File: LocalValuesDevelSupport.fth

package info (click to toggle)
fcode-utils 1.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 46,768 kB
  • sloc: ansic: 9,717; csh: 241; makefile: 129; sh: 17
file content (45 lines) | stat: -rw-r--r-- 1,448 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
\       (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
\       Licensed under the Common Public License (CPL) version 1.0
\       for full details see:
\            http://www.opensource.org/licenses/cpl1.0.php
\
\       Module Author:  David L. Paktor    dlpaktor@us.ibm.com

\  Support file for development of FCode that uses Local Values
\  FLoad this right after  LocalValuesSupport.fth
\  Remove it from your final product.

\  Exported Function:  max-local-storage-size  ( -- n )
\      Returns the measured maximum size of storage for Local Values
\      used by any given test run.  This number can be used to guide
\      the declaration of  _local-storage-size_ 
\
\       (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
\       Module Author:  David L. Paktor    dlpaktor@us.ibm.com

\  Count the current depth on a per-instance basis, 
\  but collect the maximum depth over all instances.

headers
0 instance value local-storage-depth

external
0 value max-local-storage-size
headers

\  Overload the  {push-locals}  and  {pop-locals}  routines to do this.
\  Do not suppress the overload warnings; they'll serve as a reminder.
: {pop-locals} ( #locals -- )
    local-storage-depth over - to local-storage-depth
    {pop-locals}
;

: {push-locals} ( #ilocals #ulocals -- )
   2dup + local-storage-depth +
   dup to local-storage-depth
   max-local-storage-size max
   to max-local-storage-size
   {push-locals}
;