summaryrefslogtreecommitdiff
authoreilers <eilers>2002-10-22 09:07:07 (UTC)
committer eilers <eilers>2002-10-22 09:07:07 (UTC)
commitbbb2c5fee87baa345ff5c16404204054442f5c11 (patch) (unidiff)
tree7a61b3afc81c9c3d96bfe12e82689843bf58d972
parent896bea1ee64705bfc8753d7b3d1d51fddf43efaf (diff)
downloadopie-bbb2c5fee87baa345ff5c16404204054442f5c11.zip
opie-bbb2c5fee87baa345ff5c16404204054442f5c11.tar.gz
opie-bbb2c5fee87baa345ff5c16404204054442f5c11.tar.bz2
fixing incompatibility to orignal sharp rom
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/backend/vobject.cpp7
-rw-r--r--library/backend/vobject_p.h15
2 files changed, 21 insertions, 1 deletions
diff --git a/library/backend/vobject.cpp b/library/backend/vobject.cpp
index dab128e..2f22c20 100644
--- a/library/backend/vobject.cpp
+++ b/library/backend/vobject.cpp
@@ -794,522 +794,527 @@ static struct PreDefProp propNames[] = {
794 { 0,0,0,0 } 794 { 0,0,0,0 }
795 }; 795 };
796 796
797 797
798static struct PreDefProp* lookupPropInfo(const char* str) 798static struct PreDefProp* lookupPropInfo(const char* str)
799{ 799{
800 /* brute force for now, could use a hash table here. */ 800 /* brute force for now, could use a hash table here. */
801 int i; 801 int i;
802 802
803 for (i = 0; propNames[i].name; i++) 803 for (i = 0; propNames[i].name; i++)
804 if (qstricmp(str, propNames[i].name) == 0) { 804 if (qstricmp(str, propNames[i].name) == 0) {
805 return &propNames[i]; 805 return &propNames[i];
806 } 806 }
807 807
808 return 0; 808 return 0;
809} 809}
810 810
811 811
812DLLEXPORT(const char*) lookupProp_(const char* str) 812DLLEXPORT(const char*) lookupProp_(const char* str)
813{ 813{
814 int i; 814 int i;
815 815
816 for (i = 0; propNames[i].name; i++) 816 for (i = 0; propNames[i].name; i++)
817 if (qstricmp(str, propNames[i].name) == 0) { 817 if (qstricmp(str, propNames[i].name) == 0) {
818 const char* s; 818 const char* s;
819 s = propNames[i].alias?propNames[i].alias:propNames[i].name; 819 s = propNames[i].alias?propNames[i].alias:propNames[i].name;
820 return lookupStr(s); 820 return lookupStr(s);
821 } 821 }
822 return lookupStr(str); 822 return lookupStr(str);
823} 823}
824 824
825 825
826DLLEXPORT(const char*) lookupProp(const char* str) 826DLLEXPORT(const char*) lookupProp(const char* str)
827{ 827{
828 int i; 828 int i;
829 829
830 for (i = 0; propNames[i].name; i++) 830 for (i = 0; propNames[i].name; i++)
831 if (qstricmp(str, propNames[i].name) == 0) { 831 if (qstricmp(str, propNames[i].name) == 0) {
832 const char *s; 832 const char *s;
833 fieldedProp = propNames[i].fields; 833 fieldedProp = propNames[i].fields;
834 s = propNames[i].alias?propNames[i].alias:propNames[i].name; 834 s = propNames[i].alias?propNames[i].alias:propNames[i].name;
835 return lookupStr(s); 835 return lookupStr(s);
836 } 836 }
837 fieldedProp = 0; 837 fieldedProp = 0;
838 return lookupStr(str); 838 return lookupStr(str);
839} 839}
840 840
841 841
842/*---------------------------------------------------------------------- 842/*----------------------------------------------------------------------
843 APIs to Output text form. 843 APIs to Output text form.
844 ----------------------------------------------------------------------*/ 844 ----------------------------------------------------------------------*/
845#define OFILE_REALLOC_SIZE 256 845#define OFILE_REALLOC_SIZE 256
846typedef struct OFile { 846typedef struct OFile {
847 FILE *fp; 847 FILE *fp;
848 char *s; 848 char *s;
849 int len; 849 int len;
850 int limit; 850 int limit;
851 int alloc:1; 851 int alloc:1;
852 int fail:1; 852 int fail:1;
853 } OFile; 853 } OFile;
854 854
855#if 0 855#if 0
856static void appendsOFile(OFile *fp, const char *s) 856static void appendsOFile(OFile *fp, const char *s)
857{ 857{
858 int slen; 858 int slen;
859 if (fp->fail) return; 859 if (fp->fail) return;
860 slen = strlen(s); 860 slen = strlen(s);
861 if (fp->fp) { 861 if (fp->fp) {
862 fwrite(s,1,slen,fp->fp); 862 fwrite(s,1,slen,fp->fp);
863 } 863 }
864 else { 864 else {
865stuff: 865stuff:
866 if (fp->len + slen < fp->limit) { 866 if (fp->len + slen < fp->limit) {
867 memcpy(fp->s+fp->len,s,slen); 867 memcpy(fp->s+fp->len,s,slen);
868 fp->len += slen; 868 fp->len += slen;
869 return; 869 return;
870 } 870 }
871 else if (fp->alloc) { 871 else if (fp->alloc) {
872 fp->limit = fp->limit + OFILE_REALLOC_SIZE; 872 fp->limit = fp->limit + OFILE_REALLOC_SIZE;
873 if (OFILE_REALLOC_SIZE <= slen) fp->limit += slen; 873 if (OFILE_REALLOC_SIZE <= slen) fp->limit += slen;
874 fp->s = (char *) realloc(fp->s,fp->limit); 874 fp->s = (char *) realloc(fp->s,fp->limit);
875 if (fp->s) goto stuff; 875 if (fp->s) goto stuff;
876 } 876 }
877 if (fp->alloc) 877 if (fp->alloc)
878 free(fp->s); 878 free(fp->s);
879 fp->s = 0; 879 fp->s = 0;
880 fp->fail = 1; 880 fp->fail = 1;
881 } 881 }
882} 882}
883 883
884static void appendcOFile(OFile *fp, char c) 884static void appendcOFile(OFile *fp, char c)
885{ 885{
886 if (fp->fail) return; 886 if (fp->fail) return;
887 if (fp->fp) { 887 if (fp->fp) {
888 fputc(c,fp->fp); 888 fputc(c,fp->fp);
889 } 889 }
890 else { 890 else {
891stuff: 891stuff:
892 if (fp->len+1 < fp->limit) { 892 if (fp->len+1 < fp->limit) {
893 fp->s[fp->len] = c; 893 fp->s[fp->len] = c;
894 fp->len++; 894 fp->len++;
895 return; 895 return;
896 } 896 }
897 else if (fp->alloc) { 897 else if (fp->alloc) {
898 fp->limit = fp->limit + OFILE_REALLOC_SIZE; 898 fp->limit = fp->limit + OFILE_REALLOC_SIZE;
899 fp->s = (char *) realloc(fp->s,fp->limit); 899 fp->s = (char *) realloc(fp->s,fp->limit);
900 if (fp->s) goto stuff; 900 if (fp->s) goto stuff;
901 } 901 }
902 if (fp->alloc) 902 if (fp->alloc)
903 free(fp->s); 903 free(fp->s);
904 fp->s = 0; 904 fp->s = 0;
905 fp->fail = 1; 905 fp->fail = 1;
906 } 906 }
907} 907}
908#else 908#else
909static void appendcOFile_(OFile *fp, char c) 909static void appendcOFile_(OFile *fp, char c)
910{ 910{
911 if (fp->fail) return; 911 if (fp->fail) return;
912 if (fp->fp) { 912 if (fp->fp) {
913 fputc(c,fp->fp); 913 fputc(c,fp->fp);
914 } 914 }
915 else { 915 else {
916stuff: 916stuff:
917 if (fp->len+1 < fp->limit) { 917 if (fp->len+1 < fp->limit) {
918 fp->s[fp->len] = c; 918 fp->s[fp->len] = c;
919 fp->len++; 919 fp->len++;
920 return; 920 return;
921 } 921 }
922 else if (fp->alloc) { 922 else if (fp->alloc) {
923 fp->limit = fp->limit + OFILE_REALLOC_SIZE; 923 fp->limit = fp->limit + OFILE_REALLOC_SIZE;
924 fp->s = (char *)realloc(fp->s,fp->limit); 924 fp->s = (char *)realloc(fp->s,fp->limit);
925 if (fp->s) goto stuff; 925 if (fp->s) goto stuff;
926 } 926 }
927 if (fp->alloc) 927 if (fp->alloc)
928 free(fp->s); 928 free(fp->s);
929 fp->s = 0; 929 fp->s = 0;
930 fp->fail = 1; 930 fp->fail = 1;
931 } 931 }
932} 932}
933 933
934static void appendcOFile(OFile *fp, char c) 934static void appendcOFile(OFile *fp, char c)
935{ 935{
936 if (c == '\n') { 936 if (c == '\n') {
937 /* write out as <CR><LF> */ 937 /* write out as <CR><LF> */
938 appendcOFile_(fp,0xd); 938 appendcOFile_(fp,0xd);
939 appendcOFile_(fp,0xa); 939 appendcOFile_(fp,0xa);
940 } 940 }
941 else 941 else
942 appendcOFile_(fp,c); 942 appendcOFile_(fp,c);
943} 943}
944 944
945static void appendsOFile(OFile *fp, const char *s) 945static void appendsOFile(OFile *fp, const char *s)
946{ 946{
947 int i, slen; 947 int i, slen;
948 slen = strlen(s); 948 slen = strlen(s);
949 for (i=0; i<slen; i++) { 949 for (i=0; i<slen; i++) {
950 appendcOFile(fp,s[i]); 950 appendcOFile(fp,s[i]);
951 } 951 }
952} 952}
953 953
954#endif 954#endif
955 955
956static void initOFile(OFile *fp, FILE *ofp) 956static void initOFile(OFile *fp, FILE *ofp)
957{ 957{
958 fp->fp = ofp; 958 fp->fp = ofp;
959 fp->s = 0; 959 fp->s = 0;
960 fp->len = 0; 960 fp->len = 0;
961 fp->limit = 0; 961 fp->limit = 0;
962 fp->alloc = 0; 962 fp->alloc = 0;
963 fp->fail = 0; 963 fp->fail = 0;
964} 964}
965 965
966static int writeBase64(OFile *fp, unsigned char *s, long len) 966static int writeBase64(OFile *fp, unsigned char *s, long len)
967{ 967{
968 long cur = 0; 968 long cur = 0;
969 int i, numQuads = 0; 969 int i, numQuads = 0;
970 unsigned long trip; 970 unsigned long trip;
971 unsigned char b; 971 unsigned char b;
972 char quad[5]; 972 char quad[5];
973#define MAXQUADS 16 973#define MAXQUADS 16
974 974
975 quad[4] = 0; 975 quad[4] = 0;
976 976
977 while (cur < len) { 977 while (cur < len) {
978 // collect the triplet of bytes into 'trip' 978 // collect the triplet of bytes into 'trip'
979 trip = 0; 979 trip = 0;
980 for (i = 0; i < 3; i++) { 980 for (i = 0; i < 3; i++) {
981 b = (cur < len) ? *(s + cur) : 0; 981 b = (cur < len) ? *(s + cur) : 0;
982 cur++; 982 cur++;
983 trip = trip << 8 | b; 983 trip = trip << 8 | b;
984 } 984 }
985 // fill in 'quad' with the appropriate four characters 985 // fill in 'quad' with the appropriate four characters
986 for (i = 3; i >= 0; i--) { 986 for (i = 3; i >= 0; i--) {
987 b = (unsigned char)(trip & 0x3F); 987 b = (unsigned char)(trip & 0x3F);
988 trip = trip >> 6; 988 trip = trip >> 6;
989 if ((3 - i) < (cur - len)) 989 if ((3 - i) < (cur - len))
990 quad[i] = '='; // pad char 990 quad[i] = '='; // pad char
991 else if (b < 26) quad[i] = (char)b + 'A'; 991 else if (b < 26) quad[i] = (char)b + 'A';
992 else if (b < 52) quad[i] = (char)(b - 26) + 'a'; 992 else if (b < 52) quad[i] = (char)(b - 26) + 'a';
993 else if (b < 62) quad[i] = (char)(b - 52) + '0'; 993 else if (b < 62) quad[i] = (char)(b - 52) + '0';
994 else if (b == 62) quad[i] = '+'; 994 else if (b == 62) quad[i] = '+';
995 else quad[i] = '/'; 995 else quad[i] = '/';
996 } 996 }
997 // now output 'quad' with appropriate whitespace and line ending 997 // now output 'quad' with appropriate whitespace and line ending
998 appendsOFile(fp, (numQuads == 0 ? " " : "")); 998 appendsOFile(fp, (numQuads == 0 ? " " : ""));
999 appendsOFile(fp, quad); 999 appendsOFile(fp, quad);
1000 appendsOFile(fp, ((cur >= len)?"\n" :(numQuads==MAXQUADS-1?"\n" : ""))); 1000 appendsOFile(fp, ((cur >= len)?"\n" :(numQuads==MAXQUADS-1?"\n" : "")));
1001 numQuads = (numQuads + 1) % MAXQUADS; 1001 numQuads = (numQuads + 1) % MAXQUADS;
1002 } 1002 }
1003 appendcOFile(fp,'\n'); 1003 appendcOFile(fp,'\n');
1004 1004
1005 return 1; 1005 return 1;
1006} 1006}
1007 1007
1008static const char *replaceChar(unsigned char c) 1008static const char *replaceChar(unsigned char c)
1009{ 1009{
1010 if (c == '\n') { 1010 if (c == '\n') {
1011 return "=0A=\n"; 1011 return "=0A=\n";
1012 } else if ( 1012 } else if (
1013 (c >= 'A' && c <= 'Z') 1013 (c >= 'A' && c <= 'Z')
1014 || 1014 ||
1015 (c >= 'a' && c <= 'z') 1015 (c >= 'a' && c <= 'z')
1016 || 1016 ||
1017 (c >= '0' && c <= '9') 1017 (c >= '0' && c <= '9')
1018 || 1018 ||
1019 (c >= '\'' && c <= ')') 1019 (c >= '\'' && c <= ')')
1020 || 1020 ||
1021 (c >= '+' && c <= '-') 1021 (c >= '+' && c <= '-')
1022 || 1022 ||
1023 (c == '/') 1023 (c == '/')
1024 || 1024 ||
1025 (c == '?') 1025 (c == '?')
1026 || 1026 ||
1027 (c == ' ')) 1027 (c == ' '))
1028 { 1028 {
1029 return 0; 1029 return 0;
1030 } 1030 }
1031 1031
1032 static char trans[4]; 1032 static char trans[4];
1033 trans[0] = '='; 1033 trans[0] = '=';
1034 trans[3] = '\0'; 1034 trans[3] = '\0';
1035 int rem = c % 16; 1035 int rem = c % 16;
1036 int div = c / 16; 1036 int div = c / 16;
1037 1037
1038 if (div < 10) 1038 if (div < 10)
1039 trans[1] = '0' + div; 1039 trans[1] = '0' + div;
1040 else 1040 else
1041 trans[1] = 'A' + (div - 10); 1041 trans[1] = 'A' + (div - 10);
1042 1042
1043 if (rem < 10) 1043 if (rem < 10)
1044 trans[2] = '0' + rem; 1044 trans[2] = '0' + rem;
1045 else 1045 else
1046 trans[2] = 'A' + (rem - 10); 1046 trans[2] = 'A' + (rem - 10);
1047 1047
1048 return trans; 1048 return trans;
1049} 1049}
1050 1050
1051static void writeQPString(OFile *fp, const char *s) 1051static void writeQPString(OFile *fp, const char *s)
1052{ 1052{
1053 /* 1053 /*
1054 only A-Z, 0-9 and 1054 only A-Z, 0-9 and
1055 "'" (ASCII code 39) 1055 "'" (ASCII code 39)
1056 "(" (ASCII code 40) 1056 "(" (ASCII code 40)
1057 ")" (ASCII code 41) 1057 ")" (ASCII code 41)
1058 "+" (ASCII code 43) 1058 "+" (ASCII code 43)
1059 "," (ASCII code 44) 1059 "," (ASCII code 44)
1060 "-" (ASCII code 45) 1060 "-" (ASCII code 45)
1061 "/" (ASCII code 47) 1061 "/" (ASCII code 47)
1062 "?" (ASCII code 63) 1062 "?" (ASCII code 63)
1063 1063
1064 should remain un-encoded. 1064 should remain un-encoded.
1065 '=' needs to be encoded as it is the escape character. 1065 '=' needs to be encoded as it is the escape character.
1066 ';' needs to be as it is a field separator. 1066 ';' needs to be as it is a field separator.
1067 1067
1068 */ 1068 */
1069 const char *p = s; 1069 const char *p = s;
1070 while (*p) { 1070 while (*p) {
1071 const char *rep = replaceChar(*p); 1071 const char *rep = replaceChar(*p);
1072 if (rep) 1072 if (rep)
1073 appendsOFile(fp, rep); 1073 appendsOFile(fp, rep);
1074 else 1074 else
1075 appendcOFile(fp, *p); 1075 appendcOFile(fp, *p);
1076 p++; 1076 p++;
1077 } 1077 }
1078} 1078}
1079 1079
1080static bool includesUnprintable(VObject *o) 1080static bool includesUnprintable(VObject *o)
1081{ 1081{
1082 if (o) { 1082 if (o) {
1083 if (VALUE_TYPE(o) == VCVT_STRINGZ) { 1083 if (VALUE_TYPE(o) == VCVT_STRINGZ) {
1084 const char *p = STRINGZ_VALUE_OF(o); 1084 const char *p = STRINGZ_VALUE_OF(o);
1085 if (p) { 1085 if (p) {
1086 while (*p) { 1086 while (*p) {
1087 if (replaceChar(*p)) 1087 if (replaceChar(*p))
1088 return TRUE; 1088 return TRUE;
1089 p++; 1089 p++;
1090 } 1090 }
1091 } 1091 }
1092 } 1092 }
1093 } 1093 }
1094 return FALSE; 1094 return FALSE;
1095} 1095}
1096 1096
1097static void writeVObject_(OFile *fp, VObject *o); 1097static void writeVObject_(OFile *fp, VObject *o);
1098 1098
1099static void writeValue(OFile *fp, VObject *o, unsigned long size) 1099static void writeValue(OFile *fp, VObject *o, unsigned long size)
1100{ 1100{
1101 if (o == 0) return; 1101 if (o == 0) return;
1102 switch (VALUE_TYPE(o)) { 1102 switch (VALUE_TYPE(o)) {
1103 case VCVT_STRINGZ: { 1103 case VCVT_STRINGZ: {
1104 writeQPString(fp, STRINGZ_VALUE_OF(o)); 1104 writeQPString(fp, STRINGZ_VALUE_OF(o));
1105 break; 1105 break;
1106 } 1106 }
1107 case VCVT_UINT: { 1107 case VCVT_UINT: {
1108 char buf[16]; 1108 char buf[16];
1109 sprintf(buf,"%u", INTEGER_VALUE_OF(o)); 1109 sprintf(buf,"%u", INTEGER_VALUE_OF(o));
1110 appendsOFile(fp,buf); 1110 appendsOFile(fp,buf);
1111 break; 1111 break;
1112 } 1112 }
1113 case VCVT_ULONG: { 1113 case VCVT_ULONG: {
1114 char buf[16]; 1114 char buf[16];
1115 sprintf(buf,"%lu", LONG_VALUE_OF(o)); 1115 sprintf(buf,"%lu", LONG_VALUE_OF(o));
1116 appendsOFile(fp,buf); 1116 appendsOFile(fp,buf);
1117 break; 1117 break;
1118 } 1118 }
1119 case VCVT_RAW: { 1119 case VCVT_RAW: {
1120 appendcOFile(fp,'\n'); 1120 appendcOFile(fp,'\n');
1121 writeBase64(fp,(unsigned char*)(ANY_VALUE_OF(o)),size); 1121 writeBase64(fp,(unsigned char*)(ANY_VALUE_OF(o)),size);
1122 break; 1122 break;
1123 } 1123 }
1124 case VCVT_VOBJECT: 1124 case VCVT_VOBJECT:
1125 appendcOFile(fp,'\n'); 1125 appendcOFile(fp,'\n');
1126 writeVObject_(fp,VOBJECT_VALUE_OF(o)); 1126 writeVObject_(fp,VOBJECT_VALUE_OF(o));
1127 break; 1127 break;
1128 } 1128 }
1129} 1129}
1130 1130
1131static void writeAttrValue(OFile *fp, VObject *o) 1131static void writeAttrValue(OFile *fp, VObject *o)
1132{ 1132{
1133 if (NAME_OF(o)) { 1133 if (NAME_OF(o)) {
1134 struct PreDefProp *pi; 1134 struct PreDefProp *pi;
1135 pi = lookupPropInfo(NAME_OF(o)); 1135 pi = lookupPropInfo(NAME_OF(o));
1136 if (pi && ((pi->flags & PD_INTERNAL) != 0)) return; 1136 if (pi && ((pi->flags & PD_INTERNAL) != 0)) return;
1137 if ( includesUnprintable(o) ) { 1137 if ( includesUnprintable(o) ) {
1138 appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); 1138 appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp);
1139 appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); 1139 appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8");
1140 } 1140 }
1141 appendcOFile(fp,';'); 1141 appendcOFile(fp,';');
1142 appendsOFile(fp,NAME_OF(o)); 1142 appendsOFile(fp,NAME_OF(o));
1143 } 1143 }
1144 else 1144 else
1145 appendcOFile(fp,';'); 1145 appendcOFile(fp,';');
1146 if (VALUE_TYPE(o)) { 1146 if (VALUE_TYPE(o)) {
1147 appendcOFile(fp,'='); 1147 appendcOFile(fp,'=');
1148 writeValue(fp,o,0); 1148 writeValue(fp,o,0);
1149 } 1149 }
1150} 1150}
1151 1151
1152static void writeGroup(OFile *fp, VObject *o) 1152static void writeGroup(OFile *fp, VObject *o)
1153{ 1153{
1154 char buf1[256]; 1154 char buf1[256];
1155 char buf2[256]; 1155 char buf2[256];
1156 strcpy(buf1,NAME_OF(o)); 1156 strcpy(buf1,NAME_OF(o));
1157 while ((o=isAPropertyOf(o,VCGroupingProp)) != 0) { 1157 while ((o=isAPropertyOf(o,VCGroupingProp)) != 0) {
1158 strcpy(buf2,STRINGZ_VALUE_OF(o)); 1158 strcpy(buf2,STRINGZ_VALUE_OF(o));
1159 strcat(buf2,"."); 1159 strcat(buf2,".");
1160 strcat(buf2,buf1); 1160 strcat(buf2,buf1);
1161 strcpy(buf1,buf2); 1161 strcpy(buf1,buf2);
1162 } 1162 }
1163 appendsOFile(fp,buf1); 1163 appendsOFile(fp,buf1);
1164} 1164}
1165 1165
1166static int inList(const char **list, const char *s) 1166static int inList(const char **list, const char *s)
1167{ 1167{
1168 if (list == 0) return 0; 1168 if (list == 0) return 0;
1169 while (*list) { 1169 while (*list) {
1170 if (qstricmp(*list,s) == 0) return 1; 1170 if (qstricmp(*list,s) == 0) return 1;
1171 list++; 1171 list++;
1172 } 1172 }
1173 return 0; 1173 return 0;
1174} 1174}
1175 1175
1176static void writeProp(OFile *fp, VObject *o) 1176static void writeProp(OFile *fp, VObject *o)
1177{ 1177{
1178 if (NAME_OF(o)) { 1178 if (NAME_OF(o)) {
1179 struct PreDefProp *pi; 1179 struct PreDefProp *pi;
1180 VObjectIterator t; 1180 VObjectIterator t;
1181 const char **fields_ = 0; 1181 const char **fields_ = 0;
1182 pi = lookupPropInfo(NAME_OF(o)); 1182 pi = lookupPropInfo(NAME_OF(o));
1183 if (pi && ((pi->flags & PD_BEGIN) != 0)) { 1183 if (pi && ((pi->flags & PD_BEGIN) != 0)) {
1184 writeVObject_(fp,o); 1184 writeVObject_(fp,o);
1185 return; 1185 return;
1186 } 1186 }
1187 if (isAPropertyOf(o,VCGroupingProp)) 1187 if (isAPropertyOf(o,VCGroupingProp))
1188 writeGroup(fp,o); 1188 writeGroup(fp,o);
1189 else 1189 else
1190 appendsOFile(fp,NAME_OF(o)); 1190 appendsOFile(fp,NAME_OF(o));
1191 if (pi) fields_ = pi->fields; 1191 if (pi) fields_ = pi->fields;
1192 initPropIterator(&t,o); 1192 initPropIterator(&t,o);
1193 while (moreIteration(&t)) { 1193 while (moreIteration(&t)) {
1194 const char *s; 1194 const char *s;
1195 VObject *eachProp = nextVObject(&t); 1195 VObject *eachProp = nextVObject(&t);
1196 s = NAME_OF(eachProp); 1196 s = NAME_OF(eachProp);
1197 if (qstricmp(VCGroupingProp,s) && !inList(fields_,s)) 1197 if (qstricmp(VCGroupingProp,s) && !inList(fields_,s))
1198 writeAttrValue(fp,eachProp); 1198 writeAttrValue(fp,eachProp);
1199 } 1199 }
1200 if (fields_) { 1200 if (fields_) {
1201 int i = 0, n = 0; 1201 int i = 0, n = 0;
1202 const char** fields = fields_; 1202 const char** fields = fields_;
1203 /* output prop as fields */ 1203 /* output prop as fields */
1204 bool printable = TRUE; 1204 bool printable = TRUE;
1205 while (*fields && printable) { 1205 while (*fields && printable) {
1206 VObject *t = isAPropertyOf(o,*fields); 1206 VObject *t = isAPropertyOf(o,*fields);
1207 if (includesUnprintable(t)) 1207 if (includesUnprintable(t))
1208 printable = FALSE; 1208 printable = FALSE;
1209 fields++; 1209 fields++;
1210 } 1210 }
1211 fields = fields_; 1211 fields = fields_;
1212 if (!printable) { 1212 if (!printable) {
1213 appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); 1213 appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp);
1214 appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); 1214 appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8");
1215 } 1215 }
1216 appendcOFile(fp,':'); 1216 appendcOFile(fp,':');
1217 while (*fields) { 1217 while (*fields) {
1218 VObject *t = isAPropertyOf(o,*fields); 1218 VObject *t = isAPropertyOf(o,*fields);
1219 i++; 1219 i++;
1220 if (t) n = i; 1220 if (t) n = i;
1221 fields++; 1221 fields++;
1222 } 1222 }
1223 fields = fields_; 1223 fields = fields_;
1224 for (i=0;i<n;i++) { 1224 for (i=0;i<n;i++) {
1225 writeValue(fp,isAPropertyOf(o,*fields),0); 1225 writeValue(fp,isAPropertyOf(o,*fields),0);
1226 fields++; 1226 fields++;
1227 if (i<(n-1)) appendcOFile(fp,';'); 1227 if (i<(n-1)) appendcOFile(fp,';');
1228 } 1228 }
1229 } 1229 }
1230 } 1230 }
1231 1231
1232 1232
1233 if (VALUE_TYPE(o)) { 1233 if (VALUE_TYPE(o)) {
1234 if ( includesUnprintable(o) ) { 1234 if ( includesUnprintable(o) ) {
1235 appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); 1235 appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp);
1236 appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); 1236 appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8");
1237 } 1237 }
1238 unsigned long size = 0; 1238 unsigned long size = 0;
1239 VObject *p = isAPropertyOf(o,VCDataSizeProp); 1239 VObject *p = isAPropertyOf(o,VCDataSizeProp);
1240 if (p) size = LONG_VALUE_OF(p); 1240 if (p) size = LONG_VALUE_OF(p);
1241 appendcOFile(fp,':'); 1241 appendcOFile(fp,':');
1242 writeValue(fp,o,size); 1242 writeValue(fp,o,size);
1243 } 1243 }
1244 1244
1245 appendcOFile(fp,'\n'); 1245 appendcOFile(fp,'\n');
1246} 1246}
1247 1247
1248static void writeVObject_(OFile *fp, VObject *o) 1248static void writeVObject_(OFile *fp, VObject *o)
1249{ 1249{
1250 if (NAME_OF(o)) { 1250 if (NAME_OF(o)) {
1251 struct PreDefProp *pi; 1251 struct PreDefProp *pi;
1252 pi = lookupPropInfo(NAME_OF(o)); 1252 pi = lookupPropInfo(NAME_OF(o));
1253 1253
1254 if (pi && ((pi->flags & PD_BEGIN) != 0)) { 1254 if (pi && ((pi->flags & PD_BEGIN) != 0)) {
1255 VObjectIterator t; 1255 VObjectIterator t;
1256 const char *begin = NAME_OF(o); 1256 const char *begin = NAME_OF(o);
1257 appendsOFile(fp,"BEGIN:"); 1257 appendsOFile(fp,"BEGIN:");
1258 appendsOFile(fp,begin); 1258 appendsOFile(fp,begin);
1259 appendcOFile(fp,'\n'); 1259 appendcOFile(fp,'\n');
1260 initPropIterator(&t,o); 1260 initPropIterator(&t,o);
1261 while (moreIteration(&t)) { 1261 while (moreIteration(&t)) {
1262 VObject *eachProp = nextVObject(&t); 1262 VObject *eachProp = nextVObject(&t);
1263 writeProp(fp, eachProp); 1263 writeProp(fp, eachProp);
1264 } 1264 }
1265 appendsOFile(fp,"END:"); 1265 appendsOFile(fp,"END:");
1266 appendsOFile(fp,begin); 1266 appendsOFile(fp,begin);
1267 appendsOFile(fp,"\n\n"); 1267 appendsOFile(fp,"\n\n");
1268 } 1268 }
1269 } 1269 }
1270} 1270}
1271 1271
1272void writeVObject(FILE *fp, VObject *o) 1272void writeVObject(FILE *fp, VObject *o)
1273{ 1273{
1274 OFile ofp; 1274 OFile ofp;
1275 // ##### 1275 // #####
1276 //_setmode(_fileno(fp), _O_BINARY); 1276 //_setmode(_fileno(fp), _O_BINARY);
1277 initOFile(&ofp,fp); 1277 initOFile(&ofp,fp);
1278 writeVObject_(&ofp,o); 1278 writeVObject_(&ofp,o);
1279} 1279}
1280 1280
1281DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o) 1281DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o)
1282{ 1282{
1283 QFileDirect f( fname); 1283 QFileDirect f( fname);
1284 if ( !f.open( IO_WriteOnly ) ) { 1284 if ( !f.open( IO_WriteOnly ) ) {
1285 qWarning("Unable to open vobject write %s", fname); 1285 qWarning("Unable to open vobject write %s", fname);
1286 return; 1286 return;
1287 } 1287 }
1288 1288
1289 writeVObject( f.directHandle(),o ); 1289 writeVObject( f.directHandle(),o );
1290} 1290}
1291 1291
1292DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list) 1292DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list)
1293{ 1293{
1294 QFileDirect f( fname); 1294 QFileDirect f( fname);
1295 if ( !f.open( IO_WriteOnly ) ) { 1295 if ( !f.open( IO_WriteOnly ) ) {
1296 qWarning("Unable to open vobject write %s", fname); 1296 qWarning("Unable to open vobject write %s", fname);
1297 return; 1297 return;
1298 } 1298 }
1299 1299
1300 while (list) { 1300 while (list) {
1301 writeVObject(f.directHandle(),list); 1301 writeVObject(f.directHandle(),list);
1302 list = nextVObjectInList(list); 1302 list = nextVObjectInList(list);
1303 } 1303 }
1304} 1304}
1305 1305
1306#ifndef __SHARP_COMP_
1307
1308// This function is not available in the Sharp ROM for SL 5500 !
1309// Therefore I have to move it into the header file.. (se)
1310
1306DLLEXPORT(const char *) vObjectTypeInfo(VObject *o) 1311DLLEXPORT(const char *) vObjectTypeInfo(VObject *o)
1307{ 1312{
1308 const char *type = vObjectName( o ); 1313 const char *type = vObjectName( o );
1309 if ( strcmp( type, "TYPE" ) == 0 ) 1314 if ( strcmp( type, "TYPE" ) == 0 )
1310 type = vObjectStringZValue( o ); 1315 type = vObjectStringZValue( o );
1311 return type; 1316 return type;
1312} 1317}
1313 1318#endif
1314 1319
1315// end of source file vobject.c 1320// end of source file vobject.c
diff --git a/library/backend/vobject_p.h b/library/backend/vobject_p.h
index 0d0a2a8..bab22bb 100644
--- a/library/backend/vobject_p.h
+++ b/library/backend/vobject_p.h
@@ -1,406 +1,421 @@
1/*************************************************************************** 1/***************************************************************************
2(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International 2(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
3Business Machines Corporation and Siemens Rolm Communications Inc. 3Business Machines Corporation and Siemens Rolm Communications Inc.
4 4
5For purposes of this license notice, the term Licensors shall mean, 5For purposes of this license notice, the term Licensors shall mean,
6collectively, Apple Computer, Inc., AT&T Corp., International 6collectively, Apple Computer, Inc., AT&T Corp., International
7Business Machines Corporation and Siemens Rolm Communications Inc. 7Business Machines Corporation and Siemens Rolm Communications Inc.
8The term Licensor shall mean any of the Licensors. 8The term Licensor shall mean any of the Licensors.
9 9
10Subject to acceptance of the following conditions, permission is hereby 10Subject to acceptance of the following conditions, permission is hereby
11granted by Licensors without the need for written agreement and without 11granted by Licensors without the need for written agreement and without
12license or royalty fees, to use, copy, modify and distribute this 12license or royalty fees, to use, copy, modify and distribute this
13software for any purpose. 13software for any purpose.
14 14
15The above copyright notice and the following four paragraphs must be 15The above copyright notice and the following four paragraphs must be
16reproduced in all copies of this software and any software including 16reproduced in all copies of this software and any software including
17this software. 17this software.
18 18
19THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE 19THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
20ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR 20ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
21MODIFICATIONS. 21MODIFICATIONS.
22 22
23IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, 23IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
24INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT 24INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
25OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 25OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26DAMAGE. 26DAMAGE.
27 27
28EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, 28EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
29INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE 29INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
30IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 30IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31PURPOSE. 31PURPOSE.
32 32
33The software is provided with RESTRICTED RIGHTS. Use, duplication, or 33The software is provided with RESTRICTED RIGHTS. Use, duplication, or
34disclosure by the government are subject to restrictions set forth in 34disclosure by the government are subject to restrictions set forth in
35DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. 35DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
36 36
37***************************************************************************/ 37***************************************************************************/
38 38
39/* 39/*
40 40
41The vCard/vCalendar C interface is implemented in the set 41The vCard/vCalendar C interface is implemented in the set
42of files as follows: 42of files as follows:
43 43
44vcc.y, yacc source, and vcc.c, the yacc output you will use 44vcc.y, yacc source, and vcc.c, the yacc output you will use
45implements the core parser 45implements the core parser
46 46
47vobject.c implements an API that insulates the caller from 47vobject.c implements an API that insulates the caller from
48the parser and changes in the vCard/vCalendar BNF 48the parser and changes in the vCard/vCalendar BNF
49 49
50port.h defines compilation environment dependent stuff 50port.h defines compilation environment dependent stuff
51 51
52vcc.h and vobject.h are header files for their .c counterparts 52vcc.h and vobject.h are header files for their .c counterparts
53 53
54vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions 54vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions
55which you may find useful. 55which you may find useful.
56 56
57test.c is a standalone test driver that exercises some of 57test.c is a standalone test driver that exercises some of
58the features of the APIs provided. Invoke test.exe on a 58the features of the APIs provided. Invoke test.exe on a
59VCARD/VCALENDAR input text file and you will see the pretty 59VCARD/VCALENDAR input text file and you will see the pretty
60print output of the internal representation (this pretty print 60print output of the internal representation (this pretty print
61output should give you a good idea of how the internal 61output should give you a good idea of how the internal
62representation looks like -- there is one such output in the 62representation looks like -- there is one such output in the
63following too). Also, a file with the .out suffix is generated 63following too). Also, a file with the .out suffix is generated
64to show that the internal representation can be written back 64to show that the internal representation can be written back
65in the original text format. 65in the original text format.
66 66
67For more information on this API see the readme.txt file 67For more information on this API see the readme.txt file
68which accompanied this distribution. 68which accompanied this distribution.
69 69
70 Also visit: 70 Also visit:
71 71
72 http://www.versit.com 72 http://www.versit.com
73 http://www.ralden.com 73 http://www.ralden.com
74 74
75*/ 75*/
76 76
77// No tr() anywhere in this file 77// No tr() anywhere in this file
78 78
79 79
80#ifndef __VOBJECT_H__ 80#ifndef __VOBJECT_H__
81#define __VOBJECT_H__ 1 81#define __VOBJECT_H__ 1
82 82
83#include <qstring.h> 83#include <qstring.h>
84 84
85 #define vCardClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCard" 85 #define vCardClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCard"
86 #define vCalendarClipboardFormat"+//ISBN 1-887687-00-9::versit::PDI//vCalendar" 86 #define vCalendarClipboardFormat"+//ISBN 1-887687-00-9::versit::PDI//vCalendar"
87 87
88/* The above strings vCardClipboardFormat and vCalendarClipboardFormat 88/* The above strings vCardClipboardFormat and vCalendarClipboardFormat
89are globally unique IDs which can be used to generate clipboard format 89are globally unique IDs which can be used to generate clipboard format
90ID's as per the requirements of a specific platform. For example, in 90ID's as per the requirements of a specific platform. For example, in
91Windows they are used as the parameter in a call to RegisterClipboardFormat. 91Windows they are used as the parameter in a call to RegisterClipboardFormat.
92For example: 92For example:
93 93
94 CLIPFORMAT foo = RegisterClipboardFormat(vCardClipboardFormat); 94 CLIPFORMAT foo = RegisterClipboardFormat(vCardClipboardFormat);
95 95
96*/ 96*/
97 97
98 #define vCardMimeType "text/x-vCard" 98 #define vCardMimeType "text/x-vCard"
99 #define vCalendarMimeType"text/x-vCalendar" 99 #define vCalendarMimeType"text/x-vCalendar"
100 100
101#undef DLLEXPORT 101#undef DLLEXPORT
102#include <qglobal.h> 102#include <qglobal.h>
103#if defined(Q_WS_WIN) 103#if defined(Q_WS_WIN)
104#define DLLEXPORT(t) __declspec(dllexport) t 104#define DLLEXPORT(t) __declspec(dllexport) t
105#else 105#else
106#define DLLEXPORT(t) t 106#define DLLEXPORT(t) t
107#endif 107#endif
108 108
109#ifndef FALSE 109#ifndef FALSE
110 #define FALSE0 110 #define FALSE0
111#endif 111#endif
112#ifndef TRUE 112#ifndef TRUE
113 #define TRUE1 113 #define TRUE1
114#endif 114#endif
115 115
116#include <stdlib.h> 116#include <stdlib.h>
117#include <stdio.h> 117#include <stdio.h>
118 118
119 119
120 #define VC7bitProp "7BIT" 120 #define VC7bitProp "7BIT"
121 #define VC8bitProp "8BIT" 121 #define VC8bitProp "8BIT"
122 #define VCAAlarmProp "AALARM" 122 #define VCAAlarmProp "AALARM"
123 #define VCAdditionalNamesProp"ADDN" 123 #define VCAdditionalNamesProp"ADDN"
124 #define VCAdrProp "ADR" 124 #define VCAdrProp "ADR"
125 #define VCAgentProp "AGENT" 125 #define VCAgentProp "AGENT"
126 #define VCAIFFProp "AIFF" 126 #define VCAIFFProp "AIFF"
127 #define VCAOLProp "AOL" 127 #define VCAOLProp "AOL"
128 #define VCAppleLinkProp "APPLELINK" 128 #define VCAppleLinkProp "APPLELINK"
129 #define VCAttachProp "ATTACH" 129 #define VCAttachProp "ATTACH"
130 #define VCAttendeeProp "ATTENDEE" 130 #define VCAttendeeProp "ATTENDEE"
131 #define VCATTMailProp "ATTMAIL" 131 #define VCATTMailProp "ATTMAIL"
132 #define VCAudioContentProp "AUDIOCONTENT" 132 #define VCAudioContentProp "AUDIOCONTENT"
133 #define VCAVIProp "AVI" 133 #define VCAVIProp "AVI"
134 #define VCBase64Prop "BASE64" 134 #define VCBase64Prop "BASE64"
135 #define VCBBSProp "BBS" 135 #define VCBBSProp "BBS"
136 #define VCBirthDateProp "BDAY" 136 #define VCBirthDateProp "BDAY"
137 #define VCBMPProp "BMP" 137 #define VCBMPProp "BMP"
138 #define VCBodyProp "BODY" 138 #define VCBodyProp "BODY"
139 #define VCBusinessRoleProp "ROLE" 139 #define VCBusinessRoleProp "ROLE"
140 #define VCCalProp "VCALENDAR" 140 #define VCCalProp "VCALENDAR"
141 #define VCCaptionProp "CAP" 141 #define VCCaptionProp "CAP"
142 #define VCCardProp "VCARD" 142 #define VCCardProp "VCARD"
143 #define VCCarProp "CAR" 143 #define VCCarProp "CAR"
144 #define VCCategoriesProp "CATEGORIES" 144 #define VCCategoriesProp "CATEGORIES"
145 #define VCCellularProp "CELL" 145 #define VCCellularProp "CELL"
146 #define VCCGMProp "CGM" 146 #define VCCGMProp "CGM"
147 #define VCCharSetProp "CHARSET" 147 #define VCCharSetProp "CHARSET"
148 #define VCCIDProp "CID" 148 #define VCCIDProp "CID"
149 #define VCCISProp "CIS" 149 #define VCCISProp "CIS"
150 #define VCCityProp "L" 150 #define VCCityProp "L"
151 #define VCClassProp "CLASS" 151 #define VCClassProp "CLASS"
152 #define VCCommentProp "NOTE" 152 #define VCCommentProp "NOTE"
153 #define VCCompletedProp "COMPLETED" 153 #define VCCompletedProp "COMPLETED"
154 #define VCContentIDProp "CONTENT-ID" 154 #define VCContentIDProp "CONTENT-ID"
155 #define VCCountryNameProp "C" 155 #define VCCountryNameProp "C"
156 #define VCDAlarmProp "DALARM" 156 #define VCDAlarmProp "DALARM"
157 #define VCDataSizeProp "DATASIZE" 157 #define VCDataSizeProp "DATASIZE"
158 #define VCDayLightProp "DAYLIGHT" 158 #define VCDayLightProp "DAYLIGHT"
159 #define VCDCreatedProp "DCREATED" 159 #define VCDCreatedProp "DCREATED"
160#define VCDeliveryLabelProp "LABEL" 160#define VCDeliveryLabelProp "LABEL"
161 #define VCDescriptionProp "DESCRIPTION" 161 #define VCDescriptionProp "DESCRIPTION"
162 #define VCDIBProp "DIB" 162 #define VCDIBProp "DIB"
163 #define VCDisplayStringProp "DISPLAYSTRING" 163 #define VCDisplayStringProp "DISPLAYSTRING"
164 #define VCDomesticProp "DOM" 164 #define VCDomesticProp "DOM"
165 #define VCDTendProp "DTEND" 165 #define VCDTendProp "DTEND"
166 #define VCDTstartProp "DTSTART" 166 #define VCDTstartProp "DTSTART"
167 #define VCDueProp "DUE" 167 #define VCDueProp "DUE"
168 #define VCEmailAddressProp "EMAIL" 168 #define VCEmailAddressProp "EMAIL"
169 #define VCEncodingProp "ENCODING" 169 #define VCEncodingProp "ENCODING"
170 #define VCEndProp "END" 170 #define VCEndProp "END"
171 #define VCEventProp "VEVENT" 171 #define VCEventProp "VEVENT"
172 #define VCEWorldProp "EWORLD" 172 #define VCEWorldProp "EWORLD"
173 #define VCExNumProp "EXNUM" 173 #define VCExNumProp "EXNUM"
174 #define VCExpDateProp "EXDATE" 174 #define VCExpDateProp "EXDATE"
175 #define VCExpectProp "EXPECT" 175 #define VCExpectProp "EXPECT"
176 #define VCExtAddressProp "EXT ADD" 176 #define VCExtAddressProp "EXT ADD"
177 #define VCFamilyNameProp "F" 177 #define VCFamilyNameProp "F"
178 #define VCFaxProp "FAX" 178 #define VCFaxProp "FAX"
179 #define VCFullNameProp "FN" 179 #define VCFullNameProp "FN"
180 #define VCGeoProp "GEO" 180 #define VCGeoProp "GEO"
181 #define VCGeoLocationProp "GEO" 181 #define VCGeoLocationProp "GEO"
182 #define VCGIFProp "GIF" 182 #define VCGIFProp "GIF"
183 #define VCGivenNameProp "G" 183 #define VCGivenNameProp "G"
184 #define VCGroupingProp "Grouping" 184 #define VCGroupingProp "Grouping"
185 #define VCHomeProp "HOME" 185 #define VCHomeProp "HOME"
186 #define VCIBMMailProp "IBMMail" 186 #define VCIBMMailProp "IBMMail"
187 #define VCInlineProp "INLINE" 187 #define VCInlineProp "INLINE"
188 #define VCInternationalProp "INTL" 188 #define VCInternationalProp "INTL"
189 #define VCInternetProp "INTERNET" 189 #define VCInternetProp "INTERNET"
190 #define VCISDNProp "ISDN" 190 #define VCISDNProp "ISDN"
191 #define VCJPEGProp "JPEG" 191 #define VCJPEGProp "JPEG"
192 #define VCLanguageProp "LANG" 192 #define VCLanguageProp "LANG"
193 #define VCLastModifiedProp "LAST-MODIFIED" 193 #define VCLastModifiedProp "LAST-MODIFIED"
194 #define VCLastRevisedProp "REV" 194 #define VCLastRevisedProp "REV"
195 #define VCLocationProp "LOCATION" 195 #define VCLocationProp "LOCATION"
196 #define VCLogoProp "LOGO" 196 #define VCLogoProp "LOGO"
197 #define VCMailerProp "MAILER" 197 #define VCMailerProp "MAILER"
198 #define VCMAlarmProp "MALARM" 198 #define VCMAlarmProp "MALARM"
199 #define VCMCIMailProp "MCIMAIL" 199 #define VCMCIMailProp "MCIMAIL"
200 #define VCMessageProp "MSG" 200 #define VCMessageProp "MSG"
201 #define VCMETProp "MET" 201 #define VCMETProp "MET"
202 #define VCModemProp "MODEM" 202 #define VCModemProp "MODEM"
203 #define VCMPEG2Prop "MPEG2" 203 #define VCMPEG2Prop "MPEG2"
204 #define VCMPEGProp "MPEG" 204 #define VCMPEGProp "MPEG"
205 #define VCMSNProp "MSN" 205 #define VCMSNProp "MSN"
206 #define VCNamePrefixesProp "NPRE" 206 #define VCNamePrefixesProp "NPRE"
207 #define VCNameProp "N" 207 #define VCNameProp "N"
208 #define VCNameSuffixesProp "NSUF" 208 #define VCNameSuffixesProp "NSUF"
209 #define VCNoteProp "NOTE" 209 #define VCNoteProp "NOTE"
210 #define VCOrgNameProp "ORGNAME" 210 #define VCOrgNameProp "ORGNAME"
211 #define VCOrgProp "ORG" 211 #define VCOrgProp "ORG"
212 #define VCOrgUnit2Prop "OUN2" 212 #define VCOrgUnit2Prop "OUN2"
213 #define VCOrgUnit3Prop "OUN3" 213 #define VCOrgUnit3Prop "OUN3"
214 #define VCOrgUnit4Prop "OUN4" 214 #define VCOrgUnit4Prop "OUN4"
215 #define VCOrgUnitProp "OUN" 215 #define VCOrgUnitProp "OUN"
216 #define VCPagerProp "PAGER" 216 #define VCPagerProp "PAGER"
217 #define VCPAlarmProp "PALARM" 217 #define VCPAlarmProp "PALARM"
218 #define VCParcelProp "PARCEL" 218 #define VCParcelProp "PARCEL"
219 #define VCPartProp "PART" 219 #define VCPartProp "PART"
220 #define VCPCMProp "PCM" 220 #define VCPCMProp "PCM"
221 #define VCPDFProp "PDF" 221 #define VCPDFProp "PDF"
222 #define VCPGPProp "PGP" 222 #define VCPGPProp "PGP"
223 #define VCPhotoProp "PHOTO" 223 #define VCPhotoProp "PHOTO"
224 #define VCPICTProp "PICT" 224 #define VCPICTProp "PICT"
225 #define VCPMBProp "PMB" 225 #define VCPMBProp "PMB"
226 #define VCPostalBoxProp "BOX" 226 #define VCPostalBoxProp "BOX"
227 #define VCPostalCodeProp "PC" 227 #define VCPostalCodeProp "PC"
228 #define VCPostalProp "POSTAL" 228 #define VCPostalProp "POSTAL"
229 #define VCPowerShareProp "POWERSHARE" 229 #define VCPowerShareProp "POWERSHARE"
230 #define VCPreferredProp "PREF" 230 #define VCPreferredProp "PREF"
231 #define VCPriorityProp "PRIORITY" 231 #define VCPriorityProp "PRIORITY"
232 #define VCProcedureNameProp "PROCEDURENAME" 232 #define VCProcedureNameProp "PROCEDURENAME"
233 #define VCProdIdProp "PRODID" 233 #define VCProdIdProp "PRODID"
234 #define VCProdigyProp "PRODIGY" 234 #define VCProdigyProp "PRODIGY"
235 #define VCPronunciationProp "SOUND" 235 #define VCPronunciationProp "SOUND"
236 #define VCPSProp "PS" 236 #define VCPSProp "PS"
237 #define VCPublicKeyProp "KEY" 237 #define VCPublicKeyProp "KEY"
238 #define VCQPProp "QP" 238 #define VCQPProp "QP"
239 #define VCQuickTimeProp "QTIME" 239 #define VCQuickTimeProp "QTIME"
240 #define VCQuotedPrintableProp"QUOTED-PRINTABLE" 240 #define VCQuotedPrintableProp"QUOTED-PRINTABLE"
241 #define VCRDateProp "RDATE" 241 #define VCRDateProp "RDATE"
242 #define VCRegionProp "R" 242 #define VCRegionProp "R"
243 #define VCRelatedToProp "RELATED-TO" 243 #define VCRelatedToProp "RELATED-TO"
244 #define VCRepeatCountProp "REPEATCOUNT" 244 #define VCRepeatCountProp "REPEATCOUNT"
245 #define VCResourcesProp "RESOURCES" 245 #define VCResourcesProp "RESOURCES"
246 #define VCRNumProp "RNUM" 246 #define VCRNumProp "RNUM"
247 #define VCRoleProp "ROLE" 247 #define VCRoleProp "ROLE"
248 #define VCRRuleProp "RRULE" 248 #define VCRRuleProp "RRULE"
249 #define VCRSVPProp "RSVP" 249 #define VCRSVPProp "RSVP"
250 #define VCRunTimeProp "RUNTIME" 250 #define VCRunTimeProp "RUNTIME"
251 #define VCSequenceProp "SEQUENCE" 251 #define VCSequenceProp "SEQUENCE"
252 #define VCSnoozeTimeProp "SNOOZETIME" 252 #define VCSnoozeTimeProp "SNOOZETIME"
253 #define VCStartProp "START" 253 #define VCStartProp "START"
254 #define VCStatusProp "STATUS" 254 #define VCStatusProp "STATUS"
255 #define VCStreetAddressProp "STREET" 255 #define VCStreetAddressProp "STREET"
256 #define VCSubTypeProp "SUBTYPE" 256 #define VCSubTypeProp "SUBTYPE"
257 #define VCSummaryProp "SUMMARY" 257 #define VCSummaryProp "SUMMARY"
258 #define VCTelephoneProp "TEL" 258 #define VCTelephoneProp "TEL"
259 #define VCTIFFProp "TIFF" 259 #define VCTIFFProp "TIFF"
260 #define VCTimeZoneProp "TZ" 260 #define VCTimeZoneProp "TZ"
261 #define VCTitleProp "TITLE" 261 #define VCTitleProp "TITLE"
262 #define VCTLXProp "TLX" 262 #define VCTLXProp "TLX"
263 #define VCTodoProp "VTODO" 263 #define VCTodoProp "VTODO"
264 #define VCTranspProp "TRANSP" 264 #define VCTranspProp "TRANSP"
265 #define VCUniqueStringProp "UID" 265 #define VCUniqueStringProp "UID"
266 #define VCURLProp "URL" 266 #define VCURLProp "URL"
267 #define VCURLValueProp "URLVAL" 267 #define VCURLValueProp "URLVAL"
268 #define VCValueProp "VALUE" 268 #define VCValueProp "VALUE"
269 #define VCVersionProp "VERSION" 269 #define VCVersionProp "VERSION"
270 #define VCVideoProp "VIDEO" 270 #define VCVideoProp "VIDEO"
271 #define VCVoiceProp "VOICE" 271 #define VCVoiceProp "VOICE"
272 #define VCWAVEProp "WAVE" 272 #define VCWAVEProp "WAVE"
273 #define VCWMFProp "WMF" 273 #define VCWMFProp "WMF"
274 #define VCWorkProp "WORK" 274 #define VCWorkProp "WORK"
275 #define VCX400Prop "X400" 275 #define VCX400Prop "X400"
276 #define VCX509Prop "X509" 276 #define VCX509Prop "X509"
277 #define VCXRuleProp "XRULE" 277 #define VCXRuleProp "XRULE"
278 278
279 279
280typedef struct VObject VObject; 280typedef struct VObject VObject;
281 281
282typedef struct VObjectIterator { 282typedef struct VObjectIterator {
283 VObject* start; 283 VObject* start;
284 VObject* next; 284 VObject* next;
285 } VObjectIterator; 285 } VObjectIterator;
286 286
287extern DLLEXPORT(VObject*) newVObject(const char *id); 287extern DLLEXPORT(VObject*) newVObject(const char *id);
288extern DLLEXPORT(void) deleteVObject(VObject *p); 288extern DLLEXPORT(void) deleteVObject(VObject *p);
289extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size); 289extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size);
290extern DLLEXPORT(void) deleteStr(const char *p); 290extern DLLEXPORT(void) deleteStr(const char *p);
291extern DLLEXPORT(void) unUseStr(const char *s); 291extern DLLEXPORT(void) unUseStr(const char *s);
292 292
293extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id); 293extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id);
294extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s); 294extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s);
295extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s); 295extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s);
296extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i); 296extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i);
297extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l); 297extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l);
298extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t); 298extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t);
299extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size); 299extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size);
300extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size); 300extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size);
301 301
302extern DLLEXPORT(const char*) vObjectName(VObject *o); 302extern DLLEXPORT(const char*) vObjectName(VObject *o);
303extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o); 303extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o);
304extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o); 304extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o);
305extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o); 305extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o);
306extern DLLEXPORT(void*) vObjectAnyValue(VObject *o); 306extern DLLEXPORT(void*) vObjectAnyValue(VObject *o);
307extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o); 307extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o);
308extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p); 308extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p);
309 309
310extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p); 310extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p);
311extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id); 311extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id);
312extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id); 312extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id);
313extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v); 313extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v);
314extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size); 314extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size);
315extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size); 315extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size);
316extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g); 316extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g);
317extern DLLEXPORT(void) addList(VObject **o, VObject *p); 317extern DLLEXPORT(void) addList(VObject **o, VObject *p);
318 318
319extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id); 319extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id);
320 320
321extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o); 321extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o);
322extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o); 322extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o);
323extern DLLEXPORT(int) moreIteration(VObjectIterator *i); 323extern DLLEXPORT(int) moreIteration(VObjectIterator *i);
324extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i); 324extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i);
325 325
326extern DLLEXPORT(const char*) lookupStr(const char *s); 326extern DLLEXPORT(const char*) lookupStr(const char *s);
327extern DLLEXPORT(void) cleanStrTbl(); 327extern DLLEXPORT(void) cleanStrTbl();
328 328
329extern DLLEXPORT(void) cleanVObject(VObject *o); 329extern DLLEXPORT(void) cleanVObject(VObject *o);
330extern DLLEXPORT(void) cleanVObjects(VObject *list); 330extern DLLEXPORT(void) cleanVObjects(VObject *list);
331 331
332extern DLLEXPORT(const char*) lookupProp(const char* str); 332extern DLLEXPORT(const char*) lookupProp(const char* str);
333extern DLLEXPORT(const char*) lookupProp_(const char* str); 333extern DLLEXPORT(const char*) lookupProp_(const char* str);
334 334
335extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o); 335extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o);
336extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list); 336extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list);
337 337
338extern DLLEXPORT(int) vObjectValueType(VObject *o); 338extern DLLEXPORT(int) vObjectValueType(VObject *o);
339 339
340/* return type of vObjectValueType: */ 340/* return type of vObjectValueType: */
341 #define VCVT_NOVALUE0 341 #define VCVT_NOVALUE0
342 /* if the VObject has no value associated with it. */ 342 /* if the VObject has no value associated with it. */
343 #define VCVT_STRINGZ1 343 #define VCVT_STRINGZ1
344 /* if the VObject has value set by setVObjectStringZValue. */ 344 /* if the VObject has value set by setVObjectStringZValue. */
345 #define VCVT_UINT 2 345 #define VCVT_UINT 2
346 /* if the VObject has value set by setVObjectIntegerValue. */ 346 /* if the VObject has value set by setVObjectIntegerValue. */
347 #define VCVT_ULONG 3 347 #define VCVT_ULONG 3
348 /* if the VObject has value set by setVObjectLongValue. */ 348 /* if the VObject has value set by setVObjectLongValue. */
349 #define VCVT_RAW 4 349 #define VCVT_RAW 4
350 /* if the VObject has value set by setVObjectAnyValue. */ 350 /* if the VObject has value set by setVObjectAnyValue. */
351 #define VCVT_VOBJECT5 351 #define VCVT_VOBJECT5
352 /* if the VObject has value set by setVObjectVObjectValue. */ 352 /* if the VObject has value set by setVObjectVObjectValue. */
353 353
354extern const char** fieldedProp; 354extern const char** fieldedProp;
355 355
356/*************************************************** 356/***************************************************
357 * The methods below are implemented in vcc.c (generated from vcc.y ) 357 * The methods below are implemented in vcc.c (generated from vcc.y )
358 ***************************************************/ 358 ***************************************************/
359 359
360/* NOTE regarding printVObject and writeVObject 360/* NOTE regarding printVObject and writeVObject
361 361
362The functions below are not exported from the DLL because they 362The functions below are not exported from the DLL because they
363take a FILE* as a parameter, which cannot be passed across a DLL 363take a FILE* as a parameter, which cannot be passed across a DLL
364interface (at least that is my experience). Instead you can use 364interface (at least that is my experience). Instead you can use
365their companion functions which take file names or pointers 365their companion functions which take file names or pointers
366to memory. However, if you are linking this code into 366to memory. However, if you are linking this code into
367your build directly then you may find them a more convenient API 367your build directly then you may find them a more convenient API
368and you can go ahead and use them. If you try to use them with 368and you can go ahead and use them. If you try to use them with
369the DLL LIB you will get a link error. 369the DLL LIB you will get a link error.
370*/ 370*/
371extern void writeVObject(FILE *fp, VObject *o); 371extern void writeVObject(FILE *fp, VObject *o);
372 372
373 373
374 374
375typedef void (*MimeErrorHandler)(char *); 375typedef void (*MimeErrorHandler)(char *);
376 376
377extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler); 377extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler);
378 378
379extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len); 379extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len);
380extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname); 380extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname);
381 381
382 382
383/* NOTE regarding Parse_MIME_FromFile 383/* NOTE regarding Parse_MIME_FromFile
384The function above, Parse_MIME_FromFile, comes in two flavors, 384The function above, Parse_MIME_FromFile, comes in two flavors,
385neither of which is exported from the DLL. Each version takes 385neither of which is exported from the DLL. Each version takes
386a CFile or FILE* as a parameter, neither of which can be 386a CFile or FILE* as a parameter, neither of which can be
387passed across a DLL interface (at least that is my experience). 387passed across a DLL interface (at least that is my experience).
388If you are linking this code into your build directly then 388If you are linking this code into your build directly then
389you may find them a more convenient API that the other flavors 389you may find them a more convenient API that the other flavors
390that take a file name. If you use them with the DLL LIB you 390that take a file name. If you use them with the DLL LIB you
391will get a link error. 391will get a link error.
392*/ 392*/
393 393
394 394
395#if INCLUDEMFC 395#if INCLUDEMFC
396extern VObject* Parse_MIME_FromFile(CFile *file); 396extern VObject* Parse_MIME_FromFile(CFile *file);
397#else 397#else
398extern VObject* Parse_MIME_FromFile(FILE *file); 398extern VObject* Parse_MIME_FromFile(FILE *file);
399#endif 399#endif
400 400
401#define __SHARP_COMP_
402
403#ifndef __SHARP_COMP_
401extern DLLEXPORT(const char *) vObjectTypeInfo(VObject *o); 404extern DLLEXPORT(const char *) vObjectTypeInfo(VObject *o);
402 405
406#else
407// This function is not available in the Sharp ROM for SL 5500 !
408// Therefore I have to move it into the header file.. (se)
409
410inline const char* vObjectTypeInfo(VObject *o)
411{
412 const char *type = vObjectName( o );
413 if ( strcmp( type, "TYPE" ) == 0 )
414 type = vObjectStringZValue( o );
415 return type;
416}
417#endif
403 418
404#endif /* __VOBJECT_H__ */ 419#endif /* __VOBJECT_H__ */
405 420
406 421