From f911cc68650bd7609894f06d0ffa2cbc4eaf8c7e Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 20 Jan 2006 16:02:03 +0000 Subject: [PATCH] no message --- ase/awk/parse.c | 7 ++++--- ase/awk/sa.c | 13 ++++++++++++- ase/awk/sa.h | 12 +++++------- ase/awk/vmsmake.com | 16 ++++++++++++++++ ase/test/awk/vmsmake.com | 6 ++++++ 5 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 ase/awk/vmsmake.com create mode 100644 ase/test/awk/vmsmake.com diff --git a/ase/awk/parse.c b/ase/awk/parse.c index 1d94bec1..977f5e8a 100644 --- a/ase/awk/parse.c +++ b/ase/awk/parse.c @@ -1,5 +1,5 @@ /* - * $Id: parse.c,v 1.27 2006-01-20 07:29:54 bacon Exp $ + * $Id: parse.c,v 1.28 2006-01-20 15:58:42 bacon Exp $ */ #include @@ -1466,18 +1466,19 @@ static int __get_token (xp_awk_t* awk) static int __get_char (xp_awk_t* awk) { xp_ssize_t n; + xp_char_t c; if (awk->lex.ungotc_count > 0) { awk->lex.curc = awk->lex.ungotc[--awk->lex.ungotc_count]; return 0; } - n = awk->src_func(XP_AWK_IO_DATA, awk->src_arg, &awk->lex.curc, 1); + n = awk->src_func(XP_AWK_IO_DATA, awk->src_arg, &c, 1); if (n == -1) { awk->errnum = XP_AWK_ESRCDT; return -1; } - if (n == 0) awk->lex.curc = XP_CHAR_EOF; + awk->lex.curc = (n == 0)? XP_CHAR_EOF: c; return 0; } diff --git a/ase/awk/sa.c b/ase/awk/sa.c index 4c3bdcc1..462a9175 100644 --- a/ase/awk/sa.c +++ b/ase/awk/sa.c @@ -1,11 +1,22 @@ /* - * $Id: sa.c,v 1.1 2006-01-20 07:32:38 bacon Exp $ + * $Id: sa.c,v 1.2 2006-01-20 15:58:42 bacon Exp $ */ #include #ifdef __STAND_ALONE +xp_char_t* xp_strdup (const xp_char_t* str) +{ + xp_char_t* tmp; + + tmp = (xp_char_t*)xp_malloc ((xp_strlen(str) + 1) * xp_sizeof(xp_char_t)); + if (tmp == XP_NULL) return XP_NULL; + + xp_strcpy (tmp, str); + return tmp; +} + xp_str_t* xp_str_open (xp_str_t* str, xp_size_t capa) { if (str == XP_NULL) { diff --git a/ase/awk/sa.h b/ase/awk/sa.h index f6f6a871..9017523b 100644 --- a/ase/awk/sa.h +++ b/ase/awk/sa.h @@ -1,5 +1,5 @@ /* - * $Id: sa.h,v 1.1 2006-01-20 07:32:38 bacon Exp $ + * $Id: sa.h,v 1.2 2006-01-20 15:58:42 bacon Exp $ */ #ifndef _XP_AWK_SA_H_ @@ -25,13 +25,9 @@ #define xp_isalnum iswalnum #define xp_isspace iswspace +#define xp_strcpy wcscpy #define xp_strcmp wcscmp #define xp_strlen wcslen -#ifdef _WIN32 -#define xp_strdup _wcsdup -#else -#define xp_strdup wcsdup -#endif #define xp_main main @@ -52,7 +48,7 @@ typedef wint_t xp_cint_t; typedef size_t xp_size_t; typedef int xp_bool_t; -#ifdef _WIN32 +#if defined(_WIN32) || defined(vms) || defined(__vms) typedef long xp_ssize_t; #else typedef ssize_t xp_ssize_t; @@ -77,6 +73,8 @@ struct xp_str_t extern "C" { #endif +xp_char_t* xp_strdup (const xp_char_t* str); + xp_str_t* xp_str_open (xp_str_t* str, xp_size_t capa); void xp_str_close (xp_str_t* str); xp_size_t xp_str_cat (xp_str_t* str, const xp_char_t* s); diff --git a/ase/awk/vmsmake.com b/ase/awk/vmsmake.com new file mode 100644 index 00000000..626ae94e --- /dev/null +++ b/ase/awk/vmsmake.com @@ -0,0 +1,16 @@ + +$ write sys$output "cc/define=__STAND_ALONE awk.c" +$ cc/define=__STAND_ALONE awk.c + +$ write sys$output "cc/define=__STAND_ALONE parse.c" +$ cc/define=__STAND_ALONE parse.c + +$ write sys$output "cc/define=__STAND_ALONE tree.c" +$ cc/define=__STAND_ALONE tree.c + +$ write sys$output "cc/define=__STAND_ALONE sa.c" +$ cc/define=__STAND_ALONE sa.c + + +$ write sys$output "lib/create xpawk awk,parse,tree,sa" +$ lib/create xpawk awk,parse,tree,sa diff --git a/ase/test/awk/vmsmake.com b/ase/test/awk/vmsmake.com new file mode 100644 index 00000000..6d217f84 --- /dev/null +++ b/ase/test/awk/vmsmake.com @@ -0,0 +1,6 @@ + +$ write sys$output "cc/define=__STAND_ALONE awk.c" +$ cc/define=__STAND_ALONE awk.c + +$ write sys$output "link awk.obj,[-.-.awk]xpawk/library" +$ link awk.obj,[-.-.awk]xpawk/library