From c9ea4a8d6e996d397aeba4f41e430673b4068f80 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 9 May 2006 05:30:57 +0000 Subject: [PATCH] adding new open-ils.cstore app; moving new IDL generator to a better home; added userData support to method context git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@712 9efc2488-bf62-4759-914b-345cdb29e865 --- src/libstack/osrf_application.c | 22 +++++++++++++++++++--- src/libstack/osrf_application.h | 6 +++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/libstack/osrf_application.c b/src/libstack/osrf_application.c index 713a19d..5722214 100644 --- a/src/libstack/osrf_application.c +++ b/src/libstack/osrf_application.c @@ -85,6 +85,21 @@ int osrfAppRunChildInit(char* appname) { int osrfAppRegisterMethod( char* appName, char* methodName, char* symbolName, char* notes, int argc, int options ) { + return osrfAppRegisterExtendedMethod( + appName, + methodName, + symbolName, + notes, + argc, + options, + NULL + ); + +} + +int osrfAppRegisterExtendedMethod( char* appName, char* methodName, + char* symbolName, char* notes, int argc, int options, void * user_data ) { + if( !appName || ! methodName ) return -1; osrfApplication* app = _osrfAppFindApplication(appName); @@ -96,7 +111,7 @@ int osrfAppRegisterMethod( char* appName, char* methodName, osrfLogDebug( OSRF_LOG_MARK, "Registering method %s for app %s", methodName, appName ); osrfMethod* method = _osrfAppBuildMethod( - methodName, symbolName, notes, argc, options ); + methodName, symbolName, notes, argc, options, user_data ); method->options = options; /* plug the method into the list of methods */ @@ -105,7 +120,7 @@ int osrfAppRegisterMethod( char* appName, char* methodName, if( options & OSRF_METHOD_STREAMING ) { /* build the atomic counterpart */ int newops = options | OSRF_METHOD_ATOMIC; osrfMethod* atomicMethod = _osrfAppBuildMethod( - methodName, symbolName, notes, argc, newops ); + methodName, symbolName, notes, argc, newops, NULL ); osrfHashSet( app->methods, atomicMethod, atomicMethod->name ); } @@ -115,13 +130,14 @@ int osrfAppRegisterMethod( char* appName, char* methodName, osrfMethod* _osrfAppBuildMethod( char* methodName, - char* symbolName, char* notes, int argc, int options ) { + char* symbolName, char* notes, int argc, int options, void* user_data ) { osrfMethod* method = safe_malloc(sizeof(osrfMethod)); if(methodName) method->name = strdup(methodName); if(symbolName) method->symbol = strdup(symbolName); if(notes) method->notes = strdup(notes); + if(user_data) method->userData = user_data; method->argc = argc; method->options = options; diff --git a/src/libstack/osrf_application.h b/src/libstack/osrf_application.h index dd5a958..c62aebb 100644 --- a/src/libstack/osrf_application.h +++ b/src/libstack/osrf_application.h @@ -88,6 +88,7 @@ struct _osrfMethodStruct { int argc; /* how many args this method expects */ //char* paramNotes; /* Description of the params expected for this method */ int options; /* describes the various options for this method */ + void* userData; /* You can put your weeeeeeed in it ... */ /* int sysmethod; @@ -133,8 +134,11 @@ int osrfAppRegisterMethod( char* appName, char* methodName, char* symbolName, char* notes, int argc, int options ); +int osrfAppRegisterExtendedMethod( char* appName, char* methodName, + char* symbolName, char* notes, int argc, int options, void* ); + osrfMethod* _osrfAppBuildMethod( char* methodName, - char* symbolName, char* notes, int argc, int options ); + char* symbolName, char* notes, int argc, int options, void* ); /** Finds the given app in the list of apps -- 2.11.0