Recovered from cvs revision 2007-10-12 14:20:00
This commit is contained in:
parent
917d2fe1ff
commit
8c505c6d5d
@ -7,6 +7,7 @@
|
||||
- added Awk::AddGlobal, Awk::DeleteGlobal (net/Awk.hpp, net/Awk.cpp)
|
||||
- added Awk::Run::SetGlobal, Awk::Run::GetGlobal (net/Awk.hpp, net/Awk.cpp)
|
||||
- enhanced ase_awk_getglobalname
|
||||
- yet to be added to the COM and JNI bindings.
|
||||
* added three new options - ASE_AWK_RESET, ASE_AWK_MAPTOVAR, ASE_AWK_PABLOCK
|
||||
|
||||
* enhanced Awk::dispatchFunction to set a more accurate error code (awk/Awk.cpp)
|
||||
|
@ -129,7 +129,7 @@ if [ "$ASEARC" = "gzip" ]
|
||||
then
|
||||
tar -cvf "ase-$ASEVER.tar" "ase-$ASEVER"
|
||||
gzip "ase-$ASEVER.tar"
|
||||
mv "ase-$ASEVER.tar.gz" "ase-$ASEVER.tgz"
|
||||
#mv "ase-$ASEVER.tar.gz" "ase-$ASEVER.tgz"
|
||||
elif [ "$ASEARC" = "zip" ]
|
||||
then
|
||||
ls -l
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.43 2007/10/10 07:03:56 bacon Exp $
|
||||
* $Id: Awk.cpp,v 1.45 2007/10/11 14:39:46 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/StdAwk.hpp>
|
||||
@ -52,8 +52,10 @@ public:
|
||||
#endif
|
||||
if (n == -1)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HeapDestroy (heap);
|
||||
heap = ASE_NULL;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -595,9 +597,35 @@ static void print_error (const ase_char_t* msg)
|
||||
ase_printf (ASE_T("Error: %s\n"), msg);
|
||||
}
|
||||
|
||||
static struct
|
||||
{
|
||||
const ase_char_t* name;
|
||||
TestAwk::Option opt;
|
||||
} otab[] =
|
||||
{
|
||||
{ ASE_T("implicit"), TestAwk::OPT_IMPLICIT },
|
||||
{ ASE_T("explicit"), TestAwk::OPT_EXPLICIT },
|
||||
{ ASE_T("uniquefn"), TestAwk::OPT_UNIQUEFN },
|
||||
{ ASE_T("shading"), TestAwk::OPT_SHADING },
|
||||
{ ASE_T("shift"), TestAwk::OPT_SHIFT },
|
||||
{ ASE_T("idiv"), TestAwk::OPT_IDIV },
|
||||
{ ASE_T("strconcat"), TestAwk::OPT_STRCONCAT },
|
||||
{ ASE_T("extio"), TestAwk::OPT_EXTIO },
|
||||
{ ASE_T("blockless"), TestAwk::OPT_BLOCKLESS },
|
||||
{ ASE_T("baseone"), TestAwk::OPT_BASEONE },
|
||||
{ ASE_T("stripspaces"), TestAwk::OPT_STRIPSPACES },
|
||||
{ ASE_T("nextofile"), TestAwk::OPT_NEXTOFILE },
|
||||
{ ASE_T("crfl"), TestAwk::OPT_CRLF },
|
||||
{ ASE_T("argstomain"), TestAwk::OPT_ARGSTOMAIN },
|
||||
{ ASE_T("reset"), TestAwk::OPT_RESET },
|
||||
{ ASE_T("maptovar"), TestAwk::OPT_MAPTOVAR },
|
||||
{ ASE_T("pablock"), TestAwk::OPT_PABLOCK }
|
||||
};
|
||||
|
||||
static void print_usage (const ase_char_t* argv0)
|
||||
{
|
||||
const ase_char_t* base;
|
||||
int j;
|
||||
|
||||
base = ase_strrchr(argv0, ASE_T('/'));
|
||||
if (base == ASE_NULL) base = ase_strrchr(argv0, ASE_T('\\'));
|
||||
@ -615,6 +643,13 @@ static void print_usage (const ase_char_t* argv0)
|
||||
ase_printf (ASE_T(" -w o:n Specify an old and new word pair\n"));
|
||||
ase_printf (ASE_T(" o - an original word\n"));
|
||||
ase_printf (ASE_T(" n - the new word to replace the original\n"));
|
||||
|
||||
|
||||
ase_printf (ASE_T("\nYou may specify the following options to change the behavior of the interpreter.\n"));
|
||||
for (j = 0; j < ASE_COUNTOF(otab); j++)
|
||||
{
|
||||
ase_printf (ASE_T(" -%-20s -no%-20s\n"), otab[j].name, otab[j].name);
|
||||
}
|
||||
}
|
||||
|
||||
int awk_main (int argc, ase_char_t* argv[])
|
||||
@ -629,31 +664,6 @@ int awk_main (int argc, ase_char_t* argv[])
|
||||
ase_size_t nsrcins = 0;
|
||||
ase_size_t nsrcouts = 0;
|
||||
|
||||
struct
|
||||
{
|
||||
const ase_char_t* name;
|
||||
TestAwk::Option opt;
|
||||
} otab[] =
|
||||
{
|
||||
{ ASE_T("implicit"), TestAwk::OPT_IMPLICIT },
|
||||
{ ASE_T("explicit"), TestAwk::OPT_EXPLICIT },
|
||||
{ ASE_T("uniquefn"), TestAwk::OPT_UNIQUEFN },
|
||||
{ ASE_T("shading"), TestAwk::OPT_SHADING },
|
||||
{ ASE_T("shift"), TestAwk::OPT_SHIFT },
|
||||
{ ASE_T("idiv"), TestAwk::OPT_IDIV },
|
||||
{ ASE_T("strconcat"), TestAwk::OPT_STRCONCAT },
|
||||
{ ASE_T("extio"), TestAwk::OPT_EXTIO },
|
||||
{ ASE_T("blockless"), TestAwk::OPT_BLOCKLESS },
|
||||
{ ASE_T("baseone"), TestAwk::OPT_BASEONE },
|
||||
{ ASE_T("stripspaces"), TestAwk::OPT_STRIPSPACES },
|
||||
{ ASE_T("nextofile"), TestAwk::OPT_NEXTOFILE },
|
||||
{ ASE_T("crfl"), TestAwk::OPT_CRLF },
|
||||
{ ASE_T("argstomain"), TestAwk::OPT_ARGSTOMAIN },
|
||||
{ ASE_T("reset"), TestAwk::OPT_RESET },
|
||||
{ ASE_T("maptovar"), TestAwk::OPT_MAPTOVAR },
|
||||
{ ASE_T("pablock"), TestAwk::OPT_PABLOCK }
|
||||
};
|
||||
|
||||
if (awk.open() == -1)
|
||||
{
|
||||
ase_fprintf (stderr, ASE_T("cannot open awk\n"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c,v 1.17 2007/09/30 15:12:20 bacon Exp $
|
||||
* $Id: awk.c,v 1.19 2007/10/11 14:39:46 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk.h>
|
||||
@ -789,9 +789,42 @@ static void on_run_end (ase_awk_run_t* run, int errnum, void* custom_data)
|
||||
app_run = NULL;
|
||||
}
|
||||
|
||||
static struct
|
||||
{
|
||||
const ase_char_t* name;
|
||||
int opt;
|
||||
} otab[] =
|
||||
{
|
||||
{ ASE_T("implicit"), ASE_AWK_IMPLICIT },
|
||||
{ ASE_T("explicit"), ASE_AWK_EXPLICIT },
|
||||
{ ASE_T("uniquefn"), ASE_AWK_UNIQUEFN },
|
||||
{ ASE_T("shading"), ASE_AWK_SHADING },
|
||||
{ ASE_T("shift"), ASE_AWK_SHIFT },
|
||||
{ ASE_T("idiv"), ASE_AWK_IDIV },
|
||||
{ ASE_T("strconcat"), ASE_AWK_STRCONCAT },
|
||||
{ ASE_T("extio"), ASE_AWK_EXTIO },
|
||||
{ ASE_T("blockless"), ASE_AWK_BLOCKLESS },
|
||||
{ ASE_T("baseone"), ASE_AWK_BASEONE },
|
||||
{ ASE_T("stripspaces"), ASE_AWK_STRIPSPACES },
|
||||
{ ASE_T("nextofile"), ASE_AWK_NEXTOFILE },
|
||||
{ ASE_T("crfl"), ASE_AWK_CRLF },
|
||||
{ ASE_T("argstomain"), ASE_AWK_ARGSTOMAIN },
|
||||
{ ASE_T("reset"), ASE_AWK_RESET },
|
||||
{ ASE_T("maptovar"), ASE_AWK_MAPTOVAR },
|
||||
{ ASE_T("pablock"), ASE_AWK_PABLOCK }
|
||||
};
|
||||
|
||||
static void print_usage (const ase_char_t* argv0)
|
||||
{
|
||||
ase_printf (ASE_T("Usage: %s [-m] [-d] [-ns] [-a argument]* -f source-file [data-file]*\n"), argv0);
|
||||
int j;
|
||||
|
||||
ase_printf (ASE_T("Usage: %s [-m] [-d] [-a argument]* -f source-file [data-file]*\n"), argv0);
|
||||
|
||||
ase_printf (ASE_T("\nYou may specify the following options to change the behavior of the interpreter.\n"));
|
||||
for (j = 0; j < ASE_COUNTOF(otab); j++)
|
||||
{
|
||||
ase_printf (ASE_T(" -%-20s -no%-20s\n"), otab[j].name, otab[j].name);
|
||||
}
|
||||
}
|
||||
|
||||
static int run_awk (ase_awk_t* awk,
|
||||
@ -900,21 +933,12 @@ static int awk_main (int argc, ase_char_t* argv[])
|
||||
int deparse = 0;
|
||||
|
||||
opt = ASE_AWK_IMPLICIT |
|
||||
/*ASE_AWK_EXPLICIT |*/
|
||||
ASE_AWK_UNIQUEFN |
|
||||
ASE_AWK_SHADING |
|
||||
/*ASE_AWK_SHIFT |*/
|
||||
/*ASE_AWK_IDIV |*/
|
||||
/*ASE_AWK_STRCONCAT |*/
|
||||
ASE_AWK_EXTIO |
|
||||
ASE_AWK_BLOCKLESS |
|
||||
ASE_AWK_BASEONE /*|*/
|
||||
/*ASE_AWK_STRIPSPACES |*/
|
||||
/*ASE_AWK_NEXTOFILE |*/
|
||||
/*ASE_AWK_CRLF |*/
|
||||
/*ASE_AWK_ARGSTOMAIN |*/
|
||||
/*ASE_AWK_RESET*/
|
||||
/*ASE_AWK_MAPTOVAR*/;
|
||||
ASE_AWK_BASEONE |
|
||||
ASE_AWK_PABLOCK;
|
||||
|
||||
if (argc <= 1)
|
||||
{
|
||||
@ -944,15 +968,39 @@ static int awk_main (int argc, ase_char_t* argv[])
|
||||
/* specify arguments */
|
||||
mode = 2;
|
||||
}
|
||||
else if (ase_strcmp(argv[i], ASE_T("-ns")) == 0)
|
||||
{
|
||||
/* no space stripping */
|
||||
opt &= ~ASE_AWK_STRIPSPACES;
|
||||
}
|
||||
else if (argv[i][0] == ASE_T('-'))
|
||||
{
|
||||
int j;
|
||||
|
||||
if (argv[i][1] == ASE_T('n') && argv[i][2] == ASE_T('o'))
|
||||
{
|
||||
for (j = 0; j < ASE_COUNTOF(otab); j++)
|
||||
{
|
||||
if (ase_strcmp(&argv[i][3], otab[j].name) == 0)
|
||||
{
|
||||
opt &= ~otab[j].opt;
|
||||
goto ok_valid;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < ASE_COUNTOF(otab); j++)
|
||||
{
|
||||
if (ase_strcmp(&argv[i][1], otab[j].name) == 0)
|
||||
{
|
||||
opt |= otab[j].opt;
|
||||
goto ok_valid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print_usage (argv[0]);
|
||||
return -1;
|
||||
|
||||
ok_valid:
|
||||
;
|
||||
}
|
||||
else if (file_count < ASE_COUNTOF(infiles)-1)
|
||||
{
|
||||
|
@ -1,8 +1,6 @@
|
||||
global abc;
|
||||
|
||||
BEGIN {
|
||||
abc[20] = "abc";
|
||||
abc = 10;
|
||||
}
|
||||
|
||||
RUN ERROR: CODE [96] LINE [5] map 'abc' not assignable with a scalar
|
||||
RUN ERROR: CODE [97] LINE [3] map 'abc' not assignable with a scalar
|
||||
|
@ -2,4 +2,4 @@ BEGIN {
|
||||
delete ARGC;
|
||||
}
|
||||
|
||||
RUN ERROR: CODE [88] LINE [2] variable 'ARGC' not deletable
|
||||
RUN ERROR: CODE [89] LINE [2] variable 'ARGC' not deletable
|
||||
|
@ -3,4 +3,4 @@ BEGIN {
|
||||
delete iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix;
|
||||
}
|
||||
|
||||
RUN ERROR: CODE [88] LINE [3] variable 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii...' not deletable
|
||||
RUN ERROR: CODE [89] LINE [3] variable 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii...' not deletable
|
||||
|
@ -2,4 +2,4 @@ BEGIN {
|
||||
helpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxhelphelp ();
|
||||
}
|
||||
|
||||
RUN ERROR: CODE [86] LINE [2] function 'helpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxhel...' not found
|
||||
RUN ERROR: CODE [87] LINE [2] function 'helpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxhel...' not found
|
||||
|
@ -1 +1 @@
|
||||
PARSE ERROR: CODE [56] LINE [2] intrinsic function 'substr' redefined
|
||||
PARSE ERROR: CODE [57] LINE [2] intrinsic function 'substr' redefined
|
||||
|
@ -1 +1 @@
|
||||
PARSE ERROR: CODE [56] LINE [3] intrinsic function 'substr' redefined
|
||||
PARSE ERROR: CODE [57] LINE [3] intrinsic function 'substr' redefined
|
||||
|
@ -1 +1 @@
|
||||
PARSE ERROR: CODE [57] LINE [9] function 'abc' redefined
|
||||
PARSE ERROR: CODE [58] LINE [9] function 'abc' redefined
|
||||
|
@ -1 +1 @@
|
||||
PARSE ERROR: CODE [58] LINE [4] global variable 'abc' redefined
|
||||
PARSE ERROR: CODE [59] LINE [4] global variable 'abc' redefined
|
||||
|
@ -1 +1 @@
|
||||
PARSE ERROR: CODE [59] LINE [4] parameter 'x' redefined
|
||||
PARSE ERROR: CODE [60] LINE [4] parameter 'x' redefined
|
||||
|
@ -1 +1 @@
|
||||
PARSE ERROR: CODE [57] LINE [11] function 'abc' redefined
|
||||
PARSE ERROR: CODE [58] LINE [11] function 'abc' redefined
|
||||
|
@ -1 +1 @@
|
||||
PARSE ERROR: CODE [57] LINE [1] function 'abc' redefined
|
||||
PARSE ERROR: CODE [58] LINE [1] function 'abc' redefined
|
||||
|
@ -1 +1 @@
|
||||
PARSE ERROR: CODE [52] LINE [2] BEGIN not followed by a left bracket on the same line
|
||||
PARSE ERROR: CODE [53] LINE [2] BEGIN not followed by a left bracket on the same line
|
||||
|
@ -1 +1 @@
|
||||
PARSE ERROR: CODE [63] LINE [1] '+' not a valid parameter name
|
||||
PARSE ERROR: CODE [64] LINE [1] '+' not a valid parameter name
|
||||
|
@ -1 +1 @@
|
||||
PARSE ERROR: CODE [64] LINE [1] '+' not a valid variable name
|
||||
PARSE ERROR: CODE [65] LINE [1] '+' not a valid variable name
|
||||
|
@ -1 +1 @@
|
||||
PARSE ERROR: CODE [64] LINE [3] '+' not a valid variable name
|
||||
PARSE ERROR: CODE [65] LINE [3] '+' not a valid variable name
|
||||
|
@ -2,4 +2,4 @@ BEGIN {
|
||||
print abc > "123\0abc";
|
||||
}
|
||||
|
||||
RUN ERROR: CODE [112] LINE [2] i/o name containing a null character
|
||||
RUN ERROR: CODE [113] LINE [2] i/o name containing a null character
|
||||
|
@ -3,4 +3,4 @@ BEGIN {
|
||||
split ("a b c",xx);
|
||||
}
|
||||
|
||||
RUN ERROR: CODE [97] LINE [3] cannot change a scalar value to a map
|
||||
RUN ERROR: CODE [98] LINE [3] cannot change a scalar value to a map
|
||||
|
@ -1 +1 @@
|
||||
PARSE ERROR: CODE [61] LINE [1] duplicate global variable 'ARGV'
|
||||
PARSE ERROR: CODE [62] LINE [1] duplicate global variable 'ARGV'
|
||||
|
@ -1,12 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
OPTION=-explicit
|
||||
|
||||
run_script_for_init()
|
||||
{
|
||||
script="$1"
|
||||
data="$2"
|
||||
output=`echo $script | sed 's/\.awk$/.out/g'`
|
||||
|
||||
"$ASEAWK" -d -f "$script" "$data" > "$output"
|
||||
"$ASEAWK" $OPTION -d -f "$script" "$data" > "$output"
|
||||
}
|
||||
|
||||
run_init()
|
||||
@ -39,7 +41,7 @@ run_script_for_test()
|
||||
output=`echo $script | sed 's/\.awk$/.out/g'`
|
||||
|
||||
echo ">> RUNNING $script"
|
||||
"$ASEAWK" -d -f "$script" "$data" > "$output.$pid"
|
||||
"$ASEAWK" $OPTION -d -f "$script" "$data" > "$output.$pid"
|
||||
|
||||
#diff -y "$output" "$output.$pid"
|
||||
diff "$output" "$output.$pid"
|
||||
|
Loading…
Reference in New Issue
Block a user