Home Page Toolkit Overview Using GML User Input Services Finger Tracker Calibrator Frame Grabber Service protocol Obtaining GML Installing GML Licence Developer Documentation Tcl/Tk API The GML Canvas Image processing Tcl Scripts Library List of Classes List of Files C/C++ API List of Classes List of Files |
gmlTcl_WrapperParser_T.h00001 // gml/tcl/wrapper/wrapper/gmlTcl_WrapperParser_T.h -- 00002 // 00003 // Template definitions for gmlTcl wrapper parser. 00004 // 00005 // Copyright (c) 1996-2002 CLIPS-IMAG 00006 // 00007 // See the file "gml_LicenseTerms.txt" for information on usage and redistribution 00008 // of this file, and for a DISCLAIMER OF ALL WARRANTIES. 00009 // 00010 // Created on September 8, 2002 (FB). 00011 #ifndef __GMLTCL_WRAPPERPARSER_T__ 00012 #define __GMLTCL_WRAPPERPARSER_T__ 00013 00014 #include "gml/tcl/wrapper/wrapper/gmlTcl_WrapperParser.h" 00015 00016 #include "gml/base/gml_Alloc.h" 00017 00018 00019 // gmlTcl_WrapParseObject -- 00020 00021 template<class T> 00022 int gmlTcl_WrapParseObject (Tcl_Interp* interp, Tcl_Obj* arg, T** storage) 00023 { 00024 int tclRes; 00025 T* theObject = (T*)(((UInt8*)storage) + sizeof(T*)); 00026 00027 tclRes = gmlTclWrapParseObjToVal (interp, arg, theObject); 00028 if (tclRes == TCL_OK) 00029 *storage = theObject; 00030 00031 return tclRes; 00032 } 00033 00034 00035 00036 // gmlTcl_WrapParseObjectList -- 00037 00038 template<class T> 00039 int gmlTcl_WrapParseObjectList (Tcl_Interp* interp, Tcl_Obj* arg, T** storage) 00040 { 00041 int res; 00042 gml_TError err; 00043 int lobjc; 00044 Tcl_Obj** lobjv; 00045 T* theArray = (T*)NULL; 00046 int i; 00047 00048 res = Tcl_ListObjGetElements (interp, arg, &lobjc, &lobjv); 00049 00050 if (res == TCL_OK) 00051 if ((err = gml_Malloc (theArray, lobjc)) != gml_cNoError) { 00052 Tcl_AppendResult (interp, "could not parse array: ", 00053 gml_ErrorGetMessage (err), (char*)NULL); 00054 res = TCL_ERROR; 00055 } 00056 00057 for (i = 0; (res == TCL_OK) && (i < lobjc); i++) 00058 res = gmlTclWrapParseObjToVal (interp, lobjv[i], &(theArray[i])); 00059 00060 if (res == TCL_OK) { 00061 *storage = theArray; 00062 *((int*)(((UInt8*)storage) + sizeof (T*))) = lobjc; 00063 } 00064 00065 if (res != TCL_OK) 00066 gml_TestAndFree (theArray); 00067 00068 return res; 00069 } 00070 00071 00072 00073 #endif /* __GMLTCL_WRAPPERPARSER_T__ */ 00074
Generated on Tue Jun 12 14:03:27 2007 for gml by
Doxygen 1.5.2.
|
Contact: julien (dot) letessier (at) gmail (dot) com.
Copyright (c) 2000-2007 CLIPS-IMAG Laboratory, Grenoble, France. All rights reserved. W3CXHTML 1.0 W3CCSS 2.0 |