home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Programming / ace_gpl_release / src / ace / c / parsevar.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-04  |  5.5 KB  |  195 lines

  1. /* << ACE >> 
  2.  
  3.    -- Amiga BASIC Compiler --
  4.  
  5.    ** Parser Variables ** 
  6.    ** Copyright (C) 1998 David Benn
  7.    ** 
  8.    ** This program is free software; you can redistribute it and/or
  9.    ** modify it under the terms of the GNU General Public License
  10.    ** as published by the Free Software Foundation; either version 2
  11.    ** of the License, or (at your option) any later version.
  12.    **
  13.    ** This program is distributed in the hope that it will be useful,
  14.    ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.    ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.    ** GNU General Public License for more details.
  17.    **
  18.    ** You should have received a copy of the GNU General Public License
  19.    ** along with this program; if not, write to the Free Software
  20.    ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  21.  
  22.    Author: David J Benn
  23.      Date: 19th October-30th November, 3rd-12th December 1991,
  24.        14th,27th January 1992, 5th,7th-17th, 
  25.            23rd-24th February 1992,
  26.            14th,22nd March 1992,
  27.        21st April 1992,
  28.        2nd,11th,15th May 1992,
  29.        7th,8th,9th,11th,13th,14th,28th June 1992,
  30.        2nd-6th,8th,14th-19th,26th,28th,29th July 1992,
  31.        1st,9th August 1992,
  32.        6th,7th,22nd,28th December 1992,
  33.        28th February 1993,
  34.        6th,13th June 1993,
  35.        1st July 1993,
  36.        25th September 1993,
  37.        25th,26th October 1993,
  38.        2nd November 1993,
  39.        18th,25th December 1993,
  40.        2nd,5th January 1994,
  41.        12th June 1994,
  42.        19th,22nd August 1994,
  43.        11th March 1995
  44. */
  45.  
  46. #include "acedef.h"
  47.  
  48. /* externals */
  49. extern    int    sym;
  50. extern    int    lastsym;
  51. extern    int    obj;
  52. extern    int    typ;
  53. extern    int    errors;
  54. extern    char       id[MAXIDSIZE]; 
  55. extern    char       ut_id[MAXIDSIZE];
  56. extern    SHORT      shortval;
  57. extern    LONG       longval; 
  58. extern    float      singleval;
  59. extern    char       stringval[MAXSTRLEN];
  60. extern    SYM    *curr_item;
  61. extern    SYM    *structdef_item;
  62. extern    CODE    *curr_code;
  63. extern    STRUCM    *curr_structmem;
  64. extern    SHORT    dimsize[255];
  65. extern    BOOL    end_of_source;
  66. extern    FILE    *dest;
  67. extern    char    ch;
  68.  
  69. char   string_const_start[7] = { 'd','c','.','b',' ','"','\0' };
  70. char   string_const_end[4] = { '"',',','0','\0' };
  71.  
  72. /* --parser-- */
  73. int  table_mem[2]=0;            
  74. int  addr[2]; 
  75. int  lev;
  76.  
  77. char exit_sub_name[80];
  78.  
  79. ACELIBS acelib[NUMACELIBS],otherlib[NUMLIBS];
  80.  
  81. char librarybase[MAXIDSIZE+6];
  82. char libraryname[MAXIDSIZE+20];
  83. char bmapname[MAXIDSIZE+20];
  84. BOOL restore_a4=FALSE;
  85. BOOL restore_a5=FALSE;
  86. CODE *exit_for_cx=NULL;
  87.  
  88. /* --expression type holders-- */
  89. int  storetype,eqvtype,ortype,andtype,nottype,simptype;
  90. int  modtype,idivtype,prodtype,negtype,exptype,factype;
  91.  
  92. /* --miscellaneous parser variables-- */
  93. int  fstrcount=0;        /* PRINT format string counter */
  94. int  strconstcount=0;           /* string constant counter */
  95. int  strstorecount=0;           /* string storage counter */
  96. int  stringvarcount=0;        /* string variable counter */
  97. int  tempstrcount=0;            /* temporary string store counter */
  98. int  tempshortcount=0;        /* temporary short store counter */
  99. int  templongcount=0;        /* temporary long store counter */
  100. int  labelcount=0;              /* label counter */
  101. int  arraycount=0;            /* array counter */
  102. int  structcount=0;        /* structure counter */
  103.      
  104. char strstorename[80],strstorelabel[80];
  105. char tempstrname[80],tempstrlabel[80];
  106. char tempshortname[80],tempshortlabel[80];
  107. char templongname[80],templonglabel[80];
  108.  
  109. char numbuf[80];                /* temporary ffp/int # buffer */
  110. int  exitvalue=0;               /* compiler exit value */
  111.  
  112. BOOL mathffpused=FALSE;        /* are these libs/devs used? */
  113. BOOL mathtransused=FALSE;       
  114. BOOL dosused=FALSE;              
  115. BOOL gfxused=FALSE;
  116. BOOL intuitionused=FALSE;
  117. BOOL translateused=FALSE;
  118. BOOL narratorused=FALSE;
  119.  
  120. BOOL iffused=FALSE;        /* create+delete ILBM.library? */
  121.  
  122. BOOL basdatapresent=FALSE;    /* DATA statement(s)? */
  123. BOOL readpresent=FALSE;        /* READ statement(s)? */
  124.  
  125. BOOL cli_args=FALSE;        /* any CLI arguments? */
  126.  
  127. /* event trapping */
  128. BOOL break_event=FALSE;
  129. BOOL menu_event=FALSE;
  130. BOOL mouse_event=FALSE;
  131. BOOL timer_event=FALSE;
  132. BOOL error_event=FALSE;
  133. BOOL wdw_event=FALSE;
  134. BOOL gad_event=FALSE;
  135.  
  136. BOOL break_event_label_exists=FALSE;
  137. BOOL menu_event_label_exists=FALSE;
  138. BOOL mouse_event_label_exists=FALSE;
  139. BOOL timer_event_label_exists=FALSE;
  140. BOOL error_event_label_exists=FALSE;
  141. BOOL wdw_event_label_exists=FALSE;
  142. BOOL gad_event_label_exists=FALSE;
  143.  
  144. char break_event_label[80];
  145. char menu_event_label[80];
  146. char mouse_event_label[80];
  147. char timer_event_label[80];
  148. char error_event_label[80];
  149. char wdw_event_label[80];
  150. char gad_event_label[80];
  151.  
  152. int  break_event_branch;
  153. int  menu_event_branch;
  154. int  mouse_event_branch;
  155. int  timer_event_branch;
  156. int  error_event_branch;
  157. int  wdw_event_branch;
  158. int  gad_event_branch;
  159.  
  160. float timer_event_seconds;
  161. char  ontimer_seconds[40];
  162. BOOL  ontimerused=FALSE;
  163.  
  164. /* compiler option flags */
  165. BOOL break_opt=FALSE;        /* ctrl-c trapping */
  166.  
  167. BOOL optimise_opt=FALSE;    /* peephole optimisation */
  168.  
  169. BOOL make_icon=FALSE;        /* make icon for executable */
  170.  
  171. BOOL error_log=FALSE;        /* send all error messages to ace.err */
  172.  
  173. BOOL asm_comments=FALSE;    /* 
  174.                 ** Make each ACE source line a comment
  175.                 ** in the assembly source file.
  176.                 */
  177.  
  178. BOOL list_source=FALSE;        /* 
  179.                 ** List each line of source code as it is
  180.                 ** being compiled. 
  181.                 */
  182.  
  183. BOOL wdw_close_opt=FALSE;    /* window close trapping */
  184.  
  185. BOOL module_opt=FALSE;        /* 
  186.                 ** Determines whether A68K source file 
  187.                 ** is a code module or a complete ACE program.
  188.                 */
  189.  
  190. /* misc. flags */
  191. BOOL have_lparen=FALSE;
  192. BOOL have_equal=FALSE;            /* see assign() & push_indices() */
  193.  
  194. BOOL early_exit=FALSE;        /* set to TRUE if ctrl-c break detected */
  195.