summaryrefslogtreecommitdiff
path: root/library/backend/vobject.cpp
Unidiff
Diffstat (limited to 'library/backend/vobject.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/backend/vobject.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/library/backend/vobject.cpp b/library/backend/vobject.cpp
index 4c8de70..9263c3a 100644
--- a/library/backend/vobject.cpp
+++ b/library/backend/vobject.cpp
@@ -1,143 +1,141 @@
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 * src: vobject.c 40 * src: vobject.c
41 * doc: vobject and APIs to construct vobject, APIs pretty print 41 * doc: vobject and APIs to construct vobject, APIs pretty print
42 * vobject, and convert a vobject into its textual representation. 42 * vobject, and convert a vobject into its textual representation.
43 */ 43 */
44 44
45 #ifndef MWERKS 45#include <stdlib.h>
46#include <malloc.h>
47#endif
48 46
49#include <qtopia/config.h> 47#include <qtopia/config.h>
50#include "vobject_p.h" 48#include "vobject_p.h"
51#include "qfiledirect_p.h" 49#include "qfiledirect_p.h"
52#include <string.h> 50#include <string.h>
53#include <stdio.h> 51#include <stdio.h>
54#include <fcntl.h> 52#include <fcntl.h>
55//#include <io.h> 53//#include <io.h>
56 54
57 55
58 #define NAME_OF(o) o->id 56 #define NAME_OF(o) o->id
59 #define VALUE_TYPE(o) o->valType 57 #define VALUE_TYPE(o) o->valType
60 #define STRINGZ_VALUE_OF(o) o->val.strs 58 #define STRINGZ_VALUE_OF(o) o->val.strs
61 #define INTEGER_VALUE_OF(o) o->val.i 59 #define INTEGER_VALUE_OF(o) o->val.i
62 #define LONG_VALUE_OF(o) o->val.l 60 #define LONG_VALUE_OF(o) o->val.l
63 #define ANY_VALUE_OF(o) o->val.any 61 #define ANY_VALUE_OF(o) o->val.any
64 #define VOBJECT_VALUE_OF(o) o->val.vobj 62 #define VOBJECT_VALUE_OF(o) o->val.vobj
65 63
66static char vobj_cs[10]; 64static char vobj_cs[10];
67static enum { EightBit, QuotedPrintable, Base64 } vobj_enc=EightBit; 65static enum { EightBit, QuotedPrintable, Base64 } vobj_enc=EightBit;
68static const char *vobj_enc_s=0; 66static const char *vobj_enc_s=0;
69 67
70typedef union ValueItem { 68typedef union ValueItem {
71 const char *strs; 69 const char *strs;
72 unsigned int i; 70 unsigned int i;
73 unsigned long l; 71 unsigned long l;
74 void *any; 72 void *any;
75 VObject *vobj; 73 VObject *vobj;
76 } ValueItem; 74 } ValueItem;
77 75
78struct VObject { 76struct VObject {
79 VObject *next; 77 VObject *next;
80 const char *id; 78 const char *id;
81 VObject *prop; 79 VObject *prop;
82 unsigned short valType; 80 unsigned short valType;
83 ValueItem val; 81 ValueItem val;
84 }; 82 };
85 83
86typedef struct StrItem StrItem; 84typedef struct StrItem StrItem;
87 85
88struct StrItem { 86struct StrItem {
89 StrItem *next; 87 StrItem *next;
90 const char *s; 88 const char *s;
91 unsigned int refCnt; 89 unsigned int refCnt;
92 }; 90 };
93 91
94DLLEXPORT(const char**) fieldedProp; 92DLLEXPORT(const char**) fieldedProp;
95 93
96 94
97 95
98/*---------------------------------------------------------------------- 96/*----------------------------------------------------------------------
99 The following functions involve with memory allocation: 97 The following functions involve with memory allocation:
100 newVObject 98 newVObject
101 deleteVObject 99 deleteVObject
102 dupStr 100 dupStr
103 deleteStr 101 deleteStr
104 newStrItem 102 newStrItem
105 deleteStrItem 103 deleteStrItem
106 ----------------------------------------------------------------------*/ 104 ----------------------------------------------------------------------*/
107 105
108DLLEXPORT(VObject*) newVObject_(const char *id) 106DLLEXPORT(VObject*) newVObject_(const char *id)
109{ 107{
110 VObject *p = (VObject*)malloc(sizeof(VObject)); 108 VObject *p = (VObject*)malloc(sizeof(VObject));
111 p->next = 0; 109 p->next = 0;
112 p->id = id; 110 p->id = id;
113 p->prop = 0; 111 p->prop = 0;
114 VALUE_TYPE(p) = 0; 112 VALUE_TYPE(p) = 0;
115 ANY_VALUE_OF(p) = 0; 113 ANY_VALUE_OF(p) = 0;
116 return p; 114 return p;
117} 115}
118 116
119DLLEXPORT(VObject*) newVObject(const char *id) 117DLLEXPORT(VObject*) newVObject(const char *id)
120{ 118{
121 return newVObject_(lookupStr(id)); 119 return newVObject_(lookupStr(id));
122} 120}
123 121
124DLLEXPORT(void) deleteVObject(VObject *p) 122DLLEXPORT(void) deleteVObject(VObject *p)
125{ 123{
126 unUseStr(p->id); 124 unUseStr(p->id);
127 free(p); 125 free(p);
128} 126}
129 127
130DLLEXPORT(char*) dupStr(const char *s, unsigned int size) 128DLLEXPORT(char*) dupStr(const char *s, unsigned int size)
131{ 129{
132 char *t; 130 char *t;
133 if (size == 0) { 131 if (size == 0) {
134 size = strlen(s); 132 size = strlen(s);
135 } 133 }
136 t = (char*)malloc(size+1); 134 t = (char*)malloc(size+1);
137 if (t) { 135 if (t) {
138 memcpy(t,s,size); 136 memcpy(t,s,size);
139 t[size] = 0; 137 t[size] = 0;
140 return t; 138 return t;
141 } 139 }
142 else { 140 else {
143 return (char*)0; 141 return (char*)0;
@@ -664,193 +662,192 @@ static struct PreDefProp propNames[] = {
664 { VCCarProp, 0, 0, 0 }, 662 { VCCarProp, 0, 0, 0 },
665 { VCCategoriesProp, 0, 0, 0 }, 663 { VCCategoriesProp, 0, 0, 0 },
666 { VCCellularProp, 0, 0, 0 }, 664 { VCCellularProp, 0, 0, 0 },
667 { VCCGMProp, 0, 0, 0 }, 665 { VCCGMProp, 0, 0, 0 },
668 { VCCharSetProp, 0, 0, 0 }, 666 { VCCharSetProp, 0, 0, 0 },
669 { VCCIDProp, VCContentIDProp, 0, 0 }, 667 { VCCIDProp, VCContentIDProp, 0, 0 },
670 { VCCISProp, 0, 0, 0 }, 668 { VCCISProp, 0, 0, 0 },
671 { VCCityProp, 0, 0, 0 }, 669 { VCCityProp, 0, 0, 0 },
672 { VCClassProp, 0, 0, 0 }, 670 { VCClassProp, 0, 0, 0 },
673 { VCCommentProp, 0, 0, 0 }, 671 { VCCommentProp, 0, 0, 0 },
674 { VCCompletedProp, 0, 0, 0 }, 672 { VCCompletedProp, 0, 0, 0 },
675 { VCContentIDProp, 0, 0, 0 }, 673 { VCContentIDProp, 0, 0, 0 },
676 { VCCountryNameProp, 0, 0, 0 }, 674 { VCCountryNameProp, 0, 0, 0 },
677 { VCDAlarmProp, 0, DAlarmFields, 0 }, 675 { VCDAlarmProp, 0, DAlarmFields, 0 },
678 { VCDataSizeProp, 0, 0, PD_INTERNAL }, 676 { VCDataSizeProp, 0, 0, PD_INTERNAL },
679 { VCDayLightProp, 0, 0, 0 }, 677 { VCDayLightProp, 0, 0, 0 },
680 { VCDCreatedProp, 0, 0, 0 }, 678 { VCDCreatedProp, 0, 0, 0 },
681 { VCDeliveryLabelProp, 0, 0, 0 }, 679 { VCDeliveryLabelProp, 0, 0, 0 },
682 { VCDescriptionProp, 0, 0, 0 }, 680 { VCDescriptionProp, 0, 0, 0 },
683 { VCDIBProp, 0, 0, 0 }, 681 { VCDIBProp, 0, 0, 0 },
684 { VCDisplayStringProp, 0, 0, 0 }, 682 { VCDisplayStringProp, 0, 0, 0 },
685 { VCDomesticProp, 0, 0, 0 }, 683 { VCDomesticProp, 0, 0, 0 },
686 { VCDTendProp, 0, 0, 0 }, 684 { VCDTendProp, 0, 0, 0 },
687 { VCDTstartProp, 0, 0, 0 }, 685 { VCDTstartProp, 0, 0, 0 },
688 { VCDueProp, 0, 0, 0 }, 686 { VCDueProp, 0, 0, 0 },
689 { VCEmailAddressProp, 0, 0, 0 }, 687 { VCEmailAddressProp, 0, 0, 0 },
690 { VCEncodingProp, 0, 0, 0 }, 688 { VCEncodingProp, 0, 0, 0 },
691 { VCEndProp, 0, 0, 0 }, 689 { VCEndProp, 0, 0, 0 },
692 { VCEventProp, 0, 0, PD_BEGIN }, 690 { VCEventProp, 0, 0, PD_BEGIN },
693 { VCEWorldProp, 0, 0, 0 }, 691 { VCEWorldProp, 0, 0, 0 },
694 { VCExNumProp, 0, 0, 0 }, 692 { VCExNumProp, 0, 0, 0 },
695 { VCExpDateProp, 0, 0, 0 }, 693 { VCExpDateProp, 0, 0, 0 },
696 { VCExpectProp, 0, 0, 0 }, 694 { VCExpectProp, 0, 0, 0 },
697 { VCExtAddressProp, 0, 0, 0 }, 695 { VCExtAddressProp, 0, 0, 0 },
698 { VCFamilyNameProp, 0, 0, 0 }, 696 { VCFamilyNameProp, 0, 0, 0 },
699 { VCFaxProp, 0, 0, 0 }, 697 { VCFaxProp, 0, 0, 0 },
700 { VCFullNameProp, 0, 0, 0 }, 698 { VCFullNameProp, 0, 0, 0 },
701 { VCGeoLocationProp, 0, 0, 0 }, 699 { VCGeoLocationProp, 0, 0, 0 },
702 { VCGeoProp, 0, 0, 0 }, 700 { VCGeoProp, 0, 0, 0 },
703 { VCGIFProp, 0, 0, 0 }, 701 { VCGIFProp, 0, 0, 0 },
704 { VCGivenNameProp, 0, 0, 0 }, 702 { VCGivenNameProp, 0, 0, 0 },
705 { VCGroupingProp, 0, 0, 0 }, 703 { VCGroupingProp, 0, 0, 0 },
706 { VCHomeProp, 0, 0, 0 }, 704 { VCHomeProp, 0, 0, 0 },
707 { VCIBMMailProp, 0, 0, 0 }, 705 { VCIBMMailProp, 0, 0, 0 },
708 { VCInlineProp, 0, 0, 0 }, 706 { VCInlineProp, 0, 0, 0 },
709 { VCInternationalProp, 0, 0, 0 }, 707 { VCInternationalProp, 0, 0, 0 },
710 { VCInternetProp, 0, 0, 0 }, 708 { VCInternetProp, 0, 0, 0 },
711 { VCISDNProp, 0, 0, 0 }, 709 { VCISDNProp, 0, 0, 0 },
712 { VCJPEGProp, 0, 0, 0 }, 710 { VCJPEGProp, 0, 0, 0 },
713 { VCLanguageProp, 0, 0, 0 }, 711 { VCLanguageProp, 0, 0, 0 },
714 { VCLastModifiedProp, 0, 0, 0 }, 712 { VCLastModifiedProp, 0, 0, 0 },
715 { VCLastRevisedProp, 0, 0, 0 }, 713 { VCLastRevisedProp, 0, 0, 0 },
716 { VCLocationProp, 0, 0, 0 }, 714 { VCLocationProp, 0, 0, 0 },
717 { VCLogoProp, 0, 0, 0 }, 715 { VCLogoProp, 0, 0, 0 },
718 { VCMailerProp, 0, 0, 0 }, 716 { VCMailerProp, 0, 0, 0 },
719 { VCMAlarmProp, 0, MAlarmFields, 0 }, 717 { VCMAlarmProp, 0, MAlarmFields, 0 },
720 { VCMCIMailProp, 0, 0, 0 }, 718 { VCMCIMailProp, 0, 0, 0 },
721 { VCMessageProp, 0, 0, 0 }, 719 { VCMessageProp, 0, 0, 0 },
722 { VCMETProp, 0, 0, 0 }, 720 { VCMETProp, 0, 0, 0 },
723 { VCModemProp, 0, 0, 0 }, 721 { VCModemProp, 0, 0, 0 },
724 { VCMPEG2Prop, 0, 0, 0 }, 722 { VCMPEG2Prop, 0, 0, 0 },
725 { VCMPEGProp, 0, 0, 0 }, 723 { VCMPEGProp, 0, 0, 0 },
726 { VCMSNProp, 0, 0, 0 }, 724 { VCMSNProp, 0, 0, 0 },
727 { VCNamePrefixesProp, 0, 0, 0 }, 725 { VCNamePrefixesProp, 0, 0, 0 },
728 { VCNameProp, 0, nameFields, 0 }, 726 { VCNameProp, 0, nameFields, 0 },
729 { VCNameSuffixesProp, 0, 0, 0 }, 727 { VCNameSuffixesProp, 0, 0, 0 },
730 { VCNoteProp, 0, 0, 0 }, 728 { VCNoteProp, 0, 0, 0 },
731 { VCOrgNameProp, 0, 0, 0 }, 729 { VCOrgNameProp, 0, 0, 0 },
732 { VCOrgProp, 0, orgFields, 0 }, 730 { VCOrgProp, 0, orgFields, 0 },
733 { VCOrgUnit2Prop, 0, 0, 0 }, 731 { VCOrgUnit2Prop, 0, 0, 0 },
734 { VCOrgUnit3Prop, 0, 0, 0 }, 732 { VCOrgUnit3Prop, 0, 0, 0 },
735 { VCOrgUnit4Prop, 0, 0, 0 }, 733 { VCOrgUnit4Prop, 0, 0, 0 },
736 { VCOrgUnitProp, 0, 0, 0 }, 734 { VCOrgUnitProp, 0, 0, 0 },
737 { VCPagerProp, 0, 0, 0 }, 735 { VCPagerProp, 0, 0, 0 },
738 { VCPAlarmProp, 0, PAlarmFields, 0 }, 736 { VCPAlarmProp, 0, PAlarmFields, 0 },
739 { VCParcelProp, 0, 0, 0 }, 737 { VCParcelProp, 0, 0, 0 },
740 { VCPartProp, 0, 0, 0 }, 738 { VCPartProp, 0, 0, 0 },
741 { VCPCMProp, 0, 0, 0 }, 739 { VCPCMProp, 0, 0, 0 },
742 { VCPDFProp, 0, 0, 0 }, 740 { VCPDFProp, 0, 0, 0 },
743 { VCPGPProp, 0, 0, 0 }, 741 { VCPGPProp, 0, 0, 0 },
744 { VCPhotoProp, 0, 0, 0 }, 742 { VCPhotoProp, 0, 0, 0 },
745 { VCPICTProp, 0, 0, 0 }, 743 { VCPICTProp, 0, 0, 0 },
746 { VCPMBProp, 0, 0, 0 }, 744 { VCPMBProp, 0, 0, 0 },
747 { VCPostalBoxProp, 0, 0, 0 }, 745 { VCPostalBoxProp, 0, 0, 0 },
748 { VCPostalCodeProp, 0, 0, 0 }, 746 { VCPostalCodeProp, 0, 0, 0 },
749 { VCPostalProp, 0, 0, 0 }, 747 { VCPostalProp, 0, 0, 0 },
750 { VCPowerShareProp, 0, 0, 0 }, 748 { VCPowerShareProp, 0, 0, 0 },
751 { VCPreferredProp, 0, 0, 0 }, 749 { VCPreferredProp, 0, 0, 0 },
752 { VCPriorityProp, 0, 0, 0 }, 750 { VCPriorityProp, 0, 0, 0 },
753 { VCProcedureNameProp, 0, 0, 0 }, 751 { VCProcedureNameProp, 0, 0, 0 },
754 { VCProdIdProp, 0, 0, 0 }, 752 { VCProdIdProp, 0, 0, 0 },
755 { VCProdigyProp, 0, 0, 0 }, 753 { VCProdigyProp, 0, 0, 0 },
756 { VCPronunciationProp, 0, 0, 0 }, 754 { VCPronunciationProp, 0, 0, 0 },
757 { VCPSProp, 0, 0, 0 }, 755 { VCPSProp, 0, 0, 0 },
758 { VCPublicKeyProp, 0, 0, 0 }, 756 { VCPublicKeyProp, 0, 0, 0 },
759 { VCQPProp, VCQuotedPrintableProp, 0, 0 }, 757 { VCQPProp, VCQuotedPrintableProp, 0, 0 },
760 { VCQPProp, VCBase64Prop, 0, 0 },
761 { VCQuickTimeProp, 0, 0, 0 }, 758 { VCQuickTimeProp, 0, 0, 0 },
762 { VCQuotedPrintableProp, 0, 0, 0 }, 759 { VCQuotedPrintableProp, 0, 0, 0 },
763 { VCRDateProp, 0, 0, 0 }, 760 { VCRDateProp, 0, 0, 0 },
764 { VCRegionProp, 0, 0, 0 }, 761 { VCRegionProp, 0, 0, 0 },
765 { VCRelatedToProp, 0, 0, 0 }, 762 { VCRelatedToProp, 0, 0, 0 },
766 { VCRepeatCountProp, 0, 0, 0 }, 763 { VCRepeatCountProp, 0, 0, 0 },
767 { VCResourcesProp, 0, 0, 0 }, 764 { VCResourcesProp, 0, 0, 0 },
768 { VCRNumProp, 0, 0, 0 }, 765 { VCRNumProp, 0, 0, 0 },
769 { VCRoleProp, 0, 0, 0 }, 766 { VCRoleProp, 0, 0, 0 },
770 { VCRRuleProp, 0, 0, 0 }, 767 { VCRRuleProp, 0, 0, 0 },
771 { VCRSVPProp, 0, 0, 0 }, 768 { VCRSVPProp, 0, 0, 0 },
772 { VCRunTimeProp, 0, 0, 0 }, 769 { VCRunTimeProp, 0, 0, 0 },
773 { VCSequenceProp, 0, 0, 0 }, 770 { VCSequenceProp, 0, 0, 0 },
774 { VCSnoozeTimeProp, 0, 0, 0 }, 771 { VCSnoozeTimeProp, 0, 0, 0 },
775 { VCStartProp, 0, 0, 0 }, 772 { VCStartProp, 0, 0, 0 },
776 { VCStatusProp, 0, 0, 0 }, 773 { VCStatusProp, 0, 0, 0 },
777 { VCStreetAddressProp, 0, 0, 0 }, 774 { VCStreetAddressProp, 0, 0, 0 },
778 { VCSubTypeProp, 0, 0, 0 }, 775 { VCSubTypeProp, 0, 0, 0 },
779 { VCSummaryProp, 0, 0, 0 }, 776 { VCSummaryProp, 0, 0, 0 },
780 { VCTelephoneProp, 0, 0, 0 }, 777 { VCTelephoneProp, 0, 0, 0 },
781 { VCTIFFProp, 0, 0, 0 }, 778 { VCTIFFProp, 0, 0, 0 },
782 { VCTimeZoneProp, 0, 0, 0 }, 779 { VCTimeZoneProp, 0, 0, 0 },
783 { VCTitleProp, 0, 0, 0 }, 780 { VCTitleProp, 0, 0, 0 },
784 { VCTLXProp, 0, 0, 0 }, 781 { VCTLXProp, 0, 0, 0 },
785 { VCTodoProp, 0, 0, PD_BEGIN }, 782 { VCTodoProp, 0, 0, PD_BEGIN },
786 { VCTranspProp, 0, 0, 0 }, 783 { VCTranspProp, 0, 0, 0 },
787 { VCUniqueStringProp, 0, 0, 0 }, 784 { VCUniqueStringProp, 0, 0, 0 },
788 { VCURLProp, 0, 0, 0 }, 785 { VCURLProp, 0, 0, 0 },
789 { VCURLValueProp, 0, 0, 0 }, 786 { VCURLValueProp, 0, 0, 0 },
790 { VCValueProp, 0, 0, 0 }, 787 { VCValueProp, 0, 0, 0 },
791 { VCVersionProp, 0, 0, 0 }, 788 { VCVersionProp, 0, 0, 0 },
792 { VCVideoProp, 0, 0, 0 }, 789 { VCVideoProp, 0, 0, 0 },
793 { VCVoiceProp, 0, 0, 0 }, 790 { VCVoiceProp, 0, 0, 0 },
794 { VCWAVEProp, 0, 0, 0 }, 791 { VCWAVEProp, 0, 0, 0 },
795 { VCWMFProp, 0, 0, 0 }, 792 { VCWMFProp, 0, 0, 0 },
796 { VCWorkProp, 0, 0, 0 }, 793 { VCWorkProp, 0, 0, 0 },
797 { VCX400Prop, 0, 0, 0 }, 794 { VCX400Prop, 0, 0, 0 },
798 { VCX509Prop, 0, 0, 0 }, 795 { VCX509Prop, 0, 0, 0 },
799 { VCXRuleProp, 0, 0, 0 }, 796 { VCXRuleProp, 0, 0, 0 },
800 { 0,0,0,0 } 797 { 0,0,0,0 }
801 }; 798 };
802 799
803 800
804static struct PreDefProp* lookupPropInfo(const char* str) 801static struct PreDefProp* lookupPropInfo(const char* str)
805{ 802{
806 /* brute force for now, could use a hash table here. */ 803 /* brute force for now, could use a hash table here. */
807 int i; 804 int i;
808 805
809 for (i = 0; propNames[i].name; i++) 806 for (i = 0; propNames[i].name; i++)
810 if (qstricmp(str, propNames[i].name) == 0) { 807 if (qstricmp(str, propNames[i].name) == 0) {
811 return &propNames[i]; 808 return &propNames[i];
812 } 809 }
813 810
814 return 0; 811 return 0;
815} 812}
816 813
817 814
818DLLEXPORT(const char*) lookupProp_(const char* str) 815DLLEXPORT(const char*) lookupProp_(const char* str)
819{ 816{
820 int i; 817 int i;
821 818
822 for (i = 0; propNames[i].name; i++) 819 for (i = 0; propNames[i].name; i++)
823 if (qstricmp(str, propNames[i].name) == 0) { 820 if (qstricmp(str, propNames[i].name) == 0) {
824 const char* s; 821 const char* s;
825 s = propNames[i].alias?propNames[i].alias:propNames[i].name; 822 s = propNames[i].alias?propNames[i].alias:propNames[i].name;
826 return lookupStr(s); 823 return lookupStr(s);
827 } 824 }
828 return lookupStr(str); 825 return lookupStr(str);
829} 826}
830 827
831 828
832DLLEXPORT(const char*) lookupProp(const char* str) 829DLLEXPORT(const char*) lookupProp(const char* str)
833{ 830{
834 int i; 831 int i;
835 832
836 for (i = 0; propNames[i].name; i++) 833 for (i = 0; propNames[i].name; i++)
837 if (qstricmp(str, propNames[i].name) == 0) { 834 if (qstricmp(str, propNames[i].name) == 0) {
838 const char *s; 835 const char *s;
839 fieldedProp = propNames[i].fields; 836 fieldedProp = propNames[i].fields;
840 s = propNames[i].alias?propNames[i].alias:propNames[i].name; 837 s = propNames[i].alias?propNames[i].alias:propNames[i].name;
841 return lookupStr(s); 838 return lookupStr(s);
842 } 839 }
843 fieldedProp = 0; 840 fieldedProp = 0;
844 return lookupStr(str); 841 return lookupStr(str);
845} 842}
846 843
847 844
848/*---------------------------------------------------------------------- 845/*----------------------------------------------------------------------
849 APIs to Output text form. 846 APIs to Output text form.
850 ----------------------------------------------------------------------*/ 847 ----------------------------------------------------------------------*/
851#define OFILE_REALLOC_SIZE 256 848#define OFILE_REALLOC_SIZE 256
852typedef struct OFile { 849typedef struct OFile {
853 FILE *fp; 850 FILE *fp;
854 char *s; 851 char *s;
855 int len; 852 int len;
856 int limit; 853 int limit;