*** empty log message ***

This commit is contained in:
2007-01-23 14:23:18 +00:00
parent ba62bc76bc
commit 6a67beb6ef
9 changed files with 644 additions and 382 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.java,v 1.19 2007-01-21 13:21:14 bacon Exp $
* $Id: Awk.java,v 1.20 2007-01-23 14:23:18 bacon Exp $
*/
package ase.test.awk;
@ -13,6 +13,8 @@ public class Awk extends ase.awk.StdAwk
addBuiltinFunction ("sin", 1, 1);
addBuiltinFunction ("cos", 1, 1);
addBuiltinFunction ("tan", 1, 1);
addBuiltinFunction ("srand", 0, 1);
addBuiltinFunction ("rand", 0, 0);
addBuiltinFunction ("system", 1, 1);
@ -41,7 +43,7 @@ public class Awk extends ase.awk.StdAwk
//return new Short ((short)1001);
}
protected String[] getInputConsoleNames ()
protected String[] consoleInputNames ()
{
String[] cin = new String[3];
cin[0] = "c1.txt";
@ -50,7 +52,7 @@ public class Awk extends ase.awk.StdAwk
return cin;
}
protected String[] getOutputConsoleNames ()
protected String[] consoleOutputNames ()
{
String[] cout = new String[1];
cout[0] = "";
@ -64,28 +66,19 @@ public class Awk extends ase.awk.StdAwk
*/
}
protected String[] getSourceNames ()
protected String[] sourceInputNames ()
{
String[] cout = new String[1];
cout[0] = "t.awk";
return cout;
String[] sin = new String[1];
sin[0] = "t.awk";
return sin;
}
/*
protected String getDeparsedSourceName ()
protected String sourceOutputName ()
{
return "";
}
*/
protected int getMaxParseDepth ()
{
return 50;
}
protected int getMaxRunDepth ()
{
return 50;
}
public static void main (String[] args)
{
@ -94,17 +87,33 @@ public class Awk extends ase.awk.StdAwk
try
{
awk = new Awk ();
awk.setMaxDepth (Awk.DEPTH_BLOCK_PARSE, 30);
awk.parse ();
awk.run ();
}
catch (ase.awk.Exception e)
{
System.out.println ("ase.awk.Exception - " + e.getMessage());
if (e.getLine() == 0)
{
System.out.println ("ase.awk.Exception - " + e.getMessage());
}
else
{
System.out.println (
"ase.awk.Exception at line " +
e.getLine() + " - " + e.getMessage());
}
}
finally
{
if (awk != null) awk.close ();
if (awk != null)
{
awk.close ();
awk = null;
}
}
System.out.println ("==== end of awk ====");
}
}

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c,v 1.151 2006-12-26 10:25:19 bacon Exp $
* $Id: awk.c,v 1.152 2007-01-23 14:23:18 bacon Exp $
*/
#include <ase/awk/awk.h>
@ -790,15 +790,14 @@ static int __main (int argc, ase_char_t* argv[])
opt = ASE_AWK_IMPLICIT |
ASE_AWK_EXPLICIT |
ASE_AWK_UNIQUEAFN |
ASE_AWK_HASHSIGN |
ASE_AWK_UNIQUEFN |
ASE_AWK_IDIV |
ASE_AWK_SHADING |
ASE_AWK_SHIFT |
ASE_AWK_EXTIO |
/*ASE_AWK_COPROC |*/
ASE_AWK_BLOCKLESS |
ASE_AWK_STRINDEXONE |
ASE_AWK_STRIDXONE |
ASE_AWK_STRIPSPACES |
ASE_AWK_NEXTOFILE;
@ -884,17 +883,17 @@ static int __main (int argc, ase_char_t* argv[])
return -1;
}
ase_awk_setopt (awk, opt);
ase_awk_setoption (awk, opt);
srcios.in = process_source;
srcios.out = dump_source;
srcios.custom_data = &src_io;
ase_awk_setmaxparsedepth (
awk, ASE_AWK_DEPTH_BLOCK | ASE_AWK_DEPTH_EXPR, 20);
ase_awk_setmaxrundepth (
awk, ASE_AWK_DEPTH_BLOCK | ASE_AWK_DEPTH_EXPR, 50);
ase_awk_setmaxdepth (
awk, ASE_AWK_DEPTH_BLOCK_PARSE | ASE_AWK_DEPTH_EXPR_PARSE, 20);
ase_awk_setmaxdepth (
awk, ASE_AWK_DEPTH_BLOCK_RUN | ASE_AWK_DEPTH_EXPR_RUN, 50);
if (ase_awk_parse (awk, &srcios) == -1)
{

View File

@ -1,4 +1,4 @@
function main ()
function main (arg1, arg2, arg3)
{
local i, k, c;
@ -14,5 +14,8 @@ function main ()
if (i in abc) j[i] = i;
}
print arg1;
print arg2;
print arg3;
print "end of program";
}