File: fld.c

package info (click to toggle)
abiword 0.7.7-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 20,604 kB
  • ctags: 18,358
  • sloc: cpp: 88,791; ansic: 66,296; sh: 7,777; makefile: 3,397; xml: 687; perl: 361; awk: 273; sed: 36; csh: 28
file content (278 lines) | stat: -rw-r--r-- 6,557 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
#include <stdlib.h>
#include <stdio.h>
#include "wv.h"

/*
 flt value live/dead field type

 1                   unknown keyword

 2         live      possible bookmark (syntax matches bookmark name)

 3         live      bookmark reference

 4         dead      index entry

 5         live      footnote reference

 6         live      Set command (for Print Merge)

 7         live      If command (for Print Merge)

 8         live      create index

 9         dead      table of contents entry

 10        live      Style reference

 11        dead      document reference

 12        live      sequence mark

 13        live      create table-of-contents

 14        live      quote Info variable

 15        live      quote Title variable

 16        live      quote Subject variable

 17        live      quote Author variable

 18        live      quote Keywords variable

 19        live      quote Comments variable

 20        live      quote Last Revised By variable

 21        live      quote Creation Date variable

 22        live      quote Revision Date variable

 23        live      quote Print Date variable

 24        live      quote Revision Number variable

 25        live      quote Edit Time variable

 26        live      quote Number of Pages variable

 27        live      quote Number of Words variable

 28        live      quote Number of Characters variable

 29        live      quote File Name variable

 30        live      quote Document Template Name variable

 31        live      quote Current Date variable

 32        live      quote Current Time variable

 33        live      quote Current Page variable

 34        live      evaluate expression

 35        live      insert literal text

 36        live      Include command (Print Merge)

 37        live      page reference

 38        live      Ask command (Print Merge)

 39        live      Fill-in command to display prompt (Print Merge)

 40        live      Data command (Print Merge)

 41        live      Next command (Print Merge)

 42        live      NextIf command (Print Merge)

 43        live      SkipIf (Print Merge)

 44        live      inserts number of current Print Merge record

 45        live      DDE reference

 46        live      DDE automatic reference

 47        live      Inserts Glossary Entry

 48        live      sends characters to printer without translation

 49        live      Formula definition

 50        live      Goto Button

 51        live      Macro Button

 52        live      insert auto numbering field in outline format

 53        live      insert auto numbering field in legal format

 54        live      insert auto numbering field in Arabic number format

 55        live      reads a TIFF file

 56        live      Link

 57        live      Symbol

 58        live      Embedded Object

 59        live      Merge fields

 60        live      User Name

 61        live      User Initial

 62        live      User Address

 63        live      Bar code

 64        live      Document variable

 65        live      Section

 66        live      Section pages

 67        live      Include Picture

 68        live      Include Text

 69        live      File Size

 70        live      Form Text Box

 71        live      Form Check Box

 72        live      Note Reference

 73        live      Create Table of Authorities

 74        dead      Mark Table of Authorities Entry

 75        live      Merge record sequence number

 76        either    Macro

 77        dead      Private

 78        live      Insert Database

 79        live      Autotext

 80        live      Compare two values

 81        live      Plug-in module private

 82        live      Subscriber

 83        live      Form List Box

 84        live      Advance

 85        live      Document property

 86        live

 87        live      OCX

 88        live      Hyperlink

 89        live      AutoTextList

 90        live      List element

 91        live      HTML control

Since dead fields have no entry in the plcffld, the string in the field code
must be used to determine the field type. All versions of Word '97 use
English field code strings, except French, German, and Spanish versions of
Word. The strings for all languages for all possible dead fields are listed
below.

 flt      English    French     German     Spanish       field type
 value    string     string     string     string

 4        XE         EX         XE         E             index entry

 9        TC         TE         INHALT     TC            table of contents
                                                         entry

 11       RD         RD         RD         RD            document reference

 74       TA         TA         TA         TA            Mark Table of
                                                         Authorities Entry

 76                                                      Macro

 77       PRIVATE    PRIVE      PRIVATE    PRIVATESPA    Private
*/


void wvGetFLD(FLD *item,FILE *fd)
	{
	U8 temp8;
	U8 ch;

	temp8 = getc(fd);
	ch = temp8 & 0x1f;
	if (ch == 19)
		{
		item->var1.ch = temp8 & 0x1f;
		item->var1.reserved = (temp8 & 0xe0)>>5;
		item->var1.flt = getc(fd);
		}
	else
		{
		item->var2.ch = temp8 & 0x1f;
		item->var2.reserved = (temp8 & 0xe0)>>5;
		temp8 = getc(fd);
		item->var2.fDiffer = temp8 & 0x01;
		item->var2.fZombieEmbed = (temp8 & 0x02)>>1;
		item->var2.fResultDirty = (temp8 & 0x04)>>2;
		item->var2.fResultEdited = (temp8 & 0x08)>>3;
		item->var2.fLocked = (temp8 & 0x10)>>4;
		item->var2.fPrivateResult = (temp8 & 0x20)>>5;
		item->var2.fNested = (temp8 & 0x40)>>6;
		item->var2.fHasSep = (temp8 & 0x80)>>7;
		}
	}


int wvGetFLD_PLCF(FLD **fld,U32 **pos,U32 *nofld,U32 offset,U32 len,FILE *fd)
	{
	U32 i;
	if (len == 0)
		{
		*fld = NULL;
		*pos = NULL;
		*nofld = 0;
		}
	else
        {
        *nofld=(len-4)/6;
        *pos = (U32 *) malloc( (*nofld+1) * sizeof(U32));
        if (*pos == NULL)
            {
            wvError(("NO MEM 1, failed to alloc %d bytes\n",(*nofld+1) * sizeof(U32)));
            return(1);
            }

        *fld= (FLD *) malloc(*nofld* sizeof(FLD));
        if (*fld== NULL)
            {
            wvError(("NO MEM 1, failed to alloc %d bytes\n",*nofld* sizeof(FLD)));
			free(pos);
            return(1);
            }
        fseek(fd,offset,SEEK_SET);
        for(i=0;i<=*nofld;i++)
            (*pos)[i]=read_32ubit(fd);
        for(i=0;i<*nofld;i++)
            wvGetFLD(&((*fld)[i]),fd);
        }
	return(0);
	}