00001 #include <stdio.h> 00002 #include <soi_key.h> 00003 00004 void printkey (KEY *key) 00005 { 00006 printf ("%s:\t", key->name); 00007 switch(key->type) { 00008 case KEYTYP_STRING: 00009 printf ("KEYTYP_STRING\t"); 00010 printf ("%s\n", (char *) key->val); 00011 break; 00012 case KEYTYP_BYTE: 00013 printf ("KEYTYP_BYTE\t"); 00014 printf ("%d\n", *(char *)key->val); 00015 break; 00016 case KEYTYP_INT: 00017 printf ("KEYTYP_INT\t"); 00018 printf ("%d\n", *(int *)key->val); 00019 break; 00020 case KEYTYP_FLOAT: 00021 printf ("KEYTYP_FLOAT\t"); 00022 printf ("%13.6e\n", *(float *)key->val); 00023 break; 00024 case KEYTYP_DOUBLE: 00025 printf ("KEYTYP_DOUBLE\t"); 00026 printf ("%23.16e\n", *(double *)key->val); 00027 break; 00028 case KEYTYP_TIME: 00029 printf ("KEYTYP_TIME\t"); 00030 printf ("%23.16e\n", *(TIME *)key->val); 00031 break; 00032 case KEYTYP_SHORT: 00033 printf ("KEYTYP_SHORT\t"); 00034 printf ("%d\n", *(short *)key->val); 00035 break; 00036 case KEYTYP_LONG: 00037 printf ("KEYTYP_LONG\t"); 00038 printf ("%ld\n", *(long *)key->val); 00039 break; 00040 case KEYTYP_UBYTE: 00041 printf ("KEYTYP_UBYTE\t"); 00042 printf ("%d\n", *(unsigned char *)key->val); 00043 break; 00044 case KEYTYP_USHORT: 00045 printf ("KEYTYP_USHORT\t"); 00046 printf ("%d\n", *(unsigned short *)key->val); 00047 break; 00048 case KEYTYP_UINT: 00049 printf ("KEYTYP_UINT\t"); 00050 printf ("%d\n", *(unsigned int *)key->val); 00051 break; 00052 case KEYTYP_ULONG: 00053 printf ("KEYTYP_ULONG\t"); 00054 printf ("%lu\n", *(unsigned long *)key->val); 00055 break; 00056 case KEYTYP_UINT64: 00057 printf ("KEYTYP_UINT64\t"); 00058 printf ("%lu\n", *(uint64_t *)key->val); 00059 break; 00060 case KEYTYP_UINT32: 00061 printf ("KEYTYP_UINT32\t"); 00062 printf ("%d\n", *(uint32_t *)key->val); 00063 break; 00064 case KEYTYP_FILEP: 00065 printf ("KEYTYP_FILEP\t"); 00066 printf ("%lu\n", *(unsigned long *)key->val); 00067 break; 00068 default: 00069 printf ("(void)\n"); 00070 } 00071 }