Ideas from S7 Scheme #6

Open
opened 2025-05-25 02:25:21 +00:00 by john · 0 comments
Owner

load-path is a list of directories to search when loading a file. [In our case, a module, or actor]


As in Common Lisp, features is a list describing what is currently loaded into s7. You can check it with the provided? function, or add something to it with provide. In my version of Snd, at startup features is:

features
(snd-24.7 snd24 snd audio snd-s7 snd-motif gsl alsa xm clm6 clm
sndlib gcc linux autoload dlopen system-extras overflow-checks ieee-float
complex-numbers ratios s7-10.12 s7)
(provided? 'gsl)
#t


help tries to find information about its argument.

(help 'caadar)
"(caadar lst) returns (car (car (cdr (car lst)))): (caadar '((1 (2 3)))) -> 2"


s7 is a let that gives access to some of s7's internal state:

version a string describing the current s7: e.g. "s7 10.0, 13-Jan-2022"
major-version an integer (10 in the example above)
minor-version an integer (0 in the example above)

print-length number of elements to print of a non-string sequence
max-string-length maximum size arg to make-string and read-string
max-list-length maximum size arg to make-list
max-vector-length maximum size arg to make-vector and make-hash-table
max-vector-dimensions make-vector dimensions limit
default-hash-table-length default size for make-hash-table (8, tables resize as needed)
initial-string-port-length 128, initial size of a input string port's buffer
max-string-port-length maximum size of a port data buffer
output-file-port-length 2048, size of an output port's buffer

history a circular buffer of recent eval entries stored backwards (use set! to add an entry)
history-size eval history buffer size if s7 built WITH_HISTORY=1
history-enabled is history buffer receiving additions (if WITH_HISTORY=1 as above)
debug determines debugging level (see debug.scm), default=0
profile profile switch (0=default, 1=gather profiling info)
profile-info the current profiling data; see profile.scm
profile-prefix name (a symbol) used to identify the current environment in profile data

default-rationalize-error 1e-12
equivalent-float-epsilon 1e-15
hash-table-float-epsilon 1e-12 (currently limited to less than 1e-3).
bignum-precision bits for bignum floats (128)
float-format-precision digits to print for floats (16) in object->string and number->string
default-random-state the default arg for random
most-positive-fixnum if not using gmp, the most positive integer ("fixnum" comes from CL)
most-negative-fixnum as above, but negative
number-separator #\null
symbol-quote? #f, so in (quote x) "quote" is a #_quote (a c-function); set to #t to get quote as a symbol
symbol-printer #f, a function to print symbols whose names contain unusual characters

safety 0 (see below)
undefined-identifier-warnings #f
undefined-constant-warnings #f
accept-all-keyword-arguments #f
autoloading? #t
openlets #t, whether any let can be open globally (this overrides all openlets)
expansions? #t, whether expansions are handled at read-time
muffle-warnings? #f, if #t s7_warn does not output anything

cpu-time run time so far (proportional to cpu cycles consumed, not wall-clock seconds)
file-names or filenames currently loaded files (a list)
catches a list of the currently active catch tags
c-types a list of c-object type names (from s7_make_c_type, etc)

stack the current stack entries
stack-top current stack location
stack-size current stack size
max-stack-size maximum stack size
stacktrace-defaults stacktrace formatting info for error handler

rootlet-size the number of globals
heap-size total cells currently available
max-heap-size maximum heap size
free-heap-size the number of currently unused cells
gc-stats 0 (or #f), 1: show GC activity, 2: heap, 4: stack, 8: protected_objects, #t = 1
gc-freed number of cells freed by the last GC pass
gc-total-freed number of cells freed so far by the GC; the total allocated is probably close to
(with-let s7 (+ (- heap-size free-heap-size) gc-total-freed))
gc-info a list: calls total-time ticks-per-second (see profile.scm)
gc-temps-size number of cells just allocated that are protected from the GC (256)
gc-resize-heap-fraction when to resize the heap (0.8); these two are aimed at GC experiments
gc-resize-heap-by-4-fraction when to get panicky about resizing the heap
gc-protected-objects vector of objects protected from the GC
memory-usage a let (environment) describing current s7 memory allocations
Use the standard environment syntax to access these fields: (s7 'stack-top). stuff.scm has the function s7->list that returns most of these fields in a list.

The compile-time defaults for some of these fields can be set:

heap-size: INITIAL_HEAP_SIZE (64000)
stack-size: INITIAL_STACK_SIZE (4096)
gc-temps-size: GC_TEMPS_SIZE (256)
bignum-precision: DEFAULT_BIGNUM_PRECISION (128)
history-size: DEFAULT_HISTORY_SIZE (8)
print-length: DEFAULT_PRINT_LENGTH (40)
gc-resize-heap-fraction: GC_RESIZE_HEAP_FRACTION (0.8)
output-file-port-length: OUTPUT_PORT_DATA_SIZE (2048)

See also WITH_WARNINGS, S7_ALIGNED, and GC_TRIGGER_SIZE.
(set! (s7 'autoloading) #f) turns off the autoloader.

The 'safety variable is an integer. Currently:

0: default.
1: no remove_from_heap (a GC optimization)
infinite loop check in eval, sort! and some iterators
immutable object check in reverse!, sort!, and fill!
more info in (s7 'history) for s7_apply_function, s7_call and s7_eval
less aggressive optimization in with-let and lambda
warnings about syntax redefinition
incoming s7_pointer checks in some FFI functions
bignum int to s7_int conversion checks
2: vector, string, and pair constants are immutable (but checks for this are currently sparse)
The debug variable controls where debug.scm is active. If it is (if debug > 0), it inserts trace calls in functions and so on. It uses dynamic-unwind to establish a catcher for the return value. (dynamic-unwind function arg) causes function to be called after the traced function has returned, passing it arg and the returned value.

(s7 'stacktrace-defaults) is a list of four integers and a boolean that tell the error handler how to format stacktrace information. The four integers are: how many frames to display, how many columns are devoted to code display, how many columns are available for a line of data, and where to place comments. The boolean sets whether the entire output should be displayed as a comment. The defaults are '(30 50 80 50 #f).


*load-path* is a list of directories to search when loading a file. [In our case, a module, or actor] --- As in Common Lisp, *features* is a list describing what is currently loaded into s7. You can check it with the provided? function, or add something to it with provide. In my version of Snd, at startup *features* is: > *features* (snd-24.7 snd24 snd audio snd-s7 snd-motif gsl alsa xm clm6 clm sndlib gcc linux autoload dlopen system-extras overflow-checks ieee-float complex-numbers ratios s7-10.12 s7) > (provided? 'gsl) #t --- help tries to find information about its argument. > (help 'caadar) "(caadar lst) returns (car (car (cdr (car lst)))): (caadar '((1 (2 3)))) -> 2" --- *s7* is a let that gives access to some of s7's internal state: version a string describing the current s7: e.g. "s7 10.0, 13-Jan-2022" major-version an integer (10 in the example above) minor-version an integer (0 in the example above) print-length number of elements to print of a non-string sequence max-string-length maximum size arg to make-string and read-string max-list-length maximum size arg to make-list max-vector-length maximum size arg to make-vector and make-hash-table max-vector-dimensions make-vector dimensions limit default-hash-table-length default size for make-hash-table (8, tables resize as needed) initial-string-port-length 128, initial size of a input string port's buffer max-string-port-length maximum size of a port data buffer output-file-port-length 2048, size of an output port's buffer history a circular buffer of recent eval entries stored backwards (use set! to add an entry) history-size eval history buffer size if s7 built WITH_HISTORY=1 history-enabled is history buffer receiving additions (if WITH_HISTORY=1 as above) debug determines debugging level (see debug.scm), default=0 profile profile switch (0=default, 1=gather profiling info) profile-info the current profiling data; see profile.scm profile-prefix name (a symbol) used to identify the current environment in profile data default-rationalize-error 1e-12 equivalent-float-epsilon 1e-15 hash-table-float-epsilon 1e-12 (currently limited to less than 1e-3). bignum-precision bits for bignum floats (128) float-format-precision digits to print for floats (16) in object->string and number->string default-random-state the default arg for random most-positive-fixnum if not using gmp, the most positive integer ("fixnum" comes from CL) most-negative-fixnum as above, but negative number-separator #\null symbol-quote? #f, so in (quote x) "quote" is a #_quote (a c-function); set to #t to get quote as a symbol symbol-printer #f, a function to print symbols whose names contain unusual characters safety 0 (see below) undefined-identifier-warnings #f undefined-constant-warnings #f accept-all-keyword-arguments #f autoloading? #t openlets #t, whether any let can be open globally (this overrides all openlets) expansions? #t, whether expansions are handled at read-time muffle-warnings? #f, if #t s7_warn does not output anything cpu-time run time so far (proportional to cpu cycles consumed, not wall-clock seconds) file-names or filenames currently loaded files (a list) catches a list of the currently active catch tags c-types a list of c-object type names (from s7_make_c_type, etc) stack the current stack entries stack-top current stack location stack-size current stack size max-stack-size maximum stack size stacktrace-defaults stacktrace formatting info for error handler rootlet-size the number of globals heap-size total cells currently available max-heap-size maximum heap size free-heap-size the number of currently unused cells gc-stats 0 (or #f), 1: show GC activity, 2: heap, 4: stack, 8: protected_objects, #t = 1 gc-freed number of cells freed by the last GC pass gc-total-freed number of cells freed so far by the GC; the total allocated is probably close to (with-let *s7* (+ (- heap-size free-heap-size) gc-total-freed)) gc-info a list: calls total-time ticks-per-second (see profile.scm) gc-temps-size number of cells just allocated that are protected from the GC (256) gc-resize-heap-fraction when to resize the heap (0.8); these two are aimed at GC experiments gc-resize-heap-by-4-fraction when to get panicky about resizing the heap gc-protected-objects vector of objects protected from the GC memory-usage a let (environment) describing current s7 memory allocations Use the standard environment syntax to access these fields: (*s7* 'stack-top). stuff.scm has the function *s7*->list that returns most of these fields in a list. The compile-time defaults for some of these fields can be set: heap-size: INITIAL_HEAP_SIZE (64000) stack-size: INITIAL_STACK_SIZE (4096) gc-temps-size: GC_TEMPS_SIZE (256) bignum-precision: DEFAULT_BIGNUM_PRECISION (128) history-size: DEFAULT_HISTORY_SIZE (8) print-length: DEFAULT_PRINT_LENGTH (40) gc-resize-heap-fraction: GC_RESIZE_HEAP_FRACTION (0.8) output-file-port-length: OUTPUT_PORT_DATA_SIZE (2048) See also WITH_WARNINGS, S7_ALIGNED, and GC_TRIGGER_SIZE. (set! (*s7* 'autoloading) #f) turns off the autoloader. The 'safety variable is an integer. Currently: 0: default. 1: no remove_from_heap (a GC optimization) infinite loop check in eval, sort! and some iterators immutable object check in reverse!, sort!, and fill! more info in (*s7* 'history) for s7_apply_function, s7_call and s7_eval less aggressive optimization in with-let and lambda warnings about syntax redefinition incoming s7_pointer checks in some FFI functions bignum int to s7_int conversion checks 2: vector, string, and pair constants are immutable (but checks for this are currently sparse) The debug variable controls where debug.scm is active. If it is (if debug > 0), it inserts trace calls in functions and so on. It uses dynamic-unwind to establish a catcher for the return value. (dynamic-unwind function arg) causes function to be called after the traced function has returned, passing it arg and the returned value. (*s7* 'stacktrace-defaults) is a list of four integers and a boolean that tell the error handler how to format stacktrace information. The four integers are: how many frames to display, how many columns are devoted to code display, how many columns are available for a line of data, and where to place comments. The boolean sets whether the entire output should be displayed as a comment. The defaults are '(30 50 80 50 #f). ---
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: john/cell#6
No description provided.