./unrtf-0.19.2/CHANGES0000644000175000017500000000705710014443765015522 0ustar msamaralmsamaral00000000000000 Overall Program Change Log for GNU UnRTF ---------------------------------------- 0.1: original version, known as "rtf2htm" 0.2: first civilized (Un*x) version 0.3: addition of hash storage for all strings 0.4: support for a few HTML special exprs 0.5: tables finally work 0.6: addition of usage() 0.7: added special chars, \tab, info group,
[go: up one dir, main page]

0.8: font table support 0.9.0: images are stored to files 0.9.1: pict files extensions a bit more accurate 0.9.2: font size changes (\fs) more accurate. 0.9.3: fixed bug regarding where goes 0.9.4: added -nopict option 0.9.5: fixed table data printing. 0.9.6: if >1 \cell in a group, font attrs affect all. 0.9.7: Chunk class renamed Word 0.10.0: input file type is checked, -echo renamed -dump 0.11.0: addition of ANSI->HTML conversion, plus limited Mac->HTML 0.11.1: unknown chars are printed as 0.12.0: separated parser from word module 0.12.1: added -version option 0.12.2: backslash-newline is now \par 0.12.3: added default font families (\fswiss etc) 0.12.4: added blurb about program in the output HTML 0.12.5: added recognition of files with ".RTF" ending, not just ".rtf" 0.12.6: added charset tables for CP437 and CP850 0.12.7: fixed bug preventing \'## sequences from being translated 0.12.8: removed size limit for words, verified DJGPP compilation works. 0.12.9: compilation bugfix, fixed author/date information 0.12.10: added --simple switch for generating HTML without SPAN/DIV tags 0.13.0: paragraph alignment added 0.13.1: fix for words getting lost after \par 0.13.2: fix for color table not being recognized 0.14.0: separation of word and convert modules 0.14.1: fixed color table indexing, added support for font background color. 0.14.2: updated parsing mechanism 0.14.3: fix for DIV nesting; fix for NS's hiding any table within a span. 0.14.4: fix for color table parsing; added better underline/strikethru support. 0.15.0: hashing of RTF keywords in convert.c; moved much code out of convert.c 0.15.1: removed null entries from special.c to reduce program size 0.15.2: removed no-op entries from hash in convert.c to reduce program size 0.15.3: first 16-bit MSDOS executable 0.15.4: fixed paragraph alignment not getting cleared by \pard 0.15.5: updated code to produce as few paragraph alignment tags as possible 0.16.0: added input buffering to improve speed 0.16.1: bugfix for printing of debugging strings stored in command hash 0.17.0: hyperlink support added 0.17.1: added support for several font attributes e.g. smallcaps, caps, \expand 0.17.2: added Amiga(TM) compilation support 0.17.3: fixed problem in interpretation of RTF command words 0.17.4: changed attr.c to use AttrStack (stack of stacks) paradigm ----program renamed UnRTF---- 0.17.5: began implementation of output personalities; wrote HTML personality. 0.17.6: added text and vt personalities 0.17.7: began addition of PostScript(TM) and LaTeX and WPML output 0.17.8: first fully commented version, removed "last change" lines 0.17.9: fixed translation between character sets 0.17.10: PS now supports underline, strikethrough, shadowed text 0.17.11: PS now uses ISOLatin1Encoding 0.17.12: PS now supports these fonts: Times,Courier,Symbol,Helvetica ----program is now GNU UnRTF---- 0.18.0: updates to comments, documentation to reflect inclusion in GNU suite. 0.18.1: updated manual 0.19.1: new maintainers: minor fixes to prevent segmentation violations; further special character code; minor cleanups 0.19.2: updated some files Note: LaTeX is a system of macros for TeX by Leslie Lamport. WPML is a tentative document format by Z.T. Smith ./unrtf-0.19.2/COPYING0000644000175000017500000004312707356513561015567 0ustar msamaralmsamaral00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. ./unrtf-0.19.2/Makefile0000644000175000017500000000517507741250155016170 0ustar msamaralmsamaral00000000000000 ############################################################################## # GNU UnRTF, a command-line program to convert RTF documents to other formats. # Copyright (C) 2000,2001 Zachary Thayer Smith # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # The author is reachable by electronic mail at tuorfa@yahoo.com. ############################################################################## # # Makefile for UnRTF # CFLAGS=-g -Wall CC=gcc OBJS=convert.o word.o error.o main.o hash.o \ parse.o malloc.o attr.o util.o \ output.o html.o text.o vt.o ps.o latex.o wpml.o entity.o TARGET=unrtf ${TARGET}: ${OBJS} gcc ${OBJS} -o ${TARGET} clean: rm -f ${OBJS} ${TARGET} bcount bcount.o tidy: rm -f ${OBJS} bcount.o strip ${TARGET} tests: ${TARGET} test/table.rtf > test/table.html ${TARGET} test/slashnewline.rtf > test/slashnewline.html ${TARGET} test/fontface.rtf > test/fontface.html ${TARGET} test/fontsize.rtf > test/fontsize.html bcount: bcount.c gcc bcount.c -o bcount all: ${TARGET} bcount rm -f ${OBJS} install: ${TARGET} cp ${TARGET} /usr/local/bin attr.o: attr.c defs.h error.h attr.h main.h malloc.h convert.o: convert.c attr.h convert.h defs.h error.h hash.h main.h malloc.h \ parse.h util.h word.h entity.o: entity.c error.o: error.c defs.h main.h hash.o: hash.c error.h hash.h main.h malloc.h html.o: html.c defs.h error.h main.h malloc.h output.h latex.o: latex.c defs.h error.h main.h malloc.h output.h main.o: main.c convert.h defs.h error.h hash.h html.h latex.h output.h \ parse.h ps.h text.h vt.h wpml.h word.h malloc.o: malloc.c error.h output.o: output.c convert.h defs.h error.h main.h malloc.h output.h parse.o: parse.c defs.h error.h main.h malloc.h parse.h word.h ps.o: ps.c defs.h error.h main.h malloc.h output.h text.o: text.c defs.h error.h main.h malloc.h output.h util.o: util.c vt.o: vt.c defs.h error.h main.h malloc.h output.h word.o: word.c defs.h error.h hash.h main.h malloc.h parse.h word.h wpml.o: wpml.c defs.h error.h main.h malloc.h output.h ./unrtf-0.19.2/README0000644000175000017500000000153707356514026015410 0ustar msamaralmsamaral00000000000000Greetings, UnRTF is a moderately complicated converter from RTF to other formats, including HTML, LaTeX, text, and PostScript. Converting to HTML, it supports tables, fonts, colors, embedded images, hyperlinks, paragraph alignment among other things. All other conversions are "alpha"--just begun. Compiling with GCC: type "make all", and assuming you have GCC and GNU make, it should compile without any warnings or errors under Linux, BSD, and DOS (using DJGPP). Amiga/GCC users should utilize the build.amiga file. Please let me know of any compilation problems. This program includes no warranty whatsoever. It is provided "AS IS". For more information please read the COPYING document, which should be included with the source code. It describes the GNU Public License, which covers UnRTF. Enjoy. Zachary Thayer Smith tuorfa@yahoo.com 22 Sept 01 ./unrtf-0.19.2/TODO0000644000175000017500000000165207356514073015220 0ustar msamaralmsamaral00000000000000 UnRTF by Zach Smith A few tasks that need doing as of 18 Sept 01 -------------------------------------------- * Make sure --inline still works; limit it to HTML. * Add a module for an intermediate character set for charset conversions. * Finish output personalities for LaTeX, PostScript, text, vt, WPML. - Postscript word-level metrics and printing. - Postscript paragraph alignment. - Postscript tables. - Postscript more font faces. - Does LaTeX support emboss, engrave, outline, shadow? * Point-lists -- rather important. * Index entries. * TOC entries. * Headers. * Footers. * Add support for line-based images (the RTF "shape" concept), converting to Beest format or another? * Centering not working within tables? * HTML: javascript-based shadow/outline/emboss/engrave ? * Style sheet support? * HTML: Multiple columns kludge using tables or layers? * Need to support more Mac RTF special expressions. ./unrtf-0.19.2/attr.c0000644000175000017500000003430007356513561015643 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: attr * Author name: Zach Smith * Create date: 01 Aug 01 * Purpose: Character attribute stack. *---------------------------------------------------------------------- * Changes: * 01 Aug 01, tuorfa@yahoo.com: moved code over from convert.c * 06 Aug 01, tuorfa@yahoo.com: added several font attributes. * 18 Sep 01, tuorfa@yahoo.com: added AttrStack (stack of stacks) paradigm * 22 Sep 01, tuorfa@yahoo.com: added comment blocks *--------------------------------------------------------------------*/ #include #include #include #include "malloc.h" #include "defs.h" #include "error.h" #include "attr.h" #include "main.h" extern void starting_body(); extern void starting_text(); extern int simulate_allcaps; extern int simulate_smallcaps; #define MAX_ATTRS (1000) /* For each RTF text block (the text within braces) we must keep * an AttrStack which is a stack of attributes and their optional * parameter. Since RTF text blocks are nested, these make up a * stack of stacks. And, since RTF text blocks inherit attributes * from parent blocks, all new AttrStacks do the same from * their parent AttrStack. */ typedef struct _stack { unsigned char attr_stack [MAX_ATTRS]; char *attr_stack_params [MAX_ATTRS]; int tos; struct _stack *next; } AttrStack; static AttrStack *stack_of_stacks = NULL; static AttrStack *stack_of_stacks_top = NULL; /*======================================================================== * Name: attr_express_begin * Purpose: Print the HTML for beginning an attribute. * Args: Attribute number, optional string parameter. * Returns: None. *=======================================================================*/ void attr_express_begin (int attr, char* param) { switch(attr) { case ATTR_BOLD: printf (op->bold_begin); break; case ATTR_ITALIC: printf (op->italic_begin); break; /* Various underlines, they all resolve to HTML's */ case ATTR_THICK_UL: case ATTR_WAVE_UL: case ATTR_DASH_UL: case ATTR_DOT_UL: case ATTR_DOT_DASH_UL: case ATTR_2DOT_DASH_UL: case ATTR_WORD_UL: case ATTR_UNDERLINE: printf (op->underline_begin); break; case ATTR_DOUBLE_UL: printf (op->dbl_underline_begin); break; case ATTR_FONTSIZE: op_begin_std_fontsize (op, atoi (param)); break; case ATTR_FONTFACE: printf (op->font_begin,param); break; case ATTR_FOREGROUND: printf (op->foreground_begin, param); break; case ATTR_BACKGROUND: if (!simple_mode) printf (op->foreground_begin,param); break; case ATTR_SUPER: printf (op->superscript_begin); break; case ATTR_SUB: printf (op->subscript_begin); break; case ATTR_STRIKE: printf (op->strikethru_begin); break; case ATTR_DBL_STRIKE: printf (op->dbl_strikethru_begin); break; case ATTR_EXPAND: printf (op->expand_begin, param); break; case ATTR_OUTLINE: printf (op->outline_begin); break; case ATTR_SHADOW: printf (op->shadow_begin); break; case ATTR_EMBOSS: printf (op->emboss_begin); break; case ATTR_ENGRAVE: printf (op->engrave_begin); break; case ATTR_CAPS: if (op->simulate_all_caps) simulate_allcaps = TRUE; break; case ATTR_SMALLCAPS: if (op->simulate_small_caps) simulate_smallcaps = TRUE; else { if (op->small_caps_begin) printf (op->small_caps_begin); } break; } } /*======================================================================== * Name: attr_express_end * Purpose: Print HTML to complete an attribute. * Args: Attribute number. * Returns: None. *=======================================================================*/ void attr_express_end (int attr, char *param) { switch(attr) { case ATTR_BOLD: printf (op->bold_end); break; case ATTR_ITALIC: printf (op->italic_end); break; /* Various underlines, they all resolve to HTML's */ case ATTR_THICK_UL: case ATTR_WAVE_UL: case ATTR_DASH_UL: case ATTR_DOT_UL: case ATTR_DOT_DASH_UL: case ATTR_2DOT_DASH_UL: case ATTR_WORD_UL: case ATTR_UNDERLINE: printf (op->underline_end); break; case ATTR_DOUBLE_UL: printf (op->dbl_underline_end); break; case ATTR_FONTSIZE: op_end_std_fontsize (op, atoi (param)); break; case ATTR_FONTFACE: printf (op->font_end); break; case ATTR_FOREGROUND: printf (op->foreground_end); break; case ATTR_BACKGROUND: if (!simple_mode) printf (op->background_end); break; case ATTR_SUPER: printf (op->superscript_end); break; case ATTR_SUB: printf (op->subscript_end); break; case ATTR_STRIKE: printf (op->strikethru_end); break; case ATTR_DBL_STRIKE: printf (op->dbl_strikethru_end); break; case ATTR_OUTLINE: printf (op->outline_end); break; case ATTR_SHADOW: printf (op->shadow_end); break; case ATTR_EMBOSS: printf (op->emboss_end); break; case ATTR_ENGRAVE: printf (op->engrave_end); break; case ATTR_EXPAND: printf (op->expand_end); break; case ATTR_CAPS: if (op->simulate_all_caps) simulate_allcaps = FALSE; break; case ATTR_SMALLCAPS: if (op->simulate_small_caps) simulate_smallcaps = FALSE; else { if (op->small_caps_end) printf (op->small_caps_end); } break; } } /*======================================================================== * Name: attr_push * Purpose: Pushes an attribute onto the current attribute stack. * Args: Attribute number, optional string parameter. * Returns: None. *=======================================================================*/ void attr_push(int attr, char* param) { AttrStack *stack = stack_of_stacks_top; if (!stack) { warning_handler ("no stack to push attribute onto"); return; } if (stack->tos>=MAX_ATTRS) { fprintf (stderr,"Too many attributes!\n"); return; } /* Make sure it's understood we're in the section. */ /* KLUDGE */ starting_body(); starting_text(); ++stack->tos; stack->attr_stack [stack->tos]=attr; if (param) stack->attr_stack_params [stack->tos]=my_strdup(param); else stack->attr_stack_params [stack->tos]=NULL; attr_express_begin (attr, param); } /*======================================================================== * Name: attrstack_copy_all * Purpose: Routine to copy all attributes from one stack to another. * Args: Two stacks. * Returns: None. *=======================================================================*/ void attrstack_copy_all (AttrStack *src, AttrStack *dest) { int i; int total; CHECK_PARAM_NOT_NULL(src); CHECK_PARAM_NOT_NULL(dest); total = src->tos + 1; for (i=0; iattr_stack [i]; char *param=src->attr_stack_params [i]; dest->attr_stack[i] = attr; if (param) dest->attr_stack_params[i] = my_strdup (param); else dest->attr_stack_params[i] = NULL; } dest->tos = src->tos; } /*======================================================================== * Name: attrstack_unexpress_all * Purpose: Routine to un-express all attributes heretofore applied, * without removing any from the stack. * Args: Stack whost contents should be unexpressed. * Returns: None. * Notes: This is needed by attrstack_push, but also for \cell, which * often occurs within a brace group, yet HTML uses * which clear attribute info within that block. *=======================================================================*/ void attrstack_unexpress_all (AttrStack *stack) { int i; CHECK_PARAM_NOT_NULL(stack); i=stack->tos; while (i>=0) { int attr=stack->attr_stack [i]; char *param=stack->attr_stack_params [i]; attr_express_end (attr, param); i--; } } /*======================================================================== * Name: attrstack_push * Purpose: Creates a new attribute stack, pushes it onto the stack * of stacks, performs inheritance from previous stack. * Args: None. * Returns: None. *=======================================================================*/ void attrstack_push () { AttrStack *new_stack; AttrStack *prev_stack; new_stack = (AttrStack*) my_malloc (sizeof (AttrStack)); bzero ((void*) new_stack, sizeof (AttrStack)); prev_stack = stack_of_stacks_top; if (!stack_of_stacks) { stack_of_stacks = new_stack; } else { stack_of_stacks_top->next = new_stack; } stack_of_stacks_top = new_stack; new_stack->tos = -1; if (prev_stack) { attrstack_unexpress_all (prev_stack); attrstack_copy_all (prev_stack, new_stack); attrstack_express_all (); } } /*======================================================================== * Name: attr_pop * Purpose: Removes and undoes the effect of the top attribute of * the current AttrStack. * Args: The top attribute's number, for verification. * Returns: Success/fail flag. *=======================================================================*/ int attr_pop (int attr) { AttrStack *stack = stack_of_stacks_top; if (!stack) { warning_handler ("no stack to pop attribute from"); return FALSE; } if(stack->tos>=0 && stack->attr_stack[stack->tos]==attr) { char *param = stack->attr_stack_params [stack->tos]; attr_express_end (attr, param); if (param) my_free(param); stack->tos--; return TRUE; } else return FALSE; } /*======================================================================== * Name: attr_read * Purpose: Reads but leaves in place the top attribute of the top * attribute stack. * Args: None. * Returns: Attribute number. *=======================================================================*/ int attr_read() { AttrStack *stack = stack_of_stacks_top; if (!stack) { warning_handler ("no stack to read attribute from"); return FALSE; } if(stack->tos>=0) { int attr = stack->attr_stack [stack->tos]; return attr; } else return ATTR_NONE; } /*======================================================================== * Name: attr_drop_all * Purpose: Undoes all attributes that an AttrStack contains. * Args: None. * Returns: None. *=======================================================================*/ void attr_drop_all () { AttrStack *stack = stack_of_stacks_top; if (!stack) { warning_handler ("no stack to drop all attributes from"); return; } while (stack->tos>=0) { char *param=stack->attr_stack_params [stack->tos]; if (param) my_free(param); stack->tos--; } } /*======================================================================== * Name: attrstack_drop * Purpose: Removes the top AttrStack from the stack of stacks, undoing * all attributes that it had in it. * Args: None. * Returns: None. *=======================================================================*/ void attrstack_drop () { AttrStack *stack = stack_of_stacks_top; AttrStack *prev_stack; if (!stack) { warning_handler ("no attr-stack to drop"); return; } attr_pop_all (); prev_stack = stack_of_stacks; while(prev_stack && prev_stack->next && prev_stack->next != stack) prev_stack = prev_stack->next; if (prev_stack) { stack_of_stacks_top = prev_stack; prev_stack->next = NULL; } else { stack_of_stacks_top = NULL; stack_of_stacks = NULL; } my_free ((void*) stack); attrstack_express_all (); } /*======================================================================== * Name: attr_pop_all * Purpose: Routine to undo all attributes heretofore applied, * also reversing the order in which they were applied. * Args: None. * Returns: None. *=======================================================================*/ void attr_pop_all() { AttrStack *stack = stack_of_stacks_top; if (!stack) { warning_handler ("no stack to pop from"); return; } while (stack->tos>=0) { int attr=stack->attr_stack [stack->tos]; char *param=stack->attr_stack_params [stack->tos]; attr_express_end (attr,param); if (param) my_free(param); stack->tos--; } } /*======================================================================== * Name: attrstack_express_all * Purpose: Routine to re-express all attributes heretofore applied. * Args: None. * Returns: None. * Notes: This is needed by attrstack_push, but also for \cell, which * often occurs within a brace group, yet HTML uses * which clear attribute info within that block. *=======================================================================*/ void attrstack_express_all() { AttrStack *stack = stack_of_stacks_top; int i; if (!stack) { warning_handler ("no stack to pop from"); return; } i=0; while (i<=stack->tos) { int attr=stack->attr_stack [i]; char *param=stack->attr_stack_params [i]; attr_express_begin (attr, param); i++; } } /*======================================================================== * Name: attr_pop_dump * Purpose: Routine to un-express all attributes heretofore applied. * Args: None. * Returns: None. * Notes: This is needed for \cell, which often occurs within a * brace group, yet HTML uses which clear attribute * info within that block. *=======================================================================*/ void attr_pop_dump() { AttrStack *stack = stack_of_stacks_top; int i; if (!stack) return; i=stack->tos; while (i>=0) { int attr=stack->attr_stack [i]; attr_pop (attr); i--; } } ./unrtf-0.19.2/attr.h0000644000175000017500000000466507356513561015663 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: attr * Author name: Zach Smith * Create date: 1 Aug 2001 * Purpose: Definitions for attribute stack module. *---------------------------------------------------------------------- * Changes: * 01 Aug 01, tuorfa@yahoo.com: moved code over from convert.c * 06 Aug 01, tuorfa@yahoo.com: added several attributes * 18 Sep 01, tuorfa@yahoo.com: updates for AttrStack paradigm *--------------------------------------------------------------------*/ enum { ATTR_NONE=0, ATTR_BOLD, ATTR_ITALIC, ATTR_UNDERLINE, ATTR_DOUBLE_UL, ATTR_WORD_UL, ATTR_THICK_UL, ATTR_WAVE_UL, ATTR_DOT_UL, ATTR_DASH_UL, ATTR_DOT_DASH_UL, ATTR_2DOT_DASH_UL, ATTR_FONTSIZE, ATTR_STD_FONTSIZE, ATTR_FONTFACE, ATTR_FOREGROUND, ATTR_BACKGROUND, ATTR_CAPS, ATTR_SMALLCAPS, ATTR_SHADOW, ATTR_OUTLINE, ATTR_EMBOSS, ATTR_ENGRAVE, ATTR_SUPER, ATTR_SUB, ATTR_STRIKE, ATTR_DBL_STRIKE, ATTR_EXPAND, /* ATTR_CONDENSE */ }; extern void attr_push_core (int attr, char* param); extern void attr_pop_core (int attr); extern void attr_push(int attr, char* param); extern void attrstack_push(); extern void attrstack_drop(); extern void attrstack_express_all(); extern int attr_pop(int attr); extern int attr_read(); extern void attr_drop_all (); extern void attr_pop_all(); extern void attr_pop_dump(); ./unrtf-0.19.2/bcount.c0000644000175000017500000000306207356513561016164 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Program name: bcount * Author name: Zach Smith * Create date: 15 Oct 00 * Purpose: Counts the number of opening and closing braces while * reading from stdin. *--------------------------------------------------------------------*/ #include main (){ int n1,n2; int ch; n1=n2=0; while (EOF!=(ch=getchar())) { if (ch=='}') ++n1; if (ch=='{') ++n2; } printf ("{=%d, }=%d\n", n2,n1); } ./unrtf-0.19.2/build.amiga0000644000175000017500000000640207741250450016617 0ustar msamaralmsamaral00000000000000.KEY CLEAR/S,INSTALL/S,MAKE/S,UNINSTALL/S .BRA { .KET } ;------------------------------------------------------------------------------ ; UnRTF, a command-line program to convert RTF documents to other formats. ; Copyright (C) 2000,2001 Zachary Thayer Smith ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; ; The author is reachable by electronic mail at tuorfa@yahoo.com. ;------------------------------------------------------------------------------ ; Author name: Lars Unger ; Create date: 15 Aug 01 ; Last change: 16 Aug 01 ; Purpose: AmigaDOS batch file to build GNU UnRTF using GNU GCC ; ;Version ;$VER: build.amiga 0.4 ;------------------------------------------------------------------------------ ; ; ; definitions (feel free to modify) ; set GCC "gnu:bin/gccv" set CFLAGS "-g -Wall" set OBJS "convert.o word.o entity.o error.o main.o hash.o parse.o special.o malloc.o attr.o util.o" set CSRC "convert.c word.c entity.c error.c main.c hash.c parse.c special.c malloc.c attr.c util.c" set TARGET "unrtf" set BINARY "C:unrtf" set HELP "HELP:english/unrtf" ; ; end of definitions ; ; gcc installed ? if not exists $GCC echo ERROR: $GCC not found ! quit 20 endif ; action control switch set BUILDAMIGA NO ; delete old gcc run if "{CLEAR}" EQ "CLEAR" set BUILDAMIGA YES delete #?.o >NIL: delete $TRAGET >NIL: endif ; uninstall unrtfl if "{UNINSTALL}" EQ "UNINSTALL" set BUILDAMIGA YES delete $BINARY >NIL: delete $HELP all >NIL: endif ; install unrtf if "{INSTALL}" EQ "INSTALL" set BUILDAMIGA YES ask "Install unrtf in $BINARY ?" if warn if exists $TARGET copy $TARGET $BINARY echo "Installed $TARGET in $BINARY" else echo "ERROR: No unrtf executable found !" endif endif ask "Install unrtf docs in $HELP ?" if warn if not exists $HELP makedir $HELP endif copy unrtf.guide changes todo readme $HELP >NIL: endif endif ; use gccv to create unrtf executable (compile) if "{MAKE}" EQ "MAKE" set BUILDAMIGA YES ; set stack for gcc if exists env:GCCSTACK stack $GCCSTACK else stack 250000 endif ; compile source file(s) $GCC $CFLAGS -c $CSRC ; link objects $GCC -o $TARGET $OBJS ; check output if exists $TARGET protect $TARGET +e echo "$TARGET was created and is executable. Maybe you" echo "have to increase the stack size of your shell. " echo "Have fun !" else echo "ERROR: unrtf executable not found !" echo "Please check output from GCC." endif endif ; any action performed otherwise give help if $BUILDAMIGA EQ NO echo "This is an AmigaDOS batch file to build unrtf using GCC" echo "Using: build.amiga CLEAR/S,INSTALL/S,MAKE/S,UNINSTALL/S" endif ./unrtf-0.19.2/convert.c0000644000175000017500000024326610014427445016354 0ustar msamaralmsamaral00000000000000 /*=========================================================================== GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. ===========================================================================*/ /*---------------------------------------------------------------------- * Module name: convert * Author name: Zach Smith * Create date: 24 Jul 01 * Purpose: Performs conversion from RTF to other formats. *---------------------------------------------------------------------- * Changes: * 24 Jul 01, tuorfa@yahoo.com: moved code over from word.c * 24 Jul 01, tuorfa@yahoo.com: fixed color table reference numbering. * 30 Jul 01, tuorfa@yahoo.com: moved hex convert to util.c * 30 Jul 01, tuorfa@yahoo.com: moved special expr tables to special.c * 30 Jul 01, tuorfa@yahoo.com: moved attribute stack to attr.c * 31 Jul 01, tuorfa@yahoo.com: began addition of hash of rtf commands * 01 Aug 01, tuorfa@yahoo.com: finished bulk of rtf command hash * 03 Aug 01, tuorfa@yahoo.com: removed no-op hash entries to save space * 03 Aug 01, tuorfa@yahoo.com: code to ignore rest of groups for \*, etc * 03 Aug 01, tuorfa@yahoo.com: fixed para-alignnot being cleared by \pard * 03 Aug 01, tuorfa@yahoo.com: added support for \keywords group * 03 Aug 01, tuorfa@yahoo.com: added dummy funcs for header/footer * 03 Aug 01, tuorfa@yahoo.com: began addition of hyperlink support * 04 Aug 01, tuorfa@yahoo.com: fixed debug string printing * 05 Aug 01, tuorfa@yahoo.com: added support for hyperlink data with \field * 06 Aug 01, tuorfa@yahoo.com: added support for several font attributes * 08 Aug 01, gommer@gmx.net: bugfix for picture storing mechanism * 08 Sep 01, tuorfa@yahoo.com: added use of PROGRAM_NAME * 11 Sep 01, tuorfa@yahoo.com: added support for JPEG and PNG pictures * 19 Sep 01, tuorfa@yahoo.com: added output personality support * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 23 Sep 01, tuorfa@yahoo.com: fixed translation of \'XX expressions * 08 Oct 03, daved@physiol.usyd.edu.au: more special character code *--------------------------------------------------------------------*/ #include #include #include #include #include "defs.h" #include "parse.h" #include "util.h" #include "malloc.h" #include "main.h" #include "error.h" #include "word.h" #include "hash.h" #include "convert.h" #include "attr.h" /* #define BINARY_ATTRS */ static int charset_type=CHARSET_ANSI; /* Nested tables aren't supported. */ static int coming_pars_that_are_tabular = 0; static int within_table = FALSE; static int have_printed_row_begin=FALSE; static int have_printed_cell_begin=FALSE; static int have_printed_row_end=FALSE; static int have_printed_cell_end=FALSE; /* Previously in word_print_core function */ static int total_chars_this_line=0; /* for simulating \tab */ /* Paragraph alignment (kludge) */ enum { ALIGN_LEFT=0, ALIGN_RIGHT, ALIGN_CENTER, ALIGN_JUSTIFY }; /* This value is set by attr_push and attr_pop */ int simulate_smallcaps; int simulate_allcaps; /* Most pictures must be written to files. */ enum { PICT_UNKNOWN=0, PICT_WM, PICT_MAC, PICT_PM, PICT_DI, PICT_WB, PICT_JPEG, PICT_PNG, }; static int within_picture=FALSE; static int picture_file_number=1; static char picture_path[255]; static int picture_width; static int picture_height; static int picture_bits_per_pixel=1; static int picture_type=PICT_UNKNOWN; static int picture_wmetafile_type; static char *picture_wmetafile_type_str; static int have_printed_body=FALSE; static int within_header=TRUE; static char *hyperlink_base = NULL; void starting_body(); void starting_text(); static int banner_printed=FALSE; #if 1 /* daved - 0.19.0 */ char *entity(int symbol); #endif /*======================================================================== * Name: print_banner * Purpose: Writes program-identifying text to the output stream. * Args: None. * Returns: None. *=======================================================================*/ void print_banner () { if (!banner_printed) { printf (op->comment_begin); printf ("Translation from RTF performed by "); printf ("%s, version ", PROGRAM_NAME); printf ("%s", PROGRAM_VERSION); printf (op->comment_end); printf (op->comment_begin); printf ("For information about this marvellous program,"); printf (op->comment_end); printf (op->comment_begin); printf ("please go to %s", PROGRAM_WEBSITE); printf (op->comment_end); } banner_printed=TRUE; } /*======================================================================== * Name: starting_body * Purpose: Switches output stream for writing document contents. * Args: None. * Returns: None. *=======================================================================*/ void starting_body () { if (!have_printed_body) { if (!inline_mode) { printf (op->header_end); printf (op->body_begin); } within_header=FALSE; have_printed_body=TRUE; } } /*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/ static char *month_strings[12]= { #ifdef ENGLISH "January","February","March","April","May","June","July","August", "September","October","November","December" #endif #ifdef FRANCAIS "Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre", "Octobre","Novembre","Decembre" #endif #ifdef ITALIANO "Ianuario","Febbraio","Marzo","Aprile","Maggio","Iuno", "Luglio","Agusto","Settembre","Ottobre","Novembre","Dicembre" #endif #ifdef ESPANOL /* amaral - 0.19.2 */ "Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto", "Septiembre","Octubre","Noviembre","Diciembre" #endif #ifdef DEUTCH "?","?","?","?","?","?","?","?", "?","?","?","?" #endif #ifdef PORTUGUES /* amaral - 0.19.2 */ "Janeiro","Fevereiro","Marco","Abril","Maio","Junho","Julho","Agosto", "Setembro","Outubro","Novembro","Dezembro" #endif }; /*======================================================================== * Name: word_dump_date * Purpose: Extracts date from an RTF input stream, writes it to * output stream. * Args: Word*, buffered RTF stream * Returns: None. *=======================================================================*/ void word_dump_date (Word *w) { int year=0, month=0, day=0, hour=0, minute=0; CHECK_PARAM_NOT_NULL(w); while (w) { char *s = word_string (w); if (*s == '\\') { ++s; if (!strncmp (s, "yr", 2) && isdigit(s[2])) { year = atoi (&s[2]); } else if (!strncmp (s, "mo", 2) && isdigit(s[2])) { month= atoi (&s[2]); } else if (!strncmp (s, "dy", 2) && isdigit(s[2])) { day= atoi (&s[2]); } else if (!strncmp (s, "min", 3) && isdigit(s[3])) { minute= atoi (&s[3]); } else if (!strncmp (s, "hr", 2) && isdigit(s[2])) { hour= atoi (&s[2]); } } w=w->next; } if (year && month && day) { printf ("%d %s %d ", day, month_strings[month-1], year); } if (hour && minute) { printf ("%02d:%02d ", hour, minute); } } /*-------------------------------------------------------------------*/ typedef struct { int num; char *name; } FontEntry; #define MAX_FONTS (256) static FontEntry font_table[MAX_FONTS]; static int total_fonts=0; /*======================================================================== * Name: lookup_fontname * Purpose: Fetches the name of a font from the already-read font table. * Args: Font#. * Returns: Font name. *=======================================================================*/ char* lookup_fontname (int num) { int i; if (total_fonts) for(i=0;ichild)) { tmp = word_string (w2); if (!strncmp("\\f",tmp,2)) { num = atoi (&tmp[2]); name[0]=0; w2=w2->next; while(w2) { tmp = word_string (w2); if (tmp && tmp[0] != '\\') strcat(name,tmp); w2=w2->next; } /* Chop the gall-derned semicolon. */ if ((tmp=strchr(name,';'))) *tmp=0; font_table[total_fonts].num=num; font_table[total_fonts].name=my_strdup(name); total_fonts++; } } w=w->next; } printf (op->comment_begin); printf ("font table contains %d fonts total",total_fonts); printf (op->comment_end); if (debug_mode) { int i; printf (op->comment_begin); printf ("font table dump: \n"); for (i=0; icomment_end); } } /*======================================================================== * Name: process_index_entry * Purpose: Processes an index entry of an RTF file. * Args: Tree of words. * Returns: None. *=======================================================================*/ void process_index_entry (Word *w) { Word *w2; CHECK_PARAM_NOT_NULL(w); while(w) { if ((w2=w->child)) { char *str = word_string (w2); if (debug_mode && str) { printf (op->comment_begin); printf ("index entry word: %s ", str); printf (op->comment_end); } } w=w->next; } } /*======================================================================== * Name: process_toc_entry * Purpose: Processes an index entry of an RTF file. * Args: Tree of words, flag to say whether to include a page#. * Returns: None. *=======================================================================*/ void process_toc_entry (Word *w, int include_page_num) { Word *w2; CHECK_PARAM_NOT_NULL(w); while(w) { if ((w2=w->child)) { char *str = word_string (w2); if (debug_mode && str) { printf (op->comment_begin); printf ("toc %s entry word: %s ", include_page_num ? "page#":"no page#", str); printf (op->comment_end); } } w=w->next; } } /*======================================================================== * Name: process_info_group * Purpose: Processes the \info group of an RTF file. * Args: Tree of words. * Returns: None. *=======================================================================*/ void process_info_group (Word *w) { Word *child; #if 1 /* amaral - 0.19.2 */ /* CHECK_PARAM_NOT_NULL(w); */ if (!w) printf ("AUTHOR'S COMMENT: \\info command is null!\n"); #endif while(w) { child = w->child; if (child) { Word *w2; char *s; s = word_string(child); if (!inline_mode) { if (!strcmp("\\title", s)) { printf (op->document_title_begin); w2=child->next; while (w2) { char *s2 = word_string(w2); if (s2[0] != '\\') printf ("%s", s2); w2=w2->next; } printf (op->document_title_end); } else if (!strcmp("\\keywords", s)) { printf (op->document_keywords_begin); w2=child->next; while (w2) { char *s2 = word_string(w2); if (s2[0] != '\\') printf ("%s,", s2); w2=w2->next; } printf (op->document_keywords_end); } else if (!strcmp("\\author", s)) { printf (op->document_author_begin); w2=child->next; while (w2) { char *s2 = word_string(w2); if (s2[0] != '\\') printf ("%s", s2); w2=w2->next; } printf (op->document_author_end); } else if (!strcmp("\\comment", s)) { printf (op->comment_begin); printf ("comments: "); w2=child->next; while (w2) { char *s2 = word_string(w2); if (s2[0] != '\\') printf ("%s", s2); w2=w2->next; } printf (op->comment_end); } else if (!strncmp("\\nofpages", s, 9)) { printf (op->comment_begin); printf ("total pages: %s",&s[9]); printf (op->comment_end); } else if (!strncmp("\\nofwords", s, 9)) { printf (op->comment_begin); printf ("total words: %s",&s[9]); printf (op->comment_end); } else if (!strncmp("\\nofchars", s, 9) && isdigit(s[9])) { printf (op->comment_begin); printf ("total chars: %s",&s[9]); printf (op->comment_end); } else if (!strcmp("\\creatim", s)) { printf (op->comment_begin); printf ("creaton date: "); if (child->next) word_dump_date (child->next); printf (op->comment_end); } else if (!strcmp("\\printim", s)) { printf (op->comment_begin); printf ("last printed: "); if (child->next) word_dump_date (child->next); printf (op->comment_end); } else if (!strcmp("\\buptim", s)) { printf (op->comment_begin); printf ("last backup: "); if (child->next) word_dump_date (child->next); printf (op->comment_end); } else if (!strcmp("\\revtim", s)) { printf (op->comment_begin); printf ("revision date: "); if (child->next) word_dump_date (child->next); printf (op->comment_end); } } /* Irregardless of whether we're in inline mode, * we want to process the following. */ if (!strcmp("\\hlinkbase", s)) { char *linkstr = NULL; printf (op->comment_begin); printf ("hyperlink base: "); if (child->next) { Word *nextword = child->next; if (nextword) linkstr=word_string (nextword); } if (linkstr) printf ("%s", linkstr); else printf ("(none)"); printf (op->comment_end); /* Store the pointer, it will remain good. */ hyperlink_base = linkstr; } } w = w->next; } } /*-------------------------------------------------------------------*/ /* RTF color table colors are RGB */ typedef struct { unsigned char r,g,b; } Color; #define MAX_COLORS (256) static Color color_table[MAX_COLORS]; static int total_colors=0; /*======================================================================== * Name: process_color_table * Purpose: Processes the color table of an RTF file. * Args: Tree of words. * Returns: None. *=======================================================================*/ void process_color_table (Word *w) { int r,g,b; CHECK_PARAM_NOT_NULL(w); /* Sometimes, RTF color tables begin with a semicolon, * i.e. an empty color entry. This seems to indicate that color 0 * will not be used, so here I set it to black. */ r=g=b=0; while(w) { char *s = word_string (w); #if 0 printf (op->comment_begin); printf ("found this color table word: %s", word_string(w)); printf (op->comment_end); #endif if(!strncmp("\\red",s,4)) { r = atoi(&s[4]); while(r>255) r>>=8; } else if(!strncmp("\\green",s,6)) { g = atoi(&s[6]); while(g>255) g>>=8; } else if(!strncmp("\\blue",s,5)) { b = atoi(&s[5]); while(b>255) b>>=8; } else /* If we find the semicolon which denotes the end of * a color entry then store the color, even if we don't * have all of it. */ if (!strcmp (";", s)) { color_table[total_colors].r = r; color_table[total_colors].g = g; color_table[total_colors++].b = b; if (debug_mode) { printf (op->comment_begin); printf ("storing color entry %d: %02x%02x%02x", total_colors-1, r,g,b); printf (op->comment_end); } r=g=b=0; } w=w->next; } if (debug_mode) { printf (op->comment_begin); printf ("color table had %d entries -->\n", total_colors); printf (op->comment_end); } } /*======================================================================== * Name: cmd_cf * Purpose: Executes the \cf command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_cf (Word *w, int align, char has_param, short num) { char str[40]; if (!has_param || num>=total_colors) { warning_handler ("font color change attempted is invalid"); } else { sprintf (str,"#%02x%02x%02x", color_table[num].r, color_table[num].g, color_table[num].b); attr_push(ATTR_FOREGROUND,str); } return FALSE; } /*======================================================================== * Name: cmd_cb * Purpose: Executes the \cb command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_cb (Word *w, int align, char has_param, short num) { char str[40]; if (!has_param || num>=total_colors) { warning_handler ("font color change attempted is invalid"); } else { sprintf (str,"#%02x%02x%02x", color_table[num].r, color_table[num].g, color_table[num].b); attr_push(ATTR_BACKGROUND,str); } return FALSE; } /*======================================================================== * Name: cmd_fs * Purpose: Executes the \fs command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_fs (Word *w, int align, char has_param, short points) { char str[20]; if (!has_param) return FALSE; /* Note, fs20 means 10pt */ points /= 2; sprintf (str,"%d",points); attr_push(ATTR_FONTSIZE,str); return FALSE; } /*======================================================================== * Name: cmd_field * Purpose: Interprets fields looking for hyperlinks. * Comment: Because hyperlinks are put in \field groups, * we must interpret all \field groups, which is * slow and laborious. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_field (Word *w, int align, char has_param, short num) { Word *child; CHECK_PARAM_NOT_NULL(w); while(w) { child = w->child; if (child) { Word *w2; char *s; s = word_string(child); if (!strcmp("\\*", s)) { w2=child->next; while (w2) { char *s2 = word_string(w2); if (s2 && !strcmp("\\fldinst", s2)) { Word *w3; w3=w2->next; #if 1 /* daved - 0.19.0 */ { char *s; char *s4; Word *w4; s = word_string(w3); if(s && !strcmp(s, "SYMBOL") ) { w4=w3->next; while(w4 && !strcmp(word_string(w4), " ")) w4 = w4->next; s4 = word_string(w4); if(s4) printf("%s", entity(atoi(s4))); } } #endif while (w3 && !w3->child) { w3=w3->next; } if (w3) w3=w3->child; while (w3) { char *s3=word_string(w3); if (s3 && !strcmp("HYPERLINK",s3)) { Word *w4; char *s4; w4=w3->next; while (w4 && !strcmp(" ", word_string(w4))) w4=w4->next; if (w4) { s4=word_string(w4); printf (op->hyperlink_begin); printf ("%s", s4); printf (op->hyperlink_end); return TRUE; } } w3=w3->next; } } w2=w2->next; } } } w=w->next; } return TRUE; } /*======================================================================== * Name: cmd_f * Purpose: Executes the \f command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_f (Word *w, int align, char has_param, short num) { char *name; /* no param exit early XX */ if (!has_param) return FALSE; name = lookup_fontname(num); if(!name) { printf (op->comment_begin); printf ("invalid font number %d",num); printf (op->comment_end); } else { attr_push(ATTR_FONTFACE,name); } return FALSE; } /*======================================================================== * Name: cmd_highlight * Purpose: Executes the \cf command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_highlight (Word *w, int align, char has_param, short num) { char str[40]; if (!has_param || num>=total_colors) { warning_handler ("font background color change attempted is invalid"); } else { sprintf (str,"#%02x%02x%02x", color_table[num].r, color_table[num].g, color_table[num].b); attr_push(ATTR_BACKGROUND,str); } return FALSE; } /*======================================================================== * Name: cmd_tab * Purpose: Executes the \tab command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_tab (Word *w, int align, char has_param, short param) { /* Tab presents a genuine problem * since some output formats don't have * an equivalent. As a kludge fix, I shall * assume the font is fixed width and that * the tabstops are 8 characters apart. */ int need= 8-(total_chars_this_line%8); total_chars_this_line += need; while(need>0) { printf (op->forced_space); need--; } printf ("\n"); return FALSE; } /*======================================================================== * Name: cmd_plain * Purpose: Executes the \plain command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_plain (Word *w, int align, char has_param, short param) { attr_pop_all(); return FALSE; } /*======================================================================== * Name: cmd_fnil * Purpose: Executes the \fnil command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_fnil (Word *w, int align, char has_param, short param) { attr_push(ATTR_FONTFACE,FONTNIL_STR); return FALSE; } /*======================================================================== * Name: cmd_froman * Purpose: Executes the \froman command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_froman (Word *w, int align, char has_param, short param) { attr_push(ATTR_FONTFACE,FONTROMAN_STR); return FALSE; } /*======================================================================== * Name: cmd_fswiss * Purpose: Executes the \fswiss command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_fswiss (Word *w, int align, char has_param, short param) { attr_push(ATTR_FONTFACE,FONTSWISS_STR); return FALSE; } /*======================================================================== * Name: cmd_fmodern * Purpose: Executes the \fmodern command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_fmodern (Word *w, int align, char has_param, short param) { attr_push(ATTR_FONTFACE,FONTMODERN_STR); return FALSE; } /*======================================================================== * Name: cmd_fscript * Purpose: Executes the \fscript command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_fscript (Word *w, int align, char has_param, short param) { attr_push(ATTR_FONTFACE,FONTSCRIPT_STR); return FALSE; } /*======================================================================== * Name: cmd_fdecor * Purpose: Executes the \fdecor command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_fdecor (Word *w, int align, char has_param, short param) { attr_push(ATTR_FONTFACE,FONTDECOR_STR); return FALSE; } /*======================================================================== * Name: cmd_ftech * Purpose: Executes the \ftech command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_ftech (Word *w, int align, char has_param, short param) { attr_push(ATTR_FONTFACE,FONTTECH_STR); return FALSE; } /*======================================================================== * Name: cmd_expand * Purpose: Executes the \expand command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_expand (Word *w, int align, char has_param, short param) { char str[10]; if (has_param) { sprintf (str, "%d", param/4); if (!param) attr_pop(ATTR_EXPAND); else attr_push(ATTR_EXPAND, str); } return FALSE; } /*======================================================================== * Name: cmd_emboss * Purpose: Executes the \embo command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_emboss (Word *w, int align, char has_param, short param) { char str[10]; if (has_param && !param) attr_pop(ATTR_EMBOSS); else { sprintf (str, "%d", param); attr_push(ATTR_EMBOSS, str); } return FALSE; } /*======================================================================== * Name: cmd_engrave * Purpose: Executes the \impr command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_engrave (Word *w, int align, char has_param, short param) { char str[10]; if (has_param && !param) attr_pop(ATTR_ENGRAVE); else { sprintf (str, "%d", param); attr_push(ATTR_ENGRAVE, str); } return FALSE; } /*======================================================================== * Name: cmd_caps * Purpose: Executes the \caps command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_caps (Word *w, int align, char has_param, short param) { if (has_param && !param) attr_pop(ATTR_CAPS); else attr_push(ATTR_CAPS,NULL); return FALSE; } /*======================================================================== * Name: cmd_scaps * Purpose: Executes the \scaps command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_scaps (Word *w, int align, char has_param, short param) { if (has_param && !param) attr_pop(ATTR_SMALLCAPS); else attr_push(ATTR_SMALLCAPS,NULL); return FALSE; } /*======================================================================== * Name: cmd_bullet * Purpose: Executes the \bullet command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_bullet (Word *w, int align, char has_param, short param) { printf (op->chars.bullet); ++total_chars_this_line; /* \tab */ return FALSE; } /*======================================================================== * Name: cmd_ldblquote * Purpose: Executes the \ldblquote command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_ldblquote (Word *w, int align, char has_param, short param) { printf (op->chars.left_dbl_quote); ++total_chars_this_line; /* \tab */ return FALSE; } /*======================================================================== * Name: cmd_rdblquote * Purpose: Executes the \rdblquote command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_rdblquote (Word *w, int align, char has_param, short param) { printf (op->chars.right_dbl_quote); ++total_chars_this_line; /* \tab */ return FALSE; } /*======================================================================== * Name: cmd_lquote * Purpose: Executes the \lquote command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_lquote (Word *w, int align, char has_param, short param) { printf (op->chars.left_quote); ++total_chars_this_line; /* \tab */ return FALSE; } /*======================================================================== * Name: cmd_nonbreaking_space * Purpose: Executes the nonbreaking space command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_nonbreaking_space (Word *w, int align, char has_param, short param) { printf (op->chars.nonbreaking_space); ++total_chars_this_line; /* \tab */ return FALSE; } /*======================================================================== * Name: cmd_nonbreaking_hyphen * Purpose: Executes the nonbreaking hyphen command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_nonbreaking_hyphen (Word *w, int align, char has_param, short param) { printf (op->chars.nonbreaking_hyphen); ++total_chars_this_line; /* \tab */ return FALSE; } /*======================================================================== * Name: cmd_optional_hyphen * Purpose: Executes the optional hyphen command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_optional_hyphen (Word *w, int align, char has_param, short param) { printf (op->chars.optional_hyphen); ++total_chars_this_line; /* \tab */ return FALSE; } /*======================================================================== * Name: cmd_emdash * Purpose: Executes the \emdash command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_emdash (Word *w, int align, char has_param, short param) { printf (op->chars.emdash); ++total_chars_this_line; /* \tab */ return FALSE; } /*======================================================================== * Name: cmd_endash * Purpose: Executes the \endash command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_endash (Word *w, int align, char has_param, short param) { printf (op->chars.endash); ++total_chars_this_line; /* \tab */ return FALSE; } /*======================================================================== * Name: cmd_rquote * Purpose: Executes the \rquote command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_rquote (Word *w, int align, char has_param, short param) { printf (op->chars.right_quote); ++total_chars_this_line; /* \tab */ return FALSE; } /*======================================================================== * Name: cmd_par * Purpose: Executes the \par command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_par (Word *w, int align, char has_param, short param) { printf (op->line_break); total_chars_this_line = 0; /* \tab */ return FALSE; } /*======================================================================== * Name: cmd_line * Purpose: Executes the \line command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_line (Word *w, int align, char has_param, short param) { printf (op->line_break); total_chars_this_line = 0; /* \tab */ return FALSE; } /*======================================================================== * Name: cmd_page * Purpose: Executes the \page command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_page (Word *w, int align, char has_param, short param) { printf (op->page_break); total_chars_this_line = 0; /* \tab */ return FALSE; } /*======================================================================== * Name: cmd_intbl * Purpose: Executes the \intbl command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_intbl (Word *w, int align, char has_param, short param) { ++coming_pars_that_are_tabular; return FALSE; } /*======================================================================== * Name: cmd_ulnone * Purpose: Executes the \ulnone command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_ulnone (Word *w, int align, char has_param, short param) { int attr, more=TRUE; #ifdef BINARY_ATTRS attr_remove_underlining(); #else do { attr = attr_read(); if (attr==ATTR_UNDERLINE || attr==ATTR_DOT_UL || attr==ATTR_DASH_UL || attr==ATTR_DOT_DASH_UL || attr==ATTR_2DOT_DASH_UL || attr==ATTR_WORD_UL || attr==ATTR_WAVE_UL || attr==ATTR_THICK_UL || attr==ATTR_DOUBLE_UL) { if (!attr_pop(ATTR_UNDERLINE)) ; } else more=FALSE; } while(more); #endif return FALSE; } /*======================================================================== * Name: cmd_ul * Purpose: Executes the \ul command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_ul (Word *w, int align, char has_param, short param) { if (has_param && param == 0) { cmd_ulnone (w, align, has_param, param); } else { attr_push (ATTR_UNDERLINE,NULL); } return FALSE; } /*======================================================================== * Name: cmd_uld * Purpose: Executes the \uld command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_uld (Word *w, int align, char has_param, short param) { attr_push(ATTR_DOUBLE_UL,NULL); return FALSE; } /*======================================================================== * Name: cmd_uldb * Purpose: Executes the \uldb command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_uldb (Word *w, int align, char has_param, short param) { attr_push(ATTR_DOT_UL,NULL); return FALSE; } /*======================================================================== * Name: cmd_uldash * Purpose: Executes the \uldash command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_uldash (Word *w, int align, char has_param, short param) { attr_push(ATTR_DASH_UL,NULL); return FALSE; } /*======================================================================== * Name: cmd_uldashd * Purpose: Executes the \cmd_uldashd command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_uldashd (Word *w, int align, char has_param, short param) { attr_push(ATTR_DOT_DASH_UL,NULL); return FALSE; } /*======================================================================== * Name: cmd_uldashdd * Purpose: Executes the \uldashdd command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_uldashdd (Word *w, int align, char has_param, short param) { attr_push(ATTR_2DOT_DASH_UL,NULL); return FALSE; } /*======================================================================== * Name: cmd_ulw * Purpose: Executes the \ulw command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_ulw (Word *w, int align, char has_param, short param) { attr_push(ATTR_WORD_UL,NULL); return FALSE; } /*======================================================================== * Name: cmd_ulth * Purpose: Executes the \ulth command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_ulth (Word *w, int align, char has_param, short param) { attr_push(ATTR_THICK_UL,NULL); return FALSE; } /*======================================================================== * Name: cmd_ulwave * Purpose: Executes the \ulwave command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_ulwave (Word *w, int align, char has_param, short param) { attr_push(ATTR_WAVE_UL,NULL); return FALSE; } /*======================================================================== * Name: cmd_strike * Purpose: Executes the \strike command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_strike (Word *w, int align, char has_param, short param) { if (has_param && param==0) attr_pop(ATTR_STRIKE); else attr_push(ATTR_STRIKE,NULL); return FALSE; } /*======================================================================== * Name: cmd_strikedl * Purpose: Executes the \strikedl command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_strikedl (Word *w, int align, char has_param, short param) { if (has_param && param==0) attr_pop(ATTR_DBL_STRIKE); else attr_push(ATTR_DBL_STRIKE,NULL); return FALSE; } /*======================================================================== * Name: cmd_striked * Purpose: Executes the \striked command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_striked (Word *w, int align, char has_param, short param) { if (has_param && param==0) attr_pop(ATTR_DBL_STRIKE); else attr_push(ATTR_DBL_STRIKE,NULL); return FALSE; } /*======================================================================== * Name: cmd_rtf * Purpose: Executes the \rtf command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_rtf (Word *w, int align, char has_param, short param) { return FALSE; } /*======================================================================== * Name: cmd_up * Purpose: Executes the \up command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_up (Word *w, int align, char has_param, short param) { if (has_param && param==0) attr_pop(ATTR_SUPER); else attr_push(ATTR_SUPER,NULL); return FALSE; } /*======================================================================== * Name: cmd_dn * Purpose: Executes the \dn command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_dn (Word *w, int align, char has_param, short param) { if (has_param && param==0) attr_pop(ATTR_SUB); else attr_push(ATTR_SUB,NULL); return FALSE; } /*======================================================================== * Name: cmd_nosupersub * Purpose: Executes the \nosupersub command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_nosupersub (Word *w, int align, char has_param, short param) { attr_pop(ATTR_SUPER); attr_pop(ATTR_SUB); return FALSE; } /*======================================================================== * Name: cmd_super * Purpose: Executes the \super command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_super (Word *w, int align, char has_param, short param) { if (has_param && param==0) attr_pop(ATTR_SUPER); else attr_push(ATTR_SUPER,NULL); return FALSE; } /*======================================================================== * Name: cmd_sub * Purpose: Executes the \sub command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_sub (Word *w, int align, char has_param, short param) { if (has_param && param==0) attr_pop(ATTR_SUB); else attr_push(ATTR_SUB,NULL); return FALSE; } /*======================================================================== * Name: cmd_shad * Purpose: Executes the \shad command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_shad (Word *w, int align, char has_param, short param) { if (has_param && param==0) attr_pop(ATTR_SHADOW); else attr_push(ATTR_SHADOW,NULL); return FALSE; } /*======================================================================== * Name: cmd_b * Purpose: Executes the \b command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_b (Word *w, int align, char has_param, short param) { if (has_param && param==0) { attr_pop(ATTR_BOLD); } else attr_push(ATTR_BOLD,NULL); return FALSE; } /*======================================================================== * Name: cmd_i * Purpose: Executes the \i command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_i (Word *w, int align, char has_param, short param) { if (has_param && param==0) attr_pop(ATTR_ITALIC); else attr_push(ATTR_ITALIC,NULL); return FALSE; } /*======================================================================== * Name: cmd_s * Purpose: Executes the \s command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_s (Word *w, int align, char has_param, short param) { return FALSE; } /*======================================================================== * Name: cmd_sect * Purpose: Executes the \sect command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_sect (Word *w, int align, char has_param, short param) { /* XX kludge */ printf (op->paragraph_begin); return FALSE; } /*======================================================================== * Name: cmd_shp * Purpose: Executes the \shp command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_shp (Word *w, int align, char has_param, short param) { printf (op->comment_begin); printf ("Drawn Shape (ignored--not implemented yet)"); printf (op->comment_begin); return FALSE; } /*======================================================================== * Name: cmd_outl * Purpose: Executes the \outl command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_outl (Word *w, int align, char has_param, short param) { if (has_param && param==0) attr_pop(ATTR_OUTLINE); else attr_push(ATTR_OUTLINE,NULL); return FALSE; } /*======================================================================== * Name: cmd_ansi * Purpose: Executes the \ansi command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_ansi (Word *w, int align, char has_param, short param) { charset_type = CHARSET_ANSI; printf (op->comment_begin); printf ("document uses ANSI character set"); printf (op->comment_end); return FALSE; } /*======================================================================== * Name: cmd_pc * Purpose: Executes the \pc command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_pc (Word *w, int align, char has_param, short param) { charset_type = CHARSET_CP437 ; printf (op->comment_begin); printf ("document uses PC codepage 437 character set"); printf (op->comment_end); return FALSE; } /*======================================================================== * Name: cmd_pca * Purpose: Executes the \pca command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_pca (Word *w, int align, char has_param, short param) { charset_type = CHARSET_CP850; printf (op->comment_begin); printf ("document uses PC codepage 850 character set"); printf (op->comment_end); return FALSE; } /*======================================================================== * Name: cmd_mac * Purpose: Executes the \mac command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_mac (Word *w, int align, char has_param, short param) { charset_type = CHARSET_MAC; printf (op->comment_begin); printf ("document uses Macintosh character set"); printf (op->comment_end); return FALSE; } /*======================================================================== * Name: cmd_colortbl * Purpose: Executes the \colortbl command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_colortbl (Word *w, int align, char has_param, short param) { if (w->next) { process_color_table(w->next); } return TRUE; } /*======================================================================== * Name: cmd_fonttbl * Purpose: Executes the \fonttbl command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_fonttbl (Word *w, int align, char has_param, short param) { if (w->next) { process_font_table(w->next); } return TRUE; } /*======================================================================== * Name: cmd_header * Purpose: Executes the \header command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_header (Word *w, int align, char has_param, short param) { return TRUE; } /*======================================================================== * Name: cmd_headerl * Purpose: Executes the \headerl command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_headerl (Word *w, int align, char has_param, short param) { return TRUE; } /*======================================================================== * Name: cmd_headerr * Purpose: Executes the \headerr command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_headerr (Word *w, int align, char has_param, short param) { return TRUE; } /*======================================================================== * Name: cmd_headerf * Purpose: Executes the \headerf command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_headerf (Word *w, int align, char has_param, short param) { return TRUE; } /*======================================================================== * Name: cmd_footer * Purpose: Executes the \footer command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_footer (Word *w, int align, char has_param, short param) { return TRUE; } /*======================================================================== * Name: cmd_footerl * Purpose: Executes the \footerl command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_footerl (Word *w, int align, char has_param, short param) { return TRUE; } /*======================================================================== * Name: cmd_footerr * Purpose: Executes the \footerr command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_footerr (Word *w, int align, char has_param, short param) { return TRUE; } /*======================================================================== * Name: cmd_footerf * Purpose: Executes the \footerf command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_footerf (Word *w, int align, char has_param, short param) { return TRUE; } /*======================================================================== * Name: cmd_ignore * Purpose: Dummy function to get rid of subgroups * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_ignore (Word *w, int align, char has_param, short param) { return TRUE; } /*======================================================================== * Name: cmd_info * Purpose: Executes the \info command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_info (Word *w, int align, char has_param, short param) { process_info_group (w->next); return TRUE; } /*======================================================================== * Name: cmd_pict * Purpose: Executes the \pict command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_pict (Word *w, int align, char has_param, short param) { within_picture=TRUE; picture_width = picture_height = 0; picture_type = PICT_WB; return FALSE; } /*======================================================================== * Name: cmd_bin * Purpose: Executes the \bin command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_bin (Word *w, int align, char has_param, short param) { return FALSE; } /*======================================================================== * Name: cmd_macpict * Purpose: Executes the \macpict command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_macpict (Word *w, int align, char has_param, short param) { picture_type = PICT_MAC; return FALSE; } /*======================================================================== * Name: cmd_jpegblip * Purpose: Executes the \jpegblip command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_jpegblip (Word *w, int align, char has_param, short param) { picture_type = PICT_JPEG; return FALSE; } /*======================================================================== * Name: cmd_pngblip * Purpose: Executes the \pngblip command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_pngblip (Word *w, int align, char has_param, short param) { picture_type = PICT_PNG; return FALSE; } /*======================================================================== * Name: cmd_pnmetafile * Purpose: Executes the \pnmetafile command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_pnmetafile (Word *w, int align, char has_param, short param) { picture_type = PICT_PM; return FALSE; } /*======================================================================== * Name: cmd_wmetafile * Purpose: Executes the \wmetafile command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_wmetafile (Word *w, int align, char has_param, short param) { picture_type = PICT_WM; if (within_picture && has_param) { picture_wmetafile_type=param; switch(param) { case 1: picture_wmetafile_type_str="MM_TEXT"; break; case 2: picture_wmetafile_type_str="MM_LOMETRIC"; break; case 3: picture_wmetafile_type_str="MM_HIMETRIC"; break; case 4: picture_wmetafile_type_str="MM_LOENGLISH"; break; case 5: picture_wmetafile_type_str="MM_HIENGLISH"; break; case 6: picture_wmetafile_type_str="MM_TWIPS"; break; case 7: picture_wmetafile_type_str="MM_ISOTROPIC"; break; case 8: picture_wmetafile_type_str="MM_ANISOTROPIC"; break; default: picture_wmetafile_type_str="default:MM_TEXT"; break; } } return FALSE; } /*======================================================================== * Name: cmd_wbmbitspixel * Purpose: Executes the \wbmbitspixel command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_wbmbitspixel (Word *w, int align, char has_param, short param) { if (within_picture && has_param) picture_bits_per_pixel = param; return FALSE; } /*======================================================================== * Name: cmd_picw * Purpose: Executes the \picw command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_picw (Word *w, int align, char has_param, short param) { if (within_picture && has_param) picture_width = param; return FALSE; } /*======================================================================== * Name: cmd_pich * Purpose: Executes the \pich command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_pich (Word *w, int align, char has_param, short param) { if (within_picture && has_param) picture_height = param; return FALSE; } /*======================================================================== * Name: cmd_xe * Purpose: Executes the \xe (index entry) command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_xe (Word *w, int align, char has_param, short param) { process_index_entry (w); return TRUE; } /*======================================================================== * Name: cmd_tc * Purpose: Executes the \tc (TOC entry) command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_tc (Word *w, int align, char has_param, short param) { process_toc_entry (w, TRUE); return TRUE; } /*======================================================================== * Name: cmd_tcn * Purpose: Executes the \tcn (TOC entry, no page #) command. * Args: Word, paragraph align info, and numeric param if any. * Returns: Flag, true only if rest of Words on line should be ignored. *=======================================================================*/ static int cmd_tcn (Word *w, int align, char has_param, short param) { process_toc_entry (w, FALSE); return TRUE; } typedef struct { char *name; int (*func)(Word*,int,char,short); char *debug_print; } HashItem; static HashItem hashArray_other [] = { { "*", cmd_ignore, NULL }, { "-", cmd_optional_hyphen, "optional hyphen" }, { "_", cmd_nonbreaking_hyphen, "nonbreaking hyphen" }, { "~", cmd_nonbreaking_space, NULL }, { NULL, NULL, NULL} }; static HashItem hashArray_a [] = { { "ansi", &cmd_ansi , NULL }, { NULL, NULL, NULL} }; static HashItem hashArray_b [] = { { "b", &cmd_b, NULL }, { "bullet", &cmd_bullet, NULL }, { "bin", &cmd_bin, "picture is binary" }, #if 0 { "bgbdiag", NULL, NULL }, { "bgcross", NULL, NULL }, { "bgdcross", NULL, NULL }, { "bgfdiag", NULL, NULL }, { "bghoriz", NULL, NULL }, { "bgkbdiag", NULL, NULL }, { "bgkcross", NULL, NULL }, { "bgkdcross", NULL, NULL }, { "bgkfdiag", NULL, NULL }, { "bgkhoriz", NULL, NULL }, { "bgkvert", NULL, NULL }, { "bgvert", NULL, NULL }, { "brdrcf", NULL, NULL }, { "brdrdb", NULL, NULL }, { "brdrdot", NULL, NULL }, { "brdrhair", NULL, NULL }, { "brdrs", NULL, NULL }, { "brdrsh", NULL, NULL }, { "brdrth", NULL, NULL }, { "brdrw", NULL, NULL }, #endif { NULL, NULL, NULL} }; static HashItem hashArray_c [] = { { "caps", &cmd_caps, NULL }, { "cb", cmd_cb, NULL }, { "cf", cmd_cf, NULL }, { "colortbl", &cmd_colortbl, "color table" }, { "cols", NULL, "columns (not implemented)" }, { "column", NULL, "column break (not implemented)" }, #if 0 { "cbpat", NULL, NULL }, { "cellx", NULL, NULL }, { "cfpat", NULL, NULL }, { "cgrid", NULL, NULL }, { "clbgbcross", NULL, NULL }, { "clbgbdiag", NULL, NULL }, { "clbgbkbdiag", NULL, NULL }, { "clbgbkcross", NULL, NULL }, { "clbgbkdcross", NULL, NULL }, { "clbgbkfdiag", NULL, NULL }, { "clbgbkhor", NULL, NULL }, { "clbgbkvert", NULL, NULL }, { "clbgdcross", NULL, NULL }, { "clbgfdiag", NULL, NULL }, { "clbghoriz", NULL, NULL }, { "clbgvert", NULL, NULL }, { "clbrdrb", NULL, NULL }, { "clbrdrl", NULL, NULL }, { "clbrdrr", NULL, NULL }, { "clbrdrt", NULL, NULL }, { "clcbpat", NULL, NULL }, { "clcfpat", NULL, NULL }, { "clmgf", NULL, NULL }, { "clmrg", NULL, NULL }, { "clshdng", NULL, NULL }, #endif { NULL, NULL, NULL} }; static HashItem hashArray_d [] = { { "dn", &cmd_dn, NULL }, #if 0 { "dibitmap", NULL, NULL }, #endif { NULL, NULL, NULL} }; static HashItem hashArray_e [] = { { "emdash", cmd_emdash, NULL }, { "endash", cmd_endash, NULL }, { "embo", &cmd_emboss, NULL }, { "expand", &cmd_expand, NULL }, { "expnd", &cmd_expand, NULL }, { NULL, NULL, NULL} }; static HashItem hashArray_f [] = { { "f", cmd_f, NULL }, { "fdecor", cmd_fdecor, NULL }, { "fmodern", cmd_fmodern, NULL }, { "fnil", cmd_fnil, NULL }, { "fonttbl", cmd_fonttbl, "font table" }, { "froman", cmd_froman, NULL }, { "fs", cmd_fs, NULL }, { "fscript", cmd_fscript, NULL }, { "fswiss", cmd_fswiss, NULL }, { "ftech", cmd_ftech, NULL }, { "field", cmd_field, NULL }, { "footer", cmd_footer, NULL }, { "footerf", cmd_footerf, NULL }, { "footerl", cmd_footerl, NULL }, { "footerr", cmd_footerr, NULL }, { NULL, NULL, NULL} }; static HashItem hashArray_h [] = { { "highlight", &cmd_highlight, NULL }, { "header", cmd_header, NULL }, { "headerf", cmd_headerf, NULL }, { "headerl", cmd_headerl, NULL }, { "headerr", cmd_headerr, NULL }, { "hl", cmd_ignore, "hyperlink within object" }, { NULL, NULL, NULL} }; static HashItem hashArray_i [] = { { "i", &cmd_i, NULL }, { "info", &cmd_info, NULL }, { "intbl", &cmd_intbl, NULL }, { "impr", &cmd_engrave, NULL }, { NULL, NULL, NULL} }; static HashItem hashArray_j [] = { { "jpegblip", &cmd_jpegblip, NULL }, { NULL, NULL, NULL} }; static HashItem hashArray_l [] = { { "ldblquote", &cmd_ldblquote, NULL }, { "line", &cmd_line, NULL }, { "lquote", &cmd_lquote, NULL }, { NULL, NULL, NULL} }; static HashItem hashArray_m [] = { { "mac", &cmd_mac , NULL }, { "macpict", &cmd_macpict, NULL }, { NULL, NULL, NULL} }; static HashItem hashArray_n [] = { { "nosupersub", &cmd_nosupersub, NULL }, { NULL, NULL, NULL} }; static HashItem hashArray_o [] = { { "outl", &cmd_outl, NULL }, { NULL, NULL, NULL} }; static HashItem hashArray_p [] = { { "page", &cmd_page, NULL }, { "par", &cmd_par, NULL }, { "pc", &cmd_pc , NULL }, { "pca", &cmd_pca , NULL }, { "pich", &cmd_pich, NULL }, { "pict", &cmd_pict, "picture" }, { "picw", &cmd_picw, NULL }, { "plain", &cmd_plain, NULL }, { "pngblip", &cmd_pngblip, NULL }, { "pnmetafile", &cmd_pnmetafile, NULL }, #if 0 { "piccropb", NULL, NULL }, { "piccropl", NULL, NULL }, { "piccropr", NULL, NULL }, { "piccropt", NULL, NULL }, { "pichgoal", NULL, NULL }, { "pichgoal", NULL, NULL }, { "picscaled", NULL, NULL }, { "picscalex", NULL, NULL }, { "picwgoal", NULL, NULL }, #endif { NULL, NULL, NULL} }; static HashItem hashArray_r [] = { { "rdblquote", &cmd_rdblquote, NULL }, { "rquote", &cmd_rquote, NULL }, { "rtf", &cmd_rtf, NULL }, { NULL, NULL, NULL} }; static HashItem hashArray_s [] = { { "s", cmd_s, "style" }, { "sect", &cmd_sect, "section break"}, { "scaps", &cmd_scaps, NULL }, { "super", &cmd_super, NULL }, { "sub", &cmd_sub, NULL }, { "shad", &cmd_shad, NULL }, { "strike", &cmd_strike, NULL }, { "striked", &cmd_striked, NULL }, { "strikedl", &cmd_strikedl, NULL }, { "stylesheet", &cmd_ignore, "style sheet" }, { "shp", cmd_shp, "drawn shape" }, #if 0 { "shading", NULL, NULL }, #endif { NULL, NULL, NULL} }; static HashItem hashArray_t [] = { { "tab", &cmd_tab, NULL }, { "tc", cmd_tc, "TOC entry" }, { "tcn", cmd_tcn, "TOC entry" }, #if 0 { "tcf", NULL , NULL }, { "tcl", NULL , NULL }, { "trgaph", NULL , NULL }, { "trleft", NULL , NULL }, { "trowd", NULL , NULL }, { "trqc", NULL , NULL }, { "trql", NULL , NULL }, { "trqr", NULL , NULL }, { "trrh", NULL , NULL }, #endif { NULL, NULL, NULL} }; static HashItem hashArray_u [] = { { "ul", &cmd_ul, NULL }, { "up", &cmd_up, NULL }, { "uld", &cmd_uld, NULL }, { "uldash", &cmd_uldash, NULL }, { "uldashd", &cmd_uldashd, NULL }, { "uldashdd", &cmd_uldashdd, NULL }, { "uldb", &cmd_uldb, NULL }, { "ulnone", &cmd_ulnone, NULL }, { "ulth", &cmd_ulth, NULL }, { "ulw", &cmd_ulw, NULL }, { "ulwave", &cmd_ulwave, NULL }, { NULL, NULL, NULL} }; static HashItem hashArray_w [] = { { "wbmbitspixel", &cmd_wbmbitspixel, NULL }, { "wmetafile", &cmd_wmetafile, NULL }, #if 0 { "wbitmap", NULL, NULL }, { "wbmplanes", NULL, NULL }, { "wbmwidthbytes", NULL, NULL }, #endif { NULL, NULL, NULL} }; static HashItem hashArray_x [] = { { "xe", cmd_xe, "index entry" }, { NULL, NULL, NULL} }; static HashItem *hash [26] = { hashArray_a, hashArray_b, hashArray_c, hashArray_d, hashArray_e, hashArray_f, NULL, hashArray_h, hashArray_i, hashArray_j, NULL, hashArray_l, hashArray_m, hashArray_n, hashArray_o, hashArray_p, NULL, hashArray_r, hashArray_s, hashArray_t, hashArray_u, NULL, hashArray_w, hashArray_x, NULL, NULL }; /*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/ /*======================================================================== * Name: * Purpose: * Args: None. * Returns: None. *=======================================================================*/ void print_with_special_exprs (char *s) { int ch; int state; enum { SMALL=0, BIG=1 }; CHECK_PARAM_NOT_NULL(s); if (simulate_smallcaps) { if (*s >= 'a' && *s <= 'z') { state=SMALL; printf (op->smaller_begin); } else state=BIG; } while ((ch=*s)) { char *post_trans = NULL; if (simulate_allcaps || simulate_smallcaps) ch = toupper (ch); if (ch >= 0x20 && ch < 0x80) { post_trans = op_translate_char (op, charset_type, ch); printf ("%s",post_trans); } s++; if (simulate_smallcaps) { ch = *s; if (ch >= 'a' && ch <= 'z') { if (state==BIG) printf (op->smaller_begin); state=SMALL; } else { if (state==SMALL) printf (op->smaller_end); state=BIG; } } } } /*======================================================================== * Name: * Purpose: * Args: None. * Returns: None. *=======================================================================*/ static void begin_table() { within_table=TRUE; have_printed_row_begin = FALSE; have_printed_cell_begin = FALSE; have_printed_row_end = FALSE; have_printed_cell_end = FALSE; attrstack_push(); starting_body(); printf (op->table_begin); } /*======================================================================== * Name: * Purpose: * Args: None. * Returns: None. *=======================================================================*/ void end_table () { if (within_table) { if (!have_printed_cell_end) { attr_pop_dump(); printf (op->table_cell_end); } if (!have_printed_row_end) { printf (op->table_row_end); } printf (op->table_end); within_table=FALSE; have_printed_row_begin = FALSE; have_printed_cell_begin = FALSE; have_printed_row_end = FALSE; have_printed_cell_end = FALSE; } } /*======================================================================== * Name: * Purpose: * Args: None. * Returns: None. *=======================================================================*/ void starting_text() { if (within_table) { if (!have_printed_row_begin) { printf (op->table_row_begin); have_printed_row_begin=TRUE; have_printed_row_end=FALSE; have_printed_cell_begin=FALSE; } if (!have_printed_cell_begin) { printf (op->table_cell_begin); attrstack_express_all(); have_printed_cell_begin=TRUE; have_printed_cell_end=FALSE; } } } /*======================================================================== * Name: * Purpose: * Args: None. * Returns: None. *=======================================================================*/ static void starting_paragraph_align (int align) { if (within_header && align != ALIGN_LEFT) starting_body(); switch (align) { case ALIGN_CENTER: printf (op->center_begin); break; case ALIGN_LEFT: break; case ALIGN_RIGHT: printf (op->align_right_begin); break; case ALIGN_JUSTIFY: printf (op->align_right_begin); break; } } /*======================================================================== * Name: * Purpose: * Args: None. * Returns: None. *=======================================================================*/ static void ending_paragraph_align (int align) { switch (align) { case ALIGN_CENTER: printf (op->center_end); break; case ALIGN_LEFT: // printf (op->align_left_end); break; case ALIGN_RIGHT: printf (op->align_right_end); break; case ALIGN_JUSTIFY: printf (op->justify_end); break; } } /*======================================================================== * Name: * Purpose: Recursive routine to produce the output in the target * format given on a tree of words. * Args: Word* (the tree). * Returns: None. *=======================================================================*/ static void word_print_core (Word *w) { char *s; FILE *f=NULL; int is_cell_group=FALSE; int paragraph_begined=FALSE; int paragraph_align=ALIGN_LEFT; CHECK_PARAM_NOT_NULL(w); if (!coming_pars_that_are_tabular && within_table) { end_table(); } else if (coming_pars_that_are_tabular && !within_table) { begin_table(); } /* Mark our place in the stack */ attrstack_push(); while (w) { s = word_string (w); if (s) { /*--Ignore whitespace in header--------------------*/ if (*s==' ' && within_header) { /* no op */ } else /*--Handle word -----------------------------------*/ if (s[0] != '\\') { starting_body(); starting_text(); if (!paragraph_begined) { starting_paragraph_align (paragraph_align); paragraph_begined=TRUE; } /*----------------------------------------*/ if (within_picture) { starting_body(); if (!f) { char *ext=NULL; switch (picture_type) { case PICT_WB: ext="bmp"; break; case PICT_WM: ext="wmf"; break; case PICT_MAC: ext="pict"; break; case PICT_JPEG: ext="jpg"; break; case PICT_PNG: ext="png"; break; case PICT_DI: ext="dib"; break; /* Device independent bitmap=??? */ case PICT_PM: ext="pmm"; break; /* OS/2 metafile=??? */ } sprintf (picture_path, "pict%03d.%s", picture_file_number++,ext); f=fopen(picture_path,"w"); } if (s[0]!=' ') { char *s2; printf (op->comment_begin); printf ("picture data found, "); if (picture_wmetafile_type_str) { printf ("WMF type is %s, ", picture_wmetafile_type_str); } printf ("picture dimensions are %d by %d, depth %d", picture_width, picture_height, picture_bits_per_pixel); printf (op->comment_end); if (picture_width && picture_height && picture_bits_per_pixel) { s2=s; while (*s2) { unsigned int tmp,value; tmp=tolower(*s2++); if (tmp>'9') tmp-=('a'-10); else tmp-='0'; value=16*tmp; tmp=tolower(*s2++); if (tmp>'9') tmp-=('a'-10); else tmp-='0'; value+=tmp; fprintf (f,"%c", value); } } } } /*----------------------------------------*/ else { total_chars_this_line += strlen(s); if (op->word_begin) printf (op->word_begin); print_with_special_exprs (s); if (op->word_end) printf (op->word_end); } /*---Handle RTF keywords---------------------------*/ } else { int done=FALSE; s++; /*----Paragraph alignment----------------------------------------------------*/ if (!strcmp ("ql", s)) paragraph_align = ALIGN_LEFT; else if (!strcmp ("qr", s)) paragraph_align = ALIGN_RIGHT; else if (!strcmp ("qj", s)) paragraph_align = ALIGN_JUSTIFY; else if (!strcmp ("qc", s)) paragraph_align = ALIGN_CENTER; else if (!strcmp ("pard", s)) { /* Clear out all font attributes. */ attr_pop_all(); if(coming_pars_that_are_tabular) { --coming_pars_that_are_tabular; } /* Clear out all paragraph attributes. */ ending_paragraph_align(paragraph_align); paragraph_align = ALIGN_LEFT; paragraph_begined = FALSE; } /*----Table keywords---------------------------------------------------------*/ else if (!strcmp (s, "cell")) { is_cell_group=TRUE; if (!have_printed_cell_begin) { /* Need this with empty cells */ printf (op->table_cell_begin); attrstack_express_all(); } attr_pop_dump(); printf (op->table_cell_end); have_printed_cell_begin = FALSE; have_printed_cell_end=TRUE; } else if (!strcmp (s, "row")) { if (within_table) { printf (op->table_row_end); have_printed_row_begin = FALSE; have_printed_row_end=TRUE; } else { if (debug_mode) { printf (op->comment_begin); printf ("end of table row"); printf (op->comment_end); } } } /*----Special chars---------------------------------------------------------*/ else if (*s == '\'') { /* \'XX is a hex char code expression */ int ch = h2toi (&s[1]); char *s2; s2 = op_translate_char (op, charset_type, ch); if (!s2 || !*s2) { printf (op->comment_begin); printf("char 0x%02x",ch); printf (op->comment_end); } else { if (op->word_begin) printf (op->word_begin); printf ("%s", s2); if (op->word_end) printf (op->word_end); } } else /*----Search the RTF command hash-------------------------------------------*/ { int ch; int index=0; int have_param=FALSE, param=0; HashItem *hip; char *p; int match; /* Look for a parameter */ p=s; while(*p && (!isdigit(*p) && *p!='-')) p++; if (*p && (isdigit(*p) || *p=='-')) { have_param=TRUE; param=atoi (p); } /* Generate a hash index */ ch = tolower (*s); if (ch>='a' && ch<='z') hip = hash [ch-'a']; else hip = hashArray_other; if (!hip) { if (debug_mode) { printf (op->comment_begin); printf ("unfamiliar rtf command: %s", s); printf (op->comment_begin); } } else { while (!done) { match=FALSE; if (have_param) { int len=p-s; if (!hip[index].name[len] && !strncmp (s, hip[index].name, len)) match=TRUE; } else match = !strcmp(s, hip[index].name); if (match) { #if 0 char *always; #endif char *debug; int terminate_group; if (hip[index].func) { terminate_group = hip[index].func (w,paragraph_align, have_param, param); if (terminate_group) while(w) w=w->next; } debug=hip[index].debug_print; #if 0 always=hip[index].always_print; if (always) printf ("%s", always); #endif if (debug && debug_mode) { printf (op->comment_begin); printf ("%s", debug); printf (op->comment_end); } done=TRUE; } else { index++; if (!hip[index].name) done=TRUE; } } } if (!match) { if (debug_mode) { printf (op->comment_begin); printf ("unfamiliar rtf command: %s", s); printf (op->comment_end); } } } } /*-------------------------------------------------------------------------*/ } else { Word *child; child = w->child; if (!paragraph_begined) { starting_paragraph_align (paragraph_align); paragraph_begined=TRUE; } if (child) word_print_core (child); } if (w) w = w->next; } if (within_picture) { if(f) { fclose(f); printf (op->imagelink_begin); printf ("%s", picture_path); printf (op->imagelink_end); within_picture=FALSE; } } /* Undo font attributes UNLESS we're doing table cells * since they would appear between and . */ if (!is_cell_group) attr_pop_all(); else attr_drop_all(); /* Undo paragraph alignment */ if (paragraph_begined) ending_paragraph_align (paragraph_align); attrstack_drop(); } /*======================================================================== * Name: * Purpose: * Args: None. * Returns: None. *=======================================================================*/ void word_print (Word *w) { CHECK_PARAM_NOT_NULL (w); if (!inline_mode) { printf (op->document_begin); printf (op->header_begin); } print_banner (); within_header=TRUE; have_printed_body=FALSE; within_table=FALSE; simulate_allcaps=FALSE; word_print_core (w); end_table(); if (!inline_mode) { printf (op->body_end); printf (op->document_end); } } ./unrtf-0.19.2/convert.h0000644000175000017500000000314007356513561016354 0ustar msamaralmsamaral00000000000000 /*=========================================================================== GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. ===========================================================================*/ /*---------------------------------------------------------------------- * Module name: convert * Author name: Zach Smith * Create date: 19 Sep 2001 * Purpose: Definitions for the conversion module *---------------------------------------------------------------------- * Changes: *--------------------------------------------------------------------*/ #ifndef _CONVERT enum { CHARSET_ANSI=1, CHARSET_MAC, CHARSET_CP437, CHARSET_CP850 }; #ifndef _WORD #include "word.h" #endif extern void word_print (Word*); #define _CONVERT #endif ./unrtf-0.19.2/defs.h0000644000175000017500000000524210014306351015600 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: defs.h * Author name: Zach Smith * Create date: 1 Sept 2000 * Purpose: Basic definitions plus externs for UnRTF *---------------------------------------------------------------------- * Changes: * 21 Oct 00, tuorfa@yahoo.com: moved program version to this file * 08 Apr 01, tuorfa@yahoo.com: updated usage info. * 08 Sep 01, tuorfa@yahoo.com: added PROGRAM_NAME. * 19 Sep 01, tuorfa@yahoo.com: added PROGRAM_WEBSITE. * 09 Oct 03, daved@physiol.usyd.edu.au: changed to GNU website * 17 Feb 04, marcossamaral@terra.com.br: changed some informations *--------------------------------------------------------------------*/ #define PROGRAM_VERSION "0.19.2" #define PROGRAM_NAME "UnRTF" #define PROGRAM_WEBSITE "http://www.gnu.org/software/unrtf/unrtf.html" /* Select the language for reporting of file creation/modificaton dates */ #define ENGLISH #if 0 #define FRANCAIS #define ITALIANO #define PORTUGUES /* amaral - 0.19.2 */ #endif #ifndef TRUE /* daved 0.19.0 */ #define TRUE (1) #endif #ifndef FALSE /* daved 0.19.0 */ #define FALSE (0) #endif #define USAGE "unrtf [--version] [--help] [--nopict|-n] [--html] [--text] [--vt] [--latex] [--ps] [--wpml] [-t html|text|vt|latex|ps|wpml] " /* Default names for RTF's default fonts */ #define FONTNIL_STR "Times,TimesRoman,TimesNewRoman" #define FONTROMAN_STR "Times,Palatino" #define FONTSWISS_STR "Helvetica,Arial" #define FONTMODERN_STR "Courier,Verdana" #define FONTSCRIPT_STR "Cursive,ZapfChancery" #define FONTDECOR_STR "ZapfChancery" #define FONTTECH_STR "Symbol" ./unrtf-0.19.2/doc/0002755000175000017500000000000007741254407015273 5ustar msamaralmsamaral00000000000000./unrtf-0.19.2/doc/unrtf.html0000644000175000017500000003036110014300255017274 0ustar msamaralmsamaral00000000000000 GNU UnRTF User's Manual
GNU UnRTF User's Manual
For program version 0.19.2
(A work in progress.)


Copyright (C) 2001
by Zachary Thayer Smith.
All rights reserved.

Document begun 18 Sept 01.
Last updated 08 Oct 03.

Preface

Once upon a time, GNU UnRTF was a program that I wrote called "rtf2htm". This seemed too generic a name, since many free programs of varying quality exist with that name. So I finally settled on a new name, UnRTF. This name reflects a desire to convert away from the RTF format, to various other formats. When it came time to include the program into the GNU software suite, the program name was changed to GNU UnRTF. This document is also provided AS-IS and without any warranty of any kind. The user shall utilize the program and/or this document at his or her own risk.

I am the primary engineer behind UnRTF, however I have received comments and bug reports from various people. These contributors are identified in the source code, when they desired to be mentioned.

Program License


   UnRTF, a command-line program to convert RTF documents to other formats.
   Copyright (C) 2000,2001 Zachary Thayer Smith

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

   The author is reachable by electronic mail at tuorfa@yahoo.com.

Introduction

UnRTF is a program to convert RTF (Rich Text) documents to other formats. At present, conversion to HTML is the most complete. I am presently adding LaTeX, plain text, text with VT100 codes, and PostScript conversion. I will later add my own format, WPML (word processor markup language), to that list.

Converting to HTML

The program supports many features of the current RTF standard when converting to HTML.

Character Attributes

Feature NameSupported?
Text font changeyes
Text font sizesyes
Text bold, italicyes
Text single-underlineyes
Other text underlining modes (double, dashed etc)converted to basic underline
Text shadow, outline, emboss, engraveconverted to bold or italic
Text (single-line) strikethroughyes
Text double-strikethroughconverted to single-strikethrough
Text all-capsyes
Text small-capsyes
Text superscript, subscriptyes
Text expand/condenseyes (not all browsers supported)
Text foreground color changeyes
Text background color changeyes

Character Sets

RTF supports at least four character sets, probably more. These four are: ANSI, Macintosh(TM), PC codepage 437, and PC codepage 850. In order to be able to read each of these, a converter can use one of two strategies: either have conversion tables from each of these four to each potential output format, or convert from each of these four to an intermediate, and then have one conversion table from the intermediate to each output format. The first approach requires 2n tables, whereas the second requires 4+n tables where n is the number of output formats. Obviously the second approach is better, but implementing it requires research to find out what the maximal set of characters is. I haven't gotten around to that, so for the time being, UnRTF uses the first approach. In addition, existing open source software may already be available to perform such conversions based on a larger library of character sets. If so, it would be wiser to utilize an existing system such as that.

Text Blocks

Feature NameSupported?
Tablesyes
Table cell background patterns e.g. diagonal linesno
Paragraph left-alignyes
Paragraph right-alignyes
Paragraph centeredyes
Paragraph justifyyes
Paragraph center within tablebuggy?

Converting to LaTeX

LaTeX is a tricky format to convert to, for several reasons. It's a very specialized system of macros. One could argue that it would be easier to convert to raw TeX than bother with the idiosyncrices of LaTeX. It has its own character set and fonts. It has some commands which are unstable, such as \underline. Some commonplace items are not for use outside of equations, e.g. superscripting. I've made an initial effort at getting the converter to work, with improvements later.

Character Attributes

Feature NameSupported?
Text font changenot yet
Text font sizesyes
Text bold, italicyes
Text single-underlineno
Other text underlining modes (double, dashed etc)no
Text shadow, outline, emboss, engraveno
Text (single-line) strikethroughno
Text double-strikethroughno
Text all-capsyes
Text small-capsyes
Text superscript, subscriptyes
Text expand/condenseno
Text foreground color changeno
Text background color changeno

Character Sets

Under construction.

Text Blocks

Feature NameSupported?
Tablesyes
Table cell background patterns e.g. diagonal linesno
Paragraph left-alignyes?
Paragraph right-alignno
Paragraph centeredyes?
Paragraph justifyyes
Paragraph center within tableno

Converting to PostScript

Converting to PostScript is a tricky because it is not actually a document format. PostScript is in fact a stack-based programming language that is executed in the printer. It lacks such concepts are paragraphs and tables or anything document-related really, but it does have drawing primitives, mechanisms for accessing built-in fonts, and can print pages. Still, at first it would that conversion to this format is a very large obstacle. Actually, PostScript is a robust and enjoyable programming language and I am enjoying the task of writing the PostScript code. Presently my text renderer is limited, since it is quite new. I will be improving it soon.

Character Attributes

Feature NameSupported?
Text font changenot yet
Text font sizesyes
Text bold, italicyes
Text single-underlineyes
Other text underlining modes (double, dashed etc)converted to basic underline
Text shadow, outline, emboss, engraveshadow only
Text (single-line) strikethroughyes
Text double-strikethroughconverted to single-strikethrough
Text all-capsyes
Text small-capsnot yet
Text superscript, subscriptnot yet
Text expand/condenseyes
Text foreground color changenot yet
Text background color changenot yet

Character Sets

Under construction.

Text Blocks

Paragraph alignment and tables are not yet supported for PostScript output.

Extra Features

None yet.

Converting to Plain Text

Under construction.

Converting to Text with VT100 control codes

Under construction.

Converting to WPML

Under construction.

Features Not Yet Supported

As development continues, I will try to add support for other features. Some that I know are not covered but that I would like to address include:
  • numbered lists and point lists
  • shapes (objects composed of lines, circles etc)
  • index entries and index generation
  • tables of contents entries and generation
  • automatic conversion of embedded images to PNG

Using UnRTF

Please refer to the manual page (unrtf.1).

Compilation

Please see the README file.

Theory of Operation

This program essentially reads the entire RTF file into memory and works on it. Because of this, it may require that you run the program on a computer that has virtual memory enabled. With smaller input files it should be possible to use the program under DOS, so long as it is compiled with the DOS version of GCC, called DJGPP.

The program operates by dealing with each RTF word in order, and interpreting those which are commands. Some RTF command words have parameters in a subtree. The command \info is an example. The program has separate routines to handle such cases. In fact, most commands have separate functions which handle their execution.

When the program was called rtf2htm (up through version 0.17 or so), the output mechanism was based on the production of HTML exclusively. This has now changed, and the abstraction of an OutputPersonality is used allow other output formats. Each format has its own C file, in which all the basic strings for producing text are stored, as well as character conversion tables. Note, RTF itself allows several character sets to be used, so for each output personality there are that many conversion tables.

One or two things that UnRTF does are fairly tricky, such as the conversion of tabular data. RTF encodes tables in an odd way compared to HTML or LaTeX, so the code is accordingly complicated. Suffice it to say that it works, so don't touch it. Do note, PostScript does not have concept of a table, since it is not a document format but a programming language. I will eventually get tables working under PS anyway, by porting my table rendering code over from my HTML viewer, Beest.

I have implemented at least three optimizations to reduce the amount of memory required by the program and the time used for the conversion.

  1. Text words and RTF command-words are stored in a hash table. This has the effect of saving memory since commonly occurring words such as "the" and "\par" are not repeated in memory. When the program finishes doing the conversion, it reports the number of words hashed.
  2. RTF command-words and pointers to the functions that interpret them are stored in a static hash so that execution can be speedy. This replaces the long if-else sequence once used and greatly speeds up the program.
  3. Input data are buffered, to eliminate the large number of calls to the fgetc function. In a modern OS such as Linux this has only a small impact, but under DOS it can really help.

Notes

  1. LaTeX is a system of macros for TeX originated by Leslie Lamport
  2. WPML is a tentative document format by Zachary Thayer Smith
  3. PostScript is a stack-based programming language for printers.
./unrtf-0.19.2/entity.c0000644000175000017500000000161507702022074016175 0ustar msamaralmsamaral00000000000000#include char *entity(int symbol) { switch(symbol) { case 97: return("α"); case 98: return("β"); case 99: return("χ"); case 100: return("δ"); case 101: return("ε"); case 102: return("φ"); case 103: return("γ"); case 109: return("μ"); case 110: return("ν"); case 111: return("ο"); case 112: return("π"); case 113: return("θ"); case 114: return("ρ"); case 115: return("σ"); case 116: return("τ"); case 117: return("υ"); case 118: return("&omega1;"); case 119: return("ω"); case 120: return("ξ"); case 121: return("ψ"); case 122: return("ζ"); case 177: return("±"); default: fprintf(stderr, "symbol %d missing in entity.c\n", symbol); return("&UnknownEntity;"); } } ./unrtf-0.19.2/error.c0000644000175000017500000000571207741252175016026 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: error * Author name: Zach Smith * Create date: 01 Sep 00 * Purpose: Management of errors and warnings, when reporting * the source code file/line is not necessary. *---------------------------------------------------------------------- * Changes * 10 Oct 00, tuorfa@yahoo.com: added usage() * 15 Oct 00, tuorfa@yahoo.com: improved output readability * 22 Sep 01, tuorfa@yahoo.com: removed mention of line number in handlers * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux *--------------------------------------------------------------------*/ #include #if linux /* daved - 0.19.1 */ #include #endif #include "defs.h" #include "main.h" /*======================================================================== * Name: usage * Purpose: Prints usage information and exits with an error. * Args: None. * Returns: None. *=======================================================================*/ void usage () { fprintf (stderr, "Usage: %s\n", USAGE); exit(-3); } /*======================================================================== * Name: error_handler * Purpose: Prints error message and other useful info, then exits. * Args: Message. * Returns: None. *=======================================================================*/ void error_handler (char* message) { fprintf (stderr, "Error: %s\n", message); exit(10); } /*======================================================================== * Name: warning_handler * Purpose: Prints useful info to stderr, but doesn't exit. * Args: Message. * Returns: None. *=======================================================================*/ void warning_handler (char* message) { fprintf (stderr, "Warning: %s\n", message); } ./unrtf-0.19.2/error.h0000644000175000017500000000362707356513561016037 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: error.h * Author name: Zach Smith * Create date: 1 Sept 2000 * Purpose: Macros to be executed at the start of a function, * when reporting source code file/line is useful. *---------------------------------------------------------------------- * Changes *--------------------------------------------------------------------*/ #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); }} #define CHECK_MALLOC_SUCCESS(XX) { if ((XX)==NULL) { fprintf (stderr, "internal error: cannot allocate memory in %s at %d\n", __FILE__, __LINE__); exit (1); }} extern void usage(void); extern void error_handler (char*); extern void warning_handler (char*); ./unrtf-0.19.2/hash.c0000644000175000017500000001226207741252272015614 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: hash * Author name: Zach Smith * Create date: 01 Sep 00 * Purpose: Word-hash management. Words are put into a hash and an * identifier is returned. This is used to save us from * doing multiple mallocs for recurring strings such as * 'the' and \par. This is not a big issue under Unix, * but it is under other OSes and anyway, waste not want not. *---------------------------------------------------------------------- * Changes: * 08 Apr 01, tuorfa@yahoo.com: check for out of memory after malloc. * 21 Apr 01, tuorfa@yahoo.com: signed to conversion unsigned bug * 03 Aug 01, tuorfa@yahoo.com: fixes for using 16-bit compiler * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 08 Oct 03, daved@physiol.usyd.edu.au: some type fixes *--------------------------------------------------------------------*/ #include #include #include "error.h" #include "main.h" #include "malloc.h" typedef struct _hi { struct _hi *next; char *str; unsigned long value; } HashItem; /* Index by first char of string */ static HashItem *hash[256]; static unsigned long hash_length[256]; static unsigned long hash_value=0; /*======================================================================== * Name: hash_init * Purpose: Clear the hash table. * Args: None. * Returns: None. *=======================================================================*/ void hash_init () { int i; for (i=0; i<256; i++) { hash[i]=NULL; hash_length[i]=0; } } /*======================================================================== * Name: hash_stats * Purpose: Prints to stderr the number of words stored. * Args: None. * Returns: None. *=======================================================================*/ void hash_stats () { int i; unsigned long total=0; for (i=0; i<256; i++) { total += hash_length[i]; } fprintf (stderr,"%lu words were hashed.\n", total); } /*======================================================================== * Name: hashitem_new * Purpose: Creates a new linked list item for the hash table. * Args: String. * Returns: HashItem. *=======================================================================*/ static HashItem * hashitem_new (char *str) { HashItem *hi; unsigned long i; hi=(HashItem*) my_malloc(sizeof(HashItem)); if (!hi) error_handler ("out of memory"); memset ((void*)hi, 0, sizeof (HashItem)); hi->str = my_strdup(str); i = *str; if (i=='\\') i=str[1]; i <<= 24; hi->value = i | (hash_value++ & 0xffffff); hi->next = NULL; #if 0 if (debug_mode) { printf ("\n", hi->value, hi->str); } #endif return hi; } /*======================================================================== * Name: hash_get_index * Purpose: Given a string, returns the "index" i.e. the word identifier. * Args: String. * Returns: Index. *=======================================================================*/ unsigned long hash_get_index (char *str) { #if 1 /* daved - 0.19.1 */ unsigned short index; unsigned char ch; #else int index; char ch; #endif HashItem *hi; #if 1 /* daved - 0.19.1 */ ch = (unsigned char)*str; #else ch = *str; #endif if (ch=='\\' && *(str+1)) ch = *(str+1); index = ch; hi = hash[index]; while (hi) { if (!strcmp(hi->str,str)) return hi->value; hi=hi->next; } /* not in hash */ hi = hashitem_new (str); hi->next = hash[index]; hash [index] = hi; ++hash_length [index]; return hi->value; } /*======================================================================== * Name: hash_get_string * Purpose: Given the index (word identifier) returns the word string. * Args: Index. * Returns: String, or NULL if not found. *=======================================================================*/ char* hash_get_string (unsigned long value) { int index; HashItem *hi; index = value >> 24; hi = hash[index]; while (hi) { if (hi->value == value) return hi->str; hi=hi->next; } warning_handler ("word not in hash"); return NULL; } ./unrtf-0.19.2/hash.h0000644000175000017500000000307607356513561015627 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: hash.h * Author name: Zach Smith * Create date: 1 Sept 2000 * Purpose: Definitions for the hash module. *---------------------------------------------------------------------- * Changes: *--------------------------------------------------------------------*/ extern void hash_init (void); extern void hash_stats (void); extern unsigned long hash_get_index (char *); extern char* hash_get_string (unsigned long ); ./unrtf-0.19.2/html.c0000644000175000017500000004317407741252366015647 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: html * Author name: Zach Smith * Create date: 18 Sep 01 * Purpose: HTML-specific output module *---------------------------------------------------------------------- * Changes: * 01 Aug 01, tuorfa@yahoo.com: code moved over from convert.c * 03 Aug 01, tuorfa@yahoo.com: removed null entries to save space * 08 Aug 01, tuorfa@yahoo.com, gommer@gmx.net: fixed/added some ANSI chars * 18 Sep 01, tuorfa@yahoo.com: moved character sets into html.c etc * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 08 Oct 03, daved@physiol.usyd.edu.au: mac special character fixes *--------------------------------------------------------------------*/ #include #include #include "malloc.h" #include "defs.h" #include "error.h" #include "main.h" #include "output.h" static char* ascii [96] = { /* 0x20 */ " ", "!", "\"", "#", "$", "%", "&", "'", /* 0x28 */ "(", ")", "*", "+", ",", "-", ".", "/", /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7", /* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?", /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G", /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O", /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W", /* 0x58 */ "X", "Y", "Z", "[", "\\", "]", "^", "_", /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g", /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o", /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w", /* 0x78 */ "x", "y", "z", "{", "|", "}", "~", "", }; static char* ansi [] = { /* 0x82 */ "‚", "ƒ", "„", "…", "†", "‡", "ˆ", "‰", "Š", "‹", "Œ", NULL, NULL, NULL, /* 0x90 */ NULL,"`","'","``","''","•","–","—", /* 0x98 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, /* 0xa0 */ " ","¡","¢","£","¤","¥","¦","§", /* 0xa8 */ "¨","©","ª","«","¬","­","®","¯", /* 0xb0 */ "°", "±","²","³","´","µ","¶","·", /* 0xb8 */ "¸","¹", "º","»", "¼", "½","¾","¿", /* 0xc0 */ "À","Á","Â","Ã","Ä","Å","Æ","Ç", /* 0xc8 */ "È","É","Ê","Ë","Ì","Í","Î","Ï", /* 0xd0 */ "Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×", /* 0xd8 */ "Ø","Ù","Ú","Û","Ü","Ý","Þ","ß", /* 0xe0 */ "à","á","â","ã","ä","å","æ","ç", /* 0xe8 */ "è","é","ê","ë","ì","í","î","ï", /* 0xf0 */ "ð","ñ","ò","ó","ô","õ","ö","÷", /* 0xf8 */ "ø","ù","ú","û","ü","ý","þ","ÿ", }; #if 1 /* daved - 0.19.1 */ static char* mac [] = { /* 0xa4 */ "•", NULL,NULL,NULL, /* 0xa8 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, /* 0xb0 */ NULL,NULL,NULL,NULL,NULL,"μ",NULL,NULL, /* 0xb8 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, /* 0xc0 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, /* 0xc8 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, /* 0xd0 */ "—","–","“","”","&lquo;","&rquo;", }; #else static char* mac [] = { /* 0xa4 */ "•", NULL,NULL,NULL,NULL,NULL,NULL,NULL, /* 0xb0 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, /* 0xc0 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, /* 0xd0 */ "—","–","“","”","&lquo;","&rquo;", }; #endif static char* cp437 [] = { /* 0x80 */ "ç", /* 0x81 */ "ü", /* 0x82 */ "é", /* 0x83 */ "â", /* 0x84 */ "ä", /* 0x85 */ "à", /* 0x86 */ "å", /* 0x87 */ "ç", /* 0x88 */ "ê", /* 0x89 */ "ë", /* 0x8a */ "è", /* 0x8b */ "ï", /* 0x8c */ "î", /* 0x8d */ "ì", /* 0x8e */ "ä", /* 0x8f */ "å", /* 0x90 */ "é", /* 0x91 */ "æ", /* 0x92 */ "æ", /* 0x93 */ "ô", /* 0x94 */ "ö", /* 0x95 */ "ò", /* 0x96 */ "û", /* 0x97 */ "ù", /* 0x98 */ "ÿ", /* 0x99 */ "ö", /* 0x9a */ "ü", /* 0x9b */ "¢", /* 0x9c */ "£", /* 0x9d */ "¥", /* 0x9e */ "₧", /* peseta */ /* 0x9f */ "ƒ", /* small f with hook */ /* 0xa0 */ "á", /* 0xa1 */ "í", /* 0xa2 */ "ó", /* 0xa3 */ "ú", /* 0xa4 */ "ñ", /* 0xa5 */ "ñ", /* 0xa6 */ "ª", /* 0xa7 */ "¼", /* 0xa8 */ "¿", /* 0xa9 */ "⌐", /* reversed not */ /* 0xaa */ "¬", /* 0xab */ "½", /* 0xac */ "»", /* 0xad */ "¡", /* 0xae */ "«", /* 0xaf */ "º", /* 0xb0 */ "░", /* light shade */ /* 0xb1 */ "▒", /* med. shade */ /* 0xb2 */ "▓", /* dark shade */ /* 0xb3 */ "│", /* box-draw light vert. */ /* 0xb4 */ "┤", /* box-draw light vert. + lt. */ /* 0xb5 */ "╡", /* box-draw vert. sgl. + lt. dbl. */ /* 0xb6 */ "╢", /* box-draw vert. dbl. + lt. sgl. */ /* 0xb7 */ "╖", /* box-draw dn. dbl. + lt. sgl. */ /* 0xb8 */ "╕", /* box-draw dn. sgl. + lt. dbl. */ /* 0xb9 */ "╣", /* box-draw dbl. vert. + lt. */ /* 0xba */ "║", /* box-draw dbl. vert. */ /* 0xbb */ "╗", /* box-draw dbl. dn. + lt. */ /* 0xbc */ "╝", /* box-draw dbl. up + lt. */ /* 0xbd */ "╜", /* box-draw up dbl. + lt. sgl. */ /* 0xbe */ "╛", /* box-draw up sgl. + lt. dbl. */ /* 0xbf */ "┐", /* box-draw light dn. + lt. */ /* 0xc0 */ "└", /* box-draw light up + rt. */ /* 0xc1 */ "┴", /* box-draw light up + horiz. */ /* 0xc2 */ "┬", /* box-draw light dn. + horiz. */ /* 0xc3 */ "├", /* box-draw light vert. + rt. */ /* 0xc4 */ "─", /* box-draw light horiz. */ /* 0xc5 */ "┼", /* box-draw light vert. + horiz. */ /* 0xc6 */ "╞", /* box-draw vert. sgl. + rt. dbl. */ /* 0xc7 */ "╟", /* box-draw vert. dbl. + rt. sgl. */ /* 0xc8 */ "╚", /* box-draw dbl. up + rt. */ /* 0xc9 */ "╔", /* box-draw dbl. dn. + rt. */ /* 0xca */ "╩", /* box-draw dbl. up + horiz. */ /* 0xcb */ "╦", /* box-draw dbl. dn. + horiz. */ /* 0xcc */ "╠", /* box-draw dbl. vert. + rt. */ /* 0xcd */ "═", /* box-draw dbl. horiz. */ /* 0xce */ "╬", /* box-draw dbl. vert. + horiz. */ /* 0xcf */ "╧", /* box-draw up sgl. + horiz. dbl. */ /* 0xd0 */ "╨", /* box-draw up dbl. + horiz. sgl. */ /* 0xd1 */ "╤", /* box-draw dn. sgl. + horiz. dbl. */ /* 0xd2 */ "╥", /* box-draw dn. dbl. + horiz. sgl. */ /* 0xd3 */ "╙", /* box-draw up dbl. + rt. sgl. */ /* 0xd4 */ "╘", /* box-draw up sgl. + rt. dbl. */ /* 0xd5 */ "╒", /* box-draw dn. sgl. + rt. dbl. */ /* 0xd6 */ "╓", /* box-draw dn. dbl. + rt. sgl. */ /* 0xd7 */ "╫", /* box-draw vert. dbl. + horiz. sgl. */ /* 0xd8 */ "╪", /* box-draw vert. sgl. + horiz. dbl. */ /* 0xd9 */ "┘", /* box-draw light up + lt. */ /* 0xda */ "┌", /* box-draw light dn. + rt. */ /* 0xdb */ "█", /* full block */ /* 0xdc */ "▄", /* lower 1/2 block */ /* 0xdd */ "▌", /* lt. 1/2 block */ /* 0xde */ "▐", /* rt. 1/2 block */ /* 0xdf */ "▀", /* upper 1/2 block */ /* 0xe0 */ "α", /* greek small alpha */ /* 0xe1 */ "ß", /* 0xe2 */ "Γ", /* greek cap gamma */ /* 0xe3 */ "π", /* greek small pi */ /* 0xe4 */ "Σ", /* greek cap sigma */ /* 0xe5 */ "σ", /* greek small sigma */ /* 0xe6 */ "µ", /* 0xe7 */ "τ", /* greek small tau */ /* 0xe8 */ "Φ", /* greek cap phi */ /* 0xe9 */ "Θ", /* greek cap theta */ /* 0xea */ "Ω", /* greek cap omega */ /* 0xeb */ "δ", /* greek small delta */ /* 0xec */ "∞", /* inf. */ /* 0xed */ "φ", /* greek small phi */ /* 0xee */ "ε", /* greek small epsilon */ /* 0xef */ "∩", /* intersect */ /* 0xf0 */ "≡", /* identical */ /* 0xf1 */ "±", /* 0xf2 */ "≥", /* greater-than or equal to */ /* 0xf3 */ "≤", /* less-than or equal to */ /* 0xf4 */ "⌠", /* top 1/2 integral */ /* 0xf5 */ "⌡", /* bottom 1/2 integral */ /* 0xf6 */ "÷", /* 0xf7 */ "≈", /* almost = */ /* 0xf8 */ "+", /* 0xf9 */ "∙", /* bullet op */ /* 0xfa */ "·", /* 0xfb */ "√", /* sqrt */ /* 0xfc */ "ⁿ", /* super-script small n */ /* 0xfd */ "²", /* 0xfe */ "■", /* black square */ /* 0xff */ " ", }; static char* cp850 [] = { /* 0x80 */ "ç", /* 0x81 */ "ü", /* 0x82 */ "é", /* 0x83 */ "â", /* 0x84 */ "ä", /* 0x85 */ "à", /* 0x86 */ "å", /* 0x87 */ "ç", /* 0x88 */ "ê", /* 0x89 */ "ë", /* 0x8a */ "è", /* 0x8b */ "ï", /* 0x8c */ "î", /* 0x8d */ "ì", /* 0x8e */ "ä", /* 0x8f */ "å", /* 0x90 */ "é", /* 0x91 */ "æ", /* 0x92 */ "æ", /* 0x93 */ "ô", /* 0x94 */ "ö", /* 0x95 */ "ò", /* 0x96 */ "û", /* 0x97 */ "ù", /* 0x98 */ "ÿ", /* 0x99 */ "ö", /* 0x9a */ "ü", /* 0x9b */ "ø", /* 0x9c */ "£", /* 0x9d */ "ø", /* 0x9e */ "×", /* 0x9f */ "ƒ", /* small f with hook */ /* 0xa0 */ "á", /* 0xa1 */ "í", /* 0xa2 */ "ó", /* 0xa3 */ "ú", /* 0xa4 */ "ñ", /* 0xa5 */ "ñ", /* 0xa6 */ "ª", /* 0xa7 */ "¼", /* 0xa8 */ "¿", /* 0xa9 */ "®", /* 0xaa */ "¬", /* 0xab */ "½", /* 0xac */ "»", /* 0xad */ "¡", /* 0xae */ "«", /* 0xaf */ "º", /* 0xb0 */ "░", /* light shade */ /* 0xb1 */ "▒", /* med. shade */ /* 0xb2 */ "▓", /* dark shade */ /* 0xb3 */ "│", /* box-draw light vert. */ /* 0xb4 */ "┤", /* box-draw light vert. + lt. */ /* 0xb5 */ "á", /* 0xb6 */ "â", /* 0xb7 */ "à", /* 0xb8 */ "©", /* 0xb9 */ "╣", /* box-draw dbl. vert. + lt. */ /* 0xba */ "║", /* box-draw dbl. vert. */ /* 0xbb */ "╗", /* box-draw dbl. dn. + lt. */ /* 0xbc */ "╝", /* box-draw dbl. up + lt. */ /* 0xbd */ "¢", /* 0xbe */ "¥", /* 0xbf */ "┐", /* box-draw light dn. + lt. */ /* 0xc0 */ "└", /* box-draw light up + rt. */ /* 0xc1 */ "┴", /* box-draw light up + horiz. */ /* 0xc2 */ "┬", /* box-draw light dn. + horiz. */ /* 0xc3 */ "├", /* box-draw light vert. + rt. */ /* 0xc4 */ "─", /* box-draw light horiz. */ /* 0xc5 */ "┼", /* box-draw light vert. + horiz. */ /* 0xc6 */ "ã", /* 0xc7 */ "ã", /* 0xc8 */ "╚", /* box-draw dbl. up + rt. */ /* 0xc9 */ "╔", /* box-draw dbl. dn. + rt. */ /* 0xca */ "╩", /* box-draw dbl. up + horiz. */ /* 0xcb */ "╦", /* box-draw dbl. dn. + horiz. */ /* 0xcc */ "╠", /* box-draw dbl. vert. + rt. */ /* 0xcd */ "═", /* box-draw dbl. horiz. */ /* 0xce */ "╬", /* box-draw dbl. vert. + horiz. */ /* 0xcf */ "¤", /* 0xd0 */ "ð", /* 0xd1 */ "ð", /* 0xd2 */ "ê", /* 0xd3 */ "ë", /* 0xd4 */ "è", /* 0xd5 */ "ı", /* small dotless i */ /* 0xd6 */ "í", /* 0xd7 */ "î", /* 0xd8 */ "ï", /* 0xd9 */ "┘", /* box-draw light up + lt. */ /* 0xda */ "┌", /* box-draw light dn. + rt. */ /* 0xdb */ "█", /* full-block */ /* 0xdc */ "▄", /* lower 1/2 block */ /* 0xdd */ "¦", /* 0xde */ "ì", /* 0xdf */ "▀", /* upper 1/2 block */ /* 0xe0 */ "ó", /* 0xe1 */ "ß", /* 0xe2 */ "ô", /* 0xe3 */ "ò", /* 0xe4 */ "õ", /* 0xe5 */ "õ", /* 0xe6 */ "µ", /* 0xe7 */ "þ", /* 0xe8 */ "þ", /* 0xe9 */ "ú", /* 0xea */ "û", /* 0xeb */ "ù", /* 0xec */ "ý", /* 0xed */ "ý", /* 0xee */ "¯", /* 0xef */ "´", /* 0xf0 */ "­", /* 0xf1 */ "±", /* 0xf2 */ "‗", /* dbl. lowline */ /* 0xf3 */ "¾", /* 0xf4 */ "¶", /* 0xf5 */ "§", /* 0xf6 */ "÷", /* 0xf7 */ "¸", /* 0xf8 */ "+", /* 0xf9 */ "¨", /* 0xfa */ "·", /* 0xfb */ "¹", /* 0xfc */ "³", /* 0xfd */ "²", /* 0xfe */ "■", /* black square */ /* 0xff */ " ", }; /*======================================================================== * Name: html_init * Purpose: Generates the HTML output personality. * Args: None. * Returns: OutputPersonality. *=======================================================================*/ OutputPersonality * html_init (void) { OutputPersonality* op; op = op_create(); op->comment_begin = "\n"; op->document_begin = "\n"; op->document_end = "\n"; op->header_begin = "\n"; op->header_end = "\n"; op->document_title_begin = ""; op->document_title_end = "\n"; op->document_author_begin = "\n"; op->document_changedate_begin = "\n"; op->body_begin = ""; op->body_end = "\n"; op->paragraph_begin = "

"; op->paragraph_end = "

\n"; op->center_begin = "
"; op->center_end = "
\n"; op->justify_begin = "
\n"; op->justify_end = "
\n"; op->align_left_begin = "
\n"; op->align_left_end = "
\n"; op->align_right_begin = "
\n"; op->align_right_end = "
\n"; op->forced_space = " "; op->line_break = "
\n"; op->page_break = "


\n"; op->hyperlink_begin = "hyperlink_end = "\">hyperlink"; op->imagelink_begin = "imagelink_end = "\">"; op->table_begin = "\n"; op->table_end = "
\n"; op->table_row_begin = ""; op->table_row_end = "\n"; op->table_cell_begin = ""; op->table_cell_end = "\n"; /* Character attributes */ op->font_begin = ""; op->font_end = ""; op->fontsize_begin = ""; op->fontsize_end = ""; op->fontsize8_begin = ""; op->fontsize8_end = ""; op->fontsize10_begin = ""; op->fontsize10_end = ""; op->fontsize12_begin = ""; op->fontsize12_end = ""; op->fontsize14_begin = ""; op->fontsize14_end = ""; op->fontsize18_begin = ""; op->fontsize18_end = ""; op->fontsize24_begin = ""; op->fontsize24_end = ""; op->smaller_begin = ""; op->smaller_end = ""; op->bigger_begin = ""; op->bigger_end = ""; op->foreground_begin = ""; op->foreground_end = ""; op->background_begin = ""; op->background_end = ""; op->bold_begin = ""; op->bold_end = ""; op->italic_begin = ""; op->italic_end = ""; op->underline_begin = ""; op->underline_end = ""; op->dbl_underline_begin = ""; op->dbl_underline_end = ""; op->superscript_begin = ""; op->superscript_end = ""; op->subscript_begin = ""; op->subscript_end = ""; op->strikethru_begin = ""; op->strikethru_end = ""; op->dbl_strikethru_begin = ""; op->dbl_strikethru_end = ""; op->emboss_begin=""; op->emboss_end = ""; op->engrave_begin = ""; op->engrave_end = ""; op->shadow_begin= ""; op->shadow_end= ""; op->outline_begin= ""; op->outline_end= ""; op->expand_begin = ""; op->expand_end = ""; op->pointlist_begin = "

    \n"; op->pointlist_end = "
\n"; op->pointlist_item_begin = "
  • "; op->pointlist_item_end = "
  • \n"; op->numericlist_begin = "
      \n"; op->numericlist_end = "
    \n"; op->numericlist_item_begin = "
  • "; op->numericlist_item_end = "
  • \n"; op->simulate_small_caps = TRUE; op->simulate_all_caps = TRUE; op->simulate_word_underline = TRUE; op->ascii_translation_table = ascii; op->ansi_translation_table = ansi; op->ansi_first_char = 0x82; op->ansi_last_char = 0xff; op->cp437_translation_table = cp437; op->cp437_first_char = 0x80; op->cp437_last_char = 0xff; op->cp850_translation_table = cp850; op->cp850_first_char = 0x80; op->cp850_last_char = 0xff; op->mac_translation_table = mac; op->mac_first_char = 0xa4; op->mac_last_char = 0xd5; op->chars.right_quote = "'"; op->chars.left_quote = "`"; op->chars.right_dbl_quote = "''"; op->chars.left_dbl_quote = "``"; return op; } ./unrtf-0.19.2/html.h0000644000175000017500000000277307356513561015653 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: html * Author name: Zach Smith * Create date: 19 Sep 01 * Purpose: Definitions for the HTML output personality *---------------------------------------------------------------------- * Changes: *--------------------------------------------------------------------*/ #ifndef _HTML extern OutputPersonality* html_init(void); #define _HTML #endif ./unrtf-0.19.2/latex.c0000644000175000017500000001736607356513561016023 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: latex * Author name: Zach Smith * Create date: 18 Sep 01 * Purpose: LaTeX-specific output module *---------------------------------------------------------------------- * Changes: * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 23 Sep 01, tuorfa@yahoo.com: fixed accented characters *--------------------------------------------------------------------*/ #include #include #include "malloc.h" #include "defs.h" #include "error.h" #include "main.h" #include "output.h" static char* ascii [96] = { /* 0x20 */ " ", "!", "''", "\\#", "{\\$}", "\\%", "\\&", "'", /* 0x28 */ "(", ")", "{\ast}", "+", ",", "-", ".", "/", /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7", /* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?", /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G", /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O", /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W", /* 0x58 */ "X", "Y", "Z", "[", "{\\slash}", "]", "{\\caret}", "\\_", /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g", /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o", /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w", /* 0x78 */ "x", "y", "z", "\\{", "$\\mid$", "\\}", "\\~{ }", "", }; static char* ansi [] = { /* 0x82 */ "?", "?", "?", "{\\ldots}", "{\\dag}", "{\\ddag}", "?", "?", "?", "?", "{\\OE}", NULL, NULL, NULL, /* 0x90 */ NULL,"`","'","``","''","{\\bullet}","--","---", /* 0x98 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, /* 0xa0 */ "\\:","?","?","{\\pounds}","?","\\Y","?","?", /* 0xa8 */ "?","{\\copyright}","?","?","?","?","?","?", /* 0xb0 */ "\\o ", "\\+- ","$^{2}$","$^{3}$","?","?","\\P ","?", /* 0xb8 */ "?","$^{1}$", "?","?", "\\frac{1}{4}", "\\frac{1}{2}","\\frac{3}{4}", "?", /* 0xc0 */ "\\`{A}","\\'{A}","\\o{A}", "\\~{A}","\\\"{A}","?","\\AE ","\\c{C}", /* 0xc8 */ "\\`{E}","\\'{E}","\\o{E}","\\\"{E}", "\\`{I}","\\'{I}","\\o{I}","\\\"{I}", /* 0xd0 */ "\\ETH ","\\~{N}","\\`{O}","\\'{O}", "\\o{O}","\\~{O}","\\\"{O}","\\mult ", /* 0xd8 */ "?","\\`{U}","\\'{U}","\\o{U}", "\\\"{U}","\\'{Y}","\\THORN","?", /* 0xe0 */ "\\`{a}","\\'{a}","\\o{a}", "\\~{a}","\\\"{a}","?","\\ae ","\\c{c}", /* 0xe8 */ "\\`{e}","\\'{e}","\\o{e}","\\\"{e}", "\\`{i}","\\'{i}","\\o{i}","\\\"{i}", /* 0xf0 */ "\\eth ","\\~{n}","\\`{o}","\\'{o}", "\\o{o}","\\~{o}","\\\"{o}","\\div ", /* 0xf8 */ "\\slash{o}","\\`{u}","\\'{u}","\\o{u}", "\\\"{u}","\\'{y}","\\thorn ","\\\"{y}", }; static char* mac [] = { "?", }; static char* cp437 [] = { "?", }; static char* cp850 [] = { "?", }; /*======================================================================== * Name: latex_init * Purpose: Generates the output personality for LaTeX. * Args: None. * Returns: OutputPersonality. *=======================================================================*/ OutputPersonality * latex_init (void) { OutputPersonality* op; op = op_create(); op->comment_begin = "%% "; op->comment_end = "\n"; op->document_begin = "\\documentclass[11pt]{article}\n"; op->document_end = "\\end{document}"; op->header_begin = ""; op->header_end = ""; op->document_title_begin = "\\title{"; op->document_title_end = "}\n"; op->document_author_begin = "\\author{"; op->document_author_end = "}\n"; op->document_changedate_begin = "\\date{"; op->document_changedate_end = "}\n"; op->body_begin = "\n\n\\begin{document}\n\\maketitle\n"; op->body_end = "\\end{document}\n"; op->paragraph_begin = "\\par\n"; op->paragraph_end = ""; op->center_begin = "\\center{\n"; op->center_end = "}\n"; op->justify_begin = ""; op->justify_end = ""; op->align_left_begin = "\\begin{sloppy}\n"; op->align_left_end = "\\end{sloppy}\n"; op->align_right_begin = ""; op->align_right_end = ""; op->forced_space = ""; op->line_break = "\\par\n"; op->page_break = "\\pagebreak "; op->hyperlink_begin = ""; op->hyperlink_end = ""; op->imagelink_begin = ""; op->imagelink_end = ""; op->table_begin = "\\begin{tabular}{|lllll}\n"; op->table_end = "\n\\end{tabular}\n"; op->table_row_begin = ""; op->table_row_end = "\\hline \\\\\n"; op->table_cell_begin = ""; op->table_cell_end = " & "; /* Character attributes */ op->font_begin = ""; op->font_end = ""; op->fontsize_begin = ""; op->fontsize_end = ""; op->fontsize8_begin = "\\tiny{"; op->fontsize8_end = "}"; op->fontsize10_begin = "\\small{"; op->fontsize10_end = "}"; op->fontsize12_begin = "\\normalsize{"; op->fontsize12_end = "}"; op->fontsize14_begin = "{\\large "; op->fontsize14_end = "}"; op->fontsize18_begin = "{\\Large "; op->fontsize18_end = "}"; op->fontsize24_begin = "{\\LARGE "; op->fontsize24_end = "}"; op->fontsize36_begin = "{\\huge "; op->fontsize36_end = "}"; op->fontsize48_begin = "{\\Huge "; op->fontsize48_end = "}"; op->smaller_begin = ""; op->smaller_end = ""; op->bigger_begin = ""; op->bigger_end = ""; op->foreground_begin = ""; op->foreground_end = ""; op->background_begin = ""; op->background_end = ""; op->bold_begin = "{\\bf "; op->bold_end = "}"; op->italic_begin = "{\\it "; op->italic_end = "}"; op->underline_begin = ""; op->underline_end = "\n"; op->dbl_underline_begin = "{\\ul "; op->dbl_underline_end = "}"; op->pointlist_begin = "\\begin{itemize}\n"; op->pointlist_end = "\\end{itemize}\n"; op->pointlist_item_begin = "\\item "; op->pointlist_item_end = ""; op->numericlist_begin = "\\begin{enumerate}\n"; op->numericlist_end = "\\end{enumerate}\n"; op->numericlist_item_begin = "\\item "; op->numericlist_item_end = ""; op->superscript_begin = "$^{"; op->superscript_end = "}$"; op->subscript_begin = "$_{"; op->subscript_end = "}$"; op->strikethru_begin = "{"; op->strikethru_end = "}"; op->dbl_strikethru_begin = "{"; op->dbl_strikethru_end = "}"; op->emboss_begin=""; op->emboss_end = ""; op->engrave_begin = ""; op->engrave_end = ""; op->shadow_begin= ""; op->shadow_end= ""; op->small_caps_begin= "\\textsc{"; op->small_caps_end= "}"; op->outline_begin= ""; op->outline_end= ""; op->expand_begin = ""; op->expand_end = ""; op->simulate_small_caps = FALSE; op->simulate_all_caps = TRUE; op->simulate_word_underline = TRUE; op->ascii_translation_table = ascii; op->ansi_translation_table = ansi; op->ansi_first_char = 0x80; op->ansi_last_char = 0x80; op->cp437_translation_table = cp437; op->cp437_first_char = 0x80; op->cp437_last_char = 0x80; op->cp850_translation_table = cp850; op->cp850_first_char = 0x80; op->cp850_last_char = 0x80; op->mac_translation_table = mac; op->mac_first_char = 0x80; op->mac_last_char = 0x80; op->chars.right_quote = "'"; op->chars.left_quote = "`"; op->chars.right_dbl_quote = "''"; op->chars.left_dbl_quote = "``"; return op; } ./unrtf-0.19.2/latex.h0000644000175000017500000000301107356513561016006 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: latex * Author name: Zach Smith * Create date: 19 Sep 01 * Purpose: Definitions for the PostScript(TM) output personality *---------------------------------------------------------------------- * Changes: *--------------------------------------------------------------------*/ #ifndef _LATEX extern OutputPersonality* latex_init(void); #define _LATEX #endif ./unrtf-0.19.2/main.c0000644000175000017500000001374210014303366015605 0ustar msamaralmsamaral00000000000000/*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: main.c * Author name: Zach Smith * Create date: 01 Sep 00 * Purpose: main() routine with file open/close. *---------------------------------------------------------------------- * Changes: * 14 Oct 00, tuorfa@yahoo.com: added -nopict option * 15 Oct 00, tuorfa@yahoo.com: added verify_file_type() * 08 Apr 01, tuorfa@yahoo.com: more GNU-like switches implemented * 24 Jul 01, tuorfa@yahoo.com: removed verify_file_type() * 03 Aug 01, tuorfa@yahoo.com: added --inline switch * 08 Sep 01, tuorfa@yahoo.com: added use of PROGRAM_NAME * 19 Sep 01, tuorfa@yahoo.com: addition of output personalities * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 23 Sep 01, tuorfa@yahoo.com: added wpml switch * 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux *--------------------------------------------------------------------*/ #include #include #if linux /* daved - 0.19.0 */ #include #endif #include "defs.h" #include "error.h" #include "word.h" #include "convert.h" #include "parse.h" #include "hash.h" #include "malloc.h" #include "output.h" #include "html.h" #include "text.h" #include "vt.h" #include "ps.h" #include "latex.h" #include "wpml.h" int nopict_mode; /* TRUE => do not write \pict's to files */ int dump_mode; /* TRUE => output a dump of the word tree */ int debug_mode; /* TRUE => output comments within HTML */ int lineno; /* used for error reporting */ int simple_mode; /* TRUE => output HTML without SPAN/DIV tags */ int inline_mode; /* TRUE => output HTML without HTML/BODY/HEAD */ OutputPersonality *op; enum { OP_HTML, OP_TEXT, OP_LATEX, OP_PS, OP_VT, OP_WPML }; /*======================================================================== * Name: main * Purpose: Main control function. * Args: Args. * Returns: Exit code. *=======================================================================*/ int main (int argc, char **argv) { FILE *f; Word * word; char *path=NULL; int i; int output_format = OP_HTML; nopict_mode = debug_mode = dump_mode = inline_mode = FALSE; if (argc<2 || argc>7) usage(); for (i=1; i: added Amiga/GCC support. * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 28 Sep 01, tuorfa@yahoo.com: removed Turbo C support. * 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux *--------------------------------------------------------------------*/ #include #include #if linux /* daved - 0.19.0 */ #include #endif #if AMIGA #include #else #include #endif #include "error.h" static unsigned long count=0; /*======================================================================== * Name: my_malloc * Purpose: Internal version of malloc necessary for record keeping. * Args: Amount. * Returns: Pointer. *=======================================================================*/ char * my_malloc (unsigned long size) { char *ptr; ptr = malloc (size); if (ptr) count += size; return ptr; } /*======================================================================== * Name: my_free * Purpose: Internal version of free necessary for record keeping. * Args: Pointer. * Returns: None. *=======================================================================*/ void my_free (char* ptr) { CHECK_PARAM_NOT_NULL(ptr); free (ptr); } /*======================================================================== * Name: total_malloced * Purpose: Returns total amount of memory thus far allocated. * Args: None. * Returns: Amount. *=======================================================================*/ unsigned long total_malloced (void) { return count; } /*======================================================================== * Name: my_strdup * Purpose: Internal version of strdup necessary for record keeping. * Args: String. * Returns: String. *=======================================================================*/ char * my_strdup (char *src) { unsigned long len; char *ptr; CHECK_PARAM_NOT_NULL(src); len = strlen(src); ptr = my_malloc (len+1); if (!ptr) error_handler ("out of memory in strdup()"); strcpy (ptr, src); return ptr; } ./unrtf-0.19.2/malloc.h0000644000175000017500000000306607356513561016152 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: malloc * Author name: Zach Smith * Create date: 1 Aug 2001 * Purpose: Definitions for memory management. *---------------------------------------------------------------------- * Changes: *--------------------------------------------------------------------*/ extern char * my_malloc (unsigned long); extern void my_free (char*); extern unsigned long total_malloced (void); extern char * my_strdup (char*); ./unrtf-0.19.2/output.c0000644000175000017500000002417507741252530016234 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: output * Author name: Zach Smith * Create date: 18 Sep 01 * Purpose: Generalized output module *---------------------------------------------------------------------- * Changes: * 22 Sep 01, tuorfa@yahoo.com: addition of functions to change font size * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux *--------------------------------------------------------------------*/ #include #include #if linux /* daved - 0.19.0 */ #include #endif #include "malloc.h" #include "defs.h" #include "error.h" #include "output.h" #include "main.h" #include "convert.h" /*======================================================================== * Name: op_create * Purpose: Creates a blank output personality. * Args: None. * Returns: Output personality struct. *=======================================================================*/ OutputPersonality* op_create () { OutputPersonality* new_op; new_op = (OutputPersonality*) my_malloc (sizeof(OutputPersonality)); if (!new_op) error_handler ("cannot allocate output personality"); bzero ((void*) new_op, sizeof (OutputPersonality)); return new_op; } /*======================================================================== * Name: op_free * Purpose: Deallocates an output personality, but none of the strings * it points to since they are usually constants. * Args: OutputPersonality. * Returns: None. *=======================================================================*/ void op_free (OutputPersonality *op) { CHECK_PARAM_NOT_NULL(op); my_free ((void*) op); } /*======================================================================== * Name: op_translate_char * Purpose: Performs a translation of a character in the context of * a given output personality. * Args: OutputPersonality, character set#, character. * Returns: String. *=======================================================================*/ char * op_translate_char (OutputPersonality *op, int charset, int ch) { short start; char *result=NULL; CHECK_PARAM_NOT_NULL(op); if (ch >= 0x20 && ch < 0x80) { result = op->ascii_translation_table [ch - 0x20]; } else if (charset != CHARSET_ANSI && charset != CHARSET_MAC && charset != CHARSET_CP437 && charset != CHARSET_CP850) error_handler ("invalid character set value, cannot translate character"); else switch (charset) { case CHARSET_ANSI: start = op->ansi_first_char; if (ch >= start && ch <= op->ansi_last_char) result = op->ansi_translation_table [ch-start]; break; case CHARSET_MAC: start = op->mac_first_char; if (ch >= start && ch <= op->mac_last_char) result = op->mac_translation_table [ch-start]; break; case CHARSET_CP437: start = op->cp437_first_char; if (ch >= start && ch <= op->cp437_last_char) result = op->cp437_translation_table [ch-start]; break; case CHARSET_CP850: start = op->cp850_first_char; if (ch >= start && ch <= op->cp850_last_char) result = op->cp850_translation_table [ch-start]; break; } return result; } /*======================================================================== * Name: op_begin_std_fontsize * Purpose: Prints whatever is necessary to perform a change in the * current font size. * Args: OutputPersonality, desired size. * Returns: None. *=======================================================================*/ void op_begin_std_fontsize (OutputPersonality *op, int size) { int found_std_expr = FALSE; CHECK_PARAM_NOT_NULL(op); /* Look for an exact match with a standard point size. */ switch (size) { case 8: if (op->fontsize8_begin) { printf (op->fontsize8_begin); found_std_expr = TRUE; } break; case 10: if (op->fontsize10_begin) { printf (op->fontsize10_begin); found_std_expr = TRUE; } break; case 12: if (op->fontsize12_begin) { printf (op->fontsize12_begin); found_std_expr = TRUE; } break; case 14: if (op->fontsize14_begin) { printf (op->fontsize14_begin); found_std_expr = TRUE; } break; case 18: if (op->fontsize18_begin) { printf (op->fontsize18_begin); found_std_expr = TRUE; } break; case 24: if (op->fontsize24_begin) { printf (op->fontsize24_begin); found_std_expr = TRUE; } break; case 36: if (op->fontsize36_begin) { printf (op->fontsize36_begin); found_std_expr = TRUE; } break; case 48: if (op->fontsize48_begin) { printf (op->fontsize48_begin); found_std_expr = TRUE; } break; } /* If no exact match, try to write out a change to the * exact point size. */ if (!found_std_expr) { if (op->fontsize_begin) { char expr[16]; sprintf (expr, "%d", size); printf (op->fontsize_begin, expr); } else { /* If we cannot write out a change for the exact * point size, we must approximate to a standard * size. */ if (size<9 && op->fontsize8_begin) { printf (op->fontsize8_begin); } else if (size<11 && op->fontsize10_begin) { printf (op->fontsize10_begin); } else if (size<13 && op->fontsize12_begin) { printf (op->fontsize12_begin); } else if (size<16 && op->fontsize14_begin) { printf (op->fontsize14_begin); } else if (size<21 && op->fontsize18_begin) { printf (op->fontsize18_begin); } else if (size<30 && op->fontsize24_begin) { printf (op->fontsize24_begin); } else if (size<42 && op->fontsize36_begin) { printf (op->fontsize36_begin); } else if (size>40 && op->fontsize48_begin) { printf (op->fontsize48_begin); } else /* If we can't even produce a good approximation, * just try to get a font size near 12 point. */ if (op->fontsize12_begin) printf (op->fontsize12_begin); else if (op->fontsize14_begin) printf (op->fontsize14_begin); else if (op->fontsize10_begin) printf (op->fontsize10_begin); else if (op->fontsize18_begin) printf (op->fontsize18_begin); else if (op->fontsize8_begin) printf (op->fontsize8_begin); else error_handler ("output personality lacks sufficient font size change capability"); } } } /*======================================================================== * Name: op_end_std_fontsize * Purpose: Prints whatever is necessary to perform a change in the * current font size. * Args: OutputPersonality, desired size. * Returns: None. *=======================================================================*/ void op_end_std_fontsize (OutputPersonality *op, int size) { int found_std_expr = FALSE; CHECK_PARAM_NOT_NULL(op); /* Look for an exact match with a standard point size. */ switch (size) { case 8: if (op->fontsize8_end) { printf (op->fontsize8_end); found_std_expr = TRUE; } break; case 10: if (op->fontsize10_end) { printf (op->fontsize10_end); found_std_expr = TRUE; } break; case 12: if (op->fontsize12_end) { printf (op->fontsize12_end); found_std_expr = TRUE; } break; case 14: if (op->fontsize14_end) { printf (op->fontsize14_end); found_std_expr = TRUE; } break; case 18: if (op->fontsize18_end) { printf (op->fontsize18_end); found_std_expr = TRUE; } break; case 24: if (op->fontsize24_end) { printf (op->fontsize24_end); found_std_expr = TRUE; } break; case 36: if (op->fontsize36_end) { printf (op->fontsize36_end); found_std_expr = TRUE; } break; case 48: if (op->fontsize48_end) { printf (op->fontsize48_end); found_std_expr = TRUE; } break; } /* If no exact match, try to write out a change to the * exact point size. */ if (!found_std_expr) { if (op->fontsize_end) { char expr[16]; sprintf (expr, "%d", size); printf (op->fontsize_end, expr); } else { /* If we cannot write out a change for the exact * point size, we must approximate to a standard * size. */ if (size<9 && op->fontsize8_end) { printf (op->fontsize8_end); } else if (size<11 && op->fontsize10_end) { printf (op->fontsize10_end); } else if (size<13 && op->fontsize12_end) { printf (op->fontsize12_end); } else if (size<16 && op->fontsize14_end) { printf (op->fontsize14_end); } else if (size<21 && op->fontsize18_end) { printf (op->fontsize18_end); } else if (size<30 && op->fontsize24_end) { printf (op->fontsize24_end); } else if (size<42 && op->fontsize36_end) { printf (op->fontsize36_end); } else if (size>40 && op->fontsize48_end) { printf (op->fontsize48_end); } else /* If we can't even produce a good approximation, * just try to get a font size near 12 point. */ if (op->fontsize12_end) printf (op->fontsize12_end); else if (op->fontsize14_end) printf (op->fontsize14_end); else if (op->fontsize10_end) printf (op->fontsize10_end); else if (op->fontsize18_end) printf (op->fontsize18_end); else if (op->fontsize8_end) printf (op->fontsize8_end); else error_handler ("output personality lacks sufficient font size change capability"); } } } ./unrtf-0.19.2/output.h0000644000175000017500000001235507356513561016244 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: output * Author name: Zach Smith * Create date: 18 Sep 01 * Purpose: Definitions for the generalized output module *---------------------------------------------------------------------- * Changes: *--------------------------------------------------------------------*/ #ifndef _OUTPUT typedef struct { char *comment_begin; char *comment_end; char *document_begin; char *document_end; char *header_begin; char *header_end; char *document_title_begin; char *document_title_end; char *document_keywords_begin; char *document_keywords_end; char *document_author_begin; char *document_author_end; char *document_changedate_begin; char *document_changedate_end; char *body_begin; char *body_end; char *word_begin; char *word_end; char *paragraph_begin; char *paragraph_end; char *center_begin; char *center_end; char *align_left_begin; char *align_left_end; char *align_right_begin; char *align_right_end; char *justify_begin; char *justify_end; char *forced_space; char *line_break; char *page_break; char *hyperlink_begin; char *hyperlink_end; char *imagelink_begin; char *imagelink_end; char *table_begin; char *table_end; char *table_row_begin; char *table_row_end; char *table_cell_begin; char *table_cell_end; /* Character attributes */ char *font_begin; char *font_end; char *fontsize_begin; char *fontsize_end; /* standard font sizes are optional */ char *fontsize8_begin; char *fontsize8_end; char *fontsize10_begin; char *fontsize10_end; char *fontsize12_begin; char *fontsize12_end; char *fontsize14_begin; char *fontsize14_end; char *fontsize18_begin; char *fontsize18_end; char *fontsize24_begin; char *fontsize24_end; char *fontsize36_begin; char *fontsize36_end; char *fontsize48_begin; char *fontsize48_end; char *smaller_begin; char *smaller_end; char *bigger_begin; char *bigger_end; char *foreground_begin; char *foreground_end; char *background_begin; char *background_end; char *bold_begin; char *bold_end; char *italic_begin; char *italic_end; char *underline_begin; char *underline_end; char *dbl_underline_begin; char *dbl_underline_end; char *superscript_begin; char *superscript_end; char *subscript_begin; char *subscript_end; char *strikethru_begin; char *strikethru_end; char *dbl_strikethru_begin; char *dbl_strikethru_end; char *emboss_begin; char *emboss_end; char *engrave_begin; char *engrave_end; char *shadow_begin; char *shadow_end; char *outline_begin; char *outline_end; char *small_caps_begin; char *small_caps_end; char *pointlist_begin; char *pointlist_end; char *pointlist_item_begin; char *pointlist_item_end; char *numericlist_begin; char *numericlist_end; char *numericlist_item_begin; char *numericlist_item_end; char *expand_begin; char *expand_end; char *toc_entry_begin; char *toc_entry_end; char *index_entry_begin; char *index_entry_end; /* XX These should really be replaced by references * to one of the charsets. */ struct { char *bullet; char *left_quote; char *right_quote; char *left_dbl_quote; char *right_dbl_quote; char *nonbreaking_space; char *emdash; char *endash; char *lessthan; char *greaterthan; char *amp; char *copyright; char *trademark; char *nonbreaking_hyphen; char *optional_hyphen; } chars; char **ascii_translation_table; int simulate_small_caps : 1; int simulate_all_caps : 1; int simulate_word_underline : 1; char **ansi_translation_table; short ansi_first_char; short ansi_last_char; char **cp437_translation_table; short cp437_first_char; short cp437_last_char; char **cp850_translation_table; short cp850_first_char; short cp850_last_char; char **mac_translation_table; short mac_first_char; short mac_last_char; void (*write_set_foreground) (int,int,int); } OutputPersonality; extern OutputPersonality* op_create(void); extern void op_free (OutputPersonality*); extern char* op_translate_char (OutputPersonality*,int,int); extern void op_begin_std_fontsize (OutputPersonality*, int); extern void op_end_std_fontsize (OutputPersonality*, int); #define _OUTPUT #endif ./unrtf-0.19.2/parse.c0000644000175000017500000002456007741252545016012 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: parse * Author name: Zach Smith * Create date: 01 Sep 00 * Purpose: Parsing of the RTF file into a structure of Word objects. *---------------------------------------------------------------------- * Changes: * 15 Oct 00, tuorfa@yahoo.com: parse.c created with functions taken from word.c * 15 Oct 00, tuorfa@yahoo.com: backslash before newline is now \par * 08 Apr 01, tuorfa@yahoo.com: removed limit on word length * 03 Aug 01, tuorfa@yahoo.com: added input buffering * 19 Sep 01, tuorfa@yahoo.com: cleaned up read_word() * 22 Sep 01, tuorfa@yahoo.com: moved word_dump() to word.c * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 08 Sep 03, daved@physiol.usyd.edu.au: type fixes; ANSI C fixes *--------------------------------------------------------------------*/ #include #include #include #include #include "defs.h" #include "parse.h" #include "malloc.h" #include "main.h" #include "error.h" #include "word.h" #include "hash.h" /* local to getchar stuff */ #if 0 /* daved - 0.19.0 */ static int ungot_char=-1; static int ungot_char2=-1; static int ungot_char3=-1; #else static int ungot_char = -1; static int ungot_char2 = -1; static int ungot_char3 = -1; #endif /*======================================================================== * Name: my_unget_char * Purpose: My own unget routine, handling up to 3 ungot characters. * Args: Character. * Returns: None. *=======================================================================*/ static void my_unget_char (int ch) { if (ungot_char>=0 && ungot_char2>=0 && ungot_char3>=0) error_handler ("more than 3 ungot chars"); ungot_char3 = ungot_char2; ungot_char2 = ungot_char; ungot_char = ch; } static int last_returned_ch=0; #define READ_BUF_LEN 2048 static int buffer_size = 0; static char *read_buf = NULL; static int read_buf_end = 0; static int read_buf_index = 0; /*======================================================================== * Name: my_getchar * Purpose: Gets a character: either an ungot one, or a buffered one. * Args: Input file. * Returns: Character, or EOF. *=======================================================================*/ static int my_getchar (FILE* f) { int ch; CHECK_PARAM_NOT_NULL(f); if (ungot_char>=0) { ch = ungot_char; #if 0 /* daved - 0.19.0 */ ungot_char=ungot_char2; ungot_char2=ungot_char3; ungot_char3=-1; #else ungot_char = ungot_char2; ungot_char2 = ungot_char3; ungot_char3 = -1; #endif last_returned_ch = ch; if(ch > 255) { fprintf(stderr, "returning bad ch = '%c' (0%o)\n", ch, ch); } return ch; } do { if (read_buf_index >= read_buf_end) { if (!read_buf) { buffer_size = READ_BUF_LEN; read_buf = my_malloc (buffer_size); if (!read_buf) { buffer_size /= 4; read_buf = my_malloc (buffer_size); if (!read_buf) error_handler ("cannot allocate read buffer"); } } read_buf_end = fread (read_buf, 1, buffer_size, f); read_buf_index = 0; if (!read_buf_end) return EOF; } ch = read_buf [read_buf_index++]; if (ch=='\n') { lineno++; /* Convert \(newline) into \par here */ if (last_returned_ch=='\\') { my_unget_char (' '); my_unget_char ('r'); my_unget_char ('a'); ch = 'p'; break; } } } while (ch=='\r' /* || ch=='\n' */ ); if (ch=='\t') ch = ' '; last_returned_ch = ch; if(ch > 255) { fprintf(stderr,"returning bad ch '%c' (0%o)\n", ch, ch); exit(1); } return ch; } /* local to read_word */ static char *input_str = NULL; static unsigned long current_max_length = 1; /*======================================================================== * Name: expand_word_buffer * Purpose: Expands the buffer used to store an incoming word. * This allows us to remove the limit on word length. * Args: None. * Returns: None. *=======================================================================*/ static int expand_word_buffer () { char *new_ptr; unsigned long old_length; if (!input_str) error_handler ("no input buffer allocated"); old_length = current_max_length; current_max_length *= 2; new_ptr = my_malloc (current_max_length); if (!new_ptr) error_handler ("out of memory while resizing buffer"); memcpy (new_ptr, input_str, old_length); my_free (input_str); input_str = new_ptr; return TRUE; } /*======================================================================== * Name: read_word * Purpose: The core of the parser, this reads a word. * Args: Input file. * Returns: Number of characters in the word, or zero. * Note: The word buffer is static and local to this file. *=======================================================================*/ static int read_word (FILE *f) { #if 0 /* daved - 0.19.0 */ int ch, ch2, ix=0; #else int ch, ch2; unsigned long ix=0; #endif int have_whitespace=FALSE; int is_control_word=FALSE; int has_numeric_param=FALSE; /* if is_control_word==TRUE */ int need_unget=FALSE; CHECK_PARAM_NOT_NULL(f); current_max_length = 10; /* XX */ /* Get some storage for a word. */ input_str = my_malloc (current_max_length); if (!input_str) error_handler("cannot allocate word storage"); do { ch = my_getchar(f); } while (ch=='\n'); if (ch==' ') { /* Compress multiple space chars down to one. */ while (ch == ' ') { ch = my_getchar(f); have_whitespace=TRUE; } if (have_whitespace) { my_unget_char (ch); input_str[0]=' '; input_str[1]=0; return 1; } } switch(ch) { case EOF: return 0; case '\\': ch2 = my_getchar(f); /* Look for two-character command words. */ switch (ch2) { case '\n': strcpy (input_str, "\\par"); return 4; case '~': case '{': case '}': case '\\': case '_': case '-': input_str[0] = '\\'; input_str[1] = ch2; input_str[2] = 0; return 2; case '\'': /* Preserve \'## expressions (hex char exprs) for later. */ input_str[0]='\\'; input_str[1]='\''; ix=2; if(ix==current_max_length) { if (!expand_word_buffer ()) error_handler("word too long"); } ch = my_getchar(f); input_str[ix++]=ch; if(ix==current_max_length) { if (!expand_word_buffer ()) error_handler("word too long"); } ch = my_getchar(f); input_str[ix++]=ch; if(ix==current_max_length) { if (!expand_word_buffer ()) error_handler("word too long"); } input_str[ix]=0; return ix; } is_control_word=TRUE; ix=1; input_str[0]=ch; ch=ch2; break; case '\t': /* In RTF, a tab char is the same as \tab. */ strcpy (input_str, "\\tab"); return 4; case '{': case '}': case ';': input_str[0]=ch; input_str[1]=0; return 1; } while (ch!=EOF) { /* Several chars always ends a word, and we need to save them. */ if (ch=='\t' || ch=='{' || ch=='}' || ch=='\\') { need_unget=TRUE; break; } /* A newline always ends a command word; we don't save it. * A newline is ignored if this is not a command word. */ if (ch=='\n') { if (is_control_word) break; ch = my_getchar(f); continue; } /* A semicolon always ends a command word; we do save it. * A semicolon never ends a regular word. */ if (ch==';') { if (is_control_word) { need_unget=TRUE; break; } } /* In this parser, a space character terminates * any word, and if it does not follow a command, * then it is a word in itself. */ if (ch==' ') { if (!is_control_word) need_unget=TRUE; break; } /* Identify a control word's numeric parameter. */ if (is_control_word) { if (!has_numeric_param && (isdigit(ch) || ch=='-')) has_numeric_param = TRUE; else if (has_numeric_param && !isdigit(ch)) { if (ch!=' ') need_unget=TRUE; break; } } input_str[ix++] = ch; if (ix==current_max_length) { if (!expand_word_buffer ()) error_handler("word too long"); } ch = my_getchar (f); } if (need_unget) my_unget_char(ch); input_str[ix]=0; return ix; } /*======================================================================== * Name: word_read * Purpose: This is the recursive metareader which pieces together the * structure of Word objects. * Args: Input file. * Returns: Tree of Word objects. *=======================================================================*/ Word * word_read (FILE* f) { Word * prev_word = NULL; Word * first_word = NULL; Word * new_word = NULL; /* temp */ CHECK_PARAM_NOT_NULL(f); do { if (!read_word(f)) { return first_word; } if (input_str[0] == '{') { /* Process subwords */ #if 0 printf ("processing subword...\n"); #endif /* Create a dummy word to point to a sublist */ new_word = word_new (NULL); if (!new_word) error_handler ("cannot allocate word"); /* Get the sublist */ new_word->child = word_read (f); if (!new_word->hash_index && !new_word->child) { /* printf ("unable to read children!\n"); */ } } else if (input_str[0] == '}') { #if 0 printf ("returning from word_read.\n"); #endif return first_word; } else { new_word = word_new (input_str); } if (prev_word) prev_word->next = new_word; if (!first_word) first_word = new_word; prev_word = new_word; /* Free up the memory allocated by read_word. */ my_free (input_str); input_str = NULL; } while(1); } ./unrtf-0.19.2/parse.h0000644000175000017500000000310307356513561016005 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: parse.h * Author name: Zach Smith * Create date: 15 Oct 2000 * Purpose: Definitions and externs for parse.c. *---------------------------------------------------------------------- * Changes: * 15 Oct 00, tuorfa@yahoo.com: parse.h created with functions taken from word.c *--------------------------------------------------------------------*/ #ifndef _WORD #include "word.h" #endif extern Word *word_read(FILE*); ./unrtf-0.19.2/ps.c0000644000175000017500000004510607741254611015315 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: ps * Author name: Zach Smith * Create date: 18 Sep 01 * Purpose: PostScript(TM)-specific output module *---------------------------------------------------------------------- * Changes: * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 23 Sep 01, tuorfa@yahoo.com: added shadow, outline, strikethru, underline * 23 Sep 01, tuorfa@yahoo.com: revised PS program to use ISOLatin1Encoding * 28 Sep 01, tuorfa@yahoo.com: added support for Helvetica,Courier,Symbol * 08 Oct 03, daved@physiol.usyd.edu.au: fixed corrupted PS_START string *--------------------------------------------------------------------*/ #include #include #include "malloc.h" #include "defs.h" #include "error.h" #include "main.h" #include "output.h" static char* ascii [96] = { /* 0x20 */ " ", "!", "\"", "#", "$", "\%", "&", "'", /* 0x28 */ "\\(", "\\)", "*", "+", ",", "-", ".", "/", /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7", /* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?", /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G", /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O", /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W", /* 0x58 */ "X", "Y", "Z", "\\[", "\\\\", "\\]", "^", "_", /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g", /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o", /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w", /* 0x78 */ "x", "y", "z", "{", "|", "}", "~", "", }; static char* ansi [] = { /* 0x80 */ "\\200","\\201","\\202","\\203", /* 0x84 */ "\\204","\\205","\\206","\\207", /* 0x88 */ "\\210","\\211","\\212","\\213", /* 0x8c */ "\\214","\\215","\\216","\\217", /* 0x90 */ "\\220","\\221","\\222","\\223", /* 0x94 */ "\\224","\\225","\\226","\\227", /* 0x98 */ "\\230","\\231","\\232","\\233", /* 0x9c */ "\\234","\\235","\\236","\\237", /* 0xa0 */ "\\240","\\241","\\242","\\243", /* 0xa4 */ "\\244","\\245","\\246","\\247", /* 0xa8 */ "\\250","\\251","\\252","\\253", /* 0xac */ "\\254","\\255","\\256","\\257", /* 0xb0 */ "\\260","\\261","\\262","\\263", /* 0xb4 */ "\\264","\\265","\\266","\\267", /* 0xb8 */ "\\270","\\271","\\272","\\273", /* 0xbc */ "\\274","\\275","\\276","\\277", /* 0xc0 */ "\\300","\\301","\\302","\\303", /* 0xc4 */ "\\304","\\305","\\306","\\307", /* 0xc8 */ "\\310","\\311","\\312","\\313", /* 0xcc */ "\\314","\\315","\\316","\\317", /* 0xd0 */ "\\320","\\321","\\322","\\323", /* 0xd4 */ "\\324","\\325","\\326","\\327", /* 0xd8 */ "\\330","\\331","\\332","\\333", /* 0xdc */ "\\334","\\335","\\336","\\337", /* 0xe0 */ "\\340","\\341","\\342","\\343", /* 0xe4 */ "\\344","\\345","\\346","\\347", /* 0xe8 */ "\\350","\\351","\\352","\\353", /* 0xec */ "\\354","\\355","\\356","\\357", /* 0xf0 */ "\\360","\\361","\\362","\\363", /* 0xf4 */ "\\364","\\365","\\366","\\367", /* 0xf8 */ "\\370","\\371","\\372","\\373", /* 0xfc */ "\\374","\\375","\\376","\\377", }; static char* mac [] = { "?", }; static char* cp437 [] = { "?", }; static char* cp850 [] = { "?", }; #define PS_END "\ %% --------- \n\n\ didShowPage not { \n\ showpage \n\ } if\n\n\ %%%%EOF\n" #define PS_START "\ %%%%!PS\n\ %%--------------------------------------------------------------------------\n\ %% GNU UnRTF, a command-line program to convert RTF documents to other formats.\n\ %% Copyright (C) 2000,2001 Zachary Thayer Smith\n\ %%\n\ %% This program is free software; you can redistribute it and/or modify\n\ %% it under the terms of the GNU General Public License as published by\n\ %% the Free Software Foundation; either version 2 of the License, or\n\ %% (at your option) any later version.\n\ %%\n\ %% This program is distributed in the hope that it will be useful,\n\ %% but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ %% GNU General Public License for more details.\n\ %%\n\ %% You should have received a copy of the GNU General Public License\n\ %% along with this program; if not, write to the Free Software\n\ %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\ %%\n\ %% The author is reachable by electronic mail at tuorfa@yahoo.com.\n\ %%--------------------------------------------------------------------------\n\ %%%%EndComments \n\ %%\n\ %% --------- Note, this PS code is unfinished -------- \n\ %% --------- Note, this PS code is unfinished -------- \n\ %% --------- Note, this PS code is unfinished -------- \n\ %% --------- Note, this PS code is unfinished -------- \n\ %% --------- Note, this PS code is unfinished -------- \n\ %%\n\ %% ----------- Variables ------------\n\ /fontFamily /Times def\n\ /fontAscent 0 def %% ascent for current font\n\ /fontDescent 0 def %% descent for current font\n\ /lineAscent 0 def \n\ /lineDescent 0 def \n\ /pageWidthInches 8.5 def \n\ /pageHeightInches 11 def \n\ /leftMargin 20 def \n\ /rightMargin 20 def \n\ /topMargin 20 def \n\ /bottomMargin 20 def \n\ /DPI 72 def \n\ /pageWidth pageWidthInches DPI mul def \n\ /rightLimit pageWidth rightMargin sub def \n\ /pageHeight pageHeightInches DPI mul def \n\ /x 0 def \n\ /y 0 def \n\ /bold false def \n\ /italic false def \n\ /underline false def \n\ /overline false def \n\ /intercharSpace 0 def \n\ /strike false def \n\ /outline false def \n\ /shadow false def \n\ /fontSize 12 def \n\ /didBR false def \n\ /didParSkip false def \n\ /didShowPage false def \n\ %%------------------------------------------------------\n\ %% Set up the ISO fonts \n\ \n\ %% Times \n\ %% ----- \n\ /Times-Roman findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /TRomanISO exch definefont pop \n\n\ /Times-Bold findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /TBoldISO exch definefont pop \n\n\ /Times-BoldItalic findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /TBoldItalicISO exch definefont pop \n\n\ /Times-Italic findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /TItalicISO exch definefont pop \n\n\ %% Courier \n\ %% ----- \n\ /Courier-Roman findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /CRomanISO exch definefont pop \n\n\ /Courier-Bold findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /CBoldISO exch definefont pop \n\n\ /Courier-BoldItalic findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /CBoldItalicISO exch definefont pop \n\n\ /Courier-Italic findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /CItalicISO exch definefont pop \n\n\ %% Symbol \n\ %% ----- \n\ /Symbol-Roman findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /SRomanISO exch definefont pop \n\n\ /Symbol-Bold findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /SBoldISO exch definefont pop \n\n\ /Symbol-BoldItalic findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /SBoldItalicISO exch definefont pop \n\n\ /Symbol-Italic findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /SItalicISO exch definefont pop \n\n\ %% Helvetica \n\ %% --------- \n\ /Helvetica-Roman findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /HRomanISO exch definefont pop \n\n\ /Helvetica-Bold findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /HBoldISO exch definefont pop \n\n\ /Helvetica-BoldOblique findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /HBoldItalicISO exch definefont pop \n\n\ /Helvetica-Oblique findfont dup length dict begin { \n\ 1 index /FID ne { def } { pop pop } ifelse \n\ } forall \n\ /Encoding ISOLatin1Encoding def \n\ currentdict end \n\ /HItalicISO exch definefont pop \n\n\ %% \n\ %% Ideally, before we can draw a line of text, we need to collect all the\n\ %% words that will be on it, just as I do in my Beest HTML viewer, as well\n\ %% as character attributes for each word. But for now, this implementation \n\ %% does not bother. It determines the maximize ascent and descent after\n\ %% drawing the text, not before. XX\n\ %% \n\ %% ----------- Functions ------------\n\ /updateFont { \n\ /f0 null def \n\ (Times) fontFamily eq (Times New Roman) fontFamily eq or { \n\ bold { \n\ italic { /TBoldItalicISO } { /TBoldISO } ifelse \n\ } { \n\ italic { /TItalicISO } { /TRomanISO } ifelse \n\ } \n\ ifelse \n\ } if \n\ (Helvetica) fontFamily eq (Arial) fontFamily eq or { \n\ bold { \n\ italic { /HBoldItalicISO } { /HBoldISO } ifelse \n\ } { \n\ italic { /HItalicISO } { /HRomanISO } ifelse \n\ } \n\ ifelse \n\ } if \n\ (Courier) fontFamily eq (Courier New) fontFamily eq or { \n\ bold { \n\ italic { /CBoldItalicISO } { /CBoldISO } ifelse \n\ } { \n\ italic { /CItalicISO } { /CRomanISO } ifelse \n\ } \n\ ifelse \n\ } if \n\ (Symbol) fontFamily eq { \n\ bold { \n\ italic { /SBoldItalicISO } { /SBoldISO } ifelse \n\ } { \n\ italic { /SItalicISO } { /SRomanISO } ifelse \n\ } \n\ ifelse \n\ } if \n\n\ findfont /f0 exch def \n\ /bboxBottom f0 /FontBBox get 1 get 1000 div fontSize mul -1 mul def \n\ /bboxTop f0 /FontBBox get 3 get 1000 div fontSize mul def \n\ f0 fontSize scalefont setfont \n\ lineAscent bboxTop lt { /lineAscent bboxTop def } if \n\ lineDescent bboxBottom lt { /lineDescent bboxBottom def } if \n\ /fontAscent bboxTop def \n\ /fontDescent bboxBottom def \n\ } def\n\ /FS { \n\ /fontSize exch def updateFont \n\ } def \n\ /F { \n\ /fontFamily exch def updateFont \n\ } def \n\ /resetX { \n\ /x leftMargin def\n\ } def \n\ /resetY { \n\ /y pageHeight topMargin sub def \n\ } def \n\ /BR { \n\ /oldx x def \n\ /y y lineAscent lineDescent add sub def \n\ resetX \n\ y bottomMargin lt { \n\ showpage \n\ /didShowPage true \n\ resetY \n\ } if \n\ oldx 0 eq didBR and { /didParSkip true def } if \n\ /didBR true def \n\ % /lineAscent 0 def \n\ % /lineDescent 0 def \n\ } def \n\ /P { \n\ didParSkip not { BR } if \n\ didParSkip not { BR } if \n\ } \n\ def \n\ /acharpath { \n\ /acstr exch def pop /acsp exch def \n\ newpath \n\ str { \n\ /ch exch def \n\ 1 string 0 ch put false charpath \n\ acsp 0 rmoveto \n\ } forall \n\ } def \n\ /A { \n\ /str exch def \n\ /w str stringwidth pop \n\ str length intercharSpace mul add \n\ def \n\ x w add rightLimit ge { BR } if \n\ x y moveto \n\ outline { \n\ shadow { \n\ 1 -0.1 0 { \n\ /offset exch def \n\ offset setgray \n\ x offset 3 mul add y offset 3 mul sub moveto \n\ intercharSpace 0 str acharpath \n\ %% str false charpath \n\ fontSize 30 div setlinewidth stroke \n\ } for \n\ 0 setgray \n\ } { \n\ intercharSpace 0 str acharpath \n\ %% str false charpath \n\ fontSize 30 div setlinewidth stroke \n\ } ifelse \n\ } { \n\ shadow { \n\ 1 -0.1 0 { \n\ /offset exch def \n\ offset setgray \n\ x offset 3 mul add y offset 3 mul sub moveto \n\ intercharSpace 0 str ashow \n\ %% str show \n\ } for \n\ 0 setgray \n\ } { \n\ intercharSpace 0 str ashow \n\ %% str show \n\ } ifelse \n\ } ifelse \n\ strike { \n\ newpath fontSize 20 div setlinewidth \n\ x y fontAscent 0.32 mul add dup /y2 exch def moveto \n\ x w add y2 lineto stroke \n\ } if \n\ underline { \n\ newpath fontSize 20 div setlinewidth \n\ x y fontAscent 0.2 mul sub dup /y2 exch def moveto \n\ x w add y2 lineto stroke \n\ } if \n\ overline { \n\ %% I don't think RTF supports this, but it can be used later. \n\ newpath fontSize 20 div setlinewidth \n\ x y fontAscent 1.2 mul add dup /y2 exch def moveto \n\ x w add y2 lineto stroke \n\ } if \n\ /x x w add def \n\ /didBR false def \n\ /didShowPage false def \n\ } def \n\ \n\ %% These are only binary for now \n\ /X1 { /intercharSpace exch def } def\n\ /X0 { /intercharSpace 0 def } def\n\ /O1 { /outline false def } def\n\ /O0 { /outline false def } def\n\ /H1 { /shadow true def } def\n\ /H0 { /shadow false def } def\n\ /S1 { /strike true def } def\n\ /S0 { /strike false def } def\n\ /B1 { /bold true def updateFont } def\n\ /B0 { /bold false def updateFont } def\n\ /I1 { /italic true def updateFont } def\n\ /I0 { /italic false def updateFont } def\n\ /U1 { /underline true def } def\n\ /U0 { /underline false def } def\n\ updateFont \n\ resetX resetY \n\ \n\ " /*======================================================================== * Name: ps_init * Purpose: Generates an OutputPersonality object for the PostScript(TM) * format. * Args: None. * Returns: OutputPersonality. *=======================================================================*/ OutputPersonality * ps_init (void) { OutputPersonality* op; op = op_create(); op->comment_begin = "%% "; op->comment_end = "\n"; op->word_begin = "("; op->word_end = ")A "; op->document_begin = PS_START; op->document_end = PS_END; op->header_begin = "%% header begin\n"; op->header_end = "%% header end\n"; op->document_title_begin = "%%%%Title: "; op->document_title_end = "\n"; op->document_author_begin = "%%%%Creator: "; op->document_author_end = "\n"; op->document_changedate_begin = "%% CHANGED: "; op->document_changedate_end = "\n"; op->body_begin = "\n\n%% ---------- Document Body ------------\n"; op->body_end = "\n"; op->paragraph_begin = "P "; op->paragraph_end = "\n"; op->center_begin = ""; op->center_end = ""; op->justify_begin = ""; op->justify_end = ""; op->align_left_begin = ""; op->align_left_end = ""; op->align_right_begin = ""; op->align_right_end = ""; op->forced_space = " "; op->line_break = "BR\n"; op->page_break = "\n"; op->hyperlink_begin = "U1("; op->hyperlink_end = ")A U0 "; op->imagelink_begin = ""; op->imagelink_end = ""; op->table_begin = "\n% TABLE BEGINS (not implemented)\nP\n(TABLE)A BR\n"; op->table_end = "\n% TABLE ENDS (not implemented)\nP\n"; op->table_row_begin = "( )A "; op->table_row_end = "( |)A BR\n"; op->table_cell_begin = "( | )A "; op->table_cell_end = ""; /* Character attributes */ op->font_begin = "(%s) F "; op->font_end = ""; op->fontsize_begin = "%s FS "; op->fontsize_end = ""; op->smaller_begin = ""; op->smaller_end = ""; op->bigger_begin = ""; op->bigger_end = ""; op->foreground_begin = ""; op->foreground_end = ""; op->background_begin = ""; op->background_end = ""; op->bold_begin = "B1 "; op->bold_end = "B0 "; op->italic_begin = "I1 "; op->italic_end = "I0 "; op->underline_begin = "U1 "; op->underline_end = "U0 "; op->dbl_underline_begin = "U1 "; op->dbl_underline_end = "U0 "; op->superscript_begin = ""; op->superscript_end = ""; op->subscript_begin = ""; op->subscript_end = ""; op->strikethru_begin = "S1 "; op->strikethru_end = "S0 "; op->dbl_strikethru_begin = "S1 "; op->dbl_strikethru_end = "S0 "; op->emboss_begin=""; op->emboss_end = ""; op->engrave_begin = ""; op->engrave_end = ""; op->shadow_begin= "H1 "; op->shadow_end= "H0 "; op->outline_begin= "O1 "; op->outline_end= "O0 "; op->expand_begin = "%s X1 "; op->expand_end = "X0 "; op->simulate_small_caps = TRUE; op->simulate_all_caps = TRUE; op->simulate_word_underline = TRUE; op->ascii_translation_table = ascii; op->ansi_translation_table = ansi; op->ansi_first_char = 0x80; op->ansi_last_char = 0xff; op->cp437_translation_table = cp437; op->cp437_first_char = 0x80; op->cp437_last_char = 0x80; op->cp850_translation_table = cp850; op->cp850_first_char = 0x80; op->cp850_last_char = 0x80; op->mac_translation_table = mac; op->mac_first_char = 0x80; op->mac_last_char = 0x80; op->chars.right_quote = "'"; op->chars.left_quote = "`"; op->chars.right_dbl_quote = "''"; op->chars.left_dbl_quote = "``"; return op; } ./unrtf-0.19.2/ps.h0000644000175000017500000000277507356513571015334 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: ps * Author name: Zach Smith * Create date: 19 Sep 01 * Purpose: Definitions for the PostScript(TM) output personality *---------------------------------------------------------------------- * Changes: *--------------------------------------------------------------------*/ #ifndef _PS extern OutputPersonality* ps_init(void); #define _PS #endif ./unrtf-0.19.2/test/0002755000175000017500000000000010014443447015474 5ustar msamaralmsamaral00000000000000./unrtf-0.19.2/test/accents.rtf0000644000175000017500000000020107346277416017637 0ustar msamaralmsamaral00000000000000{\rtf1\ansi { Je crois que j'irai au caf\'e9 o\'f9 on ne fume pas. } { Credo che andr\'f2 a un caff\'e8 dove nessuno fuma. } } ./unrtf-0.19.2/test/align.rtf0000644000175000017500000000672707346277416017334 0ustar msamaralmsamaral00000000000000{\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;} {\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);} {\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; \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{ \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*\cs10 \additive Default Paragraph Font;}{ \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} {\creatim\yr2001\mo4\dy21\hr17\min36}{\revtim\yr2001\mo4\dy21\hr17\min36}{\version2}{\edmins0}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company Kawm Pani }{\nofcharsws0}{\vern8269}} \widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1800\dgvorigin1440\dghshow1\dgvshow1 \jexpand\viewkind1\viewscale90\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule \fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl {\*\pnseclvl1 \pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\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 )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\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 { This is left-aligned text. \par }\pard \qc \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {This is centered text. \par }\pard \qr \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {This is right-aligned text. \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. This is justified text. This is justified text. This is justified text. \par }\pard \s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {This is left-aligned text again. \par }\pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 { \par }} ./unrtf-0.19.2/test/colors.rtf0000644000175000017500000000446607346277416017541 0ustar msamaralmsamaral00000000000000{\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;} {\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; \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; \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} {\creatim\yr2001\mo7\dy24\hr14\min45}{\revtim\yr2001\mo7\dy24\hr14\min49}{\version1}{\edmins4}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company Poopies}{\nofcharsws0}{\vern89}} \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 .}} {\*\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 (} {\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \widctlpar\adjustright \fs20\cgrid {\cf6 This is red text}{. \par }{\cf2 This is blue text. \par }{\cf4 This is green text}{. \par This text becomes }{\b bold, then }{\b\i italic, then }{\b\i\cf2 blue. Blue}{\b\i off. Italic }{\b off. Bold }{off. \par \par The follow text is red with a blue background: \par \tab }{\fs48\cf6\highlight2 Red text with blue background.}{\fs48\cf6 \par }{...and now plain text; plain text is very plain. \par \par \par }{\i \par }} ./unrtf-0.19.2/test/colors2.rtf0000644000175000017500000000446507346277416017622 0ustar msamaralmsamaral00000000000000{\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;} {\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; \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; \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} {\creatim\yr2001\mo7\dy24\hr14\min45}{\revtim\yr2001\mo7\dy24\hr14\min49}{\version1}{\edmins4}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company Poopies}{\nofcharsws0}{\vern89}} \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 .}} {\*\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 (} {\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \widctlpar\adjustright \fs20\cgrid {\cf5 This is red text}{. \par }{\cf1 This is blue text. \par }{\cf3 This is green text}{. \par This text becomes }{\b bold, then }{\b\i italic, then }{\b\i\cf1 blue. Blue}{\b\i off. Italic }{\b off. Bold }{off. \par \par The follow text is red with a blue background: \par \tab }{\fs48\cf5\highlight1 Red text with blue background.}{\fs48\cf5 \par }{...and now plain text; plain text is very plain. \par \par \par }{\i \par }} ./unrtf-0.19.2/test/fontface.rtf0000644000175000017500000003141107346277416020013 0ustar msamaralmsamaral00000000000000{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;} {\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f4\froman\fcharset0\fprq2{\*\panose 00000000000000000000}Times;} {\f5\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Helvetica;}{\f6\fmodern\fcharset0\fprq1{\*\panose 00000000000000000000}Courier;}{\f7\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Geneva;} {\f8\froman\fcharset0\fprq2{\*\panose 00000000000000000000}Tms Rmn;}{\f9\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Helv;}{\f10\froman\fcharset0\fprq2{\*\panose 00000000000000000000}MS Serif;} {\f11\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}MS Sans Serif;}{\f12\froman\fcharset0\fprq2{\*\panose 00000000000000000000}New York;}{\f13\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}System;} {\f14\fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}{\f15\fswiss\fcharset0\fprq3{\*\panose 020b0604030504040204}Tahoma;}{\f16\fmodern\fcharset0\fprq1{\*\panose 00000000000000000000}Letter Gothic;} {\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;} {\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;} {\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;} {\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; \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; \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;}{ \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;}{ \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 \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 \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 FollowedHyperlink;}{\*\cs21 \additive \b \sbasedon10 Strong;}}{\*\listtable{\list\listtemplateid67698703\listsimple{\listlevel\levelnfc0\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\fbias0 \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 \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 \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 } {\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 \'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 } {\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 \'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 } {\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 \'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li6480\jclisttab\tx6480 }{\listname ;}\listid1463503336}{\list\listtemplateid-1877444064{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat0\levelspace360\levelindent0{\leveltext \'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 \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 \'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 \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 {\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 } {\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 \levelnfc0\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\fbias0 \fi-360\li360\jclisttab\tx360 }{\listname ;}\listid1680893012}{\list\listtemplateid1756634642{\listlevel\levelnfc23\leveljc0 \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;} \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 \levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li2880\jclisttab\tx2880 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext \'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 \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 {\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 } {\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 \leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\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\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li2880\jclisttab\tx2880 } {\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'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\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{\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 }{\listname ;}\listid2034959735}}{\*\listoverridetable{\listoverride\listid1463503336\listoverridecount0\ls1}{\listoverride\listid1375692428 \listoverridecount0\ls2}{\listoverride\listid957219121\listoverridecount0\ls3}{\listoverride\listid1680893012\listoverridecount0\ls4}{\listoverride\listid1137333544\listoverridecount0\ls5}{\listoverride\listid1860776333\listoverridecount0\ls6} {\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} {\revtim\yr2000\mo9\dy13\hr14\min50}{\printim\yr2000\mo7\dy22\hr14\min14}{\version2}{\edmins1}{\nofpages1}{\nofwords16098}{\nofchars91762}{\*\company Poopy Poop}{\nofcharsws112690}{\vern89}} \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 \tqc\tx4320\tqr\tx8640\adjustright \cgrid {\field{\*\fldinst {\cs19 PAGE }}{\fldrslt {\cs19\lang1024 77}}}{ \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 )}} {\*\pnseclvl5\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{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \s1\keepn\widctlpar\outlinelevel0\adjustright {\f0 test using font 0 \par } {\f1 test using font 1 \par } {\f2 test using font 2 \par } {\f3 test using font 3 \par } {\f4 test using font 4 \par } {\f10 test using font 10 \par } {\f14 test using font 14 \par } {\par} } ./unrtf-0.19.2/test/fontsize.rtf0000644000175000017500000000013107346277416020062 0ustar msamaralmsamaral00000000000000{\rtf1 { \fs24 This should be 12 point text } { \fs32 This should be 16 point text } } ./unrtf-0.19.2/test/groups.rtf0000644000175000017500000001017307346277416017547 0ustar msamaralmsamaral00000000000000{\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;} {\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;} {\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;} {\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);} {\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; \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{ \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 \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 \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} {\version1}{\edmins2}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company }{\nofcharsws0}{\vern8269}}\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180 \dghorigin1800\dgvorigin1440\dghshow1\dgvshow1\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule \fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\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 )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (} {\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 \faauto\adjustright\rin0\lin0\itap0 \f4\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f2 ANOTHER TEST \par }\pard \s15\ql \li0\ri0\widctlpar\faauto\adjustright\rin0\lin0\itap0 {\f2 \par }{\f2\ul ABC \par }{\f2 Line 1 \par Line 2 \par Line 3 \par }\pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f2 Line 4 \par \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 \par }\pard\plain \s15\ql \li0\ri0\widctlpar\faauto\adjustright\rin0\lin0\itap0 \f4\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f2 Line 1 \par Line 2 \par Line 3 \par }\pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f2 Line 4 \par }{ \par }} ./unrtf-0.19.2/test/param.rtf0000644000175000017500000003140207346277416017326 0ustar msamaralmsamaral00000000000000{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;} {\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f4\froman\fcharset0\fprq2{\*\panose 00000000000000000000}Times;} {\f5\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Helvetica;}{\f6\fmodern\fcharset0\fprq1{\*\panose 00000000000000000000}Courier;}{\f7\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Geneva;} {\f8\froman\fcharset0\fprq2{\*\panose 00000000000000000000}Tms Rmn;}{\f9\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Helv;}{\f10\froman\fcharset0\fprq2{\*\panose 00000000000000000000}MS Serif;} {\f11\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}MS Sans Serif;}{\f12\froman\fcharset0\fprq2{\*\panose 00000000000000000000}New York;}{\f13\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}System;} {\f14\fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}{\f15\fswiss\fcharset0\fprq3{\*\panose 020b0604030504040204}Tahoma;}{\f16\fmodern\fcharset0\fprq1{\*\panose 00000000000000000000}Letter Gothic;} {\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;} {\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;} {\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;} {\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; \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; \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;}{ \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;}{ \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 \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 \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 FollowedHyperlink;}{\*\cs21 \additive \b \sbasedon10 Strong;}}{\*\listtable{\list\listtemplateid67698703\listsimple{\listlevel\levelnfc0\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\fbias0 \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 \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 \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 } {\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 \'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 } {\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 \'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 } {\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 \'01\u-3929 ?;}{\levelnumbers;}\f14\fbias0 \fi-360\li6480\jclisttab\tx6480 }{\listname ;}\listid1463503336}{\list\listtemplateid-1877444064{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat0\levelspace360\levelindent0{\leveltext \'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 \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 \'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 \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 {\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 } {\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 \levelnfc0\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\fbias0 \fi-360\li360\jclisttab\tx360 }{\listname ;}\listid1680893012}{\list\listtemplateid1756634642{\listlevel\levelnfc23\leveljc0 \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;} \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 \levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li2880\jclisttab\tx2880 }{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext \'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 \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 {\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 } {\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 \leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01o;}{\levelnumbers;}\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\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li2880\jclisttab\tx2880 } {\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\'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\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{\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 }{\listname ;}\listid2034959735}}{\*\listoverridetable{\listoverride\listid1463503336\listoverridecount0\ls1}{\listoverride\listid1375692428 \listoverridecount0\ls2}{\listoverride\listid957219121\listoverridecount0\ls3}{\listoverride\listid1680893012\listoverridecount0\ls4}{\listoverride\listid1137333544\listoverridecount0\ls5}{\listoverride\listid1860776333\listoverridecount0\ls6} {\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} {\revtim\yr2000\mo9\dy13\hr14\min50}{\printim\yr2000\mo7\dy22\hr14\min14}{\version2}{\edmins1}{\nofpages1}{\nofwords16098}{\nofchars91762}{\*\company Poopy Poop}{\nofcharsws112690}{\vern89}} \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 \tqc\tx4320\tqr\tx8640\adjustright \cgrid {\field{\*\fldinst {\cs19 PAGE }}{\fldrslt {\cs19\lang1024 77}}}{ \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 )}} {\*\pnseclvl5\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{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \s1\keepn\widctlpar\outlinelevel0\adjustright {\f0test using font 0 \par } {\f1test using font 1 \par } {\f2test using font 2 \par } {\f3test using font 3 \par } {\f4test using font 4 \par } {\f10test using font 10 \par } {\f14test using font 14 \par } {\par} } ./unrtf-0.19.2/test/slashnew.rtf0000644000175000017500000000013107346277416020045 0ustar msamaralmsamaral00000000000000{\rtf1 this is a test of backslash before newline \ x \ y\ foo \ { fee }\ {{}} } ./unrtf-0.19.2/test/table.rtf0000644000175000017500000001076307346277416017324 0ustar msamaralmsamaral00000000000000{\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;} {\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; \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; \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} {\creatim\yr2000\mo9\dy15\hr14\min31}{\revtim\yr2000\mo9\dy15\hr14\min32}{\version1}{\edmins1}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company City of Poopy Poop}{\nofcharsws0}{\vern89}} \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 .}} {\*\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 (} {\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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \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 { \par }} ./unrtf-0.19.2/test/attrs.rtf0000644000175000017500000000472507353450737017370 0ustar msamaralmsamaral00000000000000{\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;} {\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; \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; \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} {\creatim\yr2001\mo8\dy6\hr8\min1}{\revtim\yr2001\mo8\dy6\hr8\min6}{\version1}{\edmins5}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company whoknows}{\nofcharsws0}{\vern89}} \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 .}} {\*\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 (} {\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \widctlpar\adjustright \fs20\cgrid {\scaps This text is in small caps. \par }{ \par }{\caps This text is in all caps. \par }{ \par }{\shad This text is shadowed. \par }{This is not shadowed.}{ \par }{\outl This text is outlined. \par }{This is not outlined.}{ \par }{\embo\cf8 This text is embossed. \par }{ \par }{\impr\cf8 This text is engraved. \par }{ \par }{\ul This text is underlined. \par }{\strike This text is struck. \par }{ \par }{\striked1 This text is double-struck. \par }{ \par }{\expnd4\expndtw20 This text is expanded. \par }{ \par }{\expnd-4\expndtw-20 This text is condensed. \par }{ \par \par }} ./unrtf-0.19.2/test/list.rtf0000644000175000017500000000104007346277416017174 0ustar msamaralmsamaral00000000000000{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Times New Roman;}{\f1\fnil\fcharset2 Symbol;}} \viewkind4\uc1\pard\f0\fs20 This is a test of the keyboard on this here computer that I have just bought.\par \par Not bad. It is a typically IBM keyboard in that it clicks a bit. But it feels solid enough,\par and that is important.\par \par Testing\par \pard{\pntext\f1\'B7\tab}{\*\pn\pnlvlblt\pnf1\pnindent0{\pntxtb\'B7}}\fi-720\li720 1\par {\pntext\f1\'B7\tab}2\par {\pntext\f1\'B7\tab}3\par \pard\par \par } ./unrtf-0.19.2/test/vectors.rtf0000644000175000017500000001676207355115600017711 0ustar msamaralmsamaral00000000000000{\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; \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; \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} {\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}} \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 .}} {\*\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 )}} {\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9 \pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \widctlpar\adjustright \loch\af4\hich\af4\dbch\f4\cgrid {\lang1024 {\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}} {\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 \dplinew15\dplinecor0\dplinecog0\dplinecob0}}}{\shp{\*\shpinst\shpleft1008\shptop432\shpright1440\shpbottom432\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz10\shplid1036 {\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 \dpline\dpptx432\dppty0\dpptx0\dppty0\dpx1008\dpy432\dpxsize432\dpysize0\dplinew15\dplinecor0\dplinecog0\dplinecob0}}} {\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}} {\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 \dplinew15\dplinecor0\dplinecog0\dplinecob0}}}{\shp{\*\shpinst\shpleft144\shptop432\shpright720\shpbottom432\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz8\shplid1034 {\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 \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 {\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 \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 {\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 \dpline\dpptx576\dppty0\dpptx0\dppty576\dpx144\dpy144\dpxsize576\dpysize576\dplinew15\dplinecor0\dplinecog0\dplinecob0}}} {\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}} {\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 \dplinew15\dplinecor0\dplinecog0\dplinecob0}}}{\shp{\*\shpinst\shpleft3888\shptop576\shpright3888\shpbottom2448\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz4\shplid1030 {\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 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}}} {\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}} {\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 \dpx3456\dpy288\dpxsize0\dpysize2160\dplinew15\dplinecor0\dplinecog0\dplinecob0}}}{\shp{\*\shpinst\shpleft1440\shptop288\shpright3168\shpbottom1584\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz2\shplid1028 {\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 \dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr255\dpfillbgcg255\dpfillbgcb255\dpfillpat1\dplinew15\dplinecor0\dplinecog0\dplinecob0}}} {\shp{\*\shpinst\shpleft864\shptop864\shpright2448\shpbottom2016\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz1\shplid1027 {\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 \dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr255\dpfillbgcg255\dpfillbgcb255\dpfillpat1\dplinew15\dplinecor0\dplinecog0\dplinecob0}}} {\shp{\*\shpinst\shpleft432\shptop1296\shpright1872\shpbottom2448\shpfhdr0\shpbxcolumn\shpbypara\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026 {\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 \dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr255\dpfillbgcg255\dpfillbgcb255\dpfillpat1\dplinew15\dplinecor0\dplinecog0\dplinecob0}}}}{ \par }} ./unrtf-0.19.2/test/braces2.rtf0000644000175000017500000000002407346443217017535 0ustar msamaralmsamaral00000000000000{1 2 3{4 5 6}7 8 9} ./unrtf-0.19.2/test/braces.rtf0000644000175000017500000000156207346442176017466 0ustar msamaralmsamaral00000000000000{ 1 { 2 { 3 { 4 { 5 { 6 { 7 { 8 { 9 { 10 { 11 { 12 { 13 { 14 { 15 { 16 { 17 { 18 { 19 { 20 { 21 { 22 { 23 { 24 { 25 { 26 { 27 { 28 { 29 { 30 { 31 { 32 { 33 { 34 { 35 { 36 { 37 { 38 { 39 { 40 { 41 { 42 { 43 { 44 { 45 { 46 { 47 { 48 { 49 { 50 { 51 { 52 { 53 { 54 { 55 { 56 { 57 { 58 { 59 { 60 { 61 { 62 { 63 { 64 { 65 { 66 { 67 { 68 { 69 { 70 { 71 { 72 { 73 { 74 { 75 { 76 { 77 { 78 { 79 { 80 { 81 { 82 { 83 { 84 { 85 { 86 { 87 { 88 { 89 { 90 { 91 { 92 { 93 { 94 { 95 { 96 { 97 { 98 { 99 } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } ./unrtf-0.19.2/test/toggle.rtf0000644000175000017500000000032007346536620017475 0ustar msamaralmsamaral00000000000000{\rtf { This is plain text. \ul This is underlined. \b1 This is bold underlined. \i This is bold italic underlined. \b0 This is italic underlined. \ulnone This is italic. } \pard This should be nothing. } ./unrtf-0.19.2/test/super.rtf0000644000175000017500000000006507350455365017361 0ustar msamaralmsamaral00000000000000{\rtf \par { e=mc\super 2 } \par { H\sub 2\sub0 0} } ./unrtf-0.19.2/test/sizes.rtf0000644000175000017500000000234607353204202017345 0ustar msamaralmsamaral00000000000000{\rtf \pard { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } { \fs20 ten point \fs24 12 point \fs28 14 point \fs36 18 point } } ./unrtf-0.19.2/test/charansi.rtf0000644000175000017500000001243107353376734020020 0ustar msamaralmsamaral00000000000000{\rtf \ansi \par\par char 0x20 = "\'20" \par char 0x21 = "\'21" \par char 0x22 = "\'22" \par char 0x23 = "\'23" \par char 0x24 = "\'24" \par char 0x25 = "\'25" \par char 0x26 = "\'26" \par char 0x27 = "\'27" \par char 0x28 = "\'28" \par char 0x29 = "\'29" \par char 0x2a = "\'2a" \par char 0x2b = "\'2b" \par char 0x2c = "\'2c" \par char 0x2d = "\'2d" \par char 0x2e = "\'2e" \par char 0x2f = "\'2f" \par char 0x30 = "\'30" \par char 0x31 = "\'31" \par char 0x32 = "\'32" \par char 0x33 = "\'33" \par char 0x34 = "\'34" \par char 0x35 = "\'35" \par char 0x36 = "\'36" \par char 0x37 = "\'37" \par char 0x38 = "\'38" \par char 0x39 = "\'39" \par char 0x3a = "\'3a" \par char 0x3b = "\'3b" \par char 0x3c = "\'3c" \par char 0x3d = "\'3d" \par char 0x3e = "\'3e" \par char 0x3f = "\'3f" \par char 0x40 = "\'40" \par char 0x41 = "\'41" \par char 0x42 = "\'42" \par char 0x43 = "\'43" \par char 0x44 = "\'44" \par char 0x45 = "\'45" \par char 0x46 = "\'46" \par char 0x47 = "\'47" \par char 0x48 = "\'48" \par char 0x49 = "\'49" \par char 0x4a = "\'4a" \par char 0x4b = "\'4b" \par char 0x4c = "\'4c" \par char 0x4d = "\'4d" \par char 0x4e = "\'4e" \par char 0x4f = "\'4f" \par char 0x50 = "\'50" \par char 0x51 = "\'51" \par char 0x52 = "\'52" \par char 0x53 = "\'53" \par char 0x54 = "\'54" \par char 0x55 = "\'55" \par char 0x56 = "\'56" \par char 0x57 = "\'57" \par char 0x58 = "\'58" \par char 0x59 = "\'59" \par char 0x5a = "\'5a" \par char 0x5b = "\'5b" \par char 0x5c = "\'5c" \par char 0x5d = "\'5d" \par char 0x5e = "\'5e" \par char 0x5f = "\'5f" \par char 0x60 = "\'60" \par char 0x61 = "\'61" \par char 0x62 = "\'62" \par char 0x63 = "\'63" \par char 0x64 = "\'64" \par char 0x65 = "\'65" \par char 0x66 = "\'66" \par char 0x67 = "\'67" \par char 0x68 = "\'68" \par char 0x69 = "\'69" \par char 0x6a = "\'6a" \par char 0x6b = "\'6b" \par char 0x6c = "\'6c" \par char 0x6d = "\'6d" \par char 0x6e = "\'6e" \par char 0x6f = "\'6f" \par char 0x70 = "\'70" \par char 0x71 = "\'71" \par char 0x72 = "\'72" \par char 0x73 = "\'73" \par char 0x74 = "\'74" \par char 0x75 = "\'75" \par char 0x76 = "\'76" \par char 0x77 = "\'77" \par char 0x78 = "\'78" \par char 0x79 = "\'79" \par char 0x7a = "\'7a" \par char 0x7b = "\'7b" \par char 0x7c = "\'7c" \par char 0x7d = "\'7d" \par char 0x7e = "\'7e" \par char 0x7f = "\'7f" \par char 0x80 = "\'80" \par char 0x81 = "\'81" \par char 0x82 = "\'82" \par char 0x83 = "\'83" \par char 0x84 = "\'84" \par char 0x85 = "\'85" \par char 0x86 = "\'86" \par char 0x87 = "\'87" \par char 0x88 = "\'88" \par char 0x89 = "\'89" \par char 0x8a = "\'8a" \par char 0x8b = "\'8b" \par char 0x8c = "\'8c" \par char 0x8d = "\'8d" \par char 0x8e = "\'8e" \par char 0x8f = "\'8f" \par char 0x90 = "\'90" \par char 0x91 = "\'91" \par char 0x92 = "\'92" \par char 0x93 = "\'93" \par char 0x94 = "\'94" \par char 0x95 = "\'95" \par char 0x96 = "\'96" \par char 0x97 = "\'97" \par char 0x98 = "\'98" \par char 0x99 = "\'99" \par char 0x9a = "\'9a" \par char 0x9b = "\'9b" \par char 0x9c = "\'9c" \par char 0x9d = "\'9d" \par char 0x9e = "\'9e" \par char 0x9f = "\'9f" \par char 0xa0 = "\'a0" \par char 0xa1 = "\'a1" \par char 0xa2 = "\'a2" \par char 0xa3 = "\'a3" \par char 0xa4 = "\'a4" \par char 0xa5 = "\'a5" \par char 0xa6 = "\'a6" \par char 0xa7 = "\'a7" \par char 0xa8 = "\'a8" \par char 0xa9 = "\'a9" \par char 0xaa = "\'aa" \par char 0xab = "\'ab" \par char 0xac = "\'ac" \par char 0xad = "\'ad" \par char 0xae = "\'ae" \par char 0xaf = "\'af" \par char 0xb0 = "\'b0" \par char 0xb1 = "\'b1" \par char 0xb2 = "\'b2" \par char 0xb3 = "\'b3" \par char 0xb4 = "\'b4" \par char 0xb5 = "\'b5" \par char 0xb6 = "\'b6" \par char 0xb7 = "\'b7" \par char 0xb8 = "\'b8" \par char 0xb9 = "\'b9" \par char 0xba = "\'ba" \par char 0xbb = "\'bb" \par char 0xbc = "\'bc" \par char 0xbd = "\'bd" \par char 0xbe = "\'be" \par char 0xbf = "\'bf" \par char 0xc0 = "\'c0" \par char 0xc1 = "\'c1" \par char 0xc2 = "\'c2" \par char 0xc3 = "\'c3" \par char 0xc4 = "\'c4" \par char 0xc5 = "\'c5" \par char 0xc6 = "\'c6" \par char 0xc7 = "\'c7" \par char 0xc8 = "\'c8" \par char 0xc9 = "\'c9" \par char 0xca = "\'ca" \par char 0xcb = "\'cb" \par char 0xcc = "\'cc" \par char 0xcd = "\'cd" \par char 0xce = "\'ce" \par char 0xcf = "\'cf" \par char 0xd0 = "\'d0" \par char 0xd1 = "\'d1" \par char 0xd2 = "\'d2" \par char 0xd3 = "\'d3" \par char 0xd4 = "\'d4" \par char 0xd5 = "\'d5" \par char 0xd6 = "\'d6" \par char 0xd7 = "\'d7" \par char 0xd8 = "\'d8" \par char 0xd9 = "\'d9" \par char 0xda = "\'da" \par char 0xdb = "\'db" \par char 0xdc = "\'dc" \par char 0xdd = "\'dd" \par char 0xde = "\'de" \par char 0xdf = "\'df" \par char 0xe0 = "\'e0" \par char 0xe1 = "\'e1" \par char 0xe2 = "\'e2" \par char 0xe3 = "\'e3" \par char 0xe4 = "\'e4" \par char 0xe5 = "\'e5" \par char 0xe6 = "\'e6" \par char 0xe7 = "\'e7" \par char 0xe8 = "\'e8" \par char 0xe9 = "\'e9" \par char 0xea = "\'ea" \par char 0xeb = "\'eb" \par char 0xec = "\'ec" \par char 0xed = "\'ed" \par char 0xee = "\'ee" \par char 0xef = "\'ef" \par char 0xf0 = "\'f0" \par char 0xf1 = "\'f1" \par char 0xf2 = "\'f2" \par char 0xf3 = "\'f3" \par char 0xf4 = "\'f4" \par char 0xf5 = "\'f5" \par char 0xf6 = "\'f6" \par char 0xf7 = "\'f7" \par char 0xf8 = "\'f8" \par char 0xf9 = "\'f9" \par char 0xfa = "\'fa" \par char 0xfb = "\'fb" \par char 0xfc = "\'fc" \par char 0xfd = "\'fd" \par char 0xfe = "\'fe" \par char 0xff = "\'ff" \par } ./unrtf-0.19.2/test/charmac.rtf0000644000175000017500000001243007353376746017630 0ustar msamaralmsamaral00000000000000{\rtf \mac \par\par char 0x20 = "\'20" \par char 0x21 = "\'21" \par char 0x22 = "\'22" \par char 0x23 = "\'23" \par char 0x24 = "\'24" \par char 0x25 = "\'25" \par char 0x26 = "\'26" \par char 0x27 = "\'27" \par char 0x28 = "\'28" \par char 0x29 = "\'29" \par char 0x2a = "\'2a" \par char 0x2b = "\'2b" \par char 0x2c = "\'2c" \par char 0x2d = "\'2d" \par char 0x2e = "\'2e" \par char 0x2f = "\'2f" \par char 0x30 = "\'30" \par char 0x31 = "\'31" \par char 0x32 = "\'32" \par char 0x33 = "\'33" \par char 0x34 = "\'34" \par char 0x35 = "\'35" \par char 0x36 = "\'36" \par char 0x37 = "\'37" \par char 0x38 = "\'38" \par char 0x39 = "\'39" \par char 0x3a = "\'3a" \par char 0x3b = "\'3b" \par char 0x3c = "\'3c" \par char 0x3d = "\'3d" \par char 0x3e = "\'3e" \par char 0x3f = "\'3f" \par char 0x40 = "\'40" \par char 0x41 = "\'41" \par char 0x42 = "\'42" \par char 0x43 = "\'43" \par char 0x44 = "\'44" \par char 0x45 = "\'45" \par char 0x46 = "\'46" \par char 0x47 = "\'47" \par char 0x48 = "\'48" \par char 0x49 = "\'49" \par char 0x4a = "\'4a" \par char 0x4b = "\'4b" \par char 0x4c = "\'4c" \par char 0x4d = "\'4d" \par char 0x4e = "\'4e" \par char 0x4f = "\'4f" \par char 0x50 = "\'50" \par char 0x51 = "\'51" \par char 0x52 = "\'52" \par char 0x53 = "\'53" \par char 0x54 = "\'54" \par char 0x55 = "\'55" \par char 0x56 = "\'56" \par char 0x57 = "\'57" \par char 0x58 = "\'58" \par char 0x59 = "\'59" \par char 0x5a = "\'5a" \par char 0x5b = "\'5b" \par char 0x5c = "\'5c" \par char 0x5d = "\'5d" \par char 0x5e = "\'5e" \par char 0x5f = "\'5f" \par char 0x60 = "\'60" \par char 0x61 = "\'61" \par char 0x62 = "\'62" \par char 0x63 = "\'63" \par char 0x64 = "\'64" \par char 0x65 = "\'65" \par char 0x66 = "\'66" \par char 0x67 = "\'67" \par char 0x68 = "\'68" \par char 0x69 = "\'69" \par char 0x6a = "\'6a" \par char 0x6b = "\'6b" \par char 0x6c = "\'6c" \par char 0x6d = "\'6d" \par char 0x6e = "\'6e" \par char 0x6f = "\'6f" \par char 0x70 = "\'70" \par char 0x71 = "\'71" \par char 0x72 = "\'72" \par char 0x73 = "\'73" \par char 0x74 = "\'74" \par char 0x75 = "\'75" \par char 0x76 = "\'76" \par char 0x77 = "\'77" \par char 0x78 = "\'78" \par char 0x79 = "\'79" \par char 0x7a = "\'7a" \par char 0x7b = "\'7b" \par char 0x7c = "\'7c" \par char 0x7d = "\'7d" \par char 0x7e = "\'7e" \par char 0x7f = "\'7f" \par char 0x80 = "\'80" \par char 0x81 = "\'81" \par char 0x82 = "\'82" \par char 0x83 = "\'83" \par char 0x84 = "\'84" \par char 0x85 = "\'85" \par char 0x86 = "\'86" \par char 0x87 = "\'87" \par char 0x88 = "\'88" \par char 0x89 = "\'89" \par char 0x8a = "\'8a" \par char 0x8b = "\'8b" \par char 0x8c = "\'8c" \par char 0x8d = "\'8d" \par char 0x8e = "\'8e" \par char 0x8f = "\'8f" \par char 0x90 = "\'90" \par char 0x91 = "\'91" \par char 0x92 = "\'92" \par char 0x93 = "\'93" \par char 0x94 = "\'94" \par char 0x95 = "\'95" \par char 0x96 = "\'96" \par char 0x97 = "\'97" \par char 0x98 = "\'98" \par char 0x99 = "\'99" \par char 0x9a = "\'9a" \par char 0x9b = "\'9b" \par char 0x9c = "\'9c" \par char 0x9d = "\'9d" \par char 0x9e = "\'9e" \par char 0x9f = "\'9f" \par char 0xa0 = "\'a0" \par char 0xa1 = "\'a1" \par char 0xa2 = "\'a2" \par char 0xa3 = "\'a3" \par char 0xa4 = "\'a4" \par char 0xa5 = "\'a5" \par char 0xa6 = "\'a6" \par char 0xa7 = "\'a7" \par char 0xa8 = "\'a8" \par char 0xa9 = "\'a9" \par char 0xaa = "\'aa" \par char 0xab = "\'ab" \par char 0xac = "\'ac" \par char 0xad = "\'ad" \par char 0xae = "\'ae" \par char 0xaf = "\'af" \par char 0xb0 = "\'b0" \par char 0xb1 = "\'b1" \par char 0xb2 = "\'b2" \par char 0xb3 = "\'b3" \par char 0xb4 = "\'b4" \par char 0xb5 = "\'b5" \par char 0xb6 = "\'b6" \par char 0xb7 = "\'b7" \par char 0xb8 = "\'b8" \par char 0xb9 = "\'b9" \par char 0xba = "\'ba" \par char 0xbb = "\'bb" \par char 0xbc = "\'bc" \par char 0xbd = "\'bd" \par char 0xbe = "\'be" \par char 0xbf = "\'bf" \par char 0xc0 = "\'c0" \par char 0xc1 = "\'c1" \par char 0xc2 = "\'c2" \par char 0xc3 = "\'c3" \par char 0xc4 = "\'c4" \par char 0xc5 = "\'c5" \par char 0xc6 = "\'c6" \par char 0xc7 = "\'c7" \par char 0xc8 = "\'c8" \par char 0xc9 = "\'c9" \par char 0xca = "\'ca" \par char 0xcb = "\'cb" \par char 0xcc = "\'cc" \par char 0xcd = "\'cd" \par char 0xce = "\'ce" \par char 0xcf = "\'cf" \par char 0xd0 = "\'d0" \par char 0xd1 = "\'d1" \par char 0xd2 = "\'d2" \par char 0xd3 = "\'d3" \par char 0xd4 = "\'d4" \par char 0xd5 = "\'d5" \par char 0xd6 = "\'d6" \par char 0xd7 = "\'d7" \par char 0xd8 = "\'d8" \par char 0xd9 = "\'d9" \par char 0xda = "\'da" \par char 0xdb = "\'db" \par char 0xdc = "\'dc" \par char 0xdd = "\'dd" \par char 0xde = "\'de" \par char 0xdf = "\'df" \par char 0xe0 = "\'e0" \par char 0xe1 = "\'e1" \par char 0xe2 = "\'e2" \par char 0xe3 = "\'e3" \par char 0xe4 = "\'e4" \par char 0xe5 = "\'e5" \par char 0xe6 = "\'e6" \par char 0xe7 = "\'e7" \par char 0xe8 = "\'e8" \par char 0xe9 = "\'e9" \par char 0xea = "\'ea" \par char 0xeb = "\'eb" \par char 0xec = "\'ec" \par char 0xed = "\'ed" \par char 0xee = "\'ee" \par char 0xef = "\'ef" \par char 0xf0 = "\'f0" \par char 0xf1 = "\'f1" \par char 0xf2 = "\'f2" \par char 0xf3 = "\'f3" \par char 0xf4 = "\'f4" \par char 0xf5 = "\'f5" \par char 0xf6 = "\'f6" \par char 0xf7 = "\'f7" \par char 0xf8 = "\'f8" \par char 0xf9 = "\'f9" \par char 0xfa = "\'fa" \par char 0xfb = "\'fb" \par char 0xfc = "\'fc" \par char 0xfd = "\'fd" \par char 0xfe = "\'fe" \par char 0xff = "\'ff" \par } ./unrtf-0.19.2/test/charpc.rtf0000644000175000017500000001242707353376755017500 0ustar msamaralmsamaral00000000000000{\rtf \pc \par\par char 0x20 = "\'20" \par char 0x21 = "\'21" \par char 0x22 = "\'22" \par char 0x23 = "\'23" \par char 0x24 = "\'24" \par char 0x25 = "\'25" \par char 0x26 = "\'26" \par char 0x27 = "\'27" \par char 0x28 = "\'28" \par char 0x29 = "\'29" \par char 0x2a = "\'2a" \par char 0x2b = "\'2b" \par char 0x2c = "\'2c" \par char 0x2d = "\'2d" \par char 0x2e = "\'2e" \par char 0x2f = "\'2f" \par char 0x30 = "\'30" \par char 0x31 = "\'31" \par char 0x32 = "\'32" \par char 0x33 = "\'33" \par char 0x34 = "\'34" \par char 0x35 = "\'35" \par char 0x36 = "\'36" \par char 0x37 = "\'37" \par char 0x38 = "\'38" \par char 0x39 = "\'39" \par char 0x3a = "\'3a" \par char 0x3b = "\'3b" \par char 0x3c = "\'3c" \par char 0x3d = "\'3d" \par char 0x3e = "\'3e" \par char 0x3f = "\'3f" \par char 0x40 = "\'40" \par char 0x41 = "\'41" \par char 0x42 = "\'42" \par char 0x43 = "\'43" \par char 0x44 = "\'44" \par char 0x45 = "\'45" \par char 0x46 = "\'46" \par char 0x47 = "\'47" \par char 0x48 = "\'48" \par char 0x49 = "\'49" \par char 0x4a = "\'4a" \par char 0x4b = "\'4b" \par char 0x4c = "\'4c" \par char 0x4d = "\'4d" \par char 0x4e = "\'4e" \par char 0x4f = "\'4f" \par char 0x50 = "\'50" \par char 0x51 = "\'51" \par char 0x52 = "\'52" \par char 0x53 = "\'53" \par char 0x54 = "\'54" \par char 0x55 = "\'55" \par char 0x56 = "\'56" \par char 0x57 = "\'57" \par char 0x58 = "\'58" \par char 0x59 = "\'59" \par char 0x5a = "\'5a" \par char 0x5b = "\'5b" \par char 0x5c = "\'5c" \par char 0x5d = "\'5d" \par char 0x5e = "\'5e" \par char 0x5f = "\'5f" \par char 0x60 = "\'60" \par char 0x61 = "\'61" \par char 0x62 = "\'62" \par char 0x63 = "\'63" \par char 0x64 = "\'64" \par char 0x65 = "\'65" \par char 0x66 = "\'66" \par char 0x67 = "\'67" \par char 0x68 = "\'68" \par char 0x69 = "\'69" \par char 0x6a = "\'6a" \par char 0x6b = "\'6b" \par char 0x6c = "\'6c" \par char 0x6d = "\'6d" \par char 0x6e = "\'6e" \par char 0x6f = "\'6f" \par char 0x70 = "\'70" \par char 0x71 = "\'71" \par char 0x72 = "\'72" \par char 0x73 = "\'73" \par char 0x74 = "\'74" \par char 0x75 = "\'75" \par char 0x76 = "\'76" \par char 0x77 = "\'77" \par char 0x78 = "\'78" \par char 0x79 = "\'79" \par char 0x7a = "\'7a" \par char 0x7b = "\'7b" \par char 0x7c = "\'7c" \par char 0x7d = "\'7d" \par char 0x7e = "\'7e" \par char 0x7f = "\'7f" \par char 0x80 = "\'80" \par char 0x81 = "\'81" \par char 0x82 = "\'82" \par char 0x83 = "\'83" \par char 0x84 = "\'84" \par char 0x85 = "\'85" \par char 0x86 = "\'86" \par char 0x87 = "\'87" \par char 0x88 = "\'88" \par char 0x89 = "\'89" \par char 0x8a = "\'8a" \par char 0x8b = "\'8b" \par char 0x8c = "\'8c" \par char 0x8d = "\'8d" \par char 0x8e = "\'8e" \par char 0x8f = "\'8f" \par char 0x90 = "\'90" \par char 0x91 = "\'91" \par char 0x92 = "\'92" \par char 0x93 = "\'93" \par char 0x94 = "\'94" \par char 0x95 = "\'95" \par char 0x96 = "\'96" \par char 0x97 = "\'97" \par char 0x98 = "\'98" \par char 0x99 = "\'99" \par char 0x9a = "\'9a" \par char 0x9b = "\'9b" \par char 0x9c = "\'9c" \par char 0x9d = "\'9d" \par char 0x9e = "\'9e" \par char 0x9f = "\'9f" \par char 0xa0 = "\'a0" \par char 0xa1 = "\'a1" \par char 0xa2 = "\'a2" \par char 0xa3 = "\'a3" \par char 0xa4 = "\'a4" \par char 0xa5 = "\'a5" \par char 0xa6 = "\'a6" \par char 0xa7 = "\'a7" \par char 0xa8 = "\'a8" \par char 0xa9 = "\'a9" \par char 0xaa = "\'aa" \par char 0xab = "\'ab" \par char 0xac = "\'ac" \par char 0xad = "\'ad" \par char 0xae = "\'ae" \par char 0xaf = "\'af" \par char 0xb0 = "\'b0" \par char 0xb1 = "\'b1" \par char 0xb2 = "\'b2" \par char 0xb3 = "\'b3" \par char 0xb4 = "\'b4" \par char 0xb5 = "\'b5" \par char 0xb6 = "\'b6" \par char 0xb7 = "\'b7" \par char 0xb8 = "\'b8" \par char 0xb9 = "\'b9" \par char 0xba = "\'ba" \par char 0xbb = "\'bb" \par char 0xbc = "\'bc" \par char 0xbd = "\'bd" \par char 0xbe = "\'be" \par char 0xbf = "\'bf" \par char 0xc0 = "\'c0" \par char 0xc1 = "\'c1" \par char 0xc2 = "\'c2" \par char 0xc3 = "\'c3" \par char 0xc4 = "\'c4" \par char 0xc5 = "\'c5" \par char 0xc6 = "\'c6" \par char 0xc7 = "\'c7" \par char 0xc8 = "\'c8" \par char 0xc9 = "\'c9" \par char 0xca = "\'ca" \par char 0xcb = "\'cb" \par char 0xcc = "\'cc" \par char 0xcd = "\'cd" \par char 0xce = "\'ce" \par char 0xcf = "\'cf" \par char 0xd0 = "\'d0" \par char 0xd1 = "\'d1" \par char 0xd2 = "\'d2" \par char 0xd3 = "\'d3" \par char 0xd4 = "\'d4" \par char 0xd5 = "\'d5" \par char 0xd6 = "\'d6" \par char 0xd7 = "\'d7" \par char 0xd8 = "\'d8" \par char 0xd9 = "\'d9" \par char 0xda = "\'da" \par char 0xdb = "\'db" \par char 0xdc = "\'dc" \par char 0xdd = "\'dd" \par char 0xde = "\'de" \par char 0xdf = "\'df" \par char 0xe0 = "\'e0" \par char 0xe1 = "\'e1" \par char 0xe2 = "\'e2" \par char 0xe3 = "\'e3" \par char 0xe4 = "\'e4" \par char 0xe5 = "\'e5" \par char 0xe6 = "\'e6" \par char 0xe7 = "\'e7" \par char 0xe8 = "\'e8" \par char 0xe9 = "\'e9" \par char 0xea = "\'ea" \par char 0xeb = "\'eb" \par char 0xec = "\'ec" \par char 0xed = "\'ed" \par char 0xee = "\'ee" \par char 0xef = "\'ef" \par char 0xf0 = "\'f0" \par char 0xf1 = "\'f1" \par char 0xf2 = "\'f2" \par char 0xf3 = "\'f3" \par char 0xf4 = "\'f4" \par char 0xf5 = "\'f5" \par char 0xf6 = "\'f6" \par char 0xf7 = "\'f7" \par char 0xf8 = "\'f8" \par char 0xf9 = "\'f9" \par char 0xfa = "\'fa" \par char 0xfb = "\'fb" \par char 0xfc = "\'fc" \par char 0xfd = "\'fd" \par char 0xfe = "\'fe" \par char 0xff = "\'ff" \par } ./unrtf-0.19.2/test/charpca.rtf0000644000175000017500000001243007353376760017627 0ustar msamaralmsamaral00000000000000{\rtf \pca \par\par char 0x20 = "\'20" \par char 0x21 = "\'21" \par char 0x22 = "\'22" \par char 0x23 = "\'23" \par char 0x24 = "\'24" \par char 0x25 = "\'25" \par char 0x26 = "\'26" \par char 0x27 = "\'27" \par char 0x28 = "\'28" \par char 0x29 = "\'29" \par char 0x2a = "\'2a" \par char 0x2b = "\'2b" \par char 0x2c = "\'2c" \par char 0x2d = "\'2d" \par char 0x2e = "\'2e" \par char 0x2f = "\'2f" \par char 0x30 = "\'30" \par char 0x31 = "\'31" \par char 0x32 = "\'32" \par char 0x33 = "\'33" \par char 0x34 = "\'34" \par char 0x35 = "\'35" \par char 0x36 = "\'36" \par char 0x37 = "\'37" \par char 0x38 = "\'38" \par char 0x39 = "\'39" \par char 0x3a = "\'3a" \par char 0x3b = "\'3b" \par char 0x3c = "\'3c" \par char 0x3d = "\'3d" \par char 0x3e = "\'3e" \par char 0x3f = "\'3f" \par char 0x40 = "\'40" \par char 0x41 = "\'41" \par char 0x42 = "\'42" \par char 0x43 = "\'43" \par char 0x44 = "\'44" \par char 0x45 = "\'45" \par char 0x46 = "\'46" \par char 0x47 = "\'47" \par char 0x48 = "\'48" \par char 0x49 = "\'49" \par char 0x4a = "\'4a" \par char 0x4b = "\'4b" \par char 0x4c = "\'4c" \par char 0x4d = "\'4d" \par char 0x4e = "\'4e" \par char 0x4f = "\'4f" \par char 0x50 = "\'50" \par char 0x51 = "\'51" \par char 0x52 = "\'52" \par char 0x53 = "\'53" \par char 0x54 = "\'54" \par char 0x55 = "\'55" \par char 0x56 = "\'56" \par char 0x57 = "\'57" \par char 0x58 = "\'58" \par char 0x59 = "\'59" \par char 0x5a = "\'5a" \par char 0x5b = "\'5b" \par char 0x5c = "\'5c" \par char 0x5d = "\'5d" \par char 0x5e = "\'5e" \par char 0x5f = "\'5f" \par char 0x60 = "\'60" \par char 0x61 = "\'61" \par char 0x62 = "\'62" \par char 0x63 = "\'63" \par char 0x64 = "\'64" \par char 0x65 = "\'65" \par char 0x66 = "\'66" \par char 0x67 = "\'67" \par char 0x68 = "\'68" \par char 0x69 = "\'69" \par char 0x6a = "\'6a" \par char 0x6b = "\'6b" \par char 0x6c = "\'6c" \par char 0x6d = "\'6d" \par char 0x6e = "\'6e" \par char 0x6f = "\'6f" \par char 0x70 = "\'70" \par char 0x71 = "\'71" \par char 0x72 = "\'72" \par char 0x73 = "\'73" \par char 0x74 = "\'74" \par char 0x75 = "\'75" \par char 0x76 = "\'76" \par char 0x77 = "\'77" \par char 0x78 = "\'78" \par char 0x79 = "\'79" \par char 0x7a = "\'7a" \par char 0x7b = "\'7b" \par char 0x7c = "\'7c" \par char 0x7d = "\'7d" \par char 0x7e = "\'7e" \par char 0x7f = "\'7f" \par char 0x80 = "\'80" \par char 0x81 = "\'81" \par char 0x82 = "\'82" \par char 0x83 = "\'83" \par char 0x84 = "\'84" \par char 0x85 = "\'85" \par char 0x86 = "\'86" \par char 0x87 = "\'87" \par char 0x88 = "\'88" \par char 0x89 = "\'89" \par char 0x8a = "\'8a" \par char 0x8b = "\'8b" \par char 0x8c = "\'8c" \par char 0x8d = "\'8d" \par char 0x8e = "\'8e" \par char 0x8f = "\'8f" \par char 0x90 = "\'90" \par char 0x91 = "\'91" \par char 0x92 = "\'92" \par char 0x93 = "\'93" \par char 0x94 = "\'94" \par char 0x95 = "\'95" \par char 0x96 = "\'96" \par char 0x97 = "\'97" \par char 0x98 = "\'98" \par char 0x99 = "\'99" \par char 0x9a = "\'9a" \par char 0x9b = "\'9b" \par char 0x9c = "\'9c" \par char 0x9d = "\'9d" \par char 0x9e = "\'9e" \par char 0x9f = "\'9f" \par char 0xa0 = "\'a0" \par char 0xa1 = "\'a1" \par char 0xa2 = "\'a2" \par char 0xa3 = "\'a3" \par char 0xa4 = "\'a4" \par char 0xa5 = "\'a5" \par char 0xa6 = "\'a6" \par char 0xa7 = "\'a7" \par char 0xa8 = "\'a8" \par char 0xa9 = "\'a9" \par char 0xaa = "\'aa" \par char 0xab = "\'ab" \par char 0xac = "\'ac" \par char 0xad = "\'ad" \par char 0xae = "\'ae" \par char 0xaf = "\'af" \par char 0xb0 = "\'b0" \par char 0xb1 = "\'b1" \par char 0xb2 = "\'b2" \par char 0xb3 = "\'b3" \par char 0xb4 = "\'b4" \par char 0xb5 = "\'b5" \par char 0xb6 = "\'b6" \par char 0xb7 = "\'b7" \par char 0xb8 = "\'b8" \par char 0xb9 = "\'b9" \par char 0xba = "\'ba" \par char 0xbb = "\'bb" \par char 0xbc = "\'bc" \par char 0xbd = "\'bd" \par char 0xbe = "\'be" \par char 0xbf = "\'bf" \par char 0xc0 = "\'c0" \par char 0xc1 = "\'c1" \par char 0xc2 = "\'c2" \par char 0xc3 = "\'c3" \par char 0xc4 = "\'c4" \par char 0xc5 = "\'c5" \par char 0xc6 = "\'c6" \par char 0xc7 = "\'c7" \par char 0xc8 = "\'c8" \par char 0xc9 = "\'c9" \par char 0xca = "\'ca" \par char 0xcb = "\'cb" \par char 0xcc = "\'cc" \par char 0xcd = "\'cd" \par char 0xce = "\'ce" \par char 0xcf = "\'cf" \par char 0xd0 = "\'d0" \par char 0xd1 = "\'d1" \par char 0xd2 = "\'d2" \par char 0xd3 = "\'d3" \par char 0xd4 = "\'d4" \par char 0xd5 = "\'d5" \par char 0xd6 = "\'d6" \par char 0xd7 = "\'d7" \par char 0xd8 = "\'d8" \par char 0xd9 = "\'d9" \par char 0xda = "\'da" \par char 0xdb = "\'db" \par char 0xdc = "\'dc" \par char 0xdd = "\'dd" \par char 0xde = "\'de" \par char 0xdf = "\'df" \par char 0xe0 = "\'e0" \par char 0xe1 = "\'e1" \par char 0xe2 = "\'e2" \par char 0xe3 = "\'e3" \par char 0xe4 = "\'e4" \par char 0xe5 = "\'e5" \par char 0xe6 = "\'e6" \par char 0xe7 = "\'e7" \par char 0xe8 = "\'e8" \par char 0xe9 = "\'e9" \par char 0xea = "\'ea" \par char 0xeb = "\'eb" \par char 0xec = "\'ec" \par char 0xed = "\'ed" \par char 0xee = "\'ee" \par char 0xef = "\'ef" \par char 0xf0 = "\'f0" \par char 0xf1 = "\'f1" \par char 0xf2 = "\'f2" \par char 0xf3 = "\'f3" \par char 0xf4 = "\'f4" \par char 0xf5 = "\'f5" \par char 0xf6 = "\'f6" \par char 0xf7 = "\'f7" \par char 0xf8 = "\'f8" \par char 0xf9 = "\'f9" \par char 0xfa = "\'fa" \par char 0xfb = "\'fb" \par char 0xfc = "\'fc" \par char 0xfd = "\'fd" \par char 0xfe = "\'fe" \par char 0xff = "\'ff" \par } ./unrtf-0.19.2/text.c0000644000175000017500000001635007356513561015662 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: text * Author name: Zach Smith * Create date: 19 Sep 01 * Purpose: Plain text output module *---------------------------------------------------------------------- * Changes: * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks *--------------------------------------------------------------------*/ #include #include #include "malloc.h" #include "defs.h" #include "error.h" #include "main.h" #include "output.h" static char* ascii_translation_table [96] = { /* 0x20 */ " ", "!", "\"", "#", "$", "%", "&", "'", /* 0x28 */ "(", ")", "*", "+", ",", "-", ".", "/", /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7", /* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?", /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G", /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O", /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W", /* 0x58 */ "X", "Y", "Z", "[", "\\", "]", "^", "_", /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g", /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o", /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w", /* 0x78 */ "x", "y", "z", "{", "|", "}", "~", "", }; static char* upper_translation_table [128] = { "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", }; /*======================================================================== * Name: text_init * Purpose: Generates an output personality for the plain text format. * Args: None. * Returns: OutputPersonality. *=======================================================================*/ OutputPersonality * text_init (void) { OutputPersonality* text_op; text_op = op_create(); text_op->comment_begin = "### "; text_op->comment_end = "\n"; text_op->document_begin = ""; text_op->document_end = ""; text_op->header_begin = ""; text_op->header_end = ""; text_op->document_title_begin = "\nTITLE: "; text_op->document_title_end = "\n"; text_op->document_author_begin = "\nAUTHOR: "; text_op->document_author_end = "\n"; text_op->document_changedate_begin = "\nDATE: "; text_op->document_changedate_end = "\n"; text_op->body_begin = "\n-----------------\n"; text_op->body_end = ""; text_op->paragraph_begin = ""; text_op->paragraph_end = "\n"; text_op->center_begin = ""; text_op->center_end = ""; text_op->justify_begin = ""; text_op->justify_end = ""; text_op->align_left_begin = ""; text_op->align_left_end = ""; text_op->align_right_begin = ""; text_op->align_right_end = ""; text_op->forced_space = " "; text_op->line_break = "\n"; text_op->page_break = "\n"; text_op->hyperlink_begin = ""; text_op->hyperlink_end = ""; text_op->imagelink_begin = ""; text_op->imagelink_end = ""; text_op->table_begin = "\n"; text_op->table_end = "\n"; text_op->table_row_begin = ""; text_op->table_row_end = "\n"; text_op->table_cell_begin = "\t"; text_op->table_cell_end = ""; /* Character attributes */ text_op->font_begin = ""; text_op->font_end = ""; text_op->fontsize_begin = ""; text_op->fontsize_end = ""; text_op->fontsize8_begin = ""; text_op->fontsize8_end = ""; text_op->fontsize10_begin = ""; text_op->fontsize10_end = ""; text_op->fontsize12_begin = ""; text_op->fontsize12_end = ""; text_op->fontsize14_begin = ""; text_op->fontsize14_end = ""; text_op->fontsize18_begin = ""; text_op->fontsize18_end = ""; text_op->fontsize24_begin = ""; text_op->fontsize24_end = ""; text_op->smaller_begin = ""; text_op->smaller_end = ""; text_op->bigger_begin = ""; text_op->bigger_end = ""; text_op->foreground_begin = ""; text_op->foreground_end = ""; text_op->background_begin = ""; text_op->background_end = ""; text_op->bold_begin = ""; text_op->bold_end = ""; text_op->italic_begin = ""; text_op->italic_end = ""; text_op->underline_begin = ""; text_op->underline_end = ""; text_op->dbl_underline_begin = ""; text_op->dbl_underline_end = ""; text_op->superscript_begin = ""; text_op->superscript_end = ""; text_op->subscript_begin = ""; text_op->subscript_end = ""; text_op->strikethru_begin = ""; text_op->strikethru_end = ""; text_op->dbl_strikethru_begin = ""; text_op->dbl_strikethru_end = ""; text_op->emboss_begin=""; text_op->emboss_end = ""; text_op->engrave_begin = ""; text_op->engrave_end = ""; text_op->shadow_begin= ""; text_op->shadow_end= ""; text_op->outline_begin= ""; text_op->outline_end= ""; text_op->expand_begin = ""; text_op->expand_end = ""; text_op->pointlist_begin = "\n"; text_op->pointlist_end = "\n"; text_op->pointlist_item_begin = " * "; text_op->pointlist_item_end = "\n"; text_op->numericlist_begin = "\n"; text_op->numericlist_end = "\n"; text_op->numericlist_item_begin = " # "; text_op->numericlist_item_end = "\n"; text_op->simulate_small_caps = TRUE; text_op->simulate_all_caps = TRUE; text_op->simulate_word_underline = TRUE; text_op->ascii_translation_table = ascii_translation_table; text_op->ansi_translation_table = upper_translation_table; text_op->ansi_first_char = 0x80; text_op->ansi_last_char = 0xff; text_op->cp437_translation_table = upper_translation_table; text_op->cp437_first_char = 0x80; text_op->cp437_last_char = 0xff; text_op->cp850_translation_table = upper_translation_table; text_op->cp850_first_char = 0x80; text_op->cp850_last_char = 0xff; text_op->mac_translation_table = upper_translation_table; text_op->mac_first_char = 0x80; text_op->mac_last_char = 0xff; text_op->chars.right_quote = "'"; text_op->chars.left_quote = "`"; text_op->chars.right_dbl_quote = "''"; text_op->chars.left_dbl_quote = "``"; return text_op; } ./unrtf-0.19.2/text.h0000644000175000017500000000300107356513561015654 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: text * Author name: Zach Smith * Create date: 19 Sep 01 * Purpose: Definitions for the plain text output personality *---------------------------------------------------------------------- * Changes: *--------------------------------------------------------------------*/ #ifndef _TEXT extern OutputPersonality* text_init(void); #define _TEXT #endif ./unrtf-0.19.2/unrtf.10000644000175000017500000000342310014300201015711 0ustar msamaralmsamaral00000000000000.\" Copyright (C) Zachary Thayer Smith 2001 .\" .\" This file may be copied under the conditions described .\" in the GNU GENERAL PUBLIC LICENSE, Version 2, June 1991 .\" that should have been distributed together with this file. .\" .TH UNRTF "GNU UnRTF 0.19.2" .SH NAME UnRTF \- converts document in RTF format to other formats .SH SYNOPSIS .BI "unrtf [" options "] [" file... ] .br .sp Options: .BI [\-\-nopict] .BI [\-\-html] .BI [\-\-text] .BI [\-\-vt] .BI [\-\-latex] .BI [\-\-ps] .BI [\-\-wpml] .BI [\-\-help] .BI [\-\-version] .br .SH DESCRIPTION The program .B unrtf is a converter from Rich Text Format (RTF) to a growing number of document formats. At present it supports Hypertext Markup Language (HTML), plain text, text with VT100 codes, LaTeX, and PostScript. All output formats except HTML are "alpha" i.e. limited and development has just begun. However with HTML, the program supports tables, fonts, embedded images, hyperlinks, and paragraph alignment. Font support includes face and size changes, as well as typical attributes such as italic, bold, underlining, strikethrough, smallcaps, allcaps, expand, compress and both foreground and background colors. Images are always stored to separate files in the current directory, or they can be ignored. .SH OPTIONS .TP \-\-nopict disables the automatic storing of embedded pictures to the current directory. .TP \-\-html selects HTML output (default). .TP \-\-text selects plain ASCII text output. .TP \-\-vt selects text output with VT100 escape codes. .TP \-\-latex selects output of a LaTeX document. .TP \-\-ps selects PostScript output. .TP \-\-wpml selects WPML output. .TP \-\-version prints the program version. .SH WEBSITE http://www.gnu.org/software/unrtf/unrtf.html .SH NOTES Report bugs in the program to unrtf@gnu.ai.mit.edu. ./unrtf-0.19.2/util.c0000644000175000017500000000405207356513561015647 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: util * Author name: Zach Smith * Create date: 01 Aug 01 * Purpose: Utility functions. *---------------------------------------------------------------------- * Changes: * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks *--------------------------------------------------------------------*/ #include #include /*======================================================================== * Name: h2toi * Purpose: Converts a 2-digit hexadecimal value to an unsigned integer. * Args: String. * Returns: Integer. *=======================================================================*/ /* Convert a two-char hexadecimal expression to an integer */ int h2toi (char *s) { int tmp; int ch; tmp = tolower(*s++); if (tmp>'9') tmp-=('a'-10); else tmp-='0'; ch=16*tmp; tmp = tolower(*s++); if (tmp>'9') tmp-=('a'-10); else tmp-='0'; ch+=tmp; return ch; } ./unrtf-0.19.2/util.h0000644000175000017500000000266507356513561015664 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: util * Author name: Zach Smith * Create date: 1 Aug 2001 * Purpose: Definitions for util module. *---------------------------------------------------------------------- * Changes: *--------------------------------------------------------------------*/ extern int h2toi (char *); ./unrtf-0.19.2/vt.c0000644000175000017500000001605707356513561015333 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: vt * Author name: Zach Smith * Create date: 19 Sep 01 * Purpose: text output with VT100 escape codes module *---------------------------------------------------------------------- * Changes: * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks *--------------------------------------------------------------------*/ #include #include #include "malloc.h" #include "defs.h" #include "error.h" #include "main.h" #include "output.h" static char* ascii_translation_table [96] = { /* 0x20 */ " ", "!", "\"", "#", "$", "%", "&", "'", /* 0x28 */ "(", ")", "*", "+", ",", "-", ".", "/", /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7", /* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?", /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G", /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O", /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W", /* 0x58 */ "X", "Y", "Z", "[", "\\", "]", "^", "_", /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g", /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o", /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w", /* 0x78 */ "x", "y", "z", "{", "|", "}", "~", "", }; static char* upper_translation_table [128] = { "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", }; /*======================================================================== * Name: vt_init * Purpose: Generates an output personality for the VT100 text format. * Args: None. * Returns: OutputPersonality. *=======================================================================*/ OutputPersonality * vt_init (void) { OutputPersonality* vt_op; vt_op = op_create(); vt_op->comment_begin = "### "; vt_op->comment_end = "\n"; vt_op->document_begin = ""; vt_op->document_end = ""; vt_op->header_begin = ""; vt_op->header_end = ""; vt_op->document_title_begin = "\nTITLE: "; vt_op->document_title_end = "\n"; vt_op->document_author_begin = "\nAUTHOR: "; vt_op->document_author_end = "\n"; vt_op->document_changedate_begin = "\nDATE: "; vt_op->document_changedate_end = "\n"; vt_op->body_begin = "\n-----------------\n"; vt_op->body_end = ""; vt_op->paragraph_begin = ""; vt_op->paragraph_end = "\n"; vt_op->center_begin = ""; vt_op->center_end = ""; vt_op->justify_begin = ""; vt_op->justify_end = ""; vt_op->align_left_begin = ""; vt_op->align_left_end = ""; vt_op->align_right_begin = ""; vt_op->align_right_end = ""; vt_op->forced_space = " "; vt_op->line_break = "\n"; vt_op->page_break = "\n"; vt_op->hyperlink_begin = ""; vt_op->hyperlink_end = ""; vt_op->imagelink_begin = ""; vt_op->imagelink_end = ""; vt_op->table_begin = "\n"; vt_op->table_end = "\n"; vt_op->table_row_begin = ""; vt_op->table_row_end = "\n"; vt_op->table_cell_begin = "\t"; vt_op->table_cell_end = ""; /* Character attributes */ vt_op->font_begin = ""; vt_op->font_end = ""; vt_op->fontsize_begin = ""; vt_op->fontsize_end = ""; vt_op->fontsize8_begin = ""; vt_op->fontsize8_end = ""; vt_op->fontsize10_begin = ""; vt_op->fontsize10_end = ""; vt_op->fontsize12_begin = ""; vt_op->fontsize12_end = ""; vt_op->fontsize14_begin = ""; vt_op->fontsize14_end = ""; vt_op->fontsize18_begin = ""; vt_op->fontsize18_end = ""; vt_op->fontsize24_begin = ""; vt_op->fontsize24_end = ""; vt_op->smaller_begin = ""; vt_op->smaller_end = ""; vt_op->bigger_begin = ""; vt_op->bigger_end = ""; vt_op->foreground_begin = ""; vt_op->foreground_end = ""; vt_op->background_begin = ""; vt_op->background_end = ""; vt_op->bold_begin = "\033[7m"; vt_op->bold_end = "\033[m"; vt_op->italic_begin = "\033[7m"; vt_op->italic_end = "\033[m"; vt_op->underline_begin = "\033[4m"; vt_op->underline_end = "\033[m"; vt_op->dbl_underline_begin = ""; vt_op->dbl_underline_end = ""; vt_op->superscript_begin = ""; vt_op->superscript_end = ""; vt_op->subscript_begin = ""; vt_op->subscript_end = ""; vt_op->strikethru_begin = ""; vt_op->strikethru_end = ""; vt_op->dbl_strikethru_begin = ""; vt_op->dbl_strikethru_end = ""; vt_op->emboss_begin=""; vt_op->emboss_end = ""; vt_op->engrave_begin = ""; vt_op->engrave_end = ""; vt_op->shadow_begin= ""; vt_op->shadow_end= ""; vt_op->outline_begin= ""; vt_op->outline_end= ""; vt_op->expand_begin = ""; vt_op->expand_end = ""; vt_op->pointlist_begin = "\n"; vt_op->pointlist_end = "\n"; vt_op->pointlist_item_begin = " * "; vt_op->pointlist_item_end = "\n"; vt_op->numericlist_begin = "\n"; vt_op->numericlist_end = "\n"; vt_op->numericlist_item_begin = " # "; vt_op->numericlist_item_end = "\n"; vt_op->simulate_small_caps = TRUE; vt_op->simulate_all_caps = TRUE; vt_op->simulate_word_underline = TRUE; vt_op->ascii_translation_table = ascii_translation_table; vt_op->ansi_translation_table = upper_translation_table; vt_op->ansi_first_char = 0x80; vt_op->ansi_last_char = 0xff; vt_op->cp437_translation_table = upper_translation_table; vt_op->cp437_first_char = 0x80; vt_op->cp437_last_char = 0xff; vt_op->cp850_translation_table = upper_translation_table; vt_op->cp850_first_char = 0x80; vt_op->cp850_last_char = 0xff; vt_op->mac_translation_table = upper_translation_table; vt_op->mac_first_char = 0x80; vt_op->mac_last_char = 0xff; vt_op->chars.right_quote = "'"; vt_op->chars.left_quote = "`"; vt_op->chars.right_dbl_quote = "''"; vt_op->chars.left_dbl_quote = "``"; return vt_op; } ./unrtf-0.19.2/vt.h0000644000175000017500000000276607356513561015342 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: vt * Author name: Zach Smith * Create date: 19 Sep 01 * Purpose: Definitions for the VT text output personality *---------------------------------------------------------------------- * Changes: *--------------------------------------------------------------------*/ #ifndef _VT extern OutputPersonality* vt_init(void); #define _VT #endif ./unrtf-0.19.2/word.c0000644000175000017500000001263407356513561015652 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: word * Author name: Zach Smith * Create date: 01 Sep 00 * Purpose: Management of Word objects, which contain strings * as well as other Words. *---------------------------------------------------------------------- * Changes: * 14 Oct 00, tuorfa@yahoo.com: fixed \fs bug (# is 2X the point size). * 14 Oct 00, tuorfa@yahoo.com: fixed table data printing. * 14 Oct 00, tuorfa@yahoo.com: protection against null entries in \info * 14 Oct 00, tuorfa@yahoo.com: fixed printing of again * 14 Oct 00, tuorfa@yahoo.com: fixed closure of tables * 15 Oct 00, tuorfa@yahoo.com: fixed font attributes preceding * 15 Oct 00, tuorfa@yahoo.com: attributes now continue if >1 \cell in group * 15 Oct 00, tuorfa@yahoo.com: fixed font-size bug, lack of * 7 Nov 00, tuorfa@yahoo.com: fixed \'## translatin bug * 8 Apr 01, tuorfa@yahoo.com: added check for out of memory after malloc * 21 Apr 01, tuorfa@yahoo.com: bug fixes regarding author, date * 21 Apr 01, tuorfa@yahoo.com: added paragraph alignment * 21 Apr 01, tuorfa@yahoo.com: fix for words getting lost after \par * 24 Jul 01, tuorfa@yahoo.com: moved conversion code to convert.c * 22 Sep 01, tuorfa@yahoo.com: moved word_dump to here from parse.c * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks *--------------------------------------------------------------------*/ #include #include #include #include #include "defs.h" #include "parse.h" #include "malloc.h" #include "main.h" #include "error.h" #include "word.h" #include "hash.h" /* For word_dump */ static int indent_level=0; /*======================================================================== * Name: word_string * Purpose: Obtains the string of a Word object. This involves accessing * the Word hash. * Args: Word*. * Returns: String. *=======================================================================*/ char * word_string (Word *w) { char *str; CHECK_PARAM_NOT_NULL(w); if (w->hash_index) str = hash_get_string (w->hash_index); else str = NULL; return str; } /*======================================================================== * Name: word_new * Purpose: Instantiates a new Word object. * Args: String. * Returns: Word*. *=======================================================================*/ Word * word_new (char *str) { Word * w; w = (Word *) my_malloc(sizeof(Word)); if (!w) error_handler ("out of memory"); memset ((void*) w, 0, sizeof(Word)); if (!w) error_handler ("cannot allocate a Word"); if (str) w->hash_index = hash_get_index (str); else w->hash_index = 0; return w; } /*======================================================================== * Name: word_free * Purpose: Deallocates a Word object. * Args: Word. * Returns: None. *=======================================================================*/ void word_free (Word *w) { Word *prev; Word *w2; CHECK_PARAM_NOT_NULL(w); while (w) { w2 = w->child; if (w2) word_free(w2); prev = w; w = w->next; my_free ((char*) prev); } } /*======================================================================== * Name: print_indentation * Purpose: Prints padding for the word_dump routine. * Args: Identation level. * Returns: None. *=======================================================================*/ static void print_indentation (int level) { int i; if (level) { for (i=0;ichild) { word_dump (w->child); printf ("\n"); print_indentation (indent_level); } else warning_handler ("Word object has no string and no children"); } w = w->next; } indent_level -= 2; } ./unrtf-0.19.2/word.h0000644000175000017500000000336707356513561015662 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: word.h * Author name: Zach Smith * Create date: 1 Sept 2000 * Purpose: Definitions for Word class. *---------------------------------------------------------------------- * Changes: *--------------------------------------------------------------------*/ #ifndef _WORD #define _WORD typedef struct _w { unsigned long hash_index; struct _w * next; struct _w * child; } Word; extern Word* word_new (char*); extern void word_free (Word*); extern Word* word_read (FILE*); extern char* word_string (Word*); extern void word_dump (Word*); extern void word_print_html (Word*); #define _WORD #endif ./unrtf-0.19.2/wpml.c0000644000175000017500000001716107356513561015656 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: wpml * Author name: Zach Smith * Create date: 19 Sep 01 * Purpose: WPML output module * Note: WPML is my own format; it is a work-in-progress *---------------------------------------------------------------------- * Changes: * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks *--------------------------------------------------------------------*/ #include #include #include "malloc.h" #include "defs.h" #include "error.h" #include "main.h" #include "output.h" static char* ascii_translation_table [96] = { /* 0x20 */ " ", "!", "\"", "#", "$", "%", "&", "'", /* 0x28 */ "(", ")", "*", "+", ",", "-", ".", "/", /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7", /* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?", /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G", /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O", /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W", /* 0x58 */ "X", "Y", "Z", "[", "\\", "]", "^", "_", /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g", /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o", /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w", /* 0x78 */ "x", "y", "z", "{", "|", "}", "~", "", }; static char* upper_translation_table [128] = { "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", }; /*======================================================================== * Name: wpml_init * Purpose: Generates an output personality for the WPML format. * Args: None. * Returns: OutputPersonality. *=======================================================================*/ OutputPersonality * wpml_init (void) { OutputPersonality* wpml_op; wpml_op = op_create(); wpml_op->comment_begin = "\n"; wpml_op->document_begin = ""; wpml_op->document_end = ""; wpml_op->header_begin = ""; wpml_op->header_end = ""; wpml_op->document_title_begin = ""; wpml_op->document_title_end = ""; wpml_op->document_author_begin = ""; wpml_op->document_author_end = "\n"; wpml_op->document_changedate_begin = ""; wpml_op->document_changedate_end = "\n"; wpml_op->body_begin = "\n\n"; wpml_op->body_end = ""; wpml_op->paragraph_begin = ""; wpml_op->paragraph_end = "\n"; wpml_op->center_begin = ""; wpml_op->center_end = ""; wpml_op->justify_begin = ""; wpml_op->justify_end = ""; wpml_op->align_left_begin = ""; wpml_op->align_left_end = ""; wpml_op->align_right_begin = ""; wpml_op->align_right_end = ""; wpml_op->forced_space = " "; wpml_op->line_break = "\n"; wpml_op->page_break = "\n"; wpml_op->hyperlink_begin = ""; wpml_op->hyperlink_end = ""; wpml_op->imagelink_begin = ""; wpml_op->imagelink_end = ""; wpml_op->table_begin = "\n"; wpml_op->table_end = "
    \n"; wpml_op->table_row_begin = ""; wpml_op->table_row_end = "\n"; wpml_op->table_cell_begin = ""; wpml_op->table_cell_end = ""; /* Character attributes */ /* XX: WPML will require that all elements that are now * character attribute strings be converted to functions, * so that a complete font description can be written * each time an attribute begins or ends. */ wpml_op->font_begin = ""; wpml_op->font_end = ""; wpml_op->fontsize_begin = ""; wpml_op->fontsize_end = ""; wpml_op->fontsize8_begin = ""; wpml_op->fontsize8_end = ""; wpml_op->fontsize10_begin = ""; wpml_op->fontsize10_end = ""; wpml_op->fontsize12_begin = ""; wpml_op->fontsize12_end = ""; wpml_op->fontsize14_begin = ""; wpml_op->fontsize14_end = ""; wpml_op->fontsize18_begin = ""; wpml_op->fontsize18_end = ""; wpml_op->fontsize24_begin = ""; wpml_op->fontsize24_end = ""; wpml_op->smaller_begin = ""; wpml_op->smaller_end = ""; wpml_op->bigger_begin = ""; wpml_op->bigger_end = ""; wpml_op->foreground_begin = ""; wpml_op->foreground_end = ""; wpml_op->background_begin = ""; wpml_op->background_end = ""; wpml_op->bold_begin = ""; wpml_op->bold_end = ""; wpml_op->italic_begin = ""; wpml_op->italic_end = ""; wpml_op->underline_begin = ""; wpml_op->underline_end = ""; wpml_op->dbl_underline_begin = ""; wpml_op->dbl_underline_end = ""; wpml_op->superscript_begin = ""; wpml_op->superscript_end = ""; wpml_op->subscript_begin = ""; wpml_op->subscript_end = ""; wpml_op->strikethru_begin = ""; wpml_op->strikethru_end = ""; wpml_op->dbl_strikethru_begin = ""; wpml_op->dbl_strikethru_end = ""; wpml_op->emboss_begin=""; wpml_op->emboss_end = ""; wpml_op->engrave_begin = ""; wpml_op->engrave_end = ""; wpml_op->shadow_begin= ""; wpml_op->shadow_end= ""; wpml_op->outline_begin= ""; wpml_op->outline_end= ""; wpml_op->expand_begin = ""; wpml_op->expand_end = ""; wpml_op->pointlist_begin = "\n"; wpml_op->pointlist_end = "\n"; wpml_op->pointlist_item_begin = ""; wpml_op->pointlist_item_end = "\n"; wpml_op->numericlist_begin = "\n"; wpml_op->numericlist_end = "\n"; wpml_op->numericlist_item_begin = ""; wpml_op->numericlist_item_end = "\n"; wpml_op->simulate_small_caps = TRUE; wpml_op->simulate_all_caps = TRUE; wpml_op->simulate_word_underline = TRUE; wpml_op->ascii_translation_table = ascii_translation_table; wpml_op->ansi_translation_table = upper_translation_table; wpml_op->ansi_first_char = 0x80; wpml_op->ansi_last_char = 0xff; wpml_op->cp437_translation_table = upper_translation_table; wpml_op->cp437_first_char = 0x80; wpml_op->cp437_last_char = 0xff; wpml_op->cp850_translation_table = upper_translation_table; wpml_op->cp850_first_char = 0x80; wpml_op->cp850_last_char = 0xff; wpml_op->mac_translation_table = upper_translation_table; wpml_op->mac_first_char = 0x80; wpml_op->mac_last_char = 0xff; wpml_op->chars.right_quote = "'"; wpml_op->chars.left_quote = "`"; wpml_op->chars.right_dbl_quote = "''"; wpml_op->chars.left_dbl_quote = "``"; return wpml_op; } ./unrtf-0.19.2/wpml.h0000644000175000017500000000277307356513561015666 0ustar msamaralmsamaral00000000000000 /*============================================================================= GNU UnRTF, a command-line program to convert RTF documents to other formats. Copyright (C) 2000,2001 Zachary Thayer Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author is reachable by electronic mail at tuorfa@yahoo.com. =============================================================================*/ /*---------------------------------------------------------------------- * Module name: wpml * Author name: Zach Smith * Create date: 22 Sep 01 * Purpose: Definitions for the WPML output personality *---------------------------------------------------------------------- * Changes: *--------------------------------------------------------------------*/ #ifndef _WPML extern OutputPersonality* wpml_init(void); #define _WPML #endif