*** empty log message ***
This commit is contained in:
parent
d26963d3d3
commit
38f0ad0fba
@ -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 */
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
126
ase/com/Awk.cpp
126
ase/com/Awk.cpp
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.11 2007-01-05 06:29:46 bacon Exp $
|
||||
* $Id: Awk.cpp,v 1.12 2007-01-05 13:39:37 bacon Exp $
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
@ -47,13 +47,12 @@ CAwk::CAwk ():
|
||||
option = ASE_AWK_IMPLICIT |
|
||||
ASE_AWK_EXPLICIT |
|
||||
ASE_AWK_UNIQUEFN |
|
||||
ASE_AWK_HASHSIGN |
|
||||
ASE_AWK_IDIV |
|
||||
ASE_AWK_SHADING |
|
||||
ASE_AWK_SHIFT |
|
||||
ASE_AWK_EXTIO |
|
||||
ASE_AWK_BLOCKLESS |
|
||||
ASE_AWK_STRINDEXONE |
|
||||
ASE_AWK_STRIDXONE |
|
||||
ASE_AWK_STRIPSPACES |
|
||||
ASE_AWK_NEXTOFILE |
|
||||
ASE_AWK_CRLF;
|
||||
@ -641,3 +640,124 @@ STDMETHODIMP CAwk::put_ShiftOperators(BOOL newVal)
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_IdivOperator(BOOL *pVal)
|
||||
{
|
||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
||||
*pVal = (option & ASE_AWK_IDIV) == 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_IdivOperator(BOOL newVal)
|
||||
{
|
||||
if (newVal) option = option | ASE_AWK_IDIV;
|
||||
else option = option & ~ASE_AWK_IDIV;
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_ConcatString(BOOL *pVal)
|
||||
{
|
||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
||||
*pVal = (option & ASE_AWK_STRCONCAT) == 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_ConcatString(BOOL newVal)
|
||||
{
|
||||
if (newVal) option = option | ASE_AWK_STRCONCAT;
|
||||
else option = option & ~ASE_AWK_STRCONCAT;
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_SupportExtio(BOOL *pVal)
|
||||
{
|
||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
||||
*pVal = (option & ASE_AWK_EXTIO) == 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_SupportExtio(BOOL newVal)
|
||||
{
|
||||
if (newVal) option = option | ASE_AWK_EXTIO;
|
||||
else option = option & ~ASE_AWK_EXTIO;
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_SupportBlockless(BOOL *pVal)
|
||||
{
|
||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
||||
*pVal = (option & ASE_AWK_BLOCKLESS) == 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_SupportBlockless(BOOL newVal)
|
||||
{
|
||||
if (newVal) option = option | ASE_AWK_BLOCKLESS;
|
||||
else option = option & ~ASE_AWK_BLOCKLESS;
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_StringIndexOne(BOOL *pVal)
|
||||
{
|
||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
||||
*pVal = (option & ASE_AWK_STRIDXONE) == 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_StringIndexOne(BOOL newVal)
|
||||
{
|
||||
if (newVal) option = option | ASE_AWK_STRIDXONE;
|
||||
else option = option & ~ASE_AWK_STRIDXONE;
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_StripSpaces(BOOL *pVal)
|
||||
{
|
||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
||||
*pVal = (option & ASE_AWK_STRIPSPACES) == 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_StripSpaces(BOOL newVal)
|
||||
{
|
||||
if (newVal) option = option | ASE_AWK_STRIPSPACES;
|
||||
else option = option & ~ASE_AWK_STRIPSPACES;
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_Nextofile(BOOL *pVal)
|
||||
{
|
||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
||||
*pVal = (option & ASE_AWK_NEXTOFILE) == 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_Nextofile(BOOL newVal)
|
||||
{
|
||||
if (newVal) option = option | ASE_AWK_NEXTOFILE;
|
||||
else option = option & ~ASE_AWK_NEXTOFILE;
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_UseCrlf(BOOL *pVal)
|
||||
{
|
||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
||||
*pVal = (option & ASE_AWK_CRLF) == 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_UseCrlf(BOOL newVal)
|
||||
{
|
||||
if (newVal) option = option | ASE_AWK_CRLF;
|
||||
else option = option & ~ASE_AWK_CRLF;
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.h,v 1.6 2007-01-05 06:29:46 bacon Exp $
|
||||
* $Id: Awk.h,v 1.7 2007-01-05 13:39:37 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_COM_AWK_H_
|
||||
@ -68,6 +68,22 @@ DECLARE_REGISTRY_RESOURCEID(IDR_AWK)
|
||||
|
||||
// IAwk
|
||||
public:
|
||||
STDMETHOD(get_UseCrlf)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_UseCrlf)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_Nextofile)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_Nextofile)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_StripSpaces)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_StripSpaces)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_StringIndexOne)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_StringIndexOne)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_SupportBlockless)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_SupportBlockless)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_SupportExtio)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_SupportExtio)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_ConcatString)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_ConcatString)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_IdivOperator)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_IdivOperator)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_ShiftOperators)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_ShiftOperators)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_VariableShading)(/*[out, retval]*/ BOOL *pVal);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: ase.idl,v 1.5 2007-01-05 06:29:46 bacon Exp $
|
||||
* $Id: ase.idl,v 1.6 2007-01-05 13:39:37 bacon Exp $
|
||||
*/
|
||||
|
||||
import "oaidl.idl";
|
||||
@ -30,16 +30,71 @@ interface IAwk : IDispatch
|
||||
[propget, id(5), helpstring("property ErrorMessage")]
|
||||
HRESULT ErrorMessage([out, retval] BSTR *pVal);
|
||||
|
||||
[propget, id(6), helpstring("property ImplicitVariable")] HRESULT ImplicitVariable([out, retval] BOOL *pVal);
|
||||
[propput, id(6), helpstring("property ImplicitVariable")] HRESULT ImplicitVariable([in] BOOL newVal);
|
||||
[propget, id(7), helpstring("property ExplicitVariable")] HRESULT ExplicitVariable([out, retval] BOOL *pVal);
|
||||
[propput, id(7), helpstring("property ExplicitVariable")] HRESULT ExplicitVariable([in] BOOL newVal);
|
||||
[propget, id(8), helpstring("property UniqueFunction")] HRESULT UniqueFunction([out, retval] BOOL *pVal);
|
||||
[propput, id(8), helpstring("property UniqueFunction")] HRESULT UniqueFunction([in] BOOL newVal);
|
||||
[propget, id(9), helpstring("property VariableShading")] HRESULT VariableShading([out, retval] BOOL *pVal);
|
||||
[propput, id(9), helpstring("property VariableShading")] HRESULT VariableShading([in] BOOL newVal);
|
||||
[propget, id(10), helpstring("property ShiftOperators")] HRESULT ShiftOperators([out, retval] BOOL *pVal);
|
||||
[propput, id(10), helpstring("property ShiftOperators")] HRESULT ShiftOperators([in] BOOL newVal);
|
||||
[propget, id(6), helpstring("property ImplicitVariable")]
|
||||
HRESULT ImplicitVariable([out, retval] BOOL *pVal);
|
||||
[propput, id(6), helpstring("property ImplicitVariable")]
|
||||
HRESULT ImplicitVariable([in] BOOL newVal);
|
||||
|
||||
[propget, id(7), helpstring("property ExplicitVariable")]
|
||||
HRESULT ExplicitVariable([out, retval] BOOL *pVal);
|
||||
[propput, id(7), helpstring("property ExplicitVariable")]
|
||||
HRESULT ExplicitVariable([in] BOOL newVal);
|
||||
|
||||
[propget, id(8), helpstring("property UniqueFunction")]
|
||||
HRESULT UniqueFunction([out, retval] BOOL *pVal);
|
||||
|
||||
[propput, id(8), helpstring("property UniqueFunction")]
|
||||
HRESULT UniqueFunction([in] BOOL newVal);
|
||||
|
||||
[propget, id(9), helpstring("property VariableShading")]
|
||||
HRESULT VariableShading([out, retval] BOOL *pVal);
|
||||
[propput, id(9), helpstring("property VariableShading")]
|
||||
HRESULT VariableShading([in] BOOL newVal);
|
||||
|
||||
[propget, id(10), helpstring("property ShiftOperators")]
|
||||
HRESULT ShiftOperators([out, retval] BOOL *pVal);
|
||||
[propput, id(10), helpstring("property ShiftOperators")]
|
||||
HRESULT ShiftOperators([in] BOOL newVal);
|
||||
|
||||
[propget, id(11), helpstring("property IdivOperator")]
|
||||
HRESULT IdivOperator([out, retval] BOOL *pVal);
|
||||
[propput, id(11), helpstring("property IdivOperator")]
|
||||
HRESULT IdivOperator([in] BOOL newVal);
|
||||
|
||||
[propget, id(12), helpstring("property ConcatString")]
|
||||
HRESULT ConcatString([out, retval] BOOL *pVal);
|
||||
[propput, id(12), helpstring("property ConcatString")]
|
||||
HRESULT ConcatString([in] BOOL newVal);
|
||||
|
||||
[propget, id(13), helpstring("property SupportExtio")]
|
||||
HRESULT SupportExtio([out, retval] BOOL *pVal);
|
||||
[propput, id(13), helpstring("property SupportExtio")]
|
||||
HRESULT SupportExtio([in] BOOL newVal);
|
||||
|
||||
[propget, id(14), helpstring("property SupportBlockless")]
|
||||
HRESULT SupportBlockless([out, retval] BOOL *pVal);
|
||||
[propput, id(14), helpstring("property SupportBlockless")]
|
||||
HRESULT SupportBlockless([in] BOOL newVal);
|
||||
|
||||
[propget, id(15), helpstring("property StringIndexOne")]
|
||||
HRESULT StringIndexOne([out, retval] BOOL *pVal);
|
||||
[propput, id(15), helpstring("property StringIndexOne")]
|
||||
HRESULT StringIndexOne([in] BOOL newVal);
|
||||
|
||||
[propget, id(16), helpstring("property StripSpaces")]
|
||||
HRESULT StripSpaces([out, retval] BOOL *pVal);
|
||||
[propput, id(16), helpstring("property StripSpaces")]
|
||||
HRESULT StripSpaces([in] BOOL newVal);
|
||||
|
||||
[propget, id(17), helpstring("property Nextofile")]
|
||||
HRESULT Nextofile([out, retval] BOOL *pVal);
|
||||
[propput, id(17), helpstring("property Nextofile")]
|
||||
HRESULT Nextofile([in] BOOL newVal);
|
||||
|
||||
[propget, id(18), helpstring("property UseCrlf")]
|
||||
HRESULT UseCrlf([out, retval] BOOL *pVal);
|
||||
[propput, id(18), helpstring("property UseCrlf")]
|
||||
HRESULT UseCrlf([in] BOOL newVal);
|
||||
};
|
||||
|
||||
/* ASELib */
|
||||
|
@ -107,6 +107,8 @@ Private Sub Execute_Click()
|
||||
|
||||
Awk.ExplicitVariable = True
|
||||
Awk.ImplicitVariable = False
|
||||
Awk.UseCrlf = True
|
||||
Awk.IdivOperator = True
|
||||
|
||||
If Awk.Parse() = -1 Then
|
||||
MsgBox "ERROR [" + Str(Awk.ErrorLine) + "]" + Awk.ErrorMessage
|
||||
|
Loading…
x
Reference in New Issue
Block a user