Codebase list unrtf / 0c292bb
Imported Upstream version 0.19.3 Willi Mann 11 years ago
66 changed file(s) with 11342 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
Binary diff not shown
0
1 Overall Program Change Log for GNU UnRTF
2 ----------------------------------------
3 0.1: original version, known as "rtf2htm"
4 0.2: first civilized (Un*x) version
5 0.3: addition of hash storage for all strings
6 0.4: support for a few HTML special exprs
7 0.5: tables finally work
8 0.6: addition of usage()
9 0.7: added special chars, \tab, info group, <body>
10 0.8: font table support
11
12 0.9.0: images are stored to files
13 0.9.1: pict files extensions a bit more accurate
14 0.9.2: font size changes (\fs) more accurate.
15 0.9.3: fixed bug regarding where <body> goes
16 0.9.4: added -nopict option
17 0.9.5: fixed table data printing.
18 0.9.6: if >1 \cell in a group, font attrs affect all.
19 0.9.7: Chunk class renamed Word
20
21 0.10.0: input file type is checked, -echo renamed -dump
22 0.11.0: addition of ANSI->HTML conversion, plus limited Mac->HTML
23 0.11.1: unknown chars are printed as <!--0x##-->
24
25 0.12.0: separated parser from word module
26 0.12.1: added -version option
27 0.12.2: backslash-newline is now \par
28 0.12.3: added default font families (\fswiss etc)
29 0.12.4: added blurb about program in the output HTML
30 0.12.5: added recognition of files with ".RTF" ending, not just ".rtf"
31 0.12.6: added charset tables for CP437 and CP850
32 0.12.7: fixed bug preventing \'## sequences from being translated
33 0.12.8: removed size limit for words, verified DJGPP compilation works.
34 0.12.9: compilation bugfix, fixed author/date information
35 0.12.10: added --simple switch for generating HTML without SPAN/DIV tags
36
37 0.13.0: paragraph alignment added
38 0.13.1: fix for words getting lost after \par
39 0.13.2: fix for color table not being recognized
40
41 0.14.0: separation of word and convert modules
42 0.14.1: fixed color table indexing, added support for font background color.
43 0.14.2: updated parsing mechanism
44 0.14.3: fix for DIV nesting; fix for NS's hiding any table within a span.
45 0.14.4: fix for color table parsing; added better underline/strikethru support.
46
47 0.15.0: hashing of RTF keywords in convert.c; moved much code out of convert.c
48 0.15.1: removed null entries from special.c to reduce program size
49 0.15.2: removed no-op entries from hash in convert.c to reduce program size
50 0.15.3: first 16-bit MSDOS executable
51 0.15.4: fixed paragraph alignment not getting cleared by \pard
52 0.15.5: updated code to produce as few paragraph alignment tags as possible
53
54 0.16.0: added input buffering to improve speed
55 0.16.1: bugfix for printing of debugging strings stored in command hash
56
57 0.17.0: hyperlink support added
58 0.17.1: added support for several font attributes e.g. smallcaps, caps, \expand
59 0.17.2: added Amiga(TM) compilation support
60 0.17.3: fixed problem in interpretation of RTF command words
61 0.17.4: changed attr.c to use AttrStack (stack of stacks) paradigm
62 ----program renamed UnRTF----
63 0.17.5: began implementation of output personalities; wrote HTML personality.
64 0.17.6: added text and vt personalities
65 0.17.7: began addition of PostScript(TM) and LaTeX and WPML output
66 0.17.8: first fully commented version, removed "last change" lines
67 0.17.9: fixed translation between character sets
68 0.17.10: PS now supports underline, strikethrough, shadowed text
69 0.17.11: PS now uses ISOLatin1Encoding
70 0.17.12: PS now supports these fonts: Times,Courier,Symbol,Helvetica
71
72 ----program is now GNU UnRTF----
73 0.18.0: updates to comments, documentation to reflect inclusion in GNU suite.
74 0.18.1: updated manual
75
76 0.19.1: new maintainers: minor fixes to prevent segmentation violations;
77 further special character code; minor cleanups
78 0.19.2: updated some files;
79 0.19.3: fix bug #225592: null pointer param in convert.c
80
81 Note:
82 LaTeX is a system of macros for TeX by Leslie Lamport.
83 WPML is a tentative document format by Z.T. Smith
84
85
86
0 GNU GENERAL PUBLIC LICENSE
1 Version 2, June 1991
2
3 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
4 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5 Everyone is permitted to copy and distribute verbatim copies
6 of this license document, but changing it is not allowed.
7
8 Preamble
9
10 The licenses for most software are designed to take away your
11 freedom to share and change it. By contrast, the GNU General Public
12 License is intended to guarantee your freedom to share and change free
13 software--to make sure the software is free for all its users. This
14 General Public License applies to most of the Free Software
15 Foundation's software and to any other program whose authors commit to
16 using it. (Some other Free Software Foundation software is covered by
17 the GNU Library General Public License instead.) You can apply it to
18 your programs, too.
19
20 When we speak of free software, we are referring to freedom, not
21 price. Our General Public Licenses are designed to make sure that you
22 have the freedom to distribute copies of free software (and charge for
23 this service if you wish), that you receive source code or can get it
24 if you want it, that you can change the software or use pieces of it
25 in new free programs; and that you know you can do these things.
26
27 To protect your rights, we need to make restrictions that forbid
28 anyone to deny you these rights or to ask you to surrender the rights.
29 These restrictions translate to certain responsibilities for you if you
30 distribute copies of the software, or if you modify it.
31
32 For example, if you distribute copies of such a program, whether
33 gratis or for a fee, you must give the recipients all the rights that
34 you have. You must make sure that they, too, receive or can get the
35 source code. And you must show them these terms so they know their
36 rights.
37
38 We protect your rights with two steps: (1) copyright the software, and
39 (2) offer you this license which gives you legal permission to copy,
40 distribute and/or modify the software.
41
42 Also, for each author's protection and ours, we want to make certain
43 that everyone understands that there is no warranty for this free
44 software. If the software is modified by someone else and passed on, we
45 want its recipients to know that what they have is not the original, so
46 that any problems introduced by others will not reflect on the original
47 authors' reputations.
48
49 Finally, any free program is threatened constantly by software
50 patents. We wish to avoid the danger that redistributors of a free
51 program will individually obtain patent licenses, in effect making the
52 program proprietary. To prevent this, we have made it clear that any
53 patent must be licensed for everyone's free use or not licensed at all.
54
55 The precise terms and conditions for copying, distribution and
56 modification follow.
57
58 GNU GENERAL PUBLIC LICENSE
59 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
60
61 0. This License applies to any program or other work which contains
62 a notice placed by the copyright holder saying it may be distributed
63 under the terms of this General Public License. The "Program", below,
64 refers to any such program or work, and a "work based on the Program"
65 means either the Program or any derivative work under copyright law:
66 that is to say, a work containing the Program or a portion of it,
67 either verbatim or with modifications and/or translated into another
68 language. (Hereinafter, translation is included without limitation in
69 the term "modification".) Each licensee is addressed as "you".
70
71 Activities other than copying, distribution and modification are not
72 covered by this License; they are outside its scope. The act of
73 running the Program is not restricted, and the output from the Program
74 is covered only if its contents constitute a work based on the
75 Program (independent of having been made by running the Program).
76 Whether that is true depends on what the Program does.
77
78 1. You may copy and distribute verbatim copies of the Program's
79 source code as you receive it, in any medium, provided that you
80 conspicuously and appropriately publish on each copy an appropriate
81 copyright notice and disclaimer of warranty; keep intact all the
82 notices that refer to this License and to the absence of any warranty;
83 and give any other recipients of the Program a copy of this License
84 along with the Program.
85
86 You may charge a fee for the physical act of transferring a copy, and
87 you may at your option offer warranty protection in exchange for a fee.
88
89 2. You may modify your copy or copies of the Program or any portion
90 of it, thus forming a work based on the Program, and copy and
91 distribute such modifications or work under the terms of Section 1
92 above, provided that you also meet all of these conditions:
93
94 a) You must cause the modified files to carry prominent notices
95 stating that you changed the files and the date of any change.
96
97 b) You must cause any work that you distribute or publish, that in
98 whole or in part contains or is derived from the Program or any
99 part thereof, to be licensed as a whole at no charge to all third
100 parties under the terms of this License.
101
102 c) If the modified program normally reads commands interactively
103 when run, you must cause it, when started running for such
104 interactive use in the most ordinary way, to print or display an
105 announcement including an appropriate copyright notice and a
106 notice that there is no warranty (or else, saying that you provide
107 a warranty) and that users may redistribute the program under
108 these conditions, and telling the user how to view a copy of this
109 License. (Exception: if the Program itself is interactive but
110 does not normally print such an announcement, your work based on
111 the Program is not required to print an announcement.)
112
113 These requirements apply to the modified work as a whole. If
114 identifiable sections of that work are not derived from the Program,
115 and can be reasonably considered independent and separate works in
116 themselves, then this License, and its terms, do not apply to those
117 sections when you distribute them as separate works. But when you
118 distribute the same sections as part of a whole which is a work based
119 on the Program, the distribution of the whole must be on the terms of
120 this License, whose permissions for other licensees extend to the
121 entire whole, and thus to each and every part regardless of who wrote it.
122
123 Thus, it is not the intent of this section to claim rights or contest
124 your rights to work written entirely by you; rather, the intent is to
125 exercise the right to control the distribution of derivative or
126 collective works based on the Program.
127
128 In addition, mere aggregation of another work not based on the Program
129 with the Program (or with a work based on the Program) on a volume of
130 a storage or distribution medium does not bring the other work under
131 the scope of this License.
132
133 3. You may copy and distribute the Program (or a work based on it,
134 under Section 2) in object code or executable form under the terms of
135 Sections 1 and 2 above provided that you also do one of the following:
136
137 a) Accompany it with the complete corresponding machine-readable
138 source code, which must be distributed under the terms of Sections
139 1 and 2 above on a medium customarily used for software interchange; or,
140
141 b) Accompany it with a written offer, valid for at least three
142 years, to give any third party, for a charge no more than your
143 cost of physically performing source distribution, a complete
144 machine-readable copy of the corresponding source code, to be
145 distributed under the terms of Sections 1 and 2 above on a medium
146 customarily used for software interchange; or,
147
148 c) Accompany it with the information you received as to the offer
149 to distribute corresponding source code. (This alternative is
150 allowed only for noncommercial distribution and only if you
151 received the program in object code or executable form with such
152 an offer, in accord with Subsection b above.)
153
154 The source code for a work means the preferred form of the work for
155 making modifications to it. For an executable work, complete source
156 code means all the source code for all modules it contains, plus any
157 associated interface definition files, plus the scripts used to
158 control compilation and installation of the executable. However, as a
159 special exception, the source code distributed need not include
160 anything that is normally distributed (in either source or binary
161 form) with the major components (compiler, kernel, and so on) of the
162 operating system on which the executable runs, unless that component
163 itself accompanies the executable.
164
165 If distribution of executable or object code is made by offering
166 access to copy from a designated place, then offering equivalent
167 access to copy the source code from the same place counts as
168 distribution of the source code, even though third parties are not
169 compelled to copy the source along with the object code.
170
171 4. You may not copy, modify, sublicense, or distribute the Program
172 except as expressly provided under this License. Any attempt
173 otherwise to copy, modify, sublicense or distribute the Program is
174 void, and will automatically terminate your rights under this License.
175 However, parties who have received copies, or rights, from you under
176 this License will not have their licenses terminated so long as such
177 parties remain in full compliance.
178
179 5. You are not required to accept this License, since you have not
180 signed it. However, nothing else grants you permission to modify or
181 distribute the Program or its derivative works. These actions are
182 prohibited by law if you do not accept this License. Therefore, by
183 modifying or distributing the Program (or any work based on the
184 Program), you indicate your acceptance of this License to do so, and
185 all its terms and conditions for copying, distributing or modifying
186 the Program or works based on it.
187
188 6. Each time you redistribute the Program (or any work based on the
189 Program), the recipient automatically receives a license from the
190 original licensor to copy, distribute or modify the Program subject to
191 these terms and conditions. You may not impose any further
192 restrictions on the recipients' exercise of the rights granted herein.
193 You are not responsible for enforcing compliance by third parties to
194 this License.
195
196 7. If, as a consequence of a court judgment or allegation of patent
197 infringement or for any other reason (not limited to patent issues),
198 conditions are imposed on you (whether by court order, agreement or
199 otherwise) that contradict the conditions of this License, they do not
200 excuse you from the conditions of this License. If you cannot
201 distribute so as to satisfy simultaneously your obligations under this
202 License and any other pertinent obligations, then as a consequence you
203 may not distribute the Program at all. For example, if a patent
204 license would not permit royalty-free redistribution of the Program by
205 all those who receive copies directly or indirectly through you, then
206 the only way you could satisfy both it and this License would be to
207 refrain entirely from distribution of the Program.
208
209 If any portion of this section is held invalid or unenforceable under
210 any particular circumstance, the balance of the section is intended to
211 apply and the section as a whole is intended to apply in other
212 circumstances.
213
214 It is not the purpose of this section to induce you to infringe any
215 patents or other property right claims or to contest validity of any
216 such claims; this section has the sole purpose of protecting the
217 integrity of the free software distribution system, which is
218 implemented by public license practices. Many people have made
219 generous contributions to the wide range of software distributed
220 through that system in reliance on consistent application of that
221 system; it is up to the author/donor to decide if he or she is willing
222 to distribute software through any other system and a licensee cannot
223 impose that choice.
224
225 This section is intended to make thoroughly clear what is believed to
226 be a consequence of the rest of this License.
227
228 8. If the distribution and/or use of the Program is restricted in
229 certain countries either by patents or by copyrighted interfaces, the
230 original copyright holder who places the Program under this License
231 may add an explicit geographical distribution limitation excluding
232 those countries, so that distribution is permitted only in or among
233 countries not thus excluded. In such case, this License incorporates
234 the limitation as if written in the body of this License.
235
236 9. The Free Software Foundation may publish revised and/or new versions
237 of the General Public License from time to time. Such new versions will
238 be similar in spirit to the present version, but may differ in detail to
239 address new problems or concerns.
240
241 Each version is given a distinguishing version number. If the Program
242 specifies a version number of this License which applies to it and "any
243 later version", you have the option of following the terms and conditions
244 either of that version or of any later version published by the Free
245 Software Foundation. If the Program does not specify a version number of
246 this License, you may choose any version ever published by the Free Software
247 Foundation.
248
249 10. If you wish to incorporate parts of the Program into other free
250 programs whose distribution conditions are different, write to the author
251 to ask for permission. For software which is copyrighted by the Free
252 Software Foundation, write to the Free Software Foundation; we sometimes
253 make exceptions for this. Our decision will be guided by the two goals
254 of preserving the free status of all derivatives of our free software and
255 of promoting the sharing and reuse of software generally.
256
257 NO WARRANTY
258
259 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
260 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
261 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
262 PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
263 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
264 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
265 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
266 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
267 REPAIR OR CORRECTION.
268
269 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
270 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
271 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
272 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
273 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
274 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
275 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
276 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
277 POSSIBILITY OF SUCH DAMAGES.
278
279 END OF TERMS AND CONDITIONS
280
281 How to Apply These Terms to Your New Programs
282
283 If you develop a new program, and you want it to be of the greatest
284 possible use to the public, the best way to achieve this is to make it
285 free software which everyone can redistribute and change under these terms.
286
287 To do so, attach the following notices to the program. It is safest
288 to attach them to the start of each source file to most effectively
289 convey the exclusion of warranty; and each file should have at least
290 the "copyright" line and a pointer to where the full notice is found.
291
292 <one line to give the program's name and a brief idea of what it does.>
293 Copyright (C) 19yy <name of author>
294
295 This program is free software; you can redistribute it and/or modify
296 it under the terms of the GNU General Public License as published by
297 the Free Software Foundation; either version 2 of the License, or
298 (at your option) any later version.
299
300 This program is distributed in the hope that it will be useful,
301 but WITHOUT ANY WARRANTY; without even the implied warranty of
302 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
303 GNU General Public License for more details.
304
305 You should have received a copy of the GNU General Public License
306 along with this program; if not, write to the Free Software
307 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
308
309
310 Also add information on how to contact you by electronic and paper mail.
311
312 If the program is interactive, make it output a short notice like this
313 when it starts in an interactive mode:
314
315 Gnomovision version 69, Copyright (C) 19yy name of author
316 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 This is free software, and you are welcome to redistribute it
318 under certain conditions; type `show c' for details.
319
320 The hypothetical commands `show w' and `show c' should show the appropriate
321 parts of the General Public License. Of course, the commands you use may
322 be called something other than `show w' and `show c'; they could even be
323 mouse-clicks or menu items--whatever suits your program.
324
325 You should also get your employer (if you work as a programmer) or your
326 school, if any, to sign a "copyright disclaimer" for the program, if
327 necessary. Here is a sample; alter the names:
328
329 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
332 <signature of Ty Coon>, 1 April 1989
333 Ty Coon, President of Vice
334
335 This General Public License does not permit incorporating your program into
336 proprietary programs. If your program is a subroutine library, you may
337 consider it more useful to permit linking proprietary applications with the
338 library. If this is what you want to do, use the GNU Library General
339 Public License instead of this License.
0
1 ##############################################################################
2 # GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 # Copyright (C) 2000,2001 Zachary Thayer Smith
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #
19 # The author is reachable by electronic mail at tuorfa@yahoo.com.
20 ##############################################################################
21
22 #
23 # Makefile for UnRTF
24 #
25
26
27 CFLAGS=-g -Wall
28 CC=gcc
29
30 OBJS=convert.o word.o error.o main.o hash.o \
31 parse.o malloc.o attr.o util.o \
32 output.o html.o text.o vt.o ps.o latex.o wpml.o entity.o
33
34 TARGET=unrtf
35
36 ${TARGET}: ${OBJS}
37 gcc ${OBJS} -o ${TARGET}
38
39 clean:
40 rm -f ${OBJS} ${TARGET} bcount bcount.o
41
42 tidy:
43 rm -f ${OBJS} bcount.o
44 strip ${TARGET}
45
46 tests:
47 ${TARGET} test/table.rtf > test/table.html
48 ${TARGET} test/slashnewline.rtf > test/slashnewline.html
49 ${TARGET} test/fontface.rtf > test/fontface.html
50 ${TARGET} test/fontsize.rtf > test/fontsize.html
51
52 bcount: bcount.c
53 gcc bcount.c -o bcount
54
55 all: ${TARGET} bcount
56 rm -f ${OBJS}
57
58 install: ${TARGET}
59 cp ${TARGET} /usr/local/bin
60
61 attr.o: attr.c defs.h error.h attr.h main.h malloc.h
62 convert.o: convert.c attr.h convert.h defs.h error.h hash.h main.h malloc.h \
63 parse.h util.h word.h
64 entity.o: entity.c
65 error.o: error.c defs.h main.h
66 hash.o: hash.c error.h hash.h main.h malloc.h
67 html.o: html.c defs.h error.h main.h malloc.h output.h
68 latex.o: latex.c defs.h error.h main.h malloc.h output.h
69 main.o: main.c convert.h defs.h error.h hash.h html.h latex.h output.h \
70 parse.h ps.h text.h vt.h wpml.h word.h
71 malloc.o: malloc.c error.h
72 output.o: output.c convert.h defs.h error.h main.h malloc.h output.h
73 parse.o: parse.c defs.h error.h main.h malloc.h parse.h word.h
74 ps.o: ps.c defs.h error.h main.h malloc.h output.h
75 text.o: text.c defs.h error.h main.h malloc.h output.h
76 util.o: util.c
77 vt.o: vt.c defs.h error.h main.h malloc.h output.h
78 word.o: word.c defs.h error.h hash.h main.h malloc.h parse.h word.h
79 wpml.o: wpml.c defs.h error.h main.h malloc.h output.h
0 Greetings,
1
2 UnRTF is a moderately complicated converter from RTF to other
3 formats, including HTML, LaTeX, text, and PostScript. Converting
4 to HTML, it supports tables, fonts, colors, embedded images,
5 hyperlinks, paragraph alignment among other things. All other
6 conversions are "alpha"--just begun.
7
8 Compiling with GCC: type "make all", and assuming you have GCC
9 and GNU make, it should compile without any warnings or errors
10 under Linux, BSD, and DOS (using DJGPP). Amiga/GCC users
11 should utilize the build.amiga file. Please let me know of
12 any compilation problems.
13
14 This program includes no warranty whatsoever. It is provided
15 "AS IS". For more information please read the COPYING
16 document, which should be included with the source code.
17 It describes the GNU Public License, which covers UnRTF.
18
19 Enjoy.
20
21 Zachary Thayer Smith
22 tuorfa@yahoo.com
23
24 22 Sept 01
25
0
1 UnRTF by Zach Smith
2
3 A few tasks that need doing as of 18 Sept 01
4 --------------------------------------------
5
6 * Make sure --inline still works; limit it to HTML.
7
8 * Add a module for an intermediate character set for charset
9 conversions.
10
11 * Finish output personalities for LaTeX, PostScript, text, vt, WPML.
12 - Postscript word-level metrics and printing.
13 - Postscript paragraph alignment.
14 - Postscript tables.
15 - Postscript more font faces.
16 - Does LaTeX support emboss, engrave, outline, shadow?
17
18 * Point-lists -- rather important.
19
20 * Index entries.
21
22 * TOC entries.
23
24 * Headers.
25
26 * Footers.
27
28 * Add support for line-based images (the RTF "shape" concept),
29 converting to Beest format or another?
30
31 * Centering not working within tables?
32
33 * HTML: javascript-based shadow/outline/emboss/engrave ?
34
35 * Style sheet support?
36
37 * HTML: Multiple columns kludge using tables or layers?
38
39 * Need to support more Mac RTF special expressions.
40
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: attr
25 * Author name: Zach Smith
26 * Create date: 01 Aug 01
27 * Purpose: Character attribute stack.
28 *----------------------------------------------------------------------
29 * Changes:
30 * 01 Aug 01, tuorfa@yahoo.com: moved code over from convert.c
31 * 06 Aug 01, tuorfa@yahoo.com: added several font attributes.
32 * 18 Sep 01, tuorfa@yahoo.com: added AttrStack (stack of stacks) paradigm
33 * 22 Sep 01, tuorfa@yahoo.com: added comment blocks
34 *--------------------------------------------------------------------*/
35
36
37 #include <stdio.h>
38 #include <string.h>
39 #include <stdlib.h>
40
41 #include "malloc.h"
42 #include "defs.h"
43 #include "error.h"
44 #include "attr.h"
45 #include "main.h"
46
47
48 extern void starting_body();
49 extern void starting_text();
50
51 extern int simulate_allcaps;
52 extern int simulate_smallcaps;
53
54
55 #define MAX_ATTRS (1000)
56
57
58
59 /* For each RTF text block (the text within braces) we must keep
60 * an AttrStack which is a stack of attributes and their optional
61 * parameter. Since RTF text blocks are nested, these make up a
62 * stack of stacks. And, since RTF text blocks inherit attributes
63 * from parent blocks, all new AttrStacks do the same from
64 * their parent AttrStack.
65 */
66 typedef struct _stack {
67 unsigned char attr_stack [MAX_ATTRS];
68 char *attr_stack_params [MAX_ATTRS];
69 int tos;
70 struct _stack *next;
71 }
72 AttrStack;
73
74 static AttrStack *stack_of_stacks = NULL;
75 static AttrStack *stack_of_stacks_top = NULL;
76
77
78
79
80 /*========================================================================
81 * Name: attr_express_begin
82 * Purpose: Print the HTML for beginning an attribute.
83 * Args: Attribute number, optional string parameter.
84 * Returns: None.
85 *=======================================================================*/
86
87 void
88 attr_express_begin (int attr, char* param) {
89 switch(attr)
90 {
91 case ATTR_BOLD:
92 printf (op->bold_begin);
93 break;
94 case ATTR_ITALIC:
95 printf (op->italic_begin);
96 break;
97
98 /* Various underlines, they all resolve to HTML's <u> */
99 case ATTR_THICK_UL:
100 case ATTR_WAVE_UL:
101 case ATTR_DASH_UL:
102 case ATTR_DOT_UL:
103 case ATTR_DOT_DASH_UL:
104 case ATTR_2DOT_DASH_UL:
105 case ATTR_WORD_UL:
106 case ATTR_UNDERLINE:
107 printf (op->underline_begin);
108 break;
109
110 case ATTR_DOUBLE_UL:
111 printf (op->dbl_underline_begin);
112 break;
113
114 case ATTR_FONTSIZE:
115 op_begin_std_fontsize (op, atoi (param));
116 break;
117
118 case ATTR_FONTFACE:
119 printf (op->font_begin,param);
120 break;
121
122 case ATTR_FOREGROUND:
123 printf (op->foreground_begin, param);
124 break;
125
126 case ATTR_BACKGROUND:
127 if (!simple_mode)
128 printf (op->foreground_begin,param);
129 break;
130
131 case ATTR_SUPER:
132 printf (op->superscript_begin);
133 break;
134 case ATTR_SUB:
135 printf (op->subscript_begin);
136 break;
137
138 case ATTR_STRIKE:
139 printf (op->strikethru_begin);
140 break;
141
142 case ATTR_DBL_STRIKE:
143 printf (op->dbl_strikethru_begin);
144 break;
145
146 case ATTR_EXPAND:
147 printf (op->expand_begin, param);
148 break;
149
150 case ATTR_OUTLINE:
151 printf (op->outline_begin);
152 break;
153 case ATTR_SHADOW:
154 printf (op->shadow_begin);
155 break;
156 case ATTR_EMBOSS:
157 printf (op->emboss_begin);
158 break;
159 case ATTR_ENGRAVE:
160 printf (op->engrave_begin);
161 break;
162
163 case ATTR_CAPS:
164 if (op->simulate_all_caps)
165 simulate_allcaps = TRUE;
166 break;
167
168 case ATTR_SMALLCAPS:
169 if (op->simulate_small_caps)
170 simulate_smallcaps = TRUE;
171 else {
172 if (op->small_caps_begin)
173 printf (op->small_caps_begin);
174 }
175 break;
176 }
177 }
178
179
180 /*========================================================================
181 * Name: attr_express_end
182 * Purpose: Print HTML to complete an attribute.
183 * Args: Attribute number.
184 * Returns: None.
185 *=======================================================================*/
186
187 void
188 attr_express_end (int attr, char *param)
189 {
190 switch(attr)
191 {
192 case ATTR_BOLD:
193 printf (op->bold_end);
194 break;
195 case ATTR_ITALIC:
196 printf (op->italic_end);
197 break;
198
199 /* Various underlines, they all resolve to HTML's </u> */
200 case ATTR_THICK_UL:
201 case ATTR_WAVE_UL:
202 case ATTR_DASH_UL:
203 case ATTR_DOT_UL:
204 case ATTR_DOT_DASH_UL:
205 case ATTR_2DOT_DASH_UL:
206 case ATTR_WORD_UL:
207 case ATTR_UNDERLINE:
208 printf (op->underline_end);
209 break;
210
211 case ATTR_DOUBLE_UL:
212 printf (op->dbl_underline_end);
213 break;
214
215 case ATTR_FONTSIZE:
216 op_end_std_fontsize (op, atoi (param));
217 break;
218
219 case ATTR_FONTFACE:
220 printf (op->font_end);
221 break;
222
223 case ATTR_FOREGROUND:
224 printf (op->foreground_end);
225 break;
226 case ATTR_BACKGROUND:
227 if (!simple_mode)
228 printf (op->background_end);
229 break;
230
231 case ATTR_SUPER:
232 printf (op->superscript_end);
233 break;
234 case ATTR_SUB:
235 printf (op->subscript_end);
236 break;
237
238 case ATTR_STRIKE:
239 printf (op->strikethru_end);
240 break;
241
242 case ATTR_DBL_STRIKE:
243 printf (op->dbl_strikethru_end);
244 break;
245
246 case ATTR_OUTLINE:
247 printf (op->outline_end);
248 break;
249 case ATTR_SHADOW:
250 printf (op->shadow_end);
251 break;
252 case ATTR_EMBOSS:
253 printf (op->emboss_end);
254 break;
255 case ATTR_ENGRAVE:
256 printf (op->engrave_end);
257 break;
258
259 case ATTR_EXPAND:
260 printf (op->expand_end);
261 break;
262
263 case ATTR_CAPS:
264 if (op->simulate_all_caps)
265 simulate_allcaps = FALSE;
266 break;
267
268 case ATTR_SMALLCAPS:
269 if (op->simulate_small_caps)
270 simulate_smallcaps = FALSE;
271 else {
272 if (op->small_caps_end)
273 printf (op->small_caps_end);
274 }
275 break;
276 }
277 }
278
279
280
281 /*========================================================================
282 * Name: attr_push
283 * Purpose: Pushes an attribute onto the current attribute stack.
284 * Args: Attribute number, optional string parameter.
285 * Returns: None.
286 *=======================================================================*/
287
288 void
289 attr_push(int attr, char* param)
290 {
291 AttrStack *stack = stack_of_stacks_top;
292 if (!stack) {
293 warning_handler ("no stack to push attribute onto");
294 return;
295 }
296
297 if (stack->tos>=MAX_ATTRS) { fprintf (stderr,"Too many attributes!\n"); return; }
298
299 /* Make sure it's understood we're in the <body> section. */
300 /* KLUDGE */
301 starting_body();
302 starting_text();
303
304 ++stack->tos;
305 stack->attr_stack [stack->tos]=attr;
306 if (param)
307 stack->attr_stack_params [stack->tos]=my_strdup(param);
308 else
309 stack->attr_stack_params [stack->tos]=NULL;
310
311 attr_express_begin (attr, param);
312 }
313
314
315 /*========================================================================
316 * Name: attrstack_copy_all
317 * Purpose: Routine to copy all attributes from one stack to another.
318 * Args: Two stacks.
319 * Returns: None.
320 *=======================================================================*/
321
322 void
323 attrstack_copy_all (AttrStack *src, AttrStack *dest)
324 {
325 int i;
326 int total;
327
328 CHECK_PARAM_NOT_NULL(src);
329 CHECK_PARAM_NOT_NULL(dest);
330
331 total = src->tos + 1;
332
333 for (i=0; i<total; i++)
334 {
335 int attr=src->attr_stack [i];
336 char *param=src->attr_stack_params [i];
337
338 dest->attr_stack[i] = attr;
339 if (param)
340 dest->attr_stack_params[i] = my_strdup (param);
341 else
342 dest->attr_stack_params[i] = NULL;
343 }
344
345 dest->tos = src->tos;
346 }
347
348 /*========================================================================
349 * Name: attrstack_unexpress_all
350 * Purpose: Routine to un-express all attributes heretofore applied,
351 * without removing any from the stack.
352 * Args: Stack whost contents should be unexpressed.
353 * Returns: None.
354 * Notes: This is needed by attrstack_push, but also for \cell, which
355 * often occurs within a brace group, yet HTML uses <td></td>
356 * which clear attribute info within that block.
357 *=======================================================================*/
358
359 void
360 attrstack_unexpress_all (AttrStack *stack)
361 {
362 int i;
363
364 CHECK_PARAM_NOT_NULL(stack);
365
366 i=stack->tos;
367 while (i>=0)
368 {
369 int attr=stack->attr_stack [i];
370 char *param=stack->attr_stack_params [i];
371
372 attr_express_end (attr, param);
373 i--;
374 }
375 }
376
377
378 /*========================================================================
379 * Name: attrstack_push
380 * Purpose: Creates a new attribute stack, pushes it onto the stack
381 * of stacks, performs inheritance from previous stack.
382 * Args: None.
383 * Returns: None.
384 *=======================================================================*/
385 void
386 attrstack_push ()
387 {
388 AttrStack *new_stack;
389 AttrStack *prev_stack;
390
391 new_stack = (AttrStack*) my_malloc (sizeof (AttrStack));
392 bzero ((void*) new_stack, sizeof (AttrStack));
393
394 prev_stack = stack_of_stacks_top;
395
396 if (!stack_of_stacks) {
397 stack_of_stacks = new_stack;
398 } else {
399 stack_of_stacks_top->next = new_stack;
400 }
401 stack_of_stacks_top = new_stack;
402 new_stack->tos = -1;
403
404 if (prev_stack) {
405 attrstack_unexpress_all (prev_stack);
406 attrstack_copy_all (prev_stack, new_stack);
407 attrstack_express_all ();
408 }
409 }
410
411
412
413 /*========================================================================
414 * Name: attr_pop
415 * Purpose: Removes and undoes the effect of the top attribute of
416 * the current AttrStack.
417 * Args: The top attribute's number, for verification.
418 * Returns: Success/fail flag.
419 *=======================================================================*/
420
421 int
422 attr_pop (int attr)
423 {
424 AttrStack *stack = stack_of_stacks_top;
425
426 if (!stack) {
427 warning_handler ("no stack to pop attribute from");
428 return FALSE;
429 }
430
431 if(stack->tos>=0 && stack->attr_stack[stack->tos]==attr)
432 {
433 char *param = stack->attr_stack_params [stack->tos];
434
435 attr_express_end (attr, param);
436
437 if (param) my_free(param);
438
439 stack->tos--;
440
441 return TRUE;
442 }
443 else
444 return FALSE;
445 }
446
447
448
449 /*========================================================================
450 * Name: attr_read
451 * Purpose: Reads but leaves in place the top attribute of the top
452 * attribute stack.
453 * Args: None.
454 * Returns: Attribute number.
455 *=======================================================================*/
456
457 int
458 attr_read() {
459 AttrStack *stack = stack_of_stacks_top;
460 if (!stack) {
461 warning_handler ("no stack to read attribute from");
462 return FALSE;
463 }
464
465 if(stack->tos>=0)
466 {
467 int attr = stack->attr_stack [stack->tos];
468 return attr;
469 }
470 else
471 return ATTR_NONE;
472 }
473
474
475 /*========================================================================
476 * Name: attr_drop_all
477 * Purpose: Undoes all attributes that an AttrStack contains.
478 * Args: None.
479 * Returns: None.
480 *=======================================================================*/
481
482 void
483 attr_drop_all ()
484 {
485 AttrStack *stack = stack_of_stacks_top;
486 if (!stack) {
487 warning_handler ("no stack to drop all attributes from");
488 return;
489 }
490
491 while (stack->tos>=0)
492 {
493 char *param=stack->attr_stack_params [stack->tos];
494 if (param) my_free(param);
495 stack->tos--;
496 }
497 }
498
499
500 /*========================================================================
501 * Name: attrstack_drop
502 * Purpose: Removes the top AttrStack from the stack of stacks, undoing
503 * all attributes that it had in it.
504 * Args: None.
505 * Returns: None.
506 *=======================================================================*/
507
508 void
509 attrstack_drop ()
510 {
511 AttrStack *stack = stack_of_stacks_top;
512 AttrStack *prev_stack;
513 if (!stack) {
514 warning_handler ("no attr-stack to drop");
515 return;
516 }
517
518 attr_pop_all ();
519
520 prev_stack = stack_of_stacks;
521 while(prev_stack && prev_stack->next && prev_stack->next != stack)
522 prev_stack = prev_stack->next;
523
524 if (prev_stack) {
525 stack_of_stacks_top = prev_stack;
526 prev_stack->next = NULL;
527 } else {
528 stack_of_stacks_top = NULL;
529 stack_of_stacks = NULL;
530 }
531 my_free ((void*) stack);
532
533 attrstack_express_all ();
534 }
535
536 /*========================================================================
537 * Name: attr_pop_all
538 * Purpose: Routine to undo all attributes heretofore applied,
539 * also reversing the order in which they were applied.
540 * Args: None.
541 * Returns: None.
542 *=======================================================================*/
543
544 void
545 attr_pop_all()
546 {
547 AttrStack *stack = stack_of_stacks_top;
548 if (!stack) {
549 warning_handler ("no stack to pop from");
550 return;
551 }
552
553 while (stack->tos>=0) {
554 int attr=stack->attr_stack [stack->tos];
555 char *param=stack->attr_stack_params [stack->tos];
556 attr_express_end (attr,param);
557 if (param) my_free(param);
558 stack->tos--;
559 }
560 }
561
562
563 /*========================================================================
564 * Name: attrstack_express_all
565 * Purpose: Routine to re-express all attributes heretofore applied.
566 * Args: None.
567 * Returns: None.
568 * Notes: This is needed by attrstack_push, but also for \cell, which
569 * often occurs within a brace group, yet HTML uses <td></td>
570 * which clear attribute info within that block.
571 *=======================================================================*/
572
573 void
574 attrstack_express_all() {
575 AttrStack *stack = stack_of_stacks_top;
576 int i;
577
578 if (!stack) {
579 warning_handler ("no stack to pop from");
580 return;
581 }
582
583 i=0;
584 while (i<=stack->tos)
585 {
586 int attr=stack->attr_stack [i];
587 char *param=stack->attr_stack_params [i];
588 attr_express_begin (attr, param);
589 i++;
590 }
591 }
592
593
594 /*========================================================================
595 * Name: attr_pop_dump
596 * Purpose: Routine to un-express all attributes heretofore applied.
597 * Args: None.
598 * Returns: None.
599 * Notes: This is needed for \cell, which often occurs within a
600 * brace group, yet HTML uses <td></td> which clear attribute
601 * info within that block.
602 *=======================================================================*/
603
604 void
605 attr_pop_dump() {
606 AttrStack *stack = stack_of_stacks_top;
607 int i;
608
609 if (!stack) return;
610
611 i=stack->tos;
612 while (i>=0)
613 {
614 int attr=stack->attr_stack [i];
615 attr_pop (attr);
616 i--;
617 }
618 }
619
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: attr
25 * Author name: Zach Smith
26 * Create date: 1 Aug 2001
27 * Purpose: Definitions for attribute stack module.
28 *----------------------------------------------------------------------
29 * Changes:
30 * 01 Aug 01, tuorfa@yahoo.com: moved code over from convert.c
31 * 06 Aug 01, tuorfa@yahoo.com: added several attributes
32 * 18 Sep 01, tuorfa@yahoo.com: updates for AttrStack paradigm
33 *--------------------------------------------------------------------*/
34
35 enum {
36 ATTR_NONE=0,
37 ATTR_BOLD, ATTR_ITALIC,
38
39 ATTR_UNDERLINE, ATTR_DOUBLE_UL, ATTR_WORD_UL,
40
41 ATTR_THICK_UL, ATTR_WAVE_UL,
42
43 ATTR_DOT_UL, ATTR_DASH_UL, ATTR_DOT_DASH_UL, ATTR_2DOT_DASH_UL,
44
45 ATTR_FONTSIZE, ATTR_STD_FONTSIZE,
46 ATTR_FONTFACE,
47 ATTR_FOREGROUND, ATTR_BACKGROUND,
48 ATTR_CAPS,
49 ATTR_SMALLCAPS,
50
51 ATTR_SHADOW,
52 ATTR_OUTLINE,
53 ATTR_EMBOSS,
54 ATTR_ENGRAVE,
55
56 ATTR_SUPER, ATTR_SUB,
57 ATTR_STRIKE,
58 ATTR_DBL_STRIKE,
59
60 ATTR_EXPAND,
61 /* ATTR_CONDENSE */
62 };
63
64
65
66 extern void attr_push_core (int attr, char* param);
67
68 extern void attr_pop_core (int attr);
69
70 extern void attr_push(int attr, char* param);
71
72 extern void attrstack_push();
73 extern void attrstack_drop();
74 extern void attrstack_express_all();
75
76 extern int attr_pop(int attr);
77
78 extern int attr_read();
79
80 extern void attr_drop_all ();
81
82 extern void attr_pop_all();
83
84 extern void attr_pop_dump();
85
86
87
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22 /*----------------------------------------------------------------------
23 * Program name: bcount
24 * Author name: Zach Smith
25 * Create date: 15 Oct 00
26 * Purpose: Counts the number of opening and closing braces while
27 * reading from stdin.
28 *--------------------------------------------------------------------*/
29
30
31
32 #include <stdio.h>
33 main (){
34 int n1,n2;
35 int ch;
36 n1=n2=0;
37 while (EOF!=(ch=getchar())) {
38 if (ch=='}') ++n1;
39 if (ch=='{') ++n2;
40 }
41 printf ("{=%d, }=%d\n", n2,n1);
42 }
43
44
0 .KEY CLEAR/S,INSTALL/S,MAKE/S,UNINSTALL/S
1 .BRA {
2 .KET }
3 ;------------------------------------------------------------------------------
4 ; UnRTF, a command-line program to convert RTF documents to other formats.
5 ; Copyright (C) 2000,2001 Zachary Thayer Smith
6 ;
7 ; This program is free software; you can redistribute it and/or modify
8 ; it under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation; either version 2 of the License, or
10 ; (at your option) any later version.
11 ;
12 ; This program is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ; GNU General Public License for more details.
16 ;
17 ; You should have received a copy of the GNU General Public License
18 ; along with this program; if not, write to the Free Software
19 ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 ;
21 ; The author is reachable by electronic mail at tuorfa@yahoo.com.
22 ;------------------------------------------------------------------------------
23 ; Author name: Lars Unger <l.unger@tu-bs.de>
24 ; Create date: 15 Aug 01
25 ; Last change: 16 Aug 01
26 ; Purpose: AmigaDOS batch file to build GNU UnRTF using GNU GCC
27 ;
28 ;Version
29 ;$VER: build.amiga 0.4
30 ;------------------------------------------------------------------------------
31 ;
32 ;
33 ; definitions (feel free to modify)
34 ;
35 set GCC "gnu:bin/gccv"
36 set CFLAGS "-g -Wall"
37 set OBJS "convert.o word.o entity.o error.o main.o hash.o parse.o special.o malloc.o attr.o util.o"
38 set CSRC "convert.c word.c entity.c error.c main.c hash.c parse.c special.c malloc.c attr.c util.c"
39 set TARGET "unrtf"
40 set BINARY "C:unrtf"
41 set HELP "HELP:english/unrtf"
42 ;
43 ; end of definitions
44 ;
45 ; gcc installed ?
46 if not exists $GCC
47 echo ERROR: $GCC not found !
48 quit 20
49 endif
50 ; action control switch
51 set BUILDAMIGA NO
52 ; delete old gcc run
53 if "{CLEAR}" EQ "CLEAR"
54 set BUILDAMIGA YES
55 delete #?.o >NIL:
56 delete $TRAGET >NIL:
57 endif
58 ; uninstall unrtfl
59 if "{UNINSTALL}" EQ "UNINSTALL"
60 set BUILDAMIGA YES
61 delete $BINARY >NIL:
62 delete $HELP all >NIL:
63 endif
64 ; install unrtf
65 if "{INSTALL}" EQ "INSTALL"
66 set BUILDAMIGA YES
67 ask "Install unrtf in $BINARY ?"
68 if warn
69 if exists $TARGET
70 copy $TARGET $BINARY
71 echo "Installed $TARGET in $BINARY"
72 else
73 echo "ERROR: No unrtf executable found !"
74 endif
75 endif
76 ask "Install unrtf docs in $HELP ?"
77 if warn
78 if not exists $HELP
79 makedir $HELP
80 endif
81 copy unrtf.guide changes todo readme $HELP >NIL:
82 endif
83 endif
84 ; use gccv to create unrtf executable (compile)
85 if "{MAKE}" EQ "MAKE"
86 set BUILDAMIGA YES
87 ; set stack for gcc
88 if exists env:GCCSTACK
89 stack $GCCSTACK
90 else
91 stack 250000
92 endif
93 ; compile source file(s)
94 $GCC $CFLAGS -c $CSRC
95 ; link objects
96 $GCC -o $TARGET $OBJS
97 ; check output
98 if exists $TARGET
99 protect $TARGET +e
100 echo "$TARGET was created and is executable. Maybe you"
101 echo "have to increase the stack size of your shell. "
102 echo "Have fun !"
103 else
104 echo "ERROR: unrtf executable not found !"
105 echo "Please check output from GCC."
106 endif
107 endif
108 ; any action performed otherwise give help
109 if $BUILDAMIGA EQ NO
110 echo "This is an AmigaDOS batch file to build unrtf using GCC"
111 echo "Using: build.amiga CLEAR/S,INSTALL/S,MAKE/S,UNINSTALL/S"
112 endif
113
114
0
1 /*===========================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 ===========================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: convert
25 * Author name: Zach Smith
26 * Create date: 24 Jul 01
27 * Purpose: Performs conversion from RTF to other formats.
28 *----------------------------------------------------------------------
29 * Changes:
30 * 24 Jul 01, tuorfa@yahoo.com: moved code over from word.c
31 * 24 Jul 01, tuorfa@yahoo.com: fixed color table reference numbering.
32 * 30 Jul 01, tuorfa@yahoo.com: moved hex convert to util.c
33 * 30 Jul 01, tuorfa@yahoo.com: moved special expr tables to special.c
34 * 30 Jul 01, tuorfa@yahoo.com: moved attribute stack to attr.c
35 * 31 Jul 01, tuorfa@yahoo.com: began addition of hash of rtf commands
36 * 01 Aug 01, tuorfa@yahoo.com: finished bulk of rtf command hash
37 * 03 Aug 01, tuorfa@yahoo.com: removed no-op hash entries to save space
38 * 03 Aug 01, tuorfa@yahoo.com: code to ignore rest of groups for \*, etc
39 * 03 Aug 01, tuorfa@yahoo.com: fixed para-alignnot being cleared by \pard
40 * 03 Aug 01, tuorfa@yahoo.com: added support for \keywords group
41 * 03 Aug 01, tuorfa@yahoo.com: added dummy funcs for header/footer
42 * 03 Aug 01, tuorfa@yahoo.com: began addition of hyperlink support
43 * 04 Aug 01, tuorfa@yahoo.com: fixed debug string printing
44 * 05 Aug 01, tuorfa@yahoo.com: added support for hyperlink data with \field
45 * 06 Aug 01, tuorfa@yahoo.com: added support for several font attributes
46 * 08 Aug 01, gommer@gmx.net: bugfix for picture storing mechanism
47 * 08 Sep 01, tuorfa@yahoo.com: added use of PROGRAM_NAME
48 * 11 Sep 01, tuorfa@yahoo.com: added support for JPEG and PNG pictures
49 * 19 Sep 01, tuorfa@yahoo.com: added output personality support
50 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
51 * 23 Sep 01, tuorfa@yahoo.com: fixed translation of \'XX expressions
52 * 08 Oct 03, daved@physiol.usyd.edu.au: more special character code
53 *--------------------------------------------------------------------*/
54
55 #include <stdio.h>
56 #include <stdlib.h>
57 #include <ctype.h>
58 #include <string.h>
59
60 #include "defs.h"
61 #include "parse.h"
62 #include "util.h"
63 #include "malloc.h"
64 #include "main.h"
65 #include "error.h"
66 #include "word.h"
67 #include "hash.h"
68 #include "convert.h"
69 #include "attr.h"
70
71
72 /*
73 #define BINARY_ATTRS
74 */
75
76
77 static int charset_type=CHARSET_ANSI;
78
79
80 /* Nested tables aren't supported.
81 */
82 static int coming_pars_that_are_tabular = 0;
83 static int within_table = FALSE;
84 static int have_printed_row_begin=FALSE;
85 static int have_printed_cell_begin=FALSE;
86 static int have_printed_row_end=FALSE;
87 static int have_printed_cell_end=FALSE;
88
89
90 /* Previously in word_print_core function
91 */
92 static int total_chars_this_line=0; /* for simulating \tab */
93
94
95 /* Paragraph alignment (kludge)
96 */
97 enum {
98 ALIGN_LEFT=0,
99 ALIGN_RIGHT,
100 ALIGN_CENTER,
101 ALIGN_JUSTIFY
102 };
103
104
105
106 /* This value is set by attr_push and attr_pop
107 */
108 int simulate_smallcaps;
109 int simulate_allcaps;
110
111
112 /* Most pictures must be written to files. */
113 enum {
114 PICT_UNKNOWN=0,
115 PICT_WM,
116 PICT_MAC,
117 PICT_PM,
118 PICT_DI,
119 PICT_WB,
120 PICT_JPEG,
121 PICT_PNG,
122 };
123 static int within_picture=FALSE;
124 static int picture_file_number=1;
125 static char picture_path[255];
126 static int picture_width;
127 static int picture_height;
128 static int picture_bits_per_pixel=1;
129 static int picture_type=PICT_UNKNOWN;
130 static int picture_wmetafile_type;
131 static char *picture_wmetafile_type_str;
132
133
134 static int have_printed_body=FALSE;
135 static int within_header=TRUE;
136
137
138
139 static char *hyperlink_base = NULL;
140
141
142
143 void starting_body();
144 void starting_text();
145
146
147 static int banner_printed=FALSE;
148
149 #if 1 /* daved - 0.19.0 */
150 char *entity(int symbol);
151 #endif
152
153
154
155 /*========================================================================
156 * Name: print_banner
157 * Purpose: Writes program-identifying text to the output stream.
158 * Args: None.
159 * Returns: None.
160 *=======================================================================*/
161
162 void
163 print_banner () {
164 if (!banner_printed) {
165 printf (op->comment_begin);
166 printf ("Translation from RTF performed by ");
167 printf ("%s, version ", PROGRAM_NAME);
168 printf ("%s", PROGRAM_VERSION);
169 printf (op->comment_end);
170
171 printf (op->comment_begin);
172 printf ("For information about this marvellous program,");
173 printf (op->comment_end);
174
175 printf (op->comment_begin);
176 printf ("please go to %s", PROGRAM_WEBSITE);
177 printf (op->comment_end);
178 }
179 banner_printed=TRUE;
180 }
181
182
183 /*========================================================================
184 * Name: starting_body
185 * Purpose: Switches output stream for writing document contents.
186 * Args: None.
187 * Returns: None.
188 *=======================================================================*/
189
190 void
191 starting_body ()
192 {
193 if (!have_printed_body) {
194 if (!inline_mode) {
195 printf (op->header_end);
196 printf (op->body_begin);
197 }
198 within_header=FALSE;
199 have_printed_body=TRUE;
200 }
201 }
202
203
204 /*-------------------------------------------------------------------*/
205 /*-------------------------------------------------------------------*/
206 /*-------------------------------------------------------------------*/
207
208
209 static char *month_strings[12]= {
210 #ifdef ENGLISH
211 "January","February","March","April","May","June","July","August",
212 "September","October","November","December"
213 #endif
214 #ifdef FRANCAIS
215 "Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre",
216 "Octobre","Novembre","Decembre"
217 #endif
218 #ifdef ITALIANO
219 "Ianuario","Febbraio","Marzo","Aprile","Maggio","Iuno",
220 "Luglio","Agusto","Settembre","Ottobre","Novembre","Dicembre"
221 #endif
222 #ifdef ESPANOL /* amaral - 0.19.2 */
223 "Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto",
224 "Septiembre","Octubre","Noviembre","Diciembre"
225 #endif
226 #ifdef DEUTCH
227 "?","?","?","?","?","?","?","?",
228 "?","?","?","?"
229 #endif
230 #ifdef PORTUGUES /* amaral - 0.19.2 */
231 "Janeiro","Fevereiro","Marco","Abril","Maio","Junho","Julho","Agosto",
232 "Setembro","Outubro","Novembro","Dezembro"
233 #endif
234 };
235
236
237 /*========================================================================
238 * Name: word_dump_date
239 * Purpose: Extracts date from an RTF input stream, writes it to
240 * output stream.
241 * Args: Word*, buffered RTF stream
242 * Returns: None.
243 *=======================================================================*/
244
245 void
246 word_dump_date (Word *w)
247 {
248 int year=0, month=0, day=0, hour=0, minute=0;
249 CHECK_PARAM_NOT_NULL(w);
250 while (w) {
251 char *s = word_string (w);
252 if (*s == '\\') {
253 ++s;
254 if (!strncmp (s, "yr", 2) && isdigit(s[2])) {
255 year = atoi (&s[2]);
256 }
257 else if (!strncmp (s, "mo", 2) && isdigit(s[2])) {
258 month= atoi (&s[2]);
259 }
260 else if (!strncmp (s, "dy", 2) && isdigit(s[2])) {
261 day= atoi (&s[2]);
262 }
263 else if (!strncmp (s, "min", 3) && isdigit(s[3])) {
264 minute= atoi (&s[3]);
265 }
266 else if (!strncmp (s, "hr", 2) && isdigit(s[2])) {
267 hour= atoi (&s[2]);
268 }
269 }
270 w=w->next;
271 }
272 if (year && month && day) {
273 printf ("%d %s %d ", day, month_strings[month-1], year);
274 }
275 if (hour && minute) {
276 printf ("%02d:%02d ", hour, minute);
277 }
278 }
279
280
281
282 /*-------------------------------------------------------------------*/
283
284 typedef struct {
285 int num;
286 char *name;
287 } FontEntry;
288
289 #define MAX_FONTS (256)
290 static FontEntry font_table[MAX_FONTS];
291 static int total_fonts=0;
292
293
294
295 /*========================================================================
296 * Name: lookup_fontname
297 * Purpose: Fetches the name of a font from the already-read font table.
298 * Args: Font#.
299 * Returns: Font name.
300 *=======================================================================*/
301
302 char*
303 lookup_fontname (int num) {
304 int i;
305 if (total_fonts)
306 for(i=0;i<total_fonts;i++) {
307 if (font_table[i].num==num)
308 return font_table[i].name;
309 }
310 return NULL;
311 }
312
313
314 /*========================================================================
315 * Name: process_font_table
316 * Purpose: Processes the font table of an RTF file.
317 * Args: Tree of words.
318 * Returns: None.
319 *=======================================================================*/
320
321 void
322 process_font_table (Word *w)
323 {
324 Word *w2;
325
326 CHECK_PARAM_NOT_NULL(w);
327
328 while(w) {
329 int num;
330 char name[255];
331 char *tmp;
332
333 if ((w2=w->child)) {
334 tmp = word_string (w2);
335 if (!strncmp("\\f",tmp,2)) {
336 num = atoi (&tmp[2]);
337 name[0]=0;
338
339 w2=w2->next;
340 while(w2) {
341 tmp = word_string (w2);
342 if (tmp && tmp[0] != '\\')
343 strcat(name,tmp);
344
345 w2=w2->next;
346 }
347
348 /* Chop the gall-derned semicolon. */
349 if ((tmp=strchr(name,';')))
350 *tmp=0;
351
352 font_table[total_fonts].num=num;
353 font_table[total_fonts].name=my_strdup(name);
354 total_fonts++;
355 }
356 }
357 w=w->next;
358 }
359
360 printf (op->comment_begin);
361 printf ("font table contains %d fonts total",total_fonts);
362 printf (op->comment_end);
363
364 if (debug_mode) {
365 int i;
366
367 printf (op->comment_begin);
368 printf ("font table dump: \n");
369 for (i=0; i<total_fonts; i++) {
370 printf (" font %d = %s\n", font_table[i].num,
371 font_table[i].name);
372 }
373 printf (op->comment_end);
374 }
375 }
376
377
378 /*========================================================================
379 * Name: process_index_entry
380 * Purpose: Processes an index entry of an RTF file.
381 * Args: Tree of words.
382 * Returns: None.
383 *=======================================================================*/
384
385 void
386 process_index_entry (Word *w)
387 {
388 Word *w2;
389
390 CHECK_PARAM_NOT_NULL(w);
391
392 while(w) {
393 if ((w2=w->child)) {
394 char *str = word_string (w2);
395
396 if (debug_mode && str) {
397 printf (op->comment_begin);
398 printf ("index entry word: %s ", str);
399 printf (op->comment_end);
400 }
401 }
402 w=w->next;
403 }
404 }
405
406
407 /*========================================================================
408 * Name: process_toc_entry
409 * Purpose: Processes an index entry of an RTF file.
410 * Args: Tree of words, flag to say whether to include a page#.
411 * Returns: None.
412 *=======================================================================*/
413
414 void
415 process_toc_entry (Word *w, int include_page_num)
416 {
417 Word *w2;
418
419 CHECK_PARAM_NOT_NULL(w);
420
421 while(w) {
422 if ((w2=w->child)) {
423 char *str = word_string (w2);
424
425 if (debug_mode && str) {
426 printf (op->comment_begin);
427 printf ("toc %s entry word: %s ",
428 include_page_num ? "page#":"no page#",
429 str);
430 printf (op->comment_end);
431 }
432 }
433 w=w->next;
434 }
435 }
436
437
438 /*========================================================================
439 * Name: process_info_group
440 * Purpose: Processes the \info group of an RTF file.
441 * Args: Tree of words.
442 * Returns: None.
443 *=======================================================================*/
444
445 void
446 process_info_group (Word *w)
447 {
448 Word *child;
449
450 #if 1 /* amaral - 0.19.2 */
451 /* CHECK_PARAM_NOT_NULL(w); */
452 if (!w) printf ("AUTHOR'S COMMENT: \\info command is null!\n");
453 #endif
454
455
456 while(w) {
457 child = w->child;
458 if (child) {
459 Word *w2;
460 char *s;
461
462 s = word_string(child);
463
464 if (!inline_mode) {
465 if (!strcmp("\\title", s)) {
466 printf (op->document_title_begin);
467 w2=child->next;
468 while (w2) {
469 char *s2 = word_string(w2);
470 if (s2[0] != '\\')
471 printf ("%s", s2);
472 w2=w2->next;
473 }
474 printf (op->document_title_end);
475 }
476 else if (!strcmp("\\keywords", s)) {
477 printf (op->document_keywords_begin);
478 w2=child->next;
479 while (w2) {
480 char *s2 = word_string(w2);
481 if (s2[0] != '\\')
482 printf ("%s,", s2);
483 w2=w2->next;
484 }
485 printf (op->document_keywords_end);
486 }
487 else if (!strcmp("\\author", s)) {
488 printf (op->document_author_begin);
489 w2=child->next;
490 while (w2) {
491 char *s2 = word_string(w2);
492 if (s2[0] != '\\')
493 printf ("%s", s2);
494 w2=w2->next;
495 }
496 printf (op->document_author_end);
497 }
498 else if (!strcmp("\\comment", s)) {
499 printf (op->comment_begin);
500 printf ("comments: ");
501 w2=child->next;
502 while (w2) {
503 char *s2 = word_string(w2);
504 if (s2[0] != '\\')
505 printf ("%s", s2);
506 w2=w2->next;
507 }
508 printf (op->comment_end);
509 }
510 else if (!strncmp("\\nofpages", s, 9)) {
511 printf (op->comment_begin);
512 printf ("total pages: %s",&s[9]);
513 printf (op->comment_end);
514 }
515 else if (!strncmp("\\nofwords", s, 9)) {
516 printf (op->comment_begin);
517 printf ("total words: %s",&s[9]);
518 printf (op->comment_end);
519 }
520 else if (!strncmp("\\nofchars", s, 9) && isdigit(s[9])) {
521 printf (op->comment_begin);
522 printf ("total chars: %s",&s[9]);
523 printf (op->comment_end);
524 }
525 else if (!strcmp("\\creatim", s)) {
526 printf (op->comment_begin);
527 printf ("creaton date: ");
528 if (child->next) word_dump_date (child->next);
529 printf (op->comment_end);
530 }
531 else if (!strcmp("\\printim", s)) {
532 printf (op->comment_begin);
533 printf ("last printed: ");
534 if (child->next) word_dump_date (child->next);
535 printf (op->comment_end);
536 }
537 else if (!strcmp("\\buptim", s)) {
538 printf (op->comment_begin);
539 printf ("last backup: ");
540 if (child->next) word_dump_date (child->next);
541 printf (op->comment_end);
542 }
543 else if (!strcmp("\\revtim", s)) {
544 printf (op->comment_begin);
545 printf ("revision date: ");
546 if (child->next) word_dump_date (child->next);
547 printf (op->comment_end);
548 }
549 }
550
551 /* Irregardless of whether we're in inline mode,
552 * we want to process the following.
553 */
554 if (!strcmp("\\hlinkbase", s)) {
555 char *linkstr = NULL;
556
557 printf (op->comment_begin);
558 printf ("hyperlink base: ");
559 if (child->next) {
560 Word *nextword = child->next;
561
562 if (nextword)
563 linkstr=word_string (nextword);
564 }
565
566 if (linkstr)
567 printf ("%s", linkstr);
568 else
569 printf ("(none)");
570 printf (op->comment_end);
571
572 /* Store the pointer, it will remain good. */
573 hyperlink_base = linkstr;
574 }
575 }
576 w = w->next;
577 }
578 }
579
580 /*-------------------------------------------------------------------*/
581
582 /* RTF color table colors are RGB */
583
584 typedef struct {
585 unsigned char r,g,b;
586 } Color;
587
588 #define MAX_COLORS (256)
589 static Color color_table[MAX_COLORS];
590 static int total_colors=0;
591
592
593 /*========================================================================
594 * Name: process_color_table
595 * Purpose: Processes the color table of an RTF file.
596 * Args: Tree of words.
597 * Returns: None.
598 *=======================================================================*/
599
600 void
601 process_color_table (Word *w)
602 {
603 int r,g,b;
604
605 CHECK_PARAM_NOT_NULL(w);
606
607 /* Sometimes, RTF color tables begin with a semicolon,
608 * i.e. an empty color entry. This seems to indicate that color 0
609 * will not be used, so here I set it to black.
610 */
611 r=g=b=0;
612
613 while(w) {
614 char *s = word_string (w);
615
616 #if 0
617 printf (op->comment_begin);
618 printf ("found this color table word: %s", word_string(w));
619 printf (op->comment_end);
620 #endif
621
622 if(!strncmp("\\red",s,4)) {
623 r = atoi(&s[4]);
624 while(r>255) r>>=8;
625 }
626 else if(!strncmp("\\green",s,6)) {
627 g = atoi(&s[6]);
628 while(g>255) g>>=8;
629 }
630 else if(!strncmp("\\blue",s,5)) {
631 b = atoi(&s[5]);
632 while(b>255) b>>=8;
633 }
634 else
635 /* If we find the semicolon which denotes the end of
636 * a color entry then store the color, even if we don't
637 * have all of it.
638 */
639 if (!strcmp (";", s)) {
640 color_table[total_colors].r = r;
641 color_table[total_colors].g = g;
642 color_table[total_colors++].b = b;
643 if (debug_mode) {
644 printf (op->comment_begin);
645 printf ("storing color entry %d: %02x%02x%02x",
646 total_colors-1, r,g,b);
647 printf (op->comment_end);
648 }
649 r=g=b=0;
650 }
651
652 w=w->next;
653 }
654
655 if (debug_mode) {
656 printf (op->comment_begin);
657 printf ("color table had %d entries -->\n", total_colors);
658 printf (op->comment_end);
659 }
660 }
661
662 /*========================================================================
663 * Name: cmd_cf
664 * Purpose: Executes the \cf command.
665 * Args: Word, paragraph align info, and numeric param if any.
666 * Returns: Flag, true only if rest of Words on line should be ignored.
667 *=======================================================================*/
668
669 static int
670 cmd_cf (Word *w, int align, char has_param, short num) {
671 char str[40];
672
673 if (!has_param || num>=total_colors) {
674 warning_handler ("font color change attempted is invalid");
675 }
676 else
677 {
678 sprintf (str,"#%02x%02x%02x",
679 color_table[num].r,
680 color_table[num].g,
681 color_table[num].b);
682 attr_push(ATTR_FOREGROUND,str);
683 }
684 return FALSE;
685 }
686
687
688
689 /*========================================================================
690 * Name: cmd_cb
691 * Purpose: Executes the \cb command.
692 * Args: Word, paragraph align info, and numeric param if any.
693 * Returns: Flag, true only if rest of Words on line should be ignored.
694 *=======================================================================*/
695
696 static int
697 cmd_cb (Word *w, int align, char has_param, short num) {
698 char str[40];
699
700 if (!has_param || num>=total_colors) {
701 warning_handler ("font color change attempted is invalid");
702 }
703 else
704 {
705 sprintf (str,"#%02x%02x%02x",
706 color_table[num].r,
707 color_table[num].g,
708 color_table[num].b);
709 attr_push(ATTR_BACKGROUND,str);
710 }
711 return FALSE;
712 }
713
714
715 /*========================================================================
716 * Name: cmd_fs
717 * Purpose: Executes the \fs command.
718 * Args: Word, paragraph align info, and numeric param if any.
719 * Returns: Flag, true only if rest of Words on line should be ignored.
720 *=======================================================================*/
721 static int
722 cmd_fs (Word *w, int align, char has_param, short points) {
723 char str[20];
724
725 if (!has_param) return FALSE;
726
727 /* Note, fs20 means 10pt */
728 points /= 2;
729
730 sprintf (str,"%d",points);
731 attr_push(ATTR_FONTSIZE,str);
732
733 return FALSE;
734 }
735
736
737 /*========================================================================
738 * Name: cmd_field
739 * Purpose: Interprets fields looking for hyperlinks.
740 * Comment: Because hyperlinks are put in \field groups,
741 * we must interpret all \field groups, which is
742 * slow and laborious.
743 * Returns: Flag, true only if rest of Words on line should be ignored.
744 *=======================================================================*/
745
746 static int
747 cmd_field (Word *w, int align, char has_param, short num) {
748 Word *child;
749
750 CHECK_PARAM_NOT_NULL(w);
751
752 while(w) {
753 child = w->child;
754 if (child) {
755 Word *w2;
756 char *s;
757
758 s = word_string(child);
759
760 if (!strcmp("\\*", s)) {
761 w2=child->next;
762 while (w2) {
763 char *s2 = word_string(w2);
764 if (s2 && !strcmp("\\fldinst", s2)) {
765 Word *w3;
766 w3=w2->next;
767 #if 1 /* daved - 0.19.0 */
768 {
769 char *s;
770 char *s4;
771 Word *w4;
772 s = word_string(w3);
773 if(s && !strcmp(s, "SYMBOL") )
774 {
775 w4=w3->next;
776 while(w4 && !strcmp(word_string(w4), " "))
777 w4 = w4->next;
778 s4 = word_string(w4);
779 if(s4)
780 printf("%s", entity(atoi(s4)));
781 }
782 }
783 #endif
784 while (w3 && !w3->child) {
785 w3=w3->next;
786 }
787 if (w3) w3=w3->child;
788 while (w3) {
789 char *s3=word_string(w3);
790 if (s3 && !strcmp("HYPERLINK",s3)) {
791 Word *w4;
792 char *s4;
793 w4=w3->next;
794 while (w4 && !strcmp(" ", word_string(w4)))
795 w4=w4->next;
796 if (w4) {
797 s4=word_string(w4);
798 printf (op->hyperlink_begin);
799 printf ("%s", s4);
800 printf (op->hyperlink_end);
801 return TRUE;
802 }
803
804 }
805 w3=w3->next;
806 }
807 }
808 w2=w2->next;
809 }
810
811 }
812 }
813 w=w->next;
814 }
815 return TRUE;
816 }
817
818
819
820 /*========================================================================
821 * Name: cmd_f
822 * Purpose: Executes the \f command.
823 * Args: Word, paragraph align info, and numeric param if any.
824 * Returns: Flag, true only if rest of Words on line should be ignored.
825 *=======================================================================*/
826 static int
827 cmd_f (Word *w, int align, char has_param, short num) {
828 char *name;
829
830 /* no param exit early XX */
831 if (!has_param)
832 return FALSE;
833
834 name = lookup_fontname(num);
835 if(!name) {
836 printf (op->comment_begin);
837 printf ("invalid font number %d",num);
838 printf (op->comment_end);
839 } else {
840 attr_push(ATTR_FONTFACE,name);
841 }
842
843 return FALSE;
844 }
845
846
847 /*========================================================================
848 * Name: cmd_highlight
849 * Purpose: Executes the \cf command.
850 * Args: Word, paragraph align info, and numeric param if any.
851 * Returns: Flag, true only if rest of Words on line should be ignored.
852 *=======================================================================*/
853
854 static int
855 cmd_highlight (Word *w, int align, char has_param, short num)
856 {
857 char str[40];
858
859 if (!has_param || num>=total_colors) {
860 warning_handler ("font background color change attempted is invalid");
861 }
862 else
863 {
864 sprintf (str,"#%02x%02x%02x",
865 color_table[num].r,
866 color_table[num].g,
867 color_table[num].b);
868 attr_push(ATTR_BACKGROUND,str);
869 }
870 return FALSE;
871 }
872
873
874
875 /*========================================================================
876 * Name: cmd_tab
877 * Purpose: Executes the \tab command.
878 * Args: Word, paragraph align info, and numeric param if any.
879 * Returns: Flag, true only if rest of Words on line should be ignored.
880 *=======================================================================*/
881
882 static int
883 cmd_tab (Word *w, int align, char has_param, short param)
884 {
885 /* Tab presents a genuine problem
886 * since some output formats don't have
887 * an equivalent. As a kludge fix, I shall
888 * assume the font is fixed width and that
889 * the tabstops are 8 characters apart.
890 */
891 int need= 8-(total_chars_this_line%8);
892 total_chars_this_line += need;
893 while(need>0) {
894 printf (op->forced_space);
895 need--;
896 }
897 printf ("\n");
898 return FALSE;
899 }
900
901
902 /*========================================================================
903 * Name: cmd_plain
904 * Purpose: Executes the \plain command.
905 * Args: Word, paragraph align info, and numeric param if any.
906 * Returns: Flag, true only if rest of Words on line should be ignored.
907 *=======================================================================*/
908
909 static int
910 cmd_plain (Word *w, int align, char has_param, short param) {
911 attr_pop_all();
912 return FALSE;
913 }
914
915
916 /*========================================================================
917 * Name: cmd_fnil
918 * Purpose: Executes the \fnil command.
919 * Args: Word, paragraph align info, and numeric param if any.
920 * Returns: Flag, true only if rest of Words on line should be ignored.
921 *=======================================================================*/
922 static int
923 cmd_fnil (Word *w, int align, char has_param, short param) {
924 attr_push(ATTR_FONTFACE,FONTNIL_STR);
925 return FALSE;
926 }
927
928
929
930 /*========================================================================
931 * Name: cmd_froman
932 * Purpose: Executes the \froman command.
933 * Args: Word, paragraph align info, and numeric param if any.
934 * Returns: Flag, true only if rest of Words on line should be ignored.
935 *=======================================================================*/
936 static int
937 cmd_froman (Word *w, int align, char has_param, short param) {
938 attr_push(ATTR_FONTFACE,FONTROMAN_STR);
939 return FALSE;
940 }
941
942
943 /*========================================================================
944 * Name: cmd_fswiss
945 * Purpose: Executes the \fswiss command.
946 * Args: Word, paragraph align info, and numeric param if any.
947 * Returns: Flag, true only if rest of Words on line should be ignored.
948 *=======================================================================*/
949
950 static int
951 cmd_fswiss (Word *w, int align, char has_param, short param) {
952 attr_push(ATTR_FONTFACE,FONTSWISS_STR);
953 return FALSE;
954 }
955
956
957 /*========================================================================
958 * Name: cmd_fmodern
959 * Purpose: Executes the \fmodern command.
960 * Args: Word, paragraph align info, and numeric param if any.
961 * Returns: Flag, true only if rest of Words on line should be ignored.
962 *=======================================================================*/
963
964 static int
965 cmd_fmodern (Word *w, int align, char has_param, short param) {
966 attr_push(ATTR_FONTFACE,FONTMODERN_STR);
967 return FALSE;
968 }
969
970
971 /*========================================================================
972 * Name: cmd_fscript
973 * Purpose: Executes the \fscript command.
974 * Args: Word, paragraph align info, and numeric param if any.
975 * Returns: Flag, true only if rest of Words on line should be ignored.
976 *=======================================================================*/
977
978 static int
979 cmd_fscript (Word *w, int align, char has_param, short param) {
980 attr_push(ATTR_FONTFACE,FONTSCRIPT_STR);
981 return FALSE;
982 }
983
984 /*========================================================================
985 * Name: cmd_fdecor
986 * Purpose: Executes the \fdecor command.
987 * Args: Word, paragraph align info, and numeric param if any.
988 * Returns: Flag, true only if rest of Words on line should be ignored.
989 *=======================================================================*/
990
991 static int
992 cmd_fdecor (Word *w, int align, char has_param, short param) {
993 attr_push(ATTR_FONTFACE,FONTDECOR_STR);
994 return FALSE;
995 }
996
997 /*========================================================================
998 * Name: cmd_ftech
999 * Purpose: Executes the \ftech command.
1000 * Args: Word, paragraph align info, and numeric param if any.
1001 * Returns: Flag, true only if rest of Words on line should be ignored.
1002 *=======================================================================*/
1003
1004 static int
1005 cmd_ftech (Word *w, int align, char has_param, short param) {
1006 attr_push(ATTR_FONTFACE,FONTTECH_STR);
1007 return FALSE;
1008 }
1009
1010 /*========================================================================
1011 * Name: cmd_expand
1012 * Purpose: Executes the \expand command.
1013 * Args: Word, paragraph align info, and numeric param if any.
1014 * Returns: Flag, true only if rest of Words on line should be ignored.
1015 *=======================================================================*/
1016
1017 static int
1018 cmd_expand (Word *w, int align, char has_param, short param) {
1019 char str[10];
1020 if (has_param) {
1021 sprintf (str, "%d", param/4);
1022 if (!param)
1023 attr_pop(ATTR_EXPAND);
1024 else
1025 attr_push(ATTR_EXPAND, str);
1026 }
1027 return FALSE;
1028 }
1029
1030
1031 /*========================================================================
1032 * Name: cmd_emboss
1033 * Purpose: Executes the \embo command.
1034 * Args: Word, paragraph align info, and numeric param if any.
1035 * Returns: Flag, true only if rest of Words on line should be ignored.
1036 *=======================================================================*/
1037
1038 static int
1039 cmd_emboss (Word *w, int align, char has_param, short param) {
1040 char str[10];
1041 if (has_param && !param)
1042 attr_pop(ATTR_EMBOSS);
1043 else
1044 {
1045 sprintf (str, "%d", param);
1046 attr_push(ATTR_EMBOSS, str);
1047 }
1048 return FALSE;
1049 }
1050
1051
1052 /*========================================================================
1053 * Name: cmd_engrave
1054 * Purpose: Executes the \impr command.
1055 * Args: Word, paragraph align info, and numeric param if any.
1056 * Returns: Flag, true only if rest of Words on line should be ignored.
1057 *=======================================================================*/
1058
1059 static int
1060 cmd_engrave (Word *w, int align, char has_param, short param) {
1061 char str[10];
1062 if (has_param && !param)
1063 attr_pop(ATTR_ENGRAVE);
1064 else
1065 {
1066 sprintf (str, "%d", param);
1067 attr_push(ATTR_ENGRAVE, str);
1068 }
1069 return FALSE;
1070 }
1071
1072 /*========================================================================
1073 * Name: cmd_caps
1074 * Purpose: Executes the \caps command.
1075 * Args: Word, paragraph align info, and numeric param if any.
1076 * Returns: Flag, true only if rest of Words on line should be ignored.
1077 *=======================================================================*/
1078
1079 static int
1080 cmd_caps (Word *w, int align, char has_param, short param) {
1081 if (has_param && !param)
1082 attr_pop(ATTR_CAPS);
1083 else
1084 attr_push(ATTR_CAPS,NULL);
1085 return FALSE;
1086 }
1087
1088
1089 /*========================================================================
1090 * Name: cmd_scaps
1091 * Purpose: Executes the \scaps command.
1092 * Args: Word, paragraph align info, and numeric param if any.
1093 * Returns: Flag, true only if rest of Words on line should be ignored.
1094 *=======================================================================*/
1095 static int
1096 cmd_scaps (Word *w, int align, char has_param, short param) {
1097 if (has_param && !param)
1098 attr_pop(ATTR_SMALLCAPS);
1099 else
1100 attr_push(ATTR_SMALLCAPS,NULL);
1101 return FALSE;
1102 }
1103
1104
1105 /*========================================================================
1106 * Name: cmd_bullet
1107 * Purpose: Executes the \bullet command.
1108 * Args: Word, paragraph align info, and numeric param if any.
1109 * Returns: Flag, true only if rest of Words on line should be ignored.
1110 *=======================================================================*/
1111 static int
1112 cmd_bullet (Word *w, int align, char has_param, short param) {
1113 printf (op->chars.bullet);
1114 ++total_chars_this_line; /* \tab */
1115 return FALSE;
1116 }
1117
1118 /*========================================================================
1119 * Name: cmd_ldblquote
1120 * Purpose: Executes the \ldblquote command.
1121 * Args: Word, paragraph align info, and numeric param if any.
1122 * Returns: Flag, true only if rest of Words on line should be ignored.
1123 *=======================================================================*/
1124 static int
1125 cmd_ldblquote (Word *w, int align, char has_param, short param) {
1126 printf (op->chars.left_dbl_quote);
1127 ++total_chars_this_line; /* \tab */
1128 return FALSE;
1129 }
1130
1131
1132 /*========================================================================
1133 * Name: cmd_rdblquote
1134 * Purpose: Executes the \rdblquote command.
1135 * Args: Word, paragraph align info, and numeric param if any.
1136 * Returns: Flag, true only if rest of Words on line should be ignored.
1137 *=======================================================================*/
1138
1139 static int
1140 cmd_rdblquote (Word *w, int align, char has_param, short param) {
1141 printf (op->chars.right_dbl_quote);
1142 ++total_chars_this_line; /* \tab */
1143 return FALSE;
1144 }
1145
1146
1147 /*========================================================================
1148 * Name: cmd_lquote
1149 * Purpose: Executes the \lquote command.
1150 * Args: Word, paragraph align info, and numeric param if any.
1151 * Returns: Flag, true only if rest of Words on line should be ignored.
1152 *=======================================================================*/
1153 static int
1154 cmd_lquote (Word *w, int align, char has_param, short param) {
1155 printf (op->chars.left_quote);
1156 ++total_chars_this_line; /* \tab */
1157 return FALSE;
1158 }
1159
1160
1161 /*========================================================================
1162 * Name: cmd_nonbreaking_space
1163 * Purpose: Executes the nonbreaking space command.
1164 * Args: Word, paragraph align info, and numeric param if any.
1165 * Returns: Flag, true only if rest of Words on line should be ignored.
1166 *=======================================================================*/
1167
1168 static int
1169 cmd_nonbreaking_space (Word *w, int align, char has_param, short param) {
1170 printf (op->chars.nonbreaking_space);
1171 ++total_chars_this_line; /* \tab */
1172 return FALSE;
1173 }
1174
1175
1176 /*========================================================================
1177 * Name: cmd_nonbreaking_hyphen
1178 * Purpose: Executes the nonbreaking hyphen command.
1179 * Args: Word, paragraph align info, and numeric param if any.
1180 * Returns: Flag, true only if rest of Words on line should be ignored.
1181 *=======================================================================*/
1182
1183 static int
1184 cmd_nonbreaking_hyphen (Word *w, int align, char has_param, short param) {
1185 printf (op->chars.nonbreaking_hyphen);
1186 ++total_chars_this_line; /* \tab */
1187 return FALSE;
1188 }
1189
1190
1191 /*========================================================================
1192 * Name: cmd_optional_hyphen
1193 * Purpose: Executes the optional hyphen command.
1194 * Args: Word, paragraph align info, and numeric param if any.
1195 * Returns: Flag, true only if rest of Words on line should be ignored.
1196 *=======================================================================*/
1197
1198 static int
1199 cmd_optional_hyphen (Word *w, int align, char has_param, short param) {
1200 printf (op->chars.optional_hyphen);
1201 ++total_chars_this_line; /* \tab */
1202 return FALSE;
1203 }
1204
1205
1206 /*========================================================================
1207 * Name: cmd_emdash
1208 * Purpose: Executes the \emdash command.
1209 * Args: Word, paragraph align info, and numeric param if any.
1210 * Returns: Flag, true only if rest of Words on line should be ignored.
1211 *=======================================================================*/
1212 static int
1213 cmd_emdash (Word *w, int align, char has_param, short param) {
1214 printf (op->chars.emdash);
1215 ++total_chars_this_line; /* \tab */
1216 return FALSE;
1217 }
1218
1219
1220 /*========================================================================
1221 * Name: cmd_endash
1222 * Purpose: Executes the \endash command.
1223 * Args: Word, paragraph align info, and numeric param if any.
1224 * Returns: Flag, true only if rest of Words on line should be ignored.
1225 *=======================================================================*/
1226
1227 static int
1228 cmd_endash (Word *w, int align, char has_param, short param) {
1229 printf (op->chars.endash);
1230 ++total_chars_this_line; /* \tab */
1231 return FALSE;
1232 }
1233
1234
1235 /*========================================================================
1236 * Name: cmd_rquote
1237 * Purpose: Executes the \rquote command.
1238 * Args: Word, paragraph align info, and numeric param if any.
1239 * Returns: Flag, true only if rest of Words on line should be ignored.
1240 *=======================================================================*/
1241
1242 static int
1243 cmd_rquote (Word *w, int align, char has_param, short param) {
1244 printf (op->chars.right_quote);
1245 ++total_chars_this_line; /* \tab */
1246 return FALSE;
1247 }
1248
1249
1250 /*========================================================================
1251 * Name: cmd_par
1252 * Purpose: Executes the \par command.
1253 * Args: Word, paragraph align info, and numeric param if any.
1254 * Returns: Flag, true only if rest of Words on line should be ignored.
1255 *=======================================================================*/
1256 static int
1257 cmd_par (Word *w, int align, char has_param, short param) {
1258 printf (op->line_break);
1259 total_chars_this_line = 0; /* \tab */
1260 return FALSE;
1261 }
1262
1263
1264 /*========================================================================
1265 * Name: cmd_line
1266 * Purpose: Executes the \line command.
1267 * Args: Word, paragraph align info, and numeric param if any.
1268 * Returns: Flag, true only if rest of Words on line should be ignored.
1269 *=======================================================================*/
1270
1271 static int
1272 cmd_line (Word *w, int align, char has_param, short param) {
1273 printf (op->line_break);
1274 total_chars_this_line = 0; /* \tab */
1275 return FALSE;
1276 }
1277
1278
1279 /*========================================================================
1280 * Name: cmd_page
1281 * Purpose: Executes the \page command.
1282 * Args: Word, paragraph align info, and numeric param if any.
1283 * Returns: Flag, true only if rest of Words on line should be ignored.
1284 *=======================================================================*/
1285
1286 static int cmd_page (Word *w, int align, char has_param, short param) {
1287 printf (op->page_break);
1288 total_chars_this_line = 0; /* \tab */
1289 return FALSE;
1290 }
1291
1292
1293 /*========================================================================
1294 * Name: cmd_intbl
1295 * Purpose: Executes the \intbl command.
1296 * Args: Word, paragraph align info, and numeric param if any.
1297 * Returns: Flag, true only if rest of Words on line should be ignored.
1298 *=======================================================================*/
1299
1300 static int cmd_intbl (Word *w, int align, char has_param, short param) {
1301 ++coming_pars_that_are_tabular;
1302 return FALSE;
1303 }
1304
1305
1306 /*========================================================================
1307 * Name: cmd_ulnone
1308 * Purpose: Executes the \ulnone command.
1309 * Args: Word, paragraph align info, and numeric param if any.
1310 * Returns: Flag, true only if rest of Words on line should be ignored.
1311 *=======================================================================*/
1312
1313 static int cmd_ulnone (Word *w, int align, char has_param, short param) {
1314 int attr, more=TRUE;
1315 #ifdef BINARY_ATTRS
1316 attr_remove_underlining();
1317 #else
1318 do {
1319 attr = attr_read();
1320 if (attr==ATTR_UNDERLINE ||
1321 attr==ATTR_DOT_UL ||
1322 attr==ATTR_DASH_UL ||
1323 attr==ATTR_DOT_DASH_UL ||
1324 attr==ATTR_2DOT_DASH_UL ||
1325 attr==ATTR_WORD_UL ||
1326 attr==ATTR_WAVE_UL ||
1327 attr==ATTR_THICK_UL ||
1328 attr==ATTR_DOUBLE_UL)
1329 {
1330 if (!attr_pop(ATTR_UNDERLINE))
1331 ;
1332 } else
1333 more=FALSE;
1334 } while(more);
1335 #endif
1336 return FALSE;
1337 }
1338
1339 /*========================================================================
1340 * Name: cmd_ul
1341 * Purpose: Executes the \ul command.
1342 * Args: Word, paragraph align info, and numeric param if any.
1343 * Returns: Flag, true only if rest of Words on line should be ignored.
1344 *=======================================================================*/
1345
1346 static int cmd_ul (Word *w, int align, char has_param, short param) {
1347 if (has_param && param == 0) {
1348 cmd_ulnone (w, align, has_param, param);
1349 } else {
1350 attr_push (ATTR_UNDERLINE,NULL);
1351 }
1352 return FALSE;
1353 }
1354
1355 /*========================================================================
1356 * Name: cmd_uld
1357 * Purpose: Executes the \uld command.
1358 * Args: Word, paragraph align info, and numeric param if any.
1359 * Returns: Flag, true only if rest of Words on line should be ignored.
1360 *=======================================================================*/
1361
1362 static int cmd_uld (Word *w, int align, char has_param, short param) {
1363 attr_push(ATTR_DOUBLE_UL,NULL);
1364 return FALSE;
1365 }
1366
1367 /*========================================================================
1368 * Name: cmd_uldb
1369 * Purpose: Executes the \uldb command.
1370 * Args: Word, paragraph align info, and numeric param if any.
1371 * Returns: Flag, true only if rest of Words on line should be ignored.
1372 *=======================================================================*/
1373
1374 static int cmd_uldb (Word *w, int align, char has_param, short param) {
1375 attr_push(ATTR_DOT_UL,NULL);
1376 return FALSE;
1377 }
1378
1379
1380 /*========================================================================
1381 * Name: cmd_uldash
1382 * Purpose: Executes the \uldash command.
1383 * Args: Word, paragraph align info, and numeric param if any.
1384 * Returns: Flag, true only if rest of Words on line should be ignored.
1385 *=======================================================================*/
1386
1387 static int cmd_uldash (Word *w, int align, char has_param, short param) {
1388 attr_push(ATTR_DASH_UL,NULL);
1389 return FALSE;
1390 }
1391
1392
1393 /*========================================================================
1394 * Name: cmd_uldashd
1395 * Purpose: Executes the \cmd_uldashd command.
1396 * Args: Word, paragraph align info, and numeric param if any.
1397 * Returns: Flag, true only if rest of Words on line should be ignored.
1398 *=======================================================================*/
1399
1400 static int cmd_uldashd (Word *w, int align, char has_param, short param) {
1401 attr_push(ATTR_DOT_DASH_UL,NULL);
1402 return FALSE;
1403 }
1404
1405
1406 /*========================================================================
1407 * Name: cmd_uldashdd
1408 * Purpose: Executes the \uldashdd command.
1409 * Args: Word, paragraph align info, and numeric param if any.
1410 * Returns: Flag, true only if rest of Words on line should be ignored.
1411 *=======================================================================*/
1412
1413 static int cmd_uldashdd (Word *w, int align, char has_param, short param) {
1414 attr_push(ATTR_2DOT_DASH_UL,NULL);
1415 return FALSE;
1416 }
1417
1418
1419 /*========================================================================
1420 * Name: cmd_ulw
1421 * Purpose: Executes the \ulw command.
1422 * Args: Word, paragraph align info, and numeric param if any.
1423 * Returns: Flag, true only if rest of Words on line should be ignored.
1424 *=======================================================================*/
1425
1426 static int cmd_ulw (Word *w, int align, char has_param, short param) {
1427 attr_push(ATTR_WORD_UL,NULL);
1428 return FALSE;
1429 }
1430
1431
1432 /*========================================================================
1433 * Name: cmd_ulth
1434 * Purpose: Executes the \ulth command.
1435 * Args: Word, paragraph align info, and numeric param if any.
1436 * Returns: Flag, true only if rest of Words on line should be ignored.
1437 *=======================================================================*/
1438
1439 static int cmd_ulth (Word *w, int align, char has_param, short param) {
1440 attr_push(ATTR_THICK_UL,NULL);
1441 return FALSE;
1442 }
1443
1444
1445 /*========================================================================
1446 * Name: cmd_ulwave
1447 * Purpose: Executes the \ulwave command.
1448 * Args: Word, paragraph align info, and numeric param if any.
1449 * Returns: Flag, true only if rest of Words on line should be ignored.
1450 *=======================================================================*/
1451
1452 static int cmd_ulwave (Word *w, int align, char has_param, short param) {
1453 attr_push(ATTR_WAVE_UL,NULL);
1454 return FALSE;
1455 }
1456
1457
1458 /*========================================================================
1459 * Name: cmd_strike
1460 * Purpose: Executes the \strike command.
1461 * Args: Word, paragraph align info, and numeric param if any.
1462 * Returns: Flag, true only if rest of Words on line should be ignored.
1463 *=======================================================================*/
1464
1465 static int cmd_strike (Word *w, int align, char has_param, short param) {
1466 if (has_param && param==0)
1467 attr_pop(ATTR_STRIKE);
1468 else
1469 attr_push(ATTR_STRIKE,NULL);
1470 return FALSE;
1471 }
1472
1473 /*========================================================================
1474 * Name: cmd_strikedl
1475 * Purpose: Executes the \strikedl command.
1476 * Args: Word, paragraph align info, and numeric param if any.
1477 * Returns: Flag, true only if rest of Words on line should be ignored.
1478 *=======================================================================*/
1479
1480 static int cmd_strikedl (Word *w, int align, char has_param, short param) {
1481 if (has_param && param==0)
1482 attr_pop(ATTR_DBL_STRIKE);
1483 else
1484 attr_push(ATTR_DBL_STRIKE,NULL);
1485 return FALSE;
1486 }
1487
1488
1489 /*========================================================================
1490 * Name: cmd_striked
1491 * Purpose: Executes the \striked command.
1492 * Args: Word, paragraph align info, and numeric param if any.
1493 * Returns: Flag, true only if rest of Words on line should be ignored.
1494 *=======================================================================*/
1495
1496 static int cmd_striked (Word *w, int align, char has_param, short param) {
1497 if (has_param && param==0)
1498 attr_pop(ATTR_DBL_STRIKE);
1499 else
1500 attr_push(ATTR_DBL_STRIKE,NULL);
1501 return FALSE;
1502 }
1503
1504
1505 /*========================================================================
1506 * Name: cmd_rtf
1507 * Purpose: Executes the \rtf command.
1508 * Args: Word, paragraph align info, and numeric param if any.
1509 * Returns: Flag, true only if rest of Words on line should be ignored.
1510 *=======================================================================*/
1511
1512 static int cmd_rtf (Word *w, int align, char has_param, short param) {
1513 return FALSE;
1514 }
1515
1516
1517 /*========================================================================
1518 * Name: cmd_up
1519 * Purpose: Executes the \up command.
1520 * Args: Word, paragraph align info, and numeric param if any.
1521 * Returns: Flag, true only if rest of Words on line should be ignored.
1522 *=======================================================================*/
1523
1524 static int cmd_up (Word *w, int align, char has_param, short param) {
1525 if (has_param && param==0)
1526 attr_pop(ATTR_SUPER);
1527 else
1528 attr_push(ATTR_SUPER,NULL);
1529 return FALSE;
1530 }
1531
1532
1533 /*========================================================================
1534 * Name: cmd_dn
1535 * Purpose: Executes the \dn command.
1536 * Args: Word, paragraph align info, and numeric param if any.
1537 * Returns: Flag, true only if rest of Words on line should be ignored.
1538 *=======================================================================*/
1539
1540 static int cmd_dn (Word *w, int align, char has_param, short param) {
1541 if (has_param && param==0)
1542 attr_pop(ATTR_SUB);
1543 else
1544 attr_push(ATTR_SUB,NULL);
1545 return FALSE;
1546 }
1547
1548 /*========================================================================
1549 * Name: cmd_nosupersub
1550 * Purpose: Executes the \nosupersub command.
1551 * Args: Word, paragraph align info, and numeric param if any.
1552 * Returns: Flag, true only if rest of Words on line should be ignored.
1553 *=======================================================================*/
1554
1555 static int cmd_nosupersub (Word *w, int align, char has_param, short param) {
1556 attr_pop(ATTR_SUPER);
1557 attr_pop(ATTR_SUB);
1558 return FALSE;
1559 }
1560
1561 /*========================================================================
1562 * Name: cmd_super
1563 * Purpose: Executes the \super command.
1564 * Args: Word, paragraph align info, and numeric param if any.
1565 * Returns: Flag, true only if rest of Words on line should be ignored.
1566 *=======================================================================*/
1567
1568 static int cmd_super (Word *w, int align, char has_param, short param) {
1569 if (has_param && param==0)
1570 attr_pop(ATTR_SUPER);
1571 else
1572 attr_push(ATTR_SUPER,NULL);
1573 return FALSE;
1574 }
1575
1576 /*========================================================================
1577 * Name: cmd_sub
1578 * Purpose: Executes the \sub command.
1579 * Args: Word, paragraph align info, and numeric param if any.
1580 * Returns: Flag, true only if rest of Words on line should be ignored.
1581 *=======================================================================*/
1582
1583 static int cmd_sub (Word *w, int align, char has_param, short param) {
1584 if (has_param && param==0)
1585 attr_pop(ATTR_SUB);
1586 else
1587 attr_push(ATTR_SUB,NULL);
1588 return FALSE;
1589 }
1590
1591 /*========================================================================
1592 * Name: cmd_shad
1593 * Purpose: Executes the \shad command.
1594 * Args: Word, paragraph align info, and numeric param if any.
1595 * Returns: Flag, true only if rest of Words on line should be ignored.
1596 *=======================================================================*/
1597
1598 static int cmd_shad (Word *w, int align, char has_param, short param) {
1599 if (has_param && param==0)
1600 attr_pop(ATTR_SHADOW);
1601 else
1602 attr_push(ATTR_SHADOW,NULL);
1603 return FALSE;
1604 }
1605
1606 /*========================================================================
1607 * Name: cmd_b
1608 * Purpose: Executes the \b command.
1609 * Args: Word, paragraph align info, and numeric param if any.
1610 * Returns: Flag, true only if rest of Words on line should be ignored.
1611 *=======================================================================*/
1612
1613 static int
1614 cmd_b (Word *w, int align, char has_param, short param) {
1615 if (has_param && param==0) {
1616 attr_pop(ATTR_BOLD);
1617 }
1618 else
1619 attr_push(ATTR_BOLD,NULL);
1620 return FALSE;
1621 }
1622
1623 /*========================================================================
1624 * Name: cmd_i
1625 * Purpose: Executes the \i command.
1626 * Args: Word, paragraph align info, and numeric param if any.
1627 * Returns: Flag, true only if rest of Words on line should be ignored.
1628 *=======================================================================*/
1629
1630 static int cmd_i (Word *w, int align, char has_param, short param) {
1631 if (has_param && param==0)
1632 attr_pop(ATTR_ITALIC);
1633 else
1634 attr_push(ATTR_ITALIC,NULL);
1635 return FALSE;
1636 }
1637
1638 /*========================================================================
1639 * Name: cmd_s
1640 * Purpose: Executes the \s command.
1641 * Args: Word, paragraph align info, and numeric param if any.
1642 * Returns: Flag, true only if rest of Words on line should be ignored.
1643 *=======================================================================*/
1644 static int cmd_s (Word *w, int align, char has_param, short param) {
1645 return FALSE;
1646 }
1647
1648 /*========================================================================
1649 * Name: cmd_sect
1650 * Purpose: Executes the \sect command.
1651 * Args: Word, paragraph align info, and numeric param if any.
1652 * Returns: Flag, true only if rest of Words on line should be ignored.
1653 *=======================================================================*/
1654
1655 static int cmd_sect (Word *w, int align, char has_param, short param) {
1656 /* XX kludge */
1657 printf (op->paragraph_begin);
1658 return FALSE;
1659 }
1660
1661 /*========================================================================
1662 * Name: cmd_shp
1663 * Purpose: Executes the \shp command.
1664 * Args: Word, paragraph align info, and numeric param if any.
1665 * Returns: Flag, true only if rest of Words on line should be ignored.
1666 *=======================================================================*/
1667
1668 static int cmd_shp (Word *w, int align, char has_param, short param) {
1669 printf (op->comment_begin);
1670 printf ("Drawn Shape (ignored--not implemented yet)");
1671 printf (op->comment_begin);
1672 return FALSE;
1673 }
1674
1675 /*========================================================================
1676 * Name: cmd_outl
1677 * Purpose: Executes the \outl command.
1678 * Args: Word, paragraph align info, and numeric param if any.
1679 * Returns: Flag, true only if rest of Words on line should be ignored.
1680 *=======================================================================*/
1681
1682 static int cmd_outl (Word *w, int align, char has_param, short param) {
1683 if (has_param && param==0)
1684 attr_pop(ATTR_OUTLINE);
1685 else
1686 attr_push(ATTR_OUTLINE,NULL);
1687 return FALSE;
1688 }
1689
1690 /*========================================================================
1691 * Name: cmd_ansi
1692 * Purpose: Executes the \ansi command.
1693 * Args: Word, paragraph align info, and numeric param if any.
1694 * Returns: Flag, true only if rest of Words on line should be ignored.
1695 *=======================================================================*/
1696
1697 static int cmd_ansi (Word *w, int align, char has_param, short param) {
1698 charset_type = CHARSET_ANSI;
1699 printf (op->comment_begin);
1700 printf ("document uses ANSI character set");
1701 printf (op->comment_end);
1702 return FALSE;
1703 }
1704
1705 /*========================================================================
1706 * Name: cmd_pc
1707 * Purpose: Executes the \pc command.
1708 * Args: Word, paragraph align info, and numeric param if any.
1709 * Returns: Flag, true only if rest of Words on line should be ignored.
1710 *=======================================================================*/
1711
1712 static int cmd_pc (Word *w, int align, char has_param, short param) {
1713 charset_type = CHARSET_CP437 ;
1714 printf (op->comment_begin);
1715 printf ("document uses PC codepage 437 character set");
1716 printf (op->comment_end);
1717 return FALSE;
1718 }
1719
1720 /*========================================================================
1721 * Name: cmd_pca
1722 * Purpose: Executes the \pca command.
1723 * Args: Word, paragraph align info, and numeric param if any.
1724 * Returns: Flag, true only if rest of Words on line should be ignored.
1725 *=======================================================================*/
1726
1727 static int cmd_pca (Word *w, int align, char has_param, short param) {
1728 charset_type = CHARSET_CP850;
1729 printf (op->comment_begin);
1730 printf ("document uses PC codepage 850 character set");
1731 printf (op->comment_end);
1732 return FALSE;
1733 }
1734
1735 /*========================================================================
1736 * Name: cmd_mac
1737 * Purpose: Executes the \mac command.
1738 * Args: Word, paragraph align info, and numeric param if any.
1739 * Returns: Flag, true only if rest of Words on line should be ignored.
1740 *=======================================================================*/
1741
1742 static int cmd_mac (Word *w, int align, char has_param, short param) {
1743 charset_type = CHARSET_MAC;
1744 printf (op->comment_begin);
1745 printf ("document uses Macintosh character set");
1746 printf (op->comment_end);
1747 return FALSE;
1748 }
1749
1750 /*========================================================================
1751 * Name: cmd_colortbl
1752 * Purpose: Executes the \colortbl command.
1753 * Args: Word, paragraph align info, and numeric param if any.
1754 * Returns: Flag, true only if rest of Words on line should be ignored.
1755 *=======================================================================*/
1756
1757 static int cmd_colortbl (Word *w, int align, char has_param, short param) {
1758 if (w->next) {
1759 process_color_table(w->next);
1760 }
1761 return TRUE;
1762 }
1763
1764 /*========================================================================
1765 * Name: cmd_fonttbl
1766 * Purpose: Executes the \fonttbl command.
1767 * Args: Word, paragraph align info, and numeric param if any.
1768 * Returns: Flag, true only if rest of Words on line should be ignored.
1769 *=======================================================================*/
1770
1771 static int cmd_fonttbl (Word *w, int align, char has_param, short param) {
1772 if (w->next) {
1773 process_font_table(w->next);
1774 }
1775 return TRUE;
1776 }
1777
1778 /*========================================================================
1779 * Name: cmd_header
1780 * Purpose: Executes the \header command.
1781 * Args: Word, paragraph align info, and numeric param if any.
1782 * Returns: Flag, true only if rest of Words on line should be ignored.
1783 *=======================================================================*/
1784
1785 static int cmd_header (Word *w, int align, char has_param, short param) {
1786 return TRUE;
1787 }
1788
1789 /*========================================================================
1790 * Name: cmd_headerl
1791 * Purpose: Executes the \headerl command.
1792 * Args: Word, paragraph align info, and numeric param if any.
1793 * Returns: Flag, true only if rest of Words on line should be ignored.
1794 *=======================================================================*/
1795
1796 static int cmd_headerl (Word *w, int align, char has_param, short param) {
1797 return TRUE;
1798 }
1799
1800 /*========================================================================
1801 * Name: cmd_headerr
1802 * Purpose: Executes the \headerr command.
1803 * Args: Word, paragraph align info, and numeric param if any.
1804 * Returns: Flag, true only if rest of Words on line should be ignored.
1805 *=======================================================================*/
1806
1807 static int cmd_headerr (Word *w, int align, char has_param, short param) {
1808 return TRUE;
1809 }
1810
1811 /*========================================================================
1812 * Name: cmd_headerf
1813 * Purpose: Executes the \headerf command.
1814 * Args: Word, paragraph align info, and numeric param if any.
1815 * Returns: Flag, true only if rest of Words on line should be ignored.
1816 *=======================================================================*/
1817
1818 static int cmd_headerf (Word *w, int align, char has_param, short param) {
1819 return TRUE;
1820 }
1821
1822 /*========================================================================
1823 * Name: cmd_footer
1824 * Purpose: Executes the \footer command.
1825 * Args: Word, paragraph align info, and numeric param if any.
1826 * Returns: Flag, true only if rest of Words on line should be ignored.
1827 *=======================================================================*/
1828
1829 static int cmd_footer (Word *w, int align, char has_param, short param) {
1830 return TRUE;
1831 }
1832
1833 /*========================================================================
1834 * Name: cmd_footerl
1835 * Purpose: Executes the \footerl command.
1836 * Args: Word, paragraph align info, and numeric param if any.
1837 * Returns: Flag, true only if rest of Words on line should be ignored.
1838 *=======================================================================*/
1839
1840 static int cmd_footerl (Word *w, int align, char has_param, short param) {
1841 return TRUE;
1842 }
1843
1844 /*========================================================================
1845 * Name: cmd_footerr
1846 * Purpose: Executes the \footerr command.
1847 * Args: Word, paragraph align info, and numeric param if any.
1848 * Returns: Flag, true only if rest of Words on line should be ignored.
1849 *=======================================================================*/
1850
1851 static int cmd_footerr (Word *w, int align, char has_param, short param) {
1852 return TRUE;
1853 }
1854
1855 /*========================================================================
1856 * Name: cmd_footerf
1857 * Purpose: Executes the \footerf command.
1858 * Args: Word, paragraph align info, and numeric param if any.
1859 * Returns: Flag, true only if rest of Words on line should be ignored.
1860 *=======================================================================*/
1861
1862 static int cmd_footerf (Word *w, int align, char has_param, short param) {
1863 return TRUE;
1864 }
1865
1866 /*========================================================================
1867 * Name: cmd_ignore
1868 * Purpose: Dummy function to get rid of subgroups
1869 * Args: Word, paragraph align info, and numeric param if any.
1870 * Returns: Flag, true only if rest of Words on line should be ignored.
1871 *=======================================================================*/
1872
1873 static int cmd_ignore (Word *w, int align, char has_param, short param) {
1874 return TRUE;
1875 }
1876
1877 /*========================================================================
1878 * Name: cmd_info
1879 * Purpose: Executes the \info command.
1880 * Args: Word, paragraph align info, and numeric param if any.
1881 * Returns: Flag, true only if rest of Words on line should be ignored.
1882 *=======================================================================*/
1883
1884 static int cmd_info (Word *w, int align, char has_param, short param) {
1885 process_info_group (w->next);
1886 return TRUE;
1887 }
1888
1889 /*========================================================================
1890 * Name: cmd_pict
1891 * Purpose: Executes the \pict command.
1892 * Args: Word, paragraph align info, and numeric param if any.
1893 * Returns: Flag, true only if rest of Words on line should be ignored.
1894 *=======================================================================*/
1895
1896 static int cmd_pict (Word *w, int align, char has_param, short param) {
1897 within_picture=TRUE;
1898 picture_width = picture_height = 0;
1899 picture_type = PICT_WB;
1900 return FALSE;
1901 }
1902
1903 /*========================================================================
1904 * Name: cmd_bin
1905 * Purpose: Executes the \bin command.
1906 * Args: Word, paragraph align info, and numeric param if any.
1907 * Returns: Flag, true only if rest of Words on line should be ignored.
1908 *=======================================================================*/
1909
1910 static int cmd_bin (Word *w, int align, char has_param, short param) {
1911 return FALSE;
1912 }
1913
1914
1915 /*========================================================================
1916 * Name: cmd_macpict
1917 * Purpose: Executes the \macpict command.
1918 * Args: Word, paragraph align info, and numeric param if any.
1919 * Returns: Flag, true only if rest of Words on line should be ignored.
1920 *=======================================================================*/
1921
1922 static int cmd_macpict (Word *w, int align, char has_param, short param) {
1923 picture_type = PICT_MAC;
1924 return FALSE;
1925 }
1926
1927 /*========================================================================
1928 * Name: cmd_jpegblip
1929 * Purpose: Executes the \jpegblip command.
1930 * Args: Word, paragraph align info, and numeric param if any.
1931 * Returns: Flag, true only if rest of Words on line should be ignored.
1932 *=======================================================================*/
1933
1934 static int cmd_jpegblip (Word *w, int align, char has_param, short param) {
1935 picture_type = PICT_JPEG;
1936 return FALSE;
1937 }
1938
1939 /*========================================================================
1940 * Name: cmd_pngblip
1941 * Purpose: Executes the \pngblip command.
1942 * Args: Word, paragraph align info, and numeric param if any.
1943 * Returns: Flag, true only if rest of Words on line should be ignored.
1944 *=======================================================================*/
1945
1946 static int cmd_pngblip (Word *w, int align, char has_param, short param) {
1947 picture_type = PICT_PNG;
1948 return FALSE;
1949 }
1950
1951 /*========================================================================
1952 * Name: cmd_pnmetafile
1953 * Purpose: Executes the \pnmetafile command.
1954 * Args: Word, paragraph align info, and numeric param if any.
1955 * Returns: Flag, true only if rest of Words on line should be ignored.
1956 *=======================================================================*/
1957
1958 static int cmd_pnmetafile (Word *w, int align, char has_param, short param) {
1959 picture_type = PICT_PM;
1960 return FALSE;
1961 }
1962
1963 /*========================================================================
1964 * Name: cmd_wmetafile
1965 * Purpose: Executes the \wmetafile command.
1966 * Args: Word, paragraph align info, and numeric param if any.
1967 * Returns: Flag, true only if rest of Words on line should be ignored.
1968 *=======================================================================*/
1969
1970 static int cmd_wmetafile (Word *w, int align, char has_param, short param) {
1971 picture_type = PICT_WM;
1972 if (within_picture && has_param) {
1973 picture_wmetafile_type=param;
1974 switch(param) {
1975 case 1: picture_wmetafile_type_str="MM_TEXT"; break;
1976 case 2: picture_wmetafile_type_str="MM_LOMETRIC"; break;
1977 case 3: picture_wmetafile_type_str="MM_HIMETRIC"; break;
1978 case 4: picture_wmetafile_type_str="MM_LOENGLISH"; break;
1979 case 5: picture_wmetafile_type_str="MM_HIENGLISH"; break;
1980 case 6: picture_wmetafile_type_str="MM_TWIPS"; break;
1981 case 7: picture_wmetafile_type_str="MM_ISOTROPIC"; break;
1982 case 8: picture_wmetafile_type_str="MM_ANISOTROPIC"; break;
1983 default: picture_wmetafile_type_str="default:MM_TEXT"; break;
1984 }
1985 }
1986 return FALSE;
1987 }
1988
1989 /*========================================================================
1990 * Name: cmd_wbmbitspixel
1991 * Purpose: Executes the \wbmbitspixel command.
1992 * Args: Word, paragraph align info, and numeric param if any.
1993 * Returns: Flag, true only if rest of Words on line should be ignored.
1994 *=======================================================================*/
1995
1996 static int cmd_wbmbitspixel (Word *w, int align, char has_param, short param) {
1997 if (within_picture && has_param)
1998 picture_bits_per_pixel = param;
1999 return FALSE;
2000 }
2001
2002 /*========================================================================
2003 * Name: cmd_picw
2004 * Purpose: Executes the \picw command.
2005 * Args: Word, paragraph align info, and numeric param if any.
2006 * Returns: Flag, true only if rest of Words on line should be ignored.
2007 *=======================================================================*/
2008
2009 static int cmd_picw (Word *w, int align, char has_param, short param) {
2010 if (within_picture && has_param)
2011 picture_width = param;
2012 return FALSE;
2013 }
2014
2015 /*========================================================================
2016 * Name: cmd_pich
2017 * Purpose: Executes the \pich command.
2018 * Args: Word, paragraph align info, and numeric param if any.
2019 * Returns: Flag, true only if rest of Words on line should be ignored.
2020 *=======================================================================*/
2021
2022 static int cmd_pich (Word *w, int align, char has_param, short param) {
2023 if (within_picture && has_param)
2024 picture_height = param;
2025 return FALSE;
2026 }
2027
2028
2029 /*========================================================================
2030 * Name: cmd_xe
2031 * Purpose: Executes the \xe (index entry) command.
2032 * Args: Word, paragraph align info, and numeric param if any.
2033 * Returns: Flag, true only if rest of Words on line should be ignored.
2034 *=======================================================================*/
2035
2036 static int cmd_xe (Word *w, int align, char has_param, short param) {
2037 process_index_entry (w);
2038 return TRUE;
2039 }
2040
2041 /*========================================================================
2042 * Name: cmd_tc
2043 * Purpose: Executes the \tc (TOC entry) command.
2044 * Args: Word, paragraph align info, and numeric param if any.
2045 * Returns: Flag, true only if rest of Words on line should be ignored.
2046 *=======================================================================*/
2047
2048 static int cmd_tc (Word *w, int align, char has_param, short param) {
2049 process_toc_entry (w, TRUE);
2050 return TRUE;
2051 }
2052
2053 /*========================================================================
2054 * Name: cmd_tcn
2055 * Purpose: Executes the \tcn (TOC entry, no page #) command.
2056 * Args: Word, paragraph align info, and numeric param if any.
2057 * Returns: Flag, true only if rest of Words on line should be ignored.
2058 *=======================================================================*/
2059
2060 static int cmd_tcn (Word *w, int align, char has_param, short param) {
2061 process_toc_entry (w, FALSE);
2062 return TRUE;
2063 }
2064
2065
2066 typedef struct {
2067 char *name;
2068 int (*func)(Word*,int,char,short);
2069 char *debug_print;
2070 }
2071 HashItem;
2072
2073
2074
2075 static HashItem hashArray_other [] = {
2076 { "*", cmd_ignore, NULL },
2077 { "-", cmd_optional_hyphen, "optional hyphen" },
2078 { "_", cmd_nonbreaking_hyphen, "nonbreaking hyphen" },
2079 { "~", cmd_nonbreaking_space, NULL },
2080 { NULL, NULL, NULL}
2081 };
2082 static HashItem hashArray_a [] = {
2083 { "ansi", &cmd_ansi , NULL },
2084 { NULL, NULL, NULL}
2085 };
2086 static HashItem hashArray_b [] = {
2087 { "b", &cmd_b, NULL },
2088 { "bullet", &cmd_bullet, NULL },
2089 { "bin", &cmd_bin, "picture is binary" },
2090 #if 0
2091 { "bgbdiag", NULL, NULL },
2092 { "bgcross", NULL, NULL },
2093 { "bgdcross", NULL, NULL },
2094 { "bgfdiag", NULL, NULL },
2095 { "bghoriz", NULL, NULL },
2096 { "bgkbdiag", NULL, NULL },
2097 { "bgkcross", NULL, NULL },
2098 { "bgkdcross", NULL, NULL },
2099 { "bgkfdiag", NULL, NULL },
2100 { "bgkhoriz", NULL, NULL },
2101 { "bgkvert", NULL, NULL },
2102 { "bgvert", NULL, NULL },
2103 { "brdrcf", NULL, NULL },
2104 { "brdrdb", NULL, NULL },
2105 { "brdrdot", NULL, NULL },
2106 { "brdrhair", NULL, NULL },
2107 { "brdrs", NULL, NULL },
2108 { "brdrsh", NULL, NULL },
2109 { "brdrth", NULL, NULL },
2110 { "brdrw", NULL, NULL },
2111 #endif
2112 { NULL, NULL, NULL}
2113 };
2114 static HashItem hashArray_c [] = {
2115 { "caps", &cmd_caps, NULL },
2116 { "cb", cmd_cb, NULL },
2117 { "cf", cmd_cf, NULL },
2118 { "colortbl", &cmd_colortbl, "color table" },
2119 { "cols", NULL, "columns (not implemented)" },
2120 { "column", NULL, "column break (not implemented)" },
2121 #if 0
2122 { "cbpat", NULL, NULL },
2123 { "cellx", NULL, NULL },
2124 { "cfpat", NULL, NULL },
2125 { "cgrid", NULL, NULL },
2126 { "clbgbcross", NULL, NULL },
2127 { "clbgbdiag", NULL, NULL },
2128 { "clbgbkbdiag", NULL, NULL },
2129 { "clbgbkcross", NULL, NULL },
2130 { "clbgbkdcross", NULL, NULL },
2131 { "clbgbkfdiag", NULL, NULL },
2132 { "clbgbkhor", NULL, NULL },
2133 { "clbgbkvert", NULL, NULL },
2134 { "clbgdcross", NULL, NULL },
2135 { "clbgfdiag", NULL, NULL },
2136 { "clbghoriz", NULL, NULL },
2137 { "clbgvert", NULL, NULL },
2138 { "clbrdrb", NULL, NULL },
2139 { "clbrdrl", NULL, NULL },
2140 { "clbrdrr", NULL, NULL },
2141 { "clbrdrt", NULL, NULL },
2142 { "clcbpat", NULL, NULL },
2143 { "clcfpat", NULL, NULL },
2144 { "clmgf", NULL, NULL },
2145 { "clmrg", NULL, NULL },
2146 { "clshdng", NULL, NULL },
2147 #endif
2148 { NULL, NULL, NULL}
2149 };
2150 static HashItem hashArray_d [] = {
2151 { "dn", &cmd_dn, NULL },
2152 #if 0
2153 { "dibitmap", NULL, NULL },
2154 #endif
2155 { NULL, NULL, NULL}
2156 };
2157 static HashItem hashArray_e [] = {
2158 { "emdash", cmd_emdash, NULL },
2159 { "endash", cmd_endash, NULL },
2160 { "embo", &cmd_emboss, NULL },
2161 { "expand", &cmd_expand, NULL },
2162 { "expnd", &cmd_expand, NULL },
2163 { NULL, NULL, NULL}
2164 };
2165 static HashItem hashArray_f [] = {
2166 { "f", cmd_f, NULL },
2167 { "fdecor", cmd_fdecor, NULL },
2168 { "fmodern", cmd_fmodern, NULL },
2169 { "fnil", cmd_fnil, NULL },
2170 { "fonttbl", cmd_fonttbl, "font table" },
2171 { "froman", cmd_froman, NULL },
2172 { "fs", cmd_fs, NULL },
2173 { "fscript", cmd_fscript, NULL },
2174 { "fswiss", cmd_fswiss, NULL },
2175 { "ftech", cmd_ftech, NULL },
2176 { "field", cmd_field, NULL },
2177 { "footer", cmd_footer, NULL },
2178 { "footerf", cmd_footerf, NULL },
2179 { "footerl", cmd_footerl, NULL },
2180 { "footerr", cmd_footerr, NULL },
2181 { NULL, NULL, NULL}
2182 };
2183 static HashItem hashArray_h [] = {
2184 { "highlight", &cmd_highlight, NULL },
2185 { "header", cmd_header, NULL },
2186 { "headerf", cmd_headerf, NULL },
2187 { "headerl", cmd_headerl, NULL },
2188 { "headerr", cmd_headerr, NULL },
2189 { "hl", cmd_ignore, "hyperlink within object" },
2190 { NULL, NULL, NULL}
2191 };
2192 static HashItem hashArray_i [] = {
2193 { "i", &cmd_i, NULL },
2194 { "info", &cmd_info, NULL },
2195 { "intbl", &cmd_intbl, NULL },
2196 { "impr", &cmd_engrave, NULL },
2197 { NULL, NULL, NULL}
2198 };
2199 static HashItem hashArray_j [] = {
2200 { "jpegblip", &cmd_jpegblip, NULL },
2201 { NULL, NULL, NULL}
2202 };
2203 static HashItem hashArray_l [] = {
2204 { "ldblquote", &cmd_ldblquote, NULL },
2205 { "line", &cmd_line, NULL },
2206 { "lquote", &cmd_lquote, NULL },
2207 { NULL, NULL, NULL}
2208 };
2209 static HashItem hashArray_m [] = {
2210 { "mac", &cmd_mac , NULL },
2211 { "macpict", &cmd_macpict, NULL },
2212 { NULL, NULL, NULL}
2213 };
2214 static HashItem hashArray_n [] = {
2215 { "nosupersub", &cmd_nosupersub, NULL },
2216 { NULL, NULL, NULL}
2217 };
2218 static HashItem hashArray_o [] = {
2219 { "outl", &cmd_outl, NULL },
2220 { NULL, NULL, NULL}
2221 };
2222 static HashItem hashArray_p [] = {
2223 { "page", &cmd_page, NULL },
2224 { "par", &cmd_par, NULL },
2225 { "pc", &cmd_pc , NULL },
2226 { "pca", &cmd_pca , NULL },
2227 { "pich", &cmd_pich, NULL },
2228 { "pict", &cmd_pict, "picture" },
2229 { "picw", &cmd_picw, NULL },
2230 { "plain", &cmd_plain, NULL },
2231 { "pngblip", &cmd_pngblip, NULL },
2232 { "pnmetafile", &cmd_pnmetafile, NULL },
2233 #if 0
2234 { "piccropb", NULL, NULL },
2235 { "piccropl", NULL, NULL },
2236 { "piccropr", NULL, NULL },
2237 { "piccropt", NULL, NULL },
2238 { "pichgoal", NULL, NULL },
2239 { "pichgoal", NULL, NULL },
2240 { "picscaled", NULL, NULL },
2241 { "picscalex", NULL, NULL },
2242 { "picwgoal", NULL, NULL },
2243 #endif
2244 { NULL, NULL, NULL}
2245 };
2246 static HashItem hashArray_r [] = {
2247 { "rdblquote", &cmd_rdblquote, NULL },
2248 { "rquote", &cmd_rquote, NULL },
2249 { "rtf", &cmd_rtf, NULL },
2250 { NULL, NULL, NULL}
2251 };
2252 static HashItem hashArray_s [] = {
2253 { "s", cmd_s, "style" },
2254 { "sect", &cmd_sect, "section break"},
2255 { "scaps", &cmd_scaps, NULL },
2256 { "super", &cmd_super, NULL },
2257 { "sub", &cmd_sub, NULL },
2258 { "shad", &cmd_shad, NULL },
2259 { "strike", &cmd_strike, NULL },
2260 { "striked", &cmd_striked, NULL },
2261 { "strikedl", &cmd_strikedl, NULL },
2262 { "stylesheet", &cmd_ignore, "style sheet" },
2263 { "shp", cmd_shp, "drawn shape" },
2264 #if 0
2265 { "shading", NULL, NULL },
2266 #endif
2267 { NULL, NULL, NULL}
2268 };
2269 static HashItem hashArray_t [] = {
2270 { "tab", &cmd_tab, NULL },
2271 { "tc", cmd_tc, "TOC entry" },
2272 { "tcn", cmd_tcn, "TOC entry" },
2273 #if 0
2274 { "tcf", NULL , NULL },
2275 { "tcl", NULL , NULL },
2276 { "trgaph", NULL , NULL },
2277 { "trleft", NULL , NULL },
2278 { "trowd", NULL , NULL },
2279 { "trqc", NULL , NULL },
2280 { "trql", NULL , NULL },
2281 { "trqr", NULL , NULL },
2282 { "trrh", NULL , NULL },
2283 #endif
2284 { NULL, NULL, NULL}
2285 };
2286 static HashItem hashArray_u [] = {
2287 { "ul", &cmd_ul, NULL },
2288 { "up", &cmd_up, NULL },
2289 { "uld", &cmd_uld, NULL },
2290 { "uldash", &cmd_uldash, NULL },
2291 { "uldashd", &cmd_uldashd, NULL },
2292 { "uldashdd", &cmd_uldashdd, NULL },
2293 { "uldb", &cmd_uldb, NULL },
2294 { "ulnone", &cmd_ulnone, NULL },
2295 { "ulth", &cmd_ulth, NULL },
2296 { "ulw", &cmd_ulw, NULL },
2297 { "ulwave", &cmd_ulwave, NULL },
2298 { NULL, NULL, NULL}
2299 };
2300
2301 static HashItem hashArray_w [] = {
2302 { "wbmbitspixel", &cmd_wbmbitspixel, NULL },
2303 { "wmetafile", &cmd_wmetafile, NULL },
2304 #if 0
2305 { "wbitmap", NULL, NULL },
2306 { "wbmplanes", NULL, NULL },
2307 { "wbmwidthbytes", NULL, NULL },
2308 #endif
2309 { NULL, NULL, NULL}
2310 };
2311
2312 static HashItem hashArray_x [] = {
2313 { "xe", cmd_xe, "index entry" },
2314 { NULL, NULL, NULL}
2315 };
2316
2317 static HashItem *hash [26] = {
2318 hashArray_a,
2319 hashArray_b,
2320 hashArray_c,
2321 hashArray_d,
2322 hashArray_e,
2323 hashArray_f,
2324 NULL,
2325 hashArray_h,
2326 hashArray_i,
2327 hashArray_j,
2328 NULL,
2329 hashArray_l,
2330 hashArray_m,
2331 hashArray_n,
2332 hashArray_o,
2333 hashArray_p,
2334 NULL,
2335 hashArray_r,
2336 hashArray_s,
2337 hashArray_t,
2338 hashArray_u,
2339 NULL,
2340 hashArray_w,
2341 hashArray_x,
2342 NULL, NULL
2343 };
2344
2345
2346 /*-------------------------------------------------------------------*/
2347 /*-------------------------------------------------------------------*/
2348
2349
2350
2351 /*-------------------------------------------------------------------*/
2352 /*-------------------------------------------------------------------*/
2353
2354
2355 /*========================================================================
2356 * Name:
2357 * Purpose:
2358 * Args: None.
2359 * Returns: None.
2360 *=======================================================================*/
2361
2362 void
2363 print_with_special_exprs (char *s) {
2364 int ch;
2365 int state;
2366
2367 enum { SMALL=0, BIG=1 };
2368
2369 CHECK_PARAM_NOT_NULL(s);
2370
2371 if (simulate_smallcaps) {
2372 if (*s >= 'a' && *s <= 'z') {
2373 state=SMALL;
2374 printf (op->smaller_begin);
2375 }
2376 else
2377 state=BIG;
2378 }
2379
2380 while ((ch=*s)) {
2381 char *post_trans = NULL;
2382
2383 if (simulate_allcaps || simulate_smallcaps)
2384 ch = toupper (ch);
2385
2386 if (ch >= 0x20 && ch < 0x80) {
2387 post_trans = op_translate_char (op, charset_type, ch);
2388 printf ("%s",post_trans);
2389 }
2390
2391 s++;
2392
2393 if (simulate_smallcaps) {
2394 ch = *s;
2395 if (ch >= 'a' && ch <= 'z') {
2396 if (state==BIG)
2397 printf (op->smaller_begin);
2398 state=SMALL;
2399 }
2400 else
2401 {
2402 if (state==SMALL)
2403 printf (op->smaller_end);
2404 state=BIG;
2405 }
2406 }
2407 }
2408 }
2409
2410
2411
2412 /*========================================================================
2413 * Name:
2414 * Purpose:
2415 * Args: None.
2416 * Returns: None.
2417 *=======================================================================*/
2418
2419 static void
2420 begin_table()
2421 {
2422 within_table=TRUE;
2423 have_printed_row_begin = FALSE;
2424 have_printed_cell_begin = FALSE;
2425 have_printed_row_end = FALSE;
2426 have_printed_cell_end = FALSE;
2427 attrstack_push();
2428 starting_body();
2429 printf (op->table_begin);
2430 }
2431
2432
2433
2434 /*========================================================================
2435 * Name:
2436 * Purpose:
2437 * Args: None.
2438 * Returns: None.
2439 *=======================================================================*/
2440
2441 void
2442 end_table ()
2443 {
2444 if (within_table) {
2445 if (!have_printed_cell_end) {
2446 attr_pop_dump();
2447 printf (op->table_cell_end);
2448 }
2449 if (!have_printed_row_end) {
2450 printf (op->table_row_end);
2451 }
2452 printf (op->table_end);
2453 within_table=FALSE;
2454 have_printed_row_begin = FALSE;
2455 have_printed_cell_begin = FALSE;
2456 have_printed_row_end = FALSE;
2457 have_printed_cell_end = FALSE;
2458 }
2459 }
2460
2461
2462
2463 /*========================================================================
2464 * Name:
2465 * Purpose:
2466 * Args: None.
2467 * Returns: None.
2468 *=======================================================================*/
2469
2470 void
2471 starting_text() {
2472 if (within_table) {
2473 if (!have_printed_row_begin) {
2474 printf (op->table_row_begin);
2475 have_printed_row_begin=TRUE;
2476 have_printed_row_end=FALSE;
2477 have_printed_cell_begin=FALSE;
2478 }
2479 if (!have_printed_cell_begin) {
2480 printf (op->table_cell_begin);
2481 attrstack_express_all();
2482 have_printed_cell_begin=TRUE;
2483 have_printed_cell_end=FALSE;
2484 }
2485 }
2486 }
2487
2488
2489
2490
2491 /*========================================================================
2492 * Name:
2493 * Purpose:
2494 * Args: None.
2495 * Returns: None.
2496 *=======================================================================*/
2497
2498 static void
2499 starting_paragraph_align (int align)
2500 {
2501 if (within_header && align != ALIGN_LEFT)
2502 starting_body();
2503
2504 switch (align)
2505 {
2506 case ALIGN_CENTER:
2507 printf (op->center_begin);
2508 break;
2509 case ALIGN_LEFT:
2510 break;
2511 case ALIGN_RIGHT:
2512 printf (op->align_right_begin);
2513 break;
2514 case ALIGN_JUSTIFY:
2515 printf (op->align_right_begin);
2516 break;
2517 }
2518 }
2519
2520
2521
2522 /*========================================================================
2523 * Name:
2524 * Purpose:
2525 * Args: None.
2526 * Returns: None.
2527 *=======================================================================*/
2528
2529 static void
2530 ending_paragraph_align (int align)
2531 {
2532 switch (align) {
2533 case ALIGN_CENTER:
2534 printf (op->center_end);
2535 break;
2536 case ALIGN_LEFT:
2537 // printf (op->align_left_end);
2538 break;
2539 case ALIGN_RIGHT:
2540 printf (op->align_right_end);
2541 break;
2542 case ALIGN_JUSTIFY:
2543 printf (op->justify_end);
2544 break;
2545 }
2546 }
2547
2548
2549 /*========================================================================
2550 * Name:
2551 * Purpose: Recursive routine to produce the output in the target
2552 * format given on a tree of words.
2553 * Args: Word* (the tree).
2554 * Returns: None.
2555 *=======================================================================*/
2556
2557 static void
2558 word_print_core (Word *w)
2559 {
2560 char *s;
2561 FILE *f=NULL;
2562 int is_cell_group=FALSE;
2563 int paragraph_begined=FALSE;
2564 int paragraph_align=ALIGN_LEFT;
2565
2566 CHECK_PARAM_NOT_NULL(w);
2567
2568 if (!coming_pars_that_are_tabular && within_table) {
2569 end_table();
2570 }
2571 else if (coming_pars_that_are_tabular && !within_table) {
2572 begin_table();
2573 }
2574
2575 /* Mark our place in the stack */
2576 attrstack_push();
2577
2578 while (w) {
2579 s = word_string (w);
2580
2581 if (s) {
2582 /*--Ignore whitespace in header--------------------*/
2583 if (*s==' ' && within_header) {
2584 /* no op */
2585 }
2586 else
2587 /*--Handle word -----------------------------------*/
2588 if (s[0] != '\\')
2589 {
2590 starting_body();
2591 starting_text();
2592
2593 if (!paragraph_begined) {
2594 starting_paragraph_align (paragraph_align);
2595 paragraph_begined=TRUE;
2596 }
2597
2598 /*----------------------------------------*/
2599 if (within_picture) {
2600 starting_body();
2601 if (!f) {
2602 char *ext=NULL;
2603 switch (picture_type) {
2604 case PICT_WB: ext="bmp"; break;
2605 case PICT_WM: ext="wmf"; break;
2606 case PICT_MAC: ext="pict"; break;
2607 case PICT_JPEG: ext="jpg"; break;
2608 case PICT_PNG: ext="png"; break;
2609 case PICT_DI: ext="dib"; break; /* Device independent bitmap=??? */
2610 case PICT_PM: ext="pmm"; break; /* OS/2 metafile=??? */
2611 }
2612 sprintf (picture_path, "pict%03d.%s",
2613 picture_file_number++,ext);
2614 f=fopen(picture_path,"w");
2615 }
2616
2617 if (s[0]!=' ') {
2618 char *s2;
2619 printf (op->comment_begin);
2620 printf ("picture data found, ");
2621 if (picture_wmetafile_type_str) {
2622 printf ("WMF type is %s, ",
2623 picture_wmetafile_type_str);
2624 }
2625 printf ("picture dimensions are %d by %d, depth %d",
2626 picture_width, picture_height, picture_bits_per_pixel);
2627 printf (op->comment_end);
2628 if (picture_width && picture_height && picture_bits_per_pixel) {
2629 s2=s;
2630 while (*s2) {
2631 unsigned int tmp,value;
2632 tmp=tolower(*s2++);
2633 if (tmp>'9') tmp-=('a'-10);
2634 else tmp-='0';
2635 value=16*tmp;
2636 tmp=tolower(*s2++);
2637 if (tmp>'9') tmp-=('a'-10);
2638 else tmp-='0';
2639 value+=tmp;
2640 fprintf (f,"%c", value);
2641 }
2642 }
2643 }
2644 }
2645 /*----------------------------------------*/
2646 else {
2647 total_chars_this_line += strlen(s);
2648
2649 if (op->word_begin)
2650 printf (op->word_begin);
2651
2652 print_with_special_exprs (s);
2653
2654 if (op->word_end)
2655 printf (op->word_end);
2656 }
2657
2658 /*---Handle RTF keywords---------------------------*/
2659
2660 } else {
2661 int done=FALSE;
2662
2663 s++;
2664
2665 /*----Paragraph alignment----------------------------------------------------*/
2666 if (!strcmp ("ql", s))
2667 paragraph_align = ALIGN_LEFT;
2668 else if (!strcmp ("qr", s))
2669 paragraph_align = ALIGN_RIGHT;
2670 else if (!strcmp ("qj", s))
2671 paragraph_align = ALIGN_JUSTIFY;
2672 else if (!strcmp ("qc", s))
2673 paragraph_align = ALIGN_CENTER;
2674 else if (!strcmp ("pard", s))
2675 {
2676 /* Clear out all font attributes.
2677 */
2678 attr_pop_all();
2679 if(coming_pars_that_are_tabular) {
2680 --coming_pars_that_are_tabular;
2681 }
2682
2683 /* Clear out all paragraph attributes.
2684 */
2685 ending_paragraph_align(paragraph_align);
2686 paragraph_align = ALIGN_LEFT;
2687 paragraph_begined = FALSE;
2688 }
2689 /*----Table keywords---------------------------------------------------------*/
2690 else
2691 if (!strcmp (s, "cell")) {
2692 is_cell_group=TRUE;
2693 if (!have_printed_cell_begin) {
2694 /* Need this with empty cells */
2695 printf (op->table_cell_begin);
2696 attrstack_express_all();
2697 }
2698 attr_pop_dump();
2699 printf (op->table_cell_end);
2700 have_printed_cell_begin = FALSE;
2701 have_printed_cell_end=TRUE;
2702 }
2703 else if (!strcmp (s, "row")) {
2704 if (within_table) {
2705 printf (op->table_row_end);
2706 have_printed_row_begin = FALSE;
2707 have_printed_row_end=TRUE;
2708 } else {
2709 if (debug_mode) {
2710 printf (op->comment_begin);
2711 printf ("end of table row");
2712 printf (op->comment_end);
2713 }
2714 }
2715 }
2716
2717 /*----Special chars---------------------------------------------------------*/
2718 else if (*s == '\'') {
2719 /* \'XX is a hex char code expression */
2720 int ch = h2toi (&s[1]);
2721 char *s2;
2722
2723 s2 = op_translate_char (op, charset_type, ch);
2724
2725 if (!s2 || !*s2) {
2726 printf (op->comment_begin);
2727 printf("char 0x%02x",ch);
2728 printf (op->comment_end);
2729 } else {
2730 if (op->word_begin)
2731 printf (op->word_begin);
2732 printf ("%s", s2);
2733 if (op->word_end)
2734 printf (op->word_end);
2735 }
2736 }
2737 else
2738 /*----Search the RTF command hash-------------------------------------------*/
2739 {
2740 int ch;
2741 int index=0;
2742 int have_param=FALSE, param=0;
2743 HashItem *hip;
2744 char *p;
2745 int match;
2746
2747 /* Look for a parameter */
2748 p=s;
2749 while(*p && (!isdigit(*p) && *p!='-')) p++;
2750 if (*p && (isdigit(*p) || *p=='-')) {
2751 have_param=TRUE;
2752 param=atoi (p);
2753 }
2754
2755 /* Generate a hash index
2756 */
2757 ch = tolower (*s);
2758 if (ch>='a' && ch<='z')
2759 hip = hash [ch-'a'];
2760 else
2761 hip = hashArray_other;
2762
2763 if (!hip) {
2764 if (debug_mode) {
2765 printf (op->comment_begin);
2766 printf ("unfamiliar rtf command: %s", s);
2767 printf (op->comment_begin);
2768 }
2769 }
2770 else
2771 {
2772 while (!done) {
2773 match=FALSE;
2774
2775 if (have_param) {
2776 int len=p-s;
2777 if (!hip[index].name[len] && !strncmp (s, hip[index].name, len))
2778 match=TRUE;
2779 }
2780 else
2781 match = !strcmp(s, hip[index].name);
2782
2783 if (match) {
2784 #if 0
2785 char *always;
2786 #endif
2787 char *debug;
2788 int terminate_group;
2789
2790 if (hip[index].func) {
2791 terminate_group = hip[index].func (w,paragraph_align, have_param, param);
2792
2793 if (terminate_group)
2794 while(w) w=w->next;
2795 }
2796
2797 debug=hip[index].debug_print;
2798
2799 #if 0
2800 always=hip[index].always_print;
2801 if (always)
2802 printf ("%s", always);
2803 #endif
2804 if (debug && debug_mode) {
2805 printf (op->comment_begin);
2806 printf ("%s", debug);
2807 printf (op->comment_end);
2808 }
2809
2810 done=TRUE;
2811 }
2812 else
2813 {
2814 index++;
2815 if (!hip[index].name)
2816 done=TRUE;
2817 }
2818 }
2819 }
2820 if (!match) {
2821 if (debug_mode) {
2822 printf (op->comment_begin);
2823 printf ("unfamiliar rtf command: %s", s);
2824 printf (op->comment_end);
2825 }
2826 }
2827 }
2828 }
2829 /*-------------------------------------------------------------------------*/
2830 } else {
2831 Word *child;
2832
2833 child = w->child;
2834
2835 if (!paragraph_begined) {
2836 starting_paragraph_align (paragraph_align);
2837 paragraph_begined=TRUE;
2838 }
2839
2840 if (child)
2841 word_print_core (child);
2842 }
2843
2844 if (w)
2845 w = w->next;
2846 }
2847
2848 if (within_picture) {
2849 if(f) {
2850 fclose(f);
2851 printf (op->imagelink_begin);
2852 printf ("%s", picture_path);
2853 printf (op->imagelink_end);
2854 within_picture=FALSE;
2855 }
2856 }
2857
2858 /* Undo font attributes UNLESS we're doing table cells
2859 * since they would appear between </td> and </tr>.
2860 */
2861 if (!is_cell_group)
2862 attr_pop_all();
2863 else
2864 attr_drop_all();
2865
2866 /* Undo paragraph alignment
2867 */
2868 if (paragraph_begined)
2869 ending_paragraph_align (paragraph_align);
2870
2871 attrstack_drop();
2872 }
2873
2874
2875
2876
2877 /*========================================================================
2878 * Name:
2879 * Purpose:
2880 * Args: None.
2881 * Returns: None.
2882 *=======================================================================*/
2883
2884 void
2885 word_print (Word *w)
2886 {
2887 CHECK_PARAM_NOT_NULL (w);
2888
2889 if (!inline_mode) {
2890 printf (op->document_begin);
2891 printf (op->header_begin);
2892 }
2893
2894 print_banner ();
2895
2896 within_header=TRUE;
2897 have_printed_body=FALSE;
2898 within_table=FALSE;
2899 simulate_allcaps=FALSE;
2900 word_print_core (w);
2901 end_table();
2902
2903 if (!inline_mode) {
2904 printf (op->body_end);
2905 printf (op->document_end);
2906 }
2907 }
2908
2909
0
1 /*===========================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 ===========================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: convert
25 * Author name: Zach Smith
26 * Create date: 19 Sep 2001
27 * Purpose: Definitions for the conversion module
28 *----------------------------------------------------------------------
29 * Changes:
30 *--------------------------------------------------------------------*/
31
32
33 #ifndef _CONVERT
34
35 enum {
36 CHARSET_ANSI=1,
37 CHARSET_MAC,
38 CHARSET_CP437,
39 CHARSET_CP850
40 };
41
42 #ifndef _WORD
43 #include "word.h"
44 #endif
45
46 extern void word_print (Word*);
47
48 #define _CONVERT
49 #endif
50
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: defs.h
25 * Author name: Zach Smith
26 * Create date: 1 Sept 2000
27 * Purpose: Basic definitions plus externs for UnRTF
28 *----------------------------------------------------------------------
29 * Changes:
30 * 21 Oct 00, tuorfa@yahoo.com: moved program version to this file
31 * 08 Apr 01, tuorfa@yahoo.com: updated usage info.
32 * 08 Sep 01, tuorfa@yahoo.com: added PROGRAM_NAME.
33 * 19 Sep 01, tuorfa@yahoo.com: added PROGRAM_WEBSITE.
34 * 09 Oct 03, daved@physiol.usyd.edu.au: changed to GNU website
35 * 17 Feb 04, marcossamaral@terra.com.br: changed some informations
36 *--------------------------------------------------------------------*/
37
38
39 #define PROGRAM_VERSION "0.19.2"
40 #define PROGRAM_NAME "UnRTF"
41 #define PROGRAM_WEBSITE "http://www.gnu.org/software/unrtf/unrtf.html"
42
43
44 /* Select the language for reporting of file creation/modificaton dates */
45 #define ENGLISH
46 #if 0
47 #define FRANCAIS
48 #define ITALIANO
49 #define PORTUGUES /* amaral - 0.19.2 */
50 #endif
51
52
53 #ifndef TRUE /* daved 0.19.0 */
54 #define TRUE (1)
55 #endif
56 #ifndef FALSE /* daved 0.19.0 */
57 #define FALSE (0)
58 #endif
59
60
61 #define USAGE "unrtf [--version] [--help] [--nopict|-n] [--html] [--text] [--vt] [--latex] [--ps] [--wpml] [-t html|text|vt|latex|ps|wpml] <filename>"
62
63
64 /* Default names for RTF's default fonts */
65 #define FONTNIL_STR "Times,TimesRoman,TimesNewRoman"
66 #define FONTROMAN_STR "Times,Palatino"
67 #define FONTSWISS_STR "Helvetica,Arial"
68 #define FONTMODERN_STR "Courier,Verdana"
69 #define FONTSCRIPT_STR "Cursive,ZapfChancery"
70 #define FONTDECOR_STR "ZapfChancery"
71 #define FONTTECH_STR "Symbol"
72
0 <html>
1 <head>
2 <title>GNU UnRTF User's Manual</title>
3 </head>
4 <body>
5 <big>
6 <center>
7 <big>
8 <big>
9 <b>
10 GNU UnRTF User's Manual
11 </br>
12 </big>
13 </b>
14 For program version 0.19.2
15 <br>
16 </big>
17 (A work in progress.)
18 </center>
19 <br>
20 <br>
21
22 </big>
23 Copyright (C) 2001<br>
24 by Zachary Thayer Smith.<br>
25 All rights reserved.<br>
26
27 <br>
28 Document begun 18 Sept 01.
29 <br>
30 Last updated 08 Oct 03.
31 </big>
32
33 <h2>Preface</h2>
34
35 Once upon a time, GNU UnRTF was a program that I wrote called
36 "rtf2htm". This seemed too generic a name, since many free programs
37 of varying quality exist with that name. So I finally settled on
38 a new name, UnRTF. This name reflects a desire to convert <i>away</i>
39 from the RTF format, to various other formats.
40 When it came time to include the program into the GNU software suite,
41 the program name was changed to GNU UnRTF.
42
43 This document is also provided AS-IS and without any warranty of any kind.
44
45 The user shall utilize the program and/or this document
46 at his or her own risk.
47
48 <p>
49
50 I am the primary engineer behind UnRTF, however I have
51 received comments and bug reports from various people.
52 These contributors are identified in the source code,
53 when they desired to be mentioned.
54
55 <h2>Program License</h2>
56
57 <pre>
58 <small>
59 UnRTF, a command-line program to convert RTF documents to other formats.
60 Copyright (C) 2000,2001 Zachary Thayer Smith
61
62 This program is free software; you can redistribute it and/or modify
63 it under the terms of the GNU General Public License as published by
64 the Free Software Foundation; either version 2 of the License, or
65 (at your option) any later version.
66
67 This program is distributed in the hope that it will be useful,
68 but WITHOUT ANY WARRANTY; without even the implied warranty of
69 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70 GNU General Public License for more details.
71
72 You should have received a copy of the GNU General Public License
73 along with this program; if not, write to the Free Software
74 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
75
76 The author is reachable by electronic mail at tuorfa@yahoo.com.
77 </small>
78 </pre>
79
80
81 <h2>Introduction</h2>
82
83 UnRTF is a program to convert RTF (Rich Text) documents to
84 other formats. At present, conversion to HTML is the most
85 complete. I am presently adding LaTeX, plain text,
86 text with VT100 codes, and PostScript conversion.
87 I will later add my own format, WPML (word processor markup language),
88 to that list.
89 <!-- daved - 0.19.0 URL no longer valid
90 that format is described at
91 <a href=http://www.geocities.com/tuorfa/wpml.html>
92 http://www.geocities.com/tuorfa/wpml.html</a>.
93 -->
94
95 <h2>Converting to HTML</h2>
96
97 The program supports many features of the current RTF standard
98 when converting to HTML.
99
100 <h3>Character Attributes</h3>
101
102 <table border=2>
103 <tr> <th>Feature Name</th><th>Supported?</th></tr>
104 <tr><td>Text font change</td><td>yes</td></tr>
105 <tr><td>Text font sizes</td><td>yes</td></tr>
106 <tr><td>Text bold, italic</td><td>yes</td></tr>
107 <tr><td>Text single-underline</td><td>yes</td></tr>
108 <tr><td>Other text underlining modes (double, dashed etc)</td><td>converted to basic underline</td></tr>
109 <tr><td>Text shadow, outline, emboss, engrave</td><td>converted to bold or italic</td></tr>
110 <tr><td>Text (single-line) strikethrough</td><td>yes</td></tr>
111 <tr><td>Text double-strikethrough</td><td>converted to single-strikethrough</td></tr>
112 <tr><td>Text all-caps</td><td>yes</td></tr>
113 <tr><td>Text small-caps</td><td>yes</td></tr>
114 <tr><td>Text superscript, subscript</td><td>yes</td></tr>
115 <tr><td>Text expand/condense</td><td>yes (not all browsers supported)</td></tr>
116 <tr><td>Text foreground color change</td><td>yes</td></tr>
117 <tr><td>Text background color change</td><td>yes</td></tr>
118
119 </table>
120
121 <h3>Character Sets</h3>
122
123 RTF supports at least four character sets, probably more.
124 These four are: ANSI, Macintosh(TM), PC codepage 437, and PC codepage 850.
125 In order to be able to read each of these, a converter can use one
126 of two strategies: either have conversion tables from each of
127 these four to each potential output format, or convert from
128 each of these four to an intermediate, and then have one conversion
129 table from the intermediate to each output format.
130 The first approach requires 2<sup>n</sup> tables, whereas
131 the second requires 4+n tables where n is the number of output
132 formats.
133 Obviously the second approach is
134 better, but implementing it requires research to find
135 out what the maximal set of characters is. I haven't gotten around to
136 that, so for the time being,
137 UnRTF uses the first approach.
138 In addition, existing open source software may already
139 be available to perform such conversions based on a larger
140 library of character sets. If so, it would be wiser to
141 utilize an existing system such as that.
142
143 <h3>Text Blocks</h3>
144
145 <table border=2>
146 <tr> <th>Feature Name</th><th>Supported?</th></tr>
147 <tr><td>Tables</td><td>yes</td></tr>
148 <tr><td>Table cell background patterns e.g. diagonal lines</td><td>no</td></tr>
149 <tr><td>Paragraph left-align</td><td>yes</td></tr>
150 <tr><td>Paragraph right-align</td><td>yes</td></tr>
151 <tr><td>Paragraph centered</td><td>yes</td></tr>
152 <tr><td>Paragraph justify</td><td>yes</td></tr>
153 <tr><td>Paragraph center within table</td><td>buggy?</td></tr>
154 </table>
155
156 <h2>Converting to LaTeX</h2>
157
158 LaTeX is a tricky format to convert to, for several reasons.
159 It's a very specialized system of macros. One could argue that it
160 would be easier to convert to raw TeX than bother with the
161 idiosyncrices of LaTeX. It has its own character set and fonts. It has
162 some commands which are unstable, such as <tt>\underline</tt>.
163 Some commonplace items are not for use outside of equations,
164 e.g. superscripting. I've made an initial effort at getting
165 the converter to work, with improvements later.
166
167 <h3>Character Attributes</h3>
168
169 <table border=2>
170 <tr> <th>Feature Name</th><th>Supported?</th></tr>
171 <tr><td>Text font change</td><td>not yet</td></tr>
172 <tr><td>Text font sizes</td><td>yes</td></tr>
173 <tr><td>Text bold, italic</td><td>yes</td></tr>
174 <tr><td>Text single-underline</td><td>no</td></tr>
175 <tr><td>Other text underlining modes (double, dashed etc)</td><td>no</td></tr>
176 <tr><td>Text shadow, outline, emboss, engrave</td><td>no</td></tr>
177 <tr><td>Text (single-line) strikethrough</td><td>no</td></tr>
178 <tr><td>Text double-strikethrough</td><td>no</td></tr>
179 <tr><td>Text all-caps</td><td>yes</td></tr>
180 <tr><td>Text small-caps</td><td>yes</td></tr>
181 <tr><td>Text superscript, subscript</td><td>yes</td></tr>
182 <tr><td>Text expand/condense</td><td>no</td></tr>
183 <tr><td>Text foreground color change</td><td>no</td></tr>
184 <tr><td>Text background color change</td><td>no</td></tr>
185
186 </table>
187
188 <h3>Character Sets</h3>
189
190 Under construction.
191
192 <h3>Text Blocks</h3>
193
194 <table border=2>
195 <tr> <th>Feature Name</th><th>Supported?</th></tr>
196 <tr><td>Tables</td><td>yes</td></tr>
197 <tr><td>Table cell background patterns e.g. diagonal lines</td><td>no</td></tr>
198 <tr><td>Paragraph left-align</td><td>yes?</td></tr>
199 <tr><td>Paragraph right-align</td><td>no</td></tr>
200 <tr><td>Paragraph centered</td><td>yes?</td></tr>
201 <tr><td>Paragraph justify</td><td>yes</td></tr>
202 <tr><td>Paragraph center within table</td><td>no</td></tr>
203 </table>
204
205 <h2>Converting to PostScript</h2>
206
207 Converting to PostScript is a tricky because it is not actually
208 a document format. PostScript is in fact a stack-based programming
209 language that is executed in the printer.
210 It lacks such concepts are paragraphs and tables or anything document-related
211 really, but it does have drawing primitives, mechanisms for accessing
212 built-in fonts, and can print pages.
213 Still, at first it would that conversion to this format is a very large
214 obstacle. Actually, PostScript
215 is a robust and enjoyable programming language and I am enjoying
216 the task of writing the PostScript code. Presently my
217 text renderer is limited, since it is quite new. I will be improving it soon.
218
219
220 <h3>Character Attributes</h3>
221
222 <table border=2>
223 <tr> <th>Feature Name</th><th>Supported?</th></tr>
224 <tr><td>Text font change</td><td>not yet</td></tr>
225 <tr><td>Text font sizes</td><td>yes</td></tr>
226 <tr><td>Text bold, italic</td><td>yes</td></tr>
227 <tr><td>Text single-underline</td><td>yes</td></tr>
228 <tr><td>Other text underlining modes (double, dashed etc)</td><td>converted to basic underline</td></tr>
229 <tr><td>Text shadow, outline, emboss, engrave</td><td>shadow only</td></tr>
230 <tr><td>Text (single-line) strikethrough</td><td>yes</td></tr>
231 <tr><td>Text double-strikethrough</td><td>converted to single-strikethrough</td></tr>
232 <tr><td>Text all-caps</td><td>yes</td></tr>
233 <tr><td>Text small-caps</td><td>not yet</td></tr>
234 <tr><td>Text superscript, subscript</td><td>not yet</td></tr>
235 <tr><td>Text expand/condense</td><td>yes<td></tr>
236 <tr><td>Text foreground color change</td><td>not yet</td></tr>
237 <tr><td>Text background color change</td><td>not yet</td></tr>
238
239 </table>
240
241 <h3>Character Sets</h3>
242
243 Under construction.
244
245 <h3>Text Blocks</h3>
246
247 Paragraph alignment and tables are not yet supported for PostScript
248 output.
249
250 <h3>Extra Features</h3>
251
252 None yet.
253
254 <h2>Converting to Plain Text</h2>
255
256 Under construction.
257
258 <h2>Converting to Text with VT100 control codes</h2>
259
260 Under construction.
261
262 <h2>Converting to WPML</h2>
263
264 Under construction.
265
266 <h2>Features Not Yet Supported</h2>
267
268 As development continues, I will try to add support
269 for other features. Some that I know are not
270 covered but that I would like to address include:
271
272 <ul>
273 <li>numbered lists and point lists
274 <li>shapes (objects composed of lines, circles etc)
275 <li>index entries and index generation
276 <li>tables of contents entries and generation
277 <li>automatic conversion of embedded images to PNG
278 </ul>
279
280
281 <h2>Using UnRTF</h2>
282
283 Please refer to the manual page (unrtf.1).
284
285 <h2>Compilation</h2>
286
287 Please see the README file.
288
289 <h2>Theory of Operation</h2>
290
291 This program essentially reads the entire
292 RTF file into memory and works on it.
293 Because of this, it may require that you run
294 the program on a computer that has virtual
295 memory enabled. With smaller input files
296 it should be possible to use the program under DOS,
297 so long as it is compiled with the
298 DOS version of GCC, called DJGPP.
299
300 <p>
301 The program operates by dealing with each
302 RTF word in order, and interpreting those
303 which are commands. Some RTF command words
304 have parameters in a subtree. The command
305 \info is an example. The program has separate
306 routines to handle such cases. In fact,
307 most commands have separate functions which
308 handle their execution.
309
310 <p>
311 When the program was called rtf2htm (up through
312 version 0.17 or so), the output mechanism was
313 based on the production of HTML exclusively.
314 This has now changed, and the abstraction of an
315 OutputPersonality is used allow other output
316 formats. Each format has its own C file,
317 in which all the basic strings for producing
318 text are stored, as well as character conversion
319 tables. Note, RTF itself allows several character
320 sets to be used, so for each output personality
321 there are that many conversion tables.
322
323 <p>
324 One or two things that UnRTF does are fairly
325 tricky, such as the conversion of tabular data.
326 RTF encodes tables in an odd way compared
327 to HTML or LaTeX, so the code is accordingly
328 complicated. Suffice it to say that it works,
329 so don't touch it. Do note, PostScript does not
330 have concept of a table, since it is not
331 a document format but a programming language.
332 I will eventually get tables working under PS
333 anyway, by porting my table rendering code
334 over from my HTML viewer, Beest.
335
336 <p>
337 I have implemented at least three optimizations to
338 reduce the amount of memory required
339 by the program and the time used for the conversion.
340
341 <ol>
342 <li>Text words and RTF command-words are stored in a
343 hash table. This has the effect of saving memory
344 since commonly occurring words such as "the" and "\par"
345 are not repeated in memory. When the program
346 finishes doing the conversion, it reports the
347 number of words hashed.
348 <li>RTF command-words and pointers to the functions
349 that interpret them are stored in a static hash
350 so that execution can be speedy. This replaces the
351 long if-else sequence once used and greatly speeds
352 up the program.
353 <li>Input data are buffered, to eliminate the large
354 number of calls to the fgetc function. In a modern
355 OS such as Linux this has only a small impact, but
356 under DOS it can really help.
357 </ol>
358
359 <h2>Notes</h2>
360
361 <ol>
362 <li>
363 LaTeX is a system of macros for TeX originated by Leslie Lamport
364 <li>
365 WPML is a tentative document format by Zachary Thayer Smith
366 <li>
367 PostScript is a stack-based programming language for printers.
368 </ol>
369
370 </body>
371 </html>
372
373
0 #include <stdio.h>
1
2 char *entity(int symbol)
3 {
4 switch(symbol)
5 {
6 case 97:
7 return("&alpha;");
8 case 98:
9 return("&beta;");
10 case 99:
11 return("&chi;");
12 case 100:
13 return("&delta;");
14 case 101:
15 return("&epsilon;");
16 case 102:
17 return("&phi;");
18 case 103:
19 return("&gamma;");
20 case 109:
21 return("&mu;");
22 case 110:
23 return("&nu;");
24 case 111:
25 return("&omicron;");
26 case 112:
27 return("&pi;");
28 case 113:
29 return("&theta;");
30 case 114:
31 return("&rho;");
32 case 115:
33 return("&sigma;");
34 case 116:
35 return("&tau;");
36 case 117:
37 return("&upsilon;");
38 case 118:
39 return("&omega1;");
40 case 119:
41 return("&omega;");
42 case 120:
43 return("&xi;");
44 case 121:
45 return("&psi;");
46 case 122:
47 return("&zeta;");
48 case 177:
49 return("&plusmn;");
50 default:
51 fprintf(stderr, "symbol %d missing in entity.c\n",
52 symbol);
53 return("&UnknownEntity;");
54 }
55 }
56
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: error
25 * Author name: Zach Smith
26 * Create date: 01 Sep 00
27 * Purpose: Management of errors and warnings, when reporting
28 * the source code file/line is not necessary.
29 *----------------------------------------------------------------------
30 * Changes
31 * 10 Oct 00, tuorfa@yahoo.com: added usage()
32 * 15 Oct 00, tuorfa@yahoo.com: improved output readability
33 * 22 Sep 01, tuorfa@yahoo.com: removed mention of line number in handlers
34 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
35 * 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux
36 *--------------------------------------------------------------------*/
37
38
39 #include <stdio.h>
40 #if linux /* daved - 0.19.1 */
41 #include <stdlib.h>
42 #endif
43
44 #include "defs.h"
45 #include "main.h"
46
47
48
49 /*========================================================================
50 * Name: usage
51 * Purpose: Prints usage information and exits with an error.
52 * Args: None.
53 * Returns: None.
54 *=======================================================================*/
55
56 void
57 usage ()
58 {
59 fprintf (stderr, "Usage: %s\n", USAGE);
60 exit(-3);
61 }
62
63
64
65 /*========================================================================
66 * Name: error_handler
67 * Purpose: Prints error message and other useful info, then exits.
68 * Args: Message.
69 * Returns: None.
70 *=======================================================================*/
71
72 void
73 error_handler (char* message)
74 {
75 fprintf (stderr, "Error: %s\n", message);
76 exit(10);
77 }
78
79
80 /*========================================================================
81 * Name: warning_handler
82 * Purpose: Prints useful info to stderr, but doesn't exit.
83 * Args: Message.
84 * Returns: None.
85 *=======================================================================*/
86
87 void
88 warning_handler (char* message)
89 {
90 fprintf (stderr, "Warning: %s\n", message);
91 }
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: error.h
25 * Author name: Zach Smith
26 * Create date: 1 Sept 2000
27 * Purpose: Macros to be executed at the start of a function,
28 * when reporting source code file/line is useful.
29 *----------------------------------------------------------------------
30 * Changes
31 *--------------------------------------------------------------------*/
32
33
34 #define CHECK_PARAM_NOT_NULL(XX) { if ((XX)==NULL) { fprintf (stderr, "internal error: null pointer param in %s at %d\n", __FILE__, __LINE__); exit (1); }}
35
36 #define CHECK_MALLOC_SUCCESS(XX) { if ((XX)==NULL) { fprintf (stderr, "internal error: cannot allocate memory in %s at %d\n", __FILE__, __LINE__); exit (1); }}
37
38
39 extern void usage(void);
40 extern void error_handler (char*);
41 extern void warning_handler (char*);
42
43
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: hash
25 * Author name: Zach Smith
26 * Create date: 01 Sep 00
27 * Purpose: Word-hash management. Words are put into a hash and an
28 * identifier is returned. This is used to save us from
29 * doing multiple mallocs for recurring strings such as
30 * 'the' and \par. This is not a big issue under Unix,
31 * but it is under other OSes and anyway, waste not want not.
32 *----------------------------------------------------------------------
33 * Changes:
34 * 08 Apr 01, tuorfa@yahoo.com: check for out of memory after malloc.
35 * 21 Apr 01, tuorfa@yahoo.com: signed to conversion unsigned bug
36 * 03 Aug 01, tuorfa@yahoo.com: fixes for using 16-bit compiler
37 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
38 * 08 Oct 03, daved@physiol.usyd.edu.au: some type fixes
39 *--------------------------------------------------------------------*/
40
41 #include <stdio.h>
42 #include <string.h>
43
44 #include "error.h"
45 #include "main.h"
46 #include "malloc.h"
47
48
49 typedef struct _hi {
50 struct _hi *next;
51 char *str;
52 unsigned long value;
53 }
54 HashItem;
55
56
57 /* Index by first char of string */
58 static HashItem *hash[256];
59 static unsigned long hash_length[256];
60 static unsigned long hash_value=0;
61
62
63
64 /*========================================================================
65 * Name: hash_init
66 * Purpose: Clear the hash table.
67 * Args: None.
68 * Returns: None.
69 *=======================================================================*/
70
71 void
72 hash_init ()
73 {
74 int i;
75 for (i=0; i<256; i++) {
76 hash[i]=NULL;
77 hash_length[i]=0;
78 }
79 }
80
81
82
83 /*========================================================================
84 * Name: hash_stats
85 * Purpose: Prints to stderr the number of words stored.
86 * Args: None.
87 * Returns: None.
88 *=======================================================================*/
89
90 void
91 hash_stats ()
92 {
93 int i;
94 unsigned long total=0;
95 for (i=0; i<256; i++) {
96 total += hash_length[i];
97 }
98 fprintf (stderr,"%lu words were hashed.\n", total);
99 }
100
101
102
103 /*========================================================================
104 * Name: hashitem_new
105 * Purpose: Creates a new linked list item for the hash table.
106 * Args: String.
107 * Returns: HashItem.
108 *=======================================================================*/
109
110 static HashItem *
111 hashitem_new (char *str)
112 {
113 HashItem *hi;
114 unsigned long i;
115
116 hi=(HashItem*) my_malloc(sizeof(HashItem));
117 if (!hi)
118 error_handler ("out of memory");
119 memset ((void*)hi, 0, sizeof (HashItem));
120
121 hi->str = my_strdup(str);
122
123 i = *str;
124 if (i=='\\') i=str[1];
125 i <<= 24;
126 hi->value = i | (hash_value++ & 0xffffff);
127 hi->next = NULL;
128
129 #if 0
130 if (debug_mode) {
131 printf ("<!-- storing val %08lx str %s -->\n",
132 hi->value, hi->str);
133 }
134 #endif
135
136 return hi;
137 }
138
139
140 /*========================================================================
141 * Name: hash_get_index
142 * Purpose: Given a string, returns the "index" i.e. the word identifier.
143 * Args: String.
144 * Returns: Index.
145 *=======================================================================*/
146
147 unsigned long
148 hash_get_index (char *str)
149 {
150 #if 1 /* daved - 0.19.1 */
151 unsigned short index;
152 unsigned char ch;
153 #else
154 int index;
155 char ch;
156 #endif
157 HashItem *hi;
158
159 #if 1 /* daved - 0.19.1 */
160 ch = (unsigned char)*str;
161 #else
162 ch = *str;
163 #endif
164 if (ch=='\\' && *(str+1))
165 ch = *(str+1);
166 index = ch;
167 hi = hash[index];
168 while (hi) {
169 if (!strcmp(hi->str,str))
170 return hi->value;
171 hi=hi->next;
172 }
173 /* not in hash */
174 hi = hashitem_new (str);
175 hi->next = hash[index];
176 hash [index] = hi;
177 ++hash_length [index];
178 return hi->value;
179 }
180
181
182 /*========================================================================
183 * Name: hash_get_string
184 * Purpose: Given the index (word identifier) returns the word string.
185 * Args: Index.
186 * Returns: String, or NULL if not found.
187 *=======================================================================*/
188
189 char*
190 hash_get_string (unsigned long value)
191 {
192 int index;
193 HashItem *hi;
194
195 index = value >> 24;
196 hi = hash[index];
197 while (hi) {
198 if (hi->value == value)
199 return hi->str;
200 hi=hi->next;
201 }
202 warning_handler ("word not in hash");
203 return NULL;
204 }
205
206
207
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: hash.h
25 * Author name: Zach Smith
26 * Create date: 1 Sept 2000
27 * Purpose: Definitions for the hash module.
28 *----------------------------------------------------------------------
29 * Changes:
30 *--------------------------------------------------------------------*/
31
32
33
34 extern void hash_init (void);
35 extern void hash_stats (void);
36 extern unsigned long hash_get_index (char *);
37 extern char* hash_get_string (unsigned long );
38
39
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: html
25 * Author name: Zach Smith
26 * Create date: 18 Sep 01
27 * Purpose: HTML-specific output module
28 *----------------------------------------------------------------------
29 * Changes:
30 * 01 Aug 01, tuorfa@yahoo.com: code moved over from convert.c
31 * 03 Aug 01, tuorfa@yahoo.com: removed null entries to save space
32 * 08 Aug 01, tuorfa@yahoo.com, gommer@gmx.net: fixed/added some ANSI chars
33 * 18 Sep 01, tuorfa@yahoo.com: moved character sets into html.c etc
34 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
35 * 08 Oct 03, daved@physiol.usyd.edu.au: mac special character fixes
36 *--------------------------------------------------------------------*/
37
38
39 #include <stdio.h>
40 #include <string.h>
41 #include "malloc.h"
42 #include "defs.h"
43 #include "error.h"
44 #include "main.h"
45 #include "output.h"
46
47
48 static char* ascii [96] = {
49 /* 0x20 */ " ", "!", "\"", "#", "$", "%", "&amp;", "'",
50 /* 0x28 */ "(", ")", "*", "+", ",", "-", ".", "/",
51 /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7",
52 /* 0x38 */ "8", "9", ":", ";", "&lt;", "=", "&gt;", "?",
53 /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G",
54 /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O",
55 /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W",
56 /* 0x58 */ "X", "Y", "Z", "[", "\\", "]", "^", "_",
57 /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g",
58 /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o",
59 /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w",
60 /* 0x78 */ "x", "y", "z", "{", "|", "}", "~", "",
61 };
62
63
64 static char* ansi [] = {
65 /* 0x82 */ "&lsquor;", "&fnof;",
66 "&ldquor;", "&hellip;", "&dagger;", "&Dagger;",
67 "&circ;", "&permil;", "&Scaron;", "&lsaquo;",
68 "&OElig;", NULL, NULL, NULL,
69 /* 0x90 */ NULL,"`","'","``","''","&bull;","&ndash;","&mdash;",
70 /* 0x98 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
71 /* 0xa0 */ "&nbsp;","&iexcl;","&cent;","&pound;","&curren;","&yen;","&brvbar;","&sect;",
72 /* 0xa8 */ "&uml;","&copy;","&ordf;","&laquo;","&not;","&shy;","&reg;","&macr;",
73 /* 0xb0 */ "&deg;", "&plusmn;","&sup2;","&sup3;","&acute;","&micro;","&para;","&middot;",
74 /* 0xb8 */ "&cedil;","&sup1", "&ordm;","&raquo", "&frac14", "&frac12;","&frac34;","&iquest;",
75 /* 0xc0 */ "&Agrave;","&Aacute;","&Acirc;","&Atilde;","&Auml;","&Aring;","&AElig;","&Ccedil;",
76 /* 0xc8 */ "&Egrave;","&Eacute;","&Ecirc;","&Euml;","&Igrave;","&Iacute;","&Icirc;","&Iuml;",
77 /* 0xd0 */ "&ETH;","&Ntilde;","&Ograve;","&Oacute;","&Ocirc;","&Otilde;","&Ouml;","&times;",
78 /* 0xd8 */ "&Oslash;","&Ugrave;","&Uacute;","&Ucirc;","&Uuml;","&Yacute;","&THORN;","&szlig;",
79 /* 0xe0 */ "&agrave;","&aacute;","&acirc;","&atilde;","&auml;","&aring;","&aelig;","&ccedil;",
80 /* 0xe8 */ "&egrave;","&eacute;","&ecirc;","&euml;","&igrave;","&iacute;","&icirc;","&iuml;",
81 /* 0xf0 */ "&eth;","&ntilde;","&ograve;","&oacute;","&ocirc;","&otilde;","&ouml;","&divide;",
82 /* 0xf8 */ "&oslash;","&ugrave;","&uacute;","&ucirc;","&uuml;","&yacute;","&thorn;","&yuml;",
83 };
84
85 #if 1 /* daved - 0.19.1 */
86 static char* mac [] = {
87 /* 0xa4 */ "&bull;", NULL,NULL,NULL,
88 /* 0xa8 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
89 /* 0xb0 */ NULL,NULL,NULL,NULL,NULL,"&mu;",NULL,NULL,
90 /* 0xb8 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
91 /* 0xc0 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
92 /* 0xc8 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
93 /* 0xd0 */ "&mdash;","&ndash;","&ldquo;","&rdquo;","&lquo;","&rquo;",
94 };
95 #else
96 static char* mac [] = {
97 /* 0xa4 */ "&bull;", NULL,NULL,NULL,NULL,NULL,NULL,NULL,
98 /* 0xb0 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
99 /* 0xc0 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
100 /* 0xd0 */ "&mdash;","&ndash;","&ldquo;","&rdquo;","&lquo;","&rquo;",
101 };
102 #endif
103
104 static char* cp437 [] = {
105 /* 0x80 */ "&ccedil;",
106 /* 0x81 */ "&uuml;",
107 /* 0x82 */ "&eacute;",
108 /* 0x83 */ "&acirc;",
109 /* 0x84 */ "&auml;",
110 /* 0x85 */ "&agrave;",
111 /* 0x86 */ "&aring;",
112 /* 0x87 */ "&ccedil;",
113 /* 0x88 */ "&ecirc;",
114 /* 0x89 */ "&euml;",
115 /* 0x8a */ "&egrave;",
116 /* 0x8b */ "&iuml;",
117 /* 0x8c */ "&icirc;",
118 /* 0x8d */ "&igrave;",
119 /* 0x8e */ "&auml;",
120 /* 0x8f */ "&aring;",
121 /* 0x90 */ "&eacute;",
122 /* 0x91 */ "&aelig;",
123 /* 0x92 */ "&aelig;",
124 /* 0x93 */ "&ocirc;",
125 /* 0x94 */ "&ouml;",
126 /* 0x95 */ "&ograve;",
127 /* 0x96 */ "&ucirc;",
128 /* 0x97 */ "&ugrave;",
129 /* 0x98 */ "&yuml;",
130 /* 0x99 */ "&ouml;",
131 /* 0x9a */ "&uuml;",
132 /* 0x9b */ "&cent;",
133 /* 0x9c */ "&pound;",
134 /* 0x9d */ "&yen;",
135 /* 0x9e */ "&#8359", /* peseta */
136 /* 0x9f */ "&#402", /* small f with hook */
137 /* 0xa0 */ "&aacute;",
138 /* 0xa1 */ "&iacute;",
139 /* 0xa2 */ "&oacute;",
140 /* 0xa3 */ "&uacute;",
141 /* 0xa4 */ "&ntilde;",
142 /* 0xa5 */ "&ntilde;",
143 /* 0xa6 */ "&ordf;",
144 /* 0xa7 */ "&frac14;",
145 /* 0xa8 */ "&iquest;",
146 /* 0xa9 */ "&#8976", /* reversed not */
147 /* 0xaa */ "&not;",
148 /* 0xab */ "&frac12;",
149 /* 0xac */ "&raquo;",
150 /* 0xad */ "&iexcl;",
151 /* 0xae */ "&laquo;",
152 /* 0xaf */ "&ordm;",
153 /* 0xb0 */ "&#9617;", /* light shade */
154 /* 0xb1 */ "&#9618;", /* med. shade */
155 /* 0xb2 */ "&#9619;", /* dark shade */
156 /* 0xb3 */ "&#9474;", /* box-draw light vert. */
157 /* 0xb4 */ "&#9508;", /* box-draw light vert. + lt. */
158 /* 0xb5 */ "&#9569;", /* box-draw vert. sgl. + lt. dbl. */
159 /* 0xb6 */ "&#9570;", /* box-draw vert. dbl. + lt. sgl. */
160 /* 0xb7 */ "&#9558;", /* box-draw dn. dbl. + lt. sgl. */
161 /* 0xb8 */ "&#9557;", /* box-draw dn. sgl. + lt. dbl. */
162 /* 0xb9 */ "&#9571;", /* box-draw dbl. vert. + lt. */
163 /* 0xba */ "&#9553;", /* box-draw dbl. vert. */
164 /* 0xbb */ "&#9559;", /* box-draw dbl. dn. + lt. */
165 /* 0xbc */ "&#9565;", /* box-draw dbl. up + lt. */
166 /* 0xbd */ "&#9564;", /* box-draw up dbl. + lt. sgl. */
167 /* 0xbe */ "&#9563;", /* box-draw up sgl. + lt. dbl. */
168 /* 0xbf */ "&#9488;", /* box-draw light dn. + lt. */
169 /* 0xc0 */ "&#9492;", /* box-draw light up + rt. */
170 /* 0xc1 */ "&#9524;", /* box-draw light up + horiz. */
171 /* 0xc2 */ "&#9516;", /* box-draw light dn. + horiz. */
172 /* 0xc3 */ "&#9500;", /* box-draw light vert. + rt. */
173 /* 0xc4 */ "&#9472;", /* box-draw light horiz. */
174 /* 0xc5 */ "&#9532;", /* box-draw light vert. + horiz. */
175 /* 0xc6 */ "&#9566;", /* box-draw vert. sgl. + rt. dbl. */
176 /* 0xc7 */ "&#9567;", /* box-draw vert. dbl. + rt. sgl. */
177 /* 0xc8 */ "&#9562;", /* box-draw dbl. up + rt. */
178 /* 0xc9 */ "&#9556;", /* box-draw dbl. dn. + rt. */
179 /* 0xca */ "&#9577;", /* box-draw dbl. up + horiz. */
180 /* 0xcb */ "&#9574;", /* box-draw dbl. dn. + horiz. */
181 /* 0xcc */ "&#9568;", /* box-draw dbl. vert. + rt. */
182 /* 0xcd */ "&#9552;", /* box-draw dbl. horiz. */
183 /* 0xce */ "&#9580;", /* box-draw dbl. vert. + horiz. */
184 /* 0xcf */ "&#9575;", /* box-draw up sgl. + horiz. dbl. */
185 /* 0xd0 */ "&#9576;", /* box-draw up dbl. + horiz. sgl. */
186 /* 0xd1 */ "&#9572;", /* box-draw dn. sgl. + horiz. dbl. */
187 /* 0xd2 */ "&#9573;", /* box-draw dn. dbl. + horiz. sgl. */
188 /* 0xd3 */ "&#9561;", /* box-draw up dbl. + rt. sgl. */
189 /* 0xd4 */ "&#9560;", /* box-draw up sgl. + rt. dbl. */
190 /* 0xd5 */ "&#9554;", /* box-draw dn. sgl. + rt. dbl. */
191 /* 0xd6 */ "&#9555;", /* box-draw dn. dbl. + rt. sgl. */
192 /* 0xd7 */ "&#9579;", /* box-draw vert. dbl. + horiz. sgl. */
193 /* 0xd8 */ "&#9578;", /* box-draw vert. sgl. + horiz. dbl. */
194 /* 0xd9 */ "&#9496;", /* box-draw light up + lt. */
195 /* 0xda */ "&#9484;", /* box-draw light dn. + rt. */
196 /* 0xdb */ "&#9608;", /* full block */
197 /* 0xdc */ "&#9604;", /* lower 1/2 block */
198 /* 0xdd */ "&#9612;", /* lt. 1/2 block */
199 /* 0xde */ "&#9616;", /* rt. 1/2 block */
200 /* 0xdf */ "&#9600;", /* upper 1/2 block */
201 /* 0xe0 */ "&#945;", /* greek small alpha */
202 /* 0xe1 */ "&szlig;",
203 /* 0xe2 */ "&#915;", /* greek cap gamma */
204 /* 0xe3 */ "&#960;", /* greek small pi */
205 /* 0xe4 */ "&#931;", /* greek cap sigma */
206 /* 0xe5 */ "&#963;", /* greek small sigma */
207 /* 0xe6 */ "&micro;",
208 /* 0xe7 */ "&#964;", /* greek small tau */
209 /* 0xe8 */ "&#934;", /* greek cap phi */
210 /* 0xe9 */ "&#920;", /* greek cap theta */
211 /* 0xea */ "&#937;", /* greek cap omega */
212 /* 0xeb */ "&#948;", /* greek small delta */
213 /* 0xec */ "&#8734;", /* inf. */
214 /* 0xed */ "&#966;", /* greek small phi */
215 /* 0xee */ "&#949;", /* greek small epsilon */
216 /* 0xef */ "&#8745;", /* intersect */
217 /* 0xf0 */ "&#8801;", /* identical */
218 /* 0xf1 */ "&plusmn;",
219 /* 0xf2 */ "&#8805;", /* greater-than or equal to */
220 /* 0xf3 */ "&#8804;", /* less-than or equal to */
221 /* 0xf4 */ "&#8992;", /* top 1/2 integral */
222 /* 0xf5 */ "&#8993;", /* bottom 1/2 integral */
223 /* 0xf6 */ "&divide;",
224 /* 0xf7 */ "&#8776;", /* almost = */
225 /* 0xf8 */ "&plus;",
226 /* 0xf9 */ "&#8729;", /* bullet op */
227 /* 0xfa */ "&middot;",
228 /* 0xfb */ "&#8730;", /* sqrt */
229 /* 0xfc */ "&#8319;", /* super-script small n */
230 /* 0xfd */ "&sup2;",
231 /* 0xfe */ "&#9632;", /* black square */
232 /* 0xff */ "&nbsp;",
233 };
234
235 static char* cp850 [] = {
236 /* 0x80 */ "&ccedil;",
237 /* 0x81 */ "&uuml;",
238 /* 0x82 */ "&eacute;",
239 /* 0x83 */ "&acirc;",
240 /* 0x84 */ "&auml;",
241 /* 0x85 */ "&agrave;",
242 /* 0x86 */ "&aring;",
243 /* 0x87 */ "&ccedil;",
244 /* 0x88 */ "&ecirc;",
245 /* 0x89 */ "&euml;",
246 /* 0x8a */ "&egrave;",
247 /* 0x8b */ "&iuml;",
248 /* 0x8c */ "&icirc;",
249 /* 0x8d */ "&igrave;",
250 /* 0x8e */ "&auml;",
251 /* 0x8f */ "&aring;",
252 /* 0x90 */ "&eacute;",
253 /* 0x91 */ "&aelig;",
254 /* 0x92 */ "&aelig;",
255 /* 0x93 */ "&ocirc;",
256 /* 0x94 */ "&ouml;",
257 /* 0x95 */ "&ograve;",
258 /* 0x96 */ "&ucirc;",
259 /* 0x97 */ "&ugrave;",
260 /* 0x98 */ "&yuml;",
261 /* 0x99 */ "&ouml;",
262 /* 0x9a */ "&uuml;",
263 /* 0x9b */ "&oslash;",
264 /* 0x9c */ "&pound;",
265 /* 0x9d */ "&oslash;",
266 /* 0x9e */ "&times;",
267 /* 0x9f */ "&#402;", /* small f with hook */
268 /* 0xa0 */ "&aacute;",
269 /* 0xa1 */ "&iacute;",
270 /* 0xa2 */ "&oacute;",
271 /* 0xa3 */ "&uacute;",
272 /* 0xa4 */ "&ntilde;",
273 /* 0xa5 */ "&ntilde;",
274 /* 0xa6 */ "&ordf;",
275 /* 0xa7 */ "&frac14;",
276 /* 0xa8 */ "&iquest;",
277 /* 0xa9 */ "&reg;",
278 /* 0xaa */ "&not;",
279 /* 0xab */ "&frac12;",
280 /* 0xac */ "&raquo;",
281 /* 0xad */ "&iexcl;",
282 /* 0xae */ "&laquo;",
283 /* 0xaf */ "&ordm;",
284 /* 0xb0 */ "&#9617;", /* light shade */
285 /* 0xb1 */ "&#9618;", /* med. shade */
286 /* 0xb2 */ "&#9619;", /* dark shade */
287 /* 0xb3 */ "&#9474;", /* box-draw light vert. */
288 /* 0xb4 */ "&#9508;", /* box-draw light vert. + lt. */
289 /* 0xb5 */ "&aacute;",
290 /* 0xb6 */ "&acirc;",
291 /* 0xb7 */ "&agrave;",
292 /* 0xb8 */ "&copy;",
293 /* 0xb9 */ "&#9571;", /* box-draw dbl. vert. + lt. */
294 /* 0xba */ "&#9553;", /* box-draw dbl. vert. */
295 /* 0xbb */ "&#9559;", /* box-draw dbl. dn. + lt. */
296 /* 0xbc */ "&#9565;", /* box-draw dbl. up + lt. */
297 /* 0xbd */ "&cent;",
298 /* 0xbe */ "&yen;",
299 /* 0xbf */ "&#9488;", /* box-draw light dn. + lt. */
300 /* 0xc0 */ "&#9492;", /* box-draw light up + rt. */
301 /* 0xc1 */ "&#9524;", /* box-draw light up + horiz. */
302 /* 0xc2 */ "&#9516;", /* box-draw light dn. + horiz. */
303 /* 0xc3 */ "&#9500;", /* box-draw light vert. + rt. */
304 /* 0xc4 */ "&#9472;", /* box-draw light horiz. */
305 /* 0xc5 */ "&#9532;", /* box-draw light vert. + horiz. */
306 /* 0xc6 */ "&atilde;",
307 /* 0xc7 */ "&atilde;",
308 /* 0xc8 */ "&#9562;", /* box-draw dbl. up + rt. */
309 /* 0xc9 */ "&#9556;", /* box-draw dbl. dn. + rt. */
310 /* 0xca */ "&#9577;", /* box-draw dbl. up + horiz. */
311 /* 0xcb */ "&#9574;", /* box-draw dbl. dn. + horiz. */
312 /* 0xcc */ "&#9568;", /* box-draw dbl. vert. + rt. */
313 /* 0xcd */ "&#9552;", /* box-draw dbl. horiz. */
314 /* 0xce */ "&#9580;", /* box-draw dbl. vert. + horiz. */
315 /* 0xcf */ "&curren;",
316 /* 0xd0 */ "&eth;",
317 /* 0xd1 */ "&eth;",
318 /* 0xd2 */ "&ecirc;",
319 /* 0xd3 */ "&euml;",
320 /* 0xd4 */ "&egrave;",
321 /* 0xd5 */ "&#305;", /* small dotless i */
322 /* 0xd6 */ "&iacute;",
323 /* 0xd7 */ "&icirc;",
324 /* 0xd8 */ "&iuml;",
325 /* 0xd9 */ "&#9496;", /* box-draw light up + lt. */
326 /* 0xda */ "&#9484;", /* box-draw light dn. + rt. */
327 /* 0xdb */ "&#9608;", /* full-block */
328 /* 0xdc */ "&#9604;", /* lower 1/2 block */
329 /* 0xdd */ "&brvbar;",
330 /* 0xde */ "&igrave;",
331 /* 0xdf */ "&#9600;", /* upper 1/2 block */
332 /* 0xe0 */ "&oacute;",
333 /* 0xe1 */ "&szlig;",
334 /* 0xe2 */ "&ocirc;",
335 /* 0xe3 */ "&ograve;",
336 /* 0xe4 */ "&otilde;",
337 /* 0xe5 */ "&otilde;",
338 /* 0xe6 */ "&micro;",
339 /* 0xe7 */ "&thorn;",
340 /* 0xe8 */ "&thorn;",
341 /* 0xe9 */ "&uacute;",
342 /* 0xea */ "&ucirc;",
343 /* 0xeb */ "&ugrave;",
344 /* 0xec */ "&yacute;",
345 /* 0xed */ "&yacute;",
346 /* 0xee */ "&macr;",
347 /* 0xef */ "&acute;",
348 /* 0xf0 */ "&shy;",
349 /* 0xf1 */ "&plusmn;",
350 /* 0xf2 */ "&#8215;", /* dbl. lowline */
351 /* 0xf3 */ "&frac34;",
352 /* 0xf4 */ "&para;",
353 /* 0xf5 */ "&sect;",
354 /* 0xf6 */ "&divide;",
355 /* 0xf7 */ "&cedil;",
356 /* 0xf8 */ "&plus;",
357 /* 0xf9 */ "&uml;",
358 /* 0xfa */ "&middot;",
359 /* 0xfb */ "&sup1;",
360 /* 0xfc */ "&sup3;",
361 /* 0xfd */ "&sup2;",
362 /* 0xfe */ "&#9632;", /* black square */
363 /* 0xff */ "&nbsp;",
364 };
365
366
367
368
369 /*========================================================================
370 * Name: html_init
371 * Purpose: Generates the HTML output personality.
372 * Args: None.
373 * Returns: OutputPersonality.
374 *=======================================================================*/
375
376 OutputPersonality *
377 html_init (void)
378 {
379 OutputPersonality* op;
380
381 op = op_create();
382
383 op->comment_begin = "<!--- ";
384 op->comment_end = " --->\n";
385
386 op->document_begin = "<html>\n";
387 op->document_end = "</html>\n";
388
389 op->header_begin = "<head>\n";
390 op->header_end = "</head>\n";
391
392 op->document_title_begin = "<title>";
393 op->document_title_end = "</title>\n";
394
395 op->document_author_begin = "<!--author: ";
396 op->document_author_end = "--->\n";
397
398 op->document_changedate_begin = "<!--changed: ";
399 op->document_changedate_end = "--->\n";
400
401 op->body_begin = "<body>";
402 op->body_end = "</body>\n";
403
404 op->paragraph_begin = "<p>";
405 op->paragraph_end = "</p>\n";
406
407 op->center_begin = "<center>";
408 op->center_end = "</center>\n";
409
410 op->justify_begin = "<div align=justify>\n";
411 op->justify_end = "</div>\n";
412
413 op->align_left_begin = "<div align=left>\n";
414 op->align_left_end = "</div>\n";
415
416 op->align_right_begin = "<div align=right>\n";
417 op->align_right_end = "</div>\n";
418
419 op->forced_space = "&nbsp;";
420 op->line_break = "<br>\n";
421 op->page_break = "<p><hr><p>\n";
422
423 op->hyperlink_begin = "<a href=\"";
424 op->hyperlink_end = "\">hyperlink</a>";
425
426 op->imagelink_begin = "<img src=\"";
427 op->imagelink_end = "\">";
428
429 op->table_begin = "<table border=2>\n";
430 op->table_end = "</table>\n";
431
432 op->table_row_begin = "<tr>";
433 op->table_row_end = "</tr>\n";
434
435 op->table_cell_begin = "<td>";
436 op->table_cell_end = "</td>\n";
437
438 /* Character attributes */
439 op->font_begin = "<font face=\"%s\">";
440 op->font_end = "</font>";
441
442 op->fontsize_begin = "<span style=\"font-size:%spt\">";
443 op->fontsize_end = "</span>";
444
445 op->fontsize8_begin = "<font size=1>";
446 op->fontsize8_end = "</font>";
447 op->fontsize10_begin = "<font size=2>";
448 op->fontsize10_end = "</font>";
449 op->fontsize12_begin = "<font size=3>";
450 op->fontsize12_end = "</font>";
451 op->fontsize14_begin = "<font size=4>";
452 op->fontsize14_end = "</font>";
453 op->fontsize18_begin = "<font size=5>";
454 op->fontsize18_end = "</font>";
455 op->fontsize24_begin = "<font size=6>";
456 op->fontsize24_end = "</font>";
457
458 op->smaller_begin = "<small>";
459 op->smaller_end = "</small>";
460
461 op->bigger_begin = "<big>";
462 op->bigger_end = "</big>";
463
464 op->foreground_begin = "<font color=\"%s\">";
465 op->foreground_end = "</font>";
466
467 op->background_begin = "<span style=\"background:%s\">";
468 op->background_end = "</span>";
469
470 op->bold_begin = "<b>";
471 op->bold_end = "</b>";
472
473 op->italic_begin = "<i>";
474 op->italic_end = "</i>";
475
476 op->underline_begin = "<u>";
477 op->underline_end = "</u>";
478
479 op->dbl_underline_begin = "<u>";
480 op->dbl_underline_end = "</u>";
481
482 op->superscript_begin = "<sup>";
483 op->superscript_end = "</sup>";
484
485 op->subscript_begin = "<sub>";
486 op->subscript_end = "</sub>";
487
488 op->strikethru_begin = "<s>";
489 op->strikethru_end = "</s>";
490
491 op->dbl_strikethru_begin = "<s>";
492 op->dbl_strikethru_end = "</s>";
493
494 op->emboss_begin="<span style=\"background:gray\"><font color=black>";
495 op->emboss_end = "</font></span>";
496
497 op->engrave_begin = "<span style=\"background:gray\"><font color=navyblue>";
498 op->engrave_end = "</font></span>";
499
500 op->shadow_begin= "<span style=\"background:gray\">";
501 op->shadow_end= "</span>";
502
503 op->outline_begin= "<span style=\"background:gray\">";
504 op->outline_end= "</span>";
505
506 op->expand_begin = "<span style=\"letter-spacing: %s\">";
507 op->expand_end = "</span>";
508
509 op->pointlist_begin = "<ol>\n";
510 op->pointlist_end = "</ol>\n";
511 op->pointlist_item_begin = "<li>";
512 op->pointlist_item_end = "</li>\n";
513
514 op->numericlist_begin = "<ul>\n";
515 op->numericlist_end = "</ul>\n";
516 op->numericlist_item_begin = "<li>";
517 op->numericlist_item_end = "</li>\n";
518
519 op->simulate_small_caps = TRUE;
520 op->simulate_all_caps = TRUE;
521 op->simulate_word_underline = TRUE;
522
523 op->ascii_translation_table = ascii;
524
525 op->ansi_translation_table = ansi;
526 op->ansi_first_char = 0x82;
527 op->ansi_last_char = 0xff;
528
529 op->cp437_translation_table = cp437;
530 op->cp437_first_char = 0x80;
531 op->cp437_last_char = 0xff;
532
533 op->cp850_translation_table = cp850;
534 op->cp850_first_char = 0x80;
535 op->cp850_last_char = 0xff;
536
537 op->mac_translation_table = mac;
538 op->mac_first_char = 0xa4;
539 op->mac_last_char = 0xd5;
540
541 op->chars.right_quote = "'";
542 op->chars.left_quote = "`";
543 op->chars.right_dbl_quote = "''";
544 op->chars.left_dbl_quote = "``";
545
546 return op;
547 }
548
549
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: html
25 * Author name: Zach Smith
26 * Create date: 19 Sep 01
27 * Purpose: Definitions for the HTML output personality
28 *----------------------------------------------------------------------
29 * Changes:
30 *--------------------------------------------------------------------*/
31
32
33 #ifndef _HTML
34
35
36 extern OutputPersonality* html_init(void);
37
38
39 #define _HTML
40 #endif
41
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: latex
25 * Author name: Zach Smith
26 * Create date: 18 Sep 01
27 * Purpose: LaTeX-specific output module
28 *----------------------------------------------------------------------
29 * Changes:
30 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
31 * 23 Sep 01, tuorfa@yahoo.com: fixed accented characters
32 *--------------------------------------------------------------------*/
33
34
35
36
37 #include <stdio.h>
38 #include <string.h>
39 #include "malloc.h"
40 #include "defs.h"
41 #include "error.h"
42 #include "main.h"
43 #include "output.h"
44
45
46
47 static char* ascii [96] = {
48 /* 0x20 */ " ", "!", "''", "\\#", "{\\$}", "\\%", "\\&", "'",
49 /* 0x28 */ "(", ")", "{\ast}", "+", ",", "-", ".", "/",
50 /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7",
51 /* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?",
52 /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G",
53 /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O",
54 /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W",
55 /* 0x58 */ "X", "Y", "Z", "[", "{\\slash}", "]", "{\\caret}", "\\_",
56 /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g",
57 /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o",
58 /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w",
59 /* 0x78 */ "x", "y", "z", "\\{", "$\\mid$", "\\}", "\\~{ }", "",
60 };
61
62
63 static char* ansi [] = {
64 /* 0x82 */ "?", "?",
65 "?", "{\\ldots}", "{\\dag}", "{\\ddag}",
66 "?", "?", "?", "?",
67 "{\\OE}", NULL, NULL, NULL,
68 /* 0x90 */ NULL,"`","'","``","''","{\\bullet}","--","---",
69 /* 0x98 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
70 /* 0xa0 */ "\\:","?","?","{\\pounds}","?","\\Y","?","?",
71 /* 0xa8 */ "?","{\\copyright}","?","?","?","?","?","?",
72 /* 0xb0 */ "\\o ", "\\+- ","$^{2}$","$^{3}$","?","?","\\P ","?",
73 /* 0xb8 */ "?","$^{1}$", "?","?", "\\frac{1}{4}", "\\frac{1}{2}","\\frac{3}{4}",
74 "?",
75 /* 0xc0 */ "\\`{A}","\\'{A}","\\o{A}",
76 "\\~{A}","\\\"{A}","?","\\AE ","\\c{C}",
77 /* 0xc8 */ "\\`{E}","\\'{E}","\\o{E}","\\\"{E}",
78 "\\`{I}","\\'{I}","\\o{I}","\\\"{I}",
79 /* 0xd0 */ "\\ETH ","\\~{N}","\\`{O}","\\'{O}",
80 "\\o{O}","\\~{O}","\\\"{O}","\\mult ",
81 /* 0xd8 */ "?","\\`{U}","\\'{U}","\\o{U}",
82 "\\\"{U}","\\'{Y}","\\THORN","?",
83 /* 0xe0 */ "\\`{a}","\\'{a}","\\o{a}",
84 "\\~{a}","\\\"{a}","?","\\ae ","\\c{c}",
85 /* 0xe8 */ "\\`{e}","\\'{e}","\\o{e}","\\\"{e}",
86 "\\`{i}","\\'{i}","\\o{i}","\\\"{i}",
87 /* 0xf0 */ "\\eth ","\\~{n}","\\`{o}","\\'{o}",
88 "\\o{o}","\\~{o}","\\\"{o}","\\div ",
89 /* 0xf8 */ "\\slash{o}","\\`{u}","\\'{u}","\\o{u}",
90 "\\\"{u}","\\'{y}","\\thorn ","\\\"{y}",
91 };
92
93 static char* mac [] = {
94 "?",
95 };
96
97 static char* cp437 [] = {
98 "?",
99 };
100
101 static char* cp850 [] = {
102 "?",
103 };
104
105
106
107
108 /*========================================================================
109 * Name: latex_init
110 * Purpose: Generates the output personality for LaTeX.
111 * Args: None.
112 * Returns: OutputPersonality.
113 *=======================================================================*/
114
115 OutputPersonality *
116 latex_init (void)
117 {
118 OutputPersonality* op;
119
120 op = op_create();
121
122 op->comment_begin = "%% ";
123 op->comment_end = "\n";
124
125 op->document_begin = "\\documentclass[11pt]{article}\n";
126 op->document_end = "\\end{document}";
127
128 op->header_begin = "";
129 op->header_end = "";
130
131 op->document_title_begin = "\\title{";
132 op->document_title_end = "}\n";
133
134 op->document_author_begin = "\\author{";
135 op->document_author_end = "}\n";
136
137 op->document_changedate_begin = "\\date{";
138 op->document_changedate_end = "}\n";
139
140 op->body_begin = "\n\n\\begin{document}\n\\maketitle\n";
141 op->body_end = "\\end{document}\n";
142
143 op->paragraph_begin = "\\par\n";
144 op->paragraph_end = "";
145
146 op->center_begin = "\\center{\n";
147 op->center_end = "}\n";
148
149 op->justify_begin = "";
150 op->justify_end = "";
151
152 op->align_left_begin = "\\begin{sloppy}\n";
153 op->align_left_end = "\\end{sloppy}\n";
154
155 op->align_right_begin = "";
156 op->align_right_end = "";
157
158 op->forced_space = "";
159 op->line_break = "\\par\n";
160 op->page_break = "\\pagebreak ";
161
162 op->hyperlink_begin = "";
163 op->hyperlink_end = "";
164
165 op->imagelink_begin = "";
166 op->imagelink_end = "";
167
168 op->table_begin = "\\begin{tabular}{|lllll}\n";
169 op->table_end = "\n\\end{tabular}\n";
170
171 op->table_row_begin = "";
172 op->table_row_end = "\\hline \\\\\n";
173
174 op->table_cell_begin = "";
175 op->table_cell_end = " & ";
176
177 /* Character attributes */
178 op->font_begin = "";
179 op->font_end = "";
180
181 op->fontsize_begin = "";
182 op->fontsize_end = "";
183
184 op->fontsize8_begin = "\\tiny{";
185 op->fontsize8_end = "}";
186 op->fontsize10_begin = "\\small{";
187 op->fontsize10_end = "}";
188 op->fontsize12_begin = "\\normalsize{";
189 op->fontsize12_end = "}";
190 op->fontsize14_begin = "{\\large ";
191 op->fontsize14_end = "}";
192 op->fontsize18_begin = "{\\Large ";
193 op->fontsize18_end = "}";
194 op->fontsize24_begin = "{\\LARGE ";
195 op->fontsize24_end = "}";
196 op->fontsize36_begin = "{\\huge ";
197 op->fontsize36_end = "}";
198 op->fontsize48_begin = "{\\Huge ";
199 op->fontsize48_end = "}";
200
201 op->smaller_begin = "";
202 op->smaller_end = "";
203
204 op->bigger_begin = "";
205 op->bigger_end = "";
206
207 op->foreground_begin = "";
208 op->foreground_end = "";
209
210 op->background_begin = "";
211 op->background_end = "";
212
213 op->bold_begin = "{\\bf ";
214 op->bold_end = "}";
215
216 op->italic_begin = "{\\it ";
217 op->italic_end = "}";
218
219 op->underline_begin = "";
220 op->underline_end = "\n";
221
222 op->dbl_underline_begin = "{\\ul ";
223 op->dbl_underline_end = "}";
224
225 op->pointlist_begin = "\\begin{itemize}\n";
226 op->pointlist_end = "\\end{itemize}\n";
227 op->pointlist_item_begin = "\\item ";
228 op->pointlist_item_end = "";
229
230 op->numericlist_begin = "\\begin{enumerate}\n";
231 op->numericlist_end = "\\end{enumerate}\n";
232 op->numericlist_item_begin = "\\item ";
233 op->numericlist_item_end = "";
234
235 op->superscript_begin = "$^{";
236 op->superscript_end = "}$";
237
238 op->subscript_begin = "$_{";
239 op->subscript_end = "}$";
240
241 op->strikethru_begin = "{";
242 op->strikethru_end = "}";
243
244 op->dbl_strikethru_begin = "{";
245 op->dbl_strikethru_end = "}";
246
247 op->emboss_begin="";
248 op->emboss_end = "";
249
250 op->engrave_begin = "";
251 op->engrave_end = "";
252
253 op->shadow_begin= "";
254 op->shadow_end= "";
255
256 op->small_caps_begin= "\\textsc{";
257 op->small_caps_end= "}";
258
259 op->outline_begin= "";
260 op->outline_end= "";
261
262 op->expand_begin = "";
263 op->expand_end = "";
264
265 op->simulate_small_caps = FALSE;
266 op->simulate_all_caps = TRUE;
267 op->simulate_word_underline = TRUE;
268
269 op->ascii_translation_table = ascii;
270
271 op->ansi_translation_table = ansi;
272 op->ansi_first_char = 0x80;
273 op->ansi_last_char = 0x80;
274
275 op->cp437_translation_table = cp437;
276 op->cp437_first_char = 0x80;
277 op->cp437_last_char = 0x80;
278
279 op->cp850_translation_table = cp850;
280 op->cp850_first_char = 0x80;
281 op->cp850_last_char = 0x80;
282
283 op->mac_translation_table = mac;
284 op->mac_first_char = 0x80;
285 op->mac_last_char = 0x80;
286
287 op->chars.right_quote = "'";
288 op->chars.left_quote = "`";
289 op->chars.right_dbl_quote = "''";
290 op->chars.left_dbl_quote = "``";
291
292 return op;
293 }
294
295
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: latex
25 * Author name: Zach Smith
26 * Create date: 19 Sep 01
27 * Purpose: Definitions for the PostScript(TM) output personality
28 *----------------------------------------------------------------------
29 * Changes:
30 *--------------------------------------------------------------------*/
31
32
33 #ifndef _LATEX
34
35
36 extern OutputPersonality* latex_init(void);
37
38
39 #define _LATEX
40 #endif
41
0 /*=============================================================================
1 GNU UnRTF, a command-line program to convert RTF documents to other formats.
2 Copyright (C) 2000,2001 Zachary Thayer Smith
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The author is reachable by electronic mail at tuorfa@yahoo.com.
19 =============================================================================*/
20
21
22 /*----------------------------------------------------------------------
23 * Module name: main.c
24 * Author name: Zach Smith
25 * Create date: 01 Sep 00
26 * Purpose: main() routine with file open/close.
27 *----------------------------------------------------------------------
28 * Changes:
29 * 14 Oct 00, tuorfa@yahoo.com: added -nopict option
30 * 15 Oct 00, tuorfa@yahoo.com: added verify_file_type()
31 * 08 Apr 01, tuorfa@yahoo.com: more GNU-like switches implemented
32 * 24 Jul 01, tuorfa@yahoo.com: removed verify_file_type()
33 * 03 Aug 01, tuorfa@yahoo.com: added --inline switch
34 * 08 Sep 01, tuorfa@yahoo.com: added use of PROGRAM_NAME
35 * 19 Sep 01, tuorfa@yahoo.com: addition of output personalities
36 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
37 * 23 Sep 01, tuorfa@yahoo.com: added wpml switch
38 * 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux
39 *--------------------------------------------------------------------*/
40
41
42
43 #include <stdio.h>
44 #include <string.h>
45 #if linux /* daved - 0.19.0 */
46 #include <stdlib.h>
47 #endif
48
49 #include "defs.h"
50 #include "error.h"
51 #include "word.h"
52 #include "convert.h"
53 #include "parse.h"
54 #include "hash.h"
55 #include "malloc.h"
56
57 #include "output.h"
58 #include "html.h"
59 #include "text.h"
60 #include "vt.h"
61 #include "ps.h"
62 #include "latex.h"
63 #include "wpml.h"
64
65
66
67 int nopict_mode; /* TRUE => do not write \pict's to files */
68 int dump_mode; /* TRUE => output a dump of the word tree */
69 int debug_mode; /* TRUE => output comments within HTML */
70 int lineno; /* used for error reporting */
71 int simple_mode; /* TRUE => output HTML without SPAN/DIV tags */
72 int inline_mode; /* TRUE => output HTML without HTML/BODY/HEAD */
73
74
75 OutputPersonality *op;
76 enum {
77 OP_HTML, OP_TEXT, OP_LATEX, OP_PS, OP_VT, OP_WPML
78 };
79
80
81
82 /*========================================================================
83 * Name: main
84 * Purpose: Main control function.
85 * Args: Args.
86 * Returns: Exit code.
87 *=======================================================================*/
88
89 int
90 main (int argc, char **argv)
91 {
92 FILE *f;
93 Word * word;
94 char *path=NULL;
95 int i;
96 int output_format = OP_HTML;
97
98 nopict_mode = debug_mode = dump_mode = inline_mode = FALSE;
99
100 if (argc<2 || argc>7) usage();
101
102 for (i=1; i<argc; i++) {
103 if (!strcmp("--dump",argv[i])) dump_mode=TRUE;
104 else if (!strcmp("-d",argv[i])) dump_mode=TRUE;
105 else if (!strcmp("--debug",argv[i])) debug_mode=TRUE;
106 else if (!strcmp("--simple",argv[i])) simple_mode=TRUE;
107 else if (!strcmp("--html",argv[i])) output_format=OP_HTML;
108 else if (!strcmp("--text",argv[i])) output_format=OP_TEXT;
109 else if (!strcmp("--vt",argv[i])) output_format=OP_VT;
110 else if (!strcmp("--ps",argv[i])) output_format=OP_PS;
111 else if (!strcmp("--latex",argv[i])) output_format=OP_LATEX;
112 else if (!strcmp("--wpml",argv[i])) output_format=OP_WPML;
113 else if (!strcmp("-t",argv[i])) {
114 if ((i+1)<argc && *argv[i+1]!='-') {
115 i++;
116 if (!strcmp ("html", argv[i]))
117 output_format=OP_HTML;
118 else if (!strcmp ("vt", argv[i]))
119 output_format=OP_VT;
120 else if (!strcmp ("text", argv[i]))
121 output_format=OP_TEXT;
122 else if (!strcmp ("ps", argv[i]))
123 output_format=OP_PS;
124 else if (!strcmp ("latex", argv[i]))
125 output_format=OP_LATEX;
126 else if (!strcmp ("wpml", argv[i]))
127 output_format=OP_WPML;
128 }
129 }
130 else if (!strcmp("--inline",argv[i])) inline_mode=TRUE;
131 else if (!strcmp("--help",argv[i])) {
132 usage();
133 exit (0);
134 }
135 else if (!strcmp("--version",argv[i])) {
136 fprintf (stderr, "%s\n", PROGRAM_VERSION);
137 exit (0);
138 }
139 else if (!strcmp("--nopict",argv[i])) nopict_mode=TRUE;
140 else if (!strcmp("-n",argv[i])) nopict_mode=TRUE;
141 else {
142 if (*argv[i]=='-') usage();
143
144 if(path)
145 usage();
146 else
147 path=argv[i];
148 }
149 }
150
151 if (!path) usage();
152
153 switch (output_format) {
154 case OP_TEXT:
155 op = text_init();
156 break;
157 case OP_VT:
158 op = vt_init();
159 break;
160 case OP_HTML:
161 op = html_init();
162 break;
163 case OP_PS:
164 op = ps_init();
165 break;
166 case OP_LATEX:
167 op = latex_init();
168 break;
169 case OP_WPML:
170 op = wpml_init();
171 break;
172 default:
173 error_handler ("unknown output format");
174 }
175
176 hash_init();
177
178 fprintf (stderr, "This is %s, ", PROGRAM_NAME);
179 fprintf (stderr, "version %s\n", PROGRAM_VERSION);
180 fprintf (stderr, "By Dave Davey and Marcos Serrou do Amaral\n");
181 fprintf (stderr, "Original Author: Zach T. Smith\n");
182
183 if (debug_mode) fprintf (stderr, "Debug mode.\n");
184 if (dump_mode) fprintf (stderr, "Dump mode.\n");
185
186 f = fopen (path, "r");
187 if (!f) {
188 char path2[200];
189 strcpy(path2,path); strcat(path2,".rtf");
190 f = fopen(path2, "r");
191 if(!f)
192 error_handler ("cannot open input file");
193 }
194
195 fprintf(stderr,"Processing %s...\n", path);
196
197 lineno=0;
198
199 word = word_read (f);
200
201 if (dump_mode) {
202 word_dump (word);
203 printf ("\n");
204 } else {
205 word_print (word);
206 }
207
208 fclose(f);
209
210 fprintf(stderr,"Done.\n");
211
212 hash_stats();
213
214 if (debug_mode) {
215 fprintf (stderr, "Total memory allocated %ld bytes.\n",
216 total_malloced());
217 }
218
219 /* May as well */
220 word_free (word);
221
222 return 0;
223 }
224
225
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: main.h
25 * Author name: Zach Smith
26 * Create date: 1 Sept 2000
27 * Purpose: Externs for main.c.
28 *----------------------------------------------------------------------
29 * Changes:
30 * 15 Oct 00, tuorfa@yahoo.com: removed echo_mode extern
31 * 19 Sep 01, tuorfa@yahoo.com: added output personality
32 *--------------------------------------------------------------------*/
33
34
35 extern int lineno;
36 extern int debug_mode;
37 extern int simple_mode;
38 extern int inline_mode;
39
40
41 #ifndef _OUTPUT
42 #include "output.h"
43 #endif
44
45 extern OutputPersonality *op;
46
47
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: malloc
25 * Author name: Zach Smith
26 * Create date: 01 Aug 01
27 * Purpose: Memory management. Allows us to keep track of how
28 * much memory is being used.
29 *----------------------------------------------------------------------
30 * Changes:
31 * 14 Aug 01, tuorfa@yahoo.com: added Turbo C support.
32 * 16 Aug 01, Lars Unger <l.unger@tu-bs.de>: added Amiga/GCC support.
33 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
34 * 28 Sep 01, tuorfa@yahoo.com: removed Turbo C support.
35 * 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux
36 *--------------------------------------------------------------------*/
37
38
39 #include <stdio.h>
40 #include <string.h>
41 #if linux /* daved - 0.19.0 */
42 #include <stdlib.h>
43 #endif
44
45 #if AMIGA
46 #include <stdlib.h>
47 #else
48 #include <malloc.h>
49 #endif
50
51 #include "error.h"
52
53
54 static unsigned long count=0;
55
56
57
58 /*========================================================================
59 * Name: my_malloc
60 * Purpose: Internal version of malloc necessary for record keeping.
61 * Args: Amount.
62 * Returns: Pointer.
63 *=======================================================================*/
64
65 char *
66 my_malloc (unsigned long size) {
67 char *ptr;
68
69 ptr = malloc (size);
70 if (ptr)
71 count += size;
72
73 return ptr;
74 }
75
76 /*========================================================================
77 * Name: my_free
78 * Purpose: Internal version of free necessary for record keeping.
79 * Args: Pointer.
80 * Returns: None.
81 *=======================================================================*/
82
83 void
84 my_free (char* ptr) {
85 CHECK_PARAM_NOT_NULL(ptr);
86
87 free (ptr);
88 }
89
90
91
92 /*========================================================================
93 * Name: total_malloced
94 * Purpose: Returns total amount of memory thus far allocated.
95 * Args: None.
96 * Returns: Amount.
97 *=======================================================================*/
98
99 unsigned long
100 total_malloced (void) {
101 return count;
102 }
103
104
105
106 /*========================================================================
107 * Name: my_strdup
108 * Purpose: Internal version of strdup necessary for record keeping.
109 * Args: String.
110 * Returns: String.
111 *=======================================================================*/
112
113 char *
114 my_strdup (char *src) {
115 unsigned long len;
116 char *ptr;
117
118 CHECK_PARAM_NOT_NULL(src);
119
120 len = strlen(src);
121 ptr = my_malloc (len+1);
122 if (!ptr)
123 error_handler ("out of memory in strdup()");
124
125 strcpy (ptr, src);
126 return ptr;
127 }
128
0
1
2 /*=============================================================================
3 GNU UnRTF, a command-line program to convert RTF documents to other formats.
4 Copyright (C) 2000,2001 Zachary Thayer Smith
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 The author is reachable by electronic mail at tuorfa@yahoo.com.
21 =============================================================================*/
22
23
24 /*----------------------------------------------------------------------
25 * Module name: malloc
26 * Author name: Zach Smith
27 * Create date: 1 Aug 2001
28 * Purpose: Definitions for memory management.
29 *----------------------------------------------------------------------
30 * Changes:
31 *--------------------------------------------------------------------*/
32
33 extern char * my_malloc (unsigned long);
34 extern void my_free (char*);
35 extern unsigned long total_malloced (void);
36 extern char * my_strdup (char*);
37
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: output
25 * Author name: Zach Smith
26 * Create date: 18 Sep 01
27 * Purpose: Generalized output module
28 *----------------------------------------------------------------------
29 * Changes:
30 * 22 Sep 01, tuorfa@yahoo.com: addition of functions to change font size
31 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
32 * 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux
33 *--------------------------------------------------------------------*/
34
35
36 #include <stdio.h>
37 #include <string.h>
38 #if linux /* daved - 0.19.0 */
39 #include <stdlib.h>
40 #endif
41 #include "malloc.h"
42 #include "defs.h"
43 #include "error.h"
44 #include "output.h"
45 #include "main.h"
46 #include "convert.h"
47
48
49 /*========================================================================
50 * Name: op_create
51 * Purpose: Creates a blank output personality.
52 * Args: None.
53 * Returns: Output personality struct.
54 *=======================================================================*/
55
56 OutputPersonality*
57 op_create ()
58 {
59 OutputPersonality* new_op;
60
61 new_op = (OutputPersonality*) my_malloc (sizeof(OutputPersonality));
62 if (!new_op)
63 error_handler ("cannot allocate output personality");
64
65 bzero ((void*) new_op, sizeof (OutputPersonality));
66 return new_op;
67 }
68
69
70
71 /*========================================================================
72 * Name: op_free
73 * Purpose: Deallocates an output personality, but none of the strings
74 * it points to since they are usually constants.
75 * Args: OutputPersonality.
76 * Returns: None.
77 *=======================================================================*/
78
79 void
80 op_free (OutputPersonality *op)
81 {
82 CHECK_PARAM_NOT_NULL(op);
83
84 my_free ((void*) op);
85 }
86
87
88
89
90 /*========================================================================
91 * Name: op_translate_char
92 * Purpose: Performs a translation of a character in the context of
93 * a given output personality.
94 * Args: OutputPersonality, character set#, character.
95 * Returns: String.
96 *=======================================================================*/
97
98 char *
99 op_translate_char (OutputPersonality *op, int charset, int ch)
100 {
101 short start;
102 char *result=NULL;
103
104 CHECK_PARAM_NOT_NULL(op);
105
106 if (ch >= 0x20 && ch < 0x80) {
107 result = op->ascii_translation_table [ch - 0x20];
108 }
109 else
110 if (charset != CHARSET_ANSI &&
111 charset != CHARSET_MAC &&
112 charset != CHARSET_CP437 &&
113 charset != CHARSET_CP850)
114 error_handler ("invalid character set value, cannot translate character");
115 else
116 switch (charset) {
117 case CHARSET_ANSI:
118 start = op->ansi_first_char;
119 if (ch >= start &&
120 ch <= op->ansi_last_char)
121 result = op->ansi_translation_table [ch-start];
122 break;
123 case CHARSET_MAC:
124 start = op->mac_first_char;
125 if (ch >= start &&
126 ch <= op->mac_last_char)
127 result = op->mac_translation_table [ch-start];
128 break;
129 case CHARSET_CP437:
130 start = op->cp437_first_char;
131 if (ch >= start &&
132 ch <= op->cp437_last_char)
133 result = op->cp437_translation_table [ch-start];
134 break;
135 case CHARSET_CP850:
136 start = op->cp850_first_char;
137 if (ch >= start &&
138 ch <= op->cp850_last_char)
139 result = op->cp850_translation_table [ch-start];
140 break;
141 }
142 return result;
143 }
144
145
146 /*========================================================================
147 * Name: op_begin_std_fontsize
148 * Purpose: Prints whatever is necessary to perform a change in the
149 * current font size.
150 * Args: OutputPersonality, desired size.
151 * Returns: None.
152 *=======================================================================*/
153
154 void
155 op_begin_std_fontsize (OutputPersonality *op, int size)
156 {
157 int found_std_expr = FALSE;
158
159 CHECK_PARAM_NOT_NULL(op);
160
161 /* Look for an exact match with a standard point size.
162 */
163 switch (size) {
164 case 8:
165 if (op->fontsize8_begin) {
166 printf (op->fontsize8_begin);
167 found_std_expr = TRUE;
168 }
169 break;
170 case 10:
171 if (op->fontsize10_begin) {
172 printf (op->fontsize10_begin);
173 found_std_expr = TRUE;
174 }
175 break;
176 case 12:
177 if (op->fontsize12_begin) {
178 printf (op->fontsize12_begin);
179 found_std_expr = TRUE;
180 }
181 break;
182 case 14:
183 if (op->fontsize14_begin) {
184 printf (op->fontsize14_begin);
185 found_std_expr = TRUE;
186 }
187 break;
188 case 18:
189 if (op->fontsize18_begin) {
190 printf (op->fontsize18_begin);
191 found_std_expr = TRUE;
192 }
193 break;
194 case 24:
195 if (op->fontsize24_begin) {
196 printf (op->fontsize24_begin);
197 found_std_expr = TRUE;
198 }
199 break;
200 case 36:
201 if (op->fontsize36_begin) {
202 printf (op->fontsize36_begin);
203 found_std_expr = TRUE;
204 }
205 break;
206 case 48:
207 if (op->fontsize48_begin) {
208 printf (op->fontsize48_begin);
209 found_std_expr = TRUE;
210 }
211 break;
212 }
213
214 /* If no exact match, try to write out a change to the
215 * exact point size.
216 */
217 if (!found_std_expr) {
218 if (op->fontsize_begin) {
219 char expr[16];
220 sprintf (expr, "%d", size);
221 printf (op->fontsize_begin, expr);
222 } else {
223 /* If we cannot write out a change for the exact
224 * point size, we must approximate to a standard
225 * size.
226 */
227 if (size<9 && op->fontsize8_begin) {
228 printf (op->fontsize8_begin);
229 } else
230 if (size<11 && op->fontsize10_begin) {
231 printf (op->fontsize10_begin);
232 } else
233 if (size<13 && op->fontsize12_begin) {
234 printf (op->fontsize12_begin);
235 } else
236 if (size<16 && op->fontsize14_begin) {
237 printf (op->fontsize14_begin);
238 } else
239 if (size<21 && op->fontsize18_begin) {
240 printf (op->fontsize18_begin);
241 } else
242 if (size<30 && op->fontsize24_begin) {
243 printf (op->fontsize24_begin);
244 } else
245 if (size<42 && op->fontsize36_begin) {
246 printf (op->fontsize36_begin);
247 } else
248 if (size>40 && op->fontsize48_begin) {
249 printf (op->fontsize48_begin);
250 } else
251 /* If we can't even produce a good approximation,
252 * just try to get a font size near 12 point.
253 */
254 if (op->fontsize12_begin)
255 printf (op->fontsize12_begin);
256 else
257 if (op->fontsize14_begin)
258 printf (op->fontsize14_begin);
259 else
260 if (op->fontsize10_begin)
261 printf (op->fontsize10_begin);
262 else
263 if (op->fontsize18_begin)
264 printf (op->fontsize18_begin);
265 else
266 if (op->fontsize8_begin)
267 printf (op->fontsize8_begin);
268 else
269 error_handler ("output personality lacks sufficient font size change capability");
270 }
271 }
272 }
273
274
275 /*========================================================================
276 * Name: op_end_std_fontsize
277 * Purpose: Prints whatever is necessary to perform a change in the
278 * current font size.
279 * Args: OutputPersonality, desired size.
280 * Returns: None.
281 *=======================================================================*/
282
283 void
284 op_end_std_fontsize (OutputPersonality *op, int size)
285 {
286 int found_std_expr = FALSE;
287
288 CHECK_PARAM_NOT_NULL(op);
289
290 /* Look for an exact match with a standard point size.
291 */
292 switch (size) {
293 case 8:
294 if (op->fontsize8_end) {
295 printf (op->fontsize8_end);
296 found_std_expr = TRUE;
297 }
298 break;
299 case 10:
300 if (op->fontsize10_end) {
301 printf (op->fontsize10_end);
302 found_std_expr = TRUE;
303 }
304 break;
305 case 12:
306 if (op->fontsize12_end) {
307 printf (op->fontsize12_end);
308 found_std_expr = TRUE;
309 }
310 break;
311 case 14:
312 if (op->fontsize14_end) {
313 printf (op->fontsize14_end);
314 found_std_expr = TRUE;
315 }
316 break;
317 case 18:
318 if (op->fontsize18_end) {
319 printf (op->fontsize18_end);
320 found_std_expr = TRUE;
321 }
322 break;
323 case 24:
324 if (op->fontsize24_end) {
325 printf (op->fontsize24_end);
326 found_std_expr = TRUE;
327 }
328 break;
329 case 36:
330 if (op->fontsize36_end) {
331 printf (op->fontsize36_end);
332 found_std_expr = TRUE;
333 }
334 break;
335 case 48:
336 if (op->fontsize48_end) {
337 printf (op->fontsize48_end);
338 found_std_expr = TRUE;
339 }
340 break;
341 }
342
343 /* If no exact match, try to write out a change to the
344 * exact point size.
345 */
346 if (!found_std_expr) {
347 if (op->fontsize_end) {
348 char expr[16];
349 sprintf (expr, "%d", size);
350 printf (op->fontsize_end, expr);
351 } else {
352 /* If we cannot write out a change for the exact
353 * point size, we must approximate to a standard
354 * size.
355 */
356 if (size<9 && op->fontsize8_end) {
357 printf (op->fontsize8_end);
358 } else
359 if (size<11 && op->fontsize10_end) {
360 printf (op->fontsize10_end);
361 } else
362 if (size<13 && op->fontsize12_end) {
363 printf (op->fontsize12_end);
364 } else
365 if (size<16 && op->fontsize14_end) {
366 printf (op->fontsize14_end);
367 } else
368 if (size<21 && op->fontsize18_end) {
369 printf (op->fontsize18_end);
370 } else
371 if (size<30 && op->fontsize24_end) {
372 printf (op->fontsize24_end);
373 } else
374 if (size<42 && op->fontsize36_end) {
375 printf (op->fontsize36_end);
376 } else
377 if (size>40 && op->fontsize48_end) {
378 printf (op->fontsize48_end);
379 } else
380 /* If we can't even produce a good approximation,
381 * just try to get a font size near 12 point.
382 */
383 if (op->fontsize12_end)
384 printf (op->fontsize12_end);
385 else
386 if (op->fontsize14_end)
387 printf (op->fontsize14_end);
388 else
389 if (op->fontsize10_end)
390 printf (op->fontsize10_end);
391 else
392 if (op->fontsize18_end)
393 printf (op->fontsize18_end);
394 else
395 if (op->fontsize8_end)
396 printf (op->fontsize8_end);
397 else
398 error_handler ("output personality lacks sufficient font size change capability");
399 }
400 }
401 }
402
403
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: output
25 * Author name: Zach Smith
26 * Create date: 18 Sep 01
27 * Purpose: Definitions for the generalized output module
28 *----------------------------------------------------------------------
29 * Changes:
30 *--------------------------------------------------------------------*/
31
32
33 #ifndef _OUTPUT
34
35
36 typedef struct {
37 char *comment_begin;
38 char *comment_end;
39
40 char *document_begin;
41 char *document_end;
42
43 char *header_begin;
44 char *header_end;
45
46 char *document_title_begin;
47 char *document_title_end;
48
49 char *document_keywords_begin;
50 char *document_keywords_end;
51
52 char *document_author_begin;
53 char *document_author_end;
54
55 char *document_changedate_begin;
56 char *document_changedate_end;
57
58 char *body_begin;
59 char *body_end;
60
61 char *word_begin;
62 char *word_end;
63
64 char *paragraph_begin;
65 char *paragraph_end;
66
67 char *center_begin;
68 char *center_end;
69
70 char *align_left_begin;
71 char *align_left_end;
72
73 char *align_right_begin;
74 char *align_right_end;
75
76 char *justify_begin;
77 char *justify_end;
78
79 char *forced_space;
80 char *line_break;
81 char *page_break;
82
83 char *hyperlink_begin;
84 char *hyperlink_end;
85
86 char *imagelink_begin;
87 char *imagelink_end;
88
89 char *table_begin;
90 char *table_end;
91
92 char *table_row_begin;
93 char *table_row_end;
94
95 char *table_cell_begin;
96 char *table_cell_end;
97
98 /* Character attributes */
99 char *font_begin;
100 char *font_end;
101
102 char *fontsize_begin;
103 char *fontsize_end;
104
105 /* standard font sizes are optional */
106 char *fontsize8_begin;
107 char *fontsize8_end;
108
109 char *fontsize10_begin;
110 char *fontsize10_end;
111
112 char *fontsize12_begin;
113 char *fontsize12_end;
114
115 char *fontsize14_begin;
116 char *fontsize14_end;
117
118 char *fontsize18_begin;
119 char *fontsize18_end;
120
121 char *fontsize24_begin;
122 char *fontsize24_end;
123
124 char *fontsize36_begin;
125 char *fontsize36_end;
126
127 char *fontsize48_begin;
128 char *fontsize48_end;
129
130 char *smaller_begin;
131 char *smaller_end;
132
133 char *bigger_begin;
134 char *bigger_end;
135
136 char *foreground_begin;
137 char *foreground_end;
138
139 char *background_begin;
140 char *background_end;
141
142 char *bold_begin;
143 char *bold_end;
144
145 char *italic_begin;
146 char *italic_end;
147
148 char *underline_begin;
149 char *underline_end;
150
151 char *dbl_underline_begin;
152 char *dbl_underline_end;
153
154 char *superscript_begin;
155 char *superscript_end;
156
157 char *subscript_begin;
158 char *subscript_end;
159
160 char *strikethru_begin;
161 char *strikethru_end;
162
163 char *dbl_strikethru_begin;
164 char *dbl_strikethru_end;
165
166 char *emboss_begin;
167 char *emboss_end;
168
169 char *engrave_begin;
170 char *engrave_end;
171
172 char *shadow_begin;
173 char *shadow_end;
174
175 char *outline_begin;
176 char *outline_end;
177
178 char *small_caps_begin;
179 char *small_caps_end;
180
181 char *pointlist_begin;
182 char *pointlist_end;
183
184 char *pointlist_item_begin;
185 char *pointlist_item_end;
186
187 char *numericlist_begin;
188 char *numericlist_end;
189
190 char *numericlist_item_begin;
191 char *numericlist_item_end;
192
193 char *expand_begin;
194 char *expand_end;
195
196 char *toc_entry_begin;
197 char *toc_entry_end;
198
199 char *index_entry_begin;
200 char *index_entry_end;
201
202 /* XX These should really be replaced by references
203 * to one of the charsets.
204 */
205 struct {
206 char *bullet;
207 char *left_quote;
208 char *right_quote;
209 char *left_dbl_quote;
210 char *right_dbl_quote;
211 char *nonbreaking_space;
212 char *emdash;
213 char *endash;
214 char *lessthan;
215 char *greaterthan;
216 char *amp;
217 char *copyright;
218 char *trademark;
219 char *nonbreaking_hyphen;
220 char *optional_hyphen;
221 } chars;
222
223 char **ascii_translation_table;
224
225 int simulate_small_caps : 1;
226 int simulate_all_caps : 1;
227 int simulate_word_underline : 1;
228
229 char **ansi_translation_table;
230 short ansi_first_char;
231 short ansi_last_char;
232 char **cp437_translation_table;
233 short cp437_first_char;
234 short cp437_last_char;
235 char **cp850_translation_table;
236 short cp850_first_char;
237 short cp850_last_char;
238 char **mac_translation_table;
239 short mac_first_char;
240 short mac_last_char;
241
242 void (*write_set_foreground) (int,int,int);
243 }
244 OutputPersonality;
245
246
247 extern OutputPersonality* op_create(void);
248 extern void op_free (OutputPersonality*);
249 extern char* op_translate_char (OutputPersonality*,int,int);
250
251 extern void op_begin_std_fontsize (OutputPersonality*, int);
252 extern void op_end_std_fontsize (OutputPersonality*, int);
253
254
255 #define _OUTPUT
256 #endif
257
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: parse
25 * Author name: Zach Smith
26 * Create date: 01 Sep 00
27 * Purpose: Parsing of the RTF file into a structure of Word objects.
28 *----------------------------------------------------------------------
29 * Changes:
30 * 15 Oct 00, tuorfa@yahoo.com: parse.c created with functions taken from word.c
31 * 15 Oct 00, tuorfa@yahoo.com: backslash before newline is now \par
32 * 08 Apr 01, tuorfa@yahoo.com: removed limit on word length
33 * 03 Aug 01, tuorfa@yahoo.com: added input buffering
34 * 19 Sep 01, tuorfa@yahoo.com: cleaned up read_word()
35 * 22 Sep 01, tuorfa@yahoo.com: moved word_dump() to word.c
36 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
37 * 08 Sep 03, daved@physiol.usyd.edu.au: type fixes; ANSI C fixes
38 *--------------------------------------------------------------------*/
39
40 #include <stdio.h>
41 #include <stdlib.h>
42 #include <ctype.h>
43 #include <string.h>
44
45 #include "defs.h"
46 #include "parse.h"
47 #include "malloc.h"
48 #include "main.h"
49 #include "error.h"
50 #include "word.h"
51 #include "hash.h"
52
53
54
55 /* local to getchar stuff */
56 #if 0 /* daved - 0.19.0 */
57 static int ungot_char=-1;
58 static int ungot_char2=-1;
59 static int ungot_char3=-1;
60 #else
61 static int ungot_char = -1;
62 static int ungot_char2 = -1;
63 static int ungot_char3 = -1;
64 #endif
65
66
67
68 /*========================================================================
69 * Name: my_unget_char
70 * Purpose: My own unget routine, handling up to 3 ungot characters.
71 * Args: Character.
72 * Returns: None.
73 *=======================================================================*/
74
75 static void my_unget_char (int ch)
76 {
77 if (ungot_char>=0 && ungot_char2>=0 && ungot_char3>=0)
78 error_handler ("more than 3 ungot chars");
79
80 ungot_char3 = ungot_char2;
81 ungot_char2 = ungot_char;
82 ungot_char = ch;
83 }
84
85
86 static int last_returned_ch=0;
87
88
89 #define READ_BUF_LEN 2048
90 static int buffer_size = 0;
91 static char *read_buf = NULL;
92 static int read_buf_end = 0;
93 static int read_buf_index = 0;
94
95
96
97
98
99 /*========================================================================
100 * Name: my_getchar
101 * Purpose: Gets a character: either an ungot one, or a buffered one.
102 * Args: Input file.
103 * Returns: Character, or EOF.
104 *=======================================================================*/
105
106 static int my_getchar (FILE* f)
107 {
108 int ch;
109
110 CHECK_PARAM_NOT_NULL(f);
111
112 if (ungot_char>=0) {
113 ch = ungot_char;
114 #if 0 /* daved - 0.19.0 */
115 ungot_char=ungot_char2;
116 ungot_char2=ungot_char3;
117 ungot_char3=-1;
118 #else
119 ungot_char = ungot_char2;
120 ungot_char2 = ungot_char3;
121 ungot_char3 = -1;
122 #endif
123 last_returned_ch = ch;
124 if(ch > 255)
125 {
126 fprintf(stderr, "returning bad ch = '%c' (0%o)\n",
127 ch, ch);
128 }
129 return ch;
130 }
131 do {
132 if (read_buf_index >= read_buf_end) {
133 if (!read_buf) {
134 buffer_size = READ_BUF_LEN;
135 read_buf = my_malloc (buffer_size);
136 if (!read_buf) {
137 buffer_size /= 4;
138 read_buf = my_malloc (buffer_size);
139 if (!read_buf)
140 error_handler ("cannot allocate read buffer");
141 }
142 }
143 read_buf_end = fread (read_buf, 1, buffer_size, f);
144 read_buf_index = 0;
145 if (!read_buf_end)
146 return EOF;
147 }
148 ch = read_buf [read_buf_index++];
149
150 if (ch=='\n') {
151 lineno++;
152 /* Convert \(newline) into \par here */
153 if (last_returned_ch=='\\') {
154 my_unget_char (' ');
155 my_unget_char ('r');
156 my_unget_char ('a');
157 ch = 'p';
158 break;
159 }
160 }
161 }
162 while (ch=='\r' /* || ch=='\n' */ );
163
164 if (ch=='\t') ch = ' ';
165
166 last_returned_ch = ch;
167 if(ch > 255)
168 {
169 fprintf(stderr,"returning bad ch '%c' (0%o)\n", ch, ch);
170 exit(1);
171 }
172 return ch;
173 }
174
175
176 /* local to read_word */
177 static char *input_str = NULL;
178 static unsigned long current_max_length = 1;
179
180
181
182 /*========================================================================
183 * Name: expand_word_buffer
184 * Purpose: Expands the buffer used to store an incoming word.
185 * This allows us to remove the limit on word length.
186 * Args: None.
187 * Returns: None.
188 *=======================================================================*/
189
190 static int
191 expand_word_buffer ()
192 {
193 char *new_ptr;
194 unsigned long old_length;
195 if (!input_str)
196 error_handler ("no input buffer allocated");
197 old_length = current_max_length;
198 current_max_length *= 2;
199 new_ptr = my_malloc (current_max_length);
200 if (!new_ptr)
201 error_handler ("out of memory while resizing buffer");
202
203 memcpy (new_ptr, input_str, old_length);
204 my_free (input_str);
205 input_str = new_ptr;
206 return TRUE;
207 }
208
209
210
211
212 /*========================================================================
213 * Name: read_word
214 * Purpose: The core of the parser, this reads a word.
215 * Args: Input file.
216 * Returns: Number of characters in the word, or zero.
217 * Note: The word buffer is static and local to this file.
218 *=======================================================================*/
219
220 static int
221 read_word (FILE *f)
222 {
223 #if 0 /* daved - 0.19.0 */
224 int ch, ch2, ix=0;
225 #else
226 int ch, ch2;
227 unsigned long ix=0;
228 #endif
229 int have_whitespace=FALSE;
230 int is_control_word=FALSE;
231 int has_numeric_param=FALSE; /* if is_control_word==TRUE */
232 int need_unget=FALSE;
233
234 CHECK_PARAM_NOT_NULL(f);
235
236 current_max_length = 10; /* XX */
237
238 /* Get some storage for a word.
239 */
240 input_str = my_malloc (current_max_length);
241 if (!input_str)
242 error_handler("cannot allocate word storage");
243
244 do {
245 ch = my_getchar(f);
246 }
247 while (ch=='\n');
248
249 if (ch==' ')
250 {
251 /* Compress multiple space chars down to one.
252 */
253 while (ch == ' ') {
254 ch = my_getchar(f);
255 have_whitespace=TRUE;
256 }
257 if (have_whitespace) {
258 my_unget_char (ch);
259 input_str[0]=' ';
260 input_str[1]=0;
261 return 1;
262 }
263 }
264
265 switch(ch)
266 {
267 case EOF:
268 return 0;
269
270 case '\\':
271 ch2 = my_getchar(f);
272
273 /* Look for two-character command words.
274 */
275 switch (ch2)
276 {
277 case '\n':
278 strcpy (input_str, "\\par");
279 return 4;
280 case '~':
281 case '{':
282 case '}':
283 case '\\':
284 case '_':
285 case '-':
286 input_str[0] = '\\';
287 input_str[1] = ch2;
288 input_str[2] = 0;
289 return 2;
290 case '\'':
291 /* Preserve \'## expressions (hex char exprs) for later.
292 */
293 input_str[0]='\\';
294 input_str[1]='\'';
295 ix=2;
296 if(ix==current_max_length) {
297 if (!expand_word_buffer ())
298 error_handler("word too long");
299 }
300 ch = my_getchar(f);
301 input_str[ix++]=ch;
302 if(ix==current_max_length) {
303 if (!expand_word_buffer ())
304 error_handler("word too long");
305 }
306 ch = my_getchar(f);
307 input_str[ix++]=ch;
308 if(ix==current_max_length) {
309 if (!expand_word_buffer ())
310 error_handler("word too long");
311 }
312 input_str[ix]=0;
313 return ix;
314 }
315
316 is_control_word=TRUE;
317 ix=1;
318 input_str[0]=ch;
319 ch=ch2;
320 break;
321
322 case '\t':
323 /* In RTF, a tab char is the same as \tab.
324 */
325 strcpy (input_str, "\\tab");
326 return 4;
327
328 case '{':
329 case '}':
330 case ';':
331 input_str[0]=ch;
332 input_str[1]=0;
333 return 1;
334
335 }
336
337 while (ch!=EOF)
338 {
339 /* Several chars always ends a word, and we need to save them.
340 */
341 if (ch=='\t' || ch=='{' || ch=='}' || ch=='\\') {
342 need_unget=TRUE;
343 break;
344 }
345
346 /* A newline always ends a command word; we don't save it.
347 * A newline is ignored if this is not a command word.
348 */
349 if (ch=='\n') {
350 if (is_control_word)
351 break;
352 ch = my_getchar(f);
353 continue;
354 }
355
356 /* A semicolon always ends a command word; we do save it.
357 * A semicolon never ends a regular word.
358 */
359 if (ch==';') {
360 if (is_control_word) {
361 need_unget=TRUE;
362 break;
363 }
364 }
365
366 /* In this parser, a space character terminates
367 * any word, and if it does not follow a command,
368 * then it is a word in itself.
369 */
370 if (ch==' ') {
371 if (!is_control_word)
372 need_unget=TRUE;
373 break;
374 }
375
376 /* Identify a control word's numeric parameter.
377 */
378 if (is_control_word) {
379 if (!has_numeric_param && (isdigit(ch) || ch=='-'))
380 has_numeric_param = TRUE;
381 else
382 if (has_numeric_param && !isdigit(ch)) {
383 if (ch!=' ')
384 need_unget=TRUE;
385 break;
386 }
387 }
388
389 input_str[ix++] = ch;
390 if (ix==current_max_length) {
391 if (!expand_word_buffer ())
392 error_handler("word too long");
393 }
394 ch = my_getchar (f);
395 }
396
397 if (need_unget)
398 my_unget_char(ch);
399
400 input_str[ix]=0;
401 return ix;
402 }
403
404
405
406 /*========================================================================
407 * Name: word_read
408 * Purpose: This is the recursive metareader which pieces together the
409 * structure of Word objects.
410 * Args: Input file.
411 * Returns: Tree of Word objects.
412 *=======================================================================*/
413
414 Word *
415 word_read (FILE* f) {
416 Word * prev_word = NULL;
417 Word * first_word = NULL;
418 Word * new_word = NULL; /* temp */
419
420 CHECK_PARAM_NOT_NULL(f);
421
422 do {
423 if (!read_word(f)) {
424 return first_word;
425 }
426
427
428 if (input_str[0] == '{') {
429 /* Process subwords */
430
431 #if 0
432 printf ("processing subword...\n");
433 #endif
434
435 /* Create a dummy word to point to a sublist */
436 new_word = word_new (NULL);
437 if (!new_word)
438 error_handler ("cannot allocate word");
439
440 /* Get the sublist */
441 new_word->child = word_read (f);
442 if (!new_word->hash_index && !new_word->child)
443 {
444 /* printf ("unable to read children!\n"); */
445 }
446
447 } else if (input_str[0] == '}') {
448 #if 0
449 printf ("returning from word_read.\n");
450 #endif
451 return first_word;
452 } else {
453 new_word = word_new (input_str);
454 }
455
456 if (prev_word) prev_word->next = new_word;
457
458 if (!first_word) first_word = new_word;
459
460 prev_word = new_word;
461
462 /* Free up the memory allocated by read_word.
463 */
464 my_free (input_str);
465 input_str = NULL;
466 }
467 while(1);
468
469 }
470
471
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: parse.h
25 * Author name: Zach Smith
26 * Create date: 15 Oct 2000
27 * Purpose: Definitions and externs for parse.c.
28 *----------------------------------------------------------------------
29 * Changes:
30 * 15 Oct 00, tuorfa@yahoo.com: parse.h created with functions taken from word.c
31 *--------------------------------------------------------------------*/
32
33
34
35 #ifndef _WORD
36 #include "word.h"
37 #endif
38
39
40 extern Word *word_read(FILE*);
41
42
43
+630
-0
ps.c less more
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: ps
25 * Author name: Zach Smith
26 * Create date: 18 Sep 01
27 * Purpose: PostScript(TM)-specific output module
28 *----------------------------------------------------------------------
29 * Changes:
30 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
31 * 23 Sep 01, tuorfa@yahoo.com: added shadow, outline, strikethru, underline
32 * 23 Sep 01, tuorfa@yahoo.com: revised PS program to use ISOLatin1Encoding
33 * 28 Sep 01, tuorfa@yahoo.com: added support for Helvetica,Courier,Symbol
34 * 08 Oct 03, daved@physiol.usyd.edu.au: fixed corrupted PS_START string
35 *--------------------------------------------------------------------*/
36
37
38
39
40 #include <stdio.h>
41 #include <string.h>
42 #include "malloc.h"
43 #include "defs.h"
44 #include "error.h"
45 #include "main.h"
46 #include "output.h"
47
48
49
50 static char*
51 ascii [96] = {
52 /* 0x20 */ " ", "!", "\"", "#", "$", "\%", "&", "'",
53 /* 0x28 */ "\\(", "\\)", "*", "+", ",", "-", ".", "/",
54 /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7",
55 /* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?",
56 /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G",
57 /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O",
58 /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W",
59 /* 0x58 */ "X", "Y", "Z", "\\[", "\\\\", "\\]", "^", "_",
60 /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g",
61 /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o",
62 /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w",
63 /* 0x78 */ "x", "y", "z", "{", "|", "}", "~", "",
64 };
65
66
67 static char* ansi [] = {
68 /* 0x80 */ "\\200","\\201","\\202","\\203",
69 /* 0x84 */ "\\204","\\205","\\206","\\207",
70 /* 0x88 */ "\\210","\\211","\\212","\\213",
71 /* 0x8c */ "\\214","\\215","\\216","\\217",
72 /* 0x90 */ "\\220","\\221","\\222","\\223",
73 /* 0x94 */ "\\224","\\225","\\226","\\227",
74 /* 0x98 */ "\\230","\\231","\\232","\\233",
75 /* 0x9c */ "\\234","\\235","\\236","\\237",
76 /* 0xa0 */ "\\240","\\241","\\242","\\243",
77 /* 0xa4 */ "\\244","\\245","\\246","\\247",
78 /* 0xa8 */ "\\250","\\251","\\252","\\253",
79 /* 0xac */ "\\254","\\255","\\256","\\257",
80 /* 0xb0 */ "\\260","\\261","\\262","\\263",
81 /* 0xb4 */ "\\264","\\265","\\266","\\267",
82 /* 0xb8 */ "\\270","\\271","\\272","\\273",
83 /* 0xbc */ "\\274","\\275","\\276","\\277",
84 /* 0xc0 */ "\\300","\\301","\\302","\\303",
85 /* 0xc4 */ "\\304","\\305","\\306","\\307",
86 /* 0xc8 */ "\\310","\\311","\\312","\\313",
87 /* 0xcc */ "\\314","\\315","\\316","\\317",
88 /* 0xd0 */ "\\320","\\321","\\322","\\323",
89 /* 0xd4 */ "\\324","\\325","\\326","\\327",
90 /* 0xd8 */ "\\330","\\331","\\332","\\333",
91 /* 0xdc */ "\\334","\\335","\\336","\\337",
92 /* 0xe0 */ "\\340","\\341","\\342","\\343",
93 /* 0xe4 */ "\\344","\\345","\\346","\\347",
94 /* 0xe8 */ "\\350","\\351","\\352","\\353",
95 /* 0xec */ "\\354","\\355","\\356","\\357",
96 /* 0xf0 */ "\\360","\\361","\\362","\\363",
97 /* 0xf4 */ "\\364","\\365","\\366","\\367",
98 /* 0xf8 */ "\\370","\\371","\\372","\\373",
99 /* 0xfc */ "\\374","\\375","\\376","\\377",
100 };
101
102
103 static char* mac [] = {
104 "?",
105 };
106
107 static char* cp437 [] = {
108 "?",
109 };
110
111 static char* cp850 [] = {
112 "?",
113 };
114
115
116
117
118 #define PS_END "\
119 %% --------- \n\n\
120 didShowPage not { \n\
121 showpage \n\
122 } if\n\n\
123 %%%%EOF\n"
124
125
126
127
128 #define PS_START "\
129 %%%%!PS\n\
130 %%--------------------------------------------------------------------------\n\
131 %% GNU UnRTF, a command-line program to convert RTF documents to other formats.\n\
132 %% Copyright (C) 2000,2001 Zachary Thayer Smith\n\
133 %%\n\
134 %% This program is free software; you can redistribute it and/or modify\n\
135 %% it under the terms of the GNU General Public License as published by\n\
136 %% the Free Software Foundation; either version 2 of the License, or\n\
137 %% (at your option) any later version.\n\
138 %%\n\
139 %% This program is distributed in the hope that it will be useful,\n\
140 %% but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
141 %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
142 %% GNU General Public License for more details.\n\
143 %%\n\
144 %% You should have received a copy of the GNU General Public License\n\
145 %% along with this program; if not, write to the Free Software\n\
146 %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\
147 %%\n\
148 %% The author is reachable by electronic mail at tuorfa@yahoo.com.\n\
149 %%--------------------------------------------------------------------------\n\
150 %%%%EndComments \n\
151 %%\n\
152 %% --------- Note, this PS code is unfinished -------- \n\
153 %% --------- Note, this PS code is unfinished -------- \n\
154 %% --------- Note, this PS code is unfinished -------- \n\
155 %% --------- Note, this PS code is unfinished -------- \n\
156 %% --------- Note, this PS code is unfinished -------- \n\
157 %%\n\
158 %% ----------- Variables ------------\n\
159 /fontFamily /Times def\n\
160 /fontAscent 0 def %% ascent for current font\n\
161 /fontDescent 0 def %% descent for current font\n\
162 /lineAscent 0 def \n\
163 /lineDescent 0 def \n\
164 /pageWidthInches 8.5 def \n\
165 /pageHeightInches 11 def \n\
166 /leftMargin 20 def \n\
167 /rightMargin 20 def \n\
168 /topMargin 20 def \n\
169 /bottomMargin 20 def \n\
170 /DPI 72 def \n\
171 /pageWidth pageWidthInches DPI mul def \n\
172 /rightLimit pageWidth rightMargin sub def \n\
173 /pageHeight pageHeightInches DPI mul def \n\
174 /x 0 def \n\
175 /y 0 def \n\
176 /bold false def \n\
177 /italic false def \n\
178 /underline false def \n\
179 /overline false def \n\
180 /intercharSpace 0 def \n\
181 /strike false def \n\
182 /outline false def \n\
183 /shadow false def \n\
184 /fontSize 12 def \n\
185 /didBR false def \n\
186 /didParSkip false def \n\
187 /didShowPage false def \n\
188 %%------------------------------------------------------\n\
189 %% Set up the ISO fonts \n\
190 \n\
191 %% Times \n\
192 %% ----- \n\
193 /Times-Roman findfont dup length dict begin { \n\
194 1 index /FID ne { def } { pop pop } ifelse \n\
195 } forall \n\
196 /Encoding ISOLatin1Encoding def \n\
197 currentdict end \n\
198 /TRomanISO exch definefont pop \n\n\
199 /Times-Bold findfont dup length dict begin { \n\
200 1 index /FID ne { def } { pop pop } ifelse \n\
201 } forall \n\
202 /Encoding ISOLatin1Encoding def \n\
203 currentdict end \n\
204 /TBoldISO exch definefont pop \n\n\
205 /Times-BoldItalic findfont dup length dict begin { \n\
206 1 index /FID ne { def } { pop pop } ifelse \n\
207 } forall \n\
208 /Encoding ISOLatin1Encoding def \n\
209 currentdict end \n\
210 /TBoldItalicISO exch definefont pop \n\n\
211 /Times-Italic findfont dup length dict begin { \n\
212 1 index /FID ne { def } { pop pop } ifelse \n\
213 } forall \n\
214 /Encoding ISOLatin1Encoding def \n\
215 currentdict end \n\
216 /TItalicISO exch definefont pop \n\n\
217 %% Courier \n\
218 %% ----- \n\
219 /Courier-Roman findfont dup length dict begin { \n\
220 1 index /FID ne { def } { pop pop } ifelse \n\
221 } forall \n\
222 /Encoding ISOLatin1Encoding def \n\
223 currentdict end \n\
224 /CRomanISO exch definefont pop \n\n\
225 /Courier-Bold findfont dup length dict begin { \n\
226 1 index /FID ne { def } { pop pop } ifelse \n\
227 } forall \n\
228 /Encoding ISOLatin1Encoding def \n\
229 currentdict end \n\
230 /CBoldISO exch definefont pop \n\n\
231 /Courier-BoldItalic findfont dup length dict begin { \n\
232 1 index /FID ne { def } { pop pop } ifelse \n\
233 } forall \n\
234 /Encoding ISOLatin1Encoding def \n\
235 currentdict end \n\
236 /CBoldItalicISO exch definefont pop \n\n\
237 /Courier-Italic findfont dup length dict begin { \n\
238 1 index /FID ne { def } { pop pop } ifelse \n\
239 } forall \n\
240 /Encoding ISOLatin1Encoding def \n\
241 currentdict end \n\
242 /CItalicISO exch definefont pop \n\n\
243 %% Symbol \n\
244 %% ----- \n\
245 /Symbol-Roman findfont dup length dict begin { \n\
246 1 index /FID ne { def } { pop pop } ifelse \n\
247 } forall \n\
248 /Encoding ISOLatin1Encoding def \n\
249 currentdict end \n\
250 /SRomanISO exch definefont pop \n\n\
251 /Symbol-Bold findfont dup length dict begin { \n\
252 1 index /FID ne { def } { pop pop } ifelse \n\
253 } forall \n\
254 /Encoding ISOLatin1Encoding def \n\
255 currentdict end \n\
256 /SBoldISO exch definefont pop \n\n\
257 /Symbol-BoldItalic findfont dup length dict begin { \n\
258 1 index /FID ne { def } { pop pop } ifelse \n\
259 } forall \n\
260 /Encoding ISOLatin1Encoding def \n\
261 currentdict end \n\
262 /SBoldItalicISO exch definefont pop \n\n\
263 /Symbol-Italic findfont dup length dict begin { \n\
264 1 index /FID ne { def } { pop pop } ifelse \n\
265 } forall \n\
266 /Encoding ISOLatin1Encoding def \n\
267 currentdict end \n\
268 /SItalicISO exch definefont pop \n\n\
269 %% Helvetica \n\
270 %% --------- \n\
271 /Helvetica-Roman findfont dup length dict begin { \n\
272 1 index /FID ne { def } { pop pop } ifelse \n\
273 } forall \n\
274 /Encoding ISOLatin1Encoding def \n\
275 currentdict end \n\
276 /HRomanISO exch definefont pop \n\n\
277 /Helvetica-Bold findfont dup length dict begin { \n\
278 1 index /FID ne { def } { pop pop } ifelse \n\
279 } forall \n\
280 /Encoding ISOLatin1Encoding def \n\
281 currentdict end \n\
282 /HBoldISO exch definefont pop \n\n\
283 /Helvetica-BoldOblique findfont dup length dict begin { \n\
284 1 index /FID ne { def } { pop pop } ifelse \n\
285 } forall \n\
286 /Encoding ISOLatin1Encoding def \n\
287 currentdict end \n\
288 /HBoldItalicISO exch definefont pop \n\n\
289 /Helvetica-Oblique findfont dup length dict begin { \n\
290 1 index /FID ne { def } { pop pop } ifelse \n\
291 } forall \n\
292 /Encoding ISOLatin1Encoding def \n\
293 currentdict end \n\
294 /HItalicISO exch definefont pop \n\n\
295 %% \n\
296 %% Ideally, before we can draw a line of text, we need to collect all the\n\
297 %% words that will be on it, just as I do in my Beest HTML viewer, as well\n\
298 %% as character attributes for each word. But for now, this implementation \n\
299 %% does not bother. It determines the maximize ascent and descent after\n\
300 %% drawing the text, not before. XX\n\
301 %% \n\
302 %% ----------- Functions ------------\n\
303 /updateFont { \n\
304 /f0 null def \n\
305 (Times) fontFamily eq (Times New Roman) fontFamily eq or { \n\
306 bold { \n\
307 italic { /TBoldItalicISO } { /TBoldISO } ifelse \n\
308 } { \n\
309 italic { /TItalicISO } { /TRomanISO } ifelse \n\
310 } \n\
311 ifelse \n\
312 } if \n\
313 (Helvetica) fontFamily eq (Arial) fontFamily eq or { \n\
314 bold { \n\
315 italic { /HBoldItalicISO } { /HBoldISO } ifelse \n\
316 } { \n\
317 italic { /HItalicISO } { /HRomanISO } ifelse \n\
318 } \n\
319 ifelse \n\
320 } if \n\
321 (Courier) fontFamily eq (Courier New) fontFamily eq or { \n\
322 bold { \n\
323 italic { /CBoldItalicISO } { /CBoldISO } ifelse \n\
324 } { \n\
325 italic { /CItalicISO } { /CRomanISO } ifelse \n\
326 } \n\
327 ifelse \n\
328 } if \n\
329 (Symbol) fontFamily eq { \n\
330 bold { \n\
331 italic { /SBoldItalicISO } { /SBoldISO } ifelse \n\
332 } { \n\
333 italic { /SItalicISO } { /SRomanISO } ifelse \n\
334 } \n\
335 ifelse \n\
336 } if \n\n\
337 findfont /f0 exch def \n\
338 /bboxBottom f0 /FontBBox get 1 get 1000 div fontSize mul -1 mul def \n\
339 /bboxTop f0 /FontBBox get 3 get 1000 div fontSize mul def \n\
340 f0 fontSize scalefont setfont \n\
341 lineAscent bboxTop lt { /lineAscent bboxTop def } if \n\
342 lineDescent bboxBottom lt { /lineDescent bboxBottom def } if \n\
343 /fontAscent bboxTop def \n\
344 /fontDescent bboxBottom def \n\
345 } def\n\
346 /FS { \n\
347 /fontSize exch def updateFont \n\
348 } def \n\
349 /F { \n\
350 /fontFamily exch def updateFont \n\
351 } def \n\
352 /resetX { \n\
353 /x leftMargin def\n\
354 } def \n\
355 /resetY { \n\
356 /y pageHeight topMargin sub def \n\
357 } def \n\
358 /BR { \n\
359 /oldx x def \n\
360 /y y lineAscent lineDescent add sub def \n\
361 resetX \n\
362 y bottomMargin lt { \n\
363 showpage \n\
364 /didShowPage true \n\
365 resetY \n\
366 } if \n\
367 oldx 0 eq didBR and { /didParSkip true def } if \n\
368 /didBR true def \n\
369 % /lineAscent 0 def \n\
370 % /lineDescent 0 def \n\
371 } def \n\
372 /P { \n\
373 didParSkip not { BR } if \n\
374 didParSkip not { BR } if \n\
375 } \n\
376 def \n\
377 /acharpath { \n\
378 /acstr exch def pop /acsp exch def \n\
379 newpath \n\
380 str { \n\
381 /ch exch def \n\
382 1 string 0 ch put false charpath \n\
383 acsp 0 rmoveto \n\
384 } forall \n\
385 } def \n\
386 /A { \n\
387 /str exch def \n\
388 /w str stringwidth pop \n\
389 str length intercharSpace mul add \n\
390 def \n\
391 x w add rightLimit ge { BR } if \n\
392 x y moveto \n\
393 outline { \n\
394 shadow { \n\
395 1 -0.1 0 { \n\
396 /offset exch def \n\
397 offset setgray \n\
398 x offset 3 mul add y offset 3 mul sub moveto \n\
399 intercharSpace 0 str acharpath \n\
400 %% str false charpath \n\
401 fontSize 30 div setlinewidth stroke \n\
402 } for \n\
403 0 setgray \n\
404 } { \n\
405 intercharSpace 0 str acharpath \n\
406 %% str false charpath \n\
407 fontSize 30 div setlinewidth stroke \n\
408 } ifelse \n\
409 } { \n\
410 shadow { \n\
411 1 -0.1 0 { \n\
412 /offset exch def \n\
413 offset setgray \n\
414 x offset 3 mul add y offset 3 mul sub moveto \n\
415 intercharSpace 0 str ashow \n\
416 %% str show \n\
417 } for \n\
418 0 setgray \n\
419 } { \n\
420 intercharSpace 0 str ashow \n\
421 %% str show \n\
422 } ifelse \n\
423 } ifelse \n\
424 strike { \n\
425 newpath fontSize 20 div setlinewidth \n\
426 x y fontAscent 0.32 mul add dup /y2 exch def moveto \n\
427 x w add y2 lineto stroke \n\
428 } if \n\
429 underline { \n\
430 newpath fontSize 20 div setlinewidth \n\
431 x y fontAscent 0.2 mul sub dup /y2 exch def moveto \n\
432 x w add y2 lineto stroke \n\
433 } if \n\
434 overline { \n\
435 %% I don't think RTF supports this, but it can be used later. \n\
436 newpath fontSize 20 div setlinewidth \n\
437 x y fontAscent 1.2 mul add dup /y2 exch def moveto \n\
438 x w add y2 lineto stroke \n\
439 } if \n\
440 /x x w add def \n\
441 /didBR false def \n\
442 /didShowPage false def \n\
443 } def \n\
444 \n\
445 %% These are only binary for now \n\
446 /X1 { /intercharSpace exch def } def\n\
447 /X0 { /intercharSpace 0 def } def\n\
448 /O1 { /outline false def } def\n\
449 /O0 { /outline false def } def\n\
450 /H1 { /shadow true def } def\n\
451 /H0 { /shadow false def } def\n\
452 /S1 { /strike true def } def\n\
453 /S0 { /strike false def } def\n\
454 /B1 { /bold true def updateFont } def\n\
455 /B0 { /bold false def updateFont } def\n\
456 /I1 { /italic true def updateFont } def\n\
457 /I0 { /italic false def updateFont } def\n\
458 /U1 { /underline true def } def\n\
459 /U0 { /underline false def } def\n\
460 updateFont \n\
461 resetX resetY \n\
462 \n\
463 "
464
465
466
467
468 /*========================================================================
469 * Name: ps_init
470 * Purpose: Generates an OutputPersonality object for the PostScript(TM)
471 * format.
472 * Args: None.
473 * Returns: OutputPersonality.
474 *=======================================================================*/
475
476 OutputPersonality *
477 ps_init (void)
478 {
479 OutputPersonality* op;
480
481 op = op_create();
482
483 op->comment_begin = "%% ";
484 op->comment_end = "\n";
485
486 op->word_begin = "(";
487 op->word_end = ")A ";
488
489 op->document_begin = PS_START;
490 op->document_end = PS_END;
491
492 op->header_begin = "%% header begin\n";
493 op->header_end = "%% header end\n";
494
495 op->document_title_begin = "%%%%Title: ";
496 op->document_title_end = "\n";
497
498 op->document_author_begin = "%%%%Creator: ";
499 op->document_author_end = "\n";
500
501 op->document_changedate_begin = "%% CHANGED: ";
502 op->document_changedate_end = "\n";
503
504 op->body_begin = "\n\n%% ---------- Document Body ------------\n";
505 op->body_end = "\n";
506
507 op->paragraph_begin = "P ";
508 op->paragraph_end = "\n";
509
510 op->center_begin = "";
511 op->center_end = "";
512
513 op->justify_begin = "";
514 op->justify_end = "";
515
516 op->align_left_begin = "";
517 op->align_left_end = "";
518
519 op->align_right_begin = "";
520 op->align_right_end = "";
521
522 op->forced_space = " ";
523 op->line_break = "BR\n";
524 op->page_break = "\n";
525
526 op->hyperlink_begin = "U1(";
527 op->hyperlink_end = ")A U0 ";
528
529 op->imagelink_begin = "";
530 op->imagelink_end = "";
531
532 op->table_begin = "\n% TABLE BEGINS (not implemented)\nP\n(TABLE)A BR\n";
533 op->table_end = "\n% TABLE ENDS (not implemented)\nP\n";
534
535 op->table_row_begin = "( )A ";
536 op->table_row_end = "( |)A BR\n";
537
538 op->table_cell_begin = "( | )A ";
539 op->table_cell_end = "";
540
541 /* Character attributes */
542 op->font_begin = "(%s) F ";
543 op->font_end = "";
544
545 op->fontsize_begin = "%s FS ";
546 op->fontsize_end = "";
547
548 op->smaller_begin = "";
549 op->smaller_end = "";
550
551 op->bigger_begin = "";
552 op->bigger_end = "";
553
554 op->foreground_begin = "";
555 op->foreground_end = "";
556
557 op->background_begin = "";
558 op->background_end = "";
559
560 op->bold_begin = "B1 ";
561 op->bold_end = "B0 ";
562
563 op->italic_begin = "I1 ";
564 op->italic_end = "I0 ";
565
566 op->underline_begin = "U1 ";
567 op->underline_end = "U0 ";
568
569 op->dbl_underline_begin = "U1 ";
570 op->dbl_underline_end = "U0 ";
571
572 op->superscript_begin = "";
573 op->superscript_end = "";
574
575 op->subscript_begin = "";
576 op->subscript_end = "";
577
578 op->strikethru_begin = "S1 ";
579 op->strikethru_end = "S0 ";
580
581 op->dbl_strikethru_begin = "S1 ";
582 op->dbl_strikethru_end = "S0 ";
583
584 op->emboss_begin="";
585 op->emboss_end = "";
586
587 op->engrave_begin = "";
588 op->engrave_end = "";
589
590 op->shadow_begin= "H1 ";
591 op->shadow_end= "H0 ";
592
593 op->outline_begin= "O1 ";
594 op->outline_end= "O0 ";
595
596 op->expand_begin = "%s X1 ";
597 op->expand_end = "X0 ";
598
599 op->simulate_small_caps = TRUE;
600 op->simulate_all_caps = TRUE;
601 op->simulate_word_underline = TRUE;
602
603 op->ascii_translation_table = ascii;
604
605 op->ansi_translation_table = ansi;
606 op->ansi_first_char = 0x80;
607 op->ansi_last_char = 0xff;
608
609 op->cp437_translation_table = cp437;
610 op->cp437_first_char = 0x80;
611 op->cp437_last_char = 0x80;
612
613 op->cp850_translation_table = cp850;
614 op->cp850_first_char = 0x80;
615 op->cp850_last_char = 0x80;
616
617 op->mac_translation_table = mac;
618 op->mac_first_char = 0x80;
619 op->mac_last_char = 0x80;
620
621 op->chars.right_quote = "'";
622 op->chars.left_quote = "`";
623 op->chars.right_dbl_quote = "''";
624 op->chars.left_dbl_quote = "``";
625
626 return op;
627 }
628
629
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: ps
25 * Author name: Zach Smith
26 * Create date: 19 Sep 01
27 * Purpose: Definitions for the PostScript(TM) output personality
28 *----------------------------------------------------------------------
29 * Changes:
30 *--------------------------------------------------------------------*/
31
32
33 #ifndef _PS
34
35
36 extern OutputPersonality* ps_init(void);
37
38
39 #define _PS
40 #endif
41
0 {\rtf1\ansi
1 { Je crois que j'irai au caf\'e9 o\'f9 on ne fume pas. }
2 { Credo che andr\'f2 a un caff\'e8 dove nessuno fuma. }
3 }
0 {\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f154\froman\fcharset238\fprq2 Times New Roman CE;}{\f155\froman\fcharset204\fprq2 Times New Roman Cyr;}
1 {\f157\froman\fcharset161\fprq2 Times New Roman Greek;}{\f158\froman\fcharset162\fprq2 Times New Roman Tur;}{\f159\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f160\froman\fcharset178\fprq2 Times New Roman (Arabic);}
2 {\f161\froman\fcharset186\fprq2 Times New Roman Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
3 \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{
4 \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*\cs10 \additive Default Paragraph Font;}{
5 \s15\qj \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext15 Body Text;}}{\info{\title Alignment test }{\author Aw Tuh}{\operator Opa Rey Ta}
6 {\creatim\yr2001\mo4\dy21\hr17\min36}{\revtim\yr2001\mo4\dy21\hr17\min36}{\version2}{\edmins0}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company Kawm Pani }{\nofcharsws0}{\vern8269}}
7 \widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1800\dgvorigin1440\dghshow1\dgvshow1
8 \jexpand\viewkind1\viewscale90\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule \fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl {\*\pnseclvl1
9 \pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5
10 \pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang
11 {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {
12 This is left-aligned text.
13 \par }\pard \qc \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {This is centered text.
14 \par }\pard \qr \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {This is right-aligned text.
15 \par }\pard\plain \s15\qj \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {This is justified text. This is justified text. This is justified text. This is justified text.
16 This is justified text. This is justified text. This is justified text.
17 \par }\pard \s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {This is left-aligned text again.
18 \par }\pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {
19 \par }}
0 {\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f58\froman\fcharset238\fprq2 Times New Roman CE;}{\f59\froman\fcharset204\fprq2 Times New Roman Cyr;}
1 {\f61\froman\fcharset161\fprq2 Times New Roman Greek;}{\f62\froman\fcharset162\fprq2 Times New Roman Tur;}{\f63\froman\fcharset186\fprq2 Times New Roman Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
2 \red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
3 \red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\widctlpar\adjustright \fs20\cgrid \snext0 Normal;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\title attribute test}{\author footy smelly}{\operator stinky}
4 {\creatim\yr2001\mo8\dy6\hr8\min1}{\revtim\yr2001\mo8\dy6\hr8\min6}{\version1}{\edmins5}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company whoknows}{\nofcharsws0}{\vern89}}
5 \widowctrl\ftnbj\aenddoc\formshade\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot \fet0\sectd \linex0\endnhere\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}
6 {\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}
7 {\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain
8 \widctlpar\adjustright \fs20\cgrid {\scaps This text is in small caps.
9 \par }{
10 \par }{\caps This text is in all caps.
11 \par }{
12 \par }{\shad This text is shadowed.
13 \par }{This is not shadowed.}{
14 \par }{\outl This text is outlined.
15 \par }{This is not outlined.}{
16 \par }{\embo\cf8 This text is embossed.
17 \par }{
18 \par }{\impr\cf8 This text is engraved.
19 \par }{
20 \par }{\ul This text is underlined.
21 \par }{\strike This text is struck.
22 \par }{
23 \par }{\striked1 This text is double-struck.
24 \par }{
25 \par }{\expnd4\expndtw20 This text is expanded.
26 \par }{
27 \par }{\expnd-4\expndtw-20 This text is condensed.
28 \par }{
29 \par
30 \par }}
0 { 1
1 { 2
2 { 3
3 { 4
4 { 5
5 { 6
6 { 7
7 { 8
8 { 9
9 { 10
10 { 11
11 { 12
12 { 13
13 { 14
14 { 15
15 { 16
16 { 17
17 { 18
18 { 19
19 { 20
20 { 21
21 { 22
22 { 23
23 { 24
24 { 25
25 { 26
26 { 27
27 { 28
28 { 29
29 { 30
30 { 31
31 { 32
32 { 33
33 { 34
34 { 35
35 { 36
36 { 37
37 { 38
38 { 39
39 { 40
40 { 41
41 { 42
42 { 43
43 { 44
44 { 45
45 { 46
46 { 47
47 { 48
48 { 49
49 { 50
50 { 51
51 { 52
52 { 53
53 { 54
54 { 55
55 { 56
56 { 57
57 { 58
58 { 59
59 { 60
60 { 61
61 { 62
62 { 63
63 { 64
64 { 65
65 { 66
66 { 67
67 { 68
68 { 69
69 { 70
70 { 71
71 { 72
72 { 73
73 { 74
74 { 75
75 { 76
76 { 77
77 { 78
78 { 79
79 { 80
80 { 81
81 { 82
82 { 83
83 { 84
84 { 85
85 { 86
86 { 87
87 { 88
88 { 89
89 { 90
90 { 91
91 { 92
92 { 93
93 { 94
94 { 95
95 { 96
96 { 97
97 { 98
98 { 99
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 }
0 {1 2 3{4 5 6}7 8 9}
0 {\rtf \ansi \par\par
1 char 0x20 = "\'20" \par
2 char 0x21 = "\'21" \par
3 char 0x22 = "\'22" \par
4 char 0x23 = "\'23" \par
5 char 0x24 = "\'24" \par
6 char 0x25 = "\'25" \par
7 char 0x26 = "\'26" \par
8 char 0x27 = "\'27" \par
9 char 0x28 = "\'28" \par
10 char 0x29 = "\'29" \par
11 char 0x2a = "\'2a" \par
12 char 0x2b = "\'2b" \par
13 char 0x2c = "\'2c" \par
14 char 0x2d = "\'2d" \par
15 char 0x2e = "\'2e" \par
16 char 0x2f = "\'2f" \par
17 char 0x30 = "\'30" \par
18 char 0x31 = "\'31" \par
19 char 0x32 = "\'32" \par
20 char 0x33 = "\'33" \par
21 char 0x34 = "\'34" \par
22 char 0x35 = "\'35" \par
23 char 0x36 = "\'36" \par
24 char 0x37 = "\'37" \par
25 char 0x38 = "\'38" \par
26 char 0x39 = "\'39" \par
27 char 0x3a = "\'3a" \par
28 char 0x3b = "\'3b" \par
29 char 0x3c = "\'3c" \par
30 char 0x3d = "\'3d" \par
31 char 0x3e = "\'3e" \par
32 char 0x3f = "\'3f" \par
33 char 0x40 = "\'40" \par
34 char 0x41 = "\'41" \par
35 char 0x42 = "\'42" \par
36 char 0x43 = "\'43" \par
37 char 0x44 = "\'44" \par
38 char 0x45 = "\'45" \par
39 char 0x46 = "\'46" \par
40 char 0x47 = "\'47" \par
41 char 0x48 = "\'48" \par
42 char 0x49 = "\'49" \par
43 char 0x4a = "\'4a" \par
44 char 0x4b = "\'4b" \par
45 char 0x4c = "\'4c" \par
46 char 0x4d = "\'4d" \par
47 char 0x4e = "\'4e" \par
48 char 0x4f = "\'4f" \par
49 char 0x50 = "\'50" \par
50 char 0x51 = "\'51" \par
51 char 0x52 = "\'52" \par
52 char 0x53 = "\'53" \par
53 char 0x54 = "\'54" \par
54 char 0x55 = "\'55" \par
55 char 0x56 = "\'56" \par
56 char 0x57 = "\'57" \par
57 char 0x58 = "\'58" \par
58 char 0x59 = "\'59" \par
59 char 0x5a = "\'5a" \par
60 char 0x5b = "\'5b" \par
61 char 0x5c = "\'5c" \par
62 char 0x5d = "\'5d" \par
63 char 0x5e = "\'5e" \par
64 char 0x5f = "\'5f" \par
65 char 0x60 = "\'60" \par
66 char 0x61 = "\'61" \par
67 char 0x62 = "\'62" \par
68 char 0x63 = "\'63" \par
69 char 0x64 = "\'64" \par
70 char 0x65 = "\'65" \par
71 char 0x66 = "\'66" \par
72 char 0x67 = "\'67" \par
73 char 0x68 = "\'68" \par
74 char 0x69 = "\'69" \par
75 char 0x6a = "\'6a" \par
76 char 0x6b = "\'6b" \par
77 char 0x6c = "\'6c" \par
78 char 0x6d = "\'6d" \par
79 char 0x6e = "\'6e" \par
80 char 0x6f = "\'6f" \par
81 char 0x70 = "\'70" \par
82 char 0x71 = "\'71" \par
83 char 0x72 = "\'72" \par
84 char 0x73 = "\'73" \par
85 char 0x74 = "\'74" \par
86 char 0x75 = "\'75" \par
87 char 0x76 = "\'76" \par
88 char 0x77 = "\'77" \par
89 char 0x78 = "\'78" \par
90 char 0x79 = "\'79" \par
91 char 0x7a = "\'7a" \par
92 char 0x7b = "\'7b" \par
93 char 0x7c = "\'7c" \par
94 char 0x7d = "\'7d" \par
95 char 0x7e = "\'7e" \par
96 char 0x7f = "\'7f" \par
97 char 0x80 = "\'80" \par
98 char 0x81 = "\'81" \par
99 char 0x82 = "\'82" \par
100 char 0x83 = "\'83" \par
101 char 0x84 = "\'84" \par
102 char 0x85 = "\'85" \par
103 char 0x86 = "\'86" \par
104 char 0x87 = "\'87" \par
105 char 0x88 = "\'88" \par
106 char 0x89 = "\'89" \par
107 char 0x8a = "\'8a" \par
108 char 0x8b = "\'8b" \par
109 char 0x8c = "\'8c" \par
110 char 0x8d = "\'8d" \par
111 char 0x8e = "\'8e" \par
112 char 0x8f = "\'8f" \par
113 char 0x90 = "\'90" \par
114 char 0x91 = "\'91" \par
115 char 0x92 = "\'92" \par
116 char 0x93 = "\'93" \par
117 char 0x94 = "\'94" \par
118 char 0x95 = "\'95" \par
119 char 0x96 = "\'96" \par
120 char 0x97 = "\'97" \par
121 char 0x98 = "\'98" \par
122 char 0x99 = "\'99" \par
123 char 0x9a = "\'9a" \par
124 char 0x9b = "\'9b" \par
125 char 0x9c = "\'9c" \par
126 char 0x9d = "\'9d" \par
127 char 0x9e = "\'9e" \par
128 char 0x9f = "\'9f" \par
129 char 0xa0 = "\'a0" \par
130 char 0xa1 = "\'a1" \par
131 char 0xa2 = "\'a2" \par
132 char 0xa3 = "\'a3" \par
133 char 0xa4 = "\'a4" \par
134 char 0xa5 = "\'a5" \par
135 char 0xa6 = "\'a6" \par
136 char 0xa7 = "\'a7" \par
137 char 0xa8 = "\'a8" \par
138 char 0xa9 = "\'a9" \par
139 char 0xaa = "\'aa" \par
140 char 0xab = "\'ab" \par
141 char 0xac = "\'ac" \par
142 char 0xad = "\'ad" \par
143 char 0xae = "\'ae" \par
144 char 0xaf = "\'af" \par
145 char 0xb0 = "\'b0" \par
146 char 0xb1 = "\'b1" \par
147 char 0xb2 = "\'b2" \par
148 char 0xb3 = "\'b3" \par
149 char 0xb4 = "\'b4" \par
150 char 0xb5 = "\'b5" \par
151 char 0xb6 = "\'b6" \par
152 char 0xb7 = "\'b7" \par
153 char 0xb8 = "\'b8" \par
154 char 0xb9 = "\'b9" \par
155 char 0xba = "\'ba" \par
156 char 0xbb = "\'bb" \par
157 char 0xbc = "\'bc" \par
158 char 0xbd = "\'bd" \par
159 char 0xbe = "\'be" \par
160 char 0xbf = "\'bf" \par
161 char 0xc0 = "\'c0" \par
162 char 0xc1 = "\'c1" \par
163 char 0xc2 = "\'c2" \par
164 char 0xc3 = "\'c3" \par
165 char 0xc4 = "\'c4" \par
166 char 0xc5 = "\'c5" \par
167 char 0xc6 = "\'c6" \par
168 char 0xc7 = "\'c7" \par
169 char 0xc8 = "\'c8" \par
170 char 0xc9 = "\'c9" \par
171 char 0xca = "\'ca" \par
172 char 0xcb = "\'cb" \par
173 char 0xcc = "\'cc" \par
174 char 0xcd = "\'cd" \par
175 char 0xce = "\'ce" \par
176 char 0xcf = "\'cf" \par
177 char 0xd0 = "\'d0" \par
178 char 0xd1 = "\'d1" \par
179 char 0xd2 = "\'d2" \par
180 char 0xd3 = "\'d3" \par
181 char 0xd4 = "\'d4" \par
182 char 0xd5 = "\'d5" \par
183 char 0xd6 = "\'d6" \par
184 char 0xd7 = "\'d7" \par
185 char 0xd8 = "\'d8" \par
186 char 0xd9 = "\'d9" \par
187 char 0xda = "\'da" \par
188 char 0xdb = "\'db" \par
189 char 0xdc = "\'dc" \par
190 char 0xdd = "\'dd" \par
191 char 0xde = "\'de" \par
192 char 0xdf = "\'df" \par
193 char 0xe0 = "\'e0" \par
194 char 0xe1 = "\'e1" \par
195 char 0xe2 = "\'e2" \par
196 char 0xe3 = "\'e3" \par
197 char 0xe4 = "\'e4" \par
198 char 0xe5 = "\'e5" \par
199 char 0xe6 = "\'e6" \par
200 char 0xe7 = "\'e7" \par
201 char 0xe8 = "\'e8" \par
202 char 0xe9 = "\'e9" \par
203 char 0xea = "\'ea" \par
204 char 0xeb = "\'eb" \par
205 char 0xec = "\'ec" \par
206 char 0xed = "\'ed" \par
207 char 0xee = "\'ee" \par
208 char 0xef = "\'ef" \par
209 char 0xf0 = "\'f0" \par
210 char 0xf1 = "\'f1" \par
211 char 0xf2 = "\'f2" \par
212 char 0xf3 = "\'f3" \par
213 char 0xf4 = "\'f4" \par
214 char 0xf5 = "\'f5" \par
215 char 0xf6 = "\'f6" \par
216 char 0xf7 = "\'f7" \par
217 char 0xf8 = "\'f8" \par
218 char 0xf9 = "\'f9" \par
219 char 0xfa = "\'fa" \par
220 char 0xfb = "\'fb" \par
221 char 0xfc = "\'fc" \par
222 char 0xfd = "\'fd" \par
223 char 0xfe = "\'fe" \par
224 char 0xff = "\'ff" \par
225
226 }
227
0 {\rtf \mac \par\par
1 char 0x20 = "\'20" \par
2 char 0x21 = "\'21" \par
3 char 0x22 = "\'22" \par
4 char 0x23 = "\'23" \par
5 char 0x24 = "\'24" \par
6 char 0x25 = "\'25" \par
7 char 0x26 = "\'26" \par
8 char 0x27 = "\'27" \par
9 char 0x28 = "\'28" \par
10 char 0x29 = "\'29" \par
11 char 0x2a = "\'2a" \par
12 char 0x2b = "\'2b" \par
13 char 0x2c = "\'2c" \par
14 char 0x2d = "\'2d" \par
15 char 0x2e = "\'2e" \par
16 char 0x2f = "\'2f" \par
17 char 0x30 = "\'30" \par
18 char 0x31 = "\'31" \par
19 char 0x32 = "\'32" \par
20 char 0x33 = "\'33" \par
21 char 0x34 = "\'34" \par
22 char 0x35 = "\'35" \par
23 char 0x36 = "\'36" \par
24 char 0x37 = "\'37" \par
25 char 0x38 = "\'38" \par
26 char 0x39 = "\'39" \par
27 char 0x3a = "\'3a" \par
28 char 0x3b = "\'3b" \par
29 char 0x3c = "\'3c" \par
30 char 0x3d = "\'3d" \par
31 char 0x3e = "\'3e" \par
32 char 0x3f = "\'3f" \par
33 char 0x40 = "\'40" \par
34 char 0x41 = "\'41" \par
35 char 0x42 = "\'42" \par
36 char 0x43 = "\'43" \par
37 char 0x44 = "\'44" \par
38 char 0x45 = "\'45" \par
39 char 0x46 = "\'46" \par
40 char 0x47 = "\'47" \par
41 char 0x48 = "\'48" \par
42 char 0x49 = "\'49" \par
43 char 0x4a = "\'4a" \par
44 char 0x4b = "\'4b" \par
45 char 0x4c = "\'4c" \par
46 char 0x4d = "\'4d" \par
47 char 0x4e = "\'4e" \par
48 char 0x4f = "\'4f" \par
49 char 0x50 = "\'50" \par
50 char 0x51 = "\'51" \par
51 char 0x52 = "\'52" \par
52 char 0x53 = "\'53" \par
53 char 0x54 = "\'54" \par
54 char 0x55 = "\'55" \par
55 char 0x56 = "\'56" \par
56 char 0x57 = "\'57" \par
57 char 0x58 = "\'58" \par
58 char 0x59 = "\'59" \par
59 char 0x5a = "\'5a" \par
60 char 0x5b = "\'5b" \par
61 char 0x5c = "\'5c" \par
62 char 0x5d = "\'5d" \par
63 char 0x5e = "\'5e" \par
64 char 0x5f = "\'5f" \par
65 char 0x60 = "\'60" \par
66 char 0x61 = "\'61" \par
67 char 0x62 = "\'62" \par
68 char 0x63 = "\'63" \par
69 char 0x64 = "\'64" \par
70 char 0x65 = "\'65" \par
71 char 0x66 = "\'66" \par
72 char 0x67 = "\'67" \par
73 char 0x68 = "\'68" \par
74 char 0x69 = "\'69" \par
75 char 0x6a = "\'6a" \par
76 char 0x6b = "\'6b" \par
77 char 0x6c = "\'6c" \par
78 char 0x6d = "\'6d" \par
79 char 0x6e = "\'6e" \par
80 char 0x6f = "\'6f" \par
81 char 0x70 = "\'70" \par
82 char 0x71 = "\'71" \par
83 char 0x72 = "\'72" \par
84 char 0x73 = "\'73" \par
85 char 0x74 = "\'74" \par
86 char 0x75 = "\'75" \par
87 char 0x76 = "\'76" \par
88 char 0x77 = "\'77" \par
89 char 0x78 = "\'78" \par
90 char 0x79 = "\'79" \par
91 char 0x7a = "\'7a" \par
92 char 0x7b = "\'7b" \par
93 char 0x7c = "\'7c" \par
94 char 0x7d = "\'7d" \par
95 char 0x7e = "\'7e" \par
96 char 0x7f = "\'7f" \par
97 char 0x80 = "\'80" \par
98 char 0x81 = "\'81" \par
99 char 0x82 = "\'82" \par
100 char 0x83 = "\'83" \par
101 char 0x84 = "\'84" \par
102 char 0x85 = "\'85" \par
103 char 0x86 = "\'86" \par
104 char 0x87 = "\'87" \par
105 char 0x88 = "\'88" \par
106 char 0x89 = "\'89" \par
107 char 0x8a = "\'8a" \par
108 char 0x8b = "\'8b" \par
109 char 0x8c = "\'8c" \par
110 char 0x8d = "\'8d" \par
111 char 0x8e = "\'8e" \par
112 char 0x8f = "\'8f" \par
113 char 0x90 = "\'90" \par
114 char 0x91 = "\'91" \par
115 char 0x92 = "\'92" \par
116 char 0x93 = "\'93" \par
117 char 0x94 = "\'94" \par
118 char 0x95 = "\'95" \par
119 char 0x96 = "\'96" \par
120 char 0x97 = "\'97" \par
121 char 0x98 = "\'98" \par
122 char 0x99 = "\'99" \par
123 char 0x9a = "\'9a" \par
124 char 0x9b = "\'9b" \par
125 char 0x9c = "\'9c" \par
126 char 0x9d = "\'9d" \par
127 char 0x9e = "\'9e" \par
128 char 0x9f = "\'9f" \par
129 char 0xa0 = "\'a0" \par
130 char 0xa1 = "\'a1" \par
131 char 0xa2 = "\'a2" \par
132 char 0xa3 = "\'a3" \par
133 char 0xa4 = "\'a4" \par
134 char 0xa5 = "\'a5" \par
135 char 0xa6 = "\'a6" \par
136 char 0xa7 = "\'a7" \par
137 char 0xa8 = "\'a8" \par
138 char 0xa9 = "\'a9" \par
139 char 0xaa = "\'aa" \par
140 char 0xab = "\'ab" \par
141 char 0xac = "\'ac" \par
142 char 0xad = "\'ad" \par
143 char 0xae = "\'ae" \par
144 char 0xaf = "\'af" \par
145 char 0xb0 = "\'b0" \par
146 char 0xb1 = "\'b1" \par
147 char 0xb2 = "\'b2" \par
148 char 0xb3 = "\'b3" \par
149 char 0xb4 = "\'b4" \par
150 char 0xb5 = "\'b5" \par
151 char 0xb6 = "\'b6" \par
152 char 0xb7 = "\'b7" \par
153 char 0xb8 = "\'b8" \par
154 char 0xb9 = "\'b9" \par
155 char 0xba = "\'ba" \par
156 char 0xbb = "\'bb" \par
157 char 0xbc = "\'bc" \par
158 char 0xbd = "\'bd" \par
159 char 0xbe = "\'be" \par
160 char 0xbf = "\'bf" \par
161 char 0xc0 = "\'c0" \par
162 char 0xc1 = "\'c1" \par
163 char 0xc2 = "\'c2" \par
164 char 0xc3 = "\'c3" \par
165 char 0xc4 = "\'c4" \par
166 char 0xc5 = "\'c5" \par
167 char 0xc6 = "\'c6" \par
168 char 0xc7 = "\'c7" \par
169 char 0xc8 = "\'c8" \par
170 char 0xc9 = "\'c9" \par
171 char 0xca = "\'ca" \par
172 char 0xcb = "\'cb" \par
173 char 0xcc = "\'cc" \par
174 char 0xcd = "\'cd" \par
175 char 0xce = "\'ce" \par
176 char 0xcf = "\'cf" \par
177 char 0xd0 = "\'d0" \par
178 char 0xd1 = "\'d1" \par
179 char 0xd2 = "\'d2" \par
180 char 0xd3 = "\'d3" \par
181 char 0xd4 = "\'d4" \par
182 char 0xd5 = "\'d5" \par
183 char 0xd6 = "\'d6" \par
184 char 0xd7 = "\'d7" \par
185 char 0xd8 = "\'d8" \par
186 char 0xd9 = "\'d9" \par
187 char 0xda = "\'da" \par
188 char 0xdb = "\'db" \par
189 char 0xdc = "\'dc" \par
190 char 0xdd = "\'dd" \par
191 char 0xde = "\'de" \par
192 char 0xdf = "\'df" \par
193 char 0xe0 = "\'e0" \par
194 char 0xe1 = "\'e1" \par
195 char 0xe2 = "\'e2" \par
196 char 0xe3 = "\'e3" \par
197 char 0xe4 = "\'e4" \par
198 char 0xe5 = "\'e5" \par
199 char 0xe6 = "\'e6" \par
200 char 0xe7 = "\'e7" \par
201 char 0xe8 = "\'e8" \par
202 char 0xe9 = "\'e9" \par
203 char 0xea = "\'ea" \par
204 char 0xeb = "\'eb" \par
205 char 0xec = "\'ec" \par
206 char 0xed = "\'ed" \par
207 char 0xee = "\'ee" \par
208 char 0xef = "\'ef" \par
209 char 0xf0 = "\'f0" \par
210 char 0xf1 = "\'f1" \par
211 char 0xf2 = "\'f2" \par
212 char 0xf3 = "\'f3" \par
213 char 0xf4 = "\'f4" \par
214 char 0xf5 = "\'f5" \par
215 char 0xf6 = "\'f6" \par
216 char 0xf7 = "\'f7" \par
217 char 0xf8 = "\'f8" \par
218 char 0xf9 = "\'f9" \par
219 char 0xfa = "\'fa" \par
220 char 0xfb = "\'fb" \par
221 char 0xfc = "\'fc" \par
222 char 0xfd = "\'fd" \par
223 char 0xfe = "\'fe" \par
224 char 0xff = "\'ff" \par
225
226 }
227
0 {\rtf \pc \par\par
1 char 0x20 = "\'20" \par
2 char 0x21 = "\'21" \par
3 char 0x22 = "\'22" \par
4 char 0x23 = "\'23" \par
5 char 0x24 = "\'24" \par
6 char 0x25 = "\'25" \par
7 char 0x26 = "\'26" \par
8 char 0x27 = "\'27" \par
9 char 0x28 = "\'28" \par
10 char 0x29 = "\'29" \par
11 char 0x2a = "\'2a" \par
12 char 0x2b = "\'2b" \par
13 char 0x2c = "\'2c" \par
14 char 0x2d = "\'2d" \par
15 char 0x2e = "\'2e" \par
16 char 0x2f = "\'2f" \par
17 char 0x30 = "\'30" \par
18 char 0x31 = "\'31" \par
19 char 0x32 = "\'32" \par
20 char 0x33 = "\'33" \par
21 char 0x34 = "\'34" \par
22 char 0x35 = "\'35" \par
23 char 0x36 = "\'36" \par
24 char 0x37 = "\'37" \par
25 char 0x38 = "\'38" \par
26 char 0x39 = "\'39" \par
27 char 0x3a = "\'3a" \par
28 char 0x3b = "\'3b" \par
29 char 0x3c = "\'3c" \par
30 char 0x3d = "\'3d" \par
31 char 0x3e = "\'3e" \par
32 char 0x3f = "\'3f" \par
33 char 0x40 = "\'40" \par
34 char 0x41 = "\'41" \par
35 char 0x42 = "\'42" \par
36 char 0x43 = "\'43" \par
37 char 0x44 = "\'44" \par
38 char 0x45 = "\'45" \par
39 char 0x46 = "\'46" \par
40 char 0x47 = "\'47" \par
41 char 0x48 = "\'48" \par
42 char 0x49 = "\'49" \par
43 char 0x4a = "\'4a" \par
44 char 0x4b = "\'4b" \par
45 char 0x4c = "\'4c" \par
46 char 0x4d = "\'4d" \par
47 char 0x4e = "\'4e" \par
48 char 0x4f = "\'4f" \par
49 char 0x50 = "\'50" \par
50 char 0x51 = "\'51" \par
51 char 0x52 = "\'52" \par
52 char 0x53 = "\'53" \par
53 char 0x54 = "\'54" \par
54 char 0x55 = "\'55" \par
55 char 0x56 = "\'56" \par
56 char 0x57 = "\'57" \par
57 char 0x58 = "\'58" \par
58 char 0x59 = "\'59" \par
59 char 0x5a = "\'5a" \par
60 char 0x5b = "\'5b" \par
61 char 0x5c = "\'5c" \par
62 char 0x5d = "\'5d" \par
63 char 0x5e = "\'5e" \par
64 char 0x5f = "\'5f" \par
65 char 0x60 = "\'60" \par
66 char 0x61 = "\'61" \par
67 char 0x62 = "\'62" \par
68 char 0x63 = "\'63" \par
69 char 0x64 = "\'64" \par
70 char 0x65 = "\'65" \par
71 char 0x66 = "\'66" \par
72 char 0x67 = "\'67" \par
73 char 0x68 = "\'68" \par
74 char 0x69 = "\'69" \par
75 char 0x6a = "\'6a" \par
76 char 0x6b = "\'6b" \par
77 char 0x6c = "\'6c" \par
78 char 0x6d = "\'6d" \par
79 char 0x6e = "\'6e" \par
80 char 0x6f = "\'6f" \par
81 char 0x70 = "\'70" \par
82 char 0x71 = "\'71" \par
83 char 0x72 = "\'72" \par
84 char 0x73 = "\'73" \par
85 char 0x74 = "\'74" \par
86 char 0x75 = "\'75" \par
87 char 0x76 = "\'76" \par
88 char 0x77 = "\'77" \par
89 char 0x78 = "\'78" \par
90 char 0x79 = "\'79" \par
91 char 0x7a = "\'7a" \par
92 char 0x7b = "\'7b" \par
93 char 0x7c = "\'7c" \par
94 char 0x7d = "\'7d" \par
95 char 0x7e = "\'7e" \par
96 char 0x7f = "\'7f" \par
97 char 0x80 = "\'80" \par
98 char 0x81 = "\'81" \par
99 char 0x82 = "\'82" \par
100 char 0x83 = "\'83" \par
101 char 0x84 = "\'84" \par
102 char 0x85 = "\'85" \par
103 char 0x86 = "\'86" \par
104 char 0x87 = "\'87" \par
105 char 0x88 = "\'88" \par
106 char 0x89 = "\'89" \par
107 char 0x8a = "\'8a" \par
108 char 0x8b = "\'8b" \par
109 char 0x8c = "\'8c" \par
110 char 0x8d = "\'8d" \par
111 char 0x8e = "\'8e" \par
112 char 0x8f = "\'8f" \par
113 char 0x90 = "\'90" \par
114 char 0x91 = "\'91" \par
115 char 0x92 = "\'92" \par
116 char 0x93 = "\'93" \par
117 char 0x94 = "\'94" \par
118 char 0x95 = "\'95" \par
119 char 0x96 = "\'96" \par
120 char 0x97 = "\'97" \par
121 char 0x98 = "\'98" \par
122 char 0x99 = "\'99" \par
123 char 0x9a = "\'9a" \par
124 char 0x9b = "\'9b" \par
125 char 0x9c = "\'9c" \par
126 char 0x9d = "\'9d" \par
127 char 0x9e = "\'9e" \par
128 char 0x9f = "\'9f" \par
129 char 0xa0 = "\'a0" \par
130 char 0xa1 = "\'a1" \par
131 char 0xa2 = "\'a2" \par
132 char 0xa3 = "\'a3" \par
133 char 0xa4 = "\'a4" \par
134 char 0xa5 = "\'a5" \par
135 char 0xa6 = "\'a6" \par
136 char 0xa7 = "\'a7" \par
137 char 0xa8 = "\'a8" \par
138 char 0xa9 = "\'a9" \par
139 char 0xaa = "\'aa" \par
140 char 0xab = "\'ab" \par
141 char 0xac = "\'ac" \par
142 char 0xad = "\'ad" \par
143 char 0xae = "\'ae" \par
144 char 0xaf = "\'af" \par
145 char 0xb0 = "\'b0" \par
146 char 0xb1 = "\'b1" \par
147 char 0xb2 = "\'b2" \par
148 char 0xb3 = "\'b3" \par
149 char 0xb4 = "\'b4" \par
150 char 0xb5 = "\'b5" \par
151 char 0xb6 = "\'b6" \par
152 char 0xb7 = "\'b7" \par
153 char 0xb8 = "\'b8" \par
154 char 0xb9 = "\'b9" \par
155 char 0xba = "\'ba" \par
156 char 0xbb = "\'bb" \par
157 char 0xbc = "\'bc" \par
158 char 0xbd = "\'bd" \par
159 char 0xbe = "\'be" \par
160 char 0xbf = "\'bf" \par
161 char 0xc0 = "\'c0" \par
162 char 0xc1 = "\'c1" \par
163 char 0xc2 = "\'c2" \par
164 char 0xc3 = "\'c3" \par
165 char 0xc4 = "\'c4" \par
166 char 0xc5 = "\'c5" \par
167 char 0xc6 = "\'c6" \par
168 char 0xc7 = "\'c7" \par
169 char 0xc8 = "\'c8" \par
170 char 0xc9 = "\'c9" \par
171 char 0xca = "\'ca" \par
172 char 0xcb = "\'cb" \par
173 char 0xcc = "\'cc" \par
174 char 0xcd = "\'cd" \par
175 char 0xce = "\'ce" \par
176 char 0xcf = "\'cf" \par
177 char 0xd0 = "\'d0" \par
178 char 0xd1 = "\'d1" \par
179 char 0xd2 = "\'d2" \par
180 char 0xd3 = "\'d3" \par
181 char 0xd4 = "\'d4" \par
182 char 0xd5 = "\'d5" \par
183 char 0xd6 = "\'d6" \par
184 char 0xd7 = "\'d7" \par
185 char 0xd8 = "\'d8" \par
186 char 0xd9 = "\'d9" \par
187 char 0xda = "\'da" \par
188 char 0xdb = "\'db" \par
189 char 0xdc = "\'dc" \par
190 char 0xdd = "\'dd" \par
191 char 0xde = "\'de" \par
192 char 0xdf = "\'df" \par
193 char 0xe0 = "\'e0" \par
194 char 0xe1 = "\'e1" \par
195 char 0xe2 = "\'e2" \par
196 char 0xe3 = "\'e3" \par
197 char 0xe4 = "\'e4" \par
198 char 0xe5 = "\'e5" \par
199 char 0xe6 = "\'e6" \par
200 char 0xe7 = "\'e7" \par
201 char 0xe8 = "\'e8" \par
202 char 0xe9 = "\'e9" \par
203 char 0xea = "\'ea" \par
204 char 0xeb = "\'eb" \par
205 char 0xec = "\'ec" \par
206 char 0xed = "\'ed" \par
207 char 0xee = "\'ee" \par
208 char 0xef = "\'ef" \par
209 char 0xf0 = "\'f0" \par
210 char 0xf1 = "\'f1" \par
211 char 0xf2 = "\'f2" \par
212 char 0xf3 = "\'f3" \par
213 char 0xf4 = "\'f4" \par
214 char 0xf5 = "\'f5" \par
215 char 0xf6 = "\'f6" \par
216 char 0xf7 = "\'f7" \par
217 char 0xf8 = "\'f8" \par
218 char 0xf9 = "\'f9" \par
219 char 0xfa = "\'fa" \par
220 char 0xfb = "\'fb" \par
221 char 0xfc = "\'fc" \par
222 char 0xfd = "\'fd" \par
223 char 0xfe = "\'fe" \par
224 char 0xff = "\'ff" \par
225
226 }
227
0 {\rtf \pca \par\par
1 char 0x20 = "\'20" \par
2 char 0x21 = "\'21" \par
3 char 0x22 = "\'22" \par
4 char 0x23 = "\'23" \par
5 char 0x24 = "\'24" \par
6 char 0x25 = "\'25" \par
7 char 0x26 = "\'26" \par
8 char 0x27 = "\'27" \par
9 char 0x28 = "\'28" \par
10 char 0x29 = "\'29" \par
11 char 0x2a = "\'2a" \par
12 char 0x2b = "\'2b" \par
13 char 0x2c = "\'2c" \par
14 char 0x2d = "\'2d" \par
15 char 0x2e = "\'2e" \par
16 char 0x2f = "\'2f" \par
17 char 0x30 = "\'30" \par
18 char 0x31 = "\'31" \par
19 char 0x32 = "\'32" \par
20 char 0x33 = "\'33" \par
21 char 0x34 = "\'34" \par
22 char 0x35 = "\'35" \par
23 char 0x36 = "\'36" \par
24 char 0x37 = "\'37" \par
25 char 0x38 = "\'38" \par
26 char 0x39 = "\'39" \par
27 char 0x3a = "\'3a" \par
28 char 0x3b = "\'3b" \par
29 char 0x3c = "\'3c" \par
30 char 0x3d = "\'3d" \par
31 char 0x3e = "\'3e" \par
32 char 0x3f = "\'3f" \par
33 char 0x40 = "\'40" \par
34 char 0x41 = "\'41" \par
35 char 0x42 = "\'42" \par
36 char 0x43 = "\'43" \par
37 char 0x44 = "\'44" \par
38 char 0x45 = "\'45" \par
39 char 0x46 = "\'46" \par
40 char 0x47 = "\'47" \par
41 char 0x48 = "\'48" \par
42 char 0x49 = "\'49" \par
43 char 0x4a = "\'4a" \par
44 char 0x4b = "\'4b" \par
45 char 0x4c = "\'4c" \par
46 char 0x4d = "\'4d" \par
47 char 0x4e = "\'4e" \par
48 char 0x4f = "\'4f" \par
49 char 0x50 = "\'50" \par
50 char 0x51 = "\'51" \par
51 char 0x52 = "\'52" \par
52 char 0x53 = "\'53" \par
53 char 0x54 = "\'54" \par
54 char 0x55 = "\'55" \par
55 char 0x56 = "\'56" \par
56 char 0x57 = "\'57" \par
57 char 0x58 = "\'58" \par
58 char 0x59 = "\'59" \par
59 char 0x5a = "\'5a" \par
60 char 0x5b = "\'5b" \par
61 char 0x5c = "\'5c" \par
62 char 0x5d = "\'5d" \par
63 char 0x5e = "\'5e" \par
64 char 0x5f = "\'5f" \par
65 char 0x60 = "\'60" \par
66 char 0x61 = "\'61" \par
67 char 0x62 = "\'62" \par
68 char 0x63 = "\'63" \par
69 char 0x64 = "\'64" \par
70 char 0x65 = "\'65" \par
71 char 0x66 = "\'66" \par
72 char 0x67 = "\'67" \par
73 char 0x68 = "\'68" \par
74 char 0x69 = "\'69" \par
75 char 0x6a = "\'6a" \par
76 char 0x6b = "\'6b" \par
77 char 0x6c = "\'6c" \par
78 char 0x6d = "\'6d" \par
79 char 0x6e = "\'6e" \par
80 char 0x6f = "\'6f" \par
81 char 0x70 = "\'70" \par
82 char 0x71 = "\'71" \par
83 char 0x72 = "\'72" \par
84 char 0x73 = "\'73" \par
85 char 0x74 = "\'74" \par
86 char 0x75 = "\'75" \par
87 char 0x76 = "\'76" \par
88 char 0x77 = "\'77" \par
89 char 0x78 = "\'78" \par
90 char 0x79 = "\'79" \par
91 char 0x7a = "\'7a" \par
92 char 0x7b = "\'7b" \par
93 char 0x7c = "\'7c" \par
94 char 0x7d = "\'7d" \par
95 char 0x7e = "\'7e" \par
96 char 0x7f = "\'7f" \par
97 char 0x80 = "\'80" \par
98 char 0x81 = "\'81" \par
99 char 0x82 = "\'82" \par
100 char 0x83 = "\'83" \par
101 char 0x84 = "\'84" \par
102 char 0x85 = "\'85" \par
103 char 0x86 = "\'86" \par
104 char 0x87 = "\'87" \par
105 char 0x88 = "\'88" \par
106 char 0x89 = "\'89" \par
107 char 0x8a = "\'8a" \par
108 char 0x8b = "\'8b" \par
109 char 0x8c = "\'8c" \par
110 char 0x8d = "\'8d" \par
111 char 0x8e = "\'8e" \par
112 char 0x8f = "\'8f" \par
113 char 0x90 = "\'90" \par
114 char 0x91 = "\'91" \par
115 char 0x92 = "\'92" \par
116 char 0x93 = "\'93" \par
117 char 0x94 = "\'94" \par
118 char 0x95 = "\'95" \par
119 char 0x96 = "\'96" \par
120 char 0x97 = "\'97" \par
121 char 0x98 = "\'98" \par
122 char 0x99 = "\'99" \par
123 char 0x9a = "\'9a" \par
124 char 0x9b = "\'9b" \par
125 char 0x9c = "\'9c" \par
126 char 0x9d = "\'9d" \par
127 char 0x9e = "\'9e" \par
128 char 0x9f = "\'9f" \par
129 char 0xa0 = "\'a0" \par
130 char 0xa1 = "\'a1" \par
131 char 0xa2 = "\'a2" \par
132 char 0xa3 = "\'a3" \par
133 char 0xa4 = "\'a4" \par
134 char 0xa5 = "\'a5" \par
135 char 0xa6 = "\'a6" \par
136 char 0xa7 = "\'a7" \par
137 char 0xa8 = "\'a8" \par
138 char 0xa9 = "\'a9" \par
139 char 0xaa = "\'aa" \par
140 char 0xab = "\'ab" \par
141 char 0xac = "\'ac" \par
142 char 0xad = "\'ad" \par
143 char 0xae = "\'ae" \par
144 char 0xaf = "\'af" \par
145 char 0xb0 = "\'b0" \par
146 char 0xb1 = "\'b1" \par
147 char 0xb2 = "\'b2" \par
148 char 0xb3 = "\'b3" \par
149 char 0xb4 = "\'b4" \par
150 char 0xb5 = "\'b5" \par
151 char 0xb6 = "\'b6" \par
152 char 0xb7 = "\'b7" \par
153 char 0xb8 = "\'b8" \par
154 char 0xb9 = "\'b9" \par
155 char 0xba = "\'ba" \par
156 char 0xbb = "\'bb" \par
157 char 0xbc = "\'bc" \par
158 char 0xbd = "\'bd" \par
159 char 0xbe = "\'be" \par
160 char 0xbf = "\'bf" \par
161 char 0xc0 = "\'c0" \par
162 char 0xc1 = "\'c1" \par
163 char 0xc2 = "\'c2" \par
164 char 0xc3 = "\'c3" \par
165 char 0xc4 = "\'c4" \par
166 char 0xc5 = "\'c5" \par
167 char 0xc6 = "\'c6" \par
168 char 0xc7 = "\'c7" \par
169 char 0xc8 = "\'c8" \par
170 char 0xc9 = "\'c9" \par
171 char 0xca = "\'ca" \par
172 char 0xcb = "\'cb" \par
173 char 0xcc = "\'cc" \par
174 char 0xcd = "\'cd" \par
175 char 0xce = "\'ce" \par
176 char 0xcf = "\'cf" \par
177 char 0xd0 = "\'d0" \par
178 char 0xd1 = "\'d1" \par
179 char 0xd2 = "\'d2" \par
180 char 0xd3 = "\'d3" \par
181 char 0xd4 = "\'d4" \par
182 char 0xd5 = "\'d5" \par
183 char 0xd6 = "\'d6" \par
184 char 0xd7 = "\'d7" \par
185 char 0xd8 = "\'d8" \par
186 char 0xd9 = "\'d9" \par
187 char 0xda = "\'da" \par
188 char 0xdb = "\'db" \par
189 char 0xdc = "\'dc" \par
190 char 0xdd = "\'dd" \par
191 char 0xde = "\'de" \par
192 char 0xdf = "\'df" \par
193 char 0xe0 = "\'e0" \par
194 char 0xe1 = "\'e1" \par
195 char 0xe2 = "\'e2" \par
196 char 0xe3 = "\'e3" \par
197 char 0xe4 = "\'e4" \par
198 char 0xe5 = "\'e5" \par
199 char 0xe6 = "\'e6" \par
200 char 0xe7 = "\'e7" \par
201 char 0xe8 = "\'e8" \par
202 char 0xe9 = "\'e9" \par
203 char 0xea = "\'ea" \par
204 char 0xeb = "\'eb" \par
205 char 0xec = "\'ec" \par
206 char 0xed = "\'ed" \par
207 char 0xee = "\'ee" \par
208 char 0xef = "\'ef" \par
209 char 0xf0 = "\'f0" \par
210 char 0xf1 = "\'f1" \par
211 char 0xf2 = "\'f2" \par
212 char 0xf3 = "\'f3" \par
213 char 0xf4 = "\'f4" \par
214 char 0xf5 = "\'f5" \par
215 char 0xf6 = "\'f6" \par
216 char 0xf7 = "\'f7" \par
217 char 0xf8 = "\'f8" \par
218 char 0xf9 = "\'f9" \par
219 char 0xfa = "\'fa" \par
220 char 0xfb = "\'fb" \par
221 char 0xfc = "\'fc" \par
222 char 0xfd = "\'fd" \par
223 char 0xfe = "\'fe" \par
224 char 0xff = "\'ff" \par
225
226 }
227
0 {\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f16\froman\fcharset238\fprq2 Times New Roman CE;}{\f17\froman\fcharset204\fprq2 Times New Roman Cyr;}
1 {\f19\froman\fcharset161\fprq2 Times New Roman Greek;}{\f20\froman\fcharset162\fprq2 Times New Roman Tur;}{\f21\froman\fcharset186\fprq2 Times New Roman Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
2 \red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
3 \red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\widctlpar\adjustright \fs20\cgrid \snext0 Normal;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\title colors}{\author Footy Smelly}{\operator Stinky toes}
4 {\creatim\yr2001\mo7\dy24\hr14\min45}{\revtim\yr2001\mo7\dy24\hr14\min49}{\version1}{\edmins4}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company Poopies}{\nofcharsws0}{\vern89}}
5 \widowctrl\ftnbj\aenddoc\formshade\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot \fet0\sectd \linex0\endnhere\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}
6 {\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}
7 {\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain
8 \widctlpar\adjustright \fs20\cgrid {\cf6 This is red text}{.
9 \par }{\cf2 This is blue text.
10 \par }{\cf4 This is green text}{.
11 \par This text becomes }{\b bold, then }{\b\i italic, then }{\b\i\cf2 blue. Blue}{\b\i off. Italic }{\b off. Bold }{off.
12 \par
13 \par The follow text is red with a blue background:
14 \par \tab }{\fs48\cf6\highlight2 Red text with blue background.}{\fs48\cf6
15 \par }{...and now plain text; plain text is very plain.
16 \par
17 \par
18 \par }{\i
19 \par }}
0 {\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f16\froman\fcharset238\fprq2 Times New Roman CE;}{\f17\froman\fcharset204\fprq2 Times New Roman Cyr;}
1 {\f19\froman\fcharset161\fprq2 Times New Roman Greek;}{\f20\froman\fcharset162\fprq2 Times New Roman Tur;}{\f21\froman\fcharset186\fprq2 Times New Roman Baltic;}}{\colortbl\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
2 \red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
3 \red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\widctlpar\adjustright \fs20\cgrid \snext0 Normal;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\title colors}{\author Footy Smelly}{\operator Stinky toes}
4 {\creatim\yr2001\mo7\dy24\hr14\min45}{\revtim\yr2001\mo7\dy24\hr14\min49}{\version1}{\edmins4}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company Poopies}{\nofcharsws0}{\vern89}}
5 \widowctrl\ftnbj\aenddoc\formshade\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot \fet0\sectd \linex0\endnhere\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}
6 {\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}
7 {\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain
8 \widctlpar\adjustright \fs20\cgrid {\cf5 This is red text}{.
9 \par }{\cf1 This is blue text.
10 \par }{\cf3 This is green text}{.
11 \par This text becomes }{\b bold, then }{\b\i italic, then }{\b\i\cf1 blue. Blue}{\b\i off. Italic }{\b off. Bold }{off.
12 \par
13 \par The follow text is red with a blue background:
14 \par \tab }{\fs48\cf5\highlight1 Red text with blue background.}{\fs48\cf5
15 \par }{...and now plain text; plain text is very plain.
16 \par
17 \par
18 \par }{\i
19 \par }}
0 {\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
1 {\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f4\froman\fcharset0\fprq2{\*\panose 00000000000000000000}Times;}
2 {\f5\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Helvetica;}{\f6\fmodern\fcharset0\fprq1{\*\panose 00000000000000000000}Courier;}{\f7\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Geneva;}
3 {\f8\froman\fcharset0\fprq2{\*\panose 00000000000000000000}Tms Rmn;}{\f9\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Helv;}{\f10\froman\fcharset0\fprq2{\*\panose 00000000000000000000}MS Serif;}
4 {\f11\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}MS Sans Serif;}{\f12\froman\fcharset0\fprq2{\*\panose 00000000000000000000}New York;}{\f13\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}System;}
5 {\f14\fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}{\f15\fswiss\fcharset0\fprq3{\*\panose 020b0604030504040204}Tahoma;}{\f16\fmodern\fcharset0\fprq1{\*\panose 00000000000000000000}Letter Gothic;}
6 {\f17\fmodern\fcharset128\fprq2{\*\panose 020b0604020202020204}Arial Unicode MS;}{\f18\froman\fcharset238\fprq2 Times New Roman CE;}{\f19\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f21\froman\fcharset161\fprq2 Times New Roman Greek;}
7 {\f22\froman\fcharset162\fprq2 Times New Roman Tur;}{\f23\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f24\fswiss\fcharset238\fprq2 Arial CE;}{\f25\fswiss\fcharset204\fprq2 Arial Cyr;}{\f27\fswiss\fcharset161\fprq2 Arial Greek;}
8 {\f28\fswiss\fcharset162\fprq2 Arial Tur;}{\f29\fswiss\fcharset186\fprq2 Arial Baltic;}{\f30\fmodern\fcharset238\fprq1 Courier New CE;}{\f31\fmodern\fcharset204\fprq1 Courier New Cyr;}{\f33\fmodern\fcharset161\fprq1 Courier New Greek;}
9 {\f34\fmodern\fcharset162\fprq1 Courier New Tur;}{\f35\fmodern\fcharset186\fprq1 Courier New Baltic;}{\f122\fmodern\fcharset0\fprq2 Arial Unicode MS;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
10 \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;
11 \red192\green192\blue192;}{\stylesheet{\widctlpar\adjustright \cgrid \snext0 Normal;}{\s1\keepn\widctlpar\adjustright \fs36\cgrid \sbasedon0 \snext0 heading 1;}{\s2\keepn\widctlpar\adjustright \fs28\cgrid \sbasedon0 \snext0 heading 2;}{
12 \s3\keepn\widctlpar\adjustright \ul\cgrid \sbasedon0 \snext0 heading 3;}{\s4\keepn\widctlpar\adjustright \fs32\cgrid \sbasedon0 \snext0 heading 4;}{\s5\keepn\widctlpar\adjustright \fs28\ul\cgrid \sbasedon0 \snext0 heading 5;}{
13 \s6\keepn\widctlpar\adjustright \i\cgrid \sbasedon0 \snext0 heading 6;}{\s7\keepn\widctlpar\adjustright \b\cgrid \sbasedon0 \snext0 heading 7;}{\s8\keepn\widctlpar\adjustright \b\fs32\cgrid \sbasedon0 \snext0 heading 8;}{\s9\keepn\widctlpar\adjustright
14 \b\fs36\ul\cgrid \sbasedon0 \snext0 heading 9;}{\*\cs10 \additive Default Paragraph Font;}{\*\cs15 \additive \ul\cf2 \sbasedon10 Hyperlink;}{\s16\widctlpar\adjustright \cbpat9 \f15\cgrid \sbasedon0 \snext16 Document Map;}{\s17\widctlpar
15 \tqc\tx4320\tqr\tx8640\adjustright \cgrid \sbasedon0 \snext17 header;}{\s18\widctlpar\tqc\tx4320\tqr\tx8640\adjustright \cgrid \sbasedon0 \snext18 footer;}{\*\cs19 \additive \sbasedon10 page number;}{\*\cs20 \additive \ul\cf12 \sbasedon10
16 FollowedHyperlink;}{\*\cs21 \additive \b \sbasedon10 Strong;}}{\*\listtable{\list\listtemplateid67698703\listsimple{\listlevel\levelnfc0\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\fbias0
17 \fi-360\li360\jclisttab\tx360 }{\listname ;}\listid957219121}{\list\listtemplateid701910968\listsimple{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat0\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li360
18 \jclisttab\tx360 }{\listname ;}\listid1137333544}{\list\listtemplateid-1928320220\listsimple{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat555\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li360
19 \jclisttab\tx360 }{\listname ;}\listid1375692428}{\list\listtemplateid-1622355776{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat0\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\fbias0 \fi-360\li720\jclisttab\tx720 }
20 {\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li1440\jclisttab\tx1440 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext
21 \'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li2160\jclisttab\tx2160 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li2880\jclisttab\tx2880 }
22 {\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li3600\jclisttab\tx3600 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext
23 \'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li4320\jclisttab\tx4320 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li5040\jclisttab\tx5040 }
24 {\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li5760\jclisttab\tx5760 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext
25 \'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li6480\jclisttab\tx6480 }{\listname ;}\listid1463503336}{\list\listtemplateid-1877444064{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat0\levelspace360\levelindent0{\leveltext
26 \'01\u-3913 ?;}{\levelnumbers;}\fbias0 \fi-360\li360\jclisttab\tx360 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li1080\jclisttab\tx1080 }{\listlevel\levelnfc23
27 \leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li1800\jclisttab\tx1800 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext
28 \'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li2520\jclisttab\tx2520 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li3240\jclisttab\tx3240 }{\listlevel
29 \levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li3960\jclisttab\tx3960 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0
30 {\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li4680\jclisttab\tx4680 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li5400\jclisttab\tx5400 }
31 {\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li6120\jclisttab\tx6120 }{\listname ;}\listid1660425882}{\list\listtemplateid67698703\listsimple{\listlevel
32 \levelnfc0\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\fbias0 \fi-360\li360\jclisttab\tx360 }{\listname ;}\listid1680893012}{\list\listtemplateid1756634642{\listlevel\levelnfc23\leveljc0
33 \levelfollow0\levelstartat0\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\fbias0 \fi-360\li720\jclisttab\tx720 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}
34 \f2\fbias0 \fi-360\li1440\jclisttab\tx1440 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li2160\jclisttab\tx2160 }{\listlevel\levelnfc23\leveljc0
35 \levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li2880\jclisttab\tx2880 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext
36 \'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li3600\jclisttab\tx3600 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li4320\jclisttab\tx4320 }{\listlevel
37 \levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li5040\jclisttab\tx5040 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0
38 {\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li5760\jclisttab\tx5760 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li6480\jclisttab\tx6480 }
39 {\listname ;}\listid1860776333}{\list\listtemplateid-1420629404{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat0\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\fbias0 \fi-360\li720\jclisttab\tx720 }{\listlevel\levelnfc23
40 \leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li1440\jclisttab\tx1440 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext
41 \'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li2160\jclisttab\tx2160 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li2880\jclisttab\tx2880 }
42 {\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li3600\jclisttab\tx3600 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0
43 {\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li4320\jclisttab\tx4320 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li5040
44 \jclisttab\tx5040 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li5760\jclisttab\tx5760 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360
45 \levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li6480\jclisttab\tx6480 }{\listname ;}\listid2034959735}}{\*\listoverridetable{\listoverride\listid1463503336\listoverridecount0\ls1}{\listoverride\listid1375692428
46 \listoverridecount0\ls2}{\listoverride\listid957219121\listoverridecount0\ls3}{\listoverride\listid1680893012\listoverridecount0\ls4}{\listoverride\listid1137333544\listoverridecount0\ls5}{\listoverride\listid1860776333\listoverridecount0\ls6}
47 {\listoverride\listid2034959735\listoverridecount0\ls7}{\listoverride\listid1660425882\listoverridecount0\ls8}}{\*\revtbl {Unknown;}}{\info{\title font test }{\author student}{\operator Footy Smelly}{\creatim\yr2000\mo9\dy13\hr14\min50}
48 {\revtim\yr2000\mo9\dy13\hr14\min50}{\printim\yr2000\mo7\dy22\hr14\min14}{\version2}{\edmins1}{\nofpages1}{\nofwords16098}{\nofchars91762}{\*\company Poopy Poop}{\nofcharsws112690}{\vern89}}
49 \widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\viewkind4\viewscale75\pgbrdrhead\pgbrdrfoot \fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl {\header \pard\plain \s17\qr\widctlpar
50 \tqc\tx4320\tqr\tx8640\adjustright \cgrid {\field{\*\fldinst {\cs19 PAGE }}{\fldrslt {\cs19\lang1024 77}}}{
51 \par }}{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}
52 {\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8
53 \pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \s1\keepn\widctlpar\outlinelevel0\adjustright
54
55 {\f0 test using font 0 \par }
56 {\f1 test using font 1 \par }
57 {\f2 test using font 2 \par }
58 {\f3 test using font 3 \par }
59 {\f4 test using font 4 \par }
60 {\f10 test using font 10 \par }
61 {\f14 test using font 14 \par }
62 {\par} }
0 {\rtf1
1 { \fs24 This should be 12 point text }
2 { \fs32 This should be 16 point text }
3 }
0 {\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}
1 {\f4\froman\fcharset0\fprq2{\*\panose 00000000000000000000}Times;}{\f34\froman\fcharset238\fprq2 Times New Roman CE;}{\f35\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f37\froman\fcharset161\fprq2 Times New Roman Greek;}
2 {\f38\froman\fcharset162\fprq2 Times New Roman Tur;}{\f39\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f40\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f41\froman\fcharset186\fprq2 Times New Roman Baltic;}
3 {\f50\fmodern\fcharset238\fprq1 Courier New CE;}{\f51\fmodern\fcharset204\fprq1 Courier New Cyr;}{\f53\fmodern\fcharset161\fprq1 Courier New Greek;}{\f54\fmodern\fcharset162\fprq1 Courier New Tur;}{\f55\fmodern\fcharset177\fprq1 Courier New (Hebrew);}
4 {\f56\fmodern\fcharset178\fprq1 Courier New (Arabic);}{\f57\fmodern\fcharset186\fprq1 Courier New Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;
5 \red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{
6 \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\s1\ql \li0\ri0\keepn\widctlpar\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0
7 \f2\fs24\ul\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 heading 1;}{\*\cs10 \additive Default Paragraph Font;}{\s15\ql \li0\ri0\widctlpar\tqc\tx4320\tqr\tx8640\faauto\adjustright\rin0\lin0\itap0
8 \f4\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext15 header;}}{\info{\title ANOTHER TEST}{\author }{\operator }{\creatim\yr2001\mo4\dy21\hr19\min8}{\revtim\yr2001\mo4\dy21\hr19\min10}
9 {\version1}{\edmins2}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company }{\nofcharsws0}{\vern8269}}\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180
10 \dghorigin1800\dgvorigin1440\dghshow1\dgvshow1\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule \fet0\sectd
11 \linex0\endnhere\sectlinegrid360\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4
12 \pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}
13 {\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \s15\ql \li0\ri0\widctlpar\brdrb\brdrs\brdrw15\brsp20
14 \faauto\adjustright\rin0\lin0\itap0 \f4\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f2 ANOTHER TEST
15 \par }\pard \s15\ql \li0\ri0\widctlpar\faauto\adjustright\rin0\lin0\itap0 {\f2
16 \par }{\f2\ul ABC
17 \par }{\f2 Line 1
18 \par Line 2
19 \par Line 3
20 \par }\pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f2 Line 4
21 \par
22 \par }\pard\plain \s1\ql \li0\ri0\keepn\widctlpar\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0 \f2\fs24\ul\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {DEF
23 \par }\pard\plain \s15\ql \li0\ri0\widctlpar\faauto\adjustright\rin0\lin0\itap0 \f4\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f2 Line 1
24 \par Line 2
25 \par Line 3
26 \par }\pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f2 Line 4
27 \par }{
28 \par }}
Binary diff not shown
0 {\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
1 {\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f4\froman\fcharset0\fprq2{\*\panose 00000000000000000000}Times;}
2 {\f5\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Helvetica;}{\f6\fmodern\fcharset0\fprq1{\*\panose 00000000000000000000}Courier;}{\f7\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Geneva;}
3 {\f8\froman\fcharset0\fprq2{\*\panose 00000000000000000000}Tms Rmn;}{\f9\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Helv;}{\f10\froman\fcharset0\fprq2{\*\panose 00000000000000000000}MS Serif;}
4 {\f11\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}MS Sans Serif;}{\f12\froman\fcharset0\fprq2{\*\panose 00000000000000000000}New York;}{\f13\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}System;}
5 {\f14\fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}{\f15\fswiss\fcharset0\fprq3{\*\panose 020b0604030504040204}Tahoma;}{\f16\fmodern\fcharset0\fprq1{\*\panose 00000000000000000000}Letter Gothic;}
6 {\f17\fmodern\fcharset128\fprq2{\*\panose 020b0604020202020204}Arial Unicode MS;}{\f18\froman\fcharset238\fprq2 Times New Roman CE;}{\f19\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f21\froman\fcharset161\fprq2 Times New Roman Greek;}
7 {\f22\froman\fcharset162\fprq2 Times New Roman Tur;}{\f23\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f24\fswiss\fcharset238\fprq2 Arial CE;}{\f25\fswiss\fcharset204\fprq2 Arial Cyr;}{\f27\fswiss\fcharset161\fprq2 Arial Greek;}
8 {\f28\fswiss\fcharset162\fprq2 Arial Tur;}{\f29\fswiss\fcharset186\fprq2 Arial Baltic;}{\f30\fmodern\fcharset238\fprq1 Courier New CE;}{\f31\fmodern\fcharset204\fprq1 Courier New Cyr;}{\f33\fmodern\fcharset161\fprq1 Courier New Greek;}
9 {\f34\fmodern\fcharset162\fprq1 Courier New Tur;}{\f35\fmodern\fcharset186\fprq1 Courier New Baltic;}{\f122\fmodern\fcharset0\fprq2 Arial Unicode MS;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
10 \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;
11 \red192\green192\blue192;}{\stylesheet{\widctlpar\adjustright \cgrid \snext0 Normal;}{\s1\keepn\widctlpar\adjustright \fs36\cgrid \sbasedon0 \snext0 heading 1;}{\s2\keepn\widctlpar\adjustright \fs28\cgrid \sbasedon0 \snext0 heading 2;}{
12 \s3\keepn\widctlpar\adjustright \ul\cgrid \sbasedon0 \snext0 heading 3;}{\s4\keepn\widctlpar\adjustright \fs32\cgrid \sbasedon0 \snext0 heading 4;}{\s5\keepn\widctlpar\adjustright \fs28\ul\cgrid \sbasedon0 \snext0 heading 5;}{
13 \s6\keepn\widctlpar\adjustright \i\cgrid \sbasedon0 \snext0 heading 6;}{\s7\keepn\widctlpar\adjustright \b\cgrid \sbasedon0 \snext0 heading 7;}{\s8\keepn\widctlpar\adjustright \b\fs32\cgrid \sbasedon0 \snext0 heading 8;}{\s9\keepn\widctlpar\adjustright
14 \b\fs36\ul\cgrid \sbasedon0 \snext0 heading 9;}{\*\cs10 \additive Default Paragraph Font;}{\*\cs15 \additive \ul\cf2 \sbasedon10 Hyperlink;}{\s16\widctlpar\adjustright \cbpat9 \f15\cgrid \sbasedon0 \snext16 Document Map;}{\s17\widctlpar
15 \tqc\tx4320\tqr\tx8640\adjustright \cgrid \sbasedon0 \snext17 header;}{\s18\widctlpar\tqc\tx4320\tqr\tx8640\adjustright \cgrid \sbasedon0 \snext18 footer;}{\*\cs19 \additive \sbasedon10 page number;}{\*\cs20 \additive \ul\cf12 \sbasedon10
16 FollowedHyperlink;}{\*\cs21 \additive \b \sbasedon10 Strong;}}{\*\listtable{\list\listtemplateid67698703\listsimple{\listlevel\levelnfc0\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\fbias0
17 \fi-360\li360\jclisttab\tx360 }{\listname ;}\listid957219121}{\list\listtemplateid701910968\listsimple{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat0\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li360
18 \jclisttab\tx360 }{\listname ;}\listid1137333544}{\list\listtemplateid-1928320220\listsimple{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat555\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li360
19 \jclisttab\tx360 }{\listname ;}\listid1375692428}{\list\listtemplateid-1622355776{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat0\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\fbias0 \fi-360\li720\jclisttab\tx720 }
20 {\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li1440\jclisttab\tx1440 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext
21 \'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li2160\jclisttab\tx2160 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li2880\jclisttab\tx2880 }
22 {\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li3600\jclisttab\tx3600 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext
23 \'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li4320\jclisttab\tx4320 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li5040\jclisttab\tx5040 }
24 {\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li5760\jclisttab\tx5760 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext
25 \'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li6480\jclisttab\tx6480 }{\listname ;}\listid1463503336}{\list\listtemplateid-1877444064{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat0\levelspace360\levelindent0{\leveltext
26 \'01\u-3913 ?;}{\levelnumbers;}\fbias0 \fi-360\li360\jclisttab\tx360 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li1080\jclisttab\tx1080 }{\listlevel\levelnfc23
27 \leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li1800\jclisttab\tx1800 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext
28 \'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li2520\jclisttab\tx2520 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li3240\jclisttab\tx3240 }{\listlevel
29 \levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li3960\jclisttab\tx3960 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0
30 {\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li4680\jclisttab\tx4680 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li5400\jclisttab\tx5400 }
31 {\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li6120\jclisttab\tx6120 }{\listname ;}\listid1660425882}{\list\listtemplateid67698703\listsimple{\listlevel
32 \levelnfc0\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\fbias0 \fi-360\li360\jclisttab\tx360 }{\listname ;}\listid1680893012}{\list\listtemplateid1756634642{\listlevel\levelnfc23\leveljc0
33 \levelfollow0\levelstartat0\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\fbias0 \fi-360\li720\jclisttab\tx720 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}
34 \f2\fbias0 \fi-360\li1440\jclisttab\tx1440 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li2160\jclisttab\tx2160 }{\listlevel\levelnfc23\leveljc0
35 \levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li2880\jclisttab\tx2880 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext
36 \'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li3600\jclisttab\tx3600 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li4320\jclisttab\tx4320 }{\listlevel
37 \levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li5040\jclisttab\tx5040 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0
38 {\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li5760\jclisttab\tx5760 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li6480\jclisttab\tx6480 }
39 {\listname ;}\listid1860776333}{\list\listtemplateid-1420629404{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat0\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\fbias0 \fi-360\li720\jclisttab\tx720 }{\listlevel\levelnfc23
40 \leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li1440\jclisttab\tx1440 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext
41 \'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li2160\jclisttab\tx2160 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li2880\jclisttab\tx2880 }
42 {\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li3600\jclisttab\tx3600 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0
43 {\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li4320\jclisttab\tx4320 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li5040
44 \jclisttab\tx5040 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li5760\jclisttab\tx5760 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360
45 \levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li6480\jclisttab\tx6480 }{\listname ;}\listid2034959735}}{\*\listoverridetable{\listoverride\listid1463503336\listoverridecount0\ls1}{\listoverride\listid1375692428
46 \listoverridecount0\ls2}{\listoverride\listid957219121\listoverridecount0\ls3}{\listoverride\listid1680893012\listoverridecount0\ls4}{\listoverride\listid1137333544\listoverridecount0\ls5}{\listoverride\listid1860776333\listoverridecount0\ls6}
47 {\listoverride\listid2034959735\listoverridecount0\ls7}{\listoverride\listid1660425882\listoverridecount0\ls8}}{\*\revtbl {Unknown;}}{\info{\title font test }{\author student}{\operator Footy Smelly}{\creatim\yr2000\mo9\dy13\hr14\min50}
48 {\revtim\yr2000\mo9\dy13\hr14\min50}{\printim\yr2000\mo7\dy22\hr14\min14}{\version2}{\edmins1}{\nofpages1}{\nofwords16098}{\nofchars91762}{\*\company Poopy Poop}{\nofcharsws112690}{\vern89}}
49 \widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\viewkind4\viewscale75\pgbrdrhead\pgbrdrfoot \fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl {\header \pard\plain \s17\qr\widctlpar
50 \tqc\tx4320\tqr\tx8640\adjustright \cgrid {\field{\*\fldinst {\cs19 PAGE }}{\fldrslt {\cs19\lang1024 77}}}{
51 \par }}{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}
52 {\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8
53 \pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \s1\keepn\widctlpar\outlinelevel0\adjustright
54
55 {\f0test using font 0 \par }
56 {\f1test using font 1 \par }
57 {\f2test using font 2 \par }
58 {\f3test using font 3 \par }
59 {\f4test using font 4 \par }
60 {\f10test using font 10 \par }
61 {\f14test using font 14 \par }
62 {\par} }
0 {\rtf
1
2 \pard
3
4 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
5 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
6 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
7 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
8 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
9 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
10 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
11 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
12 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
13 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
14 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
15 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
16 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
17 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
18 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
19 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
20 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
21 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
22 { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point }
23
24
25
26 }
0 {\rtf1 this is a test of backslash before newline \
1 x \
2 y\
3 foo \
4 { fee }\
5 {{}}
6 }
7
0 {\rtf
1 \par
2 { e=mc\super 2 }
3 \par
4 { H\sub 2\sub0 0}
5 }
0 {\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f16\froman\fcharset238\fprq2 Times New Roman CE;}{\f17\froman\fcharset204\fprq2 Times New Roman Cyr;}
1 {\f19\froman\fcharset161\fprq2 Times New Roman Greek;}{\f20\froman\fcharset162\fprq2 Times New Roman Tur;}{\f21\froman\fcharset186\fprq2 Times New Roman Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
2 \red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
3 \red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\widctlpar\adjustright \fs20\cgrid \snext0 Normal;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\title 1}{\author }{\operator eep eep}
4 {\creatim\yr2000\mo9\dy15\hr14\min31}{\revtim\yr2000\mo9\dy15\hr14\min32}{\version1}{\edmins1}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company City of Poopy Poop}{\nofcharsws0}{\vern89}}
5 \widowctrl\ftnbj\aenddoc\formshade\viewkind4\viewscale75\pgbrdrhead\pgbrdrfoot \fet0\sectd \linex0\endnhere\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}
6 {\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}
7 {\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\trowd \trgaph108\trleft-108
8 \trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb
9 \cellx1663\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx3434\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx5205
10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx6976\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx8747
11 \pard\plain \widctlpar\intbl\adjustright \fs20\cgrid {\b 1\cell 2\cell 3\cell 4\cell 5\cell }\pard \widctlpar\intbl\adjustright {\row }\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10
12 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx1663\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
13 \brdrs\brdrw10 \cltxlrtb \cellx3434\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx5205\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
14 \brdrs\brdrw10 \cltxlrtb \cellx6976\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx8747\pard \widctlpar\intbl\adjustright {6\cell 7\cell 8\cell 9\cell 10\cell }\pard
15 \widctlpar\intbl\adjustright {\row }\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
16 \brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx1663\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx3434\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
17 \brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx5205\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx6976\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
18 \brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx8747\pard \widctlpar\intbl\adjustright {\ul 11\cell 12\cell 13\cell 14\cell 15\cell }\pard \widctlpar\intbl\adjustright {\row }\pard \widctlpar\adjustright {
19 \par }}
0 {\rtf
1
2 {
3 This is plain text.
4 \ul This is underlined.
5 \b1 This is bold underlined.
6 \i This is bold italic underlined.
7 \b0 This is italic underlined.
8 \ulnone This is italic.
9 }
10 \pard
11 This should be nothing.
12
13 }
0 {\rtf1\mac\ansicpg10000\uc1 \deff0\deflang1033\deflangfe1033{\upr{\fonttbl{\f4\fnil\fcharset256\fprq2{\*\panose 02000500000000000000}Times;}}{\*\ud{\fonttbl{\f4\fnil\fcharset256\fprq2{\*\panose 02000500000000000000}Times;}}}}{\colortbl;\red0\green0\blue0;
1 \red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
2 \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\widctlpar\adjustright \loch\af4\hich\af4\dbch\f4\cgrid \snext0 Normal;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\author O M L}
3 {\operator O M L}{\creatim\yr2001\mo8\dy6\hr17\min50}{\revtim\yr2001\mo8\dy6\hr17\min50}{\version1}{\edmins0}{\nofpages1}{\nofwords1}{\nofchars10}{\*\company Pooville}{\nofcharsws12}{\vern115}}
4 \paperw20160\paperh20160\margl7920\margr7920\margt8640\margb8640 \widowctrl\ftnbj\aenddoc\formshade\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot \fet0\sectd \linex0\endnhere\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}
5 {\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}
6 {\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9
7 \pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \widctlpar\adjustright \loch\af4\hich\af4\dbch\f4\cgrid {\lang1024
8 {\shp{\*\shpinst\shpleft1008\shptop432\shpright1440\shpbottom720\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz11\shplid1037{\sp{\sn shapeType}{\sv 20}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 1}}
9 {\sp{\sn shapePath}{\sv 4}}{\sp{\sn fFillOK}{\sv 0}}{\sp{\sn fFilled}{\sv 0}}{\sp{\sn fArrowheadsOK}{\sv 1}}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8203\dpline\dpptx432\dppty0\dpptx0\dppty288\dpx1008\dpy432\dpxsize432\dpysize288
10 \dplinew15\dplinecor0\dplinecog0\dplinecob0}}}{\shp{\*\shpinst\shpleft1008\shptop432\shpright1440\shpbottom432\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz10\shplid1036
11 {\sp{\sn shapeType}{\sv 20}}{\sp{\sn fFlipH}{\sv 1}}{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn shapePath}{\sv 4}}{\sp{\sn fFillOK}{\sv 0}}{\sp{\sn fFilled}{\sv 0}}{\sp{\sn fArrowheadsOK}{\sv 1}}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8202
12 \dpline\dpptx432\dppty0\dpptx0\dppty0\dpx1008\dpy432\dpxsize432\dpysize0\dplinew15\dplinecor0\dplinecog0\dplinecob0}}}
13 {\shp{\*\shpinst\shpleft1008\shptop144\shpright1440\shpbottom432\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz9\shplid1035{\sp{\sn shapeType}{\sv 20}}{\sp{\sn fFlipH}{\sv 1}}{\sp{\sn fFlipV}{\sv 0}}
14 {\sp{\sn shapePath}{\sv 4}}{\sp{\sn fFillOK}{\sv 0}}{\sp{\sn fFilled}{\sv 0}}{\sp{\sn fArrowheadsOK}{\sv 1}}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8201\dpline\dpptx432\dppty0\dpptx0\dppty288\dpx1008\dpy144\dpxsize432\dpysize288
15 \dplinew15\dplinecor0\dplinecog0\dplinecob0}}}{\shp{\*\shpinst\shpleft144\shptop432\shpright720\shpbottom432\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz8\shplid1034
16 {\sp{\sn shapeType}{\sv 20}}{\sp{\sn fFlipH}{\sv 1}}{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn shapePath}{\sv 4}}{\sp{\sn fFillOK}{\sv 0}}{\sp{\sn fFilled}{\sv 0}}{\sp{\sn fArrowheadsOK}{\sv 1}}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8200
17 \dpline\dpptx576\dppty0\dpptx0\dppty0\dpx144\dpy432\dpxsize576\dpysize0\dplinew15\dplinecor0\dplinecog0\dplinecob0}}}{\shp{\*\shpinst\shpleft144\shptop720\shpright720\shpbottom720\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz7\shplid1033
18 {\sp{\sn shapeType}{\sv 20}}{\sp{\sn fFlipH}{\sv 1}}{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn shapePath}{\sv 4}}{\sp{\sn fFillOK}{\sv 0}}{\sp{\sn fFilled}{\sv 0}}{\sp{\sn fArrowheadsOK}{\sv 1}}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8199
19 \dpline\dpptx576\dppty0\dpptx0\dppty0\dpx144\dpy720\dpxsize576\dpysize0\dplinew15\dplinecor0\dplinecog0\dplinecob0}}}{\shp{\*\shpinst\shpleft144\shptop144\shpright720\shpbottom720\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz6\shplid1032
20 {\sp{\sn shapeType}{\sv 20}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 1}}{\sp{\sn shapePath}{\sv 4}}{\sp{\sn fFillOK}{\sv 0}}{\sp{\sn fFilled}{\sv 0}}{\sp{\sn fArrowheadsOK}{\sv 1}}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8198
21 \dpline\dpptx576\dppty0\dpptx0\dppty576\dpx144\dpy144\dpxsize576\dpysize576\dplinew15\dplinecor0\dplinecog0\dplinecob0}}}
22 {\shp{\*\shpinst\shpleft144\shptop144\shpright720\shpbottom144\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz5\shplid1031{\sp{\sn shapeType}{\sv 20}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}
23 {\sp{\sn shapePath}{\sv 4}}{\sp{\sn fFillOK}{\sv 0}}{\sp{\sn fFilled}{\sv 0}}{\sp{\sn fArrowheadsOK}{\sv 1}}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8197\dpline\dpptx0\dppty0\dpptx576\dppty0\dpx144\dpy144\dpxsize576\dpysize0
24 \dplinew15\dplinecor0\dplinecog0\dplinecob0}}}{\shp{\*\shpinst\shpleft3888\shptop576\shpright3888\shpbottom2448\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz4\shplid1030
25 {\sp{\sn shapeType}{\sv 20}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 1}}{\sp{\sn shapePath}{\sv 4}}{\sp{\sn fFillOK}{\sv 0}}{\sp{\sn fFilled}{\sv 0}}
26 {\sp{\sn lineEndArrowhead}{\sv 1}}{\sp{\sn fArrowheadsOK}{\sv 1}}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8196\dpline\dpptx0\dppty0\dpptx0\dppty1872\dpx3888\dpy576\dpxsize0\dpysize1872\dplinew15\dplinecor0\dplinecog0\dplinecob0}}}
27 {\shp{\*\shpinst\shpleft3456\shptop288\shpright3456\shpbottom2448\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz3\shplid1029{\sp{\sn shapeType}{\sv 20}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}
28 {\sp{\sn shapePath}{\sv 4}}{\sp{\sn fFillOK}{\sv 0}}{\sp{\sn fFilled}{\sv 0}}{\sp{\sn lineEndArrowhead}{\sv 1}}{\sp{\sn fArrowheadsOK}{\sv 1}}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8195\dpline\dpptx0\dppty0\dpptx0\dppty2160
29 \dpx3456\dpy288\dpxsize0\dpysize2160\dplinew15\dplinecor0\dplinecog0\dplinecob0}}}{\shp{\*\shpinst\shpleft1440\shptop288\shpright3168\shpbottom1584\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz2\shplid1028
30 {\sp{\sn shapeType}{\sv 3}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8194\dpellipse\dpx1440\dpy288\dpxsize1728\dpysize1296
31 \dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr255\dpfillbgcg255\dpfillbgcb255\dpfillpat1\dplinew15\dplinecor0\dplinecog0\dplinecob0}}}
32 {\shp{\*\shpinst\shpleft864\shptop864\shpright2448\shpbottom2016\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz1\shplid1027
33 {\sp{\sn shapeType}{\sv 1}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8193\dprect\dpx864\dpy864\dpxsize1584\dpysize1152
34 \dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr255\dpfillbgcg255\dpfillbgcb255\dpfillpat1\dplinew15\dplinecor0\dplinecog0\dplinecob0}}}
35 {\shp{\*\shpinst\shpleft432\shptop1296\shpright1872\shpbottom2448\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026
36 {\sp{\sn shapeType}{\sv 1}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}}{\shprslt{\*\do\dobxcolumn\dobypara\dodhgt8192\dprect\dpx432\dpy1296\dpxsize1440\dpysize1152
37 \dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr255\dpfillbgcg255\dpfillbgcb255\dpfillpat1\dplinew15\dplinecor0\dplinecog0\dplinecob0}}}}{
38 \par }}
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: text
25 * Author name: Zach Smith
26 * Create date: 19 Sep 01
27 * Purpose: Plain text output module
28 *----------------------------------------------------------------------
29 * Changes:
30 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
31 *--------------------------------------------------------------------*/
32
33
34 #include <stdio.h>
35 #include <string.h>
36 #include "malloc.h"
37 #include "defs.h"
38 #include "error.h"
39 #include "main.h"
40 #include "output.h"
41
42
43 static char*
44 ascii_translation_table [96] = {
45 /* 0x20 */ " ", "!", "\"", "#", "$", "%", "&", "'",
46 /* 0x28 */ "(", ")", "*", "+", ",", "-", ".", "/",
47 /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7",
48 /* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?",
49 /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G",
50 /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O",
51 /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W",
52 /* 0x58 */ "X", "Y", "Z", "[", "\\", "]", "^", "_",
53 /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g",
54 /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o",
55 /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w",
56 /* 0x78 */ "x", "y", "z", "{", "|", "}", "~", "",
57 };
58
59 static char*
60 upper_translation_table [128] = {
61 "?", "?", "?", "?", "?", "?", "?", "?",
62 "?", "?", "?", "?", "?", "?", "?", "?",
63 "?", "?", "?", "?", "?", "?", "?", "?",
64 "?", "?", "?", "?", "?", "?", "?", "?",
65 "?", "?", "?", "?", "?", "?", "?", "?",
66 "?", "?", "?", "?", "?", "?", "?", "?",
67 "?", "?", "?", "?", "?", "?", "?", "?",
68 "?", "?", "?", "?", "?", "?", "?", "?",
69 "?", "?", "?", "?", "?", "?", "?", "?",
70 "?", "?", "?", "?", "?", "?", "?", "?",
71 "?", "?", "?", "?", "?", "?", "?", "?",
72 "?", "?", "?", "?", "?", "?", "?", "?",
73 "?", "?", "?", "?", "?", "?", "?", "?",
74 "?", "?", "?", "?", "?", "?", "?", "?",
75 "?", "?", "?", "?", "?", "?", "?", "?",
76 "?", "?", "?", "?", "?", "?", "?", "?",
77 };
78
79
80
81 /*========================================================================
82 * Name: text_init
83 * Purpose: Generates an output personality for the plain text format.
84 * Args: None.
85 * Returns: OutputPersonality.
86 *=======================================================================*/
87
88 OutputPersonality *
89 text_init (void)
90 {
91 OutputPersonality* text_op;
92
93 text_op = op_create();
94
95 text_op->comment_begin = "### ";
96 text_op->comment_end = "\n";
97
98 text_op->document_begin = "";
99 text_op->document_end = "";
100
101 text_op->header_begin = "";
102 text_op->header_end = "";
103
104 text_op->document_title_begin = "\nTITLE: ";
105 text_op->document_title_end = "\n";
106
107 text_op->document_author_begin = "\nAUTHOR: ";
108 text_op->document_author_end = "\n";
109
110 text_op->document_changedate_begin = "\nDATE: ";
111 text_op->document_changedate_end = "\n";
112
113 text_op->body_begin = "\n-----------------\n";
114 text_op->body_end = "";
115
116 text_op->paragraph_begin = "";
117 text_op->paragraph_end = "\n";
118
119 text_op->center_begin = "";
120 text_op->center_end = "";
121
122 text_op->justify_begin = "";
123 text_op->justify_end = "";
124
125 text_op->align_left_begin = "";
126 text_op->align_left_end = "";
127
128 text_op->align_right_begin = "";
129 text_op->align_right_end = "";
130
131 text_op->forced_space = " ";
132 text_op->line_break = "\n";
133 text_op->page_break = "\n";
134
135 text_op->hyperlink_begin = "";
136 text_op->hyperlink_end = "";
137
138 text_op->imagelink_begin = "";
139 text_op->imagelink_end = "";
140
141 text_op->table_begin = "\n";
142 text_op->table_end = "\n";
143
144 text_op->table_row_begin = "";
145 text_op->table_row_end = "\n";
146
147 text_op->table_cell_begin = "\t";
148 text_op->table_cell_end = "";
149
150 /* Character attributes */
151 text_op->font_begin = "";
152 text_op->font_end = "";
153
154 text_op->fontsize_begin = "";
155 text_op->fontsize_end = "";
156
157 text_op->fontsize8_begin = "";
158 text_op->fontsize8_end = "";
159 text_op->fontsize10_begin = "";
160 text_op->fontsize10_end = "";
161 text_op->fontsize12_begin = "";
162 text_op->fontsize12_end = "";
163 text_op->fontsize14_begin = "";
164 text_op->fontsize14_end = "";
165 text_op->fontsize18_begin = "";
166 text_op->fontsize18_end = "";
167 text_op->fontsize24_begin = "";
168 text_op->fontsize24_end = "";
169
170 text_op->smaller_begin = "";
171 text_op->smaller_end = "";
172
173 text_op->bigger_begin = "";
174 text_op->bigger_end = "";
175
176 text_op->foreground_begin = "";
177 text_op->foreground_end = "";
178
179 text_op->background_begin = "";
180 text_op->background_end = "";
181
182 text_op->bold_begin = "";
183 text_op->bold_end = "";
184
185 text_op->italic_begin = "";
186 text_op->italic_end = "";
187
188 text_op->underline_begin = "";
189 text_op->underline_end = "";
190
191 text_op->dbl_underline_begin = "";
192 text_op->dbl_underline_end = "";
193
194 text_op->superscript_begin = "";
195 text_op->superscript_end = "";
196
197 text_op->subscript_begin = "";
198 text_op->subscript_end = "";
199
200 text_op->strikethru_begin = "";
201 text_op->strikethru_end = "";
202
203 text_op->dbl_strikethru_begin = "";
204 text_op->dbl_strikethru_end = "";
205
206 text_op->emboss_begin="";
207 text_op->emboss_end = "";
208
209 text_op->engrave_begin = "";
210 text_op->engrave_end = "";
211
212 text_op->shadow_begin= "";
213 text_op->shadow_end= "";
214
215 text_op->outline_begin= "";
216 text_op->outline_end= "";
217
218 text_op->expand_begin = "";
219 text_op->expand_end = "";
220
221 text_op->pointlist_begin = "\n";
222 text_op->pointlist_end = "\n";
223 text_op->pointlist_item_begin = " * ";
224 text_op->pointlist_item_end = "\n";
225
226 text_op->numericlist_begin = "\n";
227 text_op->numericlist_end = "\n";
228 text_op->numericlist_item_begin = " # ";
229 text_op->numericlist_item_end = "\n";
230
231 text_op->simulate_small_caps = TRUE;
232 text_op->simulate_all_caps = TRUE;
233 text_op->simulate_word_underline = TRUE;
234
235 text_op->ascii_translation_table = ascii_translation_table;
236
237 text_op->ansi_translation_table = upper_translation_table;
238 text_op->ansi_first_char = 0x80;
239 text_op->ansi_last_char = 0xff;
240
241 text_op->cp437_translation_table = upper_translation_table;
242 text_op->cp437_first_char = 0x80;
243 text_op->cp437_last_char = 0xff;
244
245 text_op->cp850_translation_table = upper_translation_table;
246 text_op->cp850_first_char = 0x80;
247 text_op->cp850_last_char = 0xff;
248
249 text_op->mac_translation_table = upper_translation_table;
250 text_op->mac_first_char = 0x80;
251 text_op->mac_last_char = 0xff;
252
253 text_op->chars.right_quote = "'";
254 text_op->chars.left_quote = "`";
255 text_op->chars.right_dbl_quote = "''";
256 text_op->chars.left_dbl_quote = "``";
257
258 return text_op;
259 }
260
261
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: text
25 * Author name: Zach Smith
26 * Create date: 19 Sep 01
27 * Purpose: Definitions for the plain text output personality
28 *----------------------------------------------------------------------
29 * Changes:
30 *--------------------------------------------------------------------*/
31
32
33 #ifndef _TEXT
34
35
36 extern OutputPersonality* text_init(void);
37
38
39 #define _TEXT
40 #endif
41
0 .\" Copyright (C) Zachary Thayer Smith 2001
1 .\"
2 .\" This file may be copied under the conditions described
3 .\" in the GNU GENERAL PUBLIC LICENSE, Version 2, June 1991
4 .\" that should have been distributed together with this file.
5 .\"
6 .TH UNRTF "GNU UnRTF 0.19.2"
7 .SH NAME
8 UnRTF \- converts document in RTF format to other formats
9 .SH SYNOPSIS
10 .BI "unrtf [" options "] [" file... ]
11 .br
12 .sp
13 Options:
14 .BI [\-\-nopict]
15 .BI [\-\-html]
16 .BI [\-\-text]
17 .BI [\-\-vt]
18 .BI [\-\-latex]
19 .BI [\-\-ps]
20 .BI [\-\-wpml]
21 .BI [\-\-help]
22 .BI [\-\-version]
23 .br
24 .SH DESCRIPTION
25 The program
26 .B unrtf
27 is a converter from Rich Text Format (RTF) to a growing number
28 of document formats. At present it supports
29 Hypertext Markup Language (HTML), plain text, text with VT100 codes,
30 LaTeX, and PostScript.
31 All output formats except HTML are "alpha" i.e. limited and development
32 has just begun.
33 However with HTML, the program supports tables, fonts, embedded images,
34 hyperlinks, and paragraph alignment. Font support includes
35 face and size changes, as well as
36 typical attributes such as italic, bold,
37 underlining, strikethrough, smallcaps, allcaps, expand, compress
38 and both foreground and background colors.
39 Images are always stored to separate files in the current
40 directory, or they can be ignored.
41 .SH OPTIONS
42 .TP
43 \-\-nopict
44 disables the automatic storing of embedded pictures to
45 the current directory.
46 .TP
47 \-\-html
48 selects HTML output (default).
49 .TP
50 \-\-text
51 selects plain ASCII text output.
52 .TP
53 \-\-vt
54 selects text output with VT100 escape codes.
55 .TP
56 \-\-latex
57 selects output of a LaTeX document.
58 .TP
59 \-\-ps
60 selects PostScript output.
61 .TP
62 \-\-wpml
63 selects WPML output.
64 .TP
65 \-\-version
66 prints the program version.
67 .SH WEBSITE
68 http://www.gnu.org/software/unrtf/unrtf.html
69 .SH NOTES
70 Report bugs in the program to unrtf@gnu.ai.mit.edu.
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: util
25 * Author name: Zach Smith
26 * Create date: 01 Aug 01
27 * Purpose: Utility functions.
28 *----------------------------------------------------------------------
29 * Changes:
30 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
31 *--------------------------------------------------------------------*/
32
33
34
35 #include <stdlib.h>
36 #include <ctype.h>
37
38
39
40
41 /*========================================================================
42 * Name: h2toi
43 * Purpose: Converts a 2-digit hexadecimal value to an unsigned integer.
44 * Args: String.
45 * Returns: Integer.
46 *=======================================================================*/
47
48 /* Convert a two-char hexadecimal expression to an integer */
49 int
50 h2toi (char *s) {
51 int tmp;
52 int ch;
53 tmp = tolower(*s++);
54 if (tmp>'9') tmp-=('a'-10);
55 else tmp-='0';
56 ch=16*tmp;
57 tmp = tolower(*s++);
58 if (tmp>'9') tmp-=('a'-10);
59 else tmp-='0';
60 ch+=tmp;
61 return ch;
62 }
63
0
1
2 /*=============================================================================
3 GNU UnRTF, a command-line program to convert RTF documents to other formats.
4 Copyright (C) 2000,2001 Zachary Thayer Smith
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 The author is reachable by electronic mail at tuorfa@yahoo.com.
21 =============================================================================*/
22
23
24 /*----------------------------------------------------------------------
25 * Module name: util
26 * Author name: Zach Smith
27 * Create date: 1 Aug 2001
28 * Purpose: Definitions for util module.
29 *----------------------------------------------------------------------
30 * Changes:
31 *--------------------------------------------------------------------*/
32
33 extern int h2toi (char *);
+262
-0
vt.c less more
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: vt
25 * Author name: Zach Smith
26 * Create date: 19 Sep 01
27 * Purpose: text output with VT100 escape codes module
28 *----------------------------------------------------------------------
29 * Changes:
30 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
31 *--------------------------------------------------------------------*/
32
33
34 #include <stdio.h>
35 #include <string.h>
36 #include "malloc.h"
37 #include "defs.h"
38 #include "error.h"
39 #include "main.h"
40 #include "output.h"
41
42
43 static char*
44 ascii_translation_table [96] = {
45 /* 0x20 */ " ", "!", "\"", "#", "$", "%", "&", "'",
46 /* 0x28 */ "(", ")", "*", "+", ",", "-", ".", "/",
47 /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7",
48 /* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?",
49 /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G",
50 /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O",
51 /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W",
52 /* 0x58 */ "X", "Y", "Z", "[", "\\", "]", "^", "_",
53 /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g",
54 /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o",
55 /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w",
56 /* 0x78 */ "x", "y", "z", "{", "|", "}", "~", "",
57 };
58
59
60 static char*
61 upper_translation_table [128] = {
62 "?", "?", "?", "?", "?", "?", "?", "?",
63 "?", "?", "?", "?", "?", "?", "?", "?",
64 "?", "?", "?", "?", "?", "?", "?", "?",
65 "?", "?", "?", "?", "?", "?", "?", "?",
66 "?", "?", "?", "?", "?", "?", "?", "?",
67 "?", "?", "?", "?", "?", "?", "?", "?",
68 "?", "?", "?", "?", "?", "?", "?", "?",
69 "?", "?", "?", "?", "?", "?", "?", "?",
70 "?", "?", "?", "?", "?", "?", "?", "?",
71 "?", "?", "?", "?", "?", "?", "?", "?",
72 "?", "?", "?", "?", "?", "?", "?", "?",
73 "?", "?", "?", "?", "?", "?", "?", "?",
74 "?", "?", "?", "?", "?", "?", "?", "?",
75 "?", "?", "?", "?", "?", "?", "?", "?",
76 "?", "?", "?", "?", "?", "?", "?", "?",
77 "?", "?", "?", "?", "?", "?", "?", "?",
78 };
79
80
81 /*========================================================================
82 * Name: vt_init
83 * Purpose: Generates an output personality for the VT100 text format.
84 * Args: None.
85 * Returns: OutputPersonality.
86 *=======================================================================*/
87
88 OutputPersonality *
89 vt_init (void)
90 {
91 OutputPersonality* vt_op;
92
93 vt_op = op_create();
94
95 vt_op->comment_begin = "### ";
96 vt_op->comment_end = "\n";
97
98 vt_op->document_begin = "";
99 vt_op->document_end = "";
100
101 vt_op->header_begin = "";
102 vt_op->header_end = "";
103
104 vt_op->document_title_begin = "\nTITLE: ";
105 vt_op->document_title_end = "\n";
106
107 vt_op->document_author_begin = "\nAUTHOR: ";
108 vt_op->document_author_end = "\n";
109
110 vt_op->document_changedate_begin = "\nDATE: ";
111 vt_op->document_changedate_end = "\n";
112
113 vt_op->body_begin = "\n-----------------\n";
114 vt_op->body_end = "";
115
116 vt_op->paragraph_begin = "";
117 vt_op->paragraph_end = "\n";
118
119 vt_op->center_begin = "";
120 vt_op->center_end = "";
121
122 vt_op->justify_begin = "";
123 vt_op->justify_end = "";
124
125 vt_op->align_left_begin = "";
126 vt_op->align_left_end = "";
127
128 vt_op->align_right_begin = "";
129 vt_op->align_right_end = "";
130
131 vt_op->forced_space = " ";
132 vt_op->line_break = "\n";
133 vt_op->page_break = "\n";
134
135 vt_op->hyperlink_begin = "";
136 vt_op->hyperlink_end = "";
137
138 vt_op->imagelink_begin = "";
139 vt_op->imagelink_end = "";
140
141 vt_op->table_begin = "\n";
142 vt_op->table_end = "\n";
143
144 vt_op->table_row_begin = "";
145 vt_op->table_row_end = "\n";
146
147 vt_op->table_cell_begin = "\t";
148 vt_op->table_cell_end = "";
149
150 /* Character attributes */
151 vt_op->font_begin = "";
152 vt_op->font_end = "";
153
154 vt_op->fontsize_begin = "";
155 vt_op->fontsize_end = "";
156
157 vt_op->fontsize8_begin = "";
158 vt_op->fontsize8_end = "";
159 vt_op->fontsize10_begin = "";
160 vt_op->fontsize10_end = "";
161 vt_op->fontsize12_begin = "";
162 vt_op->fontsize12_end = "";
163 vt_op->fontsize14_begin = "";
164 vt_op->fontsize14_end = "";
165 vt_op->fontsize18_begin = "";
166 vt_op->fontsize18_end = "";
167 vt_op->fontsize24_begin = "";
168 vt_op->fontsize24_end = "";
169
170 vt_op->smaller_begin = "";
171 vt_op->smaller_end = "";
172
173 vt_op->bigger_begin = "";
174 vt_op->bigger_end = "";
175
176 vt_op->foreground_begin = "";
177 vt_op->foreground_end = "";
178
179 vt_op->background_begin = "";
180 vt_op->background_end = "";
181
182 vt_op->bold_begin = "\033[7m";
183 vt_op->bold_end = "\033[m";
184
185 vt_op->italic_begin = "\033[7m";
186 vt_op->italic_end = "\033[m";
187
188 vt_op->underline_begin = "\033[4m";
189 vt_op->underline_end = "\033[m";
190
191 vt_op->dbl_underline_begin = "";
192 vt_op->dbl_underline_end = "";
193
194 vt_op->superscript_begin = "";
195 vt_op->superscript_end = "";
196
197 vt_op->subscript_begin = "";
198 vt_op->subscript_end = "";
199
200 vt_op->strikethru_begin = "";
201 vt_op->strikethru_end = "";
202
203 vt_op->dbl_strikethru_begin = "";
204 vt_op->dbl_strikethru_end = "";
205
206 vt_op->emboss_begin="";
207 vt_op->emboss_end = "";
208
209 vt_op->engrave_begin = "";
210 vt_op->engrave_end = "";
211
212 vt_op->shadow_begin= "";
213 vt_op->shadow_end= "";
214
215 vt_op->outline_begin= "";
216 vt_op->outline_end= "";
217
218 vt_op->expand_begin = "";
219 vt_op->expand_end = "";
220
221 vt_op->pointlist_begin = "\n";
222 vt_op->pointlist_end = "\n";
223 vt_op->pointlist_item_begin = " * ";
224 vt_op->pointlist_item_end = "\n";
225
226 vt_op->numericlist_begin = "\n";
227 vt_op->numericlist_end = "\n";
228 vt_op->numericlist_item_begin = " # ";
229 vt_op->numericlist_item_end = "\n";
230
231 vt_op->simulate_small_caps = TRUE;
232 vt_op->simulate_all_caps = TRUE;
233 vt_op->simulate_word_underline = TRUE;
234
235 vt_op->ascii_translation_table = ascii_translation_table;
236
237 vt_op->ansi_translation_table = upper_translation_table;
238 vt_op->ansi_first_char = 0x80;
239 vt_op->ansi_last_char = 0xff;
240
241 vt_op->cp437_translation_table = upper_translation_table;
242 vt_op->cp437_first_char = 0x80;
243 vt_op->cp437_last_char = 0xff;
244
245 vt_op->cp850_translation_table = upper_translation_table;
246 vt_op->cp850_first_char = 0x80;
247 vt_op->cp850_last_char = 0xff;
248
249 vt_op->mac_translation_table = upper_translation_table;
250 vt_op->mac_first_char = 0x80;
251 vt_op->mac_last_char = 0xff;
252
253 vt_op->chars.right_quote = "'";
254 vt_op->chars.left_quote = "`";
255 vt_op->chars.right_dbl_quote = "''";
256 vt_op->chars.left_dbl_quote = "``";
257
258 return vt_op;
259 }
260
261
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: vt
25 * Author name: Zach Smith
26 * Create date: 19 Sep 01
27 * Purpose: Definitions for the VT text output personality
28 *----------------------------------------------------------------------
29 * Changes:
30 *--------------------------------------------------------------------*/
31
32
33 #ifndef _VT
34
35
36 extern OutputPersonality* vt_init(void);
37
38
39 #define _VT
40 #endif
41
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: word
25 * Author name: Zach Smith
26 * Create date: 01 Sep 00
27 * Purpose: Management of Word objects, which contain strings
28 * as well as other Words.
29 *----------------------------------------------------------------------
30 * Changes:
31 * 14 Oct 00, tuorfa@yahoo.com: fixed \fs bug (# is 2X the point size).
32 * 14 Oct 00, tuorfa@yahoo.com: fixed table data printing.
33 * 14 Oct 00, tuorfa@yahoo.com: protection against null entries in \info
34 * 14 Oct 00, tuorfa@yahoo.com: fixed printing of <body> again
35 * 14 Oct 00, tuorfa@yahoo.com: fixed closure of tables
36 * 15 Oct 00, tuorfa@yahoo.com: fixed font attributes preceding <tr><td>
37 * 15 Oct 00, tuorfa@yahoo.com: attributes now continue if >1 \cell in group
38 * 15 Oct 00, tuorfa@yahoo.com: fixed font-size bug, lack of </head>
39 * 7 Nov 00, tuorfa@yahoo.com: fixed \'## translatin bug
40 * 8 Apr 01, tuorfa@yahoo.com: added check for out of memory after malloc
41 * 21 Apr 01, tuorfa@yahoo.com: bug fixes regarding author, date
42 * 21 Apr 01, tuorfa@yahoo.com: added paragraph alignment
43 * 21 Apr 01, tuorfa@yahoo.com: fix for words getting lost after \par
44 * 24 Jul 01, tuorfa@yahoo.com: moved conversion code to convert.c
45 * 22 Sep 01, tuorfa@yahoo.com: moved word_dump to here from parse.c
46 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
47 *--------------------------------------------------------------------*/
48
49
50 #include <stdio.h>
51 #include <stdlib.h>
52 #include <ctype.h>
53 #include <string.h>
54
55 #include "defs.h"
56 #include "parse.h"
57 #include "malloc.h"
58 #include "main.h"
59 #include "error.h"
60 #include "word.h"
61 #include "hash.h"
62
63
64
65 /* For word_dump */
66 static int indent_level=0;
67
68
69
70
71 /*========================================================================
72 * Name: word_string
73 * Purpose: Obtains the string of a Word object. This involves accessing
74 * the Word hash.
75 * Args: Word*.
76 * Returns: String.
77 *=======================================================================*/
78
79 char *
80 word_string (Word *w) {
81 char *str;
82 CHECK_PARAM_NOT_NULL(w);
83 if (w->hash_index) str = hash_get_string (w->hash_index);
84 else str = NULL;
85 return str;
86 }
87
88
89
90 /*========================================================================
91 * Name: word_new
92 * Purpose: Instantiates a new Word object.
93 * Args: String.
94 * Returns: Word*.
95 *=======================================================================*/
96
97 Word *
98 word_new (char *str) {
99 Word * w;
100
101 w = (Word *) my_malloc(sizeof(Word));
102 if (!w)
103 error_handler ("out of memory");
104 memset ((void*) w, 0, sizeof(Word));
105 if (!w) error_handler ("cannot allocate a Word");
106
107 if (str) w->hash_index = hash_get_index (str);
108 else w->hash_index = 0;
109
110 return w;
111 }
112
113
114
115
116 /*========================================================================
117 * Name: word_free
118 * Purpose: Deallocates a Word object.
119 * Args: Word.
120 * Returns: None.
121 *=======================================================================*/
122
123 void word_free (Word *w) {
124 Word *prev;
125 Word *w2;
126
127 CHECK_PARAM_NOT_NULL(w);
128
129 while (w) {
130 w2 = w->child;
131 if (w2)
132 word_free(w2);
133
134 prev = w;
135 w = w->next;
136 my_free ((char*) prev);
137 }
138 }
139
140
141
142
143
144 /*========================================================================
145 * Name: print_indentation
146 * Purpose: Prints padding for the word_dump routine.
147 * Args: Identation level.
148 * Returns: None.
149 *=======================================================================*/
150
151 static void
152 print_indentation (int level)
153 {
154 int i;
155
156 if (level) {
157 for (i=0;i<level;i+=2)
158 printf (". ");
159 } else {
160 printf ("\n-----------------------------------------------------------------------\n\n");
161 }
162 }
163
164
165
166
167 /*========================================================================
168 * Name: word_dump
169 * Purpose: Recursive diagnostic routine to print out a tree of words.
170 * Args: Word tree.
171 * Returns: None.
172 *=======================================================================*/
173
174 void
175 word_dump (Word *w)
176 {
177 char *s;
178
179 CHECK_PARAM_NOT_NULL(w);
180
181 printf ("\n");
182 indent_level += 2;
183 print_indentation (indent_level);
184
185 while (w) {
186 s = word_string (w);
187 if (s) {
188 printf ("\"%s\" ", s);
189 } else {
190 if (w->child) {
191 word_dump (w->child);
192 printf ("\n");
193 print_indentation (indent_level);
194 }
195 else
196 warning_handler ("Word object has no string and no children");
197 }
198 w = w->next;
199 }
200
201 indent_level -= 2;
202 }
203
204
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: word.h
25 * Author name: Zach Smith
26 * Create date: 1 Sept 2000
27 * Purpose: Definitions for Word class.
28 *----------------------------------------------------------------------
29 * Changes:
30 *--------------------------------------------------------------------*/
31
32
33
34 #ifndef _WORD
35 #define _WORD
36
37
38 typedef struct _w {
39 unsigned long hash_index;
40 struct _w * next;
41 struct _w * child;
42 }
43 Word;
44
45
46 extern Word* word_new (char*);
47 extern void word_free (Word*);
48 extern Word* word_read (FILE*);
49 extern char* word_string (Word*);
50 extern void word_dump (Word*);
51 extern void word_print_html (Word*);
52
53
54 #define _WORD
55 #endif
56
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: wpml
25 * Author name: Zach Smith
26 * Create date: 19 Sep 01
27 * Purpose: WPML output module
28 * Note: WPML is my own format; it is a work-in-progress
29 *----------------------------------------------------------------------
30 * Changes:
31 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
32 *--------------------------------------------------------------------*/
33
34
35 #include <stdio.h>
36 #include <string.h>
37 #include "malloc.h"
38 #include "defs.h"
39 #include "error.h"
40 #include "main.h"
41 #include "output.h"
42
43
44 static char*
45 ascii_translation_table [96] = {
46 /* 0x20 */ " ", "!", "\"", "#", "$", "%", "&", "'",
47 /* 0x28 */ "(", ")", "*", "+", ",", "-", ".", "/",
48 /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7",
49 /* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?",
50 /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G",
51 /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O",
52 /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W",
53 /* 0x58 */ "X", "Y", "Z", "[", "\\", "]", "^", "_",
54 /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g",
55 /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o",
56 /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w",
57 /* 0x78 */ "x", "y", "z", "{", "|", "}", "~", "",
58 };
59
60 static char*
61 upper_translation_table [128] = {
62 "?", "?", "?", "?", "?", "?", "?", "?",
63 "?", "?", "?", "?", "?", "?", "?", "?",
64 "?", "?", "?", "?", "?", "?", "?", "?",
65 "?", "?", "?", "?", "?", "?", "?", "?",
66 "?", "?", "?", "?", "?", "?", "?", "?",
67 "?", "?", "?", "?", "?", "?", "?", "?",
68 "?", "?", "?", "?", "?", "?", "?", "?",
69 "?", "?", "?", "?", "?", "?", "?", "?",
70 "?", "?", "?", "?", "?", "?", "?", "?",
71 "?", "?", "?", "?", "?", "?", "?", "?",
72 "?", "?", "?", "?", "?", "?", "?", "?",
73 "?", "?", "?", "?", "?", "?", "?", "?",
74 "?", "?", "?", "?", "?", "?", "?", "?",
75 "?", "?", "?", "?", "?", "?", "?", "?",
76 "?", "?", "?", "?", "?", "?", "?", "?",
77 "?", "?", "?", "?", "?", "?", "?", "?",
78 };
79
80
81
82 /*========================================================================
83 * Name: wpml_init
84 * Purpose: Generates an output personality for the WPML format.
85 * Args: None.
86 * Returns: OutputPersonality.
87 *=======================================================================*/
88
89 OutputPersonality *
90 wpml_init (void)
91 {
92 OutputPersonality* wpml_op;
93
94 wpml_op = op_create();
95
96 wpml_op->comment_begin = "<!--";
97 wpml_op->comment_end = "-->\n";
98
99 wpml_op->document_begin = "<WPML>";
100 wpml_op->document_end = "</WPML>";
101
102 wpml_op->header_begin = "<HEAD>";
103 wpml_op->header_end = "</HEAD>";
104
105 wpml_op->document_title_begin = "<TITLE>";
106 wpml_op->document_title_end = "</TITLE>";
107
108 wpml_op->document_author_begin = "<AUTHOR>";
109 wpml_op->document_author_end = "</AUTHOR>\n";
110
111 wpml_op->document_changedate_begin = "<DATE>";
112 wpml_op->document_changedate_end = "</DATE>\n";
113
114 wpml_op->body_begin = "\n<BODY>\n";
115 wpml_op->body_end = "</BODY>";
116
117 wpml_op->paragraph_begin = "<LINE>";
118 wpml_op->paragraph_end = "</LINE>\n";
119
120 wpml_op->center_begin = "";
121 wpml_op->center_end = "";
122
123 wpml_op->justify_begin = "";
124 wpml_op->justify_end = "";
125
126 wpml_op->align_left_begin = "";
127 wpml_op->align_left_end = "";
128
129 wpml_op->align_right_begin = "";
130 wpml_op->align_right_end = "";
131
132 wpml_op->forced_space = " ";
133 wpml_op->line_break = "\n";
134 wpml_op->page_break = "\n";
135
136 wpml_op->hyperlink_begin = "";
137 wpml_op->hyperlink_end = "";
138
139 wpml_op->imagelink_begin = "";
140 wpml_op->imagelink_end = "";
141
142 wpml_op->table_begin = "<TABLE>\n";
143 wpml_op->table_end = "</TABLE>\n";
144
145 wpml_op->table_row_begin = "<TABLEROW>";
146 wpml_op->table_row_end = "</TABLEROW>\n";
147
148 wpml_op->table_cell_begin = "<TABLECELL>";
149 wpml_op->table_cell_end = "</TABLECELL>";
150
151 /* Character attributes */
152
153 /* XX: WPML will require that all elements that are now
154 * character attribute strings be converted to functions,
155 * so that a complete font description can be written
156 * each time an attribute begins or ends.
157 */
158
159 wpml_op->font_begin = "<FONT=\"%s\"/>";
160 wpml_op->font_end = "";
161
162 wpml_op->fontsize_begin = "";
163 wpml_op->fontsize_end = "";
164
165 wpml_op->fontsize8_begin = "";
166 wpml_op->fontsize8_end = "";
167 wpml_op->fontsize10_begin = "";
168 wpml_op->fontsize10_end = "";
169 wpml_op->fontsize12_begin = "";
170 wpml_op->fontsize12_end = "";
171 wpml_op->fontsize14_begin = "";
172 wpml_op->fontsize14_end = "";
173 wpml_op->fontsize18_begin = "";
174 wpml_op->fontsize18_end = "";
175 wpml_op->fontsize24_begin = "";
176 wpml_op->fontsize24_end = "";
177
178 wpml_op->smaller_begin = "";
179 wpml_op->smaller_end = "";
180
181 wpml_op->bigger_begin = "";
182 wpml_op->bigger_end = "";
183
184 wpml_op->foreground_begin = "";
185 wpml_op->foreground_end = "";
186
187 wpml_op->background_begin = "";
188 wpml_op->background_end = "";
189
190 wpml_op->bold_begin = "";
191 wpml_op->bold_end = "";
192
193 wpml_op->italic_begin = "";
194 wpml_op->italic_end = "";
195
196 wpml_op->underline_begin = "";
197 wpml_op->underline_end = "";
198
199 wpml_op->dbl_underline_begin = "";
200 wpml_op->dbl_underline_end = "";
201
202 wpml_op->superscript_begin = "";
203 wpml_op->superscript_end = "";
204
205 wpml_op->subscript_begin = "";
206 wpml_op->subscript_end = "";
207
208 wpml_op->strikethru_begin = "";
209 wpml_op->strikethru_end = "";
210
211 wpml_op->dbl_strikethru_begin = "";
212 wpml_op->dbl_strikethru_end = "";
213
214 wpml_op->emboss_begin="";
215 wpml_op->emboss_end = "";
216
217 wpml_op->engrave_begin = "";
218 wpml_op->engrave_end = "";
219
220 wpml_op->shadow_begin= "";
221 wpml_op->shadow_end= "";
222
223 wpml_op->outline_begin= "";
224 wpml_op->outline_end= "";
225
226 wpml_op->expand_begin = "";
227 wpml_op->expand_end = "";
228
229 wpml_op->pointlist_begin = "\n";
230 wpml_op->pointlist_end = "\n";
231 wpml_op->pointlist_item_begin = "";
232 wpml_op->pointlist_item_end = "\n";
233
234 wpml_op->numericlist_begin = "\n";
235 wpml_op->numericlist_end = "\n";
236 wpml_op->numericlist_item_begin = "";
237 wpml_op->numericlist_item_end = "\n";
238
239 wpml_op->simulate_small_caps = TRUE;
240 wpml_op->simulate_all_caps = TRUE;
241 wpml_op->simulate_word_underline = TRUE;
242
243 wpml_op->ascii_translation_table = ascii_translation_table;
244
245 wpml_op->ansi_translation_table = upper_translation_table;
246 wpml_op->ansi_first_char = 0x80;
247 wpml_op->ansi_last_char = 0xff;
248
249 wpml_op->cp437_translation_table = upper_translation_table;
250 wpml_op->cp437_first_char = 0x80;
251 wpml_op->cp437_last_char = 0xff;
252
253 wpml_op->cp850_translation_table = upper_translation_table;
254 wpml_op->cp850_first_char = 0x80;
255 wpml_op->cp850_last_char = 0xff;
256
257 wpml_op->mac_translation_table = upper_translation_table;
258 wpml_op->mac_first_char = 0x80;
259 wpml_op->mac_last_char = 0xff;
260
261 wpml_op->chars.right_quote = "'";
262 wpml_op->chars.left_quote = "`";
263 wpml_op->chars.right_dbl_quote = "''";
264 wpml_op->chars.left_dbl_quote = "``";
265
266 return wpml_op;
267 }
268
269
0
1 /*=============================================================================
2 GNU UnRTF, a command-line program to convert RTF documents to other formats.
3 Copyright (C) 2000,2001 Zachary Thayer Smith
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 The author is reachable by electronic mail at tuorfa@yahoo.com.
20 =============================================================================*/
21
22
23 /*----------------------------------------------------------------------
24 * Module name: wpml
25 * Author name: Zach Smith
26 * Create date: 22 Sep 01
27 * Purpose: Definitions for the WPML output personality
28 *----------------------------------------------------------------------
29 * Changes:
30 *--------------------------------------------------------------------*/
31
32
33 #ifndef _WPML
34
35
36 extern OutputPersonality* wpml_init(void);
37
38
39 #define _WPML
40 #endif
41