1 /*
2     This file is part of GNU APL, a free implementation of the
3     ISO/IEC Standard 13751, "Programming Language APL, Extended"
4 
5     Copyright (C) 2008-2016  Dr. Jürgen Sauermann
6 
7     This program is free software: you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation, either version 3 of the License, or
10     (at your option) any later version.
11 
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16 
17     You should have received a copy of the GNU General Public License
18     along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef __APL_TYPES_HH_DEFINED__
22 #define __APL_TYPES_HH_DEFINED__
23 
24 #ifndef __COMMON_HH_DEFINED__
25 # error This file shall not be #included directly, but by #including Common.hh
26 #endif
27 
28 #include <complex>
29 #include <memory>
30 
31 #include <math.h>
32 #include <stdint.h>
33 
34 #include "../config.h"
35 #include "Unicode.hh"
36 
37 using namespace std;
38 
39 #define APL_Float_is_class 0
40 
41 //////////////////////////////////////////////////////////////
42 // A. typedefs                                              //
43 //////////////////////////////////////////////////////////////
44 
45 /// The rank of an APL value.
46 typedef int32_t Rank;
47 typedef Rank Axis;
48 
49 typedef uint32_t uRank;
50 typedef uRank uAxis;
51 
52 typedef int32_t Depth;
53 
54 /// The dimensions of an APL value.
55 typedef int64_t ShapeItem;
56 
57 /// The SI level, 0 = global (oldest), caller at level N called function at N+1
58 typedef int SI_level;
59 
60 /// One APL character value.
61 typedef Unicode APL_Char;
62 
63 /// One APL integer value.
64 typedef int64_t APL_Integer;
65 
66 /// long long for sprintf() and friends
67 typedef long long long_long;
68 
69 /// unsigned long for sprintf() and friends
70 typedef unsigned long unsigned_long;
71 
72 inline void
Hswap(APL_Integer & i1,APL_Integer & i2)73 Hswap(APL_Integer & i1, APL_Integer & i2)
74 { const APL_Integer tmp = i1;   i1 = i2;   i2 = tmp; }
75 
76 /// One (real) APL floating point value.
77 #if APL_Float_is_class // APL_Float is a class
78 
79 #include "APL_Float_as_class.hh"
80 
release_APL_Float(APL_Float * x)81 inline void release_APL_Float(APL_Float * x)   { x->~APL_Float(); }
82 
83 #else   // APL_Float is a POD (double)
84 
85 typedef double APL_Float_Base;
86 typedef APL_Float_Base APL_Float;
87 
88 #define complex_exponent(x) exp(x)
89 #define complex_power(x, y) pow((x), (y))
90 #define complex_sqrt(x)     sqrt(x)
91 #define release_APL_Float(x)
92 
93 #endif // APL_Float is class vs. POD
94 
95 //------------------------------------------------------------------------------
96 /// One APL complex value.
97 typedef complex<APL_Float> APL_Complex;
98 //------------------------------------------------------------------------------
99 /// APL time = microseconds since Jan. 1. 1970 00:00:00 UTC
100 typedef int64_t APL_time_us;
101 
102 class Symbol;
103 class Value;
104 
105 //////////////////////////////////////////////////////////////
106 // B. enums            i                                    //
107 //////////////////////////////////////////////////////////////
108 
109 /// The possible cell types (in the ravel of an APL value)
110 enum CellType
111 {
112    CT_NONE    = 0,
113    CT_BASE    = 0x01,
114    CT_CHAR    = 0x02,
115    CT_POINTER = 0x04,
116    CT_CELLREF = 0x08,
117    CT_INT     = 0x10,
118    CT_FLOAT   = 0x20,
119    CT_COMPLEX = 0x40,
120    CT_NUMERIC = CT_INT  | CT_FLOAT   | CT_COMPLEX,
121    CT_SIMPLE  = CT_CHAR | CT_NUMERIC,
122    CT_MASK    = CT_CHAR | CT_NUMERIC | CT_POINTER | CT_CELLREF,
123 
124    // sub-types for Int and Char cells of different sizes.
125    //
126    CTS_BIT    = 0x0001000,   ///<                    1-bit  integer
127    CTS_X8     = 0x0002000,   ///< signed or unsigned 8-bit  integer or char
128    CTS_S8     = 0x0004000,   ///< signed             8-bit  integer or char
129    CTS_U8     = 0x0008000,   ///< unsigned           8-bit  integer or char
130    CTS_X16    = 0x0010000,   ///< signed or unsigned 16-bit integer or char
131    CTS_S16    = 0x0020000,   ///< signed             16-bit integer or char
132    CTS_U16    = 0x0040000,   ///< unsigned           16-bit integer or char
133    CTS_X32    = 0x0080000,   ///< signed or unsigned 32-bit integer or char
134    CTS_S32    = 0x0100000,   ///< signed             32-bit integer or char
135    CTS_U32    = 0x0200000,   ///< unsigned           32-bit integer or char
136    CTS_X64    = 0x0400000,   ///< signed or unsigned 64-bit integer
137    CTS_S64    = 0x0800000,   ///< signed             64-bit integer
138    CTS_U64    = 0x1000000,   ///< unsigned           64-bit integer
139    CTS_MASK   = 0x1FFF000,   ///<
140 };
141 
142 /// flags of a line to be printed. These flags extend CellType
143 enum Col_flags
144 {
145    has_j         = 0x0100,   // CT_COMPLEX and imag != 0
146    real_has_E    = 0x0200,   // real part scaled (exponential format)
147    imag_has_E    = 0x0400,   // imag part scaled (exponential format)
148 };
149 
150 ///  What to list, used by )SYMBOLS, )VARS, and )FUNS.
151 enum ListCategory
152 {
153   LIST_NONE    = 0,           ///< list nothing
154   LIST_VARS    = 0x01,        ///< list variables for )VARS
155   LIST_FUNS    = 0x02,        ///< list functions for )FNS
156   LIST_OPERS   = 0x04,        ///< list operators for )OPS
157   LIST_LABELS  = 0x08,        ///< list labels
158   LIST_ERASED  = 0x10,        ///< list erased symbols
159   LIST_INVALID = 0x20,        ///< list invalid symbols
160   LIST_UNUSED  = 0x40,        ///< list unused symbols
161   LIST_NAMES   = LIST_VARS    ///< list names for )NMS
162                | LIST_FUNS
163                | LIST_OPERS,
164   LIST_ALL     = 0xFFFFFFFF   ///< list everything
165 };
166 //-----------------------------------------------------------------------------
167 /// possible properties of a Value.
168 enum ValueFlags
169 {
170   VF_NONE     = 0x0000,   ///< no flags
171   VF_complete = 0x0400,   ///< CHECK called
172   VF_marked   = 0x0800,   ///< marked to detect stale
173   VF_temp     = 0x1000,   ///< computed value
174 };
175 
176 extern ostream & print_flags(ostream & out, ValueFlags flags);
177 
178 //-----------------------------------------------------------------------------
179 /// events for APL values
180 enum VH_event
181 {
182   VHE_None =  0,   ///< no event
183   VHE_Create,      ///< value created (shape is complete, ravel is not)
184   VHE_Unroll,      ///< rollback creation
185   VHE_Check,       ///< check function called (if enabled)
186   VHE_SetFlag,     ///< set a value flag
187   VHE_ClearFlag,   ///< clear a value flag
188   VHE_Erase,       ///< erase the value
189   VHE_Destruct,    ///< destruct the value
190   VHE_Error,       ///< some APL error has occurred
191   VHE_PtrNew,      ///< new Value_P created
192   VHE_PtrNew0,     ///< new Value_P with 0-pointer created
193   VHE_PtrCopy1,    ///< Value_P copied with constructor(Value_P)
194   VHE_PtrCopy2,    ///< Value_P copied with constructor(Value_P, loc)
195   VHE_PtrCopy3,    ///< Value_P copied with operator =()
196   VHE_PtrClr,      ///< Value_P cleared
197   VHE_PtrDel,      ///< Value_P deleted
198   VHE_PtrDel0,     ///< Value_P deleted (with 0 pointer)
199   VHE_TokCopy1,    ///< token with Value_P copied
200   VHE_TokMove1,    ///< token with Value_P moved
201   VHE_TokMove2,    ///< token with Value_P moved
202   VHE_Completed,   ///< incomplete ravel set to 42424242
203   VHE_Stale,       ///< stale value erased
204   VHE_Visit,       ///< test point
205 };
206 //-----------------------------------------------------------------------------
207 /// The bits in an int
208 enum Bitmask
209 {
210    BIT_0  = 1 <<  0,   ///<< dito.
211    BIT_1  = 1 <<  1,   ///<< dito.
212    BIT_2  = 1 <<  2,   ///<< dito.
213    BIT_3  = 1 <<  3,   ///<< dito.
214    BIT_4  = 1 <<  4,   ///<< dito.
215    BIT_5  = 1 <<  5,   ///<< dito.
216    BIT_6  = 1 <<  6,   ///<< dito.
217    BIT_7  = 1 <<  7,   ///<< dito.
218    BIT_8  = 1 <<  8,   ///<< dito.
219    BIT_9  = 1 <<  9,   ///<< dito.
220    BIT_10 = 1 << 10,   ///<< dito.
221    BIT_11 = 1 << 11,   ///<< dito.
222    BIT_12 = 1 << 12,   ///<< dito.
223    BIT_13 = 1 << 13,   ///<< dito.
224    BIT_14 = 1 << 14,   ///<< dito.
225    BIT_15 = 1 << 15,   ///<< dito.
226    BIT_16 = 1 << 16,   ///<< dito.
227    BIT_17 = 1 << 17,   ///<< dito.
228    BIT_18 = 1 << 18,   ///<< dito.
229    BIT_19 = 1 << 19,   ///<< dito.
230    BIT_20 = 1 << 20,   ///<< dito.
231    BIT_21 = 1 << 21,   ///<< dito.
232    BIT_22 = 1 << 22,   ///<< dito.
233    BIT_23 = 1 << 23,   ///<< dito.
234    BIT_24 = 1 << 24,   ///<< dito.
235    BIT_25 = 1 << 25,   ///<< dito.
236    BIT_26 = 1 << 26,   ///<< dito.
237    BIT_27 = 1 << 27,   ///<< dito.
238    BIT_28 = 1 << 28,   ///<< dito.
239    BIT_29 = 1 << 29,   ///<< dito.
240    BIT_30 = 1 << 30,   ///<< dito.
241    BIT_31 = 1 << 31    ///<< dito.
242 };
243 //-----------------------------------------------------------------------------
244 /// the line number of an APL function line (0 being the line to
245 /// return from the function).
246 enum Function_Line
247 {
248    Function_Retry   = -2,   // →'' in immediate execution
249    Function_Line_0  =  0,
250    Function_Line_1  =  1,
251    Function_Line_10 = 10,
252 };
253 //-----------------------------------------------------------------------------
254 ///  What is being parsed (function, immediate execution statements, or ⍎expr)
255 enum ParseMode
256 {
257    PM_FUNCTION       = 0,   ///< function execution
258    PM_STATEMENT_LIST = 1,   ///< immediate execution
259    PM_EXECUTE        = 2,   ///< execute (⍎)
260 };
261 //-----------------------------------------------------------------------------
262 /// Different ways of printing APL values.
263 enum PrintStyle
264 {
265    PST_NONE          = 0,                ///< nothing
266 
267    // character sets for inner and outer frames
268    //
269    PST_CS_NONE       = 0x00000000,       ///< ASCII chars (- | and +)
270    PST_CS_ASCII      = 0x00000001,       ///< ASCII chars (- | and +)
271    PST_CS_THIN       = 0x00000002,       ///< thin lines
272    PST_CS_THICK      = 0x00000003,       ///< thick lines
273    PST_CS_DOUBLE     = 0x00000004,       ///< double lines
274    PST_CS_MASK       = 0x0000000F,       ///< mask for line style
275 
276    PST_CS_INNER      = PST_CS_MASK,      ///< mask for inner line style
277    PST_CS_OUTER      = PST_CS_MASK << 4, ///< mask for outer line style
278 
279    // flags for numeric formatting
280    //
281    PST_SCALED        = 0x00000100,       ///< use exponential form
282    PST_NO_EXPO_0     = 0x00000200,       ///< remove E0
283    PST_NO_FRACT_0    = 0x00000400,       ///< remove trailing fractional 0s
284    PST_EMPTY_LAST    = 0x00000800,       ///< last axis is empty
285    PST_EMPTY_NLAST   = 0x00001000,       ///< some non-last axis is empty
286 
287    PST_MATRIX        = 0x00010000,       ///< multi line output
288    PST_INPUT         = 0x00020000,       ///< use '' for chars and () for nested
289    PST_PACKED        = 0x00040000,       ///< 4 byte/char
290    PST_NARS          = 0x00080000,       ///< NARS APL ⎕FMT style
291    PST_QUOTE_CHARS   = 0x00100000,       ///< quote chars and strings
292    PST_PRETTY        = 0x00200000,       ///< print control characters nicely
293 
294    PR_APL            = PST_MATRIX,       ///< normal APL output
295    PR_APL_MIN        = PST_MATRIX        ///< normal APL output w/o E0 and ...0
296                      | PST_NO_FRACT_0
297                      | PST_NO_EXPO_0,
298    PR_APL_FUN        = PST_INPUT,        ///< ⎕CR function
299    PR_Quad           = PST_INPUT,        ///< ⎕ output
300    PR_QUOTE_Quad     = PST_NONE,         ///< ⍞ output
301    PR_BOXED_CHAR     = PST_MATRIX
302                      | PST_CS_ASCII,     ///< 2 ⎕CR (ASCII chars)
303    PR_BOXED_GRAPHIC  = PST_MATRIX
304                      | PST_PRETTY
305                      | PST_CS_THICK,     ///< 3/4 ⎕CR (graphic characters)
306    PR_BOXED_GRAPHIC1 = PST_MATRIX
307                      | PST_PRETTY
308                      | PST_CS_THIN,      ///< 7/8 ⎕CR (graphic characters)
309    PR_BOXED_GRAPHIC2 = PST_MATRIX
310                      | PST_PRETTY
311                      | PST_CS_THICK
312                      | PST_CS_DOUBLE << 4, ///< DISPLAY graphic in double box
313    PR_BOXED_GRAPHIC3 = PST_MATRIX
314                      | PST_PRETTY
315                      | PST_CS_THICK
316                      | PST_QUOTE_CHARS,    ///<  29 ⎕CR (quoted chars)
317    PR_NARS           = PR_BOXED_GRAPHIC  | PST_NARS,  ///< NARS APL style
318    PR_NARS1          = PR_BOXED_GRAPHIC1 | PST_NARS,  ///< NARS APL style,
319    PR_NARS2          = PR_BOXED_GRAPHIC2 | PST_NARS,  ///< NARS APL style,
320 };
321 //-----------------------------------------------------------------------------
322 /// an offset into the body of a user-defined function. If we consider the APL
323 /// interpreter as a high-level machine that executes token in user defined
324 /// functions then this offset is the "program counter" of the high-level
325 /// machine.
326 enum Function_PC
327 {
328    Function_PC_0       =  0,   ///< the first token in a function
329    Function_PC_done    = -1,   ///< goto 0
330    Function_PC_invalid = -1    ///< dito
331 };
332 //-----------------------------------------------------------------------------
333 /// signature of a user defined function
334 enum Fun_signature
335 {
336    // atoms
337    //
338    SIG_NONE            = 0,      ///<
339    SIG_Z               = 0x01,   ///< function has a result
340    SIG_A               = 0x02,   ///< function has a left argument
341    SIG_LO              = 0x04,   ///< operator left operand
342    SIG_FUN             = 0x08,   ///< function (always set)
343    SIG_RO              = 0x10,   ///< operator right operand
344    SIG_X               = 0x20,   ///< RO has an axis
345    SIG_B               = 0x40,   ///< function has a right argument
346 
347    // operator variants
348    //
349    SIG_FUN_X           = SIG_FUN | SIG_X,     ///< function with axis
350    SIG_OP1             = SIG_LO  | SIG_FUN,   ///< monadic operator
351    SIG_OP1_X           = SIG_OP1 | SIG_X,     ///< monadic operator with axis
352    SIG_OP2             = SIG_OP1 | SIG_RO,    ///< dyadic operator
353    SIG_LORO            = SIG_LO  | SIG_RO,    ///< monadic or dyadic operator
354 
355    // argument variants
356    //
357    SIG_NIL             = SIG_NONE,            ///< niladic function
358    SIG_MON             = SIG_B,               ///< monadic function or operator
359    SIG_DYA             = SIG_A | SIG_B,       ///< dyadic function or operator
360 
361    // allowed combinations of operator variants and argument variants...
362 
363    // niladic
364    //
365    SIG_F0              = SIG_FUN | SIG_NIL,             ///< dito
366 
367    SIG_Z_F0            = SIG_Z   | SIG_F0,              ///< dito
368 
369    // monadic
370    //
371    SIG_F1_B            = SIG_MON | SIG_FUN,             ///< dito
372    SIG_F1_X_B          = SIG_MON | SIG_FUN_X,           ///< dito
373    SIG_LO_OP1_B        = SIG_MON | SIG_OP1,             ///< dito
374    SIG_LO_OP1_X_B      = SIG_MON | SIG_OP1_X,           ///< dito
375    SIG_LO_OP2_RO_B     = SIG_MON | SIG_OP2,             ///< dito
376 
377    SIG_Z_F1_B          = SIG_Z   | SIG_F1_B,            ///< dito
378    SIG_Z_F1_X_B        = SIG_Z   | SIG_F1_X_B,          ///< dito
379    SIG_Z_LO_OP1_B      = SIG_Z   | SIG_LO_OP1_B,        ///< dito
380    SIG_Z_LO_OP1_X_B    = SIG_Z   | SIG_LO_OP1_X_B,      ///< dito
381    SIG_Z_LO_OP2_RO_B   = SIG_Z   | SIG_LO_OP2_RO_B,     ///< dito
382 
383    // dyadic
384    //
385    SIG_A_F2_B          = SIG_DYA | SIG_FUN,             ///< dito
386    SIG_A_F2_X_B        = SIG_DYA | SIG_FUN_X,           ///< dito
387    SIG_A_LO_OP1_B      = SIG_DYA | SIG_OP1,             ///< dito
388    SIG_A_LO_OP1_X_B    = SIG_DYA | SIG_OP1_X,           ///< dito
389    SIG_A_LO_OP2_RO_B   = SIG_DYA | SIG_OP2,             ///< dito
390 
391    SIG_Z_A_F2_B        = SIG_Z   | SIG_A_F2_B,          ///< dito
392    SIG_Z_A_F2_X_B      = SIG_Z   | SIG_A_F2_X_B,        ///< dito
393    SIG_Z_A_LO_OP1_B    = SIG_Z   | SIG_A_LO_OP1_B,      ///< dito
394    SIG_Z_A_LO_OP1_X_B  = SIG_Z   | SIG_A_LO_OP1_X_B,    ///< dito
395    SIG_Z_A_LO_OP2_RO_B = SIG_Z   | SIG_A_LO_OP2_RO_B,   ///< dito
396 };
397 //-----------------------------------------------------------------------------
398 /// the mode that distinguishes different SI commands (SI, SIS, SINL, ]SI, ]SIS)
399 enum SI_mode
400 {
401    SIM_none       = 0x00,   ///< )SI
402    SIM_debug      = 0x01,   ///< ]SI  and ]SIS
403    SIM_statements = 0x02,   ///< )SIS and ]SIS
404    SIM_name_list  = 0x04,   ///< )SINL
405    SIM_SI         = SIM_none,
406    SIM_SIS        = SIM_statements,
407    SIM_SINL       = SIM_name_list,
408    SIM_SI_dbg     = SIM_debug,
409    SIM_SIS_dbg    = SIM_debug | SIM_statements,
410 };
411 //-----------------------------------------------------------------------------
412 /// the number of cores/tasks to be used
413 enum CoreCount
414 {
415   CCNT_UNKNOWN = -1,   ///< unknown core count
416   CCNT_0       = 0,    ///<< no core
417   CCNT_1       = 1,    ///< one core ...
418 };
419 //-----------------------------------------------------------------------------
420 /// the cores/tasks to be used
421 enum CoreNumber
422 {
423   CNUM_INVALID = -1,  ///< invalid core
424   CNUM_MASTER  = 0,   ///< the interpreter core
425   CNUM_WORKER1 = 1,   ///< the first worker core ...
426 };
427 //-----------------------------------------------------------------------------
428 /// the CPUs reported by the OS
429 enum CPU_Number
430 {
431    CPU_0 = 0   ///< the first (only) CPU
432 };
433 //-----------------------------------------------------------------------------
434 /// the number of CPUs available
435 enum CPU_count
436 {
437    CPU_CNT_1 = 1   ///< one CPU
438 };
439 //-----------------------------------------------------------------------------
440 /// the state of an assignment
441 enum Assign_state
442 {
443    ASS_none       = 0,   ///< no assignment (right of ←)
444    ASS_arrow_seen = 1,   ///< ← seen but no variable yet
445    ASS_var_seen   = 2,   ///< var and ← seen
446 };
447 //-----------------------------------------------------------------------------
448 /// the cause for something
449 enum Cause
450 {
451    NO_CAUSE       = 0,
452    CAUSE_SHUTDOWN = 1,
453    CAUSE_ERASED   = 2,
454 };
455 //-----------------------------------------------------------------------------
456 /// the CDR data types
457 enum CDR_type
458 {
459    CDR_BOOL1   = 0,   ///< 1 bit boolean
460    CDR_INT32   = 1,   ///< 32 bit integer
461    CDR_FLT64   = 2,   ///< 64 bit double
462    CDR_CPLX128 = 3,   ///< 2*64 bit complex
463    CDR_CHAR8   = 4,   ///< 8 bit char
464    CDR_CHAR32  = 5,   ///< 32 bit char
465    CDR_PROG64  = 6,   ///< 2*32 bit progression vector
466    CDR_NEST32  = 7,   ///< 32 bit pointer to nested value
467 };
468 //-----------------------------------------------------------------------------
469 /// the result of a comparison
470 enum Comp_result
471 {
472   COMP_LT = -1,   ///< less than
473   COMP_EQ =  0,   ///< equal
474   COMP_GT =  1,   ///< greter than
475 };
476 //-----------------------------------------------------------------------------
477 /// the order of a comparison
478 enum Sort_order
479 {
480    SORT_DESCENDING = 0,   ///< sort descending
481    SORT_ASCENDING  = 1,   ///< sort asscending
482 };
483 //-----------------------------------------------------------------------------
484 /// events for a symbol
485 enum Symbol_Event
486 {
487    SEV_CREATED  = 1,
488    SEV_PUSHED   = 2,
489    SEV_POPED    = 3,
490    SEV_ASSIGNED = 4,
491    SEV_ERASED   = 5,
492 };
493 //-----------------------------------------------------------------------------
494 /// Auxiliary processor numbers
495 enum AP_num
496 {
497   NO_AP          = -1,     ///< invalid AP
498   AP_NULL        = 0,      ///< invalid AP for structs using memset(0)
499   AP_GENERAL     = 0,      ///< AP for generic offers
500   AP_INTERPRETER = 1000,   ///< the AP for the APL interpreters
501   AP_FIRST_USER  = 1001,   ///< the first AP for APL users
502 };
503 //-----------------------------------------------------------------------------
504 /// longest filename
505 enum {  APL_PATH_MAX = 4096 };
506 //-----------------------------------------------------------------------------
507 /// an ID. Every internal object known to APL (primitive, ⎕xx, ...) has one
508 enum Id
509 {
510 #define pp(i, _u, v) ID_ ##   i v,
511 #define qf(i, _u, v) ID_Quad_ ## i v,
512 #define qv(i, _u, v) ID_Quad_ ## i v,
513 #define sf(i, _u, v) ID_ ##   i v,
514 #define st(i, _u, v) ID_ ##   i v,
515 
516 #include "Id.def"
517 };
518 
519 //////////////////////////////////////////////////////////////
520 // C. structs                                               //
521 //////////////////////////////////////////////////////////////
522 
523 /// three AP numbers that uniquely identify a processor
524 struct AP_num3
525 {
526    /// constructor: processor, parent, and grand-parent
AP_num3AP_num3527    AP_num3(AP_num pro = NO_AP, AP_num par = AP_NULL, AP_num gra = AP_NULL)
528    : proc(pro),
529      parent(par),
530      grand(gra)
531    {}
532 
533    /// copy \b other to \b this
operator =AP_num3534    void operator =(const AP_num3 & other)
535       {
536         proc   = other.proc;
537         parent = other.parent;
538         grand  = other.grand;
539       }
540 
541    /// true if \b this AP_num3 is equal to \b other
operator ==AP_num3542    bool operator==(const AP_num3 & other) const
543       { return proc   == other.proc   &&
544                parent == other.parent &&
545                grand  == other.grand; }
546 
547    AP_num proc;     ///< the processor
548    AP_num parent;   ///< the parent of the processor
549    AP_num grand;    ///< the parent of the parent
550 };
551 //-----------------------------------------------------------------------------
552 /// two Function_PCs indication a token range in a user defined function body
553 struct Function_PC2
554 {
555    /// a PC range
Function_PC2Function_PC2556    Function_PC2(Function_PC l, Function_PC h)
557    : low(l),
558      high(h)
559    {}
560 
561    Function_PC low;    ///< low PC  (including)
562    Function_PC high;   ///< high PC (including)
563 };
564 //-----------------------------------------------------------------------------
565 /** A single label. A label is a local variable (sym) with an integer function
566     line (in which \b sym: was specified as the first 2 tokens in the line)
567  */
568 ///  A label in a defined function
569 struct labVal
570 {
571    Symbol      * sym;    ///< The symbol for the label variable.
572    Function_Line line;   ///< The line number of the label.
573 };
574 //-----------------------------------------------------------------------------
575 /// The end and the state of an abstract iterator along one axis
576 /// (to / weight / current)
577 struct _twc
578 {
579    /// the end index (exclusive) for each axis. It can be > dimension
580    /// length for over-Take from the start.
581    ShapeItem to;
582 
583    /// weight of the dimension
584    ShapeItem weight;
585 
586    /// the current index
587    ShapeItem current;
588 };
589 //-----------------------------------------------------------------------------
590 /// The range and the state of an abstract iterator along one axis
591 /// (from / to / weight / current)
592 struct _ftwc : public _twc
593 {
594    /// the start index (inclusive) for each axis. It can be < 0 for
595    /// over-Take from the end.
596    ShapeItem from;
597 };
598 //-----------------------------------------------------------------------------
599 
600 #endif // __APL_TYPES_HH_DEFINED__
601