diff --git a/c/dsls/Makefile.am b/c/dsls/Makefile.am index f858b7057..32578df9c 100644 --- a/c/dsls/Makefile.am +++ b/c/dsls/Makefile.am @@ -2,7 +2,9 @@ AM_CPPFLAGS= -I${srcdir} AM_CFLAGS= -std=gnu99 noinst_PROGRAMS= lemon -lemon_SOURCES= lemon.c +lemon_SOURCES= lemon.c \ + lemon_option.c \ + lemon_option.h noinst_LTLIBRARIES= libdsl.la # if we don't want to distribute the generated sources, move them to a nodist_libfoo_la_SOURCES variable diff --git a/c/dsls/Makefile.no-autoconfig b/c/dsls/Makefile.no-autoconfig index 869115217..a398baf44 100644 --- a/c/dsls/Makefile.no-autoconfig +++ b/c/dsls/Makefile.no-autoconfig @@ -105,8 +105,8 @@ ex2_lexer.c ex2_lexer.h: ex2_lexer.l ./ex_ast.h flex --prefix=ex2_lexer_ --outfile=ex2_lexer.c --header-file=ex2_lexer.h ex2_lexer.l # ---------------------------------------------------------------- -lemon: lemon.c lempar.c - $(DSLCC) -o lemon lemon.c +lemon: lemon.c lemon_option.c + $(DSLCC) -o lemon lemon.c lemon_option.c # ---------------------------------------------------------------- clean: diff --git a/c/dsls/lemon.c b/c/dsls/lemon.c index 9e5c1f234..bbce0c1ce 100644 --- a/c/dsls/lemon.c +++ b/c/dsls/lemon.c @@ -13,6 +13,8 @@ #include #include +#include "lemon_option.h" + #ifndef __WIN32__ # if defined(_WIN32) || defined(WIN32) # define __WIN32__ @@ -66,20 +68,6 @@ void Configlist_reset(/* void */); /********* From the file "error.h" ***************************************/ void ErrorMsg(const char *, int,const char *, ...); -/****** From the file "option.h" ******************************************/ -struct s_options { - enum { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, - OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR} type; - char *label; - char *arg; - char *message; -}; -int OptInit(/* char**,struct s_options*,FILE* */); -int OptNArgs(/* void */); -char *OptArg(/* int */); -void OptErr(/* int */); -void OptPrint(/* void */); - /******** From the file "parse.h" *****************************************/ int Parse(/* struct lemon *lemp */); @@ -1576,281 +1564,6 @@ char *msort(char *list, char **next, int (*cmp)()) return ep; } -/************************ From the file "option.c" **************************/ -static char **argv; -static struct s_options *op; -static FILE *errstream; - -#define ISOPT(X) ((X)[0]=='-'||(X)[0]=='+'||strchr((X),'=')!=0) - -/* -** Print the command line with a carrot pointing to the k-th character -** of the n-th field. -*/ -static void errline(int n, int k, FILE *err) -{ - int spcnt, i; - spcnt = 0; - if (argv[0]) fprintf(err,"%s",argv[0]); - spcnt = strlen(argv[0]) + 1; - for(i=1; i