00001
00002
00003
00004
00005
00048
00114
00130
00131 #ifndef GXSD_INCL
00132 #define GXSD_INCL
00133
00134 #include <assert.h>
00135 #include <stdio.h>
00136 #include <wchar.h>
00137 #include <stdlib.h>
00138 #include <stdarg.h>
00139 #include <string.h>
00140 #include "gxtypes.h"
00141
00142 #if !defined(GX_SWIGIF) && !defined(GX_MANUAL)
00143
00144 #if !defined(gx_strncpy)
00145
00146 #if _MSC_VER >= 1400
00147
00148 inline int gx_snwprintf(wchar_t *buffer, size_t count, const wchar_t *format, ...) {
00149 int r;
00150 va_list args;
00151 va_start(args, format);
00152 r = _vsnwprintf_s(buffer,count,_TRUNCATE,format, args);
00153 va_end(args);
00154 return r;
00155 }
00156
00157 inline int gx_snprintf(char *buffer, size_t count, const char *format, ...) {
00158 int r;
00159 va_list args;
00160 va_start(args, format);
00161 r = _vsnprintf_s(buffer,count,_TRUNCATE,format,args);
00162 va_end(args);
00163 return r;
00164 }
00165 #define gx_strncpy(strDest,strSource,count) strncpy_s(strDest,count,strSource,_TRUNCATE)
00166 #define gx_wcsncpy(strDest,strSource,count) wcsncpy_s(strDest,count,strSource,_TRUNCATE)
00167
00168 #define gx_strncat(strDest,strSource,count) strncat_s(strDest,strlen(strDest)+count+1,strSource,_TRUNCATE)
00169 #define gx_wcsncat(strDest,strSource,count) wcsncat_s(strDest,wcslen(strDest)+count+1,strSource,_TRUNCATE)
00170
00171 inline size_t gx_wcstombs(char *mbstr, const wchar_t *wcstr, size_t count) {
00172 size_t pConvertedChars = 0;
00173 wcstombs_s(&pConvertedChars,mbstr,count,wcstr,_TRUNCATE);
00174 return pConvertedChars;
00175 }
00176 inline size_t gx_mbstowcs(wchar_t *wcstr, const char *mbstr, size_t count) {
00177 size_t pConvertedChars = 0;
00178 mbstowcs_s(&pConvertedChars,wcstr,count,mbstr,_TRUNCATE);
00179 return pConvertedChars;
00180 }
00181
00182 #define gx_strdup _strdup
00183 #define gx_wcsdup _wcsdup
00184 #define gx_wcstol wcstol
00185
00186 #if defined(__INTEL_COMPILER) && !defined(_M_X64)
00187 #define __ptr32
00188 #endif
00189
00190 #elif defined(WIN32)
00191
00192 #define gx_snwprintf _snwprintf
00193 #define gx_snprintf _snprintf
00194 #define gx_strncpy strncpy
00195 #define gx_strncat strncat
00196 #define gx_wcsncat wcsncat
00197 #define gx_wcsncpy wcsncpy
00198 #define gx_wcstombs wcstombs
00199 #define gx_mbstowcs mbstowcs
00200 #define gx_strdup _strdup
00201 #define gx_wcsdup _wcsdup
00202 #define gx_wcstol wcstol
00203
00204 #define __ptr32
00205
00206 #else //LINUX
00207
00208 #ifdef ANDROID
00209 #include "unicode/ConvertUTF.h"
00210 #include "androidlog.h"
00211 inline wchar_t *wcsdup(const wchar_t *st)
00212 {
00213 if (!st) return NULL;
00214 wchar_t *pst = (wchar_t *)malloc((wcslen(st)+1)*sizeof(wchar_t));
00215 if (pst) wcscpy(pst,st);
00216 return pst;
00217 }
00218 inline size_t gx_wcstombs(char *mbstr,const wchar_t *wcstr,size_t count)
00219 {
00220 if (!mbstr || !wcstr || !count) return 0;
00221 size_t l = wcslen(wcstr);
00222 if (l > count) l = count;
00223 memset((void*)mbstr,0,count);
00224
00225 for(int i=0;i<l;i++)
00226 {
00227 if (wcstr[i] > 255) mbstr[i]='.';
00228 else mbstr[i] = (char)(wcstr[i] & 0xff);
00229 }
00230 return l;
00231 }
00232 inline size_t gx_mbstowcs(wchar_t *wcstr,const char *mbstr,size_t count)
00233 {
00234 if (!mbstr || !wcstr || !count) return 0;
00235 size_t l = strlen(mbstr);
00236 if (l > count) l = count;
00237 memset((void*)wcstr,0,count*sizeof(wchar_t));
00238
00239 for(int i=0;i<l;i++)
00240 {
00241 wcstr[i] = (wchar_t)mbstr[i];
00242 }
00243 return l;
00244 }
00245 inline long int gx_wcstol(const wchar_t *wcstr, wchar_t **endptr, int base)
00246 {
00247 size_t s = (wcslen(wcstr)+1)*sizeof(char);
00248 char *pch = (char*)malloc(s);
00249 char *ep = 0;
00250 long int ret = 0;
00251 if (!pch) return 0;
00252 gx_wcstombs(pch,wcstr,s);
00253 ret = strtol(pch,&ep,base);
00254 if (endptr) *endptr = (wchar_t*)wcstr + (int)(ep-pch);
00255 free(pch);
00256 return ret;
00257 }
00258 #else
00259 #define gx_wcstombs wcstombs
00260 #define gx_mbstowcs mbstowcs
00261 #define gx_wcstol wcstol
00262 #endif
00263
00264 #define gx_snwprintf swprintf
00265 #define gx_wcsncpy wcsncpy
00266 #define gx_wcsncat wcsncat
00267 #define gx_wcsdup wcsdup
00268 #define gx_snprintf snprintf
00269 #define gx_strncpy strncpy
00270 #define gx_strncat strncat
00271 #define gx_strdup strdup
00272 #endif
00273 #endif
00274
00275 #if defined(WIN32) && !defined(va_copy)
00276 #define va_copy(ap,v) (ap=(v))
00277 #endif
00278 #if defined(LINUX) && !defined(va_copy)
00279 #define va_copy __va_copy
00280 #endif
00281 #include "gxerror.h"
00282 #include "gxlibsd.h"
00283
00284 #ifdef __BORLANDC__
00285 #pragma warn -rch
00286 #endif
00287 #ifdef _MSC_VER
00288 #pragma warning(disable : 4127)
00289 #endif
00290
00291 #endif
00292
00293 #ifdef GX_NAMESPACES
00294 namespace gx {
00295 #ifdef GX_DOTNET
00296
00297 #pragma unmanaged
00298 #endif
00299 #endif
00300
00301 #ifndef GX_MANUAL
00302
00303 #ifdef GX_DOTNET
00304 #define _GX_ERR_FLAG_CLEAR 0
00305 #define _GX_ERR_FLAG_APPEND 1
00306 #define _GX_ERR_FLAG_PREPEND 2
00307 #else
00308 #define _GX_ERR_FLAG_CLEAR GX_ERR_FLAG_CLEAR
00309 #define _GX_ERR_FLAG_APPEND GX_ERR_FLAG_APPEND
00310 #define _GX_ERR_FLAG_PREPEND GX_ERR_FLAG_PREPEND
00311 #endif
00312 #endif
00313
00314 #if !defined(GX_SWIGIF) && !defined(GX_MANUAL)
00315
00316
00317
00319 enum GX_CALL_GROUP_CODES {
00320
00321
00322
00323 GX_CALL_GROUP_API = 0x10000000,
00324 GX_CALL_GROUP_API_FIRST = 0x10000000,
00325 GX_CALL_GROUP_API_LAST = 0x10FFFFFF,
00327 GX_CALL_GROUP_ERROR = 0x10010000,
00328 GX_CALL_GROUP_MEMORY = 0x10020000,
00329 GX_CALL_GROUP_MODULE = 0x10030000,
00330 GX_CALL_GROUP_VARIANT = 0x10040000,
00332
00333
00334
00335 GX_CALL_GROUP_LICENSE = 0x10900000,
00337
00338
00339
00340 GX_CALL_GROUP_GX_DEVICE = 0x10FF0000,
00342
00343
00344
00345 GX_CALL_GROUP_GX = 0x11000000,
00346 GX_CALL_GROUP_GX_FIRST = 0x11000000,
00347 GX_CALL_GROUP_GX_LAST = 0x1FFFFFFF,
00349 GX_CALL_GROUP_GX_PROPERTY = 0x11000000,
00350 GX_CALL_GROUP_GX_LOG = 0x11010000,
00351 GX_CALL_GROUP_GX_STREAM = 0x11020000,
00352 GX_CALL_GROUP_GX_TRAFO = 0x11030000,
00353 GX_CALL_GROUP_GX_IMAGE = 0x11040000,
00354 GX_CALL_GROUP_GX_BMP = 0x11050000,
00355 GX_CALL_GROUP_GX_JPEG = 0x11060000,
00356 GX_CALL_GROUP_GX_WATCHDOG = 0x11070000,
00357 GX_CALL_GROUP_GX_MOTDET = 0x11080000,
00358 GX_CALL_GROUP_GX_JPEG2K = 0x11090000,
00359 GX_CALL_GROUP_GX_ZLIB = 0x110A0000,
00360 GX_CALL_GROUP_GX_PNG = 0x110B0000,
00361 GX_CALL_GROUP_GX_IMGEXT = 0x110C0000,
00362 GX_CALL_GROUP_GX_TEST = 0x110D0000,
00363 GX_CALL_GROUP_GX_PROPFILE = 0x110E0000,
00364 GX_CALL_GROUP_GX_PROPCLIENT = 0x110F0000,
00365 GX_CALL_GROUP_GX_JPEG8 = 0x11100000,
00366 GX_CALL_GROUP_GX_JPEG12 = 0x11110000,
00367 GX_CALL_GROUP_GX_CRYPTO = 0x11120000,
00368 GX_CALL_GROUP_GX_WSQ = 0x11130000,
00369 GX_CALL_GROUP_GX_VIDEO = 0x11140000,
00370 GX_CALL_GROUP_GX_LLJE = 0x11150000,
00372
00373
00374
00375 GX_CALL_GROUP_OTHER = 0x20000000,
00376 GX_CALL_GROUP_OTHER_FIRST = 0x20000000,
00377 GX_CALL_GROUP_OTHER_LAST = 0xEFFFFFFF,
00379
00380
00381
00382 GX_CALL_GROUP_USER = 0xF0000000,
00383 GX_CALL_GROUP_USER_FIRST = 0xF0000000,
00384 GX_CALL_GROUP_USER_LAST = 0xFFFFFFFF
00385 };
00386
00387
00388
00389
00390
00392 enum GX_CALL_DEFMODULE_CODES {
00393
00394 GX_CALL_SENDCOMPVERSION = GX_CALL_GROUP_API | 0x000F,
00395 GX_CALL_LISTMODULES = GX_CALL_GROUP_API | 0x0010,
00396 GX_CALL_LISTMODULESA = GX_CALL_GROUP_API | 0x0011,
00397 };
00398
00400 #define GX_CURRENT_VERSION 0x07020A01
00401
00403 enum GX_CALL_MODULE_CODES {
00404 GX_CALL_OPENMODULE = GX_CALL_GROUP_MODULE | 0x0000,
00405 #ifndef ANDROID
00406 GX_CALL_OPENMODULEA = GX_CALL_GROUP_MODULE | 0x0001,
00407 #endif
00408 GX_CALL_CLOSEHANDLE = GX_CALL_GROUP_MODULE | 0x0002,
00409 GX_CALL_GETMODULEINFO = GX_CALL_GROUP_MODULE | 0x0004,
00410 GX_CALL_RESERVED = GX_CALL_GROUP_MODULE | 0x0005,
00412 GX_CALL_REFHANDLE = GX_CALL_GROUP_MODULE | 0x0006,
00413 GX_CALL_UNREFHANDLE = GX_CALL_GROUP_MODULE | 0x0007,
00415 GX_CALL_GETMODULEPROPERTY = GX_CALL_GROUP_MODULE | 0x0008,
00416 #ifndef ANDROID
00417 GX_CALL_GETMODULEPROPERTYA = GX_CALL_GROUP_MODULE | 0x0009,
00418 #endif
00419 GX_CALL_SETMODULEPROPERTY = GX_CALL_GROUP_MODULE | 0x000A,
00420 #ifndef ANDROID
00421 GX_CALL_SETMODULEPROPERTYA = GX_CALL_GROUP_MODULE | 0x000B,
00422 #endif
00423 GX_CALL_SAVEMODULEPROPERTIESOLD = GX_CALL_GROUP_MODULE | 0x000C,
00424 #ifndef ANDROID
00425 GX_CALL_SAVEMODULEPROPERTIESOLDA= GX_CALL_GROUP_MODULE | 0x000D,
00426 #endif
00427 GX_CALL_SAVEMODULEPROPERTIES = GX_CALL_GROUP_MODULE | 0x000E,
00428 #ifndef ANDROID
00429 GX_CALL_SAVEMODULEPROPERTIESA = GX_CALL_GROUP_MODULE | 0x000F,
00430 #endif
00431 GX_CALL_MPSTARTTRANSACTION = GX_CALL_GROUP_MODULE | 0x0010,
00432 GX_CALL_MPCOMMIT = GX_CALL_GROUP_MODULE | 0x0011,
00433 };
00434
00436 enum GX_CALL_ERROR_CODES {
00437 GX_CALL_GETERROR = GX_CALL_GROUP_ERROR | 0x0000,
00438 #ifndef ANDROID
00439 GX_CALL_GETERRORA = GX_CALL_GROUP_ERROR | 0x0001,
00440 #endif
00441 GX_CALL_SETERROR = GX_CALL_GROUP_ERROR | 0x0002,
00442 #ifndef ANDROID
00443 GX_CALL_SETERRORA = GX_CALL_GROUP_ERROR | 0x0003,
00444 #endif
00445 GX_CALL_PUSHERROR = GX_CALL_GROUP_ERROR | 0x0004,
00446 GX_CALL_POPERROR = GX_CALL_GROUP_ERROR | 0x0005,
00447 GX_CALL_UPDATEERRTABLE = GX_CALL_GROUP_ERROR | 0x000F
00448 };
00449
00451 enum GX_CALL_MEMORY_CODES {
00452 GX_CALL_GLOBALREALLOC = GX_CALL_GROUP_MEMORY | 0x0000,
00453 GX_CALL_GLOBALSIZE = GX_CALL_GROUP_MEMORY | 0x0001,
00454 GX_CALL_GLOBALREALLOC_DBG = GX_CALL_GROUP_MEMORY | 0x0002,
00455 GX_CALL_GLOBALCHECK_DBG = GX_CALL_GROUP_MEMORY | 0x0003,
00456 GX_CALL_GLOBALTESTMEM_DBG = GX_CALL_GROUP_MEMORY | 0x0004,
00457 GX_CALL_CREATEMEMSLOT = GX_CALL_GROUP_MEMORY | 0x0005,
00458 GX_CALL_GETMEMSLOT = GX_CALL_GROUP_MEMORY | 0x0006,
00459 GX_CALL_UNREFMEMSLOT = GX_CALL_GROUP_MEMORY | 0x0007,
00460 };
00461
00463 enum GX_CALL_DEVICE_CODES {
00464 GX_CALL_LISTDEVICES = GX_CALL_GROUP_GX_DEVICE | 0x0000,
00465 #ifndef ANDROID
00466 GX_CALL_LISTDEVICESA = GX_CALL_GROUP_GX_DEVICE | 0x0001,
00467 #endif
00468 GX_CALL_OPENDEVICE = GX_CALL_GROUP_GX_DEVICE | 0x0002,
00469 #ifndef ANDROID
00470 GX_CALL_OPENDEVICEA = GX_CALL_GROUP_GX_DEVICE | 0x0003,
00471 #endif
00472 GX_CALL_GETDEVICEPROPERTY = GX_CALL_GROUP_GX_DEVICE | 0x0004,
00473 #ifndef ANDROID
00474 GX_CALL_GETDEVICEPROPERTYA = GX_CALL_GROUP_GX_DEVICE | 0x0005,
00475 #endif
00476 GX_CALL_SETDEVICEPROPERTY = GX_CALL_GROUP_GX_DEVICE | 0x0006,
00477 #ifndef ANDROID
00478 GX_CALL_SETDEVICEPROPERTYA = GX_CALL_GROUP_GX_DEVICE | 0x0007,
00479 #endif
00480 GX_CALL_GETDRIVERPROPERTY = GX_CALL_GROUP_GX_DEVICE | 0x0008,
00481 #ifndef ANDROID
00482 GX_CALL_GETDRIVERPROPERTYA = GX_CALL_GROUP_GX_DEVICE | 0x0009,
00483 #endif
00484 GX_CALL_SETDRIVERPROPERTY = GX_CALL_GROUP_GX_DEVICE | 0x000A,
00485 #ifndef ANDROID
00486 GX_CALL_SETDRIVERPROPERTYA = GX_CALL_GROUP_GX_DEVICE | 0x000B,
00487 #endif
00488 GX_CALL_GETSYSTEMINFO = GX_CALL_GROUP_GX_DEVICE | 0x000C,
00489 };
00490
00491 #endif
00492 #ifdef GX_SWIGIF
00493 %define GX_CALL_GROUP_GX_BMP 0x11050000 %enddef
00494 %define GX_CALL_GROUP_GX_JPEG 0x11060000 %enddef
00495 %define GX_CALL_GROUP_GX_JPEG2K 0x11090000 %enddef
00496 %define GX_CALL_GROUP_GX_WSQ 0x11130000 %enddef
00497 #endif
00498
00499
00500
00501
00502
00503 #ifdef GX_DOTNET
00504
00505 #pragma managed
00506 #endif
00507
00508 #ifndef GX_EXT_MODULE
00509
00510 GX_STRUCT gxRCT {
00511 int left;
00512 int top;
00513 int right;
00514 int bottom;
00515 };
00516
00517 #ifndef __cplusplus
00518 typedef struct gxRCT gxRCT;
00519 #endif
00520
00522 GX_STRUCT gxPNT {
00523 int x;
00524 int y;
00525 };
00526
00527 #ifndef __cplusplus
00528 typedef struct gxPNT gxPNT;
00529 #endif
00530
00531 #ifdef GX_DOTNET
00532 #ifndef GX_DOTNET_20
00533 typedef gxPNT gxPNT_ARRAY [];
00534 #else
00535 typedef array<gxPNT>^ gxPNT_ARRAY;
00536 #endif
00537 #else
00538 typedef gxPNT gxPNT_ARRAY [];
00539 #endif
00540
00542 GX_STRUCT gxPG2 {
00543 int x1;
00544 int y1;
00545 int x2;
00546 int y2;
00547 };
00548
00549 #ifndef __cplusplus
00550 typedef struct gxPG2 gxPG2;
00551 #endif
00552
00554 GX_STRUCT gxPG4 {
00555 int x1;
00556 int y1;
00557 int x2;
00558 int y2;
00559 int x3;
00560 int y3;
00561 int x4;
00562 int y4;
00563 };
00564
00565 #ifndef __cplusplus
00566 typedef struct gxPG4 gxPG4;
00567 #endif
00568
00570 GX_STRUCT gxPNTF {
00571 float x;
00572 float y;
00573 };
00574
00575 #ifndef __cplusplus
00576 typedef struct gxPNTF gxPNTF;
00577 #endif
00578
00579 #endif
00580
00581 #if defined(GX_DOTNET) && !defined(GX_MANUAL)
00582 #pragma unmanaged
00583
00585 struct _gxRCT {
00586 int left;
00587 int top;
00588 int right;
00589 int bottom;
00590 };
00591
00593 struct _gxPNT {
00594 int x;
00595 int y;
00596 };
00597
00599 struct _gxPG2 {
00600 int x1;
00601 int y1;
00602 int x2;
00603 int y2;
00604 };
00605
00607 struct _gxPG4 {
00608 int x1;
00609 int y1;
00610 int x2;
00611 int y2;
00612 int x3;
00613 int y3;
00614 int x4;
00615 int y4;
00616 };
00617
00619 struct _gxPNTF {
00620 float x;
00621 float y;
00622 };
00623
00624 #endif
00625
00626
00627
00628
00629 #if !defined(GX_SWIGIF) && !defined(GX_MANUAL)
00630
00631 struct GX_PARM_GETERROR {
00632 int code;
00633 wchar_t *string;
00634 int maxlen;
00635 };
00636
00637 #ifndef ANDROID
00638
00639 struct GX_PARM_GETERRORA {
00640 int code;
00641 char *string;
00642 int maxlen;
00643 };
00644 #endif
00645 #endif
00646
00647 #ifndef GX_EXT_MODULE
00648
00649 #ifdef GX_DOTNET
00650 #pragma managed
00651 #endif
00652
00654 GX_ENUM GX_ERROR_FLAGS {
00655 GX_ERR_FLAG_CLEAR = 0,
00656 GX_ERR_FLAG_APPEND = 1,
00657 GX_ERR_FLAG_PREPEND = 2,
00659 GX_ERR_FLAG_APPMODE = (GX_ERR_FLAG_CLEAR | GX_ERR_FLAG_APPEND | GX_ERR_FLAG_PREPEND),
00661 GX_ERR_FLAG_NOARGS = 0x100,
00663 GX_ERR_FLAG_LOCAL = 0x1000,
00664 GX_ERR_FLAG_DIRECT = 0x2000
00665 };
00666
00667 #ifdef GX_DOTNET
00668 #pragma unmanaged
00669 #endif
00670
00671 #endif
00672
00673 #if !defined(GX_SWIGIF) && !defined(GX_MANUAL)
00674
00675 struct GX_PARM_SETERROR {
00676 int flags;
00677 int code;
00678 const wchar_t *appformat;
00679 va_list arguments;
00680 };
00681
00682 #ifndef ANDROID
00683
00684 struct GX_PARM_SETERRORA {
00685 int flags;
00686 int code;
00687 const char *appformat;
00688 va_list arguments;
00689 };
00690 #endif
00691 #endif
00692
00693 #if !defined(GX_SWIGIF) && !(defined(GX_DOTNET) && defined(GX_MANUAL))
00694
00696 struct gxERRITEM {
00697 int code;
00698 wchar_t *string;
00699 };
00700
00701 #ifndef __cplusplus
00702 typedef struct gxERRITEM gxERRITEM;
00703 #endif
00704
00705 #endif
00706
00707 #if !defined(GX_SWIGIF) && !defined(GX_MANUAL)
00708
00710 struct GX_PARM_UPDATEERRTABLE {
00711 int nitems;
00712 const gxERRITEM *items;
00713 };
00714
00715
00716
00717
00718
00719
00721 struct GX_PARM_GLOBALREALLOC {
00722 void *buffer;
00724 int size;
00725 };
00726
00727
00729 struct GX_PARM_GLOBALSIZE {
00730 void *buffer;
00731 int size;
00732 };
00733
00734
00736 struct GX_PARM_GLOBALREALLOC_DBG {
00737 void *buffer;
00739 int size;
00740 const char *file;
00741 int line;
00742 };
00743
00745 struct GX_PARM_GLOBALTESTMEM_DBG {
00746 int index;
00747 char *fnbuffer;
00748 int fnbsize;
00749 char *membuffer;
00750 int mbsize;
00751 int line;
00752 int size;
00753 void *address;
00754 };
00755
00757 struct GX_PARM_CREATEMEMSLOT {
00758 int handle;
00759 void *mem;
00760 };
00761
00763 struct GX_PARM_GETMEMSLOT {
00764 int handle;
00765 void *mem;
00766 };
00767
00769 struct GX_PARM_UNREFMEMSLOT {
00770 int handle;
00771 };
00772
00773
00774
00775
00777 struct GX_PARM_GETDEFMODULENAME {
00778 int group;
00779 wchar_t *string;
00780 int maxlen;
00781 };
00782
00783 #ifndef ANDROID
00784
00785 struct GX_PARM_GETDEFMODULENAMEA {
00786 int group;
00787 char *string;
00788 int maxlen;
00789 };
00790 #endif
00791
00792 struct GX_PARM_SETDEFMODULENAME {
00793 int group;
00794 const wchar_t *string;
00795 };
00796
00797 #ifndef ANDROID
00798
00799 struct GX_PARM_SETDEFMODULENAMEA {
00800 int group;
00801 const char *string;
00802 };
00803 #endif
00804
00805 struct GX_PARM_SENDCOMPVERSION {
00806 unsigned int version;
00807 };
00808
00809
00810 #ifndef ANDROID
00811
00812 struct GX_PARM_LISTMODULESA {
00813 unsigned int flags;
00814 const char *filter;
00815 char **files;
00816 unsigned int *versions;
00817 int nitems;
00818 };
00819 #endif
00820
00821 struct GX_PARM_LISTMODULES {
00822 unsigned int flags;
00823 const wchar_t *filter;
00824 wchar_t **files;
00825 unsigned int *versions;
00826 int nitems;
00827 };
00828
00829
00830 #ifdef GX_DOTNET
00831 #define gxHANDLE _gxHANDLE
00832 #endif
00833
00834 #endif
00835
00836
00837
00838 #if !defined(GX_SWIGIF) && !(defined(GX_DOTNET) && defined(GX_MANUAL))
00839
00841 struct gxHANDLE {
00842 gxu32 handle;
00843 };
00844
00845 #ifndef __cplusplus
00846 typedef struct gxHANDLE gxHANDLE;
00847 #endif
00848
00849 #endif
00850 #if !defined(GX_SWIGIF) && !defined(GX_MANUAL)
00851
00853 struct GX_PARM_OPENMODULE {
00854 const wchar_t *modulename;
00855 const wchar_t *groupname;
00856 gxHANDLE handle;
00857 };
00858
00859 #ifndef ANDROID
00860
00861 struct GX_PARM_OPENMODULEA {
00862 const char *modulename;
00863 const char *groupname;
00864 gxHANDLE handle;
00865 };
00866 #endif
00867
00868 struct GX_PARM_CLOSEHANDLE {
00869 gxHANDLE handle;
00870 };
00871
00872 #endif
00873
00874 #if !defined(GX_SWIGIF)
00875
00877 enum GX_INFO_IDS {
00878 GXMODULE_INFO_ID = 0x67780000,
00879 GXUSRDRV_INFO_ID = 0x67786400,
00880 };
00881
00882 #endif
00883
00884 #if !defined(GX_SWIGIF) && !(defined(GX_DOTNET) && defined(GX_MANUAL))
00885
00886 #ifdef WIN32
00887
00888 #define GXAPI __stdcall
00889 #endif
00890 #ifdef LINUX
00891
00892 #define GXAPI
00893 #endif
00894
00896 typedef int GXAPI gxmodule_process_t(gxHANDLE mhandle, int function, void *param);
00897
00899 struct gxMODULEINFO {
00900 int id;
00901 int version;
00902 const char *description;
00903 const wchar_t *wdescription;
00905 gxmodule_process_t *process;
00906 };
00907
00908 #ifndef __cplusplus
00909 typedef struct gxMODULEINFO gxMODULEINFO;
00910 #endif
00911
00912 #endif
00913 #if !defined(GX_SWIGIF) && !defined(GX_MANUAL)
00914
00916 struct GX_PARM_GETMODULEPROPERTY {
00917 const wchar_t *name;
00918 wchar_t *string;
00919 int maxlen;
00920 };
00921
00922 #ifndef ANDROID
00923
00924 struct GX_PARM_GETMODULEPROPERTYA {
00925 const char *name;
00926 char *string;
00927 int maxlen;
00928 };
00929 #endif
00930
00931 struct GX_PARM_SETMODULEPROPERTY {
00932 const wchar_t *name;
00933 const wchar_t *string;
00934 };
00935
00936 #ifndef ANDROID
00937
00938 struct GX_PARM_SETMODULEPROPERTYA {
00939 const char *name;
00940 const char *string;
00941 };
00942 #endif
00943
00944 struct GX_PARM_SAVEMODULEPROPERTIES {
00945 const wchar_t *name;
00946 int level;
00947 };
00948
00949 #ifndef ANDROID
00950
00951 struct GX_PARM_SAVEMODULEPROPERTIESA {
00952 const char *name;
00953 int level;
00954 };
00955 #endif
00956 #endif
00957
00958 #ifdef GX_DOTNET
00959 #pragma managed
00960 #endif
00961
00962 #ifndef GX_EXT_MODULE
00963
00965 GX_ENUM GX_DEVICE_FLAGS {
00966 GX_DEVICE_FLAG_TYPE = 1,
00967 GX_DEVICE_FLAG_NAME = 2,
00968 GX_DEVICE_FLAG_SERIAL = 4,
00969 GX_DEVICE_FLAG_SERIAL_NOMSK = 8,
00971 GX_DEVICE_FLAG_EXCLUSIVE = 0x100,
00972 };
00973
00975 GX_ENUM GX_SYSINFO_FLAGS {
00976 GX_SYSINFO_FLAG_FREEFLOW = 1,
00977 GX_SYSINFO_FLAG_PARKING = 2,
00978 GX_SYSINFO_FLAG_ACCR = 3,
00979 GX_SYSINFO_FLAG_PARKINGLANE = 4,
00980 GX_SYSINFO_FLAG_FACE = 5,
00981 GX_SYSINFO_FLAG_PR = 6,
00982 };
00983
00984 #endif
00985
00986 #ifdef GX_DOTNET
00987 #pragma unmanaged
00988 #endif
00989
00990 #if !defined(GX_SWIGIF) && !(defined(GX_MANUAL) && defined(GX_DOTNET))
00991
00993 struct GX_DEVICE_INFO {
00994 wchar_t type[8];
00995 wchar_t devname[64];
00996 unsigned int serial;
00997 int priority;
00998 };
00999
01000 #ifndef __cplusplus
01001 typedef struct GX_DEVICE_INFO GX_DEVICE_INFO;
01002 #endif
01003
01004 #ifndef ANDROID
01005
01006 struct GX_DEVICE_INFOA {
01007 char type[8];
01008 char devname[64];
01009 unsigned int serial;
01010 int priority;
01011 };
01012 #endif
01013 #ifndef __cplusplus
01014 typedef struct GX_DEVICE_INFOA GX_DEVICE_INFOA;
01015 #endif
01016
01018 struct GX_SYSTEM_INFO {
01019 int size;
01020 int cm_ff;
01021 int cm_park;
01022 int cm_accr;
01023 int cm_pl;
01024 int cm_face;
01025 int pr;
01026 };
01027
01028 #ifndef __cplusplus
01029 typedef struct GX_SYSTEM_INFO GX_SYSTEM_INFO;
01030 #endif
01031
01032 #endif
01033 #if !defined(GX_SWIGIF) && !defined(GX_MANUAL)
01034
01035 #ifndef ANDROID
01036
01037 struct GX_PARM_LISTDEVICESA {
01038 unsigned int flags;
01039 struct GX_DEVICE_INFOA filter;
01040 int maxitems;
01041 struct GX_DEVICE_INFOA *items;
01042 };
01043 #endif
01044
01045 struct GX_PARM_LISTDEVICES {
01046 unsigned int flags;
01047 struct GX_DEVICE_INFO filter;
01048 int maxitems;
01049 struct GX_DEVICE_INFO *items;
01050 };
01051
01053 struct GX_PARM_OPENDEVICE {
01054 unsigned int flags;
01055 struct GX_DEVICE_INFO filter;
01056 int nproperties;
01057 const wchar_t **properties;
01058 int timeoutms;
01059 gxHANDLE handle;
01060 struct GX_DEVICE_INFO info;
01061 };
01062
01063 #ifndef ANDROID
01064
01065 struct GX_PARM_OPENDEVICEA {
01066 unsigned int flags;
01067 struct GX_DEVICE_INFOA filter;
01068 int nproperties;
01069 const char **properties;
01070 int timeoutms;
01071 gxHANDLE handle;
01072 struct GX_DEVICE_INFOA info;
01073 };
01075 struct GX_PARM_GETDEVICEPROPERTYA {
01076 const char *name;
01077 int sname;
01078 char *value;
01079 int svalue;
01080 };
01081
01083 struct GX_PARM_SETDEVICEPROPERTYA {
01084 const char *name;
01085 int sname;
01086 const char *value;
01087 int svalue;
01088 };
01089 #endif
01090
01092 #define GX_PARM_GETSYSTEMINFO GX_SYSTEM_INFO
01094 #if defined(WIN32)
01095
01098 struct GX_PARM_LISTDEVICESA32 {
01099 unsigned int flags;
01100 struct GX_DEVICE_INFOA filter;
01101 int maxitems;
01102 struct GX_DEVICE_INFOA* __ptr32 items;
01103 };
01104
01108 struct GX_PARM_LISTDEVICES32 {
01109 unsigned int flags;
01110 struct GX_DEVICE_INFO filter;
01111 int maxitems;
01112 struct GX_DEVICE_INFO* __ptr32 items;
01113 };
01114
01118 struct GX_PARM_OPENDEVICE32 {
01119 unsigned int flags;
01120 struct GX_DEVICE_INFO filter;
01121 int nproperties;
01122 const wchar_t* __ptr32 * __ptr32 properties;
01123 int timeoutms;
01124 gxHANDLE handle;
01125 struct GX_DEVICE_INFO info;
01126 };
01127
01131 struct GX_PARM_OPENDEVICEA32 {
01132 unsigned int flags;
01133 struct GX_DEVICE_INFOA filter;
01134 int nproperties;
01135 const char* __ptr32 * __ptr32 properties;
01136 int timeoutms;
01137 gxHANDLE handle;
01138 struct GX_DEVICE_INFOA info;
01139 };
01140
01144 struct GX_PARM_GETDEVICEPROPERTYA32 {
01145 const char* __ptr32 name;
01146 int sname;
01147 char* __ptr32 value;
01148 int svalue;
01149 };
01150
01154 struct GX_PARM_SETDEVICEPROPERTYA32 {
01155 const char* __ptr32 name;
01156 int sname;
01157 char* __ptr32 value;
01158 int svalue;
01159 };
01160 #endif
01161
01162 #endif
01163 #if !defined(GX_SWIGIF) && !(defined(GX_MANUAL) && defined(GX_DOTNET))
01164
01165 #ifdef __cplusplus
01166 extern "C"
01167 {
01168 #endif
01169
01181 int GXAPI gx_call(struct gxHANDLE handle, int function, void *params);
01182 #ifdef __cplusplus
01183 }
01184 #endif
01185
01186 #endif
01187
01188
01189
01190 #if !defined(GX_SWIGIF) && !defined(GX_MANUAL)
01191 enum GX_MAXLEN_VALUES {
01192 GX_MAXLEN_STRING = 1023,
01193 GX_MAXLEN_ERRVALUE = 255,
01194 GX_MAXLEN_PROPVALUE = 255,
01195 GX_MAXLEN_INT = 32,
01196 GX_MAXLEN_FLOAT = 64,
01197 GX_MAXLEN_VERSION = 20
01198 };
01199 #endif
01200
01201
01202
01203 #if !defined(GX_SWIGIF) && !defined(NO_GX_FUNCTIONS)
01204
01205
01206
01207
01208
01214 inline gxHANDLE gx_direct(int call_group) {
01215 gxHANDLE ret;
01216 assert((unsigned int)call_group >= (unsigned int)GX_CALL_GROUP_API_FIRST);
01217 ret.handle = (((unsigned int)call_group >> 16) | 0xFFFF0000);
01218 return ret;
01219 }
01220
01221
01235 inline int gx_listmodules(unsigned int flags, const wchar_t *filter, wchar_t ***files,
01236 unsigned int **versions, int *nitems) {
01237 gxHANDLE nullhandle = { 0 };
01238 struct GX_PARM_LISTMODULES m;
01239 int st = 0;
01240 m.flags = flags;
01241 m.filter = filter;
01242 m.files = NULL;
01243 m.versions = NULL;
01244 m.nitems = 0;
01245
01246 st = gx_call(nullhandle, GX_CALL_LISTMODULES, &m);
01247 if(st) {
01248 *files = m.files;
01249 *versions = m.versions;
01250 *nitems = m.nitems;
01251 } else {
01252 *files = NULL;
01253 *versions = NULL;
01254 *nitems = 0;
01255 }
01256 return st;
01257 }
01258
01259 #ifndef ANDROID
01260
01274 inline int gx_listmodulesa(unsigned int flags, const char *filter, char ***files,
01275 unsigned int **versions, int *nitems) {
01276 gxHANDLE nullhandle = { 0 };
01277 struct GX_PARM_LISTMODULESA m;
01278 int st = 0;
01279 m.flags = flags;
01280 m.filter = filter;
01281 m.files = NULL;
01282 m.versions = NULL;
01283 m.nitems = 0;
01284
01285 st = gx_call(nullhandle, GX_CALL_LISTMODULESA, &m);
01286 if(st) {
01287 *files = m.files;
01288 *versions = m.versions;
01289 *nitems = m.nitems;
01290 } else {
01291 *files = NULL;
01292 *versions = NULL;
01293 *nitems = 0;
01294 }
01295 return st;
01296 }
01297
01298 #ifdef __cplusplus
01299
01313 inline int gx_listmodules(unsigned int flags, const char *filter, char ***files,
01314 unsigned int **versions, int *nitems) {
01315 return gx_listmodulesa(flags, filter, files, versions, nitems);
01316 }
01317 #endif
01318 #endif
01319
01320
01321
01322
01323
01324
01328
01329
01330
01342
01343 inline int gx_globalrealloc(void **buffer, int sbuffer) {
01344 gxHANDLE nullhandle = { 0 };
01345 struct GX_PARM_GLOBALREALLOC r;
01346 int ret;
01347
01348 assert(buffer);
01349 assert(sbuffer >= 0);
01350 r.buffer = *buffer;
01351 r.size = sbuffer;
01352 ret = gx_call(nullhandle, GX_CALL_GLOBALREALLOC, &r);
01353 if(ret) *buffer = r.buffer;
01354 return ret;
01355 }
01356
01357
01367 inline int gx_globalalloc(void **buffer, int sbuffer) {
01368 assert(buffer);
01369 *buffer = 0;
01370 return gx_globalrealloc(buffer, sbuffer);
01371 }
01372
01373
01379 inline int gx_globalfree(void *buffer) {
01380 assert(buffer);
01381 return gx_globalrealloc(&buffer, 0);
01382 }
01383
01384
01391 inline int gx_globalsize(int *sbuffer, void *buffer) {
01392 gxHANDLE nullhandle = { 0 };
01393 struct GX_PARM_GLOBALSIZE s;
01394 int ret;
01395
01396 assert(sbuffer);
01397 assert(buffer);
01398 s.buffer = buffer;
01399 ret = gx_call(nullhandle, GX_CALL_GLOBALSIZE, &s);
01400 if(ret) *sbuffer = s.size;
01401 return ret;
01402 }
01403
01404
01418
01419 inline int gx_globalrealloc_dbg(void **buffer, int sbuffer, const char *file, int line) {
01420 gxHANDLE nullhandle = { 0 };
01421 struct GX_PARM_GLOBALREALLOC_DBG r;
01422 int ret;
01423
01424 assert(buffer);
01425 assert(sbuffer >= 0);
01426 r.buffer = *buffer;
01427 r.size = sbuffer;
01428 r.file = file;
01429 r.line = line;
01430 ret = gx_call(nullhandle, GX_CALL_GLOBALREALLOC_DBG, &r);
01431 if(ret) *buffer = r.buffer;
01432 return ret;
01433 }
01434
01435
01447 inline int gx_globalalloc_dbg(void **buffer, int sbuffer,const char *file, int line) {
01448 assert(buffer);
01449 *buffer = 0;
01450 return gx_globalrealloc_dbg(buffer, sbuffer, file, line);
01451 }
01452
01453
01459 inline int gx_globalcheck_dbg() {
01460 gxHANDLE nullhandle = { 0 };
01461 return gx_call(nullhandle, GX_CALL_GLOBALCHECK_DBG, 0);
01462 }
01463
01464
01478 inline int gx_globaltestmem_dbg(int index, char *fnbuffer, int fnbsize, char *membuffer, int mbsize
01479 , int *line, int *size, void **address) {
01480
01481 gxHANDLE nullhandle = { 0 };
01482 struct GX_PARM_GLOBALTESTMEM_DBG gtm;
01483
01484 gtm.index = index;
01485 gtm.fnbuffer = fnbuffer;
01486 gtm.fnbsize = fnbsize;
01487 gtm.membuffer = membuffer;
01488 gtm.mbsize = mbsize;
01489 if(!gx_call(nullhandle, GX_CALL_GLOBALTESTMEM_DBG, >m)) return 0;
01490 if(line) *line = gtm.line;
01491 if(size) *size = gtm.size;
01492 if(address) *address = gtm.address;
01493 return true;
01494 }
01495
01496 #if defined(GX_TESTMEMORY) || defined(GX_TESTLEAKS)
01497
01499 #define gx_globalrealloc(buf,sbuf) gx_globalrealloc_dbg(buf,sbuf, __FILE__, __LINE__)
01500
01501 #define gx_globalalloc(buf,sbuf) gx_globalalloc_dbg(buf,sbuf, __FILE__, __LINE__)
01502
01503 #else
01504
01506 #define gx_globalrealloc_dbg(buf,sbuf,f,l) gx_globalrealloc(buf,sbuf)
01507
01508 #define gx_globalalloc_dbg(buf,sbuf,f,l) gx_globalalloc(buf,sbuf)
01509
01510 #endif
01511
01512
01521 inline int gx_creatememslot(int *handle,void **mem) {
01522 gxHANDLE nullhandle = { 0 };
01523 struct GX_PARM_CREATEMEMSLOT cm;
01524 assert(handle && mem);
01525 if(!gx_call(nullhandle, GX_CALL_CREATEMEMSLOT, &cm)) return 0;
01526 if(handle) *handle = cm.handle;
01527 if(mem) *mem = cm.mem;
01528 return true;
01529 }
01530
01531
01538 inline int gx_getmemslot(int handle,void **mem) {
01539 gxHANDLE nullhandle = { 0 };
01540 struct GX_PARM_GETMEMSLOT gm;
01541 assert(mem);
01542 gm.handle = handle;
01543 if(!gx_call(nullhandle, GX_CALL_GETMEMSLOT, &gm)) return 0;
01544 if(mem) *mem = gm.mem;
01545 return true;
01546 }
01547
01548
01556 inline int gx_unrefmemslot(int handle) {
01557 gxHANDLE nullhandle = { 0 };
01558 struct GX_PARM_UNREFMEMSLOT um;
01559 um.handle = handle;
01560 return gx_call(nullhandle, GX_CALL_UNREFMEMSLOT, &um);
01561 }
01562
01563
01565
01566
01567
01568
01569
01570
01571
01575
01576
01577
01606 inline int gx_openmodule(gxHANDLE *handle, const wchar_t *modulename, const wchar_t *groupname) {
01607 gxHANDLE nullhandle = { 0 };
01608 struct GX_PARM_OPENMODULE op;
01609
01610 assert(handle);
01611 assert(modulename);
01612 op.modulename = modulename;
01613 op.groupname = groupname;
01614 if(!gx_call(nullhandle, GX_CALL_OPENMODULE, &op)) return false;
01615 *handle = op.handle;
01616 return true;
01617 }
01618
01619 #ifndef ANDROID
01620
01649 inline int gx_openmodulea(gxHANDLE *handle, const char *modulename, const char *groupname) {
01650 gxHANDLE nullhandle = { 0 };
01651 struct GX_PARM_OPENMODULEA op;
01652
01653 assert(handle);
01654 assert(modulename);
01655 op.modulename = modulename;
01656 op.groupname = groupname;
01657 if(!gx_call(nullhandle, GX_CALL_OPENMODULEA, &op)) return false;
01658 *handle = op.handle;
01659 return true;
01660 }
01661
01662 #ifdef __cplusplus
01663
01692 inline int gx_openmodule(gxHANDLE *handle, const char *modulename, const char *groupname) {
01693 return gx_openmodulea(handle, modulename, groupname);
01694 }
01695 #endif
01696 #endif
01697
01706 inline int gx_closehandle(gxHANDLE *handle) {
01707 gxHANDLE nullhandle = { 0 };
01708 struct GX_PARM_CLOSEHANDLE cl;
01709 assert(handle);
01710 cl.handle = *handle;
01711 if(!gx_call(nullhandle, GX_CALL_CLOSEHANDLE, &cl)) return false;
01712 handle->handle = 0;
01713 return true;
01714 }
01715
01716
01718
01722
01723
01724
01730 inline int gx_refhandle(gxHANDLE handle) {
01731 gxHANDLE nullhandle = { 0 };
01732 return gx_call(nullhandle, GX_CALL_REFHANDLE, &handle);
01733 }
01734
01735
01741 inline int gx_unrefhandle(gxHANDLE *handle) {
01742 gxHANDLE nullhandle = { 0 };
01743 return gx_call(nullhandle, GX_CALL_UNREFHANDLE, handle);
01744 }
01745
01746
01748
01749
01750
01757 inline int gx_isvalidhandle(gxHANDLE handle) {
01758 return handle.handle ? true : false;
01759 }
01760
01761
01765
01766
01767
01778 inline int gx_getmoduleinfo(gxHANDLE handle, const gxMODULEINFO **moduleinfo) {
01779 assert(moduleinfo);
01780 return gx_call(handle, GX_CALL_GETMODULEINFO, (void *)moduleinfo);
01781 }
01782
01783
01785
01789
01790
01791
01807 inline int gx_getmoduleproperty(gxHANDLE handle, const wchar_t *name, wchar_t *string, int maxlen) {
01808 struct GX_PARM_GETMODULEPROPERTY gp;
01809 gp.name = name;
01810 gp.string = string;
01811 gp.maxlen = maxlen;
01812 return gx_call(handle, GX_CALL_GETMODULEPROPERTY, &gp);
01813 }
01814
01815 #ifndef ANDROID
01816
01832 inline int gx_getmodulepropertya(gxHANDLE handle, const char *name, char *string, int maxlen) {
01833 struct GX_PARM_GETMODULEPROPERTYA gp;
01834 gp.name = name;
01835 gp.string = string;
01836 gp.maxlen = maxlen;
01837 return gx_call(handle, GX_CALL_GETMODULEPROPERTYA, &gp);
01838 }
01839
01840 #ifdef __cplusplus
01841
01857 inline int gx_getmoduleproperty(gxHANDLE handle, const char *name, char *string, int maxlen) {
01858 return gx_getmodulepropertya(handle, name, string, maxlen);
01859 }
01860 #endif
01861 #endif
01862
01877 inline int gx_getmodulepropertyint(gxHANDLE handle, const wchar_t *name, int *ivalue) {
01878 wchar_t ibuf[GX_MAXLEN_INT+1];
01879 int ret;
01880 assert(ivalue);
01881 ibuf[GX_MAXLEN_INT] = 0;
01882 ret = gx_getmoduleproperty(handle, name, ibuf, GX_MAXLEN_INT);
01883 if(ret) {
01884 *ivalue = (int)gx_wcstol(ibuf, 0, 10);
01885 }
01886 return ret;
01887 }
01888
01889 #ifdef __cplusplus
01890
01905 inline int gx_getmoduleproperty(gxHANDLE handle, const wchar_t *name, int *ivalue) {
01906 return gx_getmodulepropertyint(handle, name, ivalue);
01907 }
01908 #endif
01909
01910 #ifndef ANDROID
01911
01926 inline int gx_getmodulepropertyinta(gxHANDLE handle, const char *name, int *ivalue) {
01927 char ibuf[GX_MAXLEN_INT+1];
01928 int ret;
01929 assert(ivalue);
01930 ibuf[sizeof(ibuf)-1] = 0;
01931 ret = gx_getmodulepropertya(handle, name, ibuf, sizeof(ibuf)-1);
01932 if(ret) {
01933 *ivalue = atoi(ibuf);
01934 }
01935 return ret;
01936 }
01937
01938 #ifdef __cplusplus
01939
01954 inline int gx_getmoduleproperty(gxHANDLE handle, const char *name, int *ivalue) {
01955 return gx_getmodulepropertyinta(handle, name, ivalue);
01956 }
01957
01958
01973 inline int gx_getmodulepropertyint(gxHANDLE handle, const char *name, int *ivalue) {
01974 return gx_getmodulepropertyinta(handle, name, ivalue);
01975 }
01976 #endif
01977 #endif
01978
01993 inline int gx_getmodulepropertyfloat(gxHANDLE handle, const wchar_t *name, double *fvalue) {
01994 wchar_t fbuf[GX_MAXLEN_FLOAT+1];
01995 int ret;
01996 assert(fvalue);
01997 fbuf[GX_MAXLEN_FLOAT] = 0;
01998 ret = gx_getmoduleproperty(handle, name, fbuf, GX_MAXLEN_FLOAT);
01999 if(ret) {
02000 *fvalue = (double)wcstod(fbuf, 0);
02001 }
02002 return ret;
02003 }
02004
02005 #ifdef __cplusplus
02006
02021 inline int gx_getmoduleproperty(gxHANDLE handle, const wchar_t *name, double *fvalue) {
02022 return gx_getmodulepropertyfloat(handle, name, fvalue);
02023 }
02024 #endif
02025
02026 #ifndef ANDROID
02027
02042 inline int gx_getmodulepropertyfloata(gxHANDLE handle, const char *name, double *fvalue) {
02043 char fbuf[GX_MAXLEN_FLOAT+1];
02044 int ret;
02045 assert(fvalue);
02046 fbuf[sizeof(fbuf)-1] = 0;
02047 ret = gx_getmodulepropertya(handle, name, fbuf, sizeof(fbuf)-1);
02048 if(ret) {
02049 *fvalue = (double)atof(fbuf);
02050 }
02051 return ret;
02052 }
02053
02054 #ifdef __cplusplus
02055
02070 inline int gx_getmoduleproperty(gxHANDLE handle, const char *name, double *fvalue) {
02071 return gx_getmodulepropertyfloata(handle, name, fvalue);
02072 }
02073
02088 inline int gx_getmodulepropertyfloat(gxHANDLE handle, const char *name, double *fvalue) {
02089 return gx_getmodulepropertyfloata(handle, name, fvalue);
02090 }
02091 #endif
02092 #endif
02093
02094
02109 inline int gx_getmodulepropertyversion(gxHANDLE handle, const wchar_t *name, unsigned int *version) {
02110 wchar_t fbuf[GX_MAXLEN_VERSION+1];
02111 int ret;
02112 assert(version);
02113 fbuf[GX_MAXLEN_VERSION] = 0;
02114 ret = gx_getmoduleproperty(handle, name, fbuf, GX_MAXLEN_VERSION);
02115 if(ret) {
02116 int ix;
02117 unsigned int ver = 0;
02118 wchar_t *s = fbuf;
02119 for(ix = 0; (ix < 4) && *s; ix++) {
02120 ver = (ver << 8) + gx_wcstol(s, &s, 10);
02121 if(*s == '.') s++;
02122 }
02123 *version = ver;
02124 }
02125 return ret;
02126 }
02127
02128 #ifndef ANDROID
02129
02144 inline int gx_getmodulepropertyversiona(gxHANDLE handle, const char *name, unsigned int *version) {
02145 char fbuf[GX_MAXLEN_VERSION+1];
02146 int ret;
02147 fbuf[sizeof(fbuf)-1] = 0;
02148 ret = gx_getmodulepropertya(handle, name, fbuf, sizeof(fbuf)-1);
02149 if(ret) {
02150 int ix;
02151 unsigned int ver = 0;
02152 char *s = fbuf;
02153 for(ix = 0; (ix < 4) && *s; ix++) {
02154 ver = (ver << 8) + strtol(s, &s, 10);
02155 if(*s == '.') s++;
02156 }
02157 *version = ver;
02158 }
02159 return ret;
02160 }
02161
02162 #ifdef __cplusplus
02163
02178 inline int gx_getmodulepropertyversion(gxHANDLE handle, const char *name, unsigned int *version) {
02179 return gx_getmodulepropertyversiona(handle, name, version);
02180 }
02181 #endif
02182 #endif
02183
02198 inline int gx_setmoduleproperty(gxHANDLE handle, const wchar_t *name, const wchar_t *string) {
02199 struct GX_PARM_SETMODULEPROPERTY sp;
02200 sp.name = name;
02201 sp.string = string;
02202 return gx_call(handle, GX_CALL_SETMODULEPROPERTY, &sp);
02203 }
02204
02205 #ifndef ANDROID
02206
02221 inline int gx_setmodulepropertya(gxHANDLE handle, const char *name, const char *string) {
02222 struct GX_PARM_SETMODULEPROPERTYA sp;
02223 sp.name = name;
02224 sp.string = string;
02225 return gx_call(handle, GX_CALL_SETMODULEPROPERTYA, &sp);
02226 }
02227
02228 #ifdef __cplusplus
02229
02244 inline int gx_setmoduleproperty(gxHANDLE handle, const char *name, const char *string) {
02245 return gx_setmodulepropertya(handle, name, string);
02246 }
02247 #endif
02248 #endif
02249
02264 inline int gx_setmodulepropertyint(gxHANDLE handle, const wchar_t *name, int ivalue) {
02265 wchar_t ibuf[GX_MAXLEN_INT+1];
02266 gx_snwprintf(ibuf, GX_MAXLEN_INT+1, L"%i", ivalue);
02267 ibuf[GX_MAXLEN_INT] = 0;
02268 return gx_setmoduleproperty(handle, name, ibuf);
02269 }
02270
02271 #ifdef __cplusplus
02272
02287 inline int gx_setmoduleproperty(gxHANDLE handle, const wchar_t *name, int ivalue) {
02288 return gx_setmodulepropertyint(handle, name, ivalue);
02289 }
02290 #endif
02291
02292 #ifndef ANDROID
02293
02308 inline int gx_setmodulepropertyinta(gxHANDLE handle, const char *name, int ivalue) {
02309 char ibuf[GX_MAXLEN_INT+1];
02310 gx_snprintf(ibuf, GX_MAXLEN_INT+1, "%i", ivalue);
02311 ibuf[GX_MAXLEN_INT] = 0;
02312 return gx_setmodulepropertya(handle, name, ibuf);
02313 }
02314
02315 #ifdef __cplusplus
02316
02331 inline int gx_setmoduleproperty(gxHANDLE handle, const char *name, int ivalue) {
02332 return gx_setmodulepropertyinta(handle, name, ivalue);
02333 }
02334
02335
02350 inline int gx_setmodulepropertyint(gxHANDLE handle, const char *name, int ivalue) {
02351 return gx_setmodulepropertyinta(handle, name, ivalue);
02352 }
02353 #endif
02354 #endif
02355
02370 inline int gx_setmodulepropertyfloat(gxHANDLE handle, const wchar_t *name, double fvalue) {
02371 wchar_t fbuf[GX_MAXLEN_FLOAT+1];
02372 gx_snwprintf(fbuf, GX_MAXLEN_FLOAT+1, L"%f", fvalue);
02373 fbuf[GX_MAXLEN_FLOAT] = 0;
02374 return gx_setmoduleproperty(handle, name, fbuf);
02375 }
02376
02377 #ifdef __cplusplus
02378
02393 inline int gx_setmoduleproperty(gxHANDLE handle, const wchar_t *name, double fvalue) {
02394 return gx_setmodulepropertyfloat(handle, name, fvalue);
02395 }
02396 #endif
02397
02398 #ifndef ANDROID
02399
02414 inline int gx_setmodulepropertyfloata(gxHANDLE handle, const char *name, double fvalue) {
02415 char fbuf[GX_MAXLEN_FLOAT+1];
02416 gx_snprintf(fbuf, GX_MAXLEN_FLOAT+1, "%f", fvalue);
02417 fbuf[GX_MAXLEN_FLOAT] = 0;
02418 return gx_setmodulepropertya(handle, name, fbuf);
02419 }
02420
02421 #ifdef __cplusplus
02422
02437 inline int gx_setmoduleproperty(gxHANDLE handle, const char *name, double fvalue) {
02438 return gx_setmodulepropertyfloata(handle, name, fvalue);
02439 }
02440
02441
02456 inline int gx_setmodulepropertyfloat(gxHANDLE handle, const char *name, double fvalue) {
02457 return gx_setmodulepropertyfloata(handle, name, fvalue);
02458 }
02459 #endif
02460 #endif
02461
02469 inline int gx_mpstarttransaction(gxHANDLE handle) {
02470 return gx_call(handle, GX_CALL_MPSTARTTRANSACTION, (void *)0);
02471 }
02472
02473
02479 inline int gx_mpcommit(gxHANDLE handle) {
02480 return gx_call(handle, GX_CALL_MPCOMMIT, (void *)0);
02481 }
02482
02483
02494 inline int gx_savemoduleproperties(gxHANDLE handle, const wchar_t *name, int level GX_DEFARG(0)) {
02495 struct GX_PARM_SAVEMODULEPROPERTIES mp;
02496 mp.name = name;
02497 mp.level = level;
02498 return gx_call(handle, GX_CALL_SAVEMODULEPROPERTIES, &mp);
02499 }
02500
02501 #ifndef ANDROID
02502
02513 inline int gx_savemodulepropertiesa(gxHANDLE handle, const char *name, int level GX_DEFARG(0)) {
02514 struct GX_PARM_SAVEMODULEPROPERTIESA mp;
02515 mp.name = name;
02516 mp.level = level;
02517 return gx_call(handle, GX_CALL_SAVEMODULEPROPERTIESA, &mp);
02518 }
02519
02520 #ifdef __cplusplus
02521
02532 inline int gx_savemoduleproperties(gxHANDLE handle, const char *name, int level = 0) {
02533 return gx_savemodulepropertiesa(handle, name, level);
02534 }
02535 #endif
02536 #endif
02537
02539
02543
02544
02545
02546
02547
02548
02549
02557 inline int gx_geterror(int *code, wchar_t *string, int maxlen) {
02558 gxHANDLE nullhandle = { 0 };
02559 struct GX_PARM_GETERROR me;
02560 int err_code;
02561 me.string = string;
02562 me.maxlen = maxlen;
02563 err_code = gx_call(nullhandle, GX_CALL_GETERROR, &me);
02564 if(code) *code = me.code;
02565 return err_code;
02566 }
02567
02568 #ifndef ANDROID
02569
02577 inline int gx_geterrora(int *code, char *string, int maxlen) {
02578 gxHANDLE nullhandle = { 0 };
02579 struct GX_PARM_GETERRORA me;
02580 int err_code;
02581 me.string = string;
02582 me.maxlen = maxlen;
02583 err_code = gx_call(nullhandle, GX_CALL_GETERRORA, &me);
02584 if(code) *code = me.code;
02585 return err_code;
02586 }
02587
02588
02589 #ifdef __cplusplus
02590
02597 inline int gx_geterror(int *code, char *string = (char *)0, int maxlen = 0) {
02598 return gx_geterrora(code, string, maxlen);
02599 }
02600 #endif
02601 #endif
02602
02606 inline int gx_geterrorcode(void) {
02607 gxHANDLE nullhandle = { 0 };
02608 return gx_call(nullhandle, GX_CALL_GETERROR, (void *)0);
02609 }
02610
02611 #ifdef __cplusplus
02612
02615 inline int gx_geterror(void) {
02616 return gx_geterrorcode();
02617 }
02618 #endif
02619
02620
02631 inline int gx_seterrorfv(int flags, int code, const wchar_t *wformat, va_list args) {
02632 gxHANDLE nullhandle = { 0 };
02633 struct GX_PARM_SETERROR se;
02634 int st;
02635 se.flags = flags;
02636 se.code = code;
02637 se.appformat = wformat;
02638 if(wformat) va_copy(se.arguments, args);
02639 st = gx_call(nullhandle, GX_CALL_SETERROR, &se);
02640 if(wformat) va_end(se.arguments);
02641 return st;
02642 }
02643
02644 #ifdef __cplusplus
02645
02655 inline int gx_seterrorv(int flags, int code, const wchar_t *wformat, va_list args) {
02656 return gx_seterrorfv(flags, code, wformat, args);
02657 }
02658 #endif
02659
02660 #ifndef ANDROID
02661
02672 inline int gx_seterrorafv(int flags, int code, const char *wformat, va_list args) {
02673 gxHANDLE nullhandle = { 0 };
02674 struct GX_PARM_SETERRORA se;
02675 int st;
02676 se.flags = flags;
02677 se.code = code;
02678 se.appformat = wformat;
02679 if(wformat) va_copy(se.arguments, args);
02680 st = gx_call(nullhandle, GX_CALL_SETERRORA, &se);
02681 if(wformat) va_end(se.arguments);
02682 return st;
02683 }
02684
02685 #ifdef __cplusplus
02686
02696 inline int gx_seterrorv(int flags, int code, const char *wformat, va_list args) {
02697 return gx_seterrorafv(flags, code, wformat, args);
02698 }
02699 #endif
02700 #endif
02701
02710 inline int gx_seterrorv(int code, const wchar_t *wformat, va_list args) {
02711 return gx_seterrorfv(_GX_ERR_FLAG_CLEAR, code, wformat, args);
02712 }
02713
02714 #ifndef ANDROID
02715
02724 inline int gx_seterrorav(int code, const char *wformat, va_list args) {
02725 return gx_seterrorafv(_GX_ERR_FLAG_CLEAR, code, wformat, args);
02726 }
02727
02728 #ifdef __cplusplus
02729
02738 inline int gx_seterrorv(int code, const char *wformat, va_list args) {
02739 return gx_seterrorafv(_GX_ERR_FLAG_CLEAR, code, wformat, args);
02740 }
02741 #endif
02742 #endif
02743
02752 inline int gx_appenderrorv(int code, const wchar_t *wformat, va_list args) {
02753 return gx_seterrorfv(_GX_ERR_FLAG_APPEND, code, wformat, args);
02754 }
02755
02756 #ifndef ANDROID
02757
02766 inline int gx_appenderrorav(int code, const char *wformat, va_list args) {
02767 return gx_seterrorafv(_GX_ERR_FLAG_APPEND, code, wformat, args);
02768 }
02769
02770 #ifdef __cplusplus
02771
02780 inline int gx_appenderrorv(int code, const char *wformat, va_list args) {
02781 return gx_seterrorafv(_GX_ERR_FLAG_APPEND, code, wformat, args);
02782 }
02783 #endif
02784 #endif
02785
02794 inline int gx_prependerrorv(int code, const wchar_t *wformat, va_list args) {
02795 return gx_seterrorfv(_GX_ERR_FLAG_PREPEND, code, wformat, args);
02796 }
02797
02798 #ifndef ANDROID
02799
02808 inline int gx_prependerrorav(int code, const char *wformat, va_list args) {
02809 return gx_seterrorafv(_GX_ERR_FLAG_PREPEND, code, wformat, args);
02810 }
02811
02812 #ifdef __cplusplus
02813
02822 inline int gx_prependerrorv(int code, const char *wformat, va_list args) {
02823 return gx_seterrorafv(_GX_ERR_FLAG_PREPEND, code, wformat, args);
02824 }
02825 #endif
02826 #endif
02827
02838 inline int gx_seterrorf(int flags, int code, const wchar_t *wformat, ...) {
02839 va_list args;
02840 int st;
02841 va_start(args, wformat);
02842 st = gx_seterrorfv(flags, code, wformat, args);
02843 va_end(args);
02844 return st;
02845 }
02846
02847 #ifdef __cplusplus
02848
02858 inline int gx_seterror(int flags, int code, const wchar_t *wformat = (const wchar_t *)0, ...) {
02859 va_list args;
02860 int st;
02861 va_start(args, wformat);
02862 st = gx_seterrorfv(flags, code, wformat, args);
02863 va_end(args);
02864 return st;
02865 }
02866 #endif
02867
02868 #ifndef ANDROID
02869
02880 inline int gx_seterroraf(int flags, int code, const char *wformat, ...) {
02881 va_list args;
02882 int st;
02883 va_start(args, wformat);
02884 st = gx_seterrorafv(flags, code, wformat, args);
02885 va_end(args);
02886 return st;
02887 }
02888
02889 #ifdef __cplusplus
02890
02900 inline int gx_seterror(int flags, int code, const char *wformat = (const char *)0, ...) {
02901 va_list args;
02902 int st;
02903 va_start(args, wformat);
02904 st = gx_seterrorafv(flags, code, wformat, args);
02905 va_end(args);
02906 return st;
02907 }
02908 #endif
02909 #endif
02910
02915 inline int gx_clearerror(void) {
02916 return gx_seterrorf(_GX_ERR_FLAG_CLEAR, 0, L"");
02917 }
02918
02919
02928 inline int gx_seterrorcodef(int flags, int code) {
02929 return gx_seterrorf(flags, code, L"");
02930 }
02931
02932
02939 inline int gx_seterrorcode(int code) {
02940 return gx_seterrorf(_GX_ERR_FLAG_CLEAR, code, L"");
02941 }
02942
02943
02950 inline int gx_appenderrorcode(int code) {
02951 return gx_seterrorf(_GX_ERR_FLAG_APPEND, code, L"");
02952 }
02953
02954
02961 inline int gx_prependerrorcode(int code) {
02962 return gx_seterrorf(_GX_ERR_FLAG_PREPEND, code, L"");
02963 }
02964
02965
02974 inline int gx_seterror(int code, const wchar_t *wformat, ...) {
02975 va_list args;
02976 int st;
02977 va_start(args, wformat);
02978 st = gx_seterrorv(code, wformat, args);
02979 va_end(args);
02980 return st;
02981 }
02982
02983
02984 #ifdef __cplusplus
02985
02991 inline int gx_seterror(int code) {
02992 return gx_seterrorcode(code);
02993 }
02994 #endif
02995
02996 #ifndef ANDROID
02997
03006 inline int gx_seterrora(int code, const char *wformat, ...) {
03007 va_list args;
03008 int st;
03009 va_start(args, wformat);
03010 st = gx_seterrorav(code, wformat, args);
03011 va_end(args);
03012 return st;
03013 }
03014
03015
03016 #ifdef __cplusplus
03017
03025 inline int gx_seterror(int code, const char *wformat, ...) {
03026 va_list args;
03027 va_start(args, wformat);
03028 int st = gx_seterrorav(code, wformat, args);
03029 va_end(args);
03030 return st;
03031 }
03032 #endif
03033 #endif
03034
03035
03044 inline int gx_appenderror(int code, const wchar_t *wformat, ...) {
03045 va_list args;
03046 int st;
03047 va_start(args, wformat);
03048 st = gx_appenderrorv(code, wformat, args);
03049 va_end(args);
03050 return st;
03051 }
03052
03053
03054 #ifdef __cplusplus
03055
03061 inline int gx_appenderror(int code) {
03062 return gx_appenderrorcode(code);
03063 }
03064 #endif
03065
03066 #ifndef ANDROID
03067
03076 inline int gx_appenderrora(int code, const char *wformat, ...) {
03077 va_list args;
03078 int st;
03079 va_start(args, wformat);
03080 st = gx_appenderrorav(code, wformat, args);
03081 va_end(args);
03082 return st;
03083 }
03084
03085
03086 #ifdef __cplusplus
03087
03095 inline int gx_appenderror(int code, const char *wformat, ...) {
03096 va_list args;
03097 va_start(args, wformat);
03098 int st = gx_appenderrorav(code, wformat, args);
03099 va_end(args);
03100 return st;
03101 }
03102 #endif
03103 #endif
03104
03105
03114 inline int gx_prependerror(int code, const wchar_t *wformat, ...) {
03115 va_list args;
03116 int st;
03117 va_start(args, wformat);
03118 st = gx_prependerrorv(code, wformat, args);
03119 va_end(args);
03120 return st;
03121 }
03122
03123
03124 #ifdef __cplusplus
03125
03132 inline int gx_prependerror(int code) {
03133 return gx_prependerrorcode(code);
03134 }
03135 #endif
03136
03137 #ifndef ANDROID
03138
03147 inline int gx_prependerrora(int code, const char *wformat, ...) {
03148 va_list args;
03149 int st;
03150 va_start(args, wformat);
03151 st = gx_prependerrorav(code, wformat, args);
03152 va_end(args);
03153 return st;
03154 }
03155
03156
03157 #ifdef __cplusplus
03158
03166 inline int gx_prependerror(int code, const char *wformat, ...) {
03167 va_list args;
03168 va_start(args, wformat);
03169 int st = gx_prependerrorv(code, wformat, args);
03170 va_end(args);
03171 return st;
03172 }
03173 #endif
03174 #endif
03175
03182 inline int gx_updateerrtable(int nitems, const gxERRITEM *items) {
03183 gxHANDLE nullhandle = { 0 };
03184 struct GX_PARM_UPDATEERRTABLE ut;
03185 ut.nitems = nitems;
03186 ut.items = items;
03187 return gx_call(nullhandle, GX_CALL_UPDATEERRTABLE, &ut);
03188 }
03189
03190
03195 inline int gx_pusherror(void) {
03196 gxHANDLE nullhandle = { 0 };
03197 return gx_call(nullhandle, GX_CALL_PUSHERROR, (void *)0);
03198 }
03199
03200
03205 inline int gx_poperror(void) {
03206 gxHANDLE nullhandle = { 0 };
03207 return gx_call(nullhandle, GX_CALL_POPERROR, (void *)0);
03208 }
03209
03210
03212
03213
03214
03215
03216
03217
03218
03222
03223
03224
03235 inline int gx_listdevices(int *nitems, GX_DEVICE_INFO *items,
03236 unsigned int flags GX_DEFARG(0), GX_DEVICE_INFO *filter GX_DEFARG(0)) {
03237 gxHANDLE nullhandle = { 0 };
03238 struct GX_PARM_LISTDEVICES pr;
03239 int st;
03240
03241 assert(nitems && items);
03242 memset(&pr, 0, sizeof(pr));
03243 pr.flags = flags;
03244 if(filter) memcpy(&pr.filter, filter, sizeof(pr.filter));
03245 pr.maxitems = *nitems;
03246 pr.items = items;
03247 st = gx_call(nullhandle, GX_CALL_LISTDEVICES, &pr);
03248 if(st) *nitems = pr.maxitems;
03249 return st;
03250 }
03251
03252 #ifndef ANDROID
03253
03264 inline int gx_listdevicesa(int *nitems, GX_DEVICE_INFOA *items,
03265 unsigned int flags, GX_DEVICE_INFOA *filter) {
03266
03267 gxHANDLE nullhandle = { 0 };
03268 struct GX_PARM_LISTDEVICESA pr;
03269 int st;
03270
03271 assert(nitems && items);
03272 memset(&pr, 0, sizeof(pr));
03273 pr.flags = flags;
03274 if(filter) memcpy(&pr.filter, filter, sizeof(pr.filter));
03275 pr.maxitems = *nitems;
03276 pr.items = items;
03277 st = gx_call(nullhandle, GX_CALL_LISTDEVICESA, &pr);
03278 if(st) *nitems = pr.maxitems;
03279 return st;
03280 }
03281
03282 #ifdef __cplusplus
03283
03294 inline int gx_listdevices(int *nitems, GX_DEVICE_INFOA *items,
03295 unsigned int flags = 0, GX_DEVICE_INFOA *filter = 0) {
03296 return gx_listdevicesa(nitems, items, flags, filter);
03297 }
03298 #endif
03299
03300
03312 inline int gx_opendevicea(gxHANDLE *handle, GX_DEVICE_INFOA *info,
03313 unsigned int flags, GX_DEVICE_INFOA *filter,
03314 int nproperties, const char **properties,
03315 int timeoutms) {
03316
03317 gxHANDLE nullhandle = { 0 };
03318 struct GX_PARM_OPENDEVICEA pr;
03319 int st;
03320
03321 assert(handle);
03322 pr.flags = flags;
03323 if(filter) memcpy(&pr.filter, filter, sizeof(pr.filter));
03324 pr.properties = properties;
03325 pr.nproperties = nproperties;
03326 pr.timeoutms = timeoutms;
03327 st = gx_call(nullhandle, GX_CALL_OPENDEVICEA, &pr);
03328 if(st) {
03329 *handle = pr.handle;
03330 if(info) memcpy(info, &pr.info, sizeof(GX_DEVICE_INFOA));
03331 }
03332 return st;
03333 }
03334
03335 #ifdef __cplusplus
03336
03348 inline int gx_opendevice(gxHANDLE *handle, GX_DEVICE_INFOA *info,
03349 unsigned int flags = 0, GX_DEVICE_INFOA *filter = 0,
03350 int nproperties = 0, const char **properties = 0,
03351 int timeoutms = 0) {
03352
03353 return gx_opendevicea(handle, info, flags, filter,
03354 nproperties, properties, timeoutms);
03355 }
03356 #endif
03357 #endif
03358
03370 inline int gx_opendevice(gxHANDLE *handle, GX_DEVICE_INFO *info,
03371 unsigned int flags GX_DEFARG(0), GX_DEVICE_INFO *filter GX_DEFARG(0),
03372 int nproperties GX_DEFARG(0), const wchar_t **properties GX_DEFARG(0),
03373 int timeoutms GX_DEFARG(0)) {
03374 gxHANDLE nullhandle = { 0 };
03375 struct GX_PARM_OPENDEVICE pr;
03376 int st;
03377
03378 assert(handle);
03379 pr.flags = flags;
03380 if(filter) memcpy(&pr.filter, filter, sizeof(pr.filter));
03381 pr.properties = properties;
03382 pr.nproperties = nproperties;
03383 pr.timeoutms = timeoutms;
03384 st = gx_call(nullhandle, GX_CALL_OPENDEVICE, &pr);
03385 if(st) {
03386 *handle = pr.handle;
03387 if(info) memcpy(info, &pr.info, sizeof(GX_DEVICE_INFO));
03388 }
03389 return st;
03390 }
03391
03392
03401 inline int gx_getsysteminfo(GX_SYSTEM_INFO *info) {
03402 gxHANDLE nullhandle = { 0 };
03403 assert(info);
03404 return gx_call(nullhandle, GX_CALL_GETSYSTEMINFO, info);
03405 }
03406
03407
03409
03410
03411
03412 #endif
03413
03414
03415
03416 #ifdef GX_DOTNET
03417 #pragma managed
03418 #endif
03419
03420 #if !defined(NO_GX_CLASSES) && !defined(ANDROID)
03421
03422
03423
03424
03425
03426 #if !defined(GX_EXT_MODULE) && !defined(__BORLANDC__)
03427
03428 #ifdef GX_UNICODE
03429
03430
03432 #if !defined(GX_DOTNET)
03433 GX_CLASS gxDeviceInfo : private GX_DEVICE_INFO {
03434 #else
03435 GX_CLASS gxDeviceInfo
03436 #ifdef GX_DOTNET
03437 : public System::IDisposable
03438 #endif
03439 {
03440 private:
03441 gxString type;
03442 gxString devname;
03443 unsigned int serial;
03444 int priority;
03445 #endif
03446 public:
03448 inline gxDeviceInfo() {
03449 #if !defined(GX_DOTNET)
03450 memset(static_cast<GX_DEVICE_INFO *>(this), 0, sizeof(GX_DEVICE_INFO));
03451 #else
03452 type = GX_NULLPTR;
03453 devname = GX_NULLPTR;
03454 serial = 0;
03455 priority = 0;
03456 #endif
03457 }
03458
03461 inline gxDeviceInfo(GX_CONST gxDeviceInfo GX_REF_CLASS(src)) {
03462 #if !defined(GX_DOTNET)
03463 memcpy(static_cast<GX_DEVICE_INFO *>(this), static_cast<const GX_DEVICE_INFO *>(&src),
03464 sizeof(GX_DEVICE_INFO));
03465 #else
03466 SetType(src GX_M GetType());
03467 SetName(src GX_M GetName());
03468 SetSerial(src GX_M GetSerial());
03469 SetPriority(src GX_M GetPriority());
03470 #endif
03471 }
03472
03474 inline ~gxDeviceInfo() {
03475 _Dispose();
03476 }
03477
03478 #ifdef GX_DOTNET_20
03479 inline !gxDeviceInfo() {
03480 _Dispose();
03481 }
03482 #else
03483
03484 inline void Dispose(void) {
03485 #ifdef GX_DOTNET
03486 System::GC::SuppressFinalize(this);
03487 #endif
03488 _Dispose();
03490 }
03491 #endif
03492
03493 private:
03494 inline void _Dispose(void) {
03495 #if defined(GX_DOTNET)
03496 type = GX_NULLPTR;
03497 devname = GX_NULLPTR;
03498 #endif
03499 }
03500 public:
03501
03502
03503 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
03504
03505 inline operator GX_DEVICE_INFO *() {
03506 return static_cast<GX_DEVICE_INFO *>(this);
03507 }
03511 inline void SetType(const wchar_t *_type) {
03512 memset(type, 0, sizeof(type));
03513 gx_wcsncpy(type, _type ? _type : L"", sizeof(type)/sizeof(wchar_t));
03514 }
03518 inline void SetName(const wchar_t *_devname) {
03519 memset(devname, 0, sizeof(devname));
03520 gx_wcsncpy(devname, _devname ? _devname : L"", sizeof(devname)/sizeof(wchar_t));
03521 }
03522 #endif
03523
03526 inline void SetSerial(unsigned int _serial) {
03527 serial = _serial;
03528 }
03532 inline void SetPriority(int _priority) {
03533 priority = _priority;
03534 }
03535
03539 inline unsigned int GetSerial(void) GX_CONST {
03540 return serial;
03541 }
03545 inline int GetPriority(void) GX_CONST {
03546 return priority;
03547 }
03548
03552 inline void SetType(gxInStr _type) {
03553 #if !defined(GX_DOTNET)
03554 GX_GETSTRING(__type, _type);
03555 memset(type, 0, sizeof(type));
03556 gx_wcsncpy(type, __type ? __type : L"", sizeof(type)/sizeof(wchar_t));
03557 #else
03558 type = _type;
03559 #endif
03560 }
03561
03565 inline void SetName(gxInStr _devname) {
03566 #if !defined(GX_DOTNET)
03567 GX_GETSTRING(__devname, _devname);
03568 memset(devname, 0, sizeof(devname));
03569 gx_wcsncpy(devname, __devname ? __devname : L"", sizeof(devname)/sizeof(wchar_t));
03570 #else
03571 devname = _devname;
03572 #endif
03573 }
03574
03578 inline gxOutStr GetType(void) GX_CONST {
03579 #if !defined(GX_DOTNET)
03580 wchar_t buffer[1+(sizeof(type)/sizeof(wchar_t))];
03581 memcpy(buffer, type, sizeof(type));
03582 buffer[sizeof(type)/sizeof(wchar_t)] = 0;
03583 return GX_PUTSTRING(buffer);
03584 #else
03585 return type;
03586 #endif
03587 }
03588
03592 inline gxOutStr GetName(void) GX_CONST {
03593 #if !defined(GX_DOTNET)
03594 wchar_t buffer[1+(sizeof(devname)/sizeof(wchar_t))];
03595 memcpy(buffer, devname, sizeof(devname));
03596 buffer[sizeof(devname)/sizeof(wchar_t)] = 0;
03597 return GX_PUTSTRING(buffer);
03598 #else
03599 return devname;
03600 #endif
03601 }
03602 };
03603
03604 #endif
03605
03606
03607
03608 #ifdef GX_ASCII
03609
03611 GX_CLASS gxDeviceInfoA : private GX_DEVICE_INFOA {
03612 public:
03614 inline gxDeviceInfoA() {
03615 memset(static_cast<GX_DEVICE_INFOA *>(this), 0, sizeof(GX_DEVICE_INFOA));
03616 }
03617
03621 inline gxDeviceInfoA(GX_CONST gxDeviceInfoA GX_REF_CLASS(src)) {
03622 memcpy(static_cast<GX_DEVICE_INFOA *>(this), static_cast<const GX_DEVICE_INFOA *>(&src),
03623 sizeof(GX_DEVICE_INFOA));
03624 }
03625
03626 #if !defined(GX_SWIGIF)
03627
03628 inline operator GX_DEVICE_INFOA *() {
03629 return static_cast<GX_DEVICE_INFOA *>(this);
03630 }
03634 inline void SetType(const char *_type) {
03635 memset(type, 0, sizeof(type));
03636 gx_strncpy(type, _type ? _type : "", sizeof(type));
03637 }
03641 inline void SetName(const char *_devname) {
03642 memset(devname, 0, sizeof(devname));
03643 gx_strncpy(devname, _devname ? _devname : "", sizeof(devname));
03644 }
03645 #endif
03646
03650 inline void SetSerial(unsigned int _serial) {
03651 serial = _serial;
03652 }
03656 inline void SetPriority(int _priority) {
03657 priority = _priority;
03658 }
03659
03663 inline unsigned int GetSerial(void) GX_CONST {
03664 return serial;
03665 }
03668 inline int GetPriority(void) GX_CONST {
03669 return priority;
03670 }
03671
03675 inline void SetType(gxInAStr _type) {
03676 GX_GETASTRING(__type, _type);
03677 memset(type, 0, sizeof(type));
03678 gx_strncpy(type, __type ? __type : "", sizeof(type));
03679 }
03680
03684 inline void SetName(gxInAStr _devname) {
03685 GX_GETASTRING(__devname, _devname);
03686 memset(devname, 0, sizeof(devname));
03687 gx_strncpy(devname, __devname ? __devname : "", sizeof(devname));
03688 }
03689
03693 inline gxOutAStr GetType(void) GX_CONST {
03694 char buffer[1+sizeof(type)];
03695 memcpy(buffer, type, sizeof(type));
03696 buffer[sizeof(type)] = 0;
03697 return GX_PUTASTRING(buffer);
03698 }
03699
03703 inline gxOutAStr GetName(void) GX_CONST {
03704 char buffer[1+sizeof(devname)];
03705 memcpy(buffer, devname, sizeof(devname));
03706 buffer[sizeof(devname)] = 0;
03707 return GX_PUTASTRING(buffer);
03708 }
03709 };
03710 #endif
03711
03712 #endif
03713
03714
03715
03716 #ifdef GX_DOTNET
03717
03718 #ifndef GX_EXT_MODULE
03719
03720 GX_CLASS gxException : public System::ApplicationException {
03721 public:
03723 inline gxException();
03724 };
03725 #endif
03726
03728 typedef GX_INDIRECTION1(gx::gxException) gxError;
03729
03730 #else
03731
03732 #ifndef GX_EXT_MODULE
03733
03738 class gxException {
03739 public:
03740
03744 inline int GetErrorCode(void) {
03745 return gx_geterrorcode();
03746 }
03747
03748 #if !defined(GX_SWIGIF)
03749
03755 inline int GetError(int *code, wchar_t *string, int maxlen) {
03756 return gx_geterror(code, string, maxlen);
03757 }
03764 inline int GetError(int *code, char *string, int maxlen) {
03765 return gx_geterrora(code, string, maxlen);
03766 }
03767 #endif
03768 #ifdef GX_UNICODE
03769
03772 inline gxOutStr GetErrorString(void) {
03773 wchar_t errbuf[GX_MAXLEN_ERRVALUE+1];
03774 gx_geterror(0, errbuf, GX_MAXLEN_ERRVALUE);
03775 errbuf[GX_MAXLEN_ERRVALUE] = 0;
03776 return GX_PUTSTRING(errbuf);
03777 }
03778 #endif
03779 #ifdef GX_ASCII
03780
03783 inline gxOutAStr GetErrorStringA(void) {
03784 char errbuf[GX_MAXLEN_ERRVALUE+1];
03785 gx_geterrora(0, errbuf, GX_MAXLEN_ERRVALUE);
03786 errbuf[GX_MAXLEN_ERRVALUE] = 0;
03787 return GX_PUTASTRING(errbuf);
03788 }
03789 #endif
03790 };
03791 #endif
03792
03794 typedef gxException gxError;
03795 #endif
03796
03797 #ifndef GX_EXT_MODULE
03798
03800 GX_CLASS gxSystem {
03801 public:
03802
03803
03804
03805
03806
03807 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
03808
03815 inline static bool SetErrorv(int flags, int code, const wchar_t *format, va_list args) {
03816 return gx_seterrorfv(flags, code, format, args) ? true : false;
03817 }
03824 inline static bool SetErrorv(int code, const wchar_t *format, va_list args) {
03825 return SetErrorv(GX_ERR_FLAG_CLEAR, code, format, args);
03826 }
03833 inline static bool AppendErrorv(int code, const wchar_t *format, va_list args) {
03834 return SetErrorv(GX_ERR_FLAG_APPEND, code, format, args);
03835 }
03842 inline static bool PrependErrorv(int code, const wchar_t *format, va_list args) {
03843 return SetErrorv(GX_ERR_FLAG_PREPEND, code, format, args);
03844 }
03845
03853 inline static bool SetError(int flags, int code, const wchar_t *format, ...) {
03854 va_list args;
03855 va_start(args, format);
03856 bool ret = SetErrorv(flags, code, format, args);
03857 va_end(args);
03858 return ret;
03859 }
03860
03868 inline static bool SetErrorv(int flags, int code, const char *format, va_list args) {
03869 return gx_seterrorafv(flags, code, format, args) ? true : false;
03870 }
03877 inline static bool SetErrorv(int code, const char *format, va_list args) {
03878 return SetErrorv(GX_ERR_FLAG_CLEAR, code, format, args);
03879 }
03886 inline static bool AppendErrorv(int code, const char *format, va_list args) {
03887 return SetErrorv(GX_ERR_FLAG_APPEND, code, format, args);
03888 }
03895 inline static bool PrependErrorv(int code, const char *format, va_list args) {
03896 return SetErrorv(GX_ERR_FLAG_PREPEND, code, format, args);
03897 }
03898
03906 inline static bool SetError(int flags, int code, const char *format, ...) {
03907 va_list args;
03908 va_start(args, format);
03909 bool ret = SetErrorv(flags, code, format, args);
03910 va_end(args);
03911 return ret;
03912 }
03913 #endif
03914
03915 #if !defined(GX_SWIG) && !defined(GX_DOTNET)
03916
03922 inline static bool SetError(int code, const wchar_t *format, ...) {
03923 va_list args;
03924 va_start(args, format);
03925 bool ret = SetErrorv(code, format, args);
03926 va_end(args);
03927 return ret;
03928 }
03935 inline static bool SetError(int code, const char *format, ...) {
03936 va_list args;
03937 va_start(args, format);
03938 bool ret = SetErrorv(code, format, args);
03939 va_end(args);
03940 return ret;
03941 }
03948 inline static bool AppendError(int code, const wchar_t *format, ...) {
03949 va_list args;
03950 va_start(args, format);
03951 bool ret = AppendErrorv(code, format, args);
03952 va_end(args);
03953 return ret;
03954 }
03961 inline static bool AppendError(int code, const char *format, ...) {
03962 va_list args;
03963 va_start(args, format);
03964 bool ret = AppendErrorv(code, format, args);
03965 va_end(args);
03966 return ret;
03967 }
03974 inline static bool PrependError(int code, const wchar_t *format, ...) {
03975 va_list args;
03976 va_start(args, format);
03977 bool ret = PrependErrorv(code, format, args);
03978 va_end(args);
03979 return ret;
03980 }
03987 inline static bool PrependError(int code, const char *format, ...) {
03988 va_list args;
03989 va_start(args, format);
03990 bool ret = PrependErrorv(code, format, args);
03991 va_end(args);
03992 return ret;
03993 }
03994 #endif
03995
03999 inline static bool ClearError(void) {
04000 return gx_clearerror() ? true : false;
04001 }
04002
04007 inline static bool SetError(int code) {
04008 return gx_seterrorf((int)GX_ENUM_PATH(GX_ERROR_FLAGS) GX_ERR_FLAG_CLEAR, code, L"")!=0;
04009 }
04014 inline static bool AppendError(int code) {
04015 return gx_seterrorf((int)GX_ENUM_PATH(GX_ERROR_FLAGS) GX_ERR_FLAG_APPEND, code, L"")!=0;
04016 }
04021 inline static bool PrependError(int code) {
04022 return gx_seterrorf((int)GX_ENUM_PATH(GX_ERROR_FLAGS) GX_ERR_FLAG_PREPEND, code, L"")!=0;
04023 }
04024
04025 #ifdef GX_UNICODE
04026
04033 inline static bool SetError(int flags, int code, gxInStr str) {
04034 GX_GETSTRING(_str, str);
04035 return gx_seterrorf(flags, code, L"%ls", _str) ? true : false;
04036 }
04043 inline static bool SetError(int code, gxInStr str) {
04044 GX_GETSTRING(_str, str);
04045 return gx_seterrorf((int)GX_ENUM_PATH(GX_ERROR_FLAGS) GX_ERR_FLAG_CLEAR, code, L"%ls", _str) ? true : false;
04046 }
04053 inline static bool AppendError(int code, gxInStr str) {
04054 GX_GETSTRING(_str, str);
04055 return gx_seterrorf((int)GX_ENUM_PATH(GX_ERROR_FLAGS) GX_ERR_FLAG_APPEND, code, L"%ls", _str) ? true : false;
04056 }
04063 inline static bool PrependError(int code, gxInStr str) {
04064 GX_GETSTRING(_str, str);
04065 return gx_seterrorf((int)GX_ENUM_PATH(GX_ERROR_FLAGS) GX_ERR_FLAG_PREPEND, code, L"%ls", _str) ? true : false;
04066 }
04067 #endif
04068 #ifdef GX_ASCII
04069
04076 inline static bool SetError(int flags, int code, gxInAStr str) {
04077 GX_GETASTRING(_str, str);
04078 return gx_seterrorf(flags, code, L"%hs", _str) ? true : false;
04079 }
04086 inline static bool SetError(int code, gxInAStr str) {
04087 GX_GETASTRING(_str, str);
04088 return gx_seterrorf(GX_ERR_FLAG_CLEAR, code, L"%hs", _str) ? true : false;
04089 }
04096 inline static bool AppendError(int code, gxInAStr str) {
04097 GX_GETASTRING(_str, str);
04098 return gx_seterrorf(GX_ERR_FLAG_APPEND, code, L"%hs", _str) ? true : false;
04099 }
04106 inline static bool PrependError(int code, gxInAStr str) {
04107 GX_GETASTRING(_str, str);
04108 return gx_seterrorf(GX_ERR_FLAG_PREPEND, code, L"%hs", _str) ? true : false;
04109 }
04110 #endif
04111
04112
04113
04114
04115
04119 inline static int GetErrorCode(void) {
04120 return gx_geterrorcode();
04121 }
04122
04123 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
04124
04130 inline static int GetError(int *code, wchar_t *string, int maxlen) {
04131 return gx_geterror(code, string, maxlen);
04132 }
04139 inline static int GetError(int *code, char *string, int maxlen) {
04140 return gx_geterrora(code, string, maxlen);
04141 }
04142 #endif
04143 #ifdef GX_UNICODE
04144
04147 inline static gxOutStr GetErrorString(void) {
04148 wchar_t errbuf[GX_MAXLEN_ERRVALUE+1];
04149 gx_geterror(0, errbuf, GX_MAXLEN_ERRVALUE);
04150 errbuf[GX_MAXLEN_ERRVALUE] = 0;
04151 #ifndef GX_DOTNET_20
04152 return GX_PUTSTRING(errbuf);
04153 #else
04154 return GX_PUTSTRING(GX_PUTPTR(errbuf));
04155 #endif
04156 }
04157 #endif
04158 #ifdef GX_ASCII
04159
04162 inline static gxOutAStr GetErrorStringA(void) {
04163 char errbuf[GX_MAXLEN_ERRVALUE+1];
04164 gx_geterrora(0, errbuf, GX_MAXLEN_ERRVALUE);
04165 errbuf[GX_MAXLEN_ERRVALUE] = 0;
04166 return GX_PUTASTRING(errbuf);
04167 }
04168 #endif
04169
04170 #if defined(GX_UNICODE) && !defined(GX_DOTNET) && !defined(GX_SWIG) && !defined(__BORLANDC__)
04171
04176 inline static std::vector<gxDeviceInfo> ListDevices(unsigned int flags, gxDeviceInfo GX_REF_CLASS(filter)) gxFuncThrowsError {
04177 const int maxarray = 100;
04178 std::vector<gxDeviceInfo> ret;
04179 GX_DEVICE_INFO *array = (GX_DEVICE_INFO *)malloc(sizeof(GX_DEVICE_INFO)*maxarray);
04180 if(!array) {
04181 SetError(GX_ENOMEM);
04182 gxthrow;
04183 }
04184 int ndevices = maxarray;
04185 int st = gx_listdevices(&ndevices, array, flags, filter);
04186 if(!st) {
04187 free(array);
04188 gxthrow;
04189 }
04190 if(ndevices) {
04191 gxtry {
04192 ret.resize(ndevices);
04193 for(int ix = 0; ix < ndevices; ix++) {
04194 ret[ix].SetType(array[ix].type);
04195 ret[ix].SetName(array[ix].devname);
04196 ret[ix].SetSerial(array[ix].serial);
04197 ret[ix].SetPriority(array[ix].priority);
04198 }
04199 } gxcatch(...) {
04200 free(array);
04201 __gxthrow;
04202 }
04203 }
04204 free(array);
04205 return ret;
04206 }
04207 #endif
04208
04209 #if defined(GX_ASCII) && !defined(GX_SWIG) && !defined(__BORLANDC__)
04210
04215 inline static std::vector<gxDeviceInfoA> ListDevicesA(unsigned int flags, gxDeviceInfoA GX_REF_CLASS(filter)) gxFuncThrowsError {
04216 const int maxarray = 100;
04217 std::vector<gxDeviceInfoA> ret;
04218 GX_DEVICE_INFOA *array = (GX_DEVICE_INFOA *)malloc(sizeof(GX_DEVICE_INFOA)*maxarray);
04219 if(!array) {
04220 SetError(GX_ENOMEM);
04221 gxthrow;
04222 }
04223 int ndevices = maxarray;
04224 int st = gx_listdevicesa(&ndevices, array, flags, filter);
04225 if(!st) {
04226 free(array);
04227 gxthrow;
04228 }
04229 if(ndevices) {
04230 gxtry {
04231 ret.resize(ndevices);
04232 for(int ix = 0; ix < ndevices; ix++) {
04233 ret[ix].SetType(array[ix].type);
04234 ret[ix].SetName(array[ix].devname);
04235 ret[ix].SetSerial(array[ix].serial);
04236 ret[ix].SetPriority(array[ix].priority);
04237 }
04238 } gxcatch(...) {
04239 free(array);
04240 __gxthrow;
04241 }
04242 }
04243 free(array);
04244 return ret;
04245 }
04246 #endif
04247
04248 #if defined(GX_DOTNET)
04249
04254 inline static gxSysArray ListDevices(unsigned int flags, GX_INDIRECTION_GC(gxDeviceInfo, filter)) gxFuncThrowsError {
04255 const int maxarray = 100;
04256 gxSysArray ret = GX_NULLPTR;
04257
04258 GX_DEVICE_INFO *array = (GX_DEVICE_INFO *)malloc(sizeof(GX_DEVICE_INFO)*maxarray);
04259 if(!array) {
04260 SetError((int)GX_ENUM_PATH(GX_ERROR_CODES) GX_ENOMEM);
04261 gxthrow;
04262 }
04263
04264 int ndevices = maxarray;
04265 gx::GX_DEVICE_INFO _filter;
04266 if(filter) {
04267 System::IntPtr wname = System::Runtime::InteropServices::Marshal::StringToBSTR(filter->GetType());
04268 if(wname.ToPointer()) {
04269 gx_wcsncpy(_filter.type, (const wchar_t *)wname.ToPointer(), sizeof(_filter.type)/sizeof(wchar_t));
04270 }
04271 System::Runtime::InteropServices::Marshal::FreeBSTR(wname);
04272 wname = System::Runtime::InteropServices::Marshal::StringToBSTR(filter->GetName());
04273 if(wname.ToPointer()) {
04274 gx_wcsncpy(_filter.devname, (const wchar_t *)wname.ToPointer(), sizeof(_filter.devname)/sizeof(wchar_t));
04275 }
04276 System::Runtime::InteropServices::Marshal::FreeBSTR(wname);
04277 }
04278
04279 int st = gx_listdevices(&ndevices, array, flags, &_filter);
04280 if(!st) {
04281 free(array);
04282 gxthrow;
04283 }
04284
04285 ret = System::Array::CreateInstance(GX_TYPEID(gxDeviceInfo), ndevices);
04286 if(ndevices) {
04287 gxtry {
04288 for(int ix = 0; ix < ndevices; ix++) {
04289 GX_INDIRECTION_GC(gxDeviceInfo, d) = gxnew gxDeviceInfo;
04290 d->SetType(GX_MARSHALPTRTOSTRING2(array[ix].type, sizeof(array[ix].type)/sizeof(wchar_t)));
04291 d->SetName(GX_MARSHALPTRTOSTRING2(array[ix].devname, sizeof(array[ix].devname)/sizeof(wchar_t)));
04292 d->SetSerial(array[ix].serial);
04293 d->SetPriority(array[ix].priority);
04294 ret->SetValue(d, ix);
04295 }
04296 } gxcatch(...) {
04297 __gxthrow;
04298 }
04299 }
04300 free(array);
04301 return ret;
04302 }
04303 #endif
04304
04308 inline static bool PushError(void) gxFuncThrowsError {
04309 bool ret = gx_pusherror() ? true : false;
04310 gxcondthrow(!ret);
04311 return ret;
04312 }
04313
04317 inline static bool PopError(void) gxFuncThrowsError {
04318 bool ret = gx_poperror() ? true : false;
04319 gxcondthrow(!ret);
04320 return ret;
04321 }
04325 inline static int GetSystemInfo(GX_SYSINFO_FLAGS flag) gxFuncThrowsError {
04326 GX_SYSTEM_INFO info;
04327 int ret = 0;
04328 memset(&info,0,sizeof(info));
04329 info.size = sizeof(info);
04330 if (gx_getsysteminfo(&info)) {
04331 switch (flag) {
04332 case GX_ENUM_PATH(GX_SYSINFO_FLAGS) GX_SYSINFO_FLAG_FREEFLOW: ret = info.cm_ff; break;
04333 case GX_ENUM_PATH(GX_SYSINFO_FLAGS) GX_SYSINFO_FLAG_PARKING: ret = info.cm_park; break;
04334 case GX_ENUM_PATH(GX_SYSINFO_FLAGS) GX_SYSINFO_FLAG_ACCR: ret = info.cm_accr ; break;
04335 case GX_ENUM_PATH(GX_SYSINFO_FLAGS) GX_SYSINFO_FLAG_PARKINGLANE: ret = info.cm_pl; break;
04336 case GX_ENUM_PATH(GX_SYSINFO_FLAGS) GX_SYSINFO_FLAG_FACE: ret = info.cm_face; break;
04337 case GX_ENUM_PATH(GX_SYSINFO_FLAGS) GX_SYSINFO_FLAG_PR: ret = info.pr; break;
04338 }
04339 } else {
04340 gxcondthrow(!ret);
04341 }
04342 return ret;
04343 }
04344 };
04345 #endif
04346
04347
04348 #if defined(GX_DOTNET) && !defined(GX_EXT_MODULE)
04349
04350 inline gxException::gxException() : System::ApplicationException(gx::gxSystem::GetErrorString()) {
04351 }
04352 #endif
04353
04354
04355
04356 #ifndef GX_EXT_MODULE
04357
04358 #if !defined(GX_SWIG) && !defined(GX_DOTNET)
04359
04360 class gxPtr {
04361 private:
04362 void *ptr;
04364 public:
04366 inline gxPtr() {
04367 ptr = (void *)0;
04368 }
04369
04373 inline gxPtr(int size) {
04374 ptr = (void *)0;
04375 bool st;
04376 st = Alloc(size);
04377 gxassert(st);
04378 }
04379
04381 inline ~gxPtr() {
04382 _Dispose();
04383 }
04384
04385 private:
04386 inline void _Dispose(void) {
04387 if(ptr) Free();
04388 }
04389 public:
04395 inline bool Realloc(int size) gxFuncThrowsError {
04396 gxassert(size >= 0);
04397 GX_PARM_GLOBALREALLOC gr;
04398 gr.buffer = ptr;
04399 gr.size = size;
04400 gxHANDLE nullhandle = { 0 };
04401 int st = gx_call(nullhandle, GX_CALL_GLOBALREALLOC, &gr);
04402 if(!st) {
04403 gxthrow;
04404 return false;
04405 }
04406 ptr = gr.buffer;
04407 return true;
04408 }
04409
04414 inline bool Alloc(int size) gxFuncThrowsError {
04415 gxassert(size > 0);
04416 return Realloc(size);
04417 }
04418
04419
04423 inline bool Free(void) gxFuncThrowsError {
04424 return Realloc(0);
04425 }
04426
04430 inline int Size(void) const gxFuncThrowsError {
04431 GX_PARM_GLOBALSIZE gs;
04432 gs.buffer = ptr;
04433 gxHANDLE nullhandle = { 0 };
04434 int st = gx_call(nullhandle, GX_CALL_GLOBALSIZE, &gs);
04435 if(!st) {
04436 gxthrow;
04437 return -1;
04438 }
04439 return gs.size;
04440 }
04441
04445 inline void *Ptr(void) const {
04446 return ptr;
04447 }
04448
04452 inline operator void *() const {
04453 return ptr;
04454 }
04455
04459 inline operator const void *() const {
04460 return ptr;
04461 }
04462 };
04463 #endif
04464 #endif
04465
04466
04467
04468
04469
04470 #if !defined(GX_MANUAL)
04471 #if !defined(GX_DOTNET)
04472 #define GX_GETHANDLE(name) gxHANDLE name = *this
04473 #else
04474 #define GX_GETHANDLE(name) gxHANDLE name = { _handle }
04475 #endif
04476 #endif
04477
04478 #ifndef GX_EXT_MODULE
04479
04485 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
04486 class gxHandle : public gxHANDLE {
04487 public:
04493 inline gxHandle(int call_group) {
04494 handle = ((unsigned int)call_group >> 16);
04495 }
04502 inline gxHandle(gxHANDLE GX_REF_CLASS(src)) gxFuncThrowsError {
04503 handle = src.handle;
04504 if(IsValid()) {
04505 if(!gx_refhandle(*this)) {
04506 handle = 0;
04507 gxthrow;
04508 }
04509 }
04510 }
04517 inline gxHandle(gxHandle GX_REF_CLASS(src)) gxFuncThrowsError {
04518 handle = src.handle;
04519 if(IsValid()) {
04520 if(!gx_refhandle(*this)) {
04521 handle = 0;
04522 gxthrow;
04523 }
04524 }
04525 }
04526
04527 #else
04528
04529 GX_CLASS gxHandle
04530 #ifdef GX_DOTNET
04531 : public System::IDisposable
04532 #endif
04533 {
04534
04535 #if !defined(GX_SWIGIF)
04536
04537 #if defined(GX_DOTNET)
04538 #if !defined(GX_MANUAL)
04539 protected:
04540 #ifndef GX_DOTNET_20
04541 __value gxu32 _handle;
04542 #else
04543 gxu32 _handle;
04544 #endif
04545 #endif
04546
04547 public:
04553 inline gxu32 _get_handle(void) GX_CONST {
04554 return _handle;
04555 }
04561 inline void _set_handle(gxu32 ptr) GX_CONST {
04562 _handle = ptr;
04563 }
04564 #endif
04565
04566 #endif
04567
04568 #endif
04569
04570 public:
04574 inline gxHandle() {
04575 #ifndef GX_DOTNET
04576 handle = 0;
04577 #else
04578 _handle = 0;
04579 #endif
04580 }
04585 inline ~gxHandle() {
04586 _Dispose();
04587 }
04588
04589 #ifdef GX_DOTNET_20
04590 inline !gxHandle() {
04591 _Dispose();
04592 }
04593 #else
04594
04595 inline void Dispose(void) {
04596 #ifdef GX_DOTNET
04597 System::GC::SuppressFinalize(this);
04598 #endif
04599 _Dispose();
04601 }
04602 #endif
04603
04604 private:
04605 inline void _Dispose(void) {
04606 Close();
04607 }
04608 public:
04609
04610 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
04611
04616 inline bool Open(const wchar_t *modulename, const wchar_t *groupname = (const wchar_t *)0) gxFuncThrowsError {
04617 gxassert(modulename);
04618 gxassert(!handle);
04619 bool st = gx_openmodule(this, modulename, groupname) ? true : false;
04620 gxcondthrow(!st);
04621 return st;
04622 }
04628 inline bool Open(const char *modulename, const char *groupname = (const char *)0) gxFuncThrowsError {
04629 gxassert(modulename);
04630 gxassert(!handle);
04631 bool st = gx_openmodule(this, modulename, groupname) ? true : false;
04632 gxcondthrow(!st);
04633 return st;
04634 }
04635 #endif
04636
04637 #ifdef GX_UNICODE
04638
04643 inline bool Open(gxInStr modulename, gxInStr groupname) gxFuncThrowsError {
04644 GX_GETSTRING(_modulename, modulename);
04645 GX_GETSTRING(_groupname, groupname);
04646 #ifndef GX_DOTNET
04647 bool st = gx_openmodule(this, _modulename, _groupname) ? true : false;
04648 #else
04649 GX_GETHANDLE(h);
04650 bool st = gx_openmodule(&h, _modulename, _groupname) ? true : false;
04651 if(st) _set_handle(h.handle);
04652 #endif
04653 gxcondthrow(!st);
04654 return st;
04655 }
04660 inline bool Open(gxInStr modulename) gxFuncThrowsError {
04661 GX_GETSTRING(_modulename, modulename);
04662 #ifndef GX_DOTNET
04663 bool st = gx_openmodule(this, _modulename, L"default")!=0;
04664 #else
04665 GX_GETHANDLE(h);
04666 bool st = gx_openmodule(&h, _modulename, L"default")!=0;
04667 if(st) _set_handle(h.handle);
04668 #endif
04669 gxcondthrow(!st);
04670 return st;
04671 }
04672 #endif
04673
04674 #ifdef GX_ASCII
04675
04680 inline bool Open(gxInAStr modulename, gxInAStr groupname) gxFuncThrowsError {
04681 GX_GETASTRING(_modulename, modulename);
04682 GX_GETASTRING(_groupname, groupname);
04683 bool st = gx_openmodulea(this, _modulename, _groupname)!=0;
04684 gxcondthrow(!st);
04685 return st;
04686 }
04691 inline bool Open(gxInAStr modulename) gxFuncThrowsError {
04692 GX_GETASTRING(_modulename, modulename);
04693 bool st = gx_openmodulea(this, _modulename, "default")!=0;
04694 gxcondthrow(!st);
04695 return st;
04696 }
04697 #endif
04698
04705 inline bool Close(void) gxFuncThrowsError {
04706 bool st = IsValid();
04707 if(st) {
04708 #ifndef GX_DOTNET
04709 st = gx_unrefhandle(this) ? true : false;
04710 if(st) handle = 0;
04711 #else
04712 gxHANDLE h = { _handle };
04713 st = gx_unrefhandle(&h) ? true : false;
04714 if(st) _handle = 0;
04715 #endif
04716 gxcondthrow(!st);
04717 }
04718 return true;
04719 }
04720
04724 inline bool IsValid(void) GX_CONST {
04725 if(!this) return false;
04726 #ifndef GX_DOTNET
04727 return handle ? true : false;
04728 #else
04729 return _handle ? true : false;
04730 #endif
04731 }
04732
04733 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
04734
04739 inline bool GetInfo(const gxMODULEINFO **moduleinfo) gxFuncThrowsError {
04740 gxassert(moduleinfo);
04741 bool st = gx_getmoduleinfo(*this, moduleinfo) ? true : false;
04742 gxcondthrow(!st);
04743 return st;
04744 }
04745
04756 inline bool Call(int callcode, void *params) {
04757 return gx_call(*this, callcode, params) ? true : false;
04758 }
04759
04764 inline gxHandle &operator = (gxHANDLE GX_REF_STRUCT(src)) gxFuncThrowsError {
04765 int st = true;
04766 if(src.handle) {
04767 gxHANDLE nullhandle = { 0 };
04768 int st = gx_call(nullhandle, GX_CALL_REFHANDLE, &src);
04769 if(!st) gxthrow;
04770 }
04771 if(st) {
04772 Close();
04773 handle = src.handle;
04774 }
04775 return *this;
04776 }
04781 inline gxHandle &operator = (gxHandle GX_REF_CLASS(src)) {
04782 int st = true;
04783 if(src.handle) {
04784 gxHANDLE nullhandle = { 0 };
04785 int st = gx_call(nullhandle, GX_CALL_REFHANDLE, &src);
04786 if(!st) gxthrow;
04787 }
04788 if(st) {
04789 Close();
04790 handle = src.handle;
04791 }
04792 return *this;
04793 }
04794
04801 inline bool GetProperty(const wchar_t *name, wchar_t *string, int maxlen) gxFuncThrowsError {
04802 bool st = gx_getmoduleproperty(*this, name, string, maxlen) ? true : false;
04803 gxcondthrow(!st);
04804 return st;
04805 }
04806
04807 #if !defined(GX_SWIG) && !defined(NO_GX_STL)
04808
04812 inline std::wstring GetProperty(const wchar_t *name) gxFuncThrowsError {
04813 wchar_t buf[GX_MAXLEN_PROPVALUE+1];
04814 if(!gx_getmoduleproperty(*this, name, buf, GX_MAXLEN_PROPVALUE)) {
04815 gxthrow;
04816 buf[0] = 0;
04817 }
04818 buf[GX_MAXLEN_PROPVALUE] = 0;
04819 return std::wstring(buf);
04820 }
04821 #endif
04822
04829 inline bool GetProperty(const char *name, char *string, int maxlen) gxFuncThrowsError {
04830 bool st = gx_getmoduleproperty(*this, name, string, maxlen) ? true : false;
04831 gxcondthrow(!st);
04832 return st;
04833 }
04834
04835 #if !defined(GX_SWIG) && !defined(NO_GX_STL)
04836
04840 inline std::string GetProperty(const char *name) gxFuncThrowsError {
04841 char buf[GX_MAXLEN_PROPVALUE+1];
04842 if(!gx_getmoduleproperty(*this, name, buf, GX_MAXLEN_PROPVALUE)) {
04843 gxthrow;
04844 buf[0] = 0;
04845 }
04846 buf[GX_MAXLEN_PROPVALUE] = 0;
04847 return std::string(buf);
04848 }
04849 #endif
04850 #endif
04851
04852 #ifdef GX_DOTNET
04853
04863 inline int Call(int callcode, System::IntPtr params) {
04864 gxHANDLE h = { _handle };
04865 return gx_call(h, callcode, params.ToPointer());
04866 }
04867 #endif
04868
04869 #ifdef GX_UNICODE
04870
04874 inline gxOutStr GetProperty(gxInStr name) gxFuncThrowsError {
04875 wchar_t buf[GX_MAXLEN_PROPVALUE+1];
04876 GX_GETSTRING(_name, name);
04877 #ifndef GX_DOTNET
04878 int st = gx_getmoduleproperty(*this, _name, buf, GX_MAXLEN_PROPVALUE);
04879 #else
04880 gxHANDLE h = { _handle };
04881 int st = gx_getmoduleproperty(h, _name, buf, GX_MAXLEN_PROPVALUE);
04882 #endif
04883 if(!st) return GX_PUTSTRING_NONE;
04884 buf[GX_MAXLEN_PROPVALUE] = 0;
04885 return GX_PUTSTRING(buf);
04886 }
04887 #endif
04888
04889 #ifdef GX_ASCII
04890
04894 inline gxOutAStr GetProperty(gxInAStr name) gxFuncThrowsError {
04895 char buf[GX_MAXLEN_PROPVALUE+1];
04896 GX_GETASTRING(_name, name);
04897 int st = gx_getmodulepropertya(*this, _name, buf, GX_MAXLEN_PROPVALUE);
04898 if(!st) return GX_PUTASTRING_NONE;
04899 buf[GX_MAXLEN_PROPVALUE] = 0;
04900 return GX_PUTASTRING(buf);
04901 }
04902 #endif
04903
04904 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
04905
04910 inline bool GetProperty(const wchar_t *name, int *ivalue) gxFuncThrowsError {
04911 bool st = gx_getmodulepropertyint(*this, name, ivalue) ? true : false;
04912 gxcondthrow(!st);
04913 return st;
04914 }
04915
04920 inline int GetPropertyInt(const wchar_t *name) gxFuncThrowsError {
04921 int ret = -1;
04922 if(!gx_getmodulepropertyint(*this, name, &ret)) gxthrow;
04923 return ret;
04924 }
04925 #endif
04926
04927 #ifdef GX_UNICODE
04928
04932 inline int GetPropertyInt(gxInStr name) gxFuncThrowsError {
04933 int ret = -1;
04934 GX_GETSTRING(_name, name);
04935 #ifndef GX_DOTNET
04936 if(!gx_getmodulepropertyint(*this, _name, &ret)) gxthrow;
04937 #else
04938 gxHANDLE h = { _handle };
04939 if(!gx_getmodulepropertyint(h, _name, &ret)) gxthrow;
04940 #endif
04941 return ret;
04942 }
04943 #endif
04944
04945 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
04946
04951 inline bool GetProperty(const char *name, int *ivalue) gxFuncThrowsError {
04952 bool st = gx_getmodulepropertyinta(*this, name, ivalue) ? true : false;
04953 gxcondthrow(!st);
04954 return st;
04955 }
04960 inline int GetPropertyInt(const char *name) gxFuncThrowsError {
04961 int ret = -1;
04962 if(!gx_getmodulepropertyinta(*this, name, &ret)) gxthrow;
04963 return ret;
04964 }
04965 #endif
04966
04967 #ifdef GX_ASCII
04968
04972 inline int GetPropertyInt(gxInAStr name) gxFuncThrowsError {
04973 int ret = -1;
04974 GX_GETASTRING(_name, name);
04975 if(!gx_getmodulepropertyinta(*this, _name, &ret)) gxthrow;
04976 return ret;
04977 }
04978 #endif
04979
04980 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
04981
04986 inline bool GetProperty(const wchar_t *name, double *fvalue) gxFuncThrowsError {
04987 bool st = gx_getmodulepropertyfloat(*this, name, fvalue)!=0;
04988 gxcondthrow(!st);
04989 return st;
04990 }
04995 inline double GetPropertyFloat(const wchar_t *name) gxFuncThrowsError {
04996 double ret = -1;
04997 if(!gx_getmodulepropertyfloat(*this, name, &ret)) gxthrow;
04998 return ret;
04999 }
05000 #endif
05001
05002 #ifdef GX_UNICODE
05003
05007 inline double GetPropertyFloat(gxInStr name) gxFuncThrowsError {
05008 double ret = -1;
05009 GX_GETSTRING(_name, name);
05010 #ifndef GX_DOTNET
05011 if(!gx_getmodulepropertyfloat(*this, _name, &ret)) gxthrow;
05012 #else
05013 gxHANDLE h = { _handle };
05014 if(!gx_getmodulepropertyfloat(h, _name, &ret)) gxthrow;
05015 #endif
05016 return ret;
05017 }
05018 #endif
05019
05020 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
05021
05026 inline bool GetProperty(const char *name, double *fvalue) gxFuncThrowsError {
05027 bool st = gx_getmodulepropertyfloata(*this, name, fvalue) ? true : false;
05028 gxcondthrow(!st);
05029 return st;
05030 }
05035 inline double GetPropertyFloat(const char *name) gxFuncThrowsError {
05036 double ret = -1;
05037 if(!gx_getmodulepropertyfloata(*this, name, &ret)) gxthrow;
05038 return ret;
05039 }
05040 #endif
05041
05042 #ifdef GX_ASCII
05043
05047 inline double GetPropertyFloat(gxInAStr name) gxFuncThrowsError {
05048 double ret = -1;
05049 GX_GETASTRING(_name, name);
05050 if(!gx_getmodulepropertyfloata(*this, _name, &ret)) gxthrow;
05051 return ret;
05052 }
05053 #endif
05054
05055
05056 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
05057
05062 inline bool GetPropertyVersion(const wchar_t *name, unsigned int *version) gxFuncThrowsError {
05063 bool st = gx_getmodulepropertyversion(*this, name, version)!=0;
05064 gxcondthrow(!st);
05065 return st;
05066 }
05067
05072 inline unsigned int GetPropertyVersion(const wchar_t *name) gxFuncThrowsError {
05073 unsigned int ret = 0;
05074 if(!gx_getmodulepropertyversion(*this, name, &ret)) gxthrow;
05075 return ret;
05076 }
05077 #endif
05078
05079 #ifdef GX_UNICODE
05080
05084 inline unsigned int GetPropertyVersion(gxInStr name) gxFuncThrowsError {
05085 unsigned int ret = 0;
05086 GX_GETSTRING(_name, name);
05087 #ifndef GX_DOTNET
05088 if(!gx_getmodulepropertyversion(*this, _name, &ret)) gxthrow;
05089 #else
05090 gxHANDLE h = { _handle };
05091 if(!gx_getmodulepropertyversion(h, _name, &ret)) gxthrow;
05092 #endif
05093 return ret;
05094 }
05095 #endif
05096
05097 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
05098
05103 inline bool GetPropertyVersion(const char *name, unsigned int *version) gxFuncThrowsError {
05104 bool st = gx_getmodulepropertyversiona(*this, name, version) ? true : false;
05105 gxcondthrow(!st);
05106 return st;
05107 }
05108
05113 inline unsigned int GetPropertyVersion(const char *name) gxFuncThrowsError {
05114 unsigned int ret = 0;
05115 if(!gx_getmodulepropertyversiona(*this, name, &ret)) gxthrow;
05116 return ret;
05117 }
05118 #endif
05119
05120 #ifdef GX_ASCII
05121
05125 inline unsigned int GetPropertyVersion(gxInAStr name) gxFuncThrowsError {
05126 unsigned int ret = 0;
05127 GX_GETASTRING(_name, name);
05128 if(!gx_getmodulepropertyversiona(*this, _name, &ret)) gxthrow;
05129 return ret;
05130 }
05131 #endif
05132
05133
05134
05135 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
05136
05141 inline bool SetProperty(const wchar_t *name, const wchar_t *string) gxFuncThrowsError {
05142 bool st = gx_setmoduleproperty(*this, name, string) ? true : false;
05143 gxcondthrow(!st);
05144 return st;
05145 }
05146
05152 inline bool SetProperty(const char *name, const char *string) gxFuncThrowsError {
05153 bool st = gx_setmodulepropertya(*this, name, string) ? true : false;
05154 gxcondthrow(!st);
05155 return st;
05156 }
05157 #endif
05158
05159 #ifdef GX_UNICODE
05160
05165 inline bool SetProperty(gxInStr name, gxInStr str) gxFuncThrowsError {
05166 GX_GETSTRING(_name, name);
05167 GX_GETSTRING(_str, str);
05168 #ifndef GX_DOTNET
05169 bool st = gx_setmoduleproperty(*this, _name, _str) ? true : false;
05170 #else
05171 gxHANDLE h = { _handle };
05172 bool st = gx_setmoduleproperty(h, _name, _str) ? true : false;
05173 #endif
05174 gxcondthrow(!st);
05175 return st;
05176 }
05177 #endif
05178
05179 #ifdef GX_ASCII
05180
05185 inline bool SetProperty(gxInAStr name, gxInAStr str) gxFuncThrowsError {
05186 GX_GETASTRING(_name, name);
05187 GX_GETASTRING(_str, str);
05188 bool st = gx_setmodulepropertya(*this, _name, _str) ? true : false;
05189 gxcondthrow(!st);
05190 return st;
05191 }
05192 #endif
05193
05194 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
05195
05200 inline bool SetProperty(const wchar_t *name, int ivalue) gxFuncThrowsError {
05201 bool st = gx_setmodulepropertyint(*this, name, ivalue) ? true : false;
05202 gxcondthrow(!st);
05203 return st;
05204 }
05205
05211 inline bool SetProperty(const char *name, int ivalue) gxFuncThrowsError {
05212 bool st = gx_setmodulepropertyinta(*this, name, ivalue) ? true : false;
05213 gxcondthrow(!st);
05214 return st;
05215 }
05216 #endif
05217
05218 #ifdef GX_UNICODE
05219
05224 inline bool SetProperty(gxInStr name, int ivalue) gxFuncThrowsError {
05225 GX_GETSTRING(_name, name);
05226 #ifndef GX_DOTNET
05227 bool st = gx_setmodulepropertyint(*this, _name, ivalue) ? true : false;
05228 #else
05229 gxHANDLE h = { _handle };
05230 bool st = gx_setmodulepropertyint(h, _name, ivalue) ? true : false;
05231 #endif
05232 gxcondthrow(!st);
05233 return st;
05234 }
05235 #endif
05236 #ifdef GX_ASCII
05237
05242 inline bool SetProperty(gxInAStr name, int ivalue) gxFuncThrowsError {
05243 GX_GETASTRING(_name, name);
05244 bool st = gx_setmodulepropertyinta(*this, _name, ivalue) ? true : false;
05245 gxcondthrow(!st);
05246 return st;
05247 }
05248 #endif
05249
05250 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
05251
05256 inline bool SetProperty(const wchar_t *name, double fvalue) gxFuncThrowsError {
05257 bool st = gx_setmodulepropertyfloat(*this, name, fvalue) ? true : false;
05258 gxcondthrow(!st);
05259 return st;
05260 }
05261
05267 inline bool SetProperty(const char *name, double fvalue) gxFuncThrowsError {
05268 bool st = gx_setmodulepropertyfloata(*this, name, fvalue) ? true : false;
05269 gxcondthrow(!st);
05270 return st;
05271 }
05272 #endif
05273
05274 #ifdef GX_UNICODE
05275
05280 inline bool SetProperty(gxInStr name, double fvalue) gxFuncThrowsError {
05281 GX_GETSTRING(_name, name);
05282 #ifndef GX_DOTNET
05283 bool st = gx_setmodulepropertyfloat(*this, _name, fvalue) ? true : false;
05284 #else
05285 gxHANDLE h = { _handle };
05286 bool st = gx_setmodulepropertyfloat(h, _name, fvalue) ? true : false;
05287 #endif
05288 gxcondthrow(!st);
05289 return st;
05290 }
05291 #endif
05292
05293 #ifdef GX_ASCII
05294
05299 inline bool SetProperty(gxInAStr name, double fvalue) gxFuncThrowsError {
05300 GX_GETASTRING(_name, name);
05301 bool st = gx_setmodulepropertyfloata(*this, _name, fvalue) ? true : false;
05302 gxcondthrow(!st);
05303 return st;
05304 }
05305 #endif
05306
05307 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
05308
05314 inline bool SaveProperties(const wchar_t *name, int level = 0) gxFuncThrowsError {
05315 bool st = gx_savemoduleproperties(*this, name, level) ? true : false;
05316 gxcondthrow(!st);
05317 return st;
05318 }
05319
05326 inline bool SaveProperties(const char *name, int level = 0) gxFuncThrowsError {
05327 bool st = gx_savemoduleproperties(*this, name, level) ? true : false;
05328 gxcondthrow(!st);
05329 return st;
05330 }
05331 #endif
05332
05333 #ifdef GX_UNICODE
05334
05340 inline bool SaveProperties(gxInStr name, int level) gxFuncThrowsError {
05341 GX_GETSTRING(_name, name);
05342 #ifndef GX_DOTNET
05343 bool st = gx_savemoduleproperties(*this, _name, level) ? true : false;
05344 #else
05345 gxHANDLE h = { _handle };
05346 bool st = gx_savemoduleproperties(h, _name, level) ? true : false;
05347 #endif
05348 gxcondthrow(!st);
05349 return st;
05350 }
05351
05357 inline bool SaveProperties(gxInStr name) gxFuncThrowsError {
05358 GX_GETSTRING(_name, name);
05359 #ifndef GX_DOTNET
05360 bool st = gx_savemoduleproperties(*this, _name, 0) ? true : false;
05361 #else
05362 gxHANDLE h = { _handle };
05363 bool st = gx_savemoduleproperties(h, _name, 0) ? true : false;
05364 #endif
05365 gxcondthrow(!st);
05366 return st;
05367 }
05368 #endif
05369
05370 #ifdef GX_ASCII
05371
05377 inline bool SaveProperties(gxInAStr name, int level = 0) gxFuncThrowsError {
05378 GX_GETASTRING(_name, name);
05379 bool st = gx_savemodulepropertiesa(*this, _name, level) ? true : false;
05380 gxcondthrow(!st);
05381 return st;
05382 }
05383 #endif
05384
05385
05391 inline bool MPStartTransaction(void) {
05392 GX_GETHANDLE(h);
05393 bool st = gx_mpstarttransaction(h) ? true : false;
05394 gxcondthrow(!st);
05395 return st;
05396 }
05397
05398
05402 inline bool MPCommit(void) {
05403 GX_GETHANDLE(h);
05404 bool st = gx_mpcommit(h) ? true : false;
05405 gxcondthrow(!st);
05406 return st;
05407 }
05408
05409 };
05410
05411 #endif
05412
05413 #endif
05414
05415 #ifdef GX_NAMESPACES
05416 }
05417 #endif
05418 #ifdef __BORLANDC__
05419 #pragma warn .rch
05420 #endif
05421 #ifdef _MSC_VER
05422 #pragma warning(default: 4127)
05423 #endif
05424
05425 #endif
05426