Changeset 93 for trunk/test/src


Ignore:
Timestamp:
Oct 6, 2005 3:33:41 PM (17 years ago)
Author:
dkearney
Message:
  1. corrected c interface language binding function names so they are

consistant with previous c interface function names

  1. separated object dictionaries from fortran code, placed them in

the RpBindings.[h,cc] files so matlab bindings can use them too.

  1. adjusted makefile to compile RpBindings code
Location:
trunk/test/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/src/RpLibraryC_test.c

    r83 r93  
    2828    printf("TESTING ELEMENT: path = %s\n", path);
    2929
    30     searchEle = element(lib,path);
    31     type = elementAsType(lib,path);
    32     comp = elementAsComp(lib,path);
    33     id = elementAsId(lib,path);
     30    searchEle = rpElement(lib,path);
     31    type = rpElementAsType(lib,path);
     32    comp = rpElementAsComp(lib,path);
     33    id = rpElementAsId(lib,path);
    3434
    3535    if (!searchEle) {
     
    4242        printf("searchEle type = :%s:\n", type);
    4343
    44         comp = nodeComp(searchEle);
    45         id   = nodeId(searchEle);
    46         type = nodeType(searchEle);
    47        
     44        comp = rpNodeComp(searchEle);
     45        id   = rpNodeId(searchEle);
     46        type = rpNodeType(searchEle);
     47
    4848        printf("searchEle comp = :%s:\n", comp);
    4949        printf("searchEle   id = :%s:\n", id);
     
    6363    printf("TESTING GET String: path = %s\n", path);
    6464
    65     searchVal = getString(lib,path);
     65    searchVal = rpGetString(lib,path);
    6666
    6767    if (!searchVal || *searchVal == '\0') {
     
    8484    printf("TESTING GET Double: path = %s\n", path);
    8585
    86     searchVal = getDouble(lib,path);
     86    searchVal = rpGetDouble(lib,path);
    8787
    8888    printf("searchVal = :%f:\n", searchVal);
     
    102102    printf("TESTING CHILDREN: path = %s\n", path);
    103103
    104     while ( (childEle = children(lib,path,childEle)) ) {
    105         comp = nodeComp(childEle);
    106         id   = nodeId(childEle);
    107         type = nodeType(childEle);
     104    while ( (childEle = rpChildren(lib,path,childEle)) ) {
     105        comp = rpNodeComp(childEle);
     106        id   = rpNodeId(childEle);
     107        type = rpNodeType(childEle);
    108108
    109109        printf("childEle comp = :%s:\n",comp);
     
    128128    printf("TESTING CHILDREN: path = %s\n", path);
    129129
    130     while ( (childEle = childrenByType(lib,path,childEle,searchType)) ) {
    131         comp = nodeComp(childEle);
    132         id   = nodeId(childEle);
    133         type = nodeType(childEle);
     130    while ( (childEle = rpChildrenByType(lib,path,childEle,searchType)) ) {
     131        comp = rpNodeComp(childEle);
     132        id   = rpNodeId(childEle);
     133        type = rpNodeType(childEle);
    134134
    135135        printf("childEle comp = :%s:\n",comp);
     
    151151    printf("TESTING PUT String: path = %s\n", path);
    152152
    153     putString(lib,path,value,append);
    154     searchVal = getString(lib, path);
     153    rpPutString(lib,path,value,append);
     154    searchVal = rpGetString(lib, path);
    155155
    156156    if (!searchVal || *searchVal == '\0') {
     
    173173    printf("TESTING PUT String: path = %s\n", path);
    174174
    175     putDouble(lib,path,value,append);
    176     searchVal = getDouble(lib, path);
     175    rpPutDouble(lib,path,value,append);
     176    searchVal = rpGetDouble(lib, path);
    177177    printf("searchVal = :%f:\n", searchVal);
    178178    retVal = 0;
     
    186186    RpLibrary* lib = NULL;
    187187
    188     if (argc < 3)
     188    if (argc < 2)
    189189    {
    190         printf("usage: RpLibrary_test infile.xml outfile.xml\n");
     190        printf("usage: %s driver.xml\n", argv[0]);
    191191        return -1;
    192192    }
    193193
    194     lib = library(argv[1]);
     194    lib = rpLibrary(argv[1]);
    195195
    196196    test_element(lib,"input.number(min)");
     
    217217    test_childrenByType(lib,"input.number(test)","preset");
    218218
    219     printf("XML = \n%s\n",xml(lib));
     219    printf("XML = \n%s\n",rpXml(lib));
    220220   
    221     freeLibrary(lib);
     221    rpFreeLibrary(lib);
    222222
    223223    return 0;
  • trunk/test/src/RpLibraryF_test.f

    r84 r93  
    55c
    66c ======================================================================
    7 c  AUTHOR:  Derrick Kearney, Purdue University
     7c  AUTHOR:  Derrick S. Kearney, Purdue University
    88c  Copyright (c) 2005
    99c  Purdue Research Foundation, West Lafayette, IN
  • trunk/test/src/RpUnitsC_test.c

    r76 r93  
    4848}
    4949
    50 int main() 
     50int main()
    5151{
    5252
    53     RpUnits* meters = defineUnit("m",NULL);
     53    RpUnits* meters = rpDefineUnit("m",NULL);
    5454
    5555    RpUnits* centimeters = NULL;
     
    5757    RpUnits* cm_basis = NULL;
    5858
    59     RpUnits* angstrom = defineUnit("A",NULL);
    60     RpUnits* fahrenheit = defineUnit("F",NULL);
    61     RpUnits* celcius = defineUnit("C",NULL);
    62     RpUnits* kelvin = defineUnit("K",NULL);
     59    RpUnits* angstrom = rpDefineUnit("A",NULL);
     60    RpUnits* fahrenheit = rpDefineUnit("F",NULL);
     61    RpUnits* celcius = rpDefineUnit("C",NULL);
     62    RpUnits* kelvin = rpDefineUnit("K",NULL);
    6363
    64     defineConv(angstrom, meters, angstrom2meter, meter2angstrom);
    65     defineConv(fahrenheit, celcius, fahrenheit2centigrade, centigrade2fahrenheit);
    66     defineConv(celcius, kelvin, centigrade2kelvin, kelvin2centigrade);
    67    
    68    
     64    rpDefineConv(angstrom, meters, angstrom2meter, meter2angstrom);
     65    rpDefineConv(fahrenheit, celcius, fahrenheit2centigrade, centigrade2fahrenheit);
     66    rpDefineConv(celcius, kelvin, centigrade2kelvin, kelvin2centigrade);
     67
     68
    6969    double cm_exp = 0;
    7070    double nm_conv = 0;
    7171    double value = 0;
    72    
     72
    7373    int result = 0;
    7474    int showUnits = 0;
     
    7676    const char* nm_conv_str = NULL;
    7777    const char* retStr = NULL;
    78    
    79     makeMetric(meters);
    80     centimeters = find("cm");
    81    
     78
     79    rpMakeMetric(meters);
     80    centimeters = rpFind("cm");
     81
    8282    if (meters) {
    83         printf("meters sign is :%s:\n",getUnitsName(meters));
     83        printf("meters sign is :%s:\n",rpGetUnitsName(meters));
    8484    }
    8585
    8686    if (centimeters) {
    87         cm_exp = getExponent(centimeters);
    88         cm_basis = getBasis(centimeters);
     87        cm_exp = rpGetExponent(centimeters);
     88        cm_basis = rpGetBasis(centimeters);
    8989
    90         printf("centimeters sign is :%s:\n",getUnits(centimeters));
     90        printf("centimeters sign is :%s:\n",rpGetUnits(centimeters));
    9191        printf("cm_exp is :%f:\n",cm_exp);
    9292
    9393        if (cm_basis) {
    94             printf("cm_basis sign is :%s:\n",getUnitsName(cm_basis));
     94            printf("cm_basis sign is :%s:\n",rpGetUnitsName(cm_basis));
    9595        }
    9696        else {
     
    100100    }
    101101
    102     nanometers = find("nm");
     102    nanometers = rpFind("nm");
    103103
    104104    if (nanometers) {
    105105
    106         nm_conv = convert_obj_double_result(nanometers,meters,1.0e9,&result);
     106        nm_conv = rpConvert_ObjDbl(nanometers,meters,1.0e9,&result);
    107107        printf("1.0e9 nm = %f m\tresult = %d\n",nm_conv,result);
    108108
    109         nm_conv = convert_obj_double(nanometers,meters,1.0e9);
     109        nm_conv = rpConvert_ObjDbl(nanometers,meters,1.0e9, NULL);
    110110        printf("1.0e9 nm = %f m\n",nm_conv);
    111111
    112112        showUnits = 1;
    113         nm_conv_str = convert_obj_str(nanometers,meters,1.588e9,showUnits);
     113        nm_conv_str = rpConvert_ObjStr(nanometers,meters,1.588e9,showUnits,NULL);
    114114        printf("1.588e9 nm = %s\n",nm_conv_str);
    115115
    116116        showUnits = 0;
    117         nm_conv_str = convert_obj_str(nanometers,meters,1.588e9,showUnits);
     117        nm_conv_str = rpConvert_ObjStr(nanometers,meters,1.588e9,showUnits,NULL);
    118118        printf("1.588e9 nm = %s\n",nm_conv_str);
    119119    }
     
    123123
    124124    if (meters && angstrom && centimeters) {
    125         value = convert_obj_double_result(angstrom,meters,1.0,&result);
     125        value = rpConvert_ObjDbl(angstrom,meters,1.0,&result);
    126126        printf("1 angstrom = %e meters\n",value);
    127127
    128         value = convert_obj_double_result(centimeters,angstrom,1e-8,&result);
     128        value = rpConvert_ObjDbl(centimeters,angstrom,1e-8,&result);
    129129        printf("1.0e-8 centimeter = %f angstroms\n",value);
    130130    }
     
    135135
    136136    if (fahrenheit && celcius) {
    137         value = convert_obj_double_result(fahrenheit,celcius,72,&result);
     137        value = rpConvert_ObjDbl(fahrenheit,celcius,72,&result);
    138138        printf("72 degrees fahrenheit = %f degrees celcius\n",value);
    139    
    140         value = convert_obj_double_result(celcius,fahrenheit,value,&result);
     139
     140        value = rpConvert_ObjDbl(celcius,fahrenheit,value,&result);
    141141        printf("22.222 degrees celcius = %f degrees fahrenheit\n",value);
    142142    }
     
    144144        printf("fahrenheit or celcius is NULL\n");
    145145    }
    146        
     146
    147147    if (celcius && kelvin) {
    148         value = convert_obj_double_result(celcius,kelvin,20,&result);
     148        value = rpConvert_ObjDbl(celcius,kelvin,20,&result);
    149149        printf("20 degrees celcius = %f kelvin\n",value);
    150150
    151         value = convert_obj_double_result(kelvin,celcius,300,&result);
     151        value = rpConvert_ObjDbl(kelvin,celcius,300,&result);
    152152        printf("300 kelvin = %f degrees celcius\n", value);
    153153    }
     
    157157
    158158    printf("====== adding all preset units ======\n");
    159     add_presets("all");
     159    rpAddPresets("all");
    160160
    161161    printf("====== TESTING STATIC CONVERT FXNS ======\n");
    162162
    163     retStr = convert("72F","C",1,&result);
     163    retStr = rpConvert("72F","C",1,&result);
    164164    printf("72F = %s\tresult = %d\n", retStr,result);
    165165
    166     retStr = convert("300K","F",1,&result);
     166    retStr = rpConvert("300K","F",1,&result);
    167167    printf("300K = %s\tresult = %d\n", retStr,result);
    168168
    169     retStr = convert("1eV","J",0,&result);
     169    retStr = rpConvert("1eV","J",0,&result);
    170170    printf("1eV = %s (no units)\tresult = %d\n", retStr,result);
    171171
    172     retStr = convert_str("300K","R",1,&result);
     172    retStr = rpConvertStr("300K","R",1,&result);
    173173    printf("300K = %s\tresult = %d\n", retStr,result);
    174174
    175     retStr = convert_str("5m","ft",1,&result);
     175    retStr = rpConvertStr("5m","ft",1,&result);
    176176    printf("5m = %s\tresult = %d\n", retStr,result);
    177177
    178     value = convert_dbl("5000mV","V",&result);
     178    value = rpConvertDbl("5000mV","V",&result);
    179179    printf("5V = %f (double value)\n", value);
    180180
    181    
     181
    182182    return 0;
    183183}
Note: See TracChangeset for help on using the changeset viewer.