*** empty log message ***

This commit is contained in:
2007-01-05 13:39:38 +00:00
parent d26963d3d3
commit 38f0ad0fba
8 changed files with 226 additions and 37 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h,v 1.179 2007-01-03 09:51:50 bacon Exp $
* $Id: awk.h,v 1.180 2007-01-05 13:38:58 bacon Exp $
*/
#ifndef _ASE_AWK_AWK_H_
@ -170,27 +170,24 @@ enum
/* enable the idiv operator (double slashes) */
ASE_AWK_IDIV = (1 << 5),
/* support comments by a hash sign */
ASE_AWK_HASHSIGN = (1 << 6),
/* support string concatenation in tokenization.
* this option can change the behavior of a certain construct.
* getline < "abc" ".def" is treated as if it is getline < "abc.def"
* when this option is on. If this option is off, the same expression
* is treated as if it is (getline < "abc") ".def". */
ASE_AWK_STRCONCAT = (1 << 7),
ASE_AWK_STRCONCAT = (1 << 6),
/* support getline and print */
ASE_AWK_EXTIO = (1 << 8),
ASE_AWK_EXTIO = (1 << 7),
/* support co-process */
ASE_AWK_COPROC = (1 << 9),
ASE_AWK_COPROC = (1 << 8),
/* support blockless patterns */
ASE_AWK_BLOCKLESS = (1 << 10),
ASE_AWK_BLOCKLESS = (1 << 9),
/* use 1 as the start index for string operations */
ASE_AWK_STRINDEXONE = (1 << 11),
ASE_AWK_STRIDXONE = (1 << 10),
/* strip off leading and trailing spaces when splitting a record
* into fields with a regular expression.
@ -205,13 +202,13 @@ enum
* The program splits " a b c " into [a], [b], [c] when this
* option is on while into [], [a], [b], [c], [] when it is off.
*/
ASE_AWK_STRIPSPACES = (1 << 12),
ASE_AWK_STRIPSPACES = (1 << 11),
/* enable the nextoutfile keyword */
ASE_AWK_NEXTOFILE = (1 << 13),
ASE_AWK_NEXTOFILE = (1 << 12),
/* cr + lf by default */
ASE_AWK_CRLF = (1 << 14)
ASE_AWK_CRLF = (1 << 13)
};
/* error code */

View File

@ -1,5 +1,5 @@
/*
* $Id: func.c,v 1.87 2007-01-03 03:18:58 bacon Exp $
* $Id: func.c,v 1.88 2007-01-05 13:38:58 bacon Exp $
*/
#include <ase/awk/awk_i.h>
@ -408,7 +408,7 @@ static int __bfn_index (
ptr = ase_awk_strxnstr (str0, len0, str1, len1);
idx = (ptr == ASE_NULL)? -1: (ase_long_t)(ptr - str0);
if (ase_awk_getopt(run->awk) & ASE_AWK_STRINDEXONE) idx = idx + 1;
if (ase_awk_getopt(run->awk) & ASE_AWK_STRIDXONE) idx = idx + 1;
if (a0->type != ASE_AWK_VAL_STR) ASE_AWK_FREE (run->awk, str0);
if (a1->type != ASE_AWK_VAL_STR) ASE_AWK_FREE (run->awk, str1);
@ -510,7 +510,7 @@ static int __bfn_substr (
if (n == 1) lcount = (ase_long_t)rcount;
}
if (ase_awk_getopt(run->awk) & ASE_AWK_STRINDEXONE) lindex = lindex - 1;
if (ase_awk_getopt(run->awk) & ASE_AWK_STRIDXONE) lindex = lindex - 1;
if (lindex >= len) lindex = len;
else if (lindex < 0) lindex = 0;
@ -684,7 +684,7 @@ static int __bfn_split (
ase_awk_refupval (run, *a1_ref);
p = str; str_left = str_len;
sta = (ase_awk_getopt(run->awk) & ASE_AWK_STRINDEXONE)? 1: 0;
sta = (ase_awk_getopt(run->awk) & ASE_AWK_STRIDXONE)? 1: 0;
num = sta;
while (p != ASE_NULL)
@ -1240,7 +1240,7 @@ static int __bfn_match (
if (n == -1) return -1;
idx = (n == 0)? -1: (ase_long_t)(mat_ptr - str0);
if (ase_awk_getopt(run->awk) & ASE_AWK_STRINDEXONE) idx = idx + 1;
if (ase_awk_getopt(run->awk) & ASE_AWK_STRIDXONE) idx = idx + 1;
a0 = ase_awk_makeintval (run, idx);
if (a0 == ASE_NULL)

View File

@ -1,5 +1,5 @@
/*
* $Id: jni.c,v 1.45 2007-01-03 09:51:51 bacon Exp $
* $Id: jni.c,v 1.46 2007-01-05 13:38:59 bacon Exp $
*/
#include <stdio.h>
@ -237,8 +237,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_open (JNIEnv* env, jobject obj)
opt = ASE_AWK_EXPLICIT | ASE_AWK_UNIQUEFN | ASE_AWK_SHADING |
ASE_AWK_IMPLICIT | ASE_AWK_SHIFT | ASE_AWK_IDIV |
ASE_AWK_EXTIO | ASE_AWK_BLOCKLESS | ASE_AWK_HASHSIGN |
ASE_AWK_NEXTOFILE;
ASE_AWK_EXTIO | ASE_AWK_BLOCKLESS | ASE_AWK_NEXTOFILE;
ase_awk_setopt (awk, opt);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: parse.c,v 1.236 2007-01-03 09:51:51 bacon Exp $
* $Id: parse.c,v 1.237 2007-01-05 13:38:59 bacon Exp $
*/
#include <ase/awk/awk_i.h>
@ -4921,7 +4921,7 @@ static int __skip_comment (ase_awk_t* awk)
ase_cint_t c = awk->src.lex.curc;
ase_size_t line, column;
if ((awk->option & ASE_AWK_HASHSIGN) && c == ASE_T('#'))
if (c == ASE_T('#'))
{
do
{