00001
00002 #include "pe.h"
00003 #include <soi_key.h>
00004
00005
00006
00007 void pack_args(argument *args)
00008 {
00009 pvm_pkint(&args->kind,1,1);
00010 pvm_pkstr(args->key);
00011 pvm_pkstr(args->default_value);
00012 pvm_pkstr(args->range);
00013 pvm_pkstr(args->description);
00014 }
00015
00016
00017
00018
00019
00020
00021 KEY *pack_keylist(KEY *list)
00022 {
00023 KEY *walker = list;
00024 int info;
00025
00026 while(walker) {
00027 pvm_pkstr(walker->name);
00028 pvm_pkint(&walker->type, 1, 1);
00029 switch(walker->type) {
00030 case KEYTYP_STRING:
00031 info=pvm_pkstr((char *)walker->val);
00032 break;
00033 case KEYTYP_BYTE:
00034 info=pvm_pkbyte((char *)walker->val, 1, 1);
00035 break;
00036 case KEYTYP_INT:
00037 info=pvm_pkint((int *)walker->val, 1, 1);
00038 break;
00039 case KEYTYP_FLOAT:
00040 info=pvm_pkfloat((float *)walker->val, 1, 1);
00041 break;
00042 case KEYTYP_DOUBLE:
00043 info=pvm_pkdouble((double *)walker->val, 1, 1);
00044 break;
00045 case KEYTYP_TIME:
00046 info=pvm_pkdouble((double *)walker->val, 1, 1);
00047 break;
00048 case KEYTYP_SHORT:
00049 info=pvm_pkshort((short *)walker->val, 1, 1);
00050 break;
00051 case KEYTYP_LONG:
00052 info=pvm_pklong((long *)walker->val, 1, 1);
00053 break;
00054 case KEYTYP_UBYTE:
00055 info=pvm_pkbyte((unsigned char *)walker->val, 1, 1);
00056 break;
00057 case KEYTYP_USHORT:
00058 info=pvm_pkshort((unsigned short *)walker->val, 1, 1);
00059 break;
00060 case KEYTYP_UINT:
00061 info=pvm_pkuint((unsigned int *)walker->val, 1, 1);
00062 break;
00063 case KEYTYP_UINT32:
00064 info=pvm_pkuint((unsigned int *)walker->val, 1, 1);
00065 break;
00066 case KEYTYP_ULONG:
00067 info=pvm_pkulong((unsigned long *)walker->val, 1, 1);
00068 break;
00069 }
00070 if(info)
00071 return(walker);
00072 walker=walker->next;
00073 }
00074 pvm_pkstr("END_NAME");
00075 return(walker);
00076 }
00077
00078
00079
00080
00081
00082
00083 KEY *unpack_keylist(KEY *list)
00084 {
00085 int info, type;
00086 char name[4096], val[131072];
00087
00088 while(1) {
00089 pvm_upkstr(name);
00090 if(!strcmp(name, "END_NAME"))
00091 break;
00092 pvm_upkint(&type, 1, 1);
00093 switch(type) {
00094 case KEYTYP_STRING:
00095 info=pvm_upkstr((char *)val);
00096 break;
00097 case KEYTYP_BYTE:
00098 info=pvm_upkbyte((char *)val, 1, 1);
00099 break;
00100 case KEYTYP_INT:
00101 info=pvm_upkint((int *)val, 1, 1);
00102 break;
00103 case KEYTYP_FLOAT:
00104 info=pvm_upkfloat((float *)val, 1, 1);
00105 break;
00106 case KEYTYP_DOUBLE:
00107 info=pvm_upkdouble((double *)val, 1, 1);
00108 break;
00109 case KEYTYP_TIME:
00110 info=pvm_upkdouble((double *)val, 1, 1);
00111 break;
00112 case KEYTYP_SHORT:
00113 info=pvm_upkshort((short *)val, 1, 1);
00114 break;
00115 case KEYTYP_LONG:
00116 info=pvm_upklong((long *)val, 1, 1);
00117 break;
00118 case KEYTYP_UBYTE:
00119 info=pvm_upkbyte((unsigned char *)val, 1, 1);
00120 break;
00121 case KEYTYP_USHORT:
00122 info=pvm_upkshort((unsigned short *)val, 1, 1);
00123 break;
00124 case KEYTYP_UINT:
00125 info=pvm_upkuint((unsigned int *)val, 1, 1);
00126 break;
00127 case KEYTYP_UINT32:
00128 info=pvm_upkuint((unsigned int *)val, 1, 1);
00129 break;
00130 case KEYTYP_ULONG:
00131 info=pvm_upkulong((unsigned long *)val, 1, 1);
00132 break;
00133 }
00134 if(info)
00135 return(NULL);
00136
00137 addkey(&list, name, val, type);
00138 }
00139 return(list);
00140 }