*** empty log message ***
This commit is contained in:
parent
e64bd5739f
commit
28c5b1e215
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.c,v 1.80 2006-10-12 14:36:25 bacon Exp $
|
* $Id: awk.c,v 1.81 2006-10-15 15:45:41 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -95,6 +95,7 @@ xp_awk_t* xp_awk_open (xp_awk_syscas_t* syscas)
|
|||||||
awk->errnum = XP_AWK_ENOERR;
|
awk->errnum = XP_AWK_ENOERR;
|
||||||
|
|
||||||
awk->parse.nlocals_max = 0;
|
awk->parse.nlocals_max = 0;
|
||||||
|
awk->parse.nl_semicolon = 0;
|
||||||
|
|
||||||
awk->tree.nglobals = 0;
|
awk->tree.nglobals = 0;
|
||||||
awk->tree.nbglobals = 0;
|
awk->tree.nbglobals = 0;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.h,v 1.127 2006-10-13 10:18:10 bacon Exp $
|
* $Id: awk.h,v 1.128 2006-10-15 15:45:41 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XP_AWK_AWK_H_
|
#ifndef _XP_AWK_AWK_H_
|
||||||
@ -189,7 +189,10 @@ enum xp_awk_option_t
|
|||||||
* The program splits " a b c " into [a], [b], [c] when this
|
* The program splits " a b c " into [a], [b], [c] when this
|
||||||
* option is on while into [], [a], [b], [c], [] when it is off.
|
* option is on while into [], [a], [b], [c], [] when it is off.
|
||||||
*/
|
*/
|
||||||
XP_AWK_STRIPSPACES = (1 << 12)
|
XP_AWK_STRIPSPACES = (1 << 12),
|
||||||
|
|
||||||
|
/* a newline terminates a statement */
|
||||||
|
XP_AWK_NEWLINE = (1 << 13)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* error code */
|
/* error code */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk_i.h,v 1.66 2006-10-13 10:18:10 bacon Exp $
|
* $Id: awk_i.h,v 1.67 2006-10-15 15:45:41 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XP_AWK_AWKI_H_
|
#ifndef _XP_AWK_AWKI_H_
|
||||||
@ -122,6 +122,8 @@ struct xp_awk_t
|
|||||||
xp_awk_tab_t locals;
|
xp_awk_tab_t locals;
|
||||||
xp_awk_tab_t params;
|
xp_awk_tab_t params;
|
||||||
xp_size_t nlocals_max;
|
xp_size_t nlocals_max;
|
||||||
|
|
||||||
|
int nl_semicolon;
|
||||||
} parse;
|
} parse;
|
||||||
|
|
||||||
/* source code management */
|
/* source code management */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: jni.c,v 1.7 2006-10-13 14:05:24 bacon Exp $
|
* $Id: jni.c,v 1.8 2006-10-15 15:45:41 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/jni.h>
|
#include <xp/awk/jni.h>
|
||||||
@ -211,6 +211,13 @@ JNIEXPORT void JNICALL Java_xpkit_xpj_awk_Awk_run (JNIEnv* env, jobject obj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_xpkit_xpj_awk_Awk_set_1extio_1handle (
|
||||||
|
JNIEnv* env, jobject obj, jlong extio, jobject handle)
|
||||||
|
{
|
||||||
|
xp_awk_extio_t* epa = (xp_awk_extio_t*)extio;
|
||||||
|
epa->handle = (void*)handle;
|
||||||
|
}
|
||||||
|
|
||||||
static xp_ssize_t __call_java_open_source (JNIEnv* env, jobject obj, int mode)
|
static xp_ssize_t __call_java_open_source (JNIEnv* env, jobject obj, int mode)
|
||||||
{
|
{
|
||||||
jclass class;
|
jclass class;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: parse.c,v 1.189 2006-10-13 10:18:10 bacon Exp $
|
* $Id: parse.c,v 1.190 2006-10-15 15:45:41 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -1155,7 +1155,11 @@ static xp_awk_nde_t* __parse_statement (xp_awk_t* awk)
|
|||||||
if (__get_token(awk) == -1) return XP_NULL;
|
if (__get_token(awk) == -1) return XP_NULL;
|
||||||
nde = __parse_block (awk, xp_false);
|
nde = __parse_block (awk, xp_false);
|
||||||
}
|
}
|
||||||
else nde = __parse_statement_nb (awk);
|
else
|
||||||
|
{
|
||||||
|
nde = __parse_statement_nb (awk);
|
||||||
|
awk->parse.nl_semicolon = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return nde;
|
return nde;
|
||||||
}
|
}
|
||||||
@ -1193,6 +1197,7 @@ static xp_awk_nde_t* __parse_statement_nb (xp_awk_t* awk)
|
|||||||
return nde;
|
return nde;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
awk->parse.nl_semicolon = 1;
|
||||||
/*
|
/*
|
||||||
* keywords that require a terminating semicolon
|
* keywords that require a terminating semicolon
|
||||||
*/
|
*/
|
||||||
@ -1256,6 +1261,7 @@ static xp_awk_nde_t* __parse_statement_nb (xp_awk_t* awk)
|
|||||||
nde = __parse_expression(awk);
|
nde = __parse_expression(awk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
awk->parse.nl_semicolon = 0;
|
||||||
if (nde == XP_NULL) return XP_NULL;
|
if (nde == XP_NULL) return XP_NULL;
|
||||||
|
|
||||||
/* check if a statement ends with a semicolon */
|
/* check if a statement ends with a semicolon */
|
||||||
@ -3623,8 +3629,10 @@ static int __get_token (xp_awk_t* awk)
|
|||||||
ADD_TOKEN_CHAR (awk, c);
|
ADD_TOKEN_CHAR (awk, c);
|
||||||
GET_CHAR_TO (awk, c);
|
GET_CHAR_TO (awk, c);
|
||||||
}
|
}
|
||||||
else if (c == XP_T(';'))
|
else if (c == XP_T(';') ||
|
||||||
|
(c == XP_T('\n') && (awk->option & XP_AWK_NEWLINE)))
|
||||||
{
|
{
|
||||||
|
/* TODO: more check on the newline terminator... */
|
||||||
SET_TOKEN_TYPE (awk, TOKEN_SEMICOLON);
|
SET_TOKEN_TYPE (awk, TOKEN_SEMICOLON);
|
||||||
ADD_TOKEN_CHAR (awk, c);
|
ADD_TOKEN_CHAR (awk, c);
|
||||||
GET_CHAR_TO (awk, c);
|
GET_CHAR_TO (awk, c);
|
||||||
@ -3986,7 +3994,15 @@ static int __skip_spaces (xp_awk_t* awk)
|
|||||||
{
|
{
|
||||||
xp_cint_t c = awk->src.lex.curc;
|
xp_cint_t c = awk->src.lex.curc;
|
||||||
|
|
||||||
while (XP_AWK_ISSPACE (awk, c)) GET_CHAR_TO (awk, c);
|
if (awk->option & XP_AWK_NEWLINE && awk->parse.nl_semicolon)
|
||||||
|
{
|
||||||
|
while (c != XP_T('\n') &&
|
||||||
|
XP_AWK_ISSPACE (awk, c)) GET_CHAR_TO (awk, c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (XP_AWK_ISSPACE (awk, c)) GET_CHAR_TO (awk, c);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,5 +14,10 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#for (i = 0
|
||||||
|
# i < 20
|
||||||
|
# i;;) print i;
|
||||||
|
|
||||||
|
|
||||||
if (ARGC >= 0) print "ARGC is positive";
|
if (ARGC >= 0) print "ARGC is positive";
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.c,v 1.96 2006-10-13 10:18:39 bacon Exp $
|
* $Id: awk.c,v 1.97 2006-10-15 15:46:14 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk.h>
|
#include <xp/awk/awk.h>
|
||||||
@ -626,7 +626,7 @@ static int __main (int argc, xp_char_t* argv[])
|
|||||||
/*XP_AWK_DBLSLASHES |*/
|
/*XP_AWK_DBLSLASHES |*/
|
||||||
XP_AWK_SHADING | XP_AWK_IMPLICIT | XP_AWK_SHIFT |
|
XP_AWK_SHADING | XP_AWK_IMPLICIT | XP_AWK_SHIFT |
|
||||||
XP_AWK_EXTIO | XP_AWK_BLOCKLESS | XP_AWK_STRINDEXONE |
|
XP_AWK_EXTIO | XP_AWK_BLOCKLESS | XP_AWK_STRINDEXONE |
|
||||||
XP_AWK_STRIPSPACES;
|
XP_AWK_STRIPSPACES | XP_AWK_NEWLINE;
|
||||||
|
|
||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user