*** empty log message ***
This commit is contained in:
parent
69b807966c
commit
0c0be8113f
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: extio.c,v 1.12 2006-06-28 03:44:39 bacon Exp $
|
* $Id: extio.c,v 1.13 2006-06-28 08:56:59 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -133,6 +133,7 @@ int xp_awk_writeextio (
|
|||||||
xp_assert (out_type >= 0 && out_type <= xp_countof(__out_type_map));
|
xp_assert (out_type >= 0 && out_type <= xp_countof(__out_type_map));
|
||||||
xp_assert (out_type >= 0 && out_type <= xp_countof(__out_opt_map));
|
xp_assert (out_type >= 0 && out_type <= xp_countof(__out_opt_map));
|
||||||
|
|
||||||
|
/* translate the out_type into the relevant extio type and option */
|
||||||
extio_type = __out_type_map[out_type];
|
extio_type = __out_type_map[out_type];
|
||||||
extio_opt = __out_opt_map[out_type];
|
extio_opt = __out_opt_map[out_type];
|
||||||
|
|
||||||
@ -161,7 +162,17 @@ int xp_awk_writeextio (
|
|||||||
/* look for the corresponding extio for name */
|
/* look for the corresponding extio for name */
|
||||||
while (p != XP_NULL)
|
while (p != XP_NULL)
|
||||||
{
|
{
|
||||||
/* TODO: should it be extio_type or out_type???? */
|
/* the file "1.tmp", in the following code snippets,
|
||||||
|
* would be opened by the first print statement, but not by
|
||||||
|
* the second print statement. this is because
|
||||||
|
* both XP_AWK_OUT_FILE and XP_AWK_OUT_FILE_APPEND are
|
||||||
|
* translated to XP_AWK_EXTIO_FILE and it is used to
|
||||||
|
* keep track of file handles..
|
||||||
|
*
|
||||||
|
* print "1111" >> "1.tmp"
|
||||||
|
* print "1111" > "1.tmp"
|
||||||
|
*/
|
||||||
|
|
||||||
if (p->type == extio_type &&
|
if (p->type == extio_type &&
|
||||||
xp_strcmp(p->name,name) == 0) break;
|
xp_strcmp(p->name,name) == 0) break;
|
||||||
p = p->next;
|
p = p->next;
|
||||||
@ -187,11 +198,6 @@ int xp_awk_writeextio (
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: should it be extio_type or out_type???? */
|
|
||||||
/* TODO: should it be extio_type or out_type???? */
|
|
||||||
/* TODO: should it be extio_type or out_type???? */
|
|
||||||
/* TODO: should it be extio_type or out_type???? */
|
|
||||||
/* TODO: should it be extio_type or out_type???? */
|
|
||||||
p->type = extio_type;
|
p->type = extio_type;
|
||||||
p->handle = XP_NULL;
|
p->handle = XP_NULL;
|
||||||
p->next = XP_NULL;
|
p->next = XP_NULL;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sa.c,v 1.22 2006-06-23 11:48:19 bacon Exp $
|
* $Id: sa.c,v 1.23 2006-06-28 08:56:59 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -72,7 +72,7 @@ int xp_strcmp (const xp_char_t* s1, const xp_char_t* s2)
|
|||||||
{
|
{
|
||||||
while (*s1 == *s2)
|
while (*s1 == *s2)
|
||||||
{
|
{
|
||||||
if (*s1 == XP_CHAR('\0')) return 0;
|
if (*s1 == XP_C('\0')) return 0;
|
||||||
s1++, s2++;
|
s1++, s2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: val.c,v 1.32 2006-06-26 15:09:28 bacon Exp $
|
* $Id: val.c,v 1.33 2006-06-28 08:56:59 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -328,6 +328,22 @@ xp_bool_t xp_awk_valtobool (xp_awk_val_t* val)
|
|||||||
|
|
||||||
xp_char_t* xp_awk_valtostr (xp_awk_val_t* v, int* errnum, xp_str_t* buf)
|
xp_char_t* xp_awk_valtostr (xp_awk_val_t* v, int* errnum, xp_str_t* buf)
|
||||||
{
|
{
|
||||||
|
if (v->type == XP_AWK_VAL_NIL)
|
||||||
|
{
|
||||||
|
if (buf == XP_NULL)
|
||||||
|
{
|
||||||
|
xp_char_t* tmp;
|
||||||
|
tmp = xp_strdup (XP_T(""));
|
||||||
|
if (tmp == XP_NULL) *errnum = XP_AWK_ENOMEM;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xp_str_clear (buf);
|
||||||
|
return XP_STR_BUF(buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (v->type == XP_AWK_VAL_INT)
|
if (v->type == XP_AWK_VAL_INT)
|
||||||
{
|
{
|
||||||
xp_char_t* tmp;
|
xp_char_t* tmp;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.c,v 1.44 2006-06-27 10:53:04 bacon Exp $
|
* $Id: awk.c,v 1.45 2006-06-28 08:56:59 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk.h>
|
#include <xp/awk/awk.h>
|
||||||
@ -147,6 +147,7 @@ static xp_ssize_t process_extio_pipe (
|
|||||||
else if (opt == XP_AWK_IO_PIPE_WRITE)
|
else if (opt == XP_AWK_IO_PIPE_WRITE)
|
||||||
mode = XP_T("w");
|
mode = XP_T("w");
|
||||||
else return -1; /* TODO: any way to set the error number? */
|
else return -1; /* TODO: any way to set the error number? */
|
||||||
|
xp_printf (XP_TEXT("opending %s of type %d (pipe)\n"), epa->name, epa->type);
|
||||||
handle = _tpopen (epa->name, mode);
|
handle = _tpopen (epa->name, mode);
|
||||||
if (handle == NULL) return -1;
|
if (handle == NULL) return -1;
|
||||||
epa->handle = (void*)handle;
|
epa->handle = (void*)handle;
|
||||||
@ -155,7 +156,7 @@ static xp_ssize_t process_extio_pipe (
|
|||||||
|
|
||||||
case XP_AWK_IO_CLOSE:
|
case XP_AWK_IO_CLOSE:
|
||||||
{
|
{
|
||||||
xp_printf (XP_TEXT("closing %s of type %d\n"), epa->name, epa->type);
|
xp_printf (XP_TEXT("closing %s of type (pipe) %d\n"), epa->name, epa->type);
|
||||||
fclose ((FILE*)epa->handle);
|
fclose ((FILE*)epa->handle);
|
||||||
epa->handle = NULL;
|
epa->handle = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
@ -207,6 +208,7 @@ static xp_ssize_t process_extio_file (
|
|||||||
mode = XP_T("a");
|
mode = XP_T("a");
|
||||||
else return -1; /* TODO: any way to set the error number? */
|
else return -1; /* TODO: any way to set the error number? */
|
||||||
|
|
||||||
|
xp_printf (XP_TEXT("opending %s of type %d (file)\n"), epa->name, epa->type);
|
||||||
handle = _tfopen (epa->name, mode);
|
handle = _tfopen (epa->name, mode);
|
||||||
if (handle == NULL) return -1;
|
if (handle == NULL) return -1;
|
||||||
epa->handle = (void*)handle;
|
epa->handle = (void*)handle;
|
||||||
@ -215,7 +217,7 @@ static xp_ssize_t process_extio_file (
|
|||||||
|
|
||||||
case XP_AWK_IO_CLOSE:
|
case XP_AWK_IO_CLOSE:
|
||||||
{
|
{
|
||||||
xp_printf (XP_TEXT("closing %s of type %d\n"), epa->name, epa->type);
|
xp_printf (XP_TEXT("closing %s of type %d (file)\n"), epa->name, epa->type);
|
||||||
fclose ((FILE*)epa->handle);
|
fclose ((FILE*)epa->handle);
|
||||||
epa->handle = NULL;
|
epa->handle = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
@ -258,6 +260,7 @@ static xp_ssize_t process_extio_console (
|
|||||||
/* opt: XP_AWK_IO_CONSOLE_READ,
|
/* opt: XP_AWK_IO_CONSOLE_READ,
|
||||||
* XP_AWK_IO_CONSOLE_WRITE */
|
* XP_AWK_IO_CONSOLE_WRITE */
|
||||||
|
|
||||||
|
xp_printf (XP_TEXT("opending %s of type %d (console)\n"), epa->name, epa->type);
|
||||||
if (opt == XP_AWK_IO_CONSOLE_READ)
|
if (opt == XP_AWK_IO_CONSOLE_READ)
|
||||||
epa->handle = stdin;
|
epa->handle = stdin;
|
||||||
else if (opt == XP_AWK_IO_CONSOLE_WRITE)
|
else if (opt == XP_AWK_IO_CONSOLE_WRITE)
|
||||||
@ -267,6 +270,7 @@ static xp_ssize_t process_extio_console (
|
|||||||
|
|
||||||
case XP_AWK_IO_CLOSE:
|
case XP_AWK_IO_CLOSE:
|
||||||
{
|
{
|
||||||
|
xp_printf (XP_TEXT("closing %s of type %d (console)\n"), epa->name, epa->type);
|
||||||
/* TODO: CloseConsole in GUI APPLICATION */
|
/* TODO: CloseConsole in GUI APPLICATION */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user