]> granicus.if.org Git - yasm/commitdiff
Flatten the tools/re2c build.
authorPeter Johnson <peter@tortall.net>
Fri, 9 Aug 2002 05:22:07 +0000 (05:22 -0000)
committerPeter Johnson <peter@tortall.net>
Fri, 9 Aug 2002 05:22:07 +0000 (05:22 -0000)
 - Moved (by repocopy) main.c to re2c.c
 - Moved (by repocopy) parser.y to re2c-parser.y
 - Changed to Makefile.inc's rather than Makefile.am's
 - Modified all the source file local includes to point to tools/re2c/*.h

svn path=/trunk/yasm/; revision=668

26 files changed:
Makefile.am
configure.ac
tools/Makefile.am [deleted file]
tools/Makefile.inc [new file with mode: 0644]
tools/re2c/.cvsignore [deleted file]
tools/re2c/Makefile.am [deleted file]
tools/re2c/Makefile.inc
tools/re2c/actions.c
tools/re2c/basics.h
tools/re2c/code.c
tools/re2c/dfa.c
tools/re2c/dfa.h
tools/re2c/globals.h
tools/re2c/ins.h
tools/re2c/main.c [deleted file]
tools/re2c/parse.h
tools/re2c/parser.y [deleted file]
tools/re2c/re.h
tools/re2c/re2c-parser.y
tools/re2c/re2c.c
tools/re2c/scanner.c
tools/re2c/scanner.h
tools/re2c/scanner.re
tools/re2c/substr.c
tools/re2c/substr.h
tools/re2c/translate.c

index 4c95259e0f7ded148e17cecf5756d5f424ea7d94..b122052d987bcc625f471b0cc71c705c81c9e1b6 100644 (file)
@@ -1,6 +1,6 @@
 # $IdPath$
 
-SUBDIRS = libltdl tools m4 po
+SUBDIRS = libltdl m4 po
 
 CFLAGS = @ANSI_CFLAGS@
 AM_YFLAGS = -d
@@ -23,9 +23,11 @@ BUILT_SOURCES =
 CLEANFILES = configure.lineno
 EXTRA_DIST = config/config.rpath  \
        check/Makefile.inc      \
+       tools/Makefile.inc      \
        src/Makefile.inc
 
 include check/Makefile.inc
+include tools/Makefile.inc
 include src/Makefile.inc
 
 EXTRA_DIST += \
index 8672f18e37dd696b5496081ce95eb4c88ce8f307..8989044a347e9fe006648bdebf3019f7b28423ba 100644 (file)
@@ -285,8 +285,6 @@ AC_SUBST(LIBLTDL)
 
 AC_CONFIG_FILES([Makefile
        libltdl/Makefile
-       tools/Makefile
-       tools/re2c/Makefile
        m4/Makefile
        po/Makefile.in
 ])
diff --git a/tools/Makefile.am b/tools/Makefile.am
deleted file mode 100644 (file)
index de43148..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# $IdPath$
-SUBDIRS = re2c
diff --git a/tools/Makefile.inc b/tools/Makefile.inc
new file mode 100644 (file)
index 0000000..f0481ed
--- /dev/null
@@ -0,0 +1,6 @@
+# $IdPath$
+
+EXTRA_DIST += \
+       tools/re2c/Makefile.inc
+
+include tools/re2c/Makefile.inc
diff --git a/tools/re2c/.cvsignore b/tools/re2c/.cvsignore
deleted file mode 100644 (file)
index f549679..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-parser.c
-parser.h
-re2c
diff --git a/tools/re2c/Makefile.am b/tools/re2c/Makefile.am
deleted file mode 100644 (file)
index 6c8c5ae..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-# $IdPath$
-AM_YFLAGS = -d
-
-INCLUDES = -I$(top_srcdir)
-
-noinst_PROGRAMS = re2c
-
-re2c_SOURCES = \
-       basics.h        \
-       globals.h       \
-       ins.h           \
-       re.h            \
-       token.h         \
-       code.c          \
-       dfa.h           \
-       dfa.c           \
-       main.c          \
-       parse.h         \
-       parser.y        \
-       actions.c       \
-       scanner.h       \
-       scanner.c       \
-       substr.h        \
-       substr.c        \
-       translate.c
-
-BUILT_SOURCES = \
-       parser.c \
-       parser.h
-
-CLEANFILES = \
-       parser.c \
-       parser.h
-
-EXTRA_DIST = \
-       CHANGELOG               \
-       NO_WARRANTY             \
-       README                  \
-       scanner.re              \
-       re2c.1                  \
-       bootstrap/re2c.man      \
-       bootstrap/scanner.c     \
-       doc/loplas.ps.gz        \
-       doc/sample.bib          \
-       examples/basemmap.c     \
-       examples/c.re           \
-       examples/cmmap.re       \
-       examples/cnokw.re       \
-       examples/cunroll.re     \
-       examples/modula.re      \
-       examples/sample.re      \
-       examples/simple.re      \
-       examples/rexx/README    \
-       examples/rexx/rexx.l    \
-       examples/rexx/scanio.c  \
-       cleanup.pl
index 6c8c5ae12b4fb2ee31c36a891ef2acb49dbe1def..25d354d2d105970a08bd15cb1ceb2178ccd9205b 100644 (file)
@@ -1,56 +1,53 @@
 # $IdPath$
-AM_YFLAGS = -d
 
-INCLUDES = -I$(top_srcdir)
-
-noinst_PROGRAMS = re2c
+noinst_PROGRAMS += re2c
 
 re2c_SOURCES = \
-       basics.h        \
-       globals.h       \
-       ins.h           \
-       re.h            \
-       token.h         \
-       code.c          \
-       dfa.h           \
-       dfa.c           \
-       main.c          \
-       parse.h         \
-       parser.y        \
-       actions.c       \
-       scanner.h       \
-       scanner.c       \
-       substr.h        \
-       substr.c        \
-       translate.c
+       tools/re2c/basics.h     \
+       tools/re2c/globals.h    \
+       tools/re2c/ins.h                \
+       tools/re2c/re.h         \
+       tools/re2c/token.h              \
+       tools/re2c/code.c               \
+       tools/re2c/dfa.h                \
+       tools/re2c/dfa.c                \
+       tools/re2c/re2c.c               \
+       tools/re2c/parse.h              \
+       tools/re2c/re2c-parser.y        \
+       tools/re2c/actions.c    \
+       tools/re2c/scanner.h    \
+       tools/re2c/scanner.c    \
+       tools/re2c/substr.h     \
+       tools/re2c/substr.c     \
+       tools/re2c/translate.c
 
-BUILT_SOURCES = \
-       parser.c \
-       parser.h
+BUILT_SOURCES += \
+       re2c-parser.c \
+       re2c-parser.h
 
-CLEANFILES = \
-       parser.c \
-       parser.h
+CLEANFILES += \
+       re2c-parser.c \
+       re2c-parser.h
 
-EXTRA_DIST = \
-       CHANGELOG               \
-       NO_WARRANTY             \
-       README                  \
-       scanner.re              \
-       re2c.1                  \
-       bootstrap/re2c.man      \
-       bootstrap/scanner.c     \
-       doc/loplas.ps.gz        \
-       doc/sample.bib          \
-       examples/basemmap.c     \
-       examples/c.re           \
-       examples/cmmap.re       \
-       examples/cnokw.re       \
-       examples/cunroll.re     \
-       examples/modula.re      \
-       examples/sample.re      \
-       examples/simple.re      \
-       examples/rexx/README    \
-       examples/rexx/rexx.l    \
-       examples/rexx/scanio.c  \
-       cleanup.pl
+EXTRA_DIST += \
+       tools/re2c/CHANGELOG                    \
+       tools/re2c/NO_WARRANTY                  \
+       tools/re2c/README                       \
+       tools/re2c/scanner.re                   \
+       tools/re2c/re2c.1                       \
+       tools/re2c/bootstrap/re2c.man           \
+       tools/re2c/bootstrap/scanner.c          \
+       tools/re2c/doc/loplas.ps.gz             \
+       tools/re2c/doc/sample.bib               \
+       tools/re2c/examples/basemmap.c          \
+       tools/re2c/examples/c.re                \
+       tools/re2c/examples/cmmap.re            \
+       tools/re2c/examples/cnokw.re            \
+       tools/re2c/examples/cunroll.re          \
+       tools/re2c/examples/modula.re           \
+       tools/re2c/examples/sample.re           \
+       tools/re2c/examples/simple.re           \
+       tools/re2c/examples/rexx/README         \
+       tools/re2c/examples/rexx/rexx.l         \
+       tools/re2c/examples/rexx/scanio.c       \
+       tools/re2c/cleanup.pl
index 32fdd170f5e661a705d1e6173b353aff690c29d3..9160e47833e5b4fa64ed77abaabe9453d76b9a05 100644 (file)
@@ -4,9 +4,9 @@
 #include <string.h>
 #include <stdio.h>
 
-#include "globals.h"
-#include "parse.h"
-#include "dfa.h"
+#include "tools/re2c/globals.h"
+#include "tools/re2c/parse.h"
+#include "tools/re2c/dfa.h"
 
 static Symbol *first = NULL;
 
index f4964a1a7a74320d1d9a8586a0e4523a8d22943f..48d07820eafea7848af29bdf50d3c09fb99ebdb2 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef re2c_basics_h
 #define re2c_basics_h
 
+#if defined(__GNUC__) && !defined(inline)
+#define inline __inline__
+#endif
+
 typedef unsigned int   uint;
 typedef unsigned char  uchar, byte;
 typedef unsigned short         ushort, word;
index 3a45010b66a5649161ddd9d3c37b2103780ba15d..c3b5b2d4ca566cec2c4cefc06a9e7c42ac3d2fdf 100644 (file)
@@ -3,9 +3,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#include "substr.h"
-#include "globals.h"
-#include "dfa.h"
+#include "tools/re2c/substr.h"
+#include "tools/re2c/globals.h"
+#include "tools/re2c/dfa.h"
 
 /* there must be at least one span in list;  all spans must cover
  * same range
index 23fdb9c789e488eb3587a73493628c5faeab43f5..f1ffb3d7d0c922da6382beb2ee0dd71adf28e0d9 100644 (file)
@@ -3,9 +3,9 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <string.h>
-#include "globals.h"
-#include "substr.h"
-#include "dfa.h"
+#include "tools/re2c/globals.h"
+#include "tools/re2c/substr.h"
+#include "tools/re2c/dfa.h"
 
 #define octCh(c) ('0' + c%8)
 
index 406bcce3326738bb007cbf8b4220a4c638998945..6b4e8be9e42d376eaaddaac4cda0dab8f1582d0d 100644 (file)
@@ -2,7 +2,7 @@
 #define re2c_dfa_h
 
 #include <stdio.h>
-#include "re.h"
+#include "tools/re2c/re.h"
 
 extern void prtCh(FILE *, uchar);
 extern void printSpan(FILE *, uint, uint);
index e0c402c73ec00d341e0839b46cf2d785d5f607f9..f42735cf9207de939c2ca5436460a98cce13f68c 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef        re2c_globals_h
 #define        re2c_globals_h
 
-#include "basics.h"
+#include "tools/re2c/basics.h"
 
 extern char *fileName;
 extern int sFlag;
index 30d2d178c27c960da8bd71eda3785a577fb550b1..0fc6ee00f3f09eb5f15fe684f8ef4d8463f5a7d2 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef re2c_ins_h
 #define re2c_ins_h
 
-#include "basics.h"
+#include "tools/re2c/basics.h"
 
 #define nChars 256
 typedef uchar Char;
diff --git a/tools/re2c/main.c b/tools/re2c/main.c
deleted file mode 100644 (file)
index e571697..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "globals.h"
-#include "parse.h"
-#include "dfa.h"
-
-char *fileName;
-int sFlag = 0;
-int bFlag = 0;
-
-int main(int argc, char *argv[]){
-    FILE *f;
-
-    fileName = NULL;
-    if(argc == 1)
-       goto usage;
-    while(--argc > 1){
-       char *p = *++argv;
-       while(*++p != '\0'){
-           switch(*p){
-           case 'e':
-               xlat = asc2ebc;
-               talx = ebc2asc;
-               break;
-           case 's':
-               sFlag = 1;
-               break;
-           case 'b':
-               sFlag = 1;
-               bFlag = 1;
-               break;
-           default:
-               goto usage;
-           }
-       }
-    }
-    fileName = *++argv;
-    if(fileName[0] == '-' && fileName[1] == '\0'){
-       fileName = "<stdin>";
-       f = stdin;
-    } else {
-       if((f = fopen(fileName, "rt")) < 0){
-           fprintf(stderr, "can't open %s\n", fileName);
-           return 1;
-       }
-    }
-    parse(f, stdout);
-    return 0;
-usage:
-    fputs("usage: re2c [-esb] name\n", stderr);
-    return 2;
-}
index cd7724cb7a6af0d53a817d46e21f8779b062671c..ffeb40548de24cdf2a7264885aa68acae14a8db6 100644 (file)
@@ -2,8 +2,8 @@
 #define re2c_parse_h
 
 #include <stdio.h>
-#include "scanner.h"
-#include "re.h"
+#include "tools/re2c/scanner.h"
+#include "tools/re2c/re.h"
 
 typedef struct Symbol {
     struct Symbol              *next;
diff --git a/tools/re2c/parser.y b/tools/re2c/parser.y
deleted file mode 100644 (file)
index d9701be..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-%{
-#include <config.h>
-
-#include <time.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "globals.h"
-#include "parse.h"
-int yyparse();
-int yylex();
-void yyerror(char*);
-
-static uint accept;
-static RegExp *spec;
-static Scanner *in;
-
-%}
-
-%start spec
-
-%union {
-    Symbol     *symbol;
-    RegExp     *regexp;
-    Token      *token;
-    char       op;
-}
-
-%token         CLOSE   ID      CODE    RANGE   STRING
-
-%type  <op>            CLOSE
-%type  <op>            close
-%type  <symbol>        ID
-%type  <token>         CODE
-%type  <regexp>        RANGE   STRING
-%type  <regexp>        rule    look    expr    diff    term    factor  primary
-
-%%
-
-spec   :
-               { accept = 0;
-                 spec = NULL; }
-       |       spec rule
-               { spec = spec? mkAlt(spec, $2) : $2; }
-       |       spec decl
-       ;
-
-decl   :       ID '=' expr ';'
-               { if($1->re)
-                     Scanner_fatal(in, "sym already defined");
-                 $1->re = $3; }
-       ;
-
-rule   :       expr look CODE
-               { $$ = RegExp_new_RuleOp($1, $2, $3, accept++); }
-       ;
-
-look   :
-               { $$ = RegExp_new_NullOp(); }
-       |       '/' expr
-               { $$ = $2; }
-       ;
-
-expr   :       diff
-               { $$ = $1; }
-       |       expr '|' diff
-               { $$ =  mkAlt($1, $3); }
-       ;
-
-diff   :       term
-               { $$ = $1; }
-       |       diff '\\' term
-               { $$ =  mkDiff($1, $3);
-                 if(!$$)
-                      Scanner_fatal(in, "can only difference char sets");
-               }
-       ;
-
-term   :       factor
-               { $$ = $1; }
-       |       term factor
-               { $$ = RegExp_new_CatOp($1, $2); }
-       ;
-
-factor :       primary
-               { $$ = $1; }
-       |       primary close
-               {
-                   switch($2){
-                   case '*':
-                       $$ = mkAlt(RegExp_new_CloseOp($1), RegExp_new_NullOp());
-                       break;
-                   case '+':
-                       $$ = RegExp_new_CloseOp($1);
-                       break;
-                   case '?':
-                       $$ = mkAlt($1, RegExp_new_NullOp());
-                       break;
-                   }
-               }
-       ;
-
-close  :       CLOSE
-               { $$ = $1; }
-       |       close CLOSE
-               { $$ = ($1 == $2) ? $1 : '*'; }
-       ;
-
-primary        :       ID
-               { if(!$1->re)
-                     Scanner_fatal(in, "can't find symbol");
-                 $$ = $1->re; }
-       |       RANGE
-               { $$ = $1; }
-       |       STRING
-               { $$ = $1; }
-       |       '(' expr ')'
-               { $$ = $2; }
-       ;
-
-%%
-
-void yyerror(char* s){
-    Scanner_fatal(in, s);
-}
-
-int yylex(){
-    return Scanner_scan(in);
-}
-
-char *
-mystrdup(const char *str)
-{
-       size_t len;
-       char *copy;
-
-       len = strlen(str) + 1;
-       copy = malloc(len);
-       memcpy(copy, str, len);
-       return (copy);
-}
-
-void parse(FILE *i, FILE *o){
-    char *     fnamebuf;
-    char *     token;
-    time_t now;
-
-    time(&now);
-
-    fputs("/* Generated by re2c 0.9.1-C on ", o);
-    fprintf(o, "%-24s", ctime(&now));
-    fputs(" */\n", o);
-
-    in = Scanner_new(i);
-
-    fprintf(o, "#line %u \"", Scanner_line(in));
-    if( fileName != NULL ) {
-       fnamebuf = mystrdup( fileName );
-    } else {
-       fnamebuf = mystrdup( "<stdin>" );
-    }
-    token = strtok( fnamebuf, "\\" );
-    for(;;) {
-       fprintf(o, "%s", token);
-       token = strtok( NULL, "\\" );
-       if( token == NULL ) break;
-       fputs("\\\\", o);
-    }
-    fputs("\"\n", o);
-    free( fnamebuf );
-
-    while(Scanner_echo(in, o)){
-       yyparse();
-       if(spec)
-           genCode(o, spec);
-       fprintf(o, "#line %u\n", Scanner_line(in));
-    }
-}
index c34cd3ec133fccede95277f0a2d0aeb5026405da..6c87d10d5cc5d73be7442ee81ea8aaea4098213c 100644 (file)
@@ -2,8 +2,8 @@
 #define re2c_re_h
 
 #include <stdio.h>
-#include "token.h"
-#include "ins.h"
+#include "tools/re2c/token.h"
+#include "tools/re2c/ins.h"
 
 typedef struct CharPtn {
     uint       card;
index d9701bee83c78549cbeb75b945d9b536910db448..c41170f5da9e42db8ad97abbe7d9ec8cbc3024d4 100644 (file)
@@ -5,8 +5,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include "globals.h"
-#include "parse.h"
+#include "tools/re2c/globals.h"
+#include "tools/re2c/parse.h"
 int yyparse();
 int yylex();
 void yyerror(char*);
index e571697cd48d2d7b843b4177077d2194c59c3ced..469da2d20f38cac36627e8bb8841fbc26eecf0aa 100644 (file)
@@ -3,9 +3,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "globals.h"
-#include "parse.h"
-#include "dfa.h"
+#include "tools/re2c/globals.h"
+#include "tools/re2c/parse.h"
+#include "tools/re2c/dfa.h"
 
 char *fileName;
 int sFlag = 0;
index 1ce43d8d04d82ba2ada12e059e227bf1c1652a49..f08bdfafb69f928bb760e1c6eca5bd0d692ca3a9 100644 (file)
@@ -5,9 +5,9 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include "scanner.h"
-#include "parse.h"
-#include "parser.h"
+#include "tools/re2c/scanner.h"
+#include "tools/re2c/parse.h"
+#include "re2c-parser.h"
 
 extern YYSTYPE yylval;
 
index f27e315b8a8e7b14b41dc4afcc57b04ce8ad8863..a76c4dd44fe50628ec36463b36b2af4b1bd0c5bc 100644 (file)
@@ -2,7 +2,7 @@
 #define        _scanner_h
 
 #include <stdio.h>
-#include "token.h"
+#include "tools/re2c/token.h"
 
 typedef struct Scanner {
     FILE               *in;
index cf69c590b6a25d3375b073830e35c695b005c4bc..a058fe7651ced03b46e574322731b845f37bd14c 100644 (file)
@@ -2,9 +2,9 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include "scanner.h"
-#include "parse.h"
-#include "parser.h"
+#include "tools/re2c/scanner.h"
+#include "tools/re2c/parse.h"
+#include "re2c-parser.h"
 
 extern YYSTYPE yylval;
 
index c88dcb63105aa6c2b89a9136318192e443448761..3be3c8756edb3c9ca31e78b35742124c6c61b1f1 100644 (file)
@@ -1,7 +1,7 @@
 #include <config.h>
 
 #include <string.h>
-#include "substr.h"
+#include "tools/re2c/substr.h"
 
 void
 SubStr_out(const SubStr *s, FILE *o)
index 68017c0118b14178385dde333bb2636c793813e5..6bf82b44047fcbef96bb356015af731408efdbf1 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include "basics.h"
+#include "tools/re2c/basics.h"
 
 struct SubStr {
     char               *str;
index d3356b8607a562b3e2c1a4994f65b2894b06a7a1..17b9adca46fa61edd6012705de8db80bde3e8a64 100644 (file)
@@ -1,6 +1,6 @@
 #include <config.h>
 
-#include "globals.h"
+#include "tools/re2c/globals.h"
 
 uchar asc2asc[256] = {
 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,