13 \ \ A constant. If not supplied, default value of d# 64 will be used.
14 \
15 \ Functions exported:
16 \ {push-locals} ( #ilocals #ulocals -- )
17 \ {pop-locals} ( #locals -- )
18 \ _{local} ( local-var# -- addr )
19 \
20 \ Additional overloaded function:
21 \ catch \ Restore Locals after a throw
22
23 \ The user is responsible for declaring the maximum depth of the
24 \ run-time Locals stack, in storage units, by defining the
25 \ constant _local-storage-size_ before floading this file.
26 \ The definition may be created either by defining it as a constant
27 \ in the startup-file that FLOADs this and other files in the
28 \ source program, or via a command-line user-symbol definition
29 \ of a form resembling: -d '_local-storage-size_=d# 42'
30 \ (be sure to enclose it within quotes so that the shell treats
31 \ it as a single string, and, of course, replace the "42" with
32 \ the actual number you need...)
33 \ If both forms are present, the command-line user-symbol will prevail.
34 \ To measure the actual usage (in a test run), use the separate tool
35 \ found in the file LocalValuesDevelSupport.fth .
36 \ If the user omits defining _local-storage-size_ the following
37 \ nine-line sequence will supply a default:
38
39 [ifdef] _local-storage-size_
40 [defined] _local-storage-size_
41 [else]
42 [ifexist] _local-storage-size_
43 _local-storage-size_
44 [else]
45 d# 64
46 [then]
47 [then]
48
49 \ The number of storage units to allocate for the buffer is on the stack.
50 cells \ Convert to address units
51 dup \ Keep a copy around...
52 ( n ) instance buffer: locals-storage \ Use one of the copies
53
54 \ The Locals Pointer, added to the base address of locals-storage
55 \ points to the base-address of the currently active set of Locals.
56 \ Locals will be accessed as a positive offset from there.
57 \ Start the Locals Pointer at end of the buffer.
58 \ A copy of ( N ), the number of address units that were allocated
59 \ for the buffer, is still on the stack. Use it here.
60 ( n ) instance value locals-pointer
61
62 \ Support for {push-locals}
63
64 \ Error-check.
65 : not-enough-locals? ( #ilocals #ulocals -- error? )
66 + cells locals-pointer swap - 0<
67 ;
68
69 \ Error message.
|
13 \ \ A constant. If not supplied, default value of d# 64 will be used.
14 \
15 \ Functions exported:
16 \ {push-locals} ( #ilocals #ulocals -- )
17 \ {pop-locals} ( #locals -- )
18 \ _{local} ( local-var# -- addr )
19 \
20 \ Additional overloaded function:
21 \ catch \ Restore Locals after a throw
22
23 \ The user is responsible for declaring the maximum depth of the
24 \ run-time Locals stack, in storage units, by defining the
25 \ constant _local-storage-size_ before floading this file.
26 \ The definition may be created either by defining it as a constant
27 \ in the startup-file that FLOADs this and other files in the
28 \ source program, or via a command-line user-symbol definition
29 \ of a form resembling: -d '_local-storage-size_=d# 42'
30 \ (be sure to enclose it within quotes so that the shell treats
31 \ it as a single string, and, of course, replace the "42" with
32 \ the actual number you need...)
33 \ If both forms are present, the command-line user-symbol value will
34 \ be used to create a duplicate definition of the named constant,
35 \ which will prevail over the earlier definition, and will remain
36 \ available for examination during development and testing. The
37 \ duplicate-name warning, which will not be suppressed, will also
38 \ act to alert the developer of this condition.
39 \ To measure the actual usage (in a test run), use the separate tool
40 \ found in the file LocalValuesDevelSupport.fth .
41 \ If the user omits defining _local-storage-size_ the following
42 \ ten-line sequence will supply a default:
43
44 [ifdef] _local-storage-size_
45 f[ [defined] _local-storage-size_ true ]f
46 [else]
47 [ifexist] _local-storage-size_
48 f[ false ]f
49 [else]
50 f[ d# 64 true ]f
51 [then]
52 [then] ( Compile-time: size true | false )
53 [if] fliteral constant _local-storage-size_ [then]
54
55 _local-storage-size_ \ The number of storage units to allocate
56 cells \ Convert to address units
57 dup \ Keep a copy around...
58 ( n ) instance buffer: locals-storage \ Use one of the copies
59
60 \ The Locals Pointer, added to the base address of locals-storage
61 \ points to the base-address of the currently active set of Locals.
62 \ Locals will be accessed as a positive offset from there.
63 \ Start the Locals Pointer at end of the buffer.
64 \ A copy of ( N ), the number of address units that were allocated
65 \ for the buffer, is still on the stack. Use it here.
66 ( n ) instance value locals-pointer
67
68 \ Support for {push-locals}
69
70 \ Error-check.
71 : not-enough-locals? ( #ilocals #ulocals -- error? )
72 + cells locals-pointer swap - 0<
73 ;
74
75 \ Error message.
|