version 0.73.0

This commit is contained in:
2023-07-14 12:15:30 -03:00
parent 110d8a0419
commit 945dd1a809
1466 changed files with 374820 additions and 0 deletions
+116
View File
@@ -0,0 +1,116 @@
# Generated automatically from Makefile.in by configure.
#
# Makefile.in for the Tiny COBOL compiler
#
SHELL=/bin/sh
prefix=/usr/local
exec_prefix=${prefix}
RM= rm -f
MKDIR=mkdir -p
#INSTALL=/usr/bin/install -c
#INSTALL_DATA=${INSTALL} -m 644
INSTALL=install.exe
INSTALL_DATA=${INSTALL}
#YACC=yacc193
YACC=bison
LEX=flex
CCX=gcc
EXEEXT=.exe
#INSTBIN=/usr/local/bin
#INSTRC=/usr/local/share/htcobol
INSTBIN=C:/TinyCOBOL
INSTRC=C:/TinyCOBOL
RCFILE=htcobolrc
#
# Debuging features are set in htconfig.h
# -DDEBUG_COMPILER -DDEBUG_SCANNER
#
INCLUDES=-I/usr/local/include -I../lib -I..
CCXFLAGS=${INCLUDES} -Wall
CCXFLAGS1=${INCLUDES}
#LIBS=-L/usr/local/lib -lgetopts -lm
LIBS=-L/usr/local/lib -lm -lpdcurses
LDFLAGS=
MAKEDEPEND=@MAKEDEPEND@
#
# Rules for compiling .c .y .l sources
#
.SUFFIX: .c .o .y .l
.c.o:
$(CCX) $(CCXFLAGS) -c $<
#
.y.c:
$(YACC) -dv -b htcobol $<
#
.l.c:
$(LEX) -o$@ $<
#
SRCS = htcobol.y scan.l pp_parser.y pp_scanner.l \
htcobol.c htcobgen.c htcobemt.c htglobals.c reswords.c
OBJS = htcobol.tab.o scan.o pp_parser.tab.o pp_scanner.o \
htcobol.o htcobgen.o htcobemt.o htglobals.o reswords.o
PROG=htcobol.exe
all: $(PROG)
devel: all
${PROG}: ${OBJS}
$(CCX) -o $@ ${OBJS} $(LDFLAGS) $(LIBS)
# strip $@
scan.c: scan.l
$(LEX) -o$@ $<
htcobol.tab.c: htcobol.y scan.c
$(YACC) -dv -b htcobol $<
htcobgen.o: htcoboly.h
htcobol.o: htcoboly.h
$(CCX) $(CCXFLAGS) -c htcobol.c
scan.o: scan.c
$(CCX) $(CCXFLAGS1) -c scan.c
htcobol.tab.o: htcobol.tab.c
$(CCX) $(CCXFLAGS1) -c htcobol.tab.c
#
pp_scanner.c: pp_scanner.l
$(LEX) -o$@ -Ppp_yy $<
pp_parser.tab.c: pp_parser.y pp_scanner.c
$(YACC) -dv -b pp_parser -p pp_yy $<
pp_parser.tab.o: pp_parser.tab.c
$(CCX) $(CCXFLAGS1) -c pp_parser.tab.c
pp_scanner.o: pp_scanner.c
$(CCX) $(CCXFLAGS1) -c pp_scanner.c
clean:
@$(RM) $(PROG) $(OBJS) \
scan.c htcobol.tab.c htcobol.tab.h htcobol.output \
pp_parser.tab.c pp_parser.tab.h pp_scanner.c pp_parser.output
install: $(PROG)
$(MKDIR) $(INSTRC)
strip $(PROG)
${INSTALL} $(PROG) $(INSTBIN)/$(PROG)
${INSTALL_DATA} $(RCFILE) $(INSTRC)/$(RCFILE)
+110
View File
@@ -0,0 +1,110 @@
#
# Makefile.in for the Tiny COBOL compiler
#
SHELL=/bin/sh
@SET_MAKE@
prefix=@prefix@
exec_prefix=@exec_prefix@
RM= rm -f
MKDIR=mkdir -p
INSTALL=@INSTALL@
INSTALL_DATA=@INSTALL_DATA@
YACC=@YACC@
LEX=@LEX@
CCX=@CC@
EXEEXT=@exeext@
INSTBIN=@cobbin_default@
INSTRC=@cobdir_default@
RCFILE=@optfile_default@
#
# Debuging features are set in htconfig.h
# -DDEBUG_COMPILER -DDEBUG_SCANNER
#
INCLUDES=@INCLUDES@
CCXFLAGS=${INCLUDES} @CCXFLAGS@ -Wall -Wno-long-long
#CCXFLAGS1=${INCLUDES} @CCXFLAGS@
CCXFLAGS1=${INCLUDES}
LIBS=@LIBS@
LDFLAGS=@LDFLAGS@
MAKEDEPEND=@MAKEDEPEND@
#
# Rules for compiling .c .y .l sources
#
.SUFFIX: .c .o .y .l
.c.o:
$(CCX) $(CCXFLAGS) -c $<
#
.y.c:
$(YACC) -dv -b htcobol $<
#
.l.c:
$(LEX) -o$@ $<
#
SRCS = htcobol.y scan.l pp_parser.y pp_scanner.l \
htcobol.c htcobgen.c htcobemt.c htglobals.c reswords.c
OBJS = htcobol.tab.o scan.o pp_parser.tab.o pp_scanner.o \
htcobol.o htcobgen.o htcobemt.o htglobals.o reswords.o
PROG=htcobol@exeext@
all: $(PROG)
devel: all
${PROG}: ${OBJS}
$(CCX) -g -o $@ ${OBJS} $(LDFLAGS) $(LIBS)
# strip $@
scan.c: scan.l
$(LEX) -o$@ $<
htcobol.tab.c: htcobol.y scan.c
$(YACC) -dv -b htcobol $<
htcobgen.o: htcoboly.h
htcobol.o: htcoboly.h
$(CCX) $(CCXFLAGS) -c htcobol.c
scan.o: scan.c
$(CCX) $(CCXFLAGS1) -c scan.c
htcobol.tab.o: htcobol.tab.c
$(CCX) $(CCXFLAGS1) -c htcobol.tab.c
#
pp_scanner.c: pp_scanner.l
$(LEX) -o$@ -Ppp_yy $<
pp_parser.tab.c: pp_parser.y pp_scanner.c
$(YACC) -dv -b pp_parser -p pp_yy $<
pp_parser.tab.o: pp_parser.tab.c
$(CCX) $(CCXFLAGS1) -c pp_parser.tab.c
pp_scanner.o: pp_scanner.c
$(CCX) $(CCXFLAGS1) -c pp_scanner.c
clean:
@$(RM) $(PROG) $(OBJS) \
scan.c htcobol.tab.c htcobol.tab.h htcobol.output \
pp_parser.tab.c pp_parser.tab.h pp_scanner.c pp_parser.output
install: $(PROG)
strip $(PROG)
${INSTALL} -m 755 $(PROG) $(INSTBIN)/$(PROG)
$(MKDIR) $(INSTRC)
${INSTALL_DATA} $(RCFILE) $(INSTRC)/$(RCFILE)
+116
View File
@@ -0,0 +1,116 @@
# Generated automatically from Makefile.in by configure.
#
# Makefile.in for the Tiny COBOL compiler
#
SHELL=/bin/sh
prefix=/usr/local
exec_prefix=${prefix}
RM= rm -f
MKDIR=mkdir -p
#INSTALL=/usr/bin/install -c
#INSTALL_DATA=${INSTALL} -m 644
INSTALL=install.exe
INSTALL_DATA=${INSTALL}
#YACC=yacc193
YACC=bison
LEX=flex
CCX=gcc
EXEEXT=.exe
#INSTBIN=/usr/local/bin
#INSTRC=/usr/local/share/htcobol
INSTBIN=@install_dir@
INSTRC=@install_dir@
RCFILE=htcobolrc
#
# Debuging features are set in htconfig.h
# -DDEBUG_COMPILER -DDEBUG_SCANNER
#
INCLUDES=-I/usr/local/include -I../lib -I..
CCXFLAGS=${INCLUDES} -Wall
CCXFLAGS1=${INCLUDES}
#LIBS=-L/usr/local/lib -lgetopts -lm
LIBS=-L/usr/local/lib -lm -lcurses
LDFLAGS=
MAKEDEPEND=@MAKEDEPEND@
#
# Rules for compiling .c .y .l sources
#
.SUFFIX: .c .o .y .l
.c.o:
$(CCX) $(CCXFLAGS) -c $<
#
.y.c:
$(YACC) -dv -b htcobol $<
#
.l.c:
$(LEX) -o$@ $<
#
SRCS = htcobol.y scan.l pp_parser.y pp_scanner.l \
htcobol.c htcobgen.c htcobemt.c htglobals.c reswords.c
OBJS = htcobol.tab.o scan.o pp_parser.tab.o pp_scanner.o \
htcobol.o htcobgen.o htcobemt.o htglobals.o reswords.o
PROG=htcobol.exe
all: $(PROG)
devel: all
${PROG}: ${OBJS}
$(CCX) -o $@ ${OBJS} $(LDFLAGS) $(LIBS)
# strip $@
scan.c: scan.l
$(LEX) -o$@ $<
htcobol.tab.c: htcobol.y scan.c
$(YACC) -dv -b htcobol $<
htcobgen.o: htcoboly.h
htcobol.o: htcoboly.h
$(CCX) $(CCXFLAGS) -c htcobol.c
scan.o: scan.c
$(CCX) $(CCXFLAGS1) -c scan.c
htcobol.tab.o: htcobol.tab.c
$(CCX) $(CCXFLAGS1) -c htcobol.tab.c
#
pp_scanner.c: pp_scanner.l
$(LEX) -o$@ -Ppp_yy $<
pp_parser.tab.c: pp_parser.y pp_scanner.c
$(YACC) -dv -b pp_parser -p pp_yy $<
pp_parser.tab.o: pp_parser.tab.c
$(CCX) $(CCXFLAGS1) -c pp_parser.tab.c
pp_scanner.o: pp_scanner.c
$(CCX) $(CCXFLAGS1) -c pp_scanner.c
clean:
@$(RM) $(PROG) $(OBJS) \
scan.c htcobol.tab.c htcobol.tab.h htcobol.output \
pp_parser.tab.c pp_parser.tab.h pp_scanner.c pp_parser.output
install: $(PROG)
$(MKDIR) $(INSTRC)
strip $(PROG)
${INSTALL} $(PROG) $(INSTBIN)/$(PROG)
${INSTALL_DATA} $(RCFILE) $(INSTRC)/$(RCFILE)
+4721
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+6251
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
BIN
View File
Binary file not shown.
+128
View File
@@ -0,0 +1,128 @@
/*
* Copyright (C) 2001, 2002 David Essex, Rildo Pragana.
* Copyright (C) 1993, 1991 Rildo Pragana.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
#include "htconfig.h"
#include "htversion.h"
#include "htcoboly.h"
#include "htcoblib.h"
#include "htglobals.h"
int main(int argc, char *argv[])
{
int rc = 1, idx, r;
#if defined (__MINGW32__)
char *pt;
#endif
prg_name = argv[0];
#if defined (__MINGW32__)
strncpy(COBINSTDIR, argv[0], PATHMAX - 1);
COBINSTDIR[PATHMAX - 1] = '\0';
pt = strrchr(COBINSTDIR, LT_DIRSEP_CHAR);
if (pt != NULL) {
*pt = '\0';
}
else {
strncpy(COBINSTDIR, COBDIR_DEFAULT, PATHMAX - 1);
COBINSTDIR[PATHMAX - 1] = '\0';
}
#endif
/* fprintf (stderr, "htcobol debug 0: main: before initialize_setup COBINSTDIR=%s\n", COBINSTDIR); */
initialize_setup();
r = read_compiler_options();
process_verbose_options(argc, argv);
/* fprintf (stderr, "htcobol debug 1: main: after process_verbose_options\n"); */
idx = process_command_line(argc, argv);
/* fprintf (stderr, "htcobol debug 3: main: after process_command_line\n"); */
if (idx == argc) {
fprintf (stderr, "No input file name provided\n");
exit (8);
}
/* fprintf (stderr, "htcobol debug 3: main: after file input check\n"); */
strcpy (file_path, argv[idx]);
setup_filenames();
/* fprintf (stderr, "htcobol debug 4: main: after setup_filenames\n"); */
/* fprintf (stderr, "htcobol debug 5: main: HTG_compile_level_flag=%d\n", HTG_compile_level_flag); */
switch (HTG_compile_level_flag)
{
case HTG_COMPILE_LEVEL_P:
rc = process_pp();
break;
case HTG_COMPILE_LEVEL_PC:
rc = process_pp();
if (rc == 0) {
rc = process_compile();
}
break;
case HTG_COMPILE_LEVEL_PCA:
case HTG_COMPILE_LEVEL_PCAL:
case HTG_COMPILE_LEVEL_PCAM:
case HTG_COMPILE_LEVEL_PCAS:
rc = process_pp();
if (rc == 0) {
rc = process_compile();
if (rc < 8) {
rc = process_assemble();
}
}
break;
default:
break;
}
if (rc == 0) {
if (HTG_compile_level_flag == HTG_COMPILE_LEVEL_PCAL) {
if (r == 0) {
setup_ld_paths();
}
else {
setup_ld_paths_defaults();
}
rc = process_ld();
}
if (HTG_compile_level_flag == HTG_COMPILE_LEVEL_PCAM) {
rc = process_shlib_ld ();
}
if (HTG_compile_level_flag == HTG_COMPILE_LEVEL_PCAS) {
rc = process_lib_ld ();
}
}
else {
HTG_RETURN_CODE = rc;
}
do_file_cleanup();
if (HTG_verbose_verbose == TRUE ) {
printf("Compiler return code %d\n", HTG_RETURN_CODE);
}
return HTG_RETURN_CODE;
}
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
+12583
View File
File diff suppressed because it is too large Load Diff
+455
View File
@@ -0,0 +1,455 @@
/* A Bison parser, made by GNU Bison 2.4.2. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
LOW_PREC = 258,
IDSTRING = 259,
STRING = 260,
VARIABLE = 261,
VARCOND = 262,
SUBSCVAR = 263,
LABELSTR = 264,
CMD_LINE = 265,
ENVIRONMENT_VARIABLE = 266,
INKEY = 267,
ESCKEY = 268,
CHAR = 269,
MULTIPLIER = 270,
USAGENUM = 271,
ZERONUM = 272,
CONDITIONAL = 273,
TO = 274,
IS = 275,
ARE = 276,
THRU = 277,
THAN = 278,
NO = 279,
COMMENTING = 280,
DIRECTION = 281,
READ = 282,
WRITE = 283,
INPUT_OUTPUT = 284,
RELEASE = 285,
NLITERAL = 286,
CLITERAL = 287,
PORTNUM = 288,
DATE_TIME = 289,
POW_OP = 290,
OR = 291,
AND = 292,
NOT = 293,
ACCEPT = 294,
ACCESS = 295,
ADD = 296,
ADDRESS = 297,
ADVANCING = 298,
AFTER = 299,
ALL = 300,
ALPHABET = 301,
ALPHABETIC = 302,
ALPHABETIC_LOWER = 303,
ALPHABETIC_UPPER = 304,
ALPHANUMERIC = 305,
ALPHANUMERIC_EDITED = 306,
ALSO = 307,
ALTERNATE = 308,
ANY = 309,
AREA = 310,
AREAS = 311,
ASSIGN = 312,
AT = 313,
AUTHOR = 314,
AUTO = 315,
BACKGROUNDCOLOR = 316,
BEFORE = 317,
BELL = 318,
BLANK = 319,
BLINK = 320,
BLOCK = 321,
BOTTOM = 322,
BY = 323,
CALL = 324,
CALL_CONV_C = 325,
CALL_CONV_STDCALL = 326,
CALL_LOADLIB = 327,
CANCEL = 328,
CENTER = 329,
CF = 330,
CH = 331,
CHAIN = 332,
CHAINING = 333,
CHARACTER = 334,
CHARACTERS = 335,
CLASS = 336,
CLOSE = 337,
CODE = 338,
CODE_SET = 339,
COLLATING = 340,
COLOR = 341,
COLUMN = 342,
COLUMNS = 343,
COMMA = 344,
COMMON = 345,
COMPUTE = 346,
CONFIGURATION = 347,
CONSOLE = 348,
CONTAINS = 349,
CONTENT = 350,
CONTINUE = 351,
CONTROL = 352,
CONTROLS = 353,
CONVERTING = 354,
CORRESPONDING = 355,
COUNT = 356,
CURRENCY = 357,
CURSOR = 358,
DATA = 359,
DATE_COMPILED = 360,
DATE_WRITTEN = 361,
DE = 362,
DEBUGGING = 363,
DECIMAL_POINT = 364,
DECLARATIVES = 365,
DELETE = 366,
DELIMITED = 367,
DELIMITER = 368,
DEPENDING = 369,
DETAIL = 370,
DISPLAY = 371,
DISPLAY_SCREEN = 372,
DIVIDE = 373,
DIVISION = 374,
DOWN = 375,
DUPLICATES = 376,
DYNAMIC = 377,
ELSE = 378,
END = 379,
END_ACCEPT = 380,
END_ADD = 381,
END_CALL = 382,
END_CALL_LOADLIB = 383,
END_CHAIN = 384,
END_COMPUTE = 385,
END_DELETE = 386,
END_DISPLAY = 387,
END_DIVIDE = 388,
END_EVALUATE = 389,
END_IF = 390,
END_MULTIPLY = 391,
END_OF_PAGE = 392,
END_PERFORM = 393,
END_READ = 394,
END_RETURN = 395,
END_REWRITE = 396,
END_SEARCH = 397,
END_START = 398,
END_STRINGCMD = 399,
END_SUBTRACT = 400,
END_UNSTRING = 401,
END_WRITE = 402,
ENVIRONMENT = 403,
EOL = 404,
EOS = 405,
ERASE = 406,
ERROR_TOK = 407,
EVALUATE = 408,
EXCEPTION = 409,
EXIT = 410,
EXTEND = 411,
EXTERNAL = 412,
FALSE_TOK = 413,
FD = 414,
FILE_CONTROL = 415,
FILE_ID = 416,
FILE_TOK = 417,
FILLER = 418,
FINAL = 419,
FIRST = 420,
FOOTING = 421,
FOR = 422,
FOREGROUNDCOLOR = 423,
FROM = 424,
FULL = 425,
FUNCTION = 426,
GENERATE = 427,
GIVING = 428,
GLOBAL = 429,
GO = 430,
GOBACK = 431,
GROUP = 432,
HEADING = 433,
HIGHLIGHT = 434,
HIGHVALUES = 435,
IDENTIFICATION = 436,
IF = 437,
IGNORE = 438,
IN = 439,
INDEXED = 440,
INDICATE = 441,
INITIALIZE = 442,
INITIAL_TOK = 443,
INITIATE = 444,
INPUT = 445,
INSPECT = 446,
INSTALLATION = 447,
INTO = 448,
INVALID = 449,
I_O = 450,
I_O_CONTROL = 451,
JUSTIFIED = 452,
KEY = 453,
LABEL = 454,
LAST = 455,
LEADING = 456,
LEFT = 457,
LENGTH = 458,
LIMIT = 459,
LIMITS = 460,
LINAGE = 461,
LINE = 462,
LINES = 463,
LINKAGE = 464,
LISTSEP = 465,
LOCK = 466,
LOWER = 467,
LOWLIGHT = 468,
LOWVALUES = 469,
LPAR = 470,
MERGE = 471,
MINUS = 472,
MODE = 473,
MOVE = 474,
MULTIPLE = 475,
MULTIPLY = 476,
NATIVE = 477,
NEGATIVE = 478,
NEXT = 479,
NOECHO = 480,
NOTEXCEP = 481,
NULL_TOK = 482,
NUMBER = 483,
NUMBERS = 484,
NUMERIC = 485,
NUMERIC_EDITED = 486,
OBJECT_COMPUTER = 487,
OCCURS = 488,
OF = 489,
OFF = 490,
OMITTED = 491,
ON = 492,
ONLY = 493,
OPEN = 494,
OPTIONAL = 495,
ORDER = 496,
ORGANIZATION = 497,
OTHER = 498,
OUTPUT = 499,
OVERFLOW_TOK = 500,
PADDING = 501,
PAGE = 502,
PAGE_COUNTER = 503,
PARAGRAPH = 504,
PERFORM = 505,
PF = 506,
PH = 507,
PICTURE = 508,
PLUS = 509,
POINTER = 510,
POSITION = 511,
POSITIVE = 512,
PREVIOUS = 513,
PROCEDURE = 514,
PROCEED = 515,
PROGRAM = 516,
PROGRAM_ID = 517,
QUOTES = 518,
RANDOM = 519,
RD = 520,
READY = 521,
RECORD = 522,
RECORDS = 523,
REDEFINES = 524,
REEL = 525,
REFERENCE = 526,
RELATIVE = 527,
REMAINDER = 528,
REMOVAL = 529,
RENAMES = 530,
REPLACING = 531,
REPORT = 532,
REPORTS = 533,
REQUIRED = 534,
RESERVE = 535,
RESET = 536,
RETURN = 537,
RETURNING = 538,
REVERSEVIDEO = 539,
REWIND = 540,
REWRITE = 541,
RF = 542,
RH = 543,
RIGHT = 544,
ROUNDED = 545,
RUN = 546,
SAME = 547,
SCREEN = 548,
SD = 549,
SEARCH = 550,
SECTION = 551,
SECURE = 552,
SECURITY = 553,
SELECT = 554,
SENTENCE = 555,
SEPARATE = 556,
SEQUENCE = 557,
SEQUENTIAL = 558,
SET = 559,
SIGN = 560,
SIZE = 561,
SORT = 562,
SORT_MERGE = 563,
SOURCE = 564,
SOURCE_COMPUTER = 565,
SPACES = 566,
SPECIAL_NAMES = 567,
STANDARD = 568,
STANDARD_1 = 569,
STANDARD_2 = 570,
START = 571,
STATUS = 572,
STD_ERROR = 573,
STD_OUTPUT = 574,
STOP = 575,
STRINGCMD = 576,
SUBTRACT = 577,
SUM = 578,
SYNCHRONIZED = 579,
TALLYING = 580,
TAPE = 581,
TCOBPROTO1 = 582,
TCOBPROTO2 = 583,
TERMINATE = 584,
TEST = 585,
THEN = 586,
TIMES = 587,
TOKDUMMY = 588,
TOP = 589,
TRACE = 590,
TRAILING = 591,
TRUE_TOK = 592,
TYPE = 593,
UNDERLINE = 594,
UNIT = 595,
UNLOCK = 596,
UNSTRING = 597,
UNTIL = 598,
UP = 599,
UPDATE = 600,
UPON = 601,
UPPER = 602,
USAGE = 603,
USE = 604,
USING = 605,
VALUE = 606,
VALUES = 607,
VARYING = 608,
WHEN = 609,
WITH = 610,
WORKING_STORAGE = 611,
ZERO = 612,
PERIOD_TOK = 613
};
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 1685 of yacc.c */
#line 119 "htcobol.y"
struct sym *sval; /* symbol */
int ival; /* int */
struct coord_pair pval; /* lin,col */
struct lit *lval; /* literal */
unsigned long dval; /* label definition, compacted */
struct ddval { /* dual label definition */
int lb1,lb2;
} ddval;
char *str;
struct vref *rval; /* variable reference (with subscripts) */
struct refmod *rmval; /* variable with RefMod specifier */
struct string_from *sfval; /* variable list in string statement */
struct unstring_delimited *udval;
struct unstring_destinations *udstval;
struct tallying_list *tlval;
struct tallying_for_list *tfval;
struct replacing_list *repval;
struct replacing_by_list *rbval;
struct converting_struct *cvval;
struct inspect_before_after *baval;
struct scr_info *sival;
struct perf_info *pfval;
struct perform_info *pfvals;
struct sortfile_node *snval;
struct selsubject *ssbjval;
struct math_var *mval; /* math variables container list */
struct math_ose *mose; /* math ON SIZE ERROR variables container */
struct ginfo *gic; /* generic container */
struct invalid_keys *iks; /* [NOT] INVALID KEY */
struct invalid_key_element *ike; /* [NOT] INVALID KEY */
struct condition condval;
struct list *lstval; /* generic container list */
struct gvar_list *glistval; /* generic variable list */
/* Line 1685 of yacc.c */
#line 447 "htcobol.tab.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
Binary file not shown.
+4487
View File
File diff suppressed because it is too large Load Diff
+144
View File
@@ -0,0 +1,144 @@
# TinyCOBOL resource file
# Set the default compiler options
#
# COPYEXT: Specify copy file extension
# Obsolete - Use COPYBOOK_SUFFIXES
#
# Specify copybook file suffixes (extensions) used in search sequence
#COPYBOOK_SUFFIXES: .cpy:.CPY:.inc:.INC:.cob:.COB:.cbl:.CBL::
#COPYBOOK_SUFFIXES: .cpy;.CPY;.inc;.INC;.cob;.COB;.cbl;.CBL;;
# COPYBOOK_SUFFIXES - not implemented
# COPYLIBR - Specify location of copy files
# Obsolete - Use COPYBOOKS_PATH
#
# Specify copybook file locations paths used in search sequence
# (compiler default=NULL)
#COPYBOOK_PATH: /usr/local/share/htcobol/copybooks::
#COPYBOOK_PATH: /usr/local/share/htcobol/copybooks;;
COPYBOOK_PATH: C:/TinyCOBOL/copys
# Specify COBOL program file suffixes (extensions) used in search sequence
# (compiler default=.cob:.COB:.cbl:.CBL:)
#PGM_SUFFIXES: .cob:.COB:.cbl:.CBL:
PGM_SUFFIXES: .cob;.COB;.cbl;.CBL;
# Specify COBOL program default input format
# free format -> PGM_FORMAT_FREE
# fixed format -> PGM_FORMAT_FIXED
# (compiler default=free format)
PGM_FORMAT_FREE
#PGM_FORMAT_FIXED
# Specify the default main program (entry point) action
#
# auto - Use the first encountered 'STOP RUN' statement,
# and if found, generate a program entry point.
#
# first - Use the first encountered 'PROGRAM-ID' statement,
# and if found, generate a program entry point.
#
# none - Do not generate any program entry point.
#
PGM_ENTRY_POINT_AUTO
#PGM_ENTRY_POINT_NONE
#PGM_ENTRY_POINT_FIRST
# Specify the compiler default action
# P - preprocess
# PC - preprocess,compile
# PCA - preprocess,compile,assemble
# PCAL - preprocess,compile,assemble,link to executable
# PCALX - preprocess,compile,assemble,link to executable
# PCALS - Preprocess, compile, assemble, link to static library
# PCALM - Preprocess, compile, assemble, link to shared library
# (compiler default=PCAL)
COMPILE_DEFAULT: PCAL
#COMPILE_DEFAULT: PCAS
#COMPILE_DEFAULT: PCAM
#
# List contents of copybook files - not implemented
# COPYLIST=yes NOCOPYLIST=no
#COPYLIST
#NOCOPYLIST
# Include source debugging lines
# DEBUG_LINES=yes NODEBUG_LINES=no
# (compiler default= NODEBUG_LINES)
NODEBUG_LINES
#DEBUG_LINES
# Generate program listing
# LIST=yes NOLIST=no
# (compiler default=NOLIST)
#LIST
NOLIST
#
# Default program listing suffix
# (compiler default=.lis)
#PGMLIST_SUFFIX: .listing.txt
PGMLIST_SUFFIX: .lis
# Generate symbolic cross-refrence listing
# XREF=yes NOXREF=no
# (compiler default=NOXREF)
XREF
#NOXREF
# Set Assembler command name
#
ASX_CMD: as.exe
#ASX_CMD: as
#ASX_CMD: as
# Set C compiler command name
#
CCX_CMD: gcc.exe
#CCX_CMD: gcc
#CCX_CMD: gcc
#
# Set static library archiver command names
#
#ARX_CMD: ar.exe
ARX_CMD: ar
#ARX_CMD: ar
RANLIBX_CMD: ranlib.exe
#RANLIBX_CMD: ranlib
#RANLIBX_CMD: ranlib
#
# Set shared library name default (prefix$suffix)
#
#SHLIB_NAME_DEFAULT: lib$.so
SHLIB_NAME_DEFAULT: $.dll
# Library paths to pass to link step
# LD_PATH:
#
#LD_PATH: -L/usr/lib -L/opt/cobol/lib
#LD_PATH: -L/usr/lib
#LD_PATH: -L../../../lib -L../../lib
#LD_PATH:
LD_PATH: -LC:/TinyCOBOL
# Libraries to pass to the link step
# LD_LIBS: Obsolete - Use variables below
#
LD_HT1_LIBS: -lhtcobol
#LD_HT2_LIBS: -lhtcobol2
LD_MATH_LIBS: -lm
LD_READLINE_LIBS: -lreadline
LD_EXTRA_LIBS:
#LD_DCALL_LIBS: -ldl
LD_DCALL_LIBS:
#LD_DLOAD_LIBS: -lltdl
#LD_TERM_LIBS: -lncurses
LD_TERM_LIBS: -lcurses
LD_IO_LIBS: -ldb
#
#LD_FLAGS:
LD_FLAGS: -Wl,--enable-auto-import
#
+146
View File
@@ -0,0 +1,146 @@
# TinyCOBOL resource file
# Set the default compiler options
#
# COPYEXT: Specify copy file extension
# Obsolete - Use COPYBOOK_SUFFIXES
#
# Specify copybook file suffixes (extensions) used in search sequence
#COPYBOOK_SUFFIXES: .cpy:.CPY:.inc:.INC:.cob:.COB:.cbl:.CBL::
#COPYBOOK_SUFFIXES: .cpy;.CPY;.inc;.INC;.cob;.COB;.cbl;.CBL;;
# COPYBOOK_SUFFIXES - not implemented
# COPYLIBR - Specify location of copy files
# Obsolete - Use COPYBOOKS_PATH
#
# Specify copybook file locations paths used in search sequence
# (compiler default=NULL)
#COPYBOOK_PATH: /usr/local/share/htcobol/copybooks::
#COPYBOOK_PATH: /usr/local/share/htcobol/copybooks;;
#COPYBOOK_PATH: $GPFONTES
# Specify COBOL program file suffixes (extensions) used in search sequence
# (compiler default=.cob:.COB:.cbl:.CBL:)
PGM_SUFFIXES: .cob:.COB:.cbl:.CBL:
#PGM_SUFFIXES: .cob;.COB;.cbl;.CBL;
# Specify COBOL program default input format
# free format -> PGM_FORMAT_FREE
# fixed format -> PGM_FORMAT_FIXED
# (compiler default=free format)
#PGM_FORMAT_FREE
PGM_FORMAT_FIXED
# Specify the default main program (entry point) action
#
# auto - Use the first encountered 'STOP RUN' statement,
# and if found, generate a program entry point.
#
# first - Use the first encountered 'PROGRAM-ID' statement,
# and if found, generate a program entry point.
#
# none - Do not generate any program entry point.
#
PGM_ENTRY_POINT_AUTO
#PGM_ENTRY_POINT_NONE
#PGM_ENTRY_POINT_FIRST
# Specify the compiler default action
# P - preprocess
# PC - preprocess,compile
# PCA - preprocess,compile,assemble
# PCAL - preprocess,compile,assemble,link to executable
# PCAX - preprocess,compile,assemble,link to executable
# PCAS - Preprocess, compile, assemble, link to static library
# PCAM - Preprocess, compile, assemble, link to shared library
# (compiler default=PCAL)
COMPILE_DEFAULT: PCAL
#COMPILE_DEFAULT: PCAS
#COMPILE_DEFAULT: PCAM
#
# List contents of copybook files - not implemented
# COPYLIST=yes NOCOPYLIST=no
#COPYLIST
#NOCOPYLIST
# Include source debugging lines
# DEBUG_LINES=yes NODEBUG_LINES=no
# (compiler default= NODEBUG_LINES)
NODEBUG_LINES
#DEBUG_LINES
# Generate program listing
# LIST=yes NOLIST=no
# (compiler default=NOLIST)
#LIST
NOLIST
#
# Default program listing suffix
# (compiler default=.lis)
#PGMLIST_SUFFIX: .listing.txt
PGMLIST_SUFFIX: .lis
# Generate symbolic cross-refrence listing
# XREF=yes NOXREF=no
# (compiler default=NOXREF)
XREF
#NOXREF
# Set Assembler command name
#
#ASX_CMD: as.exe
ASX_CMD: as
#ASX_CMD: @asx_cmd@
# Set C compiler command name
#
#CCX_CMD: gcc.exe
CCX_CMD: gcc
#CCX_CMD: @ccx_cmd@
#
# Set static library archiver command names
#
#ARX_CMD: ar.exe
ARX_CMD: ar
#ARX_CMD: @arx_cmd@
#RANLIBX_CMD: ranlib.exe
RANLIBX_CMD: ranlib
#RANLIBX_CMD: @ranlibx_cmd@
#
# Set shared library name default (prefix$suffix)
#
#SHLIB_NAME_DEFAULT: $.dll
SHLIB_NAME_DEFAULT: lib$.so
# Library paths to pass to link step
# LD_PATH:
#
#LD_PATH: -L/usr/lib -L/opt/cobol/lib
#LD_PATH: -L/usr/lib
LD_PATH: -L../../../lib -L../../lib
#LD_PATH:
# Libraries to pass to the link step
# LD_LIBS: Obsolete - Use variables below
#
LD_HT1_LIBS: -lhtcobol
#LD_HT2_LIBS: -lhtcobol2
#LD_MATH_LIBS: -lm
LD_MATH_LIBS: @htg_ld_args_m@
LD_READLINE_LIBS: -lreadline
LD_EXTRA_LIBS: -ldl
LD_DCALL_LIBS: -ldl
#LD_DLOAD_LIBS: -lltdl
#LD_DLOAD_LIBS: @htg_ld_args_ltdl@
LD_TERM_LIBS: -lncurses
#LD_TERM_LIBS: -lpdcurses
#LD_IO_LIBS: -ldb
LD_IO_LIBS: @htg_ld_args_db@
#
LD_FLAGS:
#LD_FLAGS: -Wl,--enable-auto-import
#
+144
View File
@@ -0,0 +1,144 @@
# TinyCOBOL resource file
# Set the default compiler options
#
# COPYEXT: Specify copy file extension
# Obsolete - Use COPYBOOK_SUFFIXES
#
# Specify copybook file suffixes (extensions) used in search sequence
#COPYBOOK_SUFFIXES: .cpy:.CPY:.inc:.INC:.cob:.COB:.cbl:.CBL::
#COPYBOOK_SUFFIXES: .cpy;.CPY;.inc;.INC;.cob;.COB;.cbl;.CBL;;
# COPYBOOK_SUFFIXES - not implemented
# COPYLIBR - Specify location of copy files
# Obsolete - Use COPYBOOKS_PATH
#
# Specify copybook file locations paths used in search sequence
# (compiler default=NULL)
#COPYBOOK_PATH: /usr/local/share/htcobol/copybooks::
#COPYBOOK_PATH: /usr/local/share/htcobol/copybooks;;
COPYBOOK_PATH: C:/TinyCOBOL/copys
# Specify COBOL program file suffixes (extensions) used in search sequence
# (compiler default=.cob:.COB:.cbl:.CBL:)
#PGM_SUFFIXES: .cob:.COB:.cbl:.CBL:
PGM_SUFFIXES: .cob;.COB;.cbl;.CBL;
# Specify COBOL program default input format
# free format -> PGM_FORMAT_FREE
# fixed format -> PGM_FORMAT_FIXED
# (compiler default=free format)
PGM_FORMAT_FREE
#PGM_FORMAT_FIXED
# Specify the default main program (entry point) action
#
# auto - Use the first encountered 'STOP RUN' statement,
# and if found, generate a program entry point.
#
# first - Use the first encountered 'PROGRAM-ID' statement,
# and if found, generate a program entry point.
#
# none - Do not generate any program entry point.
#
PGM_ENTRY_POINT_AUTO
#PGM_ENTRY_POINT_NONE
#PGM_ENTRY_POINT_FIRST
# Specify the compiler default action
# P - preprocess
# PC - preprocess,compile
# PCA - preprocess,compile,assemble
# PCAL - preprocess,compile,assemble,link to executable
# PCALX - preprocess,compile,assemble,link to executable
# PCALS - Preprocess, compile, assemble, link to static library
# PCALM - Preprocess, compile, assemble, link to shared library
# (compiler default=PCAL)
COMPILE_DEFAULT: PCAL
#COMPILE_DEFAULT: PCAS
#COMPILE_DEFAULT: PCAM
#
# List contents of copybook files - not implemented
# COPYLIST=yes NOCOPYLIST=no
#COPYLIST
#NOCOPYLIST
# Include source debugging lines
# DEBUG_LINES=yes NODEBUG_LINES=no
# (compiler default= NODEBUG_LINES)
NODEBUG_LINES
#DEBUG_LINES
# Generate program listing
# LIST=yes NOLIST=no
# (compiler default=NOLIST)
#LIST
NOLIST
#
# Default program listing suffix
# (compiler default=.lis)
#PGMLIST_SUFFIX: .listing.txt
PGMLIST_SUFFIX: .lis
# Generate symbolic cross-refrence listing
# XREF=yes NOXREF=no
# (compiler default=NOXREF)
XREF
#NOXREF
# Set Assembler command name
#
ASX_CMD: as.exe
#ASX_CMD: as
#ASX_CMD: as
# Set C compiler command name
#
CCX_CMD: gcc.exe
#CCX_CMD: gcc
#CCX_CMD: gcc
#
# Set static library archiver command names
#
#ARX_CMD: ar.exe
ARX_CMD: ar
#ARX_CMD: ar
RANLIBX_CMD: ranlib.exe
#RANLIBX_CMD: ranlib
#RANLIBX_CMD: ranlib
#
# Set shared library name default (prefix$suffix)
#
#SHLIB_NAME_DEFAULT: lib$.so
SHLIB_NAME_DEFAULT: $.dll
# Library paths to pass to link step
# LD_PATH:
#
#LD_PATH: -L/usr/lib -L/opt/cobol/lib
#LD_PATH: -L/usr/lib
#LD_PATH: -L../../../lib -L../../lib
#LD_PATH:
LD_PATH: -LC:/TinyCOBOL
# Libraries to pass to the link step
# LD_LIBS: Obsolete - Use variables below
#
LD_HT1_LIBS: -lhtcobol
#LD_HT2_LIBS: -lhtcobol2
LD_MATH_LIBS: -lm
LD_READLINE_LIBS: -lreadline
LD_EXTRA_LIBS:
#LD_DCALL_LIBS: -ldl
LD_DCALL_LIBS:
#LD_DLOAD_LIBS: -lltdl
#LD_TERM_LIBS: -lncurses
LD_TERM_LIBS: -lcurses
LD_IO_LIBS: -ldb
#
#LD_FLAGS:
LD_FLAGS: -Wl,--enable-auto-import
#
+987
View File
@@ -0,0 +1,987 @@
/*
* Copyright (C) 1999-2003 Rildo Pragana, Jim Noeth,
* David Essex, Glen Colbert.
* Copyright (C) 1993,1991 Rildo Pragana.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
#ifndef __HTCOBOL_H
#define __HTCOBOL_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>
#define organization decimals
#define fdesc location
#define direction access_mode
#define call_mode access_mode
#define sort_data value2
#define record pic
#define recordsym redefines
#define filenamevar son
#define alternate brother
#define scrinfo index
#define rec_varying picstr
#define sort_file sign
/* current division (cobol source) */
#define CDIV_IDENT 1
#define CDIV_ENVIR 2
#define CDIV_DATA 3
#define CDIV_PROC 4
#define CDIV_COMMENT 5
#define CDIV_FD 6
#define CDIV_REDEF 7
#define CDIV_SUBSCRIPTS 8
#define CDIV_COPY 9
#define CDIV_COPYFILE 10
#define CDIV_EXCEPTION 11
#define CDIV_PIC 12
#define CINITIAL 15
#define CDIV_COMMENT1 16
/* symbol table selector */
#define SYTB_LIT 1
#define SYTB_VAR 2
#define SYTB_LAB 3
/* set operations */
#define SET_TO 1
#define SET_UP_BY 2
#define SET_DOWN_BY 3
/* call modes */
#define CM_REF 1
#define CM_VAL 2
#define CM_CONT 3
#define CM_DESC 4
#define CM_CHAIN 5
/* asm sections or pseudo-sections */
#define SEC_CODE 1
#define SEC_CONST 2
#define SEC_DATA 3
#define SEC_STACK 4
#define SEC_ARGS 5
#define SEC_TEMPS 6
#define SEC_WORKING SEC_DATA
#define SEC_RETURN_CODE SEC_DATA
#define SEC_FIRST_NAMED 7
/* selection subject types (evaluate statement) */
#define SSUBJ_FALSE 0
#define SSUBJ_TRUE 1
#define SSUBJ_EXPR 2
#define SSUBJ_COND 3
#define SSUBJ_STR 4
/* selection object types (evaluate statement) */
#define SOBJ_FALSE 0
#define SOBJ_TRUE 1
#define SOBJ_ANY 2
#define SOBJ_EXPR 3
#define SOBJ_NEGEXPR 4
#define SOBJ_RANGE 5
#define SOBJ_NEGRANGE 6
#define SOBJ_COND 7
#define SOBJ_NEGCOND 8
#define SOBJ_NEGSTR 9
#define SOBJ_STR 10
#define FLD_DESC_SIZE0 8
#define FLD_DESC_SIZE1 FLD_DESC_SIZE0 + 4
#define CFLD_DESC_SIZE0 12
#define CFLD_DESC_SIZE1 CFLD_DESC_SIZE0 + 8
/* math verb options */
#define MATH_OPT_ON_SIZE_ERROR 2
/* Severity codes dor hterror & yyerror */
#define TCOB_SEVERITY_INFO 0
#define TCOB_SEVERITY_WARN 4
#define TCOB_SEVERITY_ERROR 8
/*
* expression nodes
*/
struct expr {
char litflag; /* 5 for expr */
char op;
struct expr *left;
struct expr *right;
};
/*
* Storage for subscripted variable references.
* First node is the variable, other are subscripts as
* variable/literals with operations.
* For instance: VAR ( SUB1 - 5, SUB2 + 3 ) is represented as
* 5 nodes: (sy,op) = (VAR,0) (SUB1,'-') (5,',') (SUB2,'+') (3,',')
* where the numbers are (struct lit *) pointers and the variables
* are (struct sym *) pointers.
*/
struct vref {
char litflag; /* ',' = end of subscript,
'+','-' = subscript arith */
struct vref *next; /* link to next in list or NULL */
void *sym; /* variable/literal at this node */
};
/* Node for refmod's */
struct refmod {
char litflag; /* 4 = refmod */
struct sym *off; /* offset from normal start address */
struct sym *sym; /* pointer to original var: must be at the same relative offset as sym in vref */
struct sym *len; /* corrected length */
short slot; /* slot in the data section */
};
/*
* compile-time list for value ranges of 88-level variables.
* the first range is stored at the "struct sym", with sym->vr
* being a pointer to the remaining "struct vrange" nodes.
*/
struct vrange {
struct vrange *next; /* pointer to next range of values (88 var) */
struct lit *value; /* pointer to literal with initial value */
struct lit *value2; /* pointer to first/next key (sort files) */
};
/*
* Node for external data (named sections).
*/
struct named_sect {
struct named_sect *next; /* pointer to next named section */
short sec_no; /* key: section id */
char *os_name; /* name of 01 or 77 data as known by OS */
};
struct lit {
char litflag; /* 1 for literals */
struct lit *next; /* next in literals list */
char *name; /* name (value) of literal */
char type;
int decimals;
unsigned location; /* data area for literal @lit+n */
unsigned descriptor; /* descriptor @lit+n */
short sec_no; /* asm section number */
unsigned char all;
char *nick;
int access_mode; /* ie call_mode */
int len; /* length of (possibly including NULLs) string */
};
/* note: "sym" and "lit" must share the same structure */
struct sym {
char litflag; /* 1 for literals, 2 for variables */
struct sym *next; /* pointer to next symbol with same hash */
char *name; /* symbol (variable) name */
char type; /* label or elementary item or group item
9,A,X,B,C=elem;
G=group;
F=file;
R=record;
S=screen */
int decimals; /* decimal places
or organization (files ) */
unsigned location; /* offset of variable in stack area */
/* or offset file descriptor in data area */
unsigned descriptor; /* field descriptor offset in data seg */
/* or index field descriptor (files) */
short sec_no; /* asm section number */
struct sym *clone; /* NULL if this symbol is unique
otherwise, it must be further qualified */
int times; /* occurs times */
char *picstr; /* pointer to picture string saved or
pointer to rec_varying (files) */
struct sym *parent; /* pointer to parent node (level)
pointer to STATUS var (files) */
struct sym *son; /* used in field hierarchy
for files this is the assign
variable (filename) */
struct sym *brother; /* field variable at the same level or
alternate key list pointer (for indexed files) */
struct sym *ix_desc; /* key variable (in file descriptor)
pointer to fdesc (in record) */
struct scr_info *scr; /* screen info in screen items */
struct report_info *ri; /* report info in report items */
struct lit *value; /* pointer to literal with initial value */
struct lit *value2; /* pointer to first/next key (sort files) */
union {
struct vrange *vr; /* pointer to next range of values (88 var) */
struct refmod *rfm; /* offset and length of refmod */
struct sym *declarative;/* declarative section */
} refmod_redef;
int level; /* level of field
or ASSIGN TO DISK/PRINTER (files) */
int access_mode; /* access mode (files) */
/* or direction (sort files data ) or call_mode for variables */
int sign; /* sign type (0=no sign,1=trailing) or sort file */
int len; /* length of item */
char defined; /* first time defined? */
unsigned pic; /* picture offset in data segment */
/* or record offset in stack (files) */
int occurs_flg;
int linkage_flg;
struct sym *redefines; /* points to a redefined field
or record symbol (files) */
struct {
unsigned int just_r:1;
unsigned int is_pointer:1;
unsigned int blank:1;
unsigned int spec_value:1;
unsigned int value:1;
unsigned int sync:1;
unsigned int in_redefinition:1;
unsigned int separate_sign:1;
unsigned int leading_sign:1;
unsigned int optional:1;
unsigned int external:1;
unsigned int reserved:5;
}flags;
unsigned char slack; /* slack bytes inserted */
struct xref { /* xrefrence line number structure */
unsigned short size; /* array size */
unsigned short pos; /* current free array position */
unsigned int *lineno; /* line numbers array */
}xrefs;
struct occurs *occurs; /* for DEPENDING ON or null if fixed table */
char pscale; /* number of 'P's in picture */
char stype; /* subtype for type 'B': 5, X, B */
};
/* this (struct rd) is aliased with (struct sym), so tail data is garbage! */
struct rd {
char litflag;
struct rd *next;
char *name;
char type; /* 'W' for report (RD) */
struct sym *file; /* file for writing this report */
struct list *controls; /* list of controls (listing breaks) */
struct list *items; /* list of all report items */
int page_limit;
int heading;
int footing;
int first_detail;
int last_detail;
};
/* additional information for report items */
struct report_info {
int line;
int line_offset; /* PLUS <offset> given */
int column;
int value_source; /* SUM, SOURCE (from a variable), literal */
/* the actual source symbol is in (struct sym *)->value */
};
/* varying record range and actual size */
struct rec_varying {
struct lit *lmin;
struct lit *lmax;
struct sym *reclen;
};
/* selection subject set (evaluate statement) */
struct selsubject {
struct selsubject *next;
struct sym *var; /* non-numeric variables */
int type;
};
/* sort file list for using/giving clauses*/
struct sortfile_node {
struct sortfile_node *next;
struct sym *sy;
};
/* information required by the 'perform ... varying ... after' statements */
struct perf_info {
struct sym *pname1; /* symbol name */
struct sym *pname2; /* symbol name */
unsigned long ljmp; /* jump label */
unsigned long lend; /* end label */
};
struct perform_info {
struct perf_info *pf[6];
};
/* information required by the math verbs statements */
struct math_var {
struct sym *sname; /* symbol name */
/* unsigned int rounded; rounded option: 0=false, 1=true */
unsigned int opts; /* options: 0=none, 1=rounded, 2=on_size_error, 3=both */
struct math_var *next;
};
/* information required by the math ON SIZE ERROR statement */
struct math_ose {
unsigned long ose; /* 1=on_size, 2=not_on_size, 3=both */
unsigned long lbl1; /* call label name 1 - on_size */
unsigned long lbl2; /* call label name 2 - not_on_size */
unsigned long lbl4; /* bypass label name */
};
/* generic information container used by the [NOT] AT END cluases */
struct ginfo {
unsigned long sel; /* 1=true, 2=not true, 3=both */
unsigned long lbl1; /* call label name 1 - true */
unsigned long lbl2; /* call label name 2 - not true */
unsigned long lbl3; /* retrun 1 label name */
unsigned long lbl4; /* retrun 2 label name */
unsigned long lbl5; /* test bypass label name */
};
/* information required by [NOT] INVALID KEY clauses */
struct invalid_key_element {
unsigned long lbl1; /* skip label */
unsigned long lbl2; /* start label */
unsigned long lbl3; /* finish label */
};
struct invalid_keys {
struct invalid_key_element *invalid_key;
struct invalid_key_element *not_invalid_key;
};
/******* supplemental information for screen items **********/
/* this is linked at the sym->index (aliased scrinfo) */
struct scr_info {
int attr;
int line;
int column;
struct sym *foreground;
struct sym *background;
struct sym *from;
struct sym *to;
int label;
struct sym *line_var;
struct sym *column_var;
short int line_sign;
short int column_sign;
struct sym *foreground_var;
struct sym *background_var;
struct sym *color;
struct sym *size;
};
struct converting_struct {
struct sym *fromvar;
struct sym *tovar;
struct inspect_before_after *before_after;
};
struct tallying_list {
struct tallying_list *next;
struct tallying_for_list *tflist;
struct sym *count;
};
struct tallying_for_list {
struct tallying_for_list *next;
int options;
struct sym *forvar;
struct inspect_before_after *before_after;
};
struct replacing_list {
struct replacing_list *next;
int options;
struct sym *byvar;
struct replacing_by_list *replbylist;
struct inspect_before_after *before_after;
};
struct replacing_by_list {
struct replacing_by_list *next;
struct sym *replvar;
struct sym *byvar;
struct inspect_before_after *before_after;
};
struct inspect_before_after {
struct sym *before;
struct sym *after;
};
struct alternate_list {
struct alternate_list *next;
struct sym *key;
int duplicates;
};
struct unstring_delimited {
struct unstring_delimited *next;
short int all;
struct sym *var;
};
struct unstring_destinations {
struct unstring_destinations *next;
struct sym *var;
struct sym *delim;
struct sym *count;
};
struct string_from {
struct string_from *next;
struct sym *var;
struct sym *delim;
};
struct parm_list {
struct parm_list *next;
void *var;
unsigned location;
short sec_no;
};
struct coord_pair {
int lin;
int col;
};
struct index_to_table_list {
struct index_to_table_list *next;
char *idxname;
char *tablename;
char *keyname;
char seq; /* '0' = none, '1' = ASCENDING, '2' = DESCENDING */
};
union label_def {
struct {
unsigned n:15;
unsigned defined:1;
unsigned off;
}l;
unsigned long x;
};
struct condition {
struct sym *sy; /* implied first operand */
int oper; /* operator */
};
struct init_str { /* structure to hold initialization sequence */
struct sym *sy; /* pointer on symbol */
char type; /* type of symbol */
int len; /* size of symbol */
unsigned location; /* location of occurence of symbol */
struct lit *value; /* original value of symbol */
};
struct init_str_tab {
struct init_str ent[1];
};
struct list {
struct list *next;
void *var;
};
/* Generic variable list for literals, identifiers */
struct gvar_list {
union gvar {
struct gvar_list *gvar;
struct sym *sym; /* name variable */
void *var;
}u;
unsigned int attribute; /* attribute */
struct gvar_list *next;
};
/* OCCURS ... DEPENDING ON info */
struct occurs {
struct sym *depend;
int min,max;
};
/* standard field classes */
#define CLASS_NUMERIC 0
#define CLASS_ALPHABETIC 1
#define CLASS_ALPHABETIC_LOWER 2
#define CLASS_ALPHABETIC_UPPER 3
/* extended condition flags */
#define COND_UNARY 0x10
#define COND_CLASS 0x20
/* minor token numbers */
/* USAGETOK - USAGENUM */
#define USAGE_COMP 0
#define USAGE_COMP1 1
#define USAGE_COMP2 2
#define USAGE_COMP3 3
#define USAGE_INDEX 4
#define USAGE_BINARY_CHAR 5
#define USAGE_BINARY_SHORT 6
#define USAGE_BINARY_LONG 7
#define USAGE_BINARY_DOUBLE 8
#define USAGE_DISPLAY 9
#define USAGE_POINTER 10
#define USAGE_COMP5 11
#define USAGE_COMPX 12
/* DISPLAY e' um token independente deste grupo */
/* DATE-TIME */
#define DATE 0
#define TIME 1
#define DAY 2
#define DAY_OF_WEEK 3
/* OPENMD */
/*
#define INPUT 1
#define I_O 2
#define OUTPUT 3
#define EXTEND 4
*/
/* ZERONUM */
/*
#define ZERO 0
#define ZEROS 1
#define ZEROES 2
*/
/* DIVISNUM */
/*
#define IDENTIFICATION 0
#define ENVIRONMENT 1
#define DATA 2
#define PROCEDURE 3
*/
/* CONDITIONAL */
#define EQUAL 1
#define LESS 2
#define GREATER 4
#define GEQ 5
#define LEQ 3
#define NEQ 6
/* COMMENTING */
/*
#define SOURCE_COMPUTER 1
#define OBJECT_COMPUTER 2
#define AUTHOR 3
#define DATE_WRITTEN 4
#define DATE_COMPILED 5
#define INSTALLATION 6
#define SECURITY 7
*/
/* DIRECTION */
#define ASCENDING 1
#define DESCENDING 2
/* SPECIAL VARIABLES */
#define SVAR_RETURN_CODE "RETURN-CODE"
/* htcobgen.c */
extern int hash(char *s);
extern char *savename(char *s);
extern char *upcase(char *s, char *buf);
extern void update_xreflist(struct sym *as);
extern struct sym *lookup(char *s, int tab);
extern struct sym *install(char *name, int tab, int cloning);
extern struct lit *install_lit(char *name, int length, int all);
extern struct sym *lookup_label(struct sym *sy, struct sym *parent);
extern struct sym *lookup_variable(struct sym *sy, struct sym *parent);
extern struct sym *lookup_parent(struct sym *sy, struct sym *parent);
extern struct sym *lookup_for_redefines(struct sym *sy);
extern void clear_symtab(void);
extern void clear_offsets(void);
extern char sign_to_char(int digit);
extern void invert_literal_sign(struct lit *sy);
extern void check_decimal_point(struct lit *lit);
extern char *sch_convert(char *s);
extern int is_variable(struct sym *sy);
extern int is_subscripted(struct sym *sy);
extern void emit_lit(char *s, int len);
extern void emit_lit_fill(int c, int len);
extern void gen_init_value(struct lit *sy, int var_len);
extern void stabs_line(void);
extern void stabs_block(int end);
extern int gen_main_rtn(void);
extern int pgm_header(char *id);
extern void data_trail(void);
extern int adjust_linkage_vars(int start_offset);
extern void do_init_val(void);
extern void proc_header(int using);
extern void proc_trail(int using);
extern void dump_working(void);
extern void save_field_in_list(struct sym *sy);
extern void save_literal(struct lit *v, int type);
extern void save_named_sect(struct sym *sy);
extern struct lit *save_special_literal(char val, char picc, char *nick);
extern void define_switch_field(struct sym *sy, struct sym *sy2);
extern struct lit *define_num_lit(int value);
extern void save_switch_value(struct sym *sy, int value);
extern void put_disp_list(struct sym *sy);
extern char *memref(struct sym *sy);
extern char *memrefat(struct sym *sy);
extern char *memrefd(struct sym *sy);
extern void push_immed(int i);
extern void push_eax(void);
extern void push_edx(void);
extern void pop_eax(void);
extern void push_ebx(void);
extern void push_at_ebx(struct sym *sy);
extern void push_at_eax(struct sym *sy);
extern void load_at_eax(struct sym *sy);
extern void cleanup_rt_stack(void);
extern void asm_call(char *s);
extern void asm_call1(char *s);
extern void emt_cobrtl_call(char *s, char *prefix);
extern int pic_digits(struct sym *sy, char target);
extern int get_max_edt_len(struct sym *sy);
extern int query_comp_len(struct sym *sy);
extern int symlen(struct sym *sy);
extern int sym_min_pic(struct sym *sy);
extern int varsize_ch(struct sym *sy);
extern void gen_call_scr_process(struct sym *sy);
extern void add_alternate_key(struct sym *sy, int duplicates);
extern struct list *insert_list(struct list *l, void *item);
extern void free_list(struct list *l);
extern void mark_decl_list(struct list *l);
extern struct scr_info *alloc_scr_info(void);
extern struct inspect_before_after *alloc_inspect_before_after(struct inspect_before_after *ba, int before_after, struct sym *var);
extern struct converting_struct *alloc_converting_struct(struct sym *fromvar, struct sym *tovar, struct inspect_before_after *ba);
extern struct tallying_list *alloc_tallying_list(struct tallying_list *tl, struct sym *count, struct tallying_for_list *tfl);
extern struct tallying_for_list *alloc_tallying_for_list(struct tallying_for_list *tfl, int options, struct sym *forvar, struct inspect_before_after *ba);
extern struct replacing_list *alloc_replacing_list(struct replacing_list *rl, int options, struct replacing_by_list *rbl, struct sym *byvar, struct inspect_before_after *ba);
extern struct replacing_by_list *alloc_replacing_by_list(struct replacing_by_list *rbl, struct sym *replvar, struct sym *byvar, struct inspect_before_after *ba);
extern struct unstring_delimited *alloc_unstring_delimited(short int all, struct sym *var);
extern struct unstring_destinations *alloc_unstring_dest(struct sym *var, struct sym *delim, struct sym *count);
extern struct string_from *alloc_string_from(struct sym *var, struct sym *delim);
extern void gen_unstring(struct sym *var, struct unstring_delimited *delim, struct unstring_destinations *dest, struct sym *ptr, struct sym *tally);
extern void gen_stringcmd(struct string_from *sf, struct sym *sy, struct sym *ptr);
/*walter acrescentei color*/
extern void gen_display_screen(int nl, int color);
extern void gen_display_line(int dupon, int nl, int color);
extern void gen_gotoxy_expr(void);
/*walter acrescentei color*/
extern void gen_accept(struct sym *sy, int echo, int main, int color);
extern void gen_accept_from_chron(struct sym *sy, int date_fmt, int is_yyyy);
extern void gen_accept_from_inkey(struct sym *sy);
extern void gen_accept_from_cmdline(struct sym *sy);
/* walter */
extern void gen_accept_from_escapekey(struct sym *sy);
extern void gen_accept_env_var(struct sym *sy, struct lit *v);
extern struct perf_info *create_perf_info(struct sym *sy1, struct sym *sy2, unsigned long lj, unsigned long le);
extern struct perform_info *create_perform_info(void);
extern char *check_perform_variables(struct sym *sy1, struct perform_info *pi1);
extern struct expr *create_expr(char op, struct expr *left, struct expr *right);
extern void free_expr(struct expr *e);
extern void free_expr_list(void);
extern struct math_var *create_mathvar_info(struct math_var *mv, struct sym *sy, unsigned int opt);
extern void delete_mathvar_info(struct math_var *mv);
extern struct math_ose *math_on_size_error0(void);
extern struct math_ose *math_on_size_error1(struct math_ose *v);
extern void math_on_size_error2(struct math_ose *v);
extern void math_on_size_error3(struct math_ose *v);
extern struct math_ose *math_on_size_error4(struct math_ose *v, unsigned long ty);
extern void math_on_size_error5(struct math_ose *v);
extern void gen_add(struct sym *s1, struct sym *s2, int rnd);
extern void gen_subtract(struct sym *s1, struct sym *s2, int rnd);
extern void gen_multiply(struct sym *s1, struct sym *s2, struct sym *s3, int rnd);
extern void gen_compute1(struct math_var *vl1, struct sym *sy1);
extern void gen_compute2(struct math_var *vl1, struct sym *sy1, struct math_ose *v1);
extern void gen_add1(struct math_var *vl0, struct math_var *vl2, struct math_ose *v1);
extern void gen_add2(struct math_var *vl1, struct math_var *vl2, struct sym *sy1, struct math_ose *v1);
extern void gen_add3(struct math_var *vl1, struct math_var *vl2, struct math_ose *v1);
extern void gen_subtract1(struct math_var *vl0, struct math_var *vl2, struct math_ose *v1);
extern void gen_subtract2(struct math_var *vl1, struct math_var *vl2, struct sym *sy1, struct math_ose *v1);
extern void gen_subtract3(struct math_var *vl1, struct math_var *vl2, struct math_ose *v1);
extern void gen_multiply1(struct math_var *vl1, struct sym *sy1, struct math_ose *v1);
extern void gen_multiply2(struct math_var *vl1, struct sym *sy1, struct sym *sy2, struct math_ose *v1);
extern void gen_divide1(struct math_var *vl1, struct sym *sy1, struct math_ose *v1);
extern void gen_divide2(struct math_var *vl1, struct sym *sy1, struct sym *sy2, struct math_ose *v1);
extern void gen_divide4(struct sym *s1, struct sym *s2, struct sym *s3, struct sym *s4, int rnd, struct math_ose *v1);
extern struct vref *create_subscripted_var(struct sym *sy, struct vref *subs);
extern struct vref *create_subscript(struct sym *sy);
extern struct vref *add_subscript_item(struct vref *subs, char op, struct sym *item);
extern struct vref *add_subscript(struct vref *ref, struct vref *subs);
extern int check_subscripts(struct sym *subs);
extern void create_occurs_info(int min, int max, struct sym *depend);
extern struct refmod *create_refmoded_var(struct sym *sy, struct sym *syoff, struct sym *sylen);
extern int check_refmods(struct sym *var);
extern void gen_subscripted(struct vref *subs);
extern struct sym *get_variable_item(struct sym *sy);
extern void gen_temp_storage(int size);
extern void adjust_desc_length(struct sym *sy);
extern void value_to_eax(struct sym *sy);
extern void load_address(struct sym *var);
extern void load_location(struct sym *var, char *cpureg);
extern void loadloc_to_eax(struct sym *sy_p);
extern void gen_loadloc(struct sym *sy_p);
extern void set_ptr(struct sym *sy);
extern void gen_loaddesc1(struct sym *sy, int variable_length);
extern void gen_loaddesc(struct sym *sy);
extern void gen_loadvar(struct sym *sy);
extern void gen_loadval(struct sym *sy);
extern void gen_pushval(struct sym *sy);
extern void gen_store_fnres(struct sym *sy);
extern int is_numeric_sy(struct sym *sy);
extern int is_numeric_dest_sy(struct sym *sy);
extern void gen_class_check(struct sym *sy, int class);
extern void gen_inspect(struct sym *var, void *list, int operation);
extern void gen_tcob_proto1(struct sym *sy);
extern void gen_tcob_proto2(struct sym *sy1, struct sym *sy2);
extern void gen_move(struct sym *sy_src, struct sym *sy_dst);
extern void gen_moves(struct sym *sy_src, struct gvar_list *gsylst);
extern struct gvar_list *gvar_list_append(struct gvar_list *l, struct sym *item, int linenum);
extern void gen_save_chainings(struct gvar_list *gsylst);
extern void gen_save_chaining(struct sym *sy);
extern void gen_save_usings(struct gvar_list *gsylst);
extern void gen_initialize(struct sym *sy_start, int from_initializes); // walter 13-12-05
extern void gen_initializes(struct gvar_list *gsylst);
extern struct gvar_list *sort_key_list_create (struct gvar_list *item, int atrbt);
extern struct gvar_list *sort_keys_list_append (struct gvar_list *l, struct gvar_list *item);
extern void gen_movelength(struct sym *sy1, struct sym *sy2);
extern void gen_move_init(struct sym *sy_src, struct sym *sy_dst);
extern void init_field_val(struct sym *sy);
extern int check_fields(struct sym *sy);
extern void def_field_storage(struct sym *sy, int fld_len);
extern struct sym *define_label(struct sym *sy, int lab_type, struct sym
*parent, int parent_type);
extern void gen_movecorr(struct sym *sy1, struct sym *sy2);
extern void gen_addcorr(struct sym *sy1, struct sym *sy2, int rnd);
extern void gen_addcorr1(struct math_var *mv1, struct math_var *mv2, int rnd, struct math_ose *v1);
extern void gen_subtractcorr(struct sym *sy1, struct sym *sy2, int rnd);
extern void gen_subtractcorr1(struct math_var *mv1, struct math_var *mv2, int rnd, struct math_ose *v1);
extern void gen_set_complex( struct sym *idx, int which, struct sym * var);
extern void gen_set(struct sym *idx, int which, struct sym *var, int adrof_idx, int adrof_var);
extern int gen_evaluate_start(void);
extern int subject_set_size(struct selsubject *ssbj);
extern int selection_object_size(int type);
extern int push_selection_subject_copy(int level, struct selsubject *ssbj, int stkadd, int objtype);
extern int selection_subject_type(int level, struct selsubject *ssbj);
extern void gen_when_check(int level, struct selsubject *ssbj, int type, int endcase, struct sym *var);
extern void gen_bypass_when_case(int bypass);
extern int gen_end_when(int n, int endcase, int sentence);
extern void push_condition(void);
extern void gen_goto_depending(struct list *l, struct sym *sy);
extern void gen_goto(struct list *l);
extern int gen_check_zero(void);
extern unsigned long gen_at_end(int status);
extern unsigned long gen_testif(void);
extern void gen_not(void);
extern unsigned long gen_andstart(void);
extern unsigned long gen_orstart(void);
extern void gen_dstlabel(unsigned long lbl);
extern unsigned long gen_passlabel(void);
extern unsigned long gen_marklabel(void);
extern void gen_jmplabel(unsigned long lbl);
extern void gen_push_int(struct sym *sy);
extern void gen_perform_test_counter(unsigned long lbl);
extern void gen_perform_times(unsigned long lbl);
extern void gen_perform_thru(struct sym *s1, struct sym *s2);
extern void gen_perform(struct sym *sy);
extern void set_usage(struct sym *sy, int usage);
extern void gen_picture(void);
extern int save_pic_char(char c, int i);
extern void gen_SearchLoopCheck(unsigned long lbl5, struct sym *syidx, struct sym *sytbl);
extern void gen_SearchAllLoopCheck(unsigned long lbl3, struct sym *syidx, struct sym *sytbl, struct sym *syvar, unsigned long lstart, unsigned long lend);
extern void define_special_fields(void);
extern struct sym *define_temp_field(char desired_type, int desired_len);
extern int define_implicit_field(struct sym *sy, struct sym *sykey, int idxlen);
extern void Initialize_SearchAll_Boundaries(struct sym *sy, struct sym *syidx);
extern struct sym *determine_table_index_name(struct sym *sy);
extern void define_field(int level, struct sym *sy);
extern struct sym *alloc_filler(void);
extern struct selsubject *save_sel_subject(int type, struct selsubject *ssubj, struct sym *sy);
extern void release_sel_subject(int label, struct selsubject *ssbj);
extern void compute_subject_set_size(struct selsubject *ssbj);
extern int set_field_value_sw(struct sym *sy, int times);
extern int set_field_length(struct sym *sy, int times);
extern unsigned field_alignment(struct sym *sy, unsigned location);
extern void set_field_location(struct sym *sy, unsigned location);
extern void scr_set_column(struct scr_info *si, struct sym *sy, int plus_minus);
extern void scr_set_line(struct scr_info *si, struct sym *sy, int plus_minus);
extern void save_report(struct sym *rep, struct sym *file);
extern void update_report_field(struct sym *sy);
extern void update_screen_field(struct sym *sy, struct scr_info *si);
extern void update_renames_field(struct sym *sy1, struct sym *sy2);
extern void update_field(struct sym *sy);
extern void close_fields(void);
extern void resolve_labels(void);
extern void open_section(struct sym *sect);
extern void close_section(void);
extern char *label_name(struct sym *lab);
extern char *var_name(struct sym *sy);
extern void close_paragr(void);
extern void open_paragr(struct sym *paragr);
extern void gen_stoprun(void);
extern void gen_exit(int code);
extern void set_variable_values(struct lit *v1, struct lit *v2);
extern void gen_condition(struct sym *sy);
extern void gen_compare_exp(int value);
extern void gen_compare(struct sym *s1, int value, struct sym *s2);
extern void assign_expr(struct sym *sy, int opt, char end);
extern int push_expr(struct sym *sy);
extern int push_subexpr(struct sym *sy);
extern void add_expr(void);
extern void subtract_expr(void);
extern void multiply_expr(void);
extern void divide_expr(void);
extern void pow_expr(void);
extern void gen_save_filedesc(struct sym *f);
extern void alloc_file_entry(struct sym *f);
extern void dump_alternate_keys(struct sym *r, struct alternate_list *alt);
extern void dump_fdesc(void);
extern void gen_fdesc(struct sym *f, struct sym *r);
extern void gen_status(struct sym *f);
extern void gen_perform_decl(struct sym *f);
extern struct sortfile_node *alloc_sortfile_node(struct sym *sy);
extern struct sym *create_status_register(char *name);
extern void gen_sort_using(struct sym *f, struct sortfile_node *sn);
extern void gen_sort_giving(struct sym *f, struct sortfile_node *sn);
extern void gen_sort(struct sym *f);
extern void gen_save_filevar(struct sym *f, struct sym *buf);
extern void gen_save_sort_fields( struct sym *f, struct sym *buf );
extern void gen_open(int mode, struct sym *f);
extern void gen_close_sort(struct sym *f);
extern void gen_close(struct sym *f);
extern int gen_reads(struct sym *f, struct sym *buf, struct sym *key,
int next_prev, int sel, int withlock );
extern void gen_return_stmt(struct sym *f, struct sym *buf);
extern void gen_read(struct sym *f, struct sym *buf, struct sym *key,
int withlock);
extern void gen_read_next(struct sym *f, struct sym *buf, int next_prev,
int withlock);
extern void gen_release(struct sym *r, struct sym *buf);
extern void gen_write(struct sym *r, struct sym *advar, struct sym *buf, int opt);
extern void gen_rewrite(struct sym *r, struct sym *buf);
extern void gen_start(struct sym *f, int cond, struct sym *key);
extern void gen_delete(struct sym *f);
extern void set_rec_varying_info(struct sym *f, struct lit *lmin, struct lit *lmax, struct sym *reclen);
extern void gen_check_varying(struct sym *f);
extern void gen_get_switches();
extern void gen_set_switch(struct sym *var, struct sym *sy);
extern struct list *chain_var(struct sym *sy);
extern void gen_push_using(struct sym *sy);
extern void gen_save_using(struct sym *sy);
extern void gen_enter_runelement();
extern unsigned long int emt_call(struct lit *v, int stack_size, int exceplabel, int notexceplabel,struct sym *ret);
extern unsigned long int emt_call_loadlib(struct lit *v);
extern int begin_on_except(void);
extern void check_call_except(int excep, int notexcep, int exceplabel, int notexceplabel, int endlabel);
/*extern void gen_inline_intrinsic(struct sym *v, short name_len, struct sym *temporary);*/
extern struct sym *gen_intrinsic_call(struct sym *v);
extern short get_std_val(struct sym *sy);
extern int get_nb_fields(struct sym *sy, int sw_val);
extern int build_init_str(struct sym *sy, int nb_fields);
extern void gen_from_init_str(int nb_fields);
extern void gen_init_str(struct sym *sy, char init_ctype, int len);
extern void mark_actives(int first, int last);
extern void dump_symbols(void);
extern void chg_underline(char *s);
extern struct ginfo *ginfo_container0(void);
extern struct ginfo *ginfo_container1(struct ginfo *v);
extern void ginfo_container2(struct ginfo *v, unsigned long ty);
extern struct ginfo *ginfo_container3(struct ginfo *v, unsigned long ty);
extern void ginfo_container4(struct ginfo *v);
extern struct invalid_key_element * gen_before_invalid_key ();
extern struct invalid_key_element * gen_after_invalid_key (struct invalid_key_element *p);
extern struct invalid_keys * gen_invalid_keys (struct invalid_key_element *p1, struct invalid_key_element *p2);
extern void gen_test_invalid_keys (struct invalid_keys *p, struct sym *f, int fs);
extern int sort_exref_compare(const void *z1, const void *z2);
extern int main(int argc, char *argv[]);
/* htcobol.c */
extern void opt_is(int i);
extern void hterror(int erno, int severity, char *s, ...);
extern void yywarn(char *s, ...);
extern void yyerror(char *s, ...);
extern int yyparse(void);
/* pp_parser.tab.c */
extern void pp_yyerror(char *s, ...);
extern int pp_yyparse(void);
/* htglobals.c */
extern int process_command_line(int argc, char *argv[]);
extern void do_file_cleanup(void);
extern int process_assemble(void);
extern int process_ld(void);
extern int process_shlib_ld(void);
extern int process_lib_ld(void);
extern int read_compiler_options(void);
extern int check_option(char *option_in, char *arg);
extern void turn_on_list_mode(void);
extern void turn_off_list_mode(void);
extern void turn_on_xref(void);
extern void turn_off_xref(void);
extern void pass_options (char *optlst);
extern int pexec(char *cmdstr);
extern void process_verbose_options (int ac, char *av[]);
extern int find_copybook_file(char *fname, char *lname);
/* scan.c */
extern int yylex(void);
extern void yyrestart(FILE *input_file);
extern int is_integer_token(char *tok);
extern int is_valid_identifier(char *tok);
extern int lex_fgets(char *buf, int maxsize);
extern void dcs(void);
extern char *copy_strip_spaces(char *s);
extern void add_copy_replacement(char *orig_value, char *replacement);
extern void copy_do_replacements(char *buffer);
extern void copy_switch(char *filename);
extern struct reserved_sym *lookup_reserved(char *s);
extern void install_reserved(void);
extern int reserved(char *s);
extern struct intrinsic_sym *lookup_intrinsic(char *s);
extern void scdebug(char *fmt, ...);
extern int yywrap(void);
/* reswords.c */
/* Enumerate the types of intrinsic functions */
enum {
ITYPE_FLOAT,
ITYPE_INT,
ITYPE_DATE,
ITYPE_DATETIME,
ITYPE_JULIANDATE,
ITYPE_YEAR,
ITYPE_ALPHA,
ITYPE_INLINE
};
struct intrinsic_function {
char *name;
char function_type;
short args;
};
struct intrinsic_function *lookup_intrinsic_function( char *s );
#define ANY_NUMBER 32767
#endif
+2404
View File
File diff suppressed because it is too large Load Diff
+390
View File
@@ -0,0 +1,390 @@
/*
* Copyright (C) 1999 - 2002, Glen Colbert, David Essex, Rildo Pragana.
* Copyright (C) 1993, 1991 Rildo Pragana.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
#ifndef _HTGLOBALS_H
#define _HTGLOBALS_H
/* ***********************************************
* * Global compiler variables *
* ***********************************************/
#define PATHMAX 120
#define PATHMAX1 (1024 * 4)
#define PATHMAX2 256
#define PATHMAX3 1024
#define CHR_SQUOTE '\''
#define CHR_DQUOTE '"'
#define CHR_EOS '\0'
#define CHR_ASTERIX '*'
#define CHR_CR '\r'
#define CHR_LF '\n'
#define STR_DASH '-'
#define STR_UNDERSCORE '_'
#define CHR_SLASH '/'
#ifndef __MINGW32__
#define STR_SEARCH_SUFFIXES ".cpy:.CPY:.cob:.COB:.cbl:.CBL::"
#define CHR_COLEN ':'
#define STR_COLEN ":"
#else
#define STR_SEARCH_SUFFIXES ".cpy;.CPY;.cob;.COB;.cbl;.CBL;;"
#define CHR_COLEN ';'
#define STR_COLEN ";"
#endif
/* #define DEBUG_COBPP 1 */
#ifdef DEBUG_COBPP
#define DEBUG_COBPP_PP 1
#define DEBUG_COBPP_SCANNER 1
#define DEBUG_COBPP_PARSER 1
#endif
#define STATE_FLIT_LNONE 1
#define STATE_FNAME_LNONE 2
#define STATE_FLIT_LLIT 3
#define STATE_FLIT_LNAME 4
#define STATE_FNAME_LLIT 5
#define STATE_FNAME_LNAME 6
#define FORMAT_FIXED 'f'
#define FORMAT_FREE 'x'
#ifndef __MINGW32__
#ifndef LT_DIRSEP_CHAR
#define LT_DIRSEP_CHAR '/'
#endif
#ifndef LT_DIRSEP_STR
#define LT_DIRSEP_STR "/"
#endif
# ifndef LT_PATHSEP_CHAR
# define LT_PATHSEP_CHAR ':'
# endif
# ifndef LT_PATHSEP_STR
# define LT_PATHSEP_STR ":"
# endif
# ifndef TMPDIR_DEFAULT_STR
# define TMPDIR_DEFAULT_STR "/tmp"
# endif
#define HTG_PGM_SUFFIXES ".cob:.COB:.cbl:.CBL:"
#else /* __MINGW32__*/
#ifndef LT_DIRSEP_CHAR
#define LT_DIRSEP_CHAR '\\'
#endif
#ifndef LT_DIRSEP_STR
#define LT_DIRSEP_STR "\\"
#endif
# ifndef LT_PATHSEP_CHAR
# define LT_PATHSEP_CHAR ';'
# endif
# ifndef LT_PATHSEP_STR
# define LT_PATHSEP_STR ";"
# endif
# ifndef TMPDIR_DEFAULT_STR
/*#define TMPDIR_DEFAULT_STR "C:/windows/temp" */
# define TMPDIR_DEFAULT_STR "G:/tmp"
# endif
# define HTG_PGM_SUFFIXES ".cob;.COB;.cbl;.CBL;"
#endif /*__MINGW32__*/
#define SUFFIX_SEP_STR "."
#define SUFFIX_SEP_CHAR '.'
#define SHLIB_SEP_STR "$"
#define SHLIB_SONAME_STR "-soname,"
#define HTG_FILE_GAS_SUFFIX ".s"
#define HTG_FILE_PPOUT_SUFFIX ".i"
#define HTG_FILE_OBJECT_SUFFIX ".o"
#define HTG_FILE_LIB_SUFFIX ".a"
#if defined (__WINDOWS__)
#define HTG_FILE_SHLIB_SUFFIX ".dll"
#else
#define HTG_FILE_SHLIB_SUFFIX ".so"
#endif
#define RTL_CALL(module) (emt_cobrtl_call(module, lib_prefix))
#define HTG_COBOPT "TCOB_OPTIONS"
#define HTG_COBDIR "TCOB_OPTIONS_PATH"
/* #define HTG_COBPPDIR "TCOB_PP_PATH" */
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
#define MAXWORDSIZE 64000
#define MAXNAMEBUF 300
#define START_STACK_ADJUST 20
#define SYMBUF_SIZE 128
#define HASHLEN 100
#define INIT 1
/*#define ARGCOUNT 17 */
/* Define if you have the dl library (-ldl). */
/* Set run time library loading feature. */
/* #undef WANT_DYNAMIC_LIBS */
/* #undef HAVE_LIBDL */
/* Define if you have the readline library (-lreadline). */
/* Set use readline library features. */
/* #undef HAVE_LIBREADLINE */
/* #undef WANT_READLINE */
#define HTG_CMDOPTION_LIST "aB:cCDe:EFghI:kL:l:mM:no:PST:tXxW:vVz"
/*#define HTG_RESOPT_ANS85 2000 */
/*#define HTG_RESOPT_NOANS85 2001 */
/*#define HTG_RESOPT_COPYEXT 2002 */
/*#define HTG_RESOPT_COPYLBR 2003 */
#define HTG_RESOPT_COPYLIST 2004
#define HTG_RESOPT_NOCOPYLIST 2005
#define HTG_RESOPT_LIST 2006
#define HTG_RESOPT_NOLIST 2007
#define HTG_RESOPT_LD_PATH 2008
/*#define HTG_RESOPT_LD_LIBS 2009 */
#define HTG_RESOPT_XREF 2010
#define HTG_RESOPT_NOXREF 2011
#define HTG_RESOPT_PGM_SUFFIXES 2012
#define HTG_RESOPT_LD_IO_LIBS 2013
#define HTG_RESOPT_LD_TERM_LIBS 2014
#define HTG_RESOPT_LD_DCALL_LIBS 2015
#define HTG_RESOPT_LD_HT1_LIBS 2016
#define HTG_RESOPT_LD_HT2_LIBS 2017
#define HTG_RESOPT_LD_EXTRA_LIBS 2018
#define HTG_RESOPT_LD_READLINE_LIBS 2019
#define HTG_RESOPT_PGM_FORMAT_FREE 2020
#define HTG_RESOPT_PGM_FORMAT_FIXED 2021
#define HTG_RESOPT_INCLUDE_PATH 2022
#define HTG_RESOPT_COPYBOOK_SUFFIXES 2023
#define HTG_RESOPT_CCX_CMD 2024
#define HTG_RESOPT_ASX_CMD 2025
#define HTG_RESOPT_ARX_CMD 2026
#define HTG_RESOPT_RANLIBX_CMD 2027
#define HTG_RESOPT_LD_MATH_LIBS 2040
#define HTG_RESOPT_PGMLIST_SUFFIX 2041
#define HTG_RESOPT_DEBUG_LINES 2042
#define HTG_RESOPT_NODEBUG_LINES 2043
#define HTG_RESOPT_COMPILE_DEFAULT 2044
#define HTG_RESOPT_SHLIB_NAME_DEFAULT 2045
#define HTG_RESOPT_LD_FLAGS 2046
#define HTG_RESOPT_PGM_ENTRY_POINT_AUTO 2050
#define HTG_RESOPT_PGM_ENTRY_POINT_FIRST 2051
#define HTG_RESOPT_PGM_ENTRY_POINT_NONE 2052
/*
*-----------------------------------------------------------------------*
Defines for HTG_compile_level_flag
10 - P - Preprocess only
20 - PC - Preprocess and compile (generate assembler code) only
30 - PCA - Preprocess, compile, assemble only
40 - PCAL - Preprocess, compile, assemble, link to executable
50 - PCAX - Preprocess, compile, assemble, link to executable
60 - PCAS - Preprocess, compile, assemble, archive to static library
70 - PCAM - Preprocess, compile, assemble, link to shared library
*-----------------------------------------------------------------------*
*/
#define HTG_COMPILE_LEVEL 0
#define HTG_COMPILE_LEVEL_P 10
#define HTG_COMPILE_LEVEL_PC 20
#define HTG_COMPILE_LEVEL_PCA 30
#define HTG_COMPILE_LEVEL_PCAL 40
#define HTG_COMPILE_LEVEL_PCAX 50
#define HTG_COMPILE_LEVEL_PCAS 60
#define HTG_COMPILE_LEVEL_PCAM 70
#define HTG_COMPILE_LEVEL_STR_P "P"
#define HTG_COMPILE_LEVEL_STR_PC "PC"
#define HTG_COMPILE_LEVEL_STR_PCA "PCA"
#define HTG_COMPILE_LEVEL_STR_PCAL "PCAL"
#define HTG_COMPILE_LEVEL_STR_PCAX "PCAX"
#define HTG_COMPILE_LEVEL_STR_PCAS "PCAS"
#define HTG_COMPILE_LEVEL_STR_PCAM "PCAM"
/* command line options */
#define HTG_CMDOPT_NIL 0
#define HTG_CMDOPT_LIB_STATIC 'a'
#define HTG_CMDOPT_BIND_MODE 'B'
#define HTG_CMDOPT_ASSEMBLE 'c'
#define HTG_CMDOPT_CALLS_DYNAMIC 'C'
#define HTG_CMDOPT_DEBUG_LINES 'D'
#define HTG_CMDOPT_ENTRY_NAME 'e'
#define HTG_CMDOPT_PREPROCESSOR 'E'
#define HTG_CMDOPT_SOURCE_FIXED 'F'
#define HTG_CMDOPT_DEBUG 'g'
#define HTG_CMDOPT_HELP 'h'
#define HTG_CMDOPT_INCLUDE_PATH 'I'
#define HTG_CMDOPT_INCLUDE_LIB 'l'
#define HTG_CMDOPT_LIB_PATH 'L'
#define HTG_CMDOPT_LIB_SHARED 'm'
#define HTG_CMDOPT_MAIN_ENTRY 'M'
#define HTG_CMDOPT_OUTPUT_NAME 'o'
#define HTG_CMDOPT_LISTING 'P'
#define HTG_CMDOPT_COMPILE 'S'
#define HTG_CMDOPT_TAB_NUMBER 'T'
#define HTG_CMDOPT_SOURCE_OPEN 'X'
#define HTG_CMDOPT_EXECUTABLE 'x'
#define HTG_CMDOPT_PASS_OPTIONS 'W'
#define HTG_CMDOPT_VERBOSE 'v'
#define HTG_CMDOPT_VERSION 'V'
#define HTG_CMDOPT_VERY_VERBOSE 'z'
#define HTG_CMDOPT_TESTMODE 't'
#define HTG_CMDOPT_NORUN 'n'
#define HTG_CMDOPT_LIBCOB 'k'
#define HTG_PGM_NAME "TinyCOBOL"
#define HTG_COPYWR "(C) 2009,2010 TinyCOBOL Development Team\n"
struct opt_sel {
char *opt;
unsigned int iopt;
};
extern int wrncnt;
extern int errcnt;
extern unsigned int source_lineno;
extern unsigned int source_colno;
extern char *source_filename;
extern char *include_filename;
extern char input_filename[];
extern char working_filename[];
extern char output_filename[];
extern char list_filename[];
extern char sys_buf[];
extern int HTG_RETURN_CODE;
extern int HTG_temporary_error_code;
extern int HTG_temporary_severity;
extern int HTG_tab2space;
/*extern short HTG_compiler_PCAL_flag; */
extern short HTG_assemble_flag;
extern short HTG_full_compile_flag;
extern short HTG_make_object_flag;
extern short HTG_list_flag;
/*extern short HTG_sym_flag; */
extern short HTG_xref_flag;
extern short HTG_debug_lines_flag;
extern short HTG_offset_flag;
extern short HTG_verbose;
extern short HTG_verbose_verbose;
extern short HTG_all_calls_dynamic;
extern short HTG_remove_source_flag;
extern short HTG_retain_symbols;
extern short HTG_dynamic_flag;
extern short HTG_shlib_soname_flag;
extern short HTG_libcob;
extern char HTG_codeFormat;
extern char HTG_COPYDIR[];
extern char HTG_TMPDIR[];
extern char HTG_CCX_CMD[];
extern char HTG_ASX_CMD[];
extern char HTG_ASX_CMD[];
extern char HTG_ARX_CMD[];
extern char HTG_RANLIBX_CMD[];
/*extern char HTG_ASMLST[]; */
extern char HTG_OBJECT[];
extern char HTG_EXECUTABLE[];
extern char HTG_LD_OPTIONS[];
extern char HTG_LD_PATHS[];
extern char HTG_LD_ARGS[];
extern char HTG_LD_RESOPT_ARGS[];
extern char HTG_LD_CMDLINE_ARGS[];
extern char HTG_LD_DCALL_ARGS[];
extern char HTG_LD_TERM_ARGS[];
extern char HTG_LD_IO_ARGS[];
extern char HTG_LD_DYNAMIC[];
extern char HTG_LD_HT1_ARGS[];
extern char HTG_LD_HT2_ARGS[];
extern char HTG_LD_EXTRA_ARGS[];
extern char HTG_LD_MATH_ARGS[];
extern char HTG_LD_READLINE_ARGS[];
extern char HTG_PCAL_RESOPT_ARGS[];
extern char HTG_SHLIB_NAME_DEFAULT[];
extern char HTG_LD_FLAGS[];
#if defined(__MINGW32__ )
extern char COBINSTDIR[];
#endif
extern FILE *yyin;
extern FILE *o_src;
extern FILE *o_lst;
extern char include_full_filename[];
extern void process_bind_options (char *arglist);
extern void process_verbose_options (int ac, char *av[]);
extern void initialize_setup (void);
extern void append_include_path (char *ap);
extern void setup_filenames (void);
extern void print_compiler_banner (void);
extern void print_copybooks_path (void);
extern void setup_ld_paths (void);
extern void setup_ld_paths_defaults (void);
extern void print_listing_file (void);
extern int process_pp (void);
extern int process_compile (void);
extern void process_select_verify (char compile_level);
extern void pass_options_ld (char *s);
extern void pp_setup_scanner_state(void);
int find_copybook_file(char *fname, char *lname);
int find_copybook_file2 (char *fname, char *lname);
int find_filename_text (char *fname, char *fp, char *fs);
int find_filename_literal (char *fname, char *fp);
char *find_env_variable (char *ev);
char *find_token(char *p, const char *d, int sw);
void append_include_path(char *ap);
extern short HTG_compile_level_flag;
extern short HTG_compile_level_default;
extern char file_path[];
extern char *prg_name;
extern char lib_prefix[];
extern int HTG_prg_uses_fileio;
extern int HTG_prg_uses_term;
extern int HTG_prg_uses_dcall;
extern int HTG_norun;
extern int HTG_fld_desc_len;
extern int HTG_grp_desc_len;
#endif /* _HTGLOBALS_H */
Binary file not shown.
+204
View File
@@ -0,0 +1,204 @@
/*
* Copyright (C) 2001, 2000, 1999 David Essex
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
/*
-o <file> Specify output file name (default name a.out)\n
-fpic Generate position independent code, if possible
*/
#ifndef _HTHELP_H
#define _HTHELP_H
//#define TCOB_LANGUAGE_@tcob_lang@ 1
#ifdef TCOB_LANGUAGE_en
#define HTG_OPTIONS "Compiler specific options:\n"\
" -h Help (display this listing)\n"\
" -a Create static library; Preprocess, compile, assemble and archive\n"\
" -B <mode> Specify libraries binding mode ( static or dynamic )\n"\
" -c Preprocess, compile and assemble, but do not link\n"\
" -e <name> Specify entry point name (first program to execute)\n"\
" -E Output preprocessor to standard output only; do not compile, assemble or link\n"\
" -g Generate compiler debugging output\n"\
" -l <name> Add library name to link step\n"\
" -L <dir> Add directory to library search path\n"\
" -m <name> Create shared library; Preprocess, compile, assemble and link\n"\
" -M <option> Specify main entry point option (auto|first|none)\n"\
" -n Don't actually run any commands; just print them\n"\
" -o <file> Specify output file name\n"\
" -S Preprocess, compile (generate assembler code) only; do not assemble or link\n"\
" -v Generate verbose compiler output\n"\
" -V Display compiler version information and exit\n"\
" -Wl,<options> Pass comma-separated <options> on to the linker\n"\
" -x Create executable; Preprocess, compile, assemble and link\n"\
" -z Generate very verbose compiler output\n"\
"COBOL specific options:\n"\
" -C Make all COBOL calls dynamic \n"\
" -D Include COBOL source debugging lines \n"\
" -F Input source is in standard fixed column format\n"\
" -I <dir> Add directory to the end of the include (copybooks) search paths\n"\
" -P Generate output listing file\n"\
" -T <num> Expand tabs to number of space(s) (default T=8)\n"\
" -X Input source is in free format\n"\
"\n"
#endif
#ifdef TCOB_LANGUAGE_fr
#define HTG_OPTIONS "Options spécifiques au compilateur:\n"\
" -h Affiche l'aide\n"\
" -a Crée une librairie statique; préprocède, compile, assemble et archive\n"\
" -B <mode> Spécifie le mode de liens (statique/dynamique)\n"\
" -c Compile un module objet lié statiqueme\n"\
" -e <name> Specify entry point name (first program to execute)\n"\
" -E Sort seulement le résultat du prétraitement sur la sortie standard; ne compile pas, ni n'assemble ou lie \n"\
" -g Génère les informations de débogage\n"\
" -l <nom> Ajoute le nom de la librairie à l'étape de liens \n"\
" -L <chemin> Ajoute le répertoire à la liste de recherche des librairies\n"\
" -m <nom> Crée une librairie partagée; préprocède, compile, assemble et lie\n"\
" -M <option> Specify main entry point option (auto|first|none)\n"\
" -n N'exécute pas les commandes; les montre seulement\n"\
" -o <fichier> Spécifie le fichier de sortie\n"\
" -S Préprocède, compile seulement (génère le code assembleur); n'assemble pas, ni ne lie\n"\
" -t Conserve les fichiers intermédiaires\n"\
" -v Demande une sortie verbeuse du compilateur\n"\
" -V Affiche les informations de version du compilateur et sort\n"\
" -Wl,<options> Passe une liste d'<options> séparée par virgule ä l'éditeur de liens\n"\
" -x Compile un module exécutable\n"\
" -z Demande une sortie très verbeuse du compilateur\n"\
"Options spécifiques ä COBOL:\n"\
" -C Rends tous les appels COBOL dynamiques\n"\
" -D Inclut les lignes sources pour le débogage\n"\
" -F Déclare l'entrée comme du format standard (colonnage fixe)\n"\
" -I <chemin> Définit le chemin de recherche des copy (défaut -I./).\n"\
" Le chemin peut être soit un seul répertoire, soit une liste de répertoires\n"\
" séparée par un `:' (`;' sur la plateforme Win32). \n"\
" -P Génère un fichier liste\n"\
" -T <nombre> Transforme les tabulations en <nombre> d'espaces (défaut T=8)\n"\
" -X Déclare l'entrée comme du format libre X/Open (format par défaut)\n"\
"\n"
#endif
#ifdef TCOB_LANGUAGE_it
#define HTG_OPTIONS "Opzioni compiler specifiche:\n"\
" -h Visualizza l'aiuto\n"\
" -a Crea libreria statica; Preprocessa, compila, assembla e comprime\n"\
" -B <mode> Specifica la modalita` di collegamento (statica/dinamica)\n"\
" -c Compila generando un modulo oggetto linkato staticamente\n"\
" -e <name> Specify entry point name (first program to execute)\n"\
" -E Invoca il preprocessore inviando il risultato nello 'standard output'\n"\
" Non compila, ne` assembla o linka\n"\
" -g Genera un file utilizzabile per il debugging\n"\
" -l <nome> Aggiungi la libreria 'nome' nella fase di link\n"\
" -L <dir> Aggiungi la cartella 'dir' nel percorso di ricerca delle librerie\n"\
" -m <nome> Crea una libreria d'uso comune (shared); preprocessa, compila, assembla e linka\n"\
" -M <option> Specify main entry point option (auto|first|none)\n"\
" -n Non esegue alcun comando; visualizza solo cio` che farebbe\n"\
" -o <file> Specifica il file da genereare\n"\
" -S Preprocessa, compila (genera codice assembler) solo; non assembla o linka\n"\
" -v Genera messaggi estesi durante la compilazione\n"\
" -V Visualizza la versione del compilatore and esce\n"\
" -Wl,<opzioni> Passa (separate da virgola) al linker\n"\
" -x Genera un modulo eseguibile\n"\
" -z Genera messaggi molto estesi durante la compilazione\n"\
"Opzioni specifiche COBOL:\n"\
" -C Rendi tutte le 'calls' COBOL dinamiche\n"\
" -D Includi le linee di sorgente per il debugging\n"\
" -F Il sorgente in ingresso e` formattato in modalita` standard (fixed column)\n"\
" -I <dir> Definisce le cartelle 'path' di ricerca delle 'include' (copybooks).\n"\
" Il percorso puo` essere sia una singola cartella, sia un elenco di\n"\
" cartelle separate da ':' (';' su piattaforma Win32).\n"\
" La cartella di ricerca di default e` la cartella corrente (./).\n"\
" -P Genera un listato di compilazione\n"\
" -T <num> Converti i 'tabs' in 'num' spazi (default T=8)\n"\
" -X Il sorgente in ingresso ha la formattazione libera (X/Open free format) (default format)\n"\
"\n"
#endif
#ifdef TCOB_LANGUAGE_pt_BR
#define HTG_OPTIONS "Opcoes especificas do Compilador:\n"\
" -h Mostra ajuda\n"\
" -a Cria biblioteca estatica; pre-processa, compila, assembla e arquiva\n"\
" -B <modo> modo especifico para aglutinacao (estatica/dinamica)\n"\
" -c Compilacao para um modulo de objeto estaticamente linkado\n"\
" -e <name> Specify entry point name (first program to execute)\n"\
" -E Saida do preprocessador para saida padrao apenas; nao compila, assembla ou linka\n"\
" -g Gera saida de debug de compilacao\n"\
" -l <arquivo> Adiciona biblioteca na linkedicao\n"\
" -L <diretorio> Adiciona diretorio ao caminho de procura de bibliotecas\n"\
" -m <arquivo> Cria biblioteca dinamica; pre-processa, compila, assembla e linka\n"\
" -M <option> Specify main entry point option (auto|first|none)\n"\
" -n Na~o executa nenhum comando, deve mostrar a compilacao\n"\
" -o <arquivo> Especifica nome do executavel (padrao de entrada x extensao)\n"\
" -S Preprocessa, compila(gera codigo assembler) somente; nao assembla ou linka\n"\
" -v Gera saida do compilador verbosa\n"\
" -V Mostra informacoes da versao do compilador e sai\n"\
" -Wl,<opcoes> Passar opcoes separadas por virgula ao linkeditor\n"\
" -x Compilacao para criar um executavel\n"\
" -z Gera saida do compilador verbosa\n"\
"Opcoes especificas do COBOL:\n"\
" -C Faz todas as chamadas dinamicas COBOL\n"\
" -D Inclui linhas de debug no fonte\n"\
" -F Fonte de entrada esta em formato de coluna fixa padrao\n"\
" -I <diretorio> Define inclusao(copybooks) de caminhos de procura. (padrao -I./)\n"\
" O caminho pode ser um simples diretorio, ou uma lista de diretorios separados por um ':'\n"\
" -P Gera arquivo de saida listado\n"\
" -T <num> <Expande tabs para um numero de espacos (padrao T=8)\n"\
" -X Arquivo de entrada esta em formato livre X/Open (formato padrao)\n"\
"\n"
#endif
#ifdef TCOB_LANGUAGE_es
#define HTG_OPTIONS "Opciones específicas del compilador:\n"\
" -h Ayuda (muestra este listado)\n"\
" -a Crea una librería estática; Preprocesar, compilar, ensamblar y archivar\n"\
" -B <mode> Especificar el modo para enlazado (static o dynamic)\n"\
" -c Proprocesa, compila y ensambla, pero no enlaza\n"\
" -e <name> Specify entry point name (first program to execute)\n"\
" -E Muestra solo la salida del preprocesador a salida estandard; no compila, ensambla o enlaza\n"\
" -g Generar salida de compilador para debug\n"\
" -l <name> Añade la librería al enlazado\n"\
" -L <dir> Añade el directorio al camino de búsqueda de librerías\n"\
" -m <name> Crea una librería compartida; Preprocesa, compila, ensambla y enlaza\n"\
" -M <option> Specify main entry point option (auto|first|none)\n"\
" -n No ejecuta ningún comando; solo los muestra\n"\
" -o <file> Especifica el nombre del fichero de salida\n"\
" -S Solo preprocesar y compilar (genera ensablador); no ensambla o enlaza\n"\
" -v Genera salida del compilador detallada\n"\
" -V Muestra la versión del compilador y termina\n"\
" -Wl,<options> Pasa <opciones>, separadas por comas, al enlazador\n"\
" -x Crea un ejecutable; preprocesa, compila, ensambla y enlaza\n"\
" -z Genera la salida del compilador muy detallada\n"\
"Opciones específicas de COBOL:\n"\
" -C Hace todas las llamadas de COBOL dinámicas\n"\
" -D Incluye lineas del fuente para debug\n"\
" -F El fuente de entrada está en formato estándar de columnas fijas\n"\
" -I <dir> Añade el directorio al final del camino de búsqueda de copybooks\n"\
" -P Genera un fichero listado de la salida\n"\
" -T <num> Expande los tabuladores a un número de espacios (por defecto T=8)\n"\
" -X El fichero de entrada está en formato libre X/Open (formato por defecto)\n"\
"\n"
#endif
#endif
+204
View File
@@ -0,0 +1,204 @@
/*
* Copyright (C) 2001, 2000, 1999 David Essex
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
/*
-o <file> Specify output file name (default name a.out)\n
-fpic Generate position independent code, if possible
*/
#ifndef _HTHELP_H
#define _HTHELP_H
//#define TCOB_LANGUAGE_@tcob_lang@ 1
#ifdef TCOB_LANGUAGE_en
#define HTG_OPTIONS "Compiler specific options:\n"\
" -h Help (display this listing)\n"\
" -a Create static library; Preprocess, compile, assemble and archive\n"\
" -B <mode> Specify libraries binding mode ( static or dynamic )\n"\
" -c Preprocess, compile and assemble, but do not link\n"\
" -e <name> Specify entry point name (first program to execute)\n"\
" -E Output preprocessor to standard output only; do not compile, assemble or link\n"\
" -g Generate compiler debugging output\n"\
" -l <name> Add library name to link step\n"\
" -L <dir> Add directory to library search path\n"\
" -m <name> Create shared library; Preprocess, compile, assemble and link\n"\
" -M <option> Specify main entry point option (auto|first|none)\n"\
" -n Don't actually run any commands; just print them\n"\
" -o <file> Specify output file name\n"\
" -S Preprocess, compile (generate assembler code) only; do not assemble or link\n"\
" -v Generate verbose compiler output\n"\
" -V Display compiler version information and exit\n"\
" -Wl,<options> Pass comma-separated <options> on to the linker\n"\
" -x Create executable; Preprocess, compile, assemble and link\n"\
" -z Generate very verbose compiler output\n"\
"COBOL specific options:\n"\
" -C Make all COBOL calls dynamic \n"\
" -D Include COBOL source debugging lines \n"\
" -F Input source is in standard fixed column format\n"\
" -I <dir> Add directory to the end of the include (copybooks) search paths\n"\
" -P Generate output listing file\n"\
" -T <num> Expand tabs to number of space(s) (default T=8)\n"\
" -X Input source is in free format\n"\
"\n"
#endif
#ifdef TCOB_LANGUAGE_fr
#define HTG_OPTIONS "Options spécifiques au compilateur:\n"\
" -h Affiche l'aide\n"\
" -a Crée une librairie statique; préprocède, compile, assemble et archive\n"\
" -B <mode> Spécifie le mode de liens (statique/dynamique)\n"\
" -c Compile un module objet lié statiqueme\n"\
" -e <name> Specify entry point name (first program to execute)\n"\
" -E Sort seulement le résultat du prétraitement sur la sortie standard; ne compile pas, ni n'assemble ou lie \n"\
" -g Génère les informations de débogage\n"\
" -l <nom> Ajoute le nom de la librairie à l'étape de liens \n"\
" -L <chemin> Ajoute le répertoire à la liste de recherche des librairies\n"\
" -m <nom> Crée une librairie partagée; préprocède, compile, assemble et lie\n"\
" -M <option> Specify main entry point option (auto|first|none)\n"\
" -n N'exécute pas les commandes; les montre seulement\n"\
" -o <fichier> Spécifie le fichier de sortie\n"\
" -S Préprocède, compile seulement (génère le code assembleur); n'assemble pas, ni ne lie\n"\
" -t Conserve les fichiers intermédiaires\n"\
" -v Demande une sortie verbeuse du compilateur\n"\
" -V Affiche les informations de version du compilateur et sort\n"\
" -Wl,<options> Passe une liste d'<options> séparée par virgule ä l'éditeur de liens\n"\
" -x Compile un module exécutable\n"\
" -z Demande une sortie très verbeuse du compilateur\n"\
"Options spécifiques ä COBOL:\n"\
" -C Rends tous les appels COBOL dynamiques\n"\
" -D Inclut les lignes sources pour le débogage\n"\
" -F Déclare l'entrée comme du format standard (colonnage fixe)\n"\
" -I <chemin> Définit le chemin de recherche des copy (défaut -I./).\n"\
" Le chemin peut être soit un seul répertoire, soit une liste de répertoires\n"\
" séparée par un `:' (`;' sur la plateforme Win32). \n"\
" -P Génère un fichier liste\n"\
" -T <nombre> Transforme les tabulations en <nombre> d'espaces (défaut T=8)\n"\
" -X Déclare l'entrée comme du format libre X/Open (format par défaut)\n"\
"\n"
#endif
#ifdef TCOB_LANGUAGE_it
#define HTG_OPTIONS "Opzioni compiler specifiche:\n"\
" -h Visualizza l'aiuto\n"\
" -a Crea libreria statica; Preprocessa, compila, assembla e comprime\n"\
" -B <mode> Specifica la modalita` di collegamento (statica/dinamica)\n"\
" -c Compila generando un modulo oggetto linkato staticamente\n"\
" -e <name> Specify entry point name (first program to execute)\n"\
" -E Invoca il preprocessore inviando il risultato nello 'standard output'\n"\
" Non compila, ne` assembla o linka\n"\
" -g Genera un file utilizzabile per il debugging\n"\
" -l <nome> Aggiungi la libreria 'nome' nella fase di link\n"\
" -L <dir> Aggiungi la cartella 'dir' nel percorso di ricerca delle librerie\n"\
" -m <nome> Crea una libreria d'uso comune (shared); preprocessa, compila, assembla e linka\n"\
" -M <option> Specify main entry point option (auto|first|none)\n"\
" -n Non esegue alcun comando; visualizza solo cio` che farebbe\n"\
" -o <file> Specifica il file da genereare\n"\
" -S Preprocessa, compila (genera codice assembler) solo; non assembla o linka\n"\
" -v Genera messaggi estesi durante la compilazione\n"\
" -V Visualizza la versione del compilatore and esce\n"\
" -Wl,<opzioni> Passa (separate da virgola) al linker\n"\
" -x Genera un modulo eseguibile\n"\
" -z Genera messaggi molto estesi durante la compilazione\n"\
"Opzioni specifiche COBOL:\n"\
" -C Rendi tutte le 'calls' COBOL dinamiche\n"\
" -D Includi le linee di sorgente per il debugging\n"\
" -F Il sorgente in ingresso e` formattato in modalita` standard (fixed column)\n"\
" -I <dir> Definisce le cartelle 'path' di ricerca delle 'include' (copybooks).\n"\
" Il percorso puo` essere sia una singola cartella, sia un elenco di\n"\
" cartelle separate da ':' (';' su piattaforma Win32).\n"\
" La cartella di ricerca di default e` la cartella corrente (./).\n"\
" -P Genera un listato di compilazione\n"\
" -T <num> Converti i 'tabs' in 'num' spazi (default T=8)\n"\
" -X Il sorgente in ingresso ha la formattazione libera (X/Open free format) (default format)\n"\
"\n"
#endif
#ifdef TCOB_LANGUAGE_pt_BR
#define HTG_OPTIONS "Opcoes especificas do Compilador:\n"\
" -h Mostra ajuda\n"\
" -a Cria biblioteca estatica; pre-processa, compila, assembla e arquiva\n"\
" -B <modo> modo especifico para aglutinacao (estatica/dinamica)\n"\
" -c Compilacao para um modulo de objeto estaticamente linkado\n"\
" -e <name> Specify entry point name (first program to execute)\n"\
" -E Saida do preprocessador para saida padrao apenas; nao compila, assembla ou linka\n"\
" -g Gera saida de debug de compilacao\n"\
" -l <arquivo> Adiciona biblioteca na linkedicao\n"\
" -L <diretorio> Adiciona diretorio ao caminho de procura de bibliotecas\n"\
" -m <arquivo> Cria biblioteca dinamica; pre-processa, compila, assembla e linka\n"\
" -M <option> Specify main entry point option (auto|first|none)\n"\
" -n Na~o executa nenhum comando, deve mostrar a compilacao\n"\
" -o <arquivo> Especifica nome do executavel (padrao de entrada x extensao)\n"\
" -S Preprocessa, compila(gera codigo assembler) somente; nao assembla ou linka\n"\
" -v Gera saida do compilador verbosa\n"\
" -V Mostra informacoes da versao do compilador e sai\n"\
" -Wl,<opcoes> Passar opcoes separadas por virgula ao linkeditor\n"\
" -x Compilacao para criar um executavel\n"\
" -z Gera saida do compilador verbosa\n"\
"Opcoes especificas do COBOL:\n"\
" -C Faz todas as chamadas dinamicas COBOL\n"\
" -D Inclui linhas de debug no fonte\n"\
" -F Fonte de entrada esta em formato de coluna fixa padrao\n"\
" -I <diretorio> Define inclusao(copybooks) de caminhos de procura. (padrao -I./)\n"\
" O caminho pode ser um simples diretorio, ou uma lista de diretorios separados por um ':'\n"\
" -P Gera arquivo de saida listado\n"\
" -T <num> <Expande tabs para um numero de espacos (padrao T=8)\n"\
" -X Arquivo de entrada esta em formato livre X/Open (formato padrao)\n"\
"\n"
#endif
#ifdef TCOB_LANGUAGE_es
#define HTG_OPTIONS "Opciones específicas del compilador:\n"\
" -h Ayuda (muestra este listado)\n"\
" -a Crea una librería estática; Preprocesar, compilar, ensamblar y archivar\n"\
" -B <mode> Especificar el modo para enlazado (static o dynamic)\n"\
" -c Proprocesa, compila y ensambla, pero no enlaza\n"\
" -e <name> Specify entry point name (first program to execute)\n"\
" -E Muestra solo la salida del preprocesador a salida estandard; no compila, ensambla o enlaza\n"\
" -g Generar salida de compilador para debug\n"\
" -l <name> Añade la librería al enlazado\n"\
" -L <dir> Añade el directorio al camino de búsqueda de librerías\n"\
" -m <name> Crea una librería compartida; Preprocesa, compila, ensambla y enlaza\n"\
" -M <option> Specify main entry point option (auto|first|none)\n"\
" -n No ejecuta ningún comando; solo los muestra\n"\
" -o <file> Especifica el nombre del fichero de salida\n"\
" -S Solo preprocesar y compilar (genera ensablador); no ensambla o enlaza\n"\
" -v Genera salida del compilador detallada\n"\
" -V Muestra la versión del compilador y termina\n"\
" -Wl,<options> Pasa <opciones>, separadas por comas, al enlazador\n"\
" -x Crea un ejecutable; preprocesa, compila, ensambla y enlaza\n"\
" -z Genera la salida del compilador muy detallada\n"\
"Opciones específicas de COBOL:\n"\
" -C Hace todas las llamadas de COBOL dinámicas\n"\
" -D Incluye lineas del fuente para debug\n"\
" -F El fuente de entrada está en formato estándar de columnas fijas\n"\
" -I <dir> Añade el directorio al final del camino de búsqueda de copybooks\n"\
" -P Genera un fichero listado de la salida\n"\
" -T <num> Expande los tabuladores a un número de espacios (por defecto T=8)\n"\
" -X El fichero de entrada está en formato libre X/Open (formato por defecto)\n"\
"\n"
#endif
#endif
+13
View File
@@ -0,0 +1,13 @@
#ifndef _TCOB_VERSION_H
#define _TCOB_VERSION_H
#define TCOB_MAJOR_VERSION "0"
#define TCOB_MINOR_VERSION "73"
#define TCOB_PATCH_LEVEL "0"
#define TCOB_VERSION "0.73.0"
#define TCOB_RELEASE_DATE "2012/02/08"
#define TCOB_PGM_VERSION "Alpha 0.73.0 (MinGW 2012/02/08)"
#endif
+13
View File
@@ -0,0 +1,13 @@
#ifndef _TCOB_VERSION_H
#define _TCOB_VERSION_H
#define TCOB_MAJOR_VERSION "@TCOB_MAJOR_VERSION@"
#define TCOB_MINOR_VERSION "@TCOB_MINOR_VERSION@"
#define TCOB_PATCH_LEVEL "@TCOB_PATCH_LEVEL@"
#define TCOB_VERSION "@TCOB_VERSION@"
#define TCOB_RELEASE_DATE "@TCOB_RELEASE_DATE@"
#define TCOB_PGM_VERSION "Alpha @TCOB_VERSION@ (@host_os@ @TCOB_RELEASE_DATE@)"
#endif
+694
View File
@@ -0,0 +1,694 @@
Terminals unused in grammar
TOK_MISC
Grammar
0 $accept: root $end
1 root: statements
2 | /* empty */
3 statements: statement
4 | statements statement
5 $@1: /* empty */
6 statement: TOK_SOURCE_COMPUTER TOK_PERIOD $@1 identifier_debug_mode_opt
7 $@2: /* empty */
8 statement: TOK_COPY $@2 copy_statement TOK_PERIOD
9 | TOK_REPLACE replace_statement TOK_PERIOD
10 | TOK_REPLACE TOK_OFF TOK_PERIOD
11 | TOK_MODE
12 | TOK_WITH
13 | error
14 $@3: /* empty */
15 copy_statement: name library_name_opt $@3 TOK_REPLACING replacing_statement
16 | name library_name_opt
17 replacing_statement: replacing_statements
18 | replacing_statements replacing_statement
19 replacing_statements: replacing_text TOK_BY replacing_text comma_delimiter_opt
20 replacing_text: pseudo_text
21 | identifier
22 | literal
23 | word
24 library_name_opt: of_in name
25 | /* empty */
26 replace_statement: replace_statements
27 | replace_statements replace_statement
28 replace_statements: pseudo_text TOK_BY pseudo_text comma_delimiter_opt
29 name: literal
30 | identifier
31 pseudo_text: TOK_PSEUDO_TEXT
32 identifier: TOK_IDENTIFIER
33 literal: TOK_LITERAL
34 word: TOK_WORD
35 of_in: TOK_OF
36 | TOK_IN
37 comma_delimiter_opt: TOK_COMMA
38 | /* empty */
39 identifier_debug_mode_opt: identifier debugging_mode_opt TOK_PERIOD
40 | /* empty */
41 debugging_mode_opt: with_opt TOK_DEBUGGING TOK_MODE
42 | /* empty */
43 with_opt: TOK_WITH
44 | /* empty */
Terminals, with rules where they appear
$end (0) 0
error (256) 13
TOK_PSEUDO_TEXT (258) 31
TOK_IDENTIFIER (259) 32
TOK_LITERAL (260) 33
TOK_WORD (261) 34
TOK_COPY (262) 8
TOK_PERIOD (263) 6 8 9 10 39
TOK_OFF (264) 10
TOK_BY (265) 19 28
TOK_OF (266) 35
TOK_IN (267) 36
TOK_REPLACING (268) 15
TOK_REPLACE (269) 9 10
TOK_MISC (270)
TOK_COMMA (271) 37
TOK_SOURCE_COMPUTER (272) 6
TOK_WITH (273) 12 43
TOK_DEBUGGING (274) 41
TOK_MODE (275) 11 41
Nonterminals, with rules where they appear
$accept (21)
on left: 0
root (22)
on left: 1 2, on right: 0
statements (23)
on left: 3 4, on right: 1 4
statement (24)
on left: 6 8 9 10 11 12 13, on right: 3 4
$@1 (25)
on left: 5, on right: 6
$@2 (26)
on left: 7, on right: 8
copy_statement (27)
on left: 15 16, on right: 8
$@3 (28)
on left: 14, on right: 15
replacing_statement (29)
on left: 17 18, on right: 15 18
replacing_statements (30)
on left: 19, on right: 17 18
replacing_text (31)
on left: 20 21 22 23, on right: 19
library_name_opt (32)
on left: 24 25, on right: 15 16
replace_statement (33)
on left: 26 27, on right: 9 27
replace_statements (34)
on left: 28, on right: 26 27
name (35)
on left: 29 30, on right: 15 16 24
pseudo_text (36)
on left: 31, on right: 20 28
identifier (37)
on left: 32, on right: 21 30 39
literal (38)
on left: 33, on right: 22 29
word (39)
on left: 34, on right: 23
of_in (40)
on left: 35 36, on right: 24
comma_delimiter_opt (41)
on left: 37 38, on right: 19 28
identifier_debug_mode_opt (42)
on left: 39 40, on right: 6
debugging_mode_opt (43)
on left: 41 42, on right: 39
with_opt (44)
on left: 43 44, on right: 41
state 0
0 $accept: . root $end
error shift, and go to state 1
TOK_COPY shift, and go to state 2
TOK_REPLACE shift, and go to state 3
TOK_SOURCE_COMPUTER shift, and go to state 4
TOK_WITH shift, and go to state 5
TOK_MODE shift, and go to state 6
$end reduce using rule 2 (root)
root go to state 7
statements go to state 8
statement go to state 9
state 1
13 statement: error .
$default reduce using rule 13 (statement)
state 2
8 statement: TOK_COPY . $@2 copy_statement TOK_PERIOD
$default reduce using rule 7 ($@2)
$@2 go to state 10
state 3
9 statement: TOK_REPLACE . replace_statement TOK_PERIOD
10 | TOK_REPLACE . TOK_OFF TOK_PERIOD
TOK_PSEUDO_TEXT shift, and go to state 11
TOK_OFF shift, and go to state 12
replace_statement go to state 13
replace_statements go to state 14
pseudo_text go to state 15
state 4
6 statement: TOK_SOURCE_COMPUTER . TOK_PERIOD $@1 identifier_debug_mode_opt
TOK_PERIOD shift, and go to state 16
state 5
12 statement: TOK_WITH .
$default reduce using rule 12 (statement)
state 6
11 statement: TOK_MODE .
$default reduce using rule 11 (statement)
state 7
0 $accept: root . $end
$end shift, and go to state 17
state 8
1 root: statements .
4 statements: statements . statement
error shift, and go to state 1
TOK_COPY shift, and go to state 2
TOK_REPLACE shift, and go to state 3
TOK_SOURCE_COMPUTER shift, and go to state 4
TOK_WITH shift, and go to state 5
TOK_MODE shift, and go to state 6
$end reduce using rule 1 (root)
statement go to state 18
state 9
3 statements: statement .
$default reduce using rule 3 (statements)
state 10
8 statement: TOK_COPY $@2 . copy_statement TOK_PERIOD
TOK_IDENTIFIER shift, and go to state 19
TOK_LITERAL shift, and go to state 20
copy_statement go to state 21
name go to state 22
identifier go to state 23
literal go to state 24
state 11
31 pseudo_text: TOK_PSEUDO_TEXT .
$default reduce using rule 31 (pseudo_text)
state 12
10 statement: TOK_REPLACE TOK_OFF . TOK_PERIOD
TOK_PERIOD shift, and go to state 25
state 13
9 statement: TOK_REPLACE replace_statement . TOK_PERIOD
TOK_PERIOD shift, and go to state 26
state 14
26 replace_statement: replace_statements .
27 | replace_statements . replace_statement
TOK_PSEUDO_TEXT shift, and go to state 11
$default reduce using rule 26 (replace_statement)
replace_statement go to state 27
replace_statements go to state 14
pseudo_text go to state 15
state 15
28 replace_statements: pseudo_text . TOK_BY pseudo_text comma_delimiter_opt
TOK_BY shift, and go to state 28
state 16
6 statement: TOK_SOURCE_COMPUTER TOK_PERIOD . $@1 identifier_debug_mode_opt
$default reduce using rule 5 ($@1)
$@1 go to state 29
state 17
0 $accept: root $end .
$default accept
state 18
4 statements: statements statement .
$default reduce using rule 4 (statements)
state 19
32 identifier: TOK_IDENTIFIER .
$default reduce using rule 32 (identifier)
state 20
33 literal: TOK_LITERAL .
$default reduce using rule 33 (literal)
state 21
8 statement: TOK_COPY $@2 copy_statement . TOK_PERIOD
TOK_PERIOD shift, and go to state 30
state 22
15 copy_statement: name . library_name_opt $@3 TOK_REPLACING replacing_statement
16 | name . library_name_opt
TOK_OF shift, and go to state 31
TOK_IN shift, and go to state 32
$default reduce using rule 25 (library_name_opt)
library_name_opt go to state 33
of_in go to state 34
state 23
30 name: identifier .
$default reduce using rule 30 (name)
state 24
29 name: literal .
$default reduce using rule 29 (name)
state 25
10 statement: TOK_REPLACE TOK_OFF TOK_PERIOD .
$default reduce using rule 10 (statement)
state 26
9 statement: TOK_REPLACE replace_statement TOK_PERIOD .
$default reduce using rule 9 (statement)
state 27
27 replace_statement: replace_statements replace_statement .
$default reduce using rule 27 (replace_statement)
state 28
28 replace_statements: pseudo_text TOK_BY . pseudo_text comma_delimiter_opt
TOK_PSEUDO_TEXT shift, and go to state 11
pseudo_text go to state 35
state 29
6 statement: TOK_SOURCE_COMPUTER TOK_PERIOD $@1 . identifier_debug_mode_opt
TOK_IDENTIFIER shift, and go to state 19
$default reduce using rule 40 (identifier_debug_mode_opt)
identifier go to state 36
identifier_debug_mode_opt go to state 37
state 30
8 statement: TOK_COPY $@2 copy_statement TOK_PERIOD .
$default reduce using rule 8 (statement)
state 31
35 of_in: TOK_OF .
$default reduce using rule 35 (of_in)
state 32
36 of_in: TOK_IN .
$default reduce using rule 36 (of_in)
state 33
15 copy_statement: name library_name_opt . $@3 TOK_REPLACING replacing_statement
16 | name library_name_opt .
TOK_PERIOD reduce using rule 16 (copy_statement)
$default reduce using rule 14 ($@3)
$@3 go to state 38
state 34
24 library_name_opt: of_in . name
TOK_IDENTIFIER shift, and go to state 19
TOK_LITERAL shift, and go to state 20
name go to state 39
identifier go to state 23
literal go to state 24
state 35
28 replace_statements: pseudo_text TOK_BY pseudo_text . comma_delimiter_opt
TOK_COMMA shift, and go to state 40
$default reduce using rule 38 (comma_delimiter_opt)
comma_delimiter_opt go to state 41
state 36
39 identifier_debug_mode_opt: identifier . debugging_mode_opt TOK_PERIOD
TOK_WITH shift, and go to state 42
TOK_DEBUGGING reduce using rule 44 (with_opt)
$default reduce using rule 42 (debugging_mode_opt)
debugging_mode_opt go to state 43
with_opt go to state 44
state 37
6 statement: TOK_SOURCE_COMPUTER TOK_PERIOD $@1 identifier_debug_mode_opt .
$default reduce using rule 6 (statement)
state 38
15 copy_statement: name library_name_opt $@3 . TOK_REPLACING replacing_statement
TOK_REPLACING shift, and go to state 45
state 39
24 library_name_opt: of_in name .
$default reduce using rule 24 (library_name_opt)
state 40
37 comma_delimiter_opt: TOK_COMMA .
$default reduce using rule 37 (comma_delimiter_opt)
state 41
28 replace_statements: pseudo_text TOK_BY pseudo_text comma_delimiter_opt .
$default reduce using rule 28 (replace_statements)
state 42
43 with_opt: TOK_WITH .
$default reduce using rule 43 (with_opt)
state 43
39 identifier_debug_mode_opt: identifier debugging_mode_opt . TOK_PERIOD
TOK_PERIOD shift, and go to state 46
state 44
41 debugging_mode_opt: with_opt . TOK_DEBUGGING TOK_MODE
TOK_DEBUGGING shift, and go to state 47
state 45
15 copy_statement: name library_name_opt $@3 TOK_REPLACING . replacing_statement
TOK_PSEUDO_TEXT shift, and go to state 11
TOK_IDENTIFIER shift, and go to state 19
TOK_LITERAL shift, and go to state 20
TOK_WORD shift, and go to state 48
replacing_statement go to state 49
replacing_statements go to state 50
replacing_text go to state 51
pseudo_text go to state 52
identifier go to state 53
literal go to state 54
word go to state 55
state 46
39 identifier_debug_mode_opt: identifier debugging_mode_opt TOK_PERIOD .
$default reduce using rule 39 (identifier_debug_mode_opt)
state 47
41 debugging_mode_opt: with_opt TOK_DEBUGGING . TOK_MODE
TOK_MODE shift, and go to state 56
state 48
34 word: TOK_WORD .
$default reduce using rule 34 (word)
state 49
15 copy_statement: name library_name_opt $@3 TOK_REPLACING replacing_statement .
$default reduce using rule 15 (copy_statement)
state 50
17 replacing_statement: replacing_statements .
18 | replacing_statements . replacing_statement
TOK_PSEUDO_TEXT shift, and go to state 11
TOK_IDENTIFIER shift, and go to state 19
TOK_LITERAL shift, and go to state 20
TOK_WORD shift, and go to state 48
$default reduce using rule 17 (replacing_statement)
replacing_statement go to state 57
replacing_statements go to state 50
replacing_text go to state 51
pseudo_text go to state 52
identifier go to state 53
literal go to state 54
word go to state 55
state 51
19 replacing_statements: replacing_text . TOK_BY replacing_text comma_delimiter_opt
TOK_BY shift, and go to state 58
state 52
20 replacing_text: pseudo_text .
$default reduce using rule 20 (replacing_text)
state 53
21 replacing_text: identifier .
$default reduce using rule 21 (replacing_text)
state 54
22 replacing_text: literal .
$default reduce using rule 22 (replacing_text)
state 55
23 replacing_text: word .
$default reduce using rule 23 (replacing_text)
state 56
41 debugging_mode_opt: with_opt TOK_DEBUGGING TOK_MODE .
$default reduce using rule 41 (debugging_mode_opt)
state 57
18 replacing_statement: replacing_statements replacing_statement .
$default reduce using rule 18 (replacing_statement)
state 58
19 replacing_statements: replacing_text TOK_BY . replacing_text comma_delimiter_opt
TOK_PSEUDO_TEXT shift, and go to state 11
TOK_IDENTIFIER shift, and go to state 19
TOK_LITERAL shift, and go to state 20
TOK_WORD shift, and go to state 48
replacing_text go to state 59
pseudo_text go to state 52
identifier go to state 53
literal go to state 54
word go to state 55
state 59
19 replacing_statements: replacing_text TOK_BY replacing_text . comma_delimiter_opt
TOK_COMMA shift, and go to state 40
$default reduce using rule 38 (comma_delimiter_opt)
comma_delimiter_opt go to state 60
state 60
19 replacing_statements: replacing_text TOK_BY replacing_text comma_delimiter_opt .
$default reduce using rule 19 (replacing_statements)
File diff suppressed because it is too large Load Diff
+86
View File
@@ -0,0 +1,86 @@
/* A Bison parser, made by GNU Bison 2.4.2. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
TOK_PSEUDO_TEXT = 258,
TOK_IDENTIFIER = 259,
TOK_LITERAL = 260,
TOK_WORD = 261,
TOK_COPY = 262,
TOK_PERIOD = 263,
TOK_OFF = 264,
TOK_BY = 265,
TOK_OF = 266,
TOK_IN = 267,
TOK_REPLACING = 268,
TOK_REPLACE = 269,
TOK_MISC = 270,
TOK_COMMA = 271,
TOK_SOURCE_COMPUTER = 272,
TOK_WITH = 273,
TOK_DEBUGGING = 274,
TOK_MODE = 275
};
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 1685 of yacc.c */
#line 74 "pp_parser.y"
char *str; /* string */
int ival; /* int */
/* Line 1685 of yacc.c */
#line 78 "pp_parser.tab.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE pp_yylval;
Binary file not shown.
+286
View File
@@ -0,0 +1,286 @@
/*
Copyright (C) 1999-2004 David Essex
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this software; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
TinyCOBOL pre-processor parser
*/
%{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
//#include "cobpp.h"
#include "htcoboly.h"
#include "htcoblib.h"
#include "htglobals.h"
//#define YYDEBUG 1
//#define DEBUG_COBPP_PARSER 1
extern unsigned long lineCount;
extern unsigned long columnCount;
extern int copy_state_sw;
extern int copy_start_sw;
extern int replace_state_sw;
extern int replace_start_sw;
extern int identifier_scan_sw;
//extern char *include_filename;
extern char *include_cpybook;
extern char *include_cpylib;
extern int pp_yylex(void);
extern char *pp_yytext;
extern void add_copy_replacement(char *, char *);
extern void add_replace_replacement(char *, char *);
#ifdef DEBUG_COBPP_PARSER
char erryybuf[1024*8];
void debug_yy_rtn (const char *s1, const char *s2, const char *s3, int sw);
#define DEBUGYY_RTN_STR1(msg1) debug_yy_rtn (msg1, NULL, NULL, 1);
#define DEBUGYY_RTN_STR3(msg1, msg2) debug_yy_rtn (msg1, msg2, NULL, 3);
#define DEBUGYY_RTN_STR15(msg1, msg2, msg3) debug_yy_rtn (msg1, msg2, msg3, 15);
#else
#define DEBUGYY_RTN_STR1(msg1)
#define DEBUGYY_RTN_STR3(msg1, msg2)
#define DEBUGYY_RTN_STR15(msg1, msg2, msg3)
#endif
%}
%union {
char *str; /* string */
int ival; /* int */
}
%token <str> TOK_PSEUDO_TEXT TOK_IDENTIFIER TOK_LITERAL TOK_WORD
//%token <ival> ERROR YYERROR_VERBOSE
%token TOK_COPY TOK_PERIOD TOK_OFF TOK_BY TOK_OF TOK_IN
%token TOK_REPLACING TOK_REPLACE
%token TOK_MISC TOK_COMMA
%token TOK_SOURCE_COMPUTER TOK_WITH TOK_DEBUGGING TOK_MODE
%type <str> pseudo_text identifier literal word name library_name_opt replacing_text
%%
root: statements
| /* nill */
;
statements: statement
| statements statement
;
statement: TOK_SOURCE_COMPUTER TOK_PERIOD
{
DEBUGYY_RTN_STR1("yytrace: TOK_SOURCE_COMPUTER TOK_PERIOD\n")
}
identifier_debug_mode_opt
{
identifier_scan_sw--;
}
| TOK_COPY
{
DEBUGYY_RTN_STR1("yytrace: TOK_COPY\n")
}
copy_statement TOK_PERIOD
{
copy_state_sw--;
copy_start_sw++;
identifier_scan_sw--;
}
| TOK_REPLACE replace_statement TOK_PERIOD
{
replace_state_sw--;
replace_start_sw++;
identifier_scan_sw--;
}
| TOK_REPLACE TOK_OFF TOK_PERIOD
{
replace_state_sw--;
replace_start_sw--;
identifier_scan_sw--;
}
| TOK_MODE { }
| TOK_WITH { }
| error
{
// globalEnvPtr->errFlag = 11;
errcnt++;
return 11;
}
// | ERROR
// {
// globalEnvPtr->errFlag = 12;
// errcnt++;
// return 12;
// }
// | YYERROR_VERBOSE
// {
// globalEnvPtr->errFlag = 13;
// errcnt++;
// return 13;
// }
;
copy_statement: name library_name_opt
{
/*include_filename = $1; */
include_cpybook = $1;
include_cpylib = $2;
DEBUGYY_RTN_STR15("yytrace: copy_statement: name=%s, lib=%s;\n", include_cpybook, include_cpylib)
}
TOK_REPLACING replacing_statement
| name library_name_opt
{
/*include_filename = $1;*/
include_cpybook = $1;
include_cpylib = $2;
DEBUGYY_RTN_STR15("yytrace: copy_statement: name=%s, lib=%s;\n", include_cpybook, include_cpylib)
}
;
replacing_statement: replacing_statements
| replacing_statements replacing_statement
;
replacing_statements: replacing_text TOK_BY replacing_text comma_delimiter_opt
{
add_copy_replacement($1,$3);
DEBUGYY_RTN_STR15("yytrace: replacing_statements: \'%s\' BY \'%s\':\n", $1, $3)
}
;
replacing_text: pseudo_text { $$=$1; }
| identifier { $$=$1; }
| literal { $$=$1; }
| word { $$=$1; }
;
library_name_opt: of_in name { $$=$2; }
| { $$=NULL; }
;
replace_statement: replace_statements
| replace_statements replace_statement
;
replace_statements: pseudo_text TOK_BY pseudo_text comma_delimiter_opt
{
add_replace_replacement($1,$3);
}
;
name: literal { $$=$1; }
| identifier { $$=$1; }
;
pseudo_text: TOK_PSEUDO_TEXT { $$=$1; }
;
identifier: TOK_IDENTIFIER
{
DEBUGYY_RTN_STR3("yytrace: identifier: \'%s\'\n", $1)
$$=$1;
}
;
literal: TOK_LITERAL { $$=$1; }
;
word: TOK_WORD { $$=$1; }
;
of_in: TOK_OF
| TOK_IN
;
comma_delimiter_opt: TOK_COMMA
| /* no comma */
;
identifier_debug_mode_opt: identifier debugging_mode_opt TOK_PERIOD
{
DEBUGYY_RTN_STR1("yytrace: identifier debugging_mode_opt TOK_PERIOD\n")
}
| /* empty */
;
debugging_mode_opt: with_opt TOK_DEBUGGING
TOK_MODE
{
// globalEnv.IncDebugLines = 1;
HTG_debug_lines_flag = TRUE;
DEBUGYY_RTN_STR1("yytrace: with_opt TOK_DEBUGGING TOK_MODE \n")
}
| /* empty */
;
with_opt: TOK_WITH
| /* no with */
;
%%
void pp_yyerror(char *s, ...)
{
fprintf(stderr, "htcobolpp: yyerror (%lu, %lu): %s \'%s\'\n", lineCount, columnCount, s, pp_yytext);
// globalEnvPtr->errFlag = 8;
/* return 0; */
}
#ifdef DEBUG_COBPP_PARSER
void debug_yy_rtn (const char *s1, const char *s2, const char *s3, int sw)
{
switch (sw)
{
case 3:
sprintf(erryybuf, s1, s2);
break;
case 5:
sprintf(erryybuf, s1, s3);
break;
case 15:
sprintf(erryybuf, s1, s2, s3);
break;
default:
sprintf(erryybuf, "%s", s1);
break;
}
fprintf(stderr, "%s", erryybuf);
}
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
+541
View File
@@ -0,0 +1,541 @@
/*
* Copyright (C) 2001, 2000, 1999, Rildo Pragana, David Essex.
* Copyright (C) 1993, 1991 Rildo Pragana.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
#include "htcoboly.h"
#include "htcobol.tab.h"
#include "reswords.h"
#include "htcoblib.h"
struct reserved_symbol reserved_symbols[] = {
{"<", CONDITIONAL, LESS, TCOB_KW_STD},
{"<=", CONDITIONAL, LEQ, TCOB_KW_STD85},
{"<>", CONDITIONAL, NEQ, TCOB_KW_STD},
{"=", CONDITIONAL, EQUAL, TCOB_KW_STD},
{">", CONDITIONAL, GREATER, TCOB_KW_STD},
{">=", CONDITIONAL, GEQ, TCOB_KW_STD85},
{"ACCEPT", ACCEPT, 0, TCOB_KW_STD},
{"ACCESS", ACCESS, 0, TCOB_KW_STD},
{"ADD", ADD, 0, TCOB_KW_STD},
{"ADDRESS", ADDRESS, 0, TCOB_KW_STD85},
{"ADVANCING", ADVANCING, 0, TCOB_KW_STD},
{"AFTER", AFTER, 0, TCOB_KW_STD},
{"ALL", ALL, 0, TCOB_KW_STD},
{"ALPHABET", ALPHABET, 0, TCOB_KW_STD85},
{"ALPHABETIC", ALPHABETIC, 0, TCOB_KW_STD},
{"ALPHABETIC-LOWER", ALPHABETIC_LOWER, 0, TCOB_KW_STD},
{"ALPHABETIC-UPPER", ALPHABETIC_UPPER, 0, TCOB_KW_STD},
{"ALPHANUMERIC", ALPHANUMERIC, 0, TCOB_KW_STD85},
{"ALPHANUMERIC-EDITED", ALPHANUMERIC_EDITED, 0, TCOB_KW_STD85},
{"ALSO", ALSO, 0, TCOB_KW_STD},
{"ALTERNATE", ALTERNATE, 0, TCOB_KW_STD},
{"AND", AND, 0, TCOB_KW_STD},
{"ANY", ANY, 0, TCOB_KW_STD85},
{"ARE", ARE, 0, TCOB_KW_STD},
{"AREA", AREA, 0, TCOB_KW_STD},
{"AREAS", AREAS, 0, TCOB_KW_STD},
{"ASCENDING", DIRECTION, ASCENDING, TCOB_KW_STD},
{"ASSIGN", ASSIGN, 0, TCOB_KW_STD},
{"AT", AT, 0, TCOB_KW_STD},
{"AUTHOR", AUTHOR, 0, TCOB_KW_STD},
{"AUTO", AUTO, 0, TCOB_KW_STD},
{"BACKGROUND-COLOR", BACKGROUNDCOLOR, 0, TCOB_KW_STD},
{"BEFORE", BEFORE, 0, TCOB_KW_STD},
{"BELL", BELL, 0, TCOB_KW_STD85},
{"BINARY", USAGENUM, USAGE_COMP, TCOB_KW_STD85},
{"BINARY-CHAR", USAGENUM, USAGE_BINARY_CHAR, TCOB_KW_STD2},
{"BINARY-DOUBLE", USAGENUM, USAGE_BINARY_DOUBLE, TCOB_KW_STD2},
{"BINARY-LONG", USAGENUM, USAGE_BINARY_LONG, TCOB_KW_STD2},
{"BINARY-SHORT", USAGENUM, USAGE_BINARY_SHORT, TCOB_KW_STD2},
{"BLANK", BLANK, 0, TCOB_KW_STD},
{"BLINK", BLINK, 0, TCOB_KW_STD},
{"BLOCK", BLOCK, 0, TCOB_KW_STD},
{"BOTTOM", BOTTOM, 0, TCOB_KW_STD},
{"BY", BY, 0, TCOB_KW_STD},
{"CALL", CALL, 0, TCOB_KW_STD},
{"CALL-LOADLIB", CALL_LOADLIB, 0, TCOB_KW_TCEXT},
{"CANCEL", CANCEL, 0, TCOB_KW_STD},
{"CDECL", CALL_CONV_C, 0, TCOB_KW_TCEXT},
{"CENTER", CENTER, 0, TCOB_KW_STD2},
{"CF", CF, 0, TCOB_KW_STD},
{"CH", CH, 0, TCOB_KW_STD},
{"CHAIN", CHAIN, 0, TCOB_KW_TCEXT},
{"CHAINING", CHAINING, 0, TCOB_KW_STD85},
{"CHARACTER", CHARACTER, 0, TCOB_KW_STD},
{"CHARACTERS", CHARACTERS, 0, TCOB_KW_STD},
{"CLASS", CLASS, 0, TCOB_KW_STD85},
{"CLOSE", CLOSE, 0, TCOB_KW_STD},
{"CODE", CODE, 0, TCOB_KW_STD},
{"CODE-SET", CODE_SET, 0, TCOB_KW_STD},
{"COL", COLUMN, 0, TCOB_KW_STD},
{"COLS", COLUMNS, 0, TCOB_KW_STD2},
{"COLLATING", COLLATING, 0, TCOB_KW_STD},
{"COLOR", COLOR, 0, TCOB_KW_STD},
{"COLUMN", COLUMN, 0, TCOB_KW_STD},
{"COLUMNS", COLUMNS, 0, TCOB_KW_STD2},
{"COM1", PORTNUM, 8, TCOB_KW_TCEXT},
{"COM2", PORTNUM, 1, TCOB_KW_TCEXT},
{"COM3", PORTNUM, 2, TCOB_KW_TCEXT},
{"COM4", PORTNUM, 3, TCOB_KW_TCEXT},
{"COMMA", COMMA, 0, TCOB_KW_STD},
{"COMMAND-LINE", CMD_LINE, 0, TCOB_KW_TCEXT},
{"COMMON", COMMON, 0, TCOB_KW_STD85},
{"COMP", USAGENUM, USAGE_COMP, TCOB_KW_STD},
{"COMP-1", USAGENUM, USAGE_COMP1, TCOB_KW_STD},
{"COMP-2", USAGENUM, USAGE_COMP2, TCOB_KW_STD},
{"COMP-3", USAGENUM, USAGE_COMP3, TCOB_KW_TCEXT},
{"COMP-5", USAGENUM, USAGE_COMP5, TCOB_KW_TCEXT},
{"COMP-X", USAGENUM, USAGE_COMPX, TCOB_KW_STD},
{"COMPUTATIONAL", USAGENUM, USAGE_COMP, TCOB_KW_STD},
{"COMPUTATIONAL-1", USAGENUM, USAGE_COMP1, TCOB_KW_STD},
{"COMPUTATIONAL-2", USAGENUM, USAGE_COMP2, TCOB_KW_STD},
{"COMPUTATIONAL-3", USAGENUM, USAGE_COMP3, TCOB_KW_TCEXT},
{"COMPUTATIONAL-5", USAGENUM, USAGE_COMP5, TCOB_KW_TCEXT},
{"COMPUTATIONAL-X", USAGENUM, USAGE_COMPX, TCOB_KW_STD},
{"COMPUTE", COMPUTE, 0, TCOB_KW_STD},
{"CONFIGURATION", CONFIGURATION, 0, TCOB_KW_STD},
{"CONSOLE", CONSOLE, 0, TCOB_KW_STD},
{"CONTAINS", CONTAINS, 0, TCOB_KW_STD},
{"CONTENT", CONTENT, 0, TCOB_KW_STD85},
{"CONTINUE", CONTINUE, 0, TCOB_KW_STD85},
{"CONTROL", CONTROL, 0, TCOB_KW_STD},
{"CONTROLS", CONTROLS, 0, TCOB_KW_STD},
{"CONVERTING", CONVERTING, 0, TCOB_KW_STD85},
/*{"COPY", COPY, 0, TCOB_KW_STD}, used by pre-processor only */
{"CORR", CORRESPONDING, 0, TCOB_KW_STD},
{"CORRESPONDING", CORRESPONDING, 0, TCOB_KW_STD},
{"COUNT", COUNT, 0, TCOB_KW_STD},
{"CRT", DISPLAY_SCREEN, 0, TCOB_KW_TCEXT},
{"CURRENCY", CURRENCY, 0, TCOB_KW_STD},
{"CURSOR", CURSOR, 0, TCOB_KW_STD},
/*{"DARK", DARK, 0, TCOB_KW_TCEXT}, not used */
{"DATA", DATA, 0, TCOB_KW_STD},
{"DATE", DATE_TIME, DATE, TCOB_KW_STD},
{"DATE-COMPILED", DATE_COMPILED, 0, TCOB_KW_STD},
{"DATE-WRITTEN", DATE_WRITTEN, 0, TCOB_KW_STD},
{"DAY", DATE_TIME, DAY, TCOB_KW_STD},
{"DAY-OF-WEEK", DATE_TIME, DAY_OF_WEEK, TCOB_KW_STD85},
{"DE", DE, 0, TCOB_KW_STD},
{"DEBUGGING", DEBUGGING, 0, TCOB_KW_STD},
{"DECIMAL-POINT", DECIMAL_POINT, 0, TCOB_KW_STD},
{"DECLARATIVES", DECLARATIVES, 0, TCOB_KW_STD},
{"DELETE", DELETE, 0, TCOB_KW_STD},
{"DELIMITED", DELIMITED, 0, TCOB_KW_STD},
{"DELIMITER", DELIMITER, 0, TCOB_KW_STD},
{"DEPENDING", DEPENDING, 0, TCOB_KW_STD},
{"DESCENDING", DIRECTION, DESCENDING, TCOB_KW_STD},
{"DETAIL", DETAIL, 0, TCOB_KW_STD},
{"DISK", PORTNUM, 0, TCOB_KW_STD},
{"DISPLAY", DISPLAY, 0, TCOB_KW_STD},
{"DIVIDE", DIVIDE, 0, TCOB_KW_STD},
{"DIVISION", DIVISION, 0, TCOB_KW_STD},
{"DOWN", DOWN, 0, TCOB_KW_STD},
{"DUPLICATES", DUPLICATES, 0, TCOB_KW_STD},
{"DYNAMIC", DYNAMIC, 0, TCOB_KW_STD},
/*{"ECHO", ECHOT, 0, TCOB_KW_TCEXT}, not used */
{"ELSE", ELSE, 0, TCOB_KW_STD},
{"END", END, 0, TCOB_KW_STD},
{"END-ACCEPT", END_ACCEPT, 0, TCOB_KW_STD85},
{"END-ADD", END_ADD, 0, TCOB_KW_STD85},
{"END-CALL-LOADLIB", END_CALL_LOADLIB, 0, TCOB_KW_TCEXT},
{"END-CALL", END_CALL, 0, TCOB_KW_STD85},
{"END-CHAIN", END_CHAIN, 0, TCOB_KW_STD85},
{"END-COMPUTE", END_COMPUTE, 0, TCOB_KW_STD85},
{"END-DELETE", END_DELETE, 0, TCOB_KW_STD85},
{"END-DISPLAY", END_DISPLAY, 0, TCOB_KW_STD85},
{"END-DIVIDE", END_DIVIDE, 0, TCOB_KW_STD85},
{"END-EVALUATE", END_EVALUATE, 0, TCOB_KW_STD85},
{"END-IF", END_IF, 0, TCOB_KW_STD85},
{"END-MULTIPLY", END_MULTIPLY, 0, TCOB_KW_STD85},
{"END-OF-PAGE", END_OF_PAGE, 0, TCOB_KW_STD},
{"END-PERFORM", END_PERFORM, 0, TCOB_KW_STD85},
{"END-READ", END_READ, 0, TCOB_KW_STD85},
{"END-RETURN", END_RETURN, 0, TCOB_KW_STD85},
{"END-REWRITE", END_REWRITE, 0, TCOB_KW_STD85},
{"END-SEARCH", END_SEARCH, 0, TCOB_KW_STD85},
{"END-START", END_START, 0, TCOB_KW_STD85},
{"END-STRING", END_STRINGCMD, 0, TCOB_KW_STD85},
{"END-SUBTRACT", END_SUBTRACT, 0, TCOB_KW_STD85},
{"END-UNSTRING", END_UNSTRING, 0, TCOB_KW_STD85},
{"END-WRITE", END_WRITE, 0, TCOB_KW_STD85},
{"ENVIRONMENT", ENVIRONMENT, 0, TCOB_KW_STD},
{"ENVIRONMENT-VARIABLE", ENVIRONMENT_VARIABLE, 0, TCOB_KW_TCEXT},
{"EOL", EOL, 0, TCOB_KW_TCEXT},
{"EOP", END_OF_PAGE, 0, TCOB_KW_STD},
{"EOS", EOS, 0, TCOB_KW_TCEXT},
{"EQUAL", CONDITIONAL, EQUAL, TCOB_KW_STD},
{"ERASE", ERASE, 0, TCOB_KW_STD},
{"ERROR", ERROR_TOK, 0, TCOB_KW_STD},
{"ESCKEY", ESCKEY, 0, TCOB_KW_TCEXT},
{"EVALUATE", EVALUATE, 0, TCOB_KW_STD85},
{"EXCEPTION", EXCEPTION, 0, TCOB_KW_STD},
{"EXIT", EXIT, 0, TCOB_KW_STD},
{"EXTEND", EXTEND, 0, TCOB_KW_STD},
{"EXTERNAL", EXTERNAL, 0, TCOB_KW_STD85},
{"FALSE", FALSE_TOK, 0, TCOB_KW_STD85},
{"FD", FD, 0, TCOB_KW_STD},
{"FILE", FILE_TOK, 0, TCOB_KW_STD},
{"FILE-CONTROL", FILE_CONTROL, 0, TCOB_KW_STD},
{"FILE-ID", FILE_ID, 0, TCOB_KW_STD},
{"FILLER", FILLER, 0, TCOB_KW_STD},
{"FINAL", FINAL, 0, TCOB_KW_STD},
{"FIRST", FIRST, 0, TCOB_KW_STD},
{"FLOAT-LONG", USAGENUM, USAGE_COMP2, TCOB_KW_STD2},
{"FLOAT-SHORT", USAGENUM, USAGE_COMP1, TCOB_KW_STD2},
{"FOOTING", FOOTING, 0, TCOB_KW_STD},
{"FOR", FOR, 0, TCOB_KW_STD},
{"FOREGROUND-COLOR", FOREGROUNDCOLOR, 0, TCOB_KW_STD85},
{"FROM", FROM, 0, TCOB_KW_STD},
{"FULL", FULL, 0, TCOB_KW_STD},
{"FUNCTION", FUNCTION, 0, TCOB_KW_STD85},
{"GENERATE", GENERATE, 0, TCOB_KW_STD},
{"GIVING", GIVING, 0, TCOB_KW_STD},
{"GLOBAL", GLOBAL, 0, TCOB_KW_STD85},
{"GO", GO, 0, TCOB_KW_STD},
{"GOBACK", GOBACK, 0, TCOB_KW_TCEXT},
{"GREATER", CONDITIONAL, GREATER, TCOB_KW_STD},
{"GROUP", GROUP, 0, TCOB_KW_STD},
{"HEADING", HEADING, 0, TCOB_KW_STD},
{"HIGH-VALUE", HIGHVALUES, 0, TCOB_KW_STD},
{"HIGH-VALUES", HIGHVALUES, 0, TCOB_KW_STD},
{"HIGHLIGHT", HIGHLIGHT, 0, TCOB_KW_TCEXT},
{"I-O", I_O, 0, TCOB_KW_STD},
{"I-O-CONTROL", I_O_CONTROL, 0, TCOB_KW_STD},
{"IDENTIFICATION", IDENTIFICATION, 0, TCOB_KW_STD},
{"IF", IF, 0, TCOB_KW_STD},
{"IGNORE", IGNORE, 0, TCOB_KW_TCEXT},
{"IN", IN, 0, TCOB_KW_STD},
{"INDEX", USAGENUM, USAGE_INDEX, TCOB_KW_STD},
{"INDEXED", INDEXED, 0, TCOB_KW_STD},
{"INDICATE", INDICATE, 0, TCOB_KW_STD},
{"INITIAL", INITIAL_TOK, 0, TCOB_KW_STD},
{"INITIALIZE", INITIALIZE, 0, TCOB_KW_STD85},
{"INITIATE", INITIATE, 0, TCOB_KW_STD},
{"INKEY", INKEY, 0, TCOB_KW_TCEXT},
{"INPUT", INPUT, 0, TCOB_KW_STD},
{"INPUT-OUTPUT", INPUT_OUTPUT, 0, TCOB_KW_STD},
{"INSPECT", INSPECT, 0, TCOB_KW_STD},
{"INSTALLATION", INSTALLATION, 0, TCOB_KW_STD},
{"INTO", INTO, 0, TCOB_KW_STD},
{"INVALID", INVALID, 0, TCOB_KW_STD},
{"IS", IS, 0, TCOB_KW_STD},
{"JUST", JUSTIFIED, 0, TCOB_KW_STD},
{"JUSTIFIED", JUSTIFIED, 0, TCOB_KW_STD},
{"KEY", KEY, 0, TCOB_KW_STD},
{"LABEL", LABEL, 0, TCOB_KW_STD},
{"LAST", LAST, 0, TCOB_KW_STD},
{"LEADING", LEADING, 0, TCOB_KW_STD},
{"LEFT", LEFT, 0, TCOB_KW_STD},
{"LENGTH", LENGTH, 0, TCOB_KW_STD},
{"LESS", CONDITIONAL, LESS, TCOB_KW_STD},
{"LIMIT", LIMIT, 0, TCOB_KW_STD},
{"LIMITS", LIMITS, 0, TCOB_KW_STD},
{"LINAGE", LINAGE, 0, TCOB_KW_STD},
{"LINE", LINE, 0, TCOB_KW_STD},
{"LINES", LINES, 0, TCOB_KW_STD},
{"LINKAGE", LINKAGE, 0, TCOB_KW_STD},
{"LOCK", LOCK, 0, TCOB_KW_STD},
{"LOW-VALUE", LOWVALUES, 0, TCOB_KW_STD},
{"LOW-VALUES", LOWVALUES, 0, TCOB_KW_STD},
{"LOWER", LOWER, 0, TCOB_KW_STD},
{"LOWLIGHT", LOWLIGHT, 0, TCOB_KW_STD},
{"LPT1", PORTNUM, 4, TCOB_KW_TCEXT},
{"LPT2", PORTNUM, 5, TCOB_KW_TCEXT},
{"LPT3", PORTNUM, 6, TCOB_KW_TCEXT},
{"LPT4", PORTNUM, 7, TCOB_KW_TCEXT},
{"MERGE", MERGE, 0, TCOB_KW_STD},
{"MINUS", MINUS, 0, TCOB_KW_STD},
{"MODE", MODE, 0, TCOB_KW_STD},
{"MOVE", MOVE, 0, TCOB_KW_STD},
{"MULTIPLE", MULTIPLE, 0, TCOB_KW_STD},
{"MULTIPLY", MULTIPLY, 0, TCOB_KW_STD},
{"NATIVE", NATIVE, 0, TCOB_KW_STD},
{"NEGATIVE", NEGATIVE, 0, TCOB_KW_STD},
{"NEXT", NEXT, 0, TCOB_KW_STD},
{"NO", NO, 0, TCOB_KW_STD},
{"NO-ECHO", NOECHO, 0, TCOB_KW_TCEXT},
{"NOT", NOT, 0, TCOB_KW_STD},
{"NULL", NULL_TOK, 0, TCOB_KW_STD},
{"NUMBER", NUMBER, 0, TCOB_KW_STD},
{"NUMBERS", NUMBERS, 0, TCOB_KW_STD},
{"NUMERIC", NUMERIC, 0, TCOB_KW_STD},
{"NUMERIC-EDITED", NUMERIC_EDITED, 0, TCOB_KW_STD},
{"OBJECT-COMPUTER", OBJECT_COMPUTER, 0, TCOB_KW_STD},
{"OCCURS", OCCURS, 0, TCOB_KW_STD},
{"OF", OF, 0, TCOB_KW_STD},
{"OFF", OFF, 0, TCOB_KW_STD},
{"OMITTED", OMITTED, 0, TCOB_KW_STD},
{"ON", ON, 0, TCOB_KW_STD},
{"ONLY", ONLY, 0, TCOB_KW_STD},
{"OPEN", OPEN, 0, TCOB_KW_STD},
{"OPTIONAL", OPTIONAL, 0, TCOB_KW_STD},
{"OR", OR, 0, TCOB_KW_STD},
{"ORDER", ORDER, 0, TCOB_KW_STD85},
{"ORGANIZATION", ORGANIZATION, 0, TCOB_KW_STD},
{"OTHER", OTHER, 0, TCOB_KW_STD85},
{"OUTPUT", OUTPUT, 0, TCOB_KW_STD},
{"OVERFLOW", OVERFLOW_TOK, 0, TCOB_KW_STD},
{"PACKED-DECIMAL", USAGENUM, USAGE_COMP3, TCOB_KW_STD85},
{"PADDING", PADDING, 0, TCOB_KW_STD85},
{"PAGE", PAGE, 0, TCOB_KW_STD},
{"PAGE-COUNTER", PAGE_COUNTER, 0, TCOB_KW_STD},
{"PARAGRAPH", PARAGRAPH, 0, TCOB_KW_STD85},
{"PERFORM", PERFORM, 0, TCOB_KW_STD},
{"PF", PF, 0, TCOB_KW_STD},
{"PH", PH, 0, TCOB_KW_STD},
{"PIC", PICTURE, 0, TCOB_KW_STD},
{"PICTURE", PICTURE, 0, TCOB_KW_STD},
{"PLUS", PLUS, 0, TCOB_KW_STD},
{"POINTER", POINTER, 0, TCOB_KW_STD},
{"POSITION", POSITION, 0, TCOB_KW_STD},
{"POSITIVE", POSITIVE, 0, TCOB_KW_STD},
{"PREV", PREVIOUS, 0, TCOB_KW_STD},
{"PREVIOUS", PREVIOUS, 0, TCOB_KW_STD},
{"PRINTER", PORTNUM, 4, TCOB_KW_STD},
{"PROCEDURE", PROCEDURE, 0, TCOB_KW_STD},
{"PROCEED", PROCEED, 0, TCOB_KW_STD},
{"PROGRAM", PROGRAM, 0, TCOB_KW_STD},
{"PROGRAM-ID", PROGRAM_ID, 0, TCOB_KW_STD},
{"QUOTE", QUOTES, 0, TCOB_KW_STD},
{"QUOTES", QUOTES, 0, TCOB_KW_STD},
{"RANDOM", RANDOM, 0, TCOB_KW_STD},
{"RD", RD, 0, TCOB_KW_STD},
{"READ", READ, 0, TCOB_KW_STD},
{"READY", READY, 0, TCOB_KW_STD},
{"RECORD", RECORD, 0, TCOB_KW_STD},
{"RECORDS", RECORDS, 0, TCOB_KW_STD},
{"REDEFINES", REDEFINES, 0, TCOB_KW_STD},
{"REFERENCE", REFERENCE, 0, TCOB_KW_STD85},
{"REEL", REEL, 0, TCOB_KW_STD},
{"RELATIVE", RELATIVE, 0, TCOB_KW_STD},
{"RELEASE", RELEASE, 0, TCOB_KW_STD},
{"REMAINDER", REMAINDER, 0, TCOB_KW_STD},
{"REMOVAL", REMOVAL, 0, TCOB_KW_STD},
{"RENAMES", RENAMES, 0, TCOB_KW_STD},
{"REPLACING", REPLACING, 0, TCOB_KW_STD},
{"REPORT", REPORT, 0, TCOB_KW_STD},
{"REPORTS", REPORTS, 0, TCOB_KW_STD},
{"REQUIRED", REQUIRED, 0, TCOB_KW_STD},
{"RESERVE", RESERVE, 0, TCOB_KW_STD},
{"RESET", RESET, 0, TCOB_KW_STD},
{"RETURN", RETURN, 0, TCOB_KW_STD},
{"RETURNING", RETURNING, 0, TCOB_KW_STD},
{"REVERSE-VIDEO", REVERSEVIDEO, 0, TCOB_KW_TCEXT},
{"REWIND", REWIND, 0, TCOB_KW_STD},
{"REWRITE", REWRITE, 0, TCOB_KW_STD},
{"RF", RF, 0, TCOB_KW_STD},
{"RH", RH, 0, TCOB_KW_STD},
{"RIGHT", RIGHT, 0, TCOB_KW_STD},
{"ROUNDED", ROUNDED, 0, TCOB_KW_STD},
{"RUN", RUN, 0, TCOB_KW_STD},
{"SAME", SAME, 0, TCOB_KW_STD},
{"SCREEN", SCREEN, 0, TCOB_KW_STD},
{"SD", SD, 0, TCOB_KW_STD},
{"SEARCH", SEARCH, 0, TCOB_KW_STD},
{"SECTION", SECTION, 0, TCOB_KW_STD},
{"SECURE", SECURE, 0, TCOB_KW_STD},
{"SECURITY", SECURITY, 0, TCOB_KW_STD},
{"SELECT", SELECT, 0, TCOB_KW_STD},
{"SENTENCE", SENTENCE, 0, TCOB_KW_STD},
{"SEPARATE", SEPARATE, 0, TCOB_KW_STD},
{"SEQUENCE", SEQUENCE, 0, TCOB_KW_STD},
{"SEQUENTIAL", SEQUENTIAL, 0, TCOB_KW_STD},
{"SET", SET, 0, TCOB_KW_STD},
{"SIGN", SIGN, 0, TCOB_KW_STD},
{"SIZE", SIZE, 0, TCOB_KW_STD},
{"SORT", SORT, 0, TCOB_KW_STD},
{"SORT-MERGE", SORT_MERGE, 0, TCOB_KW_STD},
{"SOURCE", SOURCE, 0, TCOB_KW_STD},
{"SOURCE-COMPUTER", SOURCE_COMPUTER, 0, TCOB_KW_STD},
{"SPACE", SPACES, 0, TCOB_KW_STD},
{"SPACES", SPACES, 0, TCOB_KW_STD},
{"SPECIAL-NAMES", SPECIAL_NAMES, 0, TCOB_KW_STD},
{"STANDARD", STANDARD, 0, TCOB_KW_STD},
{"STANDARD-1", STANDARD_1, 0, TCOB_KW_STD},
{"STANDARD-2", STANDARD_2, 0, TCOB_KW_STD85},
{"START", START, 0, TCOB_KW_STD},
{"STATUS", STATUS, 0, TCOB_KW_STD},
{"STDCALL", CALL_CONV_STDCALL, 0, TCOB_KW_TCEXT},
{"STD-ERROR", STD_ERROR, 0, TCOB_KW_TCEXT},
{"STD-OUTPUT", STD_OUTPUT, 0, TCOB_KW_TCEXT},
{"STOP", STOP, 0, TCOB_KW_STD},
{"STRING", STRINGCMD, 0, TCOB_KW_STD},
{"SUBTRACT", SUBTRACT, 0, TCOB_KW_STD},
{"SUM", SUM, 0, TCOB_KW_STD},
{"SYNC", SYNCHRONIZED, 0, TCOB_KW_STD},
{"SYNCHRONIZED", SYNCHRONIZED, 0, TCOB_KW_STD},
{"TALLYING", TALLYING, 0, TCOB_KW_STD},
{"TAPE", TAPE, 0, TCOB_KW_STD},
{"TCOB-PROTOTYPE1", TCOBPROTO1, 0, TCOB_KW_TCEXT},
{"TCOB-PROTOTYPE2", TCOBPROTO2, 0, TCOB_KW_TCEXT},
{"TERMINATE", TERMINATE, 0, TCOB_KW_STD},
{"TEST", TEST, 0, TCOB_KW_STD},
{"THAN", THAN, 0, TCOB_KW_STD},
{"THEN", THEN, 0, TCOB_KW_STD},
{"THROUGH", THRU, 0, TCOB_KW_STD},
{"THRU", THRU, 0, TCOB_KW_STD},
{"TIME", DATE_TIME, TIME, TCOB_KW_STD},
{"TIMES", TIMES, 0, TCOB_KW_STD},
{"TO", TO, 0, TCOB_KW_STD},
{"TOP", TOP, 0, TCOB_KW_STD},
{"TRACE", TRACE, 0, TCOB_KW_STD},
{"TRAILING", TRAILING, 0, TCOB_KW_STD},
{"TRUE", TRUE_TOK, 0, TCOB_KW_STD},
{"TYPE", TYPE, 0, TCOB_KW_STD},
{"UNDERLINE", UNDERLINE, 0, TCOB_KW_TCEXT},
{"UNIT", UNIT, 0, TCOB_KW_STD},
{"UNLOCK", UNLOCK, 0, TCOB_KW_STD},
{"UNSTRING", UNSTRING, 0, TCOB_KW_STD},
{"UNTIL", UNTIL, 0, TCOB_KW_STD},
{"UP", UP, 0, TCOB_KW_STD},
{"UPDATE", UPDATE, 0, TCOB_KW_STD},
{"UPON", UPON, 0, TCOB_KW_STD},
{"UPPER", UPPER, 0, TCOB_KW_STD},
{"USAGE", USAGE, 0, TCOB_KW_STD},
{"USE", USE, 0, TCOB_KW_STD},
{"USING", USING, 0, TCOB_KW_STD},
{"VALUE", VALUE, 0, TCOB_KW_STD},
{"VALUES", VALUES, 0, TCOB_KW_STD},
{"VARYING", VARYING, 0, TCOB_KW_STD},
{"WHEN", WHEN, 0, TCOB_KW_STD},
{"WINAPI", CALL_CONV_STDCALL, 0, TCOB_KW_TCEXT},
{"WITH", WITH, 0, TCOB_KW_STD},
{"WORKING-STORAGE", WORKING_STORAGE, 0, TCOB_KW_STD},
{"WRITE", WRITE, 0, TCOB_KW_STD},
{"ZERO", ZERO, 0, TCOB_KW_STD},
{"ZEROES", ZERO, 0, TCOB_KW_STD},
{"ZEROS", ZERO, 0, TCOB_KW_STD},
{"",0,0,0}
};
struct intrinsic_function intrinsic_functions[] = {
{"ABS",ITYPE_FLOAT,1},
{"ACOS",ITYPE_FLOAT,1},
{"ANNUITY",ITYPE_FLOAT,2},
{"ASIN",ITYPE_FLOAT,1},
{"ATAN",ITYPE_FLOAT,1},
{"CHAR",ITYPE_INLINE,1}, /* inline */
{"COS",ITYPE_FLOAT,1},
{"CURRENT-DATE",ITYPE_DATETIME,0},
{"DATE-OF-INTEGER",ITYPE_DATE,1},
{"DATE-TO-YYYYMMDD",ITYPE_DATE,ANY_NUMBER}, /* params can be 1 or 2 */
{"DAY-OF-INTEGER",ITYPE_JULIANDATE,1},
{"DAY-TO-YYYYDDD",ITYPE_JULIANDATE,ANY_NUMBER}, /* params can be 1 or 2 */
{"FACTORIAL",ITYPE_INT,1},
{"INTEGER",ITYPE_INT,1},
{"INTEGER-OF-DATE",ITYPE_INT,1},
{"INTEGER-OF-DAY",ITYPE_INT,1},
{"INTEGER-PART",ITYPE_INT,1},
{"LENGTH",ITYPE_INLINE,1}, /* inline */
{"LOG",ITYPE_FLOAT,1},
{"LOG10",ITYPE_FLOAT,1},
{"LOWER-CASE",ITYPE_ALPHA,1},
{"MAX",ITYPE_FLOAT,ANY_NUMBER},
{"MEAN",ITYPE_FLOAT,ANY_NUMBER},
{"MEDIAN",ITYPE_FLOAT,ANY_NUMBER},
{"MIDRANGE",ITYPE_FLOAT,ANY_NUMBER},
{"MIN",ITYPE_FLOAT,ANY_NUMBER},
{"MOD",ITYPE_INT,2},
{"NUMVAL",ITYPE_FLOAT,1},
{"NUMVAL-C",ITYPE_FLOAT,ANY_NUMBER},
{"ORD",ITYPE_INLINE,1}, /* inline */
{"ORD-MAX",ITYPE_INT,ANY_NUMBER},
{"ORD-MIN",ITYPE_INT,ANY_NUMBER},
{"PRESENT-VALUE",ITYPE_FLOAT,ANY_NUMBER},
{"RANDOM",ITYPE_FLOAT,ANY_NUMBER}, /* really 1 or 0 params */
{"RANGE",ITYPE_FLOAT,ANY_NUMBER},
{"REM",ITYPE_INT,2},
{"REVERSE",ITYPE_ALPHA,1},
{"SIN",ITYPE_FLOAT,1},
{"SQRT",ITYPE_FLOAT,1},
{"STANDARD-DEVIATION",ITYPE_FLOAT,ANY_NUMBER},
{"SUM",ITYPE_FLOAT,ANY_NUMBER},
{"TAN",ITYPE_FLOAT,1},
{"TEST-DATE-YYYYMMDD",ITYPE_INT,1},
{"TEST-DAY-YYYYDDD",ITYPE_INT,1},
{"UPPER-CASE",ITYPE_ALPHA,1},
{"VARIANCE",ITYPE_FLOAT,ANY_NUMBER},
{"WHEN-COMPILED",ITYPE_INLINE,0}, /* inline (we should save the date at compile time) */
{"YEAR-TO-YYYY",ITYPE_YEAR,1},
{"",0,0}
};
static struct reserved_sym *reserved_tab[ HASHLEN ]={NULL};
static struct intrinsic_sym *intrinsic_tab[ HASHLEN ]={NULL};
struct reserved_sym *lookup_reserved( char *s ) {
struct reserved_sym *as;
for ( as = reserved_tab[ hash(s) ] ; as != NULL ; as = as->next )
if ( strcasecmp( s, as->name ) == 0 ) {
return( as );
}
return( NULL );
}
void install_reserved( void ) {
struct reserved_sym *as = NULL;
struct intrinsic_sym *is = NULL;
int val,i;
for (i=0;strcmp(reserved_symbols[i].name,"");i++) {
as = (struct reserved_sym *)
malloc( sizeof(struct reserved_sym) );
as->name = savename( reserved_symbols[i].name );
val = hash( as->name );
as->next = reserved_tab[ val ];
reserved_tab[ val ] = as;
as->i=i;
}
for (i=0;strcmp(intrinsic_functions[i].name,"");i++) {
is = (struct intrinsic_sym *)
malloc( sizeof(struct intrinsic_sym) );
is->name = savename( intrinsic_functions[i].name );
val = hash( is->name );
is->next = intrinsic_tab[ val ];
intrinsic_tab[ val ] = is;
is->i=i;
}
}
int reserved( char *s ) {
struct reserved_sym *r;
if ((r=lookup_reserved(s))!=NULL) {
yylval.ival=reserved_symbols[r->i].minor;
return reserved_symbols[r->i].token;
}
return 0;
}
struct intrinsic_sym *lookup_intrinsic_sym( char *s ) {
struct intrinsic_sym *is;
for ( is = intrinsic_tab[ hash(s) ] ; is != NULL ; is = is->next )
if ( strcasecmp( s, is->name ) == 0 ) {
return( is );
}
return( NULL );
}
struct intrinsic_function *lookup_intrinsic_function( char *s ) {
struct intrinsic_sym *is;
for ( is = intrinsic_tab[ hash(s) ] ; is != NULL ; is = is->next )
if ( strcasecmp( s, is->name ) == 0 ) {
return & ( intrinsic_functions[is->i] );
}
return( NULL );
}
+59
View File
@@ -0,0 +1,59 @@
/*
* Copyright (C) 2001, 2000, 1999, Rildo Pragana, David Essex.
* Copyright (C) 1993, 1991 Rildo Pragana.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
#define HASHLEN 100
#define TCOB_KW_TCEXT 0
#define TCOB_KW_STD 1
#define TCOB_KW_STD74 74
#define TCOB_KW_STD85 85
#define TCOB_KW_STD2 200
/*
#define TCOB_KW_DIAL_MF 4
#define TCOB_KW_DIAL_TC 5
*/
struct reserved_symbol {
char *name;
int token;
unsigned minor;
unsigned char dialect;
};
struct reserved_sym {
char *name;
struct reserved_sym *next;
int i; /* index on reserved symbol table */
};
struct intrinsic_sym {
char *name;
struct intrinsic_sym *next;
int i; /* index on intrinsic symbol table */
};
void install_reserved (void);
int reserved( char *s );
struct intrinsic_sym *lookup_intrinsic_sym( char *s );
Binary file not shown.
+8
View File
@@ -0,0 +1,8 @@
MSYS-1.0.11 Build:2009-07-11 17:46
Exception: STATUS_ACCESS_VIOLATION at eip=00000000
eax=00000000 ebx=60E915DC ecx=00561CD8 edx=60E915DC esi=00000000 edi=60E900D4
ebp=0022FE98 esp=0022FE6C program=C:\MinGW\1.0\bin\rm.exe
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame Function Args
End of stack trace
+3127
View File
File diff suppressed because it is too large Load Diff
+817
View File
@@ -0,0 +1,817 @@
/*
* Copyright (C) 2001, 2000, 1999, Rildo Pragana.
* Copyright (C) 1993, 1991 Rildo Pragana.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
/*
** COBOL scanner
** Scanner para o Compilador COBOL
*/
%{
#include "htcoblib.h"
#include "htglobals.h"
#include <ctype.h>
#define MAX_COPY_DEPTH 10
#define MAX_CPYNAME_LEN 65
#define MAXLINEBUF 256
void scdebug( char *fmt, ... );
char *savename1(const char*, int, int);
#define lexchar input
/* extern int lexgetc(void); */
int source_debug=0;
int envdiv_bypass_save_sw=0;
int stabs_started=0;
extern FILE *o_lst;
int lex_fgets( char *buf, int maxsize );
#define YY_INPUT(buf,result,max_size) \
{ \
result = lex_fgets( buf, max_size ); \
}
/*
redefines the lexer so that we define yylex to call yylex2 and save
the token returned by the real lexer (yylex2)
*/
int prev_token=0;
#ifdef YY_USE_PROTOS
#define YY_DECL int yylex2 YY_PROTO((void))
#else
#define YY_PROTO(proto) (void)
#define YY_DECL int yylex2(void)
#endif
%}
AnyNoDQuote [^"\t\n]
AnyNoSQuote [^'\t\n]
cobword [A-Za-z0-9\-_\$]
letters [A-Za-z]
alphanum [A-Za-z0-9]
ident {alphanum}(({alphanum}|-|_|$)*{alphanum}+)?
exletter {letters}|-
digit [0-9]
pic_ch [9XVSBZAP.,-+*/$]
relop [<>=]
white [\r\t ]
white_nl [\r\t \n]
lpar \(
rpar \)
sdelim \"
ldelim \'
lhexa [xX]
any [!-~�]
int {digit}({digit})*
decdelim [.,]
sign [+-]
notperiod [^.\n]
period [.]
%{
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "htcoboly.h"
#include "htcobol.tab.h" /* definitions from YACC */
#include "reswords.h"
#define TOKTEXT_SIZE 1024
char toktext[TOKTEXT_SIZE];
char *tp;
unsigned char hnum[512];
unsigned int varnumber;
int reserved_token;
int previous_state = 0;
short function_seen = 0;
int eos_detect=0;
#define svtoken() strncpy(toktext,yytext,sizeof(toktext))
%}
%x IDENT_ST ENVIR_ST DATA_ST COMMENT_ST FD_ST REDEF_ST
%x SUBSCRIPTS_ST EXCEPTION_ST PIC_ST PIC_ST2 COMMENT1_ST
%%
%{
extern int curr_division;
extern int need_subscripts;
/* struct copy_symbols *tmp = NULL; */
switch (curr_division) {
case CDIV_IDENT:
scdebug("-> IDENT_ST\n");
BEGIN IDENT_ST;
break;
case CDIV_ENVIR:
scdebug("-> ENVIR_ST\n");
BEGIN ENVIR_ST;
break;
case CDIV_DATA:
scdebug("-> DATA_ST\n");
BEGIN DATA_ST;
break;
case CDIV_PROC:
/* stabs_started=1; */
scdebug("-> INITIAL\n");
BEGIN INITIAL;
break;
case CDIV_COMMENT:
scdebug("-> COMMENT_ST\n");
BEGIN COMMENT_ST;
break;
case CDIV_COMMENT1:
scdebug("-> COMMENT1_ST\n");
BEGIN COMMENT1_ST;
break;
case CDIV_FD:
scdebug("-> FD_ST\n");
BEGIN FD_ST;
break;
case CDIV_REDEF:
scdebug("-> REDEF_ST\n");
BEGIN REDEF_ST;
break;
case CDIV_SUBSCRIPTS:
scdebug("-> SUBSCRIPTS_ST\n");
BEGIN SUBSCRIPTS_ST;
break;
case CDIV_EXCEPTION:
scdebug("-> EXCEPTION_ST\n");
BEGIN EXCEPTION_ST;
break;
case CDIV_PIC:
scdebug("-> PIC_ST\n");
BEGIN PIC_ST;
break;
case CINITIAL:
scdebug("-> INITIAL\n");
BEGIN INITIAL;
break;
}
curr_division=0; /* avoid new state switch */
%}
<*>^"#".* {
char *endp;
source_lineno = strtol (yytext + 2, &endp, 10);
if (source_lineno > 0)
source_lineno--;
if (source_filename)
free (source_filename);
source_filename = strdup (strchr (endp, '"') + 1);
strrchr (source_filename, '"')[0] = '\0';
scdebug("NEW FILE/LINE : %s,%d\n", source_filename,source_lineno);
}
<*>"EJECT"|"SKIP1"|"SKIP2"|"SKIP3" { /* throw away this */ }
<*>^[ \t]?"*".*$ {
/* allow floating comment line */
scdebug("<comment>: %s:\n", yytext);
}
<*>^"D ".* {
if (!source_debug)
scdebug("<comment>: %s:\n", yytext);
else
yyless(2);
}
";" { }
"," { }
{lpar} {
if (need_subscripts) {
scdebug("<LPAR>:\n");
need_subscripts=0;
return(LPAR);
}
else {
return('(');
}
}
{white}+ { }
<INITIAL,SUBSCRIPTS_ST>{ident} { {
struct sym *symbol;
svtoken();
if (is_integer_token(toktext) && prev_token == PERIOD_TOK) {
yylval.sval=install(toktext,SYTB_LAB,0);
scdebug("<LABELSTR>: %s\n", toktext);
return(LABELSTR);
}
/* if (is_integer_token(toktext) && !eos_detect) {*/
if (is_integer_token(toktext)) {
scdebug("<NLITERAL>: %s\n", toktext);
yylval.lval = (struct lit *)install_lit(toktext,0,0);
return(NLITERAL);
}
eos_detect=0;
if (!is_valid_identifier(toktext)) {
yylval.sval=install(toktext,SYTB_LAB,0);
scdebug("<LABELSTR>: %s\n", toktext);
return(LABELSTR);
}
else {
if ((reserved_token=reserved(toktext))!=0)
{
if (reserved_token == FUNCTION) function_seen=TRUE;
/* special case of 4 intrinsics which are also reserved */
if (function_seen && lookup_intrinsic_sym(toktext) != NULL)
{
yylval.sval=install(toktext,SYTB_LAB,0);
scdebug(" <LABELSTR>: %s\n", toktext);
return(LABELSTR);
}
scdebug(" <reserved>: %s\n", toktext);
return reserved_token;
}
/* if symbol was defined at the data division */
if (symbol=lookup(toktext,2)) {
yylval.sval=symbol;
if (symbol->type == '8') {
scdebug("<VARCOND>: %s\n",toktext);
update_xreflist(yylval.sval);
return(VARCOND);
}
else {
if (is_subscripted(symbol)) {
scdebug("<SUBSCVAR>: %s\n",toktext);
return(SUBSCVAR);
}
scdebug("<VARIABLE>: %s\n", toktext);
update_xreflist(yylval.sval);
return(VARIABLE);
}
}
/* otherwise, it should be a label */
else {
yylval.sval=install(toktext,SYTB_LAB,0);
scdebug("<LABELSTR>: %s\n", toktext);
return(LABELSTR);
}
}
} }
<ENVIR_ST>{ident} {
svtoken();
if (is_integer_token(toktext)) {
scdebug("<NLITERAL>: %s\n", toktext);
yylval.lval = (struct lit *)install_lit(toktext,0,0);
return(NLITERAL);
}
if (!is_valid_identifier(toktext)) {
yylval.sval=install(toktext,SYTB_LAB,0);
scdebug("<LABELSTR>: %s\n", toktext);
return(LABELSTR);
}
else {
if ((reserved_token=reserved(toktext))!=0)
{
scdebug(" <reserved>: %s\n", toktext);
return reserved_token;
}
scdebug("<STRING>: %s\n", toktext);
if (envdiv_bypass_save_sw == 0) {
yylval.sval=install(toktext,SYTB_VAR,0);
update_xreflist(yylval.sval);
}
return(STRING);
}
}
<EXCEPTION_ST>{ident} { {
struct sym *symbol;
svtoken();
if (is_integer_token(toktext)) {
scdebug("<NLITERAL>: %s\n", toktext);
yylval.lval = (struct lit *)install_lit(toktext,0,0);
return(NLITERAL);
}
if (!is_valid_identifier(toktext)) {
yylval.sval=install(toktext,SYTB_LAB,0);
scdebug("<LABELSTR>: %s\n", toktext);
return(LABELSTR);
}
else {
if ((reserved_token=reserved(toktext))!=0)
{
scdebug(" <reserved>: %s\n", toktext);
if (reserved_token == NOT)
reserved_token = NOTEXCEP;
return reserved_token;
}
/* if symbol was defined at the data division */
if (symbol=lookup(toktext,2)) {
yylval.sval=symbol;
if (symbol->type == '8') {
scdebug("<VARCOND>: %s\n",toktext);
update_xreflist(yylval.sval);
return(VARCOND);
}
else {
scdebug("<VARIABLE>: %s\n", toktext);
update_xreflist(yylval.sval);
return(VARIABLE);
}
}
/* otherwise, it should be a label */
else {
yylval.sval=install(toktext,SYTB_LAB,0);
scdebug("<LABELSTR>: %s\n", toktext);
return(LABELSTR);
}
}
} }
<FD_ST>{
{ident} {
svtoken();
if (is_integer_token(toktext)) {
scdebug("<NLITERAL>: %s\n", toktext);
yylval.lval = (struct lit *)install_lit(toktext,0,0);
return(NLITERAL);
}
if (!is_valid_identifier(toktext)) {
yylval.sval=install(toktext,SYTB_LAB,0);
scdebug("<LABELSTR>: %s\n", toktext);
return(LABELSTR);
}
else {
if ((reserved_token=reserved(toktext))!=0)
{
scdebug(" <reserved>: %s\n", toktext);
return reserved_token;
}
scdebug("<STRING>: %s\n", toktext);
/* install w/clone if neccessary */
if ((yylval.sval=lookup(toktext,SYTB_VAR))==NULL)
yyerror("undefined %s at FD/SD",toktext);
return(STRING);
}
}
[ \t]* { }
}
<REDEF_ST>{ident} {
svtoken();
if (is_integer_token(toktext)) {
scdebug("<NLITERAL>: %s\n", toktext);
yylval.lval = (struct lit *)install_lit(toktext,0,0);
return(NLITERAL);
}
if (!is_valid_identifier(toktext)) {
yylval.sval=install(toktext,SYTB_LAB,0);
scdebug("<LABELSTR>: %s\n", toktext);
return(LABELSTR);
}
else {
if ((reserved_token=reserved(toktext))!=0)
{
scdebug(" <reserved>: %s\n", toktext);
return reserved_token;
}
scdebug("<STRING>: %s\n", toktext);
/* don't clone redefined var */
yylval.sval=install(toktext,SYTB_VAR,0);
update_xreflist(yylval.sval);
return(STRING);
}
}
<DATA_ST>{ident} {
svtoken();
if (is_integer_token(toktext)) {
scdebug("<NLITERAL>: %s\n", toktext);
yylval.lval = (struct lit *)install_lit(toktext,0,0);
return(NLITERAL);
}
if (!is_valid_identifier(toktext)) {
yylval.sval=install(toktext,SYTB_LAB,0);
scdebug("<LABELSTR>: %s\n", toktext);
return(LABELSTR);
}
else {
if ((reserved_token=reserved(toktext))!=0)
{
scdebug(" <reserved>: %s\n", toktext);
return reserved_token;
}
scdebug("<STRING>: %s\n", toktext);
/* install w/clone if neccessary */
yylval.sval=install(toktext,SYTB_VAR,1);
update_xreflist(yylval.sval);
return(STRING);
}
}
<SUBSCRIPTS_ST>{
";" { }
"+"{int} {
svtoken();
scdebug("<NLITERAL>: %s\n", toktext);
yylval.lval = (struct lit *)install_lit(&toktext[1],0,0);
return(NLITERAL);
}
{any} {
svtoken();
scdebug("<0: any>: %s\n", toktext);
return(toktext[0]);
}
{white}+ { }
}
<IDENT_ST>{
[ \t]* { }
\./[ \t\n]+ {
scdebug("<PERIOD_TOK>:\n");
return(PERIOD_TOK);
}
{sdelim}{AnyNoDQuote}+{sdelim} {
svtoken();
scdebug(" <IDSTRING>: %s\n", toktext);
yylval.str=savename1(toktext, 1, 1);
return IDSTRING;
}
{ldelim}{AnyNoSQuote}+{ldelim} {
svtoken();
scdebug(" <IDSTRING>: %s\n", toktext);
yylval.str=savename1(toktext, 1, 1);
return IDSTRING;
}
[^\r\t \n\.]+ {
svtoken();
scdebug(" <IDSTRING>: %s\n", toktext);
yylval.str=toktext;
return IDSTRING;
}
{any} {
svtoken();
scdebug("<0: any>: %s\n", toktext);
return(toktext[0]);
}
"\n" { }
} /* end of <IDENT_ST> */
<INITIAL,ENVIR_ST,DATA_ST,REDEF_ST,EXCEPTION_ST>{
";" { }
\./[ \t\n]+ {
scdebug("<PERIOD_TOK>:\n");
eos_detect++;
return(PERIOD_TOK);
}
{sdelim} {
tp=toktext;
while(1) {
while((*tp=lexchar())!='"') {
if (tp >= toktext+TOKTEXT_SIZE) {
yyerror("scanner error: token too large");
while(lexchar()!='"') ;
*tp=0;
scdebug("<CLITERAL>: %s\n", toktext);
yylval.lval = (struct lit *)install_lit(toktext,0,0);
return(CLITERAL);
}
tp++;
}
/* replace two consecutives '"' by one and continue */
if ((*tp=lexchar())=='"') {
tp++;
continue;
}
else {
unput(*tp);
break;
}
}
*tp=0;
scdebug("<CLITERAL>: %s\n", toktext);
yylval.lval = (struct lit *)install_lit(toktext,0,0);
return(CLITERAL);
}
{lhexa}{ldelim} { {
unsigned char *s=hnum;
int len;
tp=toktext;
while((*tp=toupper(lexchar()))!='\'') {
if (tp >= toktext+TOKTEXT_SIZE) {
yyerror("scanner error: token too large");
while(lexchar()!='\'') ;
*tp=0;
scdebug("<CLITERAL>: %s\n", toktext);
yylval.lval = (struct lit *)install_lit(toktext,0,0);
return(CLITERAL);
}
*s = (*tp > '9') ?
(*tp - 'A' + 0x0a) : (*tp - '0');
if ((*tp=toupper(lexchar()))=='\'') {
break;
}
*s++ = *s * 0x10 + ((*tp > '9') ?
(*tp - 'A' + 0x0a) : (*tp - '0'));
}
len = (int) (s - hnum);
yylval.lval = (struct lit *)install_lit(hnum,len,0);
scdebug("<CLITERAL>: %s\n", toktext);
return(CLITERAL);
} }
{lhexa}{sdelim} { {
unsigned char *s=hnum;
int len;
tp=toktext;
while((*tp=toupper(lexchar()))!='\"') {
if (tp >= toktext+TOKTEXT_SIZE) {
yyerror("scanner error: token too large");
while(lexchar()!='\"') ;
*tp=0;
scdebug("<CLITERAL>: %s\n", toktext);
yylval.lval = (struct lit *)install_lit(toktext,0,0);
return(CLITERAL);
}
*s = (*tp > '9') ?
(*tp - 'A' + 0x0a) : (*tp - '0');
if ((*tp=toupper(lexchar()))=='\"') {
break;
}
*s++ = *s * 0x10 + ((*tp > '9') ?
(*tp - 'A' + 0x0a) : (*tp - '0'));
}
len = (int) (s - hnum);
yylval.lval = (struct lit *)install_lit(hnum,len,0);
scdebug("<CLITERAL>: %s\n", toktext);
return(CLITERAL);
} }
{ldelim} {
tp=toktext;
while(1) {
while((*tp=lexchar())!='\'') {
if (tp >= toktext+TOKTEXT_SIZE) {
yyerror("scanner error: token too large");
while(lexchar()!='\'') ;
*tp=0;
scdebug("<CLITERAL>: %s\n", toktext);
yylval.lval = (struct lit *)install_lit(toktext,0,0);
return(CLITERAL);
}
tp++;
}
/* replace two consecutives '\'' by one and continue */
if ((*tp=lexchar())=='\'') {
tp++;
continue;
}
else {
unput(*tp);
break;
}
}
*tp=0;
yylval.lval = (struct lit *)install_lit(toktext,0,0);
scdebug("<CLITERAL>: %s\n", toktext);
return(CLITERAL);
}
{digit}*{decdelim}?{int}+ {
svtoken();
scdebug("<NLITERAL>: %s\n", toktext);
yylval.lval = (struct lit *)install_lit(toktext,0,0);
return(NLITERAL);
}
%{ /*
{digit}({exletter}|{digit})* {
svtoken();
scdebug("<LABELSTR>: %s\n", toktext);
yylval.sval=install(toktext,SYTB_LAB,0);
return(LABELSTR);
}
*/
%}
{white}+ { }
{relop}{relop}? {
svtoken();
if ((reserved_token=reserved(toktext))!=0) {
scdebug(" <reserved>: %s\n", toktext);
return reserved_token;
}
yyerror("relational operator unknown");
}
{lpar} {
svtoken();
if (function_seen) {
function_seen=FALSE;
}
scdebug("<0: lpar>: %s\n", toktext);
return(toktext[0]);
}
"**" {
svtoken();
scdebug("<0: POW_OP>: %s\n", toktext);
return(POW_OP);
}
"," { }
";" { }
{any} {
svtoken();
scdebug("<0: any>: %s\n", toktext);
return(toktext[0]);
}
"\n" { }
} /* end of <INITIAL,DATA_ST,ENVIR_ST> */
<COMMENT_ST>{
.* {
svtoken();
scdebug(" <COMMENT_ST>: %s\n", toktext);
}
"\n" { BEGIN INITIAL; }
} /* end of COMMENT_ST */
<COMMENT1_ST>{
{notperiod}* {
svtoken();
scdebug(" <COMMENT1_ST>:>>%s<<:\n", toktext);
}
"."" "*/"\n" {
svtoken();
scdebug(" <COMMENT1_ST>:>>%s<<:\n", toktext);
BEGIN INITIAL;
}
"." {
svtoken();
scdebug(" <COMMENT1_ST>:>>%s<<:\n", toktext);
}
"\n" {
svtoken();
scdebug(" <COMMENT1_ST>:<NL>:\n");
}
} /* end of COMMENT1_ST */
<PIC_ST>{white_nl}* {
BEGIN PIC_ST2;
scdebug("<PICS -> PIC_ST2>:\n");
}
<PIC_ST2>{
{white_nl}* {
BEGIN DATA_ST;
scdebug("<PICS -> DATA_ST>:\n");
}
\./[ \t\n]+ {
BEGIN DATA_ST;
scdebug("<PICS -> DATA_ST>: PERIOD_TOK\n");
return PERIOD_TOK;
}
}
<PIC_ST,PIC_ST2>{
{lpar}{digit}({digit})*{rpar} {
{
char *s;
yylval.ival = 0;
s = yytext+1; /* bypass lpar */
while (*s!=')')
yylval.ival = 10 * yylval.ival + *s++ - '0';
scdebug("<PICS: MULTIPLIER>: %d\n", yylval.ival);
return(MULTIPLIER);
}
}
{ident} {
svtoken();
if ((reserved_token=reserved(toktext))!=0)
{
scdebug(" <reserved>: %s\n", toktext);
BEGIN PIC_ST;
scdebug("<PIC_ST2-> PIC_ST>:\n");
return reserved_token;
}
REJECT;
}
";" { }
{any} {
scdebug("<PICS: any char>: %c\n", yytext[0]);
yylval.ival=(int)yytext[0];
return(CHAR); }
"\n" { }
} /* end of PICS */
<<EOF>> {
yyterminate();
}
. {svtoken();
scdebug("invalid character:>>%x<<:\n", (unsigned char)toktext[0]);
yyerror("invalid character:>>%x<<:\n", (unsigned char)toktext[0]);
}
%%
int yylex YY_PROTO((void))
{
prev_token = yylex2();
/*printf("tok:%x\n", prev_token);*/
return prev_token;
}
int is_integer_token( char *tok ) {
while (isdigit(*tok)) tok++;
if (*tok=='\0') return 1;
return 0;
}
int is_valid_identifier( char *tok ) {
while (*tok && !isalpha(*tok)) tok++;
if (*tok=='\0') {
return 0;
}
return 1;
}
int lex_fgets( char *buf, int maxsize ) {
int result;
char *s;
s = fgets( buf,maxsize,yyin );
result = (s==NULL) ? YY_NULL: strlen(s);
/* result = fread( buf, 1, maxsize, yyin); */
if (result) {
result = strlen(buf);
++source_lineno;
}
return result;
}
char *savename1(const char *s, int x1, int x2) {
char *ap, *s1;
int len;
len = strlen(s) + 1 - x1 - x2;
ap = (char *) malloc(len);
if (ap != NULL) {
len = strlen(s) - x1 - x2;
strncpy(ap, s + x1, len);
s1 = ap + len + 1;
*s1 = '\0';
}
return(ap);
}
/*
char *savename( char *name );
int hash( char *name );
*/
#if defined(SunOS)
va_list __builtin_va_alist;
#endif
void scdebug( char *fmt, ... ) {
va_list args;
va_start(args,fmt);
#ifdef DEBUG_SCANNER
fprintf(stderr,"SCAN(%4d):",source_lineno);
vfprintf(stderr,fmt,args);
#endif
va_end(args);
}
int yywrap() { return 1; }
/* end of scan.l */
BIN
View File
Binary file not shown.