From 50a5873b95424e7c1a805e1cd4697c8df2153388 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 3 Apr 2012 16:57:34 +0000 Subject: Tweaks to help with the new libbu++ and windows compatibility. --- build.sh | 12 ++++++---- src/build.l | 18 +++++++-------- src/build.y | 74 ++++++++++++++++++++++++++++++------------------------------- 3 files changed, 54 insertions(+), 50 deletions(-) diff --git a/build.sh b/build.sh index 66946a0..a5f86ce 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,8 @@ #!/bin/bash -BUSRC="stack.cpp string.cpp hash.cpp list.cpp trace.cpp stream.cpp formatter.cpp util.cpp sharedcore.cpp exceptionbase.cpp heap.cpp archivebase.cpp archive.cpp queue.cpp archival.cpp sio.cpp stdstream.cpp process.cpp plugger.cpp optparser.cpp signals.cpp array.cpp membuf.cpp file.cpp regex.cpp variant.cpp" -BUHDR="stack.h string.h hash.h list.h trace.h stream.h formatter.h util.h sharedcore.h exceptionbase.h heap.h archivebase.h archive.h queue.h archival.h sio.h stdstream.h process.h config.h compat/linux.h compat/win32.h compat/osx.h plugger.h singleton.h optparser.h array.h membuf.h file.h regex.h variant.h fmt.h extratypes.h" +BUSRC="stack.cpp string.cpp hash.cpp list.cpp trace.cpp stream.cpp formatter.cpp util.cpp sharedcore.cpp exceptionbase.cpp heap.cpp archivebase.cpp archive.cpp queue.cpp archival.cpp sio.cpp stdstream.cpp process.cpp plugger.cpp optparser.cpp signals.cpp array.cpp membuf.cpp file.cpp variant.cpp" +BUHDR="stack.h string.h hash.h list.h trace.h stream.h formatter.h util.h sharedcore.h exceptionbase.h heap.h archivebase.h archive.h queue.h archival.h sio.h stdstream.h process.h plugger.h singleton.h optparser.h array.h membuf.h file.h variant.h fmt.h extratypes.h" +BUCOMPAT="config.h compat/linux.h compat/win32.h compat/osx.h" function bld() { @@ -27,7 +28,7 @@ function cmd() function gpp() { - bld "$1" "$2" || cmd CXX "$1" g++ -ggdb -fPIC -rdynamic -W -Wall -Iminibu -c -o "$1" "$2" + bld "$1" "$2" || cmd CXX "$1" g++ -ggdb -fPIC -W -Wall -Iminibu -c -o "$1" "$2" } if [ ! -z "$1" ]; then @@ -52,9 +53,12 @@ for file in $(cd bootstrap; ls); do cmd BOOTSTRAP minibu/bu/${file} cp bootstrap/${file} minibu/bu done for F in $BUSRC; do - bld minibu/src/$F || cmd WGET minibu/src/$F wget -q http://svn.xagasoft.com/libbu++/trunk/src/$F -O minibu/src/$F + bld minibu/src/$F || cmd WGET minibu/src/$F wget -q http://svn.xagasoft.com/libbu++/trunk/src/stable/$F -O minibu/src/$F done for F in $BUHDR; do + bld minibu/bu/$F || cmd WGET minibu/bu/$F wget -q http://svn.xagasoft.com/libbu++/trunk/src/stable/$F -O minibu/bu/$F +done +for F in $BUCOMPAT; do bld minibu/bu/$F || cmd WGET minibu/bu/$F wget -q http://svn.xagasoft.com/libbu++/trunk/src/$F -O minibu/bu/$F done diff --git a/src/build.l b/src/build.l index 7b770f7..30c79a6 100644 --- a/src/build.l +++ b/src/build.l @@ -118,36 +118,36 @@ int iStrDepth = 0; "true" { yylval->bVal = true; - return BOOL; + return LTR_BOOL; } "false" { yylval->bVal = false; - return BOOL; + return LTR_BOOL; } [a-zA-Z_][a-zA-Z0-9_]*: { yytext[yyleng-1] = '\0'; yylval->sVal = rstrdup( yytext ); - return PROFILE; + return LTR_PROFILE; } [a-zA-Z_][a-zA-Z0-9_]* { yylval->sVal = rstrdup( yytext ); if( b.isKeyword( yylval->sVal ) ) - return KEYWORD; + return LTR_KEYWORD; else if( b.isCond( yylval->sVal ) ) - return CONDITION; - return UNDEF; + return LTR_CONDITION; + return LTR_UNDEF; } -?([1-9][0-9]*)|(0) { yylval->iVal = strtol( yytext, NULL, 10 ); - return INT; + return LTR_INT; } (0\.0+)|(-?(([1-9][0-9]*)|(0))\.[0-9]*) { yylval->fVal = strtof( yytext, NULL ); - return FLOAT; + return LTR_FLOAT; } \" { @@ -198,7 +198,7 @@ int iStrDepth = 0; { BEGIN( INITIAL ); yylval->sVal = fstrdup( sBuf ); - return STRING; + return LTR_STRING; } } diff --git a/src/build.y b/src/build.y index 5a5e938..ae8a696 100644 --- a/src/build.y +++ b/src/build.y @@ -25,16 +25,16 @@ void yyerror( YYLTYPE *locp, yyscan_t yyscanner, BuildParser &bld, const char *m bool bVal; } -%token STRING "string literal" -%token KEYWORD "keyword" -%token CONDITION "condition term" -%token VARIABLE "variable name" -%token FUNCTION "function name" -%token UNDEF "undefined identifier" -%token PROFILE "profile execute" -%token INT "integer literal" -%token FLOAT "floating point literal" -%token BOOL "boolean literal" +%token LTR_STRING "string literal" +%token LTR_KEYWORD "keyword" +%token LTR_CONDITION "condition term" +%token LTR_VARIABLE "variable name" +%token LTR_FUNCTION "function name" +%token LTR_UNDEF "undefined identifier" +%token LTR_PROFILE "profile execute" +%token LTR_INT "integer literal" +%token LTR_FLOAT "floating point literal" +%token LTR_BOOL "boolean literal" %token TOK_TARGET "target" %token TOK_INPUT "input" @@ -96,13 +96,13 @@ void yyerror( YYLTYPE *locp, yyscan_t yyscanner, BuildParser &bld, const char *m %left '(' ')' '{' '}' '[' ']' %left IINEG IINOT -%destructor { delete[] $$; } STRING -%destructor { delete[] $$; } KEYWORD -%destructor { delete[] $$; } CONDITION -%destructor { delete[] $$; } VARIABLE -%destructor { delete[] $$; } FUNCTION -%destructor { delete[] $$; } UNDEF -%destructor { delete[] $$; } PROFILE +%destructor { delete[] $$; } LTR_STRING +%destructor { delete[] $$; } LTR_KEYWORD +%destructor { delete[] $$; } LTR_CONDITION +%destructor { delete[] $$; } LTR_VARIABLE +%destructor { delete[] $$; } LTR_FUNCTION +%destructor { delete[] $$; } LTR_UNDEF +%destructor { delete[] $$; } LTR_PROFILE %% /* Grammar rules */ @@ -140,23 +140,23 @@ root_sub_exprs: | root export ; -include: TOK_INCLUDE STRING ';' { bld.include( $2, yyscanner, &yylloc ); } +include: TOK_INCLUDE LTR_STRING ';' { bld.include( $2, yyscanner, &yylloc ); } ; /* * data related */ -string: STRING { bld.xAst.addNode( @1, AstNode::typeString, $1 ); } +string: LTR_STRING { bld.xAst.addNode( @1, AstNode::typeString, $1 ); } ; -int: INT { bld.xAst.addNode( @1, AstNode::typeInt, $1 ); } +int: LTR_INT { bld.xAst.addNode( @1, AstNode::typeInt, $1 ); } ; -float: FLOAT { bld.xAst.addNode( @1, AstNode::typeFloat, $1 ); } +float: LTR_FLOAT { bld.xAst.addNode( @1, AstNode::typeFloat, $1 ); } ; -bool: BOOL { bld.xAst.addNode( @1, AstNode::typeBool, (bool)$1 ); } +bool: LTR_BOOL { bld.xAst.addNode( @1, AstNode::typeBool, (bool)$1 ); } ; null: TOK_NULL { bld.xAst.addNode( @1, AstNode::typeNull ); } @@ -168,7 +168,7 @@ literal: string | null ; -variable: UNDEF { bld.xAst.addNode( @1, AstNode::typeVariable, $1 ); } +variable: LTR_UNDEF { bld.xAst.addNode( @1, AstNode::typeVariable, $1 ); } list_core: | { bld.xAst.openBranch(); } expr @@ -199,9 +199,9 @@ value: value_core value_mods * misc global things */ -notify: TOK_ERROR STRING ';' { bld.xAst.addNode( @$,AstNode::typeError, $2 ); } - | TOK_WARNING STRING ';' { bld.xAst.addNode( @$, AstNode::typeWarning, $2 ); } - | TOK_NOTICE STRING ';' { bld.xAst.addNode( @$, AstNode::typeNotice, $2 ); } +notify: TOK_ERROR LTR_STRING ';' { bld.xAst.addNode( @$,AstNode::typeError, $2 ); } + | TOK_WARNING LTR_STRING ';' { bld.xAst.addNode( @$, AstNode::typeWarning, $2 ); } + | TOK_NOTICE LTR_STRING ';' { bld.xAst.addNode( @$, AstNode::typeNotice, $2 ); } ; /* set_rhs: '=' { bld.xAst.addNode( AstNode::typeOpEq ); } value @@ -245,7 +245,7 @@ func_param_list: { bld.xAst.openBranch(); } expr | func_param_list ',' { bld.xAst.openBranch(); } expr ; -function: UNDEF '(' { +function: LTR_UNDEF '(' { bld.xAst.addNode( @$, AstNode::typeFunction ); bld.xAst.openBranch(); bld.xAst.addNode( @$, AstNode::typeString, $1 ); @@ -254,7 +254,7 @@ function: UNDEF '(' { } ; -function_no_input: UNDEF '(' { +function_no_input: LTR_UNDEF '(' { bld.xAst.addNode( @$, AstNode::typeNull ); bld.xAst.addNode( @$, AstNode::typeFunction ); bld.xAst.openBranch(); @@ -285,17 +285,17 @@ type: TOK_STRING { bld.xAst.addNode( @1, AstNode::typeTypeString ); } expr: value | '(' expr ')' - | UNDEF '=' { + | LTR_UNDEF '=' { bld.xAst.addNode( @$, AstNode::typeVariableRef, $1 ); } expr { bld.xAst.addNode( @3, AstNode::typeOpEq ); } - | UNDEF OP_ADDSETP { + | LTR_UNDEF OP_ADDSETP { bld.xAst.addNode( @$, AstNode::typeVariableRef, $1 ); } expr { bld.xAst.addNode( @3, AstNode::typeOpPlusEq ); } - | UNDEF OP_ADDSETR { + | LTR_UNDEF OP_ADDSETR { bld.xAst.addNode( @$, AstNode::typeVariableRef, $1 ); } expr { bld.xAst.addNode( @3, AstNode::typeOpPlusEqRaw ); @@ -436,7 +436,7 @@ function_for: for_base '{' function_exprs '}' { bld.xAst.closeNode(); } * functions */ -function_def: TOK_FUNCTION UNDEF { +function_def: TOK_FUNCTION LTR_UNDEF { bld.xAst.addNode( @1, AstNode::typeFunctionDef ); bld.xAst.openBranch(); bld.xAst.addNode( @2, AstNode::typeString, $2 ); @@ -481,7 +481,7 @@ return: TOK_RETURN { * Actions, they're basically functions, no parameters */ -action_def: TOK_ACTION STRING { +action_def: TOK_ACTION LTR_STRING { bld.xAst.addNode( @$, AstNode::typeActionDef ); bld.xAst.openBranch(); bld.xAst.addNode( @1, AstNode::typeString, $2 ); @@ -564,7 +564,7 @@ target_rule: TOK_RULE { } ; -condition: TOK_CONDITION CONDITION ';' { +condition: TOK_CONDITION LTR_CONDITION ';' { bld.xAst.addNode( @$, AstNode::typeCondition, $2 ); } | TOK_CONDITION TOK_ALWAYS ';'{ @@ -603,7 +603,7 @@ rule_exprs: ; rule_input_func: function - | STRING { + | LTR_STRING { /* In this case, when the input is just a string, lets actually turn it into a call to the matches function. */ @@ -671,7 +671,7 @@ config_exprs: | config_exprs cache ; -display: TOK_DISPLAY STRING ';' { +display: TOK_DISPLAY LTR_STRING ';' { bld.xAst.addNode( @$, AstNode::typeDisplay, $2 ); } ; @@ -720,7 +720,7 @@ cache: TOK_CACHE TOK_ALWAYS ';' /* * target/profile execute */ -process_target: PROFILE +process_target: LTR_PROFILE { bld.xAst.addNode( @$, AstNode::typeProcessTarget ); bld.xAst.openBranch(); -- cgit v1.2.3