*** empty log message ***

This commit is contained in:
hyung-hwan 2007-01-17 03:45:59 +00:00
parent 465aef1208
commit ed0520bc4e
3 changed files with 43 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: func.c,v 1.89 2007-01-07 07:30:39 bacon Exp $
* $Id: func.c,v 1.90 2007-01-17 03:45:59 bacon Exp $
*/
#include <ase/awk/awk_i.h>
@ -51,7 +51,10 @@ void* ase_awk_addbfn (
if (ase_awk_getbfn (awk, name, name_len) != ASE_NULL)
{
ase_awk_seterror (awk, ASE_AWK_EEXIST, 0, ASE_NULL);
awk->sysfns.sprintf (
awk->errmsg, ASE_COUNTOF(awk->errmsg),
ASE_T("'%.*s' added already"), name_len, name);
ase_awk_seterror (awk, ASE_AWK_EEXIST, 0, awk->errmsg);
return ASE_NULL;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.cpp,v 1.19 2007-01-16 14:20:42 bacon Exp $
* $Id: Awk.cpp,v 1.20 2007-01-17 03:45:59 bacon Exp $
*/
#include "stdafx.h"
@ -473,6 +473,8 @@ HRESULT CAwk::Parse (int* ret)
ASE_AWK_DEPTH_REX_MATCH, max_depth.rex.match);
}
ase_awk_clrbfn (handle);
for (bfn_t* bfn = bfn_list; bfn != NULL; bfn = bfn->next)
{
if (ase_awk_addbfn (
@ -724,7 +726,28 @@ HRESULT CAwk::Run (int* ret)
STDMETHODIMP CAwk::AddBuiltinFunction (
BSTR name, int min_args, int max_args, int* ret)
{
bfn_t* bfn = (bfn_t*)malloc (sizeof(bfn_t));
bfn_t* bfn;
size_t name_len = SysStringLen(name);
for (bfn = bfn_list; bfn != NULL; bfn = bfn->next)
{
if (ase_awk_strxncmp (
bfn->name.ptr, bfn->name.len,
name, name_len) == 0)
{
errnum = ASE_AWK_EEXIST;
errlin = 0;
_sntprintf (
errmsg, ASE_COUNTOF(errmsg),
_T("'%.*s' added already\n"),
bfn->name.len, bfn->name.ptr);
*ret = -1;
return S_OK;
}
}
bfn = (bfn_t*)malloc (sizeof(bfn_t));
if (bfn == NULL)
{
errnum = ASE_AWK_ENOMEM;
@ -737,7 +760,7 @@ STDMETHODIMP CAwk::AddBuiltinFunction (
return S_OK;
}
bfn->name.len = SysStringLen(name);
bfn->name.len = name_len;
bfn->name.ptr = (TCHAR*)malloc (bfn->name.len * sizeof(TCHAR));
if (bfn->name.ptr == NULL)
{

View File

@ -173,14 +173,16 @@ Private Sub Execute_Click()
'Awk.MaxDepthForRexMatch = 10
Awk.UseLongLong = False
Awk.Debug = True
If Awk.AddBuiltinFunction("sin", 1, 1) = -1 Then
MsgBox "Cannot add builtin function - " + Awk.ErrorMessage
Exit Sub
End If
Call Awk.AddBuiltinFunction("cos", 1, 1)
If Awk.AddBuiltinFunction("cos", 1, 1) = -1 Then
MsgBox "Cannot add builtin function - " + Awk.ErrorMessage
Exit Sub
End If
Call Awk.AddBuiltinFunction("tan", 1, 1)
Call Awk.AddBuiltinFunction("trim", 1, 1)
@ -266,7 +268,9 @@ Function Awk_OpenExtio(ByVal extio As ASELib.AwkExtio) As Long
End If
Case ASELib.AWK_EXTIO_PIPE
Awk_OpenExtio = -1
Case ASELib.AWK_EXTIO_COPROC
Awk_OpenExtio = -1
End Select
Exit Function
@ -293,7 +297,9 @@ Function Awk_CloseExtio(ByVal extio As ASELib.AwkExtio) As Long
Awk_CloseExtio = 0
End If
Case ASELib.AWK_EXTIO_PIPE
Awk_CloseExtio = -1
Case ASELib.AWK_EXTIO_COPROC
Awk_CloseExtio = -1
End Select
End Function
@ -313,7 +319,9 @@ Function Awk_ReadExtio(ByVal extio As ASELib.AwkExtio, ByVal buf As ASELib.Buffe
End If
Case ASELib.AWK_EXTIO_PIPE
Awk_ReadExtio = -1
Case ASELib.AWK_EXTIO_COPROC
Awk_ReadExtio = -1
End Select
End Function
@ -332,7 +340,9 @@ Function Awk_WriteExtio(ByVal extio As ASELib.AwkExtio, ByVal buf As ASELib.Buff
Awk_WriteExtio = WriteExtioFile(extio, buf)
End If
Case ASELib.AWK_EXTIO_PIPE
Awk_WriteExtio = -1
Case ASELib.AWK_EXTIO_COPROC
Awk_WriteExtio = -1
End Select
End Function