From 2d1813fb64275317d0a8cc19dbdd2300a1ede0a3 Mon Sep 17 00:00:00 2001 From: grejppi Date: Tue, 12 Jul 2016 19:28:45 +0300 Subject: [PATCH] Remove FLP import, revert to GPLv2+ only (#2904) --- LICENSE.txt | 681 ----- README.md | 2 +- include/EnvelopeAndLfoParameters.h | 1 - include/FileBrowser.h | 2 - include/InstrumentFunctions.h | 1 - include/InstrumentSoundShaping.h | 1 - include/InstrumentTrack.h | 1 - plugins/CMakeLists.txt | 1 - plugins/flp_import/CMakeLists.txt | 13 - plugins/flp_import/FlpImport.cpp | 1887 ------------- plugins/flp_import/FlpImport.h | 104 - plugins/flp_import/unrtf.cpp | 71 - plugins/flp_import/unrtf/attr.c | 677 ----- plugins/flp_import/unrtf/attr.h | 104 - plugins/flp_import/unrtf/convert.c | 3684 -------------------------- plugins/flp_import/unrtf/convert.h | 60 - plugins/flp_import/unrtf/defs.h | 78 - plugins/flp_import/unrtf/error.c | 106 - plugins/flp_import/unrtf/error.h | 46 - plugins/flp_import/unrtf/hash.c | 218 -- plugins/flp_import/unrtf/hash.h | 42 - plugins/flp_import/unrtf/html.c | 1265 --------- plugins/flp_import/unrtf/html.h | 43 - plugins/flp_import/unrtf/main.h | 46 - plugins/flp_import/unrtf/output.c | 478 ---- plugins/flp_import/unrtf/output.h | 312 --- plugins/flp_import/unrtf/parse.c | 472 ---- plugins/flp_import/unrtf/parse.h | 45 - plugins/flp_import/unrtf/ur_malloc.c | 133 - plugins/flp_import/unrtf/ur_malloc.h | 39 - plugins/flp_import/unrtf/util.c | 72 - plugins/flp_import/unrtf/util.h | 34 - plugins/flp_import/unrtf/word.c | 217 -- plugins/flp_import/unrtf/word.h | 53 - src/core/DataFile.cpp | 2 +- src/core/ImportFilter.cpp | 2 +- src/core/Song.cpp | 2 - src/gui/FileBrowser.cpp | 23 - src/gui/MainWindow.cpp | 2 +- 39 files changed, 4 insertions(+), 11016 deletions(-) delete mode 100644 plugins/flp_import/CMakeLists.txt delete mode 100644 plugins/flp_import/FlpImport.cpp delete mode 100644 plugins/flp_import/FlpImport.h delete mode 100644 plugins/flp_import/unrtf.cpp delete mode 100644 plugins/flp_import/unrtf/attr.c delete mode 100644 plugins/flp_import/unrtf/attr.h delete mode 100644 plugins/flp_import/unrtf/convert.c delete mode 100644 plugins/flp_import/unrtf/convert.h delete mode 100644 plugins/flp_import/unrtf/defs.h delete mode 100644 plugins/flp_import/unrtf/error.c delete mode 100644 plugins/flp_import/unrtf/error.h delete mode 100644 plugins/flp_import/unrtf/hash.c delete mode 100644 plugins/flp_import/unrtf/hash.h delete mode 100644 plugins/flp_import/unrtf/html.c delete mode 100644 plugins/flp_import/unrtf/html.h delete mode 100644 plugins/flp_import/unrtf/main.h delete mode 100644 plugins/flp_import/unrtf/output.c delete mode 100644 plugins/flp_import/unrtf/output.h delete mode 100644 plugins/flp_import/unrtf/parse.c delete mode 100644 plugins/flp_import/unrtf/parse.h delete mode 100644 plugins/flp_import/unrtf/ur_malloc.c delete mode 100644 plugins/flp_import/unrtf/ur_malloc.h delete mode 100644 plugins/flp_import/unrtf/util.c delete mode 100644 plugins/flp_import/unrtf/util.h delete mode 100644 plugins/flp_import/unrtf/word.c delete mode 100644 plugins/flp_import/unrtf/word.h diff --git a/LICENSE.txt b/LICENSE.txt index e8fbd3be0..d511905c1 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,3 @@ -This program and almost all plug-ins are licensed under the GNU General Public -License, either version 2 or any later version. ------------------------------------------------------------------------------- GNU GENERAL PUBLIC LICENSE Version 2, June 1991 @@ -340,681 +337,3 @@ 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 Lesser General Public License instead of this License. -============================================================================== -The FLP Import plug-in is licensed under the GNU General Public License, -either version 3 or any later version. ------------------------------------------------------------------------------- - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. 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 -them 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 prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. 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. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey 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; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If 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 convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU 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 that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - 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. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -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. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - 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 -state 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) - - 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 3 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, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program 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, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU 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 Lesser General -Public License instead of this License. But first, please read -. diff --git a/README.md b/README.md index 467bf2df2..644976700 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Features * Many powerful instrument and effect-plugins out of the box * Full user-defined track-based automation and computer-controlled automation sources * Compatible with many standards such as SoundFont2, VST(i), LADSPA, GUS Patches, and full MIDI support -* Import of MIDI and FLP (FL Studio®/Fruityloops® Project) files +* MIDI file importing Building --------- diff --git a/include/EnvelopeAndLfoParameters.h b/include/EnvelopeAndLfoParameters.h index 01a31251b..765bdbfb7 100644 --- a/include/EnvelopeAndLfoParameters.h +++ b/include/EnvelopeAndLfoParameters.h @@ -179,7 +179,6 @@ private: friend class EnvelopeAndLfoView; - friend class FlpImport; } ; diff --git a/include/FileBrowser.h b/include/FileBrowser.h index a73a00801..3239dcdc9 100644 --- a/include/FileBrowser.h +++ b/include/FileBrowser.h @@ -179,7 +179,6 @@ public: SoundFontFile, PatchFile, MidiFile, - FlpFile, VstPluginFile, UnknownFile, NumFileTypes @@ -228,7 +227,6 @@ private: static QPixmap * s_soundfontFilePixmap; static QPixmap * s_vstPluginFilePixmap; static QPixmap * s_midiFilePixmap; - static QPixmap * s_flpFilePixmap; static QPixmap * s_unknownFilePixmap; QString m_path; diff --git a/include/InstrumentFunctions.h b/include/InstrumentFunctions.h index d6abef16a..b69744c8b 100644 --- a/include/InstrumentFunctions.h +++ b/include/InstrumentFunctions.h @@ -202,7 +202,6 @@ private: ComboBoxModel m_arpModeModel; - friend class FlpImport; friend class InstrumentTrack; friend class InstrumentFunctionArpeggioView; diff --git a/include/InstrumentSoundShaping.h b/include/InstrumentSoundShaping.h index 4e10bbdc2..421765734 100644 --- a/include/InstrumentSoundShaping.h +++ b/include/InstrumentSoundShaping.h @@ -78,7 +78,6 @@ private: friend class InstrumentSoundShapingView; - friend class FlpImport; } ; diff --git a/include/InstrumentTrack.h b/include/InstrumentTrack.h index de9339e9d..ade3ac400 100644 --- a/include/InstrumentTrack.h +++ b/include/InstrumentTrack.h @@ -268,7 +268,6 @@ private: friend class InstrumentTrackView; friend class InstrumentTrackWindow; friend class NotePlayHandle; - friend class FlpImport; friend class InstrumentMiscView; } ; diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 55b27b344..1bb61f55c 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -19,7 +19,6 @@ ADD_SUBDIRECTORY(DualFilter) ADD_SUBDIRECTORY(dynamics_processor) ADD_SUBDIRECTORY(Eq) ADD_SUBDIRECTORY(Flanger) -ADD_SUBDIRECTORY(flp_import) ADD_SUBDIRECTORY(HydrogenImport) ADD_SUBDIRECTORY(kicker) ADD_SUBDIRECTORY(ladspa_browser) diff --git a/plugins/flp_import/CMakeLists.txt b/plugins/flp_import/CMakeLists.txt deleted file mode 100644 index 833bbd665..000000000 --- a/plugins/flp_import/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -INCLUDE(BuildPlugin) - -INCLUDE_DIRECTORIES(unrtf) - -# Enable C++11 -ADD_DEFINITIONS(-std=c++0x) - -IF(LMMS_BUILD_APPLE) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") -ENDIF() - -BUILD_PLUGIN(flpimport FlpImport.cpp unrtf.cpp FlpImport.h) - diff --git a/plugins/flp_import/FlpImport.cpp b/plugins/flp_import/FlpImport.cpp deleted file mode 100644 index 406440ce2..000000000 --- a/plugins/flp_import/FlpImport.cpp +++ /dev/null @@ -1,1887 +0,0 @@ -/* - * FlpImport.cpp - support for importing FLP-files - * - * Copyright (c) 2006-2014 Tobias Doerffel - * - * This file is part of LMMS - http://lmms.io - * - * 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 (see COPYING); if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "FlpImport.h" -#include "NotePlayHandle.h" -#include "AutomationPattern.h" -#include "BasicFilters.h" -#include "BBTrack.h" -#include "BBTrackContainer.h" -#include "ComboBox.h" -#include "ConfigManager.h" -#include "debug.h" -#include "Effect.h" -#include "Engine.h" -#include "FxMixer.h" -#include "FxMixerView.h" -#include "GroupBox.h" -#include "GuiApplication.h" -#include "Instrument.h" -#include "InstrumentTrack.h" -#include "EnvelopeAndLfoParameters.h" -#include "Knob.h" -#include "Oscillator.h" -#include "Pattern.h" -#include "Piano.h" -#include "PluginFactory.h" -#include "ProjectJournal.h" -#include "ProjectNotes.h" -#include "Song.h" -#include "TrackContainer.h" -#include "embed.h" -#include "lmmsconfig.h" - -#ifdef LMMS_HAVE_CTYPE_H -#include -#endif - -#define makeID(_c0, _c1, _c2, _c3) \ - ( ( _c0 ) | ( ( _c1 ) << 8 ) | ( ( _c2 ) << 16 ) | ( ( _c3 ) << 24 ) ) - - -extern "C" -{ - -Plugin::Descriptor PLUGIN_EXPORT flpimport_plugin_descriptor = -{ - STRINGIFY( PLUGIN_NAME ), - "FLP Import", - QT_TRANSLATE_NOOP( "pluginBrowser", - "Filter for importing FL Studio projects into LMMS" ), - "Tobias Doerffel ", - 0x0100, - Plugin::ImportFilter, - NULL, - NULL, - NULL -} ; - - -// unrtf-stuff -#include "defs.h" -#include "main.h" -#include "html.h" -#include "word.h" -#include "hash.h" -#include "convert.h" -#include "attr.h" - -extern OutputPersonality * op; -extern int lineno; -extern QString outstring; - -} - -const int NumFLFxChannels = 64; - -static void dump_mem( const void * buffer, uint n_bytes ) -{ - uchar * cp = (uchar *) buffer; - for( uint k = 0; k < n_bytes; ++k ) - { - qDebug( "%02x ", (unsigned int)cp[k] );//( cp[k] > 31 || cp[k] < 7 ) ? cp[k] : '.' ); - } - qDebug( "\n" ); -} - - -enum FLP_Events -{ - // BYTE EVENTS - FLP_Byte = 0, - FLP_Enabled = 0, - FLP_NoteOn = 1, //+pos (byte) - FLP_Vol = 2, - FLP_Pan = 3, - FLP_MIDIChan = 4, - FLP_MIDINote = 5, - FLP_MIDIPatch = 6, - FLP_MIDIBank = 7, - FLP_LoopActive = 9, - FLP_ShowInfo = 10, - FLP_Shuffle = 11, - FLP_MainVol = 12, - FLP_Stretch = 13, // old byte version - FLP_Pitchable = 14, - FLP_Zipped = 15, - FLP_Delay_Flags = 16, - FLP_PatLength = 17, - FLP_BlockLength = 18, - FLP_UseLoopPoints = 19, - FLP_LoopType = 20, - FLP_ChanType = 21, - FLP_MixSliceNum = 22, - FLP_EffectChannelMuted = 27, - - // WORD EVENTS - FLP_Word = 64, - FLP_NewChan = FLP_Word, - FLP_NewPat = FLP_Word + 1, //+PatNum (word) - FLP_Tempo = FLP_Word + 2, - FLP_CurrentPatNum = FLP_Word + 3, - FLP_PatData = FLP_Word + 4, - FLP_FX = FLP_Word + 5, - FLP_Fade_Stereo = FLP_Word + 6, - FLP_CutOff = FLP_Word + 7, - FLP_DotVol = FLP_Word + 8, - FLP_DotPan = FLP_Word + 9, - FLP_PreAmp = FLP_Word + 10, - FLP_Decay = FLP_Word + 11, - FLP_Attack = FLP_Word + 12, - FLP_DotNote = FLP_Word + 13, - FLP_DotPitch = FLP_Word + 14, - FLP_DotMix = FLP_Word + 15, - FLP_MainPitch = FLP_Word + 16, - FLP_RandChan = FLP_Word + 17, - FLP_MixChan = FLP_Word + 18, - FLP_Resonance = FLP_Word + 19, - FLP_LoopBar = FLP_Word + 20, - FLP_StDel = FLP_Word + 21, - FLP_FX3 = FLP_Word + 22, - FLP_DotReso = FLP_Word + 23, - FLP_DotCutOff = FLP_Word + 24, - FLP_ShiftDelay = FLP_Word + 25, - FLP_LoopEndBar = FLP_Word + 26, - FLP_Dot = FLP_Word + 27, - FLP_DotShift = FLP_Word + 28, - FLP_LayerChans = FLP_Word + 30, - - // DWORD EVENTS - FLP_Int = 128, - FLP_Color = FLP_Int, - FLP_PlayListItem = FLP_Int + 1, //+Pos (word) +PatNum (word) - FLP_Echo = FLP_Int + 2, - FLP_FXSine = FLP_Int + 3, - FLP_CutCutBy = FLP_Int + 4, - FLP_WindowH = FLP_Int + 5, - FLP_MiddleNote = FLP_Int + 7, - FLP_Reserved = FLP_Int + 8, // may contain an invalid - // version info - FLP_MainResoCutOff = FLP_Int + 9, - FLP_DelayReso = FLP_Int + 10, - FLP_Reverb = FLP_Int + 11, - FLP_IntStretch = FLP_Int + 12, - FLP_SSNote = FLP_Int + 13, - FLP_FineTune = FLP_Int + 14, - - // TEXT EVENTS - FLP_Undef = 192, //+Size (var length) - FLP_Text = FLP_Undef, //+Size (var length)+Text - // (Null Term. String) - FLP_Text_ChanName = FLP_Text, // name for the current channel - FLP_Text_PatName = FLP_Text + 1, // name for the current pattern - FLP_Text_Title = FLP_Text + 2, // title of the loop - FLP_Text_Comment = FLP_Text + 3, // old comments in text format. - // Not used anymore - FLP_Text_SampleFileName = FLP_Text + 4, // filename for the sample in - // the current channel, stored - // as relative path - FLP_Text_URL = FLP_Text + 5, - FLP_Text_CommentRTF = FLP_Text + 6, // new comments in Rich Text - // format - FLP_Text_Version = FLP_Text + 7, - FLP_Text_PluginName = FLP_Text + 9, // plugin file name - // (without path) - - FLP_Text_EffectChanName = FLP_Text + 12, - FLP_Text_MIDICtrls = FLP_Text + 16, - FLP_Text_Delay = FLP_Text + 17, - FLP_Text_TS404Params = FLP_Text + 18, - FLP_Text_DelayLine = FLP_Text + 19, - FLP_Text_NewPlugin = FLP_Text + 20, - FLP_Text_PluginParams = FLP_Text + 21, - FLP_Text_ChanParams = FLP_Text + 23,// block of various channel - // params (can grow) - FLP_Text_EnvLfoParams = FLP_Text + 26, - FLP_Text_BasicChanParams= FLP_Text + 27, - FLP_Text_OldFilterParams= FLP_Text + 28, - FLP_Text_AutomationData = FLP_Text + 31, - FLP_Text_PatternNotes = FLP_Text + 32, - FLP_Text_ChanGroupName = FLP_Text + 39, - FLP_Text_PlayListItems = FLP_Text + 41, - - FLP_Event_EffectParams = 225, - FLP_Event_PlaylistItems = 233, - - FLP_CmdCount - -} ; - - -struct FL_Automation -{ - FL_Automation() : - pos( 0 ), - value( 0 ), - channel( 0 ), - control( 0 ) - { - } - - enum Controls - { - ControlVolume = 0, - ControlPanning = 1, - ControlFilterCut = 2, - ControlFilterRes = 3, - ControlPitch = 4, - ControlFilterType = 5, - ControlFXChannel = 8, - - ControlVolPredelay = 4354, - ControlVolAttack, - ControlVolHold, - ControlVolDecay, - ControlVolSustain, - ControlVolRelease, - ControlVolLfoPredelay = ControlVolPredelay+7, - ControlVolLfoAttack, - ControlVolLfoAmount, - ControlVolLfoSpeed, - ControlVolAttackTension = ControlVolPredelay+12, - ControlVolDecayTension, - ControlVolReleaseTension, - ControlCutPredelay = 4610, - ControlCutAttack, - ControlCutHold, - ControlCutDecay, - ControlCutSustain, - ControlCutRelease, - ControlCutAmount, - ControlCutLfoPredelay = ControlCutPredelay+7, - ControlCutLfoAttack, - ControlCutLfoAmount, - ControlCutLfoSpeed, - ControlCutAttackTension = ControlCutPredelay+12, - ControlCutDecayTension, - ControlCutReleaseTension, - - ControlResPredelay = 4866, - ControlResAttack, - ControlResHold, - ControlResDecay, - ControlResSustain, - ControlResRelease, - ControlResAmount, - ControlResLfoPredelay = ControlResPredelay+7, - ControlResLfoAttack, - ControlResLfoAmount, - ControlResLfoSpeed, - ControlResAttackTension = ControlResPredelay+12, - ControlResDecayTension, - ControlResReleaseTension - } ; - - int pos; - int value; - int channel; - int control; - -} ; - - - -struct FL_Channel_Envelope -{ - InstrumentSoundShaping::Targets target; - float predelay; - float attack; - float hold; - float decay; - float sustain; - float release; - float amount; -} ; - - -struct FL_Plugin -{ - enum PluginTypes - { - UnknownPlugin, - - InstrumentPlugin, - Sampler, - TS404, - Fruity_3x_Osc, - Layer, - BeepMap, - BuzzGeneratorAdapter, - FruitKick, - FruityDrumSynthLive, - FruityDX10, - FruityGranulizer, - FruitySlicer, - FruitySoundfontPlayer, - FruityVibrator, - MidiOut, - Plucked, - SimSynth, - Sytrus, - WASP, - - EffectPlugin, - Fruity7BandEq, - FruityBalance, - FruityBassBoost, - FruityBigClock, - FruityBloodOverdrive, - FruityCenter, - FruityChorus, - FruityCompressor, - FruityDbMeter, - FruityDelay, - FruityDelay2, - FruityFastDist, - FruityFastLP, - FruityFilter, - FruityFlanger, - FruityFormulaController, - FruityFreeFilter, - FruityHTMLNotebook, - FruityLSD, - FruityMute2, - FruityNotebook, - FruityPanOMatic, - FruityParametricEQ, - FruityPeakController, - FruityPhaseInverter, - FruityPhaser, - FruityReeverb, - FruityScratcher, - FruitySend, - FruitySoftClipper, - FruitySpectroman, - FruityStereoEnhancer, - FruityXYController - } ; - - FL_Plugin( PluginTypes _pt = UnknownPlugin ) : - pluginType( _pt ), - name(), - pluginSettings( NULL ), - pluginSettingsLength( 0 ) - { - } - - ~FL_Plugin() - { - delete[] pluginSettings; - } - - PluginTypes pluginType; - QString name; - - char * pluginSettings; - int pluginSettingsLength; - -} ; - - -struct FL_Channel : public FL_Plugin -{ - QList automationData; - - int volume; - int panning; - int baseNote; - int fxChannel; - int layerParent; - - typedef QList > noteVector; - noteVector notes; - - QList dots; - - - QString sampleFileName; - int sampleAmp; - bool sampleReversed; - bool sampleReverseStereo; - bool sampleUseLoopPoints; - - Instrument * instrumentPlugin; - - QList envelopes; - - int filterType; - float filterCut; - float filterRes; - bool filterEnabled; - - int arpDir; - int arpRange; - int selectedArp; - float arpTime; - float arpGate; - bool arpEnabled; - - QRgb color; - - - FL_Channel( PluginTypes _pt = UnknownPlugin ) : - FL_Plugin( _pt ), - automationData(), - volume( DefaultVolume ), - panning( DefaultPanning ), - baseNote( DefaultKey ), - fxChannel( 0 ), - layerParent( -1 ), - notes(), - dots(), - sampleFileName(), - sampleAmp( 100 ), - sampleReversed( false ), - sampleReverseStereo( false ), - sampleUseLoopPoints( false ), - instrumentPlugin( NULL ), - envelopes(), - filterType( BasicFilters<>::LowPass ), - filterCut( 10000 ), - filterRes( 0.1 ), - filterEnabled( false ), - arpDir( InstrumentFunctionArpeggio::ArpDirUp ), - arpRange( 0 ), - selectedArp( 0 ), - arpTime( 100 ), - arpGate( 100 ), - arpEnabled( false ), - color( qRgb( 64, 128, 255 ) ) - { - } - -} ; - - -struct FL_Effect : public FL_Plugin -{ - FL_Effect( PluginTypes _pt = UnknownPlugin ) : - FL_Plugin( _pt ), - fxChannel( 0 ), - fxPos( 0 ) - { - } - - int fxChannel; - int fxPos; - -} ; - - -struct FL_PlayListItem -{ - FL_PlayListItem() : - position( 0 ), - length( 1 ), - pattern( 0 ) - { - } - int position; - int length; - int pattern; -} ; - - -struct FL_EffectChannel -{ - FL_EffectChannel() : - name(), - volume( DefaultVolume ), - isMuted( false ) - { - } - - QString name; - int volume; - bool isMuted; -} ; - - -struct FL_Project -{ - int mainVolume; - int mainPitch; - bpm_t tempo; - int numChannels; - - QList channels; - QList effects; - QList playListItems; - - QMap patternNames; - int maxPatterns; - int currentPattern; - int activeEditPattern; - - FL_EffectChannel effectChannels[NumFLFxChannels+1]; - int currentEffectChannel; - - QString projectNotes; - QString projectTitle; - - QString versionString; - int version; - int versionSpecificFactor; - - FL_Project() : - mainVolume( DefaultVolume ), - mainPitch( 0 ), - tempo( DefaultTempo ), - numChannels( 0 ), - channels(), - effects(), - playListItems(), - patternNames(), - maxPatterns( 0 ), - currentPattern( 0 ), - activeEditPattern( 0 ), - effectChannels(), - currentEffectChannel( -1 ), - projectNotes(), - projectTitle(), - versionString(), - version( 0x100 ), - versionSpecificFactor( 1 ) - { - } - -} ; - - - - -FlpImport::FlpImport( const QString & _file ) : - ImportFilter( _file, &flpimport_plugin_descriptor ) -{ -} - - - - -FlpImport::~FlpImport() -{ -} - - - - -bool FlpImport::tryImport( TrackContainer* tc ) -{ - const int mappedFilter[] = - { - BasicFilters<>::LowPass,// fast LP - BasicFilters<>::LowPass, - BasicFilters<>::BandPass_CSG, - BasicFilters<>::HiPass, - BasicFilters<>::Notch, - BasicFilters<>::NumFilters+BasicFilters<>::LowPass, - BasicFilters<>::LowPass, - BasicFilters<>::NumFilters+BasicFilters<>::LowPass - } ; - - const InstrumentFunctionArpeggio::ArpDirections mappedArpDir[] = - { - InstrumentFunctionArpeggio::ArpDirUp, - InstrumentFunctionArpeggio::ArpDirUp, - InstrumentFunctionArpeggio::ArpDirDown, - InstrumentFunctionArpeggio::ArpDirUpAndDown, - InstrumentFunctionArpeggio::ArpDirUpAndDown, - InstrumentFunctionArpeggio::ArpDirRandom - } ; - - QMap mappedPluginTypes; - - // instruments - mappedPluginTypes["sampler"] = FL_Plugin::Sampler; - mappedPluginTypes["ts404"] = FL_Plugin::TS404; - mappedPluginTypes["3x osc"] = FL_Plugin::Fruity_3x_Osc; - mappedPluginTypes["beepmap"] = FL_Plugin::BeepMap; - mappedPluginTypes["buzz generator adapter"] = FL_Plugin::BuzzGeneratorAdapter; - mappedPluginTypes["fruit kick"] = FL_Plugin::FruitKick; - mappedPluginTypes["fruity drumsynth live"] = FL_Plugin::FruityDrumSynthLive; - mappedPluginTypes["fruity dx10"] = FL_Plugin::FruityDX10; - mappedPluginTypes["fruity granulizer"] = FL_Plugin::FruityGranulizer; - mappedPluginTypes["fruity slicer"] = FL_Plugin::FruitySlicer; - mappedPluginTypes["fruity soundfont player"] = FL_Plugin::FruitySoundfontPlayer; - mappedPluginTypes["fruity vibrator"] = FL_Plugin::FruityVibrator; - mappedPluginTypes["midi out"] = FL_Plugin::MidiOut; - mappedPluginTypes["plucked!"] = FL_Plugin::Plucked; - mappedPluginTypes["simsynth"] = FL_Plugin::SimSynth; - mappedPluginTypes["sytrus"] = FL_Plugin::Sytrus; - mappedPluginTypes["wasp"] = FL_Plugin::WASP; - - // effects - mappedPluginTypes["fruity 7 band EQ"] = FL_Plugin::Fruity7BandEq; - mappedPluginTypes["fruity balance"] = FL_Plugin::FruityBalance; - mappedPluginTypes["fruity bass boost"] = FL_Plugin::FruityBassBoost; - mappedPluginTypes["fruity big clock"] = FL_Plugin::FruityBigClock; - mappedPluginTypes["fruity blood overdrive"] = FL_Plugin::FruityBloodOverdrive; - mappedPluginTypes["fruity center"] = FL_Plugin::FruityCenter; - mappedPluginTypes["fruity chorus"] = FL_Plugin::FruityChorus; - mappedPluginTypes["fruity compressor"] = FL_Plugin::FruityCompressor; - mappedPluginTypes["fruity db meter"] = FL_Plugin::FruityDbMeter; - mappedPluginTypes["fruity delay"] = FL_Plugin::FruityDelay; - mappedPluginTypes["fruity delay 2"] = FL_Plugin::FruityDelay2; - mappedPluginTypes["fruity fast dist"] = FL_Plugin::FruityFastDist; - mappedPluginTypes["fruity fast lp"] = FL_Plugin::FruityFastLP; - mappedPluginTypes["fruity filter"] = FL_Plugin::FruityFilter; - mappedPluginTypes["fruity flanger"] = FL_Plugin::FruityFlanger; - mappedPluginTypes["fruity formula controller"] = FL_Plugin::FruityFormulaController; - mappedPluginTypes["fruity free filter"] = FL_Plugin::FruityFreeFilter; - mappedPluginTypes["fruity html notebook"] = FL_Plugin::FruityHTMLNotebook; - mappedPluginTypes["fruity lsd"] = FL_Plugin::FruityLSD; - mappedPluginTypes["fruity mute 2"] = FL_Plugin::FruityMute2; - mappedPluginTypes["fruity notebook"] = FL_Plugin::FruityNotebook; - mappedPluginTypes["fruity panomatic"] = FL_Plugin::FruityPanOMatic; - mappedPluginTypes["fruity parametric eq"] = FL_Plugin::FruityParametricEQ; - mappedPluginTypes["fruity peak controller"] = FL_Plugin::FruityPeakController; - mappedPluginTypes["fruity phase inverter"] = FL_Plugin::FruityPhaseInverter; - mappedPluginTypes["fruity phaser"] = FL_Plugin::FruityPhaser; - mappedPluginTypes["fruity reeverb"] = FL_Plugin::FruityReeverb; - mappedPluginTypes["fruity scratcher"] = FL_Plugin::FruityScratcher; - mappedPluginTypes["fruity send"] = FL_Plugin::FruitySend; - mappedPluginTypes["fruity soft clipper"] = FL_Plugin::FruitySoftClipper; - mappedPluginTypes["fruity spectroman"] = FL_Plugin::FruitySpectroman; - mappedPluginTypes["fruity stereo enhancer"] = FL_Plugin::FruityStereoEnhancer; - mappedPluginTypes["fruity x-y controller"] = FL_Plugin::FruityXYController; - - - FL_Project p; - - if( openFile() == false ) - { - return false; - } - - if( readID() != makeID( 'F', 'L', 'h', 'd' ) ) - { - qWarning( "FlpImport::tryImport(): not a valid FL project\n" ); - return false; - } - - const int header_len = read32LE(); - if( header_len != 6 ) - { - qWarning( "FlpImport::tryImport(): invalid file format\n" ); - return false; - } - - const int type = read16LE(); - if( type != 0 ) - { - qWarning( "FlpImport::tryImport(): type %d format is not " - "supported\n", type ); - return false; - } - - p.numChannels = read16LE(); - if( p.numChannels < 1 || p.numChannels > 1000 ) - { - qWarning( "FlpImport::tryImport(): invalid number of channels " - "(%d)\n", p.numChannels ); - return false; - } - - const int ppq = read16LE(); - if( ppq < 0 ) - { - qWarning( "FlpImport::tryImport(): invalid ppq\n" ); - return false; - } - - QProgressDialog progressDialog( - TrackContainer::tr( "Importing FLP-file..." ), - TrackContainer::tr( "Cancel" ), 0, p.numChannels ); - progressDialog.setWindowTitle( TrackContainer::tr( "Please wait..." ) ); - progressDialog.show(); - - bool valid = false; - - // search for FLdt chunk - while( 1 ) - { - int32_t id = readID(); - const int len = read32LE(); - if( file().atEnd() ) - { - qWarning( "FlpImport::tryImport(): unexpected " - "end of file\n" ); - return false; - } - if( len < 0 || len >= 0x10000000 ) - { - qWarning( "FlpImport::tryImport(): invalid " - "chunk length %d\n", len ); - return false; - } - if( id == makeID( 'F', 'L', 'd', 't' ) ) - { - valid = true; - break; - } - skip( len ); - } - - if( valid == false ) - { - return false; - } - - for( int i = 0; i < p.numChannels; ++i ) - { - p.channels += FL_Channel(); - } - - qDebug( "channels: %d\n", p.numChannels ); - - - char * text = NULL; - int text_len = 0; - FL_Plugin::PluginTypes last_plugin_type = FL_Plugin::UnknownPlugin; - - int cur_channel = -1; - - const bool is_journ = Engine::projectJournal()->isJournalling(); - Engine::projectJournal()->setJournalling( false ); - - - while( file().atEnd() == false ) - { - FLP_Events ev = static_cast( readByte() ); - uint32_t data = readByte(); - - if( ev >= FLP_Word && ev < FLP_Text ) - { - data = data | ( readByte() << 8 ); - } - - if( ev >= FLP_Int && ev < FLP_Text ) - { - data = data | ( readByte() << 16 ); - data = data | ( readByte() << 24 ); - } - - - if( ev >= FLP_Text ) - { - text_len = data & 0x7F; - uint8_t shift = 0; - while( data & 0x80 ) - { - data = readByte(); - text_len = text_len | ( ( data & 0x7F ) << - ( shift += 7 ) ); - } - - delete[] text; - text = new char[text_len+1]; - if( readBlock( text, text_len ) <= 0 ) - { - qWarning( "could not read string (len: %d)\n", - text_len ); - } - - text[text_len] = 0; - } - const unsigned char * puc = (const unsigned char*) text; - const int * pi = (const int *) text; - - - FL_Channel * cc = cur_channel >= 0 ? - &p.channels[cur_channel] : NULL; - - switch( ev ) - { - // BYTE EVENTS - case FLP_Byte: - qDebug( "undefined byte %d\n", data ); - break; - - case FLP_NoteOn: - qDebug( "note on: %d\n", data ); - // data = pos how to handle? - break; - - case FLP_Vol: - qDebug( "vol %d\n", data ); - break; - - case FLP_Pan: - qDebug( "pan %d\n", data ); - break; - - case FLP_LoopActive: - qDebug( "active loop: %d\n", data ); - break; - - case FLP_ShowInfo: - qDebug( "show info: %d\n", data ); - break; - - case FLP_Shuffle: - qDebug( "shuffle: %d\n", data ); - break; - - case FLP_MainVol: - p.mainVolume = data * 100 / 128; - break; - - case FLP_PatLength: - qDebug( "pattern length: %d\n", data ); - break; - - case FLP_BlockLength: - qDebug( "block length: %d\n", data ); - break; - - case FLP_UseLoopPoints: - cc->sampleUseLoopPoints = true; - break; - - case FLP_LoopType: - qDebug( "loop type: %d\n", data ); - break; - - case FLP_ChanType: - qDebug( "channel type: %d\n", data ); - if( cc ) - { - switch( data ) - { - case 0: cc->pluginType = FL_Plugin::Sampler; break; - case 1: cc->pluginType = FL_Plugin::TS404; break; -// case 2: cc->pluginType = FL_Plugin::Fruity_3x_Osc; break; - case 3: cc->pluginType = FL_Plugin::Layer; break; - default: - break; - } - } - break; - - case FLP_MixSliceNum: - cc->fxChannel = data+1; - break; - - case FLP_EffectChannelMuted: - if( p.currentEffectChannel <= NumFLFxChannels ) - { - p.effectChannels[p.currentEffectChannel].isMuted = - ( data & 0x08 ) > 0 ? false : true; - } - break; - - - // WORD EVENTS - case FLP_NewChan: - cur_channel = data; - qDebug( "new channel: %d\n", data ); - break; - - case FLP_NewPat: - p.currentPattern = data - 1; - if( p.currentPattern > p.maxPatterns ) - { - p.maxPatterns = p.currentPattern; - } - break; - - case FLP_Tempo: - p.tempo = data; - break; - - case FLP_CurrentPatNum: - p.activeEditPattern = data; - break; - - case FLP_FX: - qDebug( "FX: %d\n", data ); - break; - - case FLP_Fade_Stereo: - if( data & 0x02 ) - { - cc->sampleReversed = true; - } - else if( data & 0x100 ) - { - cc->sampleReverseStereo = true; - } - qDebug( "fade stereo: %d\n", data ); - break; - - case FLP_CutOff: - qDebug( "cutoff (sample): %d\n", data ); - break; - - case FLP_PreAmp: - cc->sampleAmp = 100 + data * 100 / 256; - break; - - case FLP_Decay: - qDebug( "decay (sample): %d\n", data ); - break; - - case FLP_Attack: - qDebug( "attack (sample): %d\n", data ); - break; - - case FLP_MainPitch: - p.mainPitch = data; - break; - - case FLP_Resonance: - qDebug( "reso (sample): %d\n", data ); - break; - - case FLP_LoopBar: - qDebug( "loop bar: %d\n", data ); - break; - - case FLP_StDel: - qDebug( "stdel (delay?): %d\n", data ); - break; - - case FLP_FX3: - qDebug( "FX 3: %d\n", data ); - break; - - case FLP_ShiftDelay: - qDebug( "shift delay: %d\n", data ); - break; - - case FLP_Dot: - cc->dots.push_back( ( data & 0xff ) + - ( p.currentPattern << 8 ) ); - break; - - case FLP_LayerChans: - p.channels[data].layerParent = cur_channel; - break; - - // DWORD EVENTS - case FLP_Color: - cc->color = data; - break; - - case FLP_PlayListItem: - { - FL_PlayListItem i; - i.position = ( data & 0xffff ) * - DefaultTicksPerTact; - i.length = DefaultTicksPerTact; - i.pattern = ( data >> 16 ) - 1; - p.playListItems.push_back( i ); - if( i.pattern > p.maxPatterns ) - { - p.maxPatterns = i.pattern; - } - break; - } - - case FLP_FXSine: - qDebug( "fx sine: %d\n", data ); - break; - - case FLP_CutCutBy: - qDebug( "cut cut by: %d\n", data ); - break; - - case FLP_MiddleNote: - cc->baseNote = data+9; - break; - - case FLP_DelayReso: - qDebug( "delay resonance: %d\n", data ); - break; - - case FLP_Reverb: - qDebug( "reverb (sample): %d\n", data ); - break; - - case FLP_IntStretch: - qDebug( "int stretch (sample): %d\n", data ); - break; - - // TEXT EVENTS - case FLP_Text_ChanName: - cc->name = text; - break; - - case FLP_Text_PatName: - p.patternNames[p.currentPattern] = text; - break; - - case FLP_Text_CommentRTF: - { - QByteArray ba( text, text_len ); - QBuffer buf( &ba ); - buf.open( QBuffer::ReadOnly ); - lineno = 0; - attr_clear_all(); - op = html_init(); - hash_init(); - Word * word = word_read( &buf ); - QString out; - word_print( word, out ); - word_free( word ); - op_free( op ); - - p.projectNotes = out; - outstring = ""; - break; - } - - case FLP_Text_Title: - p.projectTitle = text; - break; - - case FLP_Text_SampleFileName: - { - QString f = text; -/* if( f.mid( 1, 11 ) == "Instruments" ) - { - f = "\\Patches\\Packs" + - f.mid( 12 ); - }*/ - f.replace( '\\', QDir::separator() ); - if( QFileInfo( ConfigManager::inst()->flDir() + - "/Data/" ).exists() ) - { - f = ConfigManager::inst()->flDir() + - "/Data/" + f; - } - else - { - // FL 3 compat - f = ConfigManager::inst()->flDir() + - "/Samples/" + f; - } - cc->sampleFileName = f; - break; - } - - case FLP_Text_Version: - { - qDebug( "FLP version: %s\n", text ); - p.versionString = text; - QStringList l = p.versionString.split( '.' ); - p.version = ( l[0].toInt() << 8 ) + - ( l[1].toInt() << 4 ) + - ( l[2].toInt() << 0 ); - if( p.version >= 0x600 ) - { - p.versionSpecificFactor = 100; - } - break; - } - - case FLP_Text_PluginName: - if( mappedPluginTypes. - contains( QString( text ).toLower() ) ) - { - const FL_Plugin::PluginTypes t = static_cast( - mappedPluginTypes[QString( text ).toLower()] ); - if( t > FL_Plugin::EffectPlugin ) - { - qDebug( "recognized new effect %s\n", text ); - p.effects.push_back( FL_Effect( t ) ); - } - else if( cc ) - { - qDebug( "recognized new plugin %s\n", text ); - cc->pluginType = t; - } - last_plugin_type = t; - } - else - { - qDebug( "unsupported plugin: %s!\n", text ); - } - break; - - case FLP_Text_EffectChanName: - ++p.currentEffectChannel; - if( p.currentEffectChannel <= NumFLFxChannels ) - { - p.effectChannels[p.currentEffectChannel].name = text; - } - break; - - case FLP_Text_Delay: - qDebug( "delay data: " ); - // pi[1] seems to be volume or similiar and - // needs to be divided - // by p.versionSpecificFactor - dump_mem( text, text_len ); - break; - - case FLP_Text_TS404Params: - if( cc && cc->pluginType == FL_Plugin::UnknownPlugin && - cc->pluginSettings == NULL ) - { - cc->pluginSettings = new char[text_len]; - memcpy( cc->pluginSettings, text, text_len ); - cc->pluginSettingsLength = text_len; - cc->pluginType = FL_Plugin::TS404; - } - break; - - case FLP_Text_NewPlugin: - if( last_plugin_type > FL_Plugin::EffectPlugin ) - { - FL_Effect * e = &p.effects.last(); - e->fxChannel = puc[0]; - e->fxPos = puc[4]; - qDebug( "new effect: " ); - } - else - { - qDebug( "new plugin: " ); - } - dump_mem( text, text_len ); - break; - - case FLP_Text_PluginParams: - if( cc && cc->pluginSettings == NULL ) - { - cc->pluginSettings = new char[text_len]; - memcpy( cc->pluginSettings, text, - text_len ); - cc->pluginSettingsLength = text_len; - } - qDebug( "plugin params: " ); - dump_mem( text, text_len ); - break; - - case FLP_Text_ChanParams: - cc->arpDir = mappedArpDir[pi[10]]; - cc->arpRange = pi[11]; - cc->selectedArp = pi[12]; - if( cc->selectedArp < 8 ) - { - const int mappedArps[] = { 0, 1, 5, 6, 2, 3, 4 } ; - cc->selectedArp = mappedArps[cc->selectedArp]; - } - cc->arpTime = ( ( pi[13]+1 ) * p.tempo ) / - ( 4*16 ) + 1; - cc->arpGate = ( pi[14] * 100.0f ) / 48.0f; - cc->arpEnabled = pi[10] > 0; - - qDebug( "channel params: " ); - dump_mem( text, text_len ); - break; - - case FLP_Text_EnvLfoParams: - { - const float scaling = 1.0 / 65536.0f; - FL_Channel_Envelope e; - - switch( cc->envelopes.size() ) - { - case 1: - e.target = InstrumentSoundShaping::Volume; - break; - case 2: - e.target = InstrumentSoundShaping::Cut; - break; - case 3: - e.target = InstrumentSoundShaping::Resonance; - break; - default: - e.target = InstrumentSoundShaping::NumTargets; - break; - } - e.predelay = pi[2] * scaling; - e.attack = pi[3] * scaling; - e.hold = pi[4] * scaling; - e.decay = pi[5] * scaling; - e.sustain = 1-pi[6] / 128.0f; - e.release = pi[7] * scaling; - if( e.target == InstrumentSoundShaping::Volume ) - { - e.amount = pi[1] ? 1 : 0; - } - else - { - e.amount = pi[8] / 128.0f; - } -// e.lfoAmount = pi[11] / 128.0f; - cc->envelopes.push_back( e ); - - qDebug( "envelope and lfo params:\n" ); - dump_mem( text, text_len ); - - break; - } - - case FLP_Text_BasicChanParams: - cc->volume = ( pi[1] / p.versionSpecificFactor ) * 100 / 128; - cc->panning = ( pi[0] / p.versionSpecificFactor ) * 200 / 128 - - PanningRight; - if( text_len > 12 ) - { - cc->filterType = mappedFilter[puc[20]]; - cc->filterCut = puc[12] / ( 255.0f * 2.5f ); - cc->filterRes = 0.01f + puc[16] / ( 256.0f * 2 ); - cc->filterEnabled = ( puc[13] == 0 ); - if( puc[20] >= 6 ) - { - cc->filterCut *= 0.5f; - } - } - qDebug( "basic chan params: " ); - dump_mem( text, text_len ); - break; - - case FLP_Text_OldFilterParams: - cc->filterType = mappedFilter[puc[8]]; - cc->filterCut = puc[0] / ( 255.0f * 2.5 ); - cc->filterRes = 0.1f + puc[4] / ( 256.0f * 2 ); - cc->filterEnabled = ( puc[1] == 0 ); - if( puc[8] >= 6 ) - { - cc->filterCut *= 0.5; - } - qDebug( "old filter params: " ); - dump_mem( text, text_len ); - break; - - case FLP_Text_AutomationData: - { - const int bpae = 12; - const int imax = text_len / bpae; - qDebug( "automation data (%d items)\n", imax ); - for( int i = 0; i < imax; ++i ) - { - FL_Automation a; - a.pos = pi[3*i+0] / - ( 4*ppq / DefaultTicksPerTact ); - a.value = pi[3*i+2]; - a.channel = pi[3*i+1] >> 16; - a.control = pi[3*i+1] & 0xffff; - if( a.channel >= 0 && - a.channel < p.numChannels ) - { - qDebug( "add channel %d at %d val %d control:%d\n", - a.channel, a.pos, a.value, a.control ); - p.channels[a.channel].automationData += a; - } -// dump_mem( text+i*bpae, bpae ); - } - break; - } - - case FLP_Text_PatternNotes: - { - //dump_mem( text, text_len ); - const int bpn = 20; - const int imax = ( text_len + bpn - 1 ) / bpn; - for( int i = 0; i < imax; ++i ) - { - int ch = *( puc + i*bpn + 6 ); - int pan = *( puc + i*bpn + 16 ); - int vol = *( puc + i*bpn + 17 ); - int pos = *( (int *)( puc + i*bpn ) ); - int key = *( puc + i*bpn + 12 ); - int len = *( (int*)( puc + i*bpn + - 8 ) ); - pos /= (4*ppq) / DefaultTicksPerTact; - len /= (4*ppq) / DefaultTicksPerTact; - Note n( len, pos, key, vol * 100 / 128, - pan*200 / 128 - 100 ); - if( ch < p.numChannels ) - { - p.channels[ch].notes.push_back( qMakePair( p.currentPattern, n ) ); - } - else - { - qDebug( "invalid " ); - } - qDebug( "note: " ); - dump_mem( text+i*bpn, bpn ); - } - break; - } - - case FLP_Text_ChanGroupName: - qDebug( "channel group name: %s\n", text ); - break; - - // case 216: pi[2] /= p.versionSpecificFactor - // case 229: pi[1] /= p.versionSpecificFactor - - case FLP_Event_EffectParams: - { - enum FLP_EffectParams - { - EffectParamVolume = 0x1fc0 - } ; - - const int bpi = 12; - const int imax = text_len / bpi; - for( int i = 0; i < imax; ++i ) - { - const int param = pi[i*3+1] & 0xffff; - const int ch = ( pi[i*3+1] >> 22 ) - & 0x7f; - if( ch < 0 || ch > NumFLFxChannels ) - { - continue; - } - const int val = pi[i*3+2]; - if( param == EffectParamVolume ) - { - p.effectChannels[ch].volume = ( val / p.versionSpecificFactor ) * 100 / 128; - } - else - { - qDebug( "FX-ch: %d param: %x value:%x\n", ch, param, val ); - } - } - break; - } - - case FLP_Event_PlaylistItems: // playlist items - { - const int bpi = 28; - const int imax = text_len / bpi; - for( int i = 0; i < imax; ++i ) - { - const int pos = pi[i*bpi/sizeof(int)+0] / ( (4*ppq) / DefaultTicksPerTact ); - const int len = pi[i*bpi/sizeof(int)+2] / ( (4*ppq) / DefaultTicksPerTact ); - const int pat = pi[i*bpi/sizeof(int)+3] & 0xfff; - if( pat > 2146 && pat <= 2278 ) // whatever these magic numbers are for... - { - FL_PlayListItem i; - i.position = pos; - i.length = len; - i.pattern = 2278 - pat; - p.playListItems += i; - } - else - { - qDebug( "unknown playlist item: " ); - dump_mem( text+i*bpi, bpi ); - } - } - break; - } - - default: - if( ev >= FLP_Text ) - { - qDebug( "!! unhandled text (ev: %d, len: %d): ", - ev, text_len ); - dump_mem( text, text_len ); - } - else - { - qDebug( "!! handling of FLP-event %d not implemented yet " - "(data=%d).\n", ev, data ); - } - break; - } - } - - - // now create a project from FL_Project data structure - Engine::getSong()->clearProject(); - - // configure the mixer - for( int i=0; icreateChannel(); - } - gui->fxMixerView()->refreshDisplay(); - - // set global parameters - Engine::getSong()->setMasterVolume( p.mainVolume ); - Engine::getSong()->setMasterPitch( p.mainPitch ); - Engine::getSong()->setTempo( p.tempo ); - - // set project notes - gui->getProjectNotes()->setText( p.projectNotes ); - - - progressDialog.setMaximum( p.maxPatterns + p.channels.size() + - p.effects.size() ); - int cur_progress = 0; - - // create BB tracks - QList bb_tracks; - QList i_tracks; - - while( Engine::getBBTrackContainer()->numOfBBs() <= p.maxPatterns ) - { - const int cur_pat = bb_tracks.size(); - BBTrack * bbt = dynamic_cast( - Track::create( Track::BBTrack, Engine::getSong() ) ); - if( p.patternNames.contains( cur_pat ) ) - { - bbt->setName( p.patternNames[cur_pat] ); - } - bb_tracks += bbt; - progressDialog.setValue( ++cur_progress ); - qApp->processEvents(); - } - - // create instrument-track for each channel - for( QList::Iterator it = p.channels.begin(); - it != p.channels.end(); ++it ) - { - InstrumentTrack * t = dynamic_cast( - Track::create( Track::InstrumentTrack, - Engine::getBBTrackContainer() ) ); - Engine::getBBTrackContainer()->updateAfterTrackAdd(); - i_tracks.push_back( t ); - switch( it->pluginType ) - { - case FL_Plugin::Fruity_3x_Osc: - it->instrumentPlugin = - t->loadInstrument( "tripleoscillator" ); - break; - case FL_Plugin::Plucked: - it->instrumentPlugin = - t->loadInstrument( "vibedstrings" ); - break; - case FL_Plugin::FruitKick: - it->instrumentPlugin = - t->loadInstrument( "kicker" ); - break; - case FL_Plugin::TS404: - it->instrumentPlugin = - t->loadInstrument( "lb302" ); - break; - case FL_Plugin::FruitySoundfontPlayer: - it->instrumentPlugin = - t->loadInstrument( "sf2player" ); - break; - case FL_Plugin::Sampler: - case FL_Plugin::UnknownPlugin: - default: - it->instrumentPlugin = - t->loadInstrument( "audiofileprocessor" ); - break; - } - processPluginParams( &( *it ) ); - - t->setName( it->name ); - t->volumeModel()->setValue( it->volume ); - t->panningModel()->setValue( it->panning ); - t->baseNoteModel()->setValue( it->baseNote ); - t->effectChannelModel()->setValue( it->fxChannel ); - - InstrumentSoundShaping * iss = &t->m_soundShaping; - iss->m_filterModel.setValue( it->filterType ); - iss->m_filterCutModel.setValue( it->filterCut * - ( iss->m_filterCutModel.maxValue() - - iss->m_filterCutModel.minValue() ) + - iss->m_filterCutModel.minValue() ); - iss->m_filterResModel.setValue( it->filterRes * - ( iss->m_filterResModel.maxValue() - - iss->m_filterResModel.minValue() ) + - iss->m_filterResModel.minValue() ); - iss->m_filterEnabledModel.setValue( it->filterEnabled ); - - for( QList::iterator jt = it->envelopes.begin(); - jt != it->envelopes.end(); ++jt ) - { - if( jt->target != InstrumentSoundShaping::NumTargets ) - { - EnvelopeAndLfoParameters * elp = - iss->m_envLfoParameters[jt->target]; - - elp->m_predelayModel.setValue( jt->predelay ); - elp->m_attackModel.setValue( jt->attack ); - elp->m_holdModel.setValue( jt->hold ); - elp->m_decayModel.setValue( jt->decay ); - elp->m_sustainModel.setValue( jt->sustain ); - elp->m_releaseModel.setValue( jt->release ); - elp->m_amountModel.setValue( jt->amount ); - elp->updateSampleVars(); - } - } - - InstrumentFunctionArpeggio * arp = &t->m_arpeggio; - arp->m_arpDirectionModel.setValue( it->arpDir ); - arp->m_arpRangeModel.setValue( it->arpRange ); - arp->m_arpModel.setValue( it->selectedArp ); - arp->m_arpTimeModel.setValue( it->arpTime ); - arp->m_arpGateModel.setValue( it->arpGate ); - arp->m_arpEnabledModel.setValue( it->arpEnabled ); - - // process all dots - for( QList::ConstIterator jt = it->dots.begin(); - jt != it->dots.end(); ++jt ) - { - const int pat = *jt / 256; - const int pos = *jt % 256; - Pattern* p = dynamic_cast( t->getTCO( pat ) ); - if( p == NULL ) - { - continue; - } - p->setStep( pos, true ); - } - - // TODO: use future layering feature - if( it->layerParent >= 0 ) - { - it->notes += p.channels[it->layerParent].notes; - } - - // process all notes - for( FL_Channel::noteVector::ConstIterator jt = it->notes.begin(); - jt != it->notes.end(); ++jt ) - { - const int pat = jt->first; - - if( pat > 100 ) - { - continue; - } - Pattern* p = dynamic_cast( t->getTCO( pat ) ); - if( p != NULL ) - { - p->addNote( jt->second, false ); - } - } - - // process automation data - for( QList::ConstIterator jt = - it->automationData.begin(); - jt != it->automationData.end(); ++jt ) - { - AutomatableModel * m = NULL; - float value = jt->value; - bool scale = false; - switch( jt->control ) - { - case FL_Automation::ControlVolume: - m = t->volumeModel(); - value *= ( 100.0f / 128.0f ) / p.versionSpecificFactor; - break; - case FL_Automation::ControlPanning: - m = t->panningModel(); - value = ( value / p.versionSpecificFactor ) *200/128 - PanningRight; - break; - case FL_Automation::ControlPitch: - m = t->pitchModel(); - break; - case FL_Automation::ControlFXChannel: - m = t->effectChannelModel(); - value = value*200/128 - PanningRight; - break; - case FL_Automation::ControlFilterCut: - scale = true; - m = &t->m_soundShaping.m_filterCutModel; - value /= ( 255 * 2.5f ); - break; - case FL_Automation::ControlFilterRes: - scale = true; - m = &t->m_soundShaping.m_filterResModel; - value = 0.1f + value / ( 256.0f * 2 ); - break; - case FL_Automation::ControlFilterType: - m = &t->m_soundShaping.m_filterModel; - value = mappedFilter[jt->value]; - break; - default: - qDebug( "handling automation data of " - "control %d not implemented " - "yet\n", jt->control ); - break; - } - if( m ) - { - if( scale ) - { - value = m->minValue() + value * - ( m->maxValue() - m->minValue() ); - } - AutomationPattern * p = AutomationPattern::globalAutomationPattern( m ); - p->putValue( jt->pos, value, false ); - } - } - - progressDialog.setValue( ++cur_progress ); - qApp->processEvents(); - } - - // process all effects - EffectKeyList effKeys; - for (const Plugin::Descriptor* desc : pluginFactory->descriptors(Plugin::Effect)) - { - if( desc->subPluginFeatures ) - { - desc->subPluginFeatures->listSubPluginKeys( desc, effKeys ); - } - else - { - effKeys << EffectKey( desc, desc->name ); - } - } - - for( int fx_ch = 0; fx_ch <= NumFLFxChannels ; ++fx_ch ) - { - FxChannel * ch = Engine::fxMixer()->effectChannel( fx_ch ); - if( !ch ) - { - continue; - } - FL_EffectChannel * flch = &p.effectChannels[fx_ch]; - if( !flch->name.isEmpty() ) - { - ch->m_name = flch->name; - } - ch->m_volumeModel.setValue( flch->volume / 100.0f ); - ch->m_muteModel.setValue( flch->isMuted ); - } - - for( QList::ConstIterator it = p.effects.begin(); - it != p.effects.end(); ++it ) - { - QString effName; - switch( it->pluginType ) - { - case FL_Plugin::Fruity7BandEq: - effName = "C* Eq2x2"; - break; - case FL_Plugin::FruityBassBoost: - effName = "BassBooster"; - break; - case FL_Plugin::FruityChorus: - effName = "TAP Chorus"; - break; - case FL_Plugin::FruityCompressor: - //effName = "C* Compress"; - effName = "Fast Lookahead limiter"; - break; - case FL_Plugin::FruityDelay: - case FL_Plugin::FruityDelay2: -// effName = "Feedback Delay Line (Maximum Delay 5s)"; - break; - case FL_Plugin::FruityBloodOverdrive: - case FL_Plugin::FruityFastDist: - case FL_Plugin::FruitySoftClipper: - effName = "C* Clip"; - break; - case FL_Plugin::FruityFastLP: - effName = "Low Pass Filter"; - break; - case FL_Plugin::FruityPhaser: - effName = "C* PhaserI"; - break; - case FL_Plugin::FruityReeverb: - effName = "C* Plate2x2"; - break; - case FL_Plugin::FruitySpectroman: - effName = "Spectrum Analyzer"; - break; - default: - break; - } - if( effName.isEmpty() || it->fxChannel < 0 || - it->fxChannel > NumFLFxChannels ) - { - continue; - } - EffectChain * ec = &Engine::fxMixer()-> - effectChannel( it->fxChannel )->m_fxChain; - qDebug( "adding %s to %d\n", effName.toUtf8().constData(), - it->fxChannel ); - for( EffectKeyList::Iterator jt = effKeys.begin(); - jt != effKeys.end(); ++jt ) - { - if( QString( jt->desc->displayName ).contains( effName ) || - ( jt->desc->subPluginFeatures != NULL && - jt->name.contains( effName ) ) ) - { - qDebug( "instantiate %s\n", jt->desc->name ); - ::Effect * e = Effect::instantiate( jt->desc->name, ec, &( *jt ) ); - ec->appendEffect( e ); - ec->setEnabled( true ); - break; - } - } - - progressDialog.setValue( ++cur_progress ); - qApp->processEvents(); - } - - - - // process all playlist-items - for( QList::ConstIterator it = p.playListItems.begin(); - it != p.playListItems.end(); ++it ) - { - if( it->pattern > p.maxPatterns ) - { - continue; - } - TrackContentObject * tco = bb_tracks[it->pattern]->createTCO( MidiTime() ); - tco->movePosition( it->position ); - if( it->length != DefaultTicksPerTact ) - { - tco->changeLength( it->length ); - } - } - - - - // set current pattern - if( p.activeEditPattern < Engine::getBBTrackContainer()->numOfBBs() ) - { - Engine::getBBTrackContainer()->setCurrentBB( - p.activeEditPattern ); - } - - // restore journalling settings - Engine::projectJournal()->setJournalling( is_journ ); - - return true; -} - - - - -void FlpImport::processPluginParams( FL_Channel * _ch ) -{ - qDebug( "plugin params for plugin %d (%d bytes): ", _ch->pluginType, - _ch->pluginSettingsLength ); - dump_mem( _ch->pluginSettings, _ch->pluginSettingsLength ); - switch( _ch->pluginType ) - { - case FL_Plugin::Sampler: // AudioFileProcessor loaded - { - QDomDocument dd; - QDomElement de = dd.createElement( - _ch->instrumentPlugin->nodeName() ); - de.setAttribute( "reversed", _ch->sampleReversed ); - de.setAttribute( "amp", _ch->sampleAmp ); - de.setAttribute( "looped", _ch->sampleUseLoopPoints ); - de.setAttribute( "sframe", 0 ); - de.setAttribute( "eframe", 1 ); - de.setAttribute( "src", _ch->sampleFileName ); - _ch->instrumentPlugin->restoreState( de ); - break; - } - - case FL_Plugin::TS404: // LB302 loaded - break; - - case FL_Plugin::Fruity_3x_Osc: // TripleOscillator loaded - { - const Oscillator::WaveShapes mapped_3xOsc_Shapes[] = - { - Oscillator::SineWave, - Oscillator::TriangleWave, - Oscillator::SquareWave, - Oscillator::SawWave, - Oscillator::SquareWave, // square-sin - Oscillator::WhiteNoise, - Oscillator::UserDefinedWave - } ; - - QDomDocument dd; - QDomElement de = dd.createElement( - _ch->instrumentPlugin->nodeName() ); - de.setAttribute( "modalgo1", Oscillator::SignalMix ); - de.setAttribute( "modalgo2", Oscillator::SignalMix ); - int ws = Oscillator::UserDefinedWave; - for( int i = 0; i < 3; ++i ) - { - const int32_t * d = (const int32_t *) - ( _ch->pluginSettings + i * 28 ); - QString is = QString::number( i ); - de.setAttribute( "vol" + is, - QString::number( d[0] * 100 / - ( 3 * 128 ) ) ); - de.setAttribute( "pan" + is, - QString::number( d[1] ) ); - de.setAttribute( "coarse" + is, - QString::number( d[3] ) ); - de.setAttribute( "finel" + is, - QString::number( d[4] - d[6] / 2 ) ); - de.setAttribute( "finer" + is, - QString::number( d[4] + d[6] / 2 ) ); - de.setAttribute( "stphdetun" + is, - QString::number( d[5] ) ); - const int s = mapped_3xOsc_Shapes[d[2]]; - de.setAttribute( "wavetype" + is, - QString::number( s ) ); - if( s != Oscillator::UserDefinedWave ) - { - ws = s; - } - } - if( ws == Oscillator::UserDefinedWave ) - { - de.setAttribute( "wavetype0", - Oscillator::SawWave ); - } - de.setAttribute( "vol0", QString::number( 100/2 ) ); - // now apply the prepared plugin-state - _ch->instrumentPlugin->restoreState( de ); - break; - } - - case FL_Plugin::Layer: - // nothing to do - break; - - case FL_Plugin::Plucked: // Vibed loaded - // TODO: setup vibed-instrument - break; - - case FL_Plugin::UnknownPlugin: - default: - qDebug( "handling of plugin params not implemented " - "for current plugin\n" ); - break; - } -} - - - - -extern "C" -{ - -// necessary for getting instance out of shared lib -Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) -{ - return new FlpImport( QString::fromUtf8( - static_cast( _data ) ) ); -} - -} - diff --git a/plugins/flp_import/FlpImport.h b/plugins/flp_import/FlpImport.h deleted file mode 100644 index 18ba3e251..000000000 --- a/plugins/flp_import/FlpImport.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * FlpImport.h - support for importing FLP-files - * - * Copyright (c) 2006-2014 Tobias Doerffel - * - * This file is part of LMMS - http://lmms.io - * - * 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 (see COPYING); if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - */ - -#ifndef _FLP_IMPORT_H -#define _FLP_IMPORT_H - -#include -#include -#include - -#include "ImportFilter.h" -#include "Note.h" - - - -class instrument; -struct FL_Channel; - -class FlpImport : public ImportFilter -{ -public: - FlpImport( const QString & _file ); - virtual ~FlpImport(); - - virtual PluginView * instantiateView( QWidget * ) - { - return NULL; - } - - -private: - virtual bool tryImport( TrackContainer* tc ); - - void processPluginParams( FL_Channel * _ch ); - - inline int readInt( int _bytes ) - { - int c, value = 0; - do - { - c = readByte(); - if( c == -1 ) - { - return( -1 ); - } - value = ( value << 8 ) | c; - } while( --_bytes ); - return( value ); - } - - inline int32_t read32LE() - { - int value = readByte(); - value |= readByte() << 8; - value |= readByte() << 16; - value |= readByte() << 24; - return( value ); - } - inline int32_t read16LE() - { - int value = readByte(); - value |= readByte() << 8; - return( value ); - } - - inline int32_t readID() - { - return( read32LE() ); - } - - inline void skip( int _bytes ) - { - while( _bytes > 0 ) - { - readByte(); - --_bytes; - } - } - -} ; - - -#endif diff --git a/plugins/flp_import/unrtf.cpp b/plugins/flp_import/unrtf.cpp deleted file mode 100644 index 1c7a63341..000000000 --- a/plugins/flp_import/unrtf.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * unrtf.cpp - integration of UnRTF - * - * Copyright (c) 2008 Tobias Doerffel - * - * This file is part of LMMS - http://lmms.io - * - * 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 (see COPYING); if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - */ - - -#include "lmmsconfig.h" - -#include -#include - -#include - -extern "C" -{ - -// unrtf-stuff -#include "defs.h" -#include "main.h" -#include "html.h" -#include "word.h" -#include "hash.h" -#include "convert.h" -#include "attr.h" - - -int lineno = 0; -#define inline_mode 0 -#define debug_mode 0 -#define nopict_mode 1 -#define verbose_mode 0 -#define simple_mode 0 -#define no_remap_mode 0 - -QString outstring; -short numchar_table; -OutputPersonality * op = NULL; - - -// include unrtf-source -#include "attr.c" -#include "convert.c" -#include "error.c" -#include "hash.c" -#include "html.c" -#include "ur_malloc.c" -#include "output.c" -#include "parse.c" -#include "util.c" -#include "word.c" - -} diff --git a/plugins/flp_import/unrtf/attr.c b/plugins/flp_import/unrtf/attr.c deleted file mode 100644 index b127b429d..000000000 --- a/plugins/flp_import/unrtf/attr.c +++ /dev/null @@ -1,677 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: attr - * Author name: Zachary 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 - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions - * 16 Dec 07, daved@physiol.usyd.edu.au: fixed fore/background_begin error - * and updated to GPL v3 - *--------------------------------------------------------------------*/ - -#ifdef LMMS_HAVE_CONFIG_H -#include -#endif - -#ifdef LMMS_HAVE_STDIO_H -#include -#endif - -#ifdef LMMS_HAVE_STRING_H -#include -#endif - -#ifdef LMMS_HAVE_STDLIB_H -#include -#endif - -#include "ur_malloc.h" -#include "defs.h" -#include "error.h" -#include "attr.h" -#include "main.h" - -extern void starting_body(); -extern void starting_text(); - -extern QString outstring; - -extern int simulate_allcaps; -extern int simulate_smallcaps; - - -#define MAX_ATTRS (10000) - - -/* 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; - - -void attr_clear_all() -{ - stack_of_stacks = NULL; - 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, const char* param) { - switch(attr) - { - case ATTR_BOLD: - outstring+=QString().sprintf("%s", op->bold_begin); - break; - case ATTR_ITALIC: - outstring+=QString().sprintf("%s", 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: - outstring+=QString().sprintf("%s", op->underline_begin); - break; - - case ATTR_DOUBLE_UL: - outstring+=QString().sprintf("%s", op->dbl_underline_begin); - break; - - case ATTR_FONTSIZE: - op_begin_std_fontsize (op, atoi (param)); - break; - - case ATTR_FONTFACE: - outstring+=QString().sprintf(op->font_begin,param); - break; - - case ATTR_FOREGROUND: - outstring+=QString().sprintf(op->foreground_begin, param); - break; - - case ATTR_BACKGROUND: - if (!simple_mode) - outstring+=QString().sprintf(op->background_begin,param); - break; - - case ATTR_SUPER: - outstring+=QString().sprintf("%s", op->superscript_begin); - break; - case ATTR_SUB: - outstring+=QString().sprintf("%s", op->subscript_begin); - break; - - case ATTR_STRIKE: - outstring+=QString().sprintf("%s", op->strikethru_begin); - break; - - case ATTR_DBL_STRIKE: - outstring+=QString().sprintf("%s", op->dbl_strikethru_begin); - break; - - case ATTR_EXPAND: - outstring+=QString().sprintf(op->expand_begin, param); - break; - - case ATTR_OUTLINE: - outstring+=QString().sprintf("%s", op->outline_begin); - break; - case ATTR_SHADOW: - outstring+=QString().sprintf("%s", op->shadow_begin); - break; - case ATTR_EMBOSS: - outstring+=QString().sprintf("%s", op->emboss_begin); - break; - case ATTR_ENGRAVE: - outstring+=QString().sprintf("%s", 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) - outstring+=QString().sprintf("%s", 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: - outstring+=QString().sprintf("%s", op->bold_end); - break; - case ATTR_ITALIC: - outstring+=QString().sprintf("%s", 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: - outstring+=QString().sprintf("%s", op->underline_end); - break; - - case ATTR_DOUBLE_UL: - outstring+=QString().sprintf("%s", op->dbl_underline_end); - break; - - case ATTR_FONTSIZE: - op_end_std_fontsize (op, atoi (param)); - break; - - case ATTR_FONTFACE: - outstring+=QString().sprintf("%s", op->font_end); - break; - - case ATTR_FOREGROUND: - outstring+=QString().sprintf("%s", op->foreground_end); - break; - case ATTR_BACKGROUND: - if (!simple_mode) - outstring+=QString().sprintf("%s", op->background_end); - break; - - case ATTR_SUPER: - outstring+=QString().sprintf("%s", op->superscript_end); - break; - case ATTR_SUB: - outstring+=QString().sprintf("%s", op->subscript_end); - break; - - case ATTR_STRIKE: - outstring+=QString().sprintf("%s", op->strikethru_end); - break; - - case ATTR_DBL_STRIKE: - outstring+=QString().sprintf("%s", op->dbl_strikethru_end); - break; - - case ATTR_OUTLINE: - outstring+=QString().sprintf("%s", op->outline_end); - break; - case ATTR_SHADOW: - outstring+=QString().sprintf("%s", op->shadow_end); - break; - case ATTR_EMBOSS: - outstring+=QString().sprintf("%s", op->emboss_end); - break; - case ATTR_ENGRAVE: - outstring+=QString().sprintf("%s", op->engrave_end); - break; - - case ATTR_EXPAND: - outstring+=QString().sprintf("%s", 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) - outstring+=QString().sprintf("%s", 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, const 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); -} - -#if 1 /* daved 0.20.2 */ - -/*======================================================================== - * Name: attr_get_param - * Purpose: Reads an attribute from the current attribute stack. - * Args: Attribute number - * Returns: string. - *=======================================================================*/ - -char * -attr_get_param(int attr) -{ - int i; - AttrStack *stack = stack_of_stacks_top; - if (!stack) { - warning_handler("No stack to get attribute from"); - return NULL; - } - - i=stack->tos; - while (i>=0) - { - if(stack->attr_stack [i] == attr) - { - if(stack->attr_stack_params [i] != NULL) - return stack->attr_stack_params [i]; - else - return NULL; - } - i--; - } - return NULL; -} - -#endif - - -/*======================================================================== - * 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)); - memset ((void*) new_stack, 0, 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 ((char*) 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--; - } -} - diff --git a/plugins/flp_import/unrtf/attr.h b/plugins/flp_import/unrtf/attr.h deleted file mode 100644 index 5ab23ef70..000000000 --- a/plugins/flp_import/unrtf/attr.h +++ /dev/null @@ -1,104 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: attr - * Author name: Zachary 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 - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - -#ifndef _ATTR -#define _ATTR - - -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_clear_all(); - -extern void attr_push_core (int attr, char* param); - -extern void attr_pop_core (int attr); - -extern void attr_push(int attr, const 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(); - -#if 1 /* daved 0.20.2 */ - -char * attr_get_param(int attr); - -#endif - - - - -#endif diff --git a/plugins/flp_import/unrtf/convert.c b/plugins/flp_import/unrtf/convert.c deleted file mode 100644 index e56598a60..000000000 --- a/plugins/flp_import/unrtf/convert.c +++ /dev/null @@ -1,3684 +0,0 @@ - -/*=========================================================================== - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -===========================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: convert - * Author name: Zachary 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 UnRTF - * 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 - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 29 Mar 05, daved@physiol.usyd.edu.au: more unicode support - * 31 Mar 05, daved@physiol.usyd.edu.au: strcat security bug fixed - * 06 Jan 06, marcossamaral@terra.com.br: patch from debian 0.19.3-1.1 - * 03 Mar 06, daved@physiol.usyd.edu.au: fixed creation date spelling - and added support for accented characters in titles from - Laurent Monin - * 09 Mar 06, daved@physiol.usyd.edu.au: don't print null post_trans - * 18 Jun 06, daved@physiol.usyd.edu.au: fixed some incorrect comment_end - * 18 Jun 06, frolovs@internet2.ru: codepage support - * 31 Oct 07, jasp00@users.sourceforge.net: fixed several warnings - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - * 17 Dec 07, daved@physiol.usyd.edu.au: Italian month name spelling corrections - # from David Santinoli - *--------------------------------------------------------------------*/ - -#ifdef LMMS_HAVE_CONFIG_H -#include -#endif - -#ifdef LMMS_HAVE_STDIO_H -#include -#endif - -#ifdef LMMS_HAVE_STDLIB_H -#include -#endif - -#ifdef LMMS_HAVE_CTYPE_H -#include -#endif - -#ifdef LMMS_HAVE_STRING_H -#include -#endif - -#include "defs.h" -#include "parse.h" -#include "util.h" -#include "ur_malloc.h" -#include "main.h" -#include "error.h" -#include "word.h" -#include "hash.h" -#include "convert.h" -#include "attr.h" - - -static CodepageInfo codepages[14] = -{ -/*-- cp850 --*/ -{ - 850, - { - /* 0x80 */ - 0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7, - 0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5, - /* 0x90 */ - 0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9, - 0x00ff, 0x00d6, 0x00dc, 0x00f8, 0x00a3, 0x00d8, 0x00d7, 0x0192, - /* 0xa0 */ - 0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba, - 0x00bf, 0x00ae, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb, - /* 0xb0 */ - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00c1, 0x00c2, 0x00c0, - 0x00a9, 0x2563, 0x2551, 0x2557, 0x255d, 0x00a2, 0x00a5, 0x2510, - /* 0xc0 */ - 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x00e3, 0x00c3, - 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x00a4, - /* 0xd0 */ - 0x00f0, 0x00d0, 0x00ca, 0x00cb, 0x00c8, 0x0131, 0x00cd, 0x00ce, - 0x00cf, 0x2518, 0x250c, 0x2588, 0x2584, 0x00a6, 0x00cc, 0x2580, - /* 0xe0 */ - 0x00d3, 0x00df, 0x00d4, 0x00d2, 0x00f5, 0x00d5, 0x00b5, 0x00fe, - 0x00de, 0x00da, 0x00db, 0x00d9, 0x00fd, 0x00dd, 0x00af, 0x00b4, - /* 0xf0 */ - 0x00ad, 0x00b1, 0x2017, 0x00be, 0x00b6, 0x00a7, 0x00f7, 0x00b8, - 0x00b0, 0x00a8, 0x00b7, 0x00b9, 0x00b3, 0x00b2, 0x25a0, 0x00a0, - } -}, -/*-- cp866 --*/ -{ - 866, - { - /* 0x80 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0x90 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xa0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xb0 */ - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, - 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, - /* 0xc0 */ - 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, - 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, - /* 0xd0 */ - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, - 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, - /* 0xe0 */ - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, - /* 0xf0 */ - 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040e, 0x045e, - 0x00b0, 0x2219, 0x00b7, 0x221a, 0x2116, 0x00a4, 0x25a0, 0x00a0, - } -}, -/*-- cp874 --*/ -{ - 874, - { - /* 0x80 */ - 0x20ac, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2026, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x90 */ - 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xa0 */ - 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, - 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, - /* 0xb0 */ - 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, - 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, - /* 0xc0 */ - 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, - 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, - /* 0xd0 */ - 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, - 0x0e38, 0x0e39, 0x0e3a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e3f, - /* 0xe0 */ - 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, - 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, - /* 0xf0 */ - 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, - 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - } -}, -/*-- cp1133 --*/ -{ - 1133, - { - /* 0x80 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0x90 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xa0 */ - 0x00a0, 0x0e81, 0x0e82, 0x0e84, 0x0e87, 0x0e88, 0x0eaa, 0x0e8a, - 0x0e8d, 0x0e94, 0x0e95, 0x0e96, 0x0e97, 0x0e99, 0x0e9a, 0x0e9b, - /* 0xb0 */ - 0x0e9c, 0x0e9d, 0x0e9e, 0x0e9f, 0x0ea1, 0x0ea2, 0x0ea3, 0x0ea5, - 0x0ea7, 0x0eab, 0x0ead, 0x0eae, 0xfffd, 0xfffd, 0xfffd, 0x0eaf, - /* 0xc0 */ - 0x0eb0, 0x0eb2, 0x0eb3, 0x0eb4, 0x0eb5, 0x0eb6, 0x0eb7, 0x0eb8, - 0x0eb9, 0x0ebc, 0x0eb1, 0x0ebb, 0x0ebd, 0xfffd, 0xfffd, 0xfffd, - /* 0xd0 */ - 0x0ec0, 0x0ec1, 0x0ec2, 0x0ec3, 0x0ec4, 0x0ec8, 0x0ec9, 0x0eca, - 0x0ecb, 0x0ecc, 0x0ecd, 0x0ec6, 0xfffd, 0x0edc, 0x0edd, 0x20ad, - /* 0xe0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xf0 */ - 0x0ed0, 0x0ed1, 0x0ed2, 0x0ed3, 0x0ed4, 0x0ed5, 0x0ed6, 0x0ed7, - 0x0ed8, 0x0ed9, 0xfffd, 0xfffd, 0x00a2, 0x00ac, 0x00a6, 0xfffd, - } -}, -/*-- cp1250 --*/ -{ - 1250, - { - /* 0x80 */ - 0x20ac, 0xfffd, 0x201a, 0xfffd, 0x201e, 0x2026, 0x2020, 0x2021, - 0xfffd, 0x2030, 0x0160, 0x2039, 0x015a, 0x0164, 0x017d, 0x0179, - /* 0x90 */ - 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0xfffd, 0x2122, 0x0161, 0x203a, 0x015b, 0x0165, 0x017e, 0x017a, - /* 0xa0 */ - 0x00a0, 0x02c7, 0x02d8, 0x0141, 0x00a4, 0x0104, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x015e, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x017b, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x02db, 0x0142, 0x00b4, 0x00b5, 0x00b6, 0x00b7, - 0x00b8, 0x0105, 0x015f, 0x00bb, 0x013d, 0x02dd, 0x013e, 0x017c, - /* 0xc0 */ - 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, - 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, - /* 0xd0 */ - 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, - 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, - /* 0xe0 */ - 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, - 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, - /* 0xf0 */ - 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, - 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, - } -}, -/*-- cp1251 --*/ -{ - 1251, - { - /* 0x80 */ - 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, - 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f, - /* 0x90 */ - 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0xfffd, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, - /* 0xa0 */ - 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, - 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, - 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, - /* 0xc0 */ - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, - /* 0xd0 */ - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, - /* 0xe0 */ - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, - /* 0xf0 */ - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, - } -}, -/*-- cp1252 --*/ -{ - 1252, - { - /* 0x80 */ - 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, - 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0xfffd, 0x017d, 0xfffd, - /* 0x90 */ -#if 1 -/* daved - don't process 93 & 94 as we want entities */ - 0xfffd, 0x2018, 0x2019, 0, 0, 0x2022, 0x2013, 0x2014, -#else - 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, -#endif - 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0xfffd, 0x017e, 0x0178, -#if 1 - /* 0xa0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xb0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xc0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xd0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xe0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xf0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -#else /* daved experimenting */ - /* 0xa0 */ - 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, - /* 0xb0 */ - 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, - /* 0xc0 */ - 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, - /* 0xd0 */ - 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, - /* 0xe0 */ - 224, 225, 226, 227, 228, 229, 230, 231, - 232, 233, 234, 235, 236, 237, 238, 239, - /* 0xf0 */ - 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, -#endif - } -}, -/*-- cp1253 --*/ -{ - 1253, - { - /* 0x80 */ - 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, - 0xfffd, 0x2030, 0xfffd, 0x2039, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x90 */ - 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0xfffd, 0x2122, 0xfffd, 0x203a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xa0 */ - 0x00a0, 0x0385, 0x0386, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0xfffd, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x2015, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x00b5, 0x00b6, 0x00b7, - 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f, - /* 0xc0 */ - 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, - /* 0xd0 */ - 0x03a0, 0x03a1, 0xfffd, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, - 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, - /* 0xe0 */ - 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, - 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, - /* 0xf0 */ - 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, - 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0xfffd, - } -}, -/*-- 1254 --*/ -{ - 1254, - { - /* 0x80 */ - 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, - 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0xfffd, 0xfffd, 0xfffd, - /* 0x90 */ - 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0xfffd, 0xfffd, 0x0178, - /* 0xa0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xb0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xc0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xd0 */ - 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, - 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, - /* 0xe0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xf0 */ - 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, - 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, - } -}, -/*-- cp1255 --*/ -{ - 1255, - { - /* 0x80 */ - 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, - 0x02c6, 0x2030, 0xfffd, 0x2039, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x90 */ - 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0x02dc, 0x2122, 0xfffd, 0x203a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xa0 */ - 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20aa, 0x00a5, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, - 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, - /* 0xc0 */ - 0x05b0, 0x05b1, 0x05b2, 0x05b3, 0x05b4, 0x05b5, 0x05b6, 0x05b7, - 0x05b8, 0x05b9, 0xfffd, 0x05bb, 0x05bc, 0x05bd, 0x05be, 0x05bf, - /* 0xd0 */ - 0x05c0, 0x05c1, 0x05c2, 0x05c3, 0x05f0, 0x05f1, 0x05f2, 0x05f3, - 0x05f4, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xe0 */ - 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, - 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, - /* 0xf0 */ - 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, - 0x05e8, 0x05e9, 0x05ea, 0xfffd, 0xfffd, 0x200e, 0x200f, 0xfffd, - } -}, -/*-- cp1256 --*/ -{ - 1256, - { - /* 0x80 */ - 0x20ac, 0x067e, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, - 0x02c6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, - /* 0x90 */ - 0x06af, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0x06a9, 0x2122, 0x0691, 0x203a, 0x0153, 0x200c, 0x200d, 0x06ba, - /* 0xa0 */ - 0x00a0, 0x060c, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x06be, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, - 0x00b8, 0x00b9, 0x061b, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x061f, - /* 0xc0 */ - 0x06c1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, - 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, - /* 0xd0 */ - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00d7, - 0x0637, 0x0638, 0x0639, 0x063a, 0x0640, 0x0641, 0x0642, 0x0643, - /* 0xe0 */ - 0x00e0, 0x0644, 0x00e2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x0649, 0x064a, 0x00ee, 0x00ef, - /* 0xf0 */ - 0x064b, 0x064c, 0x064d, 0x064e, 0x00f4, 0x064f, 0x0650, 0x00f7, - 0x0651, 0x00f9, 0x0652, 0x00fb, 0x00fc, 0x200e, 0x200f, 0x06d2, - } -}, -{ - 1257, - { - /* 0x80 */ - 0x20ac, 0xfffd, 0x201a, 0xfffd, 0x201e, 0x2026, 0x2020, 0x2021, - 0xfffd, 0x2030, 0xfffd, 0x2039, 0xfffd, 0x00a8, 0x02c7, 0x00b8, - /* 0x90 */ - 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0xfffd, 0x2122, 0xfffd, 0x203a, 0xfffd, 0x00af, 0x02db, 0xfffd, - /* 0xa0 */ - 0x00a0, 0xfffd, 0x00a2, 0x00a3, 0x00a4, 0xfffd, 0x00a6, 0x00a7, - 0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, - 0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6, - /* 0xc0 */ - 0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112, - 0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b, - /* 0xd0 */ - 0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7, - 0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df, - /* 0xe0 */ - 0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113, - 0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c, - /* 0xf0 */ - 0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7, - 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x02d9, - } -}, -{ - 1258, - { - /* 0x80 */ - 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, - 0x02c6, 0x2030, 0xfffd, 0x2039, 0x0152, 0xfffd, 0xfffd, 0xfffd, - /* 0x90 */ - 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0x02dc, 0x2122, 0xfffd, 0x203a, 0x0153, 0xfffd, 0xfffd, 0x0178, - /* 0xa0 */ - 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, - 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, - /* 0xc0 */ - 0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x00c5, 0x00c6, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x0300, 0x00cd, 0x00ce, 0x00cf, - /* 0xd0 */ - 0x0110, 0x00d1, 0x0309, 0x00d3, 0x00d4, 0x01a0, 0x00d6, 0x00d7, - 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x01af, 0x0303, 0x00df, - /* 0xe0 */ - 0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x00e5, 0x00e6, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x0301, 0x00ed, 0x00ee, 0x00ef, - /* 0xf0 */ - 0x0111, 0x00f1, 0x0323, 0x00f3, 0x00f4, 0x01a1, 0x00f6, 0x00f7, - 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x01b0, 0x20ab, 0x00ff, - } -}, -/*-- null --*/ -{ - 0, - { - /* 0x80 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0x90 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xa0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xb0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xc0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xd0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xe0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* 0xf0 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - } -}, -}; - - -//extern int nopict_mode; - -/* -#define BINARY_ATTRS -*/ - -extern QString outstring; - - -static int charset_type=CHARSET_ANSI; -static CodepageInfo * charset_codepage; - - -/* 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 const 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(); -#if 1 /* daved - 0.19.6 */ -void print_with_special_exprs (char *s); -#endif - - -#if 0 /* daved - 0.19.0 removed in 0.19.5 */ -char *entity(int symbol); -#endif - - - - -/*======================================================================== - * 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) { - outstring+=QString().sprintf("%s", op->header_end); - outstring+=QString().sprintf("%s", op->body_begin); - } - within_header = false; - have_printed_body = true; - } -} - - -/*-------------------------------------------------------------------*/ -/*-------------------------------------------------------------------*/ -/*-------------------------------------------------------------------*/ - - -static const 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 - "Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno", - "Luglio","Agosto","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) { - outstring+=QString().sprintf("%d %s %d ", day, month_strings[month-1], year); - } - if (hour && minute) { - outstring+=QString().sprintf("%02d:%02d ", hour, minute); - } -} - - - -/*-------------------------------------------------------------------*/ - -typedef struct { - int num; - char *name; -} FontEntry; - -#define MAX_FONTS (8192) -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] != '\\') { - if (strlen(tmp) + strlen(name) > BUFSIZ - 1) { - outstring+=QString().sprintf("Invalid font table entry\n"); - name[0] = 0; - } - else - strncat(name,tmp,sizeof(name) - strlen(name) - 1); - } - 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; - } - - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("font table contains %d fonts total",total_fonts); - outstring+=QString().sprintf("%s",op->comment_end); - - if (debug_mode) { - int i; - - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("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) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("index entry word: %s ", str); - outstring+=QString().sprintf("%s",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) { - outstring+=QString().sprintf("%s",op->comment_begin); - printf("toc %s entry word: %s ", - include_page_num ? "page#":"no page#", - str); - outstring+=QString().sprintf("%s",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) outstring+=QString().sprintf("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)) { - outstring+=QString().sprintf("%s", op->document_title_begin); - w2=child->next; - while (w2) { - char *s2 = word_string(w2); - if (s2[0] != '\\') -#if 1 /* daved 0.20.0 */ - { -#endif -#if 1 /* daved 0.19.6 */ - print_with_special_exprs (s2); -#else - outstring+=QString().sprintf("%s", s2); -#endif -#if 1 /* daved 0.20.0 */ - } - else - { - if (s2[1] == '\'') - { - int ch = h2toi (&s2[2]); - - const char *s3; - s3 = op_translate_char (op, charset_type, charset_codepage, ch, numchar_table); - if (!s3 || !*s3) - { - outstring+=QString().sprintf("%s", op->comment_begin); - outstring+=QString().sprintf("char 0x%02x",ch); - outstring+=QString().sprintf("%s", op->comment_end); - - } - else - { - if (op->word_begin) - outstring+=QString().sprintf("%s", op->word_begin); - outstring+=QString().sprintf("%s", s3); - if (op->word_end) - outstring+=QString().sprintf("%s", op->word_end); - } - } - } - -#endif - w2 = w2->next; - } - outstring+=QString().sprintf("%s", op->document_title_end); - } - else if (!strcmp("\\keywords", s)) { - outstring+=QString().sprintf("%s", op->document_keywords_begin); - w2=child->next; - while (w2) { - char *s2 = word_string(w2); - if (s2[0] != '\\') - outstring+=QString().sprintf("%s,", s2); - w2 = w2->next; - } - outstring+=QString().sprintf("%s", op->document_keywords_end); - } - else if (!strcmp("\\author", s)) { - outstring+=QString().sprintf("%s", op->document_author_begin); - w2=child->next; - while (w2) { - char *s2 = word_string(w2); - if (s2[0] != '\\') - outstring+=QString().sprintf("%s", s2); - w2 = w2->next; - } - outstring+=QString().sprintf("%s", op->document_author_end); - } - else if (!strcmp("\\comment", s)) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("comments: "); - w2=child->next; - while (w2) { - char *s2 = word_string(w2); - if (s2[0] != '\\') - outstring+=QString().sprintf("%s", s2); - w2 = w2->next; - } - outstring+=QString().sprintf("%s",op->comment_end); - } - else if (!strncmp("\\nofpages", s, 9)) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("total pages: %s",&s[9]); - outstring+=QString().sprintf("%s",op->comment_end); - } - else if (!strncmp("\\nofwords", s, 9)) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("total words: %s",&s[9]); - outstring+=QString().sprintf("%s",op->comment_end); - } - else if (!strncmp("\\nofchars", s, 9) && isdigit(s[9])) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("total chars: %s",&s[9]); - outstring+=QString().sprintf("%s",op->comment_end); - } - else if (!strcmp("\\creatim", s)) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("creation date: "); - if (child->next) word_dump_date (child->next); - outstring+=QString().sprintf("%s",op->comment_end); - } - else if (!strcmp("\\printim", s)) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("last printed: "); - if (child->next) word_dump_date (child->next); - outstring+=QString().sprintf("%s",op->comment_end); - } - else if (!strcmp("\\buptim", s)) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("last backup: "); - if (child->next) word_dump_date (child->next); - outstring+=QString().sprintf("%s",op->comment_end); - } - else if (!strcmp("\\revtim", s)) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("revision date: "); - if (child->next) word_dump_date (child->next); - outstring+=QString().sprintf("%s",op->comment_end); - } - } - - /* Irregardless of whether we're in inline mode, - * we want to process the following. - */ - if (!strcmp("\\hlinkbase", s)) { - char *linkstr = NULL; - - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("hyperlink base: "); - if (child->next) { - Word *nextword = child->next; - - if (nextword) - linkstr=word_string (nextword); - } - - if (linkstr) - outstring+=QString().sprintf("%s", linkstr); - else - outstring+=QString().sprintf("(none)"); - outstring+=QString().sprintf("%s",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 (1024) -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 - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("found this color table word: %s", word_string(w)); - outstring+=QString().sprintf("%s",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) { - outstring+=QString().sprintf("%s",op->comment_begin); - printf("storing color entry %d: %02x%02x%02x", - total_colors-1, r,g,b); - outstring+=QString().sprintf("%s",op->comment_end); - } - r=g=b=0; - } - - w=w->next; - } - - if (debug_mode) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("color table had %d entries -->\n", total_colors); - outstring+=QString().sprintf("%s",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, int 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, int 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, int 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, int 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; -#if 1 /* daved - 0.19.2 */ - char *s; - char *s4; - Word *w4; -#endif - w3=w2->next; -#if 1 /* daved - 0.19.0 */ - 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) - { - int char_num; - char_num = atoi(s4); - if - ( - op->symbol_first_char <= char_num - && - op->symbol_last_char >= char_num - ) - { - const char * string; - if ((string = op->symbol_translation_table[char_num - op->symbol_first_char]) != 0) - outstring+=QString().sprintf("%s", string); - } - } - } -#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); - outstring+=QString().sprintf("%s", op->hyperlink_begin); - outstring+=QString().sprintf("%s", s4); - outstring+=QString().sprintf("%s", 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, int num) { - char *name; - - /* no param exit early XX */ - if (!has_param) - return false; - - name = lookup_fontname(num); -#if 1 /* daved - 0.19.6 */ - /* if a character is requested by number, we will need to know - which translation table to use - roman or symbol */ - numchar_table = FONTROMAN_TABLE; -#endif - if (!name) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("invalid font number %d",num); - outstring+=QString().sprintf("%s",op->comment_end); - } else { - attr_push(ATTR_FONTFACE,name); -#if 1 /* daved - 0.19.6 */ - if (strstr(name,"Symbol") != NULL) - numchar_table=FONTSYMBOL_TABLE; -#endif -#if 1 /* daved - 0.20.3 */ - else if (strstr(name,"Greek") != NULL) - numchar_table=FONTGREEK_TABLE; -#endif - if(0) - outstring+=QString().sprintf("", numchar_table); - } - - 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, int 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, int 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) { - outstring+=QString().sprintf("%s", op->forced_space); - need--; - } - outstring+=QString().sprintf("\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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int param) { - if (op->chars.bullet) { - outstring+=QString().sprintf("%s", 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, int param) { - if (op->chars.left_dbl_quote) { - outstring+=QString().sprintf("%s", 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, int param) { - if (op->chars.right_dbl_quote) { - outstring+=QString().sprintf("%s", 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, int param) { - if (op->chars.left_quote) { - outstring+=QString().sprintf("%s", 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, int param) { - if (op->chars.nonbreaking_space) { - outstring+=QString().sprintf("%s", 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, int param) { - if (op->chars.nonbreaking_hyphen) { - outstring+=QString().sprintf("%s", 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, int param) { - if (op->chars.optional_hyphen) { - outstring+=QString().sprintf("%s", 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, int param) { - if (op->chars.emdash) { - outstring+=QString().sprintf("%s", 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, int param) { - if (op->chars.endash) { - outstring+=QString().sprintf("%s", 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, int param) { - if (op->chars.right_quote) { - outstring+=QString().sprintf("%s", 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, int param) { - if (op->line_break) { - outstring+=QString().sprintf("%s", 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, int param) { - if (op->line_break) { - outstring+=QString().sprintf("%s", 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, int param) { - if (op->page_break) { - outstring+=QString().sprintf("%s", 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, int 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, int 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) - { - 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int param) { - attr_push(ATTR_THICK_UL,NULL); - return false; -} - - -/*======================================================================== - * Name: cmd_ulthd - * Purpose: Executes the \ulthd 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_ulthd (Word *w, int align, char has_param, int param) { - attr_push(ATTR_THICK_UL, NULL); - return false; -} - - -/*======================================================================== - * Name: cmd_ulthdash - * Purpose: Executes the \ulthdash 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_ulthdash (Word *w, int align, char has_param, int 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, int 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, int 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, int 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, int 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, int 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, int param) { - if (has_param && param==0) - attr_pop(ATTR_SUPER); - else - attr_push(ATTR_SUPER,NULL); - return false; -} - -#if 1 /* daved - 0.19.4 */ -/*======================================================================== - * Name: cmd_u - * Purpose: Processes a Unicode character - * Args: Word, paragraph align info, and numeric param if any. - * Returns: Flag, always false - *=======================================================================*/ - -static int cmd_u (Word *w, int align, char has_param, int param) { - short done=0; -/*#if DEBUG - char *str; - if (has_param == true) - { - fprintf(stderr,"param is %d (x%x) (0%o)\n", param, - param, param); - } - if (w->hash_index) - { - str=hash_get_string (w->hash_index); - fprintf(stderr,"string is %s\n", str); - } -#endif*/ - if - ( - (uchar)param >= op->unisymbol1_first_char - && - (uchar)param <= op->unisymbol1_last_char - ) - { - const char *string; - if ((string = op->unisymbol1_translation_table[param - op->unisymbol1_first_char]) != 0) - outstring+=QString().sprintf("%s", string); - else - outstring+=QString().sprintf("&#%u;", (unsigned int)param); - done++; - } - if - ( - (uchar)param >= op->unisymbol2_first_char - && - (uchar)param <= op->unisymbol2_last_char - ) - { - const char *string; - if ((string = op->unisymbol2_translation_table[param - op->unisymbol2_first_char]) != 0) - outstring+=QString().sprintf("%s", string); - else - outstring+=QString().sprintf("&#%u;", (unsigned int)param); - done++; - } - if - ( - (uchar)param >= op->unisymbol3_first_char - && - (uchar)param <= op->unisymbol3_last_char - ) - { - const char *string; - if ((string = op->unisymbol3_translation_table[param - op->unisymbol3_first_char]) != 0) - outstring+=QString().sprintf("%s", string); - else - outstring+=QString().sprintf("&#%u;", (unsigned int)param); - done++; - } -#if 1 /* 0.19.5 more unicode support */ - if - ( - (uchar)param >= op->unisymbol4_first_char - && - (uchar)param <= op->unisymbol4_last_char - ) - { - const char *string; - if ((string = op->unisymbol4_translation_table[param - op->unisymbol4_first_char]) != 0) - outstring+=QString().sprintf("%s", string); - else - outstring+=QString().sprintf("&#%u;", (unsigned int)param); - done++; - } -#endif -#if 1 /* 0.20.3 - daved added missing function call for unprocessed chars */ - if(!done && op->unisymbol_print) - { - outstring+=QString().sprintf("%s", op->unisymbol_print(param)); - done++; - } -#endif - - /* - ** if we know how to represent the unicode character in the - ** output language, we need to skip the next word, otherwise - ** we will output that alternative. - */ - if (done) - return(SKIP_ONE_WORD); - return(false); -} -#endif - -/*======================================================================== - * 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int param) { - /* XX kludge */ - if (op->paragraph_begin) { - outstring+=QString().sprintf("%s", 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, int param) { - if (op->comment_begin) { - outstring+=QString().sprintf("%s", op->comment_begin); - outstring+=QString().sprintf("Drawn Shape (ignored--not implemented yet)"); - outstring+=QString().sprintf("%s", op->comment_end); /* daved 0.20.2 */ - } - - 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, int 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, int param) { - charset_type = CHARSET_ANSI; - if (op->comment_begin) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("document uses ANSI character set"); - outstring+=QString().sprintf("%s",op->comment_end); - } - return false; -} - -/*======================================================================== - * Name: cmd_ansicpg - * Purpose: Executes the \ansicpg 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_ansicpg (Word *w, int align, char has_param, int param) { - unsigned int i; - for (i = 0; i < sizeof(codepages) / sizeof(CodepageInfo); i ++) { - charset_codepage = &codepages[i]; - if (charset_codepage->cp == param) { - if (op->comment_begin) { - outstring+=QString().sprintf("%s", op->comment_begin); - outstring+=QString().sprintf("document uses ANSI codepage %d character set", param); - outstring+=QString().sprintf("%s", op->comment_end); - } - break; - } - } - if ((charset_codepage == NULL || charset_codepage->cp == 0) && op->comment_begin) { - outstring+=QString().sprintf("%s", op->comment_begin); - outstring+=QString().sprintf("document uses default ANSI codepage character set"); - outstring+=QString().sprintf("%s", 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, int param) { - charset_type = CHARSET_CP437 ; - if (op->comment_begin) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("document uses PC codepage 437 character set"); - outstring+=QString().sprintf("%s",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, int param) { - charset_type = CHARSET_CP850; - if (op->comment_begin) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("document uses PC codepage 850 character set"); - outstring+=QString().sprintf("%s",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, int param) { - charset_type = CHARSET_MAC; - if (op->comment_begin) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("document uses Macintosh character set"); - outstring+=QString().sprintf("%s",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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int 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, int param) { - process_toc_entry (w, false); - return true; -} - - -typedef struct { - const char *name; - int (*func)(Word*, int, char, int); - const char *debug_print; -} HashItem; - - -/* All of the possible commands that RTF might recognize. */ -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 }, - { "ansicpg", &cmd_ansicpg , 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)" }, - { "cbpat", NULL, "Paragraph Shading" }, - { "cellx", NULL, "Table Definitions" }, - { "cfpat", NULL, NULL }, - { "cgrid", NULL, NULL }, - { "charrsid", NULL, "Revision Mark (ignore)" }, - { "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 }, - { NULL, NULL, NULL} -}; -static HashItem hashArray_d [] = { - { "deff", NULL, "Default Font" }, - { "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 }, - { "insrsid", NULL, "Revision Mark (ignore)" }, - { "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 [] = { -#if 1 /* daved - 0.19.4 */ - { "u", &cmd_u, NULL }, -#endif - { "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 }, - { "ulthd", &cmd_ulthd, NULL }, - { "ulthdash", &cmd_ulthdash, NULL }, - { "ulw", &cmd_ulw, NULL }, - { "ulwave", &cmd_ulwave, NULL }, - { NULL, NULL, NULL} -}; - -static HashItem hashArray_v [] = { - { "v", NULL, "Hidden Text" }, - { 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, - hashArray_v, - 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); - - state=SMALL; /* Pacify gcc, st001906 - 0.19.6 */ - if (simulate_smallcaps) { - if (*s >= 'a' && *s <= 'z') { - state=SMALL; - outstring+=QString().sprintf("%s", op->smaller_begin); - } - else - state=BIG; - } - - while ((ch=*s)) { - const char *post_trans = NULL; - - if (simulate_allcaps || simulate_smallcaps) - ch = toupper (ch); - - if (ch >= 0x20 && ch < 0x80) { -#if 1 /* daved - 0.19.6 */ - post_trans = op_translate_char (op, charset_type, charset_codepage, ch, numchar_table); -#else - post_trans = op_translate_char (op, charset_type, charset_codepage, ch); -#endif -#if 1 /* daved - 0.20.1 */ - if(post_trans) -#endif - outstring+=QString().sprintf("%s",post_trans); - } - - s++; - - if (simulate_smallcaps) { - ch = *s; - if (ch >= 'a' && ch <= 'z') { - if (state==BIG) - outstring+=QString().sprintf("%s", op->smaller_begin); - state=SMALL; - } - else - { - if (state==SMALL) - outstring+=QString().sprintf("%s", 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(); - outstring+=QString().sprintf("%s", op->table_begin); -} - - - -/*======================================================================== - * Name: - * Purpose: - * Args: None. - * Returns: None. - *=======================================================================*/ - -void -end_table () -{ - if (within_table) { - if (!have_printed_cell_end) { - attr_pop_dump(); - outstring+=QString().sprintf("%s", op->table_cell_end); - } - if (!have_printed_row_end) { - outstring+=QString().sprintf("%s", op->table_row_end); - } - outstring+=QString().sprintf("%s", 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) { - outstring+=QString().sprintf("%s", op->table_row_begin); - have_printed_row_begin=true; - have_printed_row_end=false; - have_printed_cell_begin=false; - } - if (!have_printed_cell_begin) { - outstring+=QString().sprintf("%s", 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: - outstring+=QString().sprintf("%s", op->center_begin); - break; - case ALIGN_LEFT: - break; - case ALIGN_RIGHT: - outstring+=QString().sprintf("%s", op->align_right_begin); - break; - case ALIGN_JUSTIFY: - outstring+=QString().sprintf("%s", op->align_right_begin); /* This is WRONG! */ - break; - } -} - - - -/*======================================================================== - * Name: - * Purpose: - * Args: None. - * Returns: None. - *=======================================================================*/ - -static void -ending_paragraph_align (int align) -{ - switch (align) { - case ALIGN_CENTER: - outstring+=QString().sprintf("%s", op->center_end); - break; - case ALIGN_LEFT: - /* outstring+=QString().sprintf("%s", op->align_left_end); */ - break; - case ALIGN_RIGHT: - outstring+=QString().sprintf("%s", op->align_right_end); - break; - case ALIGN_JUSTIFY: - outstring+=QString().sprintf("%s", 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 *pictfile=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 (!pictfile && !nopict_mode) { - const 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); - pictfile=fopen(picture_path,"w"); - } - - if (s[0]!=' ') { - char *s2; - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("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); - outstring+=QString().sprintf("%s",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; - if (pictfile) { - fprintf(pictfile,"%c", value); - } - } - } - } - } - /*----------------------------------------*/ - else { - total_chars_this_line += strlen(s); - - if (op->word_begin) - outstring+=QString().sprintf("%s", op->word_begin); - - print_with_special_exprs (s); - - if (op->word_end) - outstring+=QString().sprintf("%s", op->word_end); - } - - - } -#if 1 /* daved 0.19.5 */ - /* output an escaped backslash */ - /* do we need special handling for latex? */ - else if (*(s+1) == '\\') - { - s++; - putchar('\\'); - } - else if (*(s+1) == '{') - { - s++; - putchar('{'); - } - else if (*(s+1) == '}') - { - s++; - putchar('}'); - } -#endif - /*---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 */ - outstring+=QString().sprintf("%s", op->table_cell_begin); - attrstack_express_all(); - } - attr_pop_dump(); - outstring+=QString().sprintf("%s", op->table_cell_end); - have_printed_cell_begin = false; - have_printed_cell_end=true; - } - else if (!strcmp (s, "row")) { - if (within_table) { - outstring+=QString().sprintf("%s", op->table_row_end); - have_printed_row_begin = false; - have_printed_row_end=true; - } else { - if (debug_mode) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("end of table row"); - outstring+=QString().sprintf("%s",op->comment_end); - } - } - } - -/*----Special chars---------------------------------------------------------*/ - else if (*s == '\'') { - /* \'XX is a hex char code expression */ - int ch = h2toi (&s[1]); - const char *s2; - -#if 1 /* daved - 0.19.6 */ - s2 = op_translate_char (op, charset_type, charset_codepage, ch, numchar_table); -#else - s2 = op_translate_char (op, charset_type, charset_codepage, ch); -#endif - - if (!s2 || !*s2) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("char 0x%02x",ch); - outstring+=QString().sprintf("%s",op->comment_end); - } else { - if (op->word_begin) - outstring+=QString().sprintf("%s", op->word_begin); - outstring+=QString().sprintf("%s", s2); - if (op->word_end) - outstring+=QString().sprintf("%s", 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 = false; /* Pacify gcc, st001906 - 0.19.6 */ - - /* 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) { - outstring+=QString().sprintf("%s", op->comment_begin); - outstring+=QString().sprintf("Unfamiliar RTF command: %s (HashIndex not found)", s); - outstring+=QString().sprintf("%s", op->comment_end); /* daved 0.20.2 */ - } - } - 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) { - const char *debug; - int terminate_group; - - if (hip[index].func) { - terminate_group = hip[index].func (w,paragraph_align, have_param, param); - -#if 1 /* daved - 0.19.4 - unicode support may need to skip only one word */ - if (terminate_group == SKIP_ONE_WORD) - w=w->next; - else -#endif - if (terminate_group) - while(w) w=w->next; - } - - debug=hip[index].debug_print; - - if (debug && debug_mode) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("%s", debug); - outstring+=QString().sprintf("%s",op->comment_end); - } - - done=true; - } - else { - index++; - if (!hip[index].name) - done = true; - } - } - } - if (!match) { - if (debug_mode) { - outstring+=QString().sprintf("%s",op->comment_begin); - outstring+=QString().sprintf("Unfamiliar RTF command: %s", s); - outstring+=QString().sprintf("%s",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(pictfile) { - fclose(pictfile); - outstring+=QString().sprintf("%s", op->imagelink_begin); - outstring+=QString().sprintf("%s", picture_path); - outstring+=QString().sprintf("%s", 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(); - -#if 1 /* daved - 0.20.3 */ - if(0) - outstring+=QString().sprintf("", numchar_table); - if((s = attr_get_param(ATTR_FONTFACE)) != NULL && - strstr(s,"Symbol") != NULL) - numchar_table=FONTSYMBOL_TABLE; - else if((s = attr_get_param(ATTR_FONTFACE)) != NULL && - strstr(s,"Greek") != NULL) - numchar_table=FONTGREEK_TABLE; - else - numchar_table = FONTROMAN_TABLE; - if(0) - outstring+=QString().sprintf("", numchar_table); -#endif -} - - - - -/*======================================================================== - * Name: - * Purpose: - * Args: None. - * Returns: None. - *=======================================================================*/ - -void -word_print (Word *w, QString & _s) -{ - CHECK_PARAM_NOT_NULL (w); - - outstring = ""; - if (!inline_mode) { - outstring+=QString().sprintf("%s", op->document_begin); - outstring+=QString().sprintf("%s", op->header_begin); - } - - within_header=true; - have_printed_body=false; - within_table=false; - simulate_allcaps=false; - word_print_core (w); - end_table(); - - if (!inline_mode) { - outstring+=QString().sprintf("%s", op->body_end); - outstring+=QString().sprintf("%s", op->document_end); - } - _s = outstring; -} diff --git a/plugins/flp_import/unrtf/convert.h b/plugins/flp_import/unrtf/convert.h deleted file mode 100644 index 497a2188d..000000000 --- a/plugins/flp_import/unrtf/convert.h +++ /dev/null @@ -1,60 +0,0 @@ - -/*=========================================================================== - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -===========================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: convert - * Author name: Zachary Smith - * Create date: 19 Sep 2001 - * Purpose: Definitions for the conversion module - *---------------------------------------------------------------------- - * Changes: - * 31 Mar 05, by daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - - -#ifndef _CONVERT - -enum { - CHARSET_ANSI=1, - CHARSET_MAC, - CHARSET_CP437, - CHARSET_CP850, -}; - -#ifndef _WORD -#include "word.h" -#endif - -extern void word_print (Word*, QString & _s); - -#if 1 /* daved 0.19.6 - support for multiple char number->output tables */ - extern short numchar_table; -#define FONTROMAN_TABLE 0 -#define FONTSYMBOL_TABLE 1 -#define FONTGREEK_TABLE 2 -#endif - -#define _CONVERT -#endif - diff --git a/plugins/flp_import/unrtf/defs.h b/plugins/flp_import/unrtf/defs.h deleted file mode 100644 index b5bc459aa..000000000 --- a/plugins/flp_import/unrtf/defs.h +++ /dev/null @@ -1,78 +0,0 @@ - -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: defs.h - * Author name: Zachary 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 UnRTF. - * 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 information - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - * 17 Dec 07, daved@physiol.usyd.edu.au: added --noremap to usage - from - * David Santinoli - *--------------------------------------------------------------------*/ - - -#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.4 */ -#endif - - -#ifndef true /* daved 0.19.0 */ -#define true (1) -#endif -#ifndef false /* daved 0.19.0 */ -#define false (0) -#endif -#if 1 /* daved - 0.19.4 */ -#define SKIP_ONE_WORD 2 -#endif - - -#define USAGE "unrtf [--version] [--verbose] [--help] [--nopict|-n] [--noremap] [--html] [--text] [--vt] [--latex] [-t html|text|vt|latex] " - - -/* 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" - diff --git a/plugins/flp_import/unrtf/error.c b/plugins/flp_import/unrtf/error.c deleted file mode 100644 index 5d8b1792c..000000000 --- a/plugins/flp_import/unrtf/error.c +++ /dev/null @@ -1,106 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: error - * Author name: Zachary 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 - * 25 Sep 04, st001906@hrz1.hrz.tu-darmstadt.de: added stdlib.h for djgpp - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 22 Aug 05, ax2groin@arbornet.org: added lineno to error_handler - * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - -#ifdef LMMS_HAVE_CONFIG_H -#include -#endif - -#ifdef LMMS_HAVE_STDIO_H -#include -#endif - -#ifdef LMMS_HAVE_STDLIB_H -#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 (const char* message) -{ -#if 1 - fprintf(stderr, "Error (line %d): %s\n", lineno, message); -#else - fprintf(stderr, "Error: %s\n", message); -#endif - exit(10); -} - - -/*======================================================================== - * Name: warning_handler - * Purpose: Prints useful info to stderr, but doesn't exit. - * Args: Message. - * Returns: None. - *=======================================================================*/ - -void -warning_handler (const char* message) -{ - fprintf(stderr, "Warning: %s\n", message); -} diff --git a/plugins/flp_import/unrtf/error.h b/plugins/flp_import/unrtf/error.h deleted file mode 100644 index 438979277..000000000 --- a/plugins/flp_import/unrtf/error.h +++ /dev/null @@ -1,46 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: error.h - * Author name: Zachary 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 - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - - -#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 (const char*); -extern void warning_handler (const char*); - - diff --git a/plugins/flp_import/unrtf/hash.c b/plugins/flp_import/unrtf/hash.c deleted file mode 100644 index b9dafd7f5..000000000 --- a/plugins/flp_import/unrtf/hash.c +++ /dev/null @@ -1,218 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: hash - * Author name: Zachary 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 - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requsted by ZT Smith - * 06 Jan 06, marcossamaral@terra.com.br: changes hash_stats function - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - -#ifdef LMMS_HAVE_CONFIG_H -#include -#endif - -#ifdef LMMS_HAVE_STDIO_H -#include -#endif - -#ifdef LMMS_HAVE_STRING_H -#include -#endif - -#include "error.h" -#include "main.h" -#include "ur_malloc.h" - - -typedef struct _hi { - struct _hi *next; - char *str; - unsigned long value; -} hashItem; - - -/* Index by first char of string */ -static hashItem *hash2[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++) { - hash2[i]=NULL; - hash_length[i]=0; - } -} - - - -/*======================================================================== - * Name: hash_stats - * Purpose: Return the number of words stored. This is all words, - * including commands to RTF, NOT the number of printed words in - * a given document. - * Args: None. - * Returns: Number of words stored. - *=======================================================================*/ - -unsigned long -hash_stats () -{ - int i; - unsigned long total=0; - for (i=0; i<256; i++) { - total += hash_length[i]; - } - return(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 = hash2[index]; - while (hi) { - if (!strcmp(hi->str,str)) - return hi->value; - hi=hi->next; - } - /* not in hash */ - hi = hashitem_new (str); - hi->next = hash2[index]; - hash2[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 = hash2[index]; - while (hi) { - if (hi->value == value) - return hi->str; - hi=hi->next; - } - warning_handler("Word not in hash"); - return NULL; -} diff --git a/plugins/flp_import/unrtf/hash.h b/plugins/flp_import/unrtf/hash.h deleted file mode 100644 index 7aea699d6..000000000 --- a/plugins/flp_import/unrtf/hash.h +++ /dev/null @@ -1,42 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: hash.h - * Author name: Zachary Smith - * Create date: 1 Sept 2000 - * Purpose: Definitions for the hash module. - *---------------------------------------------------------------------- - * Changes: - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 06 Jan 06, marcossamaral@terra.com.br: changes hash_stats() - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - - - -extern void hash_init (void); -extern unsigned long hash_stats (void); -extern unsigned long hash_get_index (char *); -extern char* hash_get_string (unsigned long ); - - diff --git a/plugins/flp_import/unrtf/html.c b/plugins/flp_import/unrtf/html.c deleted file mode 100644 index 32fa187ed..000000000 --- a/plugins/flp_import/unrtf/html.c +++ /dev/null @@ -1,1265 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: html - * Author name: Zachary 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 - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 29 Mar 05, daved@physiol.usyd.edu.au: more unicode characters - * 21 Jul 05, daved@physiol.usyd.edu.au: added endash - * 19 Aug 05, ax2groin@arbornet.org: added more chars and changes to ANSI - * 05 Jan 06, marcossamaral@terra.com.br: fixed bugs #14982 and #14983 - * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions - * 13 Dec 07, daved@physiol.usyd.edu.au: fixed some missing entity ';' - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - -#ifdef LMMS_HAVE_CONFIG_H -#include -#endif - -#ifdef LMMS_HAVE_STDIO_H -#include -#endif - -#ifdef LMMS_HAVE_STRING_H -#include -#endif - -#include "ur_malloc.h" -#include "defs.h" -#include "error.h" -#include "main.h" -#include "output.h" - - -static const 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 const char* ansi [] = { -/* 0x78 */ "x", -/* 0x79 */ "y", -/* 0x7a */ "z", -/* 0x7b */ "{", -/* 0x7c */ "|", -/* 0x7d */ "}", -/* 0x7e */ "~", -/* 0x7f */ "", -/* 0x80 */ "€", /* € may be more widely recognized. */ -/* 0x81 */ "", -/* 0x82 */ "‚", /* ‚ not implemented in any browsers I've seen. */ -/* 0x83 */ "ƒ", -/* 0x84 */ "„", /* „ not implemented in any browsers I've seen. */ -/* 0x85 */ "…", -/* 0x86 */ "†", -/* 0x87 */ "‡", -/* 0x88 */ "ˆ", -/* 0x89 */ "‰", -/* 0x8a */ "Š", -/* 0x8b */ "‹", -/* 0x8c */ "Œ", -/* 0x8d */ "", -/* 0x8e */ "Ž", -/* 0x8f */ "", -/* 0x90 */ "", "‘", "’", "“", "”", "•", "–", "—", -/* 0x98 */ "˜", -/* 0x99 */ "™", -/* 0x9a */ "š", -/* 0x9b */ "›", /* daved - 0.9.6 */ -/* 0x9c */ "œ", -/* 0x9d */ "", -/* 0x9e */ "ž", -/* 0x9f */ "Ÿ", -/* 0xa0 */ " ","¡","¢","£","¤","¥","¦","§", -/* 0xa8 */ "¨","©","ª","«","¬","­","®","¯", -/* 0xb0 */ "°", "±","²","³","´","µ","¶","·", -/* 0xb8 */ "¸","¹", "º","»", "¼", "½","¾","¿", -/* 0xc0 */ "À","Á","Â","Ã","Ä","Å","Æ","Ç", -/* 0xc8 */ "È","É","Ê","Ë","Ì","Í","Î","Ï", -/* 0xd0 */ "Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×", -/* 0xd8 */ "Ø","Ù","Ú","Û","Ü","Ý","Þ","ß", -/* 0xe0 */ "à","á","â","ã","ä","å","æ","ç", -/* 0xe8 */ "è","é","ê","ë","ì","í","î","ï", -/* 0xf0 */ "ð","ñ","ò","ó","ô","õ","ö","÷", -/* 0xf8 */ "ø","ù","ú","û","ü","ý","þ","ÿ" -}; - -static const 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;" -}; - -#if 1 /* daved - 0.19.4 - unicode symbol character support */ -static const char * unisymbol1[] = { - /* 913 */ "Α", - /* 914 */ "Β", - /* 915 */ "Γ", - /* 916 */ "Δ", - /* 917 */ "Ε", - /* 918 */ "Ζ", - /* 919 */ "Η", - /* 920 */ "Θ", - /* 921 */ "Ι", - /* 922 */ "Κ", - /* 923 */ "Λ", - /* 924 */ "Μ", - /* 925 */ "Ν", - /* 926 */ "Ξ", - /* 927 */ "Ο", - /* 928 */ "Π", - /* 929 */ "Ρ", - /* 930 */ 0, - /* 931 */ "Σ", - /* 932 */ "Τ", - /* 933 */ "Υ", - /* 934 */ "Φ", - /* 935 */ "Χ", - /* 936 */ "Ψ", - /* 937 */ "Ω", - /* 938 */ 0, - /* 939 */ 0, - /* 940 */ 0, - /* 941 */ 0, - /* 942 */ 0, - /* 943 */ 0, - /* 944 */ 0, - /* 945 */ "α", - /* 946 */ "β", - /* 947 */ "γ", - /* 948 */ "δ", - /* 949 */ "ε", - /* 950 */ "ζ", - /* 951 */ "η", - /* 952 */ "θ", - /* 953 */ "ι", - /* 954 */ "κ", - /* 955 */ "λ", - /* 956 */ "μ", - /* 957 */ "ν", - /* 958 */ "ξ", - /* 959 */ "ο", - /* 960 */ "π", - /* 961 */ "ρ", - /* 962 */ "ς", - /* 963 */ "σ", - /* 964 */ "τ", - /* 965 */ "υ", - /* 966 */ "φ", - /* 967 */ "χ", - /* 968 */ "ψ", - /* 969 */ "ω", - /* 970 */ 0, - /* 971 */ 0, - /* 972 */ 0, - /* 973 */ 0, - /* 974 */ 0, - /* 975 */ 0, - /* 976 */ 0, - /* 977 */ "ϑ", - /* 978 */ "ϒ", - /* 979 */ 0, - /* 980 */ 0, - /* 981 */ 0, - /* 982 */ "ϖ", -}; -#endif -#if 1 /* daved - 0.19.4 - unicode symbol character support */ -static const char * unisymbol2[] = { -/* 57516 */ "Γ", -/* 57517 */ "Δ", -/* 57518 */ "Θ", -/* 57519 */ "Λ", -/* 57520 */ "Ξ", -/* 57521 */ "Π", -/* 57522 */ "Σ", -/* 57523 */ "Υ", -/* 57524 */ "Φ", -/* 57525 */ "Ψ", -/* 57526 */ "Ω", -/* 57527 */ "α", -/* 57528 */ "β", -/* 57529 */ "γ", -/* 57530 */ "δ", -/* 57531 */ "ε", -/* 57532 */ "ζ", -/* 57533 */ "η", -/* 57534 */ "θ", -/* 57535 */ "ι", -/* 57536 */ "κ", -/* 57537 */ "λ", -/* 57538 */ "μ", -/* 57539 */ "ν", -/* 57540 */ "ξ", -/* 57541 */ "ο", -/* 57542 */ "π", -/* 57543 */ "ρ", -/* 57544 */ "σ", -/* 57545 */ "τ", -/* 57546 */ "υ", -/* 57547 */ "φ", -/* 57548 */ "χ", -/* 57549 */ "ψ", -/* 57550 */ "ω", -/* 57551 */ "ϵ", -/* 57552 */ "ϑ", -/* 57553 */ "ϖ", -/* 57554 */ 0, -/* 57555 */ "ς", -/* 57556 */ "ϕ", -/* 57557 */ "δ", -}; - -static const char * unisymbol3[] = { - /* 61505 */ "Α", - /* 61506 */ "Β", - /* 61507 */ "Χ", - /* 61508 */ "Δ", - /* 61509 */ "Ε", - /* 61510 */ "Φ", - /* 61511 */ "Γ", - /* 61512 */ "Η", - /* 61513 */ "Ι", - /* 61514 */ "ϕ", - /* 61515 */ "Κ", - /* 61516 */ "Λ", - /* 61517 */ "Μ", - /* 61518 */ "Ν", - /* 61519 */ "Ο", - /* 61520 */ "Π", - /* 61521 */ "Θ", - /* 61522 */ "Ρ", - /* 61523 */ "Σ", - /* 61524 */ "Τ", - /* 61525 */ "Υ", - /* 61526 */ "ς", - /* 61527 */ "Ω", - /* 61528 */ "Ξ", - /* 61529 */ "Ψ", - /* 61530 */ "Ζ", - /* 61531 */ 0, - /* 61532 */ 0, - /* 61533 */ 0, - /* 61534 */ 0, - /* 61535 */ 0, - /* 61536 */ 0, - /* 61537 */ "α", - /* 61538 */ "β", - /* 61539 */ "χ", - /* 61540 */ "δ", - /* 61541 */ "ε", - /* 61542 */ "φ", - /* 61543 */ "γ", - /* 61544 */ "η", - /* 61545 */ "τ", - /* 61546 */ "ϕ", - /* 61547 */ "κ", - /* 61548 */ "λ", - /* 61549 */ "μ", - /* 61550 */ "ν", - /* 61551 */ "ο", - /* 61552 */ "π", - /* 61553 */ "θ", - /* 61554 */ "ρ", - /* 61555 */ "σ", - /* 61556 */ "τ", - /* 61557 */ "υ", - /* 61558 */ "ϖ", - /* 61559 */ "ω", - /* 61560 */ "ξ", - /* 61561 */ "ψ", - /* 61562 */ "ζ", -}; -#endif - -#if 1 /* 0.19.5 more unicode characters */ -static const char * unisymbol4[] = { - /* 61600 */ "€", - /* 61601 */ "ϒ", - /* 61602 */ "′", - /* 61603 */ "≤", - /* 61604 */ "⁄", - /* 61605 */ "∞", - /* 61606 */ "ƒ", - /* 61607 */ "♣", - /* 61608 */ "♦", - /* 61609 */ "♥", - /* 61610 */ "♠", - /* 61611 */ "↔", - /* 61612 */ "&larr", - /* 61613 */ "↑", - /* 61614 */ "→", - /* 61615 */ "↓", - /* 61616 */ "°", - /* 61617 */ "±", - /* 61618 */ "″", - /* 61619 */ "≥", - /* 61620 */ "×", - /* 61621 */ "∝", - /* 61622 */ "∂", - /* 61623 */ "•", - /* 61624 */ "÷", - /* 61625 */ "≠", - /* 61626 */ "≡", - /* 61627 */ "≈", - /* 61628 */ "…", - /* 61629 */ 0, /* vertical bar */ - /* 61630 */ "—", - /* 61631 */ "↵", - /* 61632 */ "ℵ", - /* 61633 */ "ℑ", - /* 61634 */ "ℜ", - /* 61635 */ "℘", - /* 61636 */ "⊗", - /* 61637 */ "⊕", - /* 61638 */ "∅", - /* 61639 */ "∩", - /* 61640 */ "∪", - /* 61641 */ "⊃", - /* 61642 */ "⊇", - /* 61643 */ "⊄", - /* 61644 */ "⊂", - /* 61645 */ "⊆", - /* 61646 */ "∈", - /* 61647 */ "∉", - /* 61648 */ "∠", - /* 61649 */ "∇", - /* 61650 */ "®", - /* 61651 */ "©", - /* 61652 */ "™", - /* 61653 */ "∏", - /* 61654 */ "√", - /* 61655 */ "·", - /* 61656 */ "¬", - /* 61657 */ "∧", - /* 61658 */ "∨", - /* 61659 */ "⇔", - /* 61660 */ "⇐", - /* 61661 */ "⇑", - /* 61662 */ "⇒", - /* 61663 */ "⇓", - /* 61664 */ "◊", - /* 61665 */ "⟨", - /* 61666 */ "®", - /* 61667 */ "©", - /* 61668 */ "™", - /* 61669 */ "∑", - /* 61670 */ 0, /* large right parenthesis ceiling */ - /* 61671 */ 0, /* large parenthesis middle */ - /* 61672 */ 0, /* large left parenthesis floor */ - /* 61673 */ "⌈", /* large left square bracket ceiling */ - /* 61674 */ 0, /* large left square bracket middle */ - /* 61675 */ "⌊", /* large left square bracket floor */ - /* 61676 */ 0, /* large left bracket ceiling */ - /* 61677 */ 0, /* large left bracket middle */ - /* 61678 */ 0, /* large left bracket floor */ - /* 61679 */ 0, /* large vertical bar */ - /* 61680 */ 0, /* appears blank */ - /* 61681 */ "⟩", - /* 61682 */ "∫", /* integral */ - /* 61683 */ 0, /* large integral ceiling */ - /* 61684 */ 0, /* large integral middle */ - /* 61685 */ 0, /* large integral floor */ - /* 61686 */ 0, /* large right parenthesis ceiling */ - /* 61687 */ 0, /* large right parenthesis middle */ - /* 61688 */ 0, /* large right parenthesis floor */ - /* 61689 */ "⌉", /* large right square bracket ceiling */ - /* 61690 */ 0, /* large right square bracket middle */ - /* 61691 */ "⌋", /* large right square bracket floor */ - /* 61692 */ 0, /* large right bracket middle */ - /* 61694 */ 0 /* large right bracket floot */ -}; -#endif -#if 1 /* daved - SYMBOL font characters */ -static const char* symbol[] = { -/* 60 */ "<", -/* 61 */ "=", -/* 62 */ ">", -/* 63 */ "?", -/* 64 */ "≅", -/* 65 */ "Α", -/* 66 */ "Β", -/* 67 */ "Β", -/* 68 */ "Δ", -/* 69 */ "Ε", -/* 70 */ "Φ", -/* 71 */ "Γ", -/* 72 */ "Η", -/* 73 */ "Ι", -/* 74 */ "ϑ", -/* 75 */ "Κ", -/* 76 */ "Λ", -/* 77 */ "Μ", -/* 78 */ "Ν", -/* 79 */ "Ο", -/* 80 */ "Π", -/* 81 */ "Θ", -/* 82 */ "Ρ", -/* 83 */ "Σ", -/* 84 */ "Τ", -/* 85 */ "Υ", -/* 86 */ "ς", -/* 87 */ "Ω", -/* 88 */ "Ξ", -/* 89 */ "Ψ", -/* 90 */ "Ζ", -/* 91 */ "[", -/* 92 */ "∴", -/* 93 */ "]", -/* 94 */ "⊥", -/* 95 */ "_", -/* 96 */ "‾", -/* 97 */ "α", -/* 98 */ "β", -/* 99 */ "χ", -/* 100 */ "δ", -/* 101 */ "ε", -/* 102 */ "φ", -/* 103 */ "γ", -/* 104 */ "η", -/* 105 */ "ι", -/* 106 */ "", /* ? */ -/* 107 */ "κ", -/* 108 */ "λ", -/* 109 */ "μ", -/* 110 */ "ν", -/* 111 */ "ο", -/* 112 */ "π", -/* 113 */ "θ", -/* 114 */ "ρ", -/* 115 */ "σ", -/* 116 */ "τ", -/* 117 */ "υ", -/* 118 */ "ϖ", -/* 119 */ "ω", -/* 120 */ "ξ", -/* 121 */ "ψ", -/* 122 */ "ζ", -/* 123 */ "{", -/* 124 */ "|", -/* 125 */ "}", -/* 126 */ "∼", -/* 127 */ 0, -/* 128 */ 0, -/* 129 */ 0, -/* 130 */ 0, -/* 131 */ 0, -/* 132 */ 0, -/* 133 */ 0, -/* 134 */ 0, -/* 135 */ 0, -/* 136 */ 0, -/* 137 */ 0, -/* 138 */ 0, -/* 139 */ 0, -/* 140 */ 0, -/* 141 */ 0, -/* 142 */ 0, -/* 143 */ 0, -/* 144 */ 0, -/* 145 */ 0, -/* 146 */ 0, -/* 147 */ 0, -/* 148 */ 0, -/* 149 */ 0, -/* 150 */ 0, -/* 151 */ 0, -/* 152 */ 0, -/* 153 */ 0, -/* 154 */ 0, -/* 155 */ 0, -/* 156 */ 0, -/* 157 */ 0, -/* 158 */ 0, -/* 159 */ 0, -/* 160 */ 0, -/* 161 */ "ϒ", -/* 162 */ "′", -/* 163 */ "≤", -/* 164 */ "⁄", -/* 165 */ "∞", -/* 166 */ "ƒ", -/* 167 */ "♣", -/* 168 */ "♦", -/* 169 */ "♥", -/* 170 */ "♠", -/* 171 */ "↔", -/* 172 */ "←", -/* 173 */ 0, -/* 174 */ "→", -/* 175 */ "↓", -/* 176 */ "°", -/* 177 */ "±", -/* 178 */ "″", -/* 179 */ "≥", -/* 180 */ "×", -/* 181 */ "∝", -/* 182 */ "∂", -/* 183 */ "•", -/* 184 */ "÷", -/* 185 */ "≠", -/* 186 */ "≡", -/* 187 */ "≈", -/* 188 */ "…", -/* 189 */ "│", /* vertical line */ -/* 190 */ "—", -/* 191 */ "↵", -/* 192 */ "ℵ", -/* 193 */ "ℑ", -/* 194 */ "ℜ", -/* 195 */ "℘", -/* 196 */ "⊗", -/* 197 */ "⊕", -/* 198 */ "∅", -/* 199 */ "∩", -/* 200 */ "∪", -/* 201 */ "⊃", -/* 202 */ "⊇", -/* 203 */ "⊄", -/* 204 */ "⊂", -/* 205 */ "⊆", -/* 206 */ "∈", -/* 207 */ "∉", -/* 208 */ "∠", -/* 209 */ "∇", -/* 210 */ "®", /* serif */ -/* 211 */ "©", /* serif */ -/* 212 */ "™", /* serif */ -/* 213 */ "∏", -/* 214 */ "√", -/* 215 */ "·", -/* 216 */ "¬", -/* 217 */ "∧", -/* 218 */ "∨", -/* 219 */ "⇔", -/* 220 */ "⇐", -/* 221 */ "⇑", -/* 222 */ "⇒", -/* 223 */ "⇓", -/* 224 */ "◊", -/* 225 */ "⟨", -/* 226 */ "®", /* sans serif */ -/* 227 */ "©", /* sans serif */ -/* 228 */ "™", /* sans serif */ -/* 229 */ "∑", -/* 230 */ 0, -/* 231 */ 0, -/* 232 */ 0, -/* 233 */ "⌈", -/* 234 */ "|", -/* 235 */ "⌊", -/* 236 */ 0, -/* 237 */ 0, -/* 238 */ 0, -/* 239 */ "|", -/* 240 */ "ð", -/* 241 */ "⟩", -/* 242 */ "∫", -/* 243 */ 0, -/* 244 */ 0, -/* 245 */ 0, -/* 246 */ 0, -/* 247 */ 0, -/* 248 */ 0, -/* 249 */ "⌉", -/* 250 */ "|", -/* 251 */ "⌋", -/* 252 */ 0, -/* 253 */ 0, -/* 254 */ 0, -}; -#endif -static const 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 const 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 */ " ", -}; -#if 1 /* daved - 0.20.3 */ -static const char * Greek[] = -{ -/* 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 */ "ó", -/* above here not done */ -/* 0xe1 */ "α", -/* 0xe2 */ "β", -/* 0xe3 */ "γ", -/* 0xe4 */ "δ", -/* 0xe5 */ "ε", -/* 0xe6 */ "ζ", -/* 0xe7 */ "η", -/* 0xe8 */ "θ", -/* 0xe9 */ "ι", -/* 0xea */ "κ", -/* 0xeb */ "λ", -/* 0xec */ "μ", -/* 0xed */ "ν", -/* 0xee */ "ξ", -/* 0xef */ "ο", -/* 0xf0 */ "π", -/* 0xf1 */ "ρ", -/* 0xf2 */ "ς", -/* 0xf3 */ "σ", -/* 0xf4 */ "τ", -/* 0xf5 */ "υ", -/* 0xf6 */ "φ", -/* 0xf7 */ "χ", -/* 0xf8 */ "ψ", -/* 0xf9 */ "&omiga;", -/* 0xfa */ "&iotauml;", -/* 0xfb */ "&nuuml;", -/* 0xfc */ "&omicronacute;", -/* 0xfd */ "&nuacute;", -/* 0xfe */ "&omegaacute;", /* black square */ -/* 0xff */ " ", -}; -#endif - - - - - -/*======================================================================== - * Name: html_unisymbol_print - * Purpose: Outputs arbitrary unicode symbol - * Args: Unsigned Short. - * Returns: String representing symbol. - *=======================================================================*/ - -char * -html_unisymbol_print (unsigned short c) -{ - char r[12]; - snprintf(r, 9, "&#%04d;", c); - return my_strdup(r); -} - - - - -/*======================================================================== - * 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\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; -#if 1 /* daved - 0.9.6 */ - op->ansi_first_char = 0x78; -#else - op->ansi_first_char = 0x82; -#endif - 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; - -#if 1 /* daved 0.19.8 */ - op->chars.right_quote = "’"; - op->chars.left_quote = "‘"; - op->chars.right_dbl_quote = "”"; - op->chars.left_dbl_quote = "“"; -#else - op->chars.right_quote = "'"; - op->chars.left_quote = "`"; - op->chars.right_dbl_quote = "\""; - op->chars.left_dbl_quote = "\""; -#endif -#if 1 /* daved - 0.19.8 */ - op->chars.endash = "–"; - op->chars.emdash = "—"; - op->chars.bullet = "•"; - op->chars.lessthan = "<"; - op->chars.greaterthan = ">"; - op->chars.amp = "&"; - op->chars.copyright = "©"; - op->chars.trademark = "™"; - op->chars.nonbreaking_space = " "; -#endif - -#if 1 /* daved - 0.19.4 - unicode symbol character support */ - op->unisymbol1_first_char = 913; - op->unisymbol1_last_char = 982; - op->unisymbol1_translation_table = unisymbol1; - op->unisymbol2_first_char = 57516; - op->unisymbol2_last_char = 57557; - op->unisymbol2_translation_table = unisymbol2; - op->unisymbol3_first_char = 61505; - op->unisymbol3_last_char = 61562; - op->unisymbol3_translation_table = unisymbol3; -#endif -#if 1 /* daved - 0.19.5 - more unicode symbol character support */ - op->unisymbol4_first_char = 61600; - op->unisymbol4_last_char = 61694; - op->unisymbol4_translation_table = unisymbol4; -#endif -#if 1 /* daved - 0.19.5 - SYMBOL font support */ - op->symbol_first_char = 60; - op->symbol_last_char = 254; - op->symbol_translation_table = symbol; -#endif -#if 1 /* daved - 0.20.3 - GREEK font support */ - op->greek_first_char = 0x80; - op->greek_last_char = 0xff; - op->greek_translation_table = Greek; -#endif - - op->unisymbol_print = html_unisymbol_print; - - return op; -} diff --git a/plugins/flp_import/unrtf/html.h b/plugins/flp_import/unrtf/html.h deleted file mode 100644 index 4af30cdc6..000000000 --- a/plugins/flp_import/unrtf/html.h +++ /dev/null @@ -1,43 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: html - * Author name: Zachary Smith - * Create date: 19 Sep 01 - * Purpose: Definitions for the HTML output personality - *---------------------------------------------------------------------- - * Changes: - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - - -#ifndef _HTML - - -extern OutputPersonality* html_init(void); - - -#define _HTML -#endif - diff --git a/plugins/flp_import/unrtf/main.h b/plugins/flp_import/unrtf/main.h deleted file mode 100644 index 446b1806c..000000000 --- a/plugins/flp_import/unrtf/main.h +++ /dev/null @@ -1,46 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: main.h - * Author name: Zachary Smith - * Create date: 1 Sept 2000 - * Purpose: Externs for main.c. - *---------------------------------------------------------------------- - * Changes: - * 15 Oct 00, tuorfa@yahoo.com: removed echo_mode extern - * 19 Sep 01, tuorfa@yahoo.com: added output personality - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - - -extern int lineno; - - -#ifndef _OUTPUT -#include "output.h" -#endif - -extern OutputPersonality *op; - - diff --git a/plugins/flp_import/unrtf/output.c b/plugins/flp_import/unrtf/output.c deleted file mode 100644 index 85a80d10e..000000000 --- a/plugins/flp_import/unrtf/output.c +++ /dev/null @@ -1,478 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: output - * Author name: Zachary 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 - * 25 Sep 04, st001906@hrz1.hrz.tu-darmstadt.de: added stdlib.h for djgpp - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 06 Jan 06, marcossamaral@terra.com.br: changes in STDOUT - * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - * 17 Dec 07, daved@physiol.usyd.edu.au: added support for --noremap from - * David Santinoli - *--------------------------------------------------------------------*/ - - -#ifdef LMMS_HAVE_CONFIG_H -#include -#endif - -#ifdef LMMS_HAVE_STDIO_H -#include -#endif - -#ifdef LMMS_HAVE_STDLIB_H -#include -#endif - -#ifdef LMMS_HAVE_STRING_H -#include -#endif - -#include "ur_malloc.h" -#include "defs.h" -#include "error.h" -#include "output.h" -#include "main.h" -#include "convert.h" - - -extern QString outstring; - -/*======================================================================== - * 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"); - - memset ((void*) new_op, 0, 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 ((char*) 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. - *=======================================================================*/ - -const char * -#if 1 /* daved - 0.19.6 */ -op_translate_char (OutputPersonality *op, int charset, CodepageInfo *codepage, int ch, int ntable) -#else -op_translate_char (OutputPersonality *op, int charset, CodepageInfo *codepage, int ch) -#endif -{ - short start; - const char *result=NULL; -#if 1 /* daved - 0.20.5 */ - static char output_buffer[2]={ 0, 0 }; -#endif - - CHECK_PARAM_NOT_NULL(op); - -#if 1 /* daved - 0.20.5 */ - if (no_remap_mode == true && ch < 256) - { - output_buffer[0]=ch; - result=output_buffer; - } - else -#endif -#if 1 /* daved - 0.19.6 */ - /* if we are seeking a character from a symbol font we can - be below 0x80 - */ - if(ntable == FONTSYMBOL_TABLE) - { - start = op->symbol_first_char; - - if(ch >= start && ch <= op->symbol_last_char) - result = op->symbol_translation_table[ch - start]; - if(result) - return result; - } - else -#endif -#if 1 /* daved - 0.20.3 */ - if(ntable == FONTGREEK_TABLE) - { - start = op->greek_first_char; - - if(ch >= start && ch <= op->greek_last_char) - result = op->greek_translation_table[ch - start]; - if(result) - return result; - } -#endif - 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: - if (codepage != NULL && op->unisymbol_print != NULL && codepage->cp) - { - if(0) - printf("", codepage->chars[ch - 0x80]); - if (codepage->chars[ch - 0x80]) { - if(0) - printf(""); - result = op->unisymbol_print(codepage->chars[ch - 0x80]); - } - } - if(!result) - { - 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) -{ - size = ( size * 3 ) / 2; - 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) { - outstring+=QString().sprintf("%s", op->fontsize8_begin); - found_std_expr = true; - } - break; - case 10: - if (op->fontsize10_begin) { - outstring+=QString().sprintf("%s", op->fontsize10_begin); - found_std_expr = true; - } - break; - case 12: - if (op->fontsize12_begin) { - outstring+=QString().sprintf("%s", op->fontsize12_begin); - found_std_expr = true; - } - break; - case 14: - if (op->fontsize14_begin) { - outstring+=QString().sprintf("%s", op->fontsize14_begin); - found_std_expr = true; - } - break; - case 18: - if (op->fontsize18_begin) { - outstring+=QString().sprintf("%s", op->fontsize18_begin); - found_std_expr = true; - } - break; - case 24: - if (op->fontsize24_begin) { - outstring+=QString().sprintf("%s", op->fontsize24_begin); - found_std_expr = true; - } - break; - case 36: - if (op->fontsize36_begin) { - outstring+=QString().sprintf("%s", op->fontsize36_begin); - found_std_expr = true; - } - break; - case 48: - if (op->fontsize48_begin) { - outstring+=QString().sprintf("%s", 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); - outstring+=QString().sprintf(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) { - outstring+=QString().sprintf("%s", op->fontsize8_begin); - } else - if (size<11 && op->fontsize10_begin) { - outstring+=QString().sprintf("%s", op->fontsize10_begin); - } else - if (size<13 && op->fontsize12_begin) { - outstring+=QString().sprintf("%s", op->fontsize12_begin); - } else - if (size<16 && op->fontsize14_begin) { - outstring+=QString().sprintf("%s", op->fontsize14_begin); - } else - if (size<21 && op->fontsize18_begin) { - outstring+=QString().sprintf("%s", op->fontsize18_begin); - } else - if (size<30 && op->fontsize24_begin) { - outstring+=QString().sprintf("%s", op->fontsize24_begin); - } else - if (size<42 && op->fontsize36_begin) { - outstring+=QString().sprintf("%s", op->fontsize36_begin); - } else - if (size>40 && op->fontsize48_begin) { - outstring+=QString().sprintf("%s", 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) - outstring+=QString().sprintf("%s", op->fontsize12_begin); - else - if (op->fontsize14_begin) - outstring+=QString().sprintf("%s", op->fontsize14_begin); - else - if (op->fontsize10_begin) - outstring+=QString().sprintf("%s", op->fontsize10_begin); - else - if (op->fontsize18_begin) - outstring+=QString().sprintf("%s", op->fontsize18_begin); - else - if (op->fontsize8_begin) - outstring+=QString().sprintf("%s", 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) { - outstring+=QString().sprintf("%s", op->fontsize8_end); - found_std_expr = true; - } - break; - case 10: - if (op->fontsize10_end) { - outstring+=QString().sprintf("%s", op->fontsize10_end); - found_std_expr = true; - } - break; - case 12: - if (op->fontsize12_end) { - outstring+=QString().sprintf("%s", op->fontsize12_end); - found_std_expr = true; - } - break; - case 14: - if (op->fontsize14_end) { - outstring+=QString().sprintf("%s", op->fontsize14_end); - found_std_expr = true; - } - break; - case 18: - if (op->fontsize18_end) { - outstring+=QString().sprintf("%s", op->fontsize18_end); - found_std_expr = true; - } - break; - case 24: - if (op->fontsize24_end) { - outstring+=QString().sprintf("%s", op->fontsize24_end); - found_std_expr = true; - } - break; - case 36: - if (op->fontsize36_end) { - outstring+=QString().sprintf("%s", op->fontsize36_end); - found_std_expr = true; - } - break; - case 48: - if (op->fontsize48_end) { - outstring+=QString().sprintf("%s", 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); - outstring+=QString().sprintf(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) { - outstring+=QString().sprintf("%s", op->fontsize8_end); - } else - if (size<11 && op->fontsize10_end) { - outstring+=QString().sprintf("%s", op->fontsize10_end); - } else - if (size<13 && op->fontsize12_end) { - outstring+=QString().sprintf("%s", op->fontsize12_end); - } else - if (size<16 && op->fontsize14_end) { - outstring+=QString().sprintf("%s", op->fontsize14_end); - } else - if (size<21 && op->fontsize18_end) { - outstring+=QString().sprintf("%s", op->fontsize18_end); - } else - if (size<30 && op->fontsize24_end) { - outstring+=QString().sprintf("%s", op->fontsize24_end); - } else - if (size<42 && op->fontsize36_end) { - outstring+=QString().sprintf("%s", op->fontsize36_end); - } else - if (size>40 && op->fontsize48_end) { - outstring+=QString().sprintf("%s", 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) - outstring+=QString().sprintf("%s", op->fontsize12_end); - else - if (op->fontsize14_end) - outstring+=QString().sprintf("%s", op->fontsize14_end); - else - if (op->fontsize10_end) - outstring+=QString().sprintf("%s", op->fontsize10_end); - else - if (op->fontsize18_end) - outstring+=QString().sprintf("%s", op->fontsize18_end); - else - if (op->fontsize8_end) - outstring+=QString().sprintf("%s", op->fontsize8_end); - else - error_handler ("output personality lacks sufficient font size change capability"); - } - } -} - - diff --git a/plugins/flp_import/unrtf/output.h b/plugins/flp_import/unrtf/output.h deleted file mode 100644 index 10ef2a3bf..000000000 --- a/plugins/flp_import/unrtf/output.h +++ /dev/null @@ -1,312 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: output - * Author name: Zachary Smith - * Create date: 18 Sep 01 - * Purpose: Definitions for the generalized output module - *---------------------------------------------------------------------- - * Changes: - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions - *--------------------------------------------------------------------*/ - - -#ifndef _OUTPUT - -typedef struct { - int cp; - unsigned short chars[128]; -} CodepageInfo; - - -typedef struct { - const char *comment_begin; - const char *comment_end; - - const char *document_begin; - const char *document_end; - - const char *header_begin; - const char *header_end; - - const char *document_title_begin; - const char *document_title_end; - - char *document_keywords_begin; - char *document_keywords_end; - - const char *document_author_begin; - const char *document_author_end; - - const char *document_changedate_begin; - const char *document_changedate_end; - - const char *body_begin; - const char *body_end; - - char *word_begin; - char *word_end; - - const char *paragraph_begin; - const char *paragraph_end; - - const char *center_begin; - const char *center_end; - - const char *align_left_begin; - const char *align_left_end; - - const char *align_right_begin; - const char *align_right_end; - - const char *justify_begin; - const char *justify_end; - - const char *forced_space; - const char *line_break; - const char *page_break; - - const char *hyperlink_begin; - const char *hyperlink_end; - - const char *imagelink_begin; - const char *imagelink_end; - - const char *table_begin; - const char *table_end; - - const char *table_row_begin; - const char *table_row_end; - - const char *table_cell_begin; - const char *table_cell_end; - - /* Character attributes */ - const char *font_begin; - const char *font_end; - - const char *fontsize_begin; - const char *fontsize_end; - - /* standard font sizes are optional */ - const char *fontsize8_begin; - const char *fontsize8_end; - - const char *fontsize10_begin; - const char *fontsize10_end; - - const char *fontsize12_begin; - const char *fontsize12_end; - - const char *fontsize14_begin; - const char *fontsize14_end; - - const char *fontsize18_begin; - const char *fontsize18_end; - - const char *fontsize24_begin; - const char *fontsize24_end; - - char *fontsize36_begin; - char *fontsize36_end; - - char *fontsize48_begin; - char *fontsize48_end; - - const char *smaller_begin; - const char *smaller_end; - - const char *bigger_begin; - const char *bigger_end; - - const char *foreground_begin; - const char *foreground_end; - - const char *background_begin; - const char *background_end; - - const char *bold_begin; - const char *bold_end; - - const char *italic_begin; - const char *italic_end; - - const char *underline_begin; - const char *underline_end; - - const char *dbl_underline_begin; - const char *dbl_underline_end; - - const char *superscript_begin; - const char *superscript_end; - - const char *subscript_begin; - const char *subscript_end; - - const char *strikethru_begin; - const char *strikethru_end; - - const char *dbl_strikethru_begin; - const char *dbl_strikethru_end; - - const char *emboss_begin; - const char *emboss_end; - - const char *engrave_begin; - const char *engrave_end; - - const char *shadow_begin; - const char *shadow_end; - - const char *outline_begin; - const char *outline_end; - - char *small_caps_begin; - char *small_caps_end; - - const char *pointlist_begin; - const char *pointlist_end; - - const char *pointlist_item_begin; - const char *pointlist_item_end; - - const char *numericlist_begin; - const char *numericlist_end; - - const char *numericlist_item_begin; - const char *numericlist_item_end; - - const char *expand_begin; - const 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 { - const char *bullet; - const char *left_quote; - const char *right_quote; - const char *left_dbl_quote; - const char *right_dbl_quote; - const char *nonbreaking_space; - const char *emdash; - const char *endash; - const char *lessthan; - const char *greaterthan; - const char *amp; - const char *copyright; - const char *trademark; - char *nonbreaking_hyphen; - char *optional_hyphen; - } chars; - - const char **ascii_translation_table; - - int simulate_small_caps : 1; - int simulate_all_caps : 1; - int simulate_word_underline : 1; - - const char **ansi_translation_table; - short ansi_first_char; - short ansi_last_char; - const char **cp437_translation_table; - short cp437_first_char; - short cp437_last_char; - const char **cp850_translation_table; - short cp850_first_char; - short cp850_last_char; - const char **mac_translation_table; - short mac_first_char; - short mac_last_char; -#if 1 /* daved 0.20.0 */ - unsigned int unisymbol1_first_char; - unsigned int unisymbol1_last_char; - const char **unisymbol1_translation_table; - unsigned int unisymbol2_first_char; - unsigned int unisymbol2_last_char; - const char **unisymbol2_translation_table; - unsigned int unisymbol3_first_char; - unsigned int unisymbol3_last_char; - const char **unisymbol3_translation_table; - unsigned int unisymbol4_first_char; - unsigned int unisymbol4_last_char; - const char **unisymbol4_translation_table; -#else -#if 1 /* daved 0.19.4 unicode support */ - short unisymbol1_first_char; - short unisymbol1_last_char; - char **unisymbol1_translation_table; - short unisymbol2_first_char; - short unisymbol2_last_char; - char **unisymbol2_translation_table; - short unisymbol3_first_char; - short unisymbol3_last_char; - char **unisymbol3_translation_table; -#endif -#if 1 /* daved 0.19.5 more unicode support */ - short unisymbol4_first_char; - short unisymbol4_last_char; - char **unisymbol4_translation_table; -#endif -#endif -#if 1 /* daved 0.19.5 SYMBOL font support */ - short symbol_first_char; - short symbol_last_char; - const char **symbol_translation_table; -#endif -#if 1 /* daved 0.20.3 GREEK font support */ - short greek_first_char; - short greek_last_char; - const char **greek_translation_table; -#endif - - char *(*unisymbol_print) (unsigned short); - - void (*write_set_foreground) (int,int,int); -} -OutputPersonality; - - -extern OutputPersonality* op_create(void); -extern void op_free (OutputPersonality*); -#if 1 /* daved - 0.19.6 */ -extern const char* op_translate_char (OutputPersonality*,int,CodepageInfo*,int, int); -#else -extern char* op_translate_char (OutputPersonality*,int,CodepageInfo*,int); -#endif - -extern void op_begin_std_fontsize (OutputPersonality*, int); -extern void op_end_std_fontsize (OutputPersonality*, int); - - -#define _OUTPUT -#endif - diff --git a/plugins/flp_import/unrtf/parse.c b/plugins/flp_import/unrtf/parse.c deleted file mode 100644 index 353ad41de..000000000 --- a/plugins/flp_import/unrtf/parse.c +++ /dev/null @@ -1,472 +0,0 @@ -/*============================================================================= - 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - -#ifdef LMMS_HAVE_CONFIG_H -#include -#endif - -#ifdef LMMS_HAVE_STDIO_H -#include -#endif - -#ifdef LMMS_HAVE_STDLIB_H -#include -#endif - -#ifdef LMMS_HAVE_CTYPE_H -#include -#endif - -#ifdef LMMS_HAVE_STRING_H -#include -#endif - -#include "defs.h" -#include "parse.h" -#include "ur_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 (QBuffer* 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 = f->read(read_buf, buffer_size); - 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 (QBuffer*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 (QBuffer* 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 */ - - /* 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); - - } else if (input_str[0] == '}') { - 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); -} diff --git a/plugins/flp_import/unrtf/parse.h b/plugins/flp_import/unrtf/parse.h deleted file mode 100644 index b8f847679..000000000 --- a/plugins/flp_import/unrtf/parse.h +++ /dev/null @@ -1,45 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: parse.h - * Author name: Zachary 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 - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - - - -#ifndef _WORD -#include "word.h" -#endif - - -extern Word *word_read(QBuffer*); - - - diff --git a/plugins/flp_import/unrtf/ur_malloc.c b/plugins/flp_import/unrtf/ur_malloc.c deleted file mode 100644 index a72ade733..000000000 --- a/plugins/flp_import/unrtf/ur_malloc.c +++ /dev/null @@ -1,133 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: malloc - * Author name: Zachary Smith - * Create date: 01 Aug 01 - * Purpose: Memory management. Allows us to keep track of how - * much memory is being used. - *---------------------------------------------------------------------- - * Changes: - * 14 Aug 01, tuorfa@yahoo.com: added Turbo C support. - * 16 Aug 01, Lars Unger : 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 - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - -#ifdef LMMS_HAVE_CONFIG_H -#include -#endif - -#ifdef LMMS_HAVE_STDIO_H -#include -#endif - -#ifdef LMMS_HAVE_STDLIB_H -#include -#endif - -#ifdef LMMS_HAVE_STRING_H -#include -#endif - -#include "error.h" -#include "ur_malloc.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 = (char *) 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. Called at - * the end of main() when in debug mode. - * 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 (const 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; -} - diff --git a/plugins/flp_import/unrtf/ur_malloc.h b/plugins/flp_import/unrtf/ur_malloc.h deleted file mode 100644 index ac16123b4..000000000 --- a/plugins/flp_import/unrtf/ur_malloc.h +++ /dev/null @@ -1,39 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: malloc - * Author name: Zachary Smith - * Create date: 1 Aug 2001 - * Purpose: Definitions for memory management. - *---------------------------------------------------------------------- - * Changes: - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - -extern char * my_malloc (unsigned long); -extern void my_free (char*); -extern unsigned long total_malloced (void); -extern char * my_strdup (const char*); - diff --git a/plugins/flp_import/unrtf/util.c b/plugins/flp_import/unrtf/util.c deleted file mode 100644 index 474f55a22..000000000 --- a/plugins/flp_import/unrtf/util.c +++ /dev/null @@ -1,72 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: util - * Author name: Zachary Smith - * Create date: 01 Aug 01 - * Purpose: Utility functions. - *---------------------------------------------------------------------- - * Changes: - * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - -#ifdef LMMS_HAVE_CONFIG_H -#include -#endif - -#ifdef LMMS_HAVE_STDLIB_H -#include -#endif - -#ifdef LMMS_HAVE_CTYPE_H -#include -#endif - - - - -/*======================================================================== - * 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; -} - diff --git a/plugins/flp_import/unrtf/util.h b/plugins/flp_import/unrtf/util.h deleted file mode 100644 index 890d66bab..000000000 --- a/plugins/flp_import/unrtf/util.h +++ /dev/null @@ -1,34 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: util - * Author name: Zachary Smith - * Create date: 1 Aug 2001 - * Purpose: Definitions for util module. - *---------------------------------------------------------------------- - * Changes: - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - -extern int h2toi (char *); diff --git a/plugins/flp_import/unrtf/word.c b/plugins/flp_import/unrtf/word.c deleted file mode 100644 index b639d94f5..000000000 --- a/plugins/flp_import/unrtf/word.c +++ /dev/null @@ -1,217 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: word - * Author name: Zachary 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 - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 11 Jan 07, jasp00@users.sourceforge.net: optimized unsafe loop - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - -#ifdef LMMS_HAVE_CONFIG_H -#include -#endif - -#ifdef LMMS_HAVE_STDIO_H -#include -#endif - -#ifdef LMMS_HAVE_STDLIB_H -#include -#endif - -#ifdef LMMS_HAVE_CTYPE_H -#include -#endif - -#ifdef LMMS_HAVE_STRING_H -#include -#endif - -#include "defs.h" -#include "parse.h" -#include "ur_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. This is only called at the end of - * main(), after everything is processed and output complete. - * 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) -{ - if (level) { - /* indent in multiples of 2 */ - level = (level >> 1) + (level & 1); - while (level-- > 0) - printf (". "); - } else { - printf ("\n-----------------------------------------------------------------------\n\n"); - } -} - - - - -/*======================================================================== - * Name: word_dump - * Purpose: Recursive diagnostic routine to print out a tree of words. - * Args: Word tree. - * Returns: None. - *=======================================================================*/ - -void -word_dump (Word *w) -{ - char *s; - - CHECK_PARAM_NOT_NULL(w); - - printf ("\n"); - indent_level += 2; - print_indentation (indent_level); - - while (w) { - s = word_string (w); - if (s) { - printf ("\"%s\" ", s); - } else { - if (w->child) { - 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; -} diff --git a/plugins/flp_import/unrtf/word.h b/plugins/flp_import/unrtf/word.h deleted file mode 100644 index 959b3b2ac..000000000 --- a/plugins/flp_import/unrtf/word.h +++ /dev/null @@ -1,53 +0,0 @@ -/*============================================================================= - GNU UnRTF, a command-line program to convert RTF documents to other formats. - Copyright (C) 2000,2001,2004 by Zachary 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - The maintainer is reachable by electronic mail at daved@physiol.usyd.edu.au -=============================================================================*/ - - -/*---------------------------------------------------------------------- - * Module name: word.h - * Author name: Zachary Smith - * Create date: 1 Sept 2000 - * Purpose: Definitions for Word class. - *---------------------------------------------------------------------- - * Changes: - * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith - * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 - *--------------------------------------------------------------------*/ - -#ifndef _WORD -#define _WORD - -class QBuffer; - -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 (QBuffer*); -extern char* word_string (Word*); -extern void word_dump (Word*); -extern void word_print_html (Word*); - -#define _WORD -#endif diff --git a/src/core/DataFile.cpp b/src/core/DataFile.cpp index 181c6146c..bd426de79 100644 --- a/src/core/DataFile.cpp +++ b/src/core/DataFile.cpp @@ -191,7 +191,7 @@ bool DataFile::validate( QString extension ) extension == "xpf" || extension == "xml" || ( extension == "xiz" && ! pluginFactory->pluginSupportingExtension(extension).isNull()) || extension == "sf2" || extension == "pat" || extension == "mid" || - extension == "flp" || extension == "dll" + extension == "dll" ) ) { return true; diff --git a/src/core/ImportFilter.cpp b/src/core/ImportFilter.cpp index 7b5644721..01f1c5beb 100644 --- a/src/core/ImportFilter.cpp +++ b/src/core/ImportFilter.cpp @@ -1,5 +1,5 @@ /* - * ImportFilter.cpp - base-class for all import-filters (MIDI, FLP etc) + * ImportFilter.cpp - base-class for all import-filters * * Copyright (c) 2006-2014 Tobias Doerffel * diff --git a/src/core/Song.cpp b/src/core/Song.cpp index 52aa8f9e0..376a74349 100644 --- a/src/core/Song.cpp +++ b/src/core/Song.cpp @@ -1170,8 +1170,6 @@ void Song::importProject() ConfigManager::inst()->userProjectsDir(), tr("MIDI sequences") + " (*.mid *.midi *.rmi);;" + - tr("FL Studio projects") + - " (*.flp);;" + tr("Hydrogen projects") + " (*.h2song);;" + tr("All file types") + diff --git a/src/gui/FileBrowser.cpp b/src/gui/FileBrowser.cpp index d3eb22132..f188dfff0 100644 --- a/src/gui/FileBrowser.cpp +++ b/src/gui/FileBrowser.cpp @@ -478,9 +478,6 @@ void FileBrowserTreeWidget::mouseMoveEvent( QMouseEvent * me ) embed::getIconPixmap( "vst_plugin_file" ), this ); break; case FileItem::MidiFile: -// don't allow dragging FLP-files as FLP import filter clears project -// without asking -// case fileItem::FlpFile: new StringPairDrag( "importedproject", f->fullName(), embed::getIconPixmap( "midi_file" ), this ); break; @@ -568,11 +565,6 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it ) } case FileItem::ImportAsProject: - if( f->type() == FileItem::FlpFile && - !gui->mainWindow()->mayChangeProject(true) ) - { - break; - } ImportFilter::import( f->fullName(), Engine::getSong() ); break; @@ -853,7 +845,6 @@ QPixmap * FileItem::s_sampleFilePixmap = NULL; QPixmap * FileItem::s_soundfontFilePixmap = NULL; QPixmap * FileItem::s_vstPluginFilePixmap = NULL; QPixmap * FileItem::s_midiFilePixmap = NULL; -QPixmap * FileItem::s_flpFilePixmap = NULL; QPixmap * FileItem::s_unknownFilePixmap = NULL; @@ -918,12 +909,6 @@ void FileItem::initPixmaps( void ) "midi_file", 16, 16 ) ); } - if( s_flpFilePixmap == NULL ) - { - s_flpFilePixmap = new QPixmap( embed::getIconPixmap( - "midi_file", 16, 16 ) ); - } - if( s_unknownFilePixmap == NULL ) { s_unknownFilePixmap = new QPixmap( embed::getIconPixmap( @@ -951,9 +936,6 @@ void FileItem::initPixmaps( void ) case MidiFile: setIcon( 0, *s_midiFilePixmap ); break; - case FlpFile: - setIcon( 0, *s_flpFilePixmap ); - break; case UnknownFile: default: setIcon( 0, *s_unknownFilePixmap ); @@ -997,11 +979,6 @@ void FileItem::determineFileType( void ) m_type = MidiFile; m_handling = ImportAsProject; } - else if( ext == "flp" ) - { - m_type = FlpFile; - m_handling = ImportAsProject; - } else if( ext == "dll" ) { m_type = VstPluginFile; diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index f6f2ef663..75f478440 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -108,7 +108,7 @@ MainWindow::MainWindow() : sideBar->appendTab( new FileBrowser( confMgr->userProjectsDir() + "*" + confMgr->factoryProjectsDir(), - "*.mmp *.mmpz *.xml *.mid *.flp", + "*.mmp *.mmpz *.xml *.mid", tr( "My Projects" ), embed::getIconPixmap( "project_file" ).transformed( QTransform().rotate( 90 ) ), splitter, false, true ) );