home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / ada / adaed-1.11 / adaed-1 / Adaed-1.11.0a / ivars.ch < prev    next >
Encoding:
Text File  |  1992-02-07  |  9.3 KB  |  223 lines

  1. /*
  2.  * Copyright (C) 1985-1992  New York University
  3.  * 
  4.  * This file is part of the Ada/Ed-C system.  See the Ada/Ed README file for
  5.  * warranty (none) and distribution info and also the GNU General Public
  6.  * License for more details.
  7.  
  8.  */
  9. /*    +---------------------------------------------------+
  10.       |                                                   |
  11.       |      I N T E R P R E T E R   V A R I A B L E S    |
  12.       |                                                   |
  13.       |                    (C Version)                    |
  14.       |                                                   |
  15.       |   Adapted From Low Level SETL version written by  |
  16.       |                                                   |
  17.       |                    Monte Zweben                   |
  18.       |                 Philippe Kruchten                 |
  19.       |                 Jean-Pierre Rosen                 |
  20.       |                                                   |
  21.       |    Original High Level SETL version written by    |
  22.       |                                                   |
  23.       |                     Clint Goss                    |
  24.       |                  Tracey M. Siesser                |
  25.       |                  Bernard D. Banner                |
  26.       |                  Stephen C. Bryant                |
  27.       |                    Gerry Fisher                   |
  28.       |                                                   |
  29.       |                 C version written by              |
  30.       |                                                   |
  31.       |                  Robert B. K. Dewar               |
  32.       |                                                   |
  33.       +---------------------------------------------------+     */
  34.  
  35.  
  36. /* Revision History
  37.   19 Jun 1985, 10:11 (RBKD)
  38.   First complete version, from low level version 10-23-1984
  39.  */
  40. C#include <stdlib.h>
  41. C#include "config.h"
  42. C#include "int.h"
  43. /*  This module contains variables used in all parts of the interpretor */
  44.  
  45. /*
  46.  *  Memory lay-out
  47.  *  --------------
  48.  */
  49.  
  50. X int *stack_segments [MAX_TASKS]; /* one stack segment for each task */
  51. X int task_stackptr [MAX_TASKS];   /* stack pointers for task stacks */
  52. X unsigned int data_segments_dim;  /* dimension of data_segments */
  53. X int **data_segments;             /* one data segment for each cunit */
  54. X int *data_seglen;                /* length of data segments */
  55. X unsigned int code_segments_dim;  /* dimension of code_segments */
  56. X char **code_segments;            /* segments containing code */
  57. X int *code_seglen;                /* length of code segments */
  58. X int *cur_stack;                  /* current stack segment */
  59. X int cur_stackptr;                /* stack ptr for cur_stack */
  60. X char *cur_code;                  /* current code segment */
  61. X int num_cunits;                  /* number of compilation units */
  62.  
  63. /*
  64.  *  Context of a task
  65.  *  -----------------
  66.  */
  67.  
  68. X int cs;       /* index of current code_segment in code_segments */
  69. X int ip;       /* instruction pointer in cur_code */
  70. X int sp;       /* stack pointer */
  71. X int sfp;      /* stack frame pointer */
  72. X int bfp;      /* block frame pointer */
  73. X int exr;      /* exception register */
  74. X int lin;      /* line number for tracing */
  75.  
  76. /*
  77.  *  Global context (not preserved by context switch)
  78.  *  ------------------------------------------------
  79.  */
  80.  
  81. X int tp;                /* index of current task in stack_segments */
  82. X int *heap_next;        /* top of heap for allocation */
  83. X int heap_base;         /* segment number of heap */
  84. X int *heap_addr;        /* address of beginning of heap */
  85. X long next_clock;        /* next time to call clock_interrupts */
  86. X long time_offset;       /* cumulative skipped time for simulated time */
  87. X int next_clock_flag;   /* request to check the clock (task waiting) */
  88. X int simul_time_flag;   /* run with simulated time (versus real time) */
  89. X int time_slicing_flag; /* time slicing (vs schedule at system call) */
  90. X long time_slice;        /* length of time slice (500 ms default) */
  91. X int tasking_trace;     /* TRUE to trace tasking */
  92. X int rendezvous_trace;  /* TRUE to trace rendezvous */
  93. X int signal_trace;      /* TRUE to trace signalling */
  94. X int debug_trace;       /* TRUE for general debugging trace */
  95. X int exception_trace;   /* TRUE to trace exceptions */
  96. X int call_trace;        /* TRUE to trace calls */
  97. X int line_trace;        /* TRUE to trace line numbers */
  98. X int instruction_trace; /* TRUE to trace instructions */
  99.  
  100. /* Number of slots */
  101.  
  102. X unsigned int data_slots_dim;      /* dimension of data_slots */
  103. X char **data_slots;
  104. X unsigned int code_slots_dim;      /* dimension of code_slots */
  105. X char **code_slots;
  106. X unsigned int exception_slots_dim; /* dimension of exception_slots */
  107. X char **exception_slots;
  108.  
  109. /* Global Variables (for main interpreter) */
  110.  
  111. X int max_mem;                      /* size of a heap segment */
  112. X int w;                            /* used by GET_WORD */
  113. X struct tt_fx_range *temp_template;/* fixed point work template */
  114.  
  115. X int bse,bas1,bas2,bas3,bas4;      /* address base values */
  116. X int off,off1,off2,off3,off4;      /* address offset values */
  117. X int *ptr,*ptr1,*ptr2,*ptr3,*ptr4; /* memory addresses */
  118. X int value,val1,val2;              /* operands for int operations */
  119. X int length1,length2;              /* for array operations */
  120. X long lvalue,lval1,lval2;          /* operands for long operations */
  121. X long fval1,fval2,fvalue;          /* operands for fixed operations */
  122. X float rvalue,rval1,rval2;         /* operands for float operations */
  123. X int val_high,val_low;             /* low/high of INT range */
  124. X int result,delta;                 /* used in fixed point */
  125. X int size;                         /* size of object */
  126. X int attribute;                    /* attribute code */
  127. X int slot;                         /* for create structure */
  128. X int component_size;               /* size of array component */
  129. X long now_time;                     /* current time */
  130. X int to_type;                      /* type from template */
  131. X int discr_list[MAX_DISCR];        /* accumulate list of discriminants */
  132. X int nb,i;                         /* loop counters etc */
  133. X int overflow;                     /* overflow flag from arith routines */
  134. X int nb_discr;                     /* number of discriminants */
  135. X int nb_dim;                       /* dimension of array */
  136. X int ratio,power;                  /* used in attribute processing */
  137. X int d,n;                          /* temporaries */
  138. X int old_cs;                       /* old value of cs */
  139. X int jump;                         /* jump address */
  140. X int lim;                          /* limit in for loop */
  141. X struct bf *bfptr;                 /* pointer to block frame */
  142. X int *tfptr1,*tfptr2;              /* pointers to task frames */
  143. X int cur_col;                      /* temporary for predef */
  144.  
  145. /*
  146.  * I/O trace flags used to get trace prints when reading and writing
  147.  * intermediate files. A trace level is one of the following:
  148.  *               0           no trace
  149.  *               1           brief trace
  150.  *               2           full trace
  151.  */
  152. X int iot_ifile INIT(0); /* current trace level for ifile */
  153. X int iot_ais_r INIT(0); /* trace level for ais files read */
  154. X int iot_lib_r INIT(0); /* trace level for lib files read */
  155. X char iot_ifile_type;
  156.  
  157. X int break_point;       /* next break point */  
  158.  
  159. X int fix_val1[20];      /* fixed point intermediate values */
  160. X int fix_val2[20];     
  161. X int fix_resu[20];     
  162. X int fix_temp[20];     
  163. X int mul_fact[20];     
  164. X int div_fact[20];     
  165.  
  166. X int arith_overflow;
  167. X int sgn;
  168. X int last_task;
  169. X int *free_list INIT((int *)0);
  170. X int raise_cs;
  171. X int raise_lin;
  172. X char *raise_reason;
  173.  
  174. /*
  175.  *                             P R E D E F
  176.  */
  177.  
  178. /* Define maximum number of files and AFCB vector to match */
  179.  
  180. /*
  181.  * Note that file numbers are 1's origin subscripts into this vector, so that
  182.  * the file number value of 1 corresponds to the first entry, i.e. afcbs[0]
  183.  */
  184.  
  185. #define MAXFILES 20
  186. X struct afcb *(afcbs[MAXFILES]);
  187.  
  188. /* Variables for predef */
  189.  
  190. X int operation;         /* operation for predef. set in the main loop */
  191. X int data_exception;    /* exception to raise on data error */
  192. X int filenum;           /* number of current file */
  193. X int standard_in_file;  /* index of standard input file */
  194. X int standard_out_file; /* index of standard output file */
  195. X int current_in_file;   /* index of current default input file */
  196. X int current_out_file;  /* index of current default output file */
  197. X int current_in_file_saved;   
  198.      /* duplicate index of current default input file */
  199. X int current_out_file_saved;  
  200.      /* duplicate index of current default output file */
  201. X int file_offset;       /* Offset due to file argument in the stack */
  202.                          /* 2 if explicit file, 0 if default file */
  203. X struct tfile *tfiles;  /* linked list of temporary files */
  204.  
  205. /*
  206.  * The area work_string is used to hold an ASCIIZ string. It is a strictly
  207.  * temporary area which can be destroyed by almost any function. Anyone
  208.  * who needs to keep this string value must copy it using make_string.
  209.  *
  210.  * Note that the maximum length of strings in the Ada system is 4K bytes.
  211. */
  212.  
  213. X char work_string[4096];
  214.  
  215. /* The task stack size for created tasks is given by new_task_size,
  216.  * and the size of the main task is given by main_task_size.
  217.  * These are initialized in imain.c; and can be set by program options
  218.  * -s and -p, respectively.
  219.  */
  220.  
  221. X int main_task_size;
  222. X int new_task_size;
  223.