dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/engine lib_regexp.c,NONE,1.1 Makefile.am


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine lib_regexp.c,NONE,1.1 Makefile.am,1.47,1.48 int_proto.h,1.30,1.31 int_table.c,1.32,1.33
Date: Thu, 21 Nov 2002 16:24:58 -0500

Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv17693/engine

Modified Files:
        Makefile.am int_proto.h int_table.c 
Added Files:
        lib_regexp.c 
Log Message:
basic regexp support using internal calls


--- NEW FILE ---
/*
 * lib_regexp.c - Internalcall methods for "Platform.Regexp"
 *
 * Copyright (C) 2002  Free Software Foundation, Inc.
 * 
 * Contributed by Gopal V
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include "engine.h"
#include "lib_defs.h"
#include "il_utils.h"

#ifdef  __cplusplus
extern  "C" {
#endif

ILNativeInt _IL_RegexpMethods_CompileInternal(ILExecThread * _thread, 
                                                                                
ILString * pattern, ILInt32 flags)
{
        char *pat;
        int error;
        ILRegexpHandle result;
        pat=ILStringToAnsi(_thread,pattern);
        if(!pat)
        {
                ILExecThreadThrowOutOfMemory(_thread);
                return 0;
        }
        result=ILRegexpCompile(pat,flags,&(error));
        if(!result)
        {
                ILExecThreadThrowOutOfMemory(_thread);
                return 0;
        }
        if(error)
        {
                pat=ILRegexpError(error,result);
                /* TODO: throw correct exception here */
                ILExecThreadThrowSystem(_thread, "System.ArgumentException",0);
                ILRegexpFree(result);
                return 0;
        }
        return (ILNativeInt)result;
}

ILInt32 _IL_RegexpMethods_ExecInternal(ILExecThread * _thread,
                                                ILNativeInt compiled, ILString 
* input, ILInt32 flags)
{
        char *pat;
        pat= ILStringToAnsi(_thread,input);
        if(!pat)
        {
                ILExecThreadThrowOutOfMemory(_thread);
                return -1;
        }
        return ILRegexpExec((ILRegexpHandle)compiled,pat,flags);
}

void _IL_RegexpMethods_FreeInternal(ILExecThread * _thread, 
                                                                                
        ILNativeInt compiled)
{
        ILRegexpFree((ILRegexpHandle)compiled);
        return;
}
#ifdef  __cplusplus
};
#endif

Index: Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/Makefile.am,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -r1.47 -r1.48
*** Makefile.am 3 Nov 2002 19:33:26 -0000       1.47
--- Makefile.am 21 Nov 2002 21:24:56 -0000      1.48
***************
*** 32,35 ****
--- 32,36 ----
                                                lib_object.c \
                                                lib_reflect.c \
+                                               lib_regexp.c \
                                                lib_security.c \
                                                lib_socket.c \

Index: int_proto.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_proto.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** int_proto.h 20 Nov 2002 23:47:35 -0000      1.30
--- int_proto.h 21 Nov 2002 21:24:56 -0000      1.31
***************
*** 462,465 ****
--- 462,475 ----
  extern void _IL_CryptoMethods_StoreKey(ILExecThread * _thread, ILInt32 
algorithm, ILString * name, System_Array * key);
  
+ 
+ extern ILNativeInt _IL_RegexpMethods_CompileInternal(ILExecThread * _thread, 
+                                                                               
ILString * pattern, ILInt32 flags);
+ 
+ extern ILInt32 _IL_RegexpMethods_ExecInternal(ILExecThread * _thread,
+                                               ILNativeInt compiled, ILString 
* input, ILInt32 flags);
+ 
+ void _IL_RegexpMethods_FreeInternal(ILExecThread * _thread, 
+                                                                               
        ILNativeInt compiled);
+ 
  extern ILBool _IL_SocketMethods_Create(ILExecThread * _thread, ILInt32 af, 
ILInt32 st, ILInt32 pt, ILNativeInt * handle);
  extern ILBool _IL_SocketMethods_Bind(ILExecThread * _thread, ILNativeInt 
handle, ILInt32 af, ILInt64 address, ILInt32 port);

Index: int_table.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_table.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** int_table.c 20 Nov 2002 23:47:35 -0000      1.32
--- int_table.c 21 Nov 2002 21:24:56 -0000      1.33
***************
*** 2189,2192 ****
--- 2189,2212 ----
  #if !defined(HAVE_LIBFFI)
  
+ static void marshal_ipjpi(void (*fn)(), void *rvalue, void **avalue)
+ {
+       *((ILNativeInt *)rvalue) = (*(ILInt32 (*)(void *, ILNativeUInt, void *, 
ILInt32))fn)(*((void * *)(avalue[0])), *((ILNativeUInt *)(avalue[1])), *((void 
* *)(avalue[2])), *((ILInt32 *)(avalue[3])));
+ }
+ 
+ #endif
+ 
+ #ifndef _IL_RegexpMethods_suppressed
+ 
+ IL_METHOD_BEGIN(RegexpMethods_Methods)
+       IL_METHOD("CompileInternal", "(oSystem.String;i)j", 
_IL_RegexpMethods_CompileInternal, marshal_jppi)
+       IL_METHOD("ExecInternal", "(joSystem.String;i)i", 
_IL_RegexpMethods_ExecInternal, marshal_ipjpi)
+       IL_METHOD("FreeInternal", "(j)V", _IL_RegexpMethods_FreeInternal, 
marshal_vpj)
+ IL_METHOD_END
+ 
+ #endif
+  
+ 
+ #if !defined(HAVE_LIBFFI)
+ 
  static void marshal_bpiiip(void (*fn)(), void *rvalue, void **avalue)
  {
***************
*** 2462,2465 ****
--- 2482,2488 ----
  #ifndef _IL_Object_suppressed
        {"Object", "System", Object_Methods},
+ #endif
+ #ifndef _IL_RegexpMethods_suppressed
+       {"RegexpMethods", "Platform", RegexpMethods_Methods},
  #endif
  #ifndef _IL_RuntimeHelpers_suppressed





reply via email to

[Prev in Thread] Current Thread [Next in Thread]