*** empty log message ***

This commit is contained in:
hyung-hwan 2006-10-26 14:22:01 +00:00
parent bfa9edd9ab
commit 4821fe92aa
5 changed files with 184 additions and 22 deletions

View File

@ -22,9 +22,9 @@ JAVACFLAGS = -classpath ../..
all: lib jni all: lib jni
lib: $(OBJS) lib: $(C_OBJS)
$(LD) /lib @<< $(LD) /lib @<<
/nologo /out:$(OUT).lib $(OBJS) /nologo /out:$(OUT).lib $(C_OBJS)
<< <<
jni: $(JNI_OBJS) $(JAVA_OBJS) jni: $(JNI_OBJS) $(JAVA_OBJS)

View File

@ -1,5 +1,5 @@
/* /*
* $Id: parse.c,v 1.195 2006-10-26 09:27:15 bacon Exp $ * $Id: parse.c,v 1.196 2006-10-26 14:21:40 bacon Exp $
*/ */
#include <ase/awk/awk_i.h> #include <ase/awk/awk_i.h>
@ -281,11 +281,11 @@ static struct __bvent __bvtab[] =
}; };
#define GET_CHAR(awk) \ #define GET_CHAR(awk) \
do { if (__get_char(awk) == -1) return -1; } while(0) do { if (__get_char (awk) == -1) return -1; } while(0)
#define GET_CHAR_TO(awk,c) \ #define GET_CHAR_TO(awk,c) \
do { \ do { \
if (__get_char(awk) == -1) return -1; \ if (__get_char (awk) == -1) return -1; \
c = (awk)->src.lex.curc; \ c = (awk)->src.lex.curc; \
} while(0) } while(0)
@ -1245,14 +1245,54 @@ awk->parse.nl_semicolon = 1;
nde = __parse_delete (awk); nde = __parse_delete (awk);
} }
else if (MATCH(awk,TOKEN_PRINT)) else if (MATCH(awk,TOKEN_PRINT))
{
if (__get_token(awk) == -1) return ASE_NULL;
if (MATCH (awk, TOKEN_LPAREN))
{ {
if (__get_token(awk) == -1) return ASE_NULL; if (__get_token(awk) == -1) return ASE_NULL;
nde = __parse_print (awk); nde = __parse_print (awk);
if (nde == ASE_NULL) return ASE_NULL;
if (!MATCH (awk, TOKEN_RPAREN))
{
ase_awk_clrpt (awk, nde);
PANIC (awk, ASE_AWK_ERPAREN);
}
if (__get_token(awk) == -1)
{
ase_awk_clrpt (awk, nde);
return ASE_NULL;
}
}
else
{
nde = __parse_print (awk);
}
} }
else if (MATCH(awk,TOKEN_PRINTF)) else if (MATCH(awk,TOKEN_PRINTF))
{
if (__get_token(awk) == -1) return ASE_NULL;
if (MATCH (awk, TOKEN_LPAREN))
{ {
if (__get_token(awk) == -1) return ASE_NULL; if (__get_token(awk) == -1) return ASE_NULL;
nde = __parse_printf (awk); nde = __parse_printf (awk);
if (nde == ASE_NULL) return ASE_NULL;
if (!MATCH (awk, TOKEN_RPAREN))
{
ase_awk_clrpt (awk, nde);
PANIC (awk, ASE_AWK_ERPAREN);
}
if (__get_token(awk) == -1)
{
ase_awk_clrpt (awk, nde);
return ASE_NULL;
}
}
else
{
nde = __parse_printf (awk);
}
} }
else else
{ {
@ -2227,7 +2267,6 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk)
if (MATCH(awk,TOKEN_IDENT)) if (MATCH(awk,TOKEN_IDENT))
{ {
/* getline var */ /* getline var */
var = __parse_primary (awk); var = __parse_primary (awk);
if (var == ASE_NULL) return ASE_NULL; if (var == ASE_NULL) return ASE_NULL;
} }
@ -3221,6 +3260,8 @@ static ase_awk_nde_t* __parse_print (ase_awk_t* awk)
static ase_awk_nde_t* __parse_printf (ase_awk_t* awk) static ase_awk_nde_t* __parse_printf (ase_awk_t* awk)
{ {
/* TODO: implement this... */ /* TODO: implement this... */
ASE_AWK_ASSERT (awk, !"printf not implemented yet");
awk->errnum = ASE_AWK_EINTERNAL;
return ASE_NULL; return ASE_NULL;
} }
@ -3297,10 +3338,26 @@ static int __get_token (ase_awk_t* awk)
{ {
SET_TOKEN_TYPE (awk, TOKEN_EOF); SET_TOKEN_TYPE (awk, TOKEN_EOF);
} }
else if (ASE_AWK_ISDIGIT (awk, c) || c == ASE_T('.')) else if (ASE_AWK_ISDIGIT (awk, c)/*|| c == ASE_T('.')*/)
{ {
if (__get_number (awk) == -1) return -1; if (__get_number (awk) == -1) return -1;
} }
else if (c == ASE_T('.'))
{
if (__get_char (awk) == -1) return -1;
c = awk->src.lex.curc;
if (ASE_AWK_ISDIGIT (awk, c))
{
if (__unget_char (awk, c) == -1) return -1;
if (__get_number (awk) == -1) return -1;
}
else
{
awk->errnum = ASE_AWK_ELXCHR;
return -1;
}
}
else if (ASE_AWK_ISALPHA (awk, c) || c == ASE_T('_')) else if (ASE_AWK_ISALPHA (awk, c) || c == ASE_T('_'))
{ {
int type; int type;
@ -4066,7 +4123,7 @@ static int __skip_comment (ase_awk_t* awk)
return 1; /* c-style comment */ return 1; /* c-style comment */
} }
if (__unget_char(awk,c) == -1) return -1; /* error */ if (__unget_char (awk, c) == -1) return -1; /* error */
awk->src.lex.curc = ASE_T('/'); awk->src.lex.curc = ASE_T('/');
return 0; return 0;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: read.c,v 1.24 2006-10-26 09:31:28 bacon Exp $ * $Id: read.c,v 1.25 2006-10-26 14:22:01 bacon Exp $
*/ */
#include <ase/lsp/lsp_i.h> #include <ase/lsp/lsp_i.h>
@ -347,6 +347,7 @@ static int read_token (ase_lsp_t* lsp)
return 0; return 0;
} }
#if 0
static int read_number (ase_lsp_t* lsp, int negative) static int read_number (ase_lsp_t* lsp, int negative)
{ {
ase_long_t ivalue = 0; ase_long_t ivalue = 0;
@ -387,6 +388,102 @@ static int read_number (ase_lsp_t* lsp, int negative)
return 0; return 0;
} }
#endif
static int __read_number (ase_lsp_t* lsp, int negative)
{
ase_cint_t c;
ASE_LSP_ASSERT (lsp, ASE_LSP_STR_LEN(&lsp->token.name) == 0);
SET_TOKEN_TYPE (lsp, TOKEN_INT);
c = lsp->src.lex.curc;
if (c == ASE_T('0'))
{
ADD_TOKEN_CHAR (lsp, c);
GET_CHAR_TO (lsp, c);
if (c == ASE_T('x') || c == ASE_T('X'))
{
/* hexadecimal number */
do
{
ADD_TOKEN_CHAR (lsp, c);
GET_CHAR_TO (lsp, c);
}
while (ASE_LSP_ISXDIGIT (lsp, c));
return 0;
}
else if (c == ASE_T('b') || c == ASE_T('B'))
{
/* binary number */
do
{
ADD_TOKEN_CHAR (lsp, c);
GET_CHAR_TO (lsp, c);
}
while (c == ASE_T('0') || c == ASE_T('1'));
return 0;
}
else if (c != '.')
{
/* octal number */
while (c >= ASE_T('0') && c <= ASE_T('7'))
{
ADD_TOKEN_CHAR (lsp, c);
GET_CHAR_TO (lsp, c);
}
return 0;
}
}
while (ASE_LSP_ISDIGIT (lsp, c))
{
ADD_TOKEN_CHAR (lsp, c);
GET_CHAR_TO (lsp, c);
}
if (c == ASE_T('.'))
{
/* floating-point number */
SET_TOKEN_TYPE (lsp, TOKEN_REAL);
ADD_TOKEN_CHAR (lsp, c);
GET_CHAR_TO (lsp, c);
while (ASE_LSP_ISDIGIT (lsp, c))
{
ADD_TOKEN_CHAR (lsp, c);
GET_CHAR_TO (lsp, c);
}
}
if (c == ASE_T('E') || c == ASE_T('e'))
{
SET_TOKEN_TYPE (lsp, TOKEN_REAL);
ADD_TOKEN_CHAR (lsp, c);
GET_CHAR_TO (lsp, c);
if (c == ASE_T('+') || c == ASE_T('-'))
{
ADD_TOKEN_CHAR (lsp, c);
GET_CHAR_TO (lsp, c);
}
while (ASE_LSP_ISDIGIT (lsp, c))
{
ADD_TOKEN_CHAR (lsp, c);
GET_CHAR_TO (lsp, c);
}
}
return 0;
}
static int read_ident (ase_lsp_t* lsp) static int read_ident (ase_lsp_t* lsp)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk.c,v 1.102 2006-10-24 04:48:52 bacon Exp $ * $Id: awk.c,v 1.103 2006-10-26 14:22:01 bacon Exp $
*/ */
#include <ase/awk/awk.h> #include <ase/awk/awk.h>
@ -641,7 +641,7 @@ static int __main (int argc, xp_char_t* argv[])
/*ASE_AWK_DBLSLASHES |*/ /*ASE_AWK_DBLSLASHES |*/
ASE_AWK_SHADING | ASE_AWK_IMPLICIT | ASE_AWK_SHIFT | ASE_AWK_SHADING | ASE_AWK_IMPLICIT | ASE_AWK_SHIFT |
ASE_AWK_EXTIO | ASE_AWK_BLOCKLESS | ASE_AWK_STRINDEXONE | ASE_AWK_EXTIO | ASE_AWK_BLOCKLESS | ASE_AWK_STRINDEXONE |
ASE_AWK_STRIPSPACES | ASE_AWK_NEWLINE; ASE_AWK_STRIPSPACES /*| ASE_AWK_NEWLINE*/;
if (argc <= 1) if (argc <= 1)
{ {

View File

@ -1,11 +1,19 @@
BEGIN
main ()
{ {
/* print (("%f", 1.0));
print 1
|
"test";
*/
print 1
|
1;
} }
BEGIN {
#print 1
#|
#"test";
# */
#print 1 |
# 1;
print .0;
print 10;
}