no message

This commit is contained in:
hyung-hwan 2006-01-20 16:02:03 +00:00
parent 4a61107140
commit f911cc6865
5 changed files with 43 additions and 11 deletions

View File

@ -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 <xp/awk/awk.h> #include <xp/awk/awk.h>
@ -1466,18 +1466,19 @@ static int __get_token (xp_awk_t* awk)
static int __get_char (xp_awk_t* awk) static int __get_char (xp_awk_t* awk)
{ {
xp_ssize_t n; xp_ssize_t n;
xp_char_t c;
if (awk->lex.ungotc_count > 0) { if (awk->lex.ungotc_count > 0) {
awk->lex.curc = awk->lex.ungotc[--awk->lex.ungotc_count]; awk->lex.curc = awk->lex.ungotc[--awk->lex.ungotc_count];
return 0; 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) { if (n == -1) {
awk->errnum = XP_AWK_ESRCDT; awk->errnum = XP_AWK_ESRCDT;
return -1; return -1;
} }
if (n == 0) awk->lex.curc = XP_CHAR_EOF; awk->lex.curc = (n == 0)? XP_CHAR_EOF: c;
return 0; return 0;
} }

View File

@ -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 <xp/awk/sa.h> #include <xp/awk/sa.h>
#ifdef __STAND_ALONE #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) xp_str_t* xp_str_open (xp_str_t* str, xp_size_t capa)
{ {
if (str == XP_NULL) { if (str == XP_NULL) {

View File

@ -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_ #ifndef _XP_AWK_SA_H_
@ -25,13 +25,9 @@
#define xp_isalnum iswalnum #define xp_isalnum iswalnum
#define xp_isspace iswspace #define xp_isspace iswspace
#define xp_strcpy wcscpy
#define xp_strcmp wcscmp #define xp_strcmp wcscmp
#define xp_strlen wcslen #define xp_strlen wcslen
#ifdef _WIN32
#define xp_strdup _wcsdup
#else
#define xp_strdup wcsdup
#endif
#define xp_main main #define xp_main main
@ -52,7 +48,7 @@ typedef wint_t xp_cint_t;
typedef size_t xp_size_t; typedef size_t xp_size_t;
typedef int xp_bool_t; typedef int xp_bool_t;
#ifdef _WIN32 #if defined(_WIN32) || defined(vms) || defined(__vms)
typedef long xp_ssize_t; typedef long xp_ssize_t;
#else #else
typedef ssize_t xp_ssize_t; typedef ssize_t xp_ssize_t;
@ -77,6 +73,8 @@ struct xp_str_t
extern "C" { extern "C" {
#endif #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); xp_str_t* xp_str_open (xp_str_t* str, xp_size_t capa);
void xp_str_close (xp_str_t* str); void xp_str_close (xp_str_t* str);
xp_size_t xp_str_cat (xp_str_t* str, const xp_char_t* s); xp_size_t xp_str_cat (xp_str_t* str, const xp_char_t* s);

16
ase/awk/vmsmake.com Normal file
View File

@ -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

6
ase/test/awk/vmsmake.com Normal file
View File

@ -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