Changeset 2549 for trunk/src/core


Ignore:
Timestamp:
Sep 21, 2011 2:32:07 PM (13 years ago)
Author:
gah
Message:
 
Location:
trunk/src/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/RpLibraryFInterface.cc

    r2529 r2549  
    211211}
    212212
    213 
    214 //int rp_lib_child_comp (   int* handle,    /* integer handle of library */
    215 //                            char* path,     /* DOM path of requested object */
    216 //                            char* type,     /* specific name of element */
    217 //                            int* childNum,  /* child number for iteration */
    218 //                            char* retText,  /* buffer to store return text */
    219 //                            int path_len,   /* length of path */
    220 //                            int type_len,   /* length of type */
    221 //                            int retText_len /* length of return text buffer */
    222 //                       )
    223 /*
    224 {
    225     int retVal = 0;
    226 
    227     char* inPath = NULL;
    228     char* inType = NULL;
    229 
    230     inPath = null_terminate(path,path_len);
    231     inType = null_terminate(type,type_len);
    232 
    233     if (inPath) {
    234         path_len = strlen(inPath) + 1;
    235     }
    236     else {
    237         path_len = 0;
    238     }
    239 
    240     if (inType) {
    241         type_len = strlen(inType) + 1;
    242     }
    243     else {
    244         type_len = 0;
    245     }
    246 
    247     retVal = rp_lib_child_str( handle,
    248                                  inPath,
    249                                  "component",
    250                                  inType,
    251                                  childNum,
    252                                  retText,
    253                                  path_len,
    254                                  10,
    255                                  type_len,
    256                                  retText_len
    257                                );
    258 
    259     if (inPath) {
    260         free(inPath);
    261         inPath = NULL;
    262     }
    263 
    264     if (inType) {
    265         free(inType);
    266         inType = NULL;
    267     }
    268 
    269     return retVal;
    270 }
    271 */
    272 
    273 //int rp_lib_child_id(   int* handle,    /* integer handle of library */
    274 //                          char* path,     /* DOM path of requested object */
    275 //                          char* type,     /* specific name of element */
    276 //                          int* childNum,  /* child number for iteration */
    277 //                          char* retText,  /* buffer to store return text */
    278 //                          int path_len,   /* length of path */
    279 //                          int type_len,   /* length of type */
    280 //                          int retText_len /* length of return text buffer */
    281 //                       )
    282 /*
    283 {
    284     int retVal = 0;
    285     char* inPath = NULL;
    286     char* inType = NULL;
    287 
    288     inPath = null_terminate(path,path_len);
    289     inType = null_terminate(type,type_len);
    290 
    291     if (inPath) {
    292         path_len = strlen(inPath) + 1;
    293     }
    294     else {
    295         path_len = 0;
    296     }
    297 
    298     if (inType) {
    299         type_len = strlen(inType) + 1;
    300     }
    301     else {
    302         type_len = 0;
    303     }
    304 
    305     retVal = rp_lib_child_str( handle,
    306                                  inPath,
    307                                  "id",
    308                                  inType,
    309                                  childNum,
    310                                  retText,
    311                                  path_len,
    312                                  3,
    313                                  type_len,
    314                                  retText_len
    315                                );
    316 
    317     if (inPath) {
    318         free(inPath);
    319         inPath = NULL;
    320     }
    321 
    322     if (inType) {
    323         free(inType);
    324         inType = NULL;
    325     }
    326 
    327     return retVal;
    328 }
    329 */
    330 
    331 //int rp_lib_child_type (   int* handle,    /* integer handle of library */
    332 //                            char* path,     /* DOM path of requested object */
    333 //                            char* type,     /* specific name of element */
    334 //                            int* childNum,  /* child number for iteration */
    335 //                            char* retText,  /* buffer to store return text */
    336 //                            int path_len,   /* length of path */
    337 //                            int type_len,   /* length of type */
    338 //                            int retText_len /* length of return text buffer */
    339 //                       )
    340 /*
    341 {
    342     int retVal = 0;
    343     char* inPath = NULL;
    344     char* inType = NULL;
    345 
    346     inPath = null_terminate(path,path_len);
    347     inType = null_terminate(type,type_len);
    348 
    349     if (inPath) {
    350         path_len = strlen(inPath) + 1;
    351     }
    352     else {
    353         path_len = 0;
    354     }
    355 
    356     if (inType) {
    357         type_len = strlen(inType) + 1;
    358     }
    359     else {
    360         type_len = 0;
    361     }
    362 
    363     retVal = rp_lib_child_str( handle,
    364                                  inPath,
    365                                  "type",
    366                                  inType,
    367                                  childNum,
    368                                  retText,
    369                                  path_len,
    370                                  5,
    371                                  type_len,
    372                                  retText_len
    373                                );
    374 
    375     if (inPath) {
    376         free(inPath);
    377         inPath = NULL;
    378     }
    379 
    380     if (inType) {
    381         free(inType);
    382         inType = NULL;
    383     }
    384 
    385     return retVal;
    386 }
    387 */
    388 
    389 /*
    390 int rp_lib_child_obj ( int* handle,
    391                             char* path,
    392                             char* type,
    393                             int path_len,
    394                             int type_len
    395                           )
    396 {
    397     int newObjHandle = -1;
    398 
    399     PyObject* lib = NULL;
    400     PyObject* list = NULL;
    401 
    402     char* inPath = NULL;
    403     char* inType = NULL;
    404 
    405     inPath = null_terminate(path,path_len);
    406     inType = null_terminate(type,type_len);
    407 
    408     if (rapptureStarted) {
    409         if ((handle) && (*handle != 0)) {
    410             lib = (RpLibrary*) getObject_Void(*handle);
    411 
    412             if (lib) {
    413                 list = rpChildren_f(lib, inPath, "object");
    414                 if (list) {
    415                     // store the whole list,
    416                     // need to make a way to read the nodes
    417                     newObjHandle = storeObject_Void((void*)list);
    418                     // Py_DECREF(list);
    419                 }
    420                 else {
    421 
    422                 }
    423             }
    424         }
    425     }
    426 
    427     if (inPath) {
    428         free(inPath);
    429         inPath = NULL;
    430     }
    431 
    432     if (inType) {
    433         free(inType);
    434         inType = NULL;
    435     }
    436 
    437     return newObjHandle;
    438 
    439 }
    440 */
    441 
    442213/**********************************************************************/
    443214// FUNCTION: rp_lib_get()
     
    445216/**
    446217 */
    447 void rp_lib_get( int* handle, /* integer handle of library */
    448                    char* path,      /* null terminated path */
    449                    char* retText,   /* return text buffer for fortran*/
    450                    int path_len,
    451                    int retText_len /* length of return text buffer */
    452                  )
     218void
     219rp_lib_get(
     220    int* handle,                        /* integer handle of library */
     221    char* path,                         /* null terminated path */
     222    char* retText,                      /* return text buffer for fortran*/
     223
     224    int retText_len)                    /* length of return text buffer */
    453225{
    454226    std::string xmlText = "";
     
    478250/**
    479251 */
    480 void rp_lib_get_str( int* handle, /* integer handle of library */
    481                    char* path,      /* null terminated path */
    482                    char* retText,   /* return text buffer for fortran*/
    483                    int path_len,
    484                    int retText_len /* length of return text buffer */
    485                  )
     252void
     253rp_lib_get_str(
     254    int* handle,                        /* integer handle of library */
     255    char* path,                         /* null terminated path */
     256    char* retText,                      /* return text buffer for fortran*/
     257    int path_len,
     258    int retText_len)                    /* length of return text buffer */
    486259{
    487260    std::string xmlText = "";
     
    512285/**
    513286 */
    514 double rp_lib_get_double( int* handle,   /* integer handle of library */
    515                             char* path,    /* null terminated path */
    516                             int path_len
    517                           )
     287double
     288rp_lib_get_double(
     289    int* handle,                        /* integer handle of library */
     290    char* path,                         /* null terminated path */
     291    int path_len)
    518292{
    519293    double retVal = 0.0;
     
    714488/**
    715489 */
    716 void rp_lib_put_data( int* handle,
    717                         char* path,
    718                         char* bytes,
    719                         int* nbytes,
    720                         int* append,
    721                         int path_len,
    722                         int bytes_len
    723                       )
     490void
     491rp_lib_put_data(
     492    int* handle,
     493    char* path,
     494    char* bytes,
     495    int* nbytes,
     496    int* append,
     497    int path_len,
     498    int bytes_len)
    724499{
    725500    std::string inPath = "";
     
    754529/**
    755530 */
    756 void rp_lib_put_file( int* handle,
    757                         char* path,
    758                         char* fileName,
    759                         int* compress,
    760                         int* append,
    761                         int path_len,
    762                         int fileName_len
    763                       )
     531void
     532rp_lib_put_file(
     533    int* handle,
     534    char* path,
     535    char* fileName,
     536    int* compress,
     537    int* append,
     538    int path_len,
     539    int fileName_len)
    764540{
    765541    std::string inPath = "";
     
    783559
    784560
    785 void rp_lib_put_obj( int* handle,
    786                         char* path,
    787                         int* valHandle,
    788                         int* append,
    789                         int path_len
    790                       )
     561void
     562rp_lib_put_obj(
     563    int* handle,
     564    char* path,
     565    int* valHandle,
     566    int* append,
     567    int path_len)
    791568{
    792569    std::string inPath = "";
     
    817594    }
    818595}
    819 
    820 
    821 /*
    822 void rp_lib_put_id_obj ( int* handle,
    823                         char* path,
    824                         int* valHandle,
    825                         char* id,
    826                         int* append,
    827                         int path_len,
    828                         int id_len
    829                       )
    830 {
    831     PyObject* lib = NULL;
    832     PyObject* value = NULL;
    833 
    834     char* inPath = NULL;
    835     char* inId = NULL;
    836 
    837     inPath = null_terminate(path,path_len);
    838     inId = null_terminate(id,id_len);
    839 
    840     if (rapptureStarted) {
    841         if ((handle) && (*handle != 0)) {
    842             lib = (RpLibrary*) getObject_Void(*handle);
    843             value = (RpLibrary*) getObject_Void(*valHandle);
    844 
    845             if (lib && value) {
    846                 // retObj is a borrowed object
    847                 // whose contents must not be modified
    848                 rpPutObj(lib, inPath, value, inId, *append);
    849             }
    850         }
    851     }
    852 
    853     if (inPath) {
    854         free(inPath);
    855         inPath = NULL;
    856     }
    857 
    858     if (inId) {
    859         free(inId);
    860         inId = NULL;
    861     }
    862 
    863 }
    864 */
    865 
    866 /*
    867 int rp_lib_remove (int* handle, char* path, int path_len)
    868 {
    869     int newObjHandle = -1;
    870 
    871     PyObject* lib = NULL;
    872     PyObject* removedObj = NULL;
    873 
    874     char* inPath = NULL;
    875 
    876     inPath = null_terminate(path,path_len);
    877 
    878     if (rapptureStarted) {
    879         if ((handle) && (*handle != 0)) {
    880             lib = (RpLibrary*) getObject_Void(*handle);
    881 
    882             if (lib) {
    883                 removedObj = rpRemove(lib, inPath);
    884 
    885                 if (removedObj) {
    886                     newObjHandle = storeObject_Void((void*)removedObj);
    887                     // Py_DECREF(removedObj);
    888                 }
    889 
    890             }
    891         }
    892     }
    893 
    894     if (inPath) {
    895         free(inPath);
    896         inPath = NULL;
    897     }
    898 
    899     return newObjHandle;
    900 }
    901 */
    902 
    903 /*
    904 int rp_lib_xml_len (int* handle)
    905 {
    906     int length = -1;
    907     char* xmlText = NULL;
    908 
    909     PyObject* lib = NULL;
    910 
    911     if (rapptureStarted) {
    912         if ((handle) && (*handle != 0)) {
    913             lib = (RpLibrary*) getObject_Void(*handle);
    914 
    915             if (lib) {
    916                 // dont modify xmlText, borrowed pointer
    917                 xmlText = rpXml(lib);
    918 
    919                 if (xmlText) {
    920                     length = strlen(xmlText) + 1;
    921                     free(xmlText);
    922                     // printf("len = :%d:\n",length);
    923                 }
    924             }
    925         }
    926     }
    927     return length;
    928 }
    929 */
    930596
    931597/**********************************************************************/
  • trunk/src/core/RpLibraryFInterface.h

    r2408 r2549  
    7979                            int path_len);
    8080
    81 int rp_lib_get_file (       int* handle,
    82                             char* path,
    83                             char* fileName,
    84                             int path_len,
    85                             int fileName_len);
     81extern int rp_lib_get_file(int* handle, char* path, char* fileName,
     82        int path_len, int fileName_len);
    8683
    8784void rp_lib_put_str (       int* handle,
Note: See TracChangeset for help on using the changeset viewer.