138 lines
3.5 KiB
C
138 lines
3.5 KiB
C
/*
|
|
Copyright (C) 1999-2004 David Essex, 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 _COBPP_H
|
|
#define _COBPP_H
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
#define PATHMAX 120
|
|
#define PATHMAX1 1024
|
|
#define PATHMAX2 256
|
|
#define PATHMAX3 (1024 * 4)
|
|
#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 '/'
|
|
|
|
//#define DEBUG_COBPP 1
|
|
#ifdef DEBUG_COBPP
|
|
#define DEBUG_COBPP_PP 1
|
|
#define DEBUG_COBPP_SCANNER 1
|
|
#define DEBUG_COBPP_PARSER 1
|
|
#endif
|
|
|
|
#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 FORMAT_FIXED 0
|
|
#define FORMAT_FREE 1
|
|
|
|
#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 TCOBPP_CMDOPTION_LIST "f:x:o:p:t:I:vV?hdg"
|
|
#define TCOBPP_CMDOPT_FRM_FIXED 'f'
|
|
#define TCOBPP_CMDOPT_FRM_FREE 'x'
|
|
#define TCOBPP_CMDOPT_OUTFILE 'o'
|
|
#define TCOBPP_CMDOPT_LIST 'p'
|
|
#define TCOBPP_CMDOPT_TAB_LEN 't'
|
|
#define TCOBPP_CMDOPT_INC_PATH 'I'
|
|
#define TCOBPP_CMDOPT_VERBOSE 'v'
|
|
#define TCOBPP_CMDOPT_VERSION 'V'
|
|
#define TCOBPP_CMDOPT_HELP1 '?'
|
|
#define TCOBPP_CMDOPT_HELP 'h'
|
|
#define TCOBPP_CMDOPT_INC_DEBUG 'd'
|
|
#define TCOBPP_CMDOPT_DEBUG 'g'
|
|
|
|
#define TCOBPP_TITLE "TinyCOBOL pre-processor"
|
|
#define TCOBPP_COPYWR "Copyright (C) 1999-2002 David Essex"
|
|
|
|
extern char HTG_COPYDIR[];
|
|
|
|
typedef short bool;
|
|
|
|
struct s_Env {
|
|
bool codeFormat; /* 1 is free , 0 is fixed */
|
|
int debugFlag;
|
|
int IncDebugLines;
|
|
int errFlag;
|
|
int verboseFlag;
|
|
int tab2space;
|
|
char *progName;
|
|
char *ifname;
|
|
char *ofname;
|
|
char *lfname;
|
|
};
|
|
|
|
typedef struct s_Env Env;
|
|
|
|
Env globalEnv;
|
|
Env *globalEnvPtr;
|
|
|
|
/* command line options */
|
|
static char option_list[] = { TCOBPP_CMDOPTION_LIST };
|
|
|
|
/* parser.tab.c */
|
|
void yyerror(char *s);
|
|
int yyparse(void);
|
|
|
|
/* scanner.c */
|
|
int yylex(void);
|
|
int yywrap(void);
|
|
void yyrestart(FILE *input_file);
|
|
int lex_fgets(char *buf, int maxsize);
|
|
|
|
extern void setup_scanner_state();
|
|
extern char include_full_filename[];
|
|
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);
|
|
|
|
int setOptions(Env*, int, char**);
|
|
void setDefaults(void);
|
|
void printVersion(void);
|
|
void printHelp(void);
|
|
void CleanUp(void);
|
|
|
|
#endif
|