00001 00002 00003 00004 00005 // ----------------------------------------------------------------------^ 00006 // Copyright (C) 2004, 2005, 2006, 2007, 2008 Giorgio Calderone 00007 // (mailto: <gcalderone@ifc.inaf.it>) 00008 // 00009 // This file is part of MCS. 00010 // 00011 // MCS is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU General Public License as published by 00013 // the Free Software Foundation; either version 2 of the License, or 00014 // (at your option) any later version. 00015 // 00016 // MCS is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License 00022 // along with MCS; if not, write to the Free Software 00023 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 // 00025 // ----------------------------------------------------------------------$ 00026 00027 #include "mcs.hh" 00028 using namespace mcs; 00029 00030 00031 00032 00033 00034 // ----------------------------------------------------------------------^ 00035 // Copyright (C) 2004, 2005, 2006, 2007, 2008 Giorgio Calderone 00036 // (mailto: <gcalderone@ifc.inaf.it>) 00037 // 00038 // This file is part of MCS. 00039 // 00040 // MCS is free software; you can redistribute it and/or modify 00041 // it under the terms of the GNU General Public License as published by 00042 // the Free Software Foundation; either version 2 of the License, or 00043 // (at your option) any later version. 00044 // 00045 // MCS is distributed in the hope that it will be useful, 00046 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00047 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00048 // GNU General Public License for more details. 00049 // 00050 // You should have received a copy of the GNU General Public License 00051 // along with MCS; if not, write to the Free Software 00052 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00053 // 00054 // ----------------------------------------------------------------------$ 00055 00056 00057 /* 00058 IFD - C/C++ to C Interface Descriptor 00059 Giorgio Calderone - gcalderone@ifc.inaf.it 00060 */ 00061 00062 00063 00064 00065 00066 //Object pointer type 00067 #define IFD_OBJP void* 00068 #define IFD_ERR_LEN 200 00069 00070 00071 00072 00073 struct ifd_status { 00074 int error; 00075 char errormsg[200]; 00076 void* data; 00077 }; 00078 00079 typedef struct ifd_status IFD_STATUS; 00080 00081 //IFD routines 00082 00083 static IFD_STATUS status; 00084 00085 /* 00086 #define IFD_C_WRAP(RETTYPE, FUNCTION, CALL, ARGS...) extern "C" RETTYPE FUNCTION (ARGS) { 00087 return (RETTYPE) CALL; 00088 } 00089 \ 00090 } 00091 00092 00093 //IFD routines 00094 #define IFD_C_WRAP_VOID(FUNCTION, CALL, ARGS...) extern "C" RETTYPE FUNCTION (ARGS) { 00095 CALL; 00096 return; 00097 } 00098 \ 00099 } 00100 */ 00101 00102 extern "C" { 00103 void ifd_reset_error() 00104 { 00105 status.error = 0; 00106 strncpy(status.errormsg, "", 1); 00107 } 00108 00109 //IFD_STATUS* ifd_new_status() 00110 //{ 00111 // IFD_STATUS* ret = (IFD_STATUS*) malloc(sizeof(IFD_STATUS)); 00112 // ifd_reset_error(ret); 00113 // return ret; 00114 //} 00115 00116 //void ifd_del_status(IFD_STATUS* _st) 00117 //{ 00118 // if (_st) 00119 // free(_st); 00120 //} 00121 00122 00123 int ifd_got_error() 00124 { 00125 return (status.error != 0 ? 1 : 0); 00126 } 00127 00128 00129 char* ifd_last_error() 00130 { 00131 return status.errormsg; 00132 } 00133 00134 //void ifd_set_error(char* msg, IFD_STATUS* _st) 00135 //{ 00136 // _st->error = 1; 00137 // strncpy(_st->errormsg, msg, IFD_ERR_LEN); 00138 //} 00139 00140 00141 void* ifd_null() 00142 { 00143 return (void*) 0; 00144 } 00145 } 00146 //extern "C" 00147 00148 00149 #ifdef IFD_EXTRA 00150 #undef IFD_EXTRA 00151 #endif 00152 #define IFD_EXTRA 00153 00154 00155 //-------------------------------------------------------------------- 00156 //Wrapper for Data class 00157 00159 extern "C" void* new_Data (void* dummy ,Types type ,unsigned short int maxLength ,short isunsigned) { 00160 if (status.error) return (void*) 0; 00161 try { 00162 IFD_EXTRA; 00163 Data* This = new Data (type, maxLength, (bool) isunsigned); 00164 return (void*) This; 00165 } 00166 catch(Event e) { 00167 strncpy(status.errormsg, e.msg().c_str(), 200); 00168 } 00169 catch(exception e) { 00170 strncpy(status.errormsg, e.what(), 200); 00171 } 00172 status.error = 1; 00173 return (void*) 0; 00174 }; 00175 00176 00178 extern "C" void* copy_Data (void* obj) { 00179 if (status.error) return (void*) 0; 00180 try { 00181 Data* This = (Data*) obj; 00182 return (void*) new Data(*This); 00183 } 00184 catch(Event e) { 00185 strncpy(status.errormsg, e.msg().c_str(), 200); 00186 } 00187 catch(exception e) { 00188 strncpy(status.errormsg, e.what(), 200); 00189 } 00190 status.error = 1; 00191 return (void*) 0; 00192 }; 00193 00195 extern "C" void del_Data (void* obj) { 00196 if (status.error) return ; 00197 try {; 00198 Data* This = (Data*) obj; 00199 delete This; 00200 return; 00201 } 00202 catch(Event e) { 00203 strncpy(status.errormsg, e.msg().c_str(), 200); 00204 } 00205 catch(exception e) { 00206 strncpy(status.errormsg, e.what(), 200); 00207 } 00208 status.error = 1; 00209 return; 00210 }; 00211 00213 extern "C" char* Data_name (void* obj ) { 00214 if (status.error) return (char*) 0; 00215 try { 00216 Data* This = (Data*) obj; 00217 IFD_EXTRA; 00218 return (char*) This->name().c_str(); 00219 } 00220 catch(Event e) { 00221 strncpy(status.errormsg, e.msg().c_str(), 200); 00222 } 00223 catch(exception e) { 00224 strncpy(status.errormsg, e.what(), 200); 00225 } 00226 status.error = 1; 00227 return (char*) 0; 00228 }; 00229 00230 //IFD_WRAP(unsigned int, Data, flags , This->flags() ); 00231 extern "C" Types Data_type (void* obj ) { 00232 if (status.error) return (Types) 0; 00233 try { 00234 Data* This = (Data*) obj; 00235 IFD_EXTRA; 00236 return (Types) This->type(); 00237 } 00238 catch(Event e) { 00239 strncpy(status.errormsg, e.msg().c_str(), 200); 00240 } 00241 catch(exception e) { 00242 strncpy(status.errormsg, e.what(), 200); 00243 } 00244 status.error = 1; 00245 return (Types) 0; 00246 }; 00247 extern "C" unsigned short int Data_maxLength (void* obj ) { 00248 if (status.error) return (unsigned short int) 0; 00249 try { 00250 Data* This = (Data*) obj; 00251 IFD_EXTRA; 00252 return (unsigned short int) This->maxLength(); 00253 } 00254 catch(Event e) { 00255 strncpy(status.errormsg, e.msg().c_str(), 200); 00256 } 00257 catch(exception e) { 00258 strncpy(status.errormsg, e.what(), 200); 00259 } 00260 status.error = 1; 00261 return (unsigned short int) 0; 00262 }; 00263 extern "C" unsigned short int Data_length (void* obj ) { 00264 if (status.error) return (unsigned short int) 0; 00265 try { 00266 Data* This = (Data*) obj; 00267 IFD_EXTRA; 00268 return (unsigned short int) This->length(); 00269 } 00270 catch(Event e) { 00271 strncpy(status.errormsg, e.msg().c_str(), 200); 00272 } 00273 catch(exception e) { 00274 strncpy(status.errormsg, e.what(), 200); 00275 } 00276 status.error = 1; 00277 return (unsigned short int) 0; 00278 }; 00279 extern "C" short Data_isUnsigned (void* obj ) { 00280 if (status.error) return (short) 0; 00281 try { 00282 Data* This = (Data*) obj; 00283 IFD_EXTRA; 00284 return (short) This->isUnsigned(); 00285 } 00286 catch(Event e) { 00287 strncpy(status.errormsg, e.msg().c_str(), 200); 00288 } 00289 catch(exception e) { 00290 strncpy(status.errormsg, e.what(), 200); 00291 } 00292 status.error = 1; 00293 return (short) 0; 00294 }; 00295 extern "C" short Data_isNull (void* obj ) { 00296 if (status.error) return (short) 0; 00297 try { 00298 Data* This = (Data*) obj; 00299 IFD_EXTRA; 00300 return (short) This->isNull(); 00301 } 00302 catch(Event e) { 00303 strncpy(status.errormsg, e.msg().c_str(), 200); 00304 } 00305 catch(exception e) { 00306 strncpy(status.errormsg, e.what(), 200); 00307 } 00308 status.error = 1; 00309 return (short) 0; 00310 }; 00311 extern "C" int Data_ival (void* obj ) { 00312 if (status.error) return (int) 0; 00313 try { 00314 Data* This = (Data*) obj; 00315 IFD_EXTRA; 00316 return (int) This->ival(); 00317 } 00318 catch(Event e) { 00319 strncpy(status.errormsg, e.msg().c_str(), 200); 00320 } 00321 catch(exception e) { 00322 strncpy(status.errormsg, e.what(), 200); 00323 } 00324 status.error = 1; 00325 return (int) 0; 00326 }; 00327 extern "C" unsigned int Data_uival (void* obj ) { 00328 if (status.error) return (unsigned int) 0; 00329 try { 00330 Data* This = (Data*) obj; 00331 IFD_EXTRA; 00332 return (unsigned int) This->uival(); 00333 } 00334 catch(Event e) { 00335 strncpy(status.errormsg, e.msg().c_str(), 200); 00336 } 00337 catch(exception e) { 00338 strncpy(status.errormsg, e.what(), 200); 00339 } 00340 status.error = 1; 00341 return (unsigned int) 0; 00342 }; 00343 extern "C" long long int Data_lval (void* obj ) { 00344 if (status.error) return (long long int) 0; 00345 try { 00346 Data* This = (Data*) obj; 00347 IFD_EXTRA; 00348 return (long long int) This->lval(); 00349 } 00350 catch(Event e) { 00351 strncpy(status.errormsg, e.msg().c_str(), 200); 00352 } 00353 catch(exception e) { 00354 strncpy(status.errormsg, e.what(), 200); 00355 } 00356 status.error = 1; 00357 return (long long int) 0; 00358 }; 00359 extern "C" unsigned long long int Data_ulval (void* obj ) { 00360 if (status.error) return (unsigned long long int) 0; 00361 try { 00362 Data* This = (Data*) obj; 00363 IFD_EXTRA; 00364 return (unsigned long long int) This->ulval(); 00365 } 00366 catch(Event e) { 00367 strncpy(status.errormsg, e.msg().c_str(), 200); 00368 } 00369 catch(exception e) { 00370 strncpy(status.errormsg, e.what(), 200); 00371 } 00372 status.error = 1; 00373 return (unsigned long long int) 0; 00374 }; 00375 extern "C" float Data_fval (void* obj ) { 00376 if (status.error) return (float) 0; 00377 try { 00378 Data* This = (Data*) obj; 00379 IFD_EXTRA; 00380 return (float) This->fval(); 00381 } 00382 catch(Event e) { 00383 strncpy(status.errormsg, e.msg().c_str(), 200); 00384 } 00385 catch(exception e) { 00386 strncpy(status.errormsg, e.what(), 200); 00387 } 00388 status.error = 1; 00389 return (float) 0; 00390 }; 00391 extern "C" double Data_dval (void* obj ) { 00392 if (status.error) return (double) 0; 00393 try { 00394 Data* This = (Data*) obj; 00395 IFD_EXTRA; 00396 return (double) This->dval(); 00397 } 00398 catch(Event e) { 00399 strncpy(status.errormsg, e.msg().c_str(), 200); 00400 } 00401 catch(exception e) { 00402 strncpy(status.errormsg, e.what(), 200); 00403 } 00404 status.error = 1; 00405 return (double) 0; 00406 }; 00407 extern "C" char* Data_sval (void* obj ) { 00408 if (status.error) return (char*) 0; 00409 try { 00410 Data* This = (Data*) obj; 00411 IFD_EXTRA; 00412 return (char*) This->sval().c_str(); 00413 } 00414 catch(Event e) { 00415 strncpy(status.errormsg, e.msg().c_str(), 200); 00416 } 00417 catch(exception e) { 00418 strncpy(status.errormsg, e.what(), 200); 00419 } 00420 status.error = 1; 00421 return (char*) 0; 00422 }; 00423 extern "C" unsigned int Data_tval (void* obj ) { 00424 if (status.error) return (unsigned int) 0; 00425 try { 00426 Data* This = (Data*) obj; 00427 IFD_EXTRA; 00428 return (unsigned int) This->tval(); 00429 } 00430 catch(Event e) { 00431 strncpy(status.errormsg, e.msg().c_str(), 200); 00432 } 00433 catch(exception e) { 00434 strncpy(status.errormsg, e.what(), 200); 00435 } 00436 status.error = 1; 00437 return (unsigned int) 0; 00438 }; 00439 00440 00441 //IFD_WRAP_VOID( Data, tsval , This->tval(t), ARG(struct tm*, t)); 00442 00443 extern "C" void Data_setNull (void* obj ) { 00444 if (status.error) return ; 00445 try { 00446 Data* This = (Data*) obj; 00447 This->setNull(); 00448 return; 00449 } 00450 catch(Event e) { 00451 strncpy(status.errormsg, e.msg().c_str(), 200); 00452 } 00453 catch(exception e) { 00454 strncpy(status.errormsg, e.what(), 200); 00455 } 00456 status.error = 1; 00457 return; 00458 }; 00459 00460 extern "C" void Data_setival (void* obj ,int val) { 00461 if (status.error) return ; 00462 try { 00463 Data* This = (Data*) obj; 00464 This->setival(val); 00465 return; 00466 } 00467 catch(Event e) { 00468 strncpy(status.errormsg, e.msg().c_str(), 200); 00469 } 00470 catch(exception e) { 00471 strncpy(status.errormsg, e.what(), 200); 00472 } 00473 status.error = 1; 00474 return; 00475 }; 00476 extern "C" void Data_setuival (void* obj ,unsigned int val) { 00477 if (status.error) return ; 00478 try { 00479 Data* This = (Data*) obj; 00480 This->setuival(val); 00481 return; 00482 } 00483 catch(Event e) { 00484 strncpy(status.errormsg, e.msg().c_str(), 200); 00485 } 00486 catch(exception e) { 00487 strncpy(status.errormsg, e.what(), 200); 00488 } 00489 status.error = 1; 00490 return; 00491 }; 00492 00493 extern "C" void Data_setlval (void* obj ,long long int val) { 00494 if (status.error) return ; 00495 try { 00496 Data* This = (Data*) obj; 00497 This->setlval(val); 00498 return; 00499 } 00500 catch(Event e) { 00501 strncpy(status.errormsg, e.msg().c_str(), 200); 00502 } 00503 catch(exception e) { 00504 strncpy(status.errormsg, e.what(), 200); 00505 } 00506 status.error = 1; 00507 return; 00508 }; 00509 extern "C" void Data_setulval (void* obj ,unsigned long long int val) { 00510 if (status.error) return ; 00511 try { 00512 Data* This = (Data*) obj; 00513 This->setulval(val); 00514 return; 00515 } 00516 catch(Event e) { 00517 strncpy(status.errormsg, e.msg().c_str(), 200); 00518 } 00519 catch(exception e) { 00520 strncpy(status.errormsg, e.what(), 200); 00521 } 00522 status.error = 1; 00523 return; 00524 }; 00525 00526 extern "C" void Data_setdval (void* obj ,double val) { 00527 if (status.error) return ; 00528 try { 00529 Data* This = (Data*) obj; 00530 This->setdval(val); 00531 return; 00532 } 00533 catch(Event e) { 00534 strncpy(status.errormsg, e.msg().c_str(), 200); 00535 } 00536 catch(exception e) { 00537 strncpy(status.errormsg, e.what(), 200); 00538 } 00539 status.error = 1; 00540 return; 00541 }; 00542 00543 extern "C" void Data_setsval (void* obj ,char* val) { 00544 if (status.error) return ; 00545 try { 00546 Data* This = (Data*) obj; 00547 This->setsval(val); 00548 return; 00549 } 00550 catch(Event e) { 00551 strncpy(status.errormsg, e.msg().c_str(), 200); 00552 } 00553 catch(exception e) { 00554 strncpy(status.errormsg, e.what(), 200); 00555 } 00556 status.error = 1; 00557 return; 00558 }; 00559 00560 extern "C" void Data_setblob (void* obj ,void* lbuf ,unsigned int size) { 00561 if (status.error) return ; 00562 try { 00563 Data* This = (Data*) obj; 00564 This->setblob(lbuf, size); 00565 return; 00566 } 00567 catch(Event e) { 00568 strncpy(status.errormsg, e.msg().c_str(), 200); 00569 } 00570 catch(exception e) { 00571 strncpy(status.errormsg, e.what(), 200); 00572 } 00573 status.error = 1; 00574 return; 00575 }; 00576 00577 00578 //IFD_WRAP_VOID( Data, settmstrval, This->settimeval(val), 00579 // ARG(struct tm*, val)); 00580 00581 extern "C" void Data_settimeval (void* obj ,unsigned int val) { 00582 if (status.error) return ; 00583 try { 00584 Data* This = (Data*) obj; 00585 This->settimeval(val); 00586 return; 00587 } 00588 catch(Event e) { 00589 strncpy(status.errormsg, e.msg().c_str(), 200); 00590 } 00591 catch(exception e) { 00592 strncpy(status.errormsg, e.what(), 200); 00593 } 00594 status.error = 1; 00595 return; 00596 }; 00597 00598 //IFD_WRAP_VOID( Data, parseTime , This->parseTime(s, ts), 00599 // ARG(char*, s) ARG(struct tm*, ts)); 00600 00601 extern "C" char* Data_print (void* obj ) { 00602 if (status.error) return (char*) 0; 00603 try { 00604 Data* This = (Data*) obj; 00605 IFD_EXTRA; 00606 return (char*) This->print().c_str(); 00607 } 00608 catch(Event e) { 00609 strncpy(status.errormsg, e.msg().c_str(), 200); 00610 } 00611 catch(exception e) { 00612 strncpy(status.errormsg, e.what(), 200); 00613 } 00614 status.error = 1; 00615 return (char*) 0; 00616 }; 00617 00618 extern "C" void Data_setTag (void* obj ,short tag) { 00619 if (status.error) return ; 00620 try { 00621 Data* This = (Data*) obj; 00622 This->setTag(tag); 00623 return; 00624 } 00625 catch(Event e) { 00626 strncpy(status.errormsg, e.msg().c_str(), 200); 00627 } 00628 catch(exception e) { 00629 strncpy(status.errormsg, e.what(), 200); 00630 } 00631 status.error = 1; 00632 return; 00633 }; 00634 00635 extern "C" short Data_getTag (void* obj ) { 00636 if (status.error) return (short) 0; 00637 try { 00638 Data* This = (Data*) obj; 00639 IFD_EXTRA; 00640 return (short) This->getTag(); 00641 } 00642 catch(Event e) { 00643 strncpy(status.errormsg, e.msg().c_str(), 200); 00644 } 00645 catch(exception e) { 00646 strncpy(status.errormsg, e.what(), 200); 00647 } 00648 status.error = 1; 00649 return (short) 0; 00650 }; 00651 00652 00653 00654 00655 00656 00657 //-------------------------------------------------------------------- 00658 //Wrapper for Record class 00659 extern "C" void* new_Record (void* dummy ) { 00660 if (status.error) return (void*) 0; 00661 try { 00662 IFD_EXTRA; 00663 Record* This = new Record (); 00664 return (void*) This; 00665 } 00666 catch(Event e) { 00667 strncpy(status.errormsg, e.msg().c_str(), 200); 00668 } 00669 catch(exception e) { 00670 strncpy(status.errormsg, e.what(), 200); 00671 } 00672 status.error = 1; 00673 return (void*) 0; 00674 }; 00675 00676 extern "C" void del_Record (void* obj) { 00677 if (status.error) return ; 00678 try {; 00679 Record* This = (Record*) obj; 00680 delete This; 00681 return; 00682 } 00683 catch(Event e) { 00684 strncpy(status.errormsg, e.msg().c_str(), 200); 00685 } 00686 catch(exception e) { 00687 strncpy(status.errormsg, e.what(), 200); 00688 } 00689 status.error = 1; 00690 return; 00691 }; 00692 00693 extern "C" void Record_clear (void* obj ) { 00694 if (status.error) return ; 00695 try { 00696 Record* This = (Record*) obj; 00697 This->clear(); 00698 return; 00699 } 00700 catch(Event e) { 00701 strncpy(status.errormsg, e.msg().c_str(), 200); 00702 } 00703 catch(exception e) { 00704 strncpy(status.errormsg, e.what(), 200); 00705 } 00706 status.error = 1; 00707 return; 00708 }; 00709 extern "C" unsigned int Record_count (void* obj ) { 00710 if (status.error) return (unsigned int) 0; 00711 try { 00712 Record* This = (Record*) obj; 00713 IFD_EXTRA; 00714 return (unsigned int) This->count(); 00715 } 00716 catch(Event e) { 00717 strncpy(status.errormsg, e.msg().c_str(), 200); 00718 } 00719 catch(exception e) { 00720 strncpy(status.errormsg, e.what(), 200); 00721 } 00722 status.error = 1; 00723 return (unsigned int) 0; 00724 }; 00725 00726 extern "C" void Record_addField (void* obj ,void* d) { 00727 if (status.error) return ; 00728 try { 00729 Record* This = (Record*) obj; 00730 This->addField(* ((Data*) d)); 00731 return; 00732 } 00733 catch(Event e) { 00734 strncpy(status.errormsg, e.msg().c_str(), 200); 00735 } 00736 catch(exception e) { 00737 strncpy(status.errormsg, e.what(), 200); 00738 } 00739 status.error = 1; 00740 return; 00741 }; 00742 00743 00744 extern "C" void* Record_pop (void* obj ,int x) { 00745 if (status.error) return (void*) 0; 00746 try { 00747 Record* This = (Record*) obj; 00748 IFD_EXTRA; 00749 return (void*) new Data(This->pop(x)); 00750 } 00751 catch(Event e) { 00752 strncpy(status.errormsg, e.msg().c_str(), 200); 00753 } 00754 catch(exception e) { 00755 strncpy(status.errormsg, e.what(), 200); 00756 } 00757 status.error = 1; 00758 return (void*) 0; 00759 }; 00760 00761 extern "C" void* Record_field (void* obj ,int x) { 00762 if (status.error) return (void*) 0; 00763 try { 00764 Record* This = (Record*) obj; 00765 IFD_EXTRA; 00766 return (void*) &(This->operator[](x)); 00767 } 00768 catch(Event e) { 00769 strncpy(status.errormsg, e.msg().c_str(), 200); 00770 } 00771 catch(exception e) { 00772 strncpy(status.errormsg, e.what(), 200); 00773 } 00774 status.error = 1; 00775 return (void*) 0; 00776 }; 00777 00778 extern "C" int Record_posWhoseNameIs (void* obj ,char* name) { 00779 if (status.error) return (int) 0; 00780 try { 00781 Record* This = (Record*) obj; 00782 IFD_EXTRA; 00783 return (int) This->posWhoseNameIs(name); 00784 } 00785 catch(Event e) { 00786 strncpy(status.errormsg, e.msg().c_str(), 200); 00787 } 00788 catch(exception e) { 00789 strncpy(status.errormsg, e.what(), 200); 00790 } 00791 status.error = 1; 00792 return (int) 0; 00793 }; 00794 00795 extern "C" void Record_setFieldMap (void* obj ,char* s) { 00796 if (status.error) return ; 00797 try { 00798 Record* This = (Record*) obj; 00799 This->setFieldMap(s); 00800 return; 00801 } 00802 catch(Event e) { 00803 strncpy(status.errormsg, e.msg().c_str(), 200); 00804 } 00805 catch(exception e) { 00806 strncpy(status.errormsg, e.what(), 200); 00807 } 00808 status.error = 1; 00809 return; 00810 }; 00811 00812 00813 00814 00815 //-------------------------------------------------------------------- 00816 //Wrapper for RecordSet class 00817 extern "C" short RecordSet_setFirst (void* obj ) { 00818 if (status.error) return (short) 0; 00819 try { 00820 RecordSet* This = (RecordSet*) obj; 00821 IFD_EXTRA; 00822 return (short) This->setFirst(); 00823 } 00824 catch(Event e) { 00825 strncpy(status.errormsg, e.msg().c_str(), 200); 00826 } 00827 catch(exception e) { 00828 strncpy(status.errormsg, e.what(), 200); 00829 } 00830 status.error = 1; 00831 return (short) 0; 00832 }; 00833 extern "C" short RecordSet_setLast (void* obj ) { 00834 if (status.error) return (short) 0; 00835 try { 00836 RecordSet* This = (RecordSet*) obj; 00837 IFD_EXTRA; 00838 return (short) This->setLast(); 00839 } 00840 catch(Event e) { 00841 strncpy(status.errormsg, e.msg().c_str(), 200); 00842 } 00843 catch(exception e) { 00844 strncpy(status.errormsg, e.what(), 200); 00845 } 00846 status.error = 1; 00847 return (short) 0; 00848 }; 00849 extern "C" short RecordSet_setNext (void* obj ) { 00850 if (status.error) return (short) 0; 00851 try { 00852 RecordSet* This = (RecordSet*) obj; 00853 IFD_EXTRA; 00854 return (short) This->setNext(); 00855 } 00856 catch(Event e) { 00857 strncpy(status.errormsg, e.msg().c_str(), 200); 00858 } 00859 catch(exception e) { 00860 strncpy(status.errormsg, e.what(), 200); 00861 } 00862 status.error = 1; 00863 return (short) 0; 00864 }; 00865 extern "C" short RecordSet_setPrev (void* obj ) { 00866 if (status.error) return (short) 0; 00867 try { 00868 RecordSet* This = (RecordSet*) obj; 00869 IFD_EXTRA; 00870 return (short) This->setPrev(); 00871 } 00872 catch(Event e) { 00873 strncpy(status.errormsg, e.msg().c_str(), 200); 00874 } 00875 catch(exception e) { 00876 strncpy(status.errormsg, e.what(), 200); 00877 } 00878 status.error = 1; 00879 return (short) 0; 00880 }; 00881 extern "C" short RecordSet_setWhereS (void* obj ,unsigned int field ,char* where) { 00882 if (status.error) return (short) 0; 00883 try { 00884 RecordSet* This = (RecordSet*) obj; 00885 IFD_EXTRA; 00886 return (short) This->setWhere(field, where); 00887 } 00888 catch(Event e) { 00889 strncpy(status.errormsg, e.msg().c_str(), 200); 00890 } 00891 catch(exception e) { 00892 strncpy(status.errormsg, e.what(), 200); 00893 } 00894 status.error = 1; 00895 return (short) 0; 00896 }; 00897 00898 00899 extern "C" short RecordSet_setWhereI (void* obj ,unsigned int field ,int where) { 00900 if (status.error) return (short) 0; 00901 try { 00902 RecordSet* This = (RecordSet*) obj; 00903 IFD_EXTRA; 00904 return (short) This->setWhere(field, where); 00905 } 00906 catch(Event e) { 00907 strncpy(status.errormsg, e.msg().c_str(), 200); 00908 } 00909 catch(exception e) { 00910 strncpy(status.errormsg, e.what(), 200); 00911 } 00912 status.error = 1; 00913 return (short) 0; 00914 }; 00915 00916 00917 extern "C" short RecordSet_setPos (void* obj ,unsigned int newpos) { 00918 if (status.error) return (short) 0; 00919 try { 00920 RecordSet* This = (RecordSet*) obj; 00921 IFD_EXTRA; 00922 return (short) This->setPos(newpos); 00923 } 00924 catch(Event e) { 00925 strncpy(status.errormsg, e.msg().c_str(), 200); 00926 } 00927 catch(exception e) { 00928 strncpy(status.errormsg, e.what(), 200); 00929 } 00930 status.error = 1; 00931 return (short) 0; 00932 }; 00933 00934 extern "C" void RecordSet_dump (void* obj ,char* fn) { 00935 if (status.error) return ; 00936 try { 00937 RecordSet* This = (RecordSet*) obj; 00938 This->dump(fn); 00939 return; 00940 } 00941 catch(Event e) { 00942 strncpy(status.errormsg, e.msg().c_str(), 200); 00943 } 00944 catch(exception e) { 00945 strncpy(status.errormsg, e.what(), 200); 00946 } 00947 status.error = 1; 00948 return; 00949 }; 00950 00951 extern "C" short RecordSet_know_nRows (void* obj ) { 00952 if (status.error) return (short) 0; 00953 try { 00954 RecordSet* This = (RecordSet*) obj; 00955 IFD_EXTRA; 00956 return (short) This->know_nRows(); 00957 } 00958 catch(Event e) { 00959 strncpy(status.errormsg, e.msg().c_str(), 200); 00960 } 00961 catch(exception e) { 00962 strncpy(status.errormsg, e.what(), 200); 00963 } 00964 status.error = 1; 00965 return (short) 0; 00966 }; 00967 extern "C" short RecordSet_eof (void* obj ) { 00968 if (status.error) return (short) 0; 00969 try { 00970 RecordSet* This = (RecordSet*) obj; 00971 IFD_EXTRA; 00972 return (short) This->eof(); 00973 } 00974 catch(Event e) { 00975 strncpy(status.errormsg, e.msg().c_str(), 200); 00976 } 00977 catch(exception e) { 00978 strncpy(status.errormsg, e.what(), 200); 00979 } 00980 status.error = 1; 00981 return (short) 0; 00982 }; 00983 extern "C" short RecordSet_alwaysSameStructure (void* obj ) { 00984 if (status.error) return (short) 0; 00985 try { 00986 RecordSet* This = (RecordSet*) obj; 00987 IFD_EXTRA; 00988 return (short) This->alwaysSameStructure(); 00989 } 00990 catch(Event e) { 00991 strncpy(status.errormsg, e.msg().c_str(), 200); 00992 } 00993 catch(exception e) { 00994 strncpy(status.errormsg, e.what(), 200); 00995 } 00996 status.error = 1; 00997 return (short) 0; 00998 }; 00999 01000 extern "C" unsigned int RecordSet_nRows (void* obj ) { 01001 if (status.error) return (unsigned int) 0; 01002 try { 01003 RecordSet* This = (RecordSet*) obj; 01004 IFD_EXTRA; 01005 return (unsigned int) This->nRows(); 01006 } 01007 catch(Event e) { 01008 strncpy(status.errormsg, e.msg().c_str(), 200); 01009 } 01010 catch(exception e) { 01011 strncpy(status.errormsg, e.what(), 200); 01012 } 01013 status.error = 1; 01014 return (unsigned int) 0; 01015 }; 01016 extern "C" unsigned int RecordSet_nFields (void* obj ) { 01017 if (status.error) return (unsigned int) 0; 01018 try { 01019 RecordSet* This = (RecordSet*) obj; 01020 IFD_EXTRA; 01021 return (unsigned int) This->nFields(); 01022 } 01023 catch(Event e) { 01024 strncpy(status.errormsg, e.msg().c_str(), 200); 01025 } 01026 catch(exception e) { 01027 strncpy(status.errormsg, e.what(), 200); 01028 } 01029 status.error = 1; 01030 return (unsigned int) 0; 01031 }; 01032 extern "C" unsigned int RecordSet_pos (void* obj ) { 01033 if (status.error) return (unsigned int) 0; 01034 try { 01035 RecordSet* This = (RecordSet*) obj; 01036 IFD_EXTRA; 01037 return (unsigned int) This->pos(); 01038 } 01039 catch(Event e) { 01040 strncpy(status.errormsg, e.msg().c_str(), 200); 01041 } 01042 catch(exception e) { 01043 strncpy(status.errormsg, e.what(), 200); 01044 } 01045 status.error = 1; 01046 return (unsigned int) 0; 01047 }; 01048 extern "C" void* RecordSet_rec (void* obj ) { 01049 if (status.error) return (void*) 0; 01050 try { 01051 RecordSet* This = (RecordSet*) obj; 01052 IFD_EXTRA; 01053 return (void*) &(This->rec()); 01054 } 01055 catch(Event e) { 01056 strncpy(status.errormsg, e.msg().c_str(), 200); 01057 } 01058 catch(exception e) { 01059 strncpy(status.errormsg, e.what(), 200); 01060 } 01061 status.error = 1; 01062 return (void*) 0; 01063 }; 01064 extern "C" void* RecordSet_metarec (void* obj ) { 01065 if (status.error) return (void*) 0; 01066 try { 01067 RecordSet* This = (RecordSet*) obj; 01068 IFD_EXTRA; 01069 return (void*) &(This->metarec()); 01070 } 01071 catch(Event e) { 01072 strncpy(status.errormsg, e.msg().c_str(), 200); 01073 } 01074 catch(exception e) { 01075 strncpy(status.errormsg, e.what(), 200); 01076 } 01077 status.error = 1; 01078 return (void*) 0; 01079 }; 01080 01081 01082 01083 01084 01085 01086 //-------------------------------------------------------------------- 01087 //Wrapper for DBConn, Query, Table classes 01088 01089 #if ENABLE_MYSQL 01090 extern "C" void* new_DBConn (void* dummy ) { 01091 if (status.error) return (void*) 0; 01092 try { 01093 IFD_EXTRA; 01094 DBConn* This = new DBConn (); 01095 return (void*) This; 01096 } 01097 catch(Event e) { 01098 strncpy(status.errormsg, e.msg().c_str(), 200); 01099 } 01100 catch(exception e) { 01101 strncpy(status.errormsg, e.what(), 200); 01102 } 01103 status.error = 1; 01104 return (void*) 0; 01105 }; 01106 01107 extern "C" void del_DBConn (void* obj) { 01108 if (status.error) return ; 01109 try {; 01110 DBConn* This = (DBConn*) obj; 01111 delete This; 01112 return; 01113 } 01114 catch(Event e) { 01115 strncpy(status.errormsg, e.msg().c_str(), 200); 01116 } 01117 catch(exception e) { 01118 strncpy(status.errormsg, e.what(), 200); 01119 } 01120 status.error = 1; 01121 return; 01122 }; 01123 01124 extern "C" void DBConn_connect (void* obj ,char* user ,char* pass ,char* db ,char* host) { 01125 if (status.error) return ; 01126 try { 01127 DBConn* This = (DBConn*) obj; 01128 This->connect(user, pass, db , host); 01129 return; 01130 } 01131 catch(Event e) { 01132 strncpy(status.errormsg, e.msg().c_str(), 200); 01133 } 01134 catch(exception e) { 01135 strncpy(status.errormsg, e.what(), 200); 01136 } 01137 status.error = 1; 01138 return; 01139 }; 01140 01141 01142 01143 01144 01145 extern "C" void DBConn_close (void* obj ) { 01146 if (status.error) return ; 01147 try { 01148 DBConn* This = (DBConn*) obj; 01149 This->close(); 01150 return; 01151 } 01152 catch(Event e) { 01153 strncpy(status.errormsg, e.msg().c_str(), 200); 01154 } 01155 catch(exception e) { 01156 strncpy(status.errormsg, e.what(), 200); 01157 } 01158 status.error = 1; 01159 return; 01160 }; 01161 extern "C" short DBConn_isOpen (void* obj ) { 01162 if (status.error) return (short) 0; 01163 try { 01164 DBConn* This = (DBConn*) obj; 01165 IFD_EXTRA; 01166 return (short) This->isOpen(); 01167 } 01168 catch(Event e) { 01169 strncpy(status.errormsg, e.msg().c_str(), 200); 01170 } 01171 catch(exception e) { 01172 strncpy(status.errormsg, e.what(), 200); 01173 } 01174 status.error = 1; 01175 return (short) 0; 01176 }; 01177 extern "C" void* DBConn_newDBConn (void* obj ) { 01178 if (status.error) return (void*) 0; 01179 try { 01180 DBConn* This = (DBConn*) obj; 01181 IFD_EXTRA; 01182 return (void*) This->newDBConn(); 01183 } 01184 catch(Event e) { 01185 strncpy(status.errormsg, e.msg().c_str(), 200); 01186 } 01187 catch(exception e) { 01188 strncpy(status.errormsg, e.what(), 200); 01189 } 01190 status.error = 1; 01191 return (void*) 0; 01192 }; 01193 01194 01195 01196 01197 01198 extern "C" void* new_Query (void* dummy ,void* lconn ,short handleNewDBConn) { 01199 if (status.error) return (void*) 0; 01200 try { 01201 IFD_EXTRA; 01202 Query* This = new Query ((DBConn*) lconn, (bool) handleNewDBConn); 01203 return (void*) This; 01204 } 01205 catch(Event e) { 01206 strncpy(status.errormsg, e.msg().c_str(), 200); 01207 } 01208 catch(exception e) { 01209 strncpy(status.errormsg, e.what(), 200); 01210 } 01211 status.error = 1; 01212 return (void*) 0; 01213 }; 01214 01215 01216 01217 extern "C" void del_Query (void* obj) { 01218 if (status.error) return ; 01219 try {; 01220 Query* This = (Query*) obj; 01221 delete This; 01222 return; 01223 } 01224 catch(Event e) { 01225 strncpy(status.errormsg, e.msg().c_str(), 200); 01226 } 01227 catch(exception e) { 01228 strncpy(status.errormsg, e.what(), 200); 01229 } 01230 status.error = 1; 01231 return; 01232 }; 01233 01234 01235 extern "C" void Query_query (void* obj ,char* query ,short StoreResult) { 01236 if (status.error) return ; 01237 try { 01238 Query* This = (Query*) obj; 01239 This->query(query, (bool) StoreResult); 01240 return; 01241 } 01242 catch(Event e) { 01243 strncpy(status.errormsg, e.msg().c_str(), 200); 01244 } 01245 catch(exception e) { 01246 strncpy(status.errormsg, e.what(), 200); 01247 } 01248 status.error = 1; 01249 return; 01250 }; 01251 01252 01253 extern "C" void Query_prepare (void* obj ,char* query) { 01254 if (status.error) return ; 01255 try { 01256 Query* This = (Query*) obj; 01257 This->prepare(query); 01258 return; 01259 } 01260 catch(Event e) { 01261 strncpy(status.errormsg, e.msg().c_str(), 200); 01262 } 01263 catch(exception e) { 01264 strncpy(status.errormsg, e.what(), 200); 01265 } 01266 status.error = 1; 01267 return; 01268 }; 01269 01270 01271 extern "C" void Query_prepare_with_parameters (void* obj ,int op ,char* fields ,char* table ,char* where) { 01272 if (status.error) return ; 01273 try { 01274 Query* This = (Query*) obj; 01275 This->prepare_with_parameters(op, string(fields), table, where); 01276 return; 01277 } 01278 catch(Event e) { 01279 strncpy(status.errormsg, e.msg().c_str(), 200); 01280 } 01281 catch(exception e) { 01282 strncpy(status.errormsg, e.what(), 200); 01283 } 01284 status.error = 1; 01285 return; 01286 }; 01287 01288 01289 01290 01291 01292 extern "C" unsigned int Query_nAffectedRows (void* obj ) { 01293 if (status.error) return (unsigned int) 0; 01294 try { 01295 Query* This = (Query*) obj; 01296 IFD_EXTRA; 01297 return (unsigned int) This->nAffectedRows(); 01298 } 01299 catch(Event e) { 01300 strncpy(status.errormsg, e.msg().c_str(), 200); 01301 } 01302 catch(exception e) { 01303 strncpy(status.errormsg, e.what(), 200); 01304 } 01305 status.error = 1; 01306 return (unsigned int) 0; 01307 }; 01308 01309 extern "C" void* Query_param (void* obj ) { 01310 if (status.error) return (void*) 0; 01311 try { 01312 Query* This = (Query*) obj; 01313 IFD_EXTRA; 01314 return (void*) &(This->param()); 01315 } 01316 catch(Event e) { 01317 strncpy(status.errormsg, e.msg().c_str(), 200); 01318 } 01319 catch(exception e) { 01320 strncpy(status.errormsg, e.what(), 200); 01321 } 01322 status.error = 1; 01323 return (void*) 0; 01324 }; 01325 01326 extern "C" void* Query_lookup (void* obj ,char* field ,char* table ,char* where) { 01327 if (status.error) return (void*) 0; 01328 try { 01329 Query* This = (Query*) obj; 01330 IFD_EXTRA; 01331 return (void*) &(This->lookup(field, table, where)); 01332 } 01333 catch(Event e) { 01334 strncpy(status.errormsg, e.msg().c_str(), 200); 01335 } 01336 catch(exception e) { 01337 strncpy(status.errormsg, e.what(), 200); 01338 } 01339 status.error = 1; 01340 return (void*) 0; 01341 }; 01342 01343 01344 //IFD_WRAP(short, Query, resultRows, This->resultRows()); 01345 01346 extern "C" short Query_gotRecordSet (void* obj ) { 01347 if (status.error) return (short) 0; 01348 try { 01349 Query* This = (Query*) obj; 01350 IFD_EXTRA; 01351 return (short) This->gotRecordSet(); 01352 } 01353 catch(Event e) { 01354 strncpy(status.errormsg, e.msg().c_str(), 200); 01355 } 01356 catch(exception e) { 01357 strncpy(status.errormsg, e.what(), 200); 01358 } 01359 status.error = 1; 01360 return (short) 0; 01361 }; 01362 01363 extern "C" void Query_execute (void* obj ,short StoreResult) { 01364 if (status.error) return ; 01365 try { 01366 Query* This = (Query*) obj; 01367 This->execute(StoreResult); 01368 return; 01369 } 01370 catch(Event e) { 01371 strncpy(status.errormsg, e.msg().c_str(), 200); 01372 } 01373 catch(exception e) { 01374 strncpy(status.errormsg, e.what(), 200); 01375 } 01376 status.error = 1; 01377 return; 01378 }; 01379 01380 01381 01382 extern "C" void Query_close (void* obj ) { 01383 if (status.error) return ; 01384 try { 01385 Query* This = (Query*) obj; 01386 This->close(); 01387 return; 01388 } 01389 catch(Event e) { 01390 strncpy(status.errormsg, e.msg().c_str(), 200); 01391 } 01392 catch(exception e) { 01393 strncpy(status.errormsg, e.what(), 200); 01394 } 01395 status.error = 1; 01396 return; 01397 }; 01398 01399 01400 01401 01402 01403 01404 #undef IFD_EXTRA 01405 #define IFD_EXTRA DBConn* conn = (DBConn*) lconn; 01406 extern "C" void* new_Table (void* dummy ,void* lconn ,char* table ,char* fieldkey) { 01407 if (status.error) return (void*) 0; 01408 try { 01409 IFD_EXTRA; 01410 Table* This = new Table (conn, table, fieldkey); 01411 return (void*) This; 01412 } 01413 catch(Event e) { 01414 strncpy(status.errormsg, e.msg().c_str(), 200); 01415 } 01416 catch(exception e) { 01417 strncpy(status.errormsg, e.what(), 200); 01418 } 01419 status.error = 1; 01420 return (void*) 0; 01421 }; 01422 01423 #undef IFD_EXTRA 01424 #define IFD_EXTRA 01425 01426 extern "C" void del_Table (void* obj) { 01427 if (status.error) return ; 01428 try {; 01429 Table* This = (Table*) obj; 01430 delete This; 01431 return; 01432 } 01433 catch(Event e) { 01434 strncpy(status.errormsg, e.msg().c_str(), 200); 01435 } 01436 catch(exception e) { 01437 strncpy(status.errormsg, e.what(), 200); 01438 } 01439 status.error = 1; 01440 return; 01441 }; 01442 01443 extern "C" void Table_loadTable (void* obj ) { 01444 if (status.error) return ; 01445 try { 01446 Table* This = (Table*) obj; 01447 This->loadTable(); 01448 return; 01449 } 01450 catch(Event e) { 01451 strncpy(status.errormsg, e.msg().c_str(), 200); 01452 } 01453 catch(exception e) { 01454 strncpy(status.errormsg, e.what(), 200); 01455 } 01456 status.error = 1; 01457 return; 01458 }; 01459 01460 extern "C" void* Table_newRec (void* obj ) { 01461 if (status.error) return (void*) 0; 01462 try { 01463 Table* This = (Table*) obj; 01464 IFD_EXTRA; 01465 return (void*) &(This->newRec()); 01466 } 01467 catch(Event e) { 01468 strncpy(status.errormsg, e.msg().c_str(), 200); 01469 } 01470 catch(exception e) { 01471 strncpy(status.errormsg, e.what(), 200); 01472 } 01473 status.error = 1; 01474 return (void*) 0; 01475 }; 01476 01477 extern "C" void Table_insert (void* obj ) { 01478 if (status.error) return ; 01479 try { 01480 Table* This = (Table*) obj; 01481 This->insert(); 01482 return; 01483 } 01484 catch(Event e) { 01485 strncpy(status.errormsg, e.msg().c_str(), 200); 01486 } 01487 catch(exception e) { 01488 strncpy(status.errormsg, e.what(), 200); 01489 } 01490 status.error = 1; 01491 return; 01492 }; 01493 extern "C" void Table_update (void* obj ) { 01494 if (status.error) return ; 01495 try { 01496 Table* This = (Table*) obj; 01497 This->update(); 01498 return; 01499 } 01500 catch(Event e) { 01501 strncpy(status.errormsg, e.msg().c_str(), 200); 01502 } 01503 catch(exception e) { 01504 strncpy(status.errormsg, e.what(), 200); 01505 } 01506 status.error = 1; 01507 return; 01508 }; 01509 #endif //ENABLE_MYSQL 01510 01511 01512 01513 01514 //-------------------------------------------------------------------- 01515 //Wrapper for Client class 01516 extern "C" void* new_Client (void* dummy ,char* path ,char* server ,int port ,int ssl ,unsigned int timeout) { 01517 if (status.error) return (void*) 0; 01518 try { 01519 IFD_EXTRA; 01520 Client* This = new Client (path, server, port, false, ssl, timeout); 01521 return (void*) This; 01522 } 01523 catch(Event e) { 01524 strncpy(status.errormsg, e.msg().c_str(), 200); 01525 } 01526 catch(exception e) { 01527 strncpy(status.errormsg, e.what(), 200); 01528 } 01529 status.error = 1; 01530 return (void*) 0; 01531 }; 01532 01533 01534 01535 extern "C" void del_Client (void* obj) { 01536 if (status.error) return ; 01537 try {; 01538 Client* This = (Client*) obj; 01539 delete This; 01540 return; 01541 } 01542 catch(Event e) { 01543 strncpy(status.errormsg, e.msg().c_str(), 200); 01544 } 01545 catch(exception e) { 01546 strncpy(status.errormsg, e.what(), 200); 01547 } 01548 status.error = 1; 01549 return; 01550 }; 01551 01552 extern "C" short Client_login (void* obj ,char* user ,char* pass ,char* db) { 01553 if (status.error) return (short) 0; 01554 try { 01555 Client* This = (Client*) obj; 01556 IFD_EXTRA; 01557 return (short) This->login(user, pass, db); 01558 } 01559 catch(Event e) { 01560 strncpy(status.errormsg, e.msg().c_str(), 200); 01561 } 01562 catch(exception e) { 01563 strncpy(status.errormsg, e.what(), 200); 01564 } 01565 status.error = 1; 01566 return (short) 0; 01567 }; 01568 01569 01570 extern "C" short Client_exec (void* obj ,char* cmd ,void* data) { 01571 if (status.error) return (short) 0; 01572 try { 01573 Client* This = (Client*) obj; 01574 IFD_EXTRA; 01575 return (short) This->exec(cmd, (Data*) data); 01576 } 01577 catch(Event e) { 01578 strncpy(status.errormsg, e.msg().c_str(), 200); 01579 } 01580 catch(exception e) { 01581 strncpy(status.errormsg, e.what(), 200); 01582 } 01583 status.error = 1; 01584 return (short) 0; 01585 }; 01586 01587 01588 01589 01590 extern "C" void* Client_code (void* obj ) { 01591 if (status.error) return (void*) 0; 01592 try { 01593 Client* This = (Client*) obj; 01594 IFD_EXTRA; 01595 return (void*) &(This->code); 01596 } 01597 catch(Event e) { 01598 strncpy(status.errormsg, e.msg().c_str(), 200); 01599 } 01600 catch(exception e) { 01601 strncpy(status.errormsg, e.what(), 200); 01602 } 01603 status.error = 1; 01604 return (void*) 0; 01605 }; 01606 01607 extern "C" void* Client_msg (void* obj ) { 01608 if (status.error) return (void*) 0; 01609 try { 01610 Client* This = (Client*) obj; 01611 IFD_EXTRA; 01612 return (void*) &(This->msg); 01613 } 01614 catch(Event e) { 01615 strncpy(status.errormsg, e.msg().c_str(), 200); 01616 } 01617 catch(exception e) { 01618 strncpy(status.errormsg, e.what(), 200); 01619 } 01620 status.error = 1; 01621 return (void*) 0; 01622 }; 01623 01624 extern "C" void* Client_out (void* obj ) { 01625 if (status.error) return (void*) 0; 01626 try { 01627 Client* This = (Client*) obj; 01628 IFD_EXTRA; 01629 return (void*) &(This->out); 01630 } 01631 catch(Event e) { 01632 strncpy(status.errormsg, e.msg().c_str(), 200); 01633 } 01634 catch(exception e) { 01635 strncpy(status.errormsg, e.what(), 200); 01636 } 01637 status.error = 1; 01638 return (void*) 0; 01639 }; 01640 01641 extern "C" void* Client_recv (void* obj ) { 01642 if (status.error) return (void*) 0; 01643 try { 01644 Client* This = (Client*) obj; 01645 IFD_EXTRA; 01646 return (void*) &(This->recv); 01647 } 01648 catch(Event e) { 01649 strncpy(status.errormsg, e.msg().c_str(), 200); 01650 } 01651 catch(exception e) { 01652 strncpy(status.errormsg, e.what(), 200); 01653 } 01654 status.error = 1; 01655 return (void*) 0; 01656 }; 01657 01658 extern "C" void* Client_aux (void* obj ) { 01659 if (status.error) return (void*) 0; 01660 try { 01661 Client* This = (Client*) obj; 01662 IFD_EXTRA; 01663 return (void*) &(This->aux); 01664 } 01665 catch(Event e) { 01666 strncpy(status.errormsg, e.msg().c_str(), 200); 01667 } 01668 catch(exception e) { 01669 strncpy(status.errormsg, e.what(), 200); 01670 } 01671 status.error = 1; 01672 return (void*) 0; 01673 }; 01674 01675 01676 01677 01678 01679 //-------------------------------------------------------------------- 01680 //Wrapper Conf class 01681 extern "C" void* new_Conf (void* dummy ,char* filename) { 01682 if (status.error) return (void*) 0; 01683 try { 01684 IFD_EXTRA; 01685 Conf* This = new Conf (filename); 01686 return (void*) This; 01687 } 01688 catch(Event e) { 01689 strncpy(status.errormsg, e.msg().c_str(), 200); 01690 } 01691 catch(exception e) { 01692 strncpy(status.errormsg, e.what(), 200); 01693 } 01694 status.error = 1; 01695 return (void*) 0; 01696 }; 01697 01698 extern "C" void del_Conf (void* obj) { 01699 if (status.error) return ; 01700 try {; 01701 Conf* This = (Conf*) obj; 01702 delete This; 01703 return; 01704 } 01705 catch(Event e) { 01706 strncpy(status.errormsg, e.msg().c_str(), 200); 01707 } 01708 catch(exception e) { 01709 strncpy(status.errormsg, e.what(), 200); 01710 } 01711 status.error = 1; 01712 return; 01713 }; 01714 01715 extern "C" char* Conf_sval (void* obj ,char* section ,char* key) { 01716 if (status.error) return (char*) 0; 01717 try { 01718 Conf* This = (Conf*) obj; 01719 IFD_EXTRA; 01720 return (char*) This->sval(section, key, false).c_str(); 01721 } 01722 catch(Event e) { 01723 strncpy(status.errormsg, e.msg().c_str(), 200); 01724 } 01725 catch(exception e) { 01726 strncpy(status.errormsg, e.what(), 200); 01727 } 01728 status.error = 1; 01729 return (char*) 0; 01730 }; 01731 01732 01733 01734 extern "C" int Conf_ival (void* obj ,char* section ,char* key) { 01735 if (status.error) return (int) 0; 01736 try { 01737 Conf* This = (Conf*) obj; 01738 IFD_EXTRA; 01739 return (int) This->ival(section, key, false); 01740 } 01741 catch(Event e) { 01742 strncpy(status.errormsg, e.msg().c_str(), 200); 01743 } 01744 catch(exception e) { 01745 strncpy(status.errormsg, e.what(), 200); 01746 } 01747 status.error = 1; 01748 return (int) 0; 01749 };
![]() |
MCS (My Customizable Server) ver. 0.3.3-alpha3
|