├── CHANGES ├── COPYING ├── DESIGN ├── Makefile ├── README.de ├── README.org ├── THANKS ├── contrib ├── TPP.plist ├── tpp-mode.el └── tpp.vim ├── doc └── tpp.1 ├── examples ├── ac-am.tpp ├── align-footer.tpp ├── bold.tpp ├── colors.tpp ├── colors2.tpp ├── debian-packaging.tpp ├── exec.tpp ├── horline.tpp ├── huge.tpp ├── list.tpp ├── manyslides.tpp ├── shell.tpp ├── shell_eval.tpp ├── slidein.tpp ├── source.tpp ├── test.tpp ├── tpp-features.tpp └── wrap.tpp └── tpp.rb /CHANGES: -------------------------------------------------------------------------------- 1 | 1.3.1: 2 | - added patch by Gregor Herrman to close the boxes 3 | - implemented some kind of auto-advance-after-n-seconds 4 | - added german translation of README, thanks 5 | Thomas Winde and Frank Hofmann 6 | 7 | 1.3: 8 | - implemented text output mode 9 | - implemented (working) LaTeX output mode 10 | - refactored controller/visualizer architecture to be more generic 11 | 12 | 1.2: 13 | - heavily refactored tpp code 14 | - added line wrapping 15 | - added possibility of a footer and a header 16 | - added LinuxDoc SGML output mode 17 | - added reload feature 18 | - added support for transparent terminals 19 | 20 | 1.1.1: 21 | - added version number command line option 22 | 23 | 1.1: 24 | - fixed two spelling mistakes (one reported by Michael Prokop) 25 | - added the possibility to set a custom format string for --date today 26 | - added function check of ncurses-ruby 27 | - fixed white space ignoring after color tag 28 | - added vim syntax file for tpp files 29 | - added new command "--sethugefont" 30 | - added possibility of commenting out lines with --## 31 | 32 | 1.0: 33 | - added manual page 34 | - fixed LaTeX converter 35 | - added horizontal line feature 36 | - --help option 37 | - cursor keys usable from within slides 38 | 39 | 0.2: 40 | - end-of-page notification added 41 | - LaTeX conversion mode added (still incomplete!) 42 | - added help screen 43 | - support for setting colors for foreground and background added 44 | - added possibility to slide in text from all left, right, top and bottom 45 | - added possibility to show slides with border around 46 | - added command line, you can execute system command during the presentation 47 | without change the window. They will be displayed in the slide. 48 | - added the possibility to jump to the start and the end of the slides with one key 49 | - exec-feature, you can execute commands in you slide directly 50 | 51 | 0.1: 52 | initial release 53 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 675 Mass Ave, Cambridge, MA 02139, USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | Appendix: How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 19yy 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) 19yy name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Library General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /DESIGN: -------------------------------------------------------------------------------- 1 | TPP design decisions: 2 | 3 | 1. Visualizers 4 | 5 | The visualization of a slide is done by a visualizer. Visualization in the 6 | context of TPP means outputting it to an output device, e.g. a terminal via 7 | ncurses, a LaTeX source file, a Docbook source file, you name it. The generic 8 | TppVisualizer is the base for all visualizers. Look at the source which 9 | methods you need to implement if you want to write your own visualizer. The 10 | visualizer is also responsible for encapsulating the output device, e.g. 11 | interactive visualizers (like the NcursesVisualizer) also return the user's key 12 | presses. 13 | 14 | 2. Controllers 15 | 16 | The controller controls the correct program flow, utilizing the parser and a 17 | visualizer. The generic TppVisualizer is the base for all visualizers. All 18 | controllers must implement a constructor, and the two methods run and close. 19 | 20 | So far, three types of controllers have been implemented. 21 | 22 | 2.1 InteractiveController 23 | 24 | The InteractiveController feeds the content of the page to the visualizer until 25 | it is told to stop. It then reads the next key press from the visualizer, and 26 | runs the appropriate action. 27 | 28 | 2.2 AutoplayController 29 | 30 | The AutoplayController works like the InteractiveController, with the only 31 | difference that it ignores any information to stop and wait for a key press. It 32 | can be used for unattended presentations. 33 | 34 | 2.3 ConversionController 35 | 36 | The ConversionController is used for non-interactive, non-visual processing, 37 | like converting TPP source into another file format. The "visualizer" is 38 | responsible for producing the appropriate output format. Currently, it is used 39 | for the TextVisualizer and the LatexVisualizer, which generate 40 | text/LaTeX-beamer representations of the presentations they're fed with. 41 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # tpp Makefile by Nico Golde 2 | # Latest Change: Sam Jul 31 00:58:01 CEST 2004 3 | ################################################# 4 | 5 | AUTOMAKE_OPTIONS = foreign 6 | BIN = tpp 7 | prefix=/usr/local 8 | INSPATH= $(prefix)/bin/ 9 | DOCPATH = $(prefix)/share/doc/tpp 10 | MANPATH = $(prefix)/share/man/man1 11 | 12 | all: 13 | @echo "TPP doesn't need to be built. Run \`make install' in order to install it." 14 | 15 | install : 16 | mkdir -p $(DOCPATH) 17 | install -m644 DESIGN CHANGES COPYING THANKS $(DOCPATH) 18 | install -m644 doc/tpp.1 $(MANPATH) 19 | install tpp.rb $(INSPATH)$(BIN) 20 | mkdir -p $(DOCPATH)/contrib 21 | mkdir -p $(DOCPATH)/examples 22 | install -m644 examples/* $(DOCPATH)/examples/ 23 | install -m644 contrib/* $(DOCPATH)/contrib/ 24 | 25 | uninstall : 26 | rm -f $(INSPATH)$(BIN) 27 | rm -rf $(DOCPATH) 28 | rm -f $(MANPATH)/tpp.1* 29 | -------------------------------------------------------------------------------- /README.de: -------------------------------------------------------------------------------- 1 | tpp - Text - Präsentations - Programm 2 | ===================================== 3 | 4 | Was ist tpp? 5 | ------------ 6 | 7 | Tpp steht für Text Präsentations Programm und ist ein ncurses-basierendes 8 | Präsentationswerkzeug. Die Präsentation kann man mit seinem Lieblingseditor 9 | in einem einfachen Beschreibungsformat erstellen und danach in einem xterm 10 | seiner Wahl - welches von ncurses unterstützt wird - vorführen. Das reicht 11 | von einem alten VT 100, einem Linux Framebuffer Terminal bis zum xterm. 12 | 13 | Installation 14 | ------------ 15 | 16 | Voraussetzungen: 17 | * Ruby 1.8 18 | * Eine aktuelle Version der ncurses-Biliothek 19 | * ncurses-ruby 20 | 21 | Zusätzlich: 22 | * FIGlet (für die Darstellung größerer Buchstaben im Textmodus) 23 | 24 | Installation von tpp: 25 | 26 | 1. Debianpaket (ttp.deb) installieren oder 27 | 2. Mit root-Rechten make install eingeben. 28 | 29 | Anwendung von tpp 30 | ----------------- 31 | 32 | Starten von tpp mit der Präsentationdatei, die man anzeigen möchte: 33 | 34 | $ tpp presentation.tpp 35 | 36 | Zur Steuerung von tpp sind folgende Tastenfunktionen verfügbar: 37 | 38 | Leertaste............................... nächster Eintrag innerhalb der Seite 39 | Leertaste, cursor-unten, cursor-rechts.. Bewegung zur nächsten Seite 40 | b, cursor-oben, cursor-links............ Bewegung zur vorherigen Seite 41 | q, Q ................................... tpp beenden 42 | j, J ................................... Direktsprung zur Seite 43 | l, L ................................... Neuladen der laufenden Datei 44 | s, S ................................... Sprung zur Startseite 45 | e, E ................................... Sprung zur letzten Seite 46 | c, C ................................... Start einer Kommandozeile 47 | ?, h ................................... zeige Hilfebildschirm 48 | 49 | Auf der linken unteren Seite des Terminals steht in eckigen Klammern die 50 | laufende Seitennummer und Gesamtseitenzahl. Links davon erscheint ein "*", wenn 51 | das Ende der aktuellen Seite erreicht wurde. Wenn kein "*" sichtbar ist, wurde 52 | die Ausgabe angehalten (durch den Befehl `---`) und kann mit der Leertaste 53 | weitergeschaltet werden. Man kann so mit der Leertaste von Punkt zu Punkt die 54 | gesamte Präsentation vorführen. 55 | 56 | Wenn man die Tasten 'l' (kleines L) oder 'L' drückt, wird die laufende 57 | Präsentation erneut aus der Datei geladen. Dies ist besonders günstig, wenn 58 | man eine tpp-Präsentationen erstellt und dabei eine ständige Vorschau benötigt. 59 | 60 | Schreiben einer tpp-Präsentation 61 | -------------------------------- 62 | 63 | Das Präsentationsformat besteht aus normalen Textzeilen und speziellen 64 | Kommandos. Die Kommandozeilen beginnen immer mit "--", gefolgt von den 65 | speziellen Kommandowörtern. 66 | 67 | Die Präsentation besteht aus einer oder mehreren Seiten, die durch den Befehl 68 | "--newpage" getrennt werden. Vor dem ersten "--newpage"-Kommando kann eine 69 | Zusammenfassung für die gesamte Präsentation stehen. Hier lassen sich der Titel, 70 | Autor und das Datum setzen. Zusätzlich kann jede Seite der Präsentation 71 | benannt werden. Nach dem "--newpage"-Kommando und einem Leerzeichen wird der 72 | Name der nächsten Seite angegeben, falls nicht, wird ein entsprechender Name 73 | automatisch erzeugt. 74 | 75 | 76 | Die folgenden Kommandos sind in der Zusammenfassung erlaubt: 77 | 78 | --author ............... Setzt den Autor der Präsentation 79 | --title ................ Setzt den Titel der Präsentation 80 | --date ................. Setzt das Datum der Präsentation. Mit "today" fügt man 81 | das aktuelle Datum ein. Zusätzlich kann das Datumsformat angegeben werden. 82 | Es entspricht dem Format des date(1)-Befehls und ist in der man-page 83 | dokumentiert (%M %T %J ist voreingestellt). 84 | 85 | --bgcolor ...... Setzt die Hintergrundfarbe. Wird keine Farbe angegeben 86 | (Transparenz), wird der aktuelle Hintergrund des Terminals verwendet. 87 | --fgcolor ...... Setzt die Vordergrundfarbe (Textfarbe) 88 | Gültige Farben sind white (weiß), yellow (gelb), red (rot), green (grün), 89 | blue (blau), cyan (hellblau), magenta (lila), black (schwarz). 90 | 91 | --heading .... Setzt die Kopfzeile für alle Seiten. Die Kopfzeile 92 | wird zentriert und fett dargestellt (wenn es das Terminal zulässt). 93 | 94 | Innerhalb der einzelnen Seiten kann man folgende "page-local"-Befehle verwenden: 95 | 96 | --withborder ........... Darstellung mit Seitenrand 97 | --horline .............. Stellt eine horizontale Linie dar 98 | 99 | --header ........ Fügt eine Kopfzeile ein 100 | --footer ........ Fügt eine Fußzeile ein 101 | 102 | --color ........ Setze eine neue Textfarbe (erlaubte Farben siehe oben) 103 | --left .......... Linksbündige Textdarstellung (Voreinstellung) 104 | --center ........ Zentrierte Textdarstellung 105 | --right ......... Rechtsbündige Textdarstellung 106 | --- .................... Stoppt die Textausgabe, Fortsetzung mit Leertaste 107 | --sleep ...... Stoppt die Ausgabe für Sekunden 108 | 109 | --beginoutput .......... markiert den Anfang des gerahmten Textes 110 | --endoutput ............ markiert das Ende des gerahmten Textes 111 | --beginshelloutput ..... Setzt den Beginn der gerahmten Shellausgabe. 112 | Jede Zeile, die mit einem $ beginnt, erscheint so, als wenn die Buchstaben 113 | direkt eingegeben werden. 114 | --endshelloutput ....... Setzt das Ende der gerahmten Shellausgabe 115 | 116 | --boldon ............... Beginn Text fett 117 | --boldoff .............. Ende Text fett 118 | --revon ................ Beginn der inversen Darstellung 119 | --revoff ............... Ende der inversen Darstellung 120 | --ulon ................. Beginn Text unterstrichen 121 | --uloff ................ Ende Text unterstrichen 122 | 123 | --beginslideleft ....... Beginn einfliegender Text von links 124 | --endslideleft ......... Ende einfliegender Text von links 125 | --beginslideright ...... Beginn einfliegender Text von rechts 126 | --endslideright ........ Ende einfliegender Text von rechts 127 | --beginslidetop ........ Beginn einfliegender Text von oben 128 | --endslidetop .......... Ende einfliegender Text von oben 129 | --beginslidebottom ..... Beginn einfliegender Text von unten 130 | --endslidebottom ....... Ende einfliegender Text von unten 131 | 132 | --huge .......... Der wird in sehr großen Buchstaben dargestellt. 133 | Das Programm FIGlet wird benutzt, um die sehr großen Buchstaben darzustellen 134 | --sethugefont ... Wenn man den --huge Befehl und FIGlet verwendet, wird 135 | mit diesem Befehl die entsprechende FIGlet Schrift ausgewählt (siehe auch 136 | FIGlet man-page). 137 | --exec ........... führt den in angegebenen Befehl aus. Nützlich, 138 | um z.B. einen Bildbetrachter aufzurufen 139 | --## ........... Zeilen auskommentieren 140 | 141 | Beispiele 142 | --------- 143 | 144 | Einige Beispiele, die die Funktionen von tpp demonstrieren, liegen dem 145 | tpp-Programm im Unterverzeichnis examples bei. 146 | 147 | 148 | Optionen 149 | -------- 150 | 151 | tpp --help 152 | zeigt die Hilfe im Textmodus 153 | 154 | tpp -l output input.tpp 155 | Konvertiert die tpp-Datei in eine LaTeX-Datei. Diese Funktion ist 156 | derzeit in Überarbeitung. 157 | 158 | tpp --version 159 | zeigt die tpp-Versionsnummer 160 | 161 | Vim-Syntax-Datei 162 | ---------------- 163 | 164 | Um die Vim-Syntax-Datei zu nutzen, muß die Datei in das Verzeichnis 165 | ~/.vim/syntax kopiert werden. Falls das Verzeichnis noch nicht existiert, muß 166 | es angelegt werden. Danach muß das folgende in die Datei ~/.vim/filetype.vim 167 | eingefügt werden: 168 | 169 | if exists("did_load_filetypes") 170 | finish 171 | endif 172 | augroup filetype detect 173 | au! BufRead,BufNewFile *.tpp setfiletype tpp 174 | augroup END 175 | 176 | Falls der Vim keine Syntaxhervorhebung unterstützt, kann das mit dem Kommando 177 | 178 | syntax on 179 | 180 | aktiviert werden. 181 | 182 | Neben der Datei tpp.vim im Verzeichnis contrib existiert eine weitere, 183 | verbesserte Variante, welche wir aus Lizenzgründen nicht verbreiten können. 184 | Diese Datei kann unter http://www.trish.de/downloads/tpp.vim bezogen werden. 185 | 186 | Übersetzung 187 | ----------- 188 | 189 | letzte Überarbeitung der Übersetzung April 2006 190 | Thomas Winde , Frank Hofmann 191 | 192 | Lizenz 193 | ------ 194 | 195 | ################################################################################ 196 | # # 197 | # tpp - text presentation program # 198 | # Copyright (C) 2004-2005, 2007 Andreas Krennmair , # 199 | # Nico Golde # 200 | # # 201 | # This program is free software; you can redistribute it and/or modify # 202 | # it under the terms of the GNU General Public License as published by # 203 | # the Free Software Foundation; either version 2 of the License, or # 204 | # (at your option) any later version. # 205 | # # 206 | # This program is distributed in the hope that it will be useful, # 207 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 208 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 209 | # GNU General Public License for more details. # 210 | # # 211 | # You should have received a copy of the GNU General Public License # 212 | # along with this program; if not, write to the Free Software # 213 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 214 | # # 215 | ################################################################################ 216 | 217 | -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | * tpp - text presentation program 2 | 3 | ** What is tpp? 4 | 5 | tpp stands for text presentation program and is an ncurses-based 6 | presentation tool. The presentation can be written with your favorite 7 | editor in a simple description format and then shown on any text 8 | terminal that is supported by ncurses - ranging from an old VT100 to 9 | the Linux framebuffer to an xterm. 10 | 11 | ** Installation 12 | 13 | Prerequisites: 14 | * Ruby 1.8 15 | * a recent version of ncurses 16 | * ncurses-ruby 17 | 18 | Optionally: 19 | * FIGlet (if you want to have huge text printed) 20 | 21 | Installing tpp: 22 | 23 | Just get root and type ~make install~ 24 | 25 | ** Using tpp 26 | 27 | Start tpp with the presentation file you would like to display: 28 | 29 | #+BEGIN_EXAMPLE 30 | $ tpp presentation.tpp 31 | #+END_EXAMPLE 32 | 33 | To control tpp, the following keys are available: 34 | #+BEGIN_EXAMPLE 35 | space bar, cursor-down, cursor-right ... display next page 36 | b, cursor-up, cursor-left .............. display previous page 37 | q, Q ................................... quit tpp 38 | j, J ................................... jump directly to page 39 | l, L ................................... reload current file 40 | s, S ................................... jump to the start page 41 | e, E ................................... jump to the last page 42 | c, C ................................... start command line 43 | ?, h ................................... show help screen 44 | #+END_EXAMPLE 45 | 46 | On the lower left side of your terminal you will notice the current slide 47 | number and the total number of slides. Left of that, a '*' will appear when 48 | the end of the current slide has been reached. If no '*' appears, 49 | pressing space bar the next time will show the next entry on the page 50 | (separated by '---'). You are also able to go to the next/previous page at 51 | this point. 52 | 53 | When you press 'l' (lower-case L) or 'L', the file you have currently loaded 54 | into tpp will be reloaded from disk. This is very useful when you write 55 | presentations with tpp, and constantly need a preview. 56 | 57 | [[https://i.imgur.com/dJBxz0x.gif]] 58 | 59 | ** Writing tpp presentations 60 | 61 | The tpp presentation formats consists of normal text lines and special 62 | commands. Special commands are contained in lines that begin with "--" 63 | and the command name. 64 | 65 | The presentation is divided into 1 or more pages, which are separated by 66 | the "--newpage". Before the first "--newpage" is encountered, all 67 | non-command text is used as the presentation's abstract. Here, the 68 | title, the author and the date can be set, too. You can also optionally 69 | specify a name for a page: append it to the "--newpage" command, 70 | separated by a single blank. If no name is set, a name will be 71 | automatically generated. 72 | 73 | The following commands are allowed in the abstract page: 74 | 75 | --author: sets the author of the presentation 76 | 77 | --title: sets the title of the presentation 78 | 79 | --date: sets the date of the presentation. If the date is "today", today's 80 | date is inserted instead. You can set a custom format string if you append 81 | it after "today", separated by a blank. Date formats are like formats for 82 | date(1), and documented in this manual page. If no format string is supplied, 83 | "%b %d %Y" is assumed as default. 84 | 85 | --bgcolor : the background color is set to . 86 | 87 | --fgcolor : the foreground color is set to . 88 | 89 | Valid colors are white, yellow, red, green, blue, cyan, magenta, black and default for transparency. 90 | 91 | Within a page, so-called "page-local" commands can be used. The 92 | following page-local commands are available: 93 | 94 | --heading : draw a heading. Headings will be centered and drawn 95 | in bold (if supported by the terminal). 96 | 97 | --horline: draws a horizontal line in the current line 98 | 99 | --header: adds text to the first line on the screen 100 | 101 | --footer: adds text to the last line on the screen 102 | 103 | --color : draw the text with specified color until a new color is set 104 | 105 | --center : center . The text will be drawn centered. 106 | 107 | --right : draw right-oriented. When drawing the text, it 108 | will be aligned on the right side of the terminal. 109 | 110 | ---: stop drawing until space bar has been pressed. 111 | 112 | --beginoutput: marks the beginning of a framed output 113 | 114 | --endoutput: marks the end of a framed output 115 | 116 | --beginshelloutput: marks the beginning of a framed shell output. The 117 | difference between normal output and shell output is that lines that 118 | start with $,%, or # are printed as if they were typed by a person. 119 | 120 | --endshelloutput: marks the end of a shell output 121 | 122 | --sleep : tpp stops for 3 seconds, doing nothing and accepting 123 | no input. 124 | 125 | --boldon: switches on bold printing 126 | --boldoff: switches off bold printing 127 | 128 | --revon: switches on reverse printing (i.e. reverse fg and bg colors) 129 | --revoff: switches off reverse printing 130 | 131 | --ulon: switches on underlined printing 132 | --uloff: switches off underlined printing 133 | 134 | --huge : is drawn in huge letters. FIGlet is used to 135 | generate the huge letters. 136 | 137 | --sethugefont : If you use --huge FIGlet will use 138 | the specified to generate the huge letters. 139 | You will find the names of the available fonts in the figlet manual. 140 | 141 | --exec : executes . Useful for e.g. starting image viewers. 142 | 143 | --beginslideleft: starts the "slide in from left" mode 144 | --endslideleft: ends the "slide in from left" mode 145 | 146 | --beginslideright: starts the "slide in from right" mode 147 | --endslideright: ends the "slide in from right" mode 148 | 149 | --beginslidetop: starts the "slide in from the top" mode 150 | --endslidetop: ends the "slide in from the top" mode 151 | 152 | --withborder: makes a border around the current page 153 | 154 | --beginslidebottom: starts the "slide in from the bottom" mode 155 | --endslidebottom: ends the "slide in from the bottom" mode 156 | 157 | $$ cmd : append the stdout of executing cmd in the shell 158 | $% cmd : append the stdout of executing cmd in the shell with % at the beginning of every line(useful with --beginshelloutput). 159 | 160 | You can comment lines using --## 161 | 162 | ** Examples 163 | 164 | For a collection of examples that demonstrate the different features 165 | of tpp, please have a look into the examples subdirectory in the tpp 166 | source distribution. 167 | 168 | ** Options: 169 | 170 | tpp --help: displays help in text mode 171 | tpp -l output input.tpp: converts tpp file into a LaTeX slide 172 | tpp --version: displays version number 173 | 174 | The LaTeX slide output option is currently unsupported and will most likely not 175 | work correctly! 176 | 177 | ** Vim syntax file 178 | 179 | To use the vim syntax file you have to copy the tpp.vim file into ~/.vim/syntax/. 180 | If the directory does not exist you have to create it. 181 | In the next step you have to copy the following into ~/.vim/filetype.vim: 182 | 183 | #+BEGIN_EXAMPLE 184 | if exists("did_load_filetypes") 185 | finish 186 | endif 187 | augroup filetype detect 188 | au! BufRead,BufNewFile *.tpp setfiletype tpp 189 | augroup END 190 | #+END_EXAMPLE 191 | 192 | If your vim editor does not use syntax highlighting in the default setup you have to 193 | change to the vim command mode and type: syntax on. 194 | 195 | Beside the tpp.vim in the contrib subdirectory, there's also another, more sophisticated 196 | version, which we unfortunately cannot distribute due to license reason. You can find 197 | this file at http://www.trish.de/downloads/tpp.vim 198 | 199 | ** OSX TextWrangler/BBEdit syntax file 200 | 201 | To use the TextWrangler syntax file you have to copy the TPP.plist 202 | file into ~/Library/Application Support/TextWrangler/Language Modules/. 203 | 204 | ** License 205 | 206 | tpp - text presentation program 207 | 208 | Copyright (C) 2004-2005, 2007 Andreas Krennmair , Nico Golde 209 | 210 | This program is free software; you can redistribute it and/or modify 211 | it under the terms of the GNU General Public License as published by 212 | the Free Software Foundation; either version 2 of the License, or (at 213 | your option) any later version. 214 | 215 | This program is distributed in the hope that it will be useful, but 216 | WITHOUT ANY WARRANTY; without even the implied warranty of 217 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 218 | General Public License for more details. 219 | 220 | You should have received a copy of the GNU General Public License 221 | along with this program; if not, write to the Free Software 222 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 223 | USA 224 | 225 | 226 | 227 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | Sven Guckes, Florian Cramer initial idea of tpp 2 | Patricia Jung for supporting tpp and making the vim syntax file 3 | Gerfried Fuchs for making another vim syntax file 4 | Christian Dietrich for emacs file 5 | Thomas Winde Frank, Frank Hofmann for the German translation of README 6 | -------------------------------------------------------------------------------- /contrib/TPP.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | BBEditDocumentType 14 | CodelessLanguageModule 15 | BBLMColorsSyntax 16 | 17 | BBLMIsCaseSensitive 18 | 19 | BBLMKeywordList 20 | 21 | author 22 | title 23 | date 24 | footer 25 | heading 26 | center 27 | right 28 | sethugefont 29 | huge 30 | exec 31 | newpage 32 | white 33 | yellow 34 | red 35 | white 36 | green 37 | blue 38 | cyan 39 | magenta 40 | black 41 | default 42 | date 43 | bgcolor 44 | fgcolor 45 | boldon 46 | boldoff 47 | ulon 48 | uloff 49 | horline 50 | beginshelloutput 51 | endshelloutput 52 | beginslideleft 53 | endslideleft 54 | color 55 | beginoutput 56 | endoutput 57 | beginslideright 58 | endslideright 59 | beginslidetop 60 | endslidetop 61 | beginslidebottom 62 | endslidebottom 63 | revon 64 | revoff 65 | withborder 66 | sleep 67 | - 68 | -- 69 | & 70 | 71 | BBLMLanguageCode 72 | TPP 73 | BBLMLanguageDisplayName 74 | TPP 75 | BBLMScansFunctions 76 | 77 | BBLMSuffixMap 78 | 79 | 80 | BBLMLanguageSuffix 81 | .tpp 82 | 83 | 84 | BBLMLanguageSuffix 85 | .TPP 86 | 87 | 88 | Language Features 89 | 90 | Close horline 91 | end 92 | Close bond 93 | boldoff 94 | Close list 95 | uloff 96 | Close output 97 | endoutput 98 | end shell 99 | endshellouput 100 | Identifier and Keyword Characters 101 | 123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz. 102 | Begin horline 103 | begin 104 | Begin bond 105 | boldon 106 | Open list 107 | ulon 108 | Begin output 109 | beginoutput 110 | begin shell 111 | beginshellouput 112 | Comment Pattern 113 | (?x: 114 | (?> \( ) | 115 | (?> \- ) | 116 | (?> \) ) | 117 | (?> \[ ) | 118 | (?> \] ) | 119 | (?> \{ ) | 120 | (?> \} ) | 121 | (?> \http ) | 122 | (?> \: ) | 123 | (?> \@ ) | 124 | (?> -> ) | 125 | (?> \# .* $ ) | 126 | (?> \-\-\- .* $ ) | 127 | (?> \#\# (?s:.*?) (?: \#\# | \z )) 128 | ) 129 | Open Line Comments 130 | -- 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /contrib/tpp-mode.el: -------------------------------------------------------------------------------- 1 | ;; tpp-mode.el - An Major mode for Emacs to editing TextPraesentionProgramm (tpp) - Files 2 | 3 | ;; Filename: tpp-mode.el 4 | ;; Author: Christian Dietrich 5 | ;; Version: 0.1 6 | ;; License: GNU General Public License 7 | 8 | ;; Installation: 9 | ;; 10 | ;; 1) Optionally, byte-compile this file 11 | ;; 2) Put this file in a directory Emacs can find 12 | ;; 3) Tell Emacs when to load this file 13 | ;; 4) Customize some variables for your system 14 | ;; 15 | ;; ad 1) 16 | ;; Byte-compilation speeds up the load time for this mode 17 | ;; and is therefore recommended. Just load this file into 18 | ;; Emacs and select "Byte-compile This File" from the 19 | ;; "Emacs-Lisp" main menu. This will create the compiled 20 | ;; file with the extension "elc". 21 | ;; 22 | ;; ad 2) 23 | ;; The directories that Emacs searches are given by the 24 | ;; load-path variable, which you can query within Emacs with 25 | ;; ESC-x describe-variable RET load-path Ret 26 | ;; To add a directory (eg. ~/.emacs) to load-path, add 27 | ;; the following code to your $HOME/.emacs file: 28 | ;; (add-to-list 'load-path "~/elisp") 29 | ;; 30 | ;; ad 3) 31 | ;; Add the following lines to your $HOME/.emacs file: 32 | ;; (autoload 'tpp-mode "tpp-mode" "TPP mode." t) 33 | ;; (add-to-list 'auto-mode-alist '("\\.tpp$" . tpp-mode)) 34 | ;; The first line tells Emacs to load tpp-mode.elc or 35 | ;; tpp-mode.el when the command 'tpp-mode' is called. 36 | ;; The second line tells emacs to invoke the command 'tpp-mode' 37 | ;; when a file with a name ending on ".tpp" is opened. 38 | ;; 39 | ;; ad 4) 40 | ;; Some variables might need adjustment to your local system 41 | ;; environment. You can do it in your $HOME/.emacs file with 42 | ;; commands like 43 | ;; (setq tpp-command "xterm -e tpp") 44 | ;; (setq tpp-helpcommand "cat /usr/local/share/doc/tpp/README | xless") 45 | ;; You can also set these variables interactively from the 46 | ;; entry "Options" in the "TPP" main menu that is created 47 | ;; when tpp-mode is entered. 48 | ;; 49 | ;; History: 50 | ;; 28.02.2005 Initial Release for Emacs 51 | ;; Thanks to: 52 | ;; 53 | ;; Christoph Dalitz: 54 | ;; He wrte the mgp-mode-cd.el, on which this script is based, Thanks 55 | 56 | 57 | (defcustom tpp-mode-hook '() 58 | "*Hook for customising `tpp-mode'." 59 | :type 'hook 60 | :group 'Tpp) 61 | 62 | ;; custom variables 63 | (defcustom tpp-command "xterm -e tpp" 64 | "tpp command line. 65 | Must be adjusted according to the compilation options, 66 | eg." 67 | :group 'Tpp) 68 | (defcustom tpp-helpcommand "cat /usr/local/share/doc/tpp/README | xless" 69 | "Command for display of TPP syntax documentation." 70 | :group 'Tpp) 71 | 72 | ;; shortcut key bindings 73 | (defvar tpp-mode-map 74 | (let ((map (make-sparse-keymap))) 75 | (define-key map (kbd "C-c C-b") 'tpp-preview-file) 76 | (define-key map (kbd "C-c C-c") 'tpp-comment-region) 77 | (define-key map (kbd "C-c C-u") 'tpp-uncomment-region) 78 | map) 79 | "Mode map used for `tpp-mode'.") 80 | 81 | ;; main menu entry 82 | (easy-menu-define 83 | tpp-mode-menu tpp-mode-map 84 | "Menu for `tpp-mode'." 85 | '("TPP" 86 | ["Preview Buffer" tpp-preview-file ] 87 | ["Comment Region" tpp-comment-region ] 88 | ["Uncomment Region" tpp-uncomment-region ] 89 | ["Syntax Help" (shell-command tpp-helpcommand) ] 90 | ["Options" (customize-group "Tpp") ] 91 | )) 92 | 93 | ;; Syntax Higlighting 94 | (defvar tpp-mode-font-lock-keywords nil 95 | "Tpp keywords used by font-lock.") 96 | (if tpp-mode-font-lock-keywords () 97 | (let () 98 | (setq tpp-mode-font-lock-keywords 99 | (list 100 | ;; comments 101 | (cons "^--##.*" 'font-lock-comment-face) 102 | ;;Abstract - Options 103 | (cons "^--author.*" 'font-lock-keyword-face) 104 | (cons "^--title.*" 'font-lock-keyword-face) 105 | (cons "^--date.*" 'font-lock-keyword-face) 106 | ;; Local - Option 107 | (cons "^--heading.*" 'font-lock-constant-face) 108 | (cons "^--center.*" 'font-lock-constant-face) 109 | (cons "^--right.*" 'font-lock-constant-face) 110 | (cons "^--sleep.*" 'font-lock-constant-face) 111 | (cons "^--exec.*" 'font-lock-constant-face) 112 | (cons "^--huge.*" 'font-lock-constant-face) 113 | (cons "^--newpage.*" 'font-lock-constant-face) 114 | (cons "^--huge.*" 'font-lock-constant-face) 115 | ;; other format parameters 116 | (cons "^--.*" 'font-lock-builtin-face) 117 | )) 118 | )) 119 | 120 | 121 | 122 | ;; Functions 123 | (defun tpp-preview-file () 124 | "Previews current file with tpp" 125 | (interactive) 126 | (save-buffer) 127 | (shell-command 128 | (format "%s %s" tpp-command (shell-quote-argument buffer-file-name)))) 129 | 130 | (defun tpp-comment-region (start end) 131 | "Comments out the current region with '--## '." 132 | (interactive "r") 133 | (goto-char end) (beginning-of-line) (setq end (point)) 134 | (goto-char start) (beginning-of-line) (setq start (point)) 135 | (let () 136 | (save-excursion 137 | (save-restriction 138 | (narrow-to-region start end) 139 | (while (not (eobp)) 140 | (insert "--## ") 141 | (forward-line 1))))) 142 | ) 143 | 144 | (defun tpp-uncomment-region (start end) 145 | "Remove '--## ' comments from current region." 146 | (interactive "r") 147 | (goto-char end) (beginning-of-line) (setq end (point)) 148 | (goto-char start) (beginning-of-line) (setq start (point)) 149 | (let ((prefix-len '5)) 150 | (save-excursion 151 | (save-restriction 152 | (narrow-to-region start end) 153 | (while (not (eobp)) 154 | (if (string= "--## " 155 | (buffer-substring 156 | (point) (+ (point) prefix-len))) 157 | (delete-char prefix-len)) 158 | (forward-line 1))))) 159 | ) 160 | 161 | ;; The Modi Function 162 | (defun tpp-mode () 163 | "Major mode for editing tpp source. 164 | Comments etc. are highlighted with font-lock. There are also a 165 | number of commands that make editing and working with TPP files 166 | more convenient. These commands are available from the main menu 167 | `TPP' or via the following shortcuts: 168 | 169 | \\[tpp-preview-file] - Run tpp on the current file. 170 | \\[tpp-comment-region] - Comments out the current region. 171 | \\[tpp-uncomment-region] - Uncomments the current region. 172 | " 173 | (interactive) 174 | (kill-all-local-variables) 175 | (setq major-mode 'tpp-mode) 176 | (setq mode-name "tpp") 177 | (use-local-map tpp-mode-map) 178 | (make-local-variable 'font-lock-defaults) 179 | (easy-menu-add tpp-mode-menu tpp-mode-map) 180 | (if (string-match "XEmacs\\|Lucid" emacs-version) 181 | (progn (make-face 'font-lock-builtin-face) 182 | (copy-face 'font-lock-preprocessor-face 'font-lock-builtin-face))) 183 | 184 | (setq font-lock-defaults '(tpp-mode-font-lock-keywords 185 | t t ((?_ . "w") (?. . "w")))) 186 | ;; let ispell skip '--'-directives 187 | (make-local-variable 'ispell-skip-region-alists) 188 | (add-to-list 'ispell-skip-region-alist (list "^--.*$")) 189 | ;; Hook ablaufen lassen 190 | (run-hooks 'tpp-mode-hook) 191 | ) 192 | ;; End of tpp-mode.el -------------------------------------------------------------------------------- /contrib/tpp.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: tpp - Text Presentation Program 3 | " Maintainer: Gerfried Fuchs 4 | " Filenames: *.tpp 5 | " Last Change: 24. February 2005 6 | " URL: http://alfie.ist.org/projects/vim/syntax/tpp.vim 7 | " License: BSD 8 | " 9 | " Comments are very welcome - but please make sure that you are commenting on 10 | " the latest version of this file. 11 | " SPAM is _NOT_ welcome - be ready to be reported! 12 | 13 | " For version 5.x: Clear all syntax items 14 | " For version 6.x: Quit when a syntax file was already loaded 15 | if version < 600 16 | syntax clear 17 | elseif exists("b:current_syntax") 18 | finish 19 | endif 20 | 21 | if !exists("main_syntax") 22 | let main_syntax = 'tpp' 23 | endif 24 | 25 | 26 | "" list of the legal switches/options 27 | syn match tppAbstractOptionKey contained "^--\%(author\|title\|date\|footer\|header\) *" nextgroup=tppString 28 | syn match tppPageLocalOptionKey contained "^--\%(heading\|center\|right\|huge\|sethugefont\|exec\) *" nextgroup=tppString 29 | syn match tppPageLocalSwitchKey contained "^--\%(horline\|-\|\%(begin\|end\)\%(\%(shell\)\?output\|slide\%(left\|right\|top\|bottom\)\)\|\%(bold\|rev\|ul\)\%(on\|off\)\|withborder\)" 30 | syn match tppNewPageOptionKey contained "^--newpage *" nextgroup=tppString 31 | syn match tppColorOptionKey contained "^--\%(\%(bg\|fg\)\?color\) *" 32 | syn match tppTimeOptionKey contained "^--sleep *" 33 | 34 | syn match tppString contained ".*" 35 | syn match tppColor contained "\%(white\|yellow\|red\|green\|blue\|cyan\|magenta\|black\|default\)" 36 | syn match tppTime contained "\d\+" 37 | 38 | syn region tppPageLocalSwitch start="^--" end="$" contains=tppPageLocalSwitchKey oneline 39 | syn region tppColorOption start="^--\%(\%(bg\|fg\)\?color\)" end="$" contains=tppColorOptionKey,tppColor oneline 40 | syn region tppTimeOption start="^--sleep" end="$" contains=tppTimeOptionKey,tppTime oneline 41 | syn region tppNewPageOption start="^--newpage" end="$" contains=tppNewPageOptionKey oneline 42 | syn region tppPageLocalOption start="^--\%(heading\|center\|right\|huge\|sethugefont\|exec\)" end="$" contains=tppPageLocalOptionKey oneline 43 | syn region tppAbstractOption start="^--\%(author\|title\|date\|footer\)" end="$" contains=tppAbstractOptionKey oneline 44 | 45 | if main_syntax != 'sh' 46 | " shell command 47 | if version < 600 48 | syn include @tppShExec :p:h/sh.vim 49 | else 50 | syn include @tppShExec syntax/sh.vim 51 | endif 52 | unlet b:current_syntax 53 | 54 | syn region shExec matchgroup=tppPageLocalOptionKey start='^--exec *' keepend end='$' contains=@tppShExec 55 | 56 | endif 57 | 58 | syn match tppComment "^--##.*$" 59 | 60 | " Define the default highlighting. 61 | " For version 5.7 and earlier: only when not done already 62 | " For version 5.8 and later: only when an item doesn't have highlighting yet 63 | if version >= 508 || !exists("did_tpp_syn_inits") 64 | if version < 508 65 | let did_tpp_syn_inits = 1 66 | command -nargs=+ HiLink hi link 67 | else 68 | command -nargs=+ HiLink hi def link 69 | endif 70 | 71 | HiLink tppAbstractOptionKey Special 72 | HiLink tppPageLocalOptionKey Keyword 73 | HiLink tppPageLocalSwitchKey Keyword 74 | HiLink tppColorOptionKey Keyword 75 | HiLink tppTimeOptionKey Comment 76 | HiLink tppNewPageOptionKey PreProc 77 | HiLink tppString String 78 | HiLink tppColor String 79 | HiLink tppTime Number 80 | HiLink tppComment Comment 81 | HiLink tppAbstractOption Error 82 | HiLink tppPageLocalOption Error 83 | HiLink tppPageLocalSwitch Error 84 | HiLink tppColorOption Error 85 | HiLink tppNewPageOption Error 86 | HiLink tppTimeOption Error 87 | 88 | delcommand HiLink 89 | endif 90 | 91 | let b:current_syntax = "tpp" 92 | 93 | " vim: ts=8 sw=2 94 | -------------------------------------------------------------------------------- /doc/tpp.1: -------------------------------------------------------------------------------- 1 | .TH TPP "1" "April 2007" "tpp 1.3.1" "User Commands" 2 | .SH NAME 3 | TPP - Text Presentation Program 4 | .SH SYNOPSIS 5 | .B tpp 6 | <\fIOPTIONS\fR> <\fIFILE\fR> 7 | .SH DESCRIPTION 8 | .PP 9 | Tpp stands for text presentation program and is an ncurses-based 10 | presentation tool. The presentation can be written with your favorite 11 | editor in a simple description format and then shown on any text 12 | terminal that is supported by ncurses - ranging from an old VT100 to the 13 | Linux framebuffer to an xterm. 14 | 15 | It supports color, various output modes, sliding in text, command prompt, 16 | LaTeX conversion and more. 17 | .SH OPTIONS 18 | .TP 19 | -h/--help display help 20 | .TP 21 | -l output.tex input.tpp converts tpp slides into tex 22 | .TP 23 | -v/--version display version number 24 | 25 | .SH KEYS 26 | .TP 27 | space 28 | display next entry within page 29 | .TP 30 | space, cursor-down, cursor-right 31 | display next page 32 | .TP 33 | b, cursor-up, cursor-left 34 | display previous page 35 | .TP 36 | q, Q 37 | quit tpp 38 | .TP 39 | j, J 40 | jump directly to page 41 | .TP 42 | s, S 43 | jump to the start page 44 | .TP 45 | e, E 46 | jump to the last page 47 | .TP 48 | c, C 49 | start command line 50 | .PP 51 | .SH WRITING PRESENTATIONS 52 | The tpp presentation formats consists of normal text lines and special 53 | commands. Special commands are contained in lines that begin with "--" 54 | and the command name. 55 | 56 | See /usr/share/doc/tpp/README for complete list of command names, and 57 | /usr/share/doc/tpp/examples for TPP presentation examples, including 58 | presentation slides that have been in real-life presentations. 59 | 60 | .SH VIM SYNTAX FILE 61 | In /usr/share/doc/tpp/contrib you'll find a syntax file for the vim editor. 62 | See /usr/share/doc/tpp/README for installation instructions. 63 | 64 | .SH AUTHOR CONTACT 65 | Tpp was written by Nico Golde and Andreas Krennmair 66 | -------------------------------------------------------------------------------- /examples/ac-am.tpp: -------------------------------------------------------------------------------- 1 | --title autoconf und automake 2 | --author Andreas Krennmair 3 | --date today 4 | Praktisch jede Software unter Linux wird mit ./configure ; make ; make 5 | install konfiguriert, compiliert und installiert. Ich möchte heute 6 | zeigen, wie man selbst mit Autoconf und Automake den Konfigurations- und 7 | Übersetzungsprozess automatisieren kann, und was das für portable 8 | Software bringen kann. 9 | --newpage agenda 10 | --heading Agenda 11 | 12 | * Einführung 13 | 14 | * Makefiles 15 | 16 | * Autoconf alleine 17 | 18 | * Autoconf und Automake 19 | --newpage intro 20 | --heading Einführung: Geschichte der automatisierten Compilierung unter Unix 21 | 22 | * Anfangs: Shellskripte namens make im Sourceverzeichnis (bis Unix V6) 23 | * Ab Unix V7: Programm make, Information aus Datei makefile 24 | * makefile enthält Informationen, welchen Dateien (Targets) aus welchen 25 | Dateien (Dependencies) erzeugt werden, und welche Kommandos dazu 26 | aufgerufen werden müssen. 27 | * Makefiles funktionierten anfangs ganz gut, bis die ersten Unix- 28 | Varianten erschienen, die subtil anders als die bisherigen Unixe waren. 29 | Software sollte aber portabel bleiben. 30 | * Einfache Lösung: ein Target pro Zielplattform. 31 | * Nachteil: bei mehr Plattformen ansteigender Wartungsaufwand 32 | --newpage intro-conf 33 | --heading Einführung: erste automatisierte Konfiguration 34 | 35 | * Makefile-Lösung hörte auf zu skalieren, als immer mehr und immer 36 | obskurere Unix-Varianten auftauchten, auf die die Entwickler von 37 | Software noch dazu keinen Zugriff mehr hatten. 38 | * Erste Lösung Mitte bis Ender der 80er Jahre: Configure 39 | * Larry Wall wollte, dass seine Software (insbesondere Perl) portabel 40 | auf möglichst vielen Unix-Plattformen läuft. 41 | * Schreib Shellskript Configure, das Informationen über das System 42 | sammelte, und aus *.SH-Dateien dementsprechende Dateien generierte 43 | (Makefile.SH -> Makefile) 44 | * Vorteil: Perl konnte ohne grossen Portierungsaufwand auf vielen, 45 | tewilweise recht obskuren Unix-Systemen betrieben werden. 46 | --newpage intro-gnu 47 | --heading Einführung: Konfiguration für GNU 48 | 49 | * GNU-Software sollte möglichst portabel sein 50 | * GNU-Projekt griff Larry Wall's Idee auf, und realisierte im 51 | wesentlichen zwei Frameworks, um das Konfigurieren und Übersetzen von 52 | GNU-Software möglichst portabel und einfach wartbar zu halten. 53 | * Konfiguration: autoconf 54 | * Übersetzung: automake 55 | * Status heute: Autoconf und Automake sind ein Quasi-Standard bei Freier 56 | Software/Open Source 57 | --newpage makefiles 58 | --heading Einfache Makefiles 59 | 60 | Makefiles bestehen im wesentlichen aus zwei Bereichen: 61 | 62 | * Variablendefinitionen 63 | * Zieldefinitionen 64 | 65 | Variablen werden verwendet, um gleiche "Textbausteine", die öfters im 66 | Makefile vorkommen, zusammenzufassen und parametrisierbar zu machen, z.B. 67 | Compilerkommandos, Compilerflags, Ausgabedatei, ... 68 | 69 | Zieldefinitionen geben an, welche Datei erzeugt werden soll, von welchen 70 | Dateien diese Datei abhängig ist, und mit welchem Kommando die Datei aus 71 | diesen Abhängigkeiten erzeugt wird. Diese Zieldefinition definiert ein 72 | sog. "Target". Wird ein Target aufgerufen, so wird das Kommando nur 73 | ausgeführt, wenn die zu generierende Datei noch nicht existiert, oder wenn 74 | eine der Abhängigkeiten erst generiert werden muss, oder wenn eine der 75 | Abhängigkeiten neuer ist als die bestehende Datei So werden unnötige 76 | Compile-Vorgänge vermieden. 77 | --newpage example1 78 | --heading Beispiel 1: einfaches Makefile 79 | 80 | --beginoutput 81 | # Kommentar 82 | LATEX=pdflatex # Variablendefinition 83 | 84 | ac-am.pdf: ac-am.tex # Zieldefinition 85 | $(LATEX) ac-am.tex # Kommando 86 | --endoutput 87 | --newpage example2 88 | --heading Beispiel 2: gleichartige Targets zusammenfassen 89 | 90 | --beginoutput 91 | LATEX=pdflatex 92 | RM=rm -f 93 | PDFFILES=ac-am.pdf 94 | 95 | all: $(PDFFILES) 96 | 97 | %.pdf: %.tex 98 | $(LATEX) $< 99 | 100 | clean: 101 | $(RM) $(PDFFILES) *.aux *.log 102 | --endoutput 103 | --newpage 104 | --heading Beispiel 3: modulares C-Programm übersetzen 105 | 106 | --beginoutput 107 | CC=gcc 108 | CFLAGS=-Os -Wall 109 | OBJS=foo.o bar.o baz.o quux.o 110 | OUTPUT=xyzzy 111 | 112 | all: $(OUTPUT) 113 | $(OUTPUT): $(OBJS) 114 | $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT) $(OJBS) $(LIBS) 115 | 116 | %.o: %.c 117 | $(CC) $(CFLAGS) $(DEFINES) -c $< 118 | 119 | clean: 120 | $(RM) $(OBJS) $(OUTPUT) core *.core 121 | .PHONY: all clean 122 | --endoutput 123 | --newpage limitations 124 | --heading Limtationen von Makefiles 125 | 126 | Makefiles funktionieren zwar bei kleineren, einfachen Programmen, wer 127 | jedoch größere, portable Software schreiben will, stößt mit make und 128 | Makefiles schnell an Grenzen. 129 | 130 | Die Unterschied zwischen den einzelnen Unix-Systemen sind z.B. folgende: 131 | 132 | * Strukturen unterscheiden sich 133 | * Funktionen sind unterschiedlich deklariert 134 | * #defines sind anders benannt oder existieren nicht 135 | * Manche Funktionen sind nicht mehr in der libc, sondern in externe 136 | Libraries ausgelagert (z.B. Sockets nach libsocket). 137 | 138 | Auf diese Unterschiede kann make nicht eingehen. Deswegen muss man einen 139 | Konfigurationsmechanismus einführen, der dies kann. 140 | --newpage autoconf1 141 | --heading Autoconf, Schritt 1: configure-Skript erzeugen 142 | 143 | Autoconf bietet die Möglichkeit, auf eine große Anzahl von Kommandos und 144 | Tests zurückzugreifen, um möglichst alle relevanten Systemparameter 145 | abzurufen. Diese Tests werden in einer Datei configure.in abgelegt, aus 146 | dem dann mit dem Kommando autoconf die Datei configure erzeugt wird. Mit 147 | dem Kommando autoheader wird die Datei config.h.in erzeugt. 148 | 149 | Ruft man ./configure auf, so sammelt das configure-Skript die 150 | Konfigurationsinformationen, und generiert aus config.h.in die Datei 151 | config.h sowie alle in configure.in angegebenen zu konfigurierenden 152 | Dateien, das ist meistens Makefile.in, aus der Makefile erzeugt wird. 153 | 154 | Die configure.in-Datei lässt sich übrigens erzeugen, indem man autoscan 155 | aufruft, und die resultierende Datei configure.scan in configure.in 156 | umbenennt. 157 | --newpage autoconf2 158 | --heading Autoconf, Schritt 2: Makefile.in erstellen 159 | 160 | Die Datei Makefile.in wird wie ein normales Makefile geschrieben, 161 | mit dem Unterschied, dass für bestimmte Variablen, deren Wert vom 162 | configure-Skript bestimmt werden, spezielle Platzhalter eingefügt 163 | werden. Das sieht dann z.B. so aus: 164 | --beginoutput 165 | CC=@CC@ 166 | CFLAGS=@CFLAGS@ @DEFS@ 167 | LDFLAGS=@LDFLAGS@ 168 | LIBS=@LIBS@ 169 | --endoutput 170 | 171 | Der Rest des Makefile sieht wie ein normales Makefile aus. Um auf 172 | sämtliche ermittelten Parameter zugreifen zu können, müssen die 173 | einzelnen C-Sourcefiles nur noch die Datei config.h inkludieren. 174 | Damit ist Autoconf vollständig integriert und das Buildsystem darauf 175 | angepasst. 176 | --newpage autoconf3 177 | --heading Autoconf, Zusammenfassung 178 | 179 | In einer Minute zur Sourcekonfiguration mit Autoconf: 180 | --beginshelloutput 181 | $ autoscan && mv configure.scan configure.in 182 | --- 183 | $ $EDITOR configure.in 184 | --- 185 | $ autoconf 186 | --- 187 | $ autoheader 188 | --- 189 | $ $EDITOR Makefile.in 190 | --endshelloutput 191 | 192 | Fertig! 193 | --newpage confex1 194 | --heading Beispiel für configure.in (1) 195 | 196 | --beginoutput 197 | AC_PREREQ(2.57) 198 | AC_INIT(akpop3d, 0.7.7, ak@synflood.at) 199 | AC_CONFIG_SRCDIR([authenticate.c]) 200 | AC_CONFIG_HEADER([config.h]) 201 | 202 | # Checks for programs. 203 | AC_PROG_CC 204 | AC_PROG_INSTALL 205 | --endoutput 206 | --newpage confex2 207 | --heading Beispiel für configure.in (2) 208 | 209 | --beginoutput 210 | # Checks for header files. 211 | AC_HEADER_STDC 212 | AC_HEADER_SYS_WAIT 213 | AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h 214 | netinet/in.h shadow.h stdlib.h string.h sys/file.h 215 | sys/socket.h sys/time.h syslog.h unistd.h]) 216 | 217 | # Checks for typedefs, structures, and compiler 218 | # characteristics. 219 | AC_C_CONST 220 | AC_TYPE_UID_T 221 | AC_TYPE_OFF_T 222 | AC_TYPE_PID_T 223 | AC_TYPE_SIZE_T 224 | AC_HEADER_TIME 225 | --endoutput 226 | --newpage confex3 227 | --heading Beispiel für configure.in (3) 228 | --beginoutput 229 | # Checks for library functions. 230 | AC_FUNC_ALLOCA 231 | AC_FUNC_FORK 232 | AC_FUNC_REALLOC 233 | AC_FUNC_SELECT_ARGTYPES 234 | AC_FUNC_STAT 235 | AC_CHECK_FUNCS([atexit dup2 getspnam inet_ntoa 236 | memchr memset select socket strchr strerror 237 | strncasecmp strrchr]) 238 | 239 | AC_CONFIG_FILES([Makefile]) 240 | AC_OUTPUT 241 | --endoutput 242 | --newpage functions 243 | --heading Weitere nützliche Autoconf-Funktionen 244 | 245 | * AC_CHECK_LIB(library,symbol): wenn symbol in Library library 246 | gefunden wird, wird -llibrary zu den LDFLAGS hinzugefügt und 247 | HAVE_LIBLIBRARY=1 in config.h definiert. 248 | * AC_DEFINE([KEY],[VALUE]): in config.h wird #define KEY VALUE 249 | eingetragen. 250 | * AC_ARG_WITH(option,[beschreibung]): das configure-Skript um 251 | eine --with-option Option erweitern. 252 | * AC_ARG_ENABLE(option,[beschreibung]): das configure-Skript um 253 | eine --enable-option Option erweitern. 254 | --newpage funcex1 255 | --heading Beispiele zu nützlichen Autoconf-Funktionen 256 | 257 | --beginoutput 258 | AC_ARG_WITH(openssl, [ --with-openssl use OpenSSL]) 259 | if test "$with_openssl" != "no" ; then 260 | AC_CHECK_LIB(crypto,BIO_new) 261 | AC_CHECK_LIB(ssl,SSL_new) 262 | fi 263 | AC_ARG_ENABLE(rfc2449, [ --enable-rfc2449 enable RFC 2449 support]) 264 | if test "$enable_rfc2449" != "no" ; then 265 | AC_DEFINE([ENABLE_RFC2449],[1],[rfc2449]) 266 | fi 267 | --endoutput 268 | --newpage funcauto 269 | --heading Funktionsweise von Autoconf 270 | 271 | * Vorgefertige Tests in Form von m4-Makros verfügbar 272 | * Autoconf lässt configure.in durch m4 laufen, daraus entsteht 273 | configure-Skript, was nicht anders als ein Shellskript ist. 274 | * -> man kann durch Einfügen von eigenem Shellcode eigene Tests 275 | durchführen. 276 | * -> oder man greift auf http://ac-archive.sourceforge.net/ zurück, 277 | einem umfangreichen Archiv von hunderten Autoconf-Macros. 278 | 279 | --beginoutput 280 | if test x`uname -s` = "xDarwin" ; then 281 | AC_DEFINE([HAVE_DARWIN],[1],[define whether we have Darwin]) 282 | fi 283 | --endoutput 284 | --newpage macroself 285 | --heading Autoconf-Makros selbst schreiben 286 | 287 | Autoconf-Makros sind ein Mischmasch aus m4-Skript und Shellskript. 288 | 289 | --beginoutput 290 | AC_DEFUN([AC_C_LONG_LONG], 291 | [AC_CACHE_CHECK(for long long int, ac_cv_c_long_long, 292 | [if test "$GCC" = yes; then 293 | ac_cv_c_long_long=yes 294 | else 295 | AC_TRY_COMPILE(,[long long int i;], 296 | ac_cv_c_long_long=yes, 297 | ac_cv_c_long_long=no) 298 | fi]) 299 | if test $ac_cv_c_long_long = yes; then 300 | AC_DEFINE(HAVE_LONG_LONG) 301 | fi 302 | ]) 303 | --endoutput 304 | --newpage automake1 305 | --heading Automake: Einführung 306 | 307 | Automake ist dafür gedacht, den eigentlichen Übersetzungsprozess so weit 308 | wie möglich zu vereinfachen, und dem User das Schreiben von eigenen 309 | Makefile.in's abzunehmen. Automake setzt Autoconf voraus. 310 | 311 | Die Makefile.am-Datei besteht wie ein Makefile aus Targets, die quasi 312 | beliebig benannt werden können, und alle Kommandos enthalten wie auch 313 | ein Target in einem Makefile oder Makefile.in. 314 | 315 | Zusätzlich existieren eine Reihe von speziellen Variablen, mit denen das 316 | Übersetzen von Software einfacher wird. 317 | 318 | --beginoutput 319 | bin_PROGRAMS = hello 320 | hello_SOURCES = hello.c main.c 321 | EXTRA_DIST = hello.h 322 | --endoutput 323 | --newpage autocmd 324 | --heading Automake: mehr Kommandos 325 | 326 | --beginshelloutput 327 | $ $EDITOR Makefile.am 328 | --- 329 | $ autoscan && mv configure.scan configure.in 330 | --- 331 | $ autoheader 332 | --- 333 | $ aclocal 334 | --- 335 | AM_INIT_AUTOMAKE(programname,version) in configure.in eintragen. 336 | --- 337 | $ automake -a 338 | --- 339 | $ autoconf 340 | --- 341 | $ ls -l Makefile.in configure 342 | -rw-r--r-- 1 ak staff 16048 16 Mar 20:03 Makefile.in 343 | -rwxr-xr-x 1 ak staff 123354 16 Mar 20:03 configure 344 | $ 345 | --endshelloutput 346 | --newpage primaries 347 | --heading Automake: Primaries 348 | 349 | Die _PROGRAMS; _SOURCES, etc. Suffixe, die vorher gesehen haben, nennen 350 | sich übrigen "Primaries". Weitere Primaries sind z.B.: 351 | 352 | * DATA: gibt Datendateien an, die 1:1 mitinstalliert, ansonsten aber 353 | ignoriert werden. 354 | * HEADER: damit werden Headerfiles spezifiziert, die zusammen mit 355 | Libraries installiert werden sollen. 356 | * SCRIPTS: ausführbare Skripte, die ebenfalls installiert werden, 357 | jedoch nicht compiliert oder gestripped werden. 358 | * MANS: gibt Manpages an, die ebenfalls mitinstalliert werden. 359 | 360 | Die Grundbedürfnisse für einfache und problemlose Konfigurations-, 361 | Übersetzungs- und Installationsroutinen wäre damit gedeckt. 362 | --newpage recam 363 | --heading Rekursives Automake 364 | 365 | Um den Inhalt von Unterverzeichnissen in den Automake-Vorgang 366 | miteinzubeziehen, muss man lediglich alle relevanten Unterverzeichnisse 367 | über die SUBDIRS-Variable angeben. 368 | 369 | --beginoutput 370 | SUBDIRS = m4 src doc 371 | --endoutput 372 | 373 | In jedem Unterverzeichnis muss natürlich wiederum eine Makefile.am 374 | angelegt und daraus eine Makefile.in erzeugt werden. Ausserdem muss das 375 | dann zu erzeugende Makefile in der configure.in angegeben werden, und 376 | zwar via AC_CONFIG_FILES. 377 | --newpage resumee 378 | --heading Resümee 379 | 380 | * make mag veraltet und eingerostet wirken (wird seit Ende der 381 | 1970er eingesetzt), bietet aber ein mächtiges System, um 382 | Abhängigkeiten zu überprüfen, und unnötige Compilevorgänge zu 383 | minimieren. 384 | * Autoconf bietet ein mächtiges System, um vielerlei systemabhängige 385 | Konfigurationspunkte in Erfahrung zu bringen, was wiederum einen 386 | Eckpfeiler für systemnahe und portable Programmierung bildet. 387 | * Automake macht es für Entwickler besonders einfach, Softwarepakete 388 | in eine Form zu bringen, dass sie übersetzt und installiert werden 389 | können. 390 | * Autoconf und Automake mögen suboptimale Lösungen sein 391 | (./configure dauert lange, configure und Makefile.in sind 392 | bei Automake extrem gross), stellen jedoch eine frei verfügbare, 393 | einfach anzuwendende und vor allem weit verbreitete Lösung dar. 394 | --newpage literacy 395 | --heading Literaturempfehlungen 396 | 397 | * Das "Autobook": Autoconf, Automake and Libtool 398 | http://sources.redhat.com/autobook/autobook/autobook_toc.html 399 | * Autoconf Dokumentation: 400 | http://www.delorie.com/gnu/docs/autoconf/autoconf_toc.html 401 | * Automake Dokumentation: 402 | http://www.delorie.com/gnu/docs/automake/automake_toc.html 403 | --newpage end 404 | --heading Und jetzt... 405 | 406 | --huge Zum praktischen Teil! 407 | -------------------------------------------------------------------------------- /examples/align-footer.tpp: -------------------------------------------------------------------------------- 1 | --author Nico Golde 2 | --title Testing Orientation 3 | --footer and this is the footer line 4 | --header and this is the header line 5 | This is oriented left. 6 | --- 7 | --center This is centered. 8 | --- 9 | --right This is oriented right. 10 | --- 11 | --beginoutput 12 | It works even here 13 | --center as you can see 14 | --right in these three lines. 15 | --endoutput 16 | -------------------------------------------------------------------------------- /examples/bold.tpp: -------------------------------------------------------------------------------- 1 | --author Andreas Krennmair 2 | --title Boldtest 3 | --newpage 4 | This is normal text. 5 | --boldon 6 | This should be bold. 7 | --boldoff 8 | This should be normal again. 9 | --revon 10 | --center This should be reverse. 11 | --revoff 12 | This should be normal. 13 | 14 | jjjjjjjjjjjjjjjjjjjjjjjjjjj 15 | --revon 16 | asdf jklö 17 | --boldon 18 | asdf jklö 19 | --boldoff 20 | asdf jklö 21 | --revoff 22 | jjjjjjjjjjjjjjjjjjjjjjjjjjj 23 | --newpage 24 | --heading This is the heading 25 | 26 | This should be normal 27 | --ulon 28 | This should be underlined 29 | --revon 30 | This should be underlined and reverse 31 | --boldon 32 | This should be underlined, reverse and bold 33 | --center This should be underlined, reverse, bold and centered 34 | --uloff 35 | This should be reverse and bold 36 | --revoff 37 | This should be bold 38 | --boldoff 39 | This should be normal again 40 | --huge This Is Huge! 41 | -------------------------------------------------------------------------------- /examples/colors.tpp: -------------------------------------------------------------------------------- 1 | --author Nico Golde 2 | --heading Colortest 3 | --bgcolor red 4 | --newpage 5 | --boldon 6 | --color red 7 | Hallo 8 | --color white 9 | das 10 | --color green 11 | ist 12 | --color blue 13 | ein 14 | --color cyan 15 | Test 16 | --color magenta 17 | mit 18 | --color yellow 19 | Farben 20 | -------------------------------------------------------------------------------- /examples/colors2.tpp: -------------------------------------------------------------------------------- 1 | --fgcolor black 2 | --bgcolor white 3 | --title FG/BG tests 4 | --author Andreas Krennmair 5 | --date today 6 | 7 | This is the abstract. Bla, bla. 8 | --newpage 9 | --heading bla bla bla 10 | 11 | * bla 12 | 13 | * bla 14 | --- 15 | --beginslideleft 16 | 17 | * bla 18 | --endslideleft 19 | --beginslidetop 20 | 21 | * bla 22 | --endslidetop 23 | 24 | more bla bla bla. 25 | -------------------------------------------------------------------------------- /examples/debian-packaging.tpp: -------------------------------------------------------------------------------- 1 | --boldon 2 | --center Debian GNU/Linux 3 | --center Paketerstellung 4 | --center am Beispiel von binclock 5 | 6 | --author Nico Golde 7 | --boldoff 8 | 9 | 10 | 11 | --center Berlinux 12 | --center 22.+23. Okt 2004 13 | 14 | 15 | --center http://www.ngolde.de 16 | --fgcolor white 17 | --bgcolor black 18 | --boldoff 19 | 20 | 21 | --newpage Inhalt 22 | --boldon 23 | --huge Inhalt 24 | --ulon 25 | --horline 26 | --boldoff 27 | --uloff 28 | --boldon 29 | 30 | 31 | 32 | 33 | - Gründe für die Erstellung von Paketen 34 | 35 | - Benötigte Software 36 | 37 | - Vorbereitung 38 | 39 | - Debian-Pakete 40 | 41 | - Erstellung benötigter Dateien 42 | 43 | - Konfiguration 44 | 45 | - Build-Prozess 46 | 47 | - Testen des Pakets 48 | 49 | - Veröffentlichung: 50 | Wie mache ich das Paket verfügbar? 51 | 52 | - Weitere Informationen 53 | 54 | 55 | --newpage warum 56 | --boldon 57 | --huge Warum? 58 | --ulon 59 | --horline 60 | --boldoff 61 | --uloff 62 | --boldon 63 | 64 | 65 | 66 | 67 | - Eingliederung von Software in das Debian-Paketsystem 68 | 69 | - Ziel: Offizieller Maintainer 70 | 71 | - "NEU!" Das Programm war bisher nicht als Debian-Paket verfügbar 72 | 73 | - Erweiterung vorhandener Pakete, zB durch patches 74 | oder zusätzliche Konfigurationsdateien 75 | 76 | - Cluster/Pool: Leichte De- und Installation 77 | von Programmen auf mehreren Rechnern 78 | 79 | - Auflösen von Abhängigkeiten und Konflikten 80 | dem Paketsystem überlassen können 81 | 82 | - Eingliederung in das Menüsystem 83 | 84 | --newpage software 85 | --boldon 86 | --huge Software 87 | --ulon 88 | --horline 89 | --boldoff 90 | --uloff 91 | --boldon 92 | 93 | 94 | 95 | 96 | - Compiler, Bibliotheken (Paket: build-essential) 97 | 98 | - dpkg-dev (Hilfe beim Entpacken und Erstellen) 99 | 100 | - debhelper 101 | 102 | - lintian (Paket-Checker) 103 | 104 | - patch, dpatch, automake, autoconf 105 | 106 | 107 | --newpage Vorbereitung 108 | --boldon 109 | --huge Vorbereitung 110 | --ulon 111 | --horline 112 | --boldoff 113 | --uloff 114 | --boldon 115 | 116 | 117 | 118 | - Existieren schon Pakete? 119 | -> packages.debian.org 120 | 121 | - Kontakt zum Autor herstellen! 122 | Interesse an einem Paket? 123 | 124 | - Lizenzen überprüfen: 125 | Ist das Programm auch frei? 126 | aka "Klären der Fakten" 127 | -> Debian Free Software Guidelines (DFSG) 128 | 129 | - Abhängigkeiten zu anderen Programmen prüfen 130 | 131 | - Kenntnis des Programms erforderlich! 132 | 133 | - Format des Dateinamens: 134 | paketname-version.tar.gz 135 | 136 | 137 | --newpage paket 138 | --boldon 139 | --huge Pakete 140 | --ulon 141 | --horline 142 | --boldoff 143 | --uloff 144 | --boldon 145 | 146 | 147 | Inhalt: 148 | --## --exec display paket.png 149 | 150 | --beginoutput 151 | Debian Paket: 152 | (1) Quellpaket (Source Package) 153 | - paket.orig.tar.gz ("source archive") 154 | - paket.dsc ("description") 155 | - paket.diff.gz ("differences") 156 | 157 | (2) Binärpaket (.deb) (Binary Package) 158 | --endoutput 159 | 160 | - zu installierende Programme und Pfade 161 | 162 | --newpage dateierstellung 163 | --boldon 164 | --huge Dateien - 1 165 | --ulon 166 | --horline 167 | --boldoff 168 | --uloff 169 | --boldon 170 | 171 | 172 | 173 | 1. Entpacken der Quellen 174 | --- 175 | --beginshelloutput 176 | $ tar xvfz binclock-1.5.tar.gz 177 | binclock-1.5/ 178 | binclock-1.5/CHANGELOG 179 | binclock-1.5/COPYING 180 | binclock-1.5/doc/ 181 | binclock-1.5/doc/binclock.1 182 | binclock-1.5/src/ 183 | binclock-1.5/src/binclock.c 184 | binclock-1.5/Makefile 185 | binclock-1.5/README 186 | binclock-1.5/INSTALL 187 | binclock-1.5/binclockrc 188 | --endshelloutput 189 | 190 | 2. Umbgebungsvariablen 191 | --- 192 | 193 | --beginshelloutput 194 | $ export DEBEMAIL="nico@ngolde.de" 195 | --endshelloutput 196 | --beginshelloutput 197 | $ export DEBFULLNAME="Nico Golde" 198 | --endshelloutput 199 | 200 | --newpage dateien2 201 | --boldon 202 | --huge Dateien - 2 203 | --ulon 204 | --horline 205 | --boldoff 206 | --uloff 207 | --boldon 208 | 209 | 210 | 211 | --- 212 | --beginshelloutput 213 | $ dh_make 214 | Type of package: single binary, multiple \ 215 | binary, library, or kernel module? [s/m/l/k] 216 | 217 | --- 218 | Maintainer name : Nico Golde 219 | Email-Address : nico@ngolde.de 220 | Date : Sat, 16 Oct 2004 01:00:14 +0200 221 | Package Name : binclock 222 | Version : 1.5 223 | Type of Package : Single 224 | Hit to confirm: 225 | --- 226 | Done. Please edit the files in the debian/ subdirectory now. 227 | You should also check that the binclock Makefiles 228 | install into $DESTDIR and not in / . 229 | --endshelloutput 230 | 231 | 232 | --beginslideleft 233 | --color red 234 | ==> debian-Dateien (im Ordner debian/) 235 | --endslideleft 236 | --color white 237 | 238 | --newpage Config-1 239 | --boldon 240 | --huge Config - 1 241 | --ulon 242 | --horline 243 | --boldoff 244 | --uloff 245 | --boldon 246 | 247 | 248 | 249 | 250 | --ulon 251 | Die wichtigen Dateien: 252 | --uloff 253 | 254 | changelog: 255 | (später /usr/share/doc/binclock/changelog.Debian.gz) 256 | --- 257 | 258 | --beginoutput 259 | binclock (1.5-1) unstable; urgency=low 260 | * Initial Release. 261 | Nico Golde Fri, 15 Oct 2004 18:45:13 +0200 262 | --endoutput 263 | 264 | - Paketname, Version, Distribution, Priorität 265 | 266 | - Änderungen am Paket, _nicht_ am Quellcode 267 | 268 | - Name des Maintainers, Emailaddresse, Datum 269 | --## "date -R" erstmal nicht so wichtig 270 | 271 | - neuer changelog-Eintrag mit "dch -i" 272 | 273 | --newpage Config-2a 274 | --boldon 275 | --huge Config - 2a 276 | --ulon 277 | --horline 278 | --boldoff 279 | --uloff 280 | --boldon 281 | 282 | 283 | 284 | 285 | Datei "control" (vor dem Editieren): 286 | --- 287 | 288 | --beginoutput 289 | Source: binclock 290 | Section: unknown 291 | Priority: optional 292 | Maintainer: Nico Golde 293 | Build-Depends: debhelper (>= 4.1.0) 294 | Standards-Version: 3.6.1 295 | 296 | Package: binclock 297 | Architecture: any 298 | Depends: ${shlibs:Depends}, ${misc:Depends} 299 | Description: 300 | 301 | --endoutput 302 | 303 | --newpage Config-2b 304 | --boldon 305 | --huge Config - 2b 306 | --ulon 307 | --horline 308 | --boldoff 309 | --uloff 310 | --boldon 311 | 312 | 313 | 314 | 315 | Datei "control" (nach dem Editieren): 316 | 317 | --- 318 | --beginoutput 319 | Source: binclock 320 | --color green 321 | Section: utils 322 | --color white 323 | Priority: optional 324 | Maintainer: Nico Golde 325 | --color green 326 | Build-Depends: debhelper (>= 4.1.0) 327 | --color white 328 | Standards-Version: 3.6.1 329 | 330 | Package: binclock 331 | --color green 332 | Architecture: any 333 | --color white 334 | Depends: ${shlibs:Depends}, ${misc:Depends} 335 | --color green 336 | Description: binary clock for console with color support * (60 Zeichen) 337 | BinClock - Displays system time in binary format. 338 | It supports showing the time with eight different colors, and it can 339 | run a loop that prints the time every second. 340 | The default colors and characters for printing can be changed with a 341 | config file. 342 | --color white 343 | 344 | --endoutput 345 | - Kontrollinformationen, Name des Quellpakets, Subsection, Maintainer, 346 | Abhängigkeiten zum Bauen, Policy-Version 347 | 348 | - Paketname, Architektur 349 | 350 | - Abhängigkeiten (mögliche weitere Felder: Suggests, Conflicts, Replaces, ...) 351 | 352 | - kurze und lange Beschreibung, kurze Beschreibung darf nicht mit 353 | Programmnamen anfangen 354 | 355 | --newpage Config-3a 356 | --boldon 357 | --huge Config - 3a 358 | --ulon 359 | --horline 360 | --boldoff 361 | --uloff 362 | --boldon 363 | 364 | 365 | 366 | 367 | copyright (vor dem Editieren): 368 | 369 | --beginoutput 370 | This package was debianized by Nico Golde on 371 | Tue, 19 Feb 2004 16:43:41 +0200. 372 | 373 | It was downloaded from 374 | 375 | Copyright: 376 | 377 | Upstream Author(s): 378 | 379 | License: 380 | 381 | 382 | --endoutput 383 | 384 | --newpage Config-3a 385 | --boldon 386 | --huge Config - 3b 387 | --ulon 388 | --horline 389 | --boldoff 390 | --uloff 391 | --boldon 392 | 393 | 394 | 395 | --beginoutput 396 | 397 | This package was debianized by Nico Golde on 398 | Wed, 19 Feb 2004 16:43:41 +0100. 399 | It was downloaded from http://www.ngolde.de/binclock/ 400 | 401 | Upstream Author: Nico Golde 402 | 403 | 404 | This software is copyrighted (c) 2003-2004 by Nico Golde. 405 | 406 | You are free to distribute this software under 407 | the terms of the GNU General Public License. 408 | On Debian systems, the complete text of the 409 | GNU General Public License can be found 410 | in the file `/usr/share/common-licenses/GPL'. 411 | --endoutput 412 | 413 | - Download Ort 414 | 415 | - Autor des Programmes 416 | 417 | - Copyright (sollte DFSG kompatibel sein) 418 | 419 | --newpage Config-4 420 | --boldon 421 | --huge Config - 4 422 | --ulon 423 | --horline 424 | --boldoff 425 | --uloff 426 | --boldon 427 | 428 | 429 | 430 | 431 | dirs: 432 | 433 | - Verzeichnisse, die nicht vom Makefile angelegt werden 434 | 435 | - ohne / am Anfang, Bsp.: usr/man 436 | 437 | conffiles.ex: 438 | 439 | - Konfigurationsdateienm, für manuelle Auswahl, in dem Fall /etc/binclockrc 440 | 441 | - WICHTIG: datei.ex immer in datei umbenennen, wenn sie verwendet wird 442 | 443 | 444 | docs: 445 | 446 | - zu installierende Dokumentationsdatein, in dem Fall nur README 447 | 448 | 449 | README.Debian: 450 | 451 | - nennenswerte Unterschied zum Original 452 | 453 | 454 | --newpage Configis 455 | --boldon 456 | --huge Config - 5 457 | --ulon 458 | --horline 459 | --boldoff 460 | --uloff 461 | --boldon 462 | 463 | 464 | 465 | 466 | menu.ex: 467 | 468 | - Fenstermanager-Menu 469 | 470 | vor dem Editieren: 471 | 472 | --beginoutput 473 | ?package(binclock):needs="X11|text|vc|wm" section="Apps/see-menu-manual"\ 474 | title="binclock" command="/usr/bin/binclock" 475 | --endoutput 476 | 477 | --beginoutput 478 | ?package(binclock): needs="text|X11" section="Apps/Tools" \ 479 | title="BinClock" command="/usr/bin/binclock" 480 | --endoutput 481 | 482 | - Bestimmung von Oberfläche, Abteilung, Titel und das auszuführende Kommando 483 | 484 | --newpage Config-5 485 | --boldon 486 | --huge Config - 6 487 | --ulon 488 | --horline 489 | --boldoff 490 | --uloff 491 | --boldon 492 | 493 | 494 | 495 | rules: 496 | --- 497 | --## this doesn't works here, because there is no rules file 498 | --##--exec vim rules 499 | --exec echo "eigentlich wäre hier die rules datei, sie ist in diesem beispiel leider nicht enthalten" | vim - 500 | 501 | --newpage Config-6 502 | --boldon 503 | --huge Config - 7 504 | --ulon 505 | --horline 506 | --boldoff 507 | --uloff 508 | --boldon 509 | 510 | 511 | 512 | Anpassung des Makefiles: 513 | 514 | vor dem Editieren: 515 | 516 | --beginoutput 517 | INSPATH = /usr/local/bin/ 518 | MANPATH = /usr/man/man1/ 519 | CONF = /etc/ 520 | all : $(MAINSRC) 521 | gcc -02 --pedantic -Wall -o binclock ./src/binclock.c 522 | strip binclock 523 | install : 524 | cp -pf CHANGELOG README COPYING 525 | cp -pf ./doc/binclock.1 $(MANPATH) 526 | cp -pf binclockrc $(CONF)binclockrc 527 | install -c -s -m 0755 binclock $(INSPATH) 528 | clean : 529 | rm -f binclock 530 | uninstall : 531 | rm -f $(INSPATH)binclock 532 | rm -f $(CONF)$(BIN)rc 533 | rm -f $(MANPATH)/binclock.1 534 | --endoutput 535 | --newpage Config-a 536 | --boldon 537 | --huge Config - 8 538 | --ulon 539 | --horline 540 | --boldoff 541 | --uloff 542 | --boldon 543 | 544 | 545 | 546 | 547 | Nach dem Editieren: 548 | 549 | --beginoutput 550 | --color green 551 | INSPATH = $(DESTDIR)/usr/bin/ 552 | MANPATH = $(DESTDIR)/usr/share/man/man1/ 553 | CONF = $(DESTDIR)/etc/ 554 | all : $(MAINSRC) 555 | --color white 556 | gcc --pedantic -Wall -o binclock ./src/binclock.c 557 | strip binclock 558 | install : 559 | cp -pf ./doc/binclock.1 $(MANPATH) 560 | cp -pf binclockrc $(CONF)binclockrc 561 | install -c -s -m 0755 $(BIN) $(INSPATH) 562 | clean : 563 | rm -f $(SOURCEPATH)$(BIN) 564 | --endoutput 565 | 566 | - Anpassung der Variablen mit $(DESTDIR) 567 | 568 | - Entfernen von Regeln, die von debhelper übernommen werden 569 | 570 | - bei Programmen mit configure Scripten normalerweise nicht nötig, 571 | sondern in rules statt $(DESTDIR) prefix einsetzen 572 | 573 | 574 | --newpage Config-7 575 | --boldon 576 | --huge Config-9 577 | --ulon 578 | --horline 579 | --boldoff 580 | --uloff 581 | --boldon 582 | 583 | 584 | 585 | 586 | Letzte Schritte: 587 | 588 | .ex-Dateien: 589 | 590 | - Spezialfälle, je nach Bedarf editieren und umbennen 591 | 592 | - anschliessend übrige .ex Dateien löschen 593 | 594 | - eventuell Manual schreiben (so wie in der Policy beschrieben) 595 | 596 | - falls benötigt die Maintainer-Scripte editieren: postinst.ex, preinst.ex, 597 | postrm.ex, prerm.ex 598 | -> werden ausgeführt bei Installation, Löschen oder Aktualisierung eines Paketes 599 | 600 | - umbenennen von binclock-1.5.tar.gz in binclock_1.5.orig.tar.gz 601 | 602 | --newpage build 603 | --boldon 604 | --huge Build Prozess 605 | --ulon 606 | --horline 607 | --boldoff 608 | --uloff 609 | --boldon 610 | 611 | 612 | 613 | 614 | Schritt 1: 615 | 616 | - Zurückkehren in das Stammverzeichnis des Programms, i.d. Fall binclock-1.5/ 617 | 618 | Schritt 2: 619 | 620 | - Bauen des Paketes mittels dpkg-buildpackage -rfakeroot 621 | 622 | --- 623 | --color red 624 | --beginslideleft 625 | ==> Debian-Paket in binclock-1.5/../ 626 | --endslideleft 627 | --color white 628 | --newpage build2 629 | --boldon 630 | --huge Nach dem Build 631 | --ulon 632 | --horline 633 | --boldoff 634 | --uloff 635 | --boldon 636 | 637 | 638 | 639 | 640 | Neue Dateien in binclock-1.5/../ : 641 | 642 | --- 643 | --beginshelloutput 644 | $ ls 645 | --color blue 646 | binclock-1.5 647 | --color white 648 | binclock_1.5-1.diff.gz 649 | binclock_1.5-1.dsc 650 | binclock_1.5-1_i386.changes 651 | binclock_1.5-1_i386.deb 652 | binclock_1.5.orig.tar.gz 653 | --endshelloutput 654 | 655 | - Alle Änderungen am Originalquelltext (.diff.gz) 656 | 657 | - Paketname, Version, Maintainer, Architektur, Build-Depends, 658 | Policy Version, Dateien mit md5 Summen (.dsc) 659 | 660 | - Paketdatum, Version, Distribution, Maintainer, 661 | _Veränderungen_, Paketbeschreibung, 662 | Dateien mit md5 Summen (.changes) 663 | 664 | - Alle zur installierenden Dateien mit Ordnern gezippt (.deb) 665 | 666 | - Originalquellen (.orig.tar.gz) 667 | 668 | --newpage test 669 | --boldon 670 | --huge Tests 671 | --ulon 672 | --horline 673 | --boldoff 674 | --uloff 675 | --boldon 676 | 677 | 1. Testen auf Policy mit lintian (Paket-Checker): 678 | 679 | --- 680 | --beginshelloutput 681 | $ lintian binclock_1.5-1_i386.changes 682 | E: binclock: binary-without-manpage binclock 683 | --endshelloutput 684 | 685 | - Fehler und Warnungen beseitigen (lintian -i für weiter Eklärungen) 686 | 687 | 2. Testen des Paketinhalts: 688 | --- 689 | 690 | --beginshelloutput 691 | $ dpkg -c binclock_1.5-1_i386.deb 692 | drwxr-xr-x root/root 0 2004-10-17 16:38:42 ./ 693 | drwxr-xr-x root/root 0 2004-10-17 16:38:42 ./usr/ 694 | drwxr-xr-x root/root 0 2004-10-17 16:38:42 ./usr/bin/ 695 | -rwxr-xr-x root/root 7500 2004-10-17 16:38:42 ./usr/bin/binclock 696 | drwxr-xr-x root/root 0 2004-10-17 16:38:41 ./usr/share/ 697 | drwxr-xr-x root/root 0 2004-10-17 16:38:41 ./usr/share/man/ 698 | drwxr-xr-x root/root 0 2004-10-17 16:38:43 ./usr/share/man/man1/ 699 | -rw-r--r-- root/root 882 2004-10-17 16:38:41 ./usr/share/man/man1/binclock.1.gz 700 | drwxr-xr-x root/root 0 2004-10-17 16:38:41 ./usr/share/doc/ 701 | drwxr-xr-x root/root 0 2004-10-17 16:38:43 ./usr/share/doc/binclock/ 702 | -rw-r--r-- root/root 1698 2004-07-24 13:42:04 ./usr/share/doc/binclock/README 703 | -rw-r--r-- root/root 484 2004-07-24 15:10:45 ./usr/share/doc/binclock/copyright 704 | -rw-r--r-- root/root 319 2004-07-24 15:10:45 ./usr/share/doc/binclock/changelog.Debian.gz 705 | drwxr-xr-x root/root 0 2004-10-17 16:38:42 ./usr/lib/ 706 | drwxr-xr-x root/root 0 2004-10-17 16:38:42 ./usr/lib/menu/ 707 | -rw-r--r-- root/root 99 2004-07-24 19:54:23 ./usr/lib/menu/binclock 708 | drwxr-xr-x root/root 0 2004-10-17 16:38:41 ./etc/ 709 | --endshelloutput 710 | 711 | - Installieren des Pakets mittels dpkg -i binclock-1.5-1_i386.deb (wahlweise in chroot) 712 | 713 | --newpage Veröffentlichung 714 | --boldon 715 | --huge Veröffentlichung 716 | --ulon 717 | --horline 718 | --boldoff 719 | --uloff 720 | --boldon 721 | 722 | 723 | 724 | 725 | 1. Kopieren des Quellpakets und Binärpakets in 726 | gewünschten Ordner (z.B. auf einen http-Server) 727 | 728 | --- 729 | --beginshelloutput 730 | $ ls 731 | binclock_1.5-1.diff.gz binclock_1.5-1.dsc 732 | binclock_1.5-1_i386.deb binclock_1.5.orig.tar.gz 733 | --endshelloutput 734 | 735 | 2. Erstellen von Sources.gz (Namen, Version, Build-Depends) 736 | und Packages.gz (Beschreibung, Name, Abhängigkeiten) 737 | 738 | --- 739 | --beginshelloutput 740 | $ dpkg-scanpackages ./ /dev/null | gzip -9c > Packages.gz 741 | ** Packages in archive but missing from override file: ** 742 | binclock 743 | 744 | Wrote 1 entries to output Packages file. 745 | --endshelloutput 746 | --- 747 | 748 | --beginshelloutput 749 | $ dpkg-scansources ./ /dev/null | gzip -9c > ./Sources.gz 750 | --endshelloutput 751 | 752 | --beginshelloutput 753 | $ echo thats all :) 754 | --endshelloutput 755 | 756 | --newpage Ende 757 | --boldon 758 | --huge Danke! Fragen? 759 | --ulon 760 | --horline 761 | --boldoff 762 | --uloff 763 | --boldon 764 | 765 | 766 | 767 | Feedback: 768 | 769 | --center Nico Golde 770 | --center http://www.ngolde.de 771 | 772 | --newpage Links 773 | --boldon 774 | --huge Links 775 | --ulon 776 | --horline 777 | --boldoff 778 | --uloff 779 | --boldon 780 | 781 | 782 | 783 | 784 | http://www.debian.org 785 | 786 | http://www.debian.org/devel/ 787 | 788 | debian-reference, maint-guide, debian-policy 789 | 790 | http://www.openoffice.de/linux/buch/debianpakete.html 791 | 792 | http://mentors.debian.net/ 793 | 794 | debian-mentors@lists.debian.org 795 | 796 | debian-devel@lists.debian.org 797 | 798 | http://www.ngolde.de/papers.html 799 | 800 | Vortragsunterlagen: http://www.ngolde.de/papers.html 801 | 802 | Präsentationsprogramm: TPP 803 | -------------------------------------------------------------------------------- /examples/exec.tpp: -------------------------------------------------------------------------------- 1 | --author Andreas Krennmair 2 | --title exec fbi /home/nion/privat/bilder/linux/bart.gif 3 | --newpage 4 | --heading heading 5 | 6 | bla. bla. bla. 7 | --- 8 | --exec echo "foobar - this is the exec output" 9 | more bla. 10 | -------------------------------------------------------------------------------- /examples/horline.tpp: -------------------------------------------------------------------------------- 1 | --author Nico Golde 2 | --date today 3 | --heading Test of horizon line 4 | --newpage 5 | --heading TPP can display a horizontal line too. 6 | --horline 7 | -------------------------------------------------------------------------------- /examples/huge.tpp: -------------------------------------------------------------------------------- 1 | --author Andreas Krennmair 2 | --title Huge Text 3 | --newpage asdf 4 | --huge Test! 5 | --newpage jklö 6 | --huge Text! 7 | --newpage qwertz 8 | --huge Abrakadabra! 9 | --newpage 10 | Normaler Text 11 | --- 12 | --huge Simsalabim! 13 | --- 14 | --huge Is that a stupid presentation! 15 | --- 16 | Normal text. 17 | --newpage 18 | --sethugefont block 19 | --huge other font 20 | --newpage 21 | --sethugefont standard 22 | --huge This is the end... 23 | -------------------------------------------------------------------------------- /examples/list.tpp: -------------------------------------------------------------------------------- 1 | --author Andreas Krennmair 2 | --title Some presentation 3 | --date today 4 | --newpage 5 | --center This Presentation's Agenda 6 | 7 | * Introduction 8 | --- 9 | 10 | * Historic Overview 11 | --- 12 | 13 | * Basic Concepts 14 | --- 15 | 16 | * Implementation 17 | --- 18 | 19 | * Examples 20 | --- 21 | 22 | * Conclusions 23 | --- 24 | 25 | And now for the inofficial part 26 | --center PARTY, PARTY, PARTY !!! 27 | -------------------------------------------------------------------------------- /examples/manyslides.tpp: -------------------------------------------------------------------------------- 1 | --author Andreas Krennmair 2 | --title Many Slides 3 | --date today 4 | this is the abstract. bla. bla. bla. 5 | --newpage slide1 6 | this is slide 1 7 | --newpage slide2 8 | this is slide 2 9 | --newpage slide3 10 | this is slide 3 11 | --newpage slide4 12 | this is slide 4 13 | --newpage slide5 14 | this is slide 5 15 | --newpage slide6 16 | this is slide 6 17 | --newpage slide7 18 | this is slide 7 19 | --newpage slide8 20 | this is slide 8 21 | --newpage slide9 22 | this is slide 9 23 | --newpage slide10 24 | this is slide 10 25 | --newpage slide11 26 | this is slide 11 27 | --newpage slide12 28 | this is slide 12 29 | --newpage slide13 30 | this is slide 13 31 | --newpage slide14 32 | this is slide 14 33 | --newpage slide15 34 | this is slide 15 35 | --newpage slide16 36 | this is slide 16 37 | --newpage slide17 38 | this is slide 17 39 | --newpage slide18 40 | this is slide 18 41 | --newpage slide19 42 | this is slide 19 43 | --newpage slide20 44 | this is slide 20 45 | --newpage slide21 46 | this is slide 21 47 | --newpage slide22 48 | this is slide 22 49 | --newpage slide23 50 | this is slide 23 51 | --newpage slide24 52 | this is slide 24 53 | --newpage slide25 54 | this is slide 25 55 | --newpage slide26 56 | this is slide 26 57 | --newpage slide27 58 | this is slide 27 59 | --newpage slide28 60 | this is slide 28 61 | --newpage slide29 62 | this is slide 29 63 | --newpage slide30 64 | this is slide 30 65 | --newpage slide31 66 | this is slide 31 67 | --newpage slide32 68 | this is slide 32 69 | --newpage slide33 70 | this is slide 33 71 | --newpage slide34 72 | this is slide 34 73 | --newpage slide35 74 | this is slide 35 75 | --newpage slide36 76 | this is slide 36 77 | --newpage slide37 78 | this is slide 37 79 | --newpage slide38 80 | this is slide 38 81 | --newpage slide39 82 | this is slide 39 83 | --newpage slide40 84 | this is slide 40 85 | --newpage slide41 86 | this is slide 41 87 | --newpage slide42 88 | this is slide 42 89 | --newpage slide43 90 | this is slide 43 91 | --newpage slide44 92 | this is slide 44 93 | --newpage slide45 94 | this is slide 45 95 | --newpage slide46 96 | this is slide 46 97 | --newpage slide47 98 | this is slide 47 99 | --newpage slide48 100 | this is slide 48 101 | --newpage slide49 102 | this is slide 49 103 | --newpage slide50 104 | this is slide 50 105 | --newpage slide51 106 | this is slide 51 107 | --newpage slide52 108 | this is slide 52 109 | --newpage slide53 110 | this is slide 53 111 | --newpage slide54 112 | this is slide 54 113 | --newpage slide55 114 | this is slide 55 115 | --newpage slide56 116 | this is slide 56 117 | --newpage slide57 118 | this is slide 57 119 | --newpage slide58 120 | this is slide 58 121 | --newpage slide59 122 | this is slide 59 123 | --newpage slide60 124 | this is slide 60 125 | --newpage slide61 126 | this is slide 61 127 | --newpage slide62 128 | this is slide 62 129 | --newpage slide63 130 | this is slide 63 131 | --newpage slide64 132 | this is slide 64 133 | --newpage slide65 134 | this is slide 65 135 | --newpage slide66 136 | this is slide 66 137 | --newpage slide67 138 | this is slide 67 139 | --newpage slide68 140 | this is slide 68 141 | --newpage slide69 142 | this is slide 69 143 | --newpage slide70 144 | this is slide 70 145 | --newpage slide71 146 | this is slide 71 147 | --newpage slide72 148 | this is slide 72 149 | --newpage slide73 150 | this is slide 73 151 | --newpage slide74 152 | this is slide 74 153 | --newpage slide75 154 | this is slide 75 155 | --newpage slide76 156 | this is slide 76 157 | --newpage slide77 158 | this is slide 77 159 | --newpage slide78 160 | this is slide 78 161 | --newpage slide79 162 | this is slide 79 163 | --newpage slide80 164 | this is slide 80 165 | --newpage slide81 166 | this is slide 81 167 | --newpage slide82 168 | this is slide 82 169 | --newpage slide83 170 | this is slide 83 171 | --newpage slide84 172 | this is slide 84 173 | --newpage slide85 174 | this is slide 85 175 | --newpage slide86 176 | this is slide 86 177 | --newpage slide87 178 | this is slide 87 179 | --newpage slide88 180 | this is slide 88 181 | --newpage slide89 182 | this is slide 89 183 | --newpage slide90 184 | this is slide 90 185 | --newpage slide91 186 | this is slide 91 187 | --newpage slide92 188 | this is slide 92 189 | --newpage slide93 190 | this is slide 93 191 | --newpage slide94 192 | this is slide 94 193 | --newpage slide95 194 | this is slide 95 195 | --newpage slide96 196 | this is slide 96 197 | --newpage slide97 198 | this is slide 97 199 | --newpage slide98 200 | this is slide 98 201 | --newpage slide99 202 | this is slide 99 203 | --newpage slide100 204 | this is slide 100 205 | -------------------------------------------------------------------------------- /examples/shell.tpp: -------------------------------------------------------------------------------- 1 | --author Andreas Krennmair 2 | --title Some shell examples 3 | --date foobar 4 | --newpage 5 | --center Some "funny" shell tricks 6 | This example shows some of the so-called "funny" shell tricks on csh/sh 7 | --beginshelloutput 8 | $ make love 9 | Make: Don't know how to make love. Stop. 10 | $ %blow 11 | %blow: No such job. 12 | $ PATH=pretending! /usr/ucb/which sense 13 | no sense in pretending! 14 | --- 15 | $ drink < bottle; opener 16 | bottle: cannot open 17 | opener: not found 18 | --- 19 | $ If I had a ( for every $ Congress spent, what would I have? 20 | Too many ('s. 21 | $ 22 | --endshelloutput 23 | --- 24 | And here some more text. 25 | --newpage 26 | --center And here some more serious shell things 27 | --beginshelloutput 28 | $ ls / 29 | bin/ dev/ initrd/ lost+found/ repos/ tftpboot/ vmlinuz@ 30 | boot/ etc/ initrd.img@ mnt/ root/ tmp/ vmlinuz.old@ 31 | cdrom/ floppy/ initrd.img.old@ opt/ sbin/ usr/ 32 | data/ home/ lib/ proc/ sys/ var/ 33 | $ uptime 34 | 23:22:41 up 23 days, 4:18, 8 users, load average: 0.10, 0.25, 0.25 35 | $ sleep 3 36 | --sleep 3 37 | $ uname -rnsm 38 | Linux tintifax 2.6.6-1-686-smp i686 39 | $ 40 | --endshelloutput 41 | -------------------------------------------------------------------------------- /examples/shell_eval.tpp: -------------------------------------------------------------------------------- 1 | --author Gabriel Rea 2 | --title An example of shell evaluation 3 | --date today 4 | 5 | 6 | --beginshelloutput 7 | $ ls 8 | abc 9 | $$ non_existent 10 | $$ ls -l 11 | $% ls -l 12 | --endshelloutput -------------------------------------------------------------------------------- /examples/slidein.tpp: -------------------------------------------------------------------------------- 1 | --author Nico Golde 2 | --title Slide text test 3 | --newpage 4 | --beginslideleft 5 | Hallo, ich bin Nico 6 | Hallo, ich bin Andreas 7 | --endslideleft 8 | --- 9 | --beginslideright 10 | Das ist der Slide-Right-Test 11 | --endslideright 12 | --newpage 13 | --heading jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj 14 | asdf jklö asdf jklö asdf jklö 15 | asdf jklö asdf jklö asdf jklö 16 | asdf jklö asdf jklö asdf jklö 17 | asdf jklö asdf jklö asdf jklö 18 | asdf jklö asdf jklö asdf jklö 19 | asdf jklö asdf jklö asdf jklö 20 | 21 | --beginslidetop 22 | * Testtesttesttest 23 | 24 | * Test 2 TEst 2 TEst 2 25 | 26 | * Test 3 Test 3 Test 3 27 | --- 28 | 29 | * Test4Test4Test4Test4Test4 30 | --endslidetop 31 | --newpage 32 | --heading jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj 33 | text first. 34 | --- 35 | more text. 36 | 37 | and even more text. bla. bla. bla. 38 | --beginslidetop 39 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 40 | --endslidetop 41 | --newpage 42 | --heading jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj 43 | some text 44 | --beginslidebottom 45 | 46 | * foobar 47 | 48 | * baz quux xyzzy 49 | 50 | * blubber blubber blubber. 51 | --endslidebottom 52 | -------------------------------------------------------------------------------- /examples/source.tpp: -------------------------------------------------------------------------------- 1 | --title Some Source Code Examples 2 | --author Andreas Krennmair 3 | --date today 4 | --newpage 5 | --center The Famous "Hello World" Source Code 6 | --beginoutput 7 | #include 8 | 9 | int main(void) { 10 | puts("Hello World"); 11 | return 0; 12 | } 13 | --endoutput 14 | --newpage 15 | --center The Very Same Example, But This Time In Pieces 16 | --beginoutput 17 | #include 18 | --- 19 | 20 | int main(void) { 21 | --- 22 | puts("Hello World"); 23 | --- 24 | return 0; 25 | --- 26 | } 27 | --endoutput 28 | --newpage 29 | --heading This is some example source code 30 | 31 | --beginoutput 32 | static void run_command(char *cmd, char *ip) { 33 | int pid; 34 | pid = fork(); 35 | if (pid == 0) { 36 | char env_ip[20], env_cmd[strlen(cmd)+10]; 37 | char *const envp[] = { env_ip, env_cmd, "PATH=/bin:/usr/bin", 0 }; 38 | snprintf(env_cmd, sizeof(env_cmd), "CMD=%s", cmd); 39 | snprintf(env_ip, sizeof(env_ip), "IP=%s", ip); 40 | execle("/bin/sh", "/bin/sh", "-c", cmd, NULL, envp); 41 | limit_syslog(LOG_ERR, "execl of %s failed: %s", cmd, strerror(errno)); 42 | exit(EXIT_FAILURE); 43 | } else if (pid == -1) { 44 | limit_syslog(LOG_ERR, "fork failed: %s", strerror(errno)); 45 | } else { 46 | (void) waitpid(pid, NULL, 0); 47 | } 48 | } 49 | --endoutput 50 | -------------------------------------------------------------------------------- /examples/test.tpp: -------------------------------------------------------------------------------- 1 | --##comment in the beginning 2 | --author Nico Golde 3 | --title Test for TPP 4 | --date today 5 | --withborder 6 | The next line in the source file is a comment and will not be displayed. 7 | --##This is the abstract, which is pretty cool. 8 | It consists of several lines. 9 | --newpage 10 | --withborder 11 | This is the next page, which also consists of 12 | several lines 13 | blubber. bla. 14 | --## comment somewhere else 15 | --newpage 16 | --withborder 17 | asdf jklö asdf jklö asdf jklö asdf jklö 18 | -------------------------------------------------------------------------------- /examples/tpp-features.tpp: -------------------------------------------------------------------------------- 1 | --bgcolor white 2 | --fgcolor black 3 | --title TPP Feature Show 4 | --author Andreas Krennmair 5 | --date today 6 | --newpage intro 7 | --heading What is TPP? 8 | 9 | * A text console application 10 | --- 11 | 12 | * "Powerpoint for Sven G^W^Wtext tool users" 13 | --- 14 | 15 | * Simple file format, only text editor required 16 | --- 17 | 18 | * First version: 4-hour hack in Ruby + ruby-ncurses 19 | --- 20 | 21 | * Extension until source code was f*cked up, 22 | then complete rewrite w/ generic design 23 | --newpage slide 24 | --heading Basic TPP Features 25 | 26 | Simple text that is in one line 27 | --- 28 | 29 | What TPP also does is that it also takes very long lines, but doesn't simply output them, but break those long lines into a series of shorter ones, which are then printed to screen. Like this one. :-) 30 | --- 31 | 32 | --center You can also center text (long lines will be wrapped, too) 33 | --- 34 | 35 | --right And everything on the right side 36 | --- 37 | 38 | --beginslideleft 39 | * You can slide it in from the left 40 | * or from the right: 41 | --endslideleft 42 | 43 | --beginslideright 44 | * Like this line, for example 45 | --endslideright 46 | --- 47 | --beginslidetop 48 | O R L O O K A T T H I S ! ! ! 49 | --endslidetop 50 | --- 51 | --beginslidebottom 52 | O R T H I S ! ! ! 53 | --endslidetop 54 | --newpage attrib 55 | --heading Attributes 56 | 57 | This should be normal 58 | --- 59 | --ulon 60 | This should be underlined 61 | --- 62 | --revon 63 | This should be underlined and reverse 64 | --- 65 | --boldon 66 | This should be underlined, reverse and bold 67 | --center This should be underlined, reverse, bold and centered 68 | --- 69 | --uloff 70 | This should be reverse and bold 71 | --- 72 | --revoff 73 | This should be bold 74 | --- 75 | --boldoff 76 | This should be normal again 77 | --newpage keys 78 | --heading Keys to Control TPP 79 | 80 | --beginoutput 81 | space bar ............................... display next entry within page 82 | space bar, cursor-down, cursor-right .... display next page 83 | b, cursor-up, cursor-left ............... display previous page 84 | q, Q .................................... quit tpp 85 | j, J .................................... jump directly to page 86 | s, S .................................... jump to the first page 87 | e, E .................................... jump to the last page 88 | c, C .................................... start command line 89 | ?, h .................................... help screen 90 | --endoutput 91 | --newpage source 92 | --heading Source Code Example 93 | 94 | --beginoutput 95 | --##comment in the beginning 96 | --author Nico Golde 97 | --title Test for TPP 98 | --date today 99 | --withborder 100 | The next line in the source file is a comment and will not be displayed. 101 | --##This is the abstract, which is pretty cool. 102 | It consists of several lines. 103 | --newpage 104 | --withborder 105 | This is the next page, which also consists of 106 | several lines 107 | blubber. bla. 108 | --## comment somewhere else 109 | --newpage 110 | --withborder 111 | asdf jklö asdf jklö asdf jklö asdf jklö 112 | --endoutput 113 | --newpage other 114 | --heading Other Things 115 | 116 | This is supposed to be shell output: 117 | --beginshelloutput 118 | $ ls ~/bin 119 | c89 cat if.pl seq ssh-agent ssh-agent.sh 120 | $ cd ~/bin 121 | $ ls -l 122 | total 36 123 | -rwxr-xr-x 1 ak staff 27 Jul 11 2003 c89 124 | -rwxr-xr-x 1 ak staff 14732 Aug 26 2002 cat 125 | -rwxr-xr-x 1 ak staff 236 Apr 27 2003 if.pl 126 | -rwxr-xr-x 1 ak staff 73 Feb 19 2004 seq 127 | -rwxr-xr-x 1 ak staff 126 Dec 21 20:45 ssh-agent 128 | -rwxr-xr-x 1 ak staff 94 Jul 24 15:01 ssh-agent.sh 129 | $ 130 | --endshelloutput 131 | --newpage figlet 132 | --heading FIGlet support! 133 | 134 | --huge This is FIGlet 135 | --- 136 | --sethugefont mini 137 | --huge This is the mini font 138 | --newpage future 139 | --heading Future Goals 140 | 141 | * Release refactored version 142 | 143 | --- 144 | * More features (i.e. effects that make PowerPoint look lousy) 145 | 146 | --- 147 | * Stable support for export formats 148 | --newpage thx 149 | --heading Thanks To... 150 | 151 | * Nico Golde, the TPP co-author, who came up with lots of nice features, and brought TPP into Debian 152 | 153 | * Sven Guckes, who had the initial idea and established contact with Nico Golde, the TPP co-author 154 | 155 | * Alfie, for writing a VIM syntax file 156 | 157 | * arved, for bringing TPP into FreeBSD 158 | 159 | * Patricia "trish" Jung, for writing a very good article about TPP 160 | - "Linux User" and 161 | - "Linux Magasinet" (Norway) 162 | -------------------------------------------------------------------------------- /examples/wrap.tpp: -------------------------------------------------------------------------------- 1 | --author Andreas Krennmair 2 | --title Wrapping long lines 3 | --date today %a %b %e %H:%M:%S %Z %Y 4 | This is oriented left. This is also quite long, also there to test how the line wrapping works. You will see examples for centered wrapping and right aligned wrapping later. 5 | --- 6 | --center This is centered. And an extremely long line, so long that it is going to be wrapped at some point, wherever that is. 7 | --- 8 | --right This is oriented right. Probably this line is even longer than the other, but this doesn't matter because this test must be as real as only possible. And I will make it even longer than planned, just to test how reliable it is, and whether it really aligns to the right. 9 | --- 10 | --beginoutput 11 | This is oriented left. This is also quite long, also there to test how the line wrapping works. You will see examples for centered wrapping and right aligned wrapping later. 12 | --- 13 | --center This is centered. And an extremely long line, so long that it is going to be wrapped at some point, wherever that is. 14 | --- 15 | --right This is oriented right. Probably this line is even longer than the other, but this doesn't matter because this test must be as real as only possible. And I will make it even longer than planned, just to test how reliable it is, and whether it really aligns to the right. 16 | --endoutput 17 | --newpage 18 | --heading This is probably an overlong heading, but it's supposed to be the way it is, for testing purposes. One more sentence, and we have our test object. 19 | 20 | This is normal text after the heading. 21 | -------------------------------------------------------------------------------- /tpp.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'io/console' 3 | version_number = "1.3.1" 4 | 5 | # Loads the ncurses-ruby module and imports "Ncurses" into the 6 | # current namespace. It stops the program if loading the 7 | # ncurses-ruby module fails. 8 | def load_ncurses 9 | begin 10 | require "ncurses" 11 | include Ncurses 12 | rescue LoadError 13 | $stderr.print < COLOR_WHITE, 27 | "yellow" => COLOR_YELLOW, 28 | "red" => COLOR_RED, 29 | "green" => COLOR_GREEN, 30 | "blue" => COLOR_BLUE, 31 | "cyan" => COLOR_CYAN, 32 | "magenta" => COLOR_MAGENTA, 33 | "black" => COLOR_BLACK, 34 | "default" => -1 } 35 | colors[color] 36 | end 37 | 38 | # Maps color name to a color pair index 39 | def ColorMap.get_color_pair(color) 40 | colors = { "white" => 1, 41 | "yellow" => 2, 42 | "red" => 3, 43 | "green" => 4, 44 | "blue" => 5, 45 | "cyan" => 6, 46 | "magenta" => 7, 47 | "black" => 8, 48 | "default" =>-1} 49 | colors[color] 50 | end 51 | 52 | end 53 | 54 | # Opens a TPP source file, and splits it into the different pages. 55 | class FileParser 56 | 57 | def initialize(filename) 58 | @filename = filename 59 | @pages = [] 60 | end 61 | 62 | # Parses the specified file and returns an array of Page objects 63 | def get_pages 64 | begin 65 | f = File.open(@filename) 66 | rescue 67 | $stderr.puts "Error: couldn't open file: #{$!}" 68 | Kernel.exit(1) 69 | end 70 | 71 | number_pages = 0 72 | 73 | cur_page = Page.new("Title") 74 | 75 | f.each_line do |line| 76 | line.chomp! 77 | case line 78 | when /^--##/ # ignore comments 79 | when /^--newpage/ 80 | @pages << cur_page 81 | number_pages += 1 82 | name = line.sub(/^--newpage/,"") 83 | if name == "" then 84 | name = "slide " + (number_pages+1).to_s 85 | else 86 | name.strip! 87 | end 88 | cur_page = Page.new(name) 89 | else 90 | cur_page.add_line(line) 91 | end # case 92 | end # each 93 | @pages << cur_page 94 | end 95 | end # class FileParser 96 | 97 | 98 | # Represents a page (aka `slide') in TPP. A page consists of a title and one or 99 | # more lines. 100 | class Page 101 | 102 | def initialize(title) 103 | @lines = [] 104 | @title = title 105 | @cur_line = 0 106 | @eop = false 107 | end 108 | 109 | # Appends a line to the page, but only if _line_ is not null 110 | def add_line(line) 111 | @lines << line if line 112 | if line =~ /^\$\$/ or line =~ /^\$\%/ 113 | prefix = '' 114 | prefix = '%' if line =~ /^\$\%/ 115 | 116 | cmd = line[2..-1] 117 | begin 118 | op = IO.popen(cmd,"r") 119 | op.readlines.each do |out_line| 120 | @lines << prefix + out_line 121 | end 122 | op.close 123 | rescue => e 124 | @lines << e.to_s 125 | end 126 | end 127 | end 128 | 129 | # Returns the next line. In case the last line is hit, then the end-of-page marker is set. 130 | def next_line 131 | line = @lines[@cur_line] 132 | @cur_line += 1 133 | if @cur_line >= @lines.size then 134 | @eop = true 135 | end 136 | return line 137 | end 138 | 139 | # Returns whether end-of-page has been reached. 140 | def eop? 141 | @eop 142 | end 143 | 144 | # Resets the end-of-page marker and sets the current line marker to the first line 145 | def reset_eop 146 | @cur_line = 0 147 | @eop = false 148 | end 149 | 150 | # Returns all lines in the page. 151 | def lines 152 | @lines 153 | end 154 | 155 | # Returns the page's title 156 | def title 157 | @title 158 | end 159 | end 160 | 161 | 162 | 163 | # Implements a generic visualizer from which all other visualizers need to be 164 | # derived. If Ruby supported abstract methods, all the do_* methods would be 165 | # abstract. 166 | class TppVisualizer 167 | 168 | def initialize 169 | # nothing 170 | end 171 | 172 | # Splits a line into several lines, where each of the result lines is at most 173 | # _width_ characters long, caring about word boundaries, and returns an array 174 | # of strings. 175 | def split_lines(text,width) 176 | lines = [] 177 | if text then 178 | begin 179 | i = width 180 | if text.length <= i then # text length is OK -> add it to array and stop splitting 181 | lines << text 182 | text = "" 183 | else 184 | # search for word boundary (space actually) 185 | while i > 0 and text[i] != ' '[0] do 186 | i -= 1 187 | end 188 | # if we can't find any space character, simply cut it off at the maximum width 189 | if i == 0 then 190 | i = width 191 | end 192 | # extract line 193 | x = text[0..i-1] 194 | # remove extracted line 195 | text = text[i+1..-1] 196 | # added line to array 197 | lines << x 198 | end 199 | end while text.length > 0 200 | end 201 | return lines 202 | end 203 | 204 | def do_footer(footer_text) 205 | $stderr.puts "Error: TppVisualizer#do_footer has been called directly." 206 | Kernel.exit(1) 207 | end 208 | 209 | def do_header(header_text) 210 | $stderr.puts "Error: TppVisualizer#do_header has been called directly." 211 | Kernel.exit(1) 212 | end 213 | 214 | 215 | def do_refresh 216 | $stderr.puts "Error: TppVisualizer#do_refresh has been called directly." 217 | Kernel.exit(1) 218 | end 219 | 220 | def new_page 221 | $stderr.puts "Error: TppVisualizer#new_page has been called directly." 222 | Kernel.exit(1) 223 | end 224 | 225 | def do_heading(text) 226 | $stderr.puts "Error: TppVisualizer#do_heading has been called directly." 227 | Kernel.exit(1) 228 | end 229 | 230 | def do_withborder 231 | $stderr.puts "Error: TppVisualizer#do_withborder has been called directly." 232 | Kernel.exit(1) 233 | end 234 | 235 | def do_horline 236 | $stderr.puts "Error: TppVisualizer#do_horline has been called directly." 237 | Kernel.exit(1) 238 | end 239 | 240 | def do_color(text) 241 | $stderr.puts "Error: TppVisualizer#do_color has been called directly." 242 | Kernel.exit(1) 243 | end 244 | 245 | def do_center(text) 246 | $stderr.puts "Error: TppVisualizer#do_center has been called directly." 247 | Kernel.exit(1) 248 | end 249 | 250 | def do_right(text) 251 | $stderr.puts "Error: TppVisualizer#do_right has been called directly." 252 | Kernel.exit(1) 253 | end 254 | 255 | def do_exec(cmdline) 256 | $stderr.puts "Error: TppVisualizer#do_exec has been called directly." 257 | Kernel.exit(1) 258 | end 259 | 260 | def do_wait 261 | $stderr.puts "Error: TppVisualizer#do_wait has been called directly." 262 | Kernel.exit(1) 263 | end 264 | 265 | def do_beginoutput 266 | $stderr.puts "Error: TppVisualizer#do_beginoutput has been called directly." 267 | Kernel.exit(1) 268 | end 269 | 270 | def do_beginshelloutput 271 | $stderr.puts "Error: TppVisualizer#do_beginshelloutput has been called directly." 272 | Kernel.exit(1) 273 | end 274 | 275 | def do_endoutput 276 | $stderr.puts "Error: TppVisualizer#do_endoutput has been called directly." 277 | Kernel.exit(1) 278 | end 279 | 280 | def do_endshelloutput 281 | $stderr.puts "Error: TppVisualizer#do_endshelloutput has been called directly." 282 | Kernel.exit(1) 283 | end 284 | 285 | def do_sleep(time2sleep) 286 | $stderr.puts "Error: TppVisualizer#do_sleep has been called directly." 287 | Kernel.exit(1) 288 | end 289 | 290 | def do_boldon 291 | $stderr.puts "Error: TppVisualizer#do_boldon has been called directly." 292 | Kernel.exit(1) 293 | end 294 | 295 | def do_boldoff 296 | $stderr.puts "Error: TppVisualizer#do_boldoff has been called directly." 297 | Kernel.exit(1) 298 | end 299 | 300 | def do_revon 301 | $stderr.puts "Error: TppVisualizer#do_revon has been called directly." 302 | Kernel.exit(1) 303 | end 304 | 305 | def do_revoff 306 | $stderr.puts "Error: TppVisualizer#do_revoff has been called directly." 307 | Kernel.exit(1) 308 | end 309 | 310 | def do_ulon 311 | $stderr.puts "Error: TppVisualizer#do_ulon has been called directly." 312 | Kernel.exit(1) 313 | end 314 | 315 | def do_uloff 316 | $stderr.puts "Error: TppVisualizer#do_uloff has been called directly." 317 | Kernel.exit(1) 318 | end 319 | 320 | def do_beginslideleft 321 | $stderr.puts "Error: TppVisualizer#do_beginslideleft has been called directly." 322 | Kernel.exit(1) 323 | end 324 | 325 | def do_endslide 326 | $stderr.puts "Error: TppVisualizer#do_endslide has been called directly." 327 | Kernel.exit(1) 328 | end 329 | 330 | def do_beginslideright 331 | $stderr.puts "Error: TppVisualizer#do_beginslideright has been called directly." 332 | Kernel.exit(1) 333 | end 334 | 335 | def do_beginslidetop 336 | $stderr.puts "Error: TppVisualizer#do_beginslidetop has been called directly." 337 | Kernel.exit(1) 338 | end 339 | 340 | def do_beginslidebottom 341 | $stderr.puts "Error: TppVisualizer#do_beginslidebottom has been called directly." 342 | Kernel.exit(1) 343 | end 344 | 345 | def do_sethugefont 346 | $stderr.puts "Error: TppVisualizer#do_sethugefont has been called directly." 347 | Kernel.exit(1) 348 | end 349 | 350 | def do_huge(text) 351 | $stderr.puts "Error: TppVisualizer#do_huge has been called directly." 352 | Kernel.exit(1) 353 | end 354 | 355 | def print_line(line) 356 | $stderr.puts "Error: TppVisualizer#print_line has been called directly." 357 | Kernel.exit(1) 358 | end 359 | 360 | def do_title(title) 361 | $stderr.puts "Error: TppVisualizer#do_title has been called directly." 362 | Kernel.exit(1) 363 | end 364 | 365 | def do_author(author) 366 | $stderr.puts "Error: TppVisualizer#do_author has been called directly." 367 | Kernel.exit(1) 368 | end 369 | 370 | def do_date(date) 371 | $stderr.puts "Error: TppVisualizer#do_date has been called directly." 372 | Kernel.exit(1) 373 | end 374 | 375 | def do_bgcolor(color) 376 | $stderr.puts "Error: TppVisualizer#do_bgcolor has been called directly." 377 | Kernel.exit(1) 378 | end 379 | 380 | def do_fgcolor(color) 381 | $stderr.puts "Error: TppVisualizer#do_fgcolor has been called directly." 382 | Kernel.exit(1) 383 | end 384 | 385 | def do_color(color) 386 | $stderr.puts "Error: TppVisualizer#do_color has been called directly." 387 | Kernel.exit(1) 388 | end 389 | 390 | # Receives a _line_, parses it if necessary, and dispatches it 391 | # to the correct method which then does the correct processing. 392 | # It returns whether the controller shall wait for input. 393 | def visualize(line) 394 | case line 395 | when /^--heading / 396 | text = line.sub(/^--heading /,"") 397 | do_heading(text) 398 | when /^--withborder/ 399 | do_withborder 400 | when /^--horline/ 401 | do_horline 402 | when /^--color / 403 | text = line.sub(/^--color /,"") 404 | text.strip! 405 | do_color(text) 406 | when /^--center / 407 | text = line.sub(/^--center /,"") 408 | do_center(text) 409 | when /^--right / 410 | text = line.sub(/^--right /,"") 411 | do_right(text) 412 | when /^--exec / 413 | cmdline = line.sub(/^--exec /,"") 414 | do_exec(cmdline) 415 | when /^---/ 416 | do_wait 417 | return true 418 | when /^--beginoutput/ 419 | do_beginoutput 420 | when /^--beginshelloutput/ 421 | do_beginshelloutput 422 | when /^--endoutput/ 423 | do_endoutput 424 | when /^--endshelloutput/ 425 | do_endshelloutput 426 | when /^--sleep / 427 | time2sleep = line.sub(/^--sleep /,"") 428 | do_sleep(time2sleep) 429 | when /^--boldon/ 430 | do_boldon 431 | when /^--boldoff/ 432 | do_boldoff 433 | when /^--revon/ 434 | do_revon 435 | when /^--revoff/ 436 | do_revoff 437 | when /^--ulon/ 438 | do_ulon 439 | when /^--uloff/ 440 | do_uloff 441 | when /^--beginslideleft/ 442 | do_beginslideleft 443 | when /^--endslideleft/, /^--endslideright/, /^--endslidetop/, /^--endslidebottom/ 444 | do_endslide 445 | when /^--beginslideright/ 446 | do_beginslideright 447 | when /^--beginslidetop/ 448 | do_beginslidetop 449 | when /^--beginslidebottom/ 450 | do_beginslidebottom 451 | when /^--sethugefont / 452 | params = line.sub(/^--sethugefont /,"") 453 | do_sethugefont(params.strip) 454 | when /^--huge / 455 | figlet_text = line.sub(/^--huge /,"") 456 | do_huge(figlet_text) 457 | when /^--footer / 458 | @footer_txt = line.sub(/^--footer /,"") 459 | do_footer(@footer_txt) 460 | when /^--header / 461 | @header_txt = line.sub(/^--header /,"") 462 | do_header(@header_txt) 463 | when /^--title / 464 | title = line.sub(/^--title /,"") 465 | do_title(title) 466 | when /^--author / 467 | author = line.sub(/^--author /,"") 468 | do_author(author) 469 | when /^--date / 470 | date = line.sub(/^--date /,"") 471 | if date == "today" then 472 | date = Time.now.strftime("%b %d %Y") 473 | elsif date =~ /^today / then 474 | date = Time.now.strftime(date.sub(/^today /,"")) 475 | end 476 | do_date(date) 477 | when /^--bgcolor / 478 | color = line.sub(/^--bgcolor /,"").strip 479 | do_bgcolor(color) 480 | when /^--fgcolor / 481 | color = line.sub(/^--fgcolor /,"").strip 482 | do_fgcolor(color) 483 | when /^--color / 484 | color = line.sub(/^--color /,"").strip 485 | do_color(color) 486 | when /^--include-file / 487 | @lastFileName = line.sub(/^--include-file /,"").strip 488 | do_beginoutput 489 | print_line(@lastFileName) 490 | do_beginoutput 491 | f = File.open(@lastFileName) 492 | f.each_line do |fileLine| 493 | fileLine.chomp! 494 | if fileLine 495 | print_line(fileLine) 496 | end 497 | end 498 | do_endoutput 499 | else 500 | print_line(line) 501 | end 502 | 503 | return false 504 | end 505 | 506 | def close 507 | # nothing 508 | end 509 | 510 | end 511 | 512 | # Implements an interactive visualizer which builds on top of ncurses. 513 | class NcursesVisualizer < TppVisualizer 514 | 515 | def initialize 516 | @figletfont = "standard" 517 | Ncurses.initscr 518 | Ncurses.curs_set(0) 519 | Ncurses.cbreak # unbuffered input 520 | Ncurses.noecho # turn off input echoing 521 | Ncurses.stdscr.intrflush(false) 522 | Ncurses.stdscr.keypad(true) 523 | @screen = Ncurses.stdscr 524 | @lastFileName = nil 525 | setsizes 526 | Ncurses.start_color() 527 | Ncurses.use_default_colors() 528 | do_bgcolor("black") 529 | #do_fgcolor("white") 530 | @fgcolor = ColorMap.get_color_pair("white") 531 | @voffset = 5 532 | @indent = 3 533 | @cur_line = @voffset 534 | @output = @shelloutput = false 535 | end 536 | 537 | def get_key 538 | ch = Ncurses.getch 539 | case ch 540 | when 100, #d 541 | 68, #D 542 | 106, #j 543 | 74, #J 544 | 108, #l 545 | 76, #L 546 | Ncurses::KEY_DOWN, 547 | Ncurses::KEY_RIGHT 548 | return :keyright 549 | when 97, #a 550 | 65, #A 551 | 98, #b 552 | 66, #B 553 | 104, #h 554 | 72, #h 555 | 107, #k 556 | 75, #k 557 | Ncurses::KEY_UP, 558 | Ncurses::KEY_LEFT 559 | return :keyleft 560 | when 122, #z 561 | 90 #Z 562 | return :keyresize 563 | when 114, #r 564 | 82 #R 565 | return :reload 566 | when 113, #q 567 | 81 #Q 568 | return :quit 569 | when 115, #s 570 | 83 #S 571 | return :firstpage 572 | when 101, #e 573 | 69 #E 574 | return :edit 575 | when 103, #g 576 | 71 #g 577 | return :jumptoslide 578 | when 63 #? 579 | return :help 580 | 581 | else 582 | return :keyright 583 | end 584 | end 585 | 586 | def clear 587 | @screen.clear 588 | @screen.refresh 589 | end 590 | 591 | 592 | def setsizes 593 | @termwidth = Ncurses.getmaxx(@screen) 594 | @termheight = Ncurses.getmaxy(@screen) 595 | end 596 | 597 | def do_refresh 598 | @screen.refresh 599 | end 600 | 601 | def do_withborder 602 | @withborder = true 603 | draw_border 604 | end 605 | 606 | def draw_border 607 | @screen.move(0,0) 608 | @screen.addstr(".") 609 | (@termwidth-2).times { @screen.addstr("-") }; @screen.addstr(".") 610 | @screen.move(@termheight-2,0) 611 | @screen.addstr("`") 612 | (@termwidth-2).times { @screen.addstr("-") }; @screen.addstr("'") 613 | 1.upto(@termheight-3) do |y| 614 | @screen.move(y,0) 615 | @screen.addstr("|") 616 | end 617 | 1.upto(@termheight-3) do |y| 618 | @screen.move(y,@termwidth-1) 619 | @screen.addstr("|") 620 | end 621 | end 622 | 623 | def new_page 624 | @cur_line = @voffset 625 | @output = @shelloutput = false 626 | setsizes 627 | @screen.clear 628 | end 629 | 630 | def do_heading(line) 631 | @screen.attron(Ncurses::A_BOLD) 632 | print_heading(line) 633 | @screen.attroff(Ncurses::A_BOLD) 634 | end 635 | 636 | def do_horline 637 | @screen.attron(Ncurses::A_BOLD) 638 | @termwidth.times do |x| 639 | @screen.move(@cur_line,x) 640 | @screen.addstr("-") 641 | end 642 | @screen.attroff(Ncurses::A_BOLD) 643 | end 644 | 645 | def print_heading(text) 646 | width = @termwidth - 2*@indent 647 | lines = split_lines(text,width) 648 | lines.each do |l| 649 | @screen.move(@cur_line,@indent) 650 | x = (@termwidth - l.length)/2 651 | @screen.move(@cur_line,x) 652 | @screen.addstr(l) 653 | @cur_line += 1 654 | end 655 | end 656 | 657 | def do_center(text) 658 | width = @termwidth - 2*@indent 659 | if @output or @shelloutput then 660 | width -= 2 661 | end 662 | lines = split_lines(text,width) 663 | lines.each do |l| 664 | @screen.move(@cur_line,@indent) 665 | if @output or @shelloutput then 666 | @screen.addstr("| ") 667 | end 668 | x = (@termwidth - l.length)/2 669 | @screen.move(@cur_line,x) 670 | @screen.addstr(l) 671 | if @output or @shelloutput then 672 | @screen.move(@cur_line,@termwidth - @indent - 2) 673 | @screen.addstr(" |") 674 | end 675 | @cur_line += 1 676 | end 677 | end 678 | 679 | def do_right(text) 680 | width = @termwidth - 2*@indent 681 | if @output or @shelloutput then 682 | width -= 2 683 | end 684 | lines = split_lines(text,width) 685 | lines.each do |l| 686 | @screen.move(@cur_line,@indent) 687 | if @output or @shelloutput then 688 | @screen.addstr("| ") 689 | end 690 | x = (@termwidth - l.length - 5) 691 | @screen.move(@cur_line,x) 692 | @screen.addstr(l) 693 | if @output or @shelloutput then 694 | @screen.addstr(" |") 695 | end 696 | @cur_line += 1 697 | end 698 | end 699 | 700 | def show_help_page 701 | help_text = [ "tpp help", 702 | "", 703 | "space bar ............................... display next entry within page", 704 | "space bar, cursor-down, cursor-right .... display next page", 705 | "b, cursor-up, cursor-left ............... display previous page", 706 | "q, Q .................................... quit tpp", 707 | "j, J .................................... jump directly to page", 708 | "l, L .................................... reload current file", 709 | "s, S .................................... jump to the first page", 710 | "e, E .................................... jump to the last page", 711 | "c, C .................................... start command line", 712 | "?, h .................................... this help screen" ] 713 | @screen.clear 714 | y = @voffset 715 | help_text.each do |line| 716 | @screen.move(y,@indent) 717 | @screen.addstr(line) 718 | y += 1 719 | end 720 | @screen.move(@termheight - 2, @indent) 721 | @screen.addstr("Press any key to return to slide") 722 | @screen.refresh 723 | end 724 | 725 | def do_exec(cmdline) 726 | rc = Kernel.system(cmdline) 727 | if not rc then 728 | # @todo: add error message 729 | end 730 | end 731 | 732 | def do_wait 733 | # nothing 734 | end 735 | 736 | def do_beginoutput 737 | @screen.move(@cur_line,@indent) 738 | @screen.addstr(".") 739 | (@termwidth - @indent*2 - 2).times { @screen.addstr("-") } 740 | @screen.addstr(".") 741 | @output = true 742 | @cur_line += 1 743 | end 744 | 745 | def do_beginshelloutput 746 | @screen.move(@cur_line,@indent) 747 | @screen.addstr(".") 748 | (@termwidth - @indent*2 - 2).times { @screen.addstr("-") } 749 | @screen.addstr(".") 750 | @shelloutput = true 751 | @cur_line += 1 752 | end 753 | 754 | def do_endoutput 755 | if @output then 756 | @screen.move(@cur_line,@indent) 757 | @screen.addstr("`") 758 | (@termwidth - @indent*2 - 2).times { @screen.addstr("-") } 759 | @screen.addstr("'") 760 | @output = false 761 | @cur_line += 1 762 | end 763 | end 764 | 765 | def do_title(title) 766 | do_boldon 767 | do_center(title) 768 | do_boldoff 769 | do_center("") 770 | end 771 | 772 | def do_footer(footer_txt) 773 | @screen.move(@termheight - 3, (@termwidth - footer_txt.length)/2) 774 | @screen.addstr(footer_txt) 775 | end 776 | 777 | def do_header(header_txt) 778 | @screen.move(@termheight - @termheight+1, (@termwidth - header_txt.length)/2) 779 | @screen.addstr(header_txt) 780 | end 781 | 782 | def do_author(author) 783 | do_center(author) 784 | do_center("") 785 | end 786 | 787 | def do_date(date) 788 | do_center(date) 789 | do_center("") 790 | end 791 | 792 | def do_endshelloutput 793 | if @shelloutput then 794 | @screen.move(@cur_line,@indent) 795 | @screen.addstr("`") 796 | (@termwidth - @indent*2 - 2).times { @screen.addstr("-") } 797 | @screen.addstr("'") 798 | @shelloutput = false 799 | @cur_line += 1 800 | end 801 | end 802 | 803 | def do_sleep(time2sleep) 804 | Kernel.sleep(time2sleep.to_i) 805 | end 806 | 807 | def do_boldon 808 | @screen.attron(Ncurses::A_BOLD) 809 | end 810 | 811 | def do_boldoff 812 | @screen.attroff(Ncurses::A_BOLD) 813 | end 814 | 815 | def do_revon 816 | @screen.attron(Ncurses::A_REVERSE) 817 | end 818 | 819 | def do_revoff 820 | @screen.attroff(Ncurses::A_REVERSE) 821 | end 822 | 823 | def do_ulon 824 | @screen.attron(Ncurses::A_UNDERLINE) 825 | end 826 | 827 | def do_uloff 828 | @screen.attroff(Ncurses::A_UNDERLINE) 829 | end 830 | 831 | def do_beginslideleft 832 | @slideoutput = true 833 | @slidedir = "left" 834 | end 835 | 836 | def do_endslide 837 | @slideoutput = false 838 | end 839 | 840 | def do_beginslideright 841 | @slideoutput = true 842 | @slidedir = "right" 843 | end 844 | 845 | def do_beginslidetop 846 | @slideoutput = true 847 | @slidedir = "top" 848 | end 849 | 850 | def do_beginslidebottom 851 | @slideoutput = true 852 | @slidedir = "bottom" 853 | end 854 | 855 | def do_sethugefont(params) 856 | @figletfont = params 857 | end 858 | 859 | def do_huge(figlet_text) 860 | output_width = @termwidth - @indent 861 | output_width -= 2 if @output or @shelloutput 862 | op = IO.popen("figlet -f #{@figletfont} -w #{output_width} -k \"#{figlet_text}\"","r") 863 | op.readlines.each do |line| 864 | print_line(line) 865 | end 866 | op.close 867 | end 868 | 869 | def do_bgcolor(color) 870 | bgcolor = ColorMap.get_color(color) or COLOR_BLACK 871 | Ncurses.init_pair(1, COLOR_WHITE, bgcolor) 872 | Ncurses.init_pair(2, COLOR_YELLOW, bgcolor) 873 | Ncurses.init_pair(3, COLOR_RED, bgcolor) 874 | Ncurses.init_pair(4, COLOR_GREEN, bgcolor) 875 | Ncurses.init_pair(5, COLOR_BLUE, bgcolor) 876 | Ncurses.init_pair(6, COLOR_CYAN, bgcolor) 877 | Ncurses.init_pair(7, COLOR_MAGENTA, bgcolor) 878 | Ncurses.init_pair(8, COLOR_BLACK, bgcolor) 879 | if @fgcolor then 880 | Ncurses.bkgd(Ncurses.COLOR_PAIR(@fgcolor)) 881 | else 882 | Ncurses.bkgd(Ncurses.COLOR_PAIR(1)) 883 | end 884 | end 885 | 886 | def do_fgcolor(color) 887 | @fgcolor = ColorMap.get_color_pair(color) 888 | Ncurses.attron(Ncurses.COLOR_PAIR(@fgcolor)) 889 | end 890 | 891 | def do_color(color) 892 | num = ColorMap.get_color_pair(color) 893 | Ncurses.attron(Ncurses.COLOR_PAIR(num)) 894 | end 895 | 896 | def type_line(l) 897 | l.each_byte do |x| 898 | @screen.addstr(x.chr) 899 | @screen.refresh() 900 | r = rand(20) 901 | time_to_sleep = (5 + r).to_f / 250; 902 | # puts "#{time_to_sleep} #{r}" 903 | Kernel.sleep(time_to_sleep) 904 | end 905 | end 906 | 907 | def slide_text(l) 908 | return if l == "" 909 | case @slidedir 910 | when "left" 911 | xcount = l.length-1 912 | while xcount >= 0 913 | @screen.move(@cur_line,@indent) 914 | @screen.addstr(l[xcount..l.length-1]) 915 | @screen.refresh() 916 | time_to_sleep = 1.to_f / 20 917 | Kernel.sleep(time_to_sleep) 918 | xcount -= 1 919 | end 920 | when "right" 921 | (@termwidth - @indent).times do |pos| 922 | @screen.move(@cur_line,@termwidth - pos - 1) 923 | @screen.clrtoeol() 924 | @screen.addstr(l[0..pos]) 925 | @screen.refresh() 926 | time_to_sleep = 1.to_f / 20 927 | Kernel.sleep(time_to_sleep) 928 | end # do 929 | when "top" 930 | # ycount = @cur_line 931 | new_scr = @screen.dupwin 932 | 1.upto(@cur_line) do |i| 933 | Ncurses.overwrite(new_scr,@screen) # overwrite @screen with new_scr 934 | @screen.move(i,@indent) 935 | @screen.addstr(l) 936 | @screen.refresh() 937 | Kernel.sleep(1.to_f / 10) 938 | end 939 | when "bottom" 940 | new_scr = @screen.dupwin 941 | (@termheight-1).downto(@cur_line) do |i| 942 | Ncurses.overwrite(new_scr,@screen) 943 | @screen.move(i,@indent) 944 | @screen.addstr(l) 945 | @screen.refresh() 946 | Kernel.sleep(1.to_f / 10) 947 | end 948 | end 949 | end 950 | 951 | def print_line(line) 952 | width = @termwidth - 2*@indent 953 | if @output or @shelloutput then 954 | width -= 2 955 | end 956 | lines = split_lines(line,width) 957 | lines.each do |l| 958 | @screen.move(@cur_line,@indent) 959 | if (@output or @shelloutput) and ! @slideoutput then 960 | @screen.addstr("| ") 961 | end 962 | if @shelloutput and (l =~ /^\$/ or l=~ /^%/ or l =~ /^#/) then # allow sh and csh style prompts 963 | type_line(l) 964 | elsif @slideoutput then 965 | slide_text(l) 966 | else 967 | @screen.addstr(l) 968 | end 969 | if (@output or @shelloutput) and ! @slideoutput then 970 | @screen.move(@cur_line,@termwidth - @indent - 2) 971 | @screen.addstr(" |") 972 | end 973 | @cur_line += 1 974 | end 975 | end 976 | 977 | def close 978 | Ncurses.nocbreak 979 | Ncurses.endwin 980 | end 981 | 982 | def read_newpage(pages,current_page) 983 | page = [] 984 | @screen.clear() 985 | col = 0 986 | line = 2 987 | pages.each_index do |i| 988 | @screen.move(line,col*15 + 2) 989 | if current_page == i then 990 | @screen.printw("%2d %s <=",i+1,pages[i].title[0..80]) 991 | else 992 | @screen.printw("%2d %s",i+1,pages[i].title[0..80]) 993 | end 994 | line += 1 995 | if line >= @termheight - 3 then 996 | line = 2 997 | col += 1 998 | end 999 | end 1000 | prompt = "jump to slide: " 1001 | prompt_indent = 12 1002 | @screen.move(@termheight - 2, @indent + prompt_indent) 1003 | @screen.addstr(prompt) 1004 | # @screen.refresh(); 1005 | Ncurses.echo 1006 | @screen.scanw("%d",page) 1007 | Ncurses.noecho 1008 | @screen.move(@termheight - 2, @indent + prompt_indent) 1009 | (prompt.length + page[0].to_s.length).times { @screen.addstr(" ") } 1010 | if page[0] then 1011 | return page[0] - 1 1012 | end 1013 | return -1 # invalid page 1014 | end 1015 | 1016 | def store_screen 1017 | @screen.dupwin 1018 | end 1019 | 1020 | def getLastFile 1021 | @lastFileName 1022 | end 1023 | 1024 | def restore_screen(s) 1025 | Ncurses.overwrite(s,@screen) 1026 | end 1027 | 1028 | def draw_slidenum(cur_page,max_pages,eop) 1029 | @screen.move(@termheight - 2, @indent) 1030 | @screen.attroff(Ncurses::A_BOLD) # this is bad 1031 | @screen.addstr("[slide #{cur_page}/#{max_pages}]") 1032 | if @footer_txt.to_s.length > 0 then 1033 | do_footer(@footer_txt) 1034 | end 1035 | if @header_txt.to_s.length > 0 then 1036 | do_header(@header_txt) 1037 | end 1038 | 1039 | if eop then 1040 | draw_eop_marker 1041 | end 1042 | end 1043 | 1044 | def draw_eop_marker 1045 | @screen.move(@termheight - 2, @indent - 1) 1046 | @screen.attron(A_BOLD) 1047 | @screen.addstr("*") 1048 | @screen.attroff(A_BOLD) 1049 | end 1050 | 1051 | end 1052 | 1053 | 1054 | # Implements a visualizer which converts TPP source to LaTeX-beamer source (http://latex-beamer.sf.net/ 1055 | class LatexVisualizer < TppVisualizer 1056 | 1057 | def initialize(outputfile) 1058 | @filename = outputfile 1059 | begin 1060 | @f = File.open(@filename,"w+") 1061 | rescue 1062 | $stderr.print "Error: couldn't open file: #{$!}" 1063 | Kernel.exit(1) 1064 | end 1065 | @slide_open = false 1066 | @verbatim_open = false 1067 | @width = 50 1068 | @title = @date = @author = false 1069 | @begindoc = false 1070 | @f.puts '% Filename: tpp.tex 1071 | % Purpose: template file for tpp latex export 1072 | % Authors: (c) Andreas Gredler, Michael Prokop http://grml.org/ 1073 | % License: This file is licensed under the GPL v2. 1074 | % Latest change: Fre Apr 15 20:34:37 CEST 2005 1075 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1076 | 1077 | \documentclass{beamer} 1078 | 1079 | \mode 1080 | { 1081 | \usetheme{Montpellier} 1082 | \setbeamercovered{transparent} 1083 | } 1084 | 1085 | \usepackage[german]{babel} 1086 | \usepackage{umlaut} 1087 | \usepackage[latin1]{inputenc} 1088 | \usepackage{times} 1089 | \usepackage[T1]{fontenc} 1090 | 1091 | ' 1092 | end 1093 | 1094 | def do_footer(footer_text) 1095 | end 1096 | 1097 | def do_header(header_text) 1098 | end 1099 | 1100 | def do_refresh 1101 | end 1102 | 1103 | def try_close 1104 | if @verbatim_open then 1105 | @f.puts '\end{verbatim}' 1106 | @verbatim_open = false 1107 | end 1108 | if @slide_open then 1109 | @f.puts '\end{frame}' 1110 | @slide_open = false 1111 | end 1112 | end 1113 | 1114 | def new_page 1115 | try_close 1116 | end 1117 | 1118 | def do_heading(text) 1119 | try_close 1120 | @f.puts "\\section{#{text}}" 1121 | end 1122 | 1123 | def do_withborder 1124 | end 1125 | 1126 | def do_horline 1127 | end 1128 | 1129 | def do_color(text) 1130 | end 1131 | 1132 | def do_center(text) 1133 | print_line(text) 1134 | end 1135 | 1136 | def do_right(text) 1137 | print_line(text) 1138 | end 1139 | 1140 | def do_exec(cmdline) 1141 | end 1142 | 1143 | def do_wait 1144 | end 1145 | 1146 | def do_beginoutput 1147 | # TODO: implement output stuff 1148 | end 1149 | 1150 | def do_beginshelloutput 1151 | end 1152 | 1153 | def do_endoutput 1154 | end 1155 | 1156 | def do_endshelloutput 1157 | end 1158 | 1159 | def do_sleep(time2sleep) 1160 | end 1161 | 1162 | def do_boldon 1163 | end 1164 | 1165 | def do_boldoff 1166 | end 1167 | 1168 | def do_revon 1169 | end 1170 | 1171 | def do_revoff 1172 | end 1173 | 1174 | def do_ulon 1175 | end 1176 | 1177 | def do_uloff 1178 | end 1179 | 1180 | def do_beginslideleft 1181 | end 1182 | 1183 | def do_endslide 1184 | end 1185 | 1186 | def do_beginslideright 1187 | end 1188 | 1189 | def do_beginslidetop 1190 | end 1191 | 1192 | def do_beginslidebottom 1193 | end 1194 | 1195 | def do_sethugefont(text) 1196 | end 1197 | 1198 | def do_huge(text) 1199 | end 1200 | 1201 | def try_open 1202 | if not @begindoc then 1203 | @f.puts '\begin{document}' 1204 | @begindoc = true 1205 | end 1206 | if not @slide_open then 1207 | @f.puts '\begin{frame}[fragile]' 1208 | @slide_open = true 1209 | end 1210 | if not @verbatim_open then 1211 | @f.puts '\begin{verbatim}' 1212 | @verbatim_open = true 1213 | end 1214 | end 1215 | 1216 | def try_intro 1217 | if @author and @title and @date and not @begindoc then 1218 | @f.puts '\begin{document}' 1219 | @begindoc = true 1220 | end 1221 | if @author and @title and @date then 1222 | @f.puts '\begin{frame} 1223 | \titlepage 1224 | \end{frame}' 1225 | end 1226 | end 1227 | 1228 | def print_line(line) 1229 | try_open 1230 | split_lines(line,@width).each do |l| 1231 | @f.puts "#{l}" 1232 | end 1233 | end 1234 | 1235 | def do_title(title) 1236 | @f.puts "\\title[#{title}]{#{title}}" 1237 | @title = true 1238 | try_intro 1239 | end 1240 | 1241 | def do_author(author) 1242 | @f.puts "\\author{#{author}}" 1243 | @author = true 1244 | try_intro 1245 | end 1246 | 1247 | def do_date(date) 1248 | @f.puts "\\date{#{date}}" 1249 | @date = true 1250 | try_intro 1251 | end 1252 | 1253 | def do_bgcolor(color) 1254 | end 1255 | 1256 | def do_fgcolor(color) 1257 | end 1258 | 1259 | def do_color(color) 1260 | end 1261 | 1262 | def close 1263 | try_close 1264 | @f.puts '\end{document} 1265 | %%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%' 1266 | @f.close 1267 | end 1268 | 1269 | end 1270 | 1271 | 1272 | # Implements a generic controller from which all other controllers need to be derived. 1273 | class TppController 1274 | 1275 | def initialize 1276 | $stderr.puts "Error: TppController.initialize has been called directly!" 1277 | Kernel.exit(1) 1278 | end 1279 | 1280 | def close 1281 | $stderr.puts "Error: TppController.close has been called directly!" 1282 | Kernel.exit(1) 1283 | end 1284 | 1285 | def run 1286 | $stderr.puts "Error: TppController.run has been called directly!" 1287 | Kernel.exit(1) 1288 | end 1289 | 1290 | end 1291 | 1292 | # Implements a non-interactive controller for ncurses. Useful for displaying 1293 | # unattended presentation. 1294 | class AutoplayController < TppController 1295 | 1296 | def initialize(filename,secs,visualizer_class) 1297 | @filename = filename 1298 | @vis = visualizer_class.new 1299 | @seconds = secs 1300 | @cur_page = 0 1301 | end 1302 | 1303 | def close 1304 | @vis.close 1305 | end 1306 | 1307 | def run 1308 | begin 1309 | @reload_file = false 1310 | parser = FileParser.new(@filename) 1311 | @pages = parser.get_pages 1312 | if @cur_page >= @pages.size then 1313 | @cur_page = @pages.size - 1 1314 | end 1315 | @vis.clear 1316 | @vis.new_page 1317 | do_run 1318 | end while @reload_file 1319 | end 1320 | 1321 | def do_run 1322 | loop do 1323 | wait = false 1324 | @vis.draw_slidenum(@cur_page + 1, @pages.size, false) 1325 | # read and visualize lines until the visualizer says "stop" or we reached end of page 1326 | begin 1327 | line = @pages[@cur_page].next_line 1328 | eop = @pages[@cur_page].eop? 1329 | wait = @vis.visualize(line) 1330 | end while not wait and not eop 1331 | # draw slide number on the bottom left and redraw: 1332 | @vis.draw_slidenum(@cur_page + 1, @pages.size, eop) 1333 | @vis.do_refresh 1334 | 1335 | if eop then 1336 | if @cur_page + 1 < @pages.size then 1337 | @cur_page += 1 1338 | else 1339 | @cur_page = 0 1340 | end 1341 | @pages[@cur_page].reset_eop 1342 | @vis.new_page 1343 | end 1344 | 1345 | Kernel.sleep(@seconds) 1346 | end # loop 1347 | end 1348 | 1349 | end 1350 | 1351 | # Implements an interactive controller which feeds the visualizer until it is 1352 | # told to stop, and then reads a key press and executes the appropriate action. 1353 | class InteractiveController < TppController 1354 | 1355 | def initialize(filename,visualizer_class) 1356 | @filename = filename 1357 | @vis = visualizer_class.new 1358 | @cur_page = 0 1359 | end 1360 | 1361 | def close 1362 | @vis.close 1363 | end 1364 | 1365 | def run 1366 | begin 1367 | @reload_file = false 1368 | parser = FileParser.new(@filename) 1369 | @pages = parser.get_pages 1370 | if @cur_page >= @pages.size then 1371 | @cur_page = @pages.size - 1 1372 | end 1373 | @vis.clear 1374 | @vis.new_page 1375 | do_run 1376 | end while @reload_file 1377 | end 1378 | 1379 | def do_run 1380 | loop do 1381 | wait = false 1382 | @vis.draw_slidenum(@cur_page + 1, @pages.size, false) 1383 | # read and visualize lines until the visualizer says "stop" or we reached end of page 1384 | begin 1385 | line = @pages[@cur_page].next_line 1386 | eop = @pages[@cur_page].eop? 1387 | wait = @vis.visualize(line) 1388 | end while not wait and not eop 1389 | # draw slide number on the bottom left and redraw: 1390 | @vis.draw_slidenum(@cur_page + 1, @pages.size, eop) 1391 | @vis.do_refresh 1392 | 1393 | # read a character from the keyboard 1394 | # a "break" in the when means that it breaks the loop, i.e. goes on with visualizing lines 1395 | loop do 1396 | ch = @vis.get_key 1397 | case ch 1398 | when :quit 1399 | return 1400 | when :redraw 1401 | # @todo: actually implement redraw 1402 | when :lastpage 1403 | @cur_page = @pages.size - 1 1404 | break 1405 | when :edit 1406 | if @vis.getLastFile 1407 | screen = @vis.store_screen 1408 | Kernel.system("vim " + @vis.getLastFile) 1409 | @vis.restore_screen(screen) 1410 | end 1411 | break 1412 | when :firstpage 1413 | @cur_page = 0 1414 | break 1415 | when :jumptoslide 1416 | screen = @vis.store_screen 1417 | p = @vis.read_newpage(@pages,@cur_page) 1418 | if p >= 0 and p < @pages.size 1419 | @cur_page = p 1420 | @pages[@cur_page].reset_eop 1421 | @vis.new_page 1422 | else 1423 | @vis.restore_screen(screen) 1424 | end 1425 | break 1426 | when :reload 1427 | @reload_file = true 1428 | return 1429 | when :help 1430 | screen = @vis.store_screen 1431 | @vis.show_help_page 1432 | ch = @vis.get_key 1433 | @vis.clear 1434 | @vis.restore_screen(screen) 1435 | when :keyright 1436 | if @cur_page + 1 < @pages.size and eop then 1437 | @cur_page += 1 1438 | @pages[@cur_page].reset_eop 1439 | @vis.new_page 1440 | end 1441 | break 1442 | when :keyleft 1443 | if @cur_page > 0 then 1444 | @cur_page -= 1 1445 | @pages[@cur_page].reset_eop 1446 | @vis.new_page 1447 | end 1448 | break 1449 | when :keyresize 1450 | @vis.setsizes 1451 | end 1452 | end 1453 | end # loop 1454 | end 1455 | 1456 | end 1457 | 1458 | 1459 | # Implements a visualizer which converts TPP source to a nicely formatted text 1460 | # file which can e.g. be used as handout. 1461 | class TextVisualizer < TppVisualizer 1462 | 1463 | def initialize(outputfile) 1464 | @filename = outputfile 1465 | begin 1466 | @f = File.open(@filename,"w+") 1467 | rescue 1468 | $stderr.print "Error: couldn't open file: #{$!}" 1469 | Kernel.exit(1) 1470 | end 1471 | @output_env = false 1472 | @title = @author = @date = false 1473 | @figletfont = "small" 1474 | @width = 80 1475 | end 1476 | 1477 | def do_footer(footer_text) 1478 | end 1479 | 1480 | def do_header(header_text) 1481 | end 1482 | 1483 | def do_refresh 1484 | end 1485 | 1486 | def new_page 1487 | @f.puts "--------------------------------------------" 1488 | end 1489 | 1490 | def do_heading(text) 1491 | @f.puts "\n" 1492 | split_lines(text,@width).each do |l| 1493 | @f.puts "#{l}\n" 1494 | end 1495 | @f.puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 1496 | end 1497 | 1498 | def do_withborder 1499 | end 1500 | 1501 | def do_horline 1502 | @f.puts "********************************************" 1503 | end 1504 | 1505 | def do_color(text) 1506 | end 1507 | 1508 | def do_exec(cmdline) 1509 | end 1510 | 1511 | def do_wait 1512 | end 1513 | 1514 | def do_beginoutput 1515 | @f.puts ".---------------------------" 1516 | @output_env = true 1517 | end 1518 | 1519 | def do_beginshelloutput 1520 | do_beginoutput 1521 | end 1522 | 1523 | def do_endoutput 1524 | @f.puts "`---------------------------" 1525 | @output_env = false 1526 | end 1527 | 1528 | def do_endshelloutput 1529 | do_endoutput 1530 | end 1531 | 1532 | def do_sleep(time2sleep) 1533 | end 1534 | 1535 | def do_boldon 1536 | end 1537 | 1538 | def do_boldoff 1539 | end 1540 | 1541 | def do_revon 1542 | end 1543 | 1544 | def do_revoff 1545 | end 1546 | 1547 | def do_ulon 1548 | end 1549 | 1550 | def do_uloff 1551 | end 1552 | 1553 | def do_beginslideleft 1554 | end 1555 | 1556 | def do_endslide 1557 | end 1558 | 1559 | def do_beginslideright 1560 | end 1561 | 1562 | def do_beginslidetop 1563 | end 1564 | 1565 | def do_beginslidebottom 1566 | end 1567 | 1568 | def do_sethugefont(text) 1569 | @figletfont = text 1570 | end 1571 | 1572 | def do_huge(text) 1573 | output_width = @width 1574 | output_width -= 2 if @output_env 1575 | op = IO.popen("figlet -f #{@figletfont} -w @output_width -k \"#{text}\"","r") 1576 | op.readlines.each do |line| 1577 | print_line(line) 1578 | end 1579 | op.close 1580 | end 1581 | 1582 | def print_line(line) 1583 | lines = split_lines(line,@width) 1584 | lines.each do |l| 1585 | if @output_env then 1586 | @f.puts "| #{l}" 1587 | else 1588 | @f.puts "#{l}" 1589 | end 1590 | end 1591 | end 1592 | 1593 | def do_center(text) 1594 | lines = split_lines(text,@width) 1595 | lines.each do |line| 1596 | spaces = (@width - line.length) / 2 1597 | spaces = 0 if spaces < 0 1598 | spaces.times { line = " " + line } 1599 | print_line(line) 1600 | end 1601 | end 1602 | 1603 | def do_right(text) 1604 | lines = split_lines(text,@width) 1605 | lines.each do |line| 1606 | spaces = @width - line.length 1607 | spaces = 0 if spaces < 0 1608 | spaces.times { line = " " + line } 1609 | print_line(line) 1610 | end 1611 | end 1612 | 1613 | def do_title(title) 1614 | @f.puts "Title: #{title}" 1615 | @title = true 1616 | if @title and @author and @date then 1617 | @f.puts "\n\n" 1618 | end 1619 | end 1620 | 1621 | def do_author(author) 1622 | @f.puts "Author: #{author}" 1623 | @author = true 1624 | if @title and @author and @date then 1625 | @f.puts "\n\n" 1626 | end 1627 | end 1628 | 1629 | def do_date(date) 1630 | @f.puts "Date: #{date}" 1631 | @date = true 1632 | if @title and @author and @date then 1633 | @f.puts "\n\n" 1634 | end 1635 | end 1636 | 1637 | def do_bgcolor(color) 1638 | end 1639 | 1640 | def do_fgcolor(color) 1641 | end 1642 | 1643 | def do_color(color) 1644 | end 1645 | 1646 | def close 1647 | @f.close 1648 | end 1649 | 1650 | end 1651 | 1652 | # Implements a non-interactive controller to control non-interactive 1653 | # visualizers (i.e. those that are used for converting TPP source code into 1654 | # another format) 1655 | class ConversionController < TppController 1656 | 1657 | def initialize(input,output,visualizer_class) 1658 | parser = FileParser.new(input) 1659 | @pages = parser.get_pages 1660 | @vis = visualizer_class.new(output) 1661 | end 1662 | 1663 | def run 1664 | @pages.each do |p| 1665 | begin 1666 | line = p.next_line 1667 | eop = p.eop? 1668 | @vis.visualize(line) 1669 | end while not eop 1670 | end 1671 | end 1672 | 1673 | def close 1674 | @vis.close 1675 | end 1676 | 1677 | end 1678 | 1679 | # Prints a nicely formatted usage message. 1680 | def usage 1681 | $stderr.puts "usage: #{$0} [-t -o ] \n" 1682 | $stderr.puts "\t -t \tset filetype as output format" 1683 | $stderr.puts "\t -o \twrite output to file " 1684 | $stderr.puts "\t -s \twait seconds between slides (with -t autoplay)" 1685 | $stderr.puts "\t --version\tprint the version" 1686 | $stderr.puts "\t --help\t\tprint this help" 1687 | $stderr.puts "\n\t currently available types: ncurses (default), autoplay, latex, txt" 1688 | Kernel.exit(1) 1689 | end 1690 | 1691 | 1692 | 1693 | ################################ 1694 | # Here starts the main program # 1695 | ################################ 1696 | 1697 | input = nil 1698 | output = nil 1699 | type = "ncurses" 1700 | time = 1 1701 | 1702 | skip_next = false 1703 | 1704 | ARGV.each_index do |i| 1705 | if skip_next then 1706 | skip_next = false 1707 | else 1708 | if ARGV[i] == '-v' or ARGV[i] == '--version' then 1709 | printf "tpp - text presentation program %s\n", version_number 1710 | Kernel.exit(1) 1711 | elsif ARGV[i] == '-h' or ARGV[i] == '--help' then 1712 | usage 1713 | elsif ARGV[i] == '-t' then 1714 | type = ARGV[i+1] 1715 | skip_next = true 1716 | elsif ARGV[i] == '-o' then 1717 | output = ARGV[i+1] 1718 | skip_next = true 1719 | elsif ARGV[i] == "-s" then 1720 | time = ARGV[i+1].to_i 1721 | skip_next = true 1722 | elsif input == nil then 1723 | input = ARGV[i] 1724 | end 1725 | if output!=nil and output==input then 1726 | $stderr.puts "Don't use the input file name as the output filename to prevent overwriting it. \n" 1727 | Kernel.exit(1) 1728 | end 1729 | end 1730 | end 1731 | 1732 | if input == nil then 1733 | usage 1734 | end 1735 | 1736 | ctrl = nil 1737 | 1738 | case type 1739 | when "ncurses" 1740 | load_ncurses 1741 | ctrl = InteractiveController.new(input,NcursesVisualizer) 1742 | when "autoplay" 1743 | load_ncurses 1744 | ctrl = AutoplayController.new(input,time,NcursesVisualizer) 1745 | when "txt" 1746 | if output == nil then 1747 | usage 1748 | else 1749 | ctrl = ConversionController.new(input,output,TextVisualizer) 1750 | end 1751 | when "latex" 1752 | if output == nil then 1753 | usage 1754 | else 1755 | ctrl = ConversionController.new(input,output,LatexVisualizer) 1756 | end 1757 | else 1758 | usage 1759 | end # case 1760 | 1761 | begin 1762 | ctrl.run 1763 | ensure 1764 | ctrl.close 1765 | end 1766 | --------------------------------------------------------------------------------