efte-1.1/0000775000076400007640000000000011264420021011312 5ustar laurilauriefte-1.1/COPYING0000664000076400007640000004307607045071303012366 0ustar laurilauri GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. efte-1.1/Artistic0000664000076400007640000001374007045071303013033 0ustar laurilauri The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End efte-1.1/HISTORY0000664000076400007640000005060111264417514012415 0ustar laurilauriRevision legend ----------------------------------------------------------------------- - = general alteration/note + = added new feature ! = fixed a bug Revision history ----------------------------------------------------------------------- 1.1 -- October 11, 2009 ! Fixed a frequent buffer overflow in e_redraw.cpp ! Fixed a couple of memory/resource leaks found by static analysis 1.0 -- June 16, 2009 - First release of eFTE - Branded FTE to be eFTE - Removed DJGPP support - Migrated to SVN for revision control + Added CursorWithinEOL + Added searching in the Routine List + Added new mode for CMake files + Windows XP and Vista now expand ~ to be the users home directory + Windows now normalizes path separators, / becomes \\ ! BlockRead command was not expanding any file ! WM_COMMAND now set in X11 binary - Removed partially implemented block cursor sizing + Added DesktopLoad command + Added oinclude command which optionally includes a configuration file + Modes are now user configurable w/o need to edit actual mode file - Cleaned up code a bit with manual and automatic formatting (astyle) - Converted from Makefiles to CMake on Win32, Unixes and OS/X ! assert bug fixed when compiling with newer Microsoft compilers + Configuration compiler loading is now much smarter - Moved all documentation to the wiki where it is now user editable as well as developer editable. ! Many minor bug fixes - Began native Mac OS X GUI interface + Added configuration variable BackupDirectory to allow storing backups in a common directory + Added based modes SOURCE and MARKUP and changed all existing modes to inherit from SOURCE, MARKUP or PLAIN + ebuild added, contributed by Daniel Hiepler + efte.spec added for rpm distributions + Macro system is now case insensitive + Added split method to FindReplace + Removed binary configuration dependency. eFTE now reads the plain text configuration files + Added a nicer help screen ! WM_HINTS are set properly in X11 + GetString and $Str0-$Str9 + User defined mode based generic indentation system + RegExp macro to perform regular expression replacements on user variables + ExpandTemplate macro for advanced user templates + Added user defined regular expression based indentation engine for any mode + Added new modes for Euphoria, Lua, VHDL ! Many bugs fixed in the bash syntax parser 0.50.1 -- January 17, 2008 - Forked from FTE (http://fte.sourceforge.net) 0.50.1 -- September 2006 - Cleanup and Debian package update 0.50.0 -- 2003 - Many internal and some external changes - Some bugs fixed in this release + cfte: added -p[reprocess] command line paramter, it can be used to debug configuration files. ! X11: XShellCommand is used to specify used shell under X11. $TERM is no longer used as shell. 0.46 ! bug fixes ! coredump when $DISPLAY not set fixed ! occasional coredump at exit from PM version fixed. ! X11: check for invalid -geometry (larger than 255x255). + colors are specified using a palette in the configuration file + ShowHelp command (view .INF file under OS/2, .HLP under Win*, manpage under UNIX). Context Sensitive. + configuration file preprocessor %if(), %endif, %define + Global (persistent) Bookmarks commands + Push/Pop bookmark + Under UNIX it should now print using lpr + SIOD mode contributed. + command FileTrim,BlockTrim - trim whitespace at end of lines + mode option to strip whitespace at EOF on FileSave. (TrimOnSave) + C/C++ indentation style is now selectable from menu + compile command configurable per mode (CompileCommand option) + command to compile without asking anything (RunCompiler) + only load desktop when no arguments on command line (option) (this is achieved by setting LoadDesktopOnEntry=2 in global.fte) + create folds with RoutineRx (command FoldCreateAtRoutines) + command to center current line (LineCenter) + OS/2: does not need 'clipserv' anymore (experimental, please report bugs). + Readonly files are not editable when loaded. + ... 0.45 -- February 1997 ! bug fixes. ! some command line option changes (-h = help now, -H = history). + support for multiple frames in the PM version. + first win32 console version. 0.44 -- November 28 0.44b6 -- November 1996 ! Bug fixes in Linux pipe handling. ! Bug fixes in OS/2 PM version. ! Fixed repainting bugs in Messages view. 0.44b5 -- November 1996 ! Minor bug fixes. ! Changes in syntax highlighting configuration. 0.44b4 -- October 1996 ! Minor bug fixes and numerous performance improvements. + New commands: BlockEnTab, BlockUnTab. + Configurable syntax highlighting. Modes HTML/IPF/Ada/Pascal/... are now configured externally. + CTags support. New commands: TagFind, TagFindWord, TagNext, TagPrev, TagPop, TagLoad, TagClear. Needs external ctags utility to create tags file. Tagfile and tag to find can be given on command line. + New option: KeepMessages. New command: ClearMessages. + X11: added support for selection copy/paste. + PM: Accept file dropped on editor window. + PM: Optional toolbar (not configurable yet). New option: ShowToolBar. + PM: GUI dialogs (find/replace, file, ...). New option: GUIDialogs. + PM: Conditional cascade menus can now be used. + PM: Alt+Fx accelerators can now be disabled with PMDisableAccel option. - Removed WSStyleSearch flag. ! PM: Rollup of editor window should now work (tested with title.dll) ! Menus can now be overriden by predefining them. ! Unix: completion of .* (dot) files now works. ! Various fixes to C-mode smart indentation. ! BlockReadXXX caused crashes when used with bad filename. + Incremental search can now be continued by using up/down arrow. ! ExitEditor doesn't close files immediatelly after discard. Desktop is now properly saved after cancelling ExitEditor command. + PM: Bigger file selection dialog box with history and save position. + New commands: IndentFunction, BlockMarkFunction, MoveFunctionPrev, MoveFunctionNext. Contributed by: jalving@ibm.net + ... 0.43 -- 15 July 1996 ! Minor bug fixes. ! Upper/Lower block in column mode could cause a crash. ! CompleteWord command occasionally inserted garbage when previous match was found in the same line. 0.42 -- July 1996 ! Several minor bug fixes. ! PM version doesn't crash when non-existant file is loaded on startup. ! HilitWord command now works again. + Setting for HilitWord color. + ViewModeMap command is back. 0.41 -- June 1996 ! Compile command crashed depending on command input. ! Substrings were matched for keywords in smart indentation (C,REXX) ! InsertSpacesToTab command always returned fail status. ! CFTE now compiles to temporary file first and replaces original on success only. ! CFTE returns correct errorlevel on failure (0 = ok, 1 = fail). ! SavePos/PrevPos is now stored using real line number, not virtual (folded). + BlockSort command. + UndoMoves setting can be set for mode to enable undo/redo of all cursor movements. + BlockCutAppend, BlockCopyAppend commands to append cut/copied block to clipboard. + Error message locations now track the position better when a file is edited (lines are added/removed). 0.40 -- June 1996 ! Keyword inheritance was not properly handled in colorize modes. ! Colors were not inherited in colorize modes. ! OS2: Keys Alt+, F10, Alt+Enter, Alt+Space are available for remapping. ! Some startup window sizing problems fixed. ! Fixed several bugs in configuration files (no bindings for MSG mode, some Alt+ menu shortcuts). ! Abbreviation expansion could abort with 'asssertion failed'. + Performance improvements (MatchBracket and related stuff). + OS2: Window position is now saved. + FTE now remembers the directory the compilation was started from and will resolve all relative pathnames found in error messages using this directory. The current directory is determined by currently active file or directory. If Messages are already open, FTE will use directory from there instead of the current one. The current directory of message list is always the directory the compilation was started from. 0.39 -- May 96 ! Fixed crash in Compile commands when repeating it. ! Multi-key bindings inserted an ascii char if the 2+ key was not valid. ! when inserting ) in Cmode, it failed to advance the cursor when there was no match and AutoHilitParen was set to 1. + EventMap variable to define keymap to use for mode. ! MoveToLine shows correct default line value when folds are used. - Did some reorganization of config files to make adding new binding sets easier. 0.38 -- May 96 ! Many bug fixes (mostly minor). + BlockWrite command can now append to a file. + Directory browser. ! PERL: properly highlight s[][], tr[][]. + Configuration files must now be compiled. + Syntax highlighting definitions now independant of editing mode. + Event mappings now independant of editing mode. + Abbreviatons. Can expand the text or run a macro. + Searching can now check for words without using regular expressions. + Loading files is now almost twice as fast. + File positions and prompt history is now saved in file FTE.HIS. + The list of loaded files is saved on exit to FTE.DSK. Files are automatically loaded on startup. Several settings and command line options are available to configure this. + On startup, only the first file is actually loaded. Other files are loaded only as they are needed. + BlockTrans, CharTrans and LineTrans commands. Can translate characters according to arguments (BlockTrans 'a-z' 'A-Z', etc). + When cursor is over the bracket, the matching bracket can be higlighted automatically of visible on screen. ! InsPrevLineChar, InsPrevLineToEol failed when tabs were on previous line. + Nonpersistent blocks (with various options and commands). + ... 0.37 -- Dec 95 - Status line can now be hidden. Also changed it's look. - Changed the syntax of keyboard bindings. Now it is possible to better emulate the wordstar two-key behavior. See documentation for details. It is also possible to define different commands for gray/white keys. ! MENU shortcuts now work. + New command: FileWriteTo ! Fixed crash when trying to center nonexistant line in file. - Changing folds now modifies the file. - When CursorTroughTabs was set to 0, certain movement commands would behave incorrectly. + S-Ins will perform Paste operation in prompts. + New Command: WinResize and WinClose. Windows can be also resized by a mouse. 0.36 -- Oct 95 ! Fixed when editor would crash when saving a folded file, but no folds are configured for active mode. ! Fixed minor bug in C mode indentation. + New command: InsertSpacesToTab (takes optional tabsize argument). 0.35 -- Oct 95 KillWordPrev now works correctly. FindReplace command works correctly if WSStyleSearch == 1. 0.34 -- 1995/10/15 Minor fixes & docs updates... 0.33 -- 1995/10/01 ! SIGBREAK handler now works again. ! Fixes in C/C++ smart indentation (if in switch, ...) + Pascal highlighting mode. + Printing. + Rewritten folding. Now supports nested folds, opening, closing folds, and persistent folds. + New folding commands: FoldCreate, FoldDestroy, FoldOpen, FoldClose, FoldPromote, FoldDemote, FoldCreateByRegexp, FoldOpenAll, FoldOpenNested, FoldCloseAll, FoldDestroyAll, FoldToggleOpenClose, MoveFoldPrev, MoveFoldNext. + New settings: SaveFolds, CommentStart, CommentEnd. + Word characters can be configured using WordChars setting. 0.32 -- 1995/08/15 + New search routines. (Find, FindReplace, FindRepeat, FindRepeatReverse, FindRepeatOnce, ...) + Block-local searches. + In buffer-list, most recently used files will now be listed first. + Main menu bar can now be hidden. + Performance improvements. + Bookmarks! New commands: PlaceBookmark, GotoBookmark, RemoveBookmark + Files can now be saved and closed from window list. + Optimized CMode indentation. Also more configurable. 0.31 -- 1995/07/31 ! Bug fixed in undo/redo when UndoLimit reached. 0.30 -- 1995/07/30 + Folding support. + New commands: FoldLine, UnfoldLine, UnfoldNextLine, UnfoldAll, ClearFolds, FoldIndent, FoldRegexp, FoldBlock, UnfoldBlock, FoldBlockRegexp ! BackSpace at eof when TrimLine is enabled will not abort. + Incremental search (IncrementalSearch). + PgUp/PgDn on a file prompt will show a list of files. + New command: CompleteWord 0.29 1995/07/20 Regexps can now be case insensitive (\C,\c). BlockRead/BlockReadColumn/BlockWrite commands. Block marking can now be undone. Commands that prompt for string/int values can now take string/int arguments. Multiple compile-regex statements can be specified simultaneously Minor bug-fixes in regexps ([\x00-\xFF] now works). Filter for filename completion. New commands: SwitchTo ChangeKeys ChangeFlags ShowMenu New options: CompletionFilter DefaultModeName 0.28 1995/07/08 - Needs to have documentation updated. Mostly rewritten PERL highlighting. Works much better now. Completely new config file syntax. New commands: ASCIITable, LoadFileInMode CMode indentation should now work for Perl (close enough). Highlighting for ADA and Email messages. 0.27 1995/06/19 Minor bug fixes. 0.26 1995/06/18 New commands: {Char,Line,Block}Case{Up,Down,Toggle} New setting: LoadAfterQuit -- if set to 1, editor will prompt to load another file before exiting. New setting: ShowScrollBar {0,1}. 0.25 1995/06/12 Minor bug fix in REXX highlighting ("\"", ...) Bug fixes in word wrap. BlockCut now doesn't move the cursor to the block beginning. New commands: MoveLineTop, MoveLineCenter, MoveLineBottom. Editor will now check if the file has changed before the first modification. Found text is now highlighted. New CMode setting: C.BraceOfs and command: ChangeCBraceOfs New commands: MovePrevPos, SavePos, MoveSavedPos, MoveSavedPosCol, MoveSavedPosRow 0.24 1995/06/06 When checking for file modification time of last change is now used instead of the time of last access. Wildcard support for file loading. 0.23 1995/06/04 Ctrl+C and Ctrl+Break are now disabled. Ctrl+S and Ctrl+C keys are now again recognised in Windowed mode. Fixed problem when spawning a subprocess in Windowed mode. New command: ShowEntryScreen ListRoutines in CMode only shows functions not their prototypes. New setting: SysClipboard - if set to 1, editor will automatically use system clipboard. New command: ToggleSysClipboard. Minor bug fix in PM clipboard support. New commands: BlockPasteStream, BlockPasteColumn and BlockPasteLine. BlockPaste command will now always paste in current block mode, not in the last Copy/Cut mode. More than 4 commands can be bound to a key (actually this worked since 0.18, but was not documented). New command: FileReload. Editor will now check if file has changed on disk before saving it. 0.22 1995/05/28 But fix in regular expressions (nested +#*@). Changes in regular expression syntax. New function: ListRoutines. Shows functions in current buffer. New setting: RoutineRx 0.21 1995/05/21 REXX mode smart indentation. KillWord & KillWordPrev commands now actually work. Pressing Ctrl+Enter to begin Search will toggle case sensitivity of search. New option 'Trim' and commands 'ToggleTrim', 'LineTrim'. Removes whitespace from end of lines. New option 'ShowMarkers' and command 'ToggleShowMarkers'. Shows end of line and end of file markers. Bug fix in PERL highlighting (caused lockups) Bug fixes and improvements in regular expressions. 0.20 1995/05/18 Major bug fixes in word wrap. New commands: MovePrevTab, MoveNextTab. Bug fixes in BlockIndent and BlockUnindent (stream/line mode) 0.19 1995/05/16 Function names in REXX are now highlighted. WordWrap can be set to 0 - disabled, 1 - wrap line at right margin and 2 - wrap paragraph continously. Function ToggleAutoWrap renamed to ToggleWordWrap. New way to set left/right margin (SetLeftMargin, SetLeftMargin) Minor fix in PERL highlighting. 0.18 1995/05/13 PERL Syntax Higlighting. Memory allocation problem in tab expansion. Wordwrap now strips all spaces on beginning of line (except on the first line of the paragraph). Tabs can be set to any number between 1 and 32. Changed names of buffer flags (WrapOn -> AutoWrap, UndoRedo -> Undo, ShowTab -> ShowTabs) New commands: ToggleAutoIndent, ToggleExpandTabs, ToggleShowTabs, ToggleUndo, ToggleReadOnly, ToggleKeepBackups, ToggleMatchCase, ToggleBackSpKillTab, ToggleDeleteKillTab, ToggleSpaceTabs, ToggleIndentWithTabs, ToggleBackSpUnindents, ToggleAutoWrap. New commands: WinRefresh, ChangeTabSize, ChangeCIndent, ChangeLeftMargin, ChangeRightMargin. 0.17 1995/05/10 Minor fix in word-wrap. Screen repaint problems when shelling out fixed. Blinking disabled for full-screen, high-intensity background colors can now be used. 0.16 1995/05/06 Minor speedups in screen handling and highlighting. Regular expressions can now match start and end of words using . Regexp replace can paste entire matched string using &. Regexp search/replace could match part of just replaced string. New commands: MoveLastNonWhite, MovePrevEqualIndent and MoveNextEqualIndent, LineDuplicate, InsPrevLineChar, InsPrevLineToEol. New color config. 'C.Function' for functions in C highlighting mode. Improved CMode hilit, preprocessor hiliting improved (strings, comments, numbers) 0.15 1995/04/29 Speed improvement in CMode auto indent. Delete command can now delete full tabs instead of converting them to spaces. When closing a modified file, editor prompts you to save it. Automatic indentation can now use tabs. Manual and automatic wordwrap. 1995/04/24 Backspace can now delete full tabs instead of converting them to spaces (See BackSpace and KillBackTab). Backspace can unindent to previous indentation level. 1995/04/20 Basic mouse support. 1995/04/12 Configurable colors/keywords in C/REXX mode. 0.14 1995/04/07 Characters could not be entered using AltGr on international keyboards. Immediatelly doing an undo on a newly loaded file deleted the first line. Ascii characters >= 128 can be now entered without quote command (C-Q). IPF Syntax highlighting. 0.13 1995/04/03 Bug fix in regular expressions. Bug fixes in compiler support Editor clipboard can now be copied to/from PM clipboard. 0.12 1995/03/30 Compiler support + error message parsing 1995/03/25 Paren matching (Command: MatchBracket). Bug fixes in CMode smart indentation. 0.11 1995/03/11 Unlimited undo now works again. 1995/03/18 Entire blocks of C code can now be reindented (BlockReIndent) Search can now be case insensitive (SearchMatchCase - toggle). Option: MatchCase, Command: SearchMatchCase Regular expression find/replace works (case sensitive only) 1995/03/19 Fixed a bug in redo (last command could not be undone) New option: KeepBackups -- if set to 0, backup files will be deleted after a succesful save. 0.10 1995/03/06 Fixed CMode indent when tabs are present in the file. Prompts now retain previous text only if you try to edit it. 1995/03/04 4DOS/4OS2 style filename completion (FileOpen, ...). 1995/02/25 New load routine, much faster in some cases. Undo/Redo can now be limited (if you hate to waste memory). 1995/02/19 C Mode indentation level can now be specified (C.Indent) Bug fixes in screen redraw. Editor will now scroll text instead of always redisplaying the screen. Regular expressions (Search only). 0.09 1995/02/08 First public release (Version 0.09b) efte-1.1/file_id.diz0000664000076400007640000000047411257205413013432 0ustar laurilauriText Mode text editor. Version 1.1 Color syntax highlighting for C/C++, REXX, HTML, IPF, PERL, Ada, Pascal, TEX Multiple file/window editing, Column blocks, configurable menus and keyboard bindings, mouse support, undo/redo, regular expression search and replace, folding, background compiler execution. efte-1.1/AUTHORS0000664000076400007640000000065111041303457012372 0ustar laurilauriCurrent Authors * Jeremy Cowgar * Lauri Nurmi * Timo Sirainen Current Contact Method: http://sourceforge.net/projects/efte/ irc: #efte on irc.freenode.net Earlier Authors * Marko Macek Contributors * F.Jalvingh * Markus F.X.J. Oberhumer * Martin Frydl * S.Pinigin * Zednek Kabelac * Don Mahurin * Lothar Schmidt If you feel your name should be listed but it isn't, please contact us. efte-1.1/src/0000775000076400007640000000000011264420021012101 5ustar laurilauriefte-1.1/src/con_os2.cpp0000664000076400007640000010153311041404761014160 0ustar laurilauri/* con_os2.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1998, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // include #include #include #include #include #include #include "sysdep.h" #include "console.h" #include "gui.h" extern int ShowVScroll; //#define INCL_NOPM //#define INCL_WINSWITCHLIST #define INCL_WIN #define INCL_SUB #define INCL_KBD #define INCL_VIO #define INCL_MOU #define INCL_BASE #define INCL_DOS #define INCL_DOSDEVIOCTL #include #include #ifndef OS2_INCLUDED #include #endif #define MAX_PIPES 4 #define PIPE_BUFLEN 4096 typedef struct { int used; int id; int reading, stopped; TID tid; HMTX Access; HEV ResumeRead; HEV NewData; char *buffer; int buflen; int bufused; int bufpos; EModel *notify; char *Command; int RetCode; int DoTerm; } GPipe; static GPipe Pipes[MAX_PIPES] = { { 0 }, { 0 }, { 0 }, { 0 } }; static long MouseAutoDelay = 400; static long MouseAutoRepeat = 5; static long MouseMultiClick = 300; static int Initialized = 0; static int MousePresent = 0; static int CursorVisible = 1; /* 1 means visible */ static int MouseVisible = 0; /* 0 means hidden */ static TEvent MouseEv = { evNone }; static TEvent EventBuf = { evNone }; static HMOU MouseHandle = 0; static KBDINFO SaveKbdState; // misc static void DrawCursor(int Show) { VIOCURSORINFO vci; VioGetCurType(&vci, 0); if (Show == 1) vci.attr = 1; else vci.attr = (SHORT) - 1; VioSetCurType(&vci, 0); } static void DrawMouse(int Show) { if (!MousePresent) return; if (Show == 1) { MouDrawPtr(MouseHandle); } else { NOPTRRECT npr; int W, H; npr.row = 0; npr.col = 0; ConQuerySize(&W, &H); npr.cCol = (USHORT)(W - 1); npr.cRow = (USHORT)(H - 1); MouRemovePtr(&npr, MouseHandle); } } static struct { // TransCharScan USHORT CharScan; TKeyCode KeyCode; } TransCharScan[] = { { 0x0100, kbEsc }, { 0x011B, kbEsc }, { 0x1C0D, kbEnter }, { 0x1C0A, kbEnter }, { 0x1C00, kbEnter }, { 0xE00D, kbEnter | kfGray }, { 0xA600, kbEnter | kfGray }, { 0xE00A, kbEnter | kfGray }, { 0x0E08, kbBackSp }, { 0x0E7F, kbBackSp }, { 0x0E00, kbBackSp }, { 0x0F09, kbTab }, { 0x9400, kbTab }, { 0xA500, kbTab }, { 0x0F00, kbTab }, { 0x4E00, '+' | kfGray }, { 0x9000, '+' | kfGray }, { 0x4E2B, '+' | kfGray }, { 0x4A00, '-' | kfGray }, { 0x8E00, '-' | kfGray }, { 0x4A2D, '-' | kfGray }, { 0x3700, '*' | kfGray }, { 0x9600, '*' | kfGray }, { 0x372A, '*' | kfGray }, { 0xE02F, '/' | kfGray }, { 0xA400, '/' | kfGray }, { 0x9500, '/' | kfGray }, { 0x0300, 0 } }; static struct { // TransScan int ScanCode; TKeyCode KeyCode; } TransScan[] = { { 0x78, '1' }, { 0x79, '2' }, { 0x7A, '3' }, { 0x7B, '4' }, { 0x7C, '5' }, { 0x7D, '6' }, { 0x7E, '7' }, { 0x7F, '8' }, { 0x80, '9' }, { 0x81, '0' }, { 0x10, 'Q' }, { 0x11, 'W' }, { 0x12, 'E' }, { 0x13, 'R' }, { 0x14, 'T' }, { 0x15, 'Y' }, { 0x16, 'U' }, { 0x17, 'I' }, { 0x18, 'O' }, { 0x19, 'P' }, { 0x1E, 'A' }, { 0x1F, 'S' }, { 0x20, 'D' }, { 0x21, 'F' }, { 0x22, 'G' }, { 0x23, 'H' }, { 0x24, 'J' }, { 0x25, 'K' }, { 0x26, 'L' }, { 0x2C, 'Z' }, { 0x2D, 'X' }, { 0x2E, 'C' }, { 0x2F, 'V' }, { 0x30, 'B' }, { 0x31, 'N' }, { 0x32, 'M' }, { 0x29, '`' }, { 0x82, '-' }, { 0x83, '=' }, { 0x2B, '\\' }, { 0x1A, '[' }, { 0x1B, ']' }, { 0x27, ';' }, { 0x28, '\'' }, { 0x33, ',' }, { 0x34, '.' }, { 0x35, '/' }, { 0x37, '*' }, { 0x4E, '+' }, { 0x4A, '-' }, { 0x3B, kbF1 }, { 0x3C, kbF2 }, { 0x3D, kbF3 }, { 0x3E, kbF4 }, { 0x3F, kbF5 }, { 0x40, kbF6 }, { 0x41, kbF7 }, { 0x42, kbF8 }, { 0x43, kbF9 }, { 0x44, kbF10 }, { 0x85, kbF11 }, { 0x86, kbF12 }, { 0x54, kbF1 }, { 0x55, kbF2 }, { 0x56, kbF3 }, { 0x57, kbF4 }, { 0x58, kbF5 }, { 0x59, kbF6 }, { 0x5A, kbF7 }, { 0x5B, kbF8 }, { 0x5C, kbF9 }, { 0x5D, kbF10 }, { 0x87, kbF11 }, { 0x88, kbF12 }, { 0x5E, kbF1 }, { 0x5F, kbF2 }, { 0x60, kbF3 }, { 0x61, kbF4 }, { 0x62, kbF5 }, { 0x63, kbF6 }, { 0x64, kbF7 }, { 0x65, kbF8 }, { 0x66, kbF9 }, { 0x67, kbF10 }, { 0x89, kbF11 }, { 0x8A, kbF12 }, { 0x68, kbF1 }, { 0x69, kbF2 }, { 0x6A, kbF3 }, { 0x6B, kbF4 }, { 0x6C, kbF5 }, { 0x6D, kbF6 }, { 0x6E, kbF7 }, { 0x6F, kbF8 }, { 0x70, kbF9 }, { 0x71, kbF10 }, { 0x8B, kbF11 }, { 0x8C, kbF12 }, { 0x47, kbHome }, { 0x48, kbUp }, { 0x49, kbPgUp }, { 0x4B, kbLeft }, { 0x4C, kbCenter}, { 0x4D, kbRight }, { 0x4F, kbEnd }, { 0x50, kbDown }, { 0x51, kbPgDn }, { 0x52, kbIns }, { 0x53, kbDel }, { 0x77, kbHome }, { 0x8D, kbUp }, { 0x84, kbPgUp }, { 0x73, kbLeft }, { 0x74, kbRight }, { 0x75, kbEnd }, { 0x91, kbDown }, { 0x76, kbPgDn }, { 0x92, kbIns }, { 0x93, kbDel }, { 0x97, kbHome | kfGray }, { 0x98, kbUp | kfGray }, { 0x99, kbPgUp | kfGray }, { 0x9B, kbLeft | kfGray }, { 0x9D, kbRight | kfGray }, { 0x9F, kbEnd | kfGray }, { 0xA0, kbDown | kfGray }, { 0xA1, kbPgDn | kfGray }, { 0xA2, kbIns | kfGray }, { 0xA3, kbDel | kfGray } }; int ReadKbdEvent(TEvent *Event, int Wait) { KBDKEYINFO ki; UCHAR CharCode, ScanCode; ULONG KeyCode, KeyFlags; USHORT CharScan, Flags; static USHORT PrevFlags = 0; unsigned int I; Event->What = evNone; KbdCharIn(&ki, IO_NOWAIT, 0); if (!(ki.fbStatus & 0x40)) return 0; Event->What = evKeyDown; CharCode = ki.chChar; ScanCode = ki.chScan; CharScan = (USHORT)((((USHORT)ScanCode) << 8) | ((USHORT)CharCode)); Flags = ki.fsState; KeyCode = 0; KeyFlags = 0; /* printf("Key: %X %X %X %X %X \n", (unsigned long) ki.bNlsShift, (unsigned long) ki.fbStatus, (unsigned long) Flags, (unsigned long) CharCode, (unsigned long) ScanCode);*/ if ((Flags & (LEFTSHIFT | RIGHTSHIFT)) != 0) KeyFlags |= kfShift; if ((Flags & (LEFTCONTROL | RIGHTCONTROL)) != 0) KeyFlags |= kfCtrl; /* cpCount = sizeof(cpList);*/ /* rc = DosQueryCp(sizeof(cpList), cpList, &cpCount); // get active code page*/ if (CharCode != 0) { if ((Flags & (LEFTALT)) != 0) KeyFlags |= kfAlt; } else { if ((Flags & (LEFTALT | RIGHTALT)) != 0) KeyFlags |= kfAlt; } /* if (rc != 0) printf("rc = %d\n", rc);*/ if (CharScan == 0) { /* shift/alt/ctrl/caps/scroll/num */ } else if (ScanCode == 0) { /* alt numeric */ KeyCode = CharCode; KeyFlags |= kfAltXXX; } else { /* now check special combinations */ for (I = 0; I < sizeof(TransCharScan) / sizeof(TransCharScan[0]); I++) if (TransCharScan[I].CharScan == CharScan) { KeyCode = TransCharScan[I].KeyCode; break; } if (KeyCode == 0) { if ((CharCode == 0) || (CharCode == 0xE0)) { if (CharCode == 0xE0) KeyFlags |= kfGray; for (I = 0; I < sizeof(TransScan) / sizeof(TransScan[0]); I++) if (TransScan[I].ScanCode == ScanCode) { KeyCode = TransScan[I].KeyCode; break; } } else { if (CharCode < 32) if (KeyFlags & kfCtrl) CharCode += 64; KeyCode = CharCode; } } } Event->Key.Code = KeyCode | KeyFlags; PrevFlags = Flags; return 1; } #define TM_DIFF(x,y) ((long)(((long)(x) < (long)(y)) ? ((long)(y) - (long)(x)) : ((long)(x) - (long)(y)))) int ReadMouseEvent(TEvent *Event, ULONG EventMask) { static unsigned short PrevState = 0; static unsigned short PrevButtons = 0; static TEvent LastMouseEvent = { evNone }; static ULONG LastEventTime = 0; static ULONG LastClick = 0; static ULONG LastClickTime = 0; static ULONG LastClickCount = 0; MOUEVENTINFO mi; unsigned short Buttons, State, Btn; USHORT fWait = MOU_NOWAIT; MOUQUEINFO mq; ULONG CurTime; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &CurTime, 4); Event->What = evNone; MouGetNumQueEl(&mq, MouseHandle); if (mq.cEvents == 0) { if (LastMouseEvent.What == evMouseAuto && (EventMask & evMouseAuto)) { if (TM_DIFF(CurTime, LastEventTime) >= MouseAutoRepeat) { *Event = LastMouseEvent; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &LastEventTime, 4); return 1; } } if ((LastMouseEvent.What == evMouseDown || LastMouseEvent.What == evMouseMove) && (LastMouseEvent.Mouse.Buttons) && (EventMask & evMouseAuto)) { if (TM_DIFF(CurTime, LastEventTime) >= MouseAutoDelay) { LastMouseEvent.What = evMouseAuto; *Event = LastMouseEvent; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &LastEventTime, 4); return 1; } } return 0; } if (MouReadEventQue(&mi, &fWait, MouseHandle) != 0) return 0; Event->Mouse.X = mi.col; Event->Mouse.Y = mi.row; State = mi.fs; Btn = Buttons = ((State & (2 | 4)) ? 1 : 0) | ((State & (8 | 16)) ? 2 : 0) | ((State & (32 | 64)) ? 4 : 0); if (Buttons != PrevButtons) { Buttons ^= PrevButtons; if (PrevButtons & Buttons) Event->What = evMouseUp; else Event->What = evMouseDown; } else { Event->What = evMouseMove; if (Event->Mouse.X == LastMouseEvent.Mouse.X && Event->Mouse.Y == LastMouseEvent.Mouse.Y) return 0; } Event->Mouse.Buttons = Buttons; Event->Mouse.Count = 1; PrevState = State; PrevButtons = Btn; if (Event->What == evMouseDown) { if (LastClickCount) { if (LastClick == Event->Mouse.Buttons) { if (TM_DIFF(CurTime, LastClickTime) <= MouseMultiClick) { Event->Mouse.Count = ++LastClickCount; } else { LastClickCount = 0; } } else { LastClick = 0; LastClickCount = 0; LastClickTime = 0; } } LastClick = Event->Mouse.Buttons; if (LastClickCount == 0) LastClickCount = 1; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &LastClickTime, 4); } /* if (Event->What == evMouseMove) { LastClick = 0; LastClickCount = 0; LastClickTime = 0; }*/ { KBDINFO ki; USHORT Flags; TKeyCode KeyFlags = 0; ki.cb = sizeof(ki); KbdGetStatus(&ki, 0); Flags = ki.fsState; if ((Flags & (LEFTSHIFT | RIGHTSHIFT)) != 0) KeyFlags |= kfShift; if ((Flags & (LEFTCONTROL | RIGHTCONTROL)) != 0) KeyFlags |= kfCtrl; if ((Flags & (LEFTALT | RIGHTALT)) != 0) KeyFlags |= kfAlt; Event->Mouse.KeyMask = KeyFlags; } LastMouseEvent = *Event; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &LastEventTime, 4); return 1; } int ConClear() { int W, H; TDrawBuffer B; MoveChar(B, 0, ConMaxCols, ' ', 0x07, 1); if ((ConQuerySize(&W, &H) == 0) && ConSetBox(0, 0, W, H, B[0])) return 0; return -1; } int ConPutBox(int X, int Y, int W, int H, PCell Cell) { int I; int MX, MY; int MouseHidden = 0; unsigned char *p = (unsigned char *) Cell; if (MouseVisible) ConQueryMousePos(&MX, &MY); for (I = 0; I < H; I++) { if (MouseVisible) if (Y + I == MY) if ((MX >= X) && (MX <= X + W)) { DrawMouse(0); MouseHidden = 1; } VioWrtCellStr((PCH)p, (USHORT)(W << 1), (USHORT)(Y + I), (USHORT)X, 0); if (MouseHidden) { DrawMouse(1); MouseHidden = 0; } p += W << 1; } return 0; } int ConGetBox(int X, int Y, int W, int H, PCell Cell) { int I; int MX, MY; int MouseHidden = 0; USHORT WW = (USHORT)(W << 1); unsigned char *p = (unsigned char *) Cell; if (MouseVisible) ConQueryMousePos(&MX, &MY); for (I = 0; I < H; I++) { if (MouseVisible) if (Y + I == MY) if (MX >= X && MX < X + W) { DrawMouse(0); MouseHidden = 1; } VioReadCellStr((PCH)p, &WW, (USHORT)(Y + I), (USHORT)X, 0); if (MouseHidden) { DrawMouse(1); MouseHidden = 0; } p += W << 1; } return 0; } int ConPutLine(int X, int Y, int W, int H, PCell Cell) { int I; int MX, MY; int MouseHidden = 0; unsigned char *p = (unsigned char *) Cell; if (MouseVisible) ConQueryMousePos(&MX, &MY); for (I = 0; I < H; I++) { if (MouseVisible) if (Y + I == MY) if (MX >= X && MX < X + W) { DrawMouse(0); MouseHidden = 1; } VioWrtCellStr((PCH)p, (USHORT)(W << 1), (USHORT)(Y + I), (USHORT)X, 0); if (MouseHidden) { DrawMouse(1); MouseHidden = 0; } } return 0; } int ConSetBox(int X, int Y, int W, int H, TCell Cell) { int I; int MX, MY; int MouseHidden = 0; unsigned char *p = (unsigned char *) & Cell; if (MouseVisible) ConQueryMousePos(&MX, &MY); for (I = 0; I < H; I++) { if (MouseVisible) if (Y + I == MY) if (MX >= X && MX < X + W) { DrawMouse(0); MouseHidden = 1; } VioWrtNCell((PCH)p, (USHORT)(W), (USHORT)(Y + I), (USHORT)X, 0); if (MouseHidden) { DrawMouse(1); MouseHidden = 0; } } return 0; } int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { int MX, MY; int MouseHidden = 0; TCell FillCell = (TCell)(Fill << 8); if (MousePresent && MouseVisible) { ConQueryMousePos(&MX, &MY); if (MX >= X && MX < X + W && MY >= Y && MY < Y + H) { DrawMouse(0); MouseHidden = 1; } } switch (Way) { case csUp: VioScrollUp((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; case csDown: VioScrollDn((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; case csLeft: VioScrollLf((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; case csRight: VioScrollRt((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; } if (MouseHidden) DrawMouse(1); return 0; } int ConSetSize(int X, int Y) { VIOMODEINFO vmi; int rc; assert(X <= ConMaxCols); assert(Y <= ConMaxRows); vmi.cb = sizeof(VIOMODEINFO); VioGetMode(&vmi, 0); vmi.col = (USHORT)X; vmi.row = (USHORT)Y; vmi.cb = 2 + 1 + 1 + 2 + 2; rc = VioSetMode(&vmi, 0); if (rc == 0) return 0; return -1; } int ConQuerySize(int *X, int *Y) { VIOMODEINFO vmi; vmi.cb = sizeof(VIOMODEINFO); VioGetMode(&vmi, 0); if (X) *X = vmi.col; if (Y) *Y = vmi.row; return 0; } int ConSetCursorPos(int X, int Y) { VioSetCurPos((USHORT)Y, (USHORT)X, 0); return 0; } int ConQueryCursorPos(int *X, int *Y) { USHORT AX, AY; VioGetCurPos(&AY, &AX, 0); if (X) *X = AX; if (Y) *Y = AY; return 0; } int ConShowCursor() { CursorVisible = 1; DrawCursor(1); return 0; } int ConHideCursor() { CursorVisible = 0; DrawCursor(0); return 0; } void ConSetInsertState(bool insert) { } int ConSetMousePos(int X, int Y) { PTRLOC mp; if (!MousePresent) return -1; mp.col = (USHORT)X; mp.row = (USHORT)Y; MouSetPtrPos(&mp, MouseHandle); return 0; } int ConQueryMousePos(int *X, int *Y) { PTRLOC mp; if (!MousePresent) return -1; MouGetPtrPos(&mp, MouseHandle); if (X) *X = mp.col; if (Y) *Y = mp.row; return 0; } int ConShowMouse() { MouseVisible = 1; if (!MousePresent) return -1; DrawMouse(1); return 0; } int ConHideMouse() { MouseVisible = 0; if (!MousePresent) return -1; DrawMouse(0); return 0; } int ConMouseVisible() { return (MouseVisible == 1); } int ConQueryMouseButtons(int *ButtonCount) { USHORT Count; if (MouGetNumButtons(&Count, MouseHandle) != 0) return -1; if (ButtonCount) *ButtonCount = Count; return 0; } int ConInit(int XSize, int YSize) { USHORT MevMask = 127; if (Initialized) return 0; EventBuf.What = evNone; MousePresent = (MouOpen(NULL, &MouseHandle) == 0) ? 1 : 0; if (MousePresent) MouSetEventMask(&MevMask, MouseHandle); memset(&SaveKbdState, 0, sizeof(SaveKbdState)); SaveKbdState.cb = sizeof(SaveKbdState); assert(KbdGetStatus(&SaveKbdState, 0) == 0); ConContinue(); Initialized = 1; return 0; } int ConDone() { return ConSuspend(); } int ConSuspend() { VIOINTENSITY vi; static KBDINFO ki; vi.cb = 6; vi.type = 2; vi.fs = 0; VioSetState(&vi, 0); ki = SaveKbdState; ki.fsMask &= ~(KEYBOARD_ECHO_OFF | KEYBOARD_BINARY_MODE); ki.fsMask |= (KEYBOARD_ECHO_ON | KEYBOARD_ASCII_MODE); assert(0 == KbdSetStatus(&ki, 0)); ConHideMouse(); signal(SIGBREAK, SIG_DFL); signal(SIGINT, SIG_DFL); return 0; } int ConContinue() { VIOINTENSITY vi; static KBDINFO ki; signal(SIGBREAK, SIG_IGN); signal(SIGINT, SIG_IGN); ki = SaveKbdState; ki.fsMask &= ~(KEYBOARD_ECHO_ON | KEYBOARD_ASCII_MODE); ki.fsMask |= (KEYBOARD_ECHO_OFF | KEYBOARD_BINARY_MODE); assert(KbdSetStatus(&ki, 0) == 0); vi.cb = 6; vi.type = 2; vi.fs = 1; VioSetState(&vi, 0); ConShowMouse(); return 0; } int GetPipeEvent(TEvent *Event) { ULONG ulPostCount; int i; Event->What = evNone; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) continue; if (Pipes[i].notify == 0) continue; if (DosResetEventSem(Pipes[i].NewData, &ulPostCount) != 0) continue; if (ulPostCount > 0) { //fprintf(stderr, "Pipe New Data: %d\n", i); Event->What = evNotify; Event->Msg.View = 0; Event->Msg.Model = Pipes[i].notify; Event->Msg.Command = cmPipeRead; Event->Msg.Param1 = i; return 1; } } return 0; } int ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete) { KBDINFO ki; if (EventBuf.What != evNone) { *Event = EventBuf; if (Delete) EventBuf.What = evNone; return 0; } if (MouseEv.What != evNone) { *Event = MouseEv; if (Delete) MouseEv.What = evNone; return 0; } EventBuf.What = evNone; Event->What = evNone; ki = SaveKbdState; ki.fsMask &= ~(KEYBOARD_ECHO_ON | KEYBOARD_ASCII_MODE); ki.fsMask |= (KEYBOARD_ECHO_OFF | KEYBOARD_BINARY_MODE); assert(KbdSetStatus(&ki, 0) == 0); while ((WaitTime == -1) || (WaitTime >= 0)) { if ((ReadKbdEvent(Event, WaitTime) == 1) && (EventMask & evKeyboard)) break; else if (MousePresent && (ReadMouseEvent(Event, EventMask) == 1) && (EventMask & evMouse)) break; else if (GetPipeEvent(Event) == 1) break; if (WaitTime == 0) return -1; DosSleep(5); if (WaitTime > 0) { WaitTime -= 5; if (WaitTime <= 0) return -1; } } if (Event->What != evNone) { if (Event->What == evMouseMove) { while (ReadMouseEvent(&MouseEv, EventMask) == 1) { if (MouseEv.What == evMouseMove) { *Event = MouseEv; MouseEv.What = evNone; } else break; } } EventBuf = *Event; if (Delete) EventBuf.What = evNone; return 0; } return -1; } static PCell SavedScreen = 0; static int SavedX, SavedY, SaveCursorPosX, SaveCursorPosY; int SaveScreen() { if (SavedScreen) free(SavedScreen); ConQuerySize(&SavedX, &SavedY); SavedScreen = (PCell) malloc(SavedX * SavedY * sizeof(PCell)); if (SavedScreen) ConGetBox(0, 0, SavedX, SavedY, SavedScreen); ConQueryCursorPos(&SaveCursorPosX, &SaveCursorPosY); return 0; } int RestoreScreen() { if (SavedScreen) { ConPutBox(0, 0, SavedX, SavedY, SavedScreen); ConSetCursorPos(SaveCursorPosX, SaveCursorPosY); } return 1; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) { fArgc = argc; fArgv = argv; ::ConInit(-1, -1); SaveScreen(); ::ConSetSize(XSize, YSize); gui = this; } GUI::~GUI() { RestoreScreen(); if (SavedScreen) free(SavedScreen); ::ConDone(); gui = 0; } int GUI::ConSuspend(void) { RestoreScreen(); return ::ConSuspend(); } int GUI::ConContinue(void) { SaveScreen(); return ::ConContinue(); } int GUI::ShowEntryScreen() { TEvent E; ConHideMouse(); RestoreScreen(); do { gui->ConGetEvent(evKeyDown, &E, -1, 1, 0); } while (E.What != evKeyDown); ConShowMouse(); if (frames) frames->Repaint(); return 1; } static int CreatePipeChild(PID &pid, HPIPE &hfPipe, char *Command) { static int PCount = 0; char szPipe[32]; char FailBuf[256]; char *Args; int arglen = 0; char *Prog; RESULTCODES rc_code; ULONG ulAction; //ULONG ulNew; HPIPE hfChildPipe; HFILE hfNewStdOut = (HFILE) - 1, hfNewStdErr = (HFILE) - 1; HFILE hfStdOut = 1, hfStdErr = 2; int rc; sprintf(szPipe, "\\PIPE\\eFTE%d\\CHILD%d", getpid(), PCount); PCount++; rc = DosCreateNPipe(szPipe, &hfPipe, NP_NOINHERIT | NP_ACCESS_INBOUND, NP_NOWAIT | NP_TYPE_BYTE | NP_READMODE_BYTE | 1, 0, 4096, 0); if (rc != 0) return -1; rc = DosConnectNPipe(hfPipe); if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED) { DosClose(hfPipe); return -1; } rc = DosSetNPHState(hfPipe, NP_WAIT | NP_READMODE_BYTE); if (rc != 0) { DosClose(hfPipe); return -1; } rc = DosOpen(szPipe, &hfChildPipe, &ulAction, 0, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYREADWRITE, NULL); if (rc != 0) { DosClose(hfPipe); return -1; } // Duplicate handles DosDupHandle(hfStdOut, &hfNewStdOut); DosDupHandle(hfStdErr, &hfNewStdErr); // Close existing handles for current process DosClose(hfStdOut); DosClose(hfStdErr); // Redirect existing handles to new file DosDupHandle(hfChildPipe, &hfStdOut); DosDupHandle(hfChildPipe, &hfStdErr); // Let started program inherit handles from parent Prog = getenv("COMSPEC"); Args = (char *)malloc(strlen(Prog) + 1 + 3 + strlen(Command) + 1 + 1); if (Args == NULL) { DosClose(hfPipe); return -1; } strcpy(Args, Prog); arglen = strlen(Args) + 1; strcpy(Args + arglen, "/c "); arglen += 3; strcpy(Args + arglen, Command); arglen += strlen(Command) + 1; Args[arglen] = '\0'; rc = DosExecPgm(FailBuf, sizeof(FailBuf), EXEC_ASYNCRESULT, // | EXEC_BACKGROUND, Args, 0, &rc_code, Prog); free(Args); // Get back original handles DosDupHandle(hfNewStdOut, &hfStdOut); DosDupHandle(hfNewStdErr, &hfStdErr); // Close the duplicated handles - no longer needed DosClose(hfNewStdOut); DosClose(hfNewStdErr); DosClose(hfChildPipe); // pipe one way, close out write end if (rc != 0) { DosClose(hfPipe); return -1; } pid = rc_code.codeTerminate; // get pid when successful return 0; } static void _LNK_CONV PipeThread(void *p) { GPipe *pipe = (GPipe *)p; int rc; ULONG ulPostCount; ULONG used; PID pid; HPIPE hfPipe; RESULTCODES rc_code; rc = CreatePipeChild(pid, hfPipe, pipe->Command); if (rc != 0) { //fprintf(stderr, "Failed createpipe"); DosRequestMutexSem(pipe->Access, SEM_INDEFINITE_WAIT); pipe->reading = 0; DosPostEventSem(pipe->NewData); DosReleaseMutexSem(pipe->Access); return; } //fprintf(stderr, "Pipe: Begin: %d %s\n", pipe->id, Args); while (1) { //fprintf(stderr, "Waiting on pipe\n"); //fread(pipe->buffer, 1, pipe->buflen, fp); rc = DosRead(hfPipe, pipe->buffer, pipe->buflen, &used); if (rc < 0) used = 0; DosRequestMutexSem(pipe->Access, SEM_INDEFINITE_WAIT); //fprintf(stderr, "Waiting on mutex\n"); pipe->bufused = used; //fprintf(stderr, "Pipe: fread: %d %d\n", pipe->id, pipe->bufused); DosResetEventSem(pipe->ResumeRead, &ulPostCount); if (pipe->bufused == 0) break; if (pipe->notify) { DosPostEventSem(pipe->NewData); pipe->stopped = 0; } DosReleaseMutexSem(pipe->Access); if (pipe->DoTerm) break; //fprintf(stderr, "Waiting on sem\n"); DosWaitEventSem(pipe->ResumeRead, SEM_INDEFINITE_WAIT); //fprintf(stderr, "Read: Released mutex\n"); if (pipe->DoTerm) break; } DosClose(hfPipe); //fprintf(stderr, "Pipe: pClose: %d\n", pipe->id); rc = DosWaitChild(DCWA_PROCESS, DCWW_WAIT, &rc_code, &pid, pid); pipe->RetCode = rc_code.codeResult; // pclose(fp); pipe->reading = 0; DosPostEventSem(pipe->NewData); DosReleaseMutexSem(pipe->Access); //fprintf(stderr, "Read: Released mutex\n"); return; } int GUI::OpenPipe(char *Command, EModel *notify) { int i; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) { Pipes[i].reading = 1; Pipes[i].stopped = 1; Pipes[i].id = i; Pipes[i].bufused = 0; Pipes[i].bufpos = 0; Pipes[i].buflen = PIPE_BUFLEN; Pipes[i].Command = strdup(Command); Pipes[i].notify = notify; Pipes[i].DoTerm = 0; if ((Pipes[i].buffer = (char *)malloc(PIPE_BUFLEN)) == 0) { free(Pipes[i].Command); return -1; } if (0 != DosCreateMutexSem(0, &Pipes[i].Access, 0, 0)) { free(Pipes[i].Command); free(Pipes[i].buffer); return -1; } if (0 != DosCreateEventSem(0, &Pipes[i].ResumeRead, 0, 0)) { free(Pipes[i].Command); free(Pipes[i].buffer); DosCloseMutexSem(Pipes[i].Access); return -1; } if (0 != DosCreateEventSem(0, &Pipes[i].NewData, 0, 0)) { free(Pipes[i].Command); free(Pipes[i].buffer); DosCloseEventSem(Pipes[i].ResumeRead); DosCloseMutexSem(Pipes[i].Access); return -1; } #if defined(__WATCOMC__) || defined(__MT__) || defined(__MULTI__) Pipes[i].tid = _beginthread(PipeThread, FAKE_BEGINTHREAD_NULL 16384, &Pipes[i]); #else DosCreateThread(Pipes[i].tid, (PFNTHREAD)PipeThread, &Pipes[i], 0, /* immediate */ 16384); #endif Pipes[i].used = 1; //fprintf(stderr, "Pipe Open: %d\n", i); return i; } } return -1; } int GUI::SetPipeView(int id, EModel *notify) { if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; DosRequestMutexSem(Pipes[id].Access, SEM_INDEFINITE_WAIT); //fprintf(stderr, "Pipe View: %d %08X\n", id, notify); Pipes[id].notify = notify; DosReleaseMutexSem(Pipes[id].Access); return 0; } int GUI::ReadPipe(int id, void *buffer, int len) { int l; //ULONG ulPostCount; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; //fprintf(stderr, "Read: Waiting on mutex\n"); //ConContinue(); DosRequestMutexSem(Pipes[id].Access, SEM_INDEFINITE_WAIT); //fprintf(stderr, "Pipe Read: Get %d %d\n", id, len); if (Pipes[id].bufused - Pipes[id].bufpos > 0) { l = len; if (l > Pipes[id].bufused - Pipes[id].bufpos) { l = Pipes[id].bufused - Pipes[id].bufpos; } memcpy(buffer, Pipes[id].buffer + Pipes[id].bufpos, l); Pipes[id].bufpos += l; if (Pipes[id].bufpos == Pipes[id].bufused) { Pipes[id].bufused = 0; Pipes[id].bufpos = 0; //fprintf(stderr, "Pipe Resume Read: %d\n", id); Pipes[id].stopped = 1; //fprintf(stderr, "Read: posting sem\n"); DosPostEventSem(Pipes[id].ResumeRead); } } else if (Pipes[id].reading == 0) l = -1; else { l = 0; // DosBeep(200, 200); } //fprintf(stderr, "Pipe Read: Got %d %d\n", id, l); DosReleaseMutexSem(Pipes[id].Access); //fprintf(stderr, "Read: Released mutex\n"); return l; } int GUI::ClosePipe(int id) { if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; if (Pipes[id].reading == 1) { Pipes[id].DoTerm = 1; DosPostEventSem(Pipes[id].ResumeRead); DosWaitThread(&Pipes[id].tid, DCWW_WAIT); } free(Pipes[id].buffer); free(Pipes[id].Command); DosCloseEventSem(Pipes[id].NewData); DosCloseEventSem(Pipes[id].ResumeRead); DosCloseMutexSem(Pipes[id].Access); // fprintf(stderr, "Pipe Close: %d\n", id); Pipes[id].used = 0; //ConContinue(); return Pipes[id].RetCode; } int GUI::RunProgram(int mode, char *Command) { int rc, W, H, W1, H1; ConQuerySize(&W, &H); ConHideMouse(); ConSuspend(); if (Command == 0 || *Command == 0) // empty string = shell Command = getenv( "COMSPEC" ); rc = system(Command); ConContinue(); ConShowMouse(); ConQuerySize(&W1, &H1); if (W != W1 || H != H1) { frames->Resize(W1, H1); } frames->Repaint(); return rc; } int ConSetTitle(char *Title, char *STitle) { /* HSWITCH hsw; SWCNTRL sw; HAB hab; PID pid; TID tid; static PVOID Shmem = NULL; if (Shmem == NULL) DosAllocSharedMem(&Shmem, NULL, 4096, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GIVEABLE); strcpy(Shmem, Title); hab = WinInitialize(0); hsw = WinQuerySwitchHandle(NULLHANDLE, getpid()); if (WinQuerySwitchEntry(hsw, &sw) != 0) printf("\x7\n"); else { strncpy (sw.szSwtitle, Title, MAXNAMEL - 1); sw.szSwtitle[MAXNAMEL-1] = 0; printf("hwnd: %X, hwndIcon: %X, pid: %d\n", sw.hwnd, sw.hwndIcon, sw.idProcess); WinQueryWindowProcess(sw.hwnd, &pid, &tid); DosGiveSharedMem(Shmem, pid, PAG_READ | PAG_WRITE); printf("txt 1: %d\n", WinSetWindowText(sw.hwnd, Shmem)); // printf("txt 2: %d\n", WinSetWindowText(Wsw.hwndIcon, Shmem)); WinChangeSwitchEntry(hsw, &sw); } WinTerminate(hab); */ return 0; } int ConGetTitle(char *Title, int MaxLen, char *STitle, int SMaxLen) { strcpy(Title, "eFTE"); strcpy(STitle, "eFTE"); return 0; } int ConCursorVisible() { return (CursorVisible == 1); } int ConPutEvent(TEvent Event) { EventBuf = Event; return 0; } extern int SevenBit; char ConGetDrawChar(int index) { static char tab[] = "ڿijô\x1A\x1B\x1A"; static char tab7[] = "++++-|+++++\x1A.-++#+\x1B\x1A"; assert(index >= 0 && index < (int)strlen(tab)); if (SevenBit) return tab7[index]; else return tab[index]; } efte-1.1/src/i_view.cpp0000664000076400007640000001471111041404761014101 0ustar laurilauri/* i_view.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" GxView::GxView(GFrame *Parent): GView(Parent, -1, -1) { Top = Bottom = 0; MouseCaptured = 0; } GxView::~GxView() { while (Top) { ExView *V = Top; Top = Top->Next; V->Win = 0; delete V; } } void GxView::PushView(ExView *view) { int W, H; ConQuerySize(&W, &H); view->Win = this; if (Top == 0) { Top = Bottom = view; view->Next = 0; } else { Top->Activate(0); view->Next = Top; Top = view; Top->Activate(1); } Top->Resize(W, H); } ExView *GxView::PopView() { ExView *V; if (Top == 0) return 0; Top->Activate(0); V = Top; Top = Top->Next; if (Top == 0) Bottom = 0; else { Top->Activate(1); Top->Repaint(); } V->Win = 0; return V; } void GxView::NewView(ExView * /*view*/) { } EEventMap *GxView::GetEventMap() { return (Top) ? Top->GetEventMap() : 0; } int GxView::ExecCommand(int Command, ExState &State) { return (Top) ? Top->ExecCommand(Command, State) : 0; } int GxView::BeginMacro() { return (Top) ? Top->BeginMacro() : 1; } int GxView::GetContext() { return (Top) ? Top->GetContext() : CONTEXT_NONE; } void GxView::HandleEvent(TEvent &Event) { GView::HandleEvent(Event); Top->HandleEvent(Event); if (Event.What & evMouse) { int W, H; ConQuerySize(&W, &H); if (Event.What != evMouseDown || Event.Mouse.Y == H - 1) { switch (Event.What) { case evMouseDown: if (CaptureMouse(1)) MouseCaptured = 1; else break; Event.What = evNone; break; case evMouseMove: if (MouseCaptured) { if (Event.Mouse.Y != H - 1) ExpandHeight(Event.Mouse.Y - H + 1); Event.What = evNone; } break; case evMouseAuto: if (MouseCaptured) Event.What = evNone; break; case evMouseUp: if (MouseCaptured) CaptureMouse(0); else break; MouseCaptured = 0; Event.What = evNone; break; } return ; } } } void GxView::Update() { if (Top) { Top->Update(); }// else // Repaint(); } void GxView::Repaint() { if (Top) { Top->Repaint(); } else { TDrawBuffer B; int X, Y; ConQuerySize(&X, &Y); MoveCh(B, ' ', 0x07, X); ConPutLine(0, 0, X, Y, B); } } void GxView::Resize(int width, int height) { ExView *V; GView::Resize(width, height); V = Top; while (V) { V->Resize(width, height); V = V->Next; } } void GxView::Activate(int gotfocus) { if (Top) Top->Activate(gotfocus); GView::Activate(gotfocus); } void GxView::UpdateTitle(char *Title, char *STitle) { if (Parent && Parent->Active == this) { Parent->ConSetTitle(Title, STitle); } } int GxView::GetStr(const char *Prompt, unsigned int BufLen, char *Str, int HistId) { if ((HaveGUIDialogs & GUIDLG_PROMPT) && GUIDialogs) { return DLGGetStr(this, Prompt, BufLen, Str, HistId, 0); } else { return ReadStr(Prompt, BufLen, Str, 0, 1, HistId); } } int GxView::GetFile(const char *Prompt, unsigned int BufLen, char *Str, int HistId, int Flags) { if ((HaveGUIDialogs & GUIDLG_FILE) && GUIDialogs) return DLGGetFile(this, Prompt, BufLen, Str, Flags); else return ReadStr(Prompt, BufLen, Str, CompletePath, SelectPathname, HistId); } int GxView::ReadStr(const char *Prompt, unsigned int BufLen, char *Str, Completer Comp, int Select, int HistId) { int rc; ExInput *input; input = new ExInput(Prompt, Str, BufLen, Comp, Select, HistId); if (input == 0) return 0; PushView((ExView *)input); rc = Execute(); PopView(); Repaint(); if (rc == 1) { strncpy(Str, input->Line, BufLen - 1); Str[BufLen - 1] = 0; } delete input; return rc; } int GxView::Choice(unsigned long Flags, const char *Title, int NSel, ... /* choices, format, args */) { int rc; va_list ap; if ((HaveGUIDialogs & GUIDLG_CHOICE) && GUIDialogs) { va_start(ap, NSel); rc = DLGPickChoice(this, Title, NSel, ap, Flags); va_end(ap); return rc; } else { ExChoice *choice; va_start(ap, NSel); choice = new ExChoice(Title, NSel, ap); va_end(ap); if (choice == 0) return 0; PushView(choice); rc = Execute(); PopView(); Repaint(); delete choice; return rc; } } TKeyCode GxView::GetChar(const char *Prompt) { int rc; ExKey *key; TKeyCode K = 0; key = new ExKey(Prompt); if (key == 0) return 0; PushView(key); rc = Execute(); PopView(); Repaint(); if (rc == 1) K = key->Key; delete key; return K; } int GxView::IncrementalSearch(EView *View) { int rc; ExISearch *search; EBuffer *B = 0; if (View->GetContext() != CONTEXT_FILE) return 0; B = (EBuffer *)View->Model; search = new ExISearch(B); if (search == 0) return 0; PushView(search); rc = Execute(); PopView(); Repaint(); delete search; return rc; } int GxView::PickASCII() { int rc; ExASCII *ascii; ascii = new ExASCII(); if (ascii == 0) return 0; PushView(ascii); rc = Execute(); PopView(); Repaint(); delete ascii; return rc; } int GxView::ICompleteWord(EView *View) { int rc = 0; if (View->GetContext() == CONTEXT_FILE) { ExComplete *c = new ExComplete((EBuffer *)View->Model); if (c != NULL) { if (c->IsSimpleCase()) { rc = c->DoCompleteWord(); } else { PushView(c); rc = Execute(); PopView(); } Repaint(); delete c; } } return rc; } efte-1.1/src/i_input.h0000664000076400007640000000220211041404761013723 0ustar laurilauri/* i_input.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __EXINPUT_H #define __EXINPUT_H typedef int (*Completer)(const char *Name, char *Completed, int Num); class ExInput: public ExView { public: char *Prompt; char *Line; char *MatchStr; char *CurStr; unsigned int Pos; unsigned int LPos; unsigned int MaxLen; Completer Comp; int TabCount; int HistId; int CurItem; unsigned int SelStart; unsigned int SelEnd; ExInput(const char *APrompt, char *ALine, unsigned int AMaxLen, Completer AComp, int Select, int AHistId); virtual ~ExInput(); virtual void Activate(int gotfocus); virtual ExView *GetViewContext() { return Next; } virtual int BeginMacro(); virtual void HandleEvent(TEvent &Event); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); }; #endif efte-1.1/src/clip_x11.cpp0000664000076400007640000000442011041404761014233 0ustar laurilauri/* clip_x11.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int GetXSelection(int *len, char **data, int clipboard); int SetXSelection(int len, char *data, int clipboard); int GetPMClip(int clipboard) { char *data; int len; int i, j, l, dx; EPoint P; if (GetXSelection(&len, &data, clipboard) == 0) { SSBuffer->Clear(); j = 0; l = 0; for (i = 0; i < len; i++) { if (data[i] == '\n') { SSBuffer->AssertLine(l); P.Col = 0; P.Row = l++; dx = 0; if ((i > 0) && (data[i-1] == '\r')) dx++; SSBuffer->InsertLine(P, i - j - dx, data + j); j = i + 1; } } if (j < len) { // remainder i = len; SSBuffer->AssertLine(l); P.Col = 0; P.Row = l++; dx = 0; if ((i > 0) && (data[i-1] == '\r')) dx++; SSBuffer->InsText(P.Row, P.Col, i - j - dx, data + j); j = i + 1; } free(data); return 1; } return 0; } int PutPMClip(int clipboard) { PELine L; char *p = NULL; int rc = 0; int l = 0; for (int i = 0; i < SSBuffer->RCount; i++) { L = SSBuffer->RLine(i); char *n = (char *)realloc(p, l + L->Count + 1); if (n != NULL) { for (int j = 0; j < L->Count; j++) { if ((j < (L->Count - 1)) && (L->Chars[j + 1] == '\b')) j++; else n[l++] = L->Chars[j]; } if (i < SSBuffer->RCount - 1) n[l++] = '\n'; else n[l] = 0; } else break; p = n; // if p already contains some address it will be freed } if (p != NULL) { // remove some 'UNWANTED' characters - sequence XX 0x08 YY -> YY // this makes usable cut&paste from manpages rc = (SetXSelection(l, p, clipboard) == 0); free(p); } return (rc) ? 1 : 0; } efte-1.1/src/clip_vio.cpp0000664000076400007640000000555511041404761014431 0ustar laurilauri/* clip_vio.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // OS/2 does not allow VIO programs to use the clipboard :-( #include "fte.h" #include "clip.h" #define INCL_DOS #include #include #include #define SEM_PREFIX "\\SEM32\\PMCLIPS\\" #define MEM_PREFIX "\\SHAREMEM\\PMCLIPS\\" #define CMD_GET 1 #define CMD_PUT 2 static HMTX hmtxSyn; static HEV hevGet; static HEV hevPut; static HEV hevEnd; int GetClipText(ClipData *cd) { int rc; ULONG PostCount; char *mem; rc = DosOpenMutexSem(SEM_PREFIX "CLIPSYN", &hmtxSyn); if (rc != 0) return -1; rc = DosOpenEventSem(SEM_PREFIX "CLIPGET", &hevGet); if (rc != 0) return -1; /* rc = DosOpenEventSem(SEM_PREFIX "CLIPPUT", &hevPut);*/ /* if (rc != 0) return -1;*/ rc = DosOpenEventSem(SEM_PREFIX "CLIPEND", &hevEnd); if (rc != 0) return -1; DosRequestMutexSem(hmtxSyn, SEM_INDEFINITE_WAIT); DosResetEventSem(hevEnd, &PostCount); DosPostEventSem(hevGet); DosWaitEventSem(hevEnd, SEM_INDEFINITE_WAIT); if (0 == DosGetNamedSharedMem((void **)&mem, MEM_PREFIX "CLIPDATA", PAG_READ | PAG_WRITE)) { cd->fLen = *(ULONG*)mem; cd->fChar = strdup(mem + 4); DosFreeMem(mem); } else { cd->fLen = 0; cd->fChar = 0; } DosPostEventSem(hevGet); DosReleaseMutexSem(hmtxSyn); /* DosCloseEventSem(hevPut);*/ DosCloseEventSem(hevGet); DosCloseEventSem(hevEnd); DosCloseMutexSem(hmtxSyn); return 0; } int PutClipText(ClipData *cd) { int rc; ULONG PostCount; char *mem; rc = DosOpenMutexSem(SEM_PREFIX "CLIPSYN", &hmtxSyn); if (rc != 0) return -1; /* rc = DosOpenEventSem(SEM_PREFIX "CLIPGET", &hevGet);*/ /* if (rc != 0) return -1;*/ rc = DosOpenEventSem(SEM_PREFIX "CLIPPUT", &hevPut); if (rc != 0) return -1; rc = DosOpenEventSem(SEM_PREFIX "CLIPEND", &hevEnd); if (rc != 0) return -1; DosRequestMutexSem(hmtxSyn, SEM_INDEFINITE_WAIT); DosResetEventSem(hevEnd, &PostCount); if (0 == DosAllocSharedMem((void **)&mem, MEM_PREFIX "CLIPDATA", cd->fLen + 5, PAG_COMMIT | PAG_READ | PAG_WRITE)) { ULONG L = cd->fLen; memcpy((void *)mem, (void *)&L, 4); strcpy(mem + 4, cd->fChar); } DosPostEventSem(hevPut); DosWaitEventSem(hevEnd, SEM_INDEFINITE_WAIT); DosPostEventSem(hevPut); DosReleaseMutexSem(hmtxSyn); DosCloseEventSem(hevPut); /* DosCloseEventSem(hevGet); */ DosCloseEventSem(hevEnd); DosCloseMutexSem(hmtxSyn); if (mem) DosFreeMem(mem); return 0; } efte-1.1/src/e_svnlog.cpp0000664000076400007640000001377511250205025014436 0ustar laurilauri/* * e_svnlog.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * S.Pinigin copy o_cvslog.cpp and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Subclass of EBuffer for writing log for SVN commit. Creates temporary file * used for commit which is deleted when view is closed. Asks for commit or * discard on view close. */ #include "fte.h" //#include "features.h" ESvnLog *SvnLogView; ESvnLog::ESvnLog(int createFlags, EModel **ARoot, char *Directory, char *OnFiles): EBuffer(createFlags, ARoot, NULL) { int i, j, p; char msgFile[MAXPATH]; SvnLogView = this; // Create filename for message #ifdef UNIX // Use this in Unix - it says more to user sprintf(msgFile, "/tmp/efte%d-svn-msg", getpid()); #else tmpnam(msgFile); #endif SetFileName(msgFile, SvnLogMode); // Preload buffer with info InsertLine(0, 0, ""); InsertLine(1, 60, "SVN: -------------------------------------------------------"); InsertLine(2, 59, "SVN: Enter log. Lines beginning with 'SVN:' will be removed"); InsertLine(3, 4, "SVN:"); InsertLine(4, 18, "SVN: Commiting in "); InsText(4, 18, strlen(Directory), Directory); if (OnFiles[0]) { p = 5; // Go through files - use GetFileStatus to show what to do with files // First count files int cnt = 0; i = 0; while (1) { if (OnFiles[i] == 0 || OnFiles[i] == ' ') { while (OnFiles[i] == ' ') i++; cnt++; if (!OnFiles[i]) break; } else i++; } int *position = new int[cnt]; int *len = new int[cnt]; char *status = new char[cnt]; // Find out position and status for each file i = j = 0; position[0] = 0; while (1) { if (OnFiles[i] == 0 || OnFiles[i] == ' ') { // This is not thread-safe! len[j] = i - position[j]; char c = OnFiles[i]; OnFiles[i] = 0; status[j] = SvnView->GetFileStatus(OnFiles + position[j]); if (status[j] == 0) status[j] = 'x'; OnFiles[i] = c; while (OnFiles[i] == ' ') i++; if (!OnFiles[i]) break; position[++j] = i; } else i++; } // Go through status int fAdded = 0, fRemoved = 0, fModified = 0, fOther = 0; for (i = 0;i < cnt;i++) switch (status[i]) { case 'A': case 'a': fAdded++; break; case 'R': case 'r': fRemoved++; break; case 'M': case 'm': fModified++; break; default: fOther++; } // Now list files with given status ListFiles(p, fAdded, "Added", cnt, position, len, status, OnFiles, "Aa"); ListFiles(p, fRemoved, "Removed", cnt, position, len, status, OnFiles, "Rr"); ListFiles(p, fModified, "Modified", cnt, position, len, status, OnFiles, "Mm"); ListFiles(p, fOther, "Other", cnt, position, len, status, OnFiles, "AaRrMm", 1); delete [] position; delete [] len; delete [] status; } else { InsertLine(5, 4, "SVN:"); InsertLine(6, 30, "SVN: Commiting whole directory"); p = 7; } InsertLine(p, 4, "SVN:"); InsertLine(p + 1, 60, "SVN: -------------------------------------------------------"); SetPos(0, 0); FreeUndo(); Modified = 0; } ESvnLog::~ESvnLog() { SvnLogView = 0; } void ESvnLog::ListFiles(int &p, const int fCount, const char *title, const int cnt, const int *position, const int *len, const char *status, const char *list, const char *excinc, const int exc) { if (fCount) { InsertLine(p++, 4, "SVN:"); int i = strlen(title); InsertLine(p, 5, "SVN: "); InsText(p, 5, i, title); InsText(p, i += 5, 5, " file"); i += 5; if (fCount != 1) InsText(p, i++, 1, "s"); InsText(p++, i, 1, ":"); for (i = 0;i < cnt;i++) if (!!strchr(excinc, status[i]) ^ !!exc) { // Should be displayed InsertLine(p, 9, "SVN: "); InsText(p, 9, 1, status + i); InsText(p, 10, 1, " "); InsText(p++, 11, len[i], list + position[i]); } } } // Overridden because we don't want to load file EViewPort *ESvnLog::CreateViewPort(EView *V) { V->Port = new EEditPort(this, V); AddView(V); return V->Port; } int ESvnLog::CanQuit() { return 0; } int ESvnLog::ConfQuit(GxView *V, int /*multiFile*/) { int i; switch (V->Choice(GPC_ERROR, "SVN commit pending", 3, "C&ommit", "&Discard", "&Cancel", "")) { case 0: // Commit // First save - this is just try if (Save() == 0) return 0; // Now remove SVN: lines and really save for (i = 0;i < RCount;) { PELine l = RLine(i); if (l->Count >= 4 && strncmp(l->Chars, "SVN:", 4) == 0) DelLine(i); else i++; } Save(); // DoneCommit returns 0 if OK return !SvnView->DoneCommit(1); case 1: // Discard SvnView->DoneCommit(0); return 1; case 2: // Cancel default: return 0; } } // Shown in "Closing xxx..." message when closing model void ESvnLog::GetName(char *AName, int MaxLen) { strncpy(AName, "SVN log", MaxLen); } // Shown in buffer list void ESvnLog::GetInfo(char *AInfo, int /*MaxLen*/) { sprintf(AInfo, "%2d %04d:%03d%cSVN log: %-140s", ModelNo, 1 + CP.Row, 1 + CP.Col, Modified ? '*' : ' ', FileName); } // Normal and short title (normal for window, short for icon in X) void ESvnLog::GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen) { strncpy(ATitle, "SVN log", MaxLen); strncpy(ASTitle, "SVN log", SMaxLen); } efte-1.1/src/indent.cpp0000664000076400007640000000151211041404761014073 0ustar laurilauri/* indent.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" /* place holder */ int Indent_SIMPLE(EBuffer *B, int Line, int /*PosCursor*/) { int Pos, Old; if (Line == 0) { Pos = 0; } else { if (B->RLine(Line - 1)->StateE == 0) { Pos = B->LineIndented(Line - 1); } else { // for comments, strings, etc, use same as prev line. Pos = B->LineIndented(Line - 1); } } Old = B->LineIndented(Line); if (Pos < 0) Pos = 0; if (Pos != Old) if (B->IndentLine(Line, Pos) == 0) return 0;; return 1; } efte-1.1/src/s_util.cpp0000664000076400007640000001433311041404761014116 0ustar laurilauri/* s_util.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #define BUF_SZ (sizeof(FileBuffer)) extern RxNode *CompletionFilter; // should use DosCopy under OS/2... static int copyfile(char *f1, char *f2) { // from F1 to F2 void *buffer; int fd1, fd2; int rd; buffer = FileBuffer; if ((fd1 = open(f1, O_RDONLY | O_BINARY)) == -1) return -1; if ((fd2 = open(f2, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, 0666)) == -1) { close(fd1); return -1; } while ((rd = read(fd1, buffer, BUF_SZ)) > 0) { if (write(fd2, buffer, rd) != rd) { close(fd1); close(fd2); unlink(f2); return -1; } } close(fd2); close(fd1); return 0; } char *MakeBackup(char *FileName, char *NewName) { int l = strlen(FileName); if (l <= 0) return NULL; /* try 1 */ if (strlen(BackupDirectory) > 0) { char TmpFileName[MAXPATH]; char TmpBackupName[MAXPATH]; strcpy(TmpFileName, FileName); for (int idx=0; idx < strlen(TmpFileName); idx++) if (TmpFileName[idx] == '/' || TmpFileName[idx] == '\\' || TmpFileName[idx] == ':') TmpFileName[idx] = '_'; snprintf(TmpBackupName, MAXPATH, "%s/%s", BackupDirectory, TmpFileName); ExpandPath(TmpBackupName, NewName, MAXPATH); } else snprintf(NewName, MAXPATH, "%s~", FileName); if (!IsSameFile(FileName, NewName)) { if (access(NewName, 0) == 0) // Backup already exists? unlink(NewName); // Then delete the file.. if (access(FileName, 0) != 0) // Original found? return NewName; if (copyfile(FileName, NewName) == 0) return NewName; #if 0 if (errno == 2) return NewName; /* file not found */ #endif } /* try 2: 8.3 */ strcpy(NewName, FileName); NewName[l-1] = '~'; if (!IsSameFile(FileName, NewName)) { if (access(NewName, 0) == 0) // Backup exists? unlink(NewName); // Then delete; if (access(FileName, 0) != 0) // Original exists? return NewName; // If not-> return base.. if (copyfile(FileName, NewName) == 0) return NewName; #if 0 if (errno == 2) return NewName; #endif } return NULL; } int GetCharFromEvent(TEvent &E, char *Ch) { *Ch = 0; if (E.Key.Code & kfModifier) return 0; if (kbCode(E.Key.Code) == kbEsc) { *Ch = 27; return 1; } if (kbCode(E.Key.Code) == kbEnter) { *Ch = 13; return 1; } if (kbCode(E.Key.Code) == (kbEnter | kfCtrl)) { *Ch = 10; return 1; } if (kbCode(E.Key.Code) == kbBackSp) { *Ch = 8; return 1; } if (kbCode(E.Key.Code) == (kbBackSp | kfCtrl)) { *Ch = 127; return 1; } if (kbCode(E.Key.Code) == kbTab) { *Ch = 9; return 1; } if (kbCode(E.Key.Code) == kbDel) { *Ch = 127; return 1; } if (keyType(E.Key.Code) == kfCtrl) { *Ch = (char)(E.Key.Code & 0x1F); return 1; } if (isAscii(E.Key.Code)) { *Ch = (char)E.Key.Code; return 1; } return 0; } int CompletePath(const char *Base, char *Match, int Count) { char Name[MAXPATH]; const char *dirp; char *namep; int len, count = 0; char cname[MAXPATH]; int hascname = 0; RxMatchRes RM; FileFind *ff; FileInfo *fi; int rc; if (strcmp(Base, "") == 0) { if (ExpandPath(".", Name, sizeof(Name)) != 0) return -1; } else { if (ExpandPath(Base, Name, sizeof(Name)) != 0) return -1; } // SlashDir(Name); dirp = Name; namep = SepRChr(Name); if (namep == Name) { dirp = SSLASH; namep = Name + 1; } else if (namep == NULL) { namep = Name; dirp = SDOT; } else { *namep = 0; namep++; } len = strlen(namep); strcpy(Match, dirp); SlashDir(Match); cname[0] = 0; ff = new FileFind(dirp, "*", ffDIRECTORY | ffHIDDEN #if defined(USE_DIRENT) | ffFAST // for SPEED #endif ); if (ff == 0) return 0; rc = ff->FindFirst(&fi); while (rc == 0) { const char *dname = fi->Name(); // filter out unwanted files if ((strcmp(dname, ".") != 0) && (strcmp(dname, "..") != 0) && (!CompletionFilter || RxExec(CompletionFilter, dname, strlen(dname), dname, &RM) != 1)) { if (( #if defined(UNIX) strncmp #else // os2, nt, ... strnicmp #endif (namep, dname, len) == 0) && (dname[0] != '.' || namep[0] == '.')) { count++; if (Count == count) { Slash(Match, 1); strcat(Match, dname); if ( #if defined(USE_DIRENT) // for SPEED IsDirectory(Match) #else fi->Type() == fiDIRECTORY #endif ) Slash(Match, 1); } else if (Count == -1) { if (!hascname) { strcpy(cname, dname); hascname = 1; } else { int o = 0; #ifdef UNIX while (cname[o] && dname[o] && (cname[o] == dname[o])) o++; #endif #if defined(OS2) || defined(NT) while (cname[o] && dname[o] && (toupper(cname[o]) == toupper(dname[o]))) o++; #endif cname[o] = 0; } } } } delete fi; rc = ff->FindNext(&fi); } delete ff; if (Count == -1) { Slash(Match, 1); strcat(Match, cname); if (count == 1) SlashDir(Match); } return count; } efte-1.1/src/e_os2.cpp0000664000076400007640000000214011041404761013617 0ustar laurilauri/* e_os2.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1997, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // Win32 (NT) specific routines #include "fte.h" int EView::SysShowHelp(ExState &State, const char *word) { char file[MAXPATH] = ""; char cmd[1024]; if (State.GetStrParam(this, file, sizeof(file) - 1) == 0) if (MView->Win->GetStr("Help file", sizeof(file) - 1, file, HIST_DEFAULT) == 0) return 0; char wordAsk[64] = ""; if (word == 0) { if (State.GetStrParam(this, wordAsk, sizeof(wordAsk) - 1) == 0) if (MView->Win->GetStr("Keyword", sizeof(wordAsk) - 1, wordAsk, HIST_DEFAULT) == 0) return 0; word = wordAsk; } sprintf(cmd, "%s %s %s", HelpCommand, file, word); if (system(cmd) != 0) { Msg(S_ERROR, "Failed to start view.exe!"); return 0; } return 1; } efte-1.1/src/c_desktop.h0000664000076400007640000000106311041404761014233 0ustar laurilauri/* c_desktop.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __DESKTOP_H__ #define __DESKTOP_H__ #ifdef UNIX # define DESKTOP_NAME ".efte-desktop" #else # define DESKTOP_NAME "efte.dsk" #endif extern char DesktopFileName[256]; int SaveDesktop(char *FileName); int LoadDesktop(char *FileName); #endif efte-1.1/src/egui.cpp0000664000076400007640000006722411042117167013561 0ustar laurilauri/* egui.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int LastEventChar = -1; EFrame::EFrame(int XSize, int YSize): GFrame(XSize, YSize) { CMap = 0; CModel = 0; } EFrame::~EFrame() { } void EFrame::Update() { GxView *V = (GxView *)Active; if (V) { if (CModel != ActiveModel && ActiveModel) { char Title[256] = ""; //fte: "; char STitle[256] = ""; //"fte: "; ActiveModel->GetTitle(Title, sizeof(Title) - 1, STitle, sizeof(STitle) - 1); ConSetTitle(Title, STitle); CModel = ActiveModel; } } GFrame::Update(); } void EFrame::UpdateMenu() { GxView *V = (GxView *)Active; EEventMap *Map = 0; if (V) Map = V->GetEventMap(); if (Map != CMap || CMap == 0) { const char *NMenu = 0; const char *OMenu = 0; // set menu if (CMap) OMenu = CMap->GetMenu(EM_MainMenu); if (Map) NMenu = Map->GetMenu(EM_MainMenu); if (NMenu == 0) NMenu = "Main"; CMap = Map; if (OMenu && strcmp(OMenu, NMenu) == 0) { // ok } else { SetMenu(NMenu); } } /*else if (CMap == 0 && Map == 0) { SetMenu("Main"); }*/ GFrame::UpdateMenu(); } EGUI::EGUI(int &argc, char **argv, int XSize, int YSize) : GUI(argc, argv, XSize, YSize) { ActiveMap = 0; OverrideMap = 0; CharMap[0] = 0; } EGUI::~EGUI() { } int EGUI::ExecCommand(GxView *view, int Command, ExState &State) { if (Command & CMD_EXT) return ExecMacro(view, Command & ~CMD_EXT); if (Command == ExFail) return ErFAIL; if (view->IsModelView()) { ExModelView *V = (ExModelView *)view->Top; EView *View = V->View; switch (Command) { case ExFileClose: return FileClose(View, State); case ExFileCloseAll: return FileCloseAll(View, State); case ExExitEditor: return ExitEditor(View); case ExIncrementalSearch: return View->MView->Win->IncrementalSearch(View); } } switch (Command) { case ExWinRefresh: view->Repaint(); return 1; case ExWinNext: return WinNext(view); case ExWinPrev: return WinPrev(view); case ExShowEntryScreen: return ShowEntryScreen(); case ExRunProgram: return RunProgram(State, view); case ExRunProgramAsync: return RunProgramAsync(State, view); case ExMainMenu: return MainMenu(State, view); case ExShowMenu: return ShowMenu(State, view); case ExLocalMenu: return LocalMenu(view); case ExFrameNew: return FrameNew(); case ExFrameNext: return FrameNext(view); case ExFramePrev: return FramePrev(view); case ExWinHSplit: return WinHSplit(view); case ExWinClose: return WinClose(view); case ExWinZoom: return WinZoom(view); case ExWinResize: return WinResize(State, view); case ExDesktopSaveAs: return DesktopSaveAs(State, view); case ExDesktopSave: if (DesktopFileName[0] != 0) return SaveDesktop(DesktopFileName); return 0; case ExDesktopLoad: return DesktopLoad(State, view); case ExChangeKeys: { char kmaps[64] = ""; EEventMap *m; if (State.GetStrParam(0, kmaps, sizeof(kmaps)) == 0) { SetOverrideMap(0, 0); return 0; } m = FindEventMap(kmaps); if (m == 0) return 0; SetOverrideMap(m->KeyMap, m->Name); return 1; } } return view->ExecCommand(Command, State); } int EGUI::BeginMacro(GxView *view) { view->BeginMacro(); return 1; } int EGUI::ExecMacro(GxView *view, int Macro) { int i, j; ExMacro *m; ExState State; if (Macro == -1) return ErFAIL; if (BeginMacro(view) == -1) return ErFAIL; State.Macro = Macro; State.Pos = 0; m = &Macros[State.Macro]; for (; State.Pos < m->Count; State.Pos++) { i = State.Pos; if (m->cmds[i].type != CT_COMMAND || m->cmds[i].u.num == ExNop) continue; for (j = 0; j < m->cmds[i].repeat; j++) { State.Pos = i + 1; if (ExecCommand(view, m->cmds[i].u.num, State) == 0 && !m->cmds[i].ign) { return ErFAIL; } } State.Pos = i; } return ErOK; } void EGUI::SetMsg(char *Msg) { char CharMap[128] = ""; if (Msg == 0) { strcpy(CharMap, ""); } else { strcat(CharMap, "["); strcat(CharMap, Msg); strcat(CharMap, "]"); } if (ActiveModel) ActiveModel->Msg(S_INFO, CharMap); } void EGUI::SetOverrideMap(EKeyMap *aMap, char *ModeName) { OverrideMap = aMap; if (aMap == 0) SetMsg(0); else SetMsg(ModeName); } void EGUI::SetMap(EKeyMap *aMap, KeySel *ks) { char key[32] = ""; ActiveMap = aMap; if (ActiveMap == 0) { SetMsg(0); } else { if (ks != 0) { GetKeyName(key, sizeof(key), *ks); SetMsg(key); } } } void EGUI::DispatchKey(GxView *view, TEvent &Event) { EEventMap *EventMap; EKeyMap *map; EKey *key = 0; char Ch; if (Event.Key.Code & kfModifier) return; LastEventChar = -1; if (GetCharFromEvent(Event, &Ch)) LastEventChar = Ch; if ((EventMap = view->GetEventMap()) == 0) return; map = EventMap->KeyMap; if (ActiveMap || OverrideMap) { map = ActiveMap; if (OverrideMap) map = OverrideMap; while (map) { if ((key = map->FindKey(Event.Key.Code)) != 0) { if (key->fKeyMap) { SetMap(key->fKeyMap, &key->fKey); Event.What = evNone; return ; } else { SetMap(0, &key->fKey); ExecMacro(view, key->Cmd); Event.What = evNone; return ; } } // printf("Going up\n"); map = map->fParent; } if (!OverrideMap) { SetMap(0, 0); Event.What = evNone; } return ; } while (EventMap) { if (map) { if ((key = map->FindKey(Event.Key.Code)) != 0) { if (key->fKeyMap) { SetMap(key->fKeyMap, &key->fKey); Event.What = evNone; return ; } else { ExecMacro(view, key->Cmd); Event.What = evNone; return ; } } } EventMap = EventMap->Parent; if (EventMap == 0) break; map = EventMap->KeyMap; } // if (GetCharFromEvent(Event, &Ch)) // CharEvent(view, Event, Ch); SetMap(0, 0); } void EGUI::DispatchCommand(GxView *view, TEvent &Event) { if (Event.Msg.Command > 65536 + 16384) { // hack for PM toolbar Event.Msg.Command -= 65536 + 16384; BeginMacro(view); ExState State; State.Macro = 0; State.Pos = 0; ExecCommand(view, Event.Msg.Command, State); Event.What = evNone; } else if (Event.Msg.Command >= 65536) { Event.Msg.Command -= 65536; ExecMacro(view, Event.Msg.Command); Event.What = evNone; } } void EGUI::DispatchEvent(GFrame *frame, GView *view, TEvent &Event) { GxView *xview = (GxView *) view; if (Event.What == evNone || (Event.What == evMouseMove && Event.Mouse.Buttons == 0)) return ; if (Event.What == evNotify && Event.Msg.Command == cmPipeRead) { Event.Msg.Model->NotifyPipe(Event.Msg.Param1); return; } if (xview->GetEventMap() != 0) { switch (Event.What) { case evKeyDown: DispatchKey(xview, Event); break; case evCommand: if (Event.Msg.Command >= 65536) { DispatchCommand(xview, Event); } else { switch (Event.Msg.Command) { case cmClose: { assert(ActiveView != 0); FrameClose(ActiveView->MView->Win); return; } } } } } GUI::DispatchEvent(frame, view, Event); #if defined(OS2) && !defined(DBMALLOC) && defined(CHECKHEAP) if (_heapchk() != _HEAPOK) DieError(0, "Heap memory is corrupt."); #endif } ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// int EGUI::WinNext(GxView *view) { view->Parent->SelectNext(0); return 1; } int EGUI::WinPrev(GxView *view) { view->Parent->SelectNext(1); return 1; } int EGUI::FileCloseX(EView *View, int CreateNew, int XClose) { char Path[MAXPATH]; // this should never fail! if (GetDefaultDirectory(View->Model, Path, sizeof(Path)) == 0) return 0; if (View->Model->ConfQuit(View->MView->Win)) { View->Model->DeleteRelated(); // close everything that can be closed without confirmation if closing all if (XClose) while (View->Model->Next != View->Model && View->Model->Next->CanQuit()) delete View->Model->Next; View->DeleteModel(View->Model); if (ActiveModel == 0 && CreateNew) { EView *V = ActiveView; EModel *m = new EDirectory(0, &ActiveModel, Path); if (m == 0) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Could not create directory view"); return 0; } do { V = V->Next; V->SelectModel(ActiveModel); } while (V != ActiveView); return 0; } if (ActiveModel == 0) { StopLoop(); } return 1; } return 0; } int EGUI::FileClose(EView *View, ExState &State) { int x = 0; if (State.GetIntParam(View, &x) == 0) x = OpenAfterClose; return FileCloseX(View, x); } int EGUI::FileCloseAll(EView *View, ExState &State) { int x = 0; if (State.GetIntParam(View, &x) == 0) x = OpenAfterClose; while (ActiveModel) if (FileCloseX(View, x, 1) == 0) return 0; return 1; } int EGUI::WinHSplit(GxView *View) { GxView *view; ExModelView *edit; EView *win; int W, H; View->ConQuerySize(&W, &H); if (H < 8) return 0; view = new GxView(View->Parent); if (view == 0) return 0; win = new EView(ActiveModel); if (win == 0) return 0; edit = new ExModelView(win); if (edit == 0) return 0; view->PushView(edit); view->Parent->SelectNext(0); return 1; } int EGUI::WinClose(GxView * /*V*/) { EView *View = ActiveView; if (View->Next == View) { // when closing last window, close all files if (ExitEditor(View) == 0) return 0; } else { View->MView->Win->Parent->SelectNext(0); delete View->MView->Win; } return 1; } int EGUI::WinZoom(GxView *View) { GView *V = View->Next; GView *V1; while (V) { V1 = V; if (V == View) break; V = V->Next; delete V1; } return 1; } int EGUI::WinResize(ExState &State, GxView *View) { int Delta = 1; if (State.GetIntParam(0, &Delta)) { if (View->ExpandHeight(Delta) == 0) return 1; } return 0; } int EGUI::ExitEditor(EView *View) { EModel *B = ActiveModel; // check/save modified files while (ActiveModel) { if (ActiveModel->CanQuit()) ; else { View->SelectModel(ActiveModel); int rc = ActiveModel->ConfQuit(View->MView->Win, 1); if (rc == -2) { View->FileSaveAll(); break; } if (rc == 0) return 0; } ActiveModel = ActiveModel->Next; if (ActiveModel == B) break; } if (SaveDesktopOnExit && DesktopFileName[0] != 0) SaveDesktop(DesktopFileName); else if (LoadDesktopMode == 2) { // Ask about saving? GxView* gx = View->MView->Win; if (gx->GetStr("Save desktop As", sizeof(DesktopFileName), DesktopFileName, HIST_DEFAULT) != 0) { SaveDesktop(DesktopFileName); } } while (ActiveModel) { if (View->Model->GetContext() == CONTEXT_ROUTINES) { // Never delete Routine models directly ActiveModel = ActiveModel->Next; View->SelectModel(ActiveModel); } View->Model->DeleteRelated(); // delete related views first while (View->Model->Next != View->Model && View->Model->Next->CanQuit()) delete View->Model->Next; View->DeleteModel(View->Model); } StopLoop(); return 1; } int EGUI::ShowEntryScreen() { return gui->ShowEntryScreen(); } int EGUI::RunProgram(ExState &State, GxView *view) { static char Cmd[512] = ""; if (ActiveModel) SetDefaultDirectory(ActiveModel); if (State.GetStrParam(ActiveView, Cmd, sizeof(Cmd)) == 0) if (view->GetStr("Run", sizeof(Cmd), Cmd, HIST_COMPILE) == 0) return 0; gui->RunProgram(RUN_WAIT, Cmd); return 1; } int EGUI::RunProgramAsync(ExState &State, GxView *view) { static char Cmd[512] = ""; if (ActiveModel) SetDefaultDirectory(ActiveModel); if (State.GetStrParam(ActiveView, Cmd, sizeof(Cmd)) == 0) if (view->GetStr("Run", sizeof(Cmd), Cmd, HIST_COMPILE) == 0) return 0; gui->RunProgram(RUN_ASYNC, Cmd); return 1; } int EGUI::MainMenu(ExState &State, GxView *View) { char s[3]; if (State.GetStrParam(0, s, sizeof(s)) == 0) s[0] = 0; View->Parent->ExecMainMenu(s[0]); return 1; } int EGUI::ShowMenu(ExState &State, GxView *View) { char MName[32] = ""; if (State.GetStrParam(0, MName, sizeof(MName)) == 0) return 0; View->Parent->PopupMenu(MName); return 0; } int EGUI::LocalMenu(GxView *View) { EEventMap *Map = View->GetEventMap(); const char *MName = 0; if (Map) MName = Map->GetMenu(EM_LocalMenu); if (MName == 0) MName = "Local"; View->Parent->PopupMenu(MName); return 0; } int EGUI::DesktopSaveAs(ExState &State, GxView *view) { if (State.GetStrParam(0, DesktopFileName, sizeof(DesktopFileName)) == 0) if (view->GetFile("Save Desktop", sizeof(DesktopFileName), DesktopFileName, HIST_PATH, GF_SAVEAS) == 0) return 0; if (DesktopFileName[0] != 0) return SaveDesktop(DesktopFileName); return 0; } int EGUI::DesktopLoad(ExState &State, GxView *view) { if (State.GetStrParam(0, DesktopFileName, sizeof(DesktopFileName)) == 0) if (view->GetFile("Load Desktop", sizeof(DesktopFileName), DesktopFileName, HIST_PATH, GF_OPEN) == 0) return 0; if (DesktopFileName[0] != 0) return LoadDesktop(DesktopFileName); return 0; } int EGUI::FrameNew() { GxView *view; ExModelView *edit; if (!multiFrame() && frames) return 0; (void) new EFrame(ScreenSizeX, ScreenSizeY); assert(frames != 0); //frames->SetMenu("Main"); //?? view = new GxView(frames); assert(view != 0); (void)new EView(ActiveModel); assert(ActiveView != 0); edit = new ExModelView(ActiveView); assert(edit != 0); view->PushView(edit); frames->Show(); return 1; } int EGUI::FrameClose(GxView *View) { assert(frames != 0); assert(View != 0); if (!frames->isLastFrame()) { deleteFrame(frames); } else { if (ExitEditor(ActiveView) == 0) return 0; deleteFrame(frames); } return 1; } int EGUI::FrameNext(GxView * /*View*/) { if (!frames->isLastFrame()) { frames->Next->Activate(); return 1; } return 0; } int EGUI::FramePrev(GxView * /*View*/) { if (!frames->isLastFrame()) { frames->Prev->Activate(); return 1; } return 0; } int EGUI::findDesktop(char *argv[]) { /* * Locates the desktop file depending on the load desktop mode flag: * 0: Try the "current" directory, then the FTE .exe directory (PC) or * the user's homedir (Unix). Fail if not found (original FTE * algorithm). * 1: Try the current directory, then loop {go one directory UP and try} * If not found, don't load a desktop! * 2: As above, but asks to save the desktop if one was not found. * This is called if the desktop is not spec'd on the command line. */ switch (LoadDesktopMode) { default: //** 0: try curdir then "homedir".. // fprintf(stderr, "ld: Mode 0\n"); if (FileExists(DESKTOP_NAME)) ExpandPath(DESKTOP_NAME, DesktopFileName, sizeof(DesktopFileName)); else { //** Use homedir, #ifdef UNIX ExpandPath("~/" DESKTOP_NAME, DesktopFileName, sizeof(DesktopFileName)); #else JustDirectory(argv[0], DesktopFileName, sizeof(DesktopFileName)); strlcat(DesktopFileName, DESKTOP_NAME, sizeof(DesktopFileName)); #endif // UNIX } return FileExists(DesktopFileName); case 1: case 2: //** Try curdir, then it's owner(s).. ExpandPath(".", DesktopFileName, sizeof(DesktopFileName)); //fprintf(stderr, "ld: Mode 1 (start at %s)\n", DesktopFileName); for (;;) { //** Try current location, char *pe = DesktopFileName + strlen(DesktopFileName); Slash(DesktopFileName, 1); // Add appropriate slash strlcat(DesktopFileName, DESKTOP_NAME, sizeof(DesktopFileName)); //fprintf(stderr, "ld: Mode 1 (trying %s)\n", DesktopFileName); if (FileExists(DesktopFileName)) { //fprintf(stderr, "ld: Mode 1 (using %s)\n", DesktopFileName); return 1; } //** Not found. Remove added stuff, then go level UP, *pe = 0; // Remove the current part, char *p = SepRChr(DesktopFileName); if (p == NULL) { //** No desktop! Set default name in current directory, ExpandPath(".", DesktopFileName, sizeof(DesktopFileName)); Slash(DesktopFileName, 1); strlcat(DesktopFileName, DESKTOP_NAME, sizeof(DesktopFileName)); SaveDesktopOnExit = 0; // Don't save, return 0; // NOT found!! } *p = 0; // Truncate name at last } } } void EGUI::DoLoadDesktopOnEntry(int &/*argc*/, char **argv) { if (DesktopFileName[0] == 0) findDesktop(argv); if (DesktopFileName[0] != 0) { if (IsDirectory(DesktopFileName)) { Slash(DesktopFileName, 1); strlcat(DesktopFileName, DESKTOP_NAME, sizeof(DesktopFileName)); } if (LoadDesktopOnEntry && FileExists(DesktopFileName)) LoadDesktop(DesktopFileName); } } void EGUI::EditorInit() { SSBuffer = new EBuffer(0, (EModel **)&SSBuffer, "Scrap"); assert(SSBuffer != 0); BFI(SSBuffer, BFI_Undo) = 0; // disable undo for clipboard ActiveModel = 0; } int EGUI::InterfaceInit(int &/*argc*/, char ** /*argv*/) { if (FrameNew() == 0) DieError(1, "Failed to create window\n"); return 0; } void EGUI::DoLoadHistoryOnEntry(int &/*argc*/, char **argv) { if (HistoryFileName[0] == 0) { #ifdef UNIX ExpandPath("~/.efte-history", HistoryFileName, sizeof(HistoryFileName)); #else JustDirectory(argv[0], HistoryFileName, sizeof(HistoryFileName)); strlcat(HistoryFileName, "efte.his", sizeof(HistoryFileName)); #endif // UNIX } else { char p[256]; ExpandPath(HistoryFileName, p, sizeof(p)); if (IsDirectory(p)) { Slash(p, 1); strlcat(p, HISTORY_NAME, sizeof(p)); } strlcpy(HistoryFileName, p, sizeof(HistoryFileName)); } if (KeepHistory && FileExists(HistoryFileName)) LoadHistory(HistoryFileName); } void EGUI::DoSaveHistoryOnExit() { if (KeepHistory && HistoryFileName[0] != 0) SaveHistory(HistoryFileName); // since we are exiting, free history ClearHistory(); } int EGUI::CmdLoadFiles(int &argc, char **argv) { int QuoteNext = 0; int QuoteAll = 0; int GotoLine = 0; int LineNum = 1; int ColNum = 1; int ModeOverride = 0; char Mode[32]; int LCount = 0; int ReadOnly = 0; for (int Arg = 1; Arg < argc; Arg++) { if (!QuoteAll && !QuoteNext && (argv[Arg][0] == '-')) { switch (argv[Arg][1]) { case '-': if (strncmp(argv[Arg], "--debug", 7) != 0) QuoteAll = 1; Arg = argc; break; case '!': case 'C': case 'c': case 'D': case 'd': case 'H': // handled before break; case '+': QuoteNext = 1; break; case '#': case 'l': LineNum = 1; ColNum = 1; if (strchr(argv[Arg], ',')) { GotoLine = (2 == sscanf(argv[Arg] + 2, "%d,%d", &LineNum, &ColNum)); } else { GotoLine = (1 == sscanf(argv[Arg] + 2, "%d", &LineNum)); } // printf("Gotoline = %d, line = %d, col = %d\n", GotoLine, LineNum, ColNum); break; case 'r': ReadOnly = 1; break; case 'm': if (argv[Arg][2] == 0) { ModeOverride = 0; } else { ModeOverride = 1; strcpy(Mode, argv[Arg] + 2); } break; case 'T': TagsAdd(argv[Arg] + 2); break; case 't': TagGoto(ActiveView, argv[Arg] + 2); break; case 'v': break; // fte.cpp handles this. default: DieError(2, "Invalid command line option %s", argv[Arg]); return 0; } } else { char Path[MAXPATH]; QuoteNext = 0; if (ExpandPath(argv[Arg], Path, sizeof(Path)) == 0 && IsDirectory(Path)) { EModel *m = new EDirectory(cfAppend, &ActiveModel, Path); if (m == 0 || ActiveModel == 0) { DieError(2, "Could not open directory view of path: %s\n", Path); } } else { if (LCount != 0) suspendLoads = 1; if (MultiFileLoad(cfAppend, argv[Arg], ModeOverride ? Mode : 0, ActiveView) == 0) { suspendLoads = 0; return 0; } suspendLoads = 0; if (GotoLine) { if (((EBuffer *)ActiveModel)->Loaded == 0) ((EBuffer *)ActiveModel)->Load(); if (GotoLine) { GotoLine = 0; ((EBuffer *)ActiveModel)->SetNearPosR(ColNum - 1, LineNum - 1); } else { int r, c; if (RetrieveFPos(((EBuffer *)ActiveModel)->FileName, r, c) == 1) ((EBuffer *)ActiveModel)->SetNearPosR(c, r); } //ActiveView->SelectModel(ActiveModel); } if (ReadOnly) { ReadOnly = 0; BFI(((EBuffer *)ActiveModel), BFI_ReadOnly) = 1; } } suspendLoads = 1; ActiveView->SelectModel(ActiveModel->Next); suspendLoads = 0; LCount++; } } EModel *P = ActiveModel; while (LCount-- > 0) P = P->Prev; ActiveView->SelectModel(P); return 1; } int EGUI::Start(int &argc, char **argv) { { int rc; rc = GUI::Start(argc, argv); if (rc) return rc; } if (InterfaceInit(argc, argv) != 0) return 2; EditorInit(); DoLoadHistoryOnEntry(argc, argv); DoLoadDesktopOnEntry(argc, argv); if (CmdLoadFiles(argc, argv) == 0) return 3; if (ActiveModel == 0) { char Path[MAXPATH]; GetDefaultDirectory(0, Path, sizeof(Path)); EModel *m = new EDirectory(0, &ActiveModel, Path); if (m == 0 || ActiveModel == 0) { DieError(2, "Could not open a directory view of path: %s\n", Path); } ActiveView->SwitchToModel(ActiveModel); } return 0; } void EGUI::EditorCleanup() { if (ActiveModel != NULL) { EModel *B, *N, *A; B = A = ActiveModel; do { N = B->Next; delete B; B = N; } while (B != A); } ActiveModel = NULL; delete SSBuffer; SSBuffer = NULL; if (ActiveView != NULL) { EView *BW, *NW; // If EView what is about to be deleted is currently ActiveView, ActiveView moves to next one // or if there is no next, it will be set as NULL. while ((BW = ActiveView) != NULL) { NW = BW->Next; delete BW; } //EView *BW, *NW, *AW; //BW = AW = ActiveView; //do { // NW = BW->Next; // delete BW; // BW = NW; //} while (BW != AW); } ActiveView = NULL; } void EGUI::InterfaceCleanup() { while (frames) delete frames; } void EGUI::Stop() { DoSaveHistoryOnExit(); // free macros if (Macros != 0) { while (CMacros--) { free(Macros[CMacros].Name); for (int i = 0; i < Macros[CMacros].Count; ++i) if (Macros[CMacros].cmds[i].type == CT_STRING) free(Macros[CMacros].cmds[i].u.string); free(Macros[CMacros].cmds); } free(Macros); Macros = 0; } // free colorizers while (EColorize *p = Colorizers) { Colorizers = Colorizers->Next; delete p; } // free event maps while (EEventMap *em = EventMaps) { EventMaps = EventMaps->Next; delete em; } // free modes while (EMode *m = Modes) { Modes = Modes->fNext; delete m; } // free menus if (Menus) { int mc, c; while (MenuCount--) { mc = MenuCount; free(Menus[mc].Name); while (Menus[mc].Count--) { c = Menus[mc].Count; free(Menus[mc].Items[c].Name); } free(Menus[MenuCount].Items); } free(Menus); Menus = NULL; } // free completion rexexp filter extern RxNode *CompletionFilter; RxFree(CompletionFilter); // free CRegexp array from o_messages.cpp FreeCRegexp(); // free CvsIgnoreRegexp array from o_messages.cpp FreeCvsIgnoreRegexp(); // free SvnIgnoreRegexp array from o_messages.cpp FreeSvnIgnoreRegexp(); // free configuration file path free(ConfigSourcePath); ConfigSourcePath = NULL; EditorCleanup(); InterfaceCleanup(); GUI::Stop(); } efte-1.1/src/clip_pm.cpp0000664000076400007640000000246411212506666014253 0ustar laurilauri/* clip_pm.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "clip.h" #define INCL_WIN #include #include #include extern HAB hab; int GetClipText(ClipData *cd) { char *text; cd->fLen = 0; cd->fChar = 0; if ((WinOpenClipbrd(hab) == TRUE) && ((text = (char *) WinQueryClipbrdData(hab, CF_TEXT)) != 0)) { cd->fLen = strlen(text); cd->fChar = strdup(text); } WinCloseClipbrd(hab); return 0; } int PutClipText(ClipData *cd) { ULONG len; void *text; if (WinOpenClipbrd(hab) == TRUE) { WinEmptyClipbrd(hab); len = cd->fLen; if (len) { DosAllocSharedMem((void **)&text, 0, len + 1, PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE); strncpy((char *)text, cd->fChar, len + 1); if (!WinSetClipbrdData(hab, (ULONG) text, CF_TEXT, CFI_POINTER)) DosBeep(100, 1500); } WinCloseClipbrd(hab); } return 0; } efte-1.1/src/fte.h0000664000076400007640000000302011041444731013032 0ustar laurilauri/* fte.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __FTE_H #define __FTE_H #include "ftever.h" #include "sysdep.h" #ifdef NEED_LOG_H #include "log.h" #endif // NEED_LOG_H #include "console.h" #include "gui.h" #include "c_desktop.h" #include "e_regex.h" #include "c_mode.h" #include "c_hilit.h" #include "c_bind.h" #include "e_undo.h" #include "c_color.h" #include "s_files.h" #include "s_direct.h" #include "c_config.h" #include "c_fconfig.h" #include "i_oview.h" #include "i_input.h" #include "i_key.h" #include "i_choice.h" #include "i_ascii.h" #include "i_view.h" #include "i_modelview.h" #include "egui.h" #include "o_model.h" #include "e_buffer.h" #include "e_mark.h" #include "o_list.h" #include "e_tags.h" #include "s_util.h" #include "s_string.h" #include "i_search.h" #include "i_complete.h" #include "o_directory.h" #include "o_messages.h" #include "o_buflist.h" #include "o_routine.h" #include "o_modemap.h" #include "e_cvslog.h" #include "o_cvsbase.h" #include "o_cvs.h" #include "o_cvsdiff.h" #include "e_svnlog.h" #include "o_svnbase.h" #include "o_svn.h" #include "o_svndiff.h" #include "c_commands.h" #include "c_history.h" #if defined(_DEBUG) && defined(MSVC) && defined(MSVCDEBUG) #include #define new new( _CLIENT_BLOCK, __FILE__, __LINE__) #endif //_DEBUG && MSVC && MSVCDEBUG #endif efte-1.1/src/e_undo.cpp0000664000076400007640000002350411041431440014062 0ustar laurilauri/* e_undo.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int EBuffer::NextCommand() { if (Match.Row != -1) { Draw(Match.Row, Match.Row); Match.Col = Match.Row = -1; } if (View) View->SetMsg(0); return BeginUndo(); } int EBuffer::PushBlockData() { if (BFI(this, BFI_Undo) == 0) return 1; if (PushULong(BB.Col) == 0) return 0; if (PushULong(BB.Row) == 0) return 0; if (PushULong(BE.Col) == 0) return 0; if (PushULong(BE.Row) == 0) return 0; if (PushULong(BlockMode) == 0) return 0; if (PushUChar(ucBlock) == 0) return 0; return 1; } int EBuffer::BeginUndo() { US.NextCmd = 1; return 1; } int EBuffer::EndUndo() { int N = US.Num - 1; assert(N >= 0); if (N >= 1) { int Order = 1; while (Order < N) Order <<= 1; US.Data = (void **) realloc(US.Data, sizeof(void *) * Order); US.Top = (int *) realloc(US.Top, sizeof(int) * Order); US.Num--; } else { free(US.Data); US.Data = 0; free(US.Top); US.Top = 0; US.Num = 0; } return 1; } int EBuffer::PushULong(unsigned long l) { return PushUData(&l, sizeof(unsigned long)); } int EBuffer::PushUChar(unsigned char ch) { return PushUData(&ch, sizeof(unsigned char)); } int EBuffer::PushUData(void *data, int len) { int N; int Order = 1; if (BFI(this, BFI_Undo) == 0) return 0; if (US.Record == 0) return 1; if (US.NextCmd || US.Num == 0 || US.Data == 0 || US.Top == 0) { N = US.Num; if ((BFI(this, BFI_UndoLimit) == -1) || (US.Undo) || (US.Num < BFI(this, BFI_UndoLimit))) { N++; US.Data = (void **) realloc(US.Data, sizeof(void *) * (N | 255)); US.Top = (int *) realloc(US.Top, sizeof(int) * (N | 255)); if (US.Num == US.UndoPtr && !US.Undo) US.UndoPtr++; US.Num++; } else { N = US.Num; free(US.Data[0]); memmove(US.Data, US.Data + 1, (N - 1) * sizeof(US.Data[0])); memmove(US.Top, US.Top + 1, (N - 1) * sizeof(US.Top[0])); } assert(US.Data); assert(US.Top); N = US.Num - 1; US.Data[N] = 0; US.Top[N] = 0; if (US.NextCmd == 1) { US.NextCmd = 0; if (PushULong(CP.Col) == 0) return 0; if (PushULong(CP.Row) == 0) return 0; if (PushUChar(ucPosition) == 0) return 0; } US.NextCmd = 0; } N = US.Num - 1; assert(N >= 0); if (US.Undo == 0) US.UndoPtr = US.Num; while (Order < (US.Top[N] + len)) Order <<= 1; US.Data[N] = realloc(US.Data[N], Order); memcpy((char *) US.Data[N] + US.Top[N], data, len); US.Top[N] += len; return 1; } int EBuffer::GetUData(int No, int pos, void **data, int len) { int N; if (No == -1) N = US.Num - 1; else N = No; if (BFI(this, BFI_Undo) == 0) return 0; if (N < 0) return 0; if (US.Data[N] == 0) return 0; if (US.Top[N] == 0) return 0; if (pos == -1) pos = US.Top[N]; if (pos == 0) return 0; assert(pos >= len); *data = ((char *) US.Data[N]) + pos - len; return 1; } // TODO: void *d is dangerous, this needs fixed! #define UGETC(rc,no,pos,what) \ do { void *d = 0; \ if ((rc = GetUData(no, pos, &d, sizeof(unsigned char)))) \ *(unsigned char *)&what = *(unsigned char *)d; \ pos -= sizeof(unsigned char); \ } while (0) // TODO: void *d is dangerous, this needs fixed! #define UGET(rc,no,pos,what) \ do { void *d = 0; \ if ((rc = GetUData(no, pos, &d, sizeof(what)))) \ memcpy((void *)&what, d, sizeof(what)); \ pos -= sizeof(what); \ } while (0) int EBuffer::Undo(int undo) { unsigned char UndoCmd; int rc; unsigned long Line; unsigned long Len; unsigned long ACount; unsigned long Col; void *data; int No; int Pos; if (BFI(this, BFI_Undo) == 0) return 0; if (undo) No = US.UndoPtr - 1; else No = US.Num - 1; Pos = US.Top[No]; if (No == 0 && Pos == 0) { return 0; } UGETC(rc, No, Pos, UndoCmd); while (rc == 1) { switch (UndoCmd) { case ucInsLine: UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (DelLine(Line) == 0) return 0; break; case ucDelLine: UGET(rc, No, Pos, Line); if (rc == 0) return 0; UGET(rc, No, Pos, Len); if (rc == 0) return 0; if (GetUData(No, Pos, &data, Len) == 0) return 0; if (InsLine(Line, 0) == 0) return 0; if (InsText(Line, 0, Len, (char *) data) == 0) return 0; Pos -= Len; break; case ucInsChars: UGET(rc, No, Pos, ACount); if (rc == 0) return 0; UGET(rc, No, Pos, Col); if (rc == 0) return 0; UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (DelChars(Line, Col, ACount) == 0) return 0; break; case ucDelChars: UGET(rc, No, Pos, Line); if (rc == 0) return 0; UGET(rc, No, Pos, Col); if (rc == 0) return 0; UGET(rc, No, Pos, ACount); if (rc == 0) return 0; if (GetUData(No, Pos, &data, ACount) == 0) return 0; if (InsChars(Line, Col, ACount, (char *) data) == 0) return 0; Pos -= ACount; break; case ucPosition: UGET(rc, No, Pos, Line); if (rc == 0) return 0; UGET(rc, No, Pos, Col); if (rc == 0) return 0; if (SetPos(Col, Line) == 0) return 0; break; case ucBlock: { EPoint P; unsigned long l; UGET(rc, No, Pos, l); if (rc == 0) return 0; if (BlockMode != (int)l) BlockRedraw(); BlockMode = l; UGET(rc, No, Pos, l); if (rc == 0) return 0; P.Row = l; UGET(rc, No, Pos, l); if (rc == 0) return 0; P.Col = l; if (SetBE(P) == 0) return 0; UGET(rc, No, Pos, l); if (rc == 0) return 0; P.Row = l; UGET(rc, No, Pos, l); if (rc == 0) return 0; P.Col = l; if (SetBB(P) == 0) return 0; } break; case ucFoldCreate: UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (FoldDestroy(Line) == 0) return 0; break; case ucFoldDestroy: { unsigned long level; int ff; UGET(rc, No, Pos, Line); if (rc == 0) return 0; UGET(rc, No, Pos, level); if (rc == 0) return 0; if (FoldCreate(Line) == 0) return 0; ff = FindFold(Line); assert(ff != -1); FF[ff].level = (unsigned char) level; } break; case ucFoldPromote: UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (FoldDemote(Line) == 0) return 0; break; case ucFoldDemote: UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (FoldPromote(Line) == 0) return 0; break; case ucFoldOpen: UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (FoldClose(Line) == 0) return 0; break; case ucFoldClose: UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (FoldOpen(Line) == 0) return 0; break; case ucModified: Modified = 0; break; case ucPlaceUserBookmark: UGET(rc, No, Pos, ACount); if (rc == 0) return 0; if (GetUData(No, Pos, &data, ACount) == 0) return 0; Pos -= ACount; UGET(rc, No, Pos, Col); if (rc == 0) return 0; UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (Col == (unsigned long) - 1 || Line == (unsigned long) - 1) { if (RemoveUserBookmark((const char *)data) == 0) return 0; } else { if (PlaceUserBookmark((const char *)data, EPoint(Line, Col)) == 0) return 0; } break; case ucRemoveUserBookmark: UGET(rc, No, Pos, ACount); if (rc == 0) return 0; if (GetUData(No, Pos, &data, ACount) == 0) return 0; Pos -= ACount; UGET(rc, No, Pos, Col); if (rc == 0) return 0; UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (PlaceUserBookmark((const char *)data, EPoint(Line, Col)) == 0) return 0; break; default: assert(1 == "Oops: invalid undo command.\n"[0]); } UGETC(rc, No, Pos, UndoCmd); } if (undo) US.UndoPtr--; else { US.UndoPtr++; free(US.Data[No]); if (EndUndo() == 0) return 0; } return 1; } int EBuffer::Redo() { int rc; if (BFI(this, BFI_Undo) == 0) return 0; if (US.Num == 0 || US.UndoPtr == US.Num) { Msg(S_INFO, "Nothing to redo."); return 0; } US.Record = 0; rc = Undo(0); US.Record = 1; return rc; } int EBuffer::Undo() { int rc; if (BFI(this, BFI_Undo) == 0) return 0; assert(US.Num >= 0); assert(US.UndoPtr >= 0); if (US.Num == 0 || US.UndoPtr == 0) { Msg(S_INFO, "Nothing to undo."); return 0; } US.Undo = 1; rc = Undo(1); US.Undo = 0; return rc; } efte-1.1/src/e_regex.cpp0000664000076400007640000010742411041411344014234 0ustar laurilauri/* e_regex.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include #include #include #include #include #if defined(MSVC) #include #endif #include "e_regex.h" #include "sysdep.h" //#define DEBUG static int RegCount = 0; #ifdef DEBUG static void RxDump(int N, RxNode *n); #endif static RxNode *NewNode(int aWhat) { RxNode *N = (RxNode *) malloc(sizeof(RxNode)); if (N) { memset(N, 0, sizeof(RxNode)); N->fWhat = (short)aWhat; } return N; } static RxNode *NewChar(char Ch) { RxNode *A = NewNode(RE_CHAR); if (A) { A->fChar = (char *)malloc(1); A->fLen = 1; A->fChar[0] = Ch; } return A; } static RxNode *NewEscape(const char **const Regexp) { char Ch = **Regexp; ++*Regexp; switch (Ch) { case 0: return 0; case 'a': Ch = '\a'; break; case 'b': Ch = '\b'; break; case 'f': Ch = '\f'; break; case 'n': Ch = '\n'; break; case 'r': Ch = '\r'; break; case 't': Ch = '\t'; break; case 'v': Ch = '\v'; break; case 'e': Ch = 27; break; case 's': return NewNode(RE_WSPACE); case 'S': return NewNode(RE_NWSPACE); case 'U': return NewNode(RE_UPPER); case 'L': return NewNode(RE_LOWER); case 'w': return NewNode(RE_WORD); case 'W': return NewNode(RE_NWORD); case 'd': return NewNode(RE_DIGIT); case 'D': return NewNode(RE_NDIGIT); case 'C': return NewNode(RE_CASE); case 'c': return NewNode(RE_NCASE); case 'N': { unsigned int N = 0; unsigned int A = 0; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) return 0; (*Regexp)++; A = N * 100; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) return 0; (*Regexp)++; A = A + N * 10; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) return 0; (*Regexp)++; A = A + N; Ch = (char)A; } break; case 'o': { unsigned int N = 0; unsigned int A = 0; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 7) return 0; (*Regexp)++; A = N * 64; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 7) return 0; (*Regexp)++; A = A + N * 8; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 7) return 0; (*Regexp)++; A = A + N; Ch = (char)A; } break; case 'x': { unsigned int N = 0; unsigned int A = 0; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) N = N + 48 - 65 + 10; if (N > 15) return 0; (*Regexp)++; A = N << 4; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) N = N + 48 - 65 + 10; if (N > 15) return 0; (*Regexp)++; A = A + N; Ch = (char)A; } break; } return NewChar(Ch); } #define NNN 32 // 8 * 32 = 256 (match set) #define SETOP(set,n) \ do { \ set[(unsigned char)(n) >> 3] |= (unsigned char)(1 << ((unsigned char)(n) & 7)); \ } while (0) static RxNode *NewSet(const char ** const Regexp) { unsigned char set[NNN]; int s = 0; int c = 0; unsigned int i, xx; unsigned char Ch, C1 = 0, C2 = 0; int doset = 0; memset(set, 0, sizeof(set)); s = 1; if (**Regexp == '^') { s = 0; ++*Regexp; } c = 0; while (**Regexp) { switch (Ch = *((*Regexp)++)) { case ']': if (doset == 1) return 0; { RxNode *N = NewNode(s ? RE_INSET : RE_NOTINSET); N->fChar = (char *) malloc(sizeof(set)); N->fLen = sizeof(set); if (N->fChar == 0) return 0; memcpy(N->fChar, (char *) set, sizeof(set)); return N; } case '\\': switch (Ch = *((*Regexp)++)) { case 0: return 0; case 'a': Ch = '\a'; break; case 'b': Ch = '\b'; break; case 'f': Ch = '\f'; break; case 'n': Ch = '\n'; break; case 'r': Ch = '\r'; break; case 't': Ch = '\t'; break; case 'v': Ch = '\v'; break; case 'e': Ch = 27; break; case 'N': { unsigned int N = 0; unsigned int A = 0; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) return 0; (*Regexp)++; A = N * 100; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) return 0; (*Regexp)++; A = A + N * 10; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) return 0; (*Regexp)++; A = A + N; Ch = (unsigned char)A; } break; case 'o': { unsigned int N = 0; unsigned int A = 0; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 7) return 0; (*Regexp)++; A = N * 64; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 7) return 0; (*Regexp)++; A = A + N * 8; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 7) return 0; (*Regexp)++; A = A + N; Ch = (unsigned char)A; } break; case 'x': { unsigned int N = 0; unsigned int A = 0; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) N = N + 48 - 65 + 10; if (N > 15) return 0; (*Regexp)++; A = N << 4; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) N = N + 48 - 65 + 10; if (N > 15) return 0; (*Regexp)++; A = A + N; Ch = (unsigned char)A; } break; case 's': c += 4; SETOP(set, '\n'); SETOP(set, '\t'); SETOP(set, ' '); SETOP(set, '\r'); continue; case 'S': for (xx = 0; xx <= 255; xx++) { if (xx != ' ' && xx != '\t' && xx != '\n' && xx != '\r') { c++; SETOP(set, xx); } } continue; case 'w': for (xx = 0; xx <= 255; xx++) { if (isalnum(xx)) { c++; SETOP(set, xx); } } break; case 'W': for (xx = 0; xx <= 255; xx++) { if (!isalnum(xx)) { c++; SETOP(set, xx); } } break; case 'd': for (xx = 0; xx <= 255; xx++) { if (isdigit(xx)) { c++; SETOP(set, xx); } } break; case 'D': for (xx = 0; xx <= 255; xx++) { if (!isdigit(xx)) { c++; SETOP(set, xx); } } break; case 'U': for (xx = 'A'; xx <= 'Z'; xx++) { c++; SETOP(set, xx); } continue; case 'L': for (xx = 'a'; xx <= 'z'; xx++) { c++; SETOP(set, xx); } continue; } break; } if (doset == 0 && ((**Regexp) == '-')) { doset = 1; C1 = Ch; ++*Regexp; continue; } else if (doset == 1) { C2 = Ch; if (C2 < C1) return 0; for (i = C1; i <= C2; i++) SETOP(set, i); doset = 0; continue; } c++; SETOP(set, Ch); } return 0; } static int AddNode(RxNode **F, RxNode **N, RxNode *A) { if (A) { if (*F) { (*N)->fNext = A; A->fPrev = (*N); *N = A; } else { (*N) = (*F) = A; A->fPrev = A->fNext = 0; } return 1; } return 0; } static int CountWidth(RxNode *N) { int w = 0; while (N) { if (N->fWhat < 32) w += 0; else if (N->fWhat >= 32 && N->fWhat < 64) w += 1; N = N->fNext; } return w; } static int MakeSub(RxNode **F, RxNode **N, char What) { //printf("MakeSub: %c\n", What); if (*N) { RxNode *No; RxNode *New; RxNode *Jump, *Skip; RxNode *Last = (*N); if (Last->fWhat & RE_GROUP) { RxNode *P = Last->fPrev; int C = 1; while ((C > 0) && P) { //puts("backtracking...-----"); //RxDump(0, P); if (P->fWhat & RE_GROUP) { if (P->fWhat & RE_CLOSE) C++; else C--; } Last = P; if (C == 0) break; P = P->fPrev; } //printf("P = %s, c = %d", P ? "ok":"null", C); if (C != 0) return 0; } assert(Last); if (What != '?' && What != '|') if (CountWidth(Last) == 0) { // puts("FAILED count"); return 0; } switch (What) { case '?': /* BRANCH x NOTHING */ New = NewNode(RE_BRANCH | RE_GREEDY | What); No = NewNode(RE_NOTHING); if (!New || !No) return 0; No->fPrev = *N; if (*N) (*N)->fNext = No; New->fNext = Last; New->fPrev = Last->fPrev; Last->fPrev = New; if (New->fPrev) { New->fPrev->fNext = New; } else { *F = New; } New->fPtr = No; No->fPtr = New; *N = No; //puts("BRANCH ?"); break; case '*': case '@': New = NewNode(RE_BRANCH | What | ((What == '*') ? RE_GREEDY : 0)); Jump = NewNode(RE_JUMP); No = NewNode(RE_NOTHING); if (!New || !No || !Jump) return 0; No->fPrev = Jump; Jump->fNext = No; Jump->fPrev = *N; if (*N) (*N)->fNext = Jump; New->fNext = Last; New->fPrev = Last->fPrev; Last->fPrev = New; if (New->fPrev) { New->fPrev->fNext = New; } else { *F = New; } New->fPtr = No; No->fPtr = New; Jump->fPtr = New; *N = No; //puts("BRANCH *"); break; case '#': case '+': New = NewNode(RE_BRANCH | What | ((What == '+') ? RE_GREEDY : 0)); Skip = NewNode(RE_JUMP); Jump = NewNode(RE_JUMP); No = NewNode(RE_NOTHING); if (!New || !No || !Jump) return 0; No->fPrev = Jump; Jump->fPrev = *N; Jump->fNext = No; Skip->fNext = New; New->fPrev = Skip; if (*N) (*N)->fNext = Jump; New->fNext = Last; Skip->fPrev = Last->fPrev; Last->fPrev = New; if (Skip->fPrev) { Skip->fPrev->fNext = Skip; } else { *F = Skip; } New->fPtr = No; No->fPtr = New; Jump->fPtr = New; Skip->fPtr = Last; *N = No; //puts("BRANCH +"); break; case '|': New = NewNode(RE_BRANCH | RE_GREEDY | What); Jump = NewNode(RE_BREAK); No = NewNode(RE_NOTHING); if (!New || !No || !Jump) return 0; No->fPrev = Jump; Jump->fNext = No; Jump->fPrev = *N; if (*N) (*N)->fNext = Jump; New->fNext = Last; New->fPrev = Last->fPrev; Last->fPrev = New; if (New->fPrev) { New->fPrev->fNext = New; } else { *F = New; } New->fPtr = No; No->fPtr = New; Jump->fPtr = New; *N = No; //puts("BRANCH |"); break; } return 1; } return 0; } #define CHECK(n) do { if ((n) == 0) { return 0;} } while (0) static RxNode *RxComp(const char **const Regexp) { RxNode *F = 0; RxNode *N = 0; int C; char Ch; while (**Regexp) { // puts(*Regexp); switch (Ch = (*(*Regexp)++)) { case '?': case '*': case '+': case '@': case '#': case '|': CHECK(MakeSub(&F, &N, Ch)); break; case '}': case ')': return F; case '{': CHECK(AddNode(&F, &N, NewNode(RE_GROUP | RE_OPEN))); CHECK(AddNode(&F, &N, RxComp(Regexp))); while (N->fNext) N = N->fNext; CHECK(AddNode(&F, &N, NewNode(RE_GROUP | RE_CLOSE))); break; case '(': C = ++RegCount; CHECK(AddNode(&F, &N, NewNode(RE_GROUP | RE_OPEN | RE_MEM | C))); CHECK(AddNode(&F, &N, RxComp(Regexp))); while (N->fNext) N = N->fNext; CHECK(AddNode(&F, &N, NewNode(RE_GROUP | RE_CLOSE | RE_MEM | C))); break; case '\\': CHECK(AddNode(&F, &N, NewEscape(Regexp))); break; case '[': CHECK(AddNode(&F, &N, NewSet(Regexp))); break; case '^': CHECK(AddNode(&F, &N, NewNode(RE_ATBOL))); break; case '$': CHECK(AddNode(&F, &N, NewNode(RE_ATEOL))); break; case '.': CHECK(AddNode(&F, &N, NewNode(RE_ANY))); break; case '<': CHECK(AddNode(&F, &N, NewNode(RE_ATBOW))); break; case '>': CHECK(AddNode(&F, &N, NewNode(RE_ATEOW))); break; default: --*Regexp; CHECK(AddNode(&F, &N, NewChar(**Regexp))); ++*Regexp; break; } } return F; } static RxNode *RxOptimize(RxNode *rx) { return rx; } RxNode *RxCompile(const char *Regexp) { RxNode *n = 0, *x; if (Regexp == 0) return 0; RegCount = 0; n = RxComp(&Regexp); if (n == 0) return 0; n = RxOptimize(n); x = n; while (x->fNext) x = x->fNext; x->fNext = NewNode(RE_END); return n; } void RxFree(RxNode *n) { RxNode *p; while (n) { p = n; n = n->fNext; switch (p->fWhat) { case RE_INSET: case RE_NOTINSET: case RE_CHAR: free(p->fChar); break; default: break; } free(p); } } #define ChClass(x) (((((x) >= 'A') && ((x) <= 'Z')) || (((x) >= 'a') && ((x) <= 'z')) || (((x) >= '0') && ((x) <= '9')))?1:0) static RxMatchRes *match; static const char *bop; static const char *eop; static int flags = RX_CASE; static const char *rex; int RxMatch(RxNode *rx) { RxNode *n = rx; //printf(">>"); while (n) { //printf("%-50.50s\n", rex); //RxDump(1, n); switch (n->fWhat) { case RE_NOTHING: break; case RE_CASE: flags |= RX_CASE; break; case RE_NCASE: flags &= ~RX_CASE; break; case RE_ATBOL: if (rex != bop) return 0; break; case RE_ATEOL: if (rex != eop) return 0; break; case RE_ANY: if (rex == eop) return 0; rex++; break; case RE_WSPACE: if (rex == eop) return 0; if (*rex != ' ' && *rex != '\n' && *rex != '\r' && *rex != '\t') return 0; rex++; break; case RE_NWSPACE: if (rex == eop) return 0; if (*rex == ' ' || *rex == '\n' || *rex == '\r' || *rex == '\t') return 0; rex++; break; case RE_WORD: if (rex == eop) return 0; if (!isalnum(*rex)) return 0; rex++; break; case RE_NWORD: if (rex == eop) return 0; if (isalnum(*rex)) return 0; rex++; break; case RE_DIGIT: if (rex == eop) return 0; if (!isdigit(*rex)) return 0; rex++; break; case RE_NDIGIT: if (rex == eop) return 0; if (isdigit(*rex)) return 0; rex++; break; case RE_UPPER: if (rex == eop) return 0; if (!isupper(*rex)) return 0; rex++; break; case RE_LOWER: if (rex == eop) return 0; if (!islower(*rex)) return 0; rex++; break; case RE_ATBOW: if (rex >= eop) return 0; if (rex > bop) { if ((ChClass(*rex) != 1) || (ChClass(*(rex - 1)) != 0)) return 0; } break; case RE_ATEOW: if (rex <= bop) return 0; if (rex < eop) { if ((ChClass(*rex) != 0) || (ChClass(*(rex - 1)) != 1)) return 0; } break; case RE_CHAR: if (rex == eop) return 0; if (flags & RX_CASE) { if (*n->fChar != *rex) return 0; if (memcmp(rex, n->fChar, n->fLen) != 0) return 0; } else { for (int i = 0; i < n->fLen; i++) if (toupper(rex[i]) != toupper(n->fChar[i])) return 0; } rex += n->fLen; break; case RE_INSET: if (rex == eop) return 0; if ((n->fChar[(unsigned char)(*rex) >> 3] & (1 << ((unsigned char)(*rex) & 7))) == 0) return 0; rex++; break; case RE_NOTINSET: if (rex == eop) return 0; if (n->fChar[(unsigned char)(*rex) >> 3] & (1 << ((unsigned char)(*rex) & 7))) return 0; rex++; break; case RE_JUMP: n = n->fPtr; continue; case RE_END: return 1; case RE_BREAK: n = n->fNext; if (n->fNext == 0) break; n = n->fNext; if (n->fWhat & RE_BRANCH) { while ((n->fWhat & RE_BRANCH) && n->fPtr && ((n->fWhat & 0xFF) == '|')) n = n->fPtr->fNext; } if (n->fWhat & RE_GROUP) { int C = 1; n = n->fNext; while ((C > 0) && n) { if (n->fWhat & RE_GROUP) { if (n->fWhat & RE_OPEN) C++; else C--; } if (C == 0) break; n = n->fNext; } } break; default: if (n->fWhat & RE_GROUP) { if (n->fWhat & RE_MEM) { const char *save = rex; int b = n->fWhat & 0xFF; int fl = flags; if (RxMatch(n->fNext) == 0) { flags = fl; if (n->fWhat & RE_OPEN) match->Open[b] = -1; else match->Close[b] = -1; return 0; } if (n->fWhat & RE_OPEN) { // if (match->Open[b] == -1) match->Open[b] = (int)(save - bop); } else { // if (match->Close[b] == -1) match->Close[b] = (int)(save - bop); } return 1; } } else if (n->fWhat & RE_BRANCH) { const char *save = rex; int fl = flags; if ((n->fWhat & RE_GREEDY) == 0) { if (RxMatch(n->fPtr) == 1) return 1; flags = fl; rex = save; } else { if (RxMatch(n->fNext) == 1) return 1; flags = fl; rex = save; n = n->fPtr; continue; } } break; } n = n->fNext; } /* NOTREACHED */ assert(1 == 0 /* internal regexp error */); return 0; } int RxTry(RxNode *rx, const char *s) { int fl = flags; rex = s; for (int i = 0; i < NSEXPS; i++) match->Open[i] = match->Close[i] = -1; if (RxMatch(rx)) { match->Open[0] = (int)(s - bop); match->Close[0] = (int)(rex - bop); return 1; } flags = fl; return 0; } int RxExecMatch(RxNode *Regexp, const char *Data, int Len, const char *Start, RxMatchRes *Match, unsigned int RxOpt) { if (Regexp == 0) return 0; match = Match; bop = Data; eop = Data + Len; flags = RxOpt; return RxTry(Regexp, Start); } int RxExec(RxNode *Regexp, const char *Data, int Len, const char *Start, RxMatchRes *Match, unsigned int RxOpt) { char Ch; if (Regexp == 0) return 0; match = Match; bop = Data; eop = Data + Len; flags = RxOpt; for (int i = 0; i < NSEXPS; i++) Match->Open[i] = Match->Close[i] = -1; switch (Regexp->fWhat) { // this should be more clever case RE_ATBOL: // match is anchored return RxTry(Regexp, Start); case RE_CHAR: // search for a character to match Ch = Regexp->fChar[0]; if (Start == eop) break; if (flags & RX_CASE) { while (1) { while (Start < eop && *Start != Ch) Start++; if (Start == eop) break; if (RxTry(Regexp, Start)) return 1; if (++Start == eop) break; } } else { Ch = toupper(Ch); while (1) { while (Start < eop && toupper(*Start) != Ch) Start++; if (Start == eop) break; if (RxTry(Regexp, Start)) return 1; if (++Start == eop) break; } } break; default: // (slow) do { if (RxTry(Regexp, Start)) return 1; } while (Start++ < eop); break; } return 0; } #define FLAG_UP_CASE 1 #define FLAG_DOWN_CASE 2 #define FLAG_UP_NEXT 4 #define FLAG_DOWN_NEXT 8 static int add(int *len, char **s, const char *a, int alen, int &flag) { int NewLen = *len + alen; int i; NewLen = NewLen * 2; if (alen == 0) return 0; if (*s) { *s = (char *) realloc(*s, NewLen); assert(*s); memcpy(*s + *len, a, alen); } else { *s = (char *) malloc(NewLen); assert(*s); memcpy(*s, a, alen); *len = 0; } if (flag & FLAG_UP_CASE) { char *p = *s + *len; for (i = 0; i < alen; i++) { *p = (char)toupper(*p); p++; } } else if (flag & FLAG_DOWN_CASE) { char *p = *s + *len; for (i = 0; i < alen; i++) { *p = (char)tolower(*p); p++; } } if (flag & FLAG_UP_NEXT) { char *p = *s + *len; *p = (char)toupper(*p); flag &= ~FLAG_UP_NEXT; } else if (flag & FLAG_DOWN_NEXT) { char *p = *s + *len; *p = (char)tolower(*p); flag &= ~FLAG_DOWN_NEXT; } *len += alen; return 0; } int RxReplace(const char *rep, const char *Src, int /*len*/, RxMatchRes match, char **Dest, int *Dlen) { int dlen = 0; char *dest = 0; char Ch; int n; int flag = 0; *Dest = 0; *Dlen = 0; // add(&dlen, &dest, Src, match.Open[0]); while (*rep) { switch (Ch = *rep++) { // case '&': // add(&dlen, &dest, Src + match.Open[0], match.Close[0] - match.Open[0], flag); // break; case '\\': switch (Ch = *rep++) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': n = Ch - 48; if (match.Open[n] != -1 && match.Close[n] != -1) { add(&dlen, &dest, Src + match.Open[n], match.Close[n] - match.Open[n], flag); } else return -1; break; case 0: if (dest) free(dest); return -1; // error case 'r': Ch = '\r'; add(&dlen, &dest, &Ch, 1, flag); break; case 'n': Ch = '\n'; add(&dlen, &dest, &Ch, 1, flag); break; case 'b': Ch = '\b'; add(&dlen, &dest, &Ch, 1, flag); break; case 'a': Ch = '\a'; add(&dlen, &dest, &Ch, 1, flag); break; case 't': Ch = '\t'; add(&dlen, &dest, &Ch, 1, flag); break; case 'U': flag |= FLAG_UP_CASE; break; case 'u': flag |= FLAG_UP_NEXT; break; case 'L': flag |= FLAG_DOWN_CASE; break; case 'l': flag |= FLAG_DOWN_NEXT; break; case 'E': case 'e': flag &= ~(FLAG_UP_CASE | FLAG_DOWN_CASE); break; case 'x': { int N = 0; int A = 0; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 9) N = N + 48 - 65 + 10; if (N > 15) return 0; rep++; A = N << 4; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 9) N = N + 48 - 65 + 10; if (N > 15) return 0; rep++; A = A + N; Ch = (char)A; } add(&dlen, &dest, &Ch, 1, flag); break; case 'd': { int N = 0; int A = 0; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 9) { free(dest); return 0; } rep++; A = N * 100; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 9) { free(dest); return 0; } rep++; A = N * 10; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 9) { free(dest); return 0; } rep++; A = A + N; Ch = (char)A; } add(&dlen, &dest, &Ch, 1, flag); break; case 'o': { int N = 0; int A = 0; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 7) { free(dest); return 0; } rep++; A = N * 64; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 7) { free(dest); return 0; } rep++; A = N * 8; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 7) { free(dest); return 0; } rep++; A = A + N; Ch = (char)A; } add(&dlen, &dest, &Ch, 1, flag); break; default: add(&dlen, &dest, &Ch, 1, flag); break; } break; default: add(&dlen, &dest, &Ch, 1, flag); break; } } // add(&dlen, &dest, Src + match.Close[0], len - match.Close[0]); *Dlen = dlen; *Dest = dest; return 0; } #ifdef DEBUG static void RxDump(int N, RxNode *n) { while (n) { for (int i = 0; i < N; i++) printf(" "); switch (n->fWhat) { case RE_NOTHING: printf("NOTHING\n"); break; case RE_CHAR: printf("CHAR '%.1s'\n", n->fChar); break; case RE_ATBOL: printf("^\n"); break; case RE_ATEOL: printf("$\n"); break; case RE_ANY: printf(".\n"); break; case RE_INSET: printf("[\n"/*, n->fChar*/); break; case RE_NOTINSET: printf("[^\n"/*, n->fChar*/); break; case RE_ATBOW: printf("<\n"); break; case RE_ATEOW: printf(">\n"); break; case RE_WSPACE: printf("WSPACE\n"); break; case RE_NWSPACE: printf("NWSPACE\n"); break; case RE_UPPER: printf("UPPER\n"); break; case RE_LOWER: printf("LOWER\n"); break; case RE_JUMP: printf("JUMP\n"); break; case RE_BREAK: printf("BREAK\n"); break; case RE_END: printf("END\n"); break; default: if (n->fWhat & RE_GROUP) { if (n->fWhat & RE_MEM) { if (n->fWhat & RE_OPEN) printf("( %d\n", n->fWhat & 0xFF); if (n->fWhat & RE_CLOSE) printf(") %d\n", n->fWhat & 0xFF); } else { if (n->fWhat & RE_OPEN) printf("{\n"); if (n->fWhat & RE_CLOSE) printf("}\n"); } } else if (n->fWhat & RE_BRANCH) { if (n->fWhat & RE_GREEDY) { printf("%c\n", n->fWhat & 0xFF); } else { printf("%c\n", n->fWhat & 0xFF); } } else { printf("???????????????\n"); } break; } n = n->fNext; } } #define TEST(rc,rx,st) \ strcpy(line,st); \ assert((a = RxCompile(rx)) != 0); \ puts("\n--- " rx " -- " st " -- "); \ RxDump(0,a);\ assert(rc == RxExec(a, line, strlen(line), line, &b)); \ RxFree(a); int main() { RxNode *a; RxMatchRes b; char line[1024]; TEST(1, "a", "a"); TEST(0, "b", "a"); TEST(1, "aaaa", "aaaa"); TEST(0, "bbbb", "aaaa"); TEST(1, ".", "a"); TEST(0, ".", ""); TEST(1, "a..", "axx"); TEST(0, "a..", "b.."); TEST(1, "a?b", "ab"); TEST(1, "a?b", "xb"); TEST(0, "a?C", "xb"); TEST(1, "{aa}?b", "aab"); TEST(1, "{aa}?b", "xab"); TEST(0, "{aa}?C", "xxb"); TEST(1, "^aa", "aa"); TEST(0, "^aa", "baa"); TEST(1, "^aa$" , "aa"); TEST(0, "^aa$", "baab"); TEST(1, "a*b", "aaab"); TEST(0, "a*b", "aaaa"); TEST(1, "{aa}*b", "aaab"); TEST(0, "{aa}*b", "aaaa"); TEST(1, "b+", "bb"); TEST(1, "b+", "b"); TEST(0, "b+", "a"); TEST(1, "^b+$", "b"); TEST(0, "^b+$", "aba"); TEST(1, "a|b", " a"); TEST(1, "a|b", " b"); TEST(0, "a|b", " c"); TEST(1, "a|b|c|d|e", " a "); TEST(1, "a|b|c|d|e", " c "); TEST(1, "a|b|c|d|e", " e "); TEST(0, "a|b|c|d|e", " x "); TEST(1, "{a}|{b}|{c}|{d}|{e}", " a "); TEST(1, "{a}|{b}|{c}|{d}|{e}", " c "); TEST(1, "{a}|{b}|{c}|{d}|{e}", " e "); TEST(0, "{a}|{b}|{c}|{d}|{e}", " x "); TEST(1, "^xx{alpha}|{beta}xx$", "xxalphaxx"); TEST(1, "^xx{alpha}|{beta}xx$", "xxbetaxx"); TEST(1, "[a-z]", "aaa"); TEST(1, "^{Error}|{Warning}", "Warning search.cpp 35: Conversion may lose significant digits in function AskReplace()"); TEST(1, "^{Error}|{Warning} (.+)", "Warning search.cpp 35: Conversion may lose significant digits in function AskReplace()"); TEST(1, "^{Error}|{Warning} ([a-z.]#) ([0-9]#)", "Warning search.cpp 35: Conversion may lose significant digits in function AskReplace()"); TEST(1, "^{Error}|{Warning} (.+) ([0-9]+): (.*)$", "Warning search.cpp 35: Conversion may lose significant digits in function AskReplace()"); TEST(1, "^{Error}|{Warning} (.+) ([0-9]+): (.*)$", "Error search.cpp 35: Conversion may lose significant digits in function AskReplace()"); TEST(1, "^([a-z]+ +)*\\(", "blabla bla bla bla ("); TEST(1, "^([a-z]+\\s+)+\\(", "blabla bla bla bla ("); TEST(1, "^([a-z]+\\s*)+\\(", "blabla bla bla bla("); TEST(1, "^([a-z]+\\s+)+\\(", "blabla bla bla bla ("); TEST(1, "^([a-z]+\\s*)+\\(", "blabla bla bla bla("); TEST(1, "^([a-z]# #)*\\(", "blabla bla bla bla ("); TEST(1, "^([a-z]+ @)@\\(", "blabla bla bla bla ("); TEST(1, "^[\\x20-\\xFF]+$", "blabla"); TEST(1, "{a{a{a{a|a}|{a|a}a}a}a|a}", "aaaaaaaaaaaaaaaaa"); while (1) { printf("Regexp: "); fflush(stdout); gets(line); if (!*line) break; a = RxCompile(line); RxDump(0, a); printf("String: "); fflush(stdout); gets(line); printf("rc = %d\n", RxExec(a, line, strlen(line), line, &b)); for (int i = 0; i < NSEXPS; i++) { if (b.Open[i] != -1) { printf("%d: %d %d\n", i, b.Open[i], b.Close[i]); } } RxFree(a); } return 0; } #endif efte-1.1/src/h_plain.cpp0000664000076400007640000000567011042704100014224 0ustar laurilauri/* h_plain.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #define hsPLAIN_Normal 0 int Hilit_Plain(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine* Line, hlState& State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); int j = 0; if (BF->Mode->fColorize->Keywords.TotalCount > 0 || BF->WordCount > 0) { /* words have to be hilited, go slow */ for (i = 0; i < Line->Count;) { IF_TAB() else { if (isalpha(*p) || (*p == '_')) { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_')) ) j++; if (BF->GetHilitWord(j, Line->Chars + i, Color, 1)) ; else { Color = CLR_Normal; State = hsPLAIN_Normal; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; State = hsPLAIN_Normal; Color = CLR_Normal; continue; } ColorNext(); continue; } } } else { if (ExpandTabs) { /* use slow mode */ for (i = 0; i < Line->Count;) { IF_TAB() else { ColorNext(); } } } else { /* fast mode */ if (Pos < Line->Count) { if (Pos + Width < Line->Count) { if (B) MoveMem(B, 0, Width, Line->Chars + Pos, HILIT_CLRD(), Width); if (StateMap) memset(StateMap, State, Line->Count); } else { if (B) MoveMem(B, 0, Width, Line->Chars + Pos, HILIT_CLRD(), Line->Count - Pos); if (StateMap) memset(StateMap, State, Line->Count); } } C = Line->Count; } } *ECol = C; State = 0; return 0; } int Indent_Plain(EBuffer *B, int Line, int PosCursor) { int OI = B->LineIndented(Line); B->IndentLine(Line, B->LineIndented(Line - 1)); if (PosCursor) { int I = B->LineIndented(Line); int X = B->CP.Col; X = X - OI + I; if (X < I) X = I; if (X < 0) X = 0; B->SetPosR(X, Line); } return 1; } efte-1.1/src/h_ada.cpp0000664000076400007640000001033311041404761013647 0ustar laurilauri/* h_ada.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #define hsAda_Normal 0 #define hsAda_Comment 1 #define hsAda_CommentL 2 #define hsAda_Keyword 4 #define hsAda_String1 10 #define hsAda_String2 11 int Hilit_ADA(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { int j = 0; int firstnw = 0; HILIT_VARS(BF->Mode->fColorize->Colors, Line); int len1 = len; // char *last = p + len1 - 1; C = 0; NC = 0; for (i = 0; i < Line->Count;) { if (*p != ' ' && *p != 9) firstnw++; IF_TAB() else { switch (State) { default: case hsAda_Normal: if (isalpha(*p) || *p == '_') { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_') || (Line->Chars[i + j] == '\'')) ) j++; if (BF->GetHilitWord(j, &Line->Chars[i], Color, 1)) { State = hsAda_Keyword; } else { int x; x = i + j; while ((x < Line->Count) && ((Line->Chars[x] == ' ') || (Line->Chars[x] == 9))) x++; if ((x < Line->Count) && (Line->Chars[x] == '(')) { Color = CLR_Function; } else { Color = CLR_Normal; } State = hsAda_Normal; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; State = hsAda_Normal; continue; } else if ((len >= 2) && (*p == '-') && (*(p + 1) == '-')) { State = hsAda_CommentL; Color = CLR_Comment; //hilit2: ColorNext(); hilit: ColorNext(); continue; } else if (isdigit(*p)) { Color = CLR_Number; ColorNext(); while (len && (isdigit(*p) || *p == 'e' || *p == 'E' || *p == '.' || *p == '_')) ColorNext(); continue; } else if (*p == '\'') { State = hsAda_String1; Color = CLR_String; goto hilit; } else if (*p == '"') { State = hsAda_String2; Color = CLR_String; goto hilit; } else if (ispunct(*p) && *p != '_') { Color = CLR_Punctuation; goto hilit; } Color = CLR_Normal; goto hilit; case hsAda_CommentL: Color = CLR_Comment; goto hilit; case hsAda_String1: Color = CLR_String; if (*p == '\'') { ColorNext(); State = hsAda_Normal; continue; } goto hilit; case hsAda_String2: Color = CLR_String; if (*p == '"') { ColorNext(); State = hsAda_Normal; continue; } goto hilit; } } } if (State == hsAda_CommentL) State = hsAda_Normal; if ((len1 == 0)) { switch (State) { case hsAda_String1: case hsAda_String2: State = hsAda_Normal; break; } } *ECol = C; return 0; } efte-1.1/src/i_choice.cpp0000664000076400007640000001145311041404761014361 0ustar laurilauri/* i_choice.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" ExChoice::ExChoice(const char *ATitle, int NSel, va_list ap): ExView() { char msg[1024]; int i; char *fmt; Cur = 0; MouseCaptured = 0; Title = strdup(ATitle); lTitle = strlen(Title); NOpt = NSel; lChoice = 0; for (i = 0; i < NSel; i++) { SOpt[i] = strdup(va_arg(ap, char *)); lChoice += CStrLen(SOpt[i]) + 1; } fmt = va_arg(ap, char *); vsprintf(msg, fmt, ap); strncpy(Prompt, msg, sizeof(Prompt)); Prompt[sizeof(Prompt) - 1] = 0; } ExChoice::~ExChoice() { free(Title); for (int i = 0; i < NOpt; i++) free(SOpt[i]); } void ExChoice::Activate(int gotfocus) { ExView::Activate(gotfocus); } int ExChoice::BeginMacro() { return 1; } int ExChoice::FindChoiceByPoint(int x, int y) { int pos, i; int W, H; Win->ConQuerySize(&W, &H); if (y != H - 1) return -1; pos = W - lChoice; if (x < pos) return -1; for (i = 0; i < NOpt; i++) { int clen = CStrLen(SOpt[i]); if (x > pos && x <= pos + clen) return i; pos += clen + 1; } return -1; } void ExChoice::HandleEvent(TEvent &Event) { int i; switch (Event.What) { case evKeyDown: switch (kbCode(Event.Key.Code)) { case kbTab | kfShift: case kbLeft: if (Cur == -1) Cur = 0; Cur--; if (Cur < 0) Cur = NOpt - 1; Event.What = evNone; break; case kbTab: case kbRight: if (Cur == -1) Cur = 0; Cur++; if (Cur >= NOpt) Cur = 0; Event.What = evNone; break; case kbHome: Cur = 0; Event.What = evNone; break; case kbEnd: Cur = NOpt - 1; Event.What = evNone; break; case kbEnter: if (Cur >= 0 && NOpt > 0) EndExec(Cur); Event.What = evNone; break; case kbEsc: EndExec(-1); Event.What = evNone; break; default: if (isAscii(Event.Key.Code)) { char c = char(Event.Key.Code & 0xFF); char s[3]; s[0] = '&'; s[1] = (char)(toupper((char)c) & 0xFF); s[2] = 0; for (i = 0; i < NOpt; i++) { if (strstr(SOpt[i], s) != 0) { Win->EndExec(i); break; } } Event.What = evNone; } break; } break; case evMouseDown: if (Win->CaptureMouse(1)) MouseCaptured = 1; else break; Cur = FindChoiceByPoint(Event.Mouse.X, Event.Mouse.Y); Event.What = evNone; break; case evMouseMove: if (MouseCaptured) Cur = FindChoiceByPoint(Event.Mouse.X, Event.Mouse.Y); Event.What = evNone; break; case evMouseUp: if (MouseCaptured) Win->CaptureMouse(0); else break; MouseCaptured = 0; Cur = FindChoiceByPoint(Event.Mouse.X, Event.Mouse.Y); Event.What = evNone; if (Cur >= 0 && Cur < NOpt && NOpt > 0) EndExec(Cur); else Cur = 0; break; } } void ExChoice::UpdateView() { if (Next) { Next->UpdateView(); } } void ExChoice::RepaintView() { if (Next) { Next->RepaintView(); } } void ExChoice::UpdateStatus() { RepaintStatus(); } void ExChoice::RepaintStatus() { TDrawBuffer B; int W, H; int pos, i; TAttr color1, color2; ConQuerySize(&W, &H); if (Cur != -1) { if (Cur >= NOpt) Cur = NOpt - 1; if (Cur < 0) Cur = 0; } MoveCh(B, ' ', hcChoice_Background, W); MoveStr(B, 0, W, Title, hcChoice_Title, W); MoveChar(B, lTitle, W, ':', hcChoice_Background, 1); MoveStr(B, lTitle + 2, W, Prompt, hcChoice_Param, W); pos = W - lChoice; for (i = 0; i < NOpt; i++) { if (i == Cur) { color1 = hcChoice_ActiveItem; color2 = hcChoice_ActiveChar; } else { color1 = hcChoice_NormalItem; color2 = hcChoice_NormalChar; } if (i == Cur) ConSetCursorPos(pos + 1, H - 1); MoveChar(B, pos, W, ConGetDrawChar(DCH_V), hcChoice_Background, 1); MoveCStr(B, pos + 1, W, SOpt[i], color1, color2, W); pos += CStrLen(SOpt[i]) + 1; } ConPutBox(0, H - 1, W, 1, B); } efte-1.1/src/i_modelview.h0000664000076400007640000000200711041404761014562 0ustar laurilauri/* i_modelview.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __EXEDIT_H #define __EXEDIT_H class EView; class ExModelView: public ExView { public: EView *View; int MouseCaptured; int MouseMoved; ExModelView(EView *AView); virtual ~ExModelView(); virtual void Activate(int gotfocus); virtual EEventMap *GetEventMap(); virtual int ExecCommand(int Command, ExState &State); virtual int GetContext(); virtual int BeginMacro(); virtual void HandleEvent(TEvent &Event); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); virtual void Resize(int width, int height); virtual void WnSwitchBuffer(EModel *M); virtual int IsModelView() { return 1; } }; #endif efte-1.1/src/o_cvs.cpp0000664000076400007640000001366211041404761013734 0ustar laurilauri/* * o_cvs.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * Contributed by Martin Frydl * * Class providing access to most of CVS commands. */ #include "fte.h" static int SameDir(char* D1, char* D2) { if (!D1 || !D2) return 0; int l1 = strlen(D1); int l2 = strlen(D2); if (l1 < l2) return strncmp(D1, D2, l1) == 0 && strcmp(D2 + l1, SSLASH) == 0; else if (l1 == l2) return !strcmp(D1, D2); else return strncmp(D1, D2, l2) == 0 && strcmp(D1 + l1, SSLASH) == 0; } const char *CvsStatusChars = "?UPMCAR"; ECvs *CvsView = 0; ECvs::ECvs(int createFlags, EModel **ARoot, char* ADir, char* ACommand, char* AOnFiles) : ECvsBase(createFlags, ARoot, "CVS") { CvsView = this; LogFile = 0; Commiting = 0; RunPipe(ADir, ACommand, AOnFiles); } ECvs::ECvs(int createFlags, EModel **ARoot) : ECvsBase(createFlags, ARoot, "CVS") { CvsView = this; LogFile = 0; } ECvs::~ECvs() { CvsView = 0; RemoveLogFile(); } void ECvs::RemoveLogFile() { if (LogFile) { unlink(LogFile); free(LogFile); LogFile = 0; } } char* ECvs::MarkedAsList() { int i; int len = 0; // First pass - calculate size for (i = 0;i < LineCount;i++) if (Lines[i]->Status&2) len += strlen(Lines[i]->File) + 1; if (len == 0) { // Nothing marked, use the file at cursor if (Lines[Row]->Status&4) return strdup(Lines[Row]->File); else return NULL; } char *s = (char *)malloc(len + 1); s[0] = 0; for (i = 0;i < LineCount;i++) if (Lines[i]->Status&2) strcat(strcat(s, Lines[i]->File), " "); s[strlen(s)-1] = 0; return s; } char ECvs::GetFileStatus(char* file) { // Search backward, file can be present several times (old messages) for (int i = LineCount - 1;i >= 0;i--) if (Lines[i]->File && filecmp(Lines[i]->File, file) == 0) return Lines[i]->Msg[0]; return 0; } void ECvs::ParseLine(char* line, int len) { if (len > 2 && line[1] == ' ' && strchr(CvsStatusChars, line[0])) { AddLine(line + 2, -1, line, 5); } else AddLine(0, -1, line); } int ECvs::RunPipe(char* ADir, char* ACommand, char* AOnFiles) { Commiting = 0; if (!SameDir(Directory, ADir)) FreeLines(); return ECvsBase::RunPipe(ADir, ACommand, AOnFiles); } void ECvs::ClosePipe() { ECvsBase::ClosePipe(); if (Commiting && !ReturnCode) { // Successful commit - reload files // Is it safe to do this ? Currently not done, manual reload is needed } Commiting = 0; } int ECvs::RunCommit(char* ADir, char* ACommand, char* AOnFiles) { if (!SameDir(Directory, ADir)) FreeLines(); free(Command); free(Directory); free(OnFiles); Command = strdup(ACommand); Directory = strdup(ADir); OnFiles = strdup(AOnFiles); RemoveLogFile(); // Disallow any CVS command while commiting Running = 1; // Create message buffer ECvsLog *cvslog = new ECvsLog(0, &ActiveModel, Directory, OnFiles); LogFile = strdup(cvslog->FileName); View->SwitchToModel(cvslog); AddLine(LogFile, -1, "CVS commit start - enter message text", 1); return 0; } extern BufferView *BufferList;//!!! int ECvs::DoneCommit(int commit) { Running = 0; // Remove line with link to log free(Lines[LineCount-1]->File); free(Lines[LineCount-1]->Msg); LineCount--; UpdateList(); if (commit) { // We need a copy of Command/Directory/OnFiles because RunPipe deletes them! char *ACommand = (char *)malloc(strlen(Command) + strlen(LogFile) + 10); char *ADirectory = strdup(Directory); char *AOnFiles = strdup(OnFiles); sprintf(ACommand, "%s -F %s", Command, LogFile); int ret = RunPipe(ADirectory, ACommand, AOnFiles); free(ACommand); free(ADirectory); free(AOnFiles); // We set Commiting after RunPipe since it sets it to 0 // This is OK since FTE is not multi-threaded Commiting = 1; if (ActiveView->Model == CvsLogView) { // CvsLogView is currently active, move CvsView just after it if (CvsLogView->Next != CvsView) { // Need to move, is not at right place yet // Here we use the fact that if current model is closed, // the one just after it (Next) is focused. CvsView->Prev->Next = CvsView->Next; CvsView->Next->Prev = CvsView->Prev; CvsView->Next = CvsLogView->Next; CvsLogView->Next->Prev = CvsView; CvsLogView->Next = CvsView; CvsView->Prev = CvsLogView; } } // else - CvsLogView is not active, there is need to make CvsView // active some other way. However, SwitchToModel() or SelectModel() // calls does not work. Currently I don't know how to do this. !!! return ret; } else { RemoveLogFile(); UpdateList(); return 0; } } // If running, can't be closed without asking int ECvs::CanQuit() { if (Running) return 0; else return 1; } // Ask user if we can close this model int ECvs::ConfQuit(GxView* V, int multiFile) { if (CvsLogView) { // Log is open if (CvsLogView->ConfQuit(V, multiFile)) { // Commit confirmed or discarded - depends on Running ActiveView->DeleteModel(CvsLogView); } else return 0; } if (Running) { // CVS command in progress switch (V->Choice(GPC_ERROR, "CVS command is running", 2, "&Kill", "&Cancel", "")) { case 0: // Kill return 1; case 1: // Cancel default: return 0; } } else return 1; } // Event map - this name is used in config files when defining eventmap EEventMap *ECvs::GetEventMap() { return FindEventMap("CVS"); } efte-1.1/src/con_cocoa.cpp0000664000076400007640000004051511041406261014540 0ustar laurilauri/* con_coca.cpp * * Copyright (c) 1994-1996, Marko Macek * Copyright (c) 2008, Lauri Nurmi * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ /* This file duplicates (way too much) code from con_x11.cpp. */ #include #include #include #include #include #include #include #include #include #include #include #include #include "sysdep.h" #include "c_config.h" #include "console.h" #include "gui.h" #include "con_i18n.h" #include "s_files.h" #include "s_util.h" #include "s_string.h" i18n_context_t* i18n_ctx = NULL; #ifdef CAST_FD_SET_INT #define FD_SET_CAST() (int *) #else #define FD_SET_CAST() #endif #define MIN_SCRWIDTH 20 #define MIN_SCRHEIGHT 6 #define MAX_PIPES 40 //#define PIPE_BUFLEN 4096 #define SELECTION_INCR_LIMIT 0x1000 #define SELECTION_XFER_LIMIT 0x1000 #define SELECTION_MAX_AGE 10 typedef struct { int used; int id; int fd; int pid; int stopped; EModel *notify; } GPipe; static GPipe Pipes[MAX_PIPES] = { { 0 }, }; static const long MouseAutoDelay = 40; static const long MouseAutoRepeat = 200; static const long MouseMultiClick = 300; static int setUserPosition = 0; static int initX = 0, initY = 0; /*static*/ unsigned int ScreenCols = 80; /*static*/ unsigned int ScreenRows = 25; static unsigned int CursorX = 0; static unsigned int CursorY = 0; static int CursorVisible = 1; static bool insertState = 1; static int CursorStart, CursorEnd; static unsigned long CursorLastTime; // Cursor flashing interval, in msecs static unsigned CursorFlashInterval = 300; unsigned char *ScreenBuffer = NULL; static int Refresh = 0; static int useI18n = 1; static int FontCX = 8, FontCY = 18; static char winTitle[256] = "eFTE"; static char winSTitle[256] = "eFTE"; typedef struct _IncrementalSelectionInfo { struct _IncrementalSelectionInfo *next; unsigned char *data; int len; int pos; Atom requestor; Atom property; Atom type; time_t lastUse; } IncrementalSelectionInfo; IncrementalSelectionInfo *incrementalSelections = NULL; static Bool gotXError; static void SendSelection(XEvent *notify, Atom property, Atom type, unsigned char *data, int len, Bool privateData); static int ErrorHandler(Display *, XErrorEvent *ee) { gotXError = True; return 1; } static int AllocBuffer() { unsigned char *p; unsigned int i; ScreenBuffer = (unsigned char *)malloc(2 * ScreenCols * ScreenRows); if (ScreenBuffer == NULL) return -1; for (i = 0, p = ScreenBuffer; i < ScreenCols * ScreenRows; i++) { *p++ = 32; *p++ = 0x07; } return 0; } static struct { int r, g, b; } dcolors[] = { { 0, 0, 0 }, // black { 0, 0, 160 }, // darkBlue { 0, 160, 0 }, // darkGreen { 0, 160, 160 }, // darkCyan { 160, 0, 0 }, // darkRed { 160, 0, 160 }, // darkMagenta { 160, 160, 0 }, // darkYellow { 204, 204, 204 }, // paleGray { 160, 160, 160 }, // darkGray { 0, 0, 255 }, // blue { 0, 255, 0 }, // green { 0, 255, 255 }, // cyan { 255, 0, 0 }, // red { 255, 0, 255 }, // magenta { 255, 255, 0 }, // yellow { 255, 255, 255 }, // white }; #include "cocoa.h" int ConInit(int XSize, int YSize) { if (XSize != -1) ScreenCols = XSize; if (YSize != -1) ScreenRows = YSize; if (AllocBuffer() == -1) return -1; #ifndef NO_SIGNALS signal(SIGALRM, SIG_IGN); signal(SIGPIPE, SIG_IGN); #endif return 0; } int ConDone(void) { free(ScreenBuffer); return 0; } int ConSuspend(void) { return 0; } int ConContinue(void) { return 0; } int ConClear(void) { TDrawBuffer B; MoveCh(B, ' ', 0x07, ScreenCols); return ConPutLine(0, 0, ScreenCols, ScreenRows, B); } int ConSetTitle(char *Title, char *STitle) { } int ConGetTitle(char *Title, int MaxLen, char *STitle, int SMaxLen) { strlcpy(Title, winTitle, MaxLen); strlcpy(STitle, winSTitle, SMaxLen); return 0; } #define InRange(x,a,y) (((x) <= (a)) && ((a) < (y))) #define CursorXYPos(x,y) (ScreenBuffer + ((x) + ((y) * ScreenCols)) * 2) void DrawCursor(int Show) { #if 0 if (CursorVisible) { unsigned char *p = CursorXYPos(CursorX, CursorY); } #endif } int ConPutBox(int X, int Y, int W, int H, PCell Cell) { unsigned int i; unsigned char temp[256], attr; unsigned char *p, *ps, *c, *ops; unsigned int len, x, l, ox, olen, skip; if (X >= (int) ScreenCols || Y >= (int) ScreenRows || X + W > (int) ScreenCols || Y + H > (int) ScreenRows) { //fprintf(stderr, "%d %d %d %d %d %d\n", ScreenCols, ScreenRows, X, Y, W, H); return -1; } //XClearArea(display, win, X, Y, W * FontCX, H * FontCY, False); //fprintf(stderr, "%d %d %d %d %d %d\n", ScreenCols, ScreenRows, X, Y, W, H); for (i = 0; i < (unsigned int)H; i++) { len = W; p = CursorXYPos(X, Y + i); ps = (unsigned char *) Cell; x = X; while (len > 0) { if (!Refresh) { c = CursorXYPos(x, Y + i); skip = 0; ops = ps; ox = x; olen = len; while ((len > 0) && c[0] == ps[0] && c[1] == ps[1]) { ps += 2; c += 2; x++; len--; skip++; } if (len <= 0) break; if (skip <= 4) { ps = ops; x = ox; len = olen; } } p = ps; l = 1; temp[0] = *ps++; attr = *ps++; while ((l < len) && ((unsigned char)(ps[1]) == attr)) { temp[l++] = *ps++; ps++; } //temp[l] = 0; printf("%s\n", temp); len -= l; x += l; } /* if (x < ScreenCols - 1) { printf("XX %d %d %d\n", X, x, W); XFillRectangle(display, win, GCs[15 * 16 + 7], x * FontCX, (Y + i) * FontCY, (ScreenCols - x - 1) * FontCX, FontCY); } */ p = CursorXYPos(X, Y + i); memcpy(p, Cell, W * 2); if (i + Y == CursorY) DrawCursor(1); Cell += W; } return 0; } int ConGetBox(int X, int Y, int W, int H, PCell Cell) { int i; for (i = 0; i < H; i++) { memcpy(Cell, CursorXYPos(X, Y + i), 2 * W); Cell += W; } return 0; } int ConPutLine(int X, int Y, int W, int H, PCell Cell) { int i; for (i = 0; i < H; i++) { if (ConPutBox(X, Y + i, W, 1, Cell) != 0) return -1; } return 0; } int ConSetBox(int X, int Y, int W, int H, TCell Cell) { TDrawBuffer B; int i; for (i = 0; i < W; i++) B[i] = Cell; ConPutLine(X, Y, W, H, B); return 0; } int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { fprintf(stderr, "%s\n", __FUNCTION__); } int ConSetSize(int X, int Y) { fprintf(stderr, "ConSetSize from (%d, %d) to (%d, %d)\n", ScreenCols, ScreenRows, X, Y); unsigned char *NewBuffer; unsigned char *p; int i; int MX, MY; p = NewBuffer = (unsigned char *) malloc(X * Y * 2); if (NewBuffer == NULL) return -1; for (i = 0; i < X * Y; i++) { *p++ = ' '; *p++ = 0x07; } MX = ScreenCols; if (X < MX) MX = X; MY = ScreenRows; if (Y < MY) MY = Y; p = NewBuffer; for (i = 0; i < MY; i++) { memcpy(p, CursorXYPos(0, i), MX * 2); p += X * 2; } free(ScreenBuffer); ScreenBuffer = NewBuffer; ScreenCols = X; ScreenRows = Y; //ConPutBox(0, 0, ScreenCols, ScreenRows, (PCell) ScreenBuffer); //if (Refresh == 0) // XResizeWindow(display, win, ScreenCols * FontCX, ScreenRows * FontCY); return 0; } int ConQuerySize(int *X, int *Y) { *X = ScreenCols; *Y = ScreenRows; return 0; } int ConSetCursorPos(int X, int Y) { DrawCursor(0); CursorX = X; CursorY = Y; DrawCursor(1); return 0; } int ConQueryCursorPos(int *X, int *Y) { *X = CursorX; *Y = CursorY; return 0; } int ConShowCursor(void) { CursorVisible = 1; DrawCursor(1); return 0; } int ConHideCursor(void) { DrawCursor(0); CursorVisible = 0; return 0; } int ConCursorVisible(void) { return 1; } void ConSetInsertState(bool insert) { insertState = insert; } int ConSetCursorSize(int Start, int End) { CursorStart = Start; CursorEnd = End; DrawCursor(CursorVisible); return 1; } int ConSetMousePos(int /*X*/, int /*Y*/) { return 0; } static int LastMouseX = -1, LastMouseY = -1; int ConQueryMousePos(int *X, int *Y) { if (X) *X = LastMouseX; if (Y) *Y = LastMouseY; return 0; } int ConShowMouse(void) { printf("Show\n"); return 0; } int ConHideMouse(void) { printf("Hide\n"); return 0; } int ConMouseVisible(void) { return 1; } int ConQueryMouseButtons(int *ButtonCount) { *ButtonCount = 3; return 0; } void UpdateWindow(int xx, int yy, int ww, int hh) { PCell p; int i; /* show redrawn area */ /* XFillRectangle(display, win, GCs[14], xx, yy, ww, hh); XFlush(display); i = XEventsQueued(display, QueuedAfterReading); while (i-- > 0) { XEvent e; XNextEvent(display, &e); } // sleep(1);*/ ww /= FontCX; ww += 2; hh /= FontCY; xx /= FontCX; yy /= FontCY; /* * OK for this moment I suggest this method - it works somehow * But I suppose the correct solution would meant general rewrite * of some basic behavior of FTE editor * THIS IS TEMPORAL FIX AND SHOULD BE SOLVED IN GENERAL WAY ! */ hh *= 3; yy -= hh; hh += hh + 2; if (yy < 0) yy = 0; if (xx + ww > (int)ScreenCols) ww = ScreenCols - xx; if (yy + hh > (int)ScreenRows) hh = ScreenRows - yy; Refresh = 1; //frames->Repaint(); //frames->Update(); p = (PCell) CursorXYPos(xx, yy); for (i = 0; i < hh; i++) { ConPutBox(xx, yy + i, ww, 1, p); p += ScreenCols; } //fprintf(stderr, "UPDATE\tx:%3d y:%3d w:%3d h:%3d\n", xx, yy, ww, hh); //XFlush(display); Refresh = 0; } void ResizeWindow(int ww, int hh) { int ox = ScreenCols; int oy = ScreenRows; ww /= FontCX; if (ww <= 4) ww = 4; hh /= FontCY; if (hh <= 2) hh = 2; if ((int)ScreenCols != ww || (int)ScreenRows != hh) { Refresh = 0; ConSetSize(ww, hh); Refresh = 1; if (ox < (int)ScreenCols) UpdateWindow(ox * FontCX, 0, (ScreenCols - ox) * FontCX, ScreenRows * FontCY); if (oy < (int)ScreenRows) UpdateWindow(0, oy * FontCY, ScreenCols * FontCX, (ScreenRows - oy) * FontCY); Refresh = 0; } } void ConvertKeyToEvent(KeySym key, KeySym key1, char */*keyname*/, char */*keyname1*/, int etype, int state, TEvent *Event) { } static TEvent LastMouseEvent = { evNone }; #define TM_DIFF(x,y) ((long)(((long)(x) < (long)(y)) ? ((long)(y) - (long)(x)) : ((long)(x) - (long)(y)))) void ConvertClickToEvent(int type, int xx, int yy, int button, int state, TEvent *Event, Time mtime) { } static void FlashCursor() { struct timeval tv; if (!CursorBlink || gettimeofday(&tv, NULL) != 0) return; unsigned long OldTime = CursorLastTime; CursorLastTime = tv.tv_sec * 1000 + tv.tv_usec / 1000; if (OldTime / CursorFlashInterval != CursorLastTime / CursorFlashInterval) DrawCursor(CursorVisible); } static TEvent Pending = { evNone }; int ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete) { fprintf(stderr, "%s\n", __FUNCTION__); //Event->What = evCommand; Event->Msg.Command = cmResize; return 0; } int ConPutEvent(TEvent Event) { fprintf(stderr, "%s\n", __FUNCTION__); Pending = Event; return 0; } int ConFlush(void) { fprintf(stderr, "%s\n", __FUNCTION__); } int ConGrabEvents(TEventMask /*EventMask*/) { return 0; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) { if (::ConInit(XSize, YSize) == 0) gui = this; else gui = NULL; fArgc = argc; fArgv = argv; } GUI::~GUI() { ::ConDone(); } int GUI::ConSuspend(void) { return ::ConSuspend(); } int GUI::ConContinue(void) { return ::ConContinue(); } int GUI::ShowEntryScreen() { return 1; } extern GFrame *frames; extern void *theGlobalGUI; int GUI::Run() { if (Start(fArgc, fArgv) == 0) { doLoop = 1; theGlobalGUI = this; cacao(); Stop(); return 0; } return 1; } int GUI::OpenPipe(char *Command, EModel *notify) { #ifndef NO_PIPES int i; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) { int pfd[2]; Pipes[i].id = i; Pipes[i].notify = notify; Pipes[i].stopped = 1; if (pipe((int *)pfd) == -1) return -1; switch (Pipes[i].pid = fork()) { case - 1: /* fail */ return -1; case 0: /* child */ signal(SIGPIPE, SIG_DFL); close(pfd[0]); close(0); assert(open("/dev/null", O_RDONLY) == 0); dup2(pfd[1], 1); dup2(pfd[1], 2); close(pfd[1]); exit(system(Command)); default: close(pfd[1]); fcntl(pfd[0], F_SETFL, O_NONBLOCK); Pipes[i].fd = pfd[0]; } Pipes[i].used = 1; //fprintf(stderr, "Pipe Open: %d\n", i); return i; } } return -1; #else return 0; #endif } int GUI::SetPipeView(int id, EModel *notify) { #ifndef NO_PIPES if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; //fprintf(stderr, "Pipe View: %d %08X\n", id, notify); Pipes[id].notify = notify; #endif return 0; } int GUI::ReadPipe(int id, void *buffer, int len) { #ifndef NO_PIPES int r; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; //fprintf(stderr, "Pipe Read: Get %d %d\n", id, len); r = read(Pipes[id].fd, buffer, len); //fprintf(stderr, "Pipe Read: Got %d %d\n", id, len); if (r == 0) { close(Pipes[id].fd); Pipes[id].fd = -1; return -1; } if (r == -1) { Pipes[id].stopped = 1; return 0; } return r; #else return 0; #endif } int GUI::ClosePipe(int id) { #ifndef NO_PIPES int status; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; if (Pipes[id].fd != -1) close(Pipes[id].fd); kill(Pipes[id].pid, SIGHUP); alarm(2); waitpid(Pipes[id].pid, &status, 0); alarm(0); //fprintf(stderr, "Pipe Close: %d\n", id); Pipes[id].used = 0; return WEXITSTATUS(status); #else return 0; #endif } int GUI::RunProgram(int mode, char *Command) { char Cmd[1024]; strlcpy(Cmd, XShellCommand, sizeof(Cmd)); if (*Command == 0) // empty string = shell strlcat(Cmd, " -ls &", sizeof(Cmd)); else { strlcat(Cmd, " -e ", sizeof(Cmd)); strlcat(Cmd, Command, sizeof(Cmd)); if (mode == RUN_ASYNC) strlcat(Cmd, " &", sizeof(Cmd)); } return system(Cmd); } char ConGetDrawChar(int idx) { static const char *tab = NULL; if (!tab) { tab = GetGUICharacters("X11", "\x0D\x0C\x0E\x0B\x12\x19____+>\x1F\x01\x12 "); } assert(idx >= 0 && idx < (int) strlen(tab)); return tab[idx]; } extern TEvent NextEvent; extern "C" void MyDispatchEvent() { GUI *g = (GUI*)theGlobalGUI; g->ProcessEvent(); /* NextEvent.What = evKeyDown; NextEvent.Msg.View = frames->Active; NextEvent.Key.Code = '\n'; g->DispatchEvent(frames, NextEvent.Msg.View, NextEvent);*/ } extern "C" void MyDispatchKeyEvent(char c) { GUI *g = (GUI*)theGlobalGUI; NextEvent.What = evKeyDown; NextEvent.Msg.View = frames->Active; NextEvent.Key.Code = c; g->ProcessEvent(); } extern "C" void MyResizeWindow(int x, int y) { ResizeWindow(x, y); MyDispatchEvent(); } efte-1.1/src/clip_gpm.cpp0000664000076400007640000000061211041404761014404 0ustar laurilauri/* clip_gpm.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int GetPMClip(int clipboard) { return 0; } int PutPMClip(int clipboard) { return 0; } efte-1.1/src/e_cvslog.h0000664000076400007640000000314611041404761014065 0ustar laurilauri/* * e_cvslog.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * Contributed by Martin Frydl * * Subclass of EBuffer for writing log for CVS commit. Creates temporary file * used for commit which is deleted when view is closed. Asks for commit or * discard on view close. */ #ifndef _CVSLOG_H_ #define _CVSLOG_H_ #include "e_buffer.h" class ECvsLog: public EBuffer { public: ECvsLog(int createFlags, EModel **ARoot, char *Directory, char *OnFiles); ~ECvsLog(); // List files into buffer // p - line where to print // fCount - number of files which will be printed // title - title // cnt - total number of files // position - positions of files in list // len - length of files // status - status of files // list - list of filenames // incexc - status of files to print/not to print // exc - incexc is exclusion void ListFiles(int &p, const int fCount, const char *title, const int cnt, const int *position, const int *len, const char *status, const char *list, const char *excinc, const int exc = 0); virtual int CanQuit(); virtual int ConfQuit(GxView *V, int multiFile = 0); virtual EViewPort *CreateViewPort(EView *V); virtual void GetName(char *AName, int MaxLen); virtual void GetInfo(char *AInfo, int MaxLen); virtual void GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen); }; extern ECvsLog *CvsLogView; #endif efte-1.1/src/ftewin32.rc0000664000076400007640000000010611152610277014077 0ustar laurilauri#include FTE ICON "..\\packaging\\shared\\eftewin32.ico" efte-1.1/src/i_choice.h0000664000076400007640000000172311041404761014025 0ustar laurilauri/* i_choice.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __EXCHOICE_H #define __EXCHOICE_H class ExChoice: public ExView { public: char *Title; char Prompt[160]; int NOpt; char *SOpt[10]; int Cur; int lTitle; int lChoice; int MouseCaptured; ExChoice(const char *ATitle, int NSel, va_list ap /* choices, format, args */); virtual ~ExChoice(); virtual void Activate(int gotfocus); virtual ExView* GetViewContext() { return Next; } virtual int BeginMacro(); int FindChoiceByPoint(int x, int y); virtual void HandleEvent(TEvent &Event); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); }; #endif efte-1.1/src/i_view.h0000664000076400007640000000340011041404761013537 0ustar laurilauri/* i_view.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __I_VIEW_H__ #define __I_VIEW_H__ class EView; class GxView: public GView { public: ExView *Top; ExView *Bottom; int MouseCaptured; GxView(GFrame *Parent); virtual ~GxView(); void PushView(ExView *view); ExView *PopView(); void NewView(ExView *view); EEventMap *GetEventMap(); int ExecCommand(int Command, ExState &State); virtual int GetContext(); virtual ExView* GetStatusContext() { if (Top) return Top->GetStatusContext(); else return 0; } virtual ExView* GetViewContext() { if (Top) return Top->GetViewContext(); else return 0; } virtual int BeginMacro(); virtual void HandleEvent(TEvent &Event); virtual void Update(); virtual void Repaint(); virtual void Activate(int gotfocus); virtual void Resize(int width, int height); void UpdateTitle(char *Title, char *STitle); int ReadStr(const char *Prompt, unsigned int BufLen, char *Str, Completer Comp, int Select, int HistId); int Choice(unsigned long Flags, const char *Title, int NSel, ... /* choices, format, args */); TKeyCode GetChar(const char *Prompt); int IncrementalSearch(EView *V); int PickASCII(); int ICompleteWord(EView *View); int GetStr(const char *Prompt, unsigned int BufLen, char *Str, int HistId); int GetFile(const char *Prompt, unsigned int BufLen, char *Str, int HistId, int Flags); int IsModelView() { return Top ? Top->IsModelView() : 0; } }; #endif efte-1.1/src/gui.cpp0000664000076400007640000000166611041404761013410 0ustar laurilauri/* * gui.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include #include #include #include #include #include "console.h" #include "gui.h" int GFrame::isLastFrame() { if (this == Next && frames == this) return 1; else return 0; } void GUI::deleteFrame(GFrame *frame) { if (frame->isLastFrame()) { delete frame; frames = 0; } else { //frame->Prev->Next = frame->Next; //frame->Next->Prev = frame->Prev; //if (frames == frame) // frames = frame->Next; //frames->Activate(); delete frame; } } int GUI::Start(int &/*argc*/, char ** /*argv*/) { return 0; } void GUI::Stop() { } void GUI::StopLoop() { doLoop = 0; } efte-1.1/src/o_model.cpp0000664000076400007640000001025011041404761014227 0ustar laurilauri/* o_model.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" EModel* ActiveModel = 0; EModel *FindModelID(EModel *Model, int ID) { EModel *M = Model; int No = ID; while (M) { if (M->ModelNo == No) return M; M = M->Next; if (M == Model) break; } return 0; } int GetNewModelID(EModel *B) { static int lastid = -1; if (ReassignModelIds) lastid = 0; // 0 is used by buffer list while (FindModelID(B, ++lastid) != 0) /* */; return lastid; } EModel::EModel(int createFlags, EModel **ARoot) { Root = ARoot; if (Root) { if (*Root) { if (createFlags & cfAppend) { Prev = *Root; Next = (*Root)->Next; } else { Next = *Root; Prev = (*Root)->Prev; } Prev->Next = this; Next->Prev = this; } else Prev = Next = this; if (!(createFlags & cfNoActivate)) *Root = this; } else Prev = Next = this; View = 0; ModelNo = -1; ModelNo = GetNewModelID(this); } EModel::~EModel() { EModel *D = this; while (D) { D->NotifyDelete(this); D = D->Next; if (D == this) break; } if (Next != this) { Prev->Next = Next; Next->Prev = Prev; if (*Root == this) *Root = Next; } else *Root = 0; } void EModel::AddView(EView *V) { RemoveView(V); if (V) V->NextView = View; View = V; } void EModel::RemoveView(EView *V) { EView **X = &View; if (!V) return; while (*X) { if ((*X) == V) { *X = V->NextView; return; } X = (&(*X)->NextView); } } void EModel::SelectView(EView *V) { RemoveView(V); AddView(V); } EViewPort *EModel::CreateViewPort(EView * /*V*/) { return 0; } int EModel::ExecCommand(int /*Command*/, ExState &/*State*/) { return ErFAIL; } void EModel::HandleEvent(TEvent &/*Event*/) { } void EModel::Msg(int level, const char *s, ...) { char msgbuftmp[MSGBUFTMP_SIZE]; va_list ap; if (View == 0) return; va_start(ap, s); vsprintf(msgbuftmp, s, ap); va_end(ap); if (level != S_BUSY) View->SetMsg(msgbuftmp); } int EModel::CanQuit() { return 1; } int EModel::ConfQuit(GxView * /*V*/, int /*multiFile*/) { return 1; } int EModel::GetContext() { return CONTEXT_NONE; } EEventMap *EModel::GetEventMap() { return 0; } int EModel::BeginMacro() { return 1; } void EModel::GetName(char *AName, int /*MaxLen*/) { *AName = 0; } void EModel::GetPath(char *APath, int /*MaxLen*/) { *APath = 0; } void EModel::GetInfo(char *AInfo, int /*MaxLen*/) { *AInfo = 0; } void EModel::GetTitle(char *ATitle, int /*MaxLen*/, char *ASTitle, int /*SMaxLen*/) { *ATitle = 0; *ASTitle = 0; } void EModel::NotifyPipe(int /*PipeId*/) { } void EModel::NotifyDelete(EModel * /*Deleted*/) { } void EModel::DeleteRelated() { } EViewPort::EViewPort(EView *V) { View = V; ReCenter = 0; } EViewPort::~EViewPort() {} void EViewPort::HandleEvent(TEvent &/*Event*/) { } void EViewPort::UpdateView() { } void EViewPort::RepaintView() { } void EViewPort::UpdateStatus() { } void EViewPort::RepaintStatus() { } void EViewPort::GetPos() { } void EViewPort::StorePos() { } void EViewPort::Resize(int /*Width*/, int /*Height*/) {} void EModel::UpdateTitle() { char Title[256] = ""; //fte: "; char STitle[256] = ""; //"fte: "; EView *V; GetTitle(Title, sizeof(Title) - 1, STitle, sizeof(STitle) - 1); V = View; while (V) { V->MView->Win->UpdateTitle(Title, STitle); V = V->NextView; } } int EModel::GetStrVar(int var, char *str, int buflen) { switch (var) { case mvCurDirectory: return GetDefaultDirectory(this, str, buflen); } return 0; } int EModel::GetIntVar(int /*var*/, int * /*value*/) { return 0; } efte-1.1/src/o_svnbase.h0000664000076400007640000000505011041404761014237 0ustar laurilauri/* * o_svnbase.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * S.Pinigin copy o_cvsbase.h and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Base class for all other SVN-related classes. This is similar to EMessages * - starts SVN and shows its messages in list view. */ #ifndef __SVNBASE_H__ #define __SVNBASE_H__ typedef struct { char *File; // Relative to view's directory int Line; char *Msg; EBuffer *Buf; char Status; // bit 0 - hilited // bit 1 - marked // bit 2 - markable } SvnLine; class ESvnBase: public EList { public: char *Command; char *Directory; char *OnFiles; char *OnFilesPos; int LineCount; SvnLine **Lines; int Running; int BufLen; int BufPos; int PipeId; int ReturnCode; char MsgBuf[4096]; ESvnBase(int createFlags, EModel **ARoot, const char *ATitle); ~ESvnBase(); void FreeLines(); void AddLine(char* file, int line, const char* msg, int hilit = 0); void FindBuffer(int line); void AssignBuffer(EBuffer *B, int line); void FindFileLines(EBuffer *B); virtual void NotifyDelete(EModel *Deleting); int GetLine(char *Line, int max); virtual void ParseLine(char *line, int len); void NotifyPipe(int APipeId); // Returns 0 if OK - calls ContinuePipe() several times to complete command for all files virtual int RunPipe(char *Dir, char *Command, char *OnFiles); // Returns 0 if OK - continue with next files in queue virtual int ContinuePipe(); // Reads ReturnCode, sets Running to 0, PipeId to -1 virtual void ClosePipe(); void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); char *FormatLine(int Line); void UpdateList(); int Activate(int No); int CanActivate(int Line); virtual int IsHilited(int Line); virtual int IsMarked(int Line); virtual int Mark(int Line); virtual int Unmark(int Line); virtual int ExecCommand(int Command, ExState &State); void ShowLine(EView *V, int err); virtual int GetContext() { return CONTEXT_SVNBASE; } virtual EEventMap *GetEventMap(); virtual void GetName(char *AName, int MaxLen); virtual void GetInfo(char *AInfo, int MaxLen); virtual void GetPath(char *APath, int MaxLen); virtual void GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen); }; int AddSvnIgnoreRegexp(const char *); void FreeSvnIgnoreRegexp(); #endif efte-1.1/src/h_c.cpp0000664000076400007640000014443211041410327013347 0ustar laurilauri/* h_c.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "log.h" #define PRINTF(x) //printf x #define ISNAME(x) (isalnum(x) || (x == '_')) #define hsC_Normal 0 #define hsC_Comment 1 #define hsC_CommentL 2 #define hsC_Keyword 4 #define hsC_String1 10 #define hsC_String2 11 #define hsC_CPP 12 #define hsC_CPP_Comm 13 #define hsC_CPP_String1 14 #define hsC_CPP_String2 15 #define hsC_CPP_ABrace 16 int Hilit_C(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { int j = 0; int firstnw = 0; HILIT_VARS(BF->Mode->fColorize->Colors, Line); int len1 = len; char *last = p + len1 - 1; int was_include = 0; for (i = 0; i < Line->Count;) { if (*p != ' ' && *p != 9) firstnw++; IF_TAB() else { switch (State) { default: case hsC_Normal: if (toupper(*p) == 'L' && p[1] == '"') { State = hsC_String2; Color = CLR_String; goto hilit2; } else if (toupper(*p) == 'L' && p[1] == '\'') { State = hsC_String1; Color = CLR_String; goto hilit2; } else if (isalpha(*p) || *p == '_') { j = 0; while (((i + j) < Line->Count) && ISNAME(Line->Chars[i + j])) j++; if (BF->GetHilitWord(j, &Line->Chars[i], Color)) { //Color = hcC_Keyword; State = hsC_Keyword; } else { int x = i + j; while (x < Line->Count && isspace(Line->Chars[x])) x++; if (x < Line->Count && Line->Chars[x] == '(') { Color = CLR_Function; } else if ((x < Line->Count) && (Line->Chars[x] == ':' && (x == Line->Count - 1 || Line->Chars[x + 1] != ':')) && firstnw == 1) { Color = CLR_Label; } else { Color = CLR_Normal; } State = hsC_Normal; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; State = hsC_Normal; continue; } else if ((len >= 2) && (*p == '/') && (*(p + 1) == '*')) { State = hsC_Comment; Color = CLR_Comment; goto hilit2; } else if ((len >= 2) && (*p == '/') && (p[1] == '/')) { State = hsC_CommentL; Color = CLR_Comment; goto hilit2; } else if (isdigit(*p)) { // check if it is not floating point number 0.08! if ((len >= 2) && (*p == '0') && p[1] != '.') { if (toupper(*(p + 1)) == 'X') { Color = CLR_HexNumber; ColorNext(); ColorNext(); while (len && isxdigit(*p)) ColorNext(); } else { /* assume it's octal */ Color = CLR_Number; ColorNext(); while (len && ('0' <= *p && *p <= '7')) ColorNext(); // if we hit a non-octal, stop hilighting it. if (len && ('8' <= *p && *p <= '9')) { Color = CLR_Normal; while (len && !isspace(*p)) ColorNext(); continue; } } } else { /* assume it's decimal/floating */ Color = CLR_Number; ColorNext(); while (len && (isdigit(*p) || *p == 'e' || *p == 'E' || *p == '.')) ColorNext(); // if it ends with 'f', the number can't have more extras. if (len && (toupper(*p) == 'F')) { ColorNext(); continue; } } // allowed extras: u, l, ll, ul, ull, lu, llu int colored_u = 0; if (len && (toupper(*p) == 'U')) { ColorNext(); colored_u = 1; } if (len && (toupper(*p) == 'L')) { ColorNext(); if (len && (toupper(*p) == 'L')) ColorNext(); if (! colored_u && len && (toupper(*p) == 'U')) ColorNext(); } continue; } else if (*p == '\'') { State = hsC_String1; Color = CLR_String; goto hilit; } else if (*p == '"') { State = hsC_String2; Color = CLR_String; goto hilit; } else if (firstnw == 1 && *p == '#') { State = hsC_CPP; Color = CLR_CPreprocessor; goto hilit; } else if (ispunct(*p) && *p != '_') { Color = CLR_Punctuation; goto hilit; } Color = CLR_Normal; goto hilit; case hsC_Comment: Color = CLR_Comment; if ((len >= 2) && (*p == '*') && (*(p + 1) == '/')) { ColorNext(); ColorNext(); State = hsC_Normal; continue; } goto hilit; case hsC_CPP_Comm: Color = CLR_Comment; if ((len >= 2) && (*p == '*') && (*(p + 1) == '/')) { ColorNext(); ColorNext(); State = hsC_CPP; continue; } goto hilit; case hsC_CPP_ABrace: Color = CLR_String; if (*p == '>') { Color = CLR_CPreprocessor; State = hsC_CPP; } goto hilit; case hsC_CommentL: Color = CLR_Comment; goto hilit; case hsC_String1: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == '\'') { ColorNext(); State = hsC_Normal; continue; } goto hilit; case hsC_String2: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == '"') { ColorNext(); State = hsC_Normal; continue; } goto hilit; case hsC_CPP_String1: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == '\'') { ColorNext(); State = hsC_CPP; continue; } goto hilit; case hsC_CPP_String2: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == '"') { ColorNext(); State = hsC_CPP; continue; } goto hilit; case hsC_CPP: if (ISNAME(*p)) { j = 0; Color = CLR_CPreprocessor; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_')) ) j++; if (j == 7 && memcmp(Line->Chars + i, "include", 7) == 0) was_include = 1; if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; continue; } else if ((len >= 2) && (*p == '/') && (*(p + 1) == '*')) { State = hsC_CPP_Comm; Color = CLR_Comment; goto hilit2; } else if ((len >= 2) && (*p == '/') && (*(p + 1) == '/')) { State = hsC_CommentL; Color = CLR_Comment; hilit2: ColorNext(); hilit: ColorNext(); continue; } else if (isdigit(*p)) { if ((len >= 2) && (*p == '0')) { if (toupper(*(p + 1)) == 'X') { Color = CLR_HexNumber; ColorNext(); ColorNext(); while (len && isxdigit(*p)) ColorNext(); } else { /* assume it's octal */ Color = CLR_Number; ColorNext(); while (len && ('0' <= *p && *p <= '7')) ColorNext(); // if we hit a non-octal, stop hilighting it. if (len && ('8' <= *p && *p <= '9')) { Color = CLR_Normal; while (len && !isspace(*p)) ColorNext(); continue; } } } else { /* assume it's decimal/floating */ Color = CLR_Number; ColorNext(); while (len && (isdigit(*p) || *p == 'e' || *p == 'E' || *p == '.')) ColorNext(); // if it ends with 'f', the number can't have more extras. if (len && (toupper(*p) == 'F')) { ColorNext(); continue; } } // allowed extras: u, l, ll, ul, ull, lu, llu int colored_u = 0; if (len && (toupper(*p) == 'U')) { ColorNext(); colored_u = 1; } if (len && (toupper(*p) == 'L')) { ColorNext(); if (len && (toupper(*p) == 'L')) ColorNext(); if (! colored_u && len && (toupper(*p) == 'U')) ColorNext(); } continue; } else if (*p == '\'') { State = hsC_CPP_String1; Color = CLR_String; goto hilit; } else if (*p == '"') { State = hsC_CPP_String2; Color = CLR_String; goto hilit; } else if (*p == '<' && was_include) { ColorNext(); State = hsC_CPP_ABrace; continue; } else { Color = CLR_CPreprocessor; goto hilit; } } } } if (State == hsC_CommentL) State = hsC_Normal; if ((len1 == 0) || (*last != '\\')) { switch (State) { case hsC_String1: case hsC_String2: case hsC_CPP: case hsC_CPP_String1: case hsC_CPP_String2: State = hsC_Normal; break; } } *ECol = C; return 0; } int IsState(hsState *Buf, hsState State, int Len) { int I; for (I = 0; I < Len; I++) if (Buf[I] != State) return 0; return 1; } int LookAt(EBuffer *B, int Row, unsigned int Pos, const char *What, hsState State, int NoWord, int CaseInsensitive) { STARTFUNC("LookAt{h_c.cpp}"); int Len = strlen(What); if (Row < 0 || Row >= B->RCount) { LOG << "Row out of range: " << Row << " vs " << B->RCount << ENDLINE; ENDFUNCRC(0); } char* pLine = B->RLine(Row)->Chars; unsigned int uLineLength = B->RLine(Row)->Count; Pos = B->CharOffset(B->RLine(Row), Pos); if (Pos + strlen(What) > uLineLength) { ENDFUNCRC(0); } if (NoWord && uLineLength > Pos + Len && ISNAME(pLine[Pos + Len])) { ENDFUNCRC(0); } LOG << "Check against [" << What << ']' << ENDLINE; if ( (CaseInsensitive && memicmp(pLine + Pos, What, Len) == 0) || (!CaseInsensitive && memcmp(pLine + Pos, What, Len) == 0) ) { int StateLen; hsState *StateMap; if (B->GetMap(Row, &StateLen, &StateMap) == 0) ENDFUNCRC(0); if (IsState(StateMap + Pos, State, strlen(What))) ENDFUNCRC(1); } ENDFUNCRC(0); } int C_Indent = 4; int C_BraceOfs = 0; int C_ParenDelta = -1; int C_CaseOfs = 0; int C_CaseDelta = 4; int C_ClassOfs = 0; int C_ClassDelta = 4; int C_ColonOfs = 0;//-4; int C_CommentOfs = 0; int C_CommentDelta = 1; int C_FirstLevelWidth = -1; int C_FirstLevelIndent = 4; int C_Continuation = 4; int FunctionUsesContinuation = 0; // this is global, unfortunately -- FIX !!! int EBuffer::SetCIndentStyle(ExState &State) { if (State.GetIntParam(View, &C_Indent) == 0) return 0; if (State.GetIntParam(View, &C_BraceOfs) == 0) return 0; if (State.GetIntParam(View, &C_ParenDelta) == 0) return 0; if (State.GetIntParam(View, &C_CaseOfs) == 0) return 0; if (State.GetIntParam(View, &C_CaseDelta) == 0) return 0; if (State.GetIntParam(View, &C_ClassOfs) == 0) return 0; if (State.GetIntParam(View, &C_ClassDelta) == 0) return 0; if (State.GetIntParam(View, &C_ColonOfs) == 0) return 0; if (State.GetIntParam(View, &C_CommentOfs) == 0) return 0; if (State.GetIntParam(View, &C_CommentDelta) == 0) return 0; if (State.GetIntParam(View, &C_FirstLevelWidth) == 0) return 0; if (State.GetIntParam(View, &C_FirstLevelIndent) == 0) return 0; if (State.GetIntParam(View, &C_Continuation) == 0) return 0; return 1; } #define C_INDENT C_Indent #define C_BRACE_OFS C_BraceOfs #define C_PAREN_DELTA C_ParenDelta #define C_CASE_OFS C_CaseOfs #define C_CASE_DELTA C_CaseDelta #define C_CLASS_OFS C_ClassOfs #define C_CLASS_DELTA C_ClassDelta #define C_COLON_OFS C_ColonOfs #define C_COMMENT_OFS C_CommentOfs #define C_COMMENT_DELTA C_CommentDelta #define C_CONTINUATION C_Continuation #define C_FIRST_INDENT C_FirstLevelIndent #define C_FIRST_WIDTH C_FirstLevelWidth #define FIND_IF 0x0001 #define FIND_SEMICOLON 0x0002 #define FIND_COMMA 0x0004 #define FIND_COLON 0x0008 #define FIND_ELSE 0x0010 #define FIND_FOR 0x0020 #define FIND_WHILE 0x0040 #define FIND_ENDBLOCK 0x0080 //#define FIND_BEGINBLOCK 0x0100 #define FIND_CLASS 0x0200 #define FIND_CASE 0x0400 #define FIND_SWITCH 0x0800 #define FIND_QUESTION 0x1000 static int CheckLabel(EBuffer *B, int Line) { PELine L = B->RLine(Line); int P = B->CharOffset(L, B->LineIndented(Line)); int Cnt = 0; if (Line > 0 && B->RLine(Line - 1)->StateE != hsC_Normal) return 0; while ((P < L->Count) && (L->Chars[P] == ' ' || L->Chars[P] == 9)) P++; while (P < L->Count) { if (Cnt > 0) if (L->Chars[P] == ':' && (Cnt == 1 || L->Chars[P + 1] != ':')) return 1; if (!isalnum(L->Chars[P]) && L->Chars[P] != '_') return 0; Cnt++; P++; } return 0; } static int SearchBackMatch(int Count, EBuffer *B, int Row, hsState State, const char *Open, const char *Close, int *OPos, int *OLine, int matchparens = 0, int bolOnly = 0) { char *P; int L; int Pos; int LOpen = strlen(Open); int LClose = strlen(Close); int StateLen; hsState *StateMap; int CountX[3] = { 0, 0, 0 }; int didMatch = 0; *OLine = Row; *OPos = 0; while (Row >= 0) { P = B->RLine(Row)->Chars; L = B->RLine(Row)->Count; StateMap = NULL; if (B->GetMap(Row, &StateLen, &StateMap) == 0) return -1; Pos = L - 1; if (L > 0) while (Pos >= 0) { if (P[Pos] != ' ' && P[Pos] != 9) { if (StateMap[Pos] == hsC_Normal) { switch (P[Pos]) { case '{': CountX[0]--; break; case '}': CountX[0]++; break; case '(': CountX[1]--; break; case ')': CountX[1]++; break; case '[': CountX[2]--; break; case ']': CountX[2]++; break; } } if (!matchparens || (CountX[0] == 0 && CountX[1] == 0 && CountX[2] == 0)) { if (LOpen + Pos <= L) { if (IsState(StateMap + Pos, State, LOpen)) { if (memcmp(P + Pos, Open, LOpen) == 0) Count++; if (Count == 0) { if (bolOnly) didMatch = 1; else { *OPos = B->ScreenPos(B->RLine(Row), Pos); *OLine = Row; free(StateMap); return B->LineIndented(Row); } } } if (LClose + Pos <= L) { if (IsState(StateMap + Pos, State, LClose)) { if (memcmp(P + Pos, Close, LClose) == 0) Count--; } } } } } Pos--; } if (bolOnly && didMatch && CountX[1] == 0 && CountX[2] == 0) { *OPos = 0; *OLine = Row; free(StateMap); return B->LineIndented(Row); } if (StateMap) free(StateMap); Row--; } return -1; } static int FindPrevIndent(EBuffer *B, int &RowP, int &ColP, char &CharP, int Flags) { STARTFUNC("FindPrevIndent{h_c.cpp}"); LOG << "Flags: " << hex << Flags << dec << ENDLINE; int StateLen; hsState *StateMap = 0; char *P; int L; int Count[4] = { 0, // { } 0, // ( ) 0, // [ ] 0, // if/else (one if for each else) }; assert(RowP >= 0 && RowP < B->RCount); L = B->RLine(RowP)->Count; if (ColP >= L) ColP = L - 1; assert(ColP >= -1 && ColP <= L); char BolChar = ' '; int BolCol = -1; int BolRow = -1; while (RowP >= 0) { P = B->RLine(RowP)->Chars; L = B->RLine(RowP)->Count; StateMap = NULL; if (B->GetMap(RowP, &StateLen, &StateMap) == 0) { LOG << "Can't get state maps" << ENDLINE; ENDFUNCRC(0); } if (L > 0) while (ColP >= 0) { LOG << "ColP: " << ColP << " State: " << (int)StateMap[ColP] << ENDLINE; if (StateMap[ColP] == hsC_Normal) { LOG << "CharP: " << BinChar(P[ColP]) << " BolChar: " << BinChar(BolChar) << " BolRow: " << BolRow << " BolCol: " << BolCol << ENDLINE; switch (CharP = P[ColP]) { case '{': if (BolChar == ':' || BolChar == ',') { CharP = BolChar; ColP = BolCol; RowP = BolRow; free(StateMap); ENDFUNCRC(1); } if (TEST_ZERO) { free(StateMap); ENDFUNCRC(1); } Count[0]--; break; case '}': if (BolChar == ':' || BolChar == ',') { CharP = BolChar; ColP = BolCol; RowP = BolRow; free(StateMap); ENDFUNCRC(1); } if (BolChar == ';') { CharP = BolChar; ColP = BolCol; RowP = BolRow; free(StateMap); ENDFUNCRC(1); } if (ColP == 0) { /* speed optimization */ free(StateMap); ENDFUNCRC(1); } if (TEST_ZERO && (Flags & FIND_ENDBLOCK)) { free(StateMap); ENDFUNCRC(1); } Count[0]++; break; case '(': if (TEST_ZERO) { free(StateMap); ENDFUNCRC(1); } Count[1]--; break; case ')': Count[1]++; break; case '[': if (TEST_ZERO) { free(StateMap); ENDFUNCRC(1); } Count[2]--; break; case ']': Count[2]++; break; case ':': if (ColP >= 1 && P[ColP - 1] == ':') { // skip :: ColP -= 2; continue; } case ',': case ';': if (TEST_ZERO && BolChar == ' ') { if ((CharP == ';' && (Flags & FIND_SEMICOLON)) || (CharP == ',' && (Flags & FIND_COMMA)) || (CharP == ':' && (Flags & FIND_COLON))) { BolChar = CharP; BolCol = ColP; BolRow = RowP; // this should be here // if not say why ??? //free(StateMap); //return 1; } } if (BolChar == ',' && CharP == ':') { BolChar = ' '; BolCol = -1; BolRow = -1; break; } if ((BolChar == ':' || BolChar == ',') && (CharP == ';'/* || CharP == ','*/)) { CharP = ':'; ColP = BolCol; RowP = BolRow; free(StateMap); ENDFUNCRC(1); } break; case '?': //if ((Flags & FIND_QUESTION)) { if (BolChar == ':' || BolChar == ',') { BolChar = ' '; BolCol = -1; BolRow = -1; } //} break; } } else if (StateMap[ColP] == hsC_Keyword && (BolChar == ' ' || BolChar == ':')) { if (L - ColP >= 2 && IsState(StateMap + ColP, hsC_Keyword, 2) && memcmp(P + ColP, "if", 2) == 0) { //puts("\nif"); if (Count[3] > 0) Count[3]--; if (Flags & FIND_IF) { if (TEST_ZERO) { CharP = 'i'; free(StateMap); ENDFUNCRC(1); } } } if (L - ColP >= 4 && IsState(StateMap + ColP, hsC_Keyword, 4) && memcmp(P + ColP, "else", 4) == 0) { //puts("\nelse\x7"); if (Flags & FIND_ELSE) { if (TEST_ZERO) { CharP = 'e'; free(StateMap); ENDFUNCRC(1); } } Count[3]++; } if (TEST_ZERO) { if ((Flags & FIND_FOR) && L - ColP >= 3 && IsState(StateMap + ColP, hsC_Keyword, 3) && memcmp(P + ColP, "for", 3) == 0) { CharP = 'f'; free(StateMap); ENDFUNCRC(1); } if ((Flags & FIND_WHILE) && L - ColP >= 5 && IsState(StateMap + ColP, hsC_Keyword, 5) && memcmp(P + ColP, "while", 5) == 0) { CharP = 'w'; free(StateMap); ENDFUNCRC(1); } if ((Flags & FIND_SWITCH) && L - ColP >= 6 && IsState(StateMap + ColP, hsC_Keyword, 6) && memcmp(P + ColP, "switch", 6) == 0) { CharP = 's'; free(StateMap); ENDFUNCRC(1); } if (((Flags & FIND_CASE) || (BolChar == ':')) && (L - ColP >= 4 && IsState(StateMap + ColP, hsC_Keyword, 4) && memcmp(P + ColP, "case", 4) == 0) || ((L - ColP >= 7) && IsState(StateMap + ColP, hsC_Keyword, 7) && memcmp(P + ColP, "default", 7) == 0)) { CharP = 'c'; if (BolChar == ':') { CharP = BolChar; ColP = BolCol; RowP = BolRow; } free(StateMap); ENDFUNCRC(1); } if (((Flags & FIND_CLASS) || (BolChar == ':')) && (L - ColP >= 5 && IsState(StateMap + ColP, hsC_Keyword, 5) && memcmp(P + ColP, "class", 5) == 0)) { CharP = 'l'; if (BolChar == ':') { CharP = BolChar; ColP = BolCol; RowP = BolRow; } free(StateMap); ENDFUNCRC(1); } if (((Flags & FIND_CLASS) || (BolChar == ':')) && ((L - ColP >= 6 && IsState(StateMap + ColP, hsC_Keyword, 6) && memcmp(P + ColP, "public", 6) == 0) || ((L - ColP >= 7) && IsState(StateMap + ColP, hsC_Keyword, 7) && memcmp(P + ColP, "private", 7) == 0) || ((L - ColP >= 9) && IsState(StateMap + ColP, hsC_Keyword, 9) && memcmp(P + ColP, "protected", 9) == 0))) { CharP = 'p'; if (BolChar == ':') { CharP = BolChar; ColP = BolCol; RowP = BolRow; } free(StateMap); ENDFUNCRC(1); } } } ColP--; } free(StateMap); if (BolChar != ' ' && BolChar != ':' && BolChar != ',') { CharP = BolChar; ColP = BolCol; ENDFUNCRC(1); } RowP--; if (RowP >= 0) { L = B->RLine(RowP)->Count; ColP = L - 1; } } #undef TEST_ZERO ENDFUNCRC(0); } #define SKIP_FORWARD 0 #define SKIP_BACK 1 #define SKIP_MATCH 2 #define SKIP_LINE 4 #define SKIP_TOBOL 8 static int SkipWhite(EBuffer *B, int Bottom, int &Row, int &Col, int Flags) { char *P; int L; int StateLen; hsState *StateMap; int Count[3] = { 0, 0, 0 }; assert(Row >= 0 && Row < B->RCount); L = B->RLine(Row)->Count; if (Col >= L) Col = L; assert(Col >= -1 && Col <= L) ; while (Row >= 0 && Row < B->RCount) { P = B->RLine(Row)->Chars; L = B->RLine(Row)->Count; StateMap = NULL; if (B->GetMap(Row, &StateLen, &StateMap) == 0) return 0; if (L > 0) for (; Col >= 0 && Col < L; Col += ((Flags & SKIP_BACK) ? -1 : + 1)) { if (P[Col] == ' ' || P[Col] == '\t') continue; if (StateMap[Col] != hsC_Normal && StateMap[Col] != hsC_Keyword && StateMap[Col] != hsC_String1 && StateMap[Col] != hsC_String2) continue; if (StateMap[Col] == hsC_Normal && (Flags & SKIP_MATCH)) { switch (P[Col]) { case '{': Count[0]--; continue; case '}': Count[0]++; continue; case '(': Count[1]--; continue; case ')': Count[1]++; continue; case '[': Count[2]--; continue; case ']': Count[2]++; continue; } } if (Count[0] == 0 && Count[1] == 0 && Count[2] == 0 && !(Flags & SKIP_TOBOL)) { free(StateMap); return 1; } } free(StateMap); if (Count[0] == 0 && Count[1] == 0 && Count[2] == 0 && (Flags & SKIP_TOBOL)) return 1; if (Flags & SKIP_LINE) { return 1; } if (Flags & SKIP_BACK) { Row--; if (Row >= 0) { L = B->RLine(Row)->Count; Col = L - 1; } } else { if (Row + 1 >= Bottom) return 1; Row++; Col = 0; } } return 0; } static int IndentNormal(EBuffer *B, int Line, int /*StateLen*/, hsState * /*StateMap*/) { STARTFUNC("IndentNormal{h_c.cpp}"); int I = 0; int Pos, L; if (LookAt(B, Line, 0, "case", hsC_Keyword) || LookAt(B, Line, 0, "default", hsC_Keyword)) { I = SearchBackMatch(-1, B, Line - 1, hsC_Normal, "{", "}", &Pos, &L) + C_CASE_OFS; return I; } else if (LookAt(B, Line, 0, "public:", hsC_Keyword, 0) || LookAt(B, Line, 0, "private:", hsC_Keyword, 0) || LookAt(B, Line, 0, "protected:", hsC_Keyword, 0)) { I = SearchBackMatch(-1, B, Line - 1, hsC_Normal, "{", "}", &Pos, &L) + C_CLASS_OFS; return I; } else if (LookAt(B, Line, 0, "else", hsC_Keyword)) { I = SearchBackMatch(-1, B, Line - 1, hsC_Keyword, "if", "else", &Pos, &L, 1); return I; } else if (LookAt(B, Line, 0, "}", hsC_Normal, 0)) { I = SearchBackMatch(-1, B, Line - 1, hsC_Normal, "{", "}", &Pos, &L, 0, 1); return I; } else if (LookAt(B, Line, 0, ")", hsC_Normal, 0)) { I = SearchBackMatch(-1, B, Line - 1, hsC_Normal, "(", ")", &Pos, &L); if (C_PAREN_DELTA >= 0) return I + C_PAREN_DELTA; else return Pos; } else if (LookAt(B, Line, 0, "]", hsC_Normal, 0)) { I = SearchBackMatch(-1, B, Line - 1, hsC_Normal, "[", "]", &Pos, &L); if (C_PAREN_DELTA >= 0) return I + C_PAREN_DELTA; else return Pos; } else { char CharP = ' '; // char FirstCharP = ' '; int RowP = Line; int ColP = -1; int PrevRowP = RowP; int PrevColP = ColP; int FirstRowP; int FirstColP; int ContinuationIndent = 0; if (SkipWhite(B, Line, PrevRowP, PrevColP, SKIP_BACK) != 1) return 0; PrevColP++; LOG << "PrevRowP=" << PrevRowP << ", PrevColP=" << PrevColP << ENDLINE; if (FindPrevIndent(B, RowP, ColP, CharP, FIND_IF | FIND_ELSE | FIND_FOR | FIND_WHILE | FIND_SWITCH | FIND_CASE | //FIND_CLASS | FIND_COLON | FIND_SEMICOLON | FIND_COMMA | FIND_ENDBLOCK) != 1) { if (RowP != PrevRowP) ContinuationIndent = C_CONTINUATION; I = 0; if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { I += C_BRACE_OFS; ContinuationIndent = 0; } return I + ContinuationIndent; } FirstRowP = RowP; FirstColP = ColP; // FirstCharP = CharP; LOG << "FirstRowP=" << FirstRowP << ", FirstColP=" << FirstColP << ", CharP=" << BinChar(CharP) << ENDLINE; switch (CharP) { case 'c': I = B->LineIndented(RowP) + C_CONTINUATION; return I; case '(': case '[': if (C_PAREN_DELTA >= 0) { I = B->LineIndented(FirstRowP) + C_PAREN_DELTA; } else { ColP++; if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD | SKIP_LINE) != 1) return 0; if (ColP < B->LineChars(RowP) || !FunctionUsesContinuation) { char strLeft[2] = { CharP, 0 }; char strRight[2] = { CharP == '(' ? ')' : ']', 0 }; I = SearchBackMatch(-1, B, Line - 1, hsC_Normal, strLeft, strRight, &Pos, &L); I = Pos + 1; } else { I = B->LineIndented(RowP) + C_CONTINUATION; } } return I; case '{': ColP++; if (((PrevRowP != RowP) || ((PrevRowP == RowP) && (PrevColP != ColP))) && FirstRowP != PrevRowP) ContinuationIndent = C_CONTINUATION; ColP--; ColP--; if (SkipWhite(B, Line, RowP, ColP, SKIP_BACK | SKIP_TOBOL | SKIP_MATCH) != 1) return 0; I = B->LineIndented(RowP); if (B->LineIndented(FirstRowP) <= C_FIRST_WIDTH) I += C_FIRST_INDENT; else I += C_INDENT; PRINTF(("'{' indent : Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) I -= C_BRACE_OFS; else I += ContinuationIndent; return I; case ',': I = B->LineIndented(FirstRowP); return I; case '}': ColP++; ColP++; /*---nobreak---*/ case ';': ColP--; if (FindPrevIndent(B, RowP, ColP, CharP, ((CharP == ',') ? FIND_COMMA | FIND_COLON : //(CharP == ';') ? FIND_SEMICOLON | FIND_COLON : FIND_SEMICOLON | FIND_COLON)) != 1) { if (FirstRowP != PrevRowP) ContinuationIndent = C_CONTINUATION; I = 0; if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { I += C_BRACE_OFS; ContinuationIndent = 0; } return I + ContinuationIndent; } PRINTF(("';' Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); LOG << " CharP now: " << BinChar(CharP) << ENDLINE; switch (CharP) { case ',': case ';': case '{': case ':': ColP++; if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD) != 1) return 0; //ColP--; //if (SkipWhite(B, RowP, ColP, SKIP_BACK) != 1) //if (CharP == ':') { // I -= C_COLON_OFS; //} PRINTF(("';' indent : Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); I = B->LineIndented(RowP); if (((PrevRowP != RowP) || ((PrevRowP == RowP) && (PrevColP != ColP))) && FirstRowP != PrevRowP) ContinuationIndent = C_CONTINUATION; if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { //I -= C_BRACE_OFS; ContinuationIndent = 0; } if (LookAt(B, Line, 0, "{", hsC_Normal, 0) && LookAt(B, RowP, ColP, "{", hsC_Normal, 0)) I -= 0; //C_BRACE_OFS; else if (LookAt(B, Line, 0, "{", hsC_Normal, 0) && !LookAt(B, RowP, ColP, "{", hsC_Normal, 0)) I += C_BRACE_OFS; else if (!LookAt(B, Line, 0, "{", hsC_Normal, 0) && LookAt(B, RowP, ColP, "{", hsC_Normal, 0)) I -= C_BRACE_OFS; break; case '(': ColP++; if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD | SKIP_LINE) != 1) return 0; I = B->ScreenPos(B->RLine(RowP), ColP); break; default: I = B->LineIndented(RowP); break; } PRINTF(("';' -- indent : Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); // else // if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) // I += C_INDENT - C_BRACE_OFS; return I + ContinuationIndent; case ':': ColP--; PRINTF(("COL-- %d\n", ColP)); if (FindPrevIndent(B, RowP, ColP, CharP, FIND_SEMICOLON | FIND_COLON | FIND_QUESTION | FIND_CLASS | FIND_CASE) != 1) { PRINTF(("FOUNPRE \n")); if (FirstRowP != PrevRowP) ContinuationIndent = C_CONTINUATION; return 0 + ContinuationIndent; } PRINTF(("':' Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); switch (CharP) { case ':': //ColP++; /*if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD) != 1) return 0; I = B->LineIndented(RowP);// - C_COLON_OFS; PRINTF(("':' 0 indent : Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); break;*/ case '{': case ';': ColP++; if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD) != 1) return 0; I = B->LineIndented(RowP); PRINTF(("!!! FirstRowP=%d, PrevRowP=%d, RowP=%d, I=%d\n", FirstRowP, PrevRowP, RowP, I)); PRINTF(("!!! FirstColP=%d, PrevColP=%d, ColP=%d\n", FirstColP, PrevColP, ColP)); if (CheckLabel(B, RowP)) I -= C_COLON_OFS; else if (PrevRowP == RowP && FirstRowP == PrevRowP && FirstColP + 1 == PrevColP) I += C_CONTINUATION; if (LookAt(B, Line, 0, "{", hsC_Normal, 0) && LookAt(B, RowP, ColP, "{", hsC_Normal, 0)) I -= 0;//C_BRACE_OFS; else if (LookAt(B, Line, 0, "{", hsC_Normal, 0) && !LookAt(B, RowP, ColP, "{", hsC_Normal, 0)) I += C_BRACE_OFS; else if (!LookAt(B, Line, 0, "{", hsC_Normal, 0) && LookAt(B, RowP, ColP, "{", hsC_Normal, 0)) I -= C_BRACE_OFS; PRINTF(("':' 1 indent : Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); break; case 'p': ColP++; //if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD) != 1) // return 0; I = B->LineIndented(RowP) + C_CLASS_DELTA; // if (FirstRowP == RowP) { // I += C_CLASS_DELTA; /// if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { /// I += C_INDENT - C_BRACE_OFS; /// } // } PRINTF(("':' 2 indent : Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); break; case 'l': ColP++; I = B->LineIndented(RowP) + C_BRACE_OFS; //C_CLASS_OFS + C_CLASS_DELTA; break; case 'c': ColP++; // if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD) != 1) // return 0; I = B->LineIndented(RowP) + C_CASE_DELTA; // if (FirstRowP == RowP) { // I += C_CASE_DELTA; /// if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { /// I += C_INDENT - C_BRACE_OFS; /// } // } PRINTF(("':' 3 indent : Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); break; default: I = B->LineIndented(RowP); break; } if (((PrevRowP != RowP) || ((PrevRowP == RowP) && (PrevColP != ColP))) && FirstRowP != PrevRowP) ContinuationIndent = C_CONTINUATION; if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { //I -= C_INDENT - C_BRACE_OFS; ContinuationIndent = 0; } PRINTF(("':' -- indent : Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); return I + ContinuationIndent; case 'i': case 's': case 'f': case 'e': case 'w': I = B->LineIndented(RowP); switch (CharP) { case 'i': ColP += 2; break; // if case 'f': ColP += 3; break; // for case 'e': ColP += 4; break; // else case 'w': ColP += 5; break; // while case 's': ColP += 6; break; // switch } PRINTF(("'ifews' -- indent 1: Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD | (CharP != 'e' ? SKIP_MATCH : 0)) != 1) return 0; if (RowP >= Line) { RowP = Line; ColP = -1; } else ColP--; if (SkipWhite(B, Line, RowP, ColP, SKIP_BACK) != 1) return 0; ColP++; PRINTF(("'ifews' -- indent 2: Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); if (((PrevRowP != RowP) || ((PrevRowP == RowP) && (PrevColP != ColP))) && FirstRowP != PrevRowP) ContinuationIndent = C_CONTINUATION; I += C_INDENT; if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { I -= C_INDENT - C_BRACE_OFS; ContinuationIndent = 0; } return I + ContinuationIndent; // default: return 0; } } return 0; } static int IndentComment(EBuffer *B, int Row, int /*StateLen*/, hsState * /*StateMap*/) { int I = 0, R; //puts("Comment"); if (Row > 0) { R = Row - 1; while (R >= 0) { if (B->RLine(R)->Count == 0) R--; else { I = B->LineIndented(R); break; } } if (B->RLine(Row - 1)->StateE == hsC_Comment) if (LookAt(B, Row - 1, I, "/*", hsC_Comment, 0)) I += C_COMMENT_DELTA; if (B->RLine(Row - 1)->StateE == hsC_CPP_Comm) if (LookAt(B, Row - 1, I, "/*", hsC_CPP_Comm, 0)) I += C_COMMENT_DELTA; } return I; } static int IndentCPP(EBuffer *B, int Line, int /*StateLen*/, hsState * /*StateMap*/) { if (LookAt(B, Line, 0, "#", hsC_CPP, 0)) return 0; else return C_INDENT; } int Indent_C(EBuffer *B, int Line, int PosCursor) { int I; hsState *StateMap = NULL; int StateLen = 0; int OI; OI = I = B->LineIndented(Line); if (Line == 0) { I = 0; } else { if (I != 0) B->IndentLine(Line, 0); if (B->GetMap(Line, &StateLen, &StateMap) == 0) return 0; switch (B->RLine(Line - 1)->StateE) { case hsC_Comment: case hsC_CPP_Comm: I = IndentComment(B, Line, StateLen, StateMap); break; case hsC_CPP: /*case hsC_CPP_Comm:*/ case hsC_CPP_String1: case hsC_CPP_String2: case hsC_CPP_ABrace: I = C_INDENT; break; default: if (StateLen > 0) { // line is not empty if (StateMap[0] == hsC_CPP || StateMap[0] == hsC_CPP_Comm || StateMap[0] == hsC_CPP_String1 || StateMap[0] == hsC_CPP_String2 || StateMap[0] == hsC_CPP_ABrace) { I = IndentCPP(B, Line, StateLen, 0); } else { I = IndentNormal(B, Line, StateLen, StateMap); if ((StateMap[0] == hsC_Comment || StateMap[0] == hsC_CommentL || StateMap[0] == hsC_CPP_Comm) && ((LookAt(B, Line, 0, "/*", hsC_Comment, 0) || LookAt(B, Line, 0, "/*", hsC_CPP_Comm, 0) || LookAt(B, Line, 0, "//", hsC_CommentL, 0)))) { I += C_COMMENT_OFS; } else if (CheckLabel(B, Line)) { if (LookAt(B, Line, 0, "case", hsC_Keyword) || LookAt(B, Line, 0, "default", hsC_Keyword) || LookAt(B, Line, 0, "public:", hsC_Keyword, 0) || LookAt(B, Line, 0, "private:", hsC_Keyword, 0) || LookAt(B, Line, 0, "protected:", hsC_Keyword, 0)) ; else I += C_COLON_OFS; } //else if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { // I -= C_INDENT - C_BRACE_OFS; //} } } else { I = IndentNormal(B, Line, 0, NULL); } break; } } if (StateMap) free(StateMap); if (I >= 0) B->IndentLine(Line, I); else I = 0; if (PosCursor == 1) { int X = B->CP.Col; X = X - OI + I; if (X < I) X = I; if (X < 0) X = 0; if (X > B->LineLen(Line)) { X = B->LineLen(Line); if (X < I) X = I; } if (B->SetPosR(X, Line) == 0) return 0; } else if (PosCursor == 2) { if (B->SetPosR(I, Line) == 0) return 0; } return 1; } efte-1.1/src/e_regex.h0000664000076400007640000001005311041404761013675 0ustar laurilauri/* e_regex.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __REGEX_H #define __REGEX_H /* * Operator: * * ^ Match the beginning of line * $ Match the end of line * . Match any character * [ ] Match characters in set * [^ ] Match characters not in set * ? Match previous pattern 0 or 1 times (greedy) * | Match previous or next pattern * @ Match previous pattern 0 or more times (non-greedy) * # Match previous pattern 1 or more times (non-greedy) * * Match previous pattern 0 or more times (greedy) * + Match previous pattern 1 or more times (greedy) * { } Group characters to form one pattern * ( ) Group and remember * \ Quote next character (only of not a-z) * < Match beginning of a word * > Match end of a word * \x## Match character with ASCII code ## (hex) * \N### Match ascii code ### (dec) * \o### Match ascii code * \a Match \a \r Match 0x13 (cr) * \b Match \b \t Match 0x09 (tab) * \f Match \f \v Match \v * \n Match 0x10 (lf) \e Match escape (^E) * \s Match whitespace (cr/lf/tab/space) * \S Match nonwhitespace (!\S) * \w Match word character * \W Match non-word character * \d Match digit character * \D Match non-digit character * \U Match uppercase * \L Match lowercase * \C Match case sensitively from here on * \c Match case ingnore from here on */ #define RE_NOTHING 0 // nothing #define RE_JUMP 1 // jump to #define RE_BREAK 2 // break | #define RE_ATBOL 3 // match at beginning of line #define RE_ATEOL 4 // match at end of line #define RE_ATBOW 5 // match beginning of word #define RE_ATEOW 6 // match end of word #define RE_CASE 7 // match case sensitively from here #define RE_NCASE 8 // ignore case from here. #define RE_END 31 // end of regexp #define RE_ANY (32 + 1) // match any character #define RE_INSET (32 + 2) // match if in set #define RE_NOTINSET (32 + 3) // match if not in set #define RE_CHAR (32 + 4) // match character string #define RE_WSPACE (32 + 5) // match whitespace #define RE_NWSPACE (32 + 6) // match whitespace #define RE_UPPER (32 + 7) // match uppercase #define RE_LOWER (32 + 8) // match lowercase #define RE_DIGIT (32 + 9) // match digit #define RE_NDIGIT (32 + 10) // match non-digit #define RE_WORD (32 + 11) // match word #define RE_NWORD (32 + 12) // match non-word #define RE_GROUP 256 // grouping #define RE_OPEN 512 // open ( #define RE_CLOSE 1024 // close ) #define RE_MEM 2048 // store () match #define RE_BRANCH 4096 #define RE_GREEDY 2048 // do a greedy match (as much as possible) #define NSEXPS 64 // for replace only 0-9 #define RX_CASE 1 // matchcase typedef struct _RxNode RxNode; struct _RxNode { short fWhat; short fLen; RxNode *fPrev; RxNode *fNext; union { char *fChar; RxNode *fPtr; }; }; typedef struct { int Open[NSEXPS]; // -1 = not matched int Close[NSEXPS]; } RxMatchRes; RxNode *RxCompile(const char *Regexp); int RxExecMatch(RxNode *Regexp, const char *Data, int Len, const char *Start, RxMatchRes *Match, unsigned int RxOpt = RX_CASE); int RxExec(RxNode *Regexp, const char *Data, int Len, const char *Start, RxMatchRes *Match, unsigned int RxOpt = RX_CASE); int RxReplace(const char *rep, const char *Src, int len, RxMatchRes match, char **Dest, int *Dlen); void RxFree(RxNode *Node); #endif efte-1.1/src/s_files.h0000664000076400007640000000274211041404761013711 0ustar laurilauri/* s_files.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __FILESYS_H__ #define __FILESYS_H__ #define SDOT "." #ifdef UNIX #define SLASH '/' #define SSLASH "/" #define ISSLASH(c) ((c) == SLASH) #define ISSEP(c) ((c) == SLASH) #endif // UNIX #if defined(OS2) || defined(NT) #define SLASH '\\' #define SSLASH "\\" #define ISSLASH(c) (((c) == '/') || ((c) == '\\')) #define ISSEP(c) (((c) == ':') || ISSLASH(c)) #endif char *Slash(char *Path, int Add); char *SlashDir(char *Path); int ExpandPath(const char *Path, char *Expanded, int ExpandSize); int CompletePath(const char *Path, char *Completed, int Num); int IsSameFile(const char *Path1, const char *Path2); int JustDirectory(const char *Path, char *Dir, int DirSize); int JustFileName(const char *Path, char *Name, int NameSize); int JustLastDirectory(const char *Path, char *Dir, int DirSize); int JustRoot(const char *Path, char *Root, int RootSize); int FileExists(const char *Path); int IsFullPath(const char *Path); int IsDirectory(const char *Path); const char *ShortFName(const char *Path, int len); int ChangeDir(char *Dir); int JoinDirFile(char *Dest, const char *Dir, const char *Name); char *SepRChr(char *Dir); int RelativePathName(const char *Dir, const char *Path, char *RelPath); #endif // OS2 || NT efte-1.1/src/fte-owos2.mak0000664000076400007640000000423211215511532014425 0ustar laurilauri# # fte-owos2.mak # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # # #---------------------------------------------------------------------------- # # Makefile for ECS-OS2 version of eFTE using OpenWatcom 1.4 # # Notes: # # 1. clipserv and cliputil are not required for current versions of OS/2. I # do not use an older version so I do not include them in this makefile. # # 2. OpenWatcom uses & rather than \ as line continuation if objs.mif is not # in the src directory wmake -f owconvert.mak will compile watconvert.exe. # When run objs.mif will be created from objs.inc. # #---------------------------------------------------------------------------- .SILENT CC = wpp386 LD = wlink RC = wrc # Machine type -5r Pent -6r Pent Pro MACHINE= -3r #Optimization None -od - Fastest possible -otexan OPT= -ot INCLUDE = $(%watcom)\h;$(%watcom)\h\os2;.\ # suppress warnings 555 and 013 MISC = -wcd555 -wcd013 -wcd726 DEFS = -dOS2 -dOS2OW -dINCL_32 -dWATCOM -dUSE_LOCALE CFLAGS = -i=$(INCLUDE) $(MISC) $(DEFS) -d3 -db -w4 -e25 -zq $(OPT) $(MACHINE) -bm -bt=OS2 -mf -xs LDFLAGS = op m op maxe=25 op q op symf op el op stack=128k OEXT = obj .EXTENSIONS:.rc .res !include objs.mif .cpp.obj: *.cpp $(CC) $(CFLAGS) $< all: efte.exe eftepm.exe #cefte.exe: $(CFTE_OBJS) fte.def # $(LD) NAME cefte SYS os2v2 $(LDFLAGS) FILE {$(CFTE_OBJS)} defcfg.h: bin2c.exe simple.fte bin2c simple.fte >defcfg.h bin2c.exe: bin2c.obj $(LD) NAME bin2c SYS os2v2 $(LDFLAGS) FILE {bin2c.obj} c_config.obj: c_config.cpp defcfg.h efte.exe: $(OBJS) $(VIOOBJS) fte.def $(LD) NAME efte SYS os2v2 $(LDFLAGS) FILE {$(OBJS) $(VIOOBJS)} eftepm.res: ftepm.rc pmdlg.rc $(RC) -r ftepm.rc eftepm.res eftepm.exe: $(OBJS) $(PMOBJS) eftepm.res $(LD) NAME eftepm SYS os2v2_pm $(LDFLAGS) FILE {$(OBJS) $(PMOBJS)} $(RC) eftepm.res eftepm.exe clean : .SYMBOLIC -@rm *.obj -@rm *.exe -@rm *.err -@rm *.lst -@rm *.map cleanall : .SYMBOLIC -@rm *.obj -@rm *.exe -@rm *.err -@rm *.lst -@rm *.map -@rm def*.h -@rm *.cnf -@rm *.mif efte-1.1/src/compkeys.cpp0000664000076400007640000002533611041404761014456 0ustar laurilauri/* * compkeys.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1998 by Istvn Vradi * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include #include #include #include #include "console.h" #include "conkbd.h" #define FTESL_KBDCTRL(x) ( x-'a'+ 1) static unsigned get_linux_keycode(TKeyCode kcode) { static unsigned lnxkeycodes[] = { /* 32 */ 57, 2, 40, 4, 5, 6, 8, 40, /* 40 */ 10, 11, 9, 13, 51, 12, 52, 53, /* 48 */ 11, 2, 3, 4, 5, 6, 7, 8, /* 56 */ 9 , 10, 39, 39, 51, 13, 52, 53, /* 64 */ 3 , 30, 48, 46, 32, 18, 33, 34, /* 72 */ 35, 23, 36, 37, 38, 50, 49, 24, /* 80 */ 25, 16, 19, 31, 20, 22, 47, 17, /* 88 */ 45, 21, 44, 26, 86, 27, 7, 12, /* 96 */ 43, 30, 48, 46, 32, 18, 33, 34, /* 104 */ 35, 23, 36, 37, 38, 50, 49, 24, /* 112 */ 25, 16, 19, 31, 20, 22, 47, 17, /* 120 */ 45, 21, 44, 26, 86, 27, 43, 0, }; TKeyCode key = keyCode(kcode) | (kcode & kfGray); switch (key) { case kbF1: case kbF2: case kbF3: case kbF4: case kbF5: case kbF6: case kbF7: case kbF8: case kbF9: case kbF10: return 59 + key - kbF1; break; case kbF11: return 87; break; case kbF12: return 88; break; case kbHome: return 102; break; case kbEnd: return 107; break; case kbPgUp: return 104; break; case kbPgDn: return 109; break; case kbIns: return 110; break; case kbDel: return 111; break; case kbUp: return 103; break; case kbDown: return 108; break; case kbLeft: return 105; break; case kbRight: return 106; break; case kbEnter: return 28; break; case kbEsc: return 1; break; case kbBackSp: return 14; break; case kbSpace: return 57; break; case kbTab: return 15; break; case kbCenter: return 76; break; case kfGray | '/': return 98; break; case kfGray | '*': return 55; break; case kfGray | '+': return 78; break; case kfGray | '-': return 74; break; case kfGray | kbEnter: return 96; break; case kfGray | '.': return 83; break; case kfGray | '7': case kfGray | kbHome: return 71; break; case kfGray | '8': case kfGray | kbUp: return 72; break; case kfGray | '9': case kfGray | kbPgUp: return 73; break; case kfGray | '4': case kfGray | kbLeft: return 75; break; case kfGray | '5': return 76; break; case kfGray | '6': case kfGray | kbRight: return 77; break; case kfGray | '1': case kfGray | kbEnd: return 79; break; case kfGray | '2': case kfGray | kbDown: return 80; break; case kfGray | '3': case kfGray | kbPgDn: return 81; break; default: if (key < 128 && key > 32) return lnxkeycodes[key-32]; else return 0; } } typedef struct keymapper { TKeyCode kcode; const char* kname; } keymapper; static keymapper speckeymap[] = { { kbHome, "Home" }, { kbEnd, "End" }, { kbPgUp, "PgUp" }, { kbPgDn, "PgDn" }, { kbIns, "Ins" }, { kbDel, "Del" }, { kbUp, "Up" }, { kbDown, "Down" }, { kbLeft, "Left" }, { kbRight, "Right" }, { kbEnter, "Enter" }, { kbEsc, "Esc" }, { kbBackSp, "BackSp" }, { kbSpace, "Space" }, { kbTab, "Tab" }, { kbCenter, "Center" }, }; static TKeyCode ftesl_getkeycode(const char* key) { TKeyCode kcode = 0; if ((*key) == '\0') return 0; while (*(key + 1) == '+') { switch (*key) { case 'A': kcode |= kfAlt; break; case 'C': kcode |= kfCtrl; break; case 'S': kcode |= kfShift; break; case 'G': kcode |= kfGray; break; default: return 0; break; } key += 2; } if ((*key) == '\0') return 0; if (*(key + 1) == '\0') { kcode |= *(const unsigned char *)key; return kcode; } for (unsigned i = 0; i < sizeof(speckeymap) / sizeof(keymapper); i++) { if (!strcmp(key, speckeymap[i].kname)) { kcode |= speckeymap[i].kcode; return kcode; } } if (*key == 'F') { key++; if (*key >= '1' && *key <= '9') { if (*key == '1' && *(key + 1) != '\0') { key++; switch (*key) { case '1': kcode |= kbF11; break; case '2': kcode |= kbF12; break; default: return 0; break; } return kcode; } kcode |= kbF1 + (*key - '1'); return kcode; } } return 0; } static int ftesl_get_ctrlcode(TKeyCode key) { TKeyCode kcode = keyCode(key); switch (kcode) { case kbUp: return FTESL_KBDCTRL('u'); case kbDown: return FTESL_KBDCTRL('d'); case kbLeft: return FTESL_KBDCTRL('l'); case kbRight: return FTESL_KBDCTRL('r'); case kbCenter: return FTESL_KBDCTRL('x'); case kbHome: return FTESL_KBDCTRL('b'); case kbEnd: return FTESL_KBDCTRL('e'); case kbPgUp: return FTESL_KBDCTRL('p'); case kbPgDn: return FTESL_KBDCTRL('n'); case kbIns: return FTESL_KBDCTRL('q'); case kbDel: return FTESL_KBDCTRL('z'); case kbBackSp: return FTESL_KBDCTRL('h'); case kbTab: return FTESL_KBDCTRL('i'); case kbEnter: return FTESL_KBDCTRL('m'); } if (kcode >= kbF1 && kcode <= kbF12) return FTESL_KBDCTRL('f'); else return (int)kcode; } int main(int argc, char* argv[]) { FILE* fin; FILE* fout; char finname[255]; char foutname[255]; char linebuf[256]; char* lptr; char keyspecbuf[32]; char* bufptr; int err = 0; unsigned linecnt = 0; unsigned strcnt = 0; //int opt; finname[0] = '\0'; foutname[0] = '\0'; printf("Linux keymap compiler for SLang eFTE, Copyright (c) 1998 by Istvn Vradi\n\n"); if (argc < 3) { fprintf(stderr, "Usage: compkeys infile outfile\n\n"); fprintf(stderr, " where:\n"); fprintf(stderr, " infile: the file with the list of the keys\n"); fprintf(stderr, " outfile: the name of the output keymap file\n"); exit(-2); } strcpy(finname, argv[1]); strcpy(foutname, argv[2]); fin = fopen(finname, "rt"); if (fin == NULL) { fprintf(stderr, "Can't open input file '%s' for reading.\n", finname); return -1; } fout = fopen(foutname, "wb"); if (fout == NULL) { fprintf(stderr, "Can't open output file '%s' for writing.\n", foutname); fclose(fin); return -1; } printf("Compiling from '%s' into '%s'.\n", finname, foutname); fprintf(fout, "#############################\n"); fprintf(fout, "# Keytable to use with e'FTE #\n"); fprintf(fout, "# generated by 'compkeys' #\n"); fprintf(fout, "#############################\n\n"); err = 0; while (!err && fgets(linebuf, sizeof(linebuf), fin) == linebuf) { linecnt++; lptr = linebuf; while (!err) { while (*lptr != '\0' && strchr(" \t", *lptr) != NULL) lptr++; if (*lptr == '#' || *lptr == '\0' || *lptr == '\n') break; bufptr = keyspecbuf; while (*lptr != '\0' && strchr(" \t\n", *lptr) == NULL) *(bufptr++) = *(lptr++); *(bufptr++) = '\0'; TKeyCode kcode = ftesl_getkeycode(keyspecbuf), kcode1; if (kcode == 0) { err = 2; } else { fprintf(fout, "\n# %s\n", keyspecbuf); if (kcode&kfShift) fprintf(fout, "shift "); if (kcode&kfCtrl) fprintf(fout, "control "); if (kcode&kfAlt) fprintf(fout, "alt "); fprintf(fout, "keycode %3u = F%u\n", get_linux_keycode(kcode), 100 + strcnt); fprintf(fout, "string F%u = \"\\033", 100 + strcnt); if (kcode&kfShift) fprintf(fout, "\\023"); if (kcode&kfCtrl) fprintf(fout, "\\003"); if (kcode&kfAlt) fprintf(fout, "\\001"); int ccode = ftesl_get_ctrlcode(kcode); fprintf(fout, "\\%03o", ccode); if (ccode == FTESL_KBDCTRL('f')) { kcode1 = keyCode(kcode); switch (kcode1) { case kbF1: case kbF2: case kbF3: case kbF4: case kbF5: case kbF6: case kbF7: case kbF8: case kbF9: fprintf(fout, "%c", (int)'1' + int(kcode1 - kbF1)); break; case kbF10: fprintf(fout, "0"); break; case kbF11: fprintf(fout, "a"); break; case kbF12: fprintf(fout, "b"); break; } } fprintf(fout, "\"\n"); strcnt++; } } } fclose(fout); fclose(fin); if (err) { fprintf(stderr, "line %u: ", linecnt); switch (err) { case 1: fprintf(stderr, "syntax error"); break; case 2: fprintf(stderr, "invalid key specification: '%s'", keyspecbuf); } fprintf(stderr, "\n"); remove(foutname); } else { printf("\nDone.\n"); } if (err) return -1; else return 0; } efte-1.1/src/o_cvsdiff.cpp0000664000076400007640000000745711041404761014572 0ustar laurilauri/* * o_cvsdiff.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * Contributed by Martin Frydl * * Class showing output from CVS diff command. Allows copying of lines * to clipboard and allows to jump to lines in real sources. */ #include "fte.h" ECvsDiff *CvsDiffView = 0; ECvsDiff::ECvsDiff(int createFlags, EModel **ARoot, char *ADir, char *ACommand, char *AOnFiles): ECvsBase(createFlags, ARoot, "CVS diff") { CvsDiffView = this; CurrFile = 0; CurrLine = 0; ToLine = 0; InToFile = 0; RunPipe(ADir, ACommand, AOnFiles); } ECvsDiff::~ECvsDiff() { CvsDiffView = 0; free(CurrFile); } void ECvsDiff::ParseFromTo(char *line, int /*len*/) { char *end; CurrLine = strtol(line + 4, &end, 10) - 1; if (*end == ',') ToLine = atoi(end + 1); else ToLine = CurrLine + 1; if (!(CurrLine < ToLine && ToLine > 0)) CurrLine = ToLine = 0; } void ECvsDiff::ParseLine(char *line, int len) { if (len > 7 && strncmp(line, "Index: ", 7) == 0) { // Filename free(CurrFile); CurrFile = strdup(line + 7); CurrLine = ToLine = InToFile = 0; AddLine(CurrFile, -1, line); } else if (len > 8 && strncmp(line, "*** ", 4) == 0) { // From file or from hunk if (strcmp(line + len - 5, " ****") == 0) { // From hunk ParseFromTo(line, len); } InToFile = 0; AddLine(0, -1, line); } else if (len > 8 && strncmp(line, "--- ", 4) == 0) { // To file or to hunk if (strcmp(line + len - 5, " ----") == 0) { // To hunk if (CurrFile) { ParseFromTo(line, len); AddLine(CurrFile, CurrLine, line, 1); } else AddLine(0, -1, line); } else { // To-file AddLine(CurrFile, -1, line); } InToFile = 1; } else if (strcmp(line, "***************") == 0) { // Hunk start CurrLine = ToLine = 0; AddLine(0, -1, line); } else if (CurrLine < ToLine) { // Diff line (markable, if CurrFile is set, also hilited) if (InToFile) AddLine(CurrFile, CurrLine, line, 5); else AddLine(0, CurrLine, line, 4); CurrLine++; } else AddLine(0, -1, line); } int ECvsDiff::RunPipe(char *ADir, char *ACommand, char *AOnFiles) { FreeLines(); free(CurrFile); CurrLine = ToLine = InToFile = 0; CurrFile = 0; return ECvsBase::RunPipe(ADir, ACommand, AOnFiles); } int ECvsDiff::ExecCommand(int Command, ExState &State) { switch (Command) { case ExBlockCopy: return BlockCopy(0); case ExBlockCopyAppend: return BlockCopy(1); } return EList::ExecCommand(Command, State); } int ECvsDiff::BlockCopy(int Append) { if (SSBuffer == 0) return ErFAIL; if (Append) { if (SystemClipboard) GetPMClip(0); } else SSBuffer->Clear(); SSBuffer->BlockMode = bmLine; // How to set these two ? BFI(SSBuffer, BFI_TabSize) = 8; BFI(SSBuffer, BFI_ExpandTabs) = 0; BFI(SSBuffer, BFI_Undo) = 0; // Go through list of marked lines int last = -1, tl = 0; for (int i = 0;i < LineCount;i++) { if (Lines[i]->Status&2) { // Marked if (last != i - 1 && tl) { // Gap between this and last marked line SSBuffer->InsLine(tl++, 0); } SSBuffer->InsertLine(tl++, strlen(Lines[i]->Msg + 2), Lines[i]->Msg + 2); last = i; } } if (SystemClipboard) PutPMClip(0); return ErOK; } // Event map - this name is used in config files when defining eventmap EEventMap *ECvsDiff::GetEventMap() { return FindEventMap("CVSDIFF"); } efte-1.1/src/o_list.h0000664000076400007640000000500711041404761013553 0ustar laurilauri/* o_list.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __OLIST_H__ #define __OLIST_H__ class EList; class EListPort: public EViewPort { public: EList *List; int Row, TopRow, LeftCol; int OldRow, OldTopRow, OldLeftCol, OldCount; EListPort(EList *L, EView *V); virtual ~EListPort(); void StorePos(); void GetPos(); virtual void HandleEvent(TEvent &Event); virtual void HandleMouse(TEvent &Event); void PaintView(int PaintAll); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); }; class EList: public EModel { public: char *Title; int Row, LeftCol, TopRow, Count; int MouseCaptured; int MouseMoved; int NeedsUpdate, NeedsRedraw; EList(int createFlags, EModel **ARoot, const char *aTitle); virtual ~EList(); virtual EViewPort *CreateViewPort(EView *V); EListPort *GetViewVPort(EView *V); EListPort *GetVPort(); void SetTitle(char *ATitle); virtual int ExecCommand(int Command, ExState &State); virtual EEventMap *GetEventMap(); virtual int GetContext(); virtual int BeginMacro(); void HandleEvent(TEvent &Event); virtual void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); virtual char *FormatLine(int Line); virtual int IsHilited(int Line); virtual int IsMarked(int Line); virtual int Mark(int Line); virtual int Unmark(int Line); int SetPos(int ARow, int ACol); void FixPos(); virtual int GetRowLength(int ARow) { return 0; }; virtual void RescanList(); virtual void UpdateList(); virtual void FreeList(); virtual int CanActivate(int Line); virtual int Activate(int No); int MoveLeft(); int MoveRight(); int MoveUp(); int MoveDown(); int MoveLineStart(); int MoveLineEnd(); int MovePageUp(); int MovePageDown(); int ScrollLeft(int Cols); int ScrollRight(int Cols); int ScrollUp(int Rows); int ScrollDown(int Rows); int MovePageStart(); int MovePageEnd(); int MoveFileStart(); int MoveFileEnd(); int Activate(); int Mark(); int Unmark(); int ToggleMark(); int MarkAll(); int UnmarkAll(); int ToggleMarkAll(); int UpdateRows(int minim, int maxim); }; #endif efte-1.1/src/s_direct.cpp0000664000076400007640000002476211041404761014422 0ustar laurilauri/* s_direct.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // TODO: on OS/2 choose between UNIX and OS/2 style patterns (now OS/2 only) // TODO: on OS/2 fetch multiple entries at once and cache them for speed #include "fte.h" #ifdef OS2 #define INCL_BASE #include #endif #ifdef NT #define WIN32_LEAN_AND_MEAN 1 #include #endif FileInfo::FileInfo(char *Name, int Type, off_t Size, time_t MTime) { name = new char[strlen(Name) + 1]; if (name) strcpy(name, Name); size = Size; type = Type; mtime = MTime; } FileInfo::~FileInfo() { delete [] name; } FileFind::FileFind(const char *aDirectory, const char *aPattern, int aFlags) { Directory = new char[strlen(aDirectory) + 1]; if (Directory) { strcpy(Directory, aDirectory); Slash(Directory, 0); } if (aPattern) { Pattern = new char[strlen(aPattern) + 1]; if (Pattern) strcpy(Pattern, aPattern); } else { Pattern = 0; } Flags = aFlags; #if defined(USE_DIRENT) dir = 0; #elif defined(OS2) && !defined(USE_DIRENT) dir = 0; #elif defined(NT) && !defined(USE_DIRENT) dir = 0; #endif } FileFind::~FileFind() { delete [] Directory; if (Pattern) delete [] Pattern; #if defined(USE_DIRENT) if (dir) closedir(dir); #elif defined(OS2) && !defined(USE_DIRENT) if (dir) DosFindClose(dir); #elif defined(NT) && !defined(USE_DIRENT) if (dir) FindClose((HANDLE)dir); #endif } int FileFind::FindFirst(FileInfo **fi) { #if defined(USE_DIRENT) if (dir) closedir(dir); if ((dir = opendir(Directory)) == 0) return -1; return FindNext(fi); #elif defined(OS2) && !defined(USE_DIRENT) char fullpattern[MAXPATH]; HDIR hdir = HDIR_CREATE; ULONG attr = FILE_ARCHIVED | FILE_READONLY; ULONG count = 1; FILEFINDBUF3 find; // need to improve to fetch multiple entries at once char fullpath[MAXPATH]; char *name; struct tm t; int rc; if (dir) DosFindClose(dir); if (Flags & ffDIRECTORY) attr |= FILE_DIRECTORY; if (Flags & ffHIDDEN) attr |= FILE_HIDDEN | FILE_SYSTEM; // separate ? if (Pattern) JoinDirFile(fullpattern, Directory, Pattern); else JoinDirFile(fullpattern, Directory, "*"); if ((rc = DosFindFirst(fullpattern, &hdir, attr, &find, sizeof(find), &count, FIL_STANDARD)) != 0) { //fprintf(stderr, "%s: %d\n\n", fullpattern, rc); return -1; } dir = hdir; if (count != 1) return -1; name = find.achName; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, name); name = fullpath; } memset((void *)&t, 0, sizeof(t)); t.tm_year = find.fdateLastWrite.year + 80; // ugh! t.tm_mon = find.fdateLastWrite.month - 1; t.tm_mday = find.fdateLastWrite.day; t.tm_hour = find.ftimeLastWrite.hours; t.tm_min = find.ftimeLastWrite.minutes; t.tm_sec = find.ftimeLastWrite.twosecs * 2; // ugh! t.tm_isdst = -1; *fi = new FileInfo(name, (find.attrFile & FILE_DIRECTORY) ? fiDIRECTORY : fiFILE, find.cbFile, mktime(&t)); return 0; #elif defined(NT) && !defined(USE_DIRENT) #if defined(USE_VCFIND) char fullpattern[MAXPATH]; _finddata_t find; // need to improve to fetch multiple entries at once char fullpath[MAXPATH]; char *name; struct tm t; int rc; if (dir) _findclose(dir); /*if (Flags & ffDIRECTORY) attr |= FILE_DIRECTORY; if (Flags & ffHIDDEN) attr |= FILE_HIDDEN | FILE_SYSTEM; // separate ? */ if (Pattern) JoinDirFile(fullpattern, Directory, Pattern); else JoinDirFile(fullpattern, Directory, "*"); if ((rc = _findfirst(fullpattern, &find)) == -1) { // fprintf(stderr, "%s: %d\n\n", fullpattern, rc); return -1; } dir = rc; name = find.name; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, name); name = fullpath; } *fi = new FileInfo(name, (find.attrib & _A_SUBDIR) ? fiDIRECTORY : fiFILE, find.size, find.time_create); return 0; #else char fullpattern[MAXPATH]; WIN32_FIND_DATA find; // need to improve to fetch multiple entries at once char fullpath[MAXPATH]; char *name; struct tm t; SYSTEMTIME st; FILETIME localft; // needed for time conversion int rc; if (dir) _findclose(dir); /*if (Flags & ffDIRECTORY) attr |= FILE_DIRECTORY; if (Flags & ffHIDDEN) attr |= FILE_HIDDEN | FILE_SYSTEM; // separate ? */ if (Pattern) JoinDirFile(fullpattern, Directory, Pattern); else JoinDirFile(fullpattern, Directory, "*"); if ((rc = (int) FindFirstFile(fullpattern, &find)) < 0) { //fprintf(stderr, "%s: %d\n\n", fullpattern, rc); return -1; } dir = rc; name = find.cFileName; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, name); name = fullpath; } /* * since filetime is in UTC format we need to convert it first to * localtime and when we have "correct" time we can use it. */ FileTimeToLocalFileTime(&find.ftLastWriteTime, &localft); FileTimeToSystemTime(&localft, &st); t.tm_year = st.wYear - 1900; t.tm_mon = st.wMonth - 1; // in system time january is 1... t.tm_mday = st.wDay; t.tm_hour = st.wHour; t.tm_min = st.wMinute; t.tm_sec = st.wSecond; t.tm_isdst = -1; *fi = new FileInfo(name, (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? fiDIRECTORY : fiFILE, find.nFileSizeLow, // !!! mktime(&t)); return 0; #endif #endif } int FileFind::FindNext(FileInfo **fi) { #if defined(USE_DIRENT) struct dirent *dent; char fullpath[MAXPATH]; char *name; *fi = 0; again: if ((dent = readdir(dir)) == NULL) return -1; name = dent->d_name; if (name[0] == '.') if (!(Flags & ffHIDDEN)) goto again; if (Pattern && fnmatch(Pattern, dent->d_name, 0) != 0) goto again; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, dent->d_name); name = fullpath; } if (Flags & ffFAST) { *fi = new FileInfo(name, fiUNKNOWN, 0, 0); } else { struct stat st; if (!(Flags & ffFULLPATH)) // need it now JoinDirFile(fullpath, Directory, dent->d_name); if (Flags && ffLINK) { // if we are handling location of symbolic links, lstat cannot be used // instead use normal stat if (stat(fullpath, &st) != 0 && 0) goto again; } else { if ( #if defined(UNIX) // must use lstat if available lstat #else stat #endif (fullpath, &st) != 0 && 0) goto again; } if (!(Flags & ffDIRECTORY) && S_ISDIR(st.st_mode)) goto again; *fi = new FileInfo(name, S_ISDIR(st.st_mode) ? fiDIRECTORY : fiFILE, st.st_size, st.st_mtime); } //printf("ok\n"); return 0; #elif defined(OS2) && !defined(USE_DIRENT) ULONG count = 1; FILEFINDBUF3 find; // need to improve to fetch multiple entries at once char fullpath[MAXPATH]; char *name; struct tm t; int rc; if ((rc = DosFindNext(dir, &find, sizeof(find), &count)) != 0) { //fprintf(stderr, "%d\n\n", rc); return -1; } if (count != 1) return -1; name = find.achName; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, name); name = fullpath; } memset((void *)&t, 0, sizeof(t)); t.tm_year = find.fdateLastWrite.year + 80; t.tm_mon = find.fdateLastWrite.month - 1; t.tm_mday = find.fdateLastWrite.day; t.tm_hour = find.ftimeLastWrite.hours; t.tm_min = find.ftimeLastWrite.minutes; t.tm_sec = find.ftimeLastWrite.twosecs * 2; // ugh! t.tm_isdst = -1; *fi = new FileInfo(name, (find.attrFile & FILE_DIRECTORY) ? fiDIRECTORY : fiFILE, find.cbFile, mktime(&t)); return 0; #elif defined(NT) && !defined(USE_DIRENT) #if defined(USE_VCFIND) _finddata_t find; char fullpath[MAXPATH]; char *name; struct tm t; int rc; if ((rc = _findnext(dir, &find)) != 0) { // fprintf(stderr, "%d\n\n", rc); return -1; } name = find.name; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, name); name = fullpath; } *fi = new FileInfo(name, (find.attrib & _A_SUBDIR) ? fiDIRECTORY : fiFILE, find.size, find.time_create); return 0; #else WIN32_FIND_DATA find; char fullpath[MAXPATH]; char *name; struct tm t; SYSTEMTIME st; FILETIME localft; // needed for time conversion int rc; if ((rc = FindNextFile((HANDLE)dir, &find)) != TRUE) { //fprintf(stderr, "%d\n\n", rc); return -1; } name = find.cFileName; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, name); name = fullpath; } /* * since filetime is in UTC format we need to convert it first to * localtime and when we have "correct" time we can use it. */ FileTimeToLocalFileTime(&find.ftLastWriteTime, &localft); FileTimeToSystemTime(&localft, &st); t.tm_year = st.wYear - 1900; t.tm_mon = st.wMonth - 1; // in system time january is 1... t.tm_mday = st.wDay; t.tm_hour = st.wHour; t.tm_min = st.wMinute; t.tm_sec = st.wSecond; t.tm_isdst = -1; *fi = new FileInfo(name, (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? fiDIRECTORY : fiFILE, find.nFileSizeLow, mktime(&t)); return 0; #endif // put code here #endif } efte-1.1/src/e_tags.cpp0000664000076400007640000003345411250237257014074 0ustar laurilauri/* * e_tags.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" struct TagData { int Tag; // tag name pos int FileName; int TagBase; // name of tag file int Line; int StrFind; // string to find }; struct TagStack { char *FileName; int Line, Col; TagStack *Next; int TagPos; char *CurrentTag; }; static char *TagMem = 0; static int TagLen = 0; static int ATagMem = 0; static int CTags = 0; // number of tags static int ATags = 0; static TagData *TagD = 0; static int *TagI = 0; static int TagFileCount = 0; static int *TagFiles = 0; static int TagFilesLoaded = 0; // tag files are loaded at first lookup static char *CurrentTag = 0; static int TagPosition = -1; static TagStack *TStack; static int AllocMem(char *Mem, int Len) { /*FOLD00*/ int N = 1024; char *NM; int TagPos = TagLen; while (N < TagLen + Len) N <<= 1; if (ATagMem < N || TagMem == 0) { NM = (char *)realloc((void *)TagMem, N); if (NM == 0) return -1; TagMem = NM; ATagMem = N; } memcpy(TagMem + TagLen, Mem, Len); TagLen += Len; return TagPos; } static int AddTag(int Tag, int FileName, int TagBase, int Line, int StrFind) { /*FOLD00*/ int N; N = 1024; while (N < CTags + 1) N <<= 1; if (ATags < N || TagD == 0) { TagData *ND; ND = (TagData *)realloc((void *)TagD, N * sizeof(TagData)); if (ND == 0) return -1; TagD = ND; ATags = N; } TagD[CTags].Tag = Tag; TagD[CTags].Line = Line; TagD[CTags].FileName = FileName; TagD[CTags].TagBase = TagBase; TagD[CTags].StrFind = StrFind; CTags++; return 0; } #if defined(__IBMCPP__) int _LNK_CONV cmptags(const void *p1, const void *p2) { #else int cmptags(const void *p1, const void *p2) { #endif return strcmp(TagMem + TagD[*(int *)p1].Tag, TagMem + TagD[*(int *)p2].Tag); } int SortTags() { /*FOLD00*/ int *NI; int i; if (CTags == 0) return 0; NI = (int *)realloc((void *)TagI, CTags * sizeof(int)); if (NI == 0) return -1; TagI = NI; for (i = 0; i < CTags; i++) TagI[i] = i; qsort(TagI, CTags, sizeof(TagI[0]), cmptags); return 0; } int TagsLoad(int id) { /*FOLD00*/ //char line[2048]; char *tags; int fd; struct stat sb; long size; free(TagI); TagI = 0; if ((fd = open(TagMem + TagFiles[id], O_BINARY | O_RDONLY)) == -1) return -1; if (fstat(fd, &sb) == -1) { close(fd); return -1; } if ((tags = (char *)malloc(sb.st_size)) == 0) { close(fd); return -1; } size = read(fd, tags, sb.st_size); close(fd); if (size != sb.st_size) { free(tags); return -1; } if (TagMem == 0) { // preallocate (useful when big file) char *NM; NM = (char *)realloc((void *)TagMem, TagLen + sb.st_size); if (NM != 0) { TagMem = NM; ATagMem = TagLen + sb.st_size; } } char *p = tags; char *e = tags + sb.st_size; char *LTag, *LFile, *LLine; int TagL, FileL/*, LineL*/; int MTag, MFile; while (p < e) { LTag = p; while (p < e && *p != '\t') p++; if (p < e && *p == '\t') *p++ = 0; else break; TagL = p - LTag; LFile = p; while (p < e && *p != '\t') p++; if (p < e && *p == '\t') *p++ = 0; else break; FileL = p - LFile; LLine = p; while (p < e && *p != '\r' && *p != '\n') p++; if (p < e && *p == '\r') *p++ = 0; // optional if (p < e && *p == '\n') *p++ = 0; else break; //LineL = p - LLine; MTag = AllocMem(LTag, TagL + FileL); if (MTag == -1) break; MFile = MTag + TagL; if (LLine[0] == '/') { char *AStr = LLine; char *p = AStr + 1; char *d = AStr; int MStr; while (*p) { if (*p == '\\') { p++; if (*p) *d++ = *p++; } else if (*p == '^' || *p == '$') p++; else if (*p == '/') break; else *d++ = *p++; } *d = 0; if (stricmp(d - 10, "/*FOLD00*/") == 0) d[-11] = 0; /* remove our internal folds */ MStr = AllocMem(AStr, strlen(AStr) + 1); if (MStr == -1) break; if (AddTag(MTag, MFile, TagFiles[id], -1, MStr) == -1) break; } else { if (AddTag(MTag, MFile, TagFiles[id], atoi(LLine), -1) == -1) break; } } free(tags); return 0; } int TagsAdd(char *FileName) { /*FOLD00*/ int *NewT; int NewF; NewF = AllocMem(FileName, strlen(FileName) + 1); if (NewF == -1) return 0; NewT = (int *)realloc((void *)TagFiles, (TagFileCount + 1) * sizeof(int)); if (NewT == 0) return 0; TagFiles = NewT; TagFiles[TagFileCount++] = NewF; return 1; } int TagsSave(FILE *fp) { /*FOLD00*/ for (int i = 0; i < TagFileCount; i++) fprintf(fp, "T|%s\n", TagMem + TagFiles[i]); return 1; } static void ClearTagStack() { /*FOLD00*/ TagStack *T; if (CurrentTag) { free(CurrentTag); CurrentTag = 0; } TagPosition = -1; while (TStack) { T = TStack; TStack = TStack->Next; free(T->CurrentTag); free(T->FileName); free(T); } } int TagLoad(char *FileName) { /*FOLD00*/ if (TagsAdd(FileName) == 0) return 0; ClearTagStack(); if (TagFilesLoaded) { if (TagsLoad(TagFileCount - 1) == -1) { return 0; } if (SortTags() == -1) { TagClear(); return 0; } } return 1; } static int LoadTagFiles() { /*FOLD00*/ int i; assert(TagFilesLoaded == 0); for (i = 0; i < TagFileCount; i++) if (TagsLoad(i) == -1) { TagClear(); return 0; } if (SortTags() == -1) { TagClear(); return 0; } TagFilesLoaded = 1; return 1; } void TagClear() { /*FOLD00*/ free(TagD); free(TagI); TagD = 0; TagI = 0; CTags = 0; ATags = 0; free(TagFiles); TagFiles = 0; TagFileCount = 0; TagFilesLoaded = 0; free(TagMem); TagMem = 0; TagLen = 0; ATagMem = 0; ClearTagStack(); } static int GotoFilePos(EView *View, char *FileName, int Line, int Col) { /*FOLD00*/ if (FileLoad(0, FileName, 0, View) == 0) return 0; if (((EBuffer *)ActiveModel)->Loaded == 0) ((EBuffer *)ActiveModel)->Load(); ((EBuffer *)ActiveModel)->CenterNearPosR(Col, Line); return 1; } static int GotoTag(int M, EView *View) { /*FOLD00*/ char path[MAXPATH]; char Dir[MAXPATH]; TagData *TT = &TagD[TagI[M]]; JustDirectory(TagMem + TT->TagBase, Dir, sizeof(Dir)); if (IsFullPath(TagMem + TT->FileName)) { strcpy(path, TagMem + TT->FileName); } else { strcpy(path, Dir); Slash(path, 1); strcat(path, TagMem + TT->FileName); } if (TT->Line != -1) { if (GotoFilePos(View, path, TT->Line - 1, 0) == 0) return 0; } else { if (GotoFilePos(View, path, 0, 0) == 0) return 0; if (((EBuffer *)ActiveModel)->FindStr(TagMem + TT->StrFind, strlen(TagMem + TT->StrFind), 0) == 0) return 0; } ((EBuffer *)ActiveModel)->FindStr(TagMem + TT->Tag, strlen(TagMem + TT->Tag), 0); return 1; } static int PushPos(EBuffer *B) { /*FOLD00*/ TagStack *T; T = (TagStack *)malloc(sizeof(TagStack)); if (T == 0) return 0; T->FileName = strdup(B->FileName); if (T->FileName == 0) { free(T); return 0; } T->Line = B->VToR(B->CP.Row); T->Col = B->CP.Col; T->Next = TStack; T->CurrentTag = CurrentTag; CurrentTag = 0; T->TagPos = TagPosition; TagPosition = -1; TStack = T; return 1; } int TagGoto(EView *View, char *Tag) { assert(Tag != 0); if (TagFilesLoaded == 0) if (LoadTagFiles() == 0) return 0; int L = 0, R = CTags, M, cmp; if (CTags == 0) return 0; while (L < R) { M = (L + R) / 2; cmp = strcmp(Tag, TagMem + TagD[TagI[M]].Tag); if (cmp == 0) { while (M > 0 && strcmp(Tag, TagMem + TagD[TagI[M - 1]].Tag) == 0) M--; if (GotoTag(M, View) == 0) return 0; CurrentTag = strdup(Tag); TagPosition = M; return 1; } else if (cmp < 0) { R = M; } else { L = M + 1; } } return 0; // tag not found } int TagFind(EBuffer *B, EView *View, char *Tag) { /*FOLD00*/ assert(View != 0 && Tag != 0 && B != 0); if (TagFilesLoaded == 0) if (LoadTagFiles() == 0) return 0; int L = 0, R = CTags, M, cmp; if (CurrentTag) { if (strcmp(CurrentTag, Tag) == 0) { if (PushPos(B) == 0) return 0; free(CurrentTag); CurrentTag = strdup(Tag); if (CurrentTag == 0) return 0; TagPosition = TStack->TagPos; return TagNext(View); } } if (CTags == 0) return -1; while (L < R) { M = (L + R) / 2; cmp = strcmp(Tag, TagMem + TagD[TagI[M]].Tag); if (cmp == 0) { while (M > 0 && strcmp(Tag, TagMem + TagD[TagI[M - 1]].Tag) == 0) M--; if (PushPos(B) == 0) return 0; if (GotoTag(M, View) == 0) return 0; free(CurrentTag); // in case it already exists. CurrentTag = strdup(Tag); TagPosition = M; return 1; } else if (cmp < 0) { R = M; } else { L = M + 1; } } return 0; // tag not found } int TagDefined(const char *Tag) { int L = 0, R = CTags, M, cmp; if (TagFilesLoaded == 0) // !!! always? if (LoadTagFiles() == 0) return 0; if (CTags == 0) return 0; while (L < R) { M = (L + R) / 2; cmp = strcmp(Tag, TagMem + TagD[TagI[M]].Tag); if (cmp == 0) return 1; else if (cmp < 0) R = M; else L = M + 1; } return 0; // tag not found } int TagComplete(char **Words, int *WordsPos, int WordsMax, char *Tag) { if ((Tag == NULL) || (Words == NULL) || (*WordsPos >= WordsMax)) return 0; if (TagFilesLoaded == 0) if (LoadTagFiles() == 0) return 0; if (CTags == 0) return 0; int L = 0, R = CTags, len = strlen(Tag); while (L < R) { int c, M; M = (L + R) / 2; c = strncmp(Tag, TagMem + TagD[TagI[M]].Tag, len); if (c == 0) { while (M > 0 && strncmp(Tag, TagMem + TagD[TagI[M - 1]].Tag, len) == 0) M--; // find begining int N = M, w = 0; while (strncmp(Tag, TagMem + TagD[TagI[N]].Tag, len) == 0) { // the first word is not tested for previous match if (!w || strcmp(TagMem + TagD[TagI[N]].Tag, TagMem + TagD[TagI[N-1]].Tag)) { int l = strlen(TagMem + TagD[TagI[N]].Tag) - len; if (l > 0) { char *s = new char[l + 1]; if (s != NULL) { strcpy(s, TagMem + TagD[TagI[N]].Tag + len); Words[(*WordsPos)++] = s; w++; // also mark the first usage if (*WordsPos >= WordsMax) break; } else break; // how about using exceptions } } N++; } return w; } else if (c < 0) { R = M; } else { L = M + 1; } } return 0; // tag not found } int TagNext(EView *View) { /*FOLD00*/ assert(View != 0); if (CurrentTag == 0 || TagPosition == -1) { return 0; } if (TagPosition < CTags - 1 && strcmp(CurrentTag, TagMem + TagD[TagI[TagPosition + 1]].Tag) == 0) { TagPosition++; if (GotoTag(TagPosition, View) == 0) return 0; return 1; } View->Msg(S_INFO, "No next match for tag."); return 0; } int TagPrev(EView *View) { /*FOLD00*/ assert(View != 0); if (CurrentTag == 0 || TagPosition == -1) { View->Msg(S_INFO, "No current tag."); return 0; } if (TagPosition > 0 && strcmp(CurrentTag, TagMem + TagD[TagI[TagPosition - 1]].Tag) == 0) { TagPosition--; if (GotoTag(TagPosition, View) == 0) return 0; return 1; } View->Msg(S_INFO, "No previous match for tag."); return 0; } int TagPop(EView *View) { /*FOLD00*/ TagStack *T = TStack; assert(View != 0); if (T) { TStack = T->Next; if (CurrentTag) { free(CurrentTag); CurrentTag = NULL; } if (T->CurrentTag) { CurrentTag = strdup(T->CurrentTag); } TagPosition = T->TagPos; if (GotoFilePos(View, T->FileName, T->Line, T->Col) == 0) { free(T); return 0; } free(T); return 1; } View->Msg(S_INFO, "Tag stack empty."); return 0; } efte-1.1/src/defcfg2.fte0000664000076400007640000002017311041404761014112 0ustar laurilauri# # Default configuration to be built into eFTE # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # menu File { item "&Open...\tCtrl+O" { FileOpen } item "&Reload" { FileReload } item "&Save\tCtrl+S" { FileSave } item "Save &As..." { FileSaveAs } item "Save Al&l" { FileSaveAll } item "&Close\tCtrl+W" { FileClose } item; item "E&xit\tCtrl+Q" { ExitEditor } } menu Edit { item "&Undo\tCtrl+Z" { Undo } item "&Redo" { Redo } item; item "Cu&t\tCtrl+X" { BlockCut } item "&Copy\tCtrl+C" { BlockCopy } item "&Paste\tCtrl+V" { BlockPasteStream } } menu Search { item "&Find...\tCtrl+F" { Find } item "Find &Next\tCtrl+G" { FindRepeat } item; item "Find and &replace...\tCtrl+R" { FindReplace } item; item "&Goto line..." { MoveToLine } } menu Help { item "&About..." { ShowVersion } } menu Main { submenu "&File", File; submenu "&Edit", Edit; submenu "&Search", Search; submenu "&Help", Help; } menu Local { item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tCtrl+X" { BlockCut } item "&Copy\tCtrl+C" { BlockCopy } item "&Paste\tCtrl+V" { BlockPasteStream } item "Cl&ose\tAlt+Q" { FileClose } } eventmap MODEL { # basic commands, for files, directories, message view, etc. key [C+O] { FileOpen } key [C+W] { FileClose } key [F10] { MainMenu } key [S+F10] { LocalMenu } key [C+Q] { ExitEditor } key [A+G-Left] { FilePrev } key [A+G-Right] { FileNext } } eventmap PLAIN: MODEL { # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [Esc] { BlockMarkStream; BlockUnmark } key [C+S] { FileSave } key [C+C] { BlockCopy } key [C+V] { BlockPasteStream } key [C+X] { BlockCut } key [A+BackSp] { Undo } key [A+S+BackSp] { Redo } key [G-Enter] { LineNew } key [BackSp] { BackSpace } key [G-Ins] { ToggleInsert } key [G-Del] { Delete } key [Tab] { InsertTab } key [C+BackSp] { KillWordPrev } key [C+F] { Find } key [C+G] { FindRepeat } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } key [C+G-Ins] { BlockCopy } key [S+G-Ins] { BlockPasteStream } key [S+G-Del] { BlockCut } key [F7] { BlockBegin } key [S+F7] { MoveBlockStart } key [F8] { BlockEnd } key [S+F8] { MoveBlockEnd } key [A+E] { MainMenu 'E' } key [A+F] { MainMenu 'F' } key [A+H] { MainMenu 'H' } key [A+S] { MainMenu 'S' } } colorize PLAIN { SyntaxParser = 'PLAIN'; # color { # { 'Normal', '-7' }, # }; } mode PLAIN { Colorizer = 'PLAIN'; } eventmap LIST { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [A+G-Up] { ScrollUp } key [A+G-Down] { ScrollDown } key [A+G-Left] { ScrollLeft } key [A+G-Right] { ScrollRight } key [Esc] { Cancel } key [G-Enter] { Activate } } eventmap BUFFERS: LIST { key [C+F10] { FileClose } key [F2] { FileSave } } eventmap ROUTINES: LIST { } eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } # key [A+G-Left] { ScrollLeft } # key [A+G-Right] { ScrollRight } key [G-Enter] { Activate } } menu Directory { item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu Navigate { item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } # item "&/ Goto Dir\t/" { DirGoto } item "&\\ Goto Dir\t\\" { DirGoto } item; item '&A:\\' { DirGoto 'A:\\' } item '&B:\\' { DirGoto 'B:\\' } item '&C:\\' { DirGoto 'C:\\' } item '&D:\\' { DirGoto 'D:\\' } item '&E:\\' { DirGoto 'E:\\' } item '&F:\\' { DirGoto 'F:\\' } item '&G:\\' { DirGoto 'G:\\' } item '&H:\\' { DirGoto 'H:\\' } item '&I:\\' { DirGoto 'I:\\' } } menu DirMain { submenu "&Directory", Directory; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap DIRECTORY: MLIST { MainMenu = 'DirMain'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [A+D] { MainMenu 'D' } key [A+N] { MainMenu 'N' } key [A+W] { MainMenu 'W' } } menu Messages { item "&Close\tAlt+Q" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu MsgMain { submenu "&Messages", Messages; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap MESSAGES: MLIST { MainMenu = "MsgMain"; key [A+M] { MainMenu 'M' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } } efte-1.1/src/o_messages.cpp0000664000076400007640000004124711041404761014750 0ustar laurilauri/* o_messages.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "s_files.h" #include "c_commands.h" #define MAXREGEXP 32 EMessages *CompilerMsgs = 0; static int NCRegexp = 0; static struct { int RefFile; int RefLine; int RefMsg; RxNode *rx; } CRegexp[MAXREGEXP]; int AddCRegexp(int file, int line, int msg, const char *regexp) { if (NCRegexp >= MAXREGEXP) return 0; CRegexp[NCRegexp].RefFile = file; CRegexp[NCRegexp].RefLine = line; CRegexp[NCRegexp].RefMsg = msg; if ((CRegexp[NCRegexp].rx = RxCompile(regexp)) == NULL) { return 0; } NCRegexp++; return 1; } void FreeCRegexp() { while (NCRegexp--) { RxFree(CRegexp[NCRegexp].rx); } } EMessages::EMessages(int createFlags, EModel **ARoot, char *ADir, char *ACommand): EList(createFlags, ARoot, "Messages") { CompilerMsgs = this; ErrCount = 0; ErrList = 0; Running = 0; BufLen = 0; BufPos = 0; Command = 0; Directory = 0; MatchCount = 0; ReturnCode = -1; Running = 1; curr_dir = 0; RunPipe(ADir, ACommand); } EMessages::~EMessages() { gui->ClosePipe(PipeId); FreeErrors(); free(Command); free(Directory); CompilerMsgs = 0; freeDirStack(); } void EMessages::freeDirStack() { while (curr_dir != 0) { aDir *a = curr_dir; curr_dir = curr_dir->next; free(a->name); delete a; } } void EMessages::NotifyDelete(EModel *Deleting) { for (int i = 0; i < ErrCount; i++) { if (ErrList[i]->Buf == Deleting) { /* NOT NEEDED! char bk[16]; sprintf(bk, "_MSG.%d", i); ((EBuffer *)Deleting)->RemoveBookmark(bk); */ ErrList[i]->Buf = 0; } } } void EMessages::FindErrorFiles() { for (int i = 0; i < ErrCount; i++) if (ErrList[i]->Buf == 0 && ErrList[i]->file != 0) FindErrorFile(i); } void EMessages::FindErrorFile(int err) { assert(err >= 0 && err < ErrCount); if (ErrList[err]->file == 0) return ; EBuffer *B; ErrList[err]->Buf = 0; B = FindFile(ErrList[err]->file); if (B == 0) return ; if (B->Loaded == 0) return; AddFileError(B, err); } void EMessages::AddFileError(EBuffer *B, int err) { char bk[16]; EPoint P; assert(err >= 0 && err < ErrCount); sprintf(bk, "_MSG.%d", err); P.Col = 0; P.Row = ErrList[err]->line - 1; // offset 0 if (P.Row >= B->RCount) P.Row = B->RCount - 1; if (P.Row < 0) P.Row = 0; if (B->PlaceBookmark(bk, P) == 1) ErrList[err]->Buf = B; } void EMessages::FindFileErrors(EBuffer *B) { for (int i = 0; i < ErrCount; i++) if (ErrList[i]->Buf == 0 && ErrList[i]->file != 0) { if (filecmp(B->FileName, ErrList[i]->file) == 0) { AddFileError(B, i); } } } int EMessages::RunPipe(char *ADir, char *ACommand) { if (!KeepMessages) FreeErrors(); free(Command); free(Directory); Command = strdup(ACommand); Directory = strdup(ADir); MatchCount = 0; ReturnCode = -1; Running = 1; BufLen = BufPos = 0; Row = ErrCount - 1; { char s[2 * MAXPATH * 4]; sprintf(s, "[running '%s' in '%s']", Command, Directory); AddError(0, -1, 0, s); } { char s[MAXPATH * 2]; sprintf(s, "Messages [%s]: %s", Directory, Command); SetTitle(s); } ChangeDir(Directory); PipeId = gui->OpenPipe(Command, this); return 0; } EEventMap *EMessages::GetEventMap() { return FindEventMap("MESSAGES"); } int EMessages::ExecCommand(int Command, ExState &State) { switch (Command) { case ExChildClose: if (Running == 0 || PipeId == -1) break; ReturnCode = gui->ClosePipe(PipeId); PipeId = -1; Running = 0; { char s[30]; sprintf(s, "[aborted, status=%d]", ReturnCode); AddError(0, -1, 0, s); } return ErOK; case ExActivateInOtherWindow: ShowError(View->Next, Row); return ErOK; } return EList::ExecCommand(Command, State); } void EMessages::AddError(Error *p) { ErrCount++; ErrList = (Error **) realloc(ErrList, sizeof(void *) * ErrCount); ErrList[ErrCount - 1] = p; ErrList[ErrCount - 1]->Buf = 0; FindErrorFile(ErrCount - 1); if (ErrCount > Count) if (Row >= Count - 1) { //if (ErrCount > 1 && !ErrList[TopRow]->file) Row = ErrCount - 1; } UpdateList(); } void EMessages::AddError(char *file, int line, char *msg, const char *text, int hilit) { Error *pe; pe = (Error *) malloc(sizeof(Error)); if (pe == 0) return ; pe->file = file ? strdup(file) : 0; pe->line = line; pe->msg = msg ? strdup(msg) : 0; pe->text = text ? strdup(text) : 0; pe->hilit = hilit; AddError(pe); } void EMessages::FreeErrors() { if (ErrList) { for (int i = 0; i < ErrCount; i++) { if (ErrList[i]->Buf != 0) { char bk[16]; sprintf(bk, "_MSG.%d", i); ((EBuffer *)(ErrList[i]->Buf))->RemoveBookmark(bk); } free(ErrList[i]->msg); free(ErrList[i]->text); free(ErrList[i]->file); free(ErrList[i]); } free(ErrList); } ErrCount = 0; ErrList = 0; BufLen = BufPos = 0; } int EMessages::GetLine(char *Line, int maxim) { int rc; char *p; int l; //fprintf(stderr, "GetLine: %d\n", Running); *Line = 0; if (Running && PipeId != -1) { rc = gui->ReadPipe(PipeId, MsgBuf + BufLen, sizeof(MsgBuf) - BufLen); //fprintf(stderr, "GetLine: ReadPipe rc = %d\n", rc); if (rc == -1) { ReturnCode = gui->ClosePipe(PipeId); PipeId = -1; Running = 0; } if (rc > 0) BufLen += rc; } l = maxim - 1; if (BufLen - BufPos < l) l = BufLen - BufPos; //fprintf(stderr, "GetLine: Data %d\n", l); p = (char *)memchr(MsgBuf + BufPos, '\n', l); if (p) { *p = 0; strcpy(Line, MsgBuf + BufPos); l = strlen(Line); if (l > 0 && Line[l - 1] == '\r') Line[l - 1] = 0; BufPos = p + 1 - MsgBuf; //fprintf(stderr, "GetLine: Line %d\n", strlen(Line)); } else if (Running && sizeof(MsgBuf) != BufLen) { memmove(MsgBuf, MsgBuf + BufPos, BufLen - BufPos); BufLen -= BufPos; BufPos = 0; //fprintf(stderr, "GetLine: Line Incomplete\n"); return 0; } else { if (l == 0) return 0; memcpy(Line, MsgBuf + BufPos, l); Line[l] = 0; if (l > 0 && Line[l - 1] == '\r') Line[l - 1] = 0; BufPos += l; //fprintf(stderr, "GetLine: Line Last %d\n", l); } memmove(MsgBuf, MsgBuf + BufPos, BufLen - BufPos); BufLen -= BufPos; BufPos = 0; //fprintf(stderr, "GetLine: Got Line\n"); return 1; } static void getWord(char* dest, char*& pin) { char *pout, *pend; char ch, ec; while (*pin == ' ' || *pin == '\t') pin++; pout = dest; pend = dest + 256 - 1; if (*pin == '\'' || *pin == '"' || *pin == '`') { ec = *pin++; if (ec == '`') ec = '\''; for (;;) { ch = *pin++; if (ch == '`') ch = '\''; if (ch == ec || ch == 0) break; if (pout < pend) *pout++ = ch; } if (ch == 0) pin--; } else { for (;;) { ch = *pin++; if (ch == ' ' || ch == '\t' || ch == 0) break; if (pout < pend) *pout++ = ch; } } *pout = 0; } void EMessages::GetErrors() { char line[4096]; RxMatchRes RM; //int retc; int i, n; int didmatch = 0; int WasRunning = Running; char fn[256]; //fprintf(stderr, "Reading pipe\n"); while (GetLine((char *)line, sizeof(line))) { if (strlen(line) > 0 && line[strlen(line)-1] == '\n') line[strlen(line)-1] = 0; didmatch = 0; for (i = 0; i < NCRegexp; i++) { if (RxExec(CRegexp[i].rx, line, strlen(line), line, &RM) == 1) { char ln[256] = ""; char msg[256] = ""; char fn1[256] = ""; char fn2[256] = ""; char *file = 0; *fn = 0; memset(fn, 0, 256); memset(ln, 0, 256); memset(msg, 0, 256); n = CRegexp[i].RefFile; if (RM.Close[n] - RM.Open[n] < 256) memcpy(fn, line + RM.Open[n], RM.Close[n] - RM.Open[n]); n = CRegexp[i].RefLine; if (RM.Close[n] - RM.Open[n] < 256) memcpy(ln, line + RM.Open[n], RM.Close[n] - RM.Open[n]); n = CRegexp[i].RefMsg; if (RM.Close[n] - RM.Open[n] < 256) memcpy(msg, line + RM.Open[n], RM.Close[n] - RM.Open[n]); if (IsFullPath(fn)) file = fn; else { if (curr_dir == 0) strcpy(fn1, Directory); else strcpy(fn1, curr_dir->name); Slash(fn1, 1); strcat(fn1, fn); if (ExpandPath(fn1, fn2, sizeof(fn2)) == 0) file = fn2; else file = fn1; } AddError(file, atoi(ln), msg[0] ? msg : 0, line, 1); didmatch = 1; MatchCount++; break; } } if (!didmatch) { AddError(0, -1, 0, line); //** Quicky: check for gnumake 'entering directory' //** make[x]: entering directory `xxx' //** make[x]: leaving... static char t1[] = "entering directory"; static char t2[] = "leaving directory"; char* pin; if ((pin = strstr(line, "]:")) != 0) { //** It *is* some make line.. Check for 'entering'.. pin += 2; //while(*pin != ':' && *pin != 0) pin++; //pin++; while (*pin == ' ') pin++; if (strnicmp(pin, t1, sizeof(t1) - 1) == 0) { // Entering? //** Get the directory name from the line, pin += sizeof(t1) - 1; getWord(fn, pin); //dbg("entering %s", fn); if (*fn) { //** Indeedy entering directory! Link in list, aDir * a = new aDir; assert(a != 0); a->name = strdup(fn); assert(a->name != 0); a->next = curr_dir; curr_dir = a; } } else if (strnicmp(pin, t2, sizeof(t2) - 1) == 0) { // Leaving? pin += sizeof(t2) - 1; getWord(fn, pin); // Get dirname, //dbg("leaving %s", fn); aDir *a; a = curr_dir; if (a != 0) curr_dir = curr_dir->next; // Remove from stack, if (a != 0 && stricmp(a->name, fn) == 0) { //** Pop this item. free(a->name); delete a; } else { //** Mismatch filenames -> error, and revoke stack. //dbg("mismatch on %s", fn); AddError(0, -1, 0, "efte: mismatch in directory stack!?"); //** In this case we totally die the stack.. while (a != 0) { free(a->name); delete a; a = curr_dir; if (a != 0) curr_dir = curr_dir->next; } } } } } } //fprintf(stderr, "Reading Stopped\n"); if (!Running && WasRunning) { char s[30]; sprintf(s, "[done, status=%d]", ReturnCode); AddError(0, -1, 0, s); } //UpdateList(); //NeedsUpdate = 1; } int EMessages::CompilePrevError(EView *V) { if (ErrCount > 0) { bad: if (Row > 0) { Row--; if (ErrList[Row]->line == -1 || !ErrList[Row]->file) goto bad; ShowError(V, Row); } else { V->Msg(S_INFO, "No previous error."); return 0; } } else { V->Msg(S_INFO, "No errors."); return 0; } return 1; } int EMessages::CompileNextError(EView *V) { if (ErrCount > 0) { bad: if (Row < ErrCount - 1) { Row++; if (ErrList[Row]->line == -1 || !ErrList[Row]->file) goto bad; ShowError(V, Row); } else { if (Running) V->Msg(S_INFO, "No more errors (yet)."); else V->Msg(S_INFO, "No more errors."); return 0; } } else { if (Running) V->Msg(S_INFO, "No errors (yet)."); else V->Msg(S_INFO, "No errors."); return 0; } return 1; } int EMessages::Compile(char * /*Command*/) { return 0; } void EMessages::ShowError(EView *V, int err) { if (err >= 0 && err < ErrCount) { if (ErrList[err]->file) { // should check if relative path // possibly scan for (gnumake) directory info in output if (ErrList[err]->Buf != 0) { char bk[16]; V->SwitchToModel(ErrList[err]->Buf); sprintf(bk, "_MSG.%d", err); ErrList[err]->Buf->GotoBookmark(bk); } else { if (FileLoad(0, ErrList[err]->file, 0, V) == 1) { V->SwitchToModel(ActiveModel); ((EBuffer *)ActiveModel)->CenterNearPosR(0, ErrList[err]->line - 1); } } if (ErrList[err]->msg != 0) V->Msg(S_INFO, "%s", ErrList[err]->msg); else V->Msg(S_INFO, "%s", ErrList[err]->text); } } } void EMessages::DrawLine(PCell B, int Line, int Col, ChColor color, int Width) { if (Line < ErrCount) if (Col < int(strlen(ErrList[Line]->text))) { char str[1024]; int len; len = UnTabStr(str, sizeof(str), ErrList[Line]->text, strlen(ErrList[Line]->text)); if (len > Col) MoveStr(B, 0, Width, str + Col, color, Width); } } char* EMessages::FormatLine(int Line) { char *p; if (Line < ErrCount) p = strdup(ErrList[Line]->text); else p = 0; return p; } int EMessages::IsHilited(int Line) { return (Line >= 0 && Line < ErrCount) ? ErrList[Line]->hilit : 0; } void EMessages::UpdateList() { Count = ErrCount; EList::UpdateList(); } int EMessages::Activate(int /*No*/) { //assert(No == Row); //Row = No; ShowError(View, Row); return 1; } int EMessages::CanActivate(int Line) { int ok = 0; if (Line < ErrCount) if (ErrList[Line]->file || ErrList[Line]->line != -1) ok = 1; return ok; } void EMessages::NotifyPipe(int APipeId) { //fprintf(stderr, "Got notified"); if (APipeId == PipeId) GetErrors(); } void EMessages::GetName(char *AName, int MaxLen) { strncpy(AName, "Messages", MaxLen); } void EMessages::GetInfo(char *AInfo, int /*MaxLen*/) { sprintf(AInfo, "%2d %04d/%03d Messages: %d (%s) ", ModelNo, Row, Count, MatchCount, Command); } void EMessages::GetPath(char *APath, int MaxLen) { strncpy(APath, Directory, MaxLen); APath[MaxLen - 1] = 0; Slash(APath, 0); } void EMessages::GetTitle(char *ATitle, int /*MaxLen*/, char *ASTitle, int SMaxLen) { sprintf(ATitle, "Messages: %s", Command); strncpy(ASTitle, "Messages", SMaxLen); ASTitle[SMaxLen - 1] = 0; } // get row length for specified row, used in MoveLineEnd to get actual row length int EMessages::GetRowLength(int ARow) { if ((ARow >= 0) && (ARow < ErrCount)) { return strlen(ErrList[ARow]->text); } return 0; } efte-1.1/src/o_cvsdiff.h0000664000076400007640000000207211041404761014223 0ustar laurilauri/* * o_cvsdiff.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * Contributed by Martin Frydl * * Class showing output from CVS diff command. Allows copying of lines * to clipboard and allows to jump to lines in real sources. */ #ifndef __CVSDIFF_H__ #define __CVSDIFF_H__ class ECvsDiff: public ECvsBase { public: int CurrLine, ToLine, InToFile; char *CurrFile; ECvsDiff(int createFlags, EModel **ARoot, char *Dir, char *ACommand, char *AOnFiles); ~ECvsDiff(); void ParseFromTo(char *line, int len); virtual void ParseLine(char *line, int len); // Returns 0 if OK virtual int RunPipe(char *Dir, char *Command, char *Info); virtual int ExecCommand(int Command, ExState &State); int BlockCopy(int Append); virtual int GetContext() { return CONTEXT_CVSDIFF; } virtual EEventMap *GetEventMap(); }; extern ECvsDiff *CvsDiffView; #endif efte-1.1/src/clip_pmv.cpp0000664000076400007640000003730111041404761014430 0ustar laurilauri/* clip_pm.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1998, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "clip.h" #define INCL_WIN #define INCL_DOS #define INCL_ORDINALS #include #include #include /* * Pointers to PM functions * Instead of calling PM directly, we are obtaining these pointers * on first access to clipboard. * All these prototypes are copied from OS2.H * Note: all prototypes are 32-bit version only */ #define ORD_WIN32ADDATOM 700 #define ORD_WIN32ALARM 701 #define ORD_WIN32BEGINENUMWINDOWS 702 #define ORD_WIN32BEGINPAINT 703 #define ORD_WIN32CALCFRAMERECT 704 #define ORD_WIN32CANCELSHUTDOWN 705 #define ORD_WIN32CLOSECLIPBRD 707 #define ORD_WIN32COMPARESTRINGS 708 #define ORD_WIN32COPYACCELTABLE 709 #define ORD_WIN32COPYRECT 710 #define ORD_WIN32CPTRANSLATECHAR 711 #define ORD_WIN32CPTRANSLATESTRING 712 #define ORD_WIN32CREATEACCELTABLE 713 #define ORD_WIN32CREATEATOMTABLE 714 #define ORD_WIN32CREATECURSOR 715 #define ORD_WIN32CREATEMSGQUEUE 716 #define ORD_WIN32CREATEPOINTER 717 #define ORD_WIN32DDEINITIATE 718 #define ORD_WIN32DDEPOSTMSG 719 #define ORD_WIN32DDERESPOND 720 #define ORD_WIN32DELETEATOM 721 #define ORD_WIN32DELETELIBRARY 722 #define ORD_WIN32DESTROYACCELTABLE 723 #define ORD_WIN32DESTROYATOMTABLE 724 #define ORD_WIN32DESTROYCURSOR 725 #define ORD_WIN32DESTROYMSGQUEUE 726 #define ORD_WIN32DESTROYPOINTER 727 #define ORD_WIN32DESTROYWINDOW 728 #define ORD_WIN32DISMISSDLG 729 #define ORD_WIN32DRAWBITMAP 730 #define ORD_WIN32DRAWBORDER 731 #define ORD_WIN32DRAWPOINTER 732 #define ORD_WIN32EMPTYCLIPBRD 733 #define ORD_WIN32ENABLEPHYSINPUT 734 #define ORD_WIN32ENABLEWINDOW 735 #define ORD_WIN32ENABLEWINDOWUPDATE 736 #define ORD_WIN32ENDENUMWINDOWS 737 #define ORD_WIN32ENDPAINT 738 #define ORD_WIN32ENUMCLIPBRDFMTS 739 #define ORD_WIN32ENUMDLGITEM 740 #define ORD_WIN32EQUALRECT 741 #define ORD_WIN32EXCLUDEUPDATEREGION 742 #define ORD_WIN32FILLRECT 743 #define ORD_WIN32FINDATOM 744 #define ORD_WIN32FLASHWINDOW 745 #define ORD_WIN32FOCUSCHANGE 746 #define ORD_WIN32FREEERRORINFO 748 #define ORD_WIN32GETCLIPPS 749 #define ORD_WIN32GETCURRENTTIME 750 #define ORD_WIN32GETERRORINFO 751 #define ORD_WIN32GETKEYSTATE 752 #define ORD_WIN32GETLASTERROR 753 #define ORD_WIN32GETMAXPOSITION 754 #define ORD_WIN32GETMINPOSITION 755 #define ORD_WIN32GETNEXTWINDOW 756 #define ORD_WIN32GETPS 757 #define ORD_WIN32GETPHYSKEYSTATE 758 #define ORD_WIN32GETSCREENPS 759 #define ORD_WIN32GETSYSBITMAP 760 #define ORD_WIN32INSENDMSG 761 #define ORD_WIN32INFLATERECT 762 #define ORD_WIN32INITIALIZE 763 #define ORD_WIN32INTERSECTRECT 764 #define ORD_WIN32INVALIDATERECT 765 #define ORD_WIN32INVALIDATEREGION 766 #define ORD_WIN32INVERTRECT 767 #define ORD_WIN32ISCHILD 768 #define ORD_WIN32ISPHYSINPUTENABLED 769 #define ORD_WIN32ISRECTEMPTY 770 #define ORD_WIN32ISTHREADACTIVE 771 #define ORD_WIN32ISWINDOW 772 #define ORD_WIN32ISWINDOWENABLED 773 #define ORD_WIN32ISWINDOWSHOWING 774 #define ORD_WIN32ISWINDOWVISIBLE 775 #define ORD_WIN32LOADACCELTABLE 776 #define ORD_WIN32LOADLIBRARY 777 #define ORD_WIN32LOADMENU 778 #define ORD_WIN32LOADMESSAGE 779 #define ORD_WIN32LOADPOINTER 780 #define ORD_WIN32LOADSTRING 781 #define ORD_WIN32LOCKVISREGIONS 782 #define ORD_WIN32LOCKWINDOWUPDATE 784 #define ORD_WIN32MAKEPOINTS 785 #define ORD_WIN32MAKERECT 786 #define ORD_WIN32MAPDLGPOINTS 787 #define ORD_WIN32MAPWINDOWPOINTS 788 #define ORD_WIN32MESSAGEBOX 789 #define ORD_WIN32MSGSEMWAIT 790 #define ORD_WIN32NEXTCHAR 791 #define ORD_WIN32OFFSETRECT 792 #define ORD_WIN32OPENCLIPBRD 793 #define ORD_WIN32OPENWINDOWDC 794 #define ORD_WIN32PREVCHAR 795 #define ORD_WIN32PROCESSDLG 796 #define ORD_WIN32PTINRECT 797 #define ORD_WIN32QUERYACCELTABLE 798 #define ORD_WIN32QUERYACTIVEWINDOW 799 #define ORD_WIN32QUERYANCHORBLOCK 800 #define ORD_WIN32QUERYATOMLENGTH 801 #define ORD_WIN32QUERYATOMNAME 802 #define ORD_WIN32QUERYATOMUSAGE 803 #define ORD_WIN32QUERYCAPTURE 804 #define ORD_WIN32QUERYCLASSNAME 805 #define ORD_WIN32QUERYCLIPBRDDATA 806 #define ORD_WIN32QUERYCLIPBRDFMTINFO 807 #define ORD_WIN32QUERYCLIPBRDOWNER 808 #define ORD_WIN32QUERYCLIPBRDVIEWER 809 #define ORD_WIN32QUERYCP 810 #define ORD_WIN32QUERYCPLIST 811 #define ORD_WIN32QUERYCURSORINFO 812 #define ORD_WIN32QUERYDESKTOPWINDOW 813 #define ORD_WIN32QUERYDLGITEMSHORT 814 #define ORD_WIN32QUERYDLGITEMTEXT 815 #define ORD_WIN32QUERYDLGITEMTEXTLENGTH 816 #define ORD_WIN32QUERYFOCUS 817 #define ORD_WIN32QUERYMSGPOS 818 #define ORD_WIN32QUERYMSGTIME 819 #define ORD_WIN32QUERYOBJECTWINDOW 820 #define ORD_WIN32QUERYPOINTER 821 #define ORD_WIN32QUERYPOINTERINFO 822 #define ORD_WIN32QUERYPOINTERPOS 823 #define ORD_WIN32QUERYQUEUEINFO 824 #define ORD_WIN32QUERYQUEUESTATUS 825 #define ORD_WIN32QUERYSYSCOLOR 826 #define ORD_WIN32QUERYSYSMODALWINDOW 827 #define ORD_WIN32QUERYSYSPOINTER 828 #define ORD_WIN32QUERYSYSVALUE 829 #define ORD_WIN32QUERYSYSTEMATOMTABLE 830 #define ORD_WIN32QUERYUPDATERECT 831 #define ORD_WIN32QUERYUPDATEREGION 832 #define ORD_WIN32QUERYVERSION 833 #define ORD_WIN32QUERYWINDOW 834 #define ORD_WIN32QUERYWINDOWDC 835 #define ORD_WIN32QUERYWINDOWPOS 837 #define ORD_WIN32QUERYWINDOWPROCESS 838 #define ORD_WIN32QUERYWINDOWPTR 839 #define ORD_WIN32QUERYWINDOWRECT 840 #define ORD_WIN32QUERYWINDOWTEXT 841 #define ORD_WIN32QUERYWINDOWTEXTLENGTH 842 #define ORD_WIN32QUERYWINDOWULONG 843 #define ORD_WIN32QUERYWINDOWUSHORT 844 #define ORD_WIN32REGISTERUSERDATATYPE 845 #define ORD_WIN32REGISTERUSERMSG 846 #define ORD_WIN32RELEASEPS 848 #define ORD_WIN32SCROLLWINDOW 849 #define ORD_WIN32SETACCELTABLE 850 #define ORD_WIN32SETACTIVEWINDOW 851 #define ORD_WIN32SETCAPTURE 852 #define ORD_WIN32SETCLASSMSGINTEREST 853 #define ORD_WIN32SETCLIPBRDDATA 854 #define ORD_WIN32SETCLIPBRDOWNER 855 #define ORD_WIN32SETCLIPBRDVIEWER 856 #define ORD_WIN32SETCP 857 #define ORD_WIN32SETDLGITEMSHORT 858 #define ORD_WIN32SETDLGITEMTEXT 859 #define ORD_WIN32SETFOCUS 860 #define ORD_WIN32SETMSGINTEREST 861 #define ORD_WIN32SETMSGMODE 862 #define ORD_WIN32SETMULTWINDOWPOS 863 #define ORD_WIN32SETOWNER 864 #define ORD_WIN32SETPARENT 865 #define ORD_WIN32SETPOINTER 866 #define ORD_WIN32SETPOINTERPOS 867 #define ORD_WIN32SETRECT 868 #define ORD_WIN32SETRECTEMPTY 869 #define ORD_WIN32SETSYNCHROMODE 870 #define ORD_WIN32SETSYSCOLORS 871 #define ORD_WIN32SETSYSMODALWINDOW 872 #define ORD_WIN32SETSYSVALUE 873 #define ORD_WIN32SETWINDOWBITS 874 #define ORD_WIN32SETWINDOWPOS 875 #define ORD_WIN32SETWINDOWPTR 876 #define ORD_WIN32SETWINDOWTEXT 877 #define ORD_WIN32SETWINDOWULONG 878 #define ORD_WIN32SETWINDOWUSHORT 879 #define ORD_WIN32SHOWCURSOR 880 #define ORD_WIN32SHOWPOINTER 881 #define ORD_WIN32SHOWTRACKRECT 882 #define ORD_WIN32SHOWWINDOW 883 #define ORD_WIN32STARTTIMER 884 #define ORD_WIN32STOPTIMER 885 #define ORD_WIN32SUBSTITUTESTRINGS 886 #define ORD_WIN32SUBTRACTRECT 887 #define ORD_WIN32TERMINATE 888 #define ORD_WIN32TRACKRECT 890 #define ORD_WIN32UNIONRECT 891 #define ORD_WIN32UPDATEWINDOW 892 #define ORD_WIN32UPPER 893 #define ORD_WIN32UPPERCHAR 894 #define ORD_WIN32VALIDATERECT 895 #define ORD_WIN32VALIDATEREGION 896 #define ORD_WIN32WAITMSG 897 #define ORD_WIN32WINDOWFROMDC 898 #define ORD_WIN32WINDOWFROMID 899 #define ORD_WIN32WINDOWFROMPOINT 900 #define ORD_WIN32BROADCASTMSG 901 #define ORD_WIN32POSTQUEUEMSG 902 #define ORD_WIN32SENDDLGITEMMSG 903 #define ORD_WIN32TRANSLATEACCEL 904 #define ORD_WIN32CALLMSGFILTER 905 #define ORD_WIN32CREATEFRAMECONTROLS 906 #define ORD_WIN32CREATEMENU 907 #define ORD_WIN32CREATESTDWINDOW 908 #define ORD_WIN32CREATEWINDOW 909 #define ORD_WIN32DEFDLGPROC 910 #define ORD_WIN32DEFWINDOWPROC 911 #define ORD_WIN32DISPATCHMSG 912 #define ORD_WIN32DRAWTEXT 913 #define ORD_WIN32GETDLGMSG 914 #define ORD_WIN32GETMSG 915 #define ORD_WIN32MSGMUXSEMWAIT 916 #define ORD_WIN32MULTWINDOWFROMIDS 917 #define ORD_WIN32PEEKMSG 918 #define ORD_WIN32POSTMSG 919 #define ORD_WIN32SENDMSG 920 #define ORD_WIN32SETKEYBOARDSTATETABLE 921 #define ORD_WIN32CREATEDLG 922 #define ORD_WIN32DLGBOX 923 #define ORD_WIN32LOADDLG 924 #define ORD_WIN32QUERYCLASSINFO 925 #define ORD_WIN32REGISTERCLASS 926 #define ORD_WIN32RELEASEHOOK 927 #define ORD_WIN32SETHOOK 928 #define ORD_WIN32SUBCLASSWINDOW 929 #define ORD_WIN32SETCLASSTHUNKPROC 930 #define ORD_WIN32QUERYCLASSTHUNKPROC 931 #define ORD_WIN32SETWINDOWTHUNKPROC 932 #define ORD_WIN32QUERYWINDOWTHUNKPROC 933 #define ORD_WIN32QUERYWINDOWMODEL 934 #define ORD_WIN32SETDESKTOPBKGND 935 #define ORD_WIN32QUERYDESKTOPBKGND 936 #define ORD_WIN32POPUPMENU 937 #define ORD_WIN32SETPRESPARAM 938 #define ORD_WIN32QUERYPRESPARAM 939 #define ORD_WIN32REMOVEPRESPARAM 940 #define ORD_WIN32REALIZEPALETTE 941 #define ORD_WIN32CREATEPOINTERINDIRECT 942 #define ORD_WIN32SAVEWINDOWPOS 943 #define ORD_WIN32GETERASEPS 952 #define ORD_WIN32RELEASEERASEPS 953 #define ORD_WIN32SETPOINTEROWNER 971 #define ORD_WIN32STRETCHPOINTER 968 #define ORD_WIN32SETERRORINFO 977 #define ORD_WIN32WAITEVENTSEM 978 #define ORD_WIN32REQUESTMUTEXSEM 979 #define ORD_WIN32WAITMUXWAITSEM 980 #ifndef INCL_32 #error Prototypes are for 32-bit compiler only #endif HAB(APIENTRY *p_WinInitialize)(ULONG flOptions); BOOL (APIENTRY *p_WinTerminate)(HAB hab); HMQ(APIENTRY *p_WinCreateMsgQueue)(HAB hab, LONG cmsg); BOOL (APIENTRY *p_WinDestroyMsgQueue)(HMQ hmq); BOOL (APIENTRY *p_WinEmptyClipbrd)(HAB hab); BOOL (APIENTRY *p_WinOpenClipbrd)(HAB hab); BOOL (APIENTRY *p_WinCloseClipbrd)(HAB hab); BOOL (APIENTRY *p_WinSetClipbrdData)(HAB hab, ULONG ulData, ULONG fmt, ULONG rgfFmtInfo); ULONG(APIENTRY *p_WinQueryClipbrdData)(HAB hab, ULONG fmt); static struct impentry { ULONG ordinal; PFN *pointer; } imported_functions[] = { { ORD_WIN32INITIALIZE, (PFN *) &p_WinInitialize }, { ORD_WIN32TERMINATE, (PFN *) &p_WinTerminate }, { ORD_WIN32CREATEMSGQUEUE, (PFN *) &p_WinCreateMsgQueue }, { ORD_WIN32DESTROYMSGQUEUE, (PFN *) &p_WinDestroyMsgQueue }, { ORD_WIN32EMPTYCLIPBRD, (PFN *) &p_WinEmptyClipbrd }, { ORD_WIN32OPENCLIPBRD, (PFN *) &p_WinOpenClipbrd }, { ORD_WIN32CLOSECLIPBRD, (PFN *) &p_WinCloseClipbrd }, { ORD_WIN32SETCLIPBRDDATA, (PFN *) &p_WinSetClipbrdData }, { ORD_WIN32QUERYCLIPBRDDATA, (PFN *)&p_WinQueryClipbrdData }, { 0, 0 } }; /* * Load PMWIN.DLL and get pointers to all reqd PM functions */ static BOOL loadDLL(void) { static BOOL loaded = FALSE; static BOOL loaded_ok = FALSE; static HMODULE pmwin; char error[200]; if (loaded == TRUE) return loaded_ok; loaded = TRUE; if (DosLoadModule((PSZ)error, sizeof(error), (PSZ)"PMWIN.DLL", &pmwin) == 0) { struct impentry *imp; for (imp = imported_functions; imp->ordinal; imp++) if (DosQueryProcAddr(pmwin, imp->ordinal, NULL, imp->pointer) != 0) return FALSE; loaded_ok = TRUE; } return loaded_ok; } /* AccessPmClipboard: Purpose: perform all necessary PM stuff and open clipboard for access; Return : TRUE on success, FALSE on error; Note : on error, clipboard is released automatically. LeavePmClipboard: Purpose: releases previously opened clipboard and clear all PM stuff Return : none */ static struct { PPIB ppib; HAB hab; HMQ hmq; ULONG savedtype; BOOL opened; } PmInfo; static void LeavePmClipboard(void) { if (PmInfo.opened) p_WinCloseClipbrd(PmInfo.hab); if (PmInfo.hmq) p_WinDestroyMsgQueue(PmInfo.hmq); if (PmInfo.hab) p_WinTerminate(PmInfo.hab); PmInfo.ppib->pib_ultype = PmInfo.savedtype; } static BOOL AccessPmClipboard(void) { PTIB ptib; if (loadDLL() == FALSE) { DosBeep(100, 1500); return FALSE; } memset(&PmInfo, 0, sizeof(PmInfo)); // mutate into PM application for clipboard (Win**) functions access DosGetInfoBlocks(&ptib, &PmInfo.ppib); PmInfo.savedtype = PmInfo.ppib->pib_ultype; PmInfo.ppib->pib_ultype = PROG_PM; if ((PmInfo.hab = p_WinInitialize(0)) != NULLHANDLE) { if ((PmInfo.hmq = p_WinCreateMsgQueue(PmInfo.hab, 0)) != NULLHANDLE) { if (p_WinOpenClipbrd(PmInfo.hab) == TRUE) { PmInfo.opened = TRUE; } } } if (PmInfo.opened != TRUE) { LeavePmClipboard(); DosBeep(100, 1500); } return PmInfo.opened; } int GetClipText(ClipData *cd) { int rc = -1; char *text; cd->fLen = 0; cd->fChar = 0; if (AccessPmClipboard() != TRUE) return rc; if ((text = (char *) p_WinQueryClipbrdData(PmInfo.hab, CF_TEXT)) != 0) { cd->fLen = strlen(text); cd->fChar = strdup(text); rc = 0; } LeavePmClipboard(); return rc; } int PutClipText(ClipData *cd) { ULONG len; void *text; int rc = -1; if (AccessPmClipboard() != TRUE) return rc; p_WinEmptyClipbrd(PmInfo.hab); len = cd->fLen; if (len) { DosAllocSharedMem((void **)&text, 0, len + 1, PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE); strncpy((char *)text, cd->fChar, len + 1); if (!p_WinSetClipbrdData(PmInfo.hab, (ULONG) text, CF_TEXT, CFI_POINTER)) DosBeep(100, 1500); else rc = 0; } LeavePmClipboard(); return rc; } efte-1.1/src/e_block.cpp0000664000076400007640000006762111041404761014225 0ustar laurilauri/* e_block.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" /////////////////////////////////////////////////////////////////////////////// // Block Commands // /////////////////////////////////////////////////////////////////////////////// int EBuffer::SetBB(EPoint M) { EPoint OldBB = BB; int MinL, MaxL; if (BB.Row == M.Row && BB.Col == M.Col) return 1; if (PushBlockData() == 0) return 0; BB = M; if (OldBB.Row == -1) OldBB = BE; if ((OldBB.Col != BB.Col) && (BlockMode == bmColumn)) BlockRedraw(); MinL = Min(OldBB.Row, BB.Row); MaxL = Max(OldBB.Row, BB.Row); if (MinL != -1) if (MinL <= MaxL) Draw(MinL, MaxL); return 1; } int EBuffer::SetBE(EPoint M) { EPoint OldBE = BE; int MinL, MaxL; if (BE.Row == M.Row && BE.Col == M.Col) return 1; if (PushBlockData() == 0) return 0; BE = M; if (OldBE.Row == -1) OldBE = BB; if ((OldBE.Col != BE.Col) && (BlockMode == bmColumn)) BlockRedraw(); MinL = Min(OldBE.Row, BE.Row); MaxL = Max(OldBE.Row, BE.Row); if (MinL != -1) if (MinL <= MaxL) Draw(MinL, MaxL); return 1; } // check if there is active or valid selection int EBuffer::CheckBlock() { if (BB.Row == -1 && BE.Row == 1) { BB.Col = -1; BE.Col = -1; return 0; } if (BB.Row == -1 || BE.Row == -1) return 0; if (BB.Row >= RCount) BB.Row = RCount - 1; if (BE.Row >= RCount) BE.Row = RCount - 1; switch (BlockMode) { case bmLine: BB.Col = 0; BE.Col = 0; if (BB.Row >= BE.Row) return 0; break; case bmColumn: if (BB.Col >= BE.Col) return 0; if (BB.Row >= BE.Row) return 0; break; case bmStream: if (BB.Row > BE.Row) return 0; if (BB.Row == BE.Row && BB.Col >= BE.Col) return 0; break; } return 1; } int EBuffer::BlockRedraw() { if (BB.Row == -1 || BE.Row == -1) return 0; Draw(BB.Row, BE.Row); return 1; } int EBuffer::BlockBegin() { EPoint X; X.Row = VToR(CP.Row); X.Col = CP.Col; CheckBlock(); SetBB(X); return 1; } int EBuffer::BlockEnd() { EPoint X; X.Row = VToR(CP.Row); X.Col = CP.Col; CheckBlock(); SetBE(X); return 1; } int EBuffer::BlockUnmark() { EPoint Null(-1, -1); SetBB(BE); SetBE(Null); SetBB(Null); AutoExtend = 0; return 1; } int EBuffer::BlockCut(int Append) { if (BlockCopy(Append) && BlockKill()) return 1; return 0; } int EBuffer::BlockCopy(int Append, int clipboard) { EPoint B, E; int L; int SL, OldCount; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount == 0) return 0; if (SSBuffer == 0) return 0; if (Append) { if (SystemClipboard) GetPMClip(clipboard); } else SSBuffer->Clear(); SSBuffer->BlockMode = BlockMode; BFI(SSBuffer, BFI_TabSize) = BFI(this, BFI_TabSize); BFI(SSBuffer, BFI_ExpandTabs) = BFI(this, BFI_ExpandTabs); BFI(SSBuffer, BFI_Undo) = 0; B = BB; E = BE; OldCount = SL = SSBuffer->RCount; switch (BlockMode) { case bmLine: for (L = B.Row; L < E.Row; L++) { if (SSBuffer->InsLine(SL, 0) == 0) return 0; if (SSBuffer->InsLineText(SL, 0, -1, 0, RLine(L)) == 0) return 0; SL++; } break; case bmColumn: for (L = B.Row; L < E.Row; L++) { if (SSBuffer->InsLine(SL, 0) == 0) return 0; if (SSBuffer->InsLineText(SL, 0, E.Col - B.Col, B.Col, RLine(L)) == 0) return 0; if (SSBuffer->PadLine(SL, E.Col - B.Col) == 0) return 0; SL++; } break; case bmStream: if (B.Row == E.Row) { if (SSBuffer->InsLine(SL, 0) == 0) return 0; if (SSBuffer->InsLineText(SL, 0, E.Col - B.Col, B.Col, RLine(B.Row)) == 0) return 0; } else { if (SSBuffer->InsLine(SL, 0) == 0) return 0; if (SSBuffer->InsLineText(SL, 0, -1, B.Col, RLine(B.Row)) == 0) return 0; SL++; for (L = B.Row + 1; L < E.Row; L++) { if (SSBuffer->InsLine(SL, 0) == 0) return 0; if (SSBuffer->InsLineText(SL, 0, -1, 0, RLine(L)) == 0) return 0; SL++; } if (SSBuffer->InsLine(SL, 0) == 0) return 0; if (SSBuffer->InsLineText(SL, 0, E.Col, 0, RLine(E.Row)) == 0) return 0; } if (Append && OldCount > 0) if (SSBuffer->JoinLine(OldCount - 1, 0) == 0) return 0; break; } if (SystemClipboard) PutPMClip(clipboard); return 1; } int EBuffer::BlockPasteStream(int clipboard) { BlockMode = bmStream; return BlockPaste(clipboard); } int EBuffer::BlockPasteLine(int clipboard) { BlockMode = bmLine; return BlockPaste(clipboard); } int EBuffer::BlockPasteColumn(int clipboard) { BlockMode = bmColumn; return BlockPaste(clipboard); } int EBuffer::BlockPaste(int clipboard) { EPoint B, E; int L, BL; if (SystemClipboard) GetPMClip(clipboard); if (SSBuffer == 0) return 0; if (SSBuffer->RCount == 0) return 0; AutoExtend = 0; BFI(SSBuffer, BFI_TabSize) = BFI(this, BFI_TabSize); BFI(SSBuffer, BFI_ExpandTabs) = BFI(this, BFI_ExpandTabs); BFI(SSBuffer, BFI_Undo) = 0; BlockUnmark(); B.Row = VToR(CP.Row); B.Col = CP.Col; BL = B.Row; switch (BlockMode) { case bmLine: B.Col = 0; for (L = 0; L < SSBuffer->RCount; L++) { if (InsLine(BL, 0) == 0) return 0; if (InsLineText(BL, 0, SSBuffer->LineLen(L), 0, SSBuffer->RLine(L)) == 0) return 0; BL++; } E.Row = BL; E.Col = 0; SetBB(B); SetBE(E); break; case bmColumn: for (L = 0; L < SSBuffer->RCount; L++) { if (AssertLine(BL) == 0) return 0; if (InsLineText(BL, B.Col, SSBuffer->LineLen(L), 0, SSBuffer->RLine(L)) == 0) return 0; if (TrimLine(BL) == 0) return 0; BL++; } if (AssertLine(BL) == 0) return 0; E.Row = BL; E.Col = B.Col + SSBuffer->LineLen(0); SetBB(B); SetBE(E); break; case bmStream: if (SSBuffer->RCount > 1) if (SplitLine(B.Row, B.Col) == 0) return 0; if (InsLineText(B.Row, B.Col, SSBuffer->LineLen(0), 0, SSBuffer->RLine(0)) == 0) return 0; E = B; E.Col += SSBuffer->LineLen(0); BL++; if (SSBuffer->RCount > 1) { for (L = 1; L < SSBuffer->RCount - 1; L++) { if (InsLine(BL, 0) == 0) return 0; if (InsLineText(BL, 0, SSBuffer->LineLen(L), 0, SSBuffer->RLine(L)) == 0) return 0; BL++; } L = SSBuffer->RCount - 1; if (InsLineText(BL, 0, SSBuffer->LineLen(L), 0, SSBuffer->RLine(L)) == 0) return 0; E.Col = SSBuffer->LineLen(L); E.Row = BL; } SetBB(B); SetBE(E); break; } return 1; } int EBuffer::BlockKill() { EPoint B, E; int L; int Y = -1; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, -1); // if (MoveToPos(B.Col, B.Row) == 0) return 0; if (BFI(this, BFI_Undo) == 1) { if (PushULong(CP.Col) == 0) return 0; if (PushULong(CP.Row) == 0) return 0; if (PushUChar(ucPosition) == 0) return 0; } switch (BlockMode) { case bmLine: Y = VToR(CP.Row); if (Y >= B.Row) { if (Y >= E.Row) { if (SetPosR(CP.Col, Y - (E.Row - B.Row)) == 0) return 0; } else { if (SetPosR(CP.Col, B.Row) == 0) return 0; } } for (L = B.Row; L < E.Row; L++) if (DelLine(B.Row) == 0) return 0; break; case bmColumn: Y = VToR(CP.Row); if (Y >= B.Row && Y < E.Row) { if (CP.Col >= B.Col) { if (CP.Col >= E.Col) { if (SetPos(CP.Col - (E.Col - B.Col), CP.Row) == 0) return 0; } else { if (SetPos(B.Col, CP.Row) == 0) return 0; } } } for (L = B.Row; L < E.Row; L++) if (DelText(L, B.Col, E.Col - B.Col) == 0) return 0; break; case bmStream: Y = VToR(CP.Row); if (B.Row == E.Row) { if (Y == B.Row) { if (CP.Col >= B.Col) { if (CP.Col >= E.Col) { if (SetPos(CP.Col - (E.Col - B.Col), CP.Row) == 0) return 0; } else { if (SetPos(B.Col, CP.Row) == 0) return 0; } } } if (DelText(B.Row, B.Col, E.Col - B.Col) == 0) return 0; } else { if (Y >= B.Row) { if (Y > E.Row || (Y == E.Row && E.Col == 0)) { if (SetPosR(CP.Col, Y - (E.Row - B.Row)) == 0) return 0; } else if (Y == E.Row) { if (CP.Col >= E.Col) { if (SetPosR(CP.Col - E.Col + B.Col, B.Row) == 0) return 0; } else { if (SetPosR(B.Col, B.Row) == 0) return 0; } } else { if (SetPosR(B.Col, B.Row) == 0) return 0; } } if (DelText(E.Row, 0, E.Col) == 0) return 0; for (L = B.Row + 1; L < E.Row; L++) if (DelLine(B.Row + 1) == 0) return 0; if (DelText(B.Row, B.Col, -1) == 0) return 0; if (JoinLine(B.Row, B.Col) == 0) return 0; } break; } return BlockUnmark(); } // remove selected text and paste information from clipboard to replace it int EBuffer::BlockPasteOver(int clipboard) { // if there is existing selection, remove it's contents if (CheckBlock()) { BlockKill(); } // paste text from clipboard if (BlockPaste(clipboard)) { // go to end of selection SetPos(BE.Col, BE.Row); // remove selection return BlockUnmark(); } return 0; } // XXX clipboard ??? int EBuffer::ClipClear(int clipboard) { if (SSBuffer == 0) return 0; SSBuffer->Clear(); if (SystemClipboard) PutPMClip(clipboard); return 1; } int EBuffer::BlockIndent() { EPoint B, E; int L; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, E.Row); if (SetPosR(B.Col, B.Row) == 0) return 0; for (L = B.Row; L <= E.Row; L++) { switch (BlockMode) { case bmStream: case bmLine: if (L < E.Row || E.Col != 0) { int I = LineIndented(L) + 1; IndentLine(L, I); } break; case bmColumn: if (L < E.Row) { if (InsText(L, B.Col, 1, 0) == 0) return 0; if (DelText(L, E.Col, 1) == 0) return 0; } break; } } if (SetPosR(B.Col, B.Row) == 0) return 0; return 1; } int EBuffer::BlockUnindent() { EPoint B, E; int L; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, E.Row); if (SetPosR(B.Col, B.Row) == 0) return 0; for (L = B.Row; L <= E.Row; L++) { switch (BlockMode) { case bmStream: case bmLine: if (L < E.Row || E.Col != 0) { int I = LineIndented(L) - 1; if (I >= 0) IndentLine(L, I); } break; case bmColumn: if (L < E.Row) { if (InsText(L, E.Col, 1, 0) == 0) return 0; if (DelText(L, B.Col, 1) == 0) return 0; } break; } } if (SetPosR(B.Col, B.Row) == 0) return 0; return 1; } int EBuffer::BlockClear() { return 0; } int EBuffer::BlockMarkStream() { if (BlockMode != bmStream) BlockUnmark(); BlockMode = bmStream; if (AutoExtend) AutoExtend = 0; else { BlockUnmark(); AutoExtend = 1; } return 1; } int EBuffer::BlockMarkLine() { if (BlockMode != bmLine) BlockUnmark(); BlockMode = bmLine; if (AutoExtend) AutoExtend = 0; else { BlockUnmark(); AutoExtend = 1; } return 1; } int EBuffer::BlockMarkColumn() { if (BlockMode != bmColumn) BlockUnmark(); BlockMode = bmColumn; if (AutoExtend) AutoExtend = 0; else { BlockUnmark(); AutoExtend = 1; } return 1; } int EBuffer::BlockExtendBegin() { CheckBlock(); ExtendGrab = 0; AutoExtend = 0; int Y = VToR(CP.Row); switch (BlockMode) { case bmStream: if ((Y == BB.Row) && (CP.Col == BB.Col)) ExtendGrab |= 1; if ((Y == BE.Row) && (CP.Col == BE.Col)) ExtendGrab |= 2; break; case bmLine: if (Y == BB.Row) ExtendGrab |= 1; if (Y == BE.Row) ExtendGrab |= 2; break; case bmColumn: if (Y == BB.Row) ExtendGrab |= 1; if (Y == BE.Row) ExtendGrab |= 2; if (CP.Col == BB.Col) ExtendGrab |= 4; if (CP.Col == BE.Col) ExtendGrab |= 8; break; } if (ExtendGrab == 0) { BlockBegin(); BlockEnd(); if (BlockMode == bmColumn) ExtendGrab = 1 | 2 | 4 | 8; else ExtendGrab = 1 | 2; } return 1; } int EBuffer::BlockExtendEnd() { EPoint T, B, E; CheckBlock(); B = BB; E = BE; switch (BlockMode) { case bmLine: if (ExtendGrab & 1) { B.Row = VToR(CP.Row); B.Col = 0; } else if (ExtendGrab & 2) { E.Row = VToR(CP.Row); E.Col = 0; } if (B.Row > E.Row) { T = B; B = E; E = T; } break; case bmStream: if (ExtendGrab & 1) { B.Col = CP.Col; B.Row = VToR(CP.Row); } else if (ExtendGrab & 2) { E.Col = CP.Col; E.Row = VToR(CP.Row); } if ((B.Row > E.Row) || ((B.Row == E.Row) && (B.Col > E.Col))) { T = B; B = E; E = T; } break; case bmColumn: if (ExtendGrab & 1) B.Row = VToR(CP.Row); else if (ExtendGrab & 2) E.Row = VToR(CP.Row); if (ExtendGrab & 4) B.Col = CP.Col; else if (ExtendGrab & 8) E.Col = CP.Col; if (B.Row > E.Row) { int T; T = B.Row; B.Row = E.Row; E.Row = T; } if (B.Col > E.Col) { int T; T = B.Col; B.Col = E.Col; E.Col = T; } break; } SetBB(B); SetBE(E); ExtendGrab = 0; AutoExtend = 0; return 1; } int EBuffer::BlockIsMarked() { if ((BB.Row != -1) && (BE.Row != -1) && (BB.Col != -1) && (BE.Col != -1)) return 1; return 0; } int EBuffer::BlockReIndent() { EPoint P = CP; EPoint B, E; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, E.Row); for (int i = B.Row; i < E.Row; i++) { if (SetPosR(0, i) == 0) return 0; if (LineIndent() == 0) return 0; } return SetPos(P.Col, P.Row); } int EBuffer::BlockSelectWord() { int Y = VToR(CP.Row); PELine L = RLine(Y); int P; int C; if (BlockUnmark() == 0) return 0; BlockMode = bmStream; P = CharOffset(L, CP.Col); if (P >= L->Count) return 0; C = ChClassK(L->Chars[P]); while ((P > 0) && (C == ChClassK(L->Chars[P - 1]))) P--; if (SetBB(EPoint(Y, ScreenPos(L, P))) == 0) return 0; while ((P < L->Count) && (C == ChClassK(L->Chars[P]))) P++; if (SetBE(EPoint(Y, ScreenPos(L, P))) == 0) return 0; return 1; } int EBuffer::BlockSelectLine() { int Y = VToR(CP.Row); if (BlockUnmark() == 0) return 0; BlockMode = bmStream; if (SetBB(EPoint(Y, 0)) == 0) return 0; if (Y == RCount - 1) { if (SetBE(EPoint(Y, LineLen(Y))) == 0) return 0; } else { if (SetBE(EPoint(Y + 1, 0)) == 0) return 0; } return 1; } int EBuffer::BlockSelectPara() { return 1; } int EBuffer::BlockWriteTo(const char *AFileName, int Append) { //int error = 0; EPoint B, E; int L; PELine LL; int A, Z; FILE *fp; int bc = 0, lc = 0, oldc = 0; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount == 0) return 0; B = BB; E = BE; Msg(S_INFO, "Writing %s...", AFileName); fp = fopen(AFileName, Append ? "ab" : "wb"); if (fp == NULL) goto error; setvbuf(fp, FileBuffer, _IOFBF, sizeof(FileBuffer)); for (L = B.Row; L <= E.Row; L++) { A = -1; Z = -1; LL = RLine(L); switch (BlockMode) { case bmLine: if (L < E.Row) { A = 0; Z = LL->Count; } break; case bmColumn: if (L < E.Row) { A = CharOffset(LL, B.Col); Z = CharOffset(LL, E.Col); } break; case bmStream: if (B.Row == E.Row) { A = CharOffset(LL, B.Col); Z = CharOffset(LL, E.Col); } else if (L == B.Row) { A = CharOffset(LL, B.Col); Z = LL->Count; } else if (L < E.Row) { A = 0; Z = LL->Count; } else if (L == E.Row) { A = 0; Z = CharOffset(LL, E.Col); } break; } if (A != -1 && Z != -1) { if (A < LL->Count) { if (Z > LL->Count) Z = LL->Count; if (Z > A) { if ((int)fwrite(LL->Chars + A, 1, Z - A, fp) != Z - A) { goto error; } else bc += Z - A; } } if (BFI(this, BFI_AddCR) == 1) if (fputc(13, fp) < 0) goto error; else bc++; if (BFI(this, BFI_AddLF) == 1) if (fputc(10, fp) < 0) goto error; else { bc++; lc++; } if (bc > 65536 + oldc) { Msg(S_INFO, "Writing %s, %d lines, %d bytes.", AFileName, lc, bc); oldc = bc; } } } fclose(fp); Msg(S_INFO, "Wrote %s, %d lines, %d bytes.", AFileName, lc, bc); return 1; error: if (fp != NULL) { fclose(fp); unlink(AFileName); } View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Failed to write block to %s", AFileName); return 0; } int EBuffer::BlockReadFrom(const char *AFileName, int blockMode) { EBuffer *B; int savesys; int rc; if (FileExists(AFileName) == 0) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "File not found: %s", AFileName); return 0; } B = new EBuffer(0, (EModel **)&SSBuffer, AFileName); if (B == 0) return 0; B->SetFileName(AFileName, 0); if (B->Load() == 0) { delete B; return 0; } savesys = SystemClipboard; SystemClipboard = 0; switch (blockMode) { case bmColumn: rc = BlockPasteColumn(); break; case bmLine: rc = BlockPasteLine(); break; default: case bmStream: rc = BlockPasteStream(); break; } SystemClipboard = savesys; if (rc == 0) return 0; delete B; return 1; } static EBuffer *SortBuffer; static int SortReverse; static int *SortRows = 0; static int SortMinRow; static int SortMaxRow; static int SortMinCol; static int SortMaxCol; static int _LNK_CONV SortProc(const void *A, const void *B) { int *AA = (int *)A; int *BB = (int *)B; ELine *LA = SortBuffer->RLine(*AA); ELine *LB = SortBuffer->RLine(*BB); int rc; if (SortMinCol == -1) { int lA = LA->Count; int lB = LB->Count; if (BFI(SortBuffer, BFI_MatchCase) == 1) rc = memcmp(LA->Chars, LB->Chars, (lA < lB) ? lA : lB); else rc = memicmp(LA->Chars, LB->Chars, (lA < lB) ? lA : lB); if (rc == 0) { if (lA > lB) rc = 1; else rc = -1; } } else { int lA = LA->Count; int lB = LB->Count; int PA = SortBuffer->CharOffset(LA, SortMinCol); int PB = SortBuffer->CharOffset(LB, SortMinCol); lA -= PA; lB -= PB; if (lA < 0 && lB < 0) rc = 0; else if (lA < 0 && lB > 0) rc = -1; else if (lA > 0 && lB < 0) rc = 1; else { if (SortMaxCol != -1) { if (lA > SortMaxCol - SortMinCol) lA = SortMaxCol - SortMinCol; if (lB > SortMaxCol - SortMinCol) lB = SortMaxCol - SortMinCol; } if (BFI(SortBuffer, BFI_MatchCase) == 1) rc = memcmp(LA->Chars + PA, LB->Chars + PB, (lA < lB) ? lA : lB); else rc = memicmp(LA->Chars + PA, LB->Chars + PB, (lA < lB) ? lA : lB); if (rc == 0) { if (lA > lB) rc = 1; else rc = -1; } } } if (SortReverse) return -rc; return rc; } int EBuffer::BlockSort(int Reverse) { int rq; ELine *oldL; if (CheckBlock() == 0) return 0; if (RCount == 0) return 0; SortMinRow = BB.Row; SortMaxRow = BE.Row; if (BlockMode != bmStream || BE.Col == 0) SortMaxRow--; if (SortMinRow >= SortMaxRow) return 1; SortBuffer = this; SortReverse = Reverse; switch (BlockMode) { case bmLine: case bmStream: SortMinCol = -1; SortMaxCol = -1; break; case bmColumn: SortMinCol = BB.Col; SortMaxCol = BE.Col; break; } SortRows = (int *)malloc((SortMaxRow - SortMinRow + 1) * sizeof(int)); if (SortRows == 0) { free(SortRows); return 0; } for (rq = 0; rq <= SortMaxRow - SortMinRow; rq++) SortRows[rq] = rq + SortMinRow; qsort(SortRows, SortMaxRow - SortMinRow + 1, sizeof(int), SortProc); // now change the order of lines according to new order in Rows array. for (rq = 0; rq <= SortMaxRow - SortMinRow; rq++) { oldL = RLine(SortRows[rq]); if (InsLine(1 + rq + SortMaxRow, 0) == 0) return 0; if (InsChars(1 + rq + SortMaxRow, 0, oldL->Count, oldL->Chars) == 0) return 0; } for (rq = 0; rq <= SortMaxRow - SortMinRow; rq++) if (DelLine(SortMinRow) == 0) return 0; free(SortRows); return 1; } int EBuffer::BlockUnTab() { EPoint B, E; ELine *L; int O, C; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, E.Row); for (int i = B.Row; i < E.Row; i++) { L = RLine(i); O = 0; C = 0; while (O < L->Count) { if (L->Chars[O] == '\t') { C = NextTab(C, BFI(this, BFI_TabSize)); if (DelChars(i, O, 1) != 1) return 0; if (InsChars(i, O, C - O, 0) != 1) return 0; O = C; } else { O++; C++; } } } return 1; } int EBuffer::BlockEnTab() { EPoint B, E; ELine *L; int O, C, O1, C1; char tab = '\t'; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, E.Row); for (int i = B.Row; i < E.Row; i++) { L = RLine(i); O = C = 0; O1 = C1 = 0; while (O < L->Count) { if (L->Chars[O] == '\t') { // see if there are spaces to remove int C2 = NextTab(C, BFI(this, BFI_TabSize)); int N = BFI(this, BFI_TabSize) - (C2 - C); if (O - O1 < N) N = O - O1; if (N > 0) { if (DelChars(i, O - N, N) != 1) return 0; O -= N; C = C2; O++; C1 = C; O1 = O; } else { O++; C = C2; O1 = O; C1 = C; } } else if (L->Chars[O] != ' ') { // nope, cannot put tab here O++; C++; C1 = C; O1 = O; } else if (((C % BFI(this, BFI_TabSize)) == (BFI(this, BFI_TabSize) - 1)) && (C - C1 > 0)) { // reached a tab and can put one int N = BFI(this, BFI_TabSize); if (O - O1 + 1 < N) { N = O - O1 + 1; } else if (O - O1 + 1 > N) { O1 = O - N + 1; } if (DelChars(i, O1, N) != 1) return 0; if (InsChars(i, O1, 1, &tab) != 1) return 0; O1++; O = O1; C++; C1 = C; } else { O++; C++; } } } return 1; } // FindFunction -- search for line matching 'RoutineRegexp' // starting from current line + 'delta'. 'way' should be +1 or -1. int EBuffer::FindFunction(int delta, int way) { RxNode *regx; int line; PELine L; RxMatchRes res; if (BFS(this, BFS_RoutineRegexp) == 0) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "No routine regexp."); return -1; } regx = RxCompile(BFS(this, BFS_RoutineRegexp)); if (regx == 0) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Failed to compile regexp '%s'", BFS(this, BFS_RoutineRegexp)); return -1; } //** Scan backwards from the current cursor position, Msg(S_BUSY, "Matching %s", BFS(this, BFS_RoutineRegexp)); line = VToR(CP.Row) + delta; while (line >= 0 && line < RCount) { L = RLine(line); if (RxExec(regx, L->Chars, L->Count, L->Chars, &res) == 1) break; line += way; } if (line < 0) line = 0; if (line >= RCount) line = RCount - 1; RxFree(regx); return line; } // Selects the current function. int EBuffer::BlockMarkFunction() { int by, ey; if (BlockUnmark() == 0) return 0; if ((by = FindFunction(0, -1)) == -1) return 0; if ((ey = FindFunction( + 1, + 1)) == -1) return 0; //** Start and end are known. Set the block; BlockMode = bmStream; if (SetBB(EPoint(by, 0)) == 0) return 0; if (SetBE(EPoint(ey, 0)) == 0) return 0; return 1; } int EBuffer::IndentFunction() { EPoint P = CP; int by, ey; if ((by = FindFunction(0, -1)) == -1) return 0; if ((ey = FindFunction( + 1, + 1)) == -1) return 0; //Draw(by, ey); ? for (int i = by; i < ey; i++) { if (SetPosR(0, i) == 0) return 0; if (LineIndent() == 0) return 0; } return SetPos(P.Col, P.Row); } int EBuffer::MoveFunctionPrev() { int line = FindFunction(-1, -1); if (line == -1) return 0; return CenterPosR(0, line); } int EBuffer::MoveFunctionNext() { int line = FindFunction( + 1, + 1); if (line == -1) return 0; return CenterPosR(0, line); } efte-1.1/src/o_buffer.cpp0000664000076400007640000016301311043103617014404 0ustar laurilauri/* o_buffer.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" SearchReplaceOptions LSearch = { 0 }; int suspendLoads = 0; EViewPort *EBuffer::CreateViewPort(EView *V) { V->Port = new EEditPort(this, V); AddView(V); if (Loaded == 0 && !suspendLoads) { Load(); if (CompilerMsgs) CompilerMsgs->FindFileErrors(this); if (CvsDiffView) CvsDiffView->FindFileLines(this); if (SvnDiffView) SvnDiffView->FindFileLines(this); markIndex.retrieveForBuffer(this); int r, c; if (RetrieveFPos(FileName, r, c) == 1) SetNearPosR(c, r); //printf("setting to c:%d r:%d f:%s", c, r, FileName); V->Port->GetPos(); V->Port->ReCenter = 1; if (BFI(this, BFI_SaveBookmarks) == 3) RetrieveBookmarks(this); } return V->Port; } EEditPort::EEditPort(EBuffer *B, EView *V): EViewPort(V) { Buffer = B; Rows = Cols = 0; OldTP.Row = -1; OldTP.Col = -1; GetPos(); TP = B->TP; CP = B->CP; if (V && V->MView && V->MView->Win) { V->MView->ConQuerySize(&Cols, &Rows); Rows--; } } EEditPort::~EEditPort() { StorePos(); } void EEditPort::Resize(int Width, int Height) { Cols = Width; Rows = Height - 1; RedrawAll(); } int EEditPort::SetTop(int Col, int Line) { int A, B; if (Line >= Buffer->VCount) Line = Buffer->VCount - 1; if (Line < 0) Line = 0; A = Line; B = Line + Rows; TP.Row = Line; TP.Col = Col; if (A >= Buffer->VCount) A = Buffer->VCount - 1; if (B >= Buffer->VCount) { B = Buffer->VCount - 1; } Buffer->Draw(Buffer->VToR(A), -1); return 1; } void EEditPort::StorePos() { Buffer->CP = CP; Buffer->TP = TP; } void EEditPort::GetPos() { CP = Buffer->CP; TP = Buffer->TP; } void EEditPort::ScrollY(int Delta) { // optimization // no need to scroll (clear) entire window which we are about to redraw if (Delta >= Rows || -Delta >= Rows) return ; if (Delta < 0) { Delta = -Delta; if (Delta > Rows) return; View->MView->ConScroll(csDown, 0, 0, Cols, Rows, hcPlain_Background, Delta); } else { if (Delta > Rows) return; View->MView->ConScroll(csUp, 0, 0, Cols, Rows, hcPlain_Background, Delta); } } void EEditPort::DrawLine(int L, TDrawBuffer B) { if (L < TP.Row) return; if (L >= TP.Row + Rows) return; if (View->MView->Win->GetViewContext() == View->MView) View->MView->ConPutBox(0, L - TP.Row, Cols, 1, B); // printf("%d %d (%d %d %d %d)\n", 0, L - TP.Row, view->sX, view->sY, view->sW, view->sH); } void EEditPort::RedrawAll() { Buffer->Draw(TP.Row, -1); /// Redraw(0, 0, Cols, Rows); } int EBuffer::GetContext() { return CONTEXT_FILE; } void EEditPort::HandleEvent(TEvent &Event) { EViewPort::HandleEvent(Event); switch (Event.What) { case evKeyDown: { char Ch; if (GetCharFromEvent(Event, &Ch)) { if (Buffer->BeginMacro() == 0) return ; Buffer->TypeChar(Ch); Event.What = evNone; } } break; case evCommand: switch (Event.Msg.Command) { case cmVScrollUp: Buffer->ScrollDown(Event.Msg.Param1); Event.What = evNone; break; case cmVScrollDown: Buffer->ScrollUp(Event.Msg.Param1); Event.What = evNone; break; case cmVScrollPgUp: Buffer->ScrollDown(Rows); Event.What = evNone; break; case cmVScrollPgDn: Buffer->ScrollUp(Rows); Event.What = evNone; break; case cmVScrollMove: { int ypos; // fprintf(stderr, "Pos = %d\n\x7", Event.Msg.Param1); ypos = Buffer->CP.Row - TP.Row; Buffer->SetNearPos(Buffer->CP.Col, Event.Msg.Param1 + ypos); SetTop(TP.Col, Event.Msg.Param1); RedrawAll(); } Event.What = evNone; break; case cmHScrollLeft: Buffer->ScrollRight(Event.Msg.Param1); Event.What = evNone; break; case cmHScrollRight: Buffer->ScrollLeft(Event.Msg.Param1); Event.What = evNone; break; case cmHScrollPgLt: Buffer->ScrollRight(Cols); Event.What = evNone; break; case cmHScrollPgRt: Buffer->ScrollLeft(Cols); Event.What = evNone; break; case cmHScrollMove: { int xpos; xpos = Buffer->CP.Col - TP.Col; Buffer->SetNearPos(Event.Msg.Param1 + xpos, Buffer->CP.Row); SetTop(Event.Msg.Param1, TP.Row); RedrawAll(); } Event.What = evNone; break; } break; case evMouseDown: case evMouseMove: case evMouseAuto: case evMouseUp: HandleMouse(Event); break; } } void EEditPort::HandleMouse(TEvent &Event) { int x, y, xx, yy, W, H; View->MView->ConQuerySize(&W, &H); x = Event.Mouse.X; y = Event.Mouse.Y; if (Event.What != evMouseDown || y < H - 1) { xx = x + TP.Col; yy = y + TP.Row; if (yy >= Buffer->VCount) yy = Buffer->VCount - 1; if (yy < 0) yy = 0; if (xx < 0) xx = 0; switch (Event.What) { case evMouseDown: if (Event.Mouse.Y == H - 1) break; if (View->MView->Win->CaptureMouse(1)) View->MView->MouseCaptured = 1; else break; View->MView->MouseMoved = 0; if (Event.Mouse.Buttons == 1) { // left mouse button down Buffer->SetNearPos(xx, yy); switch (Event.Mouse.Count % 5) { case 1: break; case 2: Buffer->BlockSelectWord(); break; case 3: Buffer->BlockSelectLine(); break; case 4: Buffer->BlockSelectPara(); break; } // Window->Buffer->Redraw(); if (SystemClipboard) { // note: copy to second clipboard Buffer->NextCommand(); Buffer->BlockCopy(0, 1); } Event.What = evNone; } else if (Event.Mouse.Buttons == 2) { // right mouse button down Buffer->SetNearPos(xx, yy); } break; case evMouseAuto: case evMouseMove: if (View->MView->MouseCaptured) { if (Event.Mouse.Buttons == 1) { // left mouse button move if (!View->MView->MouseMoved) { if (Event.Mouse.KeyMask == kfCtrl) Buffer->BlockMarkColumn(); else if (Event.Mouse.KeyMask == kfAlt) Buffer->BlockMarkLine(); else Buffer->BlockMarkStream(); Buffer->BlockUnmark(); if (Event.What == evMouseMove) View->MView->MouseMoved = 1; } Buffer->BlockExtendBegin(); Buffer->SetNearPos(xx, yy); Buffer->BlockExtendEnd(); } else if (Event.Mouse.Buttons == 2) { // right mouse button move if (Event.Mouse.KeyMask == kfAlt) { } else { Buffer->SetNearPos(xx, yy); } } Event.What = evNone; } break; /* case evMouseAuto: if (View->MView->MouseCaptured) { Event.What = evNone; } break;*/ case evMouseUp: if (View->MView->MouseCaptured) View->MView->Win->CaptureMouse(0); else break; View->MView->MouseCaptured = 0; if (Event.Mouse.Buttons == 1) { // left mouse button up if (View->MView->MouseMoved) if (SystemClipboard) { // note: copy to second clipboard Buffer->NextCommand(); Buffer->BlockCopy(0, 1); } } if (Event.Mouse.Buttons == 2) { // right mouse button up if (!View->MView->MouseMoved) { EEventMap *Map = View->MView->Win->GetEventMap(); const char *MName = 0; if (Map) MName = Map->GetMenu(EM_LocalMenu); if (MName == 0) MName = "Local"; View->MView->Win->Parent->PopupMenu(MName); } } if (Event.Mouse.Buttons == 4) { // middle mouse button up if (SystemClipboard) { // note: copy to second clipboard Buffer->NextCommand(); if (Event.Mouse.KeyMask == 0) Buffer->BlockPasteStream(1); else if (Event.Mouse.KeyMask == kfCtrl) Buffer->BlockPasteColumn(1); else if (Event.Mouse.KeyMask == kfAlt) Buffer->BlockPasteLine(1); } } Event.What = evNone; break; } } } void EEditPort::UpdateView() { Buffer->Redraw(); } void EEditPort::RepaintView() { RedrawAll(); } void EEditPort::UpdateStatus() { } void EEditPort::RepaintStatus() { //Buffer->Redraw(); } EEventMap *EBuffer::GetEventMap() { return FindActiveMap(Mode); } int EBuffer::BeginMacro() { return NextCommand(); } int EBuffer::ExecCommand(int Command, ExState &State) { if (CursorWithinEOL == 1 && (Command != ExMoveUp && Command != ExMoveDown)) { LastUpDownColumn = -1; // Reset when not moving up or down } switch (Command) { case ExMoveUp: return MoveUp(); case ExMoveDown: return MoveDown(); case ExMoveLeft: return MoveLeft(); case ExMoveRight: return MoveRight(); case ExMovePrev: return MovePrev(); case ExMoveNext: return MoveNext(); case ExMoveWordLeft: return MoveWordLeft(); case ExMoveWordRight: return MoveWordRight(); case ExMoveWordPrev: return MoveWordPrev(); case ExMoveWordNext: return MoveWordNext(); case ExMoveWordEndLeft: return MoveWordEndLeft(); case ExMoveWordEndRight: return MoveWordEndRight(); case ExMoveWordEndPrev: return MoveWordEndPrev(); case ExMoveWordEndNext: return MoveWordEndNext(); case ExMoveWordOrCapLeft: return MoveWordOrCapLeft(); case ExMoveWordOrCapRight: return MoveWordOrCapRight(); case ExMoveWordOrCapPrev: return MoveWordOrCapPrev(); case ExMoveWordOrCapNext: return MoveWordOrCapNext(); case ExMoveWordOrCapEndLeft: return MoveWordOrCapEndLeft(); case ExMoveWordOrCapEndRight: return MoveWordOrCapEndRight(); case ExMoveWordOrCapEndPrev: return MoveWordOrCapEndPrev(); case ExMoveWordOrCapEndNext: return MoveWordOrCapEndNext(); case ExMoveLineStart: return MoveLineStart(); case ExMoveLineEnd: return MoveLineEnd(); case ExMovePageStart: return MovePageStart(); case ExMovePageEnd: return MovePageEnd(); case ExMovePageUp: return MovePageUp(); case ExMovePageDown: return MovePageDown(); case ExMovePageLeft: return MovePageLeft(); case ExMovePageRight: return MovePageEnd(); case ExMoveFileStart: return MoveFileStart(); case ExMoveFileEnd: return MoveFileEnd(); case ExMoveBlockStart: return MoveBlockStart(); case ExMoveBlockEnd: return MoveBlockEnd(); case ExMoveFirstNonWhite: return MoveFirstNonWhite(); case ExMoveLastNonWhite: return MoveLastNonWhite(); case ExMovePrevEqualIndent: return MovePrevEqualIndent(); case ExMoveNextEqualIndent: return MoveNextEqualIndent(); case ExMovePrevTab: return MovePrevTab(); case ExMoveNextTab: return MoveNextTab(); case ExMoveTabStart: return MoveTabStart(); case ExMoveTabEnd: return MoveTabEnd(); case ExMoveLineTop: return MoveLineTop(); case ExMoveLineCenter: return MoveLineCenter(); case ExMoveLineBottom: return MoveLineBottom(); case ExMoveBeginOrNonWhite: return MoveBeginOrNonWhite(); case ExMoveBeginLinePageFile: return MoveBeginLinePageFile(); case ExMoveEndLinePageFile: return MoveEndLinePageFile(); case ExScrollLeft: return ScrollLeft(State); case ExScrollRight: return ScrollRight(State); case ExScrollDown: return ScrollDown(State); case ExScrollUp: return ScrollUp(State); case ExKillLine: return KillLine(); case ExKillChar: return KillChar(); case ExKillCharPrev: return KillCharPrev(); case ExKillWord: return KillWord(); case ExKillWordPrev: return KillWordPrev(); case ExKillWordOrCap: return KillWordOrCap(); case ExKillWordOrCapPrev: return KillWordOrCapPrev(); case ExKillToLineStart: return KillToLineStart(); case ExKillToLineEnd: return KillToLineEnd(); case ExKillBlock: return KillBlock(); case ExBackSpace: return BackSpace(); case ExDelete: return Delete(); case ExCharCaseUp: return CharCaseUp(); case ExCharCaseDown: return CharCaseDown(); case ExCharCaseToggle: return CharCaseToggle(); case ExLineCaseUp: return LineCaseUp(); case ExLineCaseDown: return LineCaseDown(); case ExLineCaseToggle: return LineCaseToggle(); case ExLineInsert: return LineInsert(); case ExLineAdd: return LineAdd(); case ExLineSplit: return LineSplit(); case ExLineJoin: return LineJoin(); case ExLineNew: return LineNew(); case ExLineIndent: return LineIndent(); case ExLineTrim: return LineTrim(); case ExLineCenter: return LineCenter(); case ExInsertSpacesToTab: { int no; if (State.GetIntParam(View, &no) == 0) no = 0; return InsertSpacesToTab(no); } case ExInsertTab: return InsertTab(); case ExInsertSpace: return InsertSpace(); case ExWrapPara: return WrapPara(); case ExInsPrevLineChar: return InsPrevLineChar(); case ExInsPrevLineToEol: return InsPrevLineToEol(); case ExLineDuplicate: return LineDuplicate(); case ExBlockBegin: return BlockBegin(); case ExBlockEnd: return BlockEnd(); case ExBlockUnmark: return BlockUnmark(); case ExBlockCut: return BlockCut(0); case ExBlockCopy: return BlockCopy(0); case ExBlockCutAppend: return BlockCut(1); case ExBlockCopyAppend: return BlockCopy(1); case ExClipClear: return ClipClear(); case ExBlockPaste: return BlockPaste(); case ExBlockKill: return BlockKill(); case ExBlockIndent: { int saved_persistence, ret_code; saved_persistence = BFI(this, BFI_PersistentBlocks); BFI_SET(this, BFI_PersistentBlocks, 1); ret_code = BlockIndent(); BFI_SET(this, BFI_PersistentBlocks, saved_persistence); return ret_code; } case ExBlockUnindent: { int saved_persistence, ret_code; saved_persistence = BFI(this, BFI_PersistentBlocks); BFI_SET(this, BFI_PersistentBlocks, 1); ret_code = BlockUnindent(); BFI_SET(this, BFI_PersistentBlocks, saved_persistence); return ret_code; } case ExBlockClear: return BlockClear(); case ExBlockMarkStream: return BlockMarkStream(); case ExBlockMarkLine: return BlockMarkLine(); case ExBlockMarkColumn: return BlockMarkColumn(); case ExBlockCaseUp: return BlockCaseUp(); case ExBlockCaseDown: return BlockCaseDown(); case ExBlockCaseToggle: return BlockCaseToggle(); case ExBlockExtendBegin: return BlockExtendBegin(); case ExBlockExtendEnd: return BlockExtendEnd(); case ExBlockReIndent: return BlockReIndent(); case ExBlockSelectWord: return BlockSelectWord(); case ExBlockSelectLine: return BlockSelectLine(); case ExBlockSelectPara: return BlockSelectPara(); case ExBlockUnTab: return BlockUnTab(); case ExBlockEnTab: return BlockEnTab(); case ExUndo: return Undo(); case ExRedo: return Redo(); case ExMatchBracket: return MatchBracket(); case ExMovePrevPos: return MovePrevPos(); case ExMoveSavedPosCol: return MoveSavedPosCol(); case ExMoveSavedPosRow: return MoveSavedPosRow(); case ExMoveSavedPos: return MoveSavedPos(); case ExSavePos: return SavePos(); case ExCompleteWord: return CompleteWord(); case ExBlockPasteStream: return BlockPasteStream(); case ExBlockPasteLine: return BlockPasteLine(); case ExBlockPasteColumn: return BlockPasteColumn(); case ExBlockPasteOver: return BlockPasteOver(); case ExShowPosition: return ShowPosition(); case ExFoldCreate: return FoldCreate(VToR(CP.Row)); case ExFoldDestroy: return FoldDestroy(VToR(CP.Row)); case ExFoldDestroyAll: return FoldDestroyAll(); case ExFoldPromote: return FoldPromote(VToR(CP.Row)); case ExFoldDemote: return FoldDemote(VToR(CP.Row)); case ExFoldOpen: return FoldOpen(VToR(CP.Row)); case ExFoldOpenNested: return FoldOpenNested(); case ExFoldClose: return FoldClose(VToR(CP.Row)); case ExFoldOpenAll: return FoldOpenAll(); case ExFoldCloseAll: return FoldCloseAll(); case ExFoldToggleOpenClose: return FoldToggleOpenClose(); case ExFoldCreateAtRoutines: return FoldCreateAtRoutines(); case ExMoveFoldTop: return MoveFoldTop(); case ExMoveFoldPrev: return MoveFoldPrev(); case ExMoveFoldNext: return MoveFoldNext(); case ExFileSave: return Save(); case ExFilePrint: return FilePrint(); case ExBlockPrint: return BlockPrint(); case ExBlockTrim: return BlockTrim(); case ExFileTrim: return FileTrim(); case ExHilitWord: return HilitWord(); case ExSearchWordPrev: return SearchWord(SEARCH_BACK | SEARCH_NEXT); case ExSearchWordNext: return SearchWord(SEARCH_NEXT); case ExHilitMatchBracket: return HilitMatchBracket(); case ExToggleAutoIndent: return ToggleAutoIndent(); case ExToggleInsert: return ToggleInsert(); case ExToggleExpandTabs: return ToggleExpandTabs(); case ExToggleShowTabs: return ToggleShowTabs(); case ExToggleUndo: return ToggleUndo(); case ExToggleReadOnly: return ToggleReadOnly(); case ExToggleKeepBackups: return ToggleKeepBackups(); case ExToggleMatchCase: return ToggleMatchCase(); case ExToggleBackSpKillTab: return ToggleBackSpKillTab(); case ExToggleDeleteKillTab: return ToggleDeleteKillTab(); case ExToggleSpaceTabs: return ToggleSpaceTabs(); case ExToggleIndentWithTabs: return ToggleIndentWithTabs(); case ExToggleBackSpUnindents: return ToggleBackSpUnindents(); case ExToggleWordWrap: return ToggleWordWrap(); case ExToggleTrim: return ToggleTrim(); case ExToggleShowMarkers: return ToggleShowMarkers(); case ExToggleHilitTags: return ToggleHilitTags(); case ExToggleShowBookmarks: return ToggleShowBookmarks(); case ExToggleMakeBackups: return ToggleMakeBackups(); case ExSetLeftMargin: return SetLeftMargin(); case ExSetRightMargin: return SetRightMargin(); case ExSetIndentWithTabs: return SetIndentWithTabs(State); // stuff with UI case ExMoveToLine: return MoveToLine(State); case ExMoveToColumn: return MoveToColumn(State); case ExFoldCreateByRegexp: return FoldCreateByRegexp(State); case ExPlaceBookmark: return PlaceBookmark(State); case ExRemoveBookmark: return RemoveBookmark(State); case ExGotoBookmark: return GotoBookmark(State); case ExPlaceGlobalBookmark: return PlaceGlobalBookmark(State); case ExPushGlobalBookmark: return PushGlobalBookmark(); case ExInsertString: return InsertString(State); case ExSelfInsert: return SelfInsert(State); case ExFileReload: return FileReload(State); case ExFileSaveAs: return FileSaveAs(State); case ExFileWriteTo: return FileWriteTo(State); case ExBlockRead: return BlockRead(State); case ExBlockReadStream: return BlockReadStream(State); case ExBlockReadLine: return BlockReadLine(State); case ExBlockReadColumn: return BlockReadColumn(State); case ExBlockWrite: return BlockWrite(State); case ExBlockSort: return BlockSort(0); case ExBlockSortReverse: return BlockSort(1); case ExFind: return Find(State); case ExFindReplace: return FindReplace(State); case ExFindRepeat: return FindRepeat(State); case ExFindRepeatOnce: return FindRepeatOnce(State); case ExFindRepeatReverse: return FindRepeatReverse(State); case ExSearch: return Search(State); case ExSearchB: return SearchB(State); case ExSearchRx: return SearchRx(State); case ExSearchAgain: return SearchAgain(State); case ExSearchAgainB: return SearchAgainB(State); case ExSearchReplace: return SearchReplace(State); case ExSearchReplaceB: return SearchReplaceB(State); case ExSearchReplaceRx: return SearchReplaceRx(State); case ExInsertChar: return InsertChar(State); case ExTypeChar: return TypeChar(State); case ExChangeMode: return ChangeMode(State); //case ExChangeKeys: return ChangeKeys(State); case ExChangeFlags: return ChangeFlags(State); case ExChangeTabSize: return ChangeTabSize(State); case ExChangeLeftMargin: return ChangeLeftMargin(State); case ExChangeRightMargin: return ChangeRightMargin(State); case ExASCIITable: return ASCIITable(State); case ExCharTrans: return CharTrans(State); case ExLineTrans: return LineTrans(State); case ExBlockTrans: return BlockTrans(State); case ExTagFind: return FindTag(State); case ExTagFindWord: return FindTagWord(State); case ExSetCIndentStyle: return SetCIndentStyle(State); case ExBlockMarkFunction: return BlockMarkFunction(); case ExIndentFunction: return IndentFunction(); case ExMoveFunctionPrev: return MoveFunctionPrev(); case ExMoveFunctionNext: return MoveFunctionNext(); case ExInsertDate: return InsertDate(State); case ExInsertUid: return InsertUid(); case ExShowHelpWord: return ShowHelpWord(State); case ExGetString: return GetString(State); case ExRegExp: return RegExp(State); case ExExpandTemplate: return ExpandTemplate(State); } return EModel::ExecCommand(Command, State); } void EBuffer::HandleEvent(TEvent &Event) { EModel::HandleEvent(Event); } int EBuffer::GetString(ExState &State) { int No = 0; char Prompt[80] = ""; State.GetIntParam(View, &No); State.GetStrParam(View, Prompt, sizeof(Prompt)); if (State.GetStrParam(View, GetStrVars[No], sizeof(GetStrVars[No])) == 0) { strcpy(GetStrVars[No], ""); } if (View->MView->Win->GetStr(Prompt, sizeof(GetStrVars[No]), GetStrVars[No], HIST_POSITION) == 0) return 0; return 1; } int EBuffer::RegExp(ExState &State) { int No = 0; char Haystack[1024], Search[128], Replace[128]; RxNode *re; RxMatchRes match; char *dest = 0; int dest_len = 0; State.GetIntParam(View, &No); State.GetStrParam(View, Haystack, sizeof(Haystack)); State.GetStrParam(View, Search, sizeof(Search)); State.GetStrParam(View, Replace, sizeof(Replace)); re = RxCompile(Search); /* if (RxExec(re, Haystack, strlen(Haystack), Haystack, &match) == 0) { RxFree(re); return 0; } if (RxReplace(Replace, Haystack, strlen(Haystack), match, &dest, &dest_len) == 0) { RxFree(re); return 0; } */ RxExec(re, Haystack, strlen(Haystack), Haystack, &match); RxReplace(Replace, Haystack, strlen(Haystack), match, &dest, &dest_len); strncpy(GetStrVars[No], dest, sizeof(GetStrVars[No])); GetStrVars[No][dest_len] = 0; RxFree(re); return 1; } int EBuffer::ExpandTemplate(ExState &State) { char FileName[MAXPATH+1] = "", ExpandedFileName[MAXPATH+1]; if (State.GetStrParam(View, FileName, MAXPATH) == 0) { if (View->MView->Win->GetStr("Filename", MAXPATH, FileName, HIST_PATH) == 0) return 0; } ExpandPath(FileName, ExpandedFileName, MAXPATH); FILE *fp; char buf[8192]; fp = fopen(ExpandedFileName, "rb"); if (fp == NULL) { Msg(S_ERROR, "Could not open template file %s.", FileName); return 0; } int len = fread(buf, 1, 8192, fp); buf[len] = 0; fclose(fp); char values[20][128]; char prompts[20][64]; const char *repl = "\\1\\{\\2\\4"; RxNode *re = RxCompile("(.#)\\{([0-9]+):([^\\}]+)(.*)"); RxMatchRes match; char *r = 0; int r_len = 0; while (RxExec(re, buf, len, buf, &match) && match.Open[2] != -1) { int num = atoi(buf + match.Open[2]); strncpy(prompts[num], buf + match.Open[3], match.Close[3] - match.Open[3]); prompts[num][match.Close[3] - match.Open[3]] = 0; strcpy(values[num], ""); if (View->MView->Win->GetStr(prompts[num], sizeof(values[num]), values[num], HIST_DEFAULT) == 0) { RxFree(re); return 0; } RxReplace(repl, buf, strlen(buf), match, &r, &r_len); r[r_len] = 0; strncpy(buf, r, r_len); buf[r_len] = 0; free(r); len = r_len; } RxFree(re); char rw[256]; re = RxCompile("(.#)(\\{([0-9]+)\\})(.*)"); while (RxExec(re, buf, len, buf, &match) && match.Open[3] != -1) { int num = atoi(buf + match.Open[3]); snprintf(rw, 256, "\\1%s\\4", values[num]); RxReplace(rw, buf, strlen(buf), match, &r, &r_len); r[r_len] = 0; strncpy(buf, r, r_len); buf[r_len] = 0; free(r); len = r_len; } int nl = 0, goto_row = -1, goto_col = -1, at = 0; for (int a = 0; a < len; a++) { if (buf[a] == 10 || buf[a] == 13) { LineIndent(); LineNew(); LineIndent(); nl = 1; } else if (nl && (buf[a] == ' ' || buf[a] == '\t')) { // ignore } else { InsertChar(buf[a]); if (buf[a] == '@') at++; if (at == 2) { KillCharPrev(); KillCharPrev(); goto_row = CP.Row; goto_col = CP.Col; at = 0; } nl = 0; } } if (goto_row != -1) { SetPos(goto_col, goto_row); } return 1; } int EBuffer::MoveToLine(ExState &State) { int No = 0; if (State.GetIntParam(View, &No) == 0) { char Num[10]; sprintf(Num, "%d", VToR(CP.Row) + 1); if (View->MView->Win->GetStr("Goto Line", sizeof(Num), Num, HIST_POSITION) == 0) return 0; No = atol(Num); } return SetNearPosR(CP.Col, No - 1); } int EBuffer::MoveToColumn(ExState &State) { int No = 0; if (State.GetIntParam(View, &No) == 0) { char Num[10]; sprintf(Num, "%d", CP.Col + 1); if (View->MView->Win->GetStr("Goto Column", 8, Num, HIST_POSITION) == 0) return 0; No = atol(Num); } return SetNearPos(No - 1, CP.Row); } int EBuffer::FoldCreateByRegexp(ExState &State) { char strbuf[1024] = ""; if (State.GetStrParam(View, strbuf, sizeof(strbuf)) == 0) { if (View->MView->Win->GetStr("Create Fold Regexp", sizeof(strbuf), strbuf, HIST_REGEXP) == 0) return 0; } return FoldCreateByRegexp(strbuf); } int EBuffer::PlaceUserBookmark(const char *n, EPoint P) { char name[256+4] = "_BMK"; int result; EPoint prev; strcpy(name + 4, n); if (GetBookmark(name, prev) == 0) { prev.Row = -1; prev.Col = -1; } result = PlaceBookmark(name, P); if (result) { if (BFI(this, BFI_ShowBookmarks)) { FullRedraw(); } if (BFI(this, BFI_SaveBookmarks) == 1 || BFI(this, BFI_SaveBookmarks) == 2) { if (!Modify()) return result; // Never try to save to read-only if (BFI(this, BFI_Undo)) { if (PushULong(prev.Row) == 0) return 0; if (PushULong(prev.Col) == 0) return 0; if (PushUData((void *)n, strlen(n) + 1) == 0) return 0; if (PushULong(strlen(n) + 1) == 0) return 0; if (PushUChar(ucPlaceUserBookmark) == 0) return 0; } } } return result; } int EBuffer::RemoveUserBookmark(const char *n) { char name[256+4] = "_BMK"; int result; EPoint p; strcpy(name + 4, n); GetBookmark(name, p); // p is valid only if remove is successful result = RemoveBookmark(name); if (result) { if (BFI(this, BFI_ShowBookmarks)) { FullRedraw(); } if (BFI(this, BFI_SaveBookmarks) == 1 || BFI(this, BFI_SaveBookmarks) == 2) { if (!Modify()) return result; // Never try to save to read-only if (PushULong(p.Row) == 0) return 0; if (PushULong(p.Col) == 0) return 0; if (PushUData((void *)n, strlen(n) + 1) == 0) return 0; if (PushULong(strlen(n) + 1) == 0) return 0; if (PushUChar(ucRemoveUserBookmark) == 0) return 0; } } return result; } int EBuffer::GotoUserBookmark(const char *n) { char name[256+4] = "_BMK"; strcpy(name + 4, n); return GotoBookmark(name); } int EBuffer::GetUserBookmarkForLine(int searchFrom, int searchForLine, char *&Name, EPoint &P) { int i; i = searchFrom; while (1) { i = GetBookmarkForLine(i, searchForLine, Name, P); if (i == -1) return -1; if (strncmp(Name, "_BMK", 4) == 0) { Name += 4; return i; } } } int EBuffer::PlaceBookmark(ExState &State) { char name[256] = ""; EPoint P = CP; P.Row = VToR(P.Row); if (State.GetStrParam(View, name, sizeof(name)) == 0) if (View->MView->Win->GetStr("Place Bookmark", sizeof(name), name, HIST_BOOKMARK) == 0) return 0; return PlaceUserBookmark(name, P); } int EBuffer::RemoveBookmark(ExState &State) { char name[256] = ""; if (State.GetStrParam(View, name, sizeof(name)) == 0) if (View->MView->Win->GetStr("Remove Bookmark", sizeof(name), name, HIST_BOOKMARK) == 0) return 0; return RemoveUserBookmark(name); } int EBuffer::GotoBookmark(ExState &State) { char name[256] = ""; if (State.GetStrParam(View, name, sizeof(name)) == 0) if (View->MView->Win->GetStr("Goto Bookmark", sizeof(name), name, HIST_BOOKMARK) == 0) return 0; return GotoUserBookmark(name); } int EBuffer::PlaceGlobalBookmark(ExState &State) { char name[256] = ""; EPoint P = CP; P.Row = VToR(P.Row); if (State.GetStrParam(View, name, sizeof(name)) == 0) if (View->MView->Win->GetStr("Place Global Bookmark", sizeof(name), name, HIST_BOOKMARK) == 0) return 0; if (markIndex.insert(name, this, P) == 0) { Msg(S_ERROR, "Error placing global bookmark %s.", name); } return 1; } int EBuffer::PushGlobalBookmark() { EPoint P = CP; P.Row = VToR(P.Row); EMark *m = markIndex.pushMark(this, P); if (m) Msg(S_INFO, "Placed bookmark %s", m->getName()); return m ? 1 : 0; } int EBuffer::InsertChar(ExState &State) { char Ch; int No; if (State.GetIntParam(View, &No) == 0) { TEvent E; E.What = evKeyDown; E.Key.Code = View->MView->Win->GetChar("Quote Char:"); if (!GetCharFromEvent(E, &Ch)) return 0; No = Ch; } if (No < 0 || No > 255) return 0; Ch = char(No); return InsertChar(Ch); } int EBuffer::TypeChar(ExState &State) { char Ch; int No; if (State.GetIntParam(View, &No) == 0) { TEvent E; E.What = evKeyDown; E.Key.Code = View->MView->Win->GetChar(0); if (!GetCharFromEvent(E, &Ch)) return 0; No = Ch; } if (No < 0 || No > 255) return 0; Ch = char(No); return TypeChar(Ch); } int EBuffer::InsertString(ExState &State) { char strbuf[1024] = ""; if (State.GetStrParam(View, strbuf, sizeof(strbuf)) == 0) { if (View->MView->Win->GetStr("Insert String", sizeof(strbuf), strbuf, HIST_DEFAULT) == 0) return 0; } return InsertString(strbuf, strlen(strbuf)); } extern int LastEventChar; int EBuffer::SelfInsert(ExState &/*State*/) { if (LastEventChar != -1) return TypeChar(char(LastEventChar)); return 0; } int EBuffer::FileReload(ExState &/*State*/) { if (Modified) { switch (View->MView->Win->Choice(GPC_ERROR, "File Modified", 2, "&Reload", "&Cancel", "%s", FileName)) { case 0: break; case 1: case -1: default: return 0; } } // GetNewNumber(); return Reload(); } int EBuffer::FileSaveAs(char *FName) { char Name[MAXPATH]; if (ExpandPath(FName, Name, sizeof(Name)) == -1) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Invalid path: %s.", FName); return 0; } if (FindFile(Name) == 0) { if (FileExists(Name)) { switch (View->MView->Win->Choice(GPC_ERROR, "File Exists", 2, "&Overwrite", "&Cancel", "%s", Name)) { case 0: break; case 1: case -1: default: return 0; } } free(FileName); FileName = strdup(Name); UpdateTitle(); return Save(); } else { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Already editing '%s.'", Name); return 0; } } int EBuffer::FileSaveAs(ExState &State) { char FName[MAXPATH]; strcpy(FName, FileName); if (State.GetStrParam(View, FName, sizeof(FName)) == 0) if (View->MView->Win->GetFile("Save As", sizeof(FName), FName, HIST_PATH, GF_SAVEAS) == 0) return 0; return FileSaveAs(FName); } int EBuffer::FileWriteTo(char *FName) { char Name[MAXPATH]; if (ExpandPath(FName, Name, sizeof(Name)) == -1) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Invalid path: %s.", FName); return 0; } if (FindFile(Name) == 0) { if (FileExists(Name)) { switch (View->MView->Win->Choice(GPC_ERROR, "File Exists", 2, "&Overwrite", "&Cancel", "%s", Name)) { case 0: break; case 1: case -1: default: return 0; } } return SaveTo(Name); } else { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Already editing '%s.'", Name); return 0; } } int EBuffer::FileWriteTo(ExState &State) { char FName[MAXPATH]; strcpy(FName, FileName); if (State.GetStrParam(View, FName, sizeof(FName)) == 0) if (View->MView->Win->GetFile("Write To", sizeof(FName), FName, HIST_PATH, GF_SAVEAS) == 0) return 0; return FileWriteTo(FName); } int EBuffer::BlockReadX(ExState &State, int blockMode) { char Name[MAXPATH]; char FName[MAXPATH]; if (JustDirectory(FileName, FName, sizeof(FName)) == -1) return 0; SlashDir(FName); if (State.GetStrParam(View, FName, sizeof(FName)) == 0) if (View->MView->Win->GetFile("Read block", sizeof(FName), FName, HIST_PATH, GF_OPEN) == 0) return 0; if (ExpandPath(FName, Name, sizeof(Name)) == -1) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Invalid path: %s.", FName); return 0; } return BlockReadFrom(Name, blockMode); } int EBuffer::BlockRead(ExState &State) { return BlockReadX(State, BlockMode); } int EBuffer::BlockReadStream(ExState &State) { return BlockReadX(State, bmStream); } int EBuffer::BlockReadLine(ExState &State) { return BlockReadX(State, bmLine); } int EBuffer::BlockReadColumn(ExState &State) { return BlockReadX(State, bmColumn); } int EBuffer::BlockWrite(ExState &State) { char Name[MAXPATH]; char FName[MAXPATH]; int Append = 0; if (JustDirectory(FileName, FName, sizeof(FName)) == -1) return 0; SlashDir(FName); if (State.GetStrParam(View, FName, sizeof(FName)) == 0) if (View->MView->Win->GetFile("Write block", sizeof(FName), FName, HIST_PATH, GF_SAVEAS) == 0) return 0; if (ExpandPath(FName, Name, sizeof(Name)) == -1) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Invalid path: %s.", FName); return 0; } if (FindFile(Name) == 0) { if (FileExists(Name)) { switch (View->MView->Win->Choice(GPC_ERROR, "File Exists", 3, "&Overwrite", "&Append", "&Cancel", "%s", Name)) { case 0: break; case 1: Append = 1; break; case 2: case -1: default: return 0; } } } else { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Already editing '%s.'", Name); return 0; } return BlockWriteTo(Name, Append); } int EBuffer::Find(ExState &State) { char find[MAXSEARCH+1] = ""; char options[32] = ""; if (State.GetStrParam(View, find, sizeof(find)) != 0) { if (State.GetStrParam(View, options, sizeof(options)) == 0) strcpy(options, BFS(this, BFS_DefFindOpt)); LSearch.ok = 0; strcpy(LSearch.strSearch, find); LSearch.strReplace[0] = 0; LSearch.Options = 0; if (ParseSearchOptions(0, options, LSearch.Options) == 0) return 0; LSearch.ok = 1; } else if ((HaveGUIDialogs & GUIDLG_FIND) && GUIDialogs) { LSearch.ok = 0; LSearch.strSearch[0] = 0; LSearch.strReplace[0] = 0; LSearch.Options = 0; if (BFS(this, BFS_DefFindOpt)) strcpy(options, BFS(this, BFS_DefFindOpt)); if (ParseSearchOptions(0, options, LSearch.Options) == 0) LSearch.Options = 0; if (DLGGetFind(View->MView->Win, LSearch) == 0) return 0; } else { if (BFS(this, BFS_DefFindOpt)) strcpy(options, BFS(this, BFS_DefFindOpt)); if (View->MView->Win->GetStr("Find", sizeof(find), find, HIST_SEARCH) == 0) return 0; if (View->MView->Win->GetStr("Options (All/Block/Cur/Delln/Glob/Igncase/Joinln/Rev/Word/regX)", sizeof(options), options, HIST_SEARCHOPT) == 0) return 0; LSearch.ok = 0; strcpy(LSearch.strSearch, find); LSearch.strReplace[0] = 0; LSearch.Options = 0; if (ParseSearchOptions(0, options, LSearch.Options) == 0) return 0; LSearch.ok = 1; } if (LSearch.ok == 0) return 0; LSearch.Options |= SEARCH_CENTER; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::FindReplace(ExState &State) { char find[MAXSEARCH+1] = ""; char replace[MAXSEARCH+1] = ""; char options[32] = ""; if (State.GetStrParam(View, find, sizeof(find)) != 0) { if (State.GetStrParam(View, replace, sizeof(replace)) == 0) return 0; if (State.GetStrParam(View, options, sizeof(options)) == 0) return 0; LSearch.ok = 0; strcpy(LSearch.strSearch, find); strcpy(LSearch.strReplace, replace); LSearch.Options = 0; if (ParseSearchOptions(1, options, LSearch.Options) == 0) return 0; LSearch.Options |= SEARCH_REPLACE; LSearch.ok = 1; } else if ((HaveGUIDialogs & GUIDLG_FINDREPLACE) && GUIDialogs) { LSearch.ok = 0; LSearch.strSearch[0] = 0; LSearch.strReplace[0] = 0; LSearch.Options = 0; if (BFS(this, BFS_DefFindReplaceOpt)) strcpy(options, BFS(this, BFS_DefFindReplaceOpt)); if (ParseSearchOptions(1, options, LSearch.Options) == 0) LSearch.Options = 0; if (DLGGetFindReplace(View->MView->Win, LSearch) == 0) return 0; } else { if (BFS(this, BFS_DefFindReplaceOpt)) strcpy(options, BFS(this, BFS_DefFindReplaceOpt)); if (State.GetStrParam(View, find, sizeof(find)) == 0) if (View->MView->Win->GetStr("Find", sizeof(find), find, HIST_SEARCH) == 0) return 0; if (State.GetStrParam(View, replace, sizeof(replace)) == 0) if (View->MView->Win->GetStr("Replace", sizeof(replace), replace, HIST_SEARCH) == 0) return 0; if (State.GetStrParam(View, options, sizeof(options)) == 0) if (View->MView->Win->GetStr("Options (All/Block/Cur/Delln/Glob/Igncase/Joinln/Rev/Splitln/Noask/Word/regX)", sizeof(options), options, HIST_SEARCHOPT) == 0) return 0; LSearch.ok = 0; strcpy(LSearch.strSearch, find); strcpy(LSearch.strReplace, replace); LSearch.Options = 0; if (ParseSearchOptions(1, options, LSearch.Options) == 0) return 0; LSearch.Options |= SEARCH_REPLACE; LSearch.ok = 1; } if (LSearch.ok == 0) return 0; LSearch.Options |= SEARCH_CENTER; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::FindRepeat(ExState &State) { if (LSearch.ok == 0) return Find(State); LSearch.Options |= SEARCH_NEXT; LSearch.Options &= ~SEARCH_GLOBAL; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::FindRepeatReverse(ExState &State) { int rc; if (LSearch.ok == 0) return Find(State); LSearch.Options |= SEARCH_NEXT; LSearch.Options &= ~SEARCH_GLOBAL; LSearch.Options ^= SEARCH_BACK; rc = Find(LSearch); LSearch.Options ^= SEARCH_BACK; return rc; } int EBuffer::FindRepeatOnce(ExState &State) { if (LSearch.ok == 0) return Find(State); LSearch.Options |= SEARCH_NEXT; LSearch.Options &= ~SEARCH_GLOBAL; LSearch.Options &= ~SEARCH_ALL; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::ChangeMode(ExState &State) { char Mode[32] = ""; int rc; if (State.GetStrParam(View, Mode, sizeof(Mode)) == 0) if (View->MView->Win->GetStr("Mode", sizeof(Mode), Mode, HIST_SETUP) == 0) return 0; rc = ChangeMode(Mode); FullRedraw(); return rc; } int EBuffer::ChangeKeys(ExState &State) { int rc; char Mode[32] = ""; if (State.GetStrParam(View, Mode, sizeof(Mode)) == 0) if (View->MView->Win->GetStr("Mode", sizeof(Mode), Mode, HIST_SETUP) == 0) return 0; rc = ChangeKeys(Mode); FullRedraw(); return rc; } int EBuffer::ChangeFlags(ExState &State) { int rc; char Mode[32] = ""; if (State.GetStrParam(View, Mode, sizeof(Mode)) == 0) if (View->MView->Win->GetStr("Mode", sizeof(Mode), Mode, HIST_SETUP) == 0) return 0; rc = ChangeFlags(Mode); FullRedraw(); return rc; } int EBuffer::ChangeTabSize(ExState &State) { int No; if (State.GetIntParam(View, &No) == 0) { char Num[10]; sprintf(Num, "%d", BFI(this, BFI_TabSize)); if (View->MView->Win->GetStr("TabSize", sizeof(Num), Num, HIST_SETUP) == 0) return 0; No = atol(Num); } if (No < 1) return 0; if (No > 32) return 0; BFI(this, BFI_TabSize) = No; FullRedraw(); return 1; } int EBuffer::SetIndentWithTabs(ExState &State) { int No; if (State.GetIntParam(View, &No) == 0) return 0; Flags.num[BFI_IndentWithTabs] = No ? 1 : 0; return 1; } int EBuffer::ChangeRightMargin(ExState &State) { char Num[10]; int No; if (State.GetIntParam(View, &No) == 0) { sprintf(Num, "%d", BFI(this, BFI_RightMargin) + 1); if (View->MView->Win->GetStr("RightMargin", sizeof(Num), Num, HIST_SETUP) == 0) return 0; No = atol(Num) - 1; } if (No <= 1) return 0; BFI(this, BFI_RightMargin) = No; Msg(S_INFO, "RightMargin set to %d.", No + 1); return 1; } int EBuffer::ChangeLeftMargin(ExState &State) { char Num[10]; int No; if (State.GetIntParam(View, &No) == 0) { sprintf(Num, "%d", BFI(this, BFI_LeftMargin) + 1); if (View->MView->Win->GetStr("LeftMargin", sizeof(Num), Num, HIST_SETUP) == 0) return 0; No = atol(Num) - 1; } if (No < 0) return 0; BFI(this, BFI_LeftMargin) = No; Msg(S_INFO, "LeftMargin set to %d.", No + 1); return 1; } int EBuffer::CanQuit() { if (Modified) return 0; else return 1; } int EBuffer::ConfQuit(GxView *V, int multiFile) { if (Modified) { if (multiFile) { switch (V->Choice(GPC_ERROR, "File Modified", 5, "&Save", "&As", "A&ll", "&Discard", "&Cancel", "%s", FileName)) { case 0: /* Save */ if (Save() == 0) return 0; break; case 1: { /* As */ char FName[MAXPATH]; strcpy(FName, FileName); if (V->GetFile("Save As", sizeof(FName), FName, HIST_PATH, GF_SAVEAS) == 0) return 0; if (FileSaveAs(FName) == 0) return 0; } break; case 2: /* Save all */ return -2; case 3: /* Discard */ break; case 4: /* Cancel */ case -1: default: return 0; } } else { switch (V->Choice(GPC_ERROR, "File Modified", 4, "&Save", "&As", "&Discard", "&Cancel", "%s", FileName)) { case 0: /* Save */ if (Save() == 0) return 0; break; case 1: { /* As */ char FName[MAXPATH]; strcpy(FName, FileName); if (V->GetFile("Save As", sizeof(FName), FName, HIST_PATH, GF_SAVEAS) == 0) return 0; if (FileSaveAs(FName) == 0) return 0; } break; case 2: /* Discard */ break; case 3: /* Cancel */ case -1: default: return 0; } } } return 1; } void EBuffer::GetName(char *AName, int MaxLen) { strncpy(AName, FileName, MaxLen); AName[MaxLen - 1] = 0; } void EBuffer::GetPath(char *APath, int MaxLen) { JustDirectory(FileName, APath, MaxLen); } void EBuffer::GetInfo(char *AInfo, int /*MaxLen*/) { char buf[256] = {0}; char winTitle[256] = {0}; JustFileName(FileName, buf, sizeof(buf)); if (buf[0] == '\0') // if there is no filename, try the directory name. JustLastDirectory(FileName, buf, sizeof(buf)); if (buf[0] != 0) { // if there is a file/dir name, stick it in here. strncat(winTitle, buf, sizeof(winTitle) - 1 - strlen(winTitle)); strncat(winTitle, " - ", sizeof(winTitle) - 1 - strlen(winTitle)); } strncat(winTitle, FileName, sizeof(winTitle) - 1 - strlen(winTitle)); winTitle[sizeof(winTitle) - 1] = 0; sprintf(AInfo, "%2d %04d:%03d%c%-150s ", ModelNo, 1 + CP.Row, 1 + CP.Col, Modified ? '*' : ' ', winTitle); } void EBuffer::GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen) { char *p; strncpy(ATitle, FileName, MaxLen - 1); ATitle[MaxLen - 1] = 0; p = SepRChr(FileName); if (p) { strncpy(ASTitle, p + 1, SMaxLen - 1); ASTitle[SMaxLen - 1] = 0; } else { strncpy(ASTitle, FileName, SMaxLen - 1); ASTitle[SMaxLen - 1] = 0; } } int EBuffer::ASCIITable(ExState &/*State*/) { int rc; rc = View->MView->Win->PickASCII(); if (rc != -1) return InsertChar(char(rc)); return 0; } int EBuffer::ScrollLeft(ExState &State) { int Cols; if (State.GetIntParam(View, &Cols) == 0) Cols = 8; return ScrollLeft(Cols); } int EBuffer::ScrollRight(ExState &State) { int Cols; if (State.GetIntParam(View, &Cols) == 0) Cols = 8; return ScrollRight(Cols); } int EBuffer::ScrollDown(ExState &State) { int Rows; if (State.GetIntParam(View, &Rows) == 0) Rows = 1; return ScrollDown(Rows); } int EBuffer::ScrollUp(ExState &State) { int Rows; if (State.GetIntParam(View, &Rows) == 0) Rows = 1; return ScrollUp(Rows); } int EBuffer::FindTag(ExState &State) { char Tag[MAXSEARCH] = ""; if (State.GetStrParam(View, Tag, sizeof(Tag)) == 0) if (View->MView->Win->GetStr("Find tag", sizeof(Tag), Tag, HIST_SEARCH) == 0) return 0; int j = 2; while (j--) { int i; i = TagFind(this, View, Tag); if (i > 0) return 1; else if (j && (i < 0)) { /* Try autoload tags */ if (View->ExecCommand(ExTagLoad, State) == 0) break; } else { Msg(S_INFO, "Tag '%s' not found.", Tag); break; } } return 0; } // these two will probably be replaced in the future int EBuffer::InsertDate(ExState &State) { char strArg[128] = ""; char buf[128], *p; time_t t; time(&t); if (State.GetStrParam(View, strArg, sizeof(strArg))) { struct tm *tt = localtime(&t); strftime(buf, sizeof(buf), strArg, tt); buf[sizeof(buf) - 1] = 0; } else { //** 012345678901234567890123 //** Wed Jan 02 02:23:54 1991 p = ctime(&t); sprintf(buf, "%.10s %.4s", p, p + 20); } //puts(buf); return InsertString(buf, strlen(buf)); } int EBuffer::InsertUid() { const char *p = getenv("USER"); if (p == 0) p = getenv("NAME"); if (p == 0) p = getenv("ID"); // mostly for Windows. Why they can't just be standard, I don't know... if (p == 0) p = getenv("USERNAME"); if (p == 0) { Msg(S_INFO, "User ID not set ($USER)."); //return 0; p = "UNKNOWN USER"; } return InsertString(p, strlen(p)); } int EBuffer::ShowHelpWord(ExState &State) { //** Code for BlockSelectWord to find the word under the cursor, const char *achr = "+-_."; // these are accepted characters char buf[128]; int Y = VToR(CP.Row); PELine L = RLine(Y); int P; P = CharOffset(L, CP.Col); // fix \b for the case of CATBS for (int i = 0; i < P; i++) { //printf("%d - %d %d %c %c\n", i, P, L->Chars[i], //L->Chars[i], L->Chars[P]); if ((L->Chars[i] == '\b') && (P < (L->Count - 2))) P += 2; } size_t len = 0; if (P < L->Count) { // To start of word, while ((P > 0) && ((L->Chars[P - 1] == '\b') || isalnum(L->Chars[P - 1]) || (strchr(achr, L->Chars[P - 1]) != NULL))) P--; // '_' for underline is hidden in achr if ((P < (L->Count - 1)) && (L->Chars[P] == '\b')) P++; // To end of word, while ((len < (sizeof(buf) - 1)) && (P < L->Count)) { if (((P + 1) < L->Count) && (L->Chars[P + 1] == '\b')) P += 2; else if (isalnum(L->Chars[P]) || (strchr(achr, L->Chars[P]) != NULL)) buf[len++] = L->Chars[P++]; else break; } } buf[len] = 0; //printf("Word: %s\n", buf); //if (buf[0] == 0) { // Msg(INFO, "No valid word under the cursor."); // return 0; //} return View->SysShowHelp(State, buf[0] ? buf : 0); } int EBuffer::GetStrVar(int var, char *str, int buflen) { assert(buflen >= 0); if (buflen == 0) return 0; //puts("variable EBuffer\x7"); switch (var) { case mvFilePath: //puts("variable FilePath\x7"); strncpy(str, FileName, buflen); str[buflen - 1] = 0; return 1; case mvFileName: JustFileName(FileName, str, buflen); return 1; case mvFileDirectory: JustDirectory(FileName, str, buflen); return 1; case mvFileBaseName: { char buf[MAXPATH]; char *dot, *dot2; JustFileName(FileName, buf, sizeof(buf)); dot = strchr(buf, '.'); while ((dot2 = strchr(dot + 1, '.')) != NULL) dot = dot2; if (dot) *dot = 0; strlcpy(str, buf, buflen); } return 1; case mvFileExtension: { char buf[MAXPATH]; char *dot, *dot2; JustFileName(FileName, buf, sizeof(buf)); dot = strchr(buf, '.'); while ((dot2 = strchr(dot + 1, '.')) != NULL) dot = dot2; if (dot) strlcpy(str, dot, buflen); else str[0] = 0; } return 1; case mvChar: { PELine L; int P; L = RLine(CP.Row); P = CharOffset(L, CP.Col); strlcpy(str, "", buflen); if (ChClass(L->Chars[P])) { char tmp[2]; // make copy of character tmp[0] = L->Chars[P]; tmp[1] = 0; strlcat(str, tmp, buflen); } } return 1; case mvWord: { PELine L; int P, C; int wordBegin, wordEnd; L = RLine(CP.Row); P = CharOffset(L, CP.Col); strlcpy(str, "", buflen); if (ChClass(L->Chars[P])) { C = ChClassK(L->Chars[P]); // search start of word while ((P > 0) && (C == ChClassK(L->Chars[P-1]))) P--; wordBegin = P; // search end of word while ((P < L->Count) && (C == ChClassK(L->Chars[P]))) P++; wordEnd = P; // calculate total length for buffer copy int length = wordEnd - wordBegin; if ((length + 1) < buflen) { length++; } else { length = buflen; } // copy word to buffer strlcpy(str, &L->Chars[wordBegin], length); } } return 1; case mvLine: { PELine L; L = RLine(CP.Row); strlcpy(str, "", buflen); if (L->Count > 0) { // calculate total length for buffer copy int length = L->Count; if ((length + 1) < buflen) { length++; } else { length = buflen; } // copy word to buffer strlcpy(str, L->Chars, length); } } return 1; case mvFTEVer: strlcpy(str, VERSION, buflen); return 1; case mvGet0: strlcpy(str, GetStrVars[0], buflen); return 1; case mvGet1: strlcpy(str, GetStrVars[1], buflen); return 1; case mvGet2: strlcpy(str, GetStrVars[2], buflen); return 1; case mvGet3: strlcpy(str, GetStrVars[3], buflen); return 1; case mvGet4: strlcpy(str, GetStrVars[4], buflen); return 1; case mvGet5: strlcpy(str, GetStrVars[5], buflen); return 1; case mvGet6: strlcpy(str, GetStrVars[6], buflen); return 1; case mvGet7: strlcpy(str, GetStrVars[7], buflen); return 1; case mvGet8: strlcpy(str, GetStrVars[8], buflen); return 1; case mvGet9: strlcpy(str, GetStrVars[9], buflen); return 1; } return EModel::GetStrVar(var, str, buflen); } int EBuffer::GetIntVar(int var, int *value) { switch (var) { case mvCurRow: *value = VToR(CP.Row) + 1; return 1; case mvCurCol: *value = CP.Col; return 1; } return EModel::GetIntVar(var, value); } efte-1.1/src/e_mark.cpp0000664000076400007640000001500611041404761014053 0ustar laurilauri/* * e_mark.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" EMarkIndex markIndex; EMark::EMark(char *aName, char *aFileName, EPoint aPoint, EBuffer *aBuffer) { Name = new char[strlen(aName) + 1]; FileName = new char[strlen(aFileName) + 1]; Buffer = 0; Point = aPoint; assert(Name != 0); assert(FileName != 0); strcpy(Name, aName); strcpy(FileName, aFileName); if (aBuffer == 0) aBuffer = FindFile(aFileName); if (aBuffer && aBuffer->Loaded) setBuffer(aBuffer); else aBuffer = 0; } EMark::~EMark() { if (Buffer) removeBuffer(Buffer); delete[] Name; delete[] FileName; } int EMark::setBuffer(EBuffer *aBuffer) { assert(aBuffer != 0); assert(filecmp(aBuffer->FileName, FileName) == 0); if (Point.Row >= aBuffer->RCount) Point.Row = aBuffer->RCount - 1; if (Point.Row < 0) Point.Row = 0; if (aBuffer->PlaceBookmark(Name, Point) == 1) { Buffer = aBuffer; return 1; } return 0; } int EMark::removeBuffer(EBuffer *aBuffer) { assert(aBuffer != 0); if (Buffer == 0 || Buffer != aBuffer) return 0; assert(filecmp(aBuffer->FileName, FileName) == 0); if (Buffer->GetBookmark(Name, Point) == 0) return 0; if (Buffer->RemoveBookmark(Name) == 0) return 0; Buffer = 0; return 1; } EPoint &EMark::getPoint() { if (Buffer) { assert(Buffer->GetBookmark(Name, Point) != 0); } return Point; } EMarkIndex::EMarkIndex() { markCount = 0; marks = 0; } EMarkIndex::~EMarkIndex() { if (markCount > 0 && marks) { for (int n = 0; n < markCount; n++) delete marks[n]; free(marks); marks = 0; } } EMark *EMarkIndex::insert(char *aName, char *aFileName, EPoint aPoint, EBuffer *aBuffer) { int L = 0, R = markCount, M, cmp; assert(aName != 0 && aName[0] != 0); assert(aFileName != 0 && aFileName[0] != 0); while (L < R) { M = (L + R) / 2; cmp = strcmp(aName, marks[M]->getName()); if (cmp == 0) return 0; else if (cmp > 0) L = M + 1; else R = M; } EMark **newMarks = (EMark **)realloc(marks, sizeof(marks[0]) * (markCount + 1)); if (newMarks == 0) return 0; marks = newMarks; EMark *m = new EMark(aName, aFileName, aPoint, aBuffer); if (m == 0) return 0; memmove(marks + L + 1, marks + L, sizeof(marks[0]) * (markCount - L)); markCount++; marks[L] = m; return m; } EMark *EMarkIndex::insert(char *aName, EBuffer *aBuffer, EPoint aPoint) { assert(aName != 0 && aName[0] != 0); assert(aBuffer != 0); assert(aBuffer->FileName != 0); return insert(aName, aBuffer->FileName, aPoint, aBuffer); } EMark *EMarkIndex::locate(char *aName) { int L = 0, R = markCount, M, cmp; assert(aName != 0 && aName[0] != 0); while (L < R) { M = (L + R) / 2; cmp = strcmp(aName, marks[M]->getName()); if (cmp == 0) return marks[M]; else if (cmp > 0) L = M + 1; else R = M; } return 0; } int EMarkIndex::remove(char *aName) { int L = 0, R = markCount, M, cmp; assert(aName != 0 && aName[0] != 0); while (L < R) { M = (L + R) / 2; cmp = strcmp(aName, marks[M]->getName()); if (cmp == 0) { EMark *m = marks[M]; memmove(marks + M, marks + M + 1, sizeof(marks[0]) * (markCount - M - 1)); markCount--; EMark **newMarks = (EMark **)realloc(marks, sizeof(marks[0]) * (markCount)); if (newMarks != 0 || markCount == 0) marks = newMarks; delete m; return 1; } else if (cmp > 0) L = M + 1; else R = M; } return 0; } int EMarkIndex::view(EView *aView, char *aName) { EMark *m = locate(aName); if (m) { EBuffer *b = m->getBuffer(); if (b == 0) { if (FileLoad(0, m->getFileName(), 0, aView) == 0) return 0; if (retrieveForBuffer((EBuffer *)ActiveModel) == 0) return 0; b = (EBuffer *)ActiveModel; } aView->SwitchToModel(b); return b->GotoBookmark(m->getName()); } return 0; } int EMarkIndex::retrieveForBuffer(EBuffer *aBuffer) { for (int n = 0; n < markCount; n++) if (marks[n]->getBuffer() == 0 && filecmp(aBuffer->FileName, marks[n]->getFileName()) == 0) { if (marks[n]->setBuffer(aBuffer) == 0) return 0; } return 1; } int EMarkIndex::storeForBuffer(EBuffer *aBuffer) { for (int n = 0; n < markCount; n++) if (marks[n]->getBuffer() == aBuffer) if (marks[n]->removeBuffer(aBuffer) == 0) return 0; return 1; } int EMarkIndex::saveToDesktop(FILE *fp) { for (int n = 0; n < markCount; n++) { EPoint p = marks[n]->getPoint(); // ??? file of buffer or of mark? (different if file renamed) ??? // perhaps marks should be duplicated? fprintf(fp, "M|%d|%d|%s|%s\n", p.Row, p.Col, marks[n]->getName(), marks[n]->getFileName()); } return 1; } // needs performance fixes (perhaps a redesign ?) EMark *EMarkIndex::pushMark(EBuffer *aBuffer, EPoint P) { int stackTop = -1; for (int n = 0; n < markCount; n++) { char *name = marks[n]->getName(); if (name && name[0] == '#' && isdigit(name[1])) { int no = atoi(name + 1); if (no > stackTop) stackTop = no; } } char name[20]; sprintf(name, "#%d", stackTop + 1); return insert(name, aBuffer, P); } int EMarkIndex::popMark(EView *aView) { int stackTop = -1; for (int n = 0; n < markCount; n++) { char *name = marks[n]->getName(); if (name && name[0] == '#' && isdigit(name[1])) { int no = atoi(name + 1); if (no > stackTop) stackTop = no; } } if (stackTop == -1) return 0; char name[20]; sprintf(name, "#%d", stackTop); if (view(aView, name) == 0) return 0; assert(remove(name) == 1); return 1; } efte-1.1/src/fte.cpp0000664000076400007640000002172711041527421013401 0ustar laurilauri/* fte.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1997, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "log.h" #include "c_history.h" #ifdef USE_LOCALE #include #endif #if defined(UNIX) // variables used by vfte uid_t effuid; gid_t effgid; #endif /* UNIX */ char ConfigFileName[MAXPATH] = ""; static void Version() { printf("eFTE version " VERSION " " COPYRIGHT "\n"); } static void Usage() { printf("Usage: " PROGRAM " [-?] [-h] [--help] [-CDHTmlrt] files...\n" "Version: " VERSION " " COPYRIGHT "\n" " You may distribute under the terms of either the GNU General Public\n" " License or the Artistic License, as specified in the README file.\n" "\n" "Options:\n" " -- End of options, only files remain.\n" " -+ Next option is file.\n" " -? -h --help Display usage.\n" " --version Display eFTE version.\n" " -v Increase verbosity level.\n" " -! Ignore config file, use builtin defaults (also -c).\n" " -C[<.cnf>] Use specified configuration file (no arg=builtin).\n" " -D[<.dsk>] Load/Save desktop from <.dsk> file (no arg=disable desktop).\n" " -H[<.his>] Load/Save history from <.his> file (no arg=disable history).\n" " -m[] Override mode for remaining files (no arg=no override).\n" " -l[,] Go to line (and column) in next file.\n" " -r Open next file as read-only.\n" " -T[] Load tags file at startup.\n" " -t Locate specified tag.\n" // " -p Load files into already running eFTE.\n" ); } #ifndef UNIX /* * findPathExt() returns a ^ to the suffix in a file name string. If the * name contains a suffix, the pointer ^ts to the suffix' dot character, * if the name has no suffix the pointer points to the NUL terminator of * the file name string. * .lib: CBASE.LIB */ static char *findPathExt(char *filename) { char *p, *sps; for (p = filename, sps = NULL; *p; p++) { if (ISSLASH(*p)) sps = NULL; if (*p == '.') sps = p; } if (sps == NULL) sps = p; return sps; } #endif #if defined(NT) && defined(MSVC) && !defined(__WATCOMC__) char *getProgramName(char *name) { return _pgmptr; } #endif #if defined(OS2) && defined(__EMX__) // argv[0] on emx does not contain full path #define INCL_DOS #include char *getProgramName(char *name) { char ProgramName[MAXPATH]; PTIB tib; PPIB pib; DosGetInfoBlocks(&tib, &pib); if (DosQueryModuleName(pib->pib_hmte, sizeof(ProgramName), ProgramName) != 0) return name; return strdup(ProgramName); } #endif static int CmdLoadConfiguration(int &argc, char **argv) { int ign = 0; int QuoteAll = 0, QuoteNext = 0; int haveConfig = 0; int Arg; for (Arg = 1; Arg < argc; Arg++) { if (!QuoteAll && !QuoteNext && (argv[Arg][0] == '-')) { if (argv[Arg][1] == '-') { if (strcmp(argv[Arg], "--help") == 0) { Usage(); return 0; } else if (strcmp(argv[Arg], "--version") == 0) { Version(); return 0; } int debug_clean = strcmp(argv[Arg], "--debugclean") == 0; if (debug_clean || strcmp(argv[Arg], "--debug") == 0) { #ifndef FTE_NO_LOGGING char path[MAXPATH]; #ifdef UNIX ExpandPath("~/.efte", path, sizeof(path)); #else JustDirectory(argv[0], path, sizeof(path)); #endif Slash(path, 1); strlcat(path, "efte.log", sizeof(path)); if (debug_clean) unlink(path); globalLog.SetLogFile(path); printf("Trace Log in: %s\n", path); #else printf("--debug, --debugclean disabled\n"); #endif } else QuoteAll = 1; } else if (argv[Arg][1] == '!') { ign = 1; } else if (argv[Arg][1] == '+') { QuoteNext = 1; } else if (argv[Arg][1] == 'v') { verbosity++; } else if (argv[Arg][1] == '?' || argv[Arg][1] == 'h') { Usage(); return 0; } else if (argv[Arg][1] == 'd') { DefineWord(argv[Arg] + 2); } else if (argv[Arg][1] == 'c' || argv[Arg][1] == 'C') { if (argv[Arg][2]) { ExpandPath(argv[Arg] + 2, ConfigFileName, sizeof(ConfigFileName)); haveConfig = 1; } else ign = 1; } } } if (haveConfig == 1) { if (access(ConfigFileName, 0) != 0) { DieError(1, "Could not access configuration file '%s'.\n" "Does it exist?", ConfigFileName); } } else strcpy(ConfigFileName, "mymain.fte"); // Ignore system config? if (ign == 1) { if (LoadDefaultConfig() == -1) { DieError(1, "Failed to load internal configuration\n" "Please specify an external configuration file\n" "via the command line option -C\n"); } } else if (LoadConfig(argc, argv, ConfigFileName) == -1) { DieError(1, "Failed to load configuration file '%s'.\n" "Use '-C' option.", ConfigFileName); } for (Arg = 1; Arg < argc; Arg++) { if (!QuoteAll && !QuoteNext && (argv[Arg][0] == '-')) { if (argv[Arg][1] == '-' && argv[Arg][2] == '\0') { QuoteAll = 1; } else if (argv[Arg][1] == '+') { QuoteNext = 1; } else if (argv[Arg][1] == 'D') { ExpandPath(argv[Arg] + 2, DesktopFileName, sizeof(DesktopFileName)); if (IsDirectory(DesktopFileName)) { Slash(DesktopFileName, 1); strlcat(DesktopFileName, DESKTOP_NAME, sizeof(DesktopFileName)); } if (DesktopFileName[0] == 0) { LoadDesktopOnEntry = 0; SaveDesktopOnExit = 0; } else { LoadDesktopOnEntry = 1; } } else if (argv[Arg][1] == 'H') { strlcpy(HistoryFileName, argv[Arg] + 2, sizeof(HistoryFileName)); if (HistoryFileName[0] == 0) { KeepHistory = 0; } else { KeepHistory = 1; } } } else { if (LoadDesktopOnEntry == 2) { LoadDesktopOnEntry = 0; SaveDesktopOnExit = 0; DesktopFileName[0] = 0; } } } if (LoadDesktopOnEntry == 2) LoadDesktopOnEntry = 1; return 1; } int main(int argc, char **argv) { #if defined(_DEBUG) && defined(MSVC) && defined(MSVCDEBUG) _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); #endif //_DEBUG && MSVC && MSVCDEBUG #if defined(__EMX__) || (defined(NT) && defined(MSVC) && !defined(__WATCOMC__)) argv[0] = getProgramName(argv[0]); #endif #if defined(UNIX) && defined(LINUX) // security fix - when we need to be suid to access vcsa effuid = geteuid(); effgid = getegid(); if (getuid() != effuid) seteuid(getuid()); if (getgid() != effgid) setegid(getgid()); #endif #ifdef USE_LOCALE // setup locale from environment setlocale(LC_ALL, ""); #endif if (CmdLoadConfiguration(argc, argv) == 0) return 1; STARTFUNC("main"); EGUI *g = new EGUI(argc, argv, ScreenSizeX, ScreenSizeY); if (gui == 0 || g == 0) DieError(1, "Failed to initialize display\n"); gui->Run(); #if defined(OS2) && !defined(DBMALLOC) && defined(CHECKHEAP) if (_heapchk() != _HEAPOK) DieError(0, "Heap memory is corrupt."); #endif delete gui; gui = 0; #if defined(__EMX__) free(argv[0]); #endif #if defined(OS2) && !defined(DBMALLOC) && defined(CHECKHEAP) if (_heapchk() != _HEAPOK) DieError(0, "Heap memory is corrupt."); #endif #if defined(_DEBUG) && defined(MSVC) && defined(MSVCDEBUG) _CrtSetDbgFlag((_CRTDBG_LEAK_CHECK_DF) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); #endif //_DEBUG && MSVC && MSVCDEBUG #if defined(__DEBUG_ALLOC__) _dump_allocated(64); #endif ENDFUNCRC(0); //return 0; } efte-1.1/src/con_x11.cpp0000664000076400007640000021443411246702342014076 0ustar laurilauri/* con_x11.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * I18N & XMB support added by zdenek.kabelac@gmail.com */ #include #include #include #ifdef WINNT #include #define NO_PIPES #define NO_SIGNALS #else #include #include #include #endif #include #include #include #include #include #include #if defined(AIX) #include #include #endif #include #include #include #include #include #include #ifdef USE_XTINIT #include #endif #ifdef HPUX #include #endif #include "sysdep.h" #include "c_config.h" #include "console.h" #include "gui.h" #include "con_i18n.h" #include "s_files.h" #include "s_util.h" #include "s_string.h" i18n_context_t* i18n_ctx = NULL; #ifdef WINHCLX #include /* HCL - HCLXlibInit */ #endif #ifdef USE_XICON #include #define ICON_COUNT 4 #include "../packaging/shared/efte16x16.xpm" #include "../packaging/shared/efte32x32.xpm" #include "../packaging/shared/efte48x48.xpm" #include "../packaging/shared/efte64x64.xpm" #endif #ifdef CAST_FD_SET_INT #define FD_SET_CAST() (int *) #else #define FD_SET_CAST() #endif #define MIN_SCRWIDTH 20 #define MIN_SCRHEIGHT 6 #define MAX_PIPES 40 //#define PIPE_BUFLEN 4096 #define SELECTION_INCR_LIMIT 0x1000 #define SELECTION_XFER_LIMIT 0x1000 #define SELECTION_MAX_AGE 10 typedef struct { int used; int id; int fd; int pid; int stopped; EModel *notify; } GPipe; static GPipe Pipes[MAX_PIPES] = { { 0 }, }; static const long MouseAutoDelay = 40; static const long MouseAutoRepeat = 200; static const long MouseMultiClick = 300; static int setUserPosition = 0; static int initX = 0, initY = 0; static unsigned int ScreenCols = 80; static unsigned int ScreenRows = 40; static unsigned int CursorX = 0; static unsigned int CursorY = 0; static int CursorVisible = 1; static bool insertState = 1; static unsigned long CursorLastTime; // Cursor flashing interval, in msecs static unsigned CursorFlashInterval = 300; static unsigned char *ScreenBuffer = NULL; static int Refresh = 0; // Configurable X11 parameters static char win_name[20] = "eFte"; static char res_name[20] = "efte"; static char res_class[20] = "Efte"; static char locale_name[32] = "C"; static char *display_name; static Display *display; static Colormap colormap; static Atom wm_protocols; static Atom wm_delete_window; static Atom XA_CLIPBOARD = 0; static Atom proptype_targets; static Atom proptype_text; static Atom proptype_compound_text; static Atom proptype_utf8_string; static Atom proptype_incr; static Window win; static Atom prop_selection; static XSizeHints sizeHints; // program now contains both modes if available // some older Xservers don't like XmbDraw... static XFontStruct *fontStruct; #ifdef USE_XMB static int useXMB = 1; // default is yes static XFontSet fontSet; static int FontCYD; #else static int useXMB = 0; #endif static int useI18n = 1; static int FontCX, FontCY; static XColor Colors[16]; static GC GCs[256]; static char winTitle[256]; static unsigned char* CurSelectionData[3] = {NULL, NULL, NULL}; static int CurSelectionLen[3] = {0, 0, 0}; static int CurSelectionOwn[3] = {0, 0, 0}; static Time now; typedef struct _IncrementalSelectionInfo { struct _IncrementalSelectionInfo *next; unsigned char *data; int len; int pos; Atom requestor; Atom property; Atom type; time_t lastUse; } IncrementalSelectionInfo; IncrementalSelectionInfo *incrementalSelections = NULL; static Bool gotXError; static void SendSelection(XEvent *notify, Atom property, Atom type, unsigned char *data, int len, Bool privateData); static int ErrorHandler(Display *, XErrorEvent *ee) { gotXError = True; return 1; } static Atom GetXClip(int clipboard) { if (clipboard == 1) { return XA_PRIMARY; } if (clipboard == 2) { return XA_SECONDARY; } return XA_CLIPBOARD; } static int GetFTEClip(Atom clip) { if (clip == XA_CLIPBOARD) { return 0; } if (clip == XA_PRIMARY) { return 1; } if (clip == XA_SECONDARY) { return 2; } return -1; } static int AllocBuffer() { unsigned char *p; unsigned int i; ScreenBuffer = (unsigned char *)malloc(2 * ScreenCols * ScreenRows); if (ScreenBuffer == NULL) return -1; for (i = 0, p = ScreenBuffer; i < ScreenCols * ScreenRows; i++) { *p++ = 32; *p++ = 0x07; } return 0; } static struct { int r, g, b; } dcolors[] = { { 0, 0, 0 }, // black { 0, 0, 160 }, // darkBlue { 0, 160, 0 }, // darkGreen { 0, 160, 160 }, // darkCyan { 160, 0, 0 }, // darkRed { 160, 0, 160 }, // darkMagenta { 160, 160, 0 }, // darkYellow { 204, 204, 204 }, // paleGray { 160, 160, 160 }, // darkGray { 0, 0, 255 }, // blue { 0, 255, 0 }, // green { 0, 255, 255 }, // cyan { 255, 0, 0 }, // red { 255, 0, 255 }, // magenta { 255, 255, 0 }, // yellow { 255, 255, 255 }, // white }; static void SetColor(int i) { assert(0 <= i && i <= 15); if (RGBColorValid [i]) { Colors[i].blue = (RGBColor[i].b << 8) | RGBColor[i].b; Colors[i].green = (RGBColor[i].g << 8) | RGBColor[i].g; Colors[i].red = (RGBColor[i].r << 8) | RGBColor[i].r; } else { Colors[i].blue = (dcolors[i].b << 8) | dcolors[i].b; Colors[i].green = (dcolors[i].g << 8) | dcolors[i].g; Colors[i].red = (dcolors[i].r << 8) | dcolors[i].r; } Colors[i].flags = DoRed | DoGreen | DoBlue; } static int InitXColors() { int i, j; long d = 0x7FFFFFFF, d1; XColor clr; unsigned long pix; int num; long d_red, d_green, d_blue; long u_red, u_green, u_blue; for (i = 0; i < 16; i++) { SetColor(i); if (XAllocColor(display, colormap, &Colors[i]) == 0) { SetColor(i); pix = 0xFFFFFFFF; num = DisplayCells(display, DefaultScreen(display)); for (j = 0; j < num; j++) { clr.pixel = j; XQueryColor(display, colormap, &clr); d_red = (clr.red - Colors[i].red) >> 3; d_green = (clr.green - Colors[i].green) >> 3; d_blue = (clr.blue - Colors[i].blue) >> 3; //fprintf(stderr, "%d:%d dr:%d, dg:%d, db:%d\n", i, j, d_red, d_green, d_blue); u_red = d_red / 100 * d_red * 3; u_green = d_green / 100 * d_green * 4; u_blue = d_blue / 100 * d_blue * 2; //fprintf(stderr, "%d:%d dr:%u, dg:%u, db:%u\n", i, j, u_red, u_green, u_blue); d1 = u_red + u_blue + u_green; if (d1 < 0) d1 = -d1; if (pix == ~0UL || d1 < d) { pix = j; d = d1; } } if (pix == 0xFFFFFFFF) { fprintf(stderr, "Color search failed for #%04X%04X%04X\n", Colors[i].red, Colors[i].green, Colors[i].blue); } clr.pixel = pix; XQueryColor(display, colormap, &clr); Colors[i] = clr; if (XAllocColor(display, colormap, &Colors[i]) == 0) { fprintf(stderr, "Color alloc failed for #%04X%04X%04X\n", Colors[i].red, Colors[i].green, Colors[i].blue); } /*colormap = XCreateColormap(display, win, DefaultVisual(display, screen), AllocNone); for (i = 0; i < 16; i++) { SetColor(i); XAllocColor(display, colormap, &Colors[i]); } XSetWindowColormap(display, win, colormap); return 0;*/ } } return 0; } static int InitXGCs() { unsigned int i; unsigned long mask = GCForeground | GCBackground; XGCValues gcv; if (!useXMB) { gcv.font = fontStruct->fid; mask |= GCFont; } for (i = 0; i < 256; i++) { gcv.foreground = Colors[i % 16].pixel; gcv.background = Colors[(i / 16)].pixel; GCs[i] = XCreateGC(display, win, mask, &gcv); } return 0; } #ifdef USE_XMB static void try_fontset_load(const char *fs) { char *def = NULL; char **miss = NULL; int nMiss = 0; if (fontSet) return; if (!fs || !*fs) return; fontSet = XCreateFontSet(display, fs, &miss, &nMiss, &def); if (fontSet == NULL) { fprintf(stderr, "xeFTE Warning: unable to open font \"%s\":\n" " Missing count: %d\n", fs, nMiss); for (int i = 0; i < nMiss; i++) fprintf(stderr, " %s\n", miss[i]); if (def != NULL) fprintf(stderr, " def_ret: %s\n", def); } } #endif static int InitXFonts(void) { char *fs = getenv("VIOFONT"); if (fs == NULL && WindowFont[0] != 0) fs = WindowFont; if (!useXMB) { fontStruct = NULL; if (fs != NULL) { char *s = 0; s = strchr(fs, ','); if (s != NULL) *s = 0; fontStruct = XLoadQueryFont(display, fs); } if (fontStruct == NULL) fontStruct = XLoadQueryFont(display, "8x13"); if (fontStruct == NULL) fontStruct = XLoadQueryFont(display, "fixed"); if (fontStruct == NULL) return -1; FontCX = fontStruct->max_bounds.width; FontCY = fontStruct->max_bounds.ascent + fontStruct->max_bounds.descent; } #ifdef USE_XMB else { try_fontset_load(getenv("VIOFONT")); try_fontset_load(WindowFont); try_fontset_load("-misc-*-r-normal-*"); try_fontset_load("*fixed*"); if (fontSet == NULL) return -1; XFontSetExtents *xE = XExtentsOfFontSet(fontSet); FontCX = xE->max_logical_extent.width; FontCY = xE->max_logical_extent.height; // handle descending (comes in negative form) FontCYD = -(xE->max_logical_extent.y); // printf("Font X:%d\tY:%d\tD:%d\n", FontCX, FontCY, FontCYD); } #endif return 0; } static int SetupXWindow(int argc, char **argv) { unsigned long mask; #ifdef WINHCLX HCLXlibInit(); /* HCL - Initialize the X DLL */ #endif #ifdef USE_XTINIT XtAppContext app_context; XtToolkitInitialize(); app_context = XtCreateApplicationContext(); if ((display = XtOpenDisplay(app_context, NULL, argv[0], "efte", NULL, 0, &argc, argv)) == NULL) { DieError(1, "%s: Can't open display\n", argv[0]); } #else if (display_name == NULL) { display_name = getenv("DISPLAY"); } if ((display = XOpenDisplay(display_name)) == NULL) { DieError(1, "XeFTE Fatal: could not open display: %s!", display_name ? display_name : "NULL"); } #endif colormap = DefaultColormap(display, DefaultScreen(display)); // this is correct behavior if (initX < 0) { initX = DisplayWidth(display, DefaultScreen(display)) + initX; } if (initY < 0) { initY = DisplayHeight(display, DefaultScreen(display)) + initY; } XSetWindowAttributes attr; attr.backing_store = Always; attr.background_pixel = BlackPixel(display, DefaultScreen(display)); win = XCreateWindow(display, DefaultRootWindow(display), initX, initY, // ScreenCols * FontCX, ScreenRows * FontCY, 0, // at this moment we don't know the exact size // but we need to open a window - so pick up 1 x 1 1, 1, 0, CopyFromParent, InputOutput, CopyFromParent, CWBackingStore|CWBackPixel, &attr); i18n_ctx = useI18n ? i18n_open(display, win, &mask) : 0; if (InitXFonts() != 0) { DieError(1, "XeFTE Fatal: could not open any font!"); } /* KeyReleaseMask shouldn't be set for correct key mapping */ /* we set it anyway, but not pass to XmbLookupString -- mark */ mask |= ExposureMask | StructureNotifyMask | VisibilityChangeMask | FocusChangeMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | PropertyChangeMask; XSelectInput(display, win, mask); wm_protocols = XInternAtom(display, "WM_PROTOCOLS", False); assert(wm_protocols != None); wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False); assert(wm_delete_window != None); prop_selection = XInternAtom(display, "fte_clip", False); assert(prop_selection != None); XA_CLIPBOARD = XInternAtom(display, "CLIPBOARD", False); assert(XA_CLIPBOARD != None); proptype_targets = XInternAtom(display, "TARGETS", False); assert(proptype_targets != None); proptype_text = XInternAtom(display, "TEXT", False); assert(proptype_text != None); proptype_compound_text = XInternAtom(display, "COMPOUND_TEXT", False); assert(proptype_compound_text != None); proptype_utf8_string = XInternAtom(display, "UTF8_STRING", False); assert(proptype_utf8_string != None); proptype_incr = XInternAtom(display, "INCR", False); assert(proptype_incr != None); sizeHints.flags = PResizeInc | PMinSize | PMaxSize | PBaseSize | PWinGravity; sizeHints.win_gravity = NorthWestGravity; sizeHints.width_inc = FontCX; sizeHints.height_inc = FontCY; sizeHints.min_width = MIN_SCRWIDTH * FontCX; sizeHints.max_width = ConMaxCols * FontCX; sizeHints.min_height = MIN_SCRHEIGHT * FontCY; sizeHints.max_height = ConMaxRows * FontCY; sizeHints.base_width = 0; sizeHints.base_height = 0; if (setUserPosition) sizeHints.flags |= USPosition; XClassHint classHints; classHints.res_name = res_name; classHints.res_class = res_class; XSetClassHint(display, win, &classHints); XSetStandardProperties(display, win, win_name, win_name, 0, NULL, 0, 0); XSetWMNormalHints(display, win, &sizeHints); XSetWMProtocols(display, win, &wm_delete_window, 1); XSetCommand(display, win, argv, argc); if (InitXColors() != 0) return -1; if (InitXGCs() != 0) return -1; #ifdef USE_XICON // Set icon using WMHints Pixmap icon_pixmap, icon_shape; XWMHints wm_hints; wm_hints.flags = (InputHint|StateHint); wm_hints.input = True; wm_hints.initial_state = NormalState; if (XpmCreatePixmapFromData(display, win, const_cast(efte16x16_xpm), &icon_pixmap, &icon_shape, NULL) == XpmSuccess) { wm_hints.flags |= IconPixmapHint | IconMaskHint; wm_hints.icon_pixmap = icon_pixmap; wm_hints.icon_mask = icon_shape; } XSetWMHints(display, win, &wm_hints); // Set icons using _NET_WM_ICON property static const char **xpmData[ICON_COUNT] = { (const char **)efte16x16_xpm, (const char **)efte32x32_xpm, (const char **)efte48x48_xpm, (const char **) efte64x64_xpm }; XpmImage xpmImage[ICON_COUNT]; CARD32 *xpmColors[ICON_COUNT] = { NULL, NULL, NULL, NULL }; int i, iconBufferSize = 0; unsigned int j; // Load icons as XpmImage instances and create their colormaps for (i = 0; i < ICON_COUNT; i++) { XpmImage &xpm = xpmImage[i]; CARD32 *&colors = xpmColors[i]; if (XpmCreateXpmImageFromData(const_cast(xpmData[i]), &xpm, NULL) != XpmSuccess) break; iconBufferSize += 2 + xpm.width * xpm.height; colors = (CARD32 *)malloc(xpm.ncolors * sizeof(CARD32)); if (colors == NULL) { // Need to clear here is cleanup at the end checks for colors[i] to see if XPM was loaded XpmFreeXpmImage(&xpm); break; } // Decode all colors for (j = 0; j < xpm.ncolors; j++) { XColor xc; char *c = xpm.colorTable[j].c_color; if (c == NULL) c = xpm.colorTable[j].g_color; else if (c == NULL) c = xpm.colorTable[j].g4_color; else if (c == NULL) c = xpm.colorTable[j].m_color; else if (c == NULL) c = xpm.colorTable[j].symbolic; if (c == NULL) { // Unknown color colors[j] = 0; } else if (strcmp(c, "None") == 0) { // No color - see thru colors[j] = 0; } else if (XParseColor(display, colormap, c, &xc)) { // Color parsed successfully ((char *)(colors + j))[0] = xc.blue >> 8; ((char *)(colors + j))[1] = xc.green >> 8; ((char *)(colors + j))[2] = xc.red >> 8; ((char *)(colors + j))[3] = 0xff; } else { // Color parsing failed colors[j] = 0; } } } if (i == ICON_COUNT) { // Everything OK, can create property long *iconBuffer = (long *)malloc(iconBufferSize * sizeof(long)); if (iconBuffer) { long *b = iconBuffer; for (i = 0; i < ICON_COUNT; i++) { XpmImage &xpm = xpmImage[i]; CARD32 *&colors = xpmColors[i]; *b++ = xpm.width; *b++ = xpm.height; for (j = 0; j < xpm.width * xpm.height; j++) { *b++ = colors[xpm.data[j]]; } } Atom at = XInternAtom(display, "_NET_WM_ICON", False); if (at != None) XChangeProperty(display, win, at, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)iconBuffer, iconBufferSize); free(iconBuffer); } } // Cleanup for (i = 0; i < ICON_COUNT; i++) { if (xpmColors[i]) { free(xpmColors[i]); XpmFreeXpmImage(xpmImage + i); } } #else XWMHints wm_hints; wm_hints.flags = (InputHint|StateHint); wm_hints.input = True; wm_hints.initial_state = NormalState; XSetWMHints(display, win, &wm_hints); #endif Atom winAtoms[2]; winAtoms[0] = XInternAtom(display, "_NET_WM_STATE_ABOVE", False); winAtoms[1] = XInternAtom(display, "_NET_WM_WINDOW_TYPE_NORMAL", False); Atom atom = XInternAtom(display, "_NET_STATE", False); if (atom != None) { XChangeProperty(display, win, atom, XA_ATOM, 32, PropModeReplace, (unsigned char*) winAtoms, 2); } pid_t pid = getpid(); atom = XInternAtom(display, "_NET_WM_PID", False); if (atom != None) { XChangeProperty(display, win, atom, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &pid, 1); } atom = XInternAtom(display, "WM_CLIENT_LEADER", False); if (atom != None) { XChangeProperty(display, win, atom, XA_WINDOW, 32, PropModeReplace, (unsigned char*)&win, 1L); } atom = XInternAtom(display, "WM_WINDOW_ROLE", False); if (atom != None) { XChangeProperty(display, win, atom, XA_STRING, 8, PropModeReplace, (unsigned char *)win_name, strlen(win_name)); } atom = XInternAtom(display, "WM_LOCALE_NAME", False); if (atom != None) { XChangeProperty(display, win, atom, XA_STRING, 8, PropModeReplace, (unsigned char *)locale_name, strlen(locale_name)); } XResizeWindow(display, win, ScreenCols * FontCX, ScreenRows * FontCY); XMapRaised(display, win); return 0; } int ConInit(int XSize, int YSize) { if (XSize != -1) ScreenCols = XSize; if (YSize != -1) ScreenRows = YSize; if (AllocBuffer() == -1) return -1; #ifndef NO_SIGNALS signal(SIGALRM, SIG_IGN); signal(SIGPIPE, SIG_IGN); #endif return 0; } int ConDone(void) { free(ScreenBuffer); return 0; } int ConSuspend(void) { return 0; } int ConContinue(void) { return 0; } int ConClear(void) { TDrawBuffer B; MoveCh(B, ' ', 0x07, ScreenCols); return ConPutLine(0, 0, ScreenCols, ScreenRows, B); } int ConSetTitle(char *Title, char *STitle) { char buf[sizeof(winTitle)] = {0}; JustFileName(Title, buf, sizeof(buf)); if (buf[0] == '\0') { // if there is no filename, try the directory name. JustLastDirectory(Title, buf, sizeof(buf)); } snprintf(winTitle, sizeof(winTitle), "%s - ", win_name); if (buf[0] != 0) { // if there is a file/dir name, stick it in here. strncat(winTitle, buf, sizeof(winTitle) - 1 - strlen(winTitle)); strncat(winTitle, " - ", sizeof(winTitle) - 1 - strlen(winTitle)); } strncat(winTitle, Title, sizeof(winTitle) - 1 - strlen(winTitle)); winTitle[sizeof(winTitle) - 1] = 0; XSetStandardProperties(display, win, winTitle, winTitle, 0, NULL, 0, NULL); return 0; } int ConGetTitle(char *Title, int MaxLen, char *STitle, int SMaxLen) { strlcpy(Title, winTitle, MaxLen); strlcpy(STitle, winTitle, SMaxLen); return 0; } #define InRange(x,a,y) (((x) <= (a)) && ((a) < (y))) #define CursorXYPos(x,y) (ScreenBuffer + ((x) + ((y) * ScreenCols)) * 2) void DrawCursor(int Show) { if (CursorVisible) { unsigned char *p = CursorXYPos(CursorX, CursorY); // Check if cursor is on or off due to flashing if (CursorBlink) Show &= (CursorLastTime % (CursorFlashInterval * 2)) > CursorFlashInterval; int attr = p[1]; if (Show) attr ^= insertState ? CursorInsertMask : CursorOverMask; if (!useXMB) XDrawImageString(display, win, GCs[attr], CursorX * FontCX, fontStruct->max_bounds.ascent + CursorY * FontCY, (char *)p, 1); #ifdef USE_XMB else XmbDrawImageString(display, win, fontSet, GCs[attr], CursorX * FontCX, FontCYD + CursorY * FontCY, (char *)p, 1); #endif #if 0 if (Show) { int cs = (CursorStart * FontCY + FontCY / 2) / 100; int ce = (CursorEnd * FontCY + FontCY / 2) / 100; XFillRectangle(display, win, GCs[p[1]], CursorX * FontCX, CursorY * FontCY + cs, FontCX, ce - cs); } #endif } } int ConPutBox(int X, int Y, int W, int H, PCell Cell) { unsigned int i; unsigned char temp[256], attr; unsigned char *p, *ps, *c, *ops; unsigned int len, x, l, ox, olen, skip; if (X >= (int) ScreenCols || Y >= (int) ScreenRows || X + W > (int) ScreenCols || Y + H > (int) ScreenRows) { //fprintf(stderr, "%d %d %d %d %d %d\n", ScreenCols, ScreenRows, X, Y, W, H); return -1; } //XClearArea(display, win, X, Y, W * FontCX, H * FontCY, False); //fprintf(stderr, "%d %d %d %d %d %d\n", ScreenCols, ScreenRows, X, Y, W, H); for (i = 0; i < (unsigned int)H; i++) { len = W; p = CursorXYPos(X, Y + i); ps = (unsigned char *) Cell; x = X; while (len > 0) { if (!Refresh) { c = CursorXYPos(x, Y + i); skip = 0; ops = ps; ox = x; olen = len; while ((len > 0) && c[0] == ps[0] && c[1] == ps[1]) { ps += 2; c += 2; x++; len--; skip++; } if (len <= 0) break; if (skip <= 4) { ps = ops; x = ox; len = olen; } } p = ps; l = 1; temp[0] = *ps++; attr = *ps++; while ((l < len) && ((unsigned char)(ps[1]) == attr)) { temp[l++] = *ps++; ps++; } if (!useXMB) XDrawImageString(display, win, GCs[((unsigned)attr) & 0xFF], x * FontCX, fontStruct->max_bounds.ascent + (Y + i) * FontCY, (char *)temp, l); #ifdef USE_XMB else XmbDrawImageString(display, win, fontSet, GCs[((unsigned)attr) & 0xFF], x * FontCX, FontCYD + (Y + i) * FontCY, (char *)temp, l); #endif //temp[l] = 0; printf("%s\n", temp); len -= l; x += l; } /* if (x < ScreenCols - 1) { printf("XX %d %d %d\n", X, x, W); XFillRectangle(display, win, GCs[15 * 16 + 7], x * FontCX, (Y + i) * FontCY, (ScreenCols - x - 1) * FontCX, FontCY); } */ p = CursorXYPos(X, Y + i); memmove(p, Cell, W * 2); if (i + Y == CursorY) DrawCursor(1); Cell += W; } return 0; } int ConGetBox(int X, int Y, int W, int H, PCell Cell) { int i; for (i = 0; i < H; i++) { memcpy(Cell, CursorXYPos(X, Y + i), 2 * W); Cell += W; } return 0; } int ConPutLine(int X, int Y, int W, int H, PCell Cell) { int i; for (i = 0; i < H; i++) { if (ConPutBox(X, Y + i, W, 1, Cell) != 0) return -1; } return 0; } int ConSetBox(int X, int Y, int W, int H, TCell Cell) { TDrawBuffer B; int i; for (i = 0; i < W; i++) B[i] = Cell; ConPutLine(X, Y, W, H, B); return 0; } int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { TCell Cell; int l; MoveCh(&Cell, ' ', Fill, 1); DrawCursor(0); if (Way == csUp) { XCopyArea(display, win, win, GCs[0], X * FontCX, (Y + Count) * FontCY, W * FontCX, (H - Count) * FontCY, X * FontCX, Y * FontCY); for (l = 0; l < H - Count; l++) memcpy(CursorXYPos(X, Y + l), CursorXYPos(X, Y + l + Count), 2 * W); if (ConSetBox(X, Y + l, W, Count, Cell) == -1) return -1; } else if (Way == csDown) { XCopyArea(display, win, win, GCs[0], X * FontCX, Y * FontCY, W * FontCX, (H - Count) * FontCY, X * FontCX, (Y + Count) * FontCY); for (l = H - 1; l >= Count; l--) memcpy(CursorXYPos(X, Y + l), CursorXYPos(X, Y + l - Count), 2 * W); if (ConSetBox(X, Y, W, Count, Cell) == -1) return -1; } DrawCursor(1); return 0; } int ConSetSize(int X, int Y) { unsigned char *NewBuffer; unsigned char *p; int i; int MX, MY; assert(X <= ConMaxCols); assert(Y <= ConMaxRows); p = NewBuffer = (unsigned char *) malloc(X * Y * 2); if (NewBuffer == NULL) return -1; for (i = 0; i < X * Y; i++) { *p++ = ' '; *p++ = 0x07; } MX = ScreenCols; if (X < MX) MX = X; MY = ScreenRows; if (Y < MY) MY = Y; p = NewBuffer; for (i = 0; i < MY; i++) { memcpy(p, CursorXYPos(0, i), MX * 2); p += X * 2; } free(ScreenBuffer); ScreenBuffer = NewBuffer; ScreenCols = X; ScreenRows = Y; //ConPutBox(0, 0, ScreenCols, ScreenRows, (PCell) ScreenBuffer); //if (Refresh == 0) // XResizeWindow(display, win, ScreenCols * FontCX, ScreenRows * FontCY); return 0; } int ConQuerySize(int *X, int *Y) { *X = ScreenCols; *Y = ScreenRows; return 0; } int ConSetCursorPos(int X, int Y) { DrawCursor(0); CursorX = X; CursorY = Y; DrawCursor(1); return 0; } int ConQueryCursorPos(int *X, int *Y) { *X = CursorX; *Y = CursorY; return 0; } int ConShowCursor(void) { CursorVisible = 1; DrawCursor(1); return 0; } int ConHideCursor(void) { DrawCursor(0); CursorVisible = 0; return 0; } int ConCursorVisible(void) { return 1; } void ConSetInsertState(bool insert) { insertState = insert; } int ConSetMousePos(int /*X*/, int /*Y*/) { return 0; } static int LastMouseX = -1, LastMouseY = -1; int ConQueryMousePos(int *X, int *Y) { if (X) *X = LastMouseX; if (Y) *Y = LastMouseY; return 0; } int ConShowMouse(void) { printf("Show\n"); return 0; } int ConHideMouse(void) { printf("Hide\n"); return 0; } int ConMouseVisible(void) { return 1; } int ConQueryMouseButtons(int *ButtonCount) { *ButtonCount = 3; return 0; } void UpdateWindow(int xx, int yy, int ww, int hh) { PCell p; int i; /* show redrawn area */ /* XFillRectangle(display, win, GCs[14], xx, yy, ww, hh); XFlush(display); i = XEventsQueued(display, QueuedAfterReading); while (i-- > 0) { XEvent e; XNextEvent(display, &e); } // sleep(1);*/ ww /= FontCX; ww += 2; hh /= FontCY; xx /= FontCX; yy /= FontCY; /* * OK for this moment I suggest this method - it works somehow * But I suppose the correct solution would meant general rewrite * of some basic behavior of FTE editor * THIS IS TEMPORAL FIX AND SHOULD BE SOLVED IN GENERAL WAY ! */ hh *= 3; yy -= hh; hh += hh + 2; if (yy < 0) yy = 0; if (xx + ww > (int)ScreenCols) ww = ScreenCols - xx; if (yy + hh > (int)ScreenRows) hh = ScreenRows - yy; Refresh = 1; //frames->Repaint(); //frames->Update(); p = (PCell) CursorXYPos(xx, yy); for (i = 0; i < hh; i++) { ConPutBox(xx, yy + i, ww, 1, p); p += ScreenCols; } //fprintf(stderr, "UPDATE\tx:%3d y:%3d w:%3d h:%3d\n", xx, yy, ww, hh); //XFlush(display); Refresh = 0; } int ResizeWindow(int ww, int hh) { int ox = ScreenCols; int oy = ScreenRows; ww /= FontCX; if (ww <= 4) ww = 4; hh /= FontCY; if (hh <= 2) hh = 2; if ((int)ScreenCols != ww || (int)ScreenRows != hh) { Refresh = 0; ConSetSize(ww, hh); Refresh = 1; if (ox < (int)ScreenCols) UpdateWindow(ox * FontCX, 0, (ScreenCols - ox) * FontCX, ScreenRows * FontCY); if (oy < (int)ScreenRows) UpdateWindow(0, oy * FontCY, ScreenCols * FontCX, (ScreenRows - oy) * FontCY); Refresh = 0; return 1; } return 0; } static struct { long keysym; long keycode; } key_table[] = { { XK_Escape, kbEsc }, { XK_Tab, kbTab }, { XK_Return, kbEnter }, { XK_Pause, kbPause }, { XK_BackSpace, kbBackSp }, { XK_Home, kbHome }, { XK_Up, kbUp }, { XK_Prior, kbPgUp }, { XK_Left, kbLeft }, { XK_Right, kbRight }, { XK_End, kbEnd }, { XK_Down, kbDown }, { XK_Next, kbPgDn }, { XK_Select, kbEnd }, { XK_KP_Enter, kbEnter | kfGray }, { XK_Insert, kbIns | kfGray }, { XK_Delete, kbDel | kfGray }, { XK_KP_Insert, kbIns }, { XK_KP_Delete, kbDel }, { XK_KP_Add, '+' | kfGray }, { XK_KP_Subtract, '-' | kfGray }, { XK_KP_Multiply, '*' | kfGray }, { XK_KP_Divide, '/' | kfGray }, { XK_KP_Begin, kbPgUp | kfGray | kfCtrl }, { XK_KP_Home, kbHome | kfGray }, { XK_KP_Up, kbUp | kfGray }, { XK_KP_Prior, kbPgUp | kfGray }, { XK_KP_Left, kbLeft | kfGray }, { XK_KP_Right, kbRight | kfGray }, { XK_KP_End, kbEnd | kfGray }, { XK_KP_Down, kbDown | kfGray }, { XK_KP_Next, kbPgDn | kfGray }, { XK_Num_Lock, kbNumLock }, { XK_Caps_Lock, kbCapsLock }, { XK_Print, kbPrtScr }, { XK_Shift_L, kbShift }, { XK_Shift_R, kbShift | kfGray }, { XK_Control_L, kbCtrl }, { XK_Control_R, kbCtrl | kfGray }, { XK_Alt_L, kbAlt }, { XK_Alt_R, kbAlt | kfGray }, { XK_Meta_L, kbAlt }, { XK_Meta_R, kbAlt | kfGray }, { XK_F1, kbF1 }, { XK_F2, kbF2 }, { XK_F3, kbF3 }, { XK_F4, kbF4 }, { XK_F5, kbF5 }, { XK_F6, kbF6 }, { XK_F7, kbF7 }, { XK_F8, kbF8 }, { XK_F9, kbF9 }, { XK_F10, kbF10 }, { XK_F11, kbF11 }, { XK_F12, kbF12 }, { XK_KP_0, '0' | kfGray }, { XK_KP_1, '1' | kfGray }, { XK_KP_2, '2' | kfGray }, { XK_KP_3, '3' | kfGray }, { XK_KP_4, '4' | kfGray }, { XK_KP_5, '5' | kfGray }, { XK_KP_6, '6' | kfGray }, { XK_KP_7, '7' | kfGray }, { XK_KP_8, '8' | kfGray }, { XK_KP_9, '9' | kfGray }, { XK_KP_Decimal, '.' | kfGray }, { 0x1000FF6F, kbDel | kfShift | kfGray }, { 0x1000FF70, kbIns | kfCtrl | kfGray }, { 0x1000FF71, kbIns | kfShift | kfGray }, { 0x1000FF72, kbIns | kfGray }, { 0x1000FF73, kbDel | kfGray }, { 0x1000FF74, kbTab | kfShift }, { 0x1000FF75, kbTab | kfShift }, { 0, 0 } }; void ConvertKeyToEvent(KeySym key, KeySym key1, char */*keyname*/, char */*keyname1*/, int etype, int state, TEvent *Event) { unsigned int myState = 0; Event->What = evNone; switch (etype) { case KeyPress: Event->What = evKeyDown; break; case KeyRelease: Event->What = evKeyUp; break; default: return ; } if (state & ShiftMask) myState |= kfShift; if (state & ControlMask) myState |= kfCtrl; if (state & Mod1Mask) myState |= kfAlt; //if (state & Mod2Mask) myState |= kfAlt; // NumLock if (state & Mod3Mask) myState |= kfAlt; if (state & Mod4Mask) myState |= kfAlt; /* modified kabi@fi.muni.cz * for old method * if (!KeyAnalyze((etype == KeyPress), state, &key, &key1)) * return; */ //printf("key: %d ; %d ; %d\n", (int)key, (int)key1, state); if (key < 256 || (key1 < 256 && (myState == kfAlt || myState == (kfAlt | kfShift)))) { if (myState & kfAlt) key = key1; if (myState == kfShift) myState = 0; if (myState & (kfAlt | kfCtrl)) if ((key >= 'a') && (key < 'z' + 32)) key &= ~0x20; if ((myState & kfCtrl) && key < 32) key += 64; Event->Key.Code = key | myState; return; } else { for (unsigned i = 0; i < (sizeof(key_table) / sizeof(key_table[0])); i++) { long k; if ((long) key1 == key_table[i].keysym) { k = key_table[i].keycode; if (k < 256) if (myState == kfShift) myState = 0; Event->Key.Code = k | myState; return; } } } //printf("Unknown key: %ld %s %d %d\n", key, keyname, etype, state); Event->What = evNone; } static TEvent LastMouseEvent = { evNone }; #define TM_DIFF(x,y) ((long)(((long)(x) < (long)(y)) ? ((long)(y) - (long)(x)) : ((long)(x) - (long)(y)))) void ConvertClickToEvent(int type, int xx, int yy, int button, int state, TEvent *Event, Time mtime) { unsigned int myState = 0; static unsigned long LastClickTime = 0; static short LastClickCount = 0; static unsigned long LastClick = 0; unsigned long CurTime = mtime; //printf("Mouse x:%d y:%d %d\n", xx, yy, type); if (type == MotionNotify) Event->What = evMouseMove; else if (type == ButtonPress) Event->What = evMouseDown; else Event->What = evMouseUp; Event->Mouse.X = xx / FontCX; Event->Mouse.Y = yy / FontCY; if (Event->What == evMouseMove) if (LastMouseX == Event->Mouse.X && LastMouseY == Event->Mouse.Y) { Event->What = evNone; return; } LastMouseX = Event->Mouse.X; LastMouseY = Event->Mouse.Y; Event->Mouse.Buttons = 0; if (type == MotionNotify) { if (state & Button1Mask) Event->Mouse.Buttons |= 1; if (state & Button2Mask) Event->Mouse.Buttons |= 4; if (state & Button3Mask) Event->Mouse.Buttons |= 2; } else { switch (button) { case Button1: Event->Mouse.Buttons |= 1; break; case Button2: Event->Mouse.Buttons |= 4; break; case Button3: Event->Mouse.Buttons |= 2; break; case Button4: case Button5: if (type == ButtonPress) { Event->What = evCommand; if (state & ShiftMask) { Event->Msg.Param1 = 1; if (button == Button4) Event->Msg.Command = cmVScrollUp; // fix core to use count else Event->Msg.Command = cmVScrollDown; } else { Event->Msg.Param1 = 3; if (button == Button4) Event->Msg.Command = cmVScrollUp; else Event->Msg.Command = cmVScrollDown; } } return; } } Event->Mouse.Count = 1; if (state & ShiftMask) myState |= kfShift; if (state & ControlMask) myState |= kfCtrl; if (state & Mod1Mask) myState |= kfAlt; //if (state & Mod2Mask) myState |= kfAlt; if (state & Mod3Mask) myState |= kfAlt; if (state & Mod4Mask) myState |= kfAlt; Event->Mouse.KeyMask = myState; if (Event->What == evMouseDown) { if (LastClickCount) { if (LastClick == Event->Mouse.Buttons) { if (TM_DIFF(CurTime, LastClickTime) <= MouseMultiClick) { Event->Mouse.Count = ++LastClickCount; } else { LastClickCount = 0; } } else { LastClick = 0; LastClickCount = 0; LastClickTime = 0; } } LastClick = Event->Mouse.Buttons; if (LastClickCount == 0) LastClickCount = 1; LastClickTime = CurTime; } /* if (Event->What == evMouseMove) { LastClick = 0; LastClickCount = 0; LastClickTime = 0; } */ LastMouseEvent = *Event; } void ProcessXEvents(TEvent *Event) { XEvent event; XAnyEvent *anyEvent = (XAnyEvent *) & event; XExposeEvent *exposeEvent = (XExposeEvent *) & event; XButtonEvent *buttonEvent = (XButtonEvent *) & event; XKeyEvent *keyEvent = (XKeyEvent *) & event; XKeyEvent keyEvent1; XConfigureEvent *configureEvent = (XConfigureEvent *) & event; XGraphicsExposeEvent *gexposeEvent = (XGraphicsExposeEvent *) & event; XMotionEvent *motionEvent = (XMotionEvent *) & event; KeySym key, key1; int state; char keyName[32]; char keyName1[32]; memset((void *)&event, 0, sizeof(event)); Event->What = evNone; #ifdef WINNT //int rc = -1; #else //int rc = #endif XNextEvent(display, &event); if (XFilterEvent(&event, None)) return; if (event.type == MappingNotify) { XRefreshKeyboardMapping(&event.xmapping); return; } if (anyEvent->window != win) { if (event.type == PropertyNotify && event.xproperty.state == PropertyDelete) { // Property change on different window - try to find matching incremental selection request IncrementalSelectionInfo *isi, *prev_isi = NULL; for (isi = incrementalSelections; isi; prev_isi = isi, isi = isi->next) { if (isi->requestor == event.xproperty.window && isi->property == event.xproperty.atom) { // Found selection request - send more data int send = isi->len - isi->pos; send = send < SELECTION_XFER_LIMIT ? send : SELECTION_XFER_LIMIT; XChangeProperty(display, isi->requestor, isi->property, isi->type, 8, PropModeAppend, isi->data + isi->pos, send); isi->pos += send; isi->lastUse = time(NULL); if (send == 0) { // Was sent - remove from memory if (prev_isi) prev_isi->next = isi->next; else incrementalSelections = isi->next; XFree(isi->data); delete isi; } break; } } } return; } switch (event.type) { case Expose: //fprintf(stderr, "EXPOSE\tx:%3d y:%3d w:%3d h:%3d\n", // exposeEvent->x, exposeEvent->y, // exposeEvent->width, exposeEvent->height); UpdateWindow(exposeEvent->x, exposeEvent->y, exposeEvent->width, exposeEvent->height); break; case GraphicsExpose: /* catch up same events to speed up this a bit */ state = XEventsQueued(display, QueuedAfterReading); // printf("Event %d\n", state); while (state-- > 0) { XEvent e; XGraphicsExposeEvent *ge = (XGraphicsExposeEvent *) & e; if (XCheckTypedWindowEvent(display, win, GraphicsExpose, &e)) { if (gexposeEvent->x == ge->x && gexposeEvent->y == ge->y && gexposeEvent->width == ge->width && gexposeEvent->height == ge->height) { // fprintf(stderr, "found the same gexpose event\n"); continue; } else { // fprintf(stderr, "caught different gexpose event\n"); XPutBackEvent(display, &e); } } break; } //fprintf(stderr, "GEXPOSE\tx:%3d y:%3d w:%3d h:%3d\n", // gexposeEvent->x, gexposeEvent->y, // gexposeEvent->width, gexposeEvent->height); UpdateWindow(gexposeEvent->x, gexposeEvent->y, gexposeEvent->width, gexposeEvent->height); break; case ConfigureNotify: while ((XPending(display) > 0) && XCheckTypedWindowEvent(display, win, ConfigureNotify, &event)) XSync(display, 0); if (ResizeWindow(configureEvent->width, configureEvent->height)) { Event->What = evCommand; Event->Msg.Command = cmResize; } break; case ButtonPress: case ButtonRelease: now = event.xbutton.time; ConvertClickToEvent(event.type, buttonEvent->x, buttonEvent->y, buttonEvent->button, buttonEvent->state, Event, motionEvent->time); break; case FocusIn: if (i18n_ctx) i18n_focus_in(i18n_ctx); break; case FocusOut: if (i18n_ctx) i18n_focus_out(i18n_ctx); break; case KeyPress: // case KeyRelease: now = event.xkey.time; state = keyEvent->state; keyEvent1 = *keyEvent; keyEvent1.state &= ~(ShiftMask | ControlMask | Mod1Mask /* | Mod2Mask*/ | Mod3Mask | Mod4Mask); if (!i18n_ctx || event.type == KeyRelease) XLookupString(keyEvent, keyName, sizeof(keyName), &key, 0); else { i18n_lookup_sym(keyEvent, keyName, sizeof(keyName), &key, i18n_ctx->xic); if (!key) break; } XLookupString(&keyEvent1, keyName1, sizeof(keyName1), &key1, 0); //printf("keyEvent->state = %d %s %08X\n", keyEvent->state, keyName, key); //printf("keyEvent1.state = %d %s %08X\n", keyEvent1.state, keyName1, key1); //key1 = XLookupKeysym(keyEvent, 0); ConvertKeyToEvent(key, key1, keyName, keyName1, event.type, state, Event); break; case MotionNotify: now = event.xmotion.time; ConvertClickToEvent(event.type, motionEvent->x, motionEvent->y, 0, motionEvent->state, Event, motionEvent->time); break; case ClientMessage: if (event.xclient.message_type == wm_protocols && event.xclient.format == 32 && (Atom)event.xclient.data.l[0] == wm_delete_window) { Event->What = evCommand; Event->Msg.Command = cmClose; } break; case SelectionClear: { int clip = GetFTEClip(event.xselectionclear.selection); if (clip >= 0) { Window owner = XGetSelectionOwner(display, GetXClip(clip)); if (owner != win) { if (CurSelectionData[clip] != NULL) free(CurSelectionData[clip]); CurSelectionData[clip] = NULL; CurSelectionLen[clip] = 0; CurSelectionOwn[clip] = 0; } } } break; case SelectionRequest: { // SelectionRequest: // owner - selection owner (should be fte window) // selection - selection (clipboard) // target - target type to which the selection should be converted // property - target property - place data to this property of requestor's window, set correct type // requestor - selection requestor // time - request time - owner should provide selection if it owned it at this time // Note: Old clients use None property - in this case the right property is stored in target field. // On error refuse request by sending notification with None property. // // SelectionNotify: // requestor - // selection - should be copied from request // target - -- copy -- // property - -- copy -- or None if on error - request could not be fulfilled // time - -- copy -- static unsigned char empty[] = ""; XEvent notify; Bool notifySent = False; int clip = GetFTEClip(event.xselectionrequest.selection); notify.type = SelectionNotify; notify.xselection.requestor = event.xselectionrequest.requestor; notify.xselection.selection = event.xselectionrequest.selection; notify.xselection.target = event.xselectionrequest.target; notify.xselection.time = event.xselectionrequest.time; // Prefill for "unknown/bad request" case notify.xselection.property = None; if (clip >= 0) { if (event.xselectionrequest.target == proptype_targets) { // Return targets - to what types data can be rendered Atom type_list[] = { XA_STRING, proptype_text #ifdef USE_XMB , proptype_compound_text #ifdef X_HAVE_UTF8_STRING , proptype_utf8_string #endif #endif }; XChangeProperty(display, event.xselectionrequest.requestor, event.xselectionrequest.property, XA_ATOM, 32, PropModeReplace, (unsigned char *)&type_list, sizeof(type_list) / sizeof(*type_list)); notify.xselection.property = event.xselectionrequest.property; #ifdef USE_XMB } else if (event.xselectionrequest.target == XA_STRING) { #else } else if (event.xselectionrequest.target == XA_STRING || event.xselectionrequest.target == proptype_text) { #endif // No conversion, just the string we have (in fact we should convert to ISO Latin-1) SendSelection(¬ify, event.xselectionrequest.property, XA_STRING, (CurSelectionData[clip] ? CurSelectionData[clip] : empty), CurSelectionLen[clip], False); notifySent = True; #ifdef USE_XMB } else { // Convert to requested type XTextProperty text_property; char *text_list[1] = {(char *)(CurSelectionData[clip] ? CurSelectionData[clip] : empty)}; XICCEncodingStyle style = event.xselectionrequest.target == XA_STRING ? XStringStyle : event.xselectionrequest.target == proptype_text ? XStdICCTextStyle : event.xselectionrequest.target == proptype_compound_text ? XCompoundTextStyle : #ifdef X_HAVE_UTF8_STRING event.xselectionrequest.target == proptype_utf8_string ? XUTF8StringStyle : #endif (XICCEncodingStyle) - 1; if (style != -1) { // Can convert if (XmbTextListToTextProperty(display, text_list, 1, style, &text_property) == Success) { if (text_property.format == 8) { // SendSelection supports only 8-bit data (should be always, just safety check) SendSelection(¬ify, event.xselectionrequest.property, text_property.encoding, text_property.value, text_property.nitems, True); notifySent = True; } else { // Bad format - just cleanup XFree(text_property.value); } } } #endif } } if (!notifySent) XSendEvent(display, notify.xselection.requestor, False, 0L, ¬ify); // Now clean too old incremental selections IncrementalSelectionInfo *isi = incrementalSelections, *prev_isi = NULL; time_t tnow = time(NULL); while (isi) { if (isi->lastUse + SELECTION_MAX_AGE < tnow) { IncrementalSelectionInfo *next_isi = isi->next; if (prev_isi) prev_isi->next = isi->next; else incrementalSelections = isi->next; XFree(isi->data); delete isi; isi = next_isi; } else { prev_isi = isi; isi = isi->next; } } } break; } } static void FlashCursor() { struct timeval tv; if (!CursorBlink || gettimeofday(&tv, NULL) != 0) return; unsigned long OldTime = CursorLastTime; CursorLastTime = tv.tv_sec * 1000 + tv.tv_usec / 1000; if (OldTime / CursorFlashInterval != CursorLastTime / CursorFlashInterval) DrawCursor(CursorVisible); } static TEvent Pending = { evNone }; int ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete) { fd_set read_fds; struct timeval timeout; int rc; static TEvent Queued = { evNone }; FlashCursor(); Event->What = evNone; if (Queued.What != evNone) { *Event = Queued; if (Delete) Queued.What = evNone; if (Event->What & EventMask) return 0; else Queued.What = evNone; } Event->What = evNone; if (Pending.What != evNone) { *Event = Pending; if (Delete) Pending.What = evNone; if (Event->What & EventMask) return 0; else Pending.What = evNone; } // We can't sleep for too much since we have to flash the cursor if (CursorBlink && ((WaitTime == -1) || (WaitTime > (int)CursorFlashInterval)) ) WaitTime = CursorFlashInterval; Event->What = evNone; while (Event->What == evNone) { Event->What = evNone; while (XPending(display) > 0) { FlashCursor(); ProcessXEvents(Event); if (Event->What != evNone) { while ((Event->What == evMouseMove) && (Queued.What == evNone)) { while ((rc = XPending(display)) > 0) { ProcessXEvents(&Queued); if (Queued.What == evMouseMove) { *Event = Queued; Queued.What = evNone; } else break; } if (rc <= 0) break; } } if (Delete == 0) Pending = *Event; if (Event->What & EventMask) return 0; else Pending.What = evNone; Event->What = evNone; } Event->What = evNone; FD_ZERO(&read_fds); FD_SET(ConnectionNumber(display), &read_fds); for (int p = 0; p < MAX_PIPES; p++) if (Pipes[p].used) if (Pipes[p].fd != -1) FD_SET(Pipes[p].fd, &read_fds); if ((WaitTime == -1 || WaitTime > MouseAutoDelay) && (LastMouseEvent.What == evMouseAuto) && (EventMask & evMouse)) { timeout.tv_sec = 0; timeout.tv_usec = MouseAutoDelay * 1000; rc = select(sizeof(fd_set) * 8, &read_fds, NULL, NULL, &timeout); if (rc == 0) { *Event = LastMouseEvent; return 0; } } else if ((WaitTime == -1 || WaitTime > MouseAutoRepeat) && (LastMouseEvent.What == evMouseDown || LastMouseEvent.What == evMouseMove) && (LastMouseEvent.Mouse.Buttons) && (EventMask & evMouse)) { timeout.tv_sec = 0; timeout.tv_usec = MouseAutoRepeat * 1000; rc = select(sizeof(fd_set) * 8, FD_SET_CAST() & read_fds, NULL, NULL, &timeout); if (rc == 0) { LastMouseEvent.What = evMouseAuto; *Event = LastMouseEvent; return 0; } } else if (WaitTime == -1) { rc = select(sizeof(fd_set) * sizeof(char), FD_SET_CAST() & read_fds, NULL, NULL, NULL); } else { timeout.tv_sec = 0; timeout.tv_usec = WaitTime * 1000 + 1; rc = select(sizeof(fd_set) * sizeof(char), FD_SET_CAST() & read_fds, NULL, NULL, &timeout); } if (rc == 0 || rc == -1) { Event->What = evNone; return -1; } if (FD_ISSET(ConnectionNumber(display), &read_fds)) // X has priority continue; for (int pp = 0; pp < MAX_PIPES; pp++) { if (Pipes[pp].used) if (Pipes[pp].fd != -1) if (FD_ISSET(Pipes[pp].fd, &read_fds)) { if (Pipes[pp].notify) { Event->What = evNotify; Event->Msg.View = 0; Event->Msg.Model = Pipes[pp].notify; Event->Msg.Command = cmPipeRead; Event->Msg.Param1 = pp; Pipes[pp].stopped = 0; } //fprintf(stderr, "Pipe %d\n", Pipes[pp].fd); return 0; } } } return 0; } int ConPutEvent(TEvent Event) { Pending = Event; return 0; } int ConFlush(void) { XFlush(display); return 0; } int ConGrabEvents(TEventMask /*EventMask*/) { return 0; } static int WaitForXEvent(int eventType, XEvent *event) { time_t time_started = time(NULL); for (;;) { if (XCheckTypedWindowEvent(display, win, eventType, event)) return 1; time_t tnow = time(NULL); if (time_started > tnow) time_started = tnow; if (tnow - time_started > 5) return 0; } } static void SendSelection(XEvent *notify, Atom property, Atom type, unsigned char *data, int len, Bool privateData) { int (*oldHandler)(Display *, XErrorEvent *); int i, send; // Install error handler oldHandler = XSetErrorHandler(ErrorHandler); gotXError = False; if (len < SELECTION_INCR_LIMIT) { // Send fully - set property by appending smaller chunks for (i = 0; !gotXError && i < len; i += SELECTION_XFER_LIMIT) { send = len - i; send = send < SELECTION_XFER_LIMIT ? send : SELECTION_XFER_LIMIT; XChangeProperty(display, notify->xselection.requestor, property, type, 8, PropModeReplace, data + i, send); } if (!gotXError) notify->xselection.property = property; XSendEvent(display, notify->xselection.requestor, False, 0L, notify); } else { // Send incrementally IncrementalSelectionInfo *isi = new IncrementalSelectionInfo; isi->next = incrementalSelections; isi->len = len; isi->pos = 0; isi->requestor = notify->xselection.requestor; isi->property = property; isi->type = type; isi->lastUse = time(NULL); if (privateData) { // Private data - use directly isi->data = data; // Mark data non-private so XFree() at the end won't remove it privateData = False; } else { // Non-private data - need to make copy isi->data = (unsigned char *)malloc(len); if (isi->data != NULL) memcpy(isi->data, data, len); } if (isi->data != NULL) { // Data ready - put to list and send response incrementalSelections = isi; // Request receiving requestor's property changes XSelectInput(display, notify->xselection.requestor, PropertyChangeMask); // Send total size XChangeProperty(display, notify->xselection.requestor, property, proptype_incr, 32, PropModeReplace, (unsigned char *)&len, 1); notify->xselection.property = property; } // Send also in case of error - with None property XSendEvent(display, notify->xselection.requestor, False, 0L, notify); } // Restore error handler XSetErrorHandler(oldHandler); // Cleanup if (privateData) XFree(data); } static int ConvertSelection(Atom selection, Atom type, int *len, char **data) { XEvent event; Atom actual_type; int actual_format, retval; unsigned long nitems, bytes_after; unsigned char *d; // Make sure property does not exist XDeleteProperty(display, win, prop_selection); // Request clipboard data XConvertSelection(display, selection, type, prop_selection, win, now); // Wait for SelectionNotify if (!WaitForXEvent(SelectionNotify, &event) || event.xselection.property != prop_selection) return -1; // Consume event sent when property was set by selection owner WaitForXEvent(PropertyNotify, &event); // Check the value - size, type etc. retval = XGetWindowProperty(display, win, prop_selection, 0, 0, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &d); XFree(d); if (retval != Success) return -1; if (actual_type == proptype_incr) { // Incremental data int pos, buffer_len; unsigned char *buffer; // Get selection length and allocate buffer XGetWindowProperty(display, win, prop_selection, 0, 8, True, proptype_incr, &actual_type, &actual_format, &nitems, &bytes_after, &d); buffer_len = *(int *)d; buffer = (unsigned char *)malloc(buffer_len); XFree(d); // Cannot exit right now if data == NULL since we need to complete the handshake // Now read data pos = 0; while (1) { // Wait for new value notification do { if (!WaitForXEvent(PropertyNotify, &event)) { if (buffer) free(buffer); return -1; } } while (event.xproperty.state != PropertyNewValue); // Get value size XGetWindowProperty(display, win, prop_selection, 0, 0, False, type, &actual_type, &actual_format, &nitems, &bytes_after, &d); XFree(d); // Get value and delete property XGetWindowProperty(display, win, prop_selection, 0, nitems + bytes_after, True, type, &actual_type, &actual_format, &nitems, &bytes_after, &d); if (nitems && buffer) { // Data received and have buffer if (nitems > (unsigned int)(buffer_len - pos)) { // More data than expected - realloc buffer int new_len = pos + nitems; unsigned char *new_buffer = (unsigned char *)malloc(new_len); if (new_buffer) memcpy(new_buffer, buffer, buffer_len); free(buffer); buffer = new_buffer; buffer_len = new_len; } if (buffer) memcpy(buffer + pos, d, nitems); pos += nitems; } XFree(d); if (nitems == 0) { // No more data - done if (!buffer) { // No buffer - failed return -1; } else { // Buffer OK - exit loop and continue to data conversion nitems = pos; d = buffer; break; } } } } else { // Obtain the data from property retval = XGetWindowProperty(display, win, prop_selection, 0, nitems + bytes_after, True, type, &actual_type, &actual_format, &nitems, &bytes_after, &d); if (retval != Success) { return -1; } } // Now convert data to char string (uses nitems and d) if (actual_type == XA_STRING) { // String - propagate directly out of this function // This propagation is not safe since it expects XFree() to be the same as free(). // Rather we should make a copy of the received data. The similar applies to data // propagated from INCR branch above - they are allocated by malloc() but get freed // by XFree() after Xmb conversion below. *data = (char *)d; *len = nitems; } else { #if USE_XMB // Convert data to char * string XTextProperty text; char **list; int list_count; text.value = d; text.encoding = actual_type; text.format = actual_format; text.nitems = nitems; *data = NULL; // NULL indicates failure retval = XmbTextPropertyToTextList(display, &text, &list, &list_count); XFree(d); if (retval >= 0) { // Conversion OK - now we'll concat all the strings together int i; // Get total length first *len = 0; for (i = 0; i < list_count; i++) { *len += strlen(list[i]); } // Allocate *data = (char *)malloc(*len + 1); if (*data != NULL) { // Concat strings char *s = *data; for (i = 0; i < list_count; i++) { strcpy(s, list[i]); s += strlen(s); } } // Cleanup XFreeStringList(list); } if (*data == NULL) return -1; // failed #else return -1; #endif } // OK return 0; } int GetXSelection(int *len, char **data, int clipboard) { if (CurSelectionOwn[clipboard]) { *data = (char *) malloc(CurSelectionLen[clipboard]); if (*data == 0) return -1; memcpy(*data, CurSelectionData[clipboard], CurSelectionLen[clipboard]); *len = CurSelectionLen[clipboard]; return 0; } else { Atom clip = GetXClip(clipboard); if (XGetSelectionOwner(display, clip) != None) { // Get data - try various formats #ifdef USE_XMB #ifdef X_HAVE_UTF8_STRING if (ConvertSelection(clip, proptype_utf8_string, len, data) == 0) return 0; #endif if (ConvertSelection(clip, proptype_compound_text, len, data) == 0) return 0; #endif return ConvertSelection(clip, XA_STRING, len, data); } } *data = XFetchBytes(display, len); if (*data == 0) return -1; else return 0; } int SetXSelection(int len, char *data, int clipboard) { Atom clip = GetXClip(clipboard); if (CurSelectionData[clipboard] != NULL) free(CurSelectionData[clipboard]); // We need CurSelectionData zero-terminated so XmbTextListToTextProperty can work CurSelectionData[clipboard] = (unsigned char *)malloc(len + 1); if (CurSelectionData[clipboard] == NULL) { CurSelectionLen[clipboard] = 0; return -1; } CurSelectionLen[clipboard] = len; memcpy(CurSelectionData[clipboard], data, CurSelectionLen[clipboard]); CurSelectionData[clipboard][len] = 0; if (CurSelectionLen[clipboard] < 64 * 1024) { XStoreBytes(display, data, len); } XSetSelectionOwner(display, clip, win, CurrentTime); if (XGetSelectionOwner(display, clip) == win) CurSelectionOwn[clipboard] = 1; return 0; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) { int o = 1; for (int c = 1; c < argc; c++) { if (strcmp(argv[c], "-display") == 0) { if (c + 1 < argc) { display_name = strdup(argv[++c]); } } else if (strcmp(argv[c], "-font") == 0) { if (c + 1 < argc) { strcpy(WindowFont, argv[++c]); } } else if (strcmp(argv[c], "-geometry") == 0) { if (c + 1 < argc) { XParseGeometry(argv[++c], &initX, &initY, &ScreenCols, &ScreenRows); if (ScreenCols > ConMaxCols) ScreenCols = ConMaxCols; else if (ScreenCols < MIN_SCRWIDTH) ScreenCols = MIN_SCRWIDTH; if (ScreenRows > ConMaxRows) ScreenRows = ConMaxRows; else if (ScreenRows < MIN_SCRHEIGHT) ScreenRows = MIN_SCRHEIGHT; XSize = YSize = -1; setUserPosition = 1; } } else if ((strcmp(argv[c], "-noxmb") == 0) || (strcmp(argv[c], "--noxmb") == 0)) { useXMB = 0; } else if ((strcmp(argv[c], "-no18n") == 0) || (strcmp(argv[c], "--noi18n") == 0)) { useI18n = 0; } else if (strcmp(argv[c], "-name") == 0) { if (c + 1 < argc) { snprintf(res_name, sizeof(res_name), "%s", argv [++c]); } } else if (strcmp(argv[c], "-wclass") == 0) { if (c + 1 < argc) { snprintf(res_class, sizeof(res_class), "%s", argv [++c]); } } else if (strcmp(argv[c], "-wname") == 0) { if (c + 1 < argc) { snprintf(win_name, sizeof(win_name), "%s", argv [++c]); } } else argv[o++] = argv[c]; } argc = o; argv[argc] = 0; if (::ConInit(XSize, YSize) == 0 && SetupXWindow(argc, argv) == 0) gui = this; else gui = NULL; fArgc = argc; fArgv = argv; } GUI::~GUI() { i18n_destroy(&i18n_ctx); for (int i = 0; i < 256; i++) XFreeGC(display, GCs[i]); #ifdef USE_XMB if (fontSet) XFreeFontSet(display, fontSet); #endif if (fontStruct) XFreeFont(display, fontStruct); XDestroyWindow(display, win); XCloseDisplay(display); for (int i = 0; i < 3; i++) { if (CurSelectionData[i] != NULL) { free(CurSelectionData[i]); } } ::ConDone(); } int GUI::ConSuspend(void) { return ::ConSuspend(); } int GUI::ConContinue(void) { return ::ConContinue(); } int GUI::ShowEntryScreen() { return 1; } int GUI::OpenPipe(char *Command, EModel *notify) { #ifndef NO_PIPES int i; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) { int pfd[2]; Pipes[i].id = i; Pipes[i].notify = notify; Pipes[i].stopped = 1; if (pipe((int *)pfd) == -1) return -1; switch (Pipes[i].pid = fork()) { case -1: /* fail */ return -1; case 0: /* child */ signal(SIGPIPE, SIG_DFL); close(pfd[0]); close(0); assert(open("/dev/null", O_RDONLY) == 0); dup2(pfd[1], 1); dup2(pfd[1], 2); close(pfd[1]); exit(system(Command)); default: close(pfd[1]); fcntl(pfd[0], F_SETFL, O_NONBLOCK); Pipes[i].fd = pfd[0]; } Pipes[i].used = 1; //fprintf(stderr, "Pipe Open: %d\n", i); return i; } } return -1; #else return 0; #endif } int GUI::SetPipeView(int id, EModel *notify) { #ifndef NO_PIPES if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; //fprintf(stderr, "Pipe View: %d %08X\n", id, notify); Pipes[id].notify = notify; #endif return 0; } int GUI::ReadPipe(int id, void *buffer, int len) { #ifndef NO_PIPES int r; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; //fprintf(stderr, "Pipe Read: Get %d %d\n", id, len); r = read(Pipes[id].fd, buffer, len); //fprintf(stderr, "Pipe Read: Got %d %d\n", id, len); if (r == 0) { close(Pipes[id].fd); Pipes[id].fd = -1; return -1; } if (r == -1) { Pipes[id].stopped = 1; return 0; } return r; #else return 0; #endif } int GUI::ClosePipe(int id) { #ifndef NO_PIPES int status; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; if (Pipes[id].fd != -1) close(Pipes[id].fd); kill(Pipes[id].pid, SIGHUP); alarm(2); waitpid(Pipes[id].pid, &status, 0); alarm(0); //fprintf(stderr, "Pipe Close: %d\n", id); Pipes[id].used = 0; return WEXITSTATUS(status); #else return 0; #endif } int GUI::RunProgram(int mode, char *Command) { char Cmd[1024]; strlcpy(Cmd, XShellCommand, sizeof(Cmd)); if (*Command == 0) // empty string = shell strlcat(Cmd, " -ls &", sizeof(Cmd)); else { strlcat(Cmd, " -e ", sizeof(Cmd)); strlcat(Cmd, Command, sizeof(Cmd)); if (mode == RUN_ASYNC) strlcat(Cmd, " &", sizeof(Cmd)); } return system(Cmd); } char ConGetDrawChar(int idx) { static const char *tab = NULL; if (!tab) { tab = GetGUICharacters("X11", "\x0D\x0C\x0E\x0B\x12\x19____+>\x1F\x01\x12 "); } assert(idx >= 0 && idx < (int) strlen(tab)); return tab[idx]; } efte-1.1/src/pmdlg.rc0000664000076400007640000001260511257205413013546 0ustar laurilauri/* pmdlg */ #include "pmdlg.h" ICON IDD_ICON1 icons\ftepm.ico ICON IDD_ICON2 icons\error.ico DLGTEMPLATE IDD_FIND BEGIN DIALOG "Find text...", IDD_FIND, 10, 13, 240, 79, WS_VISIBLE, FCF_SYSMENU | FCF_TITLEBAR PRESPARAMS PP_FONTNAMESIZE, "8.Helv" BEGIN CONTROL "Find", IDL_FIND, 3, 66, 25, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE CONTROL "", IDE_FIND, 37, 20, 198, 55, WC_COMBOBOX, CBS_DROPDOWN | LS_HORZSCROLL | WS_VISIBLE | WS_GROUP | WS_TABSTOP CONTROL "Options", 101, 3, 21, 231, 42, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP CONTROL "~Ignore Case", IDC_IGNORECASE, 9, 45, 75, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE | WS_GROUP | WS_TABSTOP CONTROL "Rege~xps", IDC_REGEXPS, 9, 34, 77, 11, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Words only", IDC_WORDS, 9, 24, 74, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Block", IDC_BLOCK, 86, 45, 60, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Global", IDC_GLOBAL, 86, 35, 63, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Reverse", IDC_REVERSE, 86, 25, 68, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~All occurences", IDC_ALLOCCURENCES, 155, 45, 72, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Delete line", IDC_DELETELINE, 155, 35, 73, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Join line", IDC_JOINLINE, 155, 25, 75, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE DEFPUSHBUTTON "OK", DID_OK, 3, 3, 51, 14, BS_PUSHBUTTON | BS_DEFAULT | WS_VISIBLE | WS_GROUP | WS_TABSTOP PUSHBUTTON "Cancel", DID_CANCEL, 58, 3, 51, 14 END END DLGTEMPLATE IDD_FINDREPLACE BEGIN DIALOG "Find and replace...", IDD_FINDREPLACE, 9, 27, 240, 91, WS_VISIBLE, FCF_SYSMENU | FCF_TITLEBAR PRESPARAMS PP_FONTNAMESIZE, "8.Helv" BEGIN CONTROL "Find", IDL_FIND, 4, 78, 29, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE CONTROL "", IDE_FIND, 45, 21, 189, 67, WC_COMBOBOX, CBS_DROPDOWN | LS_HORZSCROLL | WS_VISIBLE | WS_GROUP | WS_TABSTOP CONTROL "Replace", IDL_REPLACE, 4, 64, 35, 9, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP CONTROL "", IDE_REPLACE, 45, 12, 189, 63, WC_COMBOBOX, CBS_DROPDOWN | LS_HORZSCROLL | WS_VISIBLE | WS_GROUP | WS_TABSTOP CONTROL "Options", 101, 4, 21, 232, 41, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP CONTROL "~Ignore Case", IDC_IGNORECASE, 9, 45, 77, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE | WS_GROUP | WS_TABSTOP CONTROL "Rege~xps", IDC_REGEXPS, 9, 34, 75, 11, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Words only", IDC_WORDS, 9, 24, 77, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Block", IDC_BLOCK, 86, 45, 64, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Global", IDC_GLOBAL, 86, 35, 64, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Reverse", IDC_REVERSE, 86, 25, 68, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~All occurences", IDC_ALLOCCURENCES, 154, 45, 72, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~No prompting", IDC_NOPROMPTING, 154, 35, 72, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Join Line", IDC_JOINLINE, 154, 25, 76, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE | WS_GROUP | WS_TABSTOP DEFPUSHBUTTON "OK", DID_OK, 4, 3, 51, 14, BS_PUSHBUTTON | BS_DEFAULT | WS_VISIBLE | WS_GROUP | WS_TABSTOP PUSHBUTTON "Cancel", DID_CANCEL, 59, 3, 51, 14 END END DLGTEMPLATE IDD_PROMPT BEGIN DIALOG "", IDD_PROMPT, 6, 125, 198, 50, WS_VISIBLE, FCF_SYSMENU | FCF_TITLEBAR PRESPARAMS PP_FONTNAMESIZE, "8.Helv" BEGIN CONTROL "", IDS_PROMPT, 3, 39, 192, 7, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP CONTROL "", IDE_FIELD, 4, 3, 191, 34, WC_COMBOBOX, CBS_DROPDOWN | WS_VISIBLE | WS_GROUP | WS_TABSTOP DEFPUSHBUTTON "OK", DID_OK, 4, 3, 51, 14 PUSHBUTTON "Cancel", DID_CANCEL, 59, 3, 51, 14 END END DLGTEMPLATE IDD_ABOUT BEGIN DIALOG "", 0, 100, 100, 200, 88, , FCF_DLGBORDER PRESPARAMS PP_FONTNAMESIZE, "8.Helv" BEGIN CTEXT "EFTE/2 1.1 for OS/2 and ECS" -1, 10, 64, 180, 8 ICON IDD_ICON1, -1, 8, 56, 0, 0 CTEXT "Copyright (c) 2000-2005 Others" -1, 10, 40, 180, 8 CTEXT "Copyright (c) 1994-1998 Marko Macek" -1, 10, 32, 180, 8 DEFPUSHBUTTON "OK" DID_OK, 80, 8, 40, 16, WS_GROUP END END DLGTEMPLATE IDD_INFO LOADONCALL MOVEABLE DISCARDABLE BEGIN DIALOG "Information", INFO_TITLE, 72, 100, 200, 56, WS_VISIBLE, FCF_TITLEBAR | FCF_DLGBORDER PRESPARAMS PP_FONTNAMESIZE, "8.Helv" BEGIN PUSHBUTTON "OK", DID_OK, 89, 4, 40, 14 CTEXT "TEXT", INFO_TEXT, 10, 32, 180, 8 END END DLGTEMPLATE IDD_ERROR LOADONCALL MOVEABLE DISCARDABLE BEGIN DIALOG "Error!", INFO_ETITLE, 72, 100, 200, 56, WS_VISIBLE, FCF_TITLEBAR | FCF_DLGBORDER PRESPARAMS PP_FONTNAMESIZE, "8.Helv" BEGIN ICON IDD_ICON2, -1, 8, 56, 0, 0 CTEXT "TEXT", INFO_TEXT, 10, 32, 180, 8 DEFPUSHBUTTON "OK", DID_OK, 89, 4, 40, 14 END END efte-1.1/src/gui.h0000664000076400007640000001410111041434500013033 0ustar laurilauri/* gui.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __GUI_H #define __GUI_H #include "console.h" #include #define RUN_WAIT 0 #define RUN_ASYNC 1 class GFramePeer; class GViewPeer; class GUI; class GFrame; class GView { public: GFrame *Parent; GView *Next, *Prev; GViewPeer *Peer; int Result; GView(GFrame *parent, int XSize, int YSize); virtual ~GView(); int ConClear(); int ConPutBox(int X, int Y, int W, int H, PCell Cell); int ConGetBox(int X, int Y, int W, int H, PCell Cell); int ConPutLine(int X, int Y, int W, int H, PCell Cell); int ConSetBox(int X, int Y, int W, int H, TCell Cell); int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); int ConSetCursorPos(int X, int Y); int ConQueryCursorPos(int *X, int *Y); int ConShowCursor(); int ConHideCursor(); int ConCursorVisible(); void ConSetInsertState(bool insert); int CaptureMouse(int grab); int CaptureFocus(int grab); virtual int Execute(); void EndExec(int NewResult); int QuerySbVPos(); int SetSbVPos(int Start, int Amount, int Total); int SetSbHPos(int Start, int Amount, int Total); int ExpandHeight(int DeltaY); int IsActive(); virtual void Update(); virtual void Repaint(); virtual void Activate(int gotfocus); virtual void Resize(int width, int height); virtual void HandleEvent(TEvent &Event); }; class GFrame { public: GFrame *Prev, *Next; GView *Top, *Active; GFramePeer *Peer; char *Menu; GFrame(int XSize, int YSize); virtual ~GFrame(); int ConSetTitle(char *Title, char *STitle); int ConGetTitle(char *Title, int MaxLen, char *STitle, int SMaxLen); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); int AddView(GView *view); int ConSplitView(GView *view, GView *newview); int ConCloseView(GView *view); int ConResizeView(GView *view, int DeltaY); int SelectView(GView *view); virtual void Update(); virtual void Repaint(); virtual void UpdateMenu(); void InsertView(GView *Prev, GView *view); void RemoveView(GView *view); void SelectNext(int back); void Resize(int width, int height); void DrawMenuBar(); int ExecMainMenu(char Sub); int SetMenu(const char *Name); char *QueryMenu(); int PopupMenu(const char *Name); void Show(); void Activate(); int isLastFrame(); }; class GUI { public: GUI(int &argc, char **argv, int XSize, int YSize); virtual ~GUI(); int ConSuspend(); int ConContinue(); int ShowEntryScreen(); void ProcessEvent(); virtual void DispatchEvent(GFrame *frame, GView *view, TEvent &Event); int ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete, GView **view); int ConPutEvent(TEvent Event); int ConFlush(void); int ConGrabEvents(TEventMask EventMask); virtual int Start(int &argc, char **argv); virtual void Stop(); int Run(); void StopLoop(); int RunProgram(int mode, char *Command); int OpenPipe(char *Command, EModel *notify); int SetPipeView(int id, EModel *notify); int ReadPipe(int id, void *buffer, int len); int ClosePipe(int id); int multiFrame(); void deleteFrame(GFrame *frame); int fArgc; char **fArgv; int doLoop; }; extern GFrame *frames; extern GUI *gui; #define GUIDLG_CHOICE 0x00000001 #define GUIDLG_PROMPT 0x00000002 #define GUIDLG_PROMPT2 0x00000004 #define GUIDLG_FILE 0x00000008 #define GUIDLG_FIND 0x00000010 #define GUIDLG_FINDREPLACE 0x00000020 extern unsigned long HaveGUIDialogs; void DieError(int rc, const char *msg, ...); #define GF_OPEN 0x0001 #define GF_SAVEAS 0x0002 int DLGGetStr(GView *View, const char *Prompt, unsigned int BufLen, char *Str, int HistId, int Flags); int DLGGetFile(GView *View, const char *Prompt, unsigned int BufLen, char *FileName, int Flags); #define GPC_NOTE 0x0000 #define GPC_CONFIRM 0x0001 #define GPC_WARNING 0x0002 #define GPC_ERROR 0x0004 #define GPC_FATAL 0x0008 #define GPC_ABOUT 0x00016 int DLGPickChoice(GView *View, const char *ATitle, int NSel, va_list ap, int Flags); #define SEARCH_BACK 0x00000001 // reverse (TODO for regexps) #define SEARCH_RE 0x00000002 // use regexp #define SEARCH_NCASE 0x00000004 // case #define SEARCH_GLOBAL 0x00000008 // start from beggining (or end if BACK) #define SEARCH_BLOCK 0x00000010 // search in block #define SEARCH_NEXT 0x00000020 // next match #define SEARCH_NASK 0x00000040 // ask before replacing #define SEARCH_ALL 0x00000080 // search all #define SEARCH_REPLACE 0x00000100 // do a replace operation #define SEARCH_JOIN 0x00000200 // join line #define SEARCH_SPLIT 0x00000800 // split the line #define SEARCH_DELETE 0x00000400 // delete line #define SEARCH_CENTER 0x00001000 // center finds #define SEARCH_NOPOS 0x00002000 // don't move the cursor #define SEARCH_WORDBEG 0x00004000 // match at beginning of words only #define SEARCH_WORDEND 0x00008000 // match at end of words only #define SEARCH_WORD (SEARCH_WORDBEG | SEARCH_WORDEND) //0x00000800 // search words //#define SEARCH_LINE 0x00002000 // search on current line only TODO //#define SEARCH_WRAP 0x00004000 // similiar to GLOBAL, but goes to start // only when match from current position fails TODO //#define SEARCH_BOL 0x00008000 // search at line start //#define SEARCH_EOL 0x00010000 // search at line end #define MAXSEARCH 512 typedef struct { int ok; char strSearch[MAXSEARCH]; char strReplace[MAXSEARCH]; unsigned long Options; // int resCount; int lastInsertLen; } SearchReplaceOptions; int DLGGetFind(GView *View, SearchReplaceOptions &sr); int DLGGetFindReplace(GView *View, SearchReplaceOptions &sr); #endif efte-1.1/src/e_win32.cpp0000664000076400007640000000226611041404761014067 0ustar laurilauri/* e_win32.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1997, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // Win32 (NT) specific routines #include "fte.h" // Silence warnings about redefinition, we don't need this here anyway. #undef SEARCH_ALL #include int EView::SysShowHelp(ExState &State, const char *word) { char file[MAXPATH] = ""; if (State.GetStrParam(this, file, sizeof(file) - 1) == 0) if (MView->Win->GetStr("Help file", sizeof(file) - 1, file, HIST_DEFAULT) == 0) return 0; char wordAsk[64] = ""; if (word == 0) { if (State.GetStrParam(this, wordAsk, sizeof(wordAsk) - 1) == 0) if (MView->Win->GetStr("Keyword", sizeof(wordAsk) - 1, wordAsk, HIST_DEFAULT) == 0) return 0; word = wordAsk; } //** Start WinHelp, if (!WinHelp(0, file, HELP_KEY, (DWORD)word)) { Msg(S_ERROR, "Failed to start WinHelp!"); return 0; } return 1; } efte-1.1/src/conkbd.h0000664000076400007640000000501411041404761013520 0ustar laurilauri/* conkbd.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __CONKBD_H__ #define __CONKBD_H__ #define kfAltXXX 0x01000000L #define kfModifier 0x02000000L #define kfSpecial 0x00010000L #define kfAlt 0x00100000L #define kfCtrl 0x00200000L #define kfShift 0x00400000L #define kfGray 0x00800000L #define kfKeyUp 0x10000000L #define kfAll 0x00F00000L #define isAltXXX(x) (((x) & (kfAltXXX)) != 0) #define isAlt(x) (((x) & kfAlt) != 0) #define isCtrl(x) (((x) & kfCtrl) != 0) #define isShift(x) (((x) & kfShift) != 0) #define isGray(x) (((x) & kfGray) != 0) #define keyType(x) ((x) & kfAll) #define keyCode(x) ((x) & 0x000FFFFF) #define kbCode(x) (((x) & 0x0FFFFFFF) & ~(kfGray | kfAltXXX)) #define isAscii(x) ((((x) & (kfAlt | kfCtrl)) == 0) && (keyCode(x) < 256)) #define kbF1 (kfSpecial | 0x101) #define kbF2 (kfSpecial | 0x102) #define kbF3 (kfSpecial | 0x103) #define kbF4 (kfSpecial | 0x104) #define kbF5 (kfSpecial | 0x105) #define kbF6 (kfSpecial | 0x106) #define kbF7 (kfSpecial | 0x107) #define kbF8 (kfSpecial | 0x108) #define kbF9 (kfSpecial | 0x109) #define kbF10 (kfSpecial | 0x110) #define kbF11 (kfSpecial | 0x111) #define kbF12 (kfSpecial | 0x112) #define kbUp (kfSpecial | 0x201) #define kbDown (kfSpecial | 0x202) #define kbLeft (kfSpecial | 0x203) #define kbCenter (kfSpecial | 0x204) #define kbRight (kfSpecial | 0x205) #define kbHome (kfSpecial | 0x206) #define kbEnd (kfSpecial | 0x207) #define kbPgUp (kfSpecial | 0x208) #define kbPgDn (kfSpecial | 0x209) #define kbIns (kfSpecial | 0x210) #define kbDel (kfSpecial | 0x211) #define kbSpace 32 #define kbBackSp (kfSpecial | 8) #define kbTab (kfSpecial | 9) #define kbEnter (kfSpecial | 13) #define kbEsc (kfSpecial | 27) #define kbAlt (kfModifier | 0x301) #define kbCtrl (kfModifier | 0x302) #define kbShift (kfModifier | 0x303) #define kbCapsLock (kfModifier | 0x304) #define kbNumLock (kfModifier | 0x305) #define kbScrollLock (kfModifier | 0x306) #define kbPause (kfSpecial | 0x401) #define kbPrtScr (kfSpecial | 0x402) #define kbSysReq (kfSpecial | 0x403) #define kbBreak (kfSpecial | 0x404) #endif efte-1.1/src/e_undo.h0000664000076400007640000000201111041404761013523 0ustar laurilauri/* e_undo.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __UNDO_H__ #define __UNDO_H__ /* * only core operations can be directly undone * - Insert # of Lines * - Delete # of Lines * - Insert # Line * - Delete Line Text * - Insert Line Text * - Positioning * - Block marking */ #define ucInsLine 1 #define ucDelLine 2 #define ucInsChars 3 #define ucDelChars 4 #define ucJoinLine 5 #define ucSplitLine 6 #define ucPosition 7 #define ucBlock 8 #define ucModified 9 #define ucFoldCreate 11 #define ucFoldDestroy 12 #define ucFoldPromote 13 #define ucFoldDemote 14 #define ucFoldOpen 15 #define ucFoldClose 16 #define ucPlaceUserBookmark 17 #define ucRemoveUserBookmark 18 #endif efte-1.1/src/cliputil.def0000664000076400007640000000016607045071303014420 0ustar laurilauriNAME ClipUtil WINDOWCOMPAT DESCRIPTION 'Clipboard Utility - get/put clipboard text from command line' STACKSIZE 49152 efte-1.1/src/e_trans.cpp0000664000076400007640000001420111041404761014244 0ustar laurilauri/* * e_trans.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include // FLAW: NULL characters can not be translated, need escaping int ParseTrans(unsigned char *S, unsigned char *D, TransTable tab) { unsigned char Dest[512]; unsigned char A, B; unsigned int i; if (S == 0 || D == 0) return 0; strncpy((char *)Dest, (char *)D, sizeof(Dest) - 1); Dest[sizeof(Dest) - 1] = 0; D = Dest; // no translation for (i = 0; i < 256; i++) tab[i] = (unsigned char)i; while (*S && *D) { if (S[0] && S[1] == '-' && S[2]) { if (S[0] <= S[2]) { A = (*S)++; if (S[0] >= S[2]) S += 2; } else { A = (*S)--; if (S[0] <= S[2]) S += 2; } } else { A = *S++; } if (D[0] && D[1] == '-' && D[2]) { if (D[0] <= D[2]) { B = (*D)++; if (D[0] >= D[2]) D += 2; } else { B = (*D)--; if (D[0] <= D[2]) D += 2; } } else { B = *D++; } tab[A] = B; } if (*S != *D) // one was too short return 0; return 1; } int MakeTrans(TransTable tab, int What) { int i; // no translation for (i = 0; i <= 255; i++) tab[i] = (unsigned char)i; switch (What) { case ccToggle: case ccUp: for (i = 33; i <= 255; i++) if (isalpha(i) && (toupper(i) != i)) tab[i] = (unsigned char) toupper(i); if (What != ccToggle) break; case ccDown: for (i = 33; i <= 255; i++) if (isalpha(i) && (i == tab[i]) && (tolower(i) != i)) tab[i] = (unsigned char) tolower(i); break; default: return 0; } return 1; } int EBuffer::BlockTrans(TransTable tab) { int L, I, B, E; PELine LL; if (CheckBlock() == 0) return 0; if (RCount == 0) return 0; for (L = BB.Row; L <= BE.Row; L++) { LL = RLine(L); B = 0; E = 0; switch (BlockMode) { case bmLine: if (L == BE.Row) E = 0; else E = LL->Count; break; case bmColumn: if (L == BE.Row) E = 0; else { B = CharOffset(LL, BB.Col); E = CharOffset(LL, BE.Col); } break; case bmStream: if (L == BB.Row && L == BE.Row) { B = CharOffset(LL, BB.Col); E = CharOffset(LL, BE.Col); } else if (L == BB.Row) { B = CharOffset(LL, BB.Col); E = LL->Count; } else if (L == BE.Row) { B = 0; E = CharOffset(LL, BE.Col); } else { B = 0; E = LL->Count; } break; } if (B > LL->Count) B = LL->Count; if (E > LL->Count) E = LL->Count; if (E > B) { if (ChgChars(L, B, E - B, 0) == 0) return 0; for (I = B; I < E; I++) LL->Chars[I] = tab[(unsigned char)LL->Chars[I]]; } } Draw(BB.Row, BE.Row); return 1; } int EBuffer::CharTrans(TransTable tab) { PELine L = VLine(CP.Row); unsigned int P = CharOffset(L, CP.Col); if (P >= (unsigned int)L->Count) return 0; if (ChgChars(CP.Row, P, 1, 0) == 0) return 0; L->Chars[P] = tab[(unsigned char)L->Chars[P]]; return 1; } int EBuffer::LineTrans(TransTable tab) { PELine L = VLine(CP.Row); int I; if (L->Count > 0) { if (ChgChars(CP.Row, 0, L->Count, 0) == 0) return 0; for (I = 0; I < L->Count; I++) L->Chars[I] = tab[(unsigned char)L->Chars[I]]; } return 1; } int EBuffer::CharCaseUp() { TransTable tab; MakeTrans(tab, ccUp); return CharTrans(tab); } int EBuffer::CharCaseDown() { TransTable tab; MakeTrans(tab, ccDown); return CharTrans(tab); } int EBuffer::CharCaseToggle() { TransTable tab; MakeTrans(tab, ccToggle); return CharTrans(tab); } int EBuffer::LineCaseUp() { TransTable tab; MakeTrans(tab, ccUp); return LineTrans(tab); } int EBuffer::LineCaseDown() { TransTable tab; MakeTrans(tab, ccDown); return LineTrans(tab); } int EBuffer::LineCaseToggle() { TransTable tab; MakeTrans(tab, ccToggle); return LineTrans(tab); } int EBuffer::BlockCaseUp() { TransTable tab; MakeTrans(tab, ccUp); return BlockTrans(tab); } int EBuffer::BlockCaseDown() { TransTable tab; MakeTrans(tab, ccDown); return BlockTrans(tab); } int EBuffer::BlockCaseToggle() { TransTable tab; MakeTrans(tab, ccToggle); return BlockTrans(tab); } int EBuffer::GetTrans(ExState &State, TransTable tab) { unsigned char TrS[512] = ""; unsigned char TrD[512] = ""; if (State.GetStrParam(View, (char *)TrS, sizeof(TrS)) == 0) if (View->MView->Win->GetStr("Trans From", sizeof(TrS), (char *)TrS, HIST_TRANS) == 0) return 0; if (State.GetStrParam(View, (char *)TrD, sizeof(TrD)) == 0) if (View->MView->Win->GetStr("Trans To", sizeof(TrS), (char *)TrD, HIST_TRANS) == 0) return 0; if (ParseTrans(TrS, TrD, tab) == 0) { Msg(S_ERROR, "Bad Trans Arguments %s %s.", TrS, TrD); return 0; } return 1; } int EBuffer::CharTrans(ExState &State) { TransTable tab; if (GetTrans(State, tab) == 0) return 0; return CharTrans(tab); } int EBuffer::LineTrans(ExState &State) { TransTable tab; if (GetTrans(State, tab) == 0) return 0; return LineTrans(tab); } int EBuffer::BlockTrans(ExState &State) { TransTable tab; if (GetTrans(State, tab) == 0) return 0; return BlockTrans(tab); } efte-1.1/src/c_mode.cpp0000664000076400007640000001020711042635671014050 0ustar laurilauri/* c_mode.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" EBufferFlags DefaultBufferFlags = { { 1, // AutoIndent 1, // InsertOn 0, // DrawOn 1, // HilitOn 1, // ExpandTabs 0, // Trim 8, // TabSize HILIT_PLAIN, // HilitMode INDENT_PLAIN, // IndentMode 0, // ShowTab 10, // LineChar #if !defined(UNIX) 13, // StripChar #else -1, #endif 1, // AddLine #if !defined(UNIX) 1, // AddStrip #else 0, #endif 0, // ForceNewLine 0, // HardMode 1, // UndoRedo 0, // ReadOnly 0, // AutoSave 1, // KeepBackups -1, // LoadMargin 256, // Max Undo/Redo Commands 1, // MatchCase 0, // BackKillTab 0, // DelKillTab 1, // BackSpUnindent 0, // SpaceTabs 1, // IndentWTabs 1, // Wrap.LeftMargin 72, // Wrap.RightMargin 0, // See Thru Sel 0, // WordWrap 0, // ShowMarkers 1, // CursorThroughTabs 0, // Save Folds 0, // MultiLineHilit 0, // AutoHilitParen 0, // Abbreviations 0, // BackSpKillBlock 0, // DeleteKillBlock 1, // PersistentBlocks 0, // InsertKillBlock 0, // EventMap 0, // UndoMoves #ifdef UNIX 0, // DetectLineSep #else 1, #endif 0, // trim on save 0, // save bookmarks 1, // HilitTags 0, // ShowBookmarks 1 // MakeBackups }, { 0, // Routine Regexp 0, // DefFindOpt 0, // DefFindReplaceOpt 0, // comment start (folds) 0, // comment end (folds) 0, // filename rx 0, // firstline rx 0 // compile command } }; EMode *GetModeForName(const char *FileName) { // char ext[10]; // char *p; int l, i; EMode *m; RxMatchRes RM; char buf[81]; int fd; m = Modes; while (m) { if (m->MatchNameRx) if (RxExec(m->MatchNameRx, FileName, strlen(FileName), FileName, &RM, RX_CASE) == 1) return m; if (m->fNext == 0) break; m = m->fNext; } fd = open(FileName, O_RDONLY); if (fd != -1) { l = read(fd, buf, 80); close(fd); if (l > 0) { buf[l] = 0; for (i = 0; i < l; i++) { if (buf[i] == '\n') { buf[i] = 0; l = i; break; } } m = Modes; while (m) { if (m->MatchLineRx) if (RxExec(m->MatchLineRx, buf, l, buf, &RM, RX_CASE) == 1) return m; if (m->fNext == 0) break; m = m->fNext; } } } if ((m = FindMode(DefaultModeName)) != 0) return m; m = Modes; while (m && m->fNext) m = m->fNext; return m; } efte-1.1/src/c_history.h0000664000076400007640000000343411041404761014267 0ustar laurilauri/* c_history.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __FPOSHIST_H__ #define __FPOSHIST_H__ #ifdef UNIX #define HISTORY_NAME ".efte-history" #else #define HISTORY_NAME "efte.his" #endif typedef struct { char *Name; int Row, Col; } HBookmark; typedef struct { char *FileName; int Row, Col; HBookmark **Books; int BookCount; } FPosHistory; #define MAX_INPUT_HIST 128 typedef struct { int Count; char **Line; int *Id; } InputHistory; extern char HistoryFileName[256]; void ClearHistory(); int SaveHistory(char *FileName); int LoadHistory(char *FileName); int UpdateFPos(char *FileName, int Row, int Col); int RetrieveFPos(char *FileName, int &Row, int &Col); int AddInputHistory(int Id, char *String); int CountInputHistory(int Id); int GetInputHistory(int Id, char *String, int maxlen, int Nth); // some platforms don't know about EBuffer yet class EBuffer; /* * Get bookmarks for given Buffer (file) from history. */ int RetrieveBookmarks(EBuffer *buf); /* * Store given Buffer's bookmarks to history. */ int StoreBookmarks(EBuffer *buf); /* history values */ #define HIST_DEFAULT 0 #define HIST_PATH 1 #define HIST_SEARCH 2 #define HIST_POSITION 3 #define HIST_SETUP 4 #define HIST_SHELL 5 #define HIST_COMPILE 6 #define HIST_SEARCHOPT 7 #define HIST_BOOKMARK 8 #define HIST_REGEXP 9 #define HIST_TRANS 10 #define HIST_TAGFILES 11 #define HIST_CVS 12 #define HIST_CVSDIFF 13 #define HIST_CVSCOMMIT 14 #define HIST_SVN 15 #define HIST_SVNDIFF 16 #define HIST_SVNCOMMIT 17 #endif efte-1.1/src/fnmatch.h0000664000076400007640000000573411041366545013720 0ustar laurilauri/* Copyright (C) 1991, 92, 93, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _FNMATCH_H #define _FNMATCH_H 1 #ifdef __cplusplus extern "C" { #endif #if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32 # if !defined __GLIBC__ || !defined __P # undef __P # define __P(protos) protos # endif #else /* Not C++ or ANSI C. */ # undef __P # define __P(protos) () /* We can get away without defining `const' here only because in this file it is used only inside the prototype for `fnmatch', which is elided in non-ANSI C where `const' is problematical. */ #endif /* C++ or ANSI C. */ #ifndef const # if (defined __STDC__ && __STDC__) || defined __cplusplus # define __const const # else # define __const # endif #endif /* We #undef these before defining them because some losing systems (HP-UX A.08.07 for example) define these in . */ #undef FNM_PATHNAME #undef FNM_NOESCAPE #undef FNM_PERIOD /* Bits set in the FLAGS argument to `fnmatch'. */ #define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ #define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE # define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ # define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ # define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ #endif /* Value returned by `fnmatch' if STRING does not match PATTERN. */ #define FNM_NOMATCH 1 /* This value is returned if the implementation does not support `fnmatch'. Since this is not the case here it will never be returned but the conformance test suites still require the symbol to be defined. */ #ifdef _XOPEN_SOURCE # define FNM_NOSYS (-1) #endif /* Match STRING against the filename pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ extern int fnmatch __P((__const char *__pattern, __const char *__string, int __flags)); #ifdef __cplusplus } #endif #endif /* fnmatch.h */ efte-1.1/src/h_ipf.cpp0000664000076400007640000000640211041404761013702 0ustar laurilauri/* h_ipf.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #define hsIPF_Normal 0 #define hsIPF_Symbol 1 #define hsIPF_Tag 2 #define hsIPF_Control 3 #define hsIPF_String 4 int Hilit_IPF(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); int j; C = 0; NC = 0; for (i = 0; i < Line->Count;) { IF_TAB() else { switch (State) { case hsIPF_Normal: Color = CLR_Normal; if (i == 0 && *p == '.') { State = hsIPF_Control; Color = CLR_Control; } else if (*p == ':') { State = hsIPF_Tag; Color = CLR_Tag; } else if (*p == '&') { State = hsIPF_Symbol; Color = CLR_Symbol; } goto hilit; case hsIPF_Tag: Color = CLR_Tag; if (isalpha(*p) || *p == '_') { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_')) ) j++; if (BF->GetHilitWord(j, &Line->Chars[i], Color, 1)) { } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; Color = CLR_Tag; continue; } else if (*p == '\'') { State = hsIPF_String; Color = CLR_String; goto hilit; } else if (*p == '.') { ColorNext(); State = hsIPF_Normal; continue; } goto hilit; case hsIPF_String: Color = CLR_String; if (*p == '\'') { ColorNext(); State = hsIPF_Tag; continue; } goto hilit; case hsIPF_Symbol: Color = CLR_Symbol; if (*p == '.') { ColorNext(); State = hsIPF_Normal; continue; } goto hilit; case hsIPF_Control: State = hsIPF_Control; Color = CLR_Control; goto hilit; default: State = hsIPF_Normal; Color = CLR_Normal; hilit: ColorNext(); continue; } } } if (State == hsIPF_Symbol || State == hsIPF_Control || State == hsIPF_String) State = hsIPF_Normal; *ECol = C; return 0; } efte-1.1/src/c_fconfig.h0000664000076400007640000000215411163156165014206 0ustar laurilauri/* c_fconfig.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __FCONFIG_H__ #define __FCONFIG_H__ #define CF_STRING 1 #define CF_INT 2 #define CF_REGEXP 3 #define CF_END 100 #define CF_SUB 101 #define CF_MENU 102 #define CF_OBJECT 103 #define CF_COMMAND 104 #define CF_ITEM 105 #define CF_SUBMENU 106 #define CF_MENUSUB 107 #define CF_MODE 108 #define CF_PARENT 109 #define CF_KEYSUB 110 #define CF_KEY 111 #define CF_COLOR 112 #define CF_KEYWORD 113 #define CF_SETVAR 114 #define CF_COMPRX 115 #define CF_EVENTMAP 116 #define CF_COLORIZE 117 #define CF_ABBREV 118 #define CF_HSTATE 119 #define CF_HTRANS 120 #define CF_HWORDS 121 #define CF_SUBMENUCOND 122 #define CF_HWTYPE 123 #define CF_VARIABLE 124 #define CF_CONCAT 125 #define CF_CVSIGNRX 126 #define CF_SVNIGNRX 127 #define CF_EOF 254 #define CONFIG_ID 0x1A1D70E1 #endif efte-1.1/src/e_buffer.cpp0000664000076400007640000006475711215511532014411 0ustar laurilauri/* e_buffer.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "c_history.h" EBuffer *SSBuffer = 0; // scrap buffer (clipboard) /////////////////////////////////////////////////////////////////////////////// EBuffer::EBuffer(int createFlags, EModel **ARoot, const char * /*AName*/) : EModel(createFlags, ARoot), TP(0, 0), CP(0, 0), BB(-1, -1), BE(-1, -1), PrevPos(-1, -1), SavedPos(-1, -1), Match(-1, -1) { Modified = 0; Loaded = 0; Loading = 0; LastUpDownColumn = -1; FileName = 0; LL = 0; VV = 0; FF = 0; RGap = RCount = RAllocated = 0; VGap = VCount = VAllocated = 0; FCount = 0; Modified = 0; BlockMode = bmStream; ExtendGrab = 0; AutoExtend = 0; MatchLen = MatchCount = 0; US.Num = 0; US.Data = 0; US.Top = 0; US.UndoPtr = 0; US.NextCmd = 1; US.Record = 1; US.Undo = 0; BMCount = 0; BMarks = 0; rlst.Count = 0; rlst.Lines = 0; Routines = 0; WordList = 0; WordCount = 0; //Name = strdup(AName); Allocate(0); AllocVis(0); Mode = GetModeForName(""); if (Mode == NULL) { fprintf(stderr, "Configuration error: default mode does not exist.\n"); exit(1); } Flags = (Mode->Flags); BFI(this, BFI_Undo) = 0; BFI(this, BFI_ReadOnly) = 0; Modified = 0; MinRedraw = -1; MaxRedraw = -1; RedrawToEos = 0; StartHilit = 0; EndHilit = -1; HilitProc = 0; if (Mode && Mode->fColorize) HilitProc = GetHilitProc(Mode->fColorize->SyntaxParser); InsertLine(CP, 0, 0); /* there should always be at least one line in the edit buffer */ Flags = (Mode->Flags); Modified = 0; } EBuffer::~EBuffer() { if (FileName != 0 && Loaded) { UpdateFPos(FileName, VToR(CP.Row), CP.Col); if (BFI(this, BFI_SaveBookmarks) == 3) StoreBookmarks(this); } if (FileName && Loaded) markIndex.storeForBuffer(this); Clear(); if (LL) free(LL); //free(Name); if (FileName) free(FileName); if (BMCount != 0) { for (int i = 0; i < BMCount; i++) free(BMarks[i].Name); free(BMarks); BMarks = 0; BMCount = 0; } if (rlst.Lines) { free(rlst.Lines); rlst.Lines = 0; } DeleteRelated(); } void EBuffer::DeleteRelated() { if (Routines) { ::ActiveView->DeleteModel(Routines); Routines = 0; } } int EBuffer::Clear() { Modified = 1; EndHilit = -1; StartHilit = 0; while (WordCount--) { free(WordList[WordCount]); } free(WordList); WordCount = 0; WordList = 0; rlst.Count = 0; if (rlst.Lines) { free(rlst.Lines); rlst.Lines = 0; } if (LL) { for (int i = 0; i < RCount; i++) delete LL[GapLine(i, RGap, RCount, RAllocated)]; free(LL); LL = 0; } RCount = RAllocated = RGap = 0; VCount = VAllocated = VGap = 0; if (VV) { free(VV); VV = 0; } FreeUndo(); if (FCount != 0) { free(FF); FCount = 0; FF = 0; } return 0; } int EBuffer::FreeUndo() { for (int j = 0; j < US.Num; j++) free(US.Data[j]); free(US.Top); free(US.Data); US.Num = 0; US.Data = 0; US.Top = 0; US.Undo = 0; US.Record = 1; US.UndoPtr = 0; return 1; } int EBuffer::Modify() { // if RecheckReadOnly is activated do readonly checking when necessary if (RecheckReadOnly != 0) { if (BFI(this, BFI_ReadOnly)) { // File might have been toggled writable outside the editor, or // you might do what I do, and do a Tools/Run/"p4 edit Filename.cpp" // from inside FTE, and it's a pain to manually reopen the file, so // recheck writability here instead. Note that we don't check the // converse, since in reality this is rarely a problem, and the // file save routines will check this (oh well). --ryan. struct stat StatBuf; if ((FileName != 0) && FileOk && (stat(FileName, &StatBuf) == 0)) { if (!(StatBuf.st_mode & (S_IWRITE | S_IWGRP | S_IWOTH))) BFI(this, BFI_ReadOnly) = 1; else BFI(this, BFI_ReadOnly) = 0; } } } if (BFI(this, BFI_ReadOnly)) { Msg(S_ERROR, "File is read-only."); return 0; } if (Modified == 0) { struct stat StatBuf; if ((FileName != 0) && FileOk && (stat(FileName, &StatBuf) == 0)) { if (FileStatus.st_size != StatBuf.st_size || FileStatus.st_mtime != StatBuf.st_mtime) { View->MView->Win->Choice(GPC_ERROR, "Warning! Press Esc!", 0, "File %-.55s changed on disk!", FileName); switch (View->MView->Win->Choice(GPC_NOTE, "File Changed on Disk", 3, "&Modify", "&Reload", "&Cancel", "%s", FileName)) { case 0: break; case 1: Reload(); case 2: case -1: default: return 0; } } } if (BFI(this, BFI_Undo)) if (PushUChar(ucModified) == 0) return 0; } Modified++; if (Modified == 0) Modified++; return 1; } int EBuffer::LoadRegion(EPoint * /*A*/, int /*FH*/, int /*StripChar*/, int /*LineChar*/) { return 0; } int EBuffer::InsertLine(EPoint Pos, int ACount, const char *AChars) { if (InsLine(Pos.Row, 0) == 0) return 0; if (InsText(Pos.Row, Pos.Col, ACount, AChars) == 0) return 0; return 1; } int EBuffer::UpdateMark(EPoint &M, int Type, int Row, int Col, int Rows, int Cols) { switch (Type) { case umInsert: /* text inserted */ switch (BlockMode) { case bmLine: case bmColumn: if (M.Row >= Row) M.Row += Rows; break; case bmStream: if (Cols) { if (M.Row == Row) if (M.Col >= Col) M.Col += Cols; } if (Rows) { if (M.Row >= Row) M.Row += Rows; } break; } break; case umDelete: switch (BlockMode) { case bmLine: case bmColumn: if (M.Row >= Row) if (InRange(Row, M.Row, Row + Rows)) M.Row = Row; else M.Row -= Rows; break; case bmStream: if (Cols) { if (M.Row == Row) if (M.Col >= Col) if (M.Col < Col + Cols) M.Col = Col; else M.Col -= Cols; } if (Rows) { if (M.Row >= Row) if (M.Row < Row + Rows) { M.Row = Row; M.Col = 0; } else M.Row -= Rows; } } break; case umSplitLine: switch (BlockMode) { case bmLine: case bmColumn: if (M.Row == Row) { if (Col <= M.Col) { M.Row++; M.Col -= Col; } } else if (M.Row > Row) M.Row++; break; case bmStream: if (M.Row == Row) { if (Col <= M.Col) { M.Row++; M.Col -= Col; } } else if (M.Row > Row) M.Row++; break; } break; case umJoinLine: switch (BlockMode) { case bmLine: case bmColumn: if (M.Row == Row + 1) M.Row--; else if (M.Row > Row) M.Row--; break; case bmStream: if (M.Row == Row + 1) { M.Row--; M.Col += Col; } else if (M.Row > Row) M.Row--; break; } break; } return 1; } int EBuffer::UpdateMarker(int Type, int Row, int Col, int Rows, int Cols) { EPoint OldBB = BB, OldBE = BE; EView *V; UpdateMark(SavedPos, Type, Row, Col, Rows, Cols); UpdateMark(PrevPos, Type, Row, Col, Rows, Cols); UpdateMark(BB, Type, Row, Col, Rows, Cols); UpdateMark(BE, Type, Row, Col, Rows, Cols); V = View; while (V) { if (V->Model != this) assert(1 == 0); if (V != View) { EPoint M; M = GetViewVPort(V)->TP; UpdateMark(GetViewVPort(V)->TP, Type, Row, Col, Rows, Cols); GetViewVPort(V)->TP.Col = M.Col; UpdateMark(GetViewVPort(V)->CP, Type, Row, Col, Rows, Cols); } V = V->NextView; } for (int i = 0; i < rlst.Count && rlst.Lines; i++) { EPoint M; M.Col = 0; M.Row = rlst.Lines[i]; UpdateMark(M, Type, Row, Col, Rows, Cols); rlst.Lines[i] = M.Row; } for (int f = 0; f < FCount; f++) { EPoint M; M.Col = 0; M.Row = FF[f].line; UpdateMark(M, Type, Row, Col, Rows, Cols); FF[f].line = M.Row; } for (int b = 0; b < BMCount; b++) UpdateMark(BMarks[b].BM, Type, Row, Col, Rows, Cols); if (OldBB.Row != BB.Row) { int MinL = Min(OldBB.Row, BB.Row); int MaxL = Max(OldBB.Row, BB.Row); if (MinL != -1 && MaxL != -1) Draw(MinL, MaxL); } if (OldBE.Row != BE.Row) { int MinL = Min(OldBE.Row, BE.Row); int MaxL = Max(OldBE.Row, BE.Row); if (MinL != -1 && MaxL != -1) Draw(MinL, MaxL); } return 1; } int EBuffer::ValidPos(EPoint Pos) { if ((Pos.Col >= 0) && (Pos.Row >= 0) && (Pos.Row < VCount)) return 1; return 0; } int EBuffer::RValidPos(EPoint Pos) { if ((Pos.Col >= 0) && (Pos.Row >= 0) && (Pos.Row < RCount)) return 1; return 0; } int EBuffer::AssertLine(int Row) { if (Row == RCount) if (InsLine(RCount, 0) == 0) return 0; return 1; } int EBuffer::SetFileName(const char *AFileName, const char *AMode) { FileOk = 0; free(FileName); FileName = strdup(AFileName); Mode = 0; if (AMode) Mode = FindMode(AMode); if (Mode == 0) Mode = GetModeForName(AFileName); assert(Mode != 0); Flags = (Mode->Flags); HilitProc = 0; if (Mode && Mode->fColorize) HilitProc = GetHilitProc(Mode->fColorize->SyntaxParser); UpdateTitle(); return FileName ? 1 : 0; } int EBuffer::SetPos(int Col, int Row, int tabMode) { assert(Col >= 0 && Row >= 0 && Row < VCount); if (BFI(this, BFI_Undo) == 1 && BFI(this, BFI_UndoMoves) == 1) { if (PushULong(CP.Col) == 0) return 0; if (PushULong(CP.Row) == 0) return 0; if (PushUChar(ucPosition) == 0) return 0; } if (AutoExtend) { BlockExtendBegin(); AutoExtend = 1; } PrevPos = CP; PrevPos.Row = (CP.Row < VCount) ? VToR(CP.Row) : (CP.Row - VCount + RCount); CP.Row = Row; if (CursorWithinEOL && Col > LineLen() + 1) CP.Col = LineLen(); else CP.Col = Col; if (AutoExtend) { BlockExtendEnd(); AutoExtend = 1; } // if (View && View->Model == this ) { // View->GetVPort(); // } if (BFI(this, BFI_CursorThroughTabs) == 0) { if (tabMode == tmLeft) { if (MoveTabStart() == 0) return 0; } else if (tabMode == tmRight) { if (MoveTabEnd() == 0) return 0; } } if (ExtendGrab == 0 && AutoExtend == 0 && BFI(this, BFI_PersistentBlocks) == 0) { if (CheckBlock() == 1) if (BlockUnmark() == 0) return 0; } return 1; } int EBuffer::SetPosR(int Col, int Row, int tabMode) { assert(Row >= 0 && Row < RCount && Col >= 0); int L = RToV(Row); if (L == -1) if (ExposeRow(Row) == 0) return 0; L = RToV(Row); return SetPos(Col, L, tabMode); } int EBuffer::SetNearPos(int Col, int Row, int tabMode) { if (Row >= VCount) Row = VCount - 1; if (Row < 0) Row = 0; if (Col < 0) Col = 0; return SetPos(Col, Row, tabMode); } int EBuffer::SetNearPosR(int Col, int Row, int tabMode) { if (Row >= RCount) Row = RCount - 1; if (Row < 0) Row = 0; if (Col < 0) Col = 0; return SetPosR(Col, Row, tabMode); } int EBuffer::CenterPos(int Col, int Row, int tabMode) { assert(Row >= 0 && Row < VCount && Col >= 0); if (SetPos(Col, Row, tabMode) == 0) return 0; if (View && View->Model == this) { Row -= GetVPort()->Rows / 2; if (Row < 0) Row = 0; Col -= GetVPort()->Cols - 8; if (Col < 0) Col = 0; if (GetVPort()->SetTop(Col, Row) == 0) return 0; GetVPort()->ReCenter = 1; } return 1; } int EBuffer::CenterPosR(int Col, int Row, int tabMode) { int L; assert(Row >= 0 && Row < RCount && Col >= 0); L = RToV(Row); if (L == -1) if (ExposeRow(Row) == 0) return 0; L = RToV(Row); return CenterPos(Col, L, tabMode); } int EBuffer::CenterNearPos(int Col, int Row, int tabMode) { if (Row >= VCount) Row = VCount - 1; if (Row < 0) Row = 0; if (Col < 0) Col = 0; return CenterPos(Col, Row, tabMode); } int EBuffer::CenterNearPosR(int Col, int Row, int tabMode) { if (Row >= RCount) Row = RCount - 1; if (Row < 0) Row = 0; if (Col < 0) Col = 0; return CenterPosR(Col, Row, tabMode); } int EBuffer::LineLen(int Row) { assert(Row >= 0 && Row < RCount); PELine L = RLine(Row); return ScreenPos(L, L->Count); } int EBuffer::LineChars(int Row) { assert(Row >= 0 && Row < RCount); return RLine(Row)->Count; } int EBuffer::DelLine(int Row, int DoMark) { int VLine; int GapSize; // printf("DelLine: %d\n", Row); if (Row < 0) return 0; if (Row >= RCount) return 0; if (Modify() == 0) return 0; VLine = RToV(Row); if (VLine == -1) if (ExposeRow(Row) == 0) return 0; VLine = RToV(Row); assert(VLine != -1); if (FindFold(Row) != -1) { if (FoldDestroy(Row) == 0) return 0; } VLine = RToV(Row); assert(VLine != -1); if (BFI(this, BFI_Undo) == 1) { if (PushUData(RLine(Row)->Chars, RLine(Row)->Count) == 0) return 0; if (PushULong(RLine(Row)->Count) == 0) return 0; if (PushULong(Row) == 0) return 0; if (PushUChar(ucDelLine) == 0) return 0; } if (DoMark) UpdateMarker(umDelete, Row, 0, 1, 0); //puts("Here"); Draw(Row, -1); Hilit(Row); assert(RAllocated >= RCount); if (RGap != Row) if (MoveRGap(Row) == 0) return 0; GapSize = RAllocated - RCount; delete LL[RGap + GapSize]; LL[RGap + GapSize] = 0; RCount--; GapSize++; if (RAllocated - RAllocated / 2 > RCount) { memmove(LL + RGap + GapSize - RAllocated / 3, LL + RGap + GapSize, sizeof(PELine) * (RCount - RGap)); if (Allocate(RAllocated - RAllocated / 3) == 0) return 0; } assert(VAllocated >= VCount); if (VGap != VLine) if (MoveVGap(VLine) == 0) return 0; GapSize = VAllocated - VCount; VV[VGap + GapSize] = 0; VCount--; GapSize++; if (VAllocated - VAllocated / 2 > VCount) { memmove(VV + VGap + GapSize - VAllocated / 3, VV + VGap + GapSize, sizeof(VV[0]) * (VCount - VGap)); if (AllocVis(VAllocated - VAllocated / 3) == 0) return 0; } return 1; } int EBuffer::InsLine(int Row, int DoAppend, int DoMark) { PELine L; int VLine = -1; // printf("InsLine: %d\n", Row); //if (! LL) // return 0; if (Row < 0) return 0; if (Row > RCount) return 0; if (Modify() == 0) return 0; if (DoAppend) { Row++; } if (Row < RCount) { VLine = RToV(Row); if (VLine == -1) if (ExposeRow(Row) == 0) return 0; VLine = RToV(Row); assert(VLine != -1); } else { VLine = VCount; } L = new ELine(0, (char *)0); if (L == 0) return 0; if (BFI(this, BFI_Undo) == 1) { if (PushULong(Row) == 0) return 0; if (PushUChar(ucInsLine) == 0) return 0; } if (DoMark) UpdateMarker(umInsert, Row, 0, 1, 0); Draw(Row, -1); Hilit(Row); VLine = RToVN(Row); assert(RCount <= RAllocated); // printf("++ %d G:C:A :: %d - %d - %d\n", Row, RGap, RCount, RAllocated); if (RCount == RAllocated) { if (Allocate(RCount ? (RCount * 2) : 1) == 0) return 0; memmove(LL + RAllocated - (RCount - RGap), LL + RGap, sizeof(PELine) * (RCount - RGap)); } if (RGap != Row) if (MoveRGap(Row) == 0) return 0; LL[RGap] = L; RGap++; RCount++; // printf("-- %d G:C:A :: %d - %d - %d\n", Row, RGap, RCount, RAllocated); assert(VCount <= VAllocated); if (VCount == VAllocated) { if (AllocVis(VCount ? (VCount * 2) : 1) == 0) return 0; memmove(VV + VAllocated - (VCount - VGap), VV + VGap, sizeof(VV[0]) * (VCount - VGap)); } if (VGap != VLine) if (MoveVGap(VLine) == 0) return 0; VV[VGap] = Row - VGap; VGap++; VCount++; /* if (AllocVis(VCount + 1) == 0) return 0; memmove(VV + VLine + 1, VV + VLine, sizeof(VV[0]) * (VCount - VLine)); VCount++; Vis(VLine, Row - VLine);*/ return 1; } int EBuffer::DelChars(int Row, int Ofs, int ACount) { PELine L; // printf("DelChars: %d:%d %d\n", Row, Ofs, ACount); if (Row < 0) return 0; if (Row >= RCount) return 0; L = RLine(Row); if (Ofs < 0) return 0; if (Ofs >= L->Count) return 0; if (Ofs + ACount >= L->Count) ACount = L->Count - Ofs; if (ACount == 0) return 1; if (Modify() == 0) return 0; if (BFI(this, BFI_Undo) == 1) { if (PushUData(L->Chars + Ofs, ACount) == 0) return 0; if (PushULong(ACount) == 0) return 0; if (PushULong(Ofs) == 0) return 0; if (PushULong(Row) == 0) return 0; if (PushUChar(ucDelChars) == 0) return 0; } if (L->Count > Ofs + ACount) memmove(L->Chars + Ofs, L->Chars + Ofs + ACount, L->Count - Ofs - ACount); L->Count -= ACount; if (L->Allocate(L->Count) == 0) return 0; Draw(Row, Row); Hilit(Row); // printf("OK\n"); return 1; } int EBuffer::InsChars(int Row, int Ofs, int ACount, const char *Buffer) { PELine L; // printf("InsChars: %d:%d %d\n", Row, Ofs, ACount); assert(Row >= 0 && Row < RCount && Ofs >= 0); L = RLine(Row); if (Ofs < 0) return 0; if (Ofs > L->Count) return 0; if (ACount == 0) return 1; if (Modify() == 0) return 0; if (BFI(this, BFI_Undo) == 1) { if (PushULong(Row) == 0) return 0; if (PushULong(Ofs) == 0) return 0; if (PushULong(ACount) == 0) return 0; if (PushUChar(ucInsChars) == 0) return 0; } if (L->Allocate(L->Count + ACount) == 0) return 0; if (L->Count > Ofs) memmove(L->Chars + Ofs + ACount, L->Chars + Ofs, L->Count - Ofs); if (Buffer == 0) memset(L->Chars + Ofs, ' ', ACount); else memmove(L->Chars + Ofs, Buffer, ACount); L->Count += ACount; Draw(Row, Row); Hilit(Row); // printf("OK\n"); return 1; } int EBuffer::InsertIndent(int Row, int Ofs, int ACount) { if (Ofs == 0 && RLine(Row)->Count == 0 && BFI(this, BFI_IndentWithTabs)) { /* We're writing the initial indentation to the line. Insert as many tabs as we can and fill the rest with spaces. */ int tabCount, tabSize = BFI(this, BFI_TabSize); char *tabs; tabCount = ACount / tabSize; tabs = (char *)malloc(tabCount); if (tabs == NULL) return 0; memset(tabs, '\t', tabCount); if (InsChars(Row, Ofs, tabCount, tabs) == 0) { free(tabs); return 0; } free(tabs); ACount %= tabSize; Ofs += tabCount; } return InsChars(Row, Ofs, ACount, 0); } int EBuffer::UnTabPoint(int Row, int Col) { ELine *L; int Ofs, Pos, TPos; assert(Row >= 0 && Row < RCount && Col >= 0); L = RLine(Row); Ofs = CharOffset(L, Col); if (Ofs >= L->Count) return 1; if (L->Chars[Ofs] != '\t') return 1; Pos = ScreenPos(L, Ofs); if (Pos < Col) { TPos = NextTab(Pos, BFI(this, BFI_TabSize)); if (DelChars(Row, Ofs, 1) != 1) return 0; if (InsChars(Row, Ofs, TPos - Pos, 0) != 1) return 0; } return 1; } int EBuffer::ChgChars(int Row, int Ofs, int ACount, const char * /*Buffer*/) { PELine L; assert(Row >= 0 && Row < RCount && Ofs >= 0); L = RLine(Row); if (Ofs < 0) return 0; if (Ofs > L->Count) return 0; if (ACount == 0) return 1; if (Modify() == 0) return 0; if (BFI(this, BFI_Undo) == 1) { if (PushUData(L->Chars + Ofs, ACount) == 0) return 0; if (PushULong(ACount) == 0) return 0; if (PushULong(Ofs) == 0) return 0; if (PushULong(Row) == 0) return 0; if (PushUChar(ucDelChars) == 0) return 0; if (PushULong(Row) == 0) return 0; if (PushULong(Ofs) == 0) return 0; if (PushULong(ACount) == 0) return 0; if (PushUChar(ucInsChars) == 0) return 0; } Hilit(Row); Draw(Row, Row); return 1; } int EBuffer::DelText(int Row, int Col, int ACount, int DoMark) { int L, B, C; // printf("DelTExt: %d:%d %d\n", Row, Col, ACount); assert(Row >= 0 && Row < RCount && Col >= 0); if (Modify() == 0) return 0; if (ACount == 0) return 1; L = LineLen(Row); if (Col >= L) return 1; if (ACount == -1 || ACount + Col > L) ACount = L - Col; if (UnTabPoint(Row, Col) == 0) return 0; if (UnTabPoint(Row, Col + ACount) == 0) return 0; B = CharOffset(RLine(Row), Col); C = CharOffset(RLine(Row), Col + ACount); if ((ACount > 0) && (B != -1) && (C != -1)) { if (DelChars(Row, B, C - B) == 0) return 0; if (DoMark) UpdateMarker(umDelete, Row, Col, 0, ACount); } // printf("OK\n"); return 1; } int EBuffer::InsText(int Row, int Col, int ACount, const char *ABuffer, int DoMark) { int B, L; // printf("InsText: %d:%d %d\n", Row, Col, ACount); assert(Row >= 0 && Row < RCount && Col >= 0 && ACount >= 0); if (ACount == 0) return 1; if (Modify() == 0) return 0; if (DoMark) UpdateMarker(umInsert, Row, Col, 0, ACount); L = LineLen(Row); if (L < Col) { if (InsertIndent(Row, RLine(Row)->Count, Col - L) == 0) return 0; } else if (UnTabPoint(Row, Col) == 0) return 0; B = CharOffset(RLine(Row), Col); if (InsChars(Row, B, ACount, ABuffer) == 0) return 0; // printf("OK\n"); return 1; } int EBuffer::PadLine(int Row, int Length) { int L; L = LineLen(Row); if (L < Length) if (InsChars(Row, RLine(Row)->Count, Length - L, 0) == 0) return 0; return 1; } int EBuffer::InsLineText(int Row, int Col, int ACount, int LCol, PELine Line) { int Ofs, Pos, TPos, C, B, L; //fprintf(stderr, "\n\nInsLineText: %d:%d %d %d", Row, Col, ACount, LCol); assert(Row >= 0 && Row < RCount && Col >= 0 && LCol >= 0); if (BFI(this, BFI_ReadOnly) == 1) return 0; L = ScreenPos(Line, Line->Count); if (LCol >= L) return 1; if (ACount == -1) ACount = L - LCol; if (ACount + LCol > L) ACount = L - LCol; if (ACount == 0) return 1; assert(ACount > 0); B = Ofs = CharOffset(Line, LCol); if (Ofs < Line->Count && Line->Chars[Ofs] == '\t') { Pos = ScreenPos(Line, Ofs); if (Pos < LCol) { TPos = NextTab(Pos, BFI(this, BFI_TabSize)); if (InsText(Row, Col, TPos - LCol, 0) == 0) return 0; Col += TPos - LCol; ACount -= TPos - LCol; LCol = TPos; B++; } } C = Ofs = CharOffset(Line, LCol + ACount); if (Ofs < Line->Count && Line->Chars[Ofs] == '\t') { Pos = ScreenPos(Line, Ofs); if (Pos < LCol + ACount) { if (InsText(Row, Col, LCol + ACount - Pos, 0) == 0) return 0; } } //fprintf(stderr, "B = %d, C = %d\n", B, C); C -= B; if (C <= 0) return 1; if (InsText(Row, Col, C, Line->Chars + B) == 0) return 0; // printf("OK\n"); return 1; } int EBuffer::SplitLine(int Row, int Col) { int VL; assert(Row >= 0 && Row < RCount && Col >= 0); if (BFI(this, BFI_ReadOnly) == 1) return 0; VL = RToV(Row); if (VL == -1) if (ExposeRow(Row) == 0) return 0; if (Row > 0) { VL = RToV(Row - 1); if (VL == -1) if (ExposeRow(Row - 1) == 0) return 0; } VL = RToV(Row); assert(VL != -1); if (Col == 0) { if (InsLine(Row, 0, 1) == 0) return 0; } else { UpdateMarker(umSplitLine, Row, Col, 0, 0); if (InsLine(Row, 1, 0) == 0) return 0; RLine(Row)->StateE = short((Row > 0) ? RLine(Row - 1)->StateE : 0); if (Col < LineLen(Row)) { int P, L; //if (RLine(Row)->ExpandTabs(Col, -2, &Flags) == 0) return 0; if (UnTabPoint(Row, Col) != 1) return 0; P = CharOffset(RLine(Row), Col); L = LineLen(Row); if (InsText(Row + 1, 0, RLine(Row)->Count - P, RLine(Row)->Chars + P, 0) == 0) return 0; if (DelText(Row, Col, L - Col, 0) == 0) return 0; } } Draw(Row, -1); Hilit(Row); return 1; } int EBuffer::JoinLine(int Row, int Col) { int Len, VLine; if (BFI(this, BFI_ReadOnly) == 1) return 0; if (Row < 0 || Row >= RCount - 1) return 0; if (Col < 0) return 0; //MoveFirstNonWhite(); //KillToLineStart(); Len = LineLen(Row); if (Col < Len) Col = Len; VLine = RToV(Row); if (VLine == -1) { if (ExposeRow(Row) == 0) return 0; if (ExposeRow(Row + 1) == 0) return 0; } VLine = RToV(Row); if (Col == 0 && RLine(Row)->Count == 0) { if (DelLine(Row, 1) == 0) return 0; } else { if (InsText(Row, Col, RLine(Row + 1)->Count, RLine(Row + 1)->Chars, 0) == 0) return 0; if (DelLine(Row + 1, 0) == 0) return 0; UpdateMarker(umJoinLine, Row, Col, 0, 0); } Draw(Row, -1); Hilit(Row); return 1; } efte-1.1/src/fte-vag.mak0000664000076400007640000000571011041404761014135 0ustar laurilauri# # fte-vag.mak # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # # Makefile for VisualAge C++ version 3.00 # # EXE = OEXT = obj DEBUG = 0 #DEBUG = 1 CC = icc LINK = ilink RC = rc VOID = echo > NUL !if $(DEBUG) C_FLAGS = /Ti /Tx !else C_FLAGS = /O /Gs- !endif C_OPTIONS = /Q /Tl /G4 /Gm+ /DOS2 /DINCL_32 $(C_FLAGS) !if $(DEBUG) CPP_FLAGS = /Ti /Tm /Tx !else CPP_FLAGS = /O /Gs- !endif CPP_OPTIONS = /Q /G4 /Gm+ /DOS2 /DINCL_32 $(CPP_FLAGS) !if $(DEBUG) L_FLAGS = /DEBUG /DBGPACK !else L_FLAGS = /EXEPACK:2 /PACKC /PACKD /OPTF !endif L_OPTIONS = /BASE:0x010000 /EXEC /NOE /NOLOGO $(L_FLAGS) RC_OPT = -n C_SRC = C_H = CPP_SRC = CPP_HPP = !include objs.inc RES = LIBS = HLIB = DEF = .SUFFIXES: .SUFFIXES: .cpp .rc all: cfte.exe fte.exe ftepm.exe clipserv.exe cliputil.exe fte.cnf clean: -del bin2c.exe -del bin2c.map -del cfte.exe -del cfte.map -del clipserv.exe -del clipserv.map -del cliputil.exe -del cliputil.map -del defcfg.cnf -del defcfg.h -del fte.cnf -del fte.exe -del fte.his -del fte.map -del ftepm.exe -del ftepm.map -del ftepm.res -del *.obj clipserv.exe: clipserv.$(OEXT) clipserv.def $(VOID) <defcfg.h fte.cnf: ..\config\* cfte.exe cfte ..\config\main.fte fte.cnf bin2c.obj: bin2c.cpp bin2c.exe: bin2c.obj $(VOID) <= CMacros)) return "?INVALID?"; if (Macros[Command].Name) return Macros[Command].Name; else return "?NONE?"; } for (int i = 0; i < int(sizeof(Command_Table) / sizeof(Command_Table[0])); i++) if (Command_Table[i].CmdId == Command) return Command_Table[i].Name; return "?invalid?"; } int CmdNum(char *Cmd) { int i; for (i = 0; i < int(sizeof(Command_Table) / sizeof(Command_Table[0])); i++) if (strcmp(Cmd, Command_Table[i].Name) == 0) return Command_Table[i].CmdId; for (i = 0; i < CMacros; i++) if (Macros[i].Name && (strcmp(Cmd, Macros[i].Name)) == 0) return i | CMD_EXT; return 0; // Nop } EMode *FindMode(const char *Name) { EMode *m = Modes; //fprintf(stderr, "Searching mode %s\n", Name); while (m) { if (strcmp(Name, m->fName) == 0) return m; m = m->fNext; } return 0; } EEventMap *FindEventMap(const char *Name) { EEventMap *m = EventMaps; //fprintf(stderr, "Searching map %s\n", Name); while (m) { if (strcmp(Name, m->Name) == 0) return m; m = m->Next; } return 0; } EEventMap *FindActiveMap(EMode *Mode) { while (Mode) { if (Mode->fEventMap) return Mode->fEventMap; Mode = Mode->fParent; } return 0; } EKey *SetKey(EEventMap *aMap, const char *aKey) { EKeyMap **map = &aMap->KeyMap, *pm, *parent = 0; EKey *k; char Key[256]; char *p, *d; EEventMap *xm = aMap; // printf("Setting key %s\n", Key); strcpy(Key, aKey); // if mode has parent, get parent keymap while (xm && xm->Parent && (parent == 0)) { parent = xm->Parent->KeyMap; // printf("%s : %s : %d\n", xm->fName, xm->fParent->fName, parent); xm = xm->Parent; } d = p = Key; while (d) { // parse key combination p = d; d = strchr(p, '_'); if (d) { if (d[1] == 0 || d[1] == '_') d++; if (*d == 0) d = 0; else { *d = 0; d++; } } // if lastkey if (d == 0) { k = new EKey(p); if (*map) { (*map)->AddKey(k); } else { *map = new EKeyMap(); (*map)->fParent = parent; (*map)->AddKey(k); } return k; } else { // if introductory key if (*map == 0) { // first key in mode, create map // printf("new map key = %s, parent %d\n", p, parent); k = new EKey(p, 0); *map = new EKeyMap(); (*map)->fParent = parent; (*map)->AddKey(k); } else { KeySel ks; ParseKey(p, ks); if ((k = (*map)->FindKey(ks.Key)) == 0) { // check if key exists // add it if not k = new EKey(p, 0); (*map)->AddKey(k); } } map = &k->fKeyMap; // set current map to key's map // get parent keymap pm = parent; parent = 0; // printf("Searching %s\n", p); while (pm) { // while exists KeySel ks; EKey *pk; ParseKey(p, ks); if ((pk = pm->FindKey(ks.Key)) != 0) { // if key exists, find parent of it parent = pk->fKeyMap; // printf("Key found %d\n", parent); break; } pm = pm->fParent; // otherwise find parent of current keymap } } } return 0; } static void InitWordChars() { static int init = 0; if (init == 0) { for (int i = 0; i < 256; i++) // isalnum??? //if (isdigit(i) || isalpha(i) // || (i >= 'A' && i <= 'Z') // || (i >= 'a' && i <= 'z') || (i == '_')) { if (isalnum(i) || (i == '_')) { WSETBIT(DefaultBufferFlags.WordChars, i, 1); // Can someone tell me why we check A through Z? // This won't work should someone port to EBCDIC (why, though?) // besides, isupper is usually a #define that will compile to something // even faster. if (/*(i >= 'A' && i <= 'Z') || */ isupper(i)) WSETBIT(DefaultBufferFlags.CapitalChars, i, 1); } init = 1; } } void SetWordChars(char *w, const char *s) { const char *p; memset((void *)w, 0, 32); p = s; while (p && *p) { if (*p == '\\') { p++; if (*p == 0) return; } else if (p[1] == '-') { if (p[2] == 0) return ; for (int i = p[0]; i < p[2]; i++) WSETBIT(w, i, 1); p += 2; } WSETBIT(w, *p, 1); p++; } } EMode::EMode(EMode *aMode, EEventMap *Map, const char *aName) { indent_count = 0; fNext = 0; fName = strdup(aName); fEventMap = Map; fParent = aMode; InitWordChars(); if (aMode) { fColorize = aMode->fColorize; Flags = aMode->Flags; // duplicate strings in flags to allow them be freed for (int i = 0; i < BFS_COUNT; i++) { if (aMode->Flags.str[i] != 0) Flags.str[i] = strdup(aMode->Flags.str[i]); } MatchName = 0; MatchLine = 0; MatchNameRx = 0; MatchLineRx = 0; if (aMode->MatchName) { MatchName = strdup(aMode->MatchName); MatchNameRx = RxCompile(MatchName); } if (aMode->MatchLine) { MatchLine = strdup(aMode->MatchLine); MatchLineRx = RxCompile(MatchLine); } } else { MatchName = 0; MatchLine = 0; MatchNameRx = 0; MatchLineRx = 0; fColorize = 0; Flags = DefaultBufferFlags; // there is no strings in default settings... } } EMode::~EMode() { // fEventMap is just pointer to EventMaps list, so do not destroy it // fColorize is also just a pointer free(fName); free(MatchName); RxFree(MatchNameRx); free(MatchLine); RxFree(MatchLineRx); // TODO: Free indents // free strings from flags for (int i = 0; i < BFS_COUNT; i++) free(Flags.str[i]); } void EMode::AddIndentRx(int look_line, int affect_line, int indent, const char *regex, int flags) { if (indent_count > 20) return; indents[indent_count].look_line = look_line; indents[indent_count].affect_line = affect_line; indents[indent_count].indent = indent; indents[indent_count].regex = RxCompile(regex); indents[indent_count].flags = flags; indent_count++; } EKeyMap::EKeyMap() { fKeys = NULL; fParent = NULL; } EKeyMap::~EKeyMap() { // free keys EKey *e; while ((e = fKeys) != NULL) { fKeys = fKeys->fNext; delete e; } } void EKeyMap::AddKey(EKey *aKey) { aKey->fNext = fKeys; fKeys = aKey; } static int MatchKey(TKeyCode aKey, KeySel aSel) { long flags = aKey & ~ 0xFFFF; long key = aKey & 0xFFFF; flags &= ~kfAltXXX; if (flags & kfShift) { if (key < 256) if (flags == kfShift) flags &= ~kfShift; else if (isascii(key)) key = toupper(key); } if ((flags & kfCtrl) && !(flags & kfSpecial)) if (key < 32) key += 64; flags &= ~aSel.Mask; if (aSel.Mask & kfShift) { if (key < 256) if (isascii(key)) key = toupper(key); } aKey = key | flags; if (aKey == aSel.Key) return 1; return 0; } EKey *EKeyMap::FindKey(TKeyCode aKey) { EKey *p = fKeys; while (p) { if (MatchKey(aKey, p->fKey)) return p; p = p->fNext; } return 0; } EEventMap::EEventMap(const char *AName, EEventMap *AParent) { Name = strdup(AName); Parent = AParent; KeyMap = 0; Next = EventMaps; EventMaps = this; memset(Menu, 0, sizeof(Menu)); memset(abbrev, 0, sizeof(abbrev)); } EEventMap::~EEventMap() { free(Name); // free menu[] { for (int i = 0; i < EM_MENUS; i++) { free(Menu[i]); } } // free Abbrev's { EAbbrev *ab; for (int i = 0; i < ABBREV_HASH; i++) { while ((ab = abbrev[i]) != NULL) { abbrev[i] = abbrev[i]->next; delete ab; } } } // free keymap's { delete KeyMap; } } void EEventMap::SetMenu(int which, const char *What) { if (which < 0 || which >= EM_MENUS) return; if (Menu[which] != 0) free(Menu[which]); Menu[which] = strdup(What); } char *EEventMap::GetMenu(int which) { if (which < 0 || which >= EM_MENUS) return 0; if (Menu[which] || Parent == 0) return Menu[which]; else return Parent->GetMenu(which); } int EEventMap::AddAbbrev(EAbbrev *ab) { int i = HashStr(ab->Match, ABBREV_HASH); ab->next = abbrev[i]; abbrev[i] = ab; return 1; } EAbbrev *EMode::FindAbbrev(const char *string) { EEventMap *Map = fEventMap; EAbbrev *ab; int i; if (string == 0) return 0; i = HashStr(string, ABBREV_HASH); while (Map) { ab = Map->abbrev[i]; while (ab != 0) { if (ab->Match && (strcmp(string, ab->Match) == 0)) return ab; ab = ab->next; } Map = Map->Parent; } return 0; } static const struct { const char *Name; TKeyCode Key; } KeyList[] = { { "Esc", kbEsc }, { "Tab", kbTab }, { "Space", kbSpace }, { "Enter", kbEnter }, { "BackSp", kbBackSp }, { "F1", kbF1 }, { "F2", kbF2 }, { "F3", kbF3 }, { "F4", kbF4 }, { "F5", kbF5 }, { "F6", kbF6 }, { "F7", kbF7 }, { "F8", kbF8 }, { "F9", kbF9 }, { "F10", kbF10 }, { "F11", kbF11 }, { "F12", kbF12 }, { "Left", kbLeft }, { "Right", kbRight }, { "Up", kbUp }, { "Down", kbDown }, { "Home", kbHome }, { "End", kbEnd }, { "PgUp", kbPgUp }, { "PgDn", kbPgDn }, { "Ins", kbIns }, { "Del", kbDel }, { "Center", kbCenter }, { "Break", kbBreak }, { "Pause", kbPause }, { "PrtScr", kbPrtScr }, { "SysReq", kbSysReq }, }; int ParseKey(const char *Key, KeySel &ks) { const unsigned char *p = (const unsigned char *)Key; TKeyCode KeyFlags = 0; int i; ks.Mask = 0; ks.Key = 0; while ((*p) && ((p[1] == '+') || (p[1] == '-'))) { if (p[1] == '-') { switch (p[0]) { case 'A': ks.Mask |= kfAlt; break; case 'C': ks.Mask |= kfCtrl; break; case 'S': ks.Mask |= kfShift; break; case 'G': ks.Mask |= kfGray; break; case 'X': ks.Mask |= kfSpecial; break; } } else if (p[1] == '+') { switch (p[0]) { case 'A': KeyFlags |= kfAlt; break; case 'C': KeyFlags |= kfCtrl; break; case 'S': KeyFlags |= kfShift; break; case 'G': KeyFlags |= kfGray; break; case 'X': KeyFlags |= kfSpecial; break; } } p += 2; } for (i = 0; i < int(sizeof(KeyList) / sizeof(KeyList[0])); i++) if (strcmp((const char *)p, KeyList[i].Name) == 0) { ks.Key = KeyList[i].Key; break; } if (ks.Key == 0) ks.Key = *p; if ((KeyFlags & kfCtrl) && !(KeyFlags & kfSpecial)) { if (ks.Key < 256) { if (ks.Key < 32) ks.Key += 64; else ks.Key = toupper(ks.Key); } } ks.Key |= KeyFlags; return 0; } int GetKeyName(char *Key, int KeySize, KeySel &ks) { strlcpy(Key, "", KeySize); if (ks.Key & kfAlt) strlcat(Key, "A+", KeySize); if (ks.Mask & kfAlt) strlcat(Key, "A-", KeySize); if (ks.Key & kfCtrl) strlcat(Key, "C+", KeySize); if (ks.Mask & kfCtrl) strlcat(Key, "C-", KeySize); if (ks.Key & kfGray) strlcat(Key, "G+", KeySize); if (ks.Mask & kfGray) strlcat(Key, "G-", KeySize); if (ks.Key & kfShift) strlcat(Key, "S+", KeySize); if (ks.Mask & kfShift) strlcat(Key, "S-", KeySize); if (keyCode(ks.Key) < 256) { char c[2]; c[0] = (char)(ks.Key & 0xFF); c[1] = 0; //if (ks.Key & kfCtrl) // if (c[0] < ' ') // c[0] += '@'; if (c[0] == 32) strlcat(Key, "Space", KeySize); else strlcat(Key, c, KeySize); } else { for (int i = 0; i < int(sizeof(KeyList) / sizeof(KeyList[0])); i++) if (KeyList[i].Key == keyCode(ks.Key)) { strlcat(Key, KeyList[i].Name, KeySize); break; } } return 0; } EKey::EKey(char *aKey) { fNext = 0; ParseKey(aKey, fKey); fKeyMap = 0; Cmd = -1; } EKey::EKey(char *aKey, EKeyMap *aKeyMap) { fNext = 0; Cmd = -1; ParseKey(aKey, fKey); fKeyMap = aKeyMap; } EKey::~EKey() { // if there is child keymaps delete them delete fKeyMap; } EAbbrev::EAbbrev(const char *aMatch, const char *aReplace) { next = 0; Match = strdup(aMatch); Replace = strdup(aReplace); Cmd = -1; } EAbbrev::EAbbrev(const char *aMatch, int aCmd) { next = 0; Replace = 0; Match = strdup(aMatch); Cmd = aCmd; } EAbbrev::~EAbbrev() { if (Match) free(Match); if (Replace) free(Replace); } int AddCommand(int no, int Command, int count, int ign) { if (count == 0) return 0; if (Command == 0) return 0; Macros[no].cmds = (CommandType *)realloc(Macros[no].cmds, sizeof(CommandType) * (Macros[no].Count + 1)); Macros[no].cmds[Macros[no].Count].type = CT_COMMAND; Macros[no].cmds[Macros[no].Count].u.num = Command; Macros[no].cmds[Macros[no].Count].repeat = short(count); Macros[no].cmds[Macros[no].Count].ign = short(ign); Macros[no].Count++; return 1; } int AddString(int no, const char *String) { Macros[no].cmds = (CommandType *)realloc(Macros[no].cmds, sizeof(CommandType) * (Macros[no].Count + 1)); Macros[no].cmds[Macros[no].Count].type = CT_STRING; Macros[no].cmds[Macros[no].Count].u.string = strdup(String); Macros[no].cmds[Macros[no].Count].repeat = 0; Macros[no].cmds[Macros[no].Count].ign = 0; Macros[no].Count++; return 1; } int AddNumber(int no, long number) { Macros[no].cmds = (CommandType *)realloc(Macros[no].cmds, sizeof(CommandType) * (Macros[no].Count + 1)); Macros[no].cmds[Macros[no].Count].type = CT_NUMBER; Macros[no].cmds[Macros[no].Count].u.num = number; Macros[no].cmds[Macros[no].Count].repeat = 0; Macros[no].cmds[Macros[no].Count].ign = 0; Macros[no].Count++; return 1; } int AddConcat(int no) { Macros[no].cmds = (CommandType *)realloc(Macros[no].cmds, sizeof(CommandType) * (Macros[no].Count + 1)); Macros[no].cmds[Macros[no].Count].type = CT_CONCAT; Macros[no].cmds[Macros[no].Count].u.num = 0; Macros[no].cmds[Macros[no].Count].repeat = 0; Macros[no].cmds[Macros[no].Count].ign = 0; Macros[no].Count++; return 1; } int AddVariable(int no, int number) { Macros[no].cmds = (CommandType *)realloc(Macros[no].cmds, sizeof(CommandType) * (Macros[no].Count + 1)); Macros[no].cmds[Macros[no].Count].type = CT_VARIABLE; Macros[no].cmds[Macros[no].Count].u.num = number; Macros[no].cmds[Macros[no].Count].repeat = 0; Macros[no].cmds[Macros[no].Count].ign = 0; Macros[no].Count++; return 1; } int NewCommand(const char *Name) { Macros = (ExMacro *) realloc(Macros, sizeof(ExMacro) * (1 + CMacros)); Macros[CMacros].Count = 0; Macros[CMacros].cmds = 0; Macros[CMacros].Name = (Name != NULL) ? strdup(Name) : 0; CMacros++; return CMacros - 1; } int ExState::GetStrParam(EView *view, char *str, int maxlen) { assert(maxlen >= 0); if (Macro == -1 || Pos == -1 || Pos >= Macros[Macro].Count) return 0; if (Macros[Macro].cmds[Pos].type == CT_STRING) { if (maxlen > 0) { strncpy(str, Macros[Macro].cmds[Pos].u.string, maxlen); str[maxlen - 1] = 0; } Pos++; } else if (view && Macros[Macro].cmds[Pos].type == CT_VARIABLE) { //puts("variable\x7"); if (view->GetStrVar(Macros[Macro].cmds[Pos].u.num, str, maxlen) == 0) return 0; Pos++; } else return 0; if (Pos < Macros[Macro].Count) { if (Macros[Macro].cmds[Pos].type == CT_CONCAT) { Pos++; int len = strlen(str); int left = maxlen - len; assert(left >= 0); //puts("concat\x7"); if (GetStrParam(view, str + len, left) == 0) return 0; } } return 1; } int ExState::GetIntParam(EView *view, int *value) { if (Macro == -1 || Pos == -1 || Pos >= Macros[Macro].Count) return 0; if (Macros[Macro].cmds[Pos].type == CT_NUMBER) { *value = Macros[Macro].cmds[Pos].u.num; Pos++; } else if (view && Macros[Macro].cmds[Pos].type == CT_VARIABLE) { if (view->GetIntVar(Macros[Macro].cmds[Pos].u.num, value) == 0) return 0; Pos++; } else return 0; return 1; } int HashStr(const char *p, int maxim) { unsigned int i = 1; while (p && *p) { i += i ^(i << 3) ^(unsigned int)(*p) ^(i >> 3); p++; } return i % maxim; } efte-1.1/src/memicmp.cpp0000664000076400007640000000154111041404761014243 0ustar laurilauri/* * memicmp.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // Contributed by Markus F.X.J. Oberhumer #include #include #if defined(UNIX) #ifdef __cplusplus extern "C" #endif int memicmp(const void *s1, const void *s2, size_t n) { if (n != 0) { const unsigned char *p1 = (const unsigned char *) s1; const unsigned char *p2 = (const unsigned char *) s2; do { if (*p1 != *p2) { int c = toupper(*p1) - toupper(*p2); if (c) return c; } p1++; p2++; } while (--n != 0); } return 0; } #endif efte-1.1/src/pm_tool.cpp0000664000076400007640000003445511041404761014277 0ustar laurilauri/* * pm_tool.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #define InRange(a,x,b) (((a) <= (x)) && ((x) < (b))) #define Min(a,b) (((a) < (b))?(a):(b)) #define Max(a,b) (((a) > (b))?(a):(b)) #define TYBORDER 6 // border on top and bottom of icon (all of it) #define TXBORDER 6 #define TXSEPARATOR 4 #define TYICON 24 #define TXICON 24 MRESULT EXPENTRY ToolBarProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { if (msg == WM_CREATE) { WinSetWindowPtr(hwnd, QWL_USER, PVOIDFROMMP(mp1)); } else { ToolBarData *td = (ToolBarData *)WinQueryWindowPtr(hwnd, QWL_USER); ToolBarItem *items = td->pItems; switch (msg) { case WM_DESTROY: free(td); free(items); break; case WM_PAINT: { HPS hps; RECTL rcl; POINTL ptl; SWP swp; int xpos, ypos, item; WinQueryWindowPos(hwnd, &swp); hps = WinBeginPaint(hwnd, 0, &rcl); /* top outside 3D border */ if (rcl.yBottom < 1) { GpiSetColor(hps, CLR_DARKGRAY); ptl.x = rcl.xLeft; ptl.y = 0; GpiMove(hps, &ptl); ptl.x = Min(rcl.xRight, swp.cx - 2); GpiLine(hps, &ptl); } /* bottom outside 3D border */ if (rcl.yTop >= swp.cy - 1 - 1) { GpiSetColor(hps, CLR_WHITE); ptl.x = Max(rcl.xLeft, 1); ptl.y = swp.cy - 1; GpiMove(hps, &ptl); ptl.x = rcl.xRight; GpiLine(hps, &ptl); } /* 3D corners */ GpiSetColor(hps, CLR_PALEGRAY); ptl.x = 0; ptl.y = 0; GpiSetPel(hps, &ptl); ptl.x = swp.cx - 1; ptl.y = swp.cy - 1; GpiSetPel(hps, &ptl); /* bottom space */ if (rcl.yBottom < TYBORDER - 1) { for (ptl.y = 1; ptl.y < TYBORDER - 2; ptl.y++) { ptl.x = Max(rcl.xLeft, 1); GpiMove(hps, &ptl); ptl.x = Min(rcl.xRight, swp.cx - 1); GpiLine(hps, &ptl); } } /* top space */ if (rcl.yTop >= swp.cy - TYBORDER + 2) { for (ptl.y = swp.cy - TYBORDER + 2; ptl.y < swp.cy - 1; ptl.y++) { ptl.x = Max(rcl.xLeft, 1); GpiMove(hps, &ptl); ptl.x = Min(rcl.xRight, swp.cx - 1); GpiLine(hps, &ptl); } } /* left outside 3D border */ if (rcl.xLeft < 1) { GpiSetColor(hps, CLR_WHITE); ptl.y = Max(1, rcl.yBottom); ptl.x = 0; GpiMove(hps, &ptl); ptl.y = rcl.yTop; GpiLine(hps, &ptl); } /* right outside 3D border */ if (rcl.xRight >= swp.cx - 1) { GpiSetColor(hps, CLR_DARKGRAY); ptl.y = rcl.yBottom; ptl.x = swp.cx - 1; GpiMove(hps, &ptl); ptl.y = Min(swp.cy - 2, rcl.yTop); GpiLine(hps, &ptl); } /* left border */ if (rcl.xLeft < TXBORDER - 2) { GpiSetColor(hps, CLR_PALEGRAY); for (ptl.x = 1; ptl.x < TXBORDER - 2; ptl.x++) { ptl.y = Max(1, rcl.yBottom); GpiMove(hps, &ptl); ptl.y = Min(swp.cy - 2, rcl.yTop); GpiLine(hps, &ptl); } } /* draw toolbar items */ xpos = TXBORDER; ypos = TYBORDER; for (item = 0; item < td->ulCount; item++) { if (items[item].ulType == tiBITMAP) { if (rcl.xRight >= xpos - 2 && rcl.xLeft <= xpos + TXICON + 1) { GpiSetColor(hps, CLR_BLACK); ptl.x = xpos - 2; ptl.y = ypos - 2; GpiMove(hps, &ptl); ptl.x = xpos + TXICON + 1; ptl.y = ypos + TYICON + 1; GpiBox(hps, DRO_OUTLINE, &ptl, 0, 0); if (item == td->ulDepressed && (items[item].ulFlags & tfDEPRESSED)) { ptl.x = xpos + 1; ptl.y = ypos - 1; WinDrawBitmap(hps, items[item].hBitmap, 0, &ptl, 0, 0, (items[item].ulFlags & tfDISABLED) ? DBM_INVERT : DBM_NORMAL); GpiSetColor(hps, CLR_DARKGRAY); ptl.x = xpos - 1; ptl.y = ypos - 1; GpiMove(hps, &ptl); ptl.y = ypos + TYICON; GpiLine(hps, &ptl); ptl.x = xpos + TXICON; GpiLine(hps, &ptl); ptl.y--; GpiMove(hps, &ptl); ptl.x = xpos; GpiLine(hps, &ptl); ptl.y = ypos - 1; GpiLine(hps, &ptl); } else { ptl.x = xpos; ptl.y = ypos; WinDrawBitmap(hps, items[item].hBitmap, 0, &ptl, 0, 0, (items[item].ulFlags & tfDISABLED) ? DBM_INVERT : DBM_NORMAL); GpiSetColor(hps, CLR_PALEGRAY); ptl.x = xpos - 1; ptl.y = ypos - 1; GpiSetPel(hps, &ptl); GpiSetColor(hps, CLR_WHITE); ptl.y++; GpiMove(hps, &ptl); ptl.y = ypos + TYICON; GpiLine(hps, &ptl); ptl.x = xpos + TXICON - 1; GpiLine(hps, &ptl); GpiSetColor(hps, CLR_PALEGRAY); ptl.x++; GpiSetPel(hps, &ptl); ptl.y--; GpiSetColor(hps, CLR_DARKGRAY); GpiMove(hps, &ptl); ptl.y = ypos - 1; GpiLine(hps, &ptl); ptl.x = xpos; GpiLine(hps, &ptl); } } xpos += TXICON + 3; } else if (items[item].ulType == tiSEPARATOR) { if (rcl.xRight >= xpos - 1 && rcl.xLeft <= xpos + TXSEPARATOR + 1) { GpiSetColor(hps, CLR_PALEGRAY); ptl.x = xpos - 1; ptl.y = ypos - 2; GpiMove(hps, &ptl); ptl.x = xpos + TXSEPARATOR + 1; ptl.y = ypos + TYICON + 1; GpiBox(hps, DRO_FILL, &ptl, 0, 0); } xpos += TXSEPARATOR + 3; } } GpiSetColor(hps, CLR_PALEGRAY); ptl.x = xpos - 1; ptl.y = ypos - 2; GpiMove(hps, &ptl); ptl.x = swp.cx - 2; ptl.y = swp.cy - TYBORDER + 1; GpiBox(hps, DRO_FILL, &ptl, 0, 0); WinEndPaint(hps); } break; case WM_ADJUSTWINDOWPOS: { PSWP pswp = (PSWP)PVOIDFROMMP(mp1); pswp->cy = TYBORDER + TYICON + TYBORDER; } break; case WM_BUTTON1DOWN: case WM_BUTTON1DBLCLK: { int item; POINTL ptl; RECTL rcl; ptl.x = (LONG) SHORT1FROMMP(mp1); ptl.y = (LONG) SHORT2FROMMP(mp1); rcl.yBottom = TYBORDER - 1; rcl.yTop = TYBORDER + TYICON + 1; rcl.xLeft = TXBORDER - 1; rcl.xRight = TXBORDER + TXICON + 1; for (item = 0; item < td->ulCount; item++) { if (rcl.xLeft <= ptl.x && rcl.yBottom <= ptl.y && rcl.xRight >= ptl.x && rcl.yTop >= ptl.y && td->pItems[item].ulType == tiBITMAP && (td->pItems[item].ulFlags & tfDISABLED) == 0) { td->ulDepressed = item; td->pItems[item].ulFlags |= tfDEPRESSED; WinInvalidateRect(hwnd, &rcl, FALSE); WinSetCapture(HWND_DESKTOP, hwnd); break; } if (td->pItems[item].ulType == tiBITMAP) { rcl.xLeft += TXICON + 3; rcl.xRight += TXICON + 3; } else if (td->pItems[item].ulType == tiSEPARATOR) { rcl.xLeft += TXSEPARATOR + 3; rcl.xRight += TXSEPARATOR + 3; } } } break; case WM_MOUSEMOVE: { STARTFUNC("ToolBarProc[WM_MOUSEMOVE]"); int item; POINTL ptl; RECTL rcl; if (td->ulDepressed == -1) break; ptl.x = (LONG) SHORT1FROMMP(mp1); ptl.y = (LONG) SHORT2FROMMP(mp1); rcl.yBottom = TYBORDER - 1; rcl.yTop = TYBORDER + TYICON + 1; rcl.xLeft = TXBORDER - 1; rcl.xRight = TXBORDER + TXICON + 1; LOG << "Depressed: " << td-> ulDepressed << ENDLINE; for (item = 0; item < td->ulCount; item++) { LOG << "Checking item " << item << ENDLINE; LOG << " pItem -> " << (void*)(td->pItems + item) << ENDLINE; if (item == td->ulDepressed) { if (rcl.xLeft <= ptl.x && rcl.yBottom <= ptl.y && rcl.xRight >= ptl.x && rcl.yTop >= ptl.y) { if ((td->pItems[item].ulFlags & tfDEPRESSED) == 0) { td->pItems[item].ulFlags |= tfDEPRESSED; WinInvalidateRect(hwnd, &rcl, FALSE); } } else { if (td->pItems[item].ulFlags & tfDEPRESSED) { td->pItems[item].ulFlags &= ~tfDEPRESSED; WinInvalidateRect(hwnd, &rcl, FALSE); } } break; } if (td->pItems[item].ulType == tiBITMAP) { rcl.xLeft += TXICON + 3; rcl.xRight += TXICON + 3; } else if (td->pItems[item].ulType == tiSEPARATOR) { rcl.xLeft += TXSEPARATOR + 3; rcl.xRight += TXSEPARATOR + 3; } } } break; case WM_BUTTON1UP: { int item; POINTL ptl; RECTL rcl; if (td->ulDepressed == -1) break; ptl.x = (LONG) SHORT1FROMMP(mp1); ptl.y = (LONG) SHORT2FROMMP(mp1); rcl.yBottom = TYBORDER - 1; rcl.yTop = TYBORDER + TYICON + 1; rcl.xLeft = TXBORDER - 1; rcl.xRight = TXBORDER + TXICON + 1; for (item = 0; item < td->ulCount; item++) { if (item == td->ulDepressed) { WinSetCapture(HWND_DESKTOP, (HWND)0); if (rcl.xLeft <= ptl.x && rcl.yBottom <= ptl.y && rcl.xRight >= ptl.x && rcl.yTop >= ptl.y && td->pItems[item].ulFlags & tfDEPRESSED) { td->pItems[item].ulFlags &= ~tfDEPRESSED; WinInvalidateRect(hwnd, &rcl, FALSE); // message WinPostMsg(WinQueryWindow(hwnd, QW_OWNER), WM_COMMAND, MPFROM2SHORT(td->pItems[item].ulCommand, 0), MPFROM2SHORT(CMDSRC_OTHER, TRUE)); break; } } if (td->pItems[item].ulType == tiBITMAP) { rcl.xLeft += TXICON + 3; rcl.xRight += TXICON + 3; } else if (td->pItems[item].ulType == tiSEPARATOR) { rcl.xLeft += TXSEPARATOR + 3; rcl.xRight += TXSEPARATOR + 3; } } td->ulDepressed = -1; } break; } } return WinDefWindowProc(hwnd, msg, mp1, mp2); } void RegisterToolBarClass(HAB hab) { assert(WinRegisterClass(hab, WC_MTOOLBAR, (PFNWP)ToolBarProc, CS_SIZEREDRAW, sizeof(void *)) == TRUE); } HWND CreateToolBar(HWND parent, HWND owner, ULONG id, ULONG count, ToolBarItem *items) { STARTFUNC("CreateToolBar"); ToolBarData *td; HWND hwnd; td = (ToolBarData *)malloc(sizeof(ToolBarData)); if (td == 0) return 0; td->pItems = (ToolBarItem *)malloc(sizeof(ToolBarItem) * count); if (td->pItems == 0) { free(td); return 0; } td->cb = sizeof(ToolBarData); td->ulCount = count; td->ulDepressed = (LONG) - 1; memcpy((void *)td->pItems, (void *)items, sizeof(ToolBarItem) * count); hwnd = WinCreateWindow(parent, WC_MTOOLBAR, "ToolBar", WS_VISIBLE, 0, 0, 0, 0, owner, HWND_TOP, id, td, 0); //free(td); <-- Don't do this here as now the window owns the memory! return hwnd; } efte-1.1/src/FTETextAreaView.h0000664000076400007640000000013511041406031015156 0ustar laurilauri/* FTETextAreaView */ #import @interface FTETextAreaView : NSView { } @end efte-1.1/src/o_model.h0000664000076400007640000001236011041404761013700 0ustar laurilauri/* o_model.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef O_MODEL_H #define O_MODEL_H #include "console.h" // TEvent class EView; class EEventMap; class ExState; class ExModelView; class GxView; class EViewPort { public: EView *View; int ReCenter; EViewPort(EView *V); virtual ~EViewPort(); virtual void HandleEvent(TEvent &Event); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); virtual void GetPos(); virtual void StorePos(); virtual void Resize(int Width, int Height); }; enum createFlags { cfAppend = 1, cfNoActivate = 2 }; class EModel { public: EModel **Root; // root ptr of this list EModel *Next; // next model EModel *Prev; // prev model EView *View; // active view of model int ModelNo; EModel(int createFlags, EModel **ARoot); virtual ~EModel(); void AddView(EView *V); void RemoveView(EView *V); void SelectView(EView *V); virtual EViewPort *CreateViewPort(EView *V); virtual int GetContext(); virtual EEventMap *GetEventMap(); virtual int BeginMacro(); virtual int ExecCommand(int Command, ExState &State); virtual void HandleEvent(TEvent &Event); virtual void GetName(char *AName, int MaxLen); virtual void GetPath(char *APath, int MaxLen); virtual void GetInfo(char *AInfo, int MaxLen); virtual void GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen); void UpdateTitle(); void Msg(int level, const char *s, ...); virtual int CanQuit(); virtual int ConfQuit(GxView *V, int multiFile = 0); virtual int GetStrVar(int var, char *str, int buflen); virtual int GetIntVar(int var, int *value); virtual void NotifyPipe(int PipeId); virtual void NotifyDelete(EModel *Deleting); virtual void DeleteRelated(); }; class EView { public: EView *Next; // next view EView *Prev; // prev view ExModelView *MView; // model view controller EModel *Model; // model for this view EView *NextView; // next view for model EViewPort *Port; char *CurMsg; EView(EModel *AModel); virtual ~EView(); virtual void FocusChange(int GotFocus); virtual void Resize(int Width, int Height); void SetModel(EModel *AModel); void SelectModel(EModel *AModel); void SwitchToModel(EModel *AModel); void Activate(int GotFocus); virtual int GetContext(); virtual EEventMap *GetEventMap(); virtual int BeginMacro(); virtual int ExecCommand(int Command, ExState &State); virtual void HandleEvent(TEvent &Event); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); void Msg(int level, const char *s, ...); void SetMsg(const char *msg); int SwitchTo(ExState &State); int FilePrev(); int FileNext(); int FileLast(); int FileSaveAll(); int FileOpen(ExState &State); int FileOpenInMode(ExState &State); int SetPrintDevice(ExState &State); int ToggleSysClipboard(ExState &State); int ShowKey(ExState &State); int ViewBuffers(ExState &State); int ViewRoutines(ExState &State); int Compile(ExState &State); int RunCompiler(ExState &State); int Compile(char *Command); int ViewMessages(ExState &State); int CompilePrevError(ExState &State); int CompileNextError(ExState &State); int ConfigRecompile(ExState &State); int Cvs(ExState &State); int RunCvs(ExState &State); int ViewCvs(ExState &State); int Cvs(char *Options); int ClearCvsMessages(ExState &State); int CvsDiff(ExState &State); int RunCvsDiff(ExState &State); int ViewCvsDiff(ExState &State); int CvsDiff(char *Options); int CvsCommit(ExState &State); int RunCvsCommit(ExState &State); int CvsCommit(char *Options); int ViewCvsLog(ExState &State); int Svn(ExState &State); int RunSvn(ExState &State); int ViewSvn(ExState &State); int Svn(char *Options); int ClearSvnMessages(ExState &State); int SvnDiff(ExState &State); int RunSvnDiff(ExState &State); int ViewSvnDiff(ExState &State); int SvnDiff(char *Options); int SvnCommit(ExState &State); int RunSvnCommit(ExState &State); int SvnCommit(char *Options); int ViewSvnLog(ExState &State); int DirOpen(ExState &State); int OpenDir(char *Directory); int ShowVersion(); int ViewModeMap(ExState &State); int ClearMessages(); int TagLoad(ExState &State); int SysShowHelp(ExState &State, const char *word); int RemoveGlobalBookmark(ExState &State); int GotoGlobalBookmark(ExState &State); int PopGlobalBookmark(); void DeleteModel(EModel *M); int CanQuit(); int GetStrVar(int var, char *str, int buflen); int GetIntVar(int var, int *value); }; extern EModel *ActiveModel; extern EView *ActiveView; int GetNewModelID(EModel *B); EModel *FindModelID(EModel *B, int ID); #define MSGBUFTMP_SIZE 1024 #endif // O_MODEL_H efte-1.1/src/h_msg.cpp0000664000076400007640000001232711041404761013715 0ustar laurilauri/* h_msg.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #define hsMSG_Normal 0 #define hsMSG_Header 1 #define hsMSG_Quote 2 #define hsMSG_Tag 3 #define hsMSG_Control 4 int Hilit_MSG(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine* Line, hlState& State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); int is_head = 0, is_quote = 0, is_space = 0, is_tag = 0, is_control = 0; if (Line->Count > 0) { if (State == hsMSG_Header) { if (Line->Chars[0] == ' ' || Line->Chars[0] == '\t') is_head = 1; else State = hsMSG_Normal; } if (State == hsMSG_Normal) { if (Line->Count >= 2 && Line->Chars[0] == '-' && Line->Chars[1] == '-' && (Line->Count == 2 || Line->Chars[2] == ' ')) is_tag = 1; else if (Line->Count >= 2 && Line->Chars[0] == '.' && Line->Chars[1] == '.' && (Line->Count == 2 || Line->Chars[2] == ' ')) is_tag = 1; else if (Line->Count >= 3 && Line->Chars[0] == '-' && Line->Chars[1] == '-' && Line->Chars[2] == '-' && (Line->Count == 3 || Line->Chars[3] == ' ')) is_tag = 1; else if (Line->Count >= 3 && Line->Chars[0] == '.' && Line->Chars[1] == '.' && Line->Chars[2] == '.' && (Line->Count == 3 || Line->Chars[3] == ' ')) is_tag = 1; else if (Line->Count > 10 && memcmp(Line->Chars, " * Origin:", 10) == 0) is_control = 1; else if (Line->Count > 0 && Line->Chars[0] == '\x01') is_control = 1; else for (i = 0; i < Line->Count; i++) { if (i < 30 && Line->Chars[i] == ':' && i < Line->Count - 1 && Line->Chars[i+1] == ' ' && !is_space) { is_head = 1; break; } else if (i < 5 && Line->Chars[i] == '>') { is_quote = 1; break; } else if (Line->Chars[i] == '<' || (Line->Chars[i] == ' ' && i > 0) || Line->Chars[i] == '\t') break; else if (Line->Chars[i] == ' ' || Line->Chars[i] == '\t') is_space = 0; } } } if (is_head) { State = hsMSG_Header; Color = CLR_Header; } else if (is_quote) { State = hsMSG_Quote; Color = CLR_Quotes; } else if (is_tag) { State = hsMSG_Tag; Color = CLR_Tag; } else if (is_control) { State = hsMSG_Control; Color = CLR_Control; } else { State = hsMSG_Normal; Color = CLR_Normal; } ChColor DefColor = Color; int j = 0; if (BF->Mode->fColorize->Keywords.TotalCount > 0 || BF->WordCount > 0) { /* words have to be hilited, go slow */ for (i = 0; i < Line->Count;) { IF_TAB() else { if (isalpha(*p) || (*p == '_')) { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_')) ) j++; if (BF->GetHilitWord(j, Line->Chars + i, Color, 1)) ; else { Color = DefColor; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; Color = DefColor; continue; } ColorNext(); continue; } } } else if (ExpandTabs) { /* use slow mode */ for (i = 0; i < Line->Count;) { IF_TAB() else { ColorNext(); } } } else { /* fast mode */ if (Pos < Line->Count) { if (Pos + Width < Line->Count) { if (B) MoveMem(B, 0, Width, Line->Chars + Pos, Color, Width); if (StateMap) memset(StateMap, State, Line->Count); } else { if (B) MoveMem(B, 0, Width, Line->Chars + Pos, Color, Line->Count - Pos); if (StateMap) memset(StateMap, State, Line->Count); } } C = Line->Count; } if (State != hsMSG_Header) State = hsMSG_Normal; *ECol = C; return 0; } efte-1.1/src/g_pm.cpp0000664000076400007640000035267611215512661013562 0ustar laurilauri/* g_pm.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ /* * here's how it works: * there's one visible and one object window per view * events are forwarded from the visible on to object window and pulled * into the editor from the worker thread (there's only one, eFTE * editor core is single-threaded). * SIQ is never blocked. * the only problem is that window doesn't repaint correctly after resize, * until the worker thread finishes processing, but we can't really * do anything with this as the editor core is not thread-safe. */ #define INCL_WIN #define INCL_GPI #define INCL_VIO #define INCL_AVIO #define INCL_DOS #define INCL_DOSERRORS #include #include #include #include #include #include #include #include #include "ftever.h" #include "sysdep.h" #include "console.h" #include "gui.h" #include "c_history.h" #include "c_commands.h" #include "c_config.h" #include "c_mode.h" #include "c_color.h" #include "s_files.h" #include "s_string.h" #include "log.h" #define PM_STACK_SIZE (96 * 1024) #define UWM_NOTIFY (WM_USER + 1) #define UWM_DESTROY (WM_USER + 2) #define UWM_DESTROYHWND (WM_USER + 3) #define UWM_DROPPEDFILE (WM_USER + 4) #define UWM_FILEDIALOG (WM_USER + 5) #define UWM_DLGBOX (WM_USER + 6) #define UWM_PROCESSDLG (WM_USER + 7) #define UWM_CHOICE (WM_USER + 8) #define UWM_CREATECHILD (WM_USER + 9) #define UWM_CREATEWORKER (WM_USER + 10) #define UWM_CREATEFRAME (WM_USER + 11) #define UWM_CREATEMAINMENU (WM_USER + 12) #define UWM_CREATEPOPUPMENU (WM_USER + 13) #define CURSOR_TYPE (CURSOR_FLASH | CURSOR_SOLID) //#define SIZER_HEIGHT 4 #define FID_MTOOLBAR 10001 #define MAXXSIZE 160 #define MAXYSIZE 96 #define MAX_PIPES 4 #define PIPE_BUFLEN 4096 typedef struct { int used; int id; int reading, stopped; TID tid; HMTX Access; HEV ResumeRead; char *buffer; int buflen; int bufused; int bufpos; EModel *notify; char *Command; int RetCode; int DoTerm; } GPipe; static GPipe Pipes[MAX_PIPES] = { { 0 }, { 0 }, { 0 }, { 0 } }; #define sfFocus 1 typedef struct _PMPTR { // for passing pointers to winprocs USHORT len; void *p; } PMPTR; class GViewPeer; struct PMData { GViewPeer *Peer; HVPS hvps; HPS hps; SHORT cxChar; SHORT cyChar; HWND hwndWorker; }; class GViewPeer { public: GView *View; // int wX, wY; int wW, wH, wState; int cX, cY, cVisible; int sbVstart, sbVamount, sbVtotal; int sbHstart, sbHamount, sbHtotal; bool insertState; HWND hwndView; HWND hwndVscroll, hwndHscroll; HWND hwndWorker; PMData *pmData; int OldMouseX, OldMouseY; GViewPeer(GView *view, int XSize, int YSize); ~GViewPeer(); int ConPutBox(int X, int Y, int W, int H, PCell Cell); int ConGetBox(int X, int Y, int W, int H, PCell Cell); int ConPutLine(int X, int Y, int W, int H, PCell Cell); int ConSetBox(int X, int Y, int W, int H, TCell Cell); int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); int ConSetCursorPos(int X, int Y); int ConQueryCursorPos(int *X, int *Y); int ConShowCursor(); int ConHideCursor(); int ConCursorVisible(); void ConSetInsertState(bool insert); int QuerySbVPos(); int SetSbVPos(int Start, int Amount, int Total); int SetSbHPos(int Start, int Amount, int Total); int ExpandHeight(int DeltaY); int UpdateCursor(); int PMShowCursor(); int PMHideCursor(); int PMSetCursorPos(); }; class GFramePeer { public: GFrame *Frame; HWND hwndFrame; HWND menuBar; HWND hwndToolBar; PFNWP oldFrameProc; GFramePeer(GFrame *aFrame, int Width, int Height); ~GFramePeer(); int ConSetTitle(char *Title, char *STitle); int ConGetTitle(char *Title, int MaxLen, char *STitle, int SMaxLen); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); void MapFrame(); void ShowFrame(); void SizeFrame(); }; int ShowVScroll = 1; int ShowHScroll = 0; int ShowMenuBar = 1; int ShowToolBar = 1; unsigned long HaveGUIDialogs = GUIDLG_FILE | GUIDLG_CHOICE | GUIDLG_FIND | GUIDLG_FINDREPLACE | GUIDLG_PROMPT; extern int PMDisableAccel; GFrame *frames = 0; GUI *gui = 0; GView *MouseCapture = 0; GView *FocusCapture = 0; static HEV WorkerStarted, StartInterface; HWND CreatePMMainMenu(HWND parent, HWND owner, char *Name); HWND CreatePMMenu(HWND parent, HWND owner, int menu, int id, int style); HWND CreateToolBar(HWND parent, HWND owner, int id); MRESULT EXPENTRY FrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); //MRESULT EXPENTRY SizerWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); MRESULT EXPENTRY AVIOWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); MRESULT EXPENTRY ObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); MRESULT EXPENTRY CreatorWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); MRESULT EXPENTRY AboutDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); MRESULT EXPENTRY InfoDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); HAB hab = 0; HAB habW = 0; static char szClient[] = "EViewer"; static char szObject[] = "EWorker"; static char szCreator[] = "ECreator"; //static char szSizeBar[] = "ESizeBar" // TODO static ULONG flFrame = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MAXBUTTON | FCF_HIDEBUTTON | FCF_SHELLPOSITION | FCF_TASKLIST | // FCF_VERTSCROLL | FCF_HORZSCROLL | FCF_MENU | FCF_ICON; SWP swp; HMQ hmq = 0; HMQ hmqW = 0; HMTX hmtxPMData = 0; ULONG cxScreen, cyScreen, cyTitleBar, //cyMenuBar, cxBorder, cyBorder, cxScrollBar, cyScrollBar; SHORT reportSize = 1; TEvent EventBuf = { evNone }; HWND hwndCreatorUser, hwndCreatorWorker; char dragname[CCHMAXPATH]; #ifdef OLD_PMMENUTOOLBAR /* implemented using menus */ struct { int id; HBITMAP handle; int cmd; int flags; } tools[] = { // { 101, 0, ExExitEditor, MIS_BITMAP }, // { 0, 0, 0, MIS_SEPARATOR }, { 102, 0, ExFileOpen, MIS_BITMAP }, { 103, 0, ExFileSave, MIS_BITMAP }, { 104, 0, ExFileClose, MIS_BITMAP }, { 0, 0, 0, MIS_SEPARATOR }, { 105, 0, ExFilePrev, MIS_BITMAP }, { 106, 0, ExFileLast, MIS_BITMAP }, { 107, 0, ExFileNext, MIS_BITMAP }, { 0, 0, 0, MIS_SEPARATOR }, { 108, 0, ExUndo, MIS_BITMAP }, { 109, 0, ExRedo, MIS_BITMAP }, { 0, 0, 0, MIS_SEPARATOR }, { 110, 0, ExBlockCut, MIS_BITMAP }, { 111, 0, ExBlockCopy, MIS_BITMAP }, { 112, 0, ExBlockPasteStream, MIS_BITMAP }, { 113, 0, ExBlockPasteColumn, MIS_BITMAP }, { 0, 0, 0, MIS_SEPARATOR }, { 114, 0, ExCompilePrevError, MIS_BITMAP }, { 115, 0, ExCompileNextError, MIS_BITMAP }, { 0, 0, 0, MIS_SEPARATOR }, { 116, 0, ExTagFindWord, MIS_BITMAP }, { 119, 0, ExTagPop, MIS_BITMAP }, { 117, 0, ExTagNext, MIS_BITMAP }, { 118, 0, ExTagPrev, MIS_BITMAP }, }; HWND CreateToolBar(HWND parent, HWND owner, int id) { HWND menu; int i; MENUITEM item; HPS ps; menu = WinCreateWindow(parent, WC_MENU, "menu", WS_VISIBLE | MS_ACTIONBAR, 0, 0, 0, 0, owner, HWND_TOP, id, 0, 0); //WinEnableWindowUpdate(hmenu, FALSE); ps = WinGetPS(menu); for (i = 0; i < sizeof(tools) / sizeof(tools[0]); i++) { if (tools[i].handle == 0 && (tools[i].flags & MIS_BITMAP)) { tools[i].handle = GpiLoadBitmap(ps, NULLHANDLE, tools[i].id, 0, 0); } memset((void *)&item, 0, sizeof(item)); item.iPosition = i; item.hwndSubMenu = 0; item.afStyle = tools[i].flags; item.id = tools[i].cmd + 16384 + 8192; item.afAttribute = 0; item.hItem = tools[i].handle; WinSendMsg(menu, MM_INSERTITEM, MPFROMP(&item), MPFROMP(0)); } WinReleasePS(ps); return menu; } #else #include "pm_tool.h" #include "pm_tool.cpp" #define CMD(x) ((x) + 16384 + 8192) ToolBarItem tools[] = { // { tiBITMAP, 101, CMD(ExExitEditor), 0, 0 }, { tiBITMAP, 102, CMD(ExFileOpen), 0, 0 }, { tiBITMAP, 103, CMD(ExFileSave), 0, 0 }, { tiBITMAP, 104, CMD(ExFileClose), 0, 0 }, { tiSEPARATOR, 0, 0, 0, 0}, { tiBITMAP, 105, CMD(ExFilePrev), 0, 0 }, { tiBITMAP, 106, CMD(ExFileLast), 0, 0 }, { tiBITMAP, 107, CMD(ExFileNext), 0, 0 }, { tiSEPARATOR, 0, 0, 0, 0}, { tiBITMAP, 108, CMD(ExUndo), 0, 0 }, { tiBITMAP, 109, CMD(ExRedo), 0, 0 }, { tiSEPARATOR, 0, 0, 0, 0}, { tiBITMAP, 110, CMD(ExBlockCut), 0, 0 }, { tiBITMAP, 111, CMD(ExBlockCopy), 0, 0 }, { tiBITMAP, 112, CMD(ExBlockPasteStream), 0, 0 }, { tiBITMAP, 113, CMD(ExBlockPasteColumn), 0, 0 }, { tiSEPARATOR, 0, 0, 0, 0}, { tiBITMAP, 114, CMD(ExCompilePrevError), 0, 0 }, { tiBITMAP, 115, CMD(ExCompileNextError), 0, 0 }, { tiSEPARATOR, 0, 0, 0, 0}, { tiBITMAP, 116, CMD(ExTagFindWord), 0, 0 }, { tiBITMAP, 119, CMD(ExTagPop), 0, 0 }, { tiBITMAP, 117, CMD(ExTagNext), 0, 0 }, { tiBITMAP, 118, CMD(ExTagPrev), 0, 0 }, }; HWND CreateToolBar(HWND parent, HWND owner, int id) { STARTFUNC("CreateToolBar{g_pm.cpp}"); static int reged = 0; HPS hps; unsigned int i; if (!reged) { RegisterToolBarClass(hab); reged = 1; } hps = WinGetPS(parent); for (i = 0; i < sizeof(tools) / sizeof(tools[0]); i++) { if (tools[i].hBitmap == 0 && (tools[i].ulType == tiBITMAP)) tools[i].hBitmap = GpiLoadBitmap(hps, NULLHANDLE, tools[i].ulId, 0, 0); } WinReleasePS(hps); return CreateToolBar(parent, owner, id, sizeof(tools) / sizeof(tools[0]), tools); } #endif HWND CreatePMMenu(HWND parent, HWND owner, int menu, int id, int style) { HWND hmenu; int i; MENUITEM item; char s[256]; char *p; hmenu = WinCreateWindow(parent, WC_MENU, "menu", style & ~MS_CONDITIONALCASCADE, 0, 0, 0, 0, owner, HWND_TOP, id, 0, 0); //WinEnableWindowUpdate(hmenu, FALSE); for (i = 0; i < Menus[menu].Count; i++) { memset((void *)&item, 0, sizeof(item)); item.iPosition = i; item.hwndSubMenu = 0; if (Menus[menu].Items[i].Name) { if (Menus[menu].Items[i].SubMenu != -1) { item.afStyle = MIS_SUBMENU | MIS_TEXT; item.hwndSubMenu = CreatePMMenu(HWND_DESKTOP, owner, Menus[menu].Items[i].SubMenu, 0, (Menus[menu].Items[i].Cmd == SUBMENU_CONDITIONAL) ? MS_CONDITIONALCASCADE : 0); { static int ids = 1000; item.id = ids++; if (ids == 7000) { ids = 1000; } } } else { item.afStyle = MIS_TEXT; item.id = (Menus[menu].Items[i].Cmd & 0xFFFF) + 8192; // ? } } else { item.afStyle = MIS_SEPARATOR; item.id = 0; } item.afAttribute = 0; item.hItem = 0; if (Menus[menu].Items[i].Name) { strcpy(s, Menus[menu].Items[i].Name); p = strchr(s, '&'); if (p) (*p) = '~'; p = (char *) s; } else { p = 0; } WinSendMsg(hmenu, MM_INSERTITEM, MPFROMP(&item), MPFROMP(p)); if (i == 0 && style == MS_CONDITIONALCASCADE) { WinSetWindowBits(hmenu, QWL_STYLE, MS_CONDITIONALCASCADE, MS_CONDITIONALCASCADE); WinSendMsg(hmenu, MM_SETDEFAULTITEMID, MPFROMSHORT(item.id), 0); } } //WinEnableWindowUpdate(hmenu, TRUE); return hmenu; } HWND CreatePMMainMenu(HWND parent, HWND owner, char *Name) { int id = GetMenuId(Name); HWND main; assert(id != -1); main = CreatePMMenu(parent, owner, id, FID_MENU, MS_ACTIONBAR); return main; } #include "pmdlg.h" void InsertHistory(HWND hwnd, int id, int maxlen) { int i, count; char *str; count = CountInputHistory(id); str = (char *)malloc(maxlen + 1); if (str == 0) return; for (i = 0; i < count; i++) { if (GetInputHistory(id, str, maxlen, i + 1) == 1) WinInsertLboxItem(hwnd, LIT_END, str); } free(str); } // display the about dialog MRESULT EXPENTRY AboutDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { switch(msg) { case WM_COMMAND: switch(SHORT1FROMMP(mp1)) { case DID_OK: case DID_CANCEL: WinDismissDlg (hwnd, TRUE); return 0 ; } break; } return WinDefDlgProc(hwnd, msg, mp1, mp2); } MRESULT EXPENTRY InfoDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { static PVOID mp2Pointer1; PVOID mp2Pointer2; switch (msg) { case WM_INITDLG: mp2Pointer1 = mp2; // Static copy mp2Pointer2 = mp2; // Nonm-static copy (gets destroyed) WinSetDlgItemText(hwnd, INFO_TEXT, (PSZ)mp2); break; case WM_COMMAND: switch(SHORT1FROMMP(mp1)) { case DID_OK: case DID_CANCEL: WinSetDlgItemText(hwnd, INFO_TEXT, (PSZ)mp2Pointer1); WinDismissDlg(hwnd, TRUE); return(0); } break; } return WinDefDlgProc(hwnd, msg, mp1, mp2); } MRESULT EXPENTRY FileDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { FILEDLG *dlg; dlg = (FILEDLG *)WinQueryWindowULong(hwnd, QWL_USER); switch (msg) { case WM_INITDLG: WinSendMsg(hwnd, WM_SETICON, MPFROMLONG(WinLoadPointer(HWND_DESKTOP, 0, 1)), 0); InsertHistory(WinWindowFromID(hwnd, DID_FILENAME_ED), HIST_PATH, MAXPATH); WinInvalidateRect(hwnd, 0, TRUE); WinRestoreWindowPos("eFTEPM", ((dlg->fl & FDS_SAVEAS_DIALOG) ? "FileSaveDlg" : "FileOpenDlg"), hwnd); break; case WM_COMMAND: switch (SHORT1FROMMP(mp1)) { case DID_OK: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("eFTEPM", ((dlg->fl & FDS_SAVEAS_DIALOG) ? "FileSaveDlg" : "FileOpenDlg"), hwnd); break; case DID_CANCEL: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("eFTEPM", ((dlg->fl & FDS_SAVEAS_DIALOG) ? "FileSaveDlg" : "FileOpenDlg"), hwnd); break; } break; case WM_CLOSE: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("eFTEPM", ((dlg->fl & FDS_SAVEAS_DIALOG) ? "FileSaveDlg" : "FileOpenDlg"), hwnd); break; } return WinDefFileDlgProc(hwnd, msg, mp1, mp2); } int DLGGetFile(GView *View, const char *Prompt, unsigned int BufLen, char *FileName, int Flags) { FILEDLG dlg; memset(&dlg, 0, sizeof(FILEDLG)); dlg.cbSize = sizeof(dlg); dlg.fl = FDS_CENTER | ((Flags & GF_SAVEAS) ? FDS_SAVEAS_DIALOG : FDS_OPEN_DIALOG); dlg.pszTitle = (char*)Prompt; strcpy(dlg.szFullFile, FileName); if (!LONGFROMMR(WinSendMsg(View->Parent->Peer->hwndFrame, UWM_FILEDIALOG, MPFROMP(&dlg), 0))) return 0; if (dlg.lReturn == DID_OK) { strncpy(FileName, dlg.szFullFile, BufLen); FileName[BufLen - 1] = 0; AddInputHistory(HIST_PATH, FileName); return 1; } return 0; } // structure used to send message information to main // window process typedef struct { char *Title; int NSel; char *Buttons[5]; char *Format; char *Message; int Flags; } ChoiceInfo; static int DoChoice(HWND hwndFrame, ChoiceInfo *choice) { int rc; int x; int y; int xw; int yw; int nx; int ny; int cp; int cd; int SPC = 4; char msgbox[100]; char msg[1024]; char Prompt[1024]; char *fmt; char *p; HWND hwndButton[40]; SWP swp; SWP swp1; ULONG flFrame = FCF_TITLEBAR | FCF_DLGBORDER; HPS ps; RECTL tr; ULONG dlgtype = 0; // If this is the About dialog let's get in done and return if(choice->Flags == GPC_ABOUT) { WinDlgBox(HWND_DESKTOP, hwndFrame, AboutDlgProc, NULLHANDLE, IDD_ABOUT, NULL); return 0; } // take care of all the information dialogs with just one button which // should be an OK response if(choice->NSel == 1 && choice->Flags != GPC_ABOUT) { sprintf(msg, choice->Format, choice->Message); if(choice->Flags == GPC_NOTE) dlgtype = IDD_INFO; else dlgtype = IDD_ERROR; WinDlgBox(HWND_DESKTOP, hwndFrame, InfoDlgProc, NULLHANDLE, dlgtype, msg); return 0; } sprintf(msgbox, "MsgBox: %s", choice->Title); // Get size of screen: // // Return the system values for the desktop-window handle // (Dimensions are in pels): // Width of the dialog-frame border long cxBorder = WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME); // Height of the dialog-frame border long cyBorder = WinQuerySysValue(HWND_DESKTOP, SV_CYDLGFRAME); HWND hwndDlg = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE | WS_TABSTOP, &flFrame, 0, choice->Title, 0, 0, 0, 0); WinSendMsg(hwndDlg, WM_SETICON, MPFROMLONG(WinLoadPointer(HWND_DESKTOP, 0, 1)), 0); WinSetOwner(hwndDlg, hwndFrame); x = SPC; for (int i = 0; i < choice->NSel; i++) { char button[60]; // convert the & (generic FTE) to ~ p = strchr(choice->Buttons[i], '&'); if (p) *p = '~'; // copy current button from Choice structure strcpy(button, choice->Buttons[i]); hwndButton[i] = WinCreateWindow(hwndDlg, WC_BUTTON, button, WS_VISIBLE | BS_PUSHBUTTON | BS_AUTOSIZE | ((i == 0) ? BS_DEFAULT | WS_TABSTOP | WS_GROUP : 0), cxBorder + x, SPC + cyBorder, 0, 0, hwndDlg, ((i == 0) ? HWND_TOP : hwndButton[i - 1]), 200 + i, NULL, NULL); WinQueryWindowPos(hwndButton[i], &swp); x += SPC + swp.cx; } fmt = choice->Format; sprintf(msg, choice->Format, choice->Message); strncpy((PCHAR)Prompt, msg, sizeof(Prompt)); Prompt[sizeof(Prompt) - 1] = 0; HWND hwndStatic = WinCreateWindow(hwndDlg, WC_STATIC, Prompt, WS_VISIBLE | SS_TEXT | DT_TOP | DT_CENTER | DT_WORDBREAK, 0, 0, 0, 0, hwndDlg, HWND_TOP, 100, NULL, NULL); WinRestoreWindowPos("eFTEPM", msgbox, hwndDlg); xw = cxScreen / 2; if (x - SPC > xw) xw = x - SPC; yw = 0; ps = WinGetPS(hwndStatic); cp = 0; for (;;) { tr.xLeft = 0; tr.xRight = xw; tr.yTop = cyScreen / 2; tr.yBottom = 0; cd = WinDrawText(ps, -1, (Prompt + cp), &tr, 0, 0, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_TEXTATTRS | DT_QUERYEXTENT | DT_EXTERNALLEADING); if (!cd) break; cp += cd; yw += tr.yTop - tr.yBottom; } WinReleasePS(ps); WinSetWindowPos(hwndStatic, 0, cxBorder + SPC, cyBorder + SPC + swp.cy + SPC, xw, yw, SWP_MOVE | SWP_SIZE); WinQueryWindowPos(hwndStatic, &swp1); WinQueryWindowPos(hwndButton[0], &swp); nx = cxBorder + SPC + xw + SPC + cxBorder; ny = cyBorder + SPC + swp.cy + SPC + swp1.cy + SPC + cyTitleBar + cyBorder; WinQueryWindowPos(hwndDlg, &swp); x = swp.x; y = swp.y + swp.cy - ny; if (y < cyBorder) y = - cyBorder; if (y + ny >= cyScreen + cyBorder) y = cyScreen - ny + cyBorder; if (x + nx >= cxScreen + cxBorder) x = cxScreen - nx + cxBorder; if (x < -cxBorder) x = -cxBorder; WinSetWindowPos(hwndDlg, 0, x, y, nx, ny, SWP_SIZE | SWP_SHOW | SWP_MOVE | SWP_ACTIVATE); WinSubclassWindow(hwndDlg, (PFNWP) WinDefDlgProc); if (choice->Flags & (GPC_ERROR | GPC_FATAL)) WinAlarm(HWND_DESKTOP, WA_ERROR); else if (choice->Flags & (GPC_CONFIRM)) WinAlarm(HWND_DESKTOP, WA_NOTE); else if (choice->Flags & (GPC_WARNING)) WinAlarm(HWND_DESKTOP, WA_WARNING); rc = LONGFROMMR(WinSendMsg(hwndFrame, UWM_PROCESSDLG, MPFROMLONG(hwndDlg), 0)); WinStoreWindowPos("eFTEPM", msgbox, hwndDlg); WinSendMsg(hwndFrame, UWM_DESTROYHWND, MPFROMLONG(hwndDlg), 0); if (rc == DID_CANCEL || rc == DID_ERROR) return choice->NSel - 1; if (rc >= 200 && rc < choice->NSel + 200) return rc - 200; return 0; } /* reimplemented most of the WinMessageBox code to get store/restore position to work */ int DLGPickChoice(GView *View, const char *ATitle, int NSel, va_list ap, int Flags) { int i; int rc; ChoiceInfo choice; choice.Title = (char *)ATitle; choice.NSel = NSel; for(i = 0; i < NSel; i++) choice.Buttons[i] = va_arg(ap, char *); choice.Format = va_arg(ap, char *); choice.Message = va_arg(ap, char *); choice.Flags = Flags; rc = LONGFROMMR(WinSendMsg(View->Parent->Peer->hwndFrame, UWM_CHOICE, MPFROMP(&choice), 0)); return(rc); } static struct { char *Title; char *Entry; int MaxLen; int HistId; } PromptInfo; MRESULT EXPENTRY PromptDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { switch (msg) { case WM_INITDLG: WinSendMsg(hwnd, WM_SETICON, MPFROMLONG(WinLoadPointer(HWND_DESKTOP, 0, 1)), 0); WinSendDlgItemMsg(hwnd, IDE_FIELD, EM_SETTEXTLIMIT, MPFROMLONG(PromptInfo.MaxLen), 0); WinSetDlgItemText(hwnd, IDE_FIELD, PromptInfo.Entry); InsertHistory(WinWindowFromID(hwnd, IDE_FIELD), PromptInfo.HistId, PromptInfo.MaxLen); WinSetDlgItemText(hwnd, IDS_PROMPT, PromptInfo.Title); WinSetWindowText(hwnd, PromptInfo.Title); WinInvalidateRect(hwnd, 0, TRUE); WinRestoreWindowPos("eFTEPM", "PromptDlg", hwnd); return WinDefDlgProc(hwnd, msg, mp1, mp2); case WM_COMMAND: switch (SHORT1FROMMP(mp1)) { case DID_OK: WinQueryDlgItemText(hwnd, IDE_FIELD, PromptInfo.MaxLen, PromptInfo.Entry); PromptInfo.Entry[PromptInfo.MaxLen - 1] = 0; AddInputHistory(PromptInfo.HistId, PromptInfo.Entry); WinShowWindow(hwnd, FALSE); WinStoreWindowPos("eFTEPM", "PromptDlg", hwnd); WinDismissDlg(hwnd, TRUE); return (MRESULT)FALSE; case DID_CANCEL: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("eFTEPM", "PromptDlg", hwnd); WinDismissDlg(hwnd, FALSE); return (MRESULT)FALSE; } break; case WM_CLOSE: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("eFTEPM", "PromptDlg", hwnd); /* passthru */ default: return WinDefDlgProc(hwnd, msg, mp1, mp2); } return (MRESULT)FALSE; } int DLGGetStr(GView *View, const char *Prompt, unsigned int BufLen, char *Str, int HistId, int Flags) { assert(BufLen > 0); PromptInfo.MaxLen = BufLen - 1; PromptInfo.Title = (char *)Prompt; PromptInfo.Entry = Str; PromptInfo.HistId = HistId; if (LONGFROMMR(WinSendMsg(View->Parent->Peer->hwndFrame, UWM_DLGBOX, MPFROMP(PFNWP(PromptDlgProc)), MPFROMLONG(IDD_PROMPT))) != DID_OK) return 0; return 1; } static SearchReplaceOptions SearchOpt; static int ReplaceDlg = 0; MRESULT EXPENTRY FindDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { switch (msg) { case WM_INITDLG: WinSendMsg(hwnd, WM_SETICON, MPFROMLONG(WinLoadPointer(HWND_DESKTOP, 0, 1)), 0); WinSendDlgItemMsg(hwnd, IDE_FIND, EM_SETTEXTLIMIT, MPFROMLONG(MAXSEARCH), 0); WinSetDlgItemText(hwnd, IDE_FIND, SearchOpt.strSearch); InsertHistory(WinWindowFromID(hwnd, IDE_FIND), HIST_SEARCH, MAXSEARCH); WinCheckButton(hwnd, IDC_IGNORECASE, (SearchOpt.Options & SEARCH_NCASE) ? 1 : 0); WinCheckButton(hwnd, IDC_REGEXPS, (SearchOpt.Options & SEARCH_RE) ? 1 : 0); WinCheckButton(hwnd, IDC_WORDS, (SearchOpt.Options & SEARCH_WORD) ? 1 : 0); WinCheckButton(hwnd, IDC_BLOCK, (SearchOpt.Options & SEARCH_BLOCK) ? 1 : 0); WinCheckButton(hwnd, IDC_GLOBAL, (SearchOpt.Options & SEARCH_GLOBAL) ? 1 : 0); WinCheckButton(hwnd, IDC_REVERSE, (SearchOpt.Options & SEARCH_BACK) ? 1 : 0); WinCheckButton(hwnd, IDC_ALLOCCURENCES, (SearchOpt.Options & SEARCH_ALL) ? 1 : 0); WinCheckButton(hwnd, IDC_JOINLINE, (SearchOpt.Options & SEARCH_JOIN) ? 1 : 0); if (ReplaceDlg) { WinSendDlgItemMsg(hwnd, IDE_REPLACE, EM_SETTEXTLIMIT, MPFROMLONG(MAXSEARCH), 0); WinSetDlgItemText(hwnd, IDE_REPLACE, SearchOpt.strReplace); InsertHistory(WinWindowFromID(hwnd, IDE_REPLACE), HIST_SEARCH, MAXSEARCH); WinCheckButton(hwnd, IDC_NOPROMPTING, (SearchOpt.Options & SEARCH_NASK) ? 1 : 0); } else { WinCheckButton(hwnd, IDC_DELETELINE, (SearchOpt.Options & SEARCH_DELETE) ? 1 : 0); } WinInvalidateRect(hwnd, 0, TRUE); WinRestoreWindowPos("eFTEPM", ReplaceDlg ? "ReplaceDlg" : "FindDlg", hwnd); return WinDefDlgProc(hwnd, msg, mp1, mp2); case WM_COMMAND: switch (SHORT1FROMMP(mp1)) { case DID_OK: SearchOpt.ok = 1; SearchOpt.resCount = 0; SearchOpt.Options = 0; strcpy(SearchOpt.strReplace, ""); WinQueryDlgItemText(hwnd, IDE_FIND, MAXSEARCH, SearchOpt.strSearch); SearchOpt.strSearch[MAXSEARCH - 1] = 0; AddInputHistory(HIST_SEARCH, SearchOpt.strSearch); if (WinQueryButtonCheckstate(hwnd, IDC_IGNORECASE)) SearchOpt.Options |= SEARCH_NCASE; if (WinQueryButtonCheckstate(hwnd, IDC_REGEXPS)) SearchOpt.Options |= SEARCH_RE; if (WinQueryButtonCheckstate(hwnd, IDC_WORDS)) SearchOpt.Options |= SEARCH_WORD; if (WinQueryButtonCheckstate(hwnd, IDC_BLOCK)) SearchOpt.Options |= SEARCH_BLOCK; if (WinQueryButtonCheckstate(hwnd, IDC_GLOBAL)) SearchOpt.Options |= SEARCH_GLOBAL; if (WinQueryButtonCheckstate(hwnd, IDC_REVERSE)) SearchOpt.Options |= SEARCH_BACK; if (WinQueryButtonCheckstate(hwnd, IDC_ALLOCCURENCES)) SearchOpt.Options |= SEARCH_ALL; if (WinQueryButtonCheckstate(hwnd, IDC_JOINLINE)) SearchOpt.Options |= SEARCH_JOIN; if (ReplaceDlg) { WinQueryDlgItemText(hwnd, IDE_REPLACE, MAXSEARCH, SearchOpt.strReplace); SearchOpt.strReplace[MAXSEARCH - 1] = 0; AddInputHistory(HIST_SEARCH, SearchOpt.strReplace); SearchOpt.Options |= SEARCH_REPLACE; if (WinQueryButtonCheckstate(hwnd, IDC_NOPROMPTING)) SearchOpt.Options |= SEARCH_NASK; } else { if (WinQueryButtonCheckstate(hwnd, IDC_DELETELINE)) SearchOpt.Options |= SEARCH_DELETE; } WinShowWindow(hwnd, FALSE); WinStoreWindowPos("eFTEPM", ReplaceDlg ? "ReplaceDlg" : "FindDlg", hwnd); WinDismissDlg(hwnd, TRUE); return (MRESULT)FALSE; case DID_CANCEL: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("eFTEPM", ReplaceDlg ? "ReplaceDlg" : "FindDlg", hwnd); WinDismissDlg(hwnd, FALSE); return (MRESULT)FALSE; } break; case WM_CLOSE: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("eFTEPM", ReplaceDlg ? "ReplaceDlg" : "FindDlg", hwnd); /* passthru */ default: return WinDefDlgProc(hwnd, msg, mp1, mp2); } return (MRESULT)FALSE; } int DLGGetFind(GView *View, SearchReplaceOptions &sr) { SearchOpt = sr; ReplaceDlg = 0; if (LONGFROMMR(WinSendMsg(View->Parent->Peer->hwndFrame, UWM_DLGBOX, PVOIDFROMMP(PFNWP(FindDlgProc)), MPFROMLONG(IDD_FIND))) != DID_OK) return 0; sr = SearchOpt; return 1; } int DLGGetFindReplace(GView *View, SearchReplaceOptions &sr) { SearchOpt = sr; ReplaceDlg = 1; if (LONGFROMMR(WinSendMsg(View->Parent->Peer->hwndFrame, UWM_DLGBOX, PVOIDFROMMP(PFNWP(FindDlgProc)), MPFROMLONG(IDD_FINDREPLACE))) != DID_OK) return 0; sr = SearchOpt; return 1; } struct { int vk; TKeyCode kc; char *name; } lvirt[] = { { VK_F1, kbF1, "F1" }, { VK_F2, kbF2, "F2" }, { VK_F3, kbF3, "F3" }, { VK_F4, kbF4, "F4" }, { VK_F5, kbF5, "F5" }, { VK_F6, kbF6, "F6" }, { VK_F7, kbF7, "F7" }, { VK_F8, kbF8, "F8" }, { VK_F9, kbF9, "F9" }, { VK_F10, kbF10, "F10" }, { VK_F11, kbF11, "F11" }, { VK_F12, kbF12, "F12" }, { VK_ESC, kbEsc, "Esc" }, { VK_ENTER, kbEnter | kfGray, "Enter" }, { VK_NEWLINE, kbEnter, "Enter" }, { VK_BACKSPACE, kbBackSp, "BackSp" }, { VK_SPACE, kbSpace, "Space" }, { VK_TAB, kbTab, "Tab" }, { VK_BACKTAB, kbTab | kfShift, "Tab" }, { VK_UP, kbUp, "Up" }, { VK_DOWN, kbDown, "Down" }, { VK_LEFT, kbLeft, "Left" }, { VK_RIGHT, kbRight, "Right" }, { VK_HOME, kbHome, "Home" }, { VK_END, kbEnd, "End" }, { VK_PAGEDOWN, kbPgDn, "PgDn" }, { VK_PAGEUP, kbPgUp, "PgUp" }, { VK_INSERT, kbIns, "Ins" }, { VK_DELETE, kbDel, "Del" }, { VK_CTRL, kbCtrl | kfModifier, "Ctrl" }, { VK_ALT, kbAlt | kfModifier, "Alt" }, { VK_ALTGRAF, kbAlt | kfModifier, "Alt" }, { VK_SHIFT, kbShift | kfModifier, "Shift" }, { VK_CAPSLOCK, kbCapsLock | kfModifier, "CapsLock" }, { VK_NUMLOCK, kbNumLock | kfModifier, "NumLock" }, { VK_SCRLLOCK, kbScrollLock | kfModifier, "ScrollLock" }, { VK_BREAK, kbBreak, "Break" }, { VK_PAUSE, kbPause, "Pause" }, { VK_PRINTSCRN, kbPrtScr, "PrtScr" }, { VK_SYSRQ, kbSysReq, "SysReq", }, }; char *ConvertKey(int ch, int virt, int flags, int scan, TEvent &Event) { int keyFlags = 0; static char name[40]; char keyname[40]; TKeyCode keyCode = 0; strcpy(keyname, "UNKNOWN"); //printf("ch:%d, virt:%d, flags:%d, scan:%d\n", ch, virt, flags, scan); name[0] = 0; if (flags & KC_CTRL) keyFlags |= kfCtrl; if (flags & KC_ALT) keyFlags |= kfAlt; if (flags & KC_SHIFT) keyFlags |= kfShift; if ((ch != 0xE0) && ((ch & 0xFF) == 0xE0)) keyFlags |= kfGray; if (keyFlags == kfAlt) {// do not produce anything on alt+XXX switch (scan) { case 71: case 72: case 73: case 75: case 76: case 77: case 79: case 80: case 81: case 82: case 83: return name; } } if (ch != 0 && (flags & KC_CHAR)) { switch (scan) { case 71: case 72: case 73: case 75: case 76: case 77: case 79: case 80: case 81: case 82: case 83: virt = 0; } } { int i; for (i = 0; i < (sizeof(lvirt) / sizeof(lvirt[0])); i++) if (lvirt[i].vk == virt) { keyCode = lvirt[i].kc; strcpy(keyname, lvirt[i].name); break; } } if (keyCode == 0) { char c[2]; if (ch == 0 && scan == 86) { // Fix for OS/2 bug with UK keyboard layout // This is shift-'\' (to the left of Z), which returns 0 ch = '|'; } c[0] = char(ch); c[1] = 0; if (ch == '+' && scan == 78) keyCode = '+' | kfGray; else if (ch == '-' && scan == 74) keyCode = '-' | kfGray; else if (ch == '*' && scan == 55) keyCode = '*' | kfGray; else if (ch == '/' && scan == 92) keyCode = '/' | kfGray; else { keyCode = ch; //if (keyFlags == kfShift) // keyFlags = 0; } keyname[0] = 0; if (keyCode & kfGray) strcpy(keyname, "G+"); strcat(keyname, c); } if ((keyFlags & (kfAlt | kfSpecial | kfGray)) == kfAlt) { if (keyCode >= 'a' && keyCode <= 'z') keyCode -= 'a' - 'A'; } if ((keyFlags & (kfCtrl | kfAlt | kfSpecial | kfGray)) == kfCtrl) { if (keyCode >= 'a' && keyCode < 'a' + 32) keyCode -= 'a' - 1; else if (keyCode >= 'A' && keyCode < 'A' + 32) keyCode -= 'A' - 1; } if (keyFlags & kfCtrl) if (keyCode < 32) keyCode += 64; keyCode |= keyFlags; if (keyCode & kfKeyUp) strcat(name, "UP "); else strcat(name, "DN "); if (keyCode & kfAlt) strcat(name, "A+"); if (keyCode & kfCtrl) strcat(name, "C+"); if (keyCode & kfGray) strcat(name, "G+"); if (keyCode & kfShift) strcat(name, "S+"); strcat(name, keyname); Event.What = evKeyDown; if (flags & KC_KEYUP) { keyFlags |= kfKeyUp; Event.What = evKeyUp; } Event.Key.Code = keyCode; return name; } MRESULT CreateChild(HWND parent, GViewPeer *peer, PMData *pmData) { PMPTR ptr; ptr.len = sizeof(PMPTR); ptr.p = pmData; peer->hwndView = WinCreateWindow(parent, szClient, "eFTE", WS_VISIBLE, 0, 0, 0, 0, NULLHANDLE, HWND_TOP, FID_CLIENT, (void *) & ptr, NULL); assert(peer->hwndView != NULLHANDLE); peer->hwndVscroll = WinCreateWindow(parent, WC_SCROLLBAR, "", WS_VISIBLE | SBS_VERT | SBS_AUTOTRACK, 0, 0, 0, 0, peer->hwndView, HWND_TOP, 0, (void *) & ptr, NULL); assert(peer->hwndVscroll != NULLHANDLE); peer->hwndHscroll = WinCreateWindow(parent, WC_SCROLLBAR, "", WS_VISIBLE | SBS_HORZ | SBS_AUTOTRACK, 0, 0, 0, 0, peer->hwndView, HWND_TOP, 0, (void *) & ptr, NULL); assert(peer->hwndHscroll != NULLHANDLE); return (MRESULT)TRUE; } BOOL CalcFrameSWP(HWND hwnd, PSWP pswp, BOOL bFrame) { BOOL bSuccess; RECTL rcl; rcl.xLeft = pswp->x; rcl.yBottom = pswp->y; rcl.xRight = pswp->x + pswp->cx; rcl.yTop = pswp->y + pswp->cy; bSuccess = WinCalcFrameRect(hwnd, &rcl, bFrame); pswp->x = rcl.xLeft; pswp->y = rcl.yBottom; pswp->cx = rcl.xRight - rcl.xLeft; pswp->cy = rcl.yTop - rcl.yBottom; return bSuccess; } MRESULT EXPENTRY FrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { GFramePeer *peer = (GFramePeer *) WinQueryWindowULong(hwnd, QWL_USER); if (peer) switch (msg) { case UWM_DESTROY: WinDestroyWindow(hwnd); return 0; case UWM_DESTROYHWND: WinDestroyWindow(LONGFROMMP(mp1)); return 0; case UWM_FILEDIALOG: return MRFROMLONG(WinFileDlg(HWND_DESKTOP, hwnd, (FILEDLG *)PVOIDFROMMP(mp1))); case UWM_DLGBOX: return MRFROMLONG(WinDlgBox(HWND_DESKTOP, hwnd, PFNWP(PVOIDFROMMP(mp1)), 0, LONGFROMMP(mp2), NULL)); case UWM_PROCESSDLG: return MRFROMLONG(WinProcessDlg(HWNDFROMMP(mp1))); case UWM_CHOICE: return MRFROMLONG(DoChoice(hwnd, (ChoiceInfo *)PVOIDFROMMP(mp1))); case UWM_CREATECHILD: //DosBeep(2500, 1000); return CreateChild(hwnd, (GViewPeer *)PVOIDFROMMP(mp1), (PMData *)PVOIDFROMMP(mp2)); case WM_TRANSLATEACCEL: // check for keys not to be translated { QMSG *qmsg = (QMSG *)mp1; USHORT vk = SHORT2FROMMP((qmsg->mp2)); USHORT fl = (USHORT)(SHORT1FROMMP((qmsg->mp1)) & (KC_ALT | KC_SHIFT | KC_CTRL | KC_KEYUP)); USHORT ch = SHORT1FROMMP((qmsg->mp2)); if ((vk == VK_MENU || vk == VK_F1) && fl == 0 || vk == VK_NEWLINE && fl == KC_ALT || vk == VK_ENTER && fl == KC_ALT || vk == VK_SPACE && fl == KC_ALT) return (MRESULT)FALSE; if ((ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z') && (fl & KC_ALT)) return (MRESULT)FALSE; if (PMDisableAccel) if (fl & KC_ALT) if (vk >= VK_F1 && vk <= VK_F24) return (MRESULT)FALSE; } break; /*case WM_CALCFRAMERECT: { PRECTL rcl = (PRECTL)PVOIDFROMMP(mp1); USHORT isFrame = SHORT1FROMMP(mp2); BOOL fSuccess = LONGFROMMR(peer->oldFrameProc(hwnd, msg, mp1, mp2)); if (ShowToolBar && fSuccess) { SWP swpToolBar; HWND hwndToolBar = WinWindowFromID(hwnd, FID_MTOOLBAR); WinQueryWindowPos(hwndToolBar, &swpToolBar); WinSendMsg(hwndToolBar, WM_ADJUSTWINDOWPOS, MPFROMP(&swpToolBar), MPARAM(0)); if (isFrame) rcl->yTop -= swpToolBar.cy; else rcl->yTop += swpToolBar.cy; } return MRFROMLONG(fSuccess); }*/ case WM_QUERYTRACKINFO: { MRESULT mr; mr = peer->oldFrameProc(hwnd, msg, mp1, mp2); if (mr == (MRESULT)FALSE) return mr; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); if ((SHORT1FROMMP(mp1) & TF_MOVE) != TF_MOVE) { PTRACKINFO pti; pti = (PTRACKINFO) PVOIDFROMMP(mp2); pti->cxGrid = peer->Frame->Top->Peer->pmData->cxChar; pti->cyGrid = peer->Frame->Top->Peer->pmData->cyChar; pti->cxKeyboard = peer->Frame->Top->Peer->pmData->cxChar; pti->cyKeyboard = peer->Frame->Top->Peer->pmData->cyChar; pti->fs |= TF_GRID; } DosReleaseMutexSem(hmtxPMData); return mr; } case WM_MINMAXFRAME: { PSWP pswp = (PSWP) PVOIDFROMMP(mp1); if (pswp->fl & SWP_MAXIMIZE) { GView *v; int cnt; SWP swpMenu; SWP swpToolBar; HWND hwndMenu = WinWindowFromID(hwnd, FID_MENU); HWND hwndToolBar = WinWindowFromID(hwnd, FID_MTOOLBAR); WinQueryWindowPos(hwndMenu, &swpMenu); swpMenu.x = 0; swpMenu.y = 0; swpMenu.cx = cxScreen - 2 * cxBorder; swpMenu.cy = cyScreen; WinSendMsg(hwndMenu, WM_ADJUSTWINDOWPOS, MPFROMP(&swpMenu), MPARAM(0)); if (ShowToolBar) { WinQueryWindowPos(hwndToolBar, &swpToolBar); swpToolBar.x = 0; swpToolBar.y = 0; swpToolBar.cx = cxScreen - 2 * cxBorder; swpToolBar.cy = cyScreen; WinSendMsg(hwndToolBar, WM_ADJUSTWINDOWPOS, MPFROMP(&swpToolBar), MPARAM(0)); } else { swpToolBar.cy = 0; } DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); pswp->cx = cxScreen - cxScrollBar; pswp->cy = cyScreen - cyTitleBar - swpMenu.cy - swpToolBar.cy; cnt = 0; v = peer->Frame->Top; while (v) { cnt++; v = v->Prev; if (v == peer->Frame->Top) break; } pswp->cy -= cnt * cyScrollBar; if (pswp->cy < 0) pswp->cy = 0; if (v) { pswp->cx /= v->Peer->pmData->cxChar; if (pswp->cx > MAXXSIZE) pswp->cx = MAXXSIZE; pswp->cx *= v->Peer->pmData->cxChar; pswp->cy /= v->Peer->pmData->cyChar; if (pswp->cy > MAXYSIZE) pswp->cy = MAXYSIZE; pswp->cy *= v->Peer->pmData->cyChar; } pswp->cy += cnt * cyScrollBar; pswp->cx += cxBorder * 2 + cxScrollBar; pswp->cy += cyBorder * 2 + cyTitleBar + swpMenu.cy + swpToolBar.cy; pswp->y = cyScreen - pswp->cy + cyBorder; DosReleaseMutexSem(hmtxPMData); return (MRESULT)FALSE; } } break; case WM_ADJUSTWINDOWPOS: { PSWP pswp = (PSWP) PVOIDFROMMP(mp1); if (pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_MAXIMIZE)) { GView *v; int cnt; SWP swpToolBar; if (pswp->cx < 0 || pswp->cy <= cyTitleBar + 2 * cyBorder) break; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); //printf("Before 1: %d %d | %d %d\n", pswp->cx, pswp->x, pswp->cy, pswp->y); CalcFrameSWP(hwnd, pswp, TRUE); if (ShowToolBar) { HWND hwndToolBar = WinWindowFromID(hwnd, FID_MTOOLBAR); WinQueryWindowPos(hwndToolBar, &swpToolBar); swpToolBar.x = 0; swpToolBar.y = 0; swpToolBar.cx = pswp->cx; swpToolBar.cy = pswp->cy; WinSendMsg(hwndToolBar, WM_ADJUSTWINDOWPOS, MPFROMP(&swpToolBar), MPARAM(0)); } else { swpToolBar.cy = 0; } pswp->cy -= swpToolBar.cy; pswp->cx -= cxScrollBar; cnt = 0; v = peer->Frame->Top; while (v) { cnt++; v = v->Prev; if (v == peer->Frame->Top) break; } pswp->cy -= cnt * cyScrollBar; //if (pswp->cy < 0) pswp->cy = 0; if (v) { pswp->cx /= v->Peer->pmData->cxChar; //if (pswp->cx < 8) pswp->cx = 8; if (pswp->cx > MAXXSIZE) pswp->cx = MAXXSIZE; pswp->cx *= v->Peer->pmData->cxChar; pswp->cy /= v->Peer->pmData->cyChar; //if (pswp->cy < cnt * 2) pswp->cy = cnt * 2; if (pswp->cy > MAXYSIZE) pswp->cy = MAXYSIZE; pswp->cy *= v->Peer->pmData->cyChar; } pswp->cy += cnt * cyScrollBar; pswp->cx += cxScrollBar; pswp->cy += swpToolBar.cy; CalcFrameSWP(hwnd, pswp, FALSE); DosReleaseMutexSem(hmtxPMData); } } break; case WM_QUERYFRAMECTLCOUNT: { SHORT sCount = SHORT1FROMMR(peer->oldFrameProc(hwnd, msg, mp1, mp2)); GView *v; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); v = peer->Frame->Top; while (v) { sCount += (SHORT)3; v = v->Prev; if (v == peer->Frame->Top) break; } if (ShowToolBar) sCount++; DosReleaseMutexSem(hmtxPMData); return MRESULT(sCount - 1); } case WM_FORMATFRAME: { SHORT sCount = SHORT1FROMMR(peer->oldFrameProc(hwnd, msg, mp1, mp2)); PSWP pswp; HWND Bhwnd; GView *v; int x, w, h, fl, y; int ctl, cnt; int Hy, H1, yPos; HWND hwndToolBar = WinWindowFromID(hwnd, FID_MTOOLBAR); SWP swpToolBar; PRECTL prcl; pswp = (PSWP) mp1; prcl = (PRECTL) mp2; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); sCount--; cnt = 0; v = peer->Frame->Top; while (v) { cnt++; v = v->Prev; if (v == peer->Frame->Top) break; } if (cnt == 0) { DosReleaseMutexSem(hmtxPMData); return MRFROMSHORT(sCount); } fl = pswp[sCount].fl; x = pswp[sCount].x; y = pswp[sCount].y; w = pswp[sCount].cx; h = pswp[sCount].cy; Bhwnd = pswp[sCount].hwndInsertBehind; if (ShowToolBar) { swpToolBar = pswp[sCount]; WinSendMsg(hwndToolBar, WM_ADJUSTWINDOWPOS, MPFROMP(&swpToolBar), MPARAM(0)); pswp[sCount].hwndInsertBehind = Bhwnd; Bhwnd = pswp[sCount].hwnd = hwndToolBar; pswp[sCount].fl = fl; pswp[sCount].x = cxBorder; pswp[sCount].cx = w; if (ShowToolBar == 1) { pswp[sCount].y = y + h - swpToolBar.cy; pswp[sCount].cy = swpToolBar.cy; h -= swpToolBar.cy; if (prcl) prcl->yTop -= swpToolBar.cy; } else if (ShowToolBar == 2) { pswp[sCount].y = y; pswp[sCount].cy = swpToolBar.cy; y += swpToolBar.cy; h -= swpToolBar.cy; if (prcl) prcl->yBottom += swpToolBar.cy; } sCount++; } ctl = 0; v = peer->Frame->Top; H1 = (h - cyScrollBar * cnt) / cnt; H1 /= v->Peer->pmData->cyChar; H1 *= v->Peer->pmData->cyChar; yPos = 0; while (v) { v = v->Prev; if (ctl == cnt - 1) { Hy = h - yPos - cyScrollBar; Hy /= v->Peer->pmData->cyChar; Hy *= v->Peer->pmData->cyChar; } else { Hy = H1; } pswp[sCount].fl = fl; pswp[sCount].hwndInsertBehind = Bhwnd; Bhwnd = pswp[sCount].hwnd = v->Peer->hwndView; pswp[sCount].x = x; pswp[sCount].cx = w - cxScrollBar; pswp[sCount].y = yPos + y + cyScrollBar; pswp[sCount].cy = Hy; sCount++; pswp[sCount].fl = fl; pswp[sCount].hwndInsertBehind = Bhwnd; Bhwnd = pswp[sCount].hwnd = v->Peer->hwndHscroll; pswp[sCount].x = x; pswp[sCount].cx = w - cxScrollBar; pswp[sCount].y = yPos + y; pswp[sCount].cy = cyScrollBar; yPos += cyScrollBar; sCount++; pswp[sCount].fl = fl; pswp[sCount].hwndInsertBehind = Bhwnd; Bhwnd = pswp[sCount].hwnd = v->Peer->hwndVscroll; pswp[sCount].x = x + w - cxScrollBar; pswp[sCount].cx = cxScrollBar; pswp[sCount].y = yPos - cyScrollBar + y; pswp[sCount].cy = Hy + cyScrollBar; yPos += Hy; sCount++; ctl++; if (v == peer->Frame->Top) break; } DosReleaseMutexSem(hmtxPMData); return MRFROMSHORT(sCount); } } return peer->oldFrameProc(hwnd, msg, mp1, mp2); } /*MRESULT EXPENTRY SizerWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { switch (msg) { case WM_CREATE: break; case WM_DESTROY: break; case WM_BUTTON1DOWN: case WM_BUTTON1UP: case WM_MOUSEMOVE: break; case WM_PAINT: { SWP swp; HPS hps; RECTL rc; POINTL pt; WinQueryWindowPos(hwnd, &swp); hps = WinBeginPaint(hwnd, (HPS)NULL, &rc); GpiSetColor(hps, CLR_GRAY); GpiSetBackColor(hps, CLR_PALEGRAY); if (swp.cy > 2 && swp.cx > 2) { ptl.x = 1; ptl.y = 1; GpiMove(hps, &ptl); ptl.x += swp.cx - 2; ptl.y += swp.cy - 2; GpiBox(hps, DRO_FILL, &ptl, 0, 0); } GpiSetColor(hps, CLR_WHITE); ptl.x = 0; ptl.y = 0; GpiMove(hps, &ptl); ptl.y += swp.cy; GpiLine(hps, &ptl); ptl.x += swp.cx; GpiLine(hps, &ptl); GpiSetColor(hps, CLR_GRAY); ptl.y = 0; GpiLine(hps, &ptl); ptl.x = 0; GpiLine(hps, &ptl); WinEndPaint(hps); } break; } return WinDefWndProc(hwnd, msg, mp1, mp2); } */ MRESULT EXPENTRY AVIOWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { PMPTR *ptr = 0; PMData *pmData = (PMData *)WinQueryWindowULong(hwnd, QWL_USER); BYTE bBlank[2] = " "; SHORT cxClient, cyClient; HDC hdc; SIZEL sizl; PDRAGINFO pDragInfo; PDRAGITEM pDragItem; switch (msg) { case WM_CREATE: ptr = (PMPTR *)mp1; pmData = ptr ? (PMData *)ptr->p : 0; assert(pmData != 0); assert(WinSetWindowULong(hwnd, QWL_USER, (ULONG)pmData) == TRUE); hdc = WinOpenWindowDC(hwnd); VioCreatePS(&pmData->hvps, MAXYSIZE, MAXXSIZE, 0, 1, 0); sizl.cx = sizl.cy = 0; pmData->hps = GpiCreatePS(hab, hdc, &sizl, PU_PELS | GPIF_DEFAULT | GPIT_MICRO | GPIA_ASSOC); VioAssociate(hdc, pmData->hvps); if (WindowFont[0] != 0) { int x, y; if (sscanf(WindowFont, "%dx%d", &x, &y) == 2) VioSetDeviceCellSize((SHORT)y, (SHORT)x, pmData->hvps); } VioGetDeviceCellSize(&pmData->cyChar, &pmData->cxChar, pmData->hvps); bBlank[1] = hcPlain_Background; VioScrollUp(0, 0, -1, -1, -1, bBlank, pmData->hvps); return 0; case WM_DESTROY: VioAssociate(NULLHANDLE, pmData->hvps); VioDestroyPS(pmData->hvps); GpiDestroyPS(pmData->hps); pmData->Peer->pmData = 0; return 0; case UWM_DESTROY: { GViewPeer *Peer = pmData->Peer; WinDestroyWindow(Peer->hwndVscroll); WinDestroyWindow(Peer->hwndHscroll); WinDestroyWindow(Peer->hwndView); } return 0; case WM_ERASEBACKGROUND: return (MRESULT) FALSE; case WM_CLOSE: if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_CLOSE", "eFTE/PM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } return (MRESULT) FALSE; case WM_SIZE: DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); { GViewPeer *Peer = pmData->Peer; cxClient = SHORT1FROMMP(mp2); cyClient = SHORT2FROMMP(mp2); WinDefAVioWindowProc(hwnd, (USHORT)msg, (ULONG)mp1, (ULONG)mp2); if (cxClient <= pmData->cxChar || cyClient <= pmData->cyChar || reportSize == 0) { DosReleaseMutexSem(hmtxPMData); break; } Peer->wW = cxClient / pmData->cxChar; Peer->wH = cyClient / pmData->cyChar; if (hwnd == WinQueryFocus(HWND_DESKTOP)) { WinDestroyCursor(hwnd); WinCreateCursor(hwnd, pmData->cxChar * Peer->cX, pmData->cyChar * (Peer->wH - Peer->cY - 1), pmData->cxChar, pmData->cyChar, CURSOR_TYPE, NULL); WinShowCursor(hwnd, TRUE); } //DosBeep(500, 100); if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_SIZE", "eFTE/PM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } } DosReleaseMutexSem(hmtxPMData); break; case WM_ACTIVATE: case WM_SETSELECTION: if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_SETFOCUS", "eFTE/PM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } break; case WM_SETFOCUS: DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); { GViewPeer *Peer = pmData->Peer; if (SHORT1FROMMP(mp2)) { WinCreateCursor(hwnd, pmData->cxChar * Peer->cX, pmData->cyChar * (Peer->wH - Peer->cY - 1), pmData->cxChar, pmData->cyChar, CURSOR_TYPE, NULL); WinShowCursor(hwnd, TRUE); Peer->wState |= sfFocus; } else { WinDestroyCursor(hwnd); Peer->wState &= ~sfFocus; } } DosReleaseMutexSem(hmtxPMData); if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_SETFOCUS", "eFTE/PM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } break; case WM_VSCROLL: if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_VSCROLL", "eFTE/PM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } return 0; case WM_HSCROLL: if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_HSCROLL", "eFTE/PM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } return 0; case WM_COMMAND: if (SHORT1FROMMP(mp1) >= 8192) { if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_COMMAND", "eFTE/PM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } } break; case WM_CHAR: if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_CHAR", "eFTE/PM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } return (MRESULT) TRUE; case WM_MOUSEMOVE: { long b; b = 0; if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000) b |= 1; if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) b |= 2; if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) b |= 4; if (b == 0) break; } case WM_BUTTON1DOWN: case WM_BUTTON1DBLCLK: case WM_BUTTON1UP: case WM_BUTTON2DOWN: case WM_BUTTON2DBLCLK: case WM_BUTTON2UP: case WM_BUTTON3DOWN: case WM_BUTTON3DBLCLK: case WM_BUTTON3UP: if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_MOUSE", "eFTE/PM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } break; case WM_PAINT: DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); { GViewPeer *Peer = pmData->Peer; WinBeginPaint(hwnd, pmData->hps, NULL); if (Peer->wH > 0 && Peer->wH <= MAXYSIZE && Peer->wW > 0 && Peer->wW <= MAXXSIZE) VioShowBuf(0, (SHORT)(MAXXSIZE * Peer->wH * 2), pmData->hvps); WinEndPaint(pmData->hps); } DosReleaseMutexSem(hmtxPMData); return 0; case DM_DRAGOVER: { char buf[1024] = ""; pDragInfo = (PDRAGINFO) mp1; DrgAccessDraginfo(pDragInfo); pDragItem = DrgQueryDragitemPtr(pDragInfo, 0); // Don't accept multi select and non-file DrgQueryNativeRMF(pDragItem, sizeof(buf), buf); if (pDragInfo->cditem > 1 || strstr(buf, "DRM_OS2FILE") == 0) return (MRFROM2SHORT((DOR_NEVERDROP), (DO_UNKNOWN))); else return (MRFROM2SHORT((DOR_DROP), (DO_UNKNOWN))); } case DM_DROP: { pDragInfo = (PDRAGINFO)mp1; DrgAccessDraginfo(pDragInfo); pDragItem = DrgQueryDragitemPtr(pDragInfo, 0); DrgQueryStrName(pDragItem->hstrContainerName, 100, dragname); DrgQueryStrName(pDragItem->hstrSourceName, 100, dragname + strlen(dragname)); WinPostMsg(pmData->hwndWorker, UWM_DROPPEDFILE, 0, 0); } break; } return WinDefWindowProc(hwnd, msg, mp1, mp2); } MRESULT EXPENTRY ObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { switch (msg) { case WM_CREATE: PMPTR *ptr = (PMPTR *)mp1; GViewPeer *peer = ptr ? (GViewPeer *)ptr->p : 0; assert(WinSetWindowULong(hwnd, QWL_USER, (ULONG)peer) == TRUE); break; } return WinDefWindowProc(hwnd, msg, mp1, mp2); } MRESULT EXPENTRY CreatorWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { switch (msg) { case UWM_CREATEWORKER: { GViewPeer *peer = (GViewPeer *)mp1; PMData *pmData = (PMData *)mp2; PMPTR ptr; ptr.len = sizeof(ptr); ptr.p = peer; //DosBeep(2500, 1000); peer->hwndWorker = pmData->hwndWorker = WinCreateWindow(HWND_OBJECT, szObject, "Worker", 0, 0, 0, 0, 0, HWND_OBJECT, HWND_TOP, 0, (void *) & ptr, NULL); assert(peer->hwndWorker != NULLHANDLE); return (MRESULT)TRUE; } case UWM_CREATEFRAME: { GFramePeer *peer = (GFramePeer *)PVOIDFROMMP(mp1); FRAMECDATA fcdata; fcdata.cb = sizeof(FRAMECDATA); fcdata.flCreateFlags = flFrame; fcdata.hmodResources = 0; fcdata.idResources = 1; //DosBeep(2500, 1000); peer->hwndFrame = WinCreateWindow(HWND_DESKTOP, WC_FRAME, NULL, 0, 0, 0, 0, 0, hwndCreatorUser, HWND_TOP, 1, &fcdata, NULL); assert(peer->hwndFrame != NULLHANDLE); WinSetWindowULong(peer->hwndFrame, QWL_USER, (ULONG)peer); peer->oldFrameProc = WinSubclassWindow(peer->hwndFrame, (PFNWP) FrameWndProc); if (ShowToolBar) { peer->hwndToolBar = CreateToolBar(peer->hwndFrame, peer->hwndFrame, FID_MTOOLBAR); assert(peer->hwndToolBar != NULLHANDLE); } return (MRESULT)TRUE; } case UWM_CREATEMAINMENU: { GFramePeer *peer = (GFramePeer *)mp1; char *Menu = (char *)PVOIDFROMMP(mp2); HWND hwnd, hwndMenu; char font[256]; ULONG AttrFound = 0; LONG len = -1; hwnd = WinWindowFromID(peer->hwndFrame, FID_MENU); if (hwnd != NULLHANDLE) { if (len == -1) { AttrFound = 0; len = WinQueryPresParam(hwnd, PP_FONTNAMESIZE, PP_FONTHANDLE, &AttrFound, sizeof(font), font, 0); } WinDestroyWindow(hwnd); } hwndMenu = CreatePMMainMenu(peer->hwndFrame, peer->hwndFrame, Menu); if (len > 0) WinSetPresParam(hwndMenu, AttrFound, len, font); WinSendMsg(peer->hwndFrame, WM_UPDATEFRAME, MPFROMLONG(FCF_MENU), 0); return (MRESULT)hwndMenu; } case UWM_CREATEPOPUPMENU: { GFramePeer *peer = (GFramePeer *)mp1; int MenuId = LONGFROMMP(mp2); static HWND hwnd = 0; POINTL ptl; char font[256]; ULONG AttrFound = 0; ULONG len; if (hwnd != 0) { WinDestroyWindow(hwnd); hwnd = 0; } hwnd = CreatePMMenu(HWND_DESKTOP, peer->hwndFrame, MenuId, 0, 0); WinQueryMsgPos(hab, &ptl); len = WinQueryPresParam(peer->menuBar, PP_FONTNAMESIZE, PP_FONTHANDLE, &AttrFound, sizeof(font), font, 0); if (len > 0) WinSetPresParam(hwnd, AttrFound, len, font); WinPopupMenu(HWND_DESKTOP, peer->Frame->Active->Peer->hwndView, hwnd, ptl.x, ptl.y, 0, PU_HCONSTRAIN | PU_VCONSTRAIN | PU_NONE | PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_MOUSEBUTTON2 | PU_MOUSEBUTTON3); return (MRESULT)TRUE; } } return WinDefWindowProc(hwnd, msg, mp1, mp2); } int ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete, GView **view) { QMSG qmsg; GFrame *f; GView *v; if (view) *view = 0; if (EventBuf.What != evNone) { *Event = EventBuf; if (Delete) EventBuf.What = evNone; return 0; } EventBuf.What = evNone; Event->What = evNone; //DosBeep(800, 10); if (WaitTime != -1) { if (WinPeekMsg(hab, &qmsg, NULLHANDLE, 0, 0, PM_NOREMOVE) == FALSE) return 0; } if (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0) == FALSE) return -1; //DosBeep(800, 10); f = frames; while (f) { v = f->Top; while (frames && v) { if (v->Peer->hwndWorker == qmsg.hwnd) { if (FocusCapture && v != FocusCapture) { WinSetFocus(HWND_DESKTOP, FocusCapture->Peer->hwndView); frames = f; break; } if (view) *view = v; switch (qmsg.msg) { /*case WM_ACTIVATE: case WM_SETSELECTION: if (SHORT1FROMMP(qmsg.mp1) == TRUE) { if (!v->IsActive()) v->Parent->SelectView(v); DosBeep(800, 10); return 0; } break;*/ case WM_SETFOCUS: if (SHORT1FROMMP(qmsg.mp2) == TRUE) { if (!v->IsActive()) v->Parent->SelectView(v); //DosBeep(800, 10); return 0; } break; case UWM_NOTIFY: //DosBeep(200, 200); Event->What = evNotify; Event->Msg.View = v; Event->Msg.Model = (EModel *)qmsg.mp1; Event->Msg.Command = cmPipeRead; Event->Msg.Param1 = (long)qmsg.mp2; frames = f; return 0; case UWM_DROPPEDFILE: if (!v->IsActive()) v->Parent->SelectView(v); Event->What = evCommand; Event->Msg.View = v; Event->Msg.Command = cmDroppedFile; Event->Msg.Param1 = 0; Event->Msg.Param2 = dragname; frames = f; return 0; case WM_SIZE: frames = f; //DosBeep(500, 500); v->Resize(v->Peer->wW, v->Peer->wH); return 0; case WM_VSCROLL: //DosBeep(200, 2000); if (!v->IsActive()) v->Parent->SelectView(v); Event->What = evNone; Event->Msg.View = v; Event->Msg.Param1 = 0; Event->Msg.Param2 = 0; switch (SHORT2FROMMP(qmsg.mp2)) { case SB_LINEUP: Event->What = evCommand; Event->Msg.Command = cmVScrollUp; Event->Msg.Param1 = 1; break; case SB_LINEDOWN: Event->What = evCommand; Event->Msg.Command = cmVScrollDown; Event->Msg.Param1 = 1; break; case SB_PAGEUP: Event->What = evCommand; Event->Msg.Command = cmVScrollPgUp; break; case SB_PAGEDOWN: Event->What = evCommand; Event->Msg.Command = cmVScrollPgDn; break; case SB_ENDSCROLL: WinSetFocus(HWND_DESKTOP, v->Parent->Active->Peer->hwndView); /* no break */ case SB_SLIDERPOSITION: case SB_SLIDERTRACK: { SHORT x = SHORT1FROMMP(qmsg.mp2); if (x != 0) { Event->What = evCommand; Event->Msg.Command = cmVScrollMove; if (v->Peer->sbVtotal > 32000) Event->Msg.Param1 = (x - 1) * v->Peer->sbVtotal / 32000; else Event->Msg.Param1 = x - 1; } } break; } return 0; case WM_HSCROLL: //DosBeep(800, 2000); if (!v->IsActive()) v->Parent->SelectView(v); Event->What = evNone; Event->Msg.View = v; Event->Msg.Param1 = 0; Event->Msg.Param2 = 0; switch (SHORT2FROMMP(qmsg.mp2)) { case SB_LINEUP: Event->What = evCommand; Event->Msg.Command = cmHScrollLeft; Event->Msg.Param1 = 1; break; case SB_LINEDOWN: Event->What = evCommand; Event->Msg.Command = cmHScrollRight; Event->Msg.Param1 = 1; break; case SB_PAGEUP: Event->What = evCommand; Event->Msg.Command = cmHScrollPgLt; break; case SB_PAGEDOWN: Event->What = evCommand; Event->Msg.Command = cmHScrollPgRt; break; case SB_ENDSCROLL: WinSetFocus(HWND_DESKTOP, v->Parent->Active->Peer->hwndView); /* no break */ case SB_SLIDERPOSITION: case SB_SLIDERTRACK: { SHORT x = SHORT1FROMMP(qmsg.mp2); if (x != 0) { Event->What = evCommand; Event->Msg.Command = cmHScrollMove; if (v->Peer->sbHtotal > 32000) Event->Msg.Param1 = (x - 1) * v->Peer->sbHtotal / 32000; else Event->Msg.Param1 = x - 1; } } break; } return 0; case WM_CLOSE: //DosBeep(500, 1500); frames = f; Event->What = evCommand; Event->Msg.View = v->Parent->Active; Event->Msg.Command = cmClose; return 0; case WM_COMMAND: //DosBeep(50, 2500); if (SHORT1FROMMP(qmsg.mp1) >= 8192) { Event->What = evCommand; Event->Msg.View = v->Parent->Active; Event->Msg.Command = (SHORT1FROMMP(qmsg.mp1) - 8192) + 65536; frames = f; return 0; } break; case WM_CHAR: //DosBeep(50, 500); Event->What = evNone; Event->Msg.View = v; ConvertKey(SHORT1FROMMP(qmsg.mp2), /* char */ SHORT2FROMMP(qmsg.mp2), /* virtual */ SHORT1FROMMP(qmsg.mp1), /* flags */ CHAR4FROMMP(qmsg.mp1), /* scan */ *Event); frames = f; return 0; case WM_BUTTON1DOWN: case WM_BUTTON2DOWN: case WM_BUTTON3DOWN: case WM_BUTTON1DBLCLK: case WM_BUTTON2DBLCLK: case WM_BUTTON3DBLCLK: if (!v->IsActive()) v->Parent->SelectView(v); case WM_BUTTON1UP: case WM_BUTTON2UP: case WM_BUTTON3UP: case WM_MOUSEMOVE: Event->Mouse.What = evNone; Event->Msg.View = v; Event->Mouse.X = ((SHORT)SHORT1FROMMP(qmsg.mp1)) / v->Peer->pmData->cxChar; Event->Mouse.Y = v->Peer->wH - ((SHORT)SHORT2FROMMP(qmsg.mp1)) / v->Peer->pmData->cyChar - 1; Event->Mouse.Buttons = 1; Event->Mouse.Count = 1; Event->Mouse.KeyMask = 0; if (WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000) Event->Mouse.KeyMask |= kfCtrl; if (WinGetKeyState(HWND_DESKTOP, VK_ALT) & 0x8000) Event->Mouse.KeyMask |= kfAlt; if (WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000) Event->Mouse.KeyMask |= kfShift; // printf("KeyFlags: %d\n", Event->Mouse.KeyMask); //DosBeep(2000, 50); frames = f; switch (qmsg.msg) { case WM_BUTTON1DOWN: Event->What = evMouseDown; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON1DBLCLK: Event->What = evMouseDown; Event->Mouse.Count = 2; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON1UP: Event->What = evMouseUp; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON2DOWN: Event->What = evMouseDown; Event->Mouse.Buttons = 2; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON2DBLCLK: Event->What = evMouseDown; Event->Mouse.Buttons = 2; Event->Mouse.Count = 2; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON2UP: Event->What = evMouseUp; Event->Mouse.Buttons = 2; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON3DOWN: Event->What = evMouseDown; Event->Mouse.Buttons = 4; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON3DBLCLK: Event->What = evMouseDown; Event->Mouse.Buttons = 4; Event->Mouse.Count = 2; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON3UP: Event->What = evMouseUp; Event->Mouse.Buttons = 4; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_MOUSEMOVE: Event->What = evMouseMove; Event->Mouse.Buttons = 0; if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000) Event->Mouse.Buttons |= 1; if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) Event->Mouse.Buttons |= 2; if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) Event->Mouse.Buttons |= 4; if (Event->Mouse.Buttons != 0) { if (Event->Mouse.X != v->Peer->OldMouseX || Event->Mouse.Y != v->Peer->OldMouseY) { v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; } else if (Event->Mouse.X >= 0 && Event->Mouse.Y >= 0 && Event->Mouse.X < v->Peer->wW && Event->Mouse.Y < v->Peer->wH) { Event->What = evNone; } } } break; default: WinDispatchMsg(hab, &qmsg); return 0; } } v = v->Next; if (v == f->Top) break; } f = f->Next; if (f == frames) break; } WinDispatchMsg(hab, &qmsg); return 0; } static void _LNK_CONV WorkThread(void *) { habW = WinInitialize(0); hmqW = WinCreateMsgQueue(hab, 0); hwndCreatorWorker = WinCreateWindow(HWND_OBJECT, szCreator, "Creator", 0, 0, 0, 0, 0, HWND_OBJECT, HWND_TOP, 0, NULL, NULL); assert(hwndCreatorWorker != 0); // work thread started DosPostEventSem(WorkerStarted); ULONG ulPostCount; DosWaitEventSem(StartInterface, SEM_INDEFINITE_WAIT); DosResetEventSem(StartInterface, &ulPostCount); //DosBeep(200, 200); if (gui->Start(gui->fArgc, gui->fArgv) == 0) { gui->doLoop = 1; //DosBeep(500, 500); while (gui->doLoop) gui->ProcessEvent(); gui->Stop(); } WinDestroyMsgQueue(hmqW); WinTerminate(habW); //DosBeep(500, 500); WinPostQueueMsg(hmq, WM_QUIT, 0, 0); _endthread(); } /////////////////////////////////////////////////////////////////////////// GViewPeer::GViewPeer(GView *view, int XSize, int YSize) { HWND parent; View = view; // wX = 0; // wY = 0; wW = XSize; wH = YSize; sbVtotal = 0; sbVstart = 0; sbVamount = 0; sbHtotal = 0; sbHstart = 0; sbHamount = 0; wState = 0; cVisible = 1; OldMouseX = OldMouseY = 0xFFFF; pmData = (PMData *)malloc(sizeof(PMData)); pmData->Peer = this; pmData->hvps = 0; pmData->cxChar = 8; pmData->cyChar = 14; pmData->hwndWorker = 0; parent = View->Parent->Peer->hwndFrame; WinSendMsg(hwndCreatorWorker, UWM_CREATEWORKER, MPFROMP(this), MPFROMP(pmData)); WinSendMsg(parent, UWM_CREATECHILD, MPFROMP(this), MPFROMP(pmData)); } GViewPeer::~GViewPeer() { WinSendMsg(hwndView, UWM_DESTROY, 0, 0); WinDestroyWindow(hwndWorker); free(pmData); } int GViewPeer::ConPutBox(int X, int Y, int W, int H, PCell Cell) { int I; char *p = (char *) Cell; int Hidden = 0; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); if (Y < 0 || Y >= wH || X < 0 || X >= wW || Y + H < 0 || Y + H > wH || X + W < 0 || X + W > wW) { //fprintf(stderr, // "X:%d, Y:%d, W:%d, H:%d, wW:%d, wH:%d\n", // X, Y, W, H, wW, wH); DosReleaseMutexSem(hmtxPMData); return -1; } for (I = 0; I < H; I++) { if (I + Y == cY) Hidden = PMHideCursor(); VioWrtCellStr(p, (USHORT)(W << 1), (USHORT)(Y + I), (USHORT)X, pmData->hvps); if (Hidden) PMShowCursor(); p += W << 1; } DosReleaseMutexSem(hmtxPMData); return 0; } int GViewPeer::ConGetBox(int X, int Y, int W, int H, PCell Cell) { int I; USHORT WW = (USHORT)(W << 1); char *p = (char *) Cell; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); if (Y < 0 || Y >= wH || X < 0 || X >= wW || Y + H < 0 || Y + H > wH || X + W < 0 || X + W > wW) { //fprintf(stderr, // "X:%d, Y:%d, W:%d, H:%d, wW:%d, wH:%d\n", // X, Y, W, H, wW, wH); DosReleaseMutexSem(hmtxPMData); return -1; } for (I = 0; I < H; I++) { VioReadCellStr((char *)p, &WW, (USHORT)(Y + I), (USHORT)X, pmData->hvps); p += W << 1; } DosReleaseMutexSem(hmtxPMData); return 0; } int GViewPeer::ConPutLine(int X, int Y, int W, int H, PCell Cell) { int I; char *p = (char *) Cell; int Hidden = 0; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); if (Y < 0 || Y >= wH || X < 0 || X >= wW || Y + H < 0 || Y + H > wH || X + W < 0 || X + W > wW) { //fprintf(stderr, // "X:%d, Y:%d, W:%d, H:%d, wW:%d, wH:%d\n", // X, Y, W, H, wW, wH); DosReleaseMutexSem(hmtxPMData); return -1; } for (I = 0; I < H; I++) { if (I + Y == cY) Hidden = PMHideCursor(); VioWrtCellStr(p, (USHORT)(W << 1), (USHORT)(Y + I), (USHORT)X, pmData->hvps); if (Hidden) PMShowCursor(); } DosReleaseMutexSem(hmtxPMData); return 0; } int GViewPeer::ConSetBox(int X, int Y, int W, int H, TCell Cell) { int I; char *p = (char *) & Cell; int Hidden = 0; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); if (Y < 0 || Y >= wH || X < 0 || X >= wW || Y + H < 0 || Y + H > wH || X + W < 0 || X + W > wW) { //fprintf(stderr, // "X:%d, Y:%d, W:%d, H:%d, wW:%d, wH:%d\n", // X, Y, W, H, wW, wH); DosReleaseMutexSem(hmtxPMData); return -1; } for (I = 0; I < H; I++) { if (I + Y == cY) Hidden = PMHideCursor(); VioWrtNCell(p, (USHORT)(W), (USHORT)(Y + I), (USHORT)X, pmData->hvps); if (Hidden) PMShowCursor(); } DosReleaseMutexSem(hmtxPMData); return 0; } int GViewPeer::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { TCell FillCell = (TCell)(Fill << 8); int Hidden = 0; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); if (Y < 0 || Y >= wH || X < 0 || X >= wW || Y + H < 0 || Y + H > wH || X + W < 0 || X + W > wW) { //fprintf(stderr, // "X:%d, Y:%d, W:%d, H:%d, wW:%d, wH:%d\n", // X, Y, W, H, wW, wH); DosReleaseMutexSem(hmtxPMData); return -1; } Hidden = PMHideCursor(); switch (Way) { case csUp: VioScrollUp((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, pmData->hvps); break; case csDown: VioScrollDn((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, pmData->hvps); break; case csLeft: VioScrollLf((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, pmData->hvps); break; case csRight: VioScrollRt((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, pmData->hvps); break; } if (Hidden) PMShowCursor(); DosReleaseMutexSem(hmtxPMData); return 0; } int GViewPeer::ConSetSize(int X, int Y) { wW = X; wH = Y; return 1; } int GViewPeer::ConQuerySize(int *X, int *Y) { if (X) *X = wW; if (Y) *Y = wH; return 1; } int GViewPeer::ConSetCursorPos(int X, int Y) { if (X < 0) X = 0; if (X >= wW) X = wW - 1; if (Y < 0) Y = 0; if (Y >= wH) Y = wH - 1; cX = X; cY = Y; if (wState & sfFocus) return PMSetCursorPos(); else return 1; } int GViewPeer::ConQueryCursorPos(int *X, int *Y) { if (X) *X = cX; if (Y) *Y = cY; return 1; } int GViewPeer::ConShowCursor() { cVisible = 1; if (wState & sfFocus) return PMShowCursor(); else return 1; } int GViewPeer::ConHideCursor() { cVisible = 0; if (wState & sfFocus) return PMHideCursor(); else return 1; } int GViewPeer::ConCursorVisible() { return cVisible; } void GViewPeer::ConSetInsertState(bool insert) { insertState = insert; ::ConSetInsertState(insert); } int GViewPeer::ExpandHeight(int DeltaY) { if (View->Parent->Top == View->Next) return -1; if (DeltaY + wH < 3) return -1; if (View->Next->Peer->wH - DeltaY < 3) return -1; ConSetSize(wW, wH + DeltaY); //View->Next->Peer->wY += DeltaY; View->Next->ConSetSize(View->Next->Peer->wW, View->Next->Peer->wH - DeltaY); View->Parent->Peer->SizeFrame(); return 0; } int GViewPeer::QuerySbVPos() { return sbVstart; } int GViewPeer::SetSbVPos(int Start, int Amount, int Total) { if (sbVstart != Start || sbVamount != Amount || sbVtotal != Total) { sbVstart = Start; sbVamount = Amount; sbVtotal = Total; if (View->Parent == 0) return 0; WinEnableWindowUpdate(hwndVscroll, FALSE); if (sbVamount < sbVtotal) { if (sbVtotal > 32000) { int total = 32000; int start = total * sbVstart / sbVtotal; int amount = total * sbVamount / sbVtotal; WinSendMsg(hwndVscroll, SBM_SETTHUMBSIZE, (MPFROM2SHORT((amount), (total))), 0); WinSendMsg(hwndVscroll, SBM_SETSCROLLBAR, (MPFROMSHORT((start + 1))), (MPFROM2SHORT((1), (total - amount + 2)))); } else { WinSendMsg(hwndVscroll, SBM_SETTHUMBSIZE, (MPFROM2SHORT((sbVamount), (sbVtotal))), 0); WinSendMsg(hwndVscroll, SBM_SETSCROLLBAR, (MPFROMSHORT((sbVstart + 1))), (MPFROM2SHORT((1), (sbVtotal - sbVamount + 2)))); } } else { WinSendMsg(hwndVscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(0, 0), 0); WinSendMsg(hwndVscroll, SBM_SETSCROLLBAR, MPFROMSHORT(0), MPFROM2SHORT(0, 0)); } WinEnableWindowUpdate(hwndVscroll, TRUE); } return 1; } int GViewPeer::SetSbHPos(int Start, int Amount, int Total) { if (sbHstart != Start || sbHamount != Amount || sbHtotal != Total) { sbHstart = Start; sbHamount = Amount; sbHtotal = Total; if (View->Parent == 0) return 0; WinEnableWindowUpdate(hwndHscroll, FALSE); if (sbHtotal > sbHamount) { if (sbHtotal > 32000) { int total = 32000; int start = total * sbVstart / sbVtotal; int amount = total * sbVamount / sbVtotal; WinSendMsg(hwndHscroll, SBM_SETTHUMBSIZE, (MPFROM2SHORT(amount, total)), 0); WinSendMsg(hwndHscroll, SBM_SETSCROLLBAR, (MPFROMSHORT(start + 1)), (MPFROM2SHORT(1, total - amount + 2))); } else { WinSendMsg(hwndHscroll, SBM_SETTHUMBSIZE, (MPFROM2SHORT(sbHamount, sbHtotal)), 0); WinSendMsg(hwndHscroll, SBM_SETSCROLLBAR, (MPFROMSHORT(sbHstart + 1)), (MPFROM2SHORT(1, sbHtotal - sbHamount + 2))); } } else { WinSendMsg(hwndHscroll, SBM_SETTHUMBSIZE, (MPFROM2SHORT(0, 0)), 0); WinSendMsg(hwndHscroll, SBM_SETSCROLLBAR, (MPFROMSHORT(0)), (MPFROM2SHORT(0, 0))); } WinEnableWindowUpdate(hwndHscroll, TRUE); } return 1; } int GViewPeer::UpdateCursor() { ConSetCursorPos(cX, cY); ConSetInsertState(insertState); if (cVisible) ConShowCursor(); else ConHideCursor(); return 1; } int GViewPeer::PMShowCursor() { if (wState & sfFocus) WinShowCursor(hwndView, TRUE); return 1; } int GViewPeer::PMHideCursor() { if (wState & sfFocus) WinShowCursor(hwndView, FALSE); return 1; } int GViewPeer::PMSetCursorPos() { if (wState & sfFocus) { WinDestroyCursor(hwndView); WinCreateCursor(hwndView, pmData->cxChar * cX, pmData->cyChar * (wH - cY - 1), pmData->cxChar, pmData->cyChar, CURSOR_TYPE, NULL); WinShowCursor(hwndView, TRUE); } return 1; } /////////////////////////////////////////////////////////////////////////// GView::GView(GFrame *parent, int XSize, int YSize) { Parent = parent; Prev = Next = 0; Peer = new GViewPeer(this, XSize, YSize); if (Parent) Parent->AddView(this); } GView::~GView() { if (FocusCapture == this) CaptureFocus(0); if (MouseCapture == this) CaptureMouse(0); if (Parent) Parent->RemoveView(this); if (Peer) { Peer->View = 0; delete Peer; Peer = 0; } } int GView::ConClear() { int W, H; TDrawBuffer B; ConQuerySize(&W, &H); MoveChar(B, 0, W, ' ', 0x07, 1); ConSetBox(0, 0, W, H, B[0]); return 1; } int GView::ConPutBox(int X, int Y, int W, int H, PCell Cell) { return Peer->ConPutBox(X, Y, W, H, Cell); } int GView::ConGetBox(int X, int Y, int W, int H, PCell Cell) { return Peer->ConGetBox(X, Y, W, H, Cell); } int GView::ConPutLine(int X, int Y, int W, int H, PCell Cell) { return Peer->ConPutLine(X, Y, W, H, Cell); } int GView::ConSetBox(int X, int Y, int W, int H, TCell Cell) { return Peer->ConSetBox(X, Y, W, H, Cell); } int GView::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { return Peer->ConScroll(Way, X, Y, W, H, Fill, Count); } int GView::ConSetSize(int X, int Y) { if (Peer->ConSetSize(X, Y)) Resize(X, Y); else return 0; return 1; } int GView::ConQuerySize(int *X, int *Y) { return Peer->ConQuerySize(X, Y); } int GView::ConSetCursorPos(int X, int Y) { return Peer->ConSetCursorPos(X, Y); } int GView::ConQueryCursorPos(int *X, int *Y) { return Peer->ConQueryCursorPos(X, Y); } int GView::ConShowCursor() { return Peer->ConShowCursor(); } int GView::ConHideCursor() { return Peer->ConHideCursor(); } int GView::ConCursorVisible() { return Peer->ConCursorVisible(); } void GView::ConSetInsertState(bool insert) { Peer->ConSetInsertState(insert); } int GView::QuerySbVPos() { return Peer->QuerySbVPos(); } int GView::SetSbVPos(int Start, int Amount, int Total) { return Peer->SetSbVPos(Start, Amount, Total); } int GView::SetSbHPos(int Start, int Amount, int Total) { return Peer->SetSbHPos(Start, Amount, Total); } int GView::ExpandHeight(int DeltaY) { return Peer->ExpandHeight(DeltaY); } void GView::Update() { } void GView::Repaint() { } void GView::HandleEvent(TEvent &Event) { } void GView::Resize(int width, int height) { Repaint(); } void GView::EndExec(int NewResult) { Result = NewResult; } int GView::Execute() { int SaveRc = Result; int NewResult; int didFocus = 0; if (FocusCapture == 0) { if (CaptureFocus(1) == 0) return -1; didFocus = 1; } else if (FocusCapture != this) return -1; Result = -2; while (Result == -2 && frames != 0) gui->ProcessEvent(); NewResult = Result; Result = SaveRc; if (didFocus) CaptureFocus(0); return NewResult; } int GView::IsActive() { return (Parent->Active == this && Parent == frames); } void GView::Activate(int gotfocus) { if (gotfocus) { Peer->wState |= sfFocus; Peer->UpdateCursor(); } else { Peer->wState &= ~sfFocus; } Repaint(); } int GView::CaptureMouse(int grab) { if (MouseCapture == 0) { if (grab) { MouseCapture = this; WinSetCapture(HWND_DESKTOP, Peer->hwndView); } else return 0; } else { if (grab || MouseCapture != this) return 0; else { MouseCapture = 0; WinSetCapture(HWND_DESKTOP, NULLHANDLE); } } return 1; } int GView::CaptureFocus(int grab) { if (FocusCapture == 0) { if (grab) { FocusCapture = this; WinSetFocus(HWND_DESKTOP, Peer->hwndView); } else return 0; } else { if (grab || FocusCapture != this) return 0; else FocusCapture = 0; } return 1; } /////////////////////////////////////////////////////////////////////////// GFramePeer::GFramePeer(GFrame *aFrame, int Width, int Height) { Frame = aFrame; WinSendMsg(hwndCreatorUser, UWM_CREATEFRAME, MPFROMP(this), MPFROMLONG(0)); if (Width != -1 && Height != -1) ConSetSize(Width, Height); } GFramePeer::~GFramePeer() { WinStoreWindowPos("eFTEPM", "Frame1", hwndFrame); WinSendMsg(hwndFrame, UWM_DESTROY, 0, 0); } int GFramePeer::ConSetSize(int X, int Y) { //return ::ConSetSize(X, Y); return 0; } int GFramePeer::ConQuerySize(int *X, int *Y) { // ::ConQuerySize(&fW, &fH); // if (X) *X = fW; // if (Y) *Y = fH; return 1; } int GFramePeer::ConSetTitle(char *Title, char *STitle) { char szTitle[256] = {0}; JustFileName(Title, szTitle, sizeof(szTitle)); if (szTitle[0] == '\0') // if there is no filename, try the directory name. JustLastDirectory(Title, szTitle, sizeof(szTitle)); if (szTitle[0] != '\0') // if there is something... strlcat(szTitle, " - ", sizeof(szTitle)); strlcat(szTitle, Title, sizeof(szTitle)); WinSetWindowText(hwndFrame, szTitle); return 1; } int GFramePeer::ConGetTitle(char *Title, int MaxLen, char *STitle, int SMaxLen) { WinQueryWindowText(hwndFrame, MaxLen, Title); WinQueryWindowText(hwndFrame, SMaxLen, STitle); return 1; } void GFramePeer::MapFrame() { if (frames != frames->Next || WinRestoreWindowPos("eFTEPM", "Frame1", hwndFrame) == FALSE) { WinQueryTaskSizePos(hab, 0, &swp); WinSetWindowPos(hwndFrame, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, SWP_MOVE | SWP_SIZE); } // WinSendMsg(Peer->hwndFrame, WM_UPDATEFRAME, 0, 0); SizeFrame(); ShowFrame(); } void GFramePeer::ShowFrame() { WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER | SWP_SHOW | SWP_ACTIVATE); } void GFramePeer::SizeFrame() { POINTL ptl; GView *v = Frame->Top; SWP swp; SWP swpMenu; HWND hwndMenu = WinWindowFromID(hwndFrame, FID_MENU); SWP swpToolBar; if (ShowToolBar) { HWND hwndToolBar = WinWindowFromID(hwndFrame, FID_MTOOLBAR); WinQueryWindowPos(hwndToolBar, &swpToolBar); WinSendMsg(hwndToolBar, WM_ADJUSTWINDOWPOS, MPFROMP(&swpToolBar), MPARAM(0)); } else { swpToolBar.cy = 0; } WinQueryWindowPos(hwndMenu, &swpMenu); WinSendMsg(hwndMenu, WM_ADJUSTWINDOWPOS, MPFROMP(&swpMenu), MPARAM(0)); //WinEnableWindowUpdate(hwndFrame, FALSE); DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); ptl.x = v->Peer->wW * v->Peer->pmData->cxChar + cxScrollBar + 2 * cxBorder; ptl.y = 2 * cyBorder + cyTitleBar + swpMenu.cy + swpToolBar.cy; while (v) { v = v->Prev; ptl.y += v->Peer->wH * v->Peer->pmData->cyChar + cyScrollBar; if (v == Frame->Top) break; } reportSize = 0; DosReleaseMutexSem(hmtxPMData); WinQueryWindowPos(hwndFrame, &swp); swp.y = swp.y + swp.cy - ptl.y; swp.cx = ptl.x; swp.cy = ptl.y; WinSendMsg(hwndFrame, WM_ADJUSTWINDOWPOS, MPFROMP(&swp), MPARAM(0)); WinSetWindowPos(hwndFrame, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, SWP_SIZE | SWP_MOVE); DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); reportSize = 1; DosReleaseMutexSem(hmtxPMData); swp.x = cxBorder; swp.y = cyBorder; if (ShowToolBar == 2) { swp.y += swpToolBar.cy; } v = Frame->Top; while (v) { v = v->Prev; swp.cx = v->Peer->wW * v->Peer->pmData->cxChar; swp.cy = cyScrollBar; WinSetWindowPos(v->Peer->hwndHscroll, 0, swp.x, swp.y, swp.cx, swp.cy, SWP_SIZE | SWP_MOVE); swp.y += cyScrollBar; swp.cy = v->Peer->wH * v->Peer->pmData->cyChar; WinSetWindowPos(v->Peer->hwndView, 0, swp.x, swp.y, swp.cx, swp.cy, SWP_SIZE | SWP_MOVE); swp.x = v->Peer->wW * v->Peer->pmData->cxChar + cxBorder; swp.y -= cyScrollBar; swp.cx = cxScrollBar; swp.cy = cyScrollBar + v->Peer->wH * v->Peer->pmData->cyChar; WinSetWindowPos(v->Peer->hwndVscroll, 0, swp.x, swp.y, swp.cx, swp.cy, SWP_SIZE | SWP_MOVE); swp.y += cyScrollBar + v->Peer->wH * v->Peer->pmData->cyChar; swp.x = cxBorder; if (v == Frame->Top) break; } //WinEnableWindowUpdate(hwndFrame, TRUE); } /////////////////////////////////////////////////////////////////////////// GFrame::GFrame(int XSize, int YSize) { Menu = 0; if (frames == 0) { frames = Prev = Next = this; } else { Next = frames->Next; Prev = frames; frames->Next->Prev = this; frames->Next = this; frames = this; } Top = Active = 0; Peer = new GFramePeer(this, XSize, YSize); } GFrame::~GFrame() { GView *P = Top, *Q; if (P) do { Q = P; P = Q->Next; Q->Parent = 0; delete Q; } while (P != Top); Top = Active = 0; if (Peer) { delete Peer; Peer = 0; } if (Next == this) { frames = 0; //DosBeep(500, 500); // printf("No more frames\x7\x7\n"); } else { Next->Prev = Prev; Prev->Next = Next; frames = Next; frames->Activate(); } Next = Prev = 0; } int GFrame::ConSetTitle(char *Title, char *STitle) { return Peer->ConSetTitle(Title, STitle); } int GFrame::ConGetTitle(char *Title, int MaxLen, char *STitle, int SMaxLen) { return Peer->ConGetTitle(Title, MaxLen, STitle, SMaxLen); } int GFrame::ConSetSize(int X, int Y) { return Peer->ConSetSize(X, Y); } int GFrame::ConQuerySize(int *X, int *Y) { return Peer->ConQuerySize(X, Y); } int GFrame::ConSplitView(GView *view, GView *newview) { int dmy; newview->Parent = this; view->ConQuerySize(&newview->Peer->wW, &dmy); newview->Peer->wH = view->Peer->wH - view->Peer->wH / 2 - 1; view->Peer->wH /= 2; InsertView(view, newview); view->ConSetSize(view->Peer->wW, view->Peer->wH); newview->ConSetSize(newview->Peer->wW, newview->Peer->wH); Peer->SizeFrame(); return 0; } int GFrame::ConCloseView(GView *view) { return 0; } int GFrame::ConResizeView(GView *view, int DeltaY) { return 0; } int GFrame::AddView(GView *view) { if (Active != 0) { return ConSplitView(Active, view); } else { // int W, H; view->Parent = this; view->Prev = view->Next = 0; // view->Peer->wX = 0; // view->Peer->wY = 0; // ConQuerySize(&W, &H); // view->ConSetSize(W, H); InsertView(Top, view); return 0; } } void GFrame::Update() { GView *v = Active; UpdateMenu(); while (v) { v->Update(); v = v->Next; if (v == Active) break; } } void GFrame::UpdateMenu() { } void GFrame::Repaint() { GView *v = Active; while (v) { v->Repaint(); v = v->Next; if (v == Active) break; } } void GFrame::InsertView(GView *Prev, GView *view) { if (!view) return ; if (Prev) { view->Prev = Prev; view->Next = Prev->Next; Prev->Next = view; view->Next->Prev = view; } else { view->Prev = view->Next = view; Top = view; } if (Active == 0) { Active = view; Active->Activate(1); } } void GFrame::RemoveView(GView *view) { if (!view) return ; if (Active == view) Active->Activate(0); if (view->Next == view) { Top = Active = 0; delete this; } else { view->Next->Prev = view->Prev; view->Prev->Next = view->Next; if (Top == view) { Top = view->Next; Top->ConSetSize(Top->Peer->wW, Top->Peer->wH + view->Peer->wH + 1); } else { view->Prev->ConSetSize(view->Prev->Peer->wW, view->Prev->Peer->wH + view->Peer->wH + 1); } if (Active == view) { Active = view->Prev; WinSetFocus(HWND_DESKTOP, Active->Peer->hwndView); Active->Activate(1); } } Peer->SizeFrame(); } void GFrame::SelectNext(int back) { GView *c = Active; if (c == 0 && Top == 0) return; else if (c == 0) c = Active = Top; else if (back) { Active = Active->Prev; } else { Active = Active->Next; } if (c != Active) { c->Activate(0); Active->Activate(1); WinSetFocus(HWND_DESKTOP, Active->Peer->hwndView); } } int GFrame::SelectView(GView *view) { if (Top == 0) return 0; if (FocusCapture != 0 || MouseCapture != 0) return 0; if (Active) Active->Activate(0); Active = view; if (Active) { Active->Activate(1); } //DosBeep(50, 500); frames = this; return 1; } void GFrame::Resize(int width, int height) { if (!Top) return; if (width < 8 || height < 2) return; if (Top == Top->Next) { Top->ConSetSize(width, height); } else { } } int GFrame::SetMenu(const char *Name) { //WinAlarm(HWND_DESKTOP, WA_NOTE); if (Menu && Name && strcmp(Name, Menu) == 0) return 1; free(Menu); Menu = strdup(Name); Peer->menuBar = (HWND)WinSendMsg(hwndCreatorUser, UWM_CREATEMAINMENU, MPFROMP(Peer), MPFROMP(Menu)); return 1; } int GFrame::ExecMainMenu(char Sub) { HWND hwnd; hwnd = WinWindowFromID(Peer->hwndFrame, FID_MENU); if (Sub != 0) { int count = LONGFROMMR(WinSendMsg(hwnd, MM_QUERYITEMCOUNT, 0, 0)); SHORT id; char buf[256]; int len; char srch[3] = "~x"; srch[1] = (char)toupper(Sub); //puts("mainmenu"); for (SHORT i = 0; i < count; i++) { id = SHORT1FROMMR(WinSendMsg(hwnd, MM_ITEMIDFROMPOSITION, MPFROMSHORT(i), 0)); if (id == MIT_ERROR) { puts("error"); } else { //printf("got %d %d\n", i, id); len = SHORT1FROMMR(WinSendMsg(hwnd, MM_QUERYITEMTEXT, MPFROM2SHORT((id), (sizeof(buf) - 1)), MPFROMP(buf))); buf[len] = 0; //puts(buf); srch[1] = (char)toupper(Sub); if (strstr(buf, srch) != 0) { WinSendMsg(hwnd, MM_SELECTITEM, (MPFROM2SHORT(id, 0)), 0); //printf("select %d %d\n", i, id); } else { srch[1] = (char)tolower(Sub); if (strstr(buf, srch) != 0) { WinSendMsg(hwnd, MM_SELECTITEM, (MPFROM2SHORT(id, 0)), 0); //printf("select %d %d\n", i, id); } } } } } else { WinPostMsg(hwnd, MM_STARTMENUMODE, MPFROM2SHORT((Sub ? TRUE : FALSE), FALSE), 0); } return 0; } int GFrame::PopupMenu(const char *Name) { int id = GetMenuId(Name); if (id == -1) return 0; WinSendMsg(hwndCreatorUser, UWM_CREATEPOPUPMENU, MPFROMP(Peer), MPFROMLONG(id)); return 0; } void GFrame::Show() { Update(); Peer->MapFrame(); } void GFrame::Activate() { frames = this; Update(); Peer->ShowFrame(); } // GUI GUI::GUI(int &argc, char **argv, int XSize, int YSize) { fArgc = argc; fArgv = argv; hab = WinInitialize(0); hmq = WinCreateMsgQueue(hab, 0); assert(0 == DosCreateMutexSem(0, &hmtxPMData, 0, 0)); cxBorder = WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER); cyBorder = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER); cxScrollBar = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL); cyScrollBar = WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL); cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN); cyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN); cyTitleBar = WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR); // edit window class WinRegisterClass(hab, szClient, (PFNWP)AVIOWndProc, CS_SIZEREDRAW, 4); //WinRegisterClass(hab, szSizer, (PFNWP)SizerWndProc, CS_SIZEREDRAW, 4); // worker object-window class WinRegisterClass(hab, szObject, (PFNWP)ObjectWndProc, 0, 4); // window that created windows in thr 1 for thr 2 WinRegisterClass(hab, szCreator, (PFNWP)CreatorWndProc, 0, 0); hwndCreatorUser = WinCreateWindow(HWND_DESKTOP, szCreator, "eFTEPM", 0, 0, 0, 0, 0, HWND_DESKTOP, HWND_TOP, 0, NULL, NULL); assert(0 == DosCreateEventSem(0, &WorkerStarted, 0, 0)); assert(0 == DosCreateEventSem(0, &StartInterface, 0, 0)); _beginthread(WorkThread, FAKE_BEGINTHREAD_NULL PM_STACK_SIZE, 0); ULONG ulPostCount; DosWaitEventSem(WorkerStarted, SEM_INDEFINITE_WAIT); DosResetEventSem(WorkerStarted, &ulPostCount); gui = this; } GUI::~GUI() { WinDestroyMsgQueue(hmq); WinTerminate(hab); gui = 0; } int GUI::ConGrabEvents(TEventMask EventMask) { return 0; } void GUI::DispatchEvent(GFrame *frame, GView *view, TEvent &Event) { if (Event.What != evNone) { if (view) view->HandleEvent(Event); } } int GUI::ConSuspend(void) { return 0; } int GUI::ConContinue(void) { return 0; } int GUI::ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete, GView **view) { return ::ConGetEvent(EventMask, Event, WaitTime, Delete, view); } int GUI::ConPutEvent(TEvent Event) { EventBuf = Event; return 0; } int GUI::ConFlush(void) { return 0; } void GUI::ProcessEvent() { TEvent E; GView *v; if (frames == 0) return ; E.What = evNone; if (E.What == evNone) { if (ConGetEvent(evMouseDown | evCommand | evKeyDown, &E, 0, 1, &v) == -1) ; } if (E.What == evNone) { //DosBeep(500, 100); frames->Update(); //DosBeep(1000, 100); if (ConGetEvent(evMouseDown | evCommand | evKeyDown, &E, -1, 1, &v) == -1) ; } if (E.What != evNone) { v = E.Msg.View; DispatchEvent(v->Parent, v, E); } } int GUI::Run() { QMSG qmsg; doLoop = 1; DosPostEventSem(StartInterface); while (doLoop != 0 && WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0)) WinDispatchMsg(hab, &qmsg); return 0; } int GUI::ShowEntryScreen() { return 1; } int GUI::RunProgram(int mode, char *Command) { char FailBuf[256]; char *Args; char *Prog; int rc; PID pid; ULONG sid; int ArgsSize; Prog = getenv("COMSPEC"); ArgsSize = 3 + strlen(Command) + 1; Args = (char *)malloc(ArgsSize); if (Args == NULL) { return -1; } if (*Command != 0) { strlcpy(Args, "/c ", ArgsSize); strlcat(Args, Command, ArgsSize); } else { Args[0] = 0; } { STARTDATA sd; memset((void *)&sd, 0, sizeof(sd)); sd.Length = sizeof(sd); sd.Related = SSF_RELATED_INDEPENDENT; sd.FgBg = SSF_FGBG_FORE; sd.TraceOpt = SSF_TRACEOPT_NONE; sd.PgmTitle = (Command && Command[0] != 0) ? Command : 0; sd.PgmName = Prog; sd.PgmInputs = (UCHAR *) Args; sd.TermQ = 0; sd.Environment = 0; sd.InheritOpt = SSF_INHERTOPT_PARENT; sd.SessionType = SSF_TYPE_DEFAULT; sd.IconFile = 0; sd.PgmHandle = 0; sd.PgmControl = SSF_CONTROL_VISIBLE;// | ((Command && Command[0] != 0) ? SSF_CONTROL_NOAUTOCLOSE : 0); sd.ObjectBuffer = FailBuf; sd.ObjectBuffLen = sizeof(FailBuf); rc = DosStartSession(&sd, &sid, &pid); } free(Args); return rc; } static int CreatePipeChild(ULONG *sid, PID *pid, HPIPE &hfPipe, char *Command) { static int PCount = 0; char szPipe[32]; char FailBuf[256]; char *Args; char *Prog; #if 0 int arglen = 0; RESULTCODES rc_code; #endif ULONG ulAction; //ULONG ulNew; HPIPE hfChildPipe; HFILE hfNewStdOut = (HFILE) - 1, hfNewStdErr = (HFILE) - 1; HFILE hfStdOut = (HFILE)1, hfStdErr = (HFILE)2; int rc; sprintf(szPipe, "\\PIPE\\eFTE%d\\CHILD%d", getpid(), PCount); PCount++; rc = DosCreateNPipe(szPipe, &hfPipe, NP_NOINHERIT | NP_ACCESS_INBOUND, NP_NOWAIT | NP_TYPE_BYTE | NP_READMODE_BYTE | 1, 0, 4096, 0); if (rc != 0) return -1; rc = DosConnectNPipe(hfPipe); if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED) { DosClose(hfPipe); return -1; } rc = DosSetNPHState(hfPipe, NP_WAIT | NP_READMODE_BYTE); if (rc != 0) { DosClose(hfPipe); return -1; } rc = DosOpen(szPipe, &hfChildPipe, &ulAction, 0, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYREADWRITE, NULL); if (rc != 0) { DosClose(hfPipe); return -1; } // Duplicate handles DosDupHandle(hfStdOut, &hfNewStdOut); DosDupHandle(hfStdErr, &hfNewStdErr); // Close existing handles for current process DosClose(hfStdOut); DosClose(hfStdErr); // Redirect existing handles to new file DosDupHandle(hfChildPipe, &hfStdOut); DosDupHandle(hfChildPipe, &hfStdErr); // Let started program inherit handles from parent Prog = getenv("COMSPEC"); #if 0 Args = (char *)malloc(strlen(Prog) + 1 + 3 + strlen(Command) + 1 + 1); if (Args == NULL) { DosClose(hfPipe); return -1; } strcpy(Args, Prog); arglen = strlen(Args) + 1; strcpy(Args + arglen, "/c "); arglen += 3; strcpy(Args + arglen, Command); arglen += strlen(Command) + 1; Args[arglen] = '\0'; #else int ArgsSize = 3 + strlen(Command) + 1; Args = (char *)malloc(ArgsSize); if (Args == NULL) { DosClose(hfPipe); return -1; } strlcpy(Args, "/c ", ArgsSize); strlcat(Args, Command, ArgsSize); #endif #if 0 rc = DosExecPgm(FailBuf, sizeof(FailBuf), EXEC_ASYNCRESULT, // | EXEC_BACKGROUND, Args, 0, &rc_code, Prog); #else { STARTDATA sd; memset((void *)&sd, 0, sizeof(sd)); sd.Length = sizeof(sd); sd.Related = SSF_RELATED_INDEPENDENT; sd.FgBg = SSF_FGBG_BACK; sd.TraceOpt = SSF_TRACEOPT_NONE; sd.PgmTitle = 0; sd.PgmName = Prog; sd.PgmInputs = (UCHAR*) Args; sd.TermQ = 0; sd.Environment = 0; sd.InheritOpt = SSF_INHERTOPT_PARENT; sd.SessionType = SSF_TYPE_DEFAULT; sd.IconFile = 0; sd.PgmHandle = 0; sd.PgmControl = SSF_CONTROL_INVISIBLE; sd.ObjectBuffer = FailBuf; sd.ObjectBuffLen = sizeof(FailBuf); rc = DosStartSession(&sd, sid, pid); } #endif free(Args); // Get back original handles DosDupHandle(hfNewStdOut, &hfStdOut); DosDupHandle(hfNewStdErr, &hfStdErr); // Close the duplicated handles - no longer needed DosClose(hfNewStdOut); DosClose(hfNewStdErr); DosClose(hfChildPipe); // pipe one way, close out write end if (rc != 0) { DosClose(hfPipe); return -1; } #if 0 pid = rc_code.codeTerminate; // get pid when successful sid = 0; #endif return 0; } static void _LNK_CONV PipeThread(void *p) { GPipe *pipe = (GPipe *)p; HAB hab; ULONG ulPostCount; ULONG used; PID pid; ULONG sid; HPIPE hfPipe; #if 0 RESULTCODES rc_code; #endif int rc; hab = WinInitialize(0); rc = CreatePipeChild(&sid, &pid, hfPipe, pipe->Command); if (rc != 0) { DosRequestMutexSem(pipe->Access, SEM_INDEFINITE_WAIT); pipe->reading = 0; if (pipe->notify) WinPostMsg(frames->Active->Peer->hwndWorker, UWM_NOTIFY, MPFROMLONG(pipe->notify), MPFROMLONG(pipe->id)); DosReleaseMutexSem(pipe->Access); WinTerminate(hab); return; } // fprintf(stderr, "Pipe: Begin: %d\n", pipe->id); while (1) { rc = DosRead(hfPipe, pipe->buffer, pipe->buflen, &used); if (rc < 0) used = 0; DosRequestMutexSem(pipe->Access, SEM_INDEFINITE_WAIT); pipe->bufused = used; // fprintf(stderr, "Pipe: fread: %d %d\n", pipe->id, pipe->bufused); DosResetEventSem(pipe->ResumeRead, &ulPostCount); if (pipe->bufused == 0) break; if (pipe->notify && pipe->stopped) { WinPostMsg(frames->Active->Peer->hwndWorker, UWM_NOTIFY, MPFROMLONG(pipe->notify), MPFROMLONG(pipe->id)); pipe->stopped = 0; } DosReleaseMutexSem(pipe->Access); if (pipe->DoTerm) break; DosWaitEventSem(pipe->ResumeRead, SEM_INDEFINITE_WAIT); if (pipe->DoTerm) break; } // fprintf(stderr, "Pipe: pClose: %d\n", pipe->id); DosClose(hfPipe); //fprintf(stderr, "Pipe: pClose: %d\n", pipe->id); #if 0 rc = DosWaitChild(DCWA_PROCESS, DCWW_WAIT, &rc_code, &pid, pid); pipe->RetCode = rc_code.codeResult; #else //DosStopSession(STOP_SESSION_SPECIFIED, sid); pipe->RetCode = 0; #endif pipe->reading = 0; if (pipe->notify) WinPostMsg(frames->Active->Peer->hwndWorker, UWM_NOTIFY, MPFROMLONG(pipe->notify), MPFROMLONG(pipe->id)); DosReleaseMutexSem(pipe->Access); WinTerminate(hab); } int GUI::OpenPipe(char *Command, EModel *notify) { int i; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) { Pipes[i].reading = 1; Pipes[i].stopped = 1; Pipes[i].id = i; Pipes[i].bufused = 0; Pipes[i].bufpos = 0; Pipes[i].buflen = PIPE_BUFLEN; Pipes[i].Command = strdup(Command); Pipes[i].notify = notify; Pipes[i].DoTerm = 0; if ((Pipes[i].buffer = (char *)malloc(PIPE_BUFLEN)) == 0) return -1; if (0 != DosCreateMutexSem(0, &Pipes[i].Access, 0, 0)) { free(Pipes[i].Command); free(Pipes[i].buffer); return -1; } if (0 != DosCreateEventSem(0, &Pipes[i].ResumeRead, 0, 0)) { free(Pipes[i].Command); free(Pipes[i].buffer); DosCloseMutexSem(Pipes[i].Access); return -1; } Pipes[i].tid = _beginthread(PipeThread, FAKE_BEGINTHREAD_NULL 16384, &Pipes[i]); Pipes[i].used = 1; // fprintf(stderr, "Pipe Open: %d\n", i); return i; } } return -1; } int GUI::SetPipeView(int id, EModel *notify) { if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; DosRequestMutexSem(Pipes[id].Access, SEM_INDEFINITE_WAIT); // fprintf(stderr, "Pipe View: %d %08X\n", id, notify); Pipes[id].notify = notify; DosReleaseMutexSem(Pipes[id].Access); return 0; } int GUI::ReadPipe(int id, void *buffer, int len) { int l; //ULONG ulPostCount; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; // DosQueryEventSem(Pipes[id].ResumeRead, &ulPostCount); // if (ulPostCount != 0) // return 0; DosRequestMutexSem(Pipes[id].Access, SEM_INDEFINITE_WAIT); // fprintf(stderr, "Pipe Read: Get %d %d\n", id, len); if (Pipes[id].bufused - Pipes[id].bufpos > 0) { l = len; if (l > Pipes[id].bufused - Pipes[id].bufpos) { l = Pipes[id].bufused - Pipes[id].bufpos; } memcpy(buffer, Pipes[id].buffer + Pipes[id].bufpos, l); Pipes[id].bufpos += l; if (Pipes[id].bufpos == Pipes[id].bufused) { Pipes[id].bufused = 0; Pipes[id].bufpos = 0; // fprintf(stderr, "Pipe Resume Read: %d\n", id); Pipes[id].stopped = 1; DosPostEventSem(Pipes[id].ResumeRead); } } else if (Pipes[id].reading == 0) l = -1; else { l = 0; //DosBeep(200, 200); } // fprintf(stderr, "Pipe Read: Got %d %d\n", id, l); DosReleaseMutexSem(Pipes[id].Access); return l; } int GUI::ClosePipe(int id) { if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; if (Pipes[id].reading == 1) { Pipes[id].DoTerm = 1; DosPostEventSem(Pipes[id].ResumeRead); DosWaitThread(&Pipes[id].tid, DCWW_WAIT); } free(Pipes[id].buffer); free(Pipes[id].Command); DosCloseEventSem(Pipes[id].ResumeRead); DosCloseMutexSem(Pipes[id].Access); // fprintf(stderr, "Pipe Close: %d\n", id); Pipes[id].used = 0; return Pipes[id].RetCode; } int GUI::multiFrame() { return 1; } void DieError(int rc, const char *msg, ...) { va_list ap; char str[1024]; va_start(ap, msg); vsprintf(str, msg, ap); va_end(ap); if (hab == 0) hab = WinInitialize(0); if (hmq == 0) hmq = WinCreateMsgQueue(hab, 0); WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, "eFTE", 0, MB_OK | MB_ERROR); WinDestroyMsgQueue(hmq); WinTerminate(hab); exit(rc); } char ConGetDrawChar(int index) { static char tab[] = "\xDA\xBF\xC0\xD9\xC4\xB3\xC2\xC3\xB4\xC1\xC5\x1A\xFA\x04\xC4\x18\x19\xB1\xB0\x1B\x1A"; assert(index >= 0 && index < (signed)strlen(tab)); return tab[index]; } void ConSetInsertState(bool) { } efte-1.1/src/c_commands.h0000664000076400007640000005405711043103617014374 0ustar laurilauri/* c_commands.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __COMMANDS_H__ #define __COMMANDS_H__ typedef enum { ErFAIL = 0, ErOK = 1 } ExResult; typedef enum { ExNop, ExFail, // Cursor Movement //& CursorTroughTabs ExMoveDown, /// Move cursor to next line. ExMoveUp, /// Move cursor to previous line ExMoveLeft, /// Move cursor to previous column. ExMoveRight, /// Move cursor to next column. ExMovePrev, /// Move cursor to previous character. Moves to end of the previous /// line if cursor is at the beginning of line. ExMoveNext, /// Move cursor to next character. Moves to the beginning of next /// line if cursor is at the end of line. ExMoveWordLeft, /// Move cursor to the beginning of the word on the left. ExMoveWordRight, /// Move cursor to the beginning of the word on the right. ExMoveWordPrev, /// Move cursor to the beginning of the previous word. ExMoveWordNext, /// Move cursor to the beginning of the next word. ExMoveWordEndLeft, /// Move cursor to the end of the previous word. ExMoveWordEndRight, /// Move cursor to the end of the word on the right. ExMoveWordEndPrev, /// Move cursor to the end of the previous word. ExMoveWordEndNext, /// Move cursor to the end of the next word. ExMoveWordOrCapLeft, /// Move cursor to the beginning of the word or capital letter on the right. ExMoveWordOrCapRight, /// Move cursor to the beginning of the word or capital letter on the left. ExMoveWordOrCapPrev, /// Move cursor to the beginning of the previous word or to previous /// capital letter. ExMoveWordOrCapNext, /// Move cursor to the beginning of the next word or to next capital letter. ExMoveWordOrCapEndLeft, /// Move cursor to the end of the word or capitals on the left. ExMoveWordOrCapEndRight, /// Move cursor to the end of the word or capitals on the right. ExMoveWordOrCapEndPrev, /// Move cursor to the end of the previous word or capitals. ExMoveWordOrCapEndNext, /// Move cursor to the end of the next word or capitals. ExMoveLineStart, /// Move cursor to the beginning of line. ExMoveLineEnd, /// Move cursor to the end of line. ExMovePageStart, /// Move cursor to the first line on current page. ExMovePageEnd, /// Move cursor to the last line on currently page. ExMovePageUp, /// Display previous page. ExMovePageDown, /// Display next page. ExMoveFileStart, /// Move cursor to the beginning of file. ExMoveFileEnd, /// Move cursor to the end of file. ExMovePageLeft, /// Scroll horizontally to display page on the left. ExMovePageRight, /// Scroll horizontally to display page on the right. ExMoveBlockStart, /// Move cursor to the beginning of block. ExMoveBlockEnd, /// Move cursor to end beginning of block. ExMoveFirstNonWhite, /// Move cursor to the first non-blank character on line. ExMoveLastNonWhite, /// Move cursor to the last non-blank character on line. ExMovePrevEqualIndent, /// Move cursor to the previous line with equal indentation. ExMoveNextEqualIndent, /// Move cursor to the next line with equal indentation. ExMovePrevTab, /// Move cursor to the previous tab position. ExMoveNextTab, /// Move cursor to the next tab position. ExMoveTabStart, /// When cursor is on the tab characters, moves it to the beginning /// of the tab. ExMoveTabEnd, /// When cursor is on the tab characters, moves it to the end /// of the tab. ExMoveLineTop, /// Scroll the file to make the current line appear on the top of the window. ExMoveLineCenter, /// Scroll the file to make the current line appear on the center of the window. ExMoveLineBottom, /// Scroll the file to make the current line appear on the bottom of the window. ExScrollLeft, /// Scroll screen left. ExScrollRight, /// Scroll screen right. ExScrollDown, /// Scroll screen down. ExScrollUp, /// Scroll screen up. ExMoveFoldTop, /// Move to the beginning of current fold. ExMoveFoldPrev, /// Move to the beginning of previous fold. ExMoveFoldNext, /// Move to the beginning of next fold. ExMoveBeginOrNonWhite, /// Move to beginning of line, or to first non blank character ExMoveBeginLinePageFile, /// Move to the beginning of line. If there already, move to the beginning /// page. If there already, move to the beginning of file. ExMoveEndLinePageFile, /// Move to the end of line. If there already, move to the end /// page. If there already, move to the end of file. ExMoveToLine, /// Move to line number given as argument ExMoveToColumn, /// Move to column given as argument ExMoveSavedPosCol, /// Move to column from saved position ExMoveSavedPosRow, /// Move to line from saved position ExMoveSavedPos, /// Move to saved position ExSavePos, /// Save current cursor position ExMovePrevPos, /// Move to last cursor position // ExCursorPush, // ExCursorPop, // Deleting Text ExKillLine, /// Delete current line. If the line is the last line in the file, /// only the text is deleted. ExKillChar, /// Delete character under (after) cursor. ExKillCharPrev, /// Delete character before cursor. ExKillWord, /// Delete the word after cursor. ExKillWordPrev, /// Delete the word before cursor. ExKillWordOrCap, /// Delete word or capitals after cursor. ExKillWordOrCapPrev, /// Delete word or capitals before cursor. ExKillToLineStart, /// Delete characters to the beginning of line. ExKillToLineEnd, /// Delete characters to the end of line. ExKillBlock, /// Delete block. ExKillBlockOrChar, /// If block is marked, delete it, otherwise delete character under cursor. ExKillBlockOrCharPrev, /// If block is marked, delete it, otherwise delete character before cursor. ExDelete, /// Delete character under (after) cursor. //& DeleteKillTab //& DeleteKillBlock ExBackSpace, /// Delete character before cursor. //& BackSpKillTab //& BackSpKillBlock // Line Commands ExLineInsert, /// Insert a new line before the current one. ExLineAdd, /// Add a new line after the current one. ExLineSplit, /// Split current line after cursor position ExLineJoin, /// Join current line with next one. If cursor is positioned beyond /// the end of line, the current line is first padded with whitespace. ExLineNew, /// Append a new line and move to the beginning of new line. ExLineIndent, /// Reindent current line. ExLineTrim, /// Trim whitespace at the end of current line. ExLineDuplicate, /// Duplicate the current line. ExLineCenter, /// Center the current line // Block Commands ExBlockBegin, /// Set block beginning to current position. ExBlockEnd, /// Set block end to current position. ExBlockUnmark, /// Unmark block. ExBlockCut, /// Cut selected block to clipboard. ExBlockCopy, /// Copy selected block to clipboard. ExBlockCutAppend, /// Cut selected block and append it to clipboard. ExBlockCopyAppend, /// Append selected block to clipboard. ExBlockClear, /// Clear selected block ExBlockPaste, /// Paste clipboard to current position. ExBlockKill, /// Delete selected text. ExBlockIndent, /// Indent block by 1 character. ExBlockUnindent, /// Unindent block by 1 character. ExBlockMarkStream, /// Start/stop marking stream block. ExBlockMarkLine, /// Start/stop marking line block. ExBlockMarkColumn, /// Start/stop marking column block. ExBlockExtendBegin, /// Start extending selected block. ExBlockExtendEnd, /// Stop extending selected block. ExBlockReIndent, /// Reindent entire block (C/REXX mode) ExBlockSelectWord, /// Select word under cursor as block. ExBlockSelectLine, /// Select current line as block. ExBlockSelectPara, /// Select current paragraph (delimited by blank lines) as block. ExBlockPasteStream, /// Paste clipboard to current position as stream block. ExBlockPasteLine, /// Paste clipboard to current position as line block. ExBlockPasteColumn, /// Paste clipboard to current position as column block. ExBlockPrint, /// Print a block to configured device. ExBlockRead, /// Read block from file. ExBlockReadStream, /// Read block from file as stream block ExBlockReadLine, /// Read block from file as line block ExBlockReadColumn, /// Read block from file as column block ExBlockWrite, /// Write marked block to file. ExBlockSort, /// Sorts the marked block in ascending order. /// //\ If mode setting MatchCase is set, characters will be compared case //\ sensitively. /// //\ When block is marked in //\ Stream or Line mode, //\ the entire lines in marked block will be compared. /// //\ When block is marked in Column //\ mode, only characters within marked columns will be compared. ExBlockSortReverse, /// Sorts the marked block in descending order. //^ BlockSort ExBlockUnTab, /// Remove tabs from marked lines. ExBlockEnTab, /// Generate and optimize tabs in marked lines. ExBlockMarkFunction, /// Mark current function as block. ExBlockTrim, /// Trim end-of-line whitespace // Text Editing and Insertion ExUndo, /// Undo last operation ExRedo, /// Redo last undone operation. // Folding Text ExFoldCreate, /// Create fold ExFoldCreateByRegexp, /// Create folds at lines matching a regular expression ExFoldCreateAtRoutines, /// Create folds at lines matching RoutineRx ExFoldDestroy, /// Destroy fold at current line ExFoldDestroyAll, /// Destroy all folds in the file ExFoldPromote, /// Promote fold to outer level ExFoldDemote, /// Demote fold to inner level ExFoldOpen, /// Open fold at current line ExFoldOpenNested, /// Open fold and nested folds ExFoldClose, /// Close current fold ExFoldOpenAll, /// Open all folds in the file ExFoldCloseAll, /// Close all folds in the file ExFoldToggleOpenClose, /// Toggle open/close current fold. //Bookmarks ExPlaceBookmark, /// Place a file-local bookmark. ExRemoveBookmark, /// Place a file-local bookmark. ExGotoBookmark, /// Go to file-local bookmark location. ExPlaceGlobalBookmark, /// Place global (persistent) bookmark. ExRemoveGlobalBookmark, /// Remove global bookmark. ExGotoGlobalBookmark, /// Go to global bookmark location. ExPushGlobalBookmark, /// Push global bookmark (named as #) to stack. ExPopGlobalBookmark, /// Pop global bookmark from stack. // Character Translation ExCharCaseUp, /// Convert current character to uppercase ExCharCaseDown, /// Convert current character to lowercase ExCharCaseToggle, /// Toggle case of current character ExCharTrans, /// Translate current character (like perl/sed) ExLineCaseUp, /// Convert current line to uppercase ExLineCaseDown, /// Convert current line to lowercase ExLineCaseToggle, /// Toggle case of current line ExLineTrans, /// Translate characters on current line ExBlockCaseUp, /// Convert characters in selected block to uppercase ExBlockCaseDown, /// Convert characters in selected block to lowercase ExBlockCaseToggle, /// Toggle case of characters in selected block ExBlockTrans, /// Translate characters in selected block. ExInsertString, /// Insert argument string at cursor position ExInsertSpace, /// Insert space ExInsertChar, /// Insert character argument at cursor position ExTypeChar, /// Insert character at cursor position (expanding abbreviations) ExInsertTab, /// Insert tab character at cursor position ExInsertSpacesToTab, /// Insert appropriate number of spaces to simulate a tab. ExSelfInsert, /// Insert typed character ExWrapPara, /// Wrap current paragraph ExInsPrevLineChar, /// Insert character in previous line above cursor ExInsPrevLineToEol, /// Insert previous line from cursor to end of line ExCompleteWord, /// Complete current word to last word starting with the /// same prefix. ExFilePrev, /// Switch to previous file in ring. ExFileNext, /// Switch to next file in ring. ExFileLast, /// Exchange last two files in ring. ExSwitchTo, /// Switch to numbered buffer given as argument // File Commands ExFileOpen, /// Open file ExFileOpenInMode, /// Open file in specified mode ExFileReload, /// Reload current file ExFileSave, /// Save current file ExFileSaveAll, /// Save all modified files ExFileSaveAs, /// Rename Save current file ExFileWriteTo, /// Write current file into another file ExFilePrint, /// Print current file ExFileClose, /// Close current file ExFileCloseAll, /// Close all open files ExFileTrim, /// Trim end-of-line whitespace // Directory Commands ExDirOpen, /// Open directory browser ExDirGoUp, /// Change to parent directory ExDirGoDown, /// Change to currently selected directory ExDirGoRoot, /// Change to root directory ExDirGoto, /// Change to directory given as argument ExDirSearchCancel, /// Cancel search ExDirSearchNext, /// Find next matching file ExDirSearchPrev, /// Find previous matching file // Search and Replace ExIncrementalSearch, /// Incremental search ExFind, /// Find ExFindReplace, /// Find and replace ExFindRepeat, /// Repeat last find/replace operation ExFindRepeatOnce, /// Repeat last find/replace operation only once ExFindRepeatReverse, /// Repeat last find/replace operation in reverse ExMatchBracket, /// Find matching bracket ([{<>}]) ExHilitWord, /// Highlight current word everywhere in the file ExSearchWordPrev, /// Search for previous occurence of word under cursor ExSearchWordNext, /// Search for next occurence of word under cursor ExHilitMatchBracket, /// Highlight matching bracket ExSearch, ExSearchB, ExSearchRx, ExSearchAgain, ExSearchAgainB, ExSearchReplace, ExSearchReplaceB, ExSearchReplaceRx, // Window Commands ExWinHSplit, /// Split window horizontally ExWinNext, /// Switch to next (bottom) window ExWinPrev, /// Switcn to previous (top) window. ExWinClose, /// Close current window ExWinZoom, /// Delete all windows except for current one ExWinResize, /// Resize current window (+n,-n given as argument) ExViewBuffers, /// View currently open buffers ExListRoutines, /// Display routines in current source file ExExitEditor, /// Exit FTE. ExShowEntryScreen, /// View external program output if available // Compiler Support ExCompile, /// Ask for compile command and run compiler ExRunCompiler, /// Run configured compile command ExViewMessages, /// View compiler output ExCompileNextError, /// Switch to next compiler error ExCompilePrevError, /// Switch to previous compiler error ExRunProgram, /// Run external program // CVS Support ExCvs, /// Ask for CVS options and run CVS ExRunCvs, /// Run configured CVS command ExViewCvs, /// View CVS output ExClearCvsMessages, /// Clear CVS messages ExCvsDiff, /// Ask for CVS diff options and run CVS ExRunCvsDiff, /// Run configured CVS diff command ExViewCvsDiff, /// View CVS diff output ExCvsCommit, /// Ask for CVS commit options and run CVS ExRunCvsCommit, /// Run configured CVS commit command ExViewCvsLog, /// View CVS log // SVN Support ExSvn, /// Ask for SVN options and run SVN ExRunSvn, /// Run configured SVN command ExViewSvn, /// View SVN output ExClearSvnMessages, /// Clear SVN messages ExSvnDiff, /// Ask for SVN diff options and run SVN ExRunSvnDiff, /// Run configured SVN diff command ExViewSvnDiff, /// View SVN diff output ExSvnCommit, /// Ask for SVN commit options and run SVN ExRunSvnCommit, /// Run configured SVN commit command ExViewSvnLog, /// View SVN log // TAGS Commands /// fte supports TAGS files generated by programs like ctags. ExTagFind, /// Find word argumen in tag files. ExTagFindWord, /// Find word under cursor in tag files. ExTagNext, /// Switch to next occurance of tag ExTagPrev, /// Switch to previous occurance of tag ExTagPop, /// Pop saved position from tag stack ExTagLoad, /// Load tag file and merge with current tags ExTagClear, /// Clear loaded tags ExTagGoto, /// // Option commands ExToggleAutoIndent, /// ExToggleInsert, /// ExToggleExpandTabs, /// ExToggleShowTabs, /// ExToggleUndo, /// ExToggleReadOnly, /// ExToggleKeepBackups, /// ExToggleMatchCase, /// ExToggleBackSpKillTab, /// ExToggleDeleteKillTab, /// ExToggleSpaceTabs, /// ExToggleIndentWithTabs, /// ExToggleBackSpUnindents, /// ExToggleWordWrap, /// ExToggleTrim, /// ExToggleShowMarkers, /// ExToggleHilitTags, /// ExToggleShowBookmarks, /// ExToggleMakeBackups, /// ExSetLeftMargin, /// ExSetRightMargin, /// ExToggleSysClipboard, /// ExSetPrintDevice, /// ExChangeTabSize, /// ExChangeLeftMargin, /// ExChangeRightMargin, /// // Other commands ExShowPosition, /// Show internal position information on status line ExShowVersion, /// Show editor version information ExShowKey, /// Wait for keypress and display modifiers+key pressed ExWinRefresh, /// Refresh display ExMainMenu, /// Activate main menu ExShowMenu, /// Popup menu specified as argument ExLocalMenu, /// Popup context menu ExChangeMode, /// Change active mode for current buffer ExChangeKeys, /// Change keybindings for current buffer ExChangeFlags, /// Change option flags for current buffer ExCancel, /// ExActivate, /// ExRescan, /// ExCloseActivate, /// ExActivateInOtherWindow, /// ExDeleteFile, /// Remove a file while in the directory browser ExRenameFile, /// Rename a file while in the directory browser ExMakeDirectory, /// Make a directory while in the directory browser ExASCIITable, /// Display ASCII selector in status line. ExDesktopSave, /// Save desktop ExClipClear, /// Clear clipboard ExDesktopSaveAs, /// Save desktop under a new name ExDesktopLoad, /// Load desktop from a file ExChildClose, /// ExBufListFileSave, /// Save currently selected file in buffer list ExBufListFileClose, /// Close currently selected file in buffer list ExBufListSearchCancel, /// Cancel search ExBufListSearchNext, /// Next match in search ExBufListSearchPrev, /// Previous match in search ExViewModeMap, /// View current mode keybindings ExClearMessages, /// Clear compiler messages ExIndentFunction, /// Indent current function ExMoveFunctionPrev, /// Move cursor to previous function ExMoveFunctionNext, /// Move cursor to next function ExInsertDate, /// Insert date at cursor ExInsertUid, /// Insert user name at cursor ExFrameNew, /// ExFrameClose, /// ExFrameNext, /// ExFramePrev, /// ExBufferViewNext, /// ExBufferViewPrev, /// ExShowHelpWord, /// Show context help on keyword. ExShowHelp, /// Show help for FTE. ExConfigRecompile, /// Recompile editor configuration ExSetCIndentStyle, /// Set C indentation style parameters /// Has the following parameters: /// /// C_Indent = 4; /// C_BraceOfs = 0; /// C_ParenDelta = -1; /// C_CaseOfs = 0; /// C_CaseDelta = 4; /// C_ClassOfs = 0; /// C_ClassDelta = 4; /// C_ColonOfs = -4; /// C_CommentOfs = 0; /// C_CommentDelta = 1; /// C_FirstLevelWidth = -1; /// C_FirstLevelIndent = 4; /// C_Continuation = 4; ExSetIndentWithTabs, /// Set value of indent-with-tabs to argument ExRunProgramAsync, ExListMark, /// Mark single line in list ExListUnmark, /// Unmark single line in list ExListToggleMark, /// Toggle marking of single line in list ExListMarkAll, /// Mark all lines in list ExListUnmarkAll, /// Unmark all lines in list ExListToggleMarkAll, /// Toggle marking of all lines in list ExBlockPasteOver, /// Delete content's of selection and paste clipboard to current position ExGetString, /// Get a string from the user ExRegExp, /// Perform a Regular Expression conversion into a user variable ExExpandTemplate /// Expand a user based template } ExCommands; #endif efte-1.1/src/con_nt.cpp0000664000076400007640000016404411114623311014077 0ustar laurilauri/* con_nt.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ /* some functionality is now shared with g_text.cpp and g_draw.cpp */ /* new os/2 code needs to be merged with this */ /* the console APIs on win'95 seem to be really screwed up */ /* * 10/13/96 Jal: * Rebuilt for Windows NT, generic; no port/Watcom code should * be needed to compile (jal). * Removed most mouse handling code (unnecessary), added pipe handler by * porting the OS/2 version to NT. * Solved some bugs with regard to the TCell problem. * * 10/28/96 Jal: * Started to replace threaded pipe code with nonthreaded code, using * overlapped I/O. * * Wed Jan 15 1997 (Jal): * - The Grey-Alt-+ key and some other keys were not recognised. This * was because NT didn't mark these as "enhanced" keys. Now the code * translates some (scancode,ascii) pairs to the enhanced keyboard. * The table was already present! * - To solve the "flashing cursor" problem: now doesn't enter FTE * mainloop when console returns empty action.. * */ #define WIN32_LEAN_AND_MEAN #include #include #include #include #include #include "sysdep.h" #include "console.h" #include "gui.h" #include "s_files.h" #include "s_string.h" #include "c_config.h" #define True 1 #define False 0 static int Initialized = 0; static int MousePresent = 0; static int CursorVisible = 0; /* 1 means visible */ static int CursorInsert = 1; /* 1 means insert */ static int MouseVisible = 0; /* 0 means hidden */ static TEvent MouseEv = { evNone }; static TEvent EventBuf = { evNone }; //static TEventMask EventMask; static HANDLE ConOut; static HANDLE ConIn; static HANDLE OurConOut; static DWORD OldConsoleMode; static int LastMouseX = 0; static int LastMouseY = 0; //static int isWin95 = 0; static char winTitle[256] = "eFTE"; static char winSTitle[256] = "eFTE"; int codepage; #define dbm(x) //printf(x), Sleep(3000) #if 0 void dbg(const char* s, ...) { } #else void dbg(const char* s, ...) { char buf[256]; va_list args; va_start(args, s); vsprintf(buf, s, args); va_end(args); OutputDebugString(buf); } #endif CONSOLE_CURSOR_INFO cci; static void DrawCursor(int Show) { if (cci.bVisible == CursorVisible && ((cci.dwSize == 100 && CursorInsert) || (cci.dwSize == 10 && CursorInsert == 0))) return; cci.bVisible = CursorVisible ? TRUE : FALSE; cci.dwSize = CursorInsert ? 100 : 10; SetConsoleCursorInfo(OurConOut, &cci); } #define NUMITEMS(x) (sizeof(x) / sizeof(x[0])) #if 1 /* * Translation table 1: translate (scan,asciicode) of the input event to a * valid FTE keystroke. This is used because NT sometimes "forgets" to flag * special keys as "enhanced" (grey) keys.. */ static struct { USHORT CharScan; TKeyCode KeyCode; } TransCharScan[] = { { 0x0100, kbEsc }, { 0x011B, kbEsc }, { 0x1C0D, kbEnter }, { 0x1C0A, kbEnter }, { 0x1C00, kbEnter }, { 0xE00D, kbEnter | kfGray }, { 0xA600, kbEnter | kfGray }, { 0xE00A, kbEnter | kfGray }, { 0x0E08, kbBackSp }, { 0x0E7F, kbBackSp }, { 0x0E00, kbBackSp }, { 0x0F09, kbTab }, { 0x9400, kbTab }, { 0xA500, kbTab }, { 0x0F00, kbTab }, { 0x4E00, '+' | kfGray }, { 0x9000, '+' | kfGray }, { 0x4E2B, '+' | kfGray }, { 0x4A00, '-' | kfGray }, { 0x8E00, '-' | kfGray }, { 0x4A2D, '-' | kfGray }, { 0x3700, '*' | kfGray }, { 0x9600, '*' | kfGray }, { 0x372A, '*' | kfGray }, { 0xE02F, '/' | kfGray }, { 0xA400, '/' | kfGray }, { 0x9500, '/' | kfGray }, { 0x0300, 0 } }; #endif #if 0 static struct { int ScanCode; TKeyCode KeyCode; } TransScan[] = { { 0x78, '1' }, { 0x79, '2' }, { 0x7A, '3' }, { 0x7B, '4' }, { 0x7C, '5' }, { 0x7D, '6' }, { 0x7E, '7' }, { 0x7F, '8' }, { 0x80, '9' }, { 0x81, '0' }, { 0x10, 'Q' }, { 0x11, 'W' }, { 0x12, 'E' }, { 0x13, 'R' }, { 0x14, 'T' }, { 0x15, 'Y' }, { 0x16, 'U' }, { 0x17, 'I' }, { 0x18, 'O' }, { 0x19, 'P' }, { 0x1E, 'A' }, { 0x1F, 'S' }, { 0x20, 'D' }, { 0x21, 'F' }, { 0x22, 'G' }, { 0x23, 'H' }, { 0x24, 'J' }, { 0x25, 'K' }, { 0x26, 'L' }, { 0x2C, 'Z' }, { 0x2D, 'X' }, { 0x2E, 'C' }, { 0x2F, 'V' }, { 0x30, 'B' }, { 0x31, 'N' }, { 0x32, 'M' }, { 0x29, '`' }, { 0x82, '-' }, { 0x83, '=' }, { 0x2B, '\\' }, { 0x1A, '[' }, { 0x1B, ']' }, { 0x27, ';' }, { 0x28, '\'' }, { 0x33, ',' }, { 0x34, '.' }, { 0x35, '/' }, { 0x37, '*' }, { 0x4E, '+' }, { 0x4A, '-' }, { 0x3B, kbF1 }, { 0x3C, kbF2 }, { 0x3D, kbF3 }, { 0x3E, kbF4 }, { 0x3F, kbF5 }, { 0x40, kbF6 }, { 0x41, kbF7 }, { 0x42, kbF8 }, { 0x43, kbF9 }, { 0x44, kbF10 }, { 0x85, kbF11 }, { 0x86, kbF12 }, { 0x54, kbF1 }, { 0x55, kbF2 }, { 0x56, kbF3 }, { 0x57, kbF4 }, { 0x58, kbF5 }, { 0x59, kbF6 }, { 0x5A, kbF7 }, { 0x5B, kbF8 }, { 0x5C, kbF9 }, { 0x5D, kbF10 }, { 0x87, kbF11 }, { 0x88, kbF12 }, { 0x5E, kbF1 }, { 0x5F, kbF2 }, { 0x60, kbF3 }, { 0x61, kbF4 }, { 0x62, kbF5 }, { 0x63, kbF6 }, { 0x64, kbF7 }, { 0x65, kbF8 }, { 0x66, kbF9 }, { 0x67, kbF10 }, { 0x89, kbF11 }, { 0x8A, kbF12 }, { 0x68, kbF1 }, { 0x69, kbF2 }, { 0x6A, kbF3 }, { 0x6B, kbF4 }, { 0x6C, kbF5 }, { 0x6D, kbF6 }, { 0x6E, kbF7 }, { 0x6F, kbF8 }, { 0x70, kbF9 }, { 0x71, kbF10 }, { 0x8B, kbF11 }, { 0x8C, kbF12 }, { 0x47, kbHome }, { 0x48, kbUp }, { 0x49, kbPgUp }, { 0x4B, kbLeft }, { 0x4C, kbCenter}, { 0x4D, kbRight }, { 0x4F, kbEnd }, { 0x50, kbDown }, { 0x51, kbPgDn }, { 0x52, kbIns }, { 0x53, kbDel }, { 0x77, kbHome }, { 0x8D, kbUp }, { 0x84, kbPgUp }, { 0x73, kbLeft }, { 0x74, kbRight }, { 0x75, kbEnd }, { 0x91, kbDown }, { 0x76, kbPgDn }, { 0x92, kbIns }, { 0x93, kbDel }, { 0x97, kbHome | kfGray }, { 0x98, kbUp | kfGray }, { 0x99, kbPgUp | kfGray }, { 0x9B, kbLeft | kfGray }, { 0x9D, kbRight | kfGray }, { 0x9F, kbEnd | kfGray }, { 0xA0, kbDown | kfGray }, { 0xA1, kbPgDn | kfGray }, { 0xA2, kbIns | kfGray }, { 0xA3, kbDel | kfGray } }; #endif struct { SHORT VirtCode; unsigned long KeyCode; } VirtTab[] = { { 112, kbF1 }, { 113, kbF2 }, { 114, kbF3 }, { 115, kbF4 }, { 116, kbF5 }, { 117, kbF6 }, { 118, kbF7 }, { 119, kbF8 }, { 120, kbF9 }, { 121, kbF10 }, { 122, kbF11 }, { 123, kbF12 }, { 35, kbEnd }, { 36, kbHome }, { 33, kbPgUp }, { 34, kbPgDn }, { 38, kbUp }, { 37, kbLeft }, { 39, kbRight }, { 40, kbDown }, { 45, kbIns }, { 46, kbDel }, { 27, kbEsc }, { 13, kbEnter }, { 8, kbBackSp }, { 32, kbSpace }, { 9, kbTab }, { 0, 0 } }; char shftwrng[] = "~!@#$%^&*()_+{}|:\"<>?"; char shftright[] = "`1234567890-=[]\\;',./"; int ReadConsoleEvent(TEvent *E) { /* * Reads and interprets the console event. It is called when console input * handle is signalled. To prevent flashing cursors this routine returns * F if there's nothing to do; this causes the caller to loop without * returning to the FTE mainloop. */ INPUT_RECORD inp; DWORD nread; TKeyCode Ch = 0; TKeyCode flg = 0; ULONG flags; int I, i; ReadConsoleInput(ConIn, &inp, 1, &nread); if (nread != 1) return False; // Nothing read after signal?? switch (inp.EventType) { case WINDOW_BUFFER_SIZE_EVENT: //** Resized the window. Make FTE use the new size.. frames->Resize(inp.Event.WindowBufferSizeEvent.dwSize.X, inp.Event.WindowBufferSizeEvent.dwSize.Y); frames->Repaint(); return True; case KEY_EVENT: if (inp.Event.KeyEvent.bKeyDown) { if ((inp.Event.KeyEvent.dwControlKeyState & CAPSLOCK_ON) && inp.Event.KeyEvent.wVirtualKeyCode != 106 && inp.Event.KeyEvent.wVirtualKeyCode != 109 && inp.Event.KeyEvent.wVirtualKeyCode != 107) { if (!(inp.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)) { for (i = 0; shftwrng[i]; i++) { if (inp.Event.KeyEvent.uChar.AsciiChar == shftwrng[i]) { inp.Event.KeyEvent.uChar.AsciiChar = shftright[i]; break; } } } else { for (i = 0; shftright[i]; i++) { if (inp.Event.KeyEvent.uChar.AsciiChar == shftright[i]) { inp.Event.KeyEvent.uChar.AsciiChar = shftwrng[i]; break; } } } } } //** Skip shift, control and alt key stuff. switch (inp.Event.KeyEvent.wVirtualKeyCode) { case VK_SHIFT: case VK_CONTROL: case VK_MENU: case VK_PAUSE: case VK_CAPITAL: case VK_LWIN: case VK_RWIN: case VK_APPS: return False; } //** Distill FTE flags from the NT flags. This fails for some keys //** because NT has an oddity with enhanced keys (Alt-Grey-+ etc). // from chaac: Please do not toutch RIGHT_ALT_PRESSED handling, // in some keyboard ALT-GR is used for special characters. flags = inp.Event.KeyEvent.dwControlKeyState; if (flags & (/*RIGHT_ALT_PRESSED |*/ LEFT_ALT_PRESSED)) flg |= kfAlt; if (flags & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED)) flg |= kfCtrl; if (flags & (RIGHT_ALT_PRESSED)) flg &= ~kfCtrl; if (flags & SHIFT_PRESSED) flg |= kfShift; if (flags & ENHANCED_KEY) flg |= kfGray; #if 0 dbg("key1: %s, vk=%x, vscan=%x, flags=%x, rep=%d, ascii=%x (%c).\n", inp.Event.KeyEvent.bKeyDown ? "down" : "up", inp.Event.KeyEvent.wVirtualKeyCode, inp.Event.KeyEvent.wVirtualScanCode, flags, inp.Event.KeyEvent.wRepeatCount, inp.Event.KeyEvent.uChar.AsciiChar, inp.Event.KeyEvent.uChar.AsciiChar); #endif Ch = 0; // handle special case when user with scandinavian keyboard presses // alt-gr + special key and then spacebar if (inp.Event.KeyEvent.bKeyDown) { if ((inp.Event.KeyEvent.wVirtualKeyCode == 0x20) && (inp.Event.KeyEvent.wVirtualScanCode == 0x39)) { switch (inp.Event.KeyEvent.uChar.AsciiChar) { case '~': Ch = '~'; break; case '^': Ch = '^'; break; case '`': Ch = '`'; break; case '': Ch = ''; break; } } } //** Translate VK codes to FTE codes, if (Ch == 0) { for (I = 0; I < sizeof(VirtTab) / sizeof(VirtTab[0]); I++) if (VirtTab[I].VirtCode == inp.Event.KeyEvent.wVirtualKeyCode) { Ch = VirtTab[I].KeyCode; break; } } //** Not a virtual key-> do charscan translation, if needed; if (Ch == 0) { unsigned int cc = ((inp.Event.KeyEvent.wVirtualScanCode << 8) | (unsigned char)inp.Event.KeyEvent.uChar.AsciiChar); for (I = 0; I < NUMITEMS(TransCharScan); I++) { if (cc == TransCharScan[I].CharScan) { Ch = TransCharScan[I].KeyCode; break; } } } if (Ch == 0) { if ((Ch = (TKeyCode)(unsigned char)inp.Event.KeyEvent.uChar.AsciiChar) != 0) { if (flg & kfAlt) Ch = toupper(Ch); } } if (Ch == 0) //** Odd: cannot distill keycode. return False; if (flg & kfCtrl) if (Ch < 32) Ch += 64; E->Key.Code = Ch | flg; // Set FTE keycode, E->What = inp.Event.KeyEvent.bKeyDown ? evKeyDown : evKeyUp; return True; case MOUSE_EVENT: LastMouseX = E->Mouse.X = inp.Event.MouseEvent.dwMousePosition.X; LastMouseY = E->Mouse.Y = inp.Event.MouseEvent.dwMousePosition.Y; flags = inp.Event.MouseEvent.dwControlKeyState; if (flags & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED)) flg |= kfAlt; if (flags & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED)) flg |= kfCtrl; if (flags & SHIFT_PRESSED) flg |= kfShift; E->Mouse.KeyMask = flg; E->Mouse.Buttons = (unsigned short)inp.Event.MouseEvent.dwButtonState; E->Mouse.Count = 1; if (inp.Event.MouseEvent.dwEventFlags & DOUBLE_CLICK) E->Mouse.Count = 2; if (inp.Event.MouseEvent.dwEventFlags & MOUSE_WHEELED) { E->What = evCommand; E->Msg.View = 0; E->Msg.Model = 0; E->Msg.Param2 = 0; // Scroll: // (The SDK does not tell how to determine whether the wheel // was scrolled up or down. Found an example on: // http://www.adrianxw.dk/SoftwareSite/Consoles/Consoles5.html if (inp.Event.MouseEvent.dwButtonState & 0xFF000000) { // Wheel down if (flg & kfShift) { // Translate to horizontal scroll. E->Msg.Command = (flg & kfCtrl) ? cmHScrollPgRt : cmHScrollRight; } else { // Translate to vertical scroll. E->Msg.Command = (flg & kfCtrl) ? cmVScrollPgDn : cmVScrollDown; } } else { // Wheel up if (flg & kfShift) { // Translate to horizontal scroll. E->Msg.Command = (flg & kfCtrl) ? cmHScrollPgLt : cmHScrollLeft; } else { // Translate to vertical scroll. E->Msg.Command = (flg & kfCtrl) ? cmVScrollPgUp : cmVScrollUp; } } E->Msg.Param1 = (flg & kfCtrl) ? 1 : 3; // 1 page / 3 lines return True; } if (inp.Event.MouseEvent.dwEventFlags == MOUSE_MOVED) { E->What = evMouseMove; //puts("Move"); } else { static unsigned short mb = 0; if (inp.Event.MouseEvent.dwButtonState & ~mb) { E->What = evMouseDown; E->Mouse.Buttons = ((unsigned short)inp.Event.MouseEvent.dwButtonState) & ~mb; //puts("Down"); } else { E->What = evMouseUp; E->Mouse.Buttons = mb & ~((unsigned short)inp.Event.MouseEvent.dwButtonState); //puts("Up"); } mb = (unsigned short)inp.Event.MouseEvent.dwButtonState; } return True; } return False; } int ConInit(int /*XSize*/, int /*YSize*/) { if (Initialized) return 0; EventBuf.What = evNone; MousePresent = 0; //MOUSInit(); //** Get NT/Win95 flag, OSVERSIONINFO oi; oi.dwOSVersionInfoSize = sizeof(oi); GetVersionEx((LPOSVERSIONINFO) &oi); //isWin95 = (oi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS); ConOut = GetStdHandle(STD_OUTPUT_HANDLE); ConIn = GetStdHandle(STD_INPUT_HANDLE); codepage = GetConsoleCP(); GetConsoleMode(ConIn, &OldConsoleMode); SetConsoleMode(ConIn, ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT); OurConOut = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); ConContinue(); // Makes the cursor visible when scrolling up and down. If the cursor is left // as an underscore on Windows, then when moving up and down on the screen the // cursor totally disappears making it hard to know where you are on the screen. GetConsoleCursorInfo(OurConOut, &cci); cci.bVisible = TRUE; cci.dwSize=100; SetConsoleCursorInfo(OurConOut, &cci); Initialized = 1; return 0; } int ConDone(void) { ConSuspend(); CloseHandle(OurConOut); return 0; } int ConSuspend(void) { SetConsoleActiveScreenBuffer(ConOut); SetConsoleMode(ConIn, OldConsoleMode); return 0; } int ConContinue(void) { SetConsoleActiveScreenBuffer(OurConOut); GetConsoleMode(ConIn, &OldConsoleMode); SetConsoleMode(ConIn, ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT); { SetConsoleOutputCP(codepage); SetConsoleCP(codepage); } return 0; } int ConClear(void) { int W, H; TDrawBuffer B; MoveChar(B, 0, ConMaxCols, ' ', 0x07, 1); if ((ConQuerySize(&W, &H) == 0) && ConSetBox(0, 0, W, H, B[0])) return 0; return -1; } #if 0 // Mouse control not necessary when using console functions. /*--------------------------------------------------------------------------*/ /* CLASS: tMouHelp is used to control mouse cursor visibility during */ /* screen updates. */ /*--------------------------------------------------------------------------*/ class tMouHelp { protected: int mh_x, mh_y; // Current mouse position / 0 int mh_valid; int mh_disabled; // T if mouse should be re-enabled. public: tMouHelp() : mh_x(0), mh_y(0), mh_valid(FALSE), mh_disabled(FALSE) {} ~tMouHelp() { if (MouseVisible && mh_disabled) DrawMouse(1); } void disIfLine(int x, int w, int y) { if (mh_disabled) return; if (! mh_valid) { ConQueryMousePos(&mh_x, &mh_y); mh_valid = TRUE; } if (y == mh_y && mh_x >= x && mh_x < x + y) { mh_disabled = TRUE; DrawMouse(0); } } }; #endif int ConPutBox(int X, int Y, int W, int H, PCell Cell) { int I; PCell p = Cell; COORD corg, csize; SMALL_RECT rcl; BOOL rc; for (I = 0; I < H; I++) { corg.X = corg.Y = 0; csize.X = W; csize.Y = 1; rcl.Left = X; rcl.Top = I + Y; rcl.Bottom = I + Y;// + (isWin95 ? 1 : 0); rcl.Right = X + W - 1;// + (isWin95 ? 1 : 0); rc = WriteConsoleOutput(OurConOut, (PCHAR_INFO)p, csize, corg, &rcl); if (rc != TRUE) { //("WriteConsoleOutput %d\n", rc); } p += W; } return 0; } int ConGetBox(int X, int Y, int W, int H, PCell Cell) { int I; USHORT WW = W << 1; PCell p = Cell; COORD corg, csize; SMALL_RECT rcl; for (I = 0; I < H; I++) { corg.X = corg.Y = 0; csize.X = W; csize.Y = 1; rcl.Left = X; rcl.Top = I + Y; rcl.Bottom = I + Y;// + (isWin95 ? 1 : 0); rcl.Right = X + W - 1;// + (isWin95 ? 1 : 0); ReadConsoleOutput(OurConOut, (PCHAR_INFO)p, csize, corg, &rcl); p += W; } return 0; } int ConPutLine(int X, int Y, int W, int H, PCell Cell) { int I; COORD corg, csize; SMALL_RECT rcl; BOOL rc; for (I = 0; I < H; I++) { corg.X = corg.Y = 0; csize.X = W; csize.Y = 1; rcl.Left = X; rcl.Top = I + Y; rcl.Bottom = I + Y;// + (isWin95 ? 1 : 0); rcl.Right = X + W - 1;// + (isWin95 ? 1 : 0); rc = WriteConsoleOutput(OurConOut, (PCHAR_INFO)Cell, csize, corg, &rcl); if (rc != TRUE) { //printf("WriteConsoleOutput %d\n", rc); } } return 0; } int ConSetBox(int X, int Y, int W, int H, TCell Cell) { int I; COORD corg, csize; SMALL_RECT rcl; TDrawBuffer B; I = W; while (I-- > 0) B[I] = Cell; for (I = 0; I < H; I++) { corg.X = corg.Y = 0; csize.X = W; csize.Y = 1; rcl.Left = X; rcl.Top = I + Y; rcl.Bottom = I + Y;// - (isWin95 ? 1 : 0); rcl.Right = X + W - 1;// - (isWin95 ? 1 : 0); WriteConsoleOutput(OurConOut, (PCHAR_INFO)B, csize, corg, &rcl); } return 0; } int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { TCell FillCell; SMALL_RECT rect, clip; COORD dest; MoveCh(&FillCell, ' ', Fill, 1); clip.Left = X; clip.Top = Y; clip.Right = X + W - 1; clip.Bottom = Y + H - 1; rect = clip; dest.X = X; dest.Y = Y; switch (Way) { case csUp: rect.Top += Count; break; case csDown: rect.Bottom -= Count; dest.Y += Count; break; case csLeft: rect.Left += Count; break; case csRight: rect.Right += Count; dest.X += Count; break; } ScrollConsoleScreenBuffer(OurConOut, &rect, &clip, dest, (PCHAR_INFO)&FillCell); return 0; } int ConSetSize(int X, int Y) { return -1; } // JNC: Trying to fix cursor problem. CONSOLE_SCREEN_BUFFER_INFO csbi; int queried = 0; int ConQuerySize(int *X, int *Y) { if (queried == 0) { GetConsoleScreenBufferInfo(OurConOut, &csbi); } *X = csbi.dwSize.X; *Y = csbi.dwSize.Y; dbg("Console size (%u,%u)\n", *X, *Y); return 0; } // JNC: Trying to fix cursor problem COORD xy; int set_cursor_pos = 0; int ConSetCursorPos(int X, int Y) { if (set_cursor_pos == 0) { xy.X = 0; xy.Y = 0; set_cursor_pos = 1; } if (xy.X != X || xy.Y != Y) { xy.X = X; xy.Y = Y; SetConsoleCursorPosition(OurConOut, xy); } return 0; } int ConQueryCursorPos(int *X, int *Y) { CONSOLE_SCREEN_BUFFER_INFO csbi; GetConsoleScreenBufferInfo(OurConOut, &csbi); *X = csbi.dwCursorPosition.X; *Y = csbi.dwCursorPosition.Y; return 0; } int ConShowCursor(void) { // Do not draw the cursor if nothing has changed if (CursorVisible == 1) return 0; CursorVisible = 1; DrawCursor(1); return 0; } int ConHideCursor(void) { // Do not draw the cursor if nothing has changed if (CursorVisible == 0) return 0; CursorVisible = 0; DrawCursor(0); return 0; } int ConCursorVisible() { return (CursorVisible == 1); } void ConSetInsertState(bool insert) { CursorInsert = insert; DrawCursor(0); } int ConSetMousePos(int X, int Y) { return -1; } int ConQueryMousePos(int *X, int *Y) { *X = LastMouseX; *Y = LastMouseY; // NT does not have this ? (not needed anyway, but check mouse hiding above). return 0; } int ConShowMouse(void) { MouseVisible = 1; if (!MousePresent) return -1; return 0; } int ConHideMouse(void) { MouseVisible = 0; if (!MousePresent) return -1; return 0; } int ConMouseVisible() { return (MouseVisible == 1); } int ConQueryMouseButtons(int *ButtonCount) { return 0; } int ConPutEvent(TEvent Event) { EventBuf = Event; return 0; } int ConFlush(void) { return 0; } int ConGrabEvents(TEventMask EventMask) { return 0; } static PCell SavedScreen = 0; static int SavedX, SavedY, SaveCursorPosX, SaveCursorPosY; int SaveScreen() { if (SavedScreen) free(SavedScreen); ConQuerySize(&SavedX, &SavedY); SavedScreen = (PCell) malloc(SavedX * SavedY * sizeof(TCell)); if (SavedScreen) ConGetBox(0, 0, SavedX, SavedY, SavedScreen); ConQueryCursorPos(&SaveCursorPosX, &SaveCursorPosY); return 0; } int RestoreScreen() { if (SavedScreen) { ConPutBox(0, 0, SavedX, SavedY, SavedScreen); ConSetCursorPos(SaveCursorPosX, SaveCursorPosY); } return 1; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) { fArgc = argc; fArgv = argv; ::ConInit(-1, -1); SaveScreen(); ::ConSetSize(XSize, YSize); gui = this; } GUI::~GUI() { RestoreScreen(); if (SavedScreen) free(SavedScreen); ::ConDone(); gui = 0; } int GUI::ConSuspend(void) { RestoreScreen(); return ::ConSuspend(); } int GUI::ConContinue(void) { SaveScreen(); return ::ConContinue(); } int GUI::ShowEntryScreen() { TEvent E; ConHideMouse(); RestoreScreen(); SetConsoleActiveScreenBuffer(ConOut); do { gui->ConGetEvent(evKeyDown, &E, -1, 1, 0); } while (E.What != evKeyDown); SetConsoleActiveScreenBuffer(OurConOut); ConShowMouse(); if (frames) frames->Repaint(); return 1; } char ConGetDrawChar(int index) { static const char *tab = NULL; if (!tab) { tab = GetGUICharacters("WindowsNT", "ڿijô\x1A\x1B\x1A"); } assert(index >= 0 && index < (int)strlen(tab)); return tab[index]; } int GUI::RunProgram(int mode, char *Command) { int rc, W, H, W1, H1; ConQuerySize(&W, &H); ConHideMouse(); ConSuspend(); if (*Command == 0) // empty string = shell Command = getenv( "COMSPEC" ); // we don't want ctrl-c or ctrl-break to exit our editor... signal(SIGBREAK, SIG_IGN); signal(SIGINT, SIG_IGN); rc = system(Command); // restore handlers back to default handlers signal(SIGBREAK, SIG_DFL); signal(SIGINT, SIG_DFL); ConContinue(); ConShowMouse(); ConQuerySize(&W1, &H1); if (W != W1 || H != H1) { frames->Resize(W1, H1); } frames->Repaint(); return rc; } int ConSetTitle(char *Title, char *STitle) { char buf[sizeof(winTitle)] = {0}; JustFileName(Title, buf, sizeof(buf)); if (buf[0] == '\0') // if there is no filename, try the directory name. JustLastDirectory(Title, buf, sizeof(buf)); strncpy(winTitle, "eFTE - ", sizeof(winTitle) - 1); if (buf[0] != 0) { // if there is a file/dir name, stick it in here. strncat(winTitle, buf, sizeof(winTitle) - 1 - strlen(winTitle)); strncat(winTitle, " - ", sizeof(winTitle) - 1 - strlen(winTitle)); } strncat(winTitle, Title, sizeof(winTitle) - 1 - strlen(winTitle)); winTitle[sizeof(winTitle) - 1] = 0; strncpy(winSTitle, STitle, sizeof(winSTitle) - 1); winSTitle[sizeof(winSTitle) - 1] = 0; SetConsoleTitle(winTitle); return 0; } int ConGetTitle(char *Title, int MaxLen, char *STitle, int SMaxLen) { strncpy(Title, winTitle, MaxLen); Title[MaxLen - 1] = 0; strncpy(STitle, winSTitle, SMaxLen); STitle[SMaxLen - 1] = 0; return 0; } #if 0 /****************************************************************************/ /* */ /* CODING: Pipe handler. */ /* */ /****************************************************************************/ /*--------------------------------------------------------------------------*/ /* STATIC GLOBALS. */ /*--------------------------------------------------------------------------*/ #define MAX_PIPES 4 #define PIPE_BUFLEN 4096 #define PIPEBUF_SZ 4096 class NTHandle { protected: HANDLE nth_h; public: operator HANDLE() { return nth_h; } void close() { if (nth_h != INVALID_HANDLE_VALUE) { CloseHandle(nth_h); nth_h = INVALID_HANDLE_VALUE; } } NTHandle() { nth_h = INVALID_HANDLE_VALUE; } ~NTHandle() { close(); } NTHandle(const HANDLE& h) : nth_h(h) {} NTHandle(const NTHandle& nth); // UNDEFINED (no assgn) NTHandle& operator =(const NTHandle& nth); // UNDEFINED (no assgn) NTHandle& operator =(const HANDLE nth) { close(); nth_h = nth; return *this; } }; class GPipe { public: int p_used; int p_id; char* p_buffer; int p_buflen; int p_bufused; int p_bufpos; EModel* p_notify; char* p_command; int p_retcode; int p_doterm; //** NT specific. HANDLE p_proc_h; // Handle of spawned process, HANDLE pipeDataRead; HANDLE pipeStartRead; HANDLE pipeMutex; HANDLE p_pipe_ph; // Input pipe (read by FTE) HANDLE p_child_ph; // Client side's handle (written to by spawned) DWORD p_read_len; // #bytes read in overlapped I/O int p_io_posted; // T when overlapped I/O is posted, int p_completed; // T when client process closed down. int p_has_data; // T when OVERLAPPED completed. static GPipe pipe_ar[MAX_PIPES]; public: int open(char *Command, EModel *notify); int close(); int read(void *buffer, int len); int getEvent(TEvent* event); protected: int createPipe(); void releasePipe(); int runCommand(); void closeProc(); int handlePost(); int postRead(); public: static GPipe* getFreePipe(); static GPipe* getPipe(int id); }; GPipe GPipe::pipe_ar[MAX_PIPES]; /* * getFreePipe() locates an unused GPipe structure. It also assigns it's ID. */ GPipe* GPipe::getFreePipe() { int i; for (i = 0; i < MAX_PIPES; i++) { if (! pipe_ar[i].p_used) { pipe_ar[i].p_id = i; // Set pipenr, return pipe_ar + i; } } return NULL; // No free pipe } GPipe* GPipe::getPipe(int id) { if (id < 0 || id > MAX_PIPES) return NULL; if (! pipe_ar[id].p_used) return NULL; return pipe_ar + id; } int GPipe::createPipe() { /* * Called from open() to create and open the server and the client pipes. */ static int PCount = 0; //HANDLE hchild; char pipename[50]; int ok; SECURITY_ATTRIBUTES sa; sa.nLength = sizeof(sa); // Security descriptor for INHERIT. sa.lpSecurityDescriptor = 0; sa.bInheritHandle = 1; #if 1 if (CreatePipe(&p_pipe_ph, &p_child_ph, &sa, 0) == FALSE) return FALSE; Pipes[i].tid = _beginthread(PipeThread, FAKE_BEGINTHREAD_NULL 16384, &Pipes[i]); #else //** Create the named pipe, and handle the SERVER (edit)'s end... sprintf(pipename, "\\\\.\\pipe\\efte%d\\child%d", getpid(), PCount); p_pipe_ph = CreateNamedPipe(pipename, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, // nMaxInstances, 0, PIPEBUF_SZ, 1000, 0); if (p_pipe_ph == INVALID_HANDLE_VALUE) return FALSE; PCount++; /* * Client side: get a connection to the server's pipe. Do this before the * call to ConnectNamedPipe() to prevent it from blocking. */ #if 1 p_child_ph = CreateFile(pipename, GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0); #else p_child_ph = CreateFile("_test", GENERIC_WRITE | GENERIC_READ, 0, &sa, CREATE_ALWAYS, 0, 0); #endif if (p_child_ph == INVALID_HANDLE_VALUE) dbm("CreateFile(client_side_pipe) has failed"); else { //** Server side: aquire connection.. ok = TRUE; if (! ConnectNamedPipe(p_pipe_ph, 0)) { // Get connect; if (GetLastError() != ERROR_PIPE_CONNECTED) ok = FALSE; } //** Connect worked? if (!ok) dbm("ConnectNmPipe() has failed"); else return TRUE; // All opened & ready for action! //** Something went wrong. CloseHandle(p_child_ph); // Close child: was inh. DisconnectNamedPipe(p_pipe_ph); // Force disconnection of client (-) CloseHandle(p_child_ph); } CloseHandle(p_pipe_ph); #endif return FALSE; // Something has failed. } void GPipe::releasePipe() { /* * releasePipe() releases all that createPipe() allocates. It's usually * called when an error causes the process to abort. */ if (p_child_ph != INVALID_HANDLE_VALUE) { CloseHandle(p_child_ph); p_child_ph = INVALID_HANDLE_VALUE; } if (p_pipe_ph != 0) { //DisconnectNamedPipe(p_pipe_ph); CloseHandle(p_pipe_ph); p_pipe_ph = INVALID_HANDLE_VALUE; } } int GPipe::runCommand() { /* * runCommand() takes the child pipe, dups it onto stdout and stderr while * saving their old assignments, then it spawns */ int ok; char* comspec, *args, tbuf[256]; HANDLE errh; PROCESS_INFORMATION pi; STARTUPINFO si; const char nt4[] = "4nt.exe"; ok = FALSE; comspec = getenv("COMSPEC"); /* * BUG workaround: When using 4NT, it doesn't properly reassign stderr! * This is a bug in 4NT, so if comspec *is* 4nt use cmd.exe instead... */ if (comspec == 0) return -1; int l = strlen(comspec); if (strnicmp(comspec + (l - sizeof(nt4) + 1), nt4, sizeof(nt4) - 1) == 0) { //** It's 4DOS all right.. args = getenv("SystemRoot"); if (args == 0) return -1; strlcpy(tbuf, args, sizeof(tbuf)); // Get to c:\winnt strlcat(tbuf, "\\system32\\cmd.exe", sizeof(tbuf)); comspec = tbuf; } int argslen = strlen(comspec) + strlen(p_command) + 120; args = (char *)malloc(argslen); if (args == 0) dbm("malloc() failed for command line.."); else { //** Form a command line for the process; strlcpy(args, comspec, argslen); strlcat(args, " /c ", argslen); strlcat(args, p_command, argslen); //** Dup the child handle to get separate handles for stdout and err, if (DuplicateHandle(GetCurrentProcess(), p_child_ph, // Source, GetCurrentProcess(), &errh, // Destination, 0, True, // Same access, inheritable DUPLICATE_SAME_ACCESS)); { /* Set up members of STARTUPINFO structure. */ memset(&si, 0, sizeof(si)); si.cb = sizeof(STARTUPINFO); si.lpReserved = NULL; si.lpReserved2 = NULL; si.cbReserved2 = 0; si.lpDesktop = NULL; /* si.dwFlags = STARTF_USESTDHANDLES; #if 1 si.hStdOutput = p_child_ph; si.hStdError = errh; si.hStdInput = INVALID_HANDLE_VALUE; #else si.hStdOutput = errh; si.hStdError = p_child_ph; si.hStdInput = INVALID_HANDLE_VALUE; #endif*/ if (CreateProcess(NULL, args, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) { ok = TRUE; CloseHandle(pi.hThread); // Thread handle not needed p_proc_h = pi.hProcess; // Return process handle (to get RC) } CloseHandle(errh); // Close error handle, } else dbm("DupHandle for stderr failed."); free(args); // Release command line. } // SetConsoleMode(horgout, ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT); //** And last but not least: close the child handle. CloseHandle(p_child_ph); p_child_ph = INVALID_HANDLE_VALUE; return ok; } void GPipe::closeProc() { /* * closeProc() gets called when a read fails. It assumes the process has * ended, retrieves the process return code, then it closes all handles. * The state is set to p_completed. */ DWORD ec; dbg("[closeProc] "); if (! GetExitCodeProcess(p_proc_h, &ec)) ec = 0xabcd; p_retcode = ec; // Save return code of process, if (p_proc_h != INVALID_HANDLE_VALUE) { // Close process, CloseHandle(p_proc_h); p_proc_h = INVALID_HANDLE_VALUE; } //** Close the main pipe, if (p_pipe_ph != INVALID_HANDLE_VALUE) { CloseHandle(p_pipe_ph); p_pipe_ph = INVALID_HANDLE_VALUE; } p_completed = TRUE; p_has_data = TRUE; } int GPipe::startRead() { /* * postRead() checks if an overlapped READ needs to be posted by checking * the io_posted flag. If that's clear and no termination or closed flag * is set then a new overlapped I/O request is issued. */ p_has_data = FALSE; dbg("[postRead "); if (p_io_posted || p_completed) dbg("no action: %s] ", p_io_posted ? "posted" : "complete"); else { p_ovl.hEvent = p_data_evh; // Signal this when done, if (!ReadFile(p_pipe_ph, p_buffer, p_buflen, &p_read_len, NULL)) { DWORD ec = GetLastError(); if (ec != ERROR_IO_PENDING) { //** Something's wrong. Treat as closed pipe for now. closeProc(); // Close pipe, complete stuff... dbg("postfail] "); return FALSE; // And return failure. } } p_io_posted = TRUE; // Handle pending ioresult. dbg("posted] "); } return TRUE; } int GPipe::open(char* command, EModel* notify) { memset(&p_ovl, 0, sizeof(p_ovl)); // Clear overlapped, p_bufused = 0; p_bufpos = 0; p_io_posted = FALSE; p_has_data = FALSE; p_completed = FALSE; // T if client closed. p_doterm = FALSE; p_buflen = PIPE_BUFLEN; p_notify = notify; p_doterm = FALSE; p_pipe_ph = INVALID_HANDLE_VALUE; p_child_ph = INVALID_HANDLE_VALUE; if ((p_command = strdup(command)) == 0) return -1; //** Allocate the read buffer; if ((p_buffer = (char*) malloc(p_buflen)) != 0) { if ((pipeDataRead = CreateEvent(0, 1, 0, 0)) == 0) { dbm("CreateEvent(data_evh) failed."); goto fail; } if ((pipeStartRead = CreateEvent(0, 1, 0, 0)) == 0) { dbm("CreateEvent(data_evh) failed."); goto fail; } if ((pipeMutex = CreateMutex(NULL, FALSE, NULL)) == NULL) { dbm("Failed pipe mutex"); goto fail; } else { if (createPipe()) { // Create server & client pipe. if (! postRead()) dbm("postRead() initial failed."); else { if (runCommand()) { p_used = TRUE; return p_id; } } releasePipe(); // Release pipes, } CloseHandle(p_data_evh); } free(p_buffer); } free(p_command); return -1; } int GPipe::close() { /* * close() disconnects from the spawned task, closes the pipe and releases * all stuff. */ if (! p_used) return -1; if (! p_completed) { // Overlapped I/O not complete yet? //** We *must* wait till the overlapped I/O completes, if (p_io_posted) { GetOverlappedResult(p_pipe_ph, &p_ovl, &p_read_len, TRUE); p_io_posted = FALSE; } } p_completed = TRUE; //** Now close all that might be pending, free(p_buffer); free(p_command); releasePipe(); // Close all pipe stuff, if (p_proc_h != INVALID_HANDLE_VALUE) { CloseHandle(p_proc_h); p_proc_h = INVALID_HANDLE_VALUE; } CloseHandle(pipeStartRead); CloseHandle(pipeDataRead); CloseHandle(pipeMutex); p_used = FALSE; return p_retcode; } int GPipe::read(void *buffer, int len) { /* * read() is called to get the current data from the pipe. It takes the * #bytes read and returns them. It returns data till the buffer is * exhausted. If the process is completed it returns -1; else it returns * the #bytes read. It returns 0 if the buffer's empty. */ dbg("[read "); if (p_has_data) { if (p_bufpos < p_read_len) { // Data in buffer? unsigned l; l = p_read_len - p_bufpos; // Try to output all, if (l > len) l = len; memcpy(buffer, p_buffer + p_bufpos, l); // Copy data from the buffer, p_bufpos += l; dbg("%u data] ", l); return l; // Data returned, } //** There's nothing left in the buffer. Is the task complete? if (p_completed) { dbg("no data, complete] "); return -1; } if (! postRead()) { dbg("post failed-> complete] "); return -1; } dbg("nodata, post] "); return 0; } else if (p_completed) { dbg("completed] "); return -1; } dbg("nothing] "); return 0; } int GPipe::getEvent(TEvent* event) { dbg("[getpipeevent: "); event->What = evNone; if (! p_used || p_notify == 0) return 0; // No data. if (! handlePost()) return 0; // Again: no data, //** This pipe has data! event->What = evNotify; event->Msg.View = 0; event->Msg.Model = p_notify; event->Msg.Command = cmPipeRead; event->Msg.Param1 = p_id; dbg("ok] "); return 1; } /* * NT Pipe handler - overview * ========================== * The NT pipe handler uses overlapped I/O to read console events. * * OpenPipe(): * When the pipe is opened, one of the pipe structures is allocated and set * to used. Then an event semaphore (reset_manual) is created. This semaphore * will be signalled when data is available on the input pipe which gathers * the spawned tasks's output. * * Then a pipe is created, opened for the client side and stdout and stderr * are redirected therein. After that the client task is spawned. * * If the spawn succeeds an overlapped READ is posted for the pipe; then the * OpenPipe function returns. * * ConGetEvent(): * The ConGetEvent() handler does a WaitForMultipleObjects() on the console * handle and all pipe handles currently active. If a pipe has data the * overlapped result is gotten, and the output is sent to the message window. * Then, if the thread didn't finish, a new overlapped read is posted. * * */ int GUI::OpenPipe(char *Command, EModel *notify) { GPipe* gp; if ((gp = GPipe::getFreePipe()) == 0) return -1; // Out of pipes. return gp->open(Command, notify); // And ask the pipe to init. } int GUI::SetPipeView(int id, EModel *notify) { GPipe* p; if ((p = GPipe::getPipe(id)) == 0) return -1; p->lock(); p->p_notify = notify; p->unlock(); return 0; } int GUI::ReadPipe(int id, void *buffer, int len) { //int l; GPipe* p; if ((p = GPipe::getPipe(id)) == 0) return -1; return p->read(buffer, len); } int GUI::ClosePipe(int id) { GPipe* p; if ((p = GPipe::getPipe(id)) == 0) return -1; return p->close(); } static int GetPipeEvent(int id, TEvent *Event) { //int i; GPipe* p; if ((p = GPipe::getPipe(id)) == 0) return -1; return p->getEvent(Event); } #else #define MAX_PIPES 4 #define PIPE_BUFLEN 4096 typedef struct { int used; int id; int reading, stopped; HANDLE Thread; HANDLE Access; HANDLE ResumeRead; HANDLE NewData; char *buffer; int buflen; int bufused; int bufpos; EModel *notify; char *Command; DWORD RetCode; int DoTerm; } GPipe; static GPipe Pipes[MAX_PIPES] = { { 0 }, { 0 }, { 0 }, { 0 } }; static int CreatePipeChild(HANDLE &child, HANDLE &hPipe, char *Command) { //static int PCount = 0; int arglen = 0; HANDLE hChildPipe; BOOL rc; SECURITY_ATTRIBUTES sa; sa.nLength = sizeof(sa); // Security descriptor for INHERIT. sa.lpSecurityDescriptor = 0; sa.bInheritHandle = 1; rc = CreatePipe(&hPipe, &hChildPipe, &sa, 0); if (rc != TRUE) return -1; int ok; char* comspec, *args, tbuf[256]; //HANDLE errh; PROCESS_INFORMATION pi; STARTUPINFO si; HANDLE hNul; const char nt4[] = "4nt.exe"; ok = FALSE; comspec = getenv("COMSPEC"); /* * BUG workaround: When using 4NT, it doesn't properly reassign stderr! * This is a bug in 4NT, so if comspec *is* 4nt use cmd.exe instead... */ if (comspec == 0) return -1; int l = strlen(comspec); if (strnicmp(comspec + (l - sizeof(nt4) + 1), nt4, sizeof(nt4) - 1) == 0) { //** It's 4DOS all right.. args = getenv("SystemRoot"); if (args == 0) return -1; strlcpy(tbuf, args, sizeof(tbuf)); // Get to c:\winnt strlcat(tbuf, "\\system32\\cmd.exe", sizeof(tbuf)); comspec = tbuf; } int argslen = strlen(comspec) + strlen(Command) + 120; args = (char *)malloc(argslen); if (args == 0) dbm("malloc() failed for command line.."); else { //** Form a command line for the process; strlcpy(args, comspec, argslen); strlcat(args, " /c ", argslen); strlcat(args, Command, argslen); //** Dup the child handle to get separate handles for stdout and err, /*if (DuplicateHandle(GetCurrentProcess(), hChildPipe, GetCurrentProcess(), &errh, 0, True, DUPLICATE_SAME_ACCESS))*/ //fprintf(stderr, "open NUL\n"); hNul = CreateFile("NUL", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); //fprintf(stderr, "starting %s\n", args); if (hNul != NULL) { /* Set up members of STARTUPINFO structure. */ memset(&si, 0, sizeof(si)); si.cb = sizeof(STARTUPINFO); si.lpReserved = NULL; si.lpReserved2 = NULL; si.cbReserved2 = 0; si.lpDesktop = NULL; si.dwFlags = STARTF_USESTDHANDLES; #if 1 si.hStdOutput = hChildPipe; si.hStdError = hChildPipe; si.hStdInput = hNul;//INVALID_HANDLE_VALUE; #else si.hStdOutput = errh; si.hStdError = hChildPipe; si.hStdInput = INVALID_HANDLE_VALUE; #endif if (CreateProcess(NULL, args, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi) == TRUE) { ok = TRUE; CloseHandle(pi.hThread); // Thread handle not needed //fprintf(stderr, "create process success\n"); child = pi.hProcess; // Return process handle (to get RC) } else //fprintf(stderr, "create process failed %d\n" + GetLastError()); CloseHandle(hNul); // Close error handle, } else dbm("DupHandle for stderr failed."); free(args); } CloseHandle(hChildPipe); return 0; } static DWORD __stdcall PipeThread(void *p) { GPipe *pipe = (GPipe *)p; BOOL rc; DWORD used; HANDLE child; HANDLE hfPipe; rc = CreatePipeChild(child, hfPipe, pipe->Command); if (rc != 0) { //fprintf(stderr, "Failed CreatePipeChild\n"); WaitForSingleObject(pipe->Access, INFINITE); pipe->reading = 0; SetEvent(pipe->NewData); ReleaseMutex(pipe->Access); return 0xFFFFFFFF; } //fprintf(stderr, "Pipe: Begin: %d %s\n", pipe->id, pipe->Command); while (1) { //fprintf(stderr, "Waiting on pipe\n"); rc = ReadFile(hfPipe, pipe->buffer, pipe->buflen, &used, NULL); if (rc != TRUE) { //fprintf(stderr, "ReadFile failed %d %ld", GetLastError(), used); used = 0; } WaitForSingleObject(pipe->Access, INFINITE); //fprintf(stderr, "Waiting on mutex\n"); pipe->bufused = used; //fprintf(stderr, "Pipe: fread: %d %d\n", pipe->id, pipe->bufused); ResetEvent(pipe->ResumeRead); if (pipe->bufused == 0) break; if (pipe->notify) { SetEvent(pipe->NewData); pipe->stopped = 0; } ReleaseMutex(pipe->Access); if (pipe->DoTerm) break; //fprintf(stderr, "Waiting on sem\n"); WaitForSingleObject(pipe->ResumeRead, INFINITE); //fprintf(stderr, "Read: Released mutex\n"); if (pipe->DoTerm) break; } CloseHandle(hfPipe); //fprintf(stderr, "Pipe: pClose: %d\n", pipe->id); rc = WaitForSingleObject(child, INFINITE); GetExitCodeProcess(child, &pipe->RetCode); CloseHandle(child); pipe->reading = 0; SetEvent(pipe->NewData); ReleaseMutex(pipe->Access); //fprintf(stderr, "Read: Released mutex\n"); return 0; } int GUI::OpenPipe(char *Command, EModel *notify) { int i; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) { Pipes[i].reading = 1; Pipes[i].stopped = 1; Pipes[i].id = i; Pipes[i].bufused = 0; Pipes[i].bufpos = 0; Pipes[i].buflen = PIPE_BUFLEN; Pipes[i].Command = strdup(Command); Pipes[i].notify = notify; Pipes[i].DoTerm = 0; if ((Pipes[i].buffer = (char *)malloc(PIPE_BUFLEN)) == 0) return -1; if ((Pipes[i].Access = CreateMutex(NULL, FALSE, NULL)) == NULL) { free(Pipes[i].Command); free(Pipes[i].buffer); return -1; } if ((Pipes[i].ResumeRead = CreateEvent(0, 1, 0, 0)) == NULL) { free(Pipes[i].Command); free(Pipes[i].buffer); CloseHandle(Pipes[i].Access); return -1; } if ((Pipes[i].NewData = CreateEvent(0, 1, 0, 0)) == NULL) { free(Pipes[i].Command); free(Pipes[i].buffer); CloseHandle(Pipes[i].ResumeRead); CloseHandle(Pipes[i].Access); return -1; } DWORD tid; if ((Pipes[i].Thread = CreateThread(NULL, 32768, &PipeThread, &Pipes[i], 0, &tid)) == NULL) { free(Pipes[i].Command); free(Pipes[i].buffer); CloseHandle(Pipes[i].ResumeRead); CloseHandle(Pipes[i].Access); CloseHandle(Pipes[i].NewData); return -1; } Pipes[i].used = 1; //fprintf(stderr, "Pipe Open: %d\n", i); return i; } } return -1; } int GUI::SetPipeView(int id, EModel *notify) { if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; WaitForSingleObject(Pipes[id].Access, INFINITE); //fprintf(stderr, "Pipe View: %d %08X\n", id, notify); Pipes[id].notify = notify; ReleaseMutex(Pipes[id].Access); return 0; } int GUI::ReadPipe(int id, void *buffer, int len) { int l; //ULONG ulPostCount; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; //fprintf(stderr, "Read: Waiting on mutex\n"); //ConContinue(); WaitForSingleObject(Pipes[id].Access, INFINITE); //fprintf(stderr, "Pipe Read: Get %d %d\n", id, len); if (Pipes[id].bufused - Pipes[id].bufpos > 0) { l = len; if (l > Pipes[id].bufused - Pipes[id].bufpos) { l = Pipes[id].bufused - Pipes[id].bufpos; } memcpy(buffer, Pipes[id].buffer + Pipes[id].bufpos, l); Pipes[id].bufpos += l; if (Pipes[id].bufpos == Pipes[id].bufused) { Pipes[id].bufused = 0; Pipes[id].bufpos = 0; //fprintf(stderr, "Pipe Resume Read: %d\n", id); Pipes[id].stopped = 1; //fprintf(stderr, "Read: posting sem\n"); SetEvent(Pipes[id].ResumeRead); } } else if (Pipes[id].reading == 0) l = -1; else { l = 0; // DosBeep(200, 200); } //fprintf(stderr, "Pipe Read: Got %d %d\n", id, l); ReleaseMutex(Pipes[id].Access); //fprintf(stderr, "Read: Released mutex\n"); return l; } int GUI::ClosePipe(int id) { if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; if (Pipes[id].reading == 1) { Pipes[id].DoTerm = 1; SetEvent(Pipes[id].ResumeRead); WaitForSingleObject(&Pipes[id].Thread, INFINITE); } free(Pipes[id].buffer); free(Pipes[id].Command); CloseHandle(Pipes[id].NewData); CloseHandle(Pipes[id].ResumeRead); CloseHandle(Pipes[id].Access); CloseHandle(Pipes[id].Thread); //fprintf(stderr, "Pipe Close: %d\n", id); Pipes[id].used = 0; //ConContinue(); return Pipes[id].RetCode; } int GetPipeEvent(int i, TEvent *Event) { Event->What = evNone; if (Pipes[i].used == 0) return 0; if (Pipes[i].notify == 0) return 0; ResetEvent(Pipes[i].NewData); //fprintf(stderr, "Pipe New Data: %d\n", i); Event->What = evNotify; Event->Msg.View = 0; Event->Msg.Model = Pipes[i].notify; Event->Msg.Command = cmPipeRead; Event->Msg.Param1 = i; return 1; } #endif int ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete) { //** Any saved events left? if (EventBuf.What != evNone) { *Event = EventBuf; if (Delete) EventBuf.What = evNone; return 0; } if (MouseEv.What != evNone) { *Event = MouseEv; if (Delete) MouseEv.What = evNone; return 0; } //** Now block and wait for a new event on the console handle and all pipes, HANDLE o_ar[1 + MAX_PIPES]; DWORD rc; int i, nh; EventBuf.What = evNone; Event->What = evNone; //** Fill the handle array with all active handles for pipes && console, o_ar[0] = ConIn; for (i = 0, nh = 1; i < MAX_PIPES; i++) { // For all possible pipes if (Pipes[i].used) o_ar[nh++] = Pipes[i].NewData; } for (;;) { rc = WaitForMultipleObjects(nh, o_ar, FALSE, WaitTime); if (rc != WAIT_FAILED && (rc >= WAIT_OBJECT_0 && rc < WAIT_OBJECT_0 + nh)) { i = rc - WAIT_OBJECT_0; // Get item that signalled new data if (i == 0) { // Was console? if (ReadConsoleEvent(Event)) // Get console, return 0; // And exit if valid, } else { GetPipeEvent(i - 1, Event); // Read data from pipe. return 0; } } else return -1; // Something's wrong! } } #include "clip.h" int GetClipText(ClipData *cd) { int rc = -1; cd->fLen = 0; cd->fChar = NULL; if (OpenClipboard(NULL)) { HANDLE hmem; if ((hmem = GetClipboardData(CF_TEXT)) != NULL) { LPVOID data; if ((data = GlobalLock(hmem)) != NULL) { int len = strlen((char *)data); cd->fChar = (char *)malloc(len); if (cd->fChar != NULL) { cd->fLen = len; memcpy(cd->fChar, data, len); rc = 0; } GlobalUnlock(hmem); } } CloseClipboard(); } return rc; } int PutClipText(ClipData *cd) { int rc = -1; if (OpenClipboard(NULL)) { if (EmptyClipboard()) { HGLOBAL hmem; if ((hmem = GlobalAlloc(GMEM_MOVEABLE, cd->fLen + 1)) != NULL) { LPVOID data; if ((data = GlobalLock(hmem)) != NULL) { memcpy(data, cd->fChar, cd->fLen); ((char *)data)[cd->fLen] = 0; GlobalUnlock(hmem); if (SetClipboardData(CF_TEXT, hmem)) { rc = 0; } } } } CloseClipboard(); } return rc; } efte-1.1/src/h_simple.cpp0000664000076400007640000002316111041404761014416 0ustar laurilauri/* h_simple.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int Hilit_SIMPLE(EBuffer *BF, int LN, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { EColorize *col = BF->Mode->fColorize; HMachine *hm = col->hm; HILIT_VARS(col->Colors, Line); HState *st = 0; HTrans *tr = 0; int t, cc; int quotech = 0; int matchFlags; int matchLen; int nextState; char *match; int lastPos = -1; hlState entryState; int iterCount; bool reportError = true; if (hm == 0 || hm->stateCount == 0) return 0; if (State >= hm->stateCount) State = 0; st = hm->state + State; Color = st->color; /*{ fprintf(stderr, "ColMode:%s, State:%d\n", col->Name, State); for (int s = 0; s < hm->stateCount; s++) { fprintf(stderr, "State:%d, transCount:%d, firstTrans:%d, options:%d, color:%d, nextState:%d\n", s, hm->state[s].transCount, hm->state[s].firstTrans, hm->state[s].options, hm->state[s].color, hm->state[s].nextState); } for (int t = 0; t < hm->transCount; t++) { fprintf(stderr, "Trans:%d, matchLen:%d, matchFlags:%d, nextState:%d, color:%d\n", t, hm->trans[t].matchLen, hm->trans[t].matchFlags, hm->trans[t].nextState, hm->trans[t].color); } //exit(1); sleep(5); }*/ for (i = 0; i < Line->Count;) { // Check for infinite loops if (i == lastPos) { if (++iterCount > hm->stateCount) { // Passed the same position more times than number of states -> must be looping if (reportError) { // Report only once per line since other errors may be false alarms caused by hiliter restart reportError = false; BF->Msg(S_INFO, "Hiliter looping at line %d, column %d, entry state %d", LN + 1, i + 1, entryState); } else { // Already reported - advance by one character Color = hm->state[entryState].color; IF_TAB() else ColorNext(); } // Restart with state 0 State = 0; st = hm->state; iterCount = 1; goto next_state; } } else { lastPos = i; entryState = State; iterCount = 1; } if (quotech) { quotech = 0; } else { for (t = 0; t < st->transCount; t++) { tr = hm->trans + st->firstTrans + t; matchLen = tr->matchLen; matchFlags = tr->matchFlags; match = tr->match; nextState = tr->nextState; //fprintf(stderr, // "line:%d, char:%d (%c), len:%d, state:%d, tr:%d, st->transCount:%d, st->firstTrans:%d, nextState:%d, matchFlags:%08x\n", // LN, i, *p, len, State, t, st->transCount, st->firstTrans, nextState, matchFlags); if (len < matchLen) continue; if ((i > 0) && (matchFlags & MATCH_MUST_BOL)) continue; if ((matchFlags & (MATCH_SET | MATCH_NOTSET)) == 0) { if (matchFlags & MATCH_REGEXP) { RxMatchRes b; if (!RxExecMatch(tr->regexp, Line->Chars, Line->Count, p, &b, (matchFlags & MATCH_NO_CASE) ? 0 : RX_CASE)) continue; if (b.Open[1] != -1 && b.Close[1] != -1) matchLen = b.Open[1] - i; else matchLen = b.Close[0] - i; } else if (matchFlags & MATCH_NO_CASE) { if (memicmp(match, p, matchLen)) continue; } else { for (cc = 0; cc < matchLen; cc++) if (p[cc] != match[cc]) goto next_trans; } } else if (matchFlags & MATCH_SET) { if (!WGETBIT(match, *p)) continue; } else if (matchFlags & MATCH_NOTSET) { if (WGETBIT(match, *p)) continue; } if ((len != matchLen) && (matchFlags & MATCH_MUST_EOL)) continue; if (matchFlags & MATCH_NOGRAB) { State = nextState; if (State >= hm->stateCount) State = 0; st = hm->state + State; //fprintf(stderr, "nograb\n"); } else { if (matchFlags & MATCH_TAGASNEXT) { State = nextState; if (State >= hm->stateCount) State = 0; st = hm->state + State; } Color = tr->color; for (cc = 0; cc < matchLen; cc++) IF_TAB() else ColorNext(); if (!(matchFlags & MATCH_TAGASNEXT)) { State = nextState; if (State >= hm->stateCount) State = 0; st = hm->state + State; } if (len > 0) { if (matchFlags & MATCH_QUOTECH) quotech = 1; } else if (len == 0) { if (matchFlags & MATCH_QUOTEEOL) goto end_parse; /* see note below !! */ } } //fprintf(stderr, "next state\n"); goto next_state; next_trans: /* */ ; } if (st->wordChars != 0) { int j; hlState MState = State; j = 0; while (((i + j) < Line->Count) && (WGETBIT(st->wordChars, Line->Chars[i + j]))) j++; //GP (fix) Color = st->color; if (j == 0) { if (st->nextKwdNoCharState != -1) { State = st->nextKwdNoCharState; if (State >= hm->stateCount) State = 0; st = hm->state + State; Color = st->color; goto next_state; } } else { if (st->GetHilitWord(j, &Line->Chars[i], Color) || BF->GetHilitWord(j, &Line->Chars[i], Color, BFI(BF, BFI_MatchCase) ? 0 : 1)) { if (st->nextKwdMatchedState != -1) State = st->nextKwdMatchedState; } else { if (st->nextKwdNotMatchedState != -1) { State = st->nextKwdNotMatchedState; if (st->options & STATE_NOGRAB) { if (State >= hm->stateCount) State = 0; st = hm->state + State; Color = st->color; goto next_state; } } } if (State >= hm->stateCount) State = 0; // highlight/tag as next state if (st->options & STATE_TAGASNEXT) { MState = State; st = hm->state + State; Color = st->color; } if (StateMap) memset(StateMap + i, MState, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; if (!(st->options & STATE_TAGASNEXT)) { st = hm->state + State; Color = st->color; } goto next_state; } } } Color = st->color; IF_TAB() else ColorNext(); next_state: /* */ ; } /* check if there are any matches for EOL */ /* NOTE: this is skipped when Q option is used above. !! */ for (t = 0; t < st->transCount; t++) { tr = hm->trans + st->firstTrans + t; matchLen = tr->matchLen; matchFlags = tr->matchFlags; match = tr->match; nextState = tr->nextState; if (((i > 0) && (matchFlags & MATCH_MUST_BOL)) || (matchFlags & MATCH_REGEXP)) continue; //cant match eol beyond eol. //if ((len != matchLen) && (matchFlags & MATCH_MUST_EOL)) //continue; if (matchLen == 0) { State = nextState; if (State >= hm->stateCount) State = 0; break; } } end_parse: ; *ECol = C; return 0; } efte-1.1/src/h_catbs.cpp0000664000076400007640000000272611041404761014225 0ustar laurilauri/* h_catbs.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #define hsBS_Normal 1 // this is for viewing only, do not try to edit or anything. int Hilit_CATBS(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); int CL = 0; //(LN == BF->VToR(BF->CP.Row)) ? 1 : 0; for (i = 0; i < Line->Count;) { IF_TAB() else { switch (State) { default: case hsBS_Normal: Color = CLR_Normal; while (!CL && len >= 2 && p[1] == '\b') { if (len > 2 && p[0] == p[2]) { // bold Color = CLR_Keyword; NextChar(); NextChar(); C -= 2; } else if (p[0] == '_') { // underline Color = CLR_Symbol; NextChar(); NextChar(); C -= 2; break; } else break; } ColorNext(); continue; } } } *ECol = C; return 0; } efte-1.1/src/o_svndiff.h0000664000076400007640000000211711041404761014236 0ustar laurilauri/* * o_svndiff.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * S.Pinigin copy o_cvsdiff.h and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Class showing output from SVN diff command. Allows copying of lines * to clipboard and allows to jump to lines in real sources. */ #ifndef __SVNDIFF_H__ #define __SVNDIFF_H__ class ESvnDiff: public ESvnBase { public: int CurrLine, ToLine, InToFile; char *CurrFile; ESvnDiff(int createFlags, EModel **ARoot, char *Dir, char *ACommand, char *AOnFiles); ~ESvnDiff(); void ParseFromTo(char *line, int len); virtual void ParseLine(char *line, int len); // Returns 0 if OK virtual int RunPipe(char *Dir, char *Command, char *Info); virtual int ExecCommand(int Command, ExState &State); int BlockCopy(int Append); virtual int GetContext() { return CONTEXT_SVNDIFF; } virtual EEventMap *GetEventMap(); }; extern ESvnDiff *SvnDiffView; #endif efte-1.1/src/h_rexx.cpp0000664000076400007640000003667011041404761014124 0ustar laurilauri/* h_rexx.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #define hsREXX_Normal 0 #define hsREXX_Comment 1 #define hsREXX_String1 3 #define hsREXX_String2 4 #define hsREXX_Keyword 5 #define hsREXX_CommentL 6 int Hilit_REXX(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { int j = 0; int firstnw = 0; HILIT_VARS(BF->Mode->fColorize->Colors, Line); int wascall = 0; C = 0; NC = 0; for (i = 0; i < Line->Count;) { if (*p != ' ' && *p != 9) firstnw++; IF_TAB() else { switch (State) { case hsREXX_Comment: Color = CLR_Comment; if ((len >= 2) && (*p == '*') && (*(p + 1) == '/')) { ColorNext(); set_normal: ColorNext(); State = hsREXX_Normal; continue; } goto hilit; case hsREXX_String1: Color = CLR_String; if (*p == '\'') { goto set_normal; } goto hilit; case hsREXX_String2: Color = CLR_String; if (*p == '"') { goto set_normal; } goto hilit; default: case hsREXX_Normal: if (isalpha(*p) || (*p == '_')) { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_')) ) j++; if (wascall) { State = hsREXX_Normal; Color = CLR_Function; wascall = 0; } else { if (BF->GetHilitWord(j, Line->Chars + i, Color, 1)) State = hsREXX_Keyword; else { int x; x = i + j; if ((x < Line->Count) && (Line->Chars[x] == '(')) { Color = CLR_Function; } else { Color = CLR_Normal; } State = hsREXX_Normal; } } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); if (State == hsREXX_Keyword) if (strnicmp(Line->Chars + i, "CALL", 4) == 0) wascall = 1; i += j; len -= j; p += j; C += j; State = hsREXX_Normal; continue; } else if ((len >= 2) && ((*p == '/') && (*(p + 1) == '*'))) { State = hsREXX_Comment; Color = CLR_Comment; //hilit2: ColorNext(); hilit: ColorNext(); continue; } else if ((len >= 2) && (*p == '-') && (p[1] == '-')) { State = hsREXX_CommentL; Color = CLR_Comment; ColorNext(); ColorNext(); continue; } else if (isdigit(*p)) { Color = CLR_Number; ColorNext(); while (len && isdigit(*p)) ColorNext(); continue; } else if (*p == '\'') { State = hsREXX_String1; Color = CLR_String; goto hilit; } else if (*p == '"') { State = hsREXX_String2; Color = CLR_String; goto hilit; } else if (ispunct(*p) && *p != '_') { Color = CLR_Punctuation; goto hilit; } Color = CLR_Normal; goto hilit; case hsREXX_CommentL: Color = CLR_Comment; goto hilit; } } } switch (State) { case hsREXX_String1: case hsREXX_String2: case hsREXX_CommentL: State = hsREXX_Normal; break; } *ECol = C; return 0; } int REXX_Base_Indent = 4; int REXX_Do_Offset = 0; #define REXX_BASE_INDENT REXX_Base_Indent #define REXX_DO_OFFSET REXX_Do_Offset static int Match(int Len, int Pos, hsState *StateMap, const char *Text, const char *String, hsState State) { int L = strlen(String); if (Pos + L <= Len) if (StateMap == NULL || IsState(StateMap + Pos, State, L)) if (strnicmp(String, Text + Pos, L) == 0) return 1; return 0; } static int Match2(int Len, int Pos, hsState *StateMap, const char *Text, const char *String, hsState State) { int L = strlen(String); int i; for (i = 0; i < Pos; i++) if (Text[i] != ' ') return 0; if (Pos + L <= Len) if (StateMap == NULL || IsState(StateMap + Pos, State, L)) if (strnicmp(String, Text + Pos, L) == 0) return 1; return 0; } static int SearchMatch(int Count, EBuffer *B, int Row, int Ctx) { char *P; int L; int Pos; int StateLen; hsState *StateMap; int ICount = (Ctx == 2) ? Count : 0; Count = (Ctx == 2) ? 0 : Count; // Check all previous rows of the buffer for a matching "starting" keyword. // Count gives the "depth" we are in, must reach 0. // Ctx == 1 means we are looking for a mate for "end" // Ctx == 2 means we are looking for a mate for "else" // We try to find the indent of the line that "started" this "block" and return it. while (Row >= 0) { P = B->RLine(Row)->Chars; L = B->RLine(Row)->Count; StateMap = NULL; if (B->GetMap(Row, &StateLen, &StateMap) == 0) return -1; Pos = L - 1; if (L > 0) while (Pos >= 0) { if (isalpha(P[Pos])) { if (Ctx == 1 || Ctx == 3) { if (Match(L, Pos, StateMap, P, "do", hsREXX_Keyword) || Match(L, Pos, StateMap, P, "loop", hsREXX_Keyword) || Match(L, Pos, StateMap, P, "select", hsREXX_Keyword)) { Count++; if (Count == 0) { if (StateMap) free(StateMap); if (Ctx == 3) return B->LineIndented(Row); else return B->LineIndented(Row) + REXX_BASE_INDENT; } } else if (Match(L, Pos, StateMap, P, "end", hsREXX_Keyword)) { Count--; } } else if (Ctx == 4) { if (Match2(L, Pos, StateMap, P, "class", hsREXX_Keyword)) { if (StateMap) free(StateMap); return B->LineIndented(Row) + REXX_BASE_INDENT; } } if (Ctx == 2 && Count == 0) { if (Match(L, Pos, StateMap, P, "if", hsREXX_Keyword)) { ICount++; if (ICount == 0) { if (StateMap) free(StateMap); return B->LineIndented(Row); } } else if (Match(L, Pos, StateMap, P, "else", hsREXX_Keyword)) { ICount--; } } } Pos--; } if (StateMap) free(StateMap); Row--; } return -1; } static int CheckLabel(EBuffer *B, int Line) { PELine L = B->RLine(Line); int P = B->CharOffset(L, B->LineIndented(Line)); int Cnt = 0; if (Line > 0 && B->RLine(Line - 1)->StateE != hsREXX_Normal) return 0; while ((P < L->Count) && (L->Chars[P] == ' ' || L->Chars[P] == 9)) P++; while (P < L->Count) { if (Cnt > 0) if (L->Chars[P] == ':') return 1; if (!(isalnum(L->Chars[P]) || (L->Chars[P] == '_'))) return 0; Cnt++; P++; } return 0; } static int SearchBackContext(EBuffer *B, int Row, char &ChFind) { char *P; int L; int Pos; int Count = -1; int StateLen; hsState *StateMap; int is_blank = 0; ChFind = '0'; while (Row >= 0) { P = B->RLine(Row)->Chars; L = B->RLine(Row)->Count; StateMap = NULL; if (B->GetMap(Row, &StateLen, &StateMap) == 0) return 0; Pos = L - 1; if (L > 0) while (Pos >= 0) { if (CheckLabel(B, Row) == 1) { Count++; ChFind = 'p'; if (Count == 0) { if (StateMap) free(StateMap); return B->LineIndented(Row); } } if (isalpha(P[Pos]) && (Pos == 0 || !isalpha(P[Pos - 1]))) { if (Match(L, Pos, StateMap, P, "do", hsREXX_Keyword) || Match(L, Pos, StateMap, P, "loop", hsREXX_Keyword)) { Count++; ChFind = 'd'; //} else if (Match(L, Pos, StateMap, P, "procedure", hsREXX_Keyword)) { //Count++; //ChFind = 'p'; } else if (Match(L, Pos, StateMap, P, "select", hsREXX_Keyword)) { Count++; ChFind = 's'; } else if (Match(L, Pos, StateMap, P, "method", hsREXX_Keyword)) { Count++; ChFind = 'm'; } else if (Match(L, Pos, StateMap, P, "properties", hsREXX_Keyword)) { Count++; ChFind = 'r'; } else if (Match2(L, Pos, StateMap, P, "class", hsREXX_Keyword)) { Count++; ChFind = 'c'; if (StateMap) free(StateMap); return B->LineIndented(Row) + REXX_BASE_INDENT; } else if (Match(L, Pos, StateMap, P, "otherwise", hsREXX_Keyword) && Count == 0) { //Count++; ChFind = 'o'; if (StateMap) free(StateMap); return B->LineIndented(Row); } else if (Match(L, Pos, StateMap, P, "end", hsREXX_Keyword)) { Count--; ChFind = 'e'; } else if (is_blank < 5 && Match(L, Pos, StateMap, P, "then", hsREXX_Keyword)) { ChFind = 't'; if (StateMap) free(StateMap); return B->LineIndented(Row); } else if (is_blank < 5 && Match(L, Pos, StateMap, P, "else", hsREXX_Keyword)) { ChFind = 'e'; if (StateMap) free(StateMap); return B->LineIndented(Row); } else { is_blank++; Pos--; continue; } if (Count == 0) { if (StateMap) free(StateMap); return B->LineIndented(Row); } } if (P[Pos] != ' ' && P[Pos] != 9) is_blank++; Pos--; } if (StateMap) free(StateMap); Row--; } return -1; } static int IndentComment(EBuffer *B, int Row, int /*StateLen*/, hsState * /*StateMap*/) { int I = 0; char ChFind; if (Row > 0) { I = SearchBackContext(B, Row - 1, ChFind); if (I != -1) switch (ChFind) { case 's': case 'd': case 'c': case 't': case 'e': case 'o': // case 'r': // case 'm': I += REXX_BASE_INDENT; } else I = 0; if (B->RLine(Row - 1)->StateE == hsREXX_Comment) //if (LookAt(B, Row - 1, I, "/*", hsREXX_Comment, 0)) I += 1; } return I; } static int IndentNormal(EBuffer *B, int Line, int /*StateLen*/, hsState * /*StateMap*/) { int I = 0; if (CheckLabel(B, Line)) { return 0; } else if (LookAtNoCase(B, Line, 0, "end", hsREXX_Keyword)) { return SearchMatch(-1, B, Line - 1, 1); } else if (LookAtNoCase(B, Line, 0, "else", hsREXX_Keyword)) { return SearchMatch(-1, B, Line - 1, 2); } else if (LookAtNoCase(B, Line, 0, "catch", hsREXX_Keyword)) { return SearchMatch(-1, B, Line - 1, 3); } else if (LookAtNoCase(B, Line, 0, "method", hsREXX_Keyword) || LookAtNoCase(B, Line, 0, "properties", hsREXX_Keyword)) { return SearchMatch(-1, B, Line - 1, 4); } else { char ChFind; I = SearchBackContext(B, Line - 1, ChFind); if (I == -1) return 0; switch (ChFind) { case 'p': if (LookAtNoCase(B, Line, 0, "return", hsREXX_Keyword)) return I; else return I + REXX_BASE_INDENT; case 's': case 'd': case 'c': case 'r': case 'm': return I + REXX_BASE_INDENT; case 't': case 'e': case 'o': if (LookAtNoCase(B, Line, 0, "do", hsREXX_Keyword)) return I + REXX_DO_OFFSET; else return I + REXX_BASE_INDENT; default: return I; } } } int Indent_REXX(EBuffer *B, int Line, int PosCursor) { int I; hsState *StateMap = NULL; int StateLen = 0; int OI; OI = I = B->LineIndented(Line); if (I != 0) B->IndentLine(Line, 0); if (B->GetMap(Line, &StateLen, &StateMap) == 0) return 0; if (StateLen > 0) { // line is not empty if (StateMap[0] == hsREXX_Comment) { I = IndentComment(B, Line, StateLen, StateMap); } else { I = IndentNormal(B, Line, StateLen, StateMap); } } else { I = IndentNormal(B, Line, 0, NULL); } if (StateMap) free(StateMap); if (I >= 0) B->IndentLine(Line, I); else I = 0; if (PosCursor == 1) { int X = B->CP.Col; X = X - OI + I; if (X < I) X = I; if (X < 0) X = 0; if (X > B->LineLen(Line)) { X = B->LineLen(Line); if (X < I) X = I; } if (B->SetPosR(X, Line) == 0) return 0; } else if (PosCursor == 2) { if (B->SetPosR(I, Line) == 0) return 0; } return 1; } efte-1.1/src/con_i18n.h0000664000076400007640000000205511041404761013700 0ustar laurilauri/* * con_i18n.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __CONI18N_H__ #define __CONI18N_H__ #include #include /* * For now the only supported input style is root !!! * in future this should be read from resources */ #define XIM_INPUT_STYLE "Root" struct remapKey { KeySym key_english; KeySym key_remap; }; struct keyboardRec { struct remapKey *tab; KeySym deadkey; short next; }; typedef struct { XIC xic; #if XlibSpecificationRelease >= 6 XIM xim; XIMStyles* xim_styles; XIMStyle input_style; #endif } i18n_context_t; /* * prototypes for I18N functions */ void i18n_focus_out(i18n_context_t*); void i18n_focus_in(i18n_context_t*); int i18n_lookup_sym(XKeyEvent *, char *, int, KeySym *, XIC); i18n_context_t* i18n_open(Display *, Window, unsigned long *); void i18n_destroy(i18n_context_t**); #endif efte-1.1/src/g_nodlg.cpp0000664000076400007640000000204011041404761014220 0ustar laurilauri/* * g_nodlg.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // used in text mode versions, should never be called (just for linking) #include #include #include "console.h" #include "gui.h" int DLGGetFile(GView * /*v*/, const char * /*Prompt*/, unsigned int /*BufLen*/, char * /*FileName*/, int /*Flags*/) { assert(1 == 0); return 0; } int DLGPickChoice(GView * /*v*/, const char * /*ATitle*/, int /*NSel*/, va_list /*ap*/, int /*Flags*/) { assert(1 == 0); return 0; } int DLGGetFind(GView * /*View*/, SearchReplaceOptions &/*sr*/) { assert(1 == 0); return 0; } int DLGGetFindReplace(GView * /*View*/, SearchReplaceOptions &/*sr*/) { assert(1 == 0); return 0; } int DLGGetStr(GView * /*View*/, const char * /*Prompt*/, unsigned int /*BufLen*/, char * /*Str*/, int /*HistId*/, int /*Flags*/) { assert(1 == 0); return 0; } efte-1.1/src/s_util.h0000664000076400007640000000154111041404761013560 0ustar laurilauri/* s_util.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __S_UTIL_H__ #define __S_UTIL_H__ #define USE_CtrlEnter 1 #define S_BUSY 0 #define S_INFO 1 #define S_BOLD 2 #define S_ERROR 3 class EView; class EBuffer; class EModel; char* MakeBackup(char *FileName, char *NewName); int GetPMClip(int clipboard); int PutPMClip(int clipboard); int FileLoad(int createFlags, const char *FileName, const char *Mode, EView *View); int MultiFileLoad(int createFlags, const char *FileName, const char *Mode, EView *View); int SetDefaultDirectory(EModel *M); int GetDefaultDirectory(EModel *M, char *Path, int MaxLen); #endif efte-1.1/src/sysdep.h0000664000076400007640000001041011147335003013562 0ustar laurilauri/* sysdep.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __SYSDEP_H #define __SYSDEP_H /* Support big files on 32-bit platform, if possible. */ #define _FILE_OFFSET_BITS 64 #ifndef _LARGEFILE_SOURCE # define _LARGEFILE_SOURCE #endif #include #include #include #include #include #if defined(AIX) || defined(SCO) || defined(NCR) #include #endif #include #include #include #include #include #include #ifdef DBMALLOC #include #endif #if defined(UNIX) # define USE_DIRENT #endif #if defined(USE_DIRENT) // also needs fnmatch # include #endif #if defined(UNIX) # include # include # if defined(__CYGWIN__) # include "fnmatch.h" # else # include # endif # define strnicmp strncasecmp # define stricmp strcasecmp # define filecmp strcmp //# define memicmp strncasecmp // FIX, fails for nulls extern "C" int memicmp(const void *s1, const void *s2, size_t n); #endif #if defined(OS2) # include # if !defined(__TOS_OS2__) # include # endif # include # include # if defined(BCPP) || defined(WATCOM) || defined(__TOS_OS2__) # include # endif # if defined(BCPP) # include # endif # define filecmp stricmp # if !defined(__EMX__) # define NO_NEW_CPP_FEATURES # endif #endif #if defined(NT) # include # include # include # include # if defined(MSVC) # include # define HAVE_STRICMP # define snprintf _snprintf # define isdigit(x) isdigit((int)(unsigned char)(x)) # define isalpha(x) isalpha((int)(unsigned char)(x)) # define isalnum(x) isalnum((int)(unsigned char)(x)) # define islower(x) islower((int)(unsigned char)(x)) # define isupper(x) isupper((int)(unsigned char)(x)) # define isprint(x) isprint((int)(unsigned char)(x)) # define ispunct(x) ispunct((int)(unsigned char)(x)) # define isspace(x) isspace((int)(unsigned char)(x)) # define isgraph(x) isgraph((int)(unsigned char)(x)) # endif # if defined(WATCOM) || defined(__WATCOM_CPLUSPLUS__) # define HAVE_STRLCPY # define HAVE_STRLCAT # define HAVE_STRICMP # include # endif # if defined(BCPP) # include # define HAVE_STRICMP # endif # if defined(MINGW) # include # define HAVE_BOOL // older versions of MingW may not have it # endif # define filecmp stricmp # define popen _popen # define pclose _pclose #endif #ifndef MAXPATH # define MAXPATH 1024 #endif #ifndef O_BINARY # define O_BINARY 0 /* defined on OS/2, no difference on unix */ #endif #if defined(OS2) || defined(NT) # if defined(__EMX__) || defined(WATCOM) || defined(__TOS_OS2__) # define FAKE_BEGINTHREAD_NULL NULL, # else # define FAKE_BEGINTHREAD_NULL # endif #endif #if (!defined(__IBMC__) && !defined(__IBMCPP__)) || !defined(OS2) # define _LNK_CONV #endif #define PT_UNIXISH 0 #define PT_DOSISH 1 #ifndef S_ISDIR // NT, DOS, DOSP32 # ifdef S_IFDIR # define S_ISDIR(mode) ((mode) & S_IFDIR) # else # define S_ISDIR(mode) ((mode) & _S_IFDIR) # endif #endif #ifndef S_IWGRP #define S_IWGRP 0 #define S_IWOTH 0 #endif #if defined(OS2) || defined(NT) #define PATHTYPE PT_DOSISH #else #define PATHTYPE PT_UNIXISH #endif #if defined __cplusplus && __cplusplus >= 199707L #define HAVE_BOOL #endif #if defined __GNUC__ && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) #define HAVE_BOOL #endif #if defined _G_HAVE_BOOL #define HAVE_BOOL #endif #if defined __BORLANDC__ && __BORLANDC__ >= 0x0500 #define HAVE_BOOL #endif #if defined __BORLANDC__ && defined __OS2__ #define popen _popen #define pclose _pclose #define ftruncate _ftruncate #endif //#undef HAVE_STRLCPY //#undef HAVE_STRLCAT #endif // __SYSDEP_H efte-1.1/src/fte-emx.mak0000664000076400007640000000431311041404761014147 0ustar laurilauri# # fte-emx.mak # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # # INCDIR = LIBDIR = #OPTIMIZE = -g OPTIMIZE = -O -s #OPTIMIZE = -O2 -s MT = -Zmt CC = gcc LD = gcc #XTYPE = -Zomf #XLTYPE = -Zsys -Zlinker /map -Zlinker /runfromvdm # -Zomf #OEXT=obj OEXT=o #DEFS = -DDEBUG_EDITOR -DCHECKHEAP #LIBS = -lmalloc1 #DEFS = -DDEBUG_EDITOR -DDBMALLOC -I/src/dbmalloc #LIBS = -L/src/dbmalloc -ldbmalloc LIBS = -lstdcpp DEFS=-DINCL_32 #-DUSE_OS2_TOOLKIT_HEADERS CCFLAGS = $(OPTIMIZE) $(MT) $(XTYPE) -x c++ -Wall -DOS2 $(DEFS) $(INCDIR) -pipe LDFLAGS = $(OPTIMIZE) $(MT) -Zmap $(XLTYPE) $(LIBDIR) .SUFFIXES: .cpp .$(OEXT) include objs.inc .cpp.$(OEXT): $(CC) $(CCFLAGS) -c $< .c.$(OEXT): $(CC) $(CCFLAGS) -c $< all: cefte.exe efte.exe eftepm.exe clipserv.exe cliputil.exe clipserv.exe: clipserv.$(OEXT) clipserv.def $(LD) $(LDFLAGS) clipserv.$(OEXT) clipserv.def -o clipserv.exe $(LIBS) cliputil.exe: cliputil.$(OEXT) clip_vio.$(OEXT) cliputil.def $(LD) $(LDFLAGS) cliputil.$(OEXT) clip_vio.$(OEXT) cliputil.def -o cliputil.exe $(LIBS) cefte.exe: $(CFTE_OBJS) cfte.def $(LD) $(LDFLAGS) $(CFTE_OBJS) cfte.def -o cefte.exe $(LIBS) defcfg.cnf: defcfg.fte cefte.exe cefte defcfg.fte defcfg.cnf defcfg.h: defcfg.cnf bin2c.exe bin2c defcfg.cnf >defcfg.h bin2c.exe: bin2c.cpp $(CC) $(CCFLAGS) bin2c.cpp -o bin2c.exe c_config.$(OEXT): defcfg.h efte.exe: $(OBJS) $(VIOOBJS) fte.def $(LD) $(LDFLAGS) $(OBJS) $(VIOOBJS) fte.def -o efte.exe $(LIBS) ftepm.res: ftepm.rc pmdlg.rc bmps/*.bmp rc -r -i \emx\include ftepm.rc ftepm.res eftepm.exe: $(OBJS) $(PMOBJS) ftepm.def ftepm.res $(LD) $(LDFLAGS) $(OBJS) $(PMOBJS) ftepm.def ftepm.res -o eftepm.exe $(LIBS) efte.cnf: cefte.exe cefte ..\config\main.fte efte.cnf #rc -i \emx\include ftepm.rc ftepm.exe #ftepm.exe:: ftepm.res # rc ftepm.res ftepm.exe distro: eftepm.exe efte.exe efte.cnf cefte.exe clipserv.exe cliputil.exe zip ../efte-os2.zip eftepm.exe efte.exe efte.cnf cefte.exe clipserv.exe cliputil.exe (cd .. && zip -r efte-config.zip Artistic doc config) efte-1.1/src/fte-cygwin-xf86.mak0000664000076400007640000000477411041404761015462 0ustar laurilauri# # fte-cygwin-xf86.mak # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # # versions of FTE to build # Versions: # xefte - using XLib (the most stable) TARGETS = xefte PRIMARY = xefte # Comment or uncoment this two flags below if # you want to use: # Keyboard remaping by XFTE #REMAPFLAG = -DUSE_HARD_REMAP # Drawing fonts with locale support XMBFLAG = -DUSE_XMB # System X11R6 is compiled with X_LOCALE #SYSTEM_X_LOCALE = -DX_LOCALE I18NOPTIONS = $(XMBFLAG) $(REMAPFLAG) $(SYSTEM_X_LOCALE) # Optionally, you can define: # -DDEFAULT_INTERNAL_CONFIG to use internal config by default # -DUSE_XTINIT to use XtInitialize on init # -DFTE_NO_LOGGING to completely disable trace logging APPOPTIONS = -DDEFAULT_INTERNAL_CONFIG #gcc/g++ COPTIONS = -Wall -Wpointer-arith -Wconversion -Wwrite-strings \ -Wmissing-prototypes -Wmissing-declarations -Winline #CC = g++ #LD = g++ # try this for smaller/faster code and less dependencies CC = g++ -fno-rtti -fno-exceptions LD = g++ -fno-rtti -fno-exceptions ####################################################################### # Linux UOS = -DLINUX XINCDIR = -I/usr/X11R6/include XLIBDIR = -L/usr/X11R6/lib -lstdc++ SOCKETLIB = -lwsock32 -liberty ####################################################################### LIBDIR = INCDIR = #OPTIMIZE = -g # -O -g OPTIMIZE = -O2 #OPTIMIZE = -O2 -s CCFLAGS = $(OPTIMIZE) $(I18NOPTIONS) $(APPOPTIONS) $(COPTIONS) -DUNIX $(UOS) \ $(INCDIR) $(XINCDIR) LDFLAGS = $(OPTIMIZE) $(LIBDIR) $(XLIBDIR) OEXT = o .SUFFIXES: .cpp .o include objs.inc # Need -lXt below if USE_XTINIT is defined XLIBS = -lX11 $(SOCKETLIB) .cpp.o: $(CC) $(CCFLAGS) -c $< .c.o: $(CC) $(CCFLAGS) -c $< all: cefte $(TARGETS) #rm -f fte ; ln -s $(PRIMARY) fte cefte: cfte.o s_files.o $(LD) $(LDFLAGS) cfte.o s_files.o -o cefte c_config.o: defcfg.h defcfg.h: defcfg.cnf perl mkdefcfg.pl defcfg.h #DEFAULT_FTE_CONFIG = simple.fte DEFAULT_FTE_CONFIG = defcfg.fte #DEFAULT_FTE_CONFIG = defcfg2.fte #DEFAULT_FTE_CONFIG = ../config/main.fte defcfg.cnf: $(DEFAULT_FTE_CONFIG) cefte ./cefte $(DEFAULT_FTE_CONFIG) defcfg.cnf xefte: $(OBJS) $(XOBJS) $(LD) $(LDFLAGS) $(OBJS) $(XOBJS) $(XLIBS) -o xefte compkeys: compkeys.o $(LD) $(LDFLAGS) compkeys.o -o compkeys clean: rm -f core *.o $(TARGETS) defcfg.h defcfg.cnf cefte efte vefte compkeys efte-1.1/src/o_buflist.h0000664000076400007640000000222111041404761014243 0ustar laurilauri/* o_buflist.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __BUFLIST_H #define __BUFLIST_H class BufferView: public EList { public: char **BList; int BCount; int SearchLen; char SearchString[MAXISEARCH]; int SearchPos[MAXISEARCH]; BufferView(int createFlags, EModel **ARoot); virtual ~BufferView(); virtual EEventMap *GetEventMap(); virtual int GetContext(); virtual void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); virtual char* FormatLine(int Line); virtual void UpdateList(); EModel *GetBufferById(int No); virtual int ExecCommand(int Command, ExState &State); virtual void HandleEvent(TEvent &Event); int getMatchingLine(int start, int direction); virtual int Activate(int No); void CancelSearch(); virtual void GetInfo(char *AInfo, int MaxLen); virtual void GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen); }; #endif efte-1.1/src/fte.def0000664000076400007640000000007210743771702013356 0ustar laurilauriNAME efte WINDOWCOMPAT DESCRIPTION 'eFTE' STACKSIZE 49152 efte-1.1/src/cliputil.cpp0000664000076400007640000000245311041404761014444 0ustar laurilauri/* cliputil.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "clip.h" #include #include #include #define MAXCLIPTEXT 256 * 1024 /* just for demo */ char buffer[MAXCLIPTEXT]; int main(int argc, char **argv) { ClipData cd; int i; if ((argc == 2) && (strcmp(argv[1], "-s") == 0)) { cd.fLen = fread(buffer, 1, MAXCLIPTEXT, stdin); cd.fChar = buffer; if (PutClipText(&cd) == -1) { fprintf(stderr, "Coult not set clipboard text\n"); return 1; } } else if (argc == 1) { if (GetClipText(&cd) == 0) { if ((cd.fLen != 0) && cd.fChar) { printf("%s", cd.fChar); } } else { fprintf(stderr, "Could not get clipboard text\n"); return 1; } } else { fprintf(stderr, "Usage: %s {-s}\n" "\n" "Examples:\n" " cliputil | more\n" " dir | cliputil -s\n", argv[0]); return 1; } return 0; } efte-1.1/src/s_string.cpp0000664000076400007640000000427711041422405014450 0ustar laurilauri/* * s_string.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include int UnTabStr(char *dest, int maxlen, const char *source, int slen) { char *p = dest; int i; int pos = 0; maxlen--; for (i = 0; i < slen; i++) { if (maxlen > 0) { if (source[i] == '\t') { do { if (maxlen > 0) { *p++ = ' '; maxlen--; } pos++; } while (pos & 0x7); } else { *p++ = source[i]; pos++; maxlen--; } } else break; } //dest[pos] = 0; *p = '\0'; return pos; } #if !defined(HAVE_STRLCPY) size_t strlcpy(char *dst, const char *src, size_t size) { size_t ret = strlen(src); if (size) { size_t len = (ret >= size) ? size - 1 : ret; memcpy(dst, src, len); dst[len] = '\0'; } return ret; } #endif // !HAVE_STRLCPY #if !defined(HAVE_STRLCAT) size_t strlcat(char *dst, const char *src, size_t size) { size_t dst_len = strlen(dst); size_t src_len = strlen(src); if (size) { size_t len = (src_len >= size - dst_len) ? (size - dst_len - 1) : src_len; memcpy(&dst[dst_len], src, len); dst[dst_len + len] = '\0'; } return dst_len + src_len; } #endif // !HAVE_STRLCAT #if !defined(HAVE_STRICMP) int stricmp(const char *a, const char *b) { if (a != NULL && b == NULL) return 1; if (a == NULL && b != NULL) return -1; if (a == NULL && b == NULL) return 0; int aLen = strlen(a); int bLen = strlen(b); int minLen = aLen < bLen ? aLen : bLen; for (int idx=0; idx < minLen; idx++) { char aC = toupper(a[idx]); char bC = toupper(b[idx]); if (aC > bC) return 1; else if (aC < bC) return -1; } if (aLen < bLen) return -1; else if (aLen > bLen) return 1; else return 0; } #endif // !HAVE_STRICMP efte-1.1/src/fte-x2.mak0000664000076400007640000000616311041404761013714 0ustar laurilauri# # fte-x2.mak # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # # versions of FTE to build # Versions: # xfte - using XLib (the most stable) # vfte - for Linux console directly (with limitations, see con_linux.cpp) TARGETS = xfte #TARGETS = xfte vfte PRIMARY = xfte # choose your os here ####################################################################### # Linux #UOS = -DLINUX #XLIBDIR = -L/usr/X11R6/lib ####################################################################### # HP/UX #UOS = -DHPUX -D_HPUX_SOURCE #XINCDIR = -I/usr/include/X11R5 #XLIBDIR = -L/usr/lib/X11R5 #MINCDIR = -I/usr/include/Motif1.2 #MLIBDIR = -L/usr/lib/Motif1.2 ####################################################################### # AIX #UOS = -DAIX -D_BSD_INCLUDES # not recently tested (it did work) ####################################################################### # Irix # missing fnmatch, but otherwise ok (tested only on 64bit) # 6.x has fnmatch now ;-) # uncomment below to use SGI CC compiler #UOS = -DIRIX ####################################################################### # SunOS (Solaris) #UOS = -DSUNOS #XINCDIR = -I/usr/openwin/include #XLIBDIR = -L/usr/openwin/lib ####################################################################### # XFree86OS/2 UOS = -DOS2 XINCDIR = -I$(X11ROOT)/XFree86/include XLIBDIR = -L$(X11ROOT)/XFree86/lib ####################################################################### #QTDIR = /users/markom/qt #QLIBDIR = -L$(QTDIR)/lib #QINCDIR = -I$(QTDIR)/include MOC = moc # for GCC #CC = g++ #LD = gcc #COPTIONS = -xc++ -Wall # for IRIX CC #CC = CC #LD = CC #COPTIONS = -xc++ # for OS/2 CC = gcc -Zmtd LD = gcc -Zmtd -Zexe COPTIONS = LIBDIR = INCDIR = #OPTIMIZE = -g #OPTIMIZE = -O -g OPTIMIZE = -O -s #CCFLAGS = $(OPTIMIZE) $(COPTIONS) -DUNIX $(UOS) $(INCDIR) $(XINCDIR) $(QINCDIR) $(MINCDIR) CCFLAGS = $(OPTIMIZE) $(COPTIONS) $(UOS) $(INCDIR) $(XINCDIR) $(QINCDIR) $(MINCDIR) LDFLAGS = $(OPTIMIZE) $(LIBDIR) $(XLIBDIR) $(QLIBDIR) $(MLIBDIR) OEXT = o .SUFFIXES: .cpp .o .moc include objs.inc XLIBS = -lX11 QLIBS = -lqt VLIBS = -lgpm -ltermcap MLIBS = -lXm -lXt .cpp.o: $(CC) $(CCFLAGS) -c $< .c.o: $(CC) $(CCFLAGS) -c $< .cpp.moc: $(MOC) $< -o $@ all: cfte $(TARGETS) # rm -f fte ; ln -s $(PRIMARY) fte cfte: cfte.o s_files.o $(LD) $(LDFLAGS) cfte.o s_files.o -o cfte c_config.o: defcfg.h defcfg.h: defcfg.cnf perl mkdefcfg.pl defcfg.h defcfg.cnf: defcfg.fte cfte cfte defcfg.fte defcfg.cnf xfte: $(OBJS) $(XOBJS) $(LD) $(LDFLAGS) $(OBJS) $(XOBJS) $(XLIBS) -o xfte qfte: g_qt.moc g_qt_dlg.moc $(OBJS) $(QOBJS) $(LD) $(LDFLAGS) $(OBJS) $(QOBJS) $(QLIBS) $(XLIBS) -o qfte vfte: $(OBJS) $(VOBJS) $(LD) $(LDFLAGS) $(OBJS) $(VOBJS) $(VLIBS) -o vfte mfte: $(OBJS) $(MOBJS) $(LD) $(LDFLAGS) $(OBJS) $(MOBJS) $(MLIBS) $(XLIBS) -o mfte g_qt.obj: g_qt.moc g_qt_dlg.obj: g_qt_dlg.moc clean: rm -f *.o $(TARGETS) defcfg.h defcfg.cnf cfte fte efte-1.1/src/e_redraw.cpp0000664000076400007640000004707211252243157014421 0ustar laurilauri/* e_redraw.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int EBuffer::GetMap(int Row, int *StateLen, hsState **StateMap) { hlState State = 0; Rehilit(Row); *StateLen = LineChars(Row); if (Row > 0) State = RLine(Row - 1)->StateE; if (*StateLen > 0) { PELine L = RLine(Row); int ECol; *StateMap = (hsState *) malloc(*StateLen); if (*StateMap == 0) return 0; if (BFI(this, BFI_HilitOn) == 1 && HilitProc != 0) HilitProc(this, Row, 0, 0, *StateLen, L, State, *StateMap, &ECol); else Hilit_Plain(this, Row, 0, 0, *StateLen, L, State, *StateMap, &ECol); // if (L->StateE != State) { // L->StateE = State; // } } else { *StateLen = 1; *StateMap = (hsState *) malloc(1); if (*StateMap == 0) return 0; (*StateMap)[0] = (hsState)(State & 0xFF); } return 1; } void EBuffer::FullRedraw() { // redraw all views EView *V = View; EEditPort *W; int Min, Max; while (V) { W = GetViewVPort(V); // Need to use real lines, not virtual // (similar to HilitMatchBracket) Min = VToR(W->TP.Row); Max = W->TP.Row + W->Rows; if (Max >= VCount) Max = RCount; else Max = VToR(Max); Draw(Min, Max); V = V->Next; if (V == View) break; } } void EBuffer::Hilit(int FromRow) { if (FromRow != -1) { if (StartHilit == -1) StartHilit = FromRow; else if (FromRow < StartHilit) StartHilit = FromRow; } } void EBuffer::Rehilit(int ToRow) { hlState State; int HilitX; PELine L; int ECol; if (StartHilit == -1) // all ok return ; if (BFI(this, BFI_MultiLineHilit) == 0) // everything handled in redisplay return; if (ToRow <= StartHilit) // will be handled in redisplay return; if (ToRow >= RCount) ToRow = RCount; HilitX = 1; while ((StartHilit < RCount) && ((StartHilit < ToRow) || HilitX)) { L = RLine(StartHilit); HilitX = 0; if (StartHilit > 0) State = RLine(StartHilit - 1)->StateE; else State = 0; if (BFI(this, BFI_HilitOn) == 1 && HilitProc != 0) { HilitProc(this, StartHilit, 0, 0, 0, L, State, 0, &ECol); } else { Hilit_Plain(this, StartHilit, 0, 0, 0, L, State, 0, &ECol); } if (L->StateE != State) { HilitX = 1; L->StateE = State; } Draw(StartHilit, StartHilit); // ? if (StartHilit > EndHilit) EndHilit = StartHilit; if (HilitX == 0) // jump over (can we always do this ?) if (StartHilit < EndHilit) { StartHilit = EndHilit; } StartHilit++; } } void EBuffer::Draw(int Row0, int RowE) { // printf("r0 = %d, re = %d\n", Row0, RowE); // printf("m = %d, max = %d, rts = %d\n", MinRedraw, MaxRedraw, RedrawToEos); if (Row0 == -1) Row0 = 0; if ((Row0 < MinRedraw) || (MinRedraw == -1)) { MinRedraw = Row0; if (MaxRedraw == -1) MaxRedraw = MinRedraw; } if (RowE == -1) { RedrawToEos = 1; MaxRedraw = MinRedraw; } else if (((RowE > MaxRedraw) || (MaxRedraw == -1)) && (RowE != -1)) MaxRedraw = RowE; // printf("m = %d, max = %d, rts = %d\n", MinRedraw, MaxRedraw, RedrawToEos); } void EBuffer::DrawLine(TDrawBuffer B, int VRow, int C, int W, int &HilitX) { hlState State; int StartPos, EndPos; HilitX = 0; MoveChar(B, 0, W, ' ', hcPlain_Background, W); // if ((VRow == VCount - 1) && !BFI(this, BFI_ForceNewLine)) { // if (BFI(this, BFI_ShowMarkers)) // MoveChar(B, 0, W, EOF_MARKER, hcPlain_Markers, W); // } if (VRow < VCount) { int Row = VToR(VRow); PELine L = RLine(Row); int ECol = 0; if (Row > 0) State = RLine(Row - 1)->StateE; else State = 0; if (BFI(this, BFI_HilitOn) == 1 && HilitProc != 0) HilitProc(this, Row, B, C, W, L, State, 0, &ECol); else Hilit_Plain(this, Row, B, C, W, L, State, 0, &ECol); if (L->StateE != State) { HilitX = 1; L->StateE = State; } if (BFI(this, BFI_ShowMarkers)) { MoveChar(B, ECol - C, W, ConGetDrawChar((Row == RCount - 1) ? DCH_EOF : DCH_EOL), hcPlain_Markers, 1); ECol += 1; } if (Row < RCount) { int f; int Folded = 0; static char fold[20]; int l; f = FindFold(Row); if (f != -1) { int foldColor; if (FF[f].level < 5) foldColor = hcPlain_Folds[FF[f].level]; else foldColor = hcPlain_Folds[4]; if (FF[f].open == 1) { l = sprintf(fold, "[%d]", FF[f].level); MoveStr(B, ECol - C + 1, W, fold, foldColor, 10); ECol += l; } else { if (VRow < VCount - 1) { Folded = Vis(VRow + 1) - Vis(VRow) + 1; } else if (VRow < VCount) { Folded = RCount - (VRow + Vis(VRow)); } l = sprintf(fold, "(%d:%d)", FF[f].level, Folded); MoveStr(B, ECol - C + 1, W, fold, foldColor, 10); ECol += l; MoveAttr(B, 0, W, foldColor, W); } } } if (BB.Row != -1 && BE.Row != -1 && Row >= BB.Row && Row <= BE.Row) { switch (BlockMode) { case bmLine: StartPos = 0; if (Row == BE.Row) EndPos = 0; else EndPos = W; break; case bmColumn: StartPos = BB.Col - C; if (Row == BE.Row) EndPos = BB.Col - C; else EndPos = BE.Col - C; break; case bmStream: if (Row == BB.Row && Row == BE.Row) { StartPos = BB.Col - C; EndPos = BE.Col - C; } else if (Row == BB.Row) { StartPos = BB.Col - C; EndPos = W; } else if (Row == BE.Row) { StartPos = 0; EndPos = BE.Col - C; } else { StartPos = 0; EndPos = W; } break; default: StartPos = EndPos = 0; break; } if (BFI(this, BFI_SeeThruSel)) MoveBgAttr(B, StartPos, W, hcPlain_Selected, EndPos - StartPos); else MoveAttr(B, StartPos, W, hcPlain_Selected, EndPos - StartPos); } if (BFI(this, BFI_ShowBookmarks)) { int i = 0; char *Name; EPoint P; while ((i = GetBookmarkForLine(i, Row, Name, P)) != -1) { if (strncmp(Name, "_BMK", 4) == 0) { // User bookmark, hilite line if (BFI(this, BFI_SeeThruSel)) MoveBgAttr(B, 0, W, hcPlain_Bookmark, W); else MoveAttr(B, 0, W, hcPlain_Bookmark, W); break; } } } if (Match.Row != -1 && Match.Col != -1) { if (Row == Match.Row) { if (BFI(this, BFI_SeeThruSel)) MoveBgAttr(B, Match.Col - C, W, hcPlain_Found, MatchLen); else MoveAttr(B, Match.Col - C, W, hcPlain_Found, MatchLen); } } } else if (VRow == VCount) { if (BFI(this, BFI_ShowMarkers)) MoveChar(B, 0, W, ConGetDrawChar(DCH_END), hcPlain_Markers, W); } } void EBuffer::Redraw() { int HilitX; EView *V; EEditPort *W; int Row; TDrawBuffer B; char s[256]; ChColor SColor; int RowA, RowZ; { int W1, H1; if (!(View && View->MView)) return; View->MView->ConQuerySize(&W1, &H1); if (H1 < 1 || W1 < 1) return; } // printf("Redraw\n"); if (CP.Row >= VCount) CP.Row = VCount - 1; if (CP.Row < 0) CP.Row = 0; CheckBlock(); V = View; /* check some window data */ if (!V) { MinRedraw = MaxRedraw = -1; RedrawToEos = 0; return; } if (View == 0 || View->MView == 0 || View->MView->Win == 0) return ; for (; V; V = V->NextView) { // printf("Checking\x7\n"); if (V->Model != this) assert(1 == 0); W = GetViewVPort(V); if (W->Rows < 1 || W->Cols < 1) continue; if (V == View) { int scrollJumpX = Min(ScrollJumpX, W->Cols / 2); int scrollJumpY = Min(ScrollJumpY, W->Rows / 2); int scrollBorderX = Min(ScrollBorderX, W->Cols / 2); int scrollBorderY = Min(ScrollBorderY, W->Rows / 2); W->CP = CP; TP = W->TP; if (W->ReCenter) { W->TP.Row = CP.Row - W->Rows / 2; W->TP.Col = CP.Col - W->Cols + 8; W->ReCenter = 0; } if (W->TP.Row + scrollBorderY > CP.Row) W->TP.Row = CP.Row - scrollJumpY + 1 - scrollBorderY; if (W->TP.Row + W->Rows - scrollBorderY <= CP.Row) W->TP.Row = CP.Row - W->Rows + 1 + scrollJumpY - 1 + scrollBorderY; if (!WeirdScroll) if (W->TP.Row + W->Rows >= VCount) W->TP.Row = VCount - W->Rows; if (W->TP.Row < 0) W->TP.Row = 0; if (W->TP.Col + scrollBorderX > CP.Col) W->TP.Col = CP.Col - scrollJumpX - scrollBorderX; if (W->TP.Col + W->Cols - scrollBorderX <= CP.Col) W->TP.Col = CP.Col - W->Cols + scrollJumpX + scrollBorderX; if (W->TP.Col < 0) W->TP.Col = 0; if (W->OldTP.Row != -1 && W->OldTP.Col != -1 && RedrawToEos == 0) { if ((W->OldTP.Row != W->TP.Row) || (W->OldTP.Col != W->TP.Col)) { int A, B; int DeltaX, DeltaY; int Rows = W->Rows; int Delta1 = 0, Delta2 = 0; DeltaY = W->TP.Row - W->OldTP.Row ; DeltaX = W->TP.Col - W->OldTP.Col; if ((DeltaX == 0) && (-Rows < DeltaY) && (DeltaY < Rows)) { if (DeltaY < 0) { W->ScrollY(DeltaY); A = W->TP.Row; B = W->TP.Row - DeltaY; } else { W->ScrollY(DeltaY); A = W->TP.Row + Rows - DeltaY; B = W->TP.Row + Rows; } } else { A = W->TP.Row; B = W->TP.Row + W->Rows; } if (A >= VCount) { Delta1 = A - VCount + 1; A = VCount - 1; } if (B >= VCount) { Delta2 = B - VCount + 1; B = VCount - 1; } if (A < 0) A = 0; if (B < 0) B = 0; Draw(VToR(A) + Delta1, VToR(B) + Delta2); } } else { int A = W->TP.Row; int B = A + W->Rows; int Delta = 0; if (B > VCount) { Delta += B - VCount; B = VCount; } int LastV = VToR(VCount - 1); int B1 = (B == VCount) ? RCount : VToR(B); if (B1 >= LastV) { Delta += B1 - LastV; B1 = LastV; } if (B1 < 0) B1 = 0; Draw(VToR(A), B1 + Delta); } W->OldTP = W->TP; TP = W->TP; } if (W->CP.Row >= VCount) W->CP.Row = VCount - 1; if (W->CP.Row < 0) W->CP.Row = 0; if (W->TP.Row > W->CP.Row) W->TP.Row = W->CP.Row; if (W->TP.Row < 0) W->TP.Row = 0; if (V->MView->IsActive()) // hack SColor = hcStatus_Active; else SColor = hcStatus_Normal; MoveChar(B, 0, W->Cols, ' ', SColor, W->Cols); if (V->MView->Win->GetViewContext() == V->MView) { V->MView->Win->SetSbVPos(W->TP.Row, W->Rows, VCount + (WeirdScroll ? W->Rows - 1 : 0)); V->MView->Win->SetSbHPos(W->TP.Col, W->Cols, 1024 + (WeirdScroll ? W->Cols - 1 : 0)); } if (V->CurMsg == 0) { { int CurLine = W->CP.Row; int ActLine = VToR(W->CP.Row); int CurColumn = W->CP.Col; int CurPos = CharOffset(RLine(ActLine), CurColumn); int NumLines = RCount; int NumChars = RLine(ActLine)->Count; // int NumColumns = ScreenPos(Line(CurLine), NumChars); char *fName = FileName; unsigned char CurCh = 0xFF; int lf = strlen(fName); char CCharStr[20] = ""; if (lf > 34) fName += lf - 34; if (CurPos < NumChars) { CurCh = VLine(CurLine)->Chars[CurPos]; sprintf(CCharStr, "%3u,%02X", CurCh, CurCh); } else { if (CurPos > NumChars) strcpy(CCharStr, " "); else if (CurLine < NumLines - 1) strcpy(CCharStr, " EOL"); else strcpy(CCharStr, " EOF"); } sprintf(s, "%04d:%02d (%04d:%02d) %c%c%c%c%c %.6s %c", // CurLine + 1, ActLine + 1, CurColumn + 1, NumLines, NumChars, // CurPos + 1, (BFI(this, BFI_Insert)) ? 'I' : ' ', (BFI(this, BFI_AutoIndent)) ? 'A' : ' ', // (BFI(this, BFI_ExpandTabs))?'T':' ', (BFI(this, BFI_MatchCase)) ? 'C' : ' ', AutoExtend ? ( (BlockMode == bmStream) ? 's' : (BlockMode == bmLine) ? 'l' : 'c' ) : ((BlockMode == bmStream) ? 'S' : (BlockMode == bmLine) ? 'L' : 'C' ), (BFI(this, BFI_WordWrap) == 3) ? 't' : (BFI(this, BFI_WordWrap) == 2) ? 'W' : (BFI(this, BFI_WordWrap) == 1) ? 'w' : ' ', // (BFI(this, BFI_Undo))?'U':' ', // (BFI(this, BFI_Trim))?'E':' ', // (Flags.KeepBackups)?'B':' ', Mode->fName, (Modified != 0) ? '*' : (BFI(this, BFI_ReadOnly)) ? '%' : ' ' ); int l = strlen(s); int fw = W->Cols - l; int fl = strlen(FileName); char num[32]; MoveStr(B, 0, W->Cols, s, SColor, W->Cols); sprintf(num, " %s %d", CCharStr, ModelNo); MoveStr(B, W->Cols - strlen(num), W->Cols, num, SColor, W->Cols); fw -= strlen(num); if (fl > fw) { MoveStr(B, l, W->Cols, FileName + fl - fw, SColor, W->Cols); } else { MoveStr(B, l, W->Cols, FileName, SColor, W->Cols); } } } else { MoveStr(B, 0, W->Cols, V->CurMsg, SColor, W->Cols); } if (V->MView->Win->GetStatusContext() == V->MView) { V->MView->ConPutBox(0, W->Rows, W->Cols, 1, B); if (V->MView->IsActive()) { V->MView->ConSetCursorPos(W->CP.Col - W->TP.Col, W->CP.Row - W->TP.Row); V->MView->ConSetInsertState(BFI(this, BFI_Insert)); V->MView->ConShowCursor(); } } } Rehilit(VToR(CP.Row)); if (BFI(this, BFI_AutoHilitParen) == 1) { if (Match.Row == -1 && Match.Col == -1) HilitMatchBracket(); } // if ((Window == WW) && (MinRedraw == -1)) // MaxRedraw = MinRedraw = VToR(CP.Row); //printf("\n\nMinRedraw = %d, MaxRedraw = %d", MinRedraw, MaxRedraw); if (MinRedraw == -1) return; // printf("Will redraw: %d to %d, to eos = %d\n", MinRedraw, MaxRedraw, RedrawToEos); if (MinRedraw >= VCount) MinRedraw = VCount - 1; if (MinRedraw < 0) MinRedraw = 0; // puts("xxx\x7"); // printf("%d\n", MinRedraw); Row = RowA = RToVN(MinRedraw); // puts("xxx\x7"); RowZ = MaxRedraw; if (MaxRedraw != -1) { int Delta = 0; if (MaxRedraw >= RCount) { Delta = MaxRedraw - RCount + 1; MaxRedraw = RCount - 1; } if (MaxRedraw < 0) MaxRedraw = 0; // printf("%d\n", MaxRedraw); RowZ = RToVN(MaxRedraw) + Delta; } // puts("xxx\x7"); //printf("\nRowA = %d, RowZ = %d", RowA, RowZ); V = View; while (V) { if (V->Model != this) assert(1 == 0); W = GetViewVPort(V); for (int R = W->TP.Row; R < W->TP.Row + W->Rows; R++) { Row = R; if ((Row >= RowA) && (RedrawToEos || Row <= RowZ)) { DrawLine(B, Row, W->TP.Col, W->Cols, HilitX); W->DrawLine(Row, B); if (HilitX && Row == RowZ) RowZ++; } } V = V->NextView; } MinRedraw = MaxRedraw = -1; RedrawToEos = 0; } int EBuffer::GetHilitWord(int len, char *str, ChColor &clr, int IgnCase) { char *p; if (Mode == 0 || Mode->fColorize == 0) return 0; if (len >= CK_MAXLEN) return 0; { char s[CK_MAXLEN + 1]; s[CK_MAXLEN] = 0; memcpy(s, str, len); s[len] = 0; if (HilitFindWord(s)) { clr = COUNT_CLR + hcPlain_HilitWord; return 1; } } if (len < 1) return 0; p = Mode->fColorize->Keywords.key[len]; if (IgnCase) { while (p && *p) { if (strnicmp(p, str, len) == 0) { clr = COUNT_CLR + ((unsigned char*)p)[len]; return 1; } p += len + 1; } } else { while (p && *p) { if (memcmp(p, str, len) == 0) { clr = COUNT_CLR + ((unsigned char*)p)[len]; //printf("PLEN %d %d\n", p[len], COUNT_CLR); return 1; } p += len + 1; } } if (len < 128) { char s[128]; memcpy(s, str, len); s[len] = 0; if (BFI(this, BFI_HilitTags) && TagDefined(s)) { //clr = 0x0A; clr = CLR_HexNumber;// Mode->fColorize->Colors[]; return 1; } } return 0; } EEditPort *EBuffer::GetViewVPort(EView *V) { return (EEditPort *)V->Port; } EEditPort *EBuffer::GetVPort() { return (EEditPort *)View->Port; } efte-1.1/src/namemaps.h0000664000076400007640000000152311041404761014062 0ustar laurilauri/* * namemaps.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ /* M$VC++ !!! */ #ifndef __NAMEMAPS_H__ #define __NAMEMAPS_H__ #define access _access #define chmod _chmod #define chsize _chsize #define close _close #define creat _creat #define dup _dup #define dup2 _dup2 #define eof _eof #define filelength _filelength #define isatty _isatty #define locking _locking #define lseek _lseek #define mktemp _mktemp #define open _open #define read _read #define setmode _setmode #define sopen _sopen #define tell _tell #define umask _umask #define unlink _unlink #define write _write #endif efte-1.1/src/icons/0000775000076400007640000000000011264420007013220 5ustar laurilauriefte-1.1/src/icons/ftewin32.ico0000664000076400007640000000427607374135435015405 0ustar laurilauri ( @@ @ @@@@@`@```@@@@ @ @ @ @@ @ @ ` @` ` ` @ @ @ @ @@@@@ @@ @ @ @@@@@@@@@@`@@`@`@`@@@@@@@@@@@@@@@@@@@@@`@``` `@ ` ` `@`@@`@`@```@```````@````@````@````@```@ @ @@@@@`@```@@@@@ @ @@@@@`@```@@@@@ @ @@@@@`@```@@@@@ @ @@@@@`@```@@@@xxxxx?efte-1.1/src/icons/ftepm.ico0000664000076400007640000000642011063302441015027 0ustar laurilauriBA(xCI @CI ̀BA(CI  CI` ̀BA(hCI (PCI` ((̀BA(CI (CI ̀a!a!??𙐙𙐙𙐙 𙙙𙐙𙐙𙙐𙐙  𙙐Q?????? ?<||??? ? ??          000?ZZ$ ZZ $ ZZ $ ZZ $ ZZ $ ZZ Z $efte-1.1/src/icons/error.ico0000664000076400007640000001274411215513016015054 0ustar laurilauriCIN@(PCIN$@((]^/0)*)*)*)*)*)*)*)*)*)*)**+*+)**)ˈ@@2323232323232323232323232323231210}}BB554444446565656565656599::::::::::87+*ˁAA554465656599999999999999999999::::::::77+)ˁBA55444444444411223412444444121244689:::::::77+)ˁBB554444448844GG|{MM88<==>=>==::+*ˁBB675656565656hjij99;;:::;=>::+*ˁBB555757575767iijj:9<==>=>=>::+*ˁBB6655669:::::JI길ML=<=>=>=>=>:;+*ˁBB666699::::::78||₁==A@BAAA>>AA>=,*ʆBB67669:::::::::AAĪ뽽OOBABABABABABA>=,*``@@76::::::=>=>=>>>PPꆆ??BABABABABABA>=+)3487::::::::=>=>=>??[\POCBBABABABABABA@?GF0165::::=>=>=>>>AACB]\hhDCBABABABABABABAHG1188::::=>AABABABADC]\썍EEGFHFHFHFHFBABAIH1199=>=>AABABACBCBDC]\ONIIKJKJKJJICBCBIH1199A@BABABABACBHFIGa`^^JJKJKJKJKJKJJIIH12::BABABACBJIKJKJLKaawwMLOMOMOMKJKJJJBB11::BABACBJIKJKJOMPNbbyzPOQQOMOMOMKJKJBB0/==CCJIKJKJKJOMRQSShh쫪zzutpqMNQQRRRQOMNLBB0/??JIKJKJOMOMRRRRSShhꑐZX]]RRRRRRRRQQBB0/@@KJKJOMOMRRUUUVVWiiꖖ\]baonTTRRRRRRQQBB0/BANLOMONRRRRSSYZ[\qp閖싋􍌨`aeea`qp}|_^Z[UVUVUVTUBB0/BAQQRRRRSSYZZ[Z[^_rq䐐뉈󑑳hgffffff^^]]^_^_Z[VWUVTUBB10IIRRRRSSYZZ[^_^__`rq䏏뉈󒒴mllklkkjffffffee^_Z[Z[TUBB10IJTUUVVW]^^_eeffggxxᏐ쏎󓒲pqopopmllkkjggffee__^_YYBB0.IJYZZ[Z[^__`ffgglk{z吖쏏󓒲uussssssrrmllkkjgfee__YZ==65IJ\]^_^__`ffkjlkopzy푒쏏󓒲||{{{{zzttssrrmlkkgfee]^IHēHGTUddffffkjmlrrssvvꍍ쏏󓒲Ӏ||{{zzttssrrmlkjffjjѲJIZYjilkmlrrttzz{{}}}~쏏󔒲ӄ{{zzttssrrkkllﻻѫKJbaqqssttzz||쐐󕕯ӈ{{zzrrllﶵѫKJhhyy{{||󖖰󖖰ՍyymmﶵѫLKno󜛾甕}}mmѫMLvvدmmѫNM~}ߥnnѬSRԃqp鯯ѬTSԍqq鰯ѬUTԓrr鰯ѭ_^ևww谰ѐ:843212121212121212121/-.,.,.,42̑efte-1.1/src/view.cpp0000664000076400007640000010030711044154601013564 0ustar laurilauri/* view.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" EView *ActiveView = 0; extern BufferView *BufferList; EView::EView(EModel *AModel) { if (ActiveView) { Prev = ActiveView; Next = ActiveView->Next; Prev->Next = this; Next->Prev = this; } else Prev = Next = this; ActiveView = this; Model = AModel; NextView = 0; Port = 0; MView = 0; CurMsg = 0; if (Model) Model->CreateViewPort(this); } EView::~EView() { if (Next != this) { Prev->Next = Next; Next->Prev = Prev; if (ActiveView == this) ActiveView = Next; } else ActiveView = 0; if (MView) MView->View = 0; if (Model) Model->RemoveView(this); if (Port) delete Port; } int EView::CanQuit() { if (Model) return Model->CanQuit(); else return 1; } void EView::FocusChange(int GetFocus) { if (GetFocus) { if (Model->View && Model->View->Port) Model->View->Port->GetPos(); Model->CreateViewPort(this); } else { if (Model) { Model->RemoveView(this); delete Port; Port = 0; if (Model->View && Model->View->Port) Model->View->Port->StorePos(); } } } void EView::Resize(int Width, int Height) { if (Port) Port->Resize(Width, Height); } void EView::SetModel(EModel *AModel) { Model = AModel; ActiveModel = Model; } void EView::SelectModel(EModel *AModel) { if (Model != AModel) { if (Model) FocusChange(0); SetModel(AModel); if (Model) FocusChange(1); } } void EView::SwitchToModel(EModel *AModel) { if (Model != AModel) { if (Model) FocusChange(0); AModel->Prev->Next = AModel->Next; AModel->Next->Prev = AModel->Prev; if (Model) { AModel->Next = Model; AModel->Prev = Model->Prev; AModel->Prev->Next = AModel; Model->Prev = AModel; } else { AModel->Next = AModel->Prev = AModel; } SetModel(AModel); if (Model) FocusChange(1); } } void EView::Activate(int GotFocus) { if (Model && Model->View != this && Port) { Model->SelectView(this); if (GotFocus) { Port->StorePos(); } else { Port->GetPos(); } Port->RepaintView(); if (GotFocus) ActiveView = this; } } int EView::GetContext() { return Model ? Model->GetContext() : 0; } EEventMap *EView::GetEventMap() { return Model ? Model->GetEventMap() : 0; } int EView::BeginMacro() { return Model ? Model->BeginMacro() : 0; } int EView::ExecCommand(int Command, ExState &State) { switch (Command) { case ExSwitchTo: return SwitchTo(State); case ExFilePrev: return FilePrev(); case ExFileNext: return FileNext(); case ExFileLast: return FileLast(); case ExFileOpen: return FileOpen(State); case ExFileOpenInMode: return FileOpenInMode(State); case ExFileSaveAll: return FileSaveAll(); case ExListRoutines: return ViewRoutines(State); case ExDirOpen: return DirOpen(State); case ExViewMessages: return ViewMessages(State); case ExCompile: return Compile(State); case ExRunCompiler: return RunCompiler(State); case ExCompilePrevError: return CompilePrevError(State); case ExCompileNextError: return CompileNextError(State); case ExCvs: return Cvs(State); case ExRunCvs: return RunCvs(State); case ExViewCvs: return ViewCvs(State); case ExClearCvsMessages: return ClearCvsMessages(State); case ExCvsDiff: return CvsDiff(State); case ExRunCvsDiff: return RunCvsDiff(State); case ExViewCvsDiff: return ViewCvsDiff(State); case ExCvsCommit: return CvsCommit(State); case ExRunCvsCommit: return RunCvsCommit(State); case ExViewCvsLog: return ViewCvsLog(State); case ExSvn: return Svn(State); case ExRunSvn: return RunSvn(State); case ExViewSvn: return ViewSvn(State); case ExClearSvnMessages: return ClearSvnMessages(State); case ExSvnDiff: return SvnDiff(State); case ExRunSvnDiff: return RunSvnDiff(State); case ExViewSvnDiff: return ViewSvnDiff(State); case ExSvnCommit: return SvnCommit(State); case ExRunSvnCommit: return RunSvnCommit(State); case ExViewSvnLog: return ViewSvnLog(State); case ExViewBuffers: return ViewBuffers(State); case ExShowKey: return ShowKey(State); case ExToggleSysClipboard: return ToggleSysClipboard(State); case ExSetPrintDevice: return SetPrintDevice(State); case ExShowVersion: return ShowVersion(); case ExViewModeMap: return ViewModeMap(State); case ExClearMessages: return ClearMessages(); case ExTagNext: return TagNext(this); case ExTagPrev: return TagPrev(this); case ExTagPop: return TagPop(this); case ExTagClear: TagClear(); return 1; case ExTagLoad: return TagLoad(State); case ExShowHelp: return SysShowHelp(State, 0); case ExConfigRecompile: return ConfigRecompile(State); case ExRemoveGlobalBookmark: return RemoveGlobalBookmark(State); case ExGotoGlobalBookmark: return GotoGlobalBookmark(State); case ExPopGlobalBookmark: return PopGlobalBookmark(); } return Model ? Model->ExecCommand(Command, State) : 0; } void EView::HandleEvent(TEvent &Event) { if (Model) Model->HandleEvent(Event); if (Port) Port->HandleEvent(Event); if (Event.What == evCommand) { switch (Event.Msg.Command) { case cmDroppedFile: { char *file = (char *)Event.Msg.Param2; if (IsDirectory(file)) OpenDir(file); MultiFileLoad(0, file, NULL, this); } break; } } } void EView::UpdateView() { if (Port) Port->UpdateView(); } void EView::RepaintView() { if (Port) Port->RepaintView(); } void EView::UpdateStatus() { if (Port) Port->UpdateStatus(); } void EView::RepaintStatus() { if (Port) Port->RepaintStatus(); } void EView::DeleteModel(EModel *M) { EView *V; EModel *M1; char s[256]; if (M == 0) return; M->GetName(s, sizeof(s)); Msg(S_INFO, "Closing %s.", s); V = ActiveView = this; while (V) { M1 = V->Model; if (M1 == M) { if (M->Next != M) V->SelectModel(M->Next); else V->SelectModel(0); } V = V->Next; if (V == ActiveView) break; } delete M; SetMsg(0); return; } ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// int EView::FilePrev() { if (Model) { EModel *n = Model->Prev; if (IgnoreBufferList && n && n->GetContext() == CONTEXT_BUFFERS) n = n->Prev; SelectModel(n); return 1; } return 0; } int EView::FileNext() { if (Model) { EModel *n = Model->Next; if (IgnoreBufferList && n && n->GetContext() == CONTEXT_BUFFERS) n = n->Next; SelectModel(n); return 1; } return 0; } int EView::FileLast() { if (Model) { EModel *n = Model->Next; if (IgnoreBufferList && n && n->GetContext() == CONTEXT_BUFFERS) n = n->Next; SwitchToModel(n); return 1; } return 0; } int EView::SwitchTo(ExState &State) { EModel *M; int No; if (State.GetIntParam(this, &No) == 0) { char str[10] = ""; if (MView->Win->GetStr("Obj.Number", sizeof(str), (char *)str, 0) == 0) return 0; No = atoi(str); } M = Model; while (M) { if (M->ModelNo == No) { SwitchToModel(M); return 1; } M = M->Next; if (M == Model) return 0; } return 0; } int EView::FileSaveAll() { EModel *M = Model; while (M) { if (M->GetContext() == CONTEXT_FILE) { EBuffer *B = (EBuffer *)M; if (B->Modified) { SwitchToModel(B); if (B->Save() == 0) return 0; } } M = M->Next; if (M == Model) break; } return 1; } int EView::FileOpen(ExState &State) { char FName[MAXPATH]; if (State.GetStrParam(this, FName, sizeof(FName)) == 0) { if (GetDefaultDirectory(Model, FName, sizeof(FName)) == 0) return 0; if (MView->Win->GetFile("Open file", sizeof(FName), FName, HIST_PATH, GF_OPEN) == 0) return 0; } if (strlen(FName) == 0) return 0; if (IsDirectory(FName)) return OpenDir(FName); return MultiFileLoad(0, FName, NULL, this); } int EView::FileOpenInMode(ExState &State) { char Mode[32] = ""; char FName[MAXPATH]; if (State.GetStrParam(this, Mode, sizeof(Mode)) == 0) if (MView->Win->GetStr("Mode", sizeof(Mode), Mode, HIST_SETUP) != 1) return 0; if (FindMode(Mode) == 0) { MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Invalid mode '%s'", Mode); return 0; } if (GetDefaultDirectory(Model, FName, sizeof(FName)) == 0) return 0; if (State.GetStrParam(this, FName, sizeof(FName)) == 0) if (MView->Win->GetFile("Open file", sizeof(FName), FName, HIST_PATH, GF_OPEN) == 0) return 0; if (IsDirectory(FName)) return OpenDir(FName); if (strlen(FName) == 0) return 0; return MultiFileLoad(0, FName, Mode, this); } int EView::SetPrintDevice(ExState &State) { char Dev[MAXPATH]; strcpy(Dev, PrintDevice); if (State.GetStrParam(this, Dev, sizeof(Dev)) == 0) if (MView->Win->GetStr("Print to", sizeof(Dev), Dev, HIST_SETUP) == 0) return 0; strcpy(PrintDevice, Dev); return 1; } int EView::ToggleSysClipboard(ExState &/*State*/) { SystemClipboard = SystemClipboard ? 0 : 1; Msg(S_INFO, "SysClipboard is now %s.", SystemClipboard ? "ON" : "OFF"); return 1; } int EView::ShowKey(ExState &/*State*/) { char buf[100]; KeySel ks; ks.Mask = 0; ks.Key = MView->Win->GetChar(0); GetKeyName(buf, sizeof(buf), ks); Msg(S_INFO, "Key: '%s' - '%8X'", buf, ks.Key); return 1; } void EView::Msg(int level, const char *s, ...) { char msgbuftmp[MSGBUFTMP_SIZE]; va_list ap; va_start(ap, s); vsprintf(msgbuftmp, s, ap); va_end(ap); if (level != S_BUSY) SetMsg(msgbuftmp); } void EView::SetMsg(const char *msg) { if (CurMsg) free(CurMsg); CurMsg = 0; if (msg && strlen(msg)) CurMsg = strdup(msg); if (CurMsg && msg && MView) { TDrawBuffer B; char SColor; int Cols, Rows; MView->ConQuerySize(&Cols, &Rows); if (MView->IsActive()) SColor = hcStatus_Active; else SColor = hcStatus_Normal; MoveChar(B, 0, Cols, ' ', SColor, Cols); MoveStr(B, 0, Cols, CurMsg, SColor, Cols); if (MView->Win->GetStatusContext() == MView) MView->ConPutBox(0, Rows - 1, Cols, 1, B); //printf("%s\n", Msg); } } int EView::ViewBuffers(ExState &/*State*/) { if (BufferList == 0) { BufferList = new BufferView(0, &ActiveModel); SwitchToModel(BufferList); } else { BufferList->UpdateList(); BufferList->Row = 1; SwitchToModel(BufferList); return 1; } return 0; } int EView::ViewRoutines(ExState &/*State*/) { //int rc = 1; //RoutineView *routines; EModel *M; EBuffer *Buffer; M = Model; if (M->GetContext() != CONTEXT_FILE) return 0; Buffer = (EBuffer *)M; if (Buffer->Routines == 0) { if (BFS(Buffer, BFS_RoutineRegexp) == 0) { MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "No routine regexp."); return 0; } Buffer->Routines = new RoutineView(0, &ActiveModel, Buffer); if (Buffer->Routines == 0) return 0; } else { Buffer->Routines->UpdateList(); } SwitchToModel(Buffer->Routines); return 1; } int EView::DirOpen(ExState &State) { char Path[MAXPATH]; if (State.GetStrParam(this, Path, sizeof(Path)) == 0) if (GetDefaultDirectory(Model, Path, sizeof(Path)) == 0) return 0; return OpenDir(Path); } int EView::OpenDir(char *Path) { char XPath[MAXPATH]; EDirectory *dir = 0; if (ExpandPath(Path, XPath, sizeof(XPath)) == -1) return 0; { EModel *x = Model; while (x) { if (x->GetContext() == CONTEXT_DIRECTORY) { if (filecmp(((EDirectory *)x)->Path, XPath) == 0) { dir = (EDirectory *)x; break; } } x = x->Next; if (x == Model) break; } } if (dir == 0) dir = new EDirectory(0, &ActiveModel, XPath); SelectModel(dir); return 1; } int EView::Compile(ExState &State) { static char Cmd[256] = ""; char Command[256] = ""; if (CompilerMsgs != 0 && CompilerMsgs->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Command, sizeof(Command)) == 0) { if (Model->GetContext() == CONTEXT_FILE) { EBuffer *B = (EBuffer *)Model; if (BFS(B, BFS_CompileCommand) != 0) strcpy(Cmd, BFS(B, BFS_CompileCommand)); } if (Cmd[0] == 0) strcpy(Cmd, CompileCommand); if (MView->Win->GetStr("Compile", sizeof(Cmd), Cmd, HIST_COMPILE) == 0) return 0; strcpy(Command, Cmd); } else { if (MView->Win->GetStr("Compile", sizeof(Command), Command, HIST_COMPILE) == 0) return 0; } return Compile(Command); } int EView::RunCompiler(ExState &State) { char Command[256] = ""; if (CompilerMsgs != 0 && CompilerMsgs->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Command, sizeof(Command)) == 0) { if (Model->GetContext() == CONTEXT_FILE) { EBuffer *B = (EBuffer *)Model; if (BFS(B, BFS_CompileCommand) != 0) strcpy(Command, BFS(B, BFS_CompileCommand)); } if (Command[0] == 0) strcpy(Command, CompileCommand); } return Compile(Command); } int EView::Compile(char *Command) { char Dir[MAXPATH] = ""; EMessages *msgs; if (CompilerMsgs != 0) { strcpy(Dir, CompilerMsgs->Directory); CompilerMsgs->RunPipe(Dir, Command); msgs = CompilerMsgs; } else { if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; msgs = new EMessages(0, &ActiveModel, Dir, Command); } SwitchToModel(msgs); return 1; } int EView::ViewMessages(ExState &/*State*/) { if (CompilerMsgs != 0) { SwitchToModel(CompilerMsgs); return 1; } return 0; } int EView::CompilePrevError(ExState &/*State*/) { if (CompilerMsgs != 0) return CompilerMsgs->CompilePrevError(this); return 0; } int EView::CompileNextError(ExState &/*State*/) { if (CompilerMsgs != 0) return CompilerMsgs->CompileNextError(this); return 0; } int EView::ShowVersion() { if (access("/usr/local/share/doc/efte/README", 0) == 0) FileLoad(0, "/usr/local/share/doc/efte/README", 0, this); else if (access("/usr/share/doc/efte/README", 0) == 0) FileLoad(0, "/usr/share/doc/efte/README", 0, this); else if (access("/efte/doc/README", 0) == 0) FileLoad(0, "/efte/doc/README", 0, this); else if (access("/efte/README", 0) == 0) FileLoad(0, "/efte/README", 0, this); else if (access("/Program Files/efte/doc/README", 0) == 0) FileLoad(0, "/Program Files/efte/doc/README", 0, this); else if (access("/Program Files (x86)/doc/README", 0) == 0) FileLoad(0, "/Program Files (x86)/doc/README", 0, this); else MView->Win->Choice(0, "About", 1, "O&K", PROGRAM " " VERSION " " COPYRIGHT); return 1; } int EView::ViewModeMap(ExState &/*State*/) { if (TheEventMapView != 0) TheEventMapView->ViewMap(GetEventMap()); else (void)new EventMapView(0, &ActiveModel, GetEventMap()); if (TheEventMapView != 0) SwitchToModel(TheEventMapView); else return 0; return 1; } int EView::ClearMessages() { if (CompilerMsgs != 0 && CompilerMsgs->Running) { Msg(S_INFO, "Running..."); return 0; } if (CompilerMsgs != 0) { CompilerMsgs->FreeErrors(); CompilerMsgs->UpdateList(); } return 1; } int EView::TagLoad(ExState &State) { char Tag[MAXPATH]; char FullTag[MAXPATH]; char const* pTagFile = getenv("TAGFILE"); if (pTagFile == NULL) { pTagFile = "tags"; } if (ExpandPath(pTagFile, Tag, sizeof(Tag)) == -1) return 0; if (State.GetStrParam(this, Tag, sizeof(Tag)) == 0) if (MView->Win->GetFile("Load tags", sizeof(Tag), Tag, HIST_TAGFILES, GF_OPEN) == 0) return 0; if (ExpandPath(Tag, FullTag, sizeof(FullTag)) == -1) return 0; if (!FileExists(FullTag)) { Msg(S_INFO, "Tag file '%s' not found.", FullTag); return 0; } return ::TagLoad(FullTag); } int EView::ConfigRecompile(ExState &/*State*/) { if (ConfigSourcePath == 0 || ConfigFileName[0] == 0) { Msg(S_ERROR, "Cannot recompile (must use external configuration)."); return 0; } char command[1024]; strlcpy(command, "cefte \"", sizeof(command)); strlcat(command, ConfigSourcePath, sizeof(command)); strlcat(command, "\" ", sizeof(command)); #ifdef UNIX if (ExpandPath("~/.efterc", command + strlen(command), sizeof(command) - strlen(command)) != 0) return 0; #else strlcat(command, "\"", sizeof(command)); strlcat(command, ConfigFileName, sizeof(command)); strlcat(command, "\"", sizeof(command)); #endif return Compile(command); } int EView::RemoveGlobalBookmark(ExState &State) { char name[256] = ""; if (State.GetStrParam(this, name, sizeof(name)) == 0) if (MView->Win->GetStr("Remove Global Bookmark", sizeof(name), name, HIST_BOOKMARK) == 0) return 0; if (markIndex.remove(name) == 0) { Msg(S_ERROR, "Error removing global bookmark %s.", name); return 0; } return 1; } int EView::GotoGlobalBookmark(ExState &State) { char name[256] = ""; if (State.GetStrParam(this, name, sizeof(name)) == 0) if (MView->Win->GetStr("Goto Global Bookmark", sizeof(name), name, HIST_BOOKMARK) == 0) return 0; if (markIndex.view(this, name) == 0) { Msg(S_ERROR, "Error locating global bookmark %s.", name); return 0; } return 1; } int EView::PopGlobalBookmark() { if (markIndex.popMark(this) == 0) { Msg(S_INFO, "Bookmark stack empty."); return 0; } return 1; } int EView::GetStrVar(int var, char *str, int buflen) { //switch (var) { //} return Model->GetStrVar(var, str, buflen); } int EView::GetIntVar(int var, int *value) { //switch (var) { //} return Model->GetIntVar(var, value); } int EView::Cvs(ExState &State) { static char Opts[128] = ""; char Options[128] = ""; if (CvsView != 0 && CvsView->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Options, sizeof(Options)) == 0) { if (MView->Win->GetStr("CVS options", sizeof(Opts), Opts, HIST_CVS) == 0) return 0; strcpy(Options, Opts); } else { if (MView->Win->GetStr("CVS options", sizeof(Options), Options, HIST_CVS) == 0) return 0; } return Cvs(Options); } int EView::RunCvs(ExState &State) { char Options[128] = ""; if (CvsView != 0 && CvsView->Running) { Msg(S_INFO, "Already running..."); return 0; } State.GetStrParam(this, Options, sizeof(Options)); return Cvs(Options); } int EView::Cvs(char *Options) { char Dir[MAXPATH] = ""; char Command[256] = ""; char buf[1024] = ""; char *OnFiles = buf; ECvs *cvs; if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; strcpy(Command, CvsCommand); strcat(Command, " "); if (Options[0] != 0) { strcat(Command, Options); strcat(Command, " "); } switch (Model->GetContext()) { case CONTEXT_FILE: if (JustFileName(((EBuffer *)Model)->FileName, OnFiles, sizeof(buf)) != 0) return 0; // OnFiles points to buf break; case CONTEXT_CVSDIFF: OnFiles = strdup(CvsDiffView->OnFiles); break; case CONTEXT_CVS: OnFiles = ((ECvs *)Model)->MarkedAsList(); if (!OnFiles) OnFiles = strdup(((ECvs *)Model)->OnFiles); break; } if (CvsView != 0) { CvsView->RunPipe(Dir, Command, OnFiles); cvs = CvsView; } else { cvs = new ECvs(0, &ActiveModel, Dir, Command, OnFiles); } if (OnFiles != buf) free(OnFiles); SwitchToModel(cvs); return 1; } int EView::ClearCvsMessages(ExState &/*State*/) { if (CvsView != 0) { if (CvsView->Running) { Msg(S_INFO, "Running..."); return 0; } else { CvsView->FreeLines(); CvsView->UpdateList(); return 1; } } return 0; } int EView::ViewCvs(ExState &/*State*/) { if (CvsView != 0) { SwitchToModel(CvsView); return 1; } return 0; } int EView::CvsDiff(ExState &State) { static char Opts[128] = ""; char Options[128] = ""; if (CvsDiffView != 0 && CvsDiffView->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Options, sizeof(Options)) == 0) { if (MView->Win->GetStr("CVS diff options", sizeof(Opts), Opts, HIST_CVSDIFF) == 0) return 0; strcpy(Options, Opts); } else { if (MView->Win->GetStr("CVS diff options", sizeof(Options), Options, HIST_CVSDIFF) == 0) return 0; } return CvsDiff(Options); } int EView::RunCvsDiff(ExState &State) { char Options[128] = ""; if (CvsDiffView != 0 && CvsDiffView->Running) { Msg(S_INFO, "Already running..."); return 0; } State.GetStrParam(this, Options, sizeof(Options)); return CvsDiff(Options); } int EView::CvsDiff(char *Options) { char Dir[MAXPATH] = ""; char Command[256] = ""; char buf[1024] = ""; char *OnFiles = buf; ECvsDiff *diffs; if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; strcpy(Command, CvsCommand); strcat(Command, " diff -c "); if (Options[0] != 0) { strcat(Command, Options); strcat(Command, " "); } switch (Model->GetContext()) { case CONTEXT_FILE: if (JustFileName(((EBuffer *)Model)->FileName, OnFiles, sizeof(buf)) != 0) return 0; // OnFiles points to buf break; case CONTEXT_CVSDIFF: OnFiles = strdup(CvsDiffView->OnFiles); break; case CONTEXT_CVS: OnFiles = ((ECvs *)Model)->MarkedAsList(); if (!OnFiles) OnFiles = strdup(((ECvs *)Model)->OnFiles); break; } if (CvsDiffView != 0) { CvsDiffView->RunPipe(Dir, Command, OnFiles); diffs = CvsDiffView; } else { diffs = new ECvsDiff(0, &ActiveModel, Dir, Command, OnFiles); } if (OnFiles != buf) free(OnFiles); SwitchToModel(diffs); return 1; } int EView::ViewCvsDiff(ExState &/*State*/) { if (CvsDiffView != 0) { SwitchToModel(CvsDiffView); return 1; } return 0; } int EView::CvsCommit(ExState &State) { static char Opts[128] = ""; char Options[128] = ""; if (CvsView != 0 && CvsView->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Options, sizeof(Options)) == 0) { if (MView->Win->GetStr("CVS commit options", sizeof(Opts), Opts, HIST_CVSCOMMIT) == 0) return 0; strcpy(Options, Opts); } else { if (MView->Win->GetStr("CVS commit options", sizeof(Options), Options, HIST_CVSCOMMIT) == 0) return 0; } return CvsCommit(Options); } int EView::RunCvsCommit(ExState &State) { char Options[128] = ""; if (CvsView != 0 && CvsView->Running) { Msg(S_INFO, "Already running..."); return 0; } State.GetStrParam(this, Options, sizeof(Options)); return CvsCommit(Options); } int EView::CvsCommit(char *Options) { char Dir[MAXPATH] = ""; char Command[256] = ""; char buf[1024] = ""; char *OnFiles = buf; ECvs *cvs; if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; strcpy(Command, CvsCommand); strcat(Command, " commit "); if (Options[0] != 0) { strcat(Command, Options); strcat(Command, " "); } switch (Model->GetContext()) { case CONTEXT_FILE: if (JustFileName(((EBuffer *)Model)->FileName, OnFiles, sizeof(buf)) != 0) return 0; // OnFiles points to buf break; case CONTEXT_CVSDIFF: OnFiles = strdup(CvsDiffView->OnFiles); break; case CONTEXT_CVS: OnFiles = ((ECvs *)Model)->MarkedAsList(); if (!OnFiles) OnFiles = strdup(((ECvs *)Model)->OnFiles); break; } if (CvsView == 0) cvs = new ECvs(0, &ActiveModel); else cvs = CvsView; SwitchToModel(cvs); cvs->RunCommit(Dir, Command, OnFiles); if (OnFiles != buf) free(OnFiles); return 1; } int EView::ViewCvsLog(ExState &/*State*/) { if (CvsLogView != 0) { SwitchToModel(CvsLogView); return 1; } return 0; } int EView::Svn(ExState &State) { static char Opts[128] = ""; char Options[128] = ""; if (SvnView != 0 && SvnView->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Options, sizeof(Options)) == 0) { if (MView->Win->GetStr("SVN options", sizeof(Opts), Opts, HIST_SVN) == 0) return 0; strcpy(Options, Opts); } else { if (MView->Win->GetStr("SVN options", sizeof(Options), Options, HIST_SVN) == 0) return 0; } return Svn(Options); } int EView::RunSvn(ExState &State) { char Options[128] = ""; if (SvnView != 0 && SvnView->Running) { Msg(S_INFO, "Already running..."); return 0; } State.GetStrParam(this, Options, sizeof(Options)); return Svn(Options); } int EView::Svn(char *Options) { char Dir[MAXPATH] = ""; char Command[256] = ""; char buf[1024] = ""; char *OnFiles = buf; ESvn *svn; if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; strcpy(Command, SvnCommand); strcat(Command, " "); if (Options[0] != 0) { strcat(Command, Options); strcat(Command, " "); } switch (Model->GetContext()) { case CONTEXT_FILE: if (JustFileName(((EBuffer *)Model)->FileName, OnFiles, sizeof(buf)) != 0) return 0; // OnFiles points to buf break; case CONTEXT_SVNDIFF: OnFiles = strdup(SvnDiffView->OnFiles); break; case CONTEXT_SVN: OnFiles = ((ESvn *)Model)->MarkedAsList(); if (!OnFiles) OnFiles = strdup(((ESvn *)Model)->OnFiles); break; } if (SvnView != 0) { SvnView->RunPipe(Dir, Command, OnFiles); svn = SvnView; } else { svn = new ESvn(0, &ActiveModel, Dir, Command, OnFiles); } if (OnFiles != buf) free(OnFiles); SwitchToModel(svn); return 1; } int EView::ClearSvnMessages(ExState &/*State*/) { if (SvnView != 0) { if (SvnView->Running) { Msg(S_INFO, "Running..."); return 0; } else { SvnView->FreeLines(); SvnView->UpdateList(); return 1; } } return 0; } int EView::ViewSvn(ExState &/*State*/) { if (SvnView != 0) { SwitchToModel(SvnView); return 1; } return 0; } int EView::SvnDiff(ExState &State) { static char Opts[128] = ""; char Options[128] = ""; if (SvnDiffView != 0 && SvnDiffView->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Options, sizeof(Options)) == 0) { if (MView->Win->GetStr("SVN diff options", sizeof(Opts), Opts, HIST_SVNDIFF) == 0) return 0; strcpy(Options, Opts); } else { if (MView->Win->GetStr("SVN diff options", sizeof(Options), Options, HIST_SVNDIFF) == 0) return 0; } return SvnDiff(Options); } int EView::RunSvnDiff(ExState &State) { char Options[128] = ""; if (SvnDiffView != 0 && SvnDiffView->Running) { Msg(S_INFO, "Already running..."); return 0; } State.GetStrParam(this, Options, sizeof(Options)); return SvnDiff(Options); } int EView::SvnDiff(char *Options) { char Dir[MAXPATH] = ""; char Command[256] = ""; char buf[1024] = ""; char *OnFiles = buf; ESvnDiff *diffs; if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; strcpy(Command, SvnCommand); strcat(Command, " diff "); if (Options[0] != 0) { strcat(Command, Options); strcat(Command, " "); } switch (Model->GetContext()) { case CONTEXT_FILE: if (JustFileName(((EBuffer *)Model)->FileName, OnFiles, sizeof(buf)) != 0) return 0; // OnFiles points to buf break; case CONTEXT_SVNDIFF: OnFiles = strdup(SvnDiffView->OnFiles); break; case CONTEXT_SVN: OnFiles = ((ESvn *)Model)->MarkedAsList(); if (!OnFiles) OnFiles = strdup(((ESvn *)Model)->OnFiles); break; } if (SvnDiffView != 0) { SvnDiffView->RunPipe(Dir, Command, OnFiles); diffs = SvnDiffView; } else { diffs = new ESvnDiff(0, &ActiveModel, Dir, Command, OnFiles); } if (OnFiles != buf) free(OnFiles); SwitchToModel(diffs); return 1; } int EView::ViewSvnDiff(ExState &/*State*/) { if (SvnDiffView != 0) { SwitchToModel(SvnDiffView); return 1; } return 0; } int EView::SvnCommit(ExState &State) { static char Opts[128] = ""; char Options[128] = ""; if (SvnView != 0 && SvnView->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Options, sizeof(Options)) == 0) { if (MView->Win->GetStr("SVN commit options", sizeof(Opts), Opts, HIST_SVNCOMMIT) == 0) return 0; strcpy(Options, Opts); } else { if (MView->Win->GetStr("SVN commit options", sizeof(Options), Options, HIST_SVNCOMMIT) == 0) return 0; } return SvnCommit(Options); } int EView::RunSvnCommit(ExState &State) { char Options[128] = ""; if (SvnView != 0 && SvnView->Running) { Msg(S_INFO, "Already running..."); return 0; } State.GetStrParam(this, Options, sizeof(Options)); return SvnCommit(Options); } int EView::SvnCommit(char *Options) { char Dir[MAXPATH] = ""; char Command[256] = ""; char buf[1024] = ""; char *OnFiles = buf; ESvn *svn; if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; strcpy(Command, SvnCommand); strcat(Command, " commit "); if (Options[0] != 0) { strcat(Command, Options); strcat(Command, " "); } switch (Model->GetContext()) { case CONTEXT_FILE: if (JustFileName(((EBuffer *)Model)->FileName, OnFiles, sizeof(buf)) != 0) return 0; // OnFiles points to buf break; case CONTEXT_SVNDIFF: OnFiles = strdup(SvnDiffView->OnFiles); break; case CONTEXT_SVN: OnFiles = ((ESvn *)Model)->MarkedAsList(); if (!OnFiles) OnFiles = strdup(((ESvn *)Model)->OnFiles); break; } if (SvnView == 0) svn = new ESvn(0, &ActiveModel); else svn = SvnView; SwitchToModel(svn); svn->RunCommit(Dir, Command, OnFiles); if (OnFiles != buf) free(OnFiles); return 1; } int EView::ViewSvnLog(ExState &/*State*/) { if (SvnLogView != 0) { SwitchToModel(SvnLogView); return 1; } return 0; } efte-1.1/src/config.h.in0000664000076400007640000000023311041374612014131 0ustar laurilauri#ifndef __CONFIG_H__ #define __CONFIG_H__ /* config.h. Generated by cmake from config.h.in */ #define EFTE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" #endif efte-1.1/src/c_hilit.h0000664000076400007640000001346411163156165013712 0ustar laurilauri/* c_hilit.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __HILIT_H__ #define __HILIT_H__ #include "console.h" #include "c_mode.h" #include "e_regex.h" #include class EBuffer; class ELine; typedef unsigned short hlState; typedef unsigned char hsState; #define HILIT_P(proc) \ int proc(EBuffer *BF, int LN, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) //typedef int (*SyntaxProc)(EBuffer *BF, int LN, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap); typedef HILIT_P((*SyntaxProc)); int Indent_Plain(EBuffer *B, int Line, int PosCursor); HILIT_P(Hilit_Plain); /* highlighting state */ HILIT_P(Hilit_C); HILIT_P(Hilit_PERL); HILIT_P(Hilit_MAKE); HILIT_P(Hilit_REXX); HILIT_P(Hilit_IPF); HILIT_P(Hilit_ADA); HILIT_P(Hilit_MSG); HILIT_P(Hilit_SH); HILIT_P(Hilit_PASCAL); HILIT_P(Hilit_TEX); HILIT_P(Hilit_FTE); HILIT_P(Hilit_CATBS); HILIT_P(Hilit_SIMPLE); int Indent_C(EBuffer *B, int Line, int PosCursor); int Indent_REXX(EBuffer *B, int Line, int PosCursor); int Indent_SIMPLE(EBuffer *B, int Line, int PosCursor); /* * NT has 2-byte charcode and attribute... Following is not portable to non- * intel; should be replaced by formal TCell definition' usage instead of * assumed array.. (Jal) */ #ifdef NTCONSOLE # define PCLI unsigned short #else # define PCLI unsigned char #endif #define HILIT_CLRD() \ ((Color < COUNT_CLR) ? Colors[Color] : Color - COUNT_CLR) #define ColorChar() \ do {\ BPos = C - Pos; \ if (B) \ if (BPos >= 0 && BPos < Width) { \ BPtr = (PCLI *) (B + BPos); \ BPtr[0] = *p; \ BPtr[1] = HILIT_CLRD(); \ } \ if (StateMap) StateMap[i] = (hsState)(State & 0xFF); \ } while (0) // MoveChar(B, C - Pos, Width, *p, Color, 1); // if (StateMap) StateMap[i] = State; } #define NextChar() do { i++; p++; len--; C++; } while (0) #define ColorNext() do { ColorChar(); NextChar(); } while (0) #define UntilMatchBrace(first, cmd) \ do { \ int Count[] = { 0, 0, 0, }; \ switch (first) \ { \ case '{': ++Count[0]; break; \ case '[': ++Count[1]; break; \ case '(': ++Count[2]; break; \ } \ \ while (len > 0) \ { \ switch (*p) { \ case '{': \ ++Count[0]; \ break; \ case '}': \ --Count[0]; \ break; \ case '[': \ ++Count[1]; \ break; \ case ']': \ --Count[1]; \ break; \ case '(': \ ++Count[2]; \ break; \ case ')': \ --Count[2]; \ break; \ } \ cmd; \ if (TEST_ZERO) \ break; \ } \ } while (0) #define HILIT_VARS(ColorTable, Line) \ PCLI *BPtr; \ int BPos; \ ChColor *Colors = ColorTable; \ ChColor Color = CLR_Normal; \ int i; \ int len = Line->Count; \ char *p = Line->Chars; \ int NC = 0, C = 0; \ int TabSize = BFI(BF, BFI_TabSize); \ int ExpandTabs = BFI(BF, BFI_ExpandTabs); //#define HILIT_VARS2() // int len1 = len; // char *last = p + len1 - 1; #define IF_TAB() \ if (*p == '\t' && ExpandTabs) { \ NC = NextTab(C, TabSize); \ if (StateMap) StateMap[i] = hsState(State);\ if (B) MoveChar(B, C - Pos, Width, ' ', HILIT_CLRD(), NC - C);\ if (BFI(BF, BFI_ShowTabs)) ColorChar();\ i++,len--,p++;\ C = NC;\ continue;\ } #define CK_MAXLEN 64 inline bool isZeroArray(int* Count, size_t len) { for (size_t i = 0; i < len; ++i) if (Count[i] != 0) return 0; return 1; } #define TEST_ZERO isZeroArray(Count, sizeof(Count)/sizeof(Count[0])) typedef struct { int TotalCount; int count[CK_MAXLEN]; char *key[CK_MAXLEN]; } ColorKeywords; struct HTrans { char *match; int matchLen; long matchFlags; int nextState; int color; RxNode *regexp; void InitTrans(); }; struct HState { int transCount; int firstTrans; int color; ColorKeywords keywords; char *wordChars; long options; int nextKwdMatchedState; int nextKwdNotMatchedState; int nextKwdNoCharState; void InitState(); int GetHilitWord(int len, char *str, ChColor &clr); }; class HMachine { public: int stateCount; int transCount; HState *state; HTrans *trans; HMachine(); ~HMachine(); void AddState(HState &aState); void AddTrans(HTrans &aTrans); HState *LastState() { return state + stateCount - 1; } }; class EColorize { public: char *Name; EColorize *Next; EColorize *Parent; int SyntaxParser; ColorKeywords Keywords; // keywords to highlight HMachine *hm; ChColor Colors[COUNT_CLR]; EColorize(const char *AName, const char *AParent); ~EColorize(); int SetColor(int clr, const char *value); }; extern EColorize *Colorizers; EColorize *FindColorizer(const char *AName); SyntaxProc GetHilitProc(int id); int IsState(hsState *Buf, hsState State, int Len); int LookAt(EBuffer *B, int Row, unsigned int Pos, const char *What, hsState State, int NoWord = 1, int CaseInsensitive = 0); inline int LookAtNoCase(EBuffer *B, int Row, unsigned int Pos, const char *What, hsState State, int NoWord = 1) { return LookAt(B, Row, Pos, What, State, NoWord, 1); } #endif /* __HILIT_H__ */ efte-1.1/src/con_ncurses.cpp0000664000076400007640000005104211137623545015147 0ustar laurilauri/* con_ncurses.cpp * * Ncurses front-end to fte - Don Mahurin * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include #include #include "sysdep.h" #include "c_config.h" #include "console.h" #include "gui.h" /* Escape sequence delay in milliseconds */ #define escDelay 10 /* translate fte colors to curses*/ static int fte_curses_colors[] = { COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE, }; static PCell *SavedScreen = 0; static int SavedW = 0, SavedH = 0; static int MaxSavedW = 0, MaxSavedH = 0; /* Routine to allocate/reallocate and zero space for screen buffer, represented as a dynamic array of dynamic PCell lines */ static void SaveScreen() { int NewSavedW, NewSavedH; ConQuerySize(&NewSavedW, &NewSavedH); if (!SavedScreen) { SavedScreen = (PCell *) malloc(NewSavedH * sizeof(PCell)); for (int j = 0 ; j < NewSavedH; j++) { SavedScreen[j] = (PCell)malloc(NewSavedW * sizeof(TCell)); bzero(SavedScreen[j], sizeof(SavedScreen[j])); } MaxSavedW = SavedW = NewSavedW; MaxSavedH = SavedH = NewSavedH; } else { if (NewSavedW > MaxSavedW) { /* Expand maximum width if needed */ for (int i = 0 ; i < MaxSavedH; i++) { // assert(sizeof(SavedScreen[i]) == MaxSavedH); SavedScreen[i] = (PCell)realloc(SavedScreen[i], NewSavedW * sizeof(TCell)); } MaxSavedW = NewSavedW; } if (NewSavedW > SavedW) { /* Zero newly expanded screen */ for (int i = 0 ; i < MaxSavedH; i++) { bzero(SavedScreen[i] + SavedW, NewSavedW - SavedW); } } if (NewSavedH > MaxSavedH) { /* Expand Maximum height if needed */ SavedScreen = (PCell *)realloc(SavedScreen, NewSavedH * sizeof(PCell)); for (int i = MaxSavedH ; i < NewSavedH; i++) { SavedScreen[i] = (PCell)malloc(MaxSavedW * sizeof(TCell)); } MaxSavedH = NewSavedH; } if (NewSavedH > SavedH) { /* Zero newly expanded screen */ for (int i = SavedH ; i < NewSavedH; i++) { bzero(SavedScreen[i], MaxSavedW); } } SavedW = NewSavedW; SavedH = NewSavedH; } } static void free_savedscreen() { if (! SavedScreen) return; for (int i = 0; i < MaxSavedH; i++) { if (SavedScreen[i]) { free(SavedScreen[i]); SavedScreen[i] = NULL; } } free(SavedScreen); SavedScreen = NULL; } static int fte_curses_attr[256]; static int key_sup = 0; static int key_sdown = 0; static int ConInitColors() { int c = 0; int colors = has_colors(); if (colors) start_color(); for (int bgb = 0 ; bgb < 2; bgb++) { /* bg bright bit */ for (int bg = 0 ; bg < 8; bg++) { for (int fgb = 0; fgb < 2; fgb++) { /* fg bright bit */ for (int fg = 0 ; fg < 8; fg++, c++) { if (colors) { int pair = bg * 8 + fg; if (c != 0) init_pair(pair, fte_curses_colors[fg], fte_curses_colors[bg]); fte_curses_attr[c] = (fgb ? A_BOLD : 0) | COLOR_PAIR(pair); } else { fte_curses_attr[c] = 0; if (fgb || bgb) { if (bg > fg) fte_curses_attr[c] |= (A_UNDERLINE | A_REVERSE); else fte_curses_attr[c] |= A_BOLD; } else if (bg > fg) fte_curses_attr[c] |= A_REVERSE; } } } } } return colors; } int ConInit(int /*XSize */ , int /*YSize */) { int ch; const char *s; ESCDELAY = escDelay; initscr(); ConInitColors(); mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL); /* cbreak (); */ raw(); noecho(); nonl(); keypad(stdscr, 1); meta(stdscr, 1); SaveScreen(); /* find shift up/down */ for (ch = KEY_MAX + 1;;ch++) { s = keyname(ch); if (s == NULL) break; if (!strcmp(s, "kUP")) key_sup = ch; else if (!strcmp(s, "kDN")) key_sdown = ch; if (key_sup > 0 && key_sdown > 0) break; } return 0; } int ConDone(void) { keypad(stdscr, 0); endwin(); free_savedscreen(); return 0; } int ConSuspend(void) { return 0; } int ConContinue(void) { return 0; } int ConSetTitle(char * /*Title */ , char * /*STitle */) { return 0; } int ConGetTitle(char *Title, int /*MaxLen */ , char * /*STitle */ , int /*SMaxLen */) { *Title = '\0'; return 0; } int ConClear() { /* not used? */ refresh(); return 0; } static unsigned int GetDch(int idx) { switch (idx) { case DCH_C1: return ACS_ULCORNER; case DCH_C2: return ACS_URCORNER; case DCH_C3: return ACS_LLCORNER; case DCH_C4: return ACS_LRCORNER; case DCH_H: return ACS_HLINE; case DCH_V: return ACS_VLINE; case DCH_M1: return ACS_HLINE; case DCH_M2: return ACS_LTEE; case DCH_M3: return ACS_RTEE; case DCH_M4 : return 'o'; break; case DCH_X: return 'X'; break; case DCH_RPTR: return ACS_RARROW; break; case DCH_EOL: return ACS_BULLET; break; case DCH_EOF: return ACS_DIAMOND; break; case DCH_END: return ACS_HLINE; break; case DCH_AUP: return ACS_UARROW; break; case DCH_ADOWN: return ACS_DARROW; break; case DCH_HFORE: return ACS_BLOCK; break; case DCH_HBACK: return ACS_CKBOARD; break; case DCH_ALEFT: return ACS_LARROW; break; case DCH_ARIGHT: return ACS_RARROW; break; default: return '@'; } } static int last_attr = A_NORMAL; // "Cell" is currently an integer type, but its contents is treated as // a char data struct. So, create a struct to cast it that way. typedef struct CellData { unsigned char ch; unsigned char attr; } CellData; int ConPutBox(int X, int Y, int W, int H, PCell Cell) { int CurX, CurY; getyx(stdscr, CurY, CurX); int yy = Y; if (Y + H > LINES) H = LINES - Y; for (int j = 0 ; j < H; j++) { memcpy(SavedScreen[Y+j] + X, Cell, W*sizeof(TCell)); // copy outputed line to saved screen move(yy++, X); for (int i = 0; i < W; i++) { CellData *celldata = (CellData *)Cell; unsigned char ch = celldata->ch; int attr = fte_curses_attr[celldata->attr]; if (attr != last_attr) { wattrset(stdscr, attr); last_attr = attr; } else attr = 0; if (ch < 32) { if (ch <= 20) { waddch(stdscr, GetDch(ch)); } else waddch(stdscr, '.'); } else if (ch < 128 || ch >= 160) { waddch(stdscr, ch); } /* else if(ch < 180) { waddch(stdscr,GetDch(ch-128)); } */ else { waddch(stdscr, '.'); } Cell++; } } move(CurY, CurX); refresh(); return 0; } int ConGetBox(int X, int Y, int W, int H, PCell Cell) { for (int j = 0 ; j < H; j++) { memcpy(Cell, SavedScreen[Y+j] + X, W*sizeof(TCell)); Cell += W; } return 0; } int ConPutLine(int X, int Y, int W, int H, PCell Cell) { for (int j = 0 ; j < H; j++) { ConPutBox(X, Y + j, W, 1, Cell); } return 0; } int ConSetBox(int X, int Y, int W, int H, TCell Cell) { PCell line = (PCell) malloc(sizeof(TCell) * W); int i; for (i = 0; i < W; i++) line[i] = Cell; ConPutLine(X, Y++, W, H, line); free(line); return 0; } int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { PCell box; box = new TCell [W * H]; TCell fill = (((unsigned) Fill) << 8) | ' '; ConGetBox(X, Y, W, H, box); if (Way == csUp) { ConPutBox(X, Y, W, H - Count, box + W * Count); ConSetBox(X, Y + H - Count, W, Count, fill); } else { ConPutBox(X, Y + Count, W, H - Count, box); ConSetBox(X, Y, W, Count, fill); } delete [](box); return 0; } int ConSetSize(int /*X */ , int /*Y */) { return -1; } static void ResizeWindow(int ww, int hh) { SaveScreen(); if (frames) { frames->Resize(ww, hh); frames->Repaint(); } } int ConQuerySize(int *X, int *Y) { *X = COLS; *Y = LINES; return 0; } int ConSetCursorPos(int X, int Y) { move(Y, X); refresh(); return 0; } int ConQueryCursorPos(int *X, int *Y) { getyx(stdscr, *Y, *X); return 0; } static int CurVis = 1; int ConShowCursor() { CurVis = 1; curs_set(1); return 0; } int ConHideCursor() { CurVis = 0; curs_set(0); return 0; } int ConCursorVisible() { return CurVis; } void ConSetInsertState(bool insert) { } int ConSetMousePos(int /*X */ , int /*Y */) { return -1; } int ConQueryMousePos(int *X, int *Y) { *X = 0; *Y = 0; return 0; } int ConShowMouse() { return -1; } int ConHideMouse() { return -1; } int ConMouseVisible() { return 0; } int ConQueryMouseButtons(int *ButtonCount) { *ButtonCount = 0; return 0; } static int ConGetMouseEvent( TEvent * Event) { MEVENT mevent; if (getmouse(&mevent) == ERR) { Event->What = evNone; return -1; } mmask_t bstate = mevent.bstate; Event->What = evNone; if (bstate & BUTTON1_PRESSED) { Event->What = Event->Mouse.What = evMouseDown; Event->Mouse.X = mevent.x; Event->Mouse.Y = mevent.y; Event->Mouse.Buttons = 1; Event->Mouse.Count = 1; } else if (bstate & BUTTON1_RELEASED) { Event->What = Event->Mouse.What = evMouseUp; Event->Mouse.X = mevent.x; Event->Mouse.Y = mevent.y; Event->Mouse.Buttons = 1; Event->Mouse.Count = (bstate & BUTTON1_DOUBLE_CLICKED) ? 2 : 1; } else if (bstate & BUTTON1_CLICKED) { Event->What = Event->Mouse.What = evMouseDown; Event->Mouse.X = mevent.x; Event->Mouse.Y = mevent.y; Event->Mouse.Buttons = 1; Event->Mouse.Count = 1; mevent.bstate ^= BUTTON1_CLICKED; mevent.bstate |= BUTTON1_RELEASED; ungetmouse(&mevent); } else if (bstate & BUTTON1_DOUBLE_CLICKED) { Event->Mouse.X = mevent.x; Event->Mouse.Y = mevent.y; Event->Mouse.Buttons = 1; Event->Mouse.Count = 2; mevent.bstate |= BUTTON1_RELEASED; ungetmouse(&mevent); } return 0; } static TEvent Prev = {evNone}; static int ConGetEscEvent(TEvent *Event) { int ch; TKeyEvent *KEvent = &(Event->Key); keypad(stdscr, 0); timeout(escDelay); ch = getch(); if (ch == 033) { ch = getch(); if (ch == '[' || ch == 'O') KEvent->Code |= kfAlt; } if (ch == ERR) { KEvent->Code |= kbEsc; } else if (ch == '[' || ch == 'O') { int ch1 = getch(); int endch = '\0'; int modch = '\0'; if (ch1 == ERR) { /* translate to Alt-[ or Alt-O */ KEvent->Code |= (kfAlt | ch); } else { if (ch1 >= '1' && ch1 <= '8') { // [n... endch = getch(); if (endch == ERR) { // //[n, not valid // TODO, should this be ALT-7 ? endch = '\0'; ch1 = '\0'; } } else { // [A endch = ch1; ch1 = '\0'; } if (endch == ';') { // [n;mX modch = getch(); endch = getch(); } else if (ch1 != '\0' && endch != '~' && endch != '$') { // [mA modch = ch1; ch1 = '\0'; } if (modch != '\0') { int ctAlSh = ch1 - '1'; if (ctAlSh & 0x4) KEvent->Code |= kfCtrl; if (ctAlSh & 0x2) KEvent->Code |= kfAlt; if (ctAlSh & 0x1) KEvent->Code |= kfShift; } switch (endch) { case 'A': KEvent->Code |= kbUp; break; case 'B': KEvent->Code |= kbDown; break; case 'C': KEvent->Code |= kbRight; break; case 'D': KEvent->Code |= kbLeft; break; case 'F': KEvent->Code |= kbEnd; break; case 'H': KEvent->Code |= kbHome; break; case 'a': KEvent->Code |= (kfShift | kbUp); break; case 'b': KEvent->Code |= (kfShift | kbDown); break; case 'c': KEvent->Code |= (kfShift | kbRight); break; case 'd': KEvent->Code |= (kfShift | kbLeft); break; case '$': KEvent->Code |= kfShift; case '~': switch (ch1 - '0') { case 1: KEvent->Code |= kbHome; break; case 2: KEvent->Code |= kbIns; break; case 3: KEvent->Code |= kbDel; break; case 4: KEvent->Code |= kbEnd; break; case 5: KEvent->Code |= kbPgUp; break; case 6: KEvent->Code |= kbPgDn; break; case 7: KEvent->Code |= kbHome; break; case 8: KEvent->Code |= kbEnd; break; default: Event->What |= evNone; break; } break; default: Event->What = evNone; break; } } } else { KEvent->Code |= kfAlt; if (ch == '\r' || ch == '\n') { KEvent->Code |= kbEnter; } else if (ch == '\t') { KEvent->Code |= kbTab; } else if (ch < 32) { KEvent->Code |= (kfCtrl | (ch + 0100)); } else { if (ch > 0x60 && ch < 0x7b) { /* Alt-A == Alt-a*/ ch -= 0x20; } KEvent->Code |= ch; } } timeout(-1); keypad(stdscr, 1); return 1; } extern int WaitPipeEvent(TEvent *Event, int WaitTime, int *fds, int nfds); int ConGetEvent(TEventMask /*EventMask */ , TEvent * Event, int WaitTime, int Delete) { int sfd[1]; int rtn; TKeyEvent *KEvent = &(Event->Key); if (WaitTime == 0) return -1; if (Prev.What != evNone) { *Event = Prev; if (Delete) Prev.What = evNone; return 1; } sfd[0] = STDIN_FILENO; if ((rtn = WaitPipeEvent(Event, -1, sfd, 1)) != 0) return rtn; int ch = wgetch(stdscr); Event->What = evKeyDown; KEvent->Code = 0; if (SevenBit && ch > 127 && ch < 256) { KEvent->Code |= kfAlt; ch -= 128; if (ch > 0x60 && ch < 0x7b) { /* Alt-A == Alt-a*/ ch -= 0x20; } } if (ch < 0) { Event->What = evNone; } else if (ch == 27) { ConGetEscEvent(Event); } else if (ch == '\r' || ch == '\n') { KEvent->Code |= kbEnter; } else if (ch == '\t') { KEvent->Code |= kbTab; } else if (ch < 32) { KEvent->Code |= (kfCtrl | (ch + 0100)); } else if (ch < 256) { KEvent->Code |= ch; } else { // > 255 switch (ch) { case KEY_RESIZE: ResizeWindow(COLS, LINES); Event->What = evNone; break; case KEY_MOUSE: Event->What = evNone; ConGetMouseEvent(Event); break; case KEY_SF: KEvent->Code = kfShift | kbDown; break; case KEY_SR: KEvent->Code = kfShift | kbUp; break; case KEY_SRIGHT: KEvent->Code = kfShift | kbRight; break; case KEY_SLEFT: KEvent->Code = kfShift | kbLeft; break; case KEY_SDC: KEvent->Code = kfShift | kbDel; break; case KEY_SIC: KEvent->Code = kfShift | kbIns; break; case KEY_SHOME: KEvent->Code = kfShift | kbHome; break; case KEY_SEND: KEvent->Code = kfShift | kbEnd; break; case KEY_SNEXT: KEvent->Code = kfShift | kbPgDn; break; case KEY_SPREVIOUS: KEvent->Code = kfShift | kbPgUp; break; case KEY_UP: KEvent->Code = kbUp; break; case KEY_DOWN: KEvent->Code = kbDown; break; case KEY_RIGHT: KEvent->Code = kbRight; break; case KEY_LEFT: KEvent->Code = kbLeft; break; case KEY_DC: KEvent->Code = kbDel; break; case KEY_IC: KEvent->Code = kbIns; break; case KEY_BACKSPACE: KEvent->Code = kbBackSp; break; case KEY_HOME: KEvent->Code = kbHome; break; case KEY_END: case KEY_LL: // used in old termcap/infos KEvent->Code = kbEnd; break; case KEY_NPAGE: KEvent->Code = kbPgDn; break; case KEY_PPAGE: KEvent->Code = kbPgUp; break; case KEY_F(1): KEvent->Code = kbF1; break; case KEY_F(2): KEvent->Code = kbF2; break; case KEY_F(3): KEvent->Code = kbF3; break; case KEY_F(4): KEvent->Code = kbF4; break; case KEY_F(5): KEvent->Code = kbF5; break; case KEY_F(6): KEvent->Code = kbF6; break; case KEY_F(7): KEvent->Code = kbF7; break; case KEY_F(8): KEvent->Code = kbF8; break; case KEY_F(9): KEvent->Code = kbF9; break; case KEY_F(10): KEvent->Code = kbF10; break; case KEY_F(11): KEvent->Code = kbF11; break; case KEY_F(12): KEvent->Code = kbF12; break; case KEY_B2: KEvent->Code = kbCenter; break; case KEY_ENTER: /* shift enter */ KEvent->Code |= kbEnter; break; default: if (key_sdown != 0 && ch == key_sdown) KEvent->Code = kfShift | kbDown; else if (key_sup != 0 && ch == key_sup) KEvent->Code = kfShift | kbUp; else { Event->What = evNone; // fprintf(stderr, "Unknown 0x%x %d\n", ch, ch); } break; } } if (!Delete) Prev = *Event; return 1; } char ConGetDrawChar(int idx) { // return 128+idx; return idx; } int ConPutEvent(TEvent Event) { Prev = Event; return 0; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) { fArgc = argc; fArgv = argv; ::ConInit(-1, -1); ::ConSetSize(XSize, YSize); gui = this; } GUI::~GUI() { ::ConDone(); gui = 0; } int GUI::ConSuspend(void) { return::ConSuspend(); } int GUI::ConContinue(void) { return::ConContinue(); } int GUI::ShowEntryScreen() { return 1; } int GUI::RunProgram(int /*mode */ , char *Command) { int rc, W, H, W1, H1; ConQuerySize(&W, &H); ConHideMouse(); ConSuspend(); if (*Command == 0) // empty string = shell Command = getenv("SHELL"); rc = system(Command); ConContinue(); ConShowMouse(); ConQuerySize(&W1, &H1); if (W != W1 || H != H1) { frames->Resize(W1, H1); } frames->Repaint(); return rc; } efte-1.1/src/e_line.cpp0000664000076400007640000001222011066235663014055 0ustar laurilauri/* e_line.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" ELine::ELine(int ACount, const char *AChars) { Chars = NULL; Count = ACount; Allocate(Count); StateE = 0; IndentContinuation = -1; if (AChars) memcpy(Chars, AChars, Count); else memset(Chars, ' ', Count); } ELine::ELine(char *AChars, int ACount) { Chars = AChars; Count = ACount; StateE = 0; IndentContinuation = -1; } ELine::~ELine() { if (Chars) free(Chars); } int ELine::Allocate(unsigned int Bytes) { unsigned int Allocated; Allocated = (Bytes | CHAR_TRESHOLD); if (Chars) Chars = (char *) realloc(Chars, Allocated); else Chars = (char *) malloc(Allocated); if (Chars == NULL) return 0; return 1; } int EBuffer::ScreenPos(ELine *L, int Offset) { int ExpandTabs = BFI(this, BFI_ExpandTabs); int TabSize = BFI(this, BFI_TabSize); if (!ExpandTabs) { return Offset; } else { char *p = L->Chars; int Len = L->Count; int Pos = 0; int Ofs = Offset; if (Ofs > Len) { while (Len > 0) { if (*p++ != '\t') Pos++; else Pos = NextTab(Pos, TabSize); Len--; } Pos += Ofs - L->Count; } else { while (Ofs > 0) { if (*p++ != '\t') Pos++; else Pos = NextTab(Pos, TabSize); Ofs--; } } return Pos; } } int EBuffer::CharOffset(ELine *L, int ScreenPos) { int ExpandTabs = BFI(this, BFI_ExpandTabs); int TabSize = BFI(this, BFI_TabSize); if (!ExpandTabs) { return ScreenPos; } else { int Pos = 0; int Ofs = 0; char *p = L->Chars; int Len = L->Count; while (Len > 0) { if (*p++ != '\t') Pos++; else Pos = NextTab(Pos, TabSize); if (Pos > ScreenPos) return Ofs; Ofs++; Len--; } return Ofs + ScreenPos - Pos; } } int EBuffer::Allocate(int ACount) { PELine *L; L = (PELine *) realloc(LL, sizeof(PELine) * (ACount + 1)); if (L == 0 && ACount != 0) return 0; RAllocated = ACount; LL = L; return 1; } int EBuffer::MoveRGap(int RPos) { int GapSize = RAllocated - RCount; if (RGap == RPos) return 1; if (RPos < 0 || RPos > RCount) return 0; if (RGap < RPos) { if (RPos - RGap == 1) { LL[RGap] = LL[RGap + GapSize]; } else { memmove(LL + RGap, LL + RGap + GapSize, sizeof(PELine) * (RPos - RGap)); } } else { if (RGap - RPos == 1) { LL[RPos + GapSize] = LL[RPos]; } else { memmove(LL + RPos + GapSize, LL + RPos, sizeof(PELine) * (RGap - RPos)); } } RGap = RPos; return 1; } int EBuffer::AllocVis(int ACount) { int *V; V = (int *) realloc(VV, sizeof(int) * (ACount + 1)); if (V == 0 && ACount != 0) return 0; VAllocated = ACount; VV = V; return 1; } int EBuffer::MoveVGap(int VPos) { int GapSize = VAllocated - VCount; if (VGap == VPos) return 1; if (VPos < 0 || VPos > VCount) return 0; if (VGap < VPos) { if (VPos - VGap == 1) { VV[VGap] = VV[VGap + GapSize]; } else { memmove(VV + VGap, VV + VGap + GapSize, sizeof(VV[0]) * (VPos - VGap)); } } else { if (VGap - VPos == 1) { VV[VPos + GapSize] = VV[VPos]; } else { memmove(VV + VPos + GapSize, VV + VPos, sizeof(VV[0]) * (VGap - VPos)); } } VGap = VPos; return 1; } int EBuffer::RToV(int No) { int L = 0, R = VCount, M, V; if (No > Vis(VCount - 1) + VCount - 1) // beyond end return -1; if (No < VCount) // no folds before (direct match) if (Vis(No) == 0) return No; while (L < R) { M = (L + R) >> 1; V = Vis(M) + M; if (V == No) return M; else if (V > No) R = M; else L = M + 1; } return -1; } int EBuffer::RToVN(int No) { int L = 0, R = VCount, M, V; if (No == RCount) return VCount; if (No > Vis(VCount - 1) + VCount - 1) return VCount - 1; if (No < VCount) if (Vis(No) == 0) return No; while (L < R) { M = (L + R) >> 1; V = Vis(M) + M; if (V == No) return M; else if (V > No) R = M; else { if (M == VCount - 1) return M; else if (Vis(M + 1) + M + 1 > No) return M; L = M + 1; } } return R; } efte-1.1/src/e_file.cpp0000664000076400007640000000501211041404761014034 0ustar laurilauri/* e_file.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" EBuffer *FindFile(char *FileName) { EModel *M; EBuffer *B; M = ActiveModel; while (M) { if (M->GetContext() == CONTEXT_FILE) { B = (EBuffer *)M; if (filecmp(B->FileName, FileName) == 0) { return B; } } M = M->Next; if (M == ActiveModel) break; } return 0; } #if 0 static void SwitchModel(EModel *AModel) { if (AModel != AcgiveModel && MM && AModel) { AModel->Prev->Next = AModel->Next; AModel->Next->Prev = AModel->Prev; AModel->Next = MM; AModel->Prev = MM->Prev; AModel->Prev->Next = AModel; MM->Prev = AModel; MM = AModel; } } #endif int FileLoad(int createFlags, const char *FileName, const char *Mode, EView *View) { char Name[MAXPATH]; EBuffer *B; assert(View != 0); if (ExpandPath(FileName, Name, sizeof(Name)) == -1) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Invalid path: %s.", FileName); return 0; } B = FindFile(Name); if (B) { if (Mode != 0) B->SetFileName(Name, Mode); View->SwitchToModel(B); return 1; } B = new EBuffer(createFlags, &ActiveModel, Name); B->SetFileName(Name, Mode); View->SwitchToModel(B); return 1; } int MultiFileLoad(int createFlags, const char *FileName, const char *Mode, EView *View) { char fX[MAXPATH]; int count = 0; char FPath[MAXPATH]; char FName[MAXPATH]; FileFind *ff; FileInfo *fi; int rc; assert(View != 0); JustDirectory(FileName, fX, sizeof(fX)); if (fX[0] == 0) strcpy(fX, "."); JustFileName(FileName, FName, sizeof(FName)); if (ExpandPath(fX, FPath, sizeof(FPath)) == -1) return 0; Slash(FPath, 1); ff = new FileFind(FPath, FName, ffHIDDEN | ffFULLPATH); if (ff == 0) return 0; rc = ff->FindFirst(&fi); while (rc == 0) { count++; if (FileLoad(createFlags, fi->Name(), Mode, View) == 0) { delete fi; delete ff; return 0; } delete fi; rc = ff->FindNext(&fi); } delete ff; if (count == 0) return FileLoad(createFlags, FileName, Mode, View); return 1; } efte-1.1/src/o_routine.cpp0000664000076400007640000001231611041404761014621 0ustar laurilauri/* o_routine.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" RoutineView::RoutineView(int createFlags, EModel **ARoot, EBuffer *AB): EList(createFlags, ARoot, "Routines") { SearchLen = 0; Buffer = AB; if (Buffer->rlst.Count == 0) Buffer->ScanForRoutines(); Row = 0; int Row = Buffer->VToR(Buffer->CP.Row); for (int i = Buffer->rlst.Count - 1; i >= 0; --i) if (Row >= Buffer->rlst.Lines[i]) { Row = i; break; } { char CTitle[256]; sprintf(CTitle, "Routines %s: %d", Buffer->FileName, Buffer->rlst.Count); SetTitle(CTitle); } } RoutineView::~RoutineView() { Buffer->Routines = 0; } EEventMap *RoutineView::GetEventMap() { return FindEventMap("ROUTINES"); } int RoutineView::ExecCommand(int Command, ExState &State) { switch (Command) { case ExRescan: CancelSearch(); Buffer->ScanForRoutines(); UpdateList(); return ErOK; case ExActivateInOtherWindow: CancelSearch(); if (Row < Buffer->rlst.Count) { View->Next->SwitchToModel(Buffer); Buffer->CenterPosR(0, Buffer->rlst.Lines[Row]); return ErOK; } return ErFAIL; case ExCloseActivate: CancelSearch(); return ErFAIL; } return EList::ExecCommand(Command, State); } void RoutineView::HandleEvent(TEvent &Event) { int resetSearch = 1; EModel::HandleEvent(Event); switch (Event.What) { case evKeyUp: resetSearch = 0; break; case evKeyDown: switch (kbCode(Event.Key.Code)) { case kbBackSp: resetSearch = 0; if (SearchLen > 0) { SearchString[--SearchLen] = 0; Row = SearchPos[SearchLen]; Msg(S_INFO, "Search: [%s]", SearchString); } else Msg(S_INFO, ""); break; case kbEsc: Msg(S_INFO, ""); break; default: resetSearch = 0; if (isAscii(Event.Key.Code) && (SearchLen < MAXISEARCH)) { char Ch = (char) Event.Key.Code; SearchPos[SearchLen] = Row; SearchString[SearchLen] = Ch; SearchString[++SearchLen] = 0; int i = getMatchingLine(Row, 1); if (i == -1) SearchString[--SearchLen] = 0; else Row = i; Msg(S_INFO, "Search: [%s]", SearchString); } break; } } if (resetSearch) { SearchLen = 0; } } /** * Search for next line containing SearchString starting from line 'start'. * Direction should be 1 for ascending and -1 for descending. * Returns line found or -1 if none. */ int RoutineView::getMatchingLine(int start, int direction) { int i = start; do { char *str = Buffer->RLine(Buffer->rlst.Lines[i])->Chars; for (int j = 0; str[j]; j++) { if (str[j] == SearchString[0] && strnicmp(SearchString, str + j, SearchLen) == 0) { return i; } } i += direction; if (i == Count) i = 0; else if (i == -1) i = Count - 1; } while (i != start); return -1; } void RoutineView::DrawLine(PCell B, int Line, int Col, ChColor color, int Width) { if (Buffer->RLine(Buffer->rlst.Lines[Line])->Count > Col) { char str[1024]; int len; len = UnTabStr(str, sizeof(str), Buffer->RLine(Buffer->rlst.Lines[Line])->Chars, Buffer->RLine(Buffer->rlst.Lines[Line])->Count); if (len > Col) MoveStr(B, 0, Width, str + Col, color, len - Col); } } char* RoutineView::FormatLine(int Line) { char *p = 0; PELine L = Buffer->RLine(Buffer->rlst.Lines[Line]); p = (char *) malloc(L->Count + 1); if (p) { memcpy(p, L->Chars, L->Count); p[L->Count] = 0; } return p; } int RoutineView::Activate(int No) { CancelSearch(); if (No < Buffer->rlst.Count) { View->SwitchToModel(Buffer); Buffer->CenterPosR(0, Buffer->rlst.Lines[No]); return 1; } return 0; } void RoutineView::CancelSearch() { SearchLen = 0; Msg(S_INFO, ""); } void RoutineView::RescanList() { Buffer->ScanForRoutines(); UpdateList(); NeedsRedraw = 1; } void RoutineView::UpdateList() { Count = Buffer->rlst.Count; NeedsUpdate = 1; } int RoutineView::GetContext() { return CONTEXT_ROUTINES; } void RoutineView::GetName(char *AName, int MaxLen) { strncpy(AName, "Routines", MaxLen); } void RoutineView::GetInfo(char *AInfo, int /*MaxLen*/) { sprintf(AInfo, "%2d %04d/%03d Routines (%s)", ModelNo, Row + 1, Count, Buffer->FileName); } void RoutineView::GetTitle(char *ATitle, int /*MaxLen*/, char *ASTitle, int SMaxLen) { sprintf(ATitle, "Routines: %s", Buffer->FileName); strncpy(ASTitle, "Routines", SMaxLen); ASTitle[SMaxLen - 1] = 0; } efte-1.1/src/ftepm.rc0000664000076400007640000000113307045071303013547 0ustar laurilauri#include ICON 1 icons\ftepm.ico BITMAP 101 bmps\exit.bmp BITMAP 102 bmps\open.bmp BITMAP 103 bmps\save.bmp BITMAP 104 bmps\close.bmp BITMAP 105 bmps\prev.bmp BITMAP 106 bmps\last.bmp BITMAP 107 bmps\next.bmp BITMAP 108 bmps\undo.bmp BITMAP 109 bmps\redo.bmp BITMAP 110 bmps\cut.bmp BITMAP 111 bmps\copy.bmp BITMAP 112 bmps\paste.bmp BITMAP 113 bmps\pastecol.bmp BITMAP 114 bmps\errprev.bmp BITMAP 115 bmps\errnext.bmp BITMAP 116 bmps\tagfind.bmp BITMAP 117 bmps\tagnext.bmp BITMAP 118 bmps\tagprev.bmp BITMAP 119 bmps\tagpop.bmp MENU 1 BEGIN MENUITEM "Quit", 100 END rcinclude pmdlg.rc efte-1.1/src/e_cmds.cpp0000664000076400007640000011207111163156165014056 0ustar laurilauri/* e_cmds.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int EBuffer::MoveLeft() { if (CP.Col == 0) { if (CursorWithinEOL == 1 && MoveUp()) return MoveLineEnd(); else return 0; } SetPos(CP.Col - 1, CP.Row, tmLeft); return 1; } int EBuffer::MoveRight() { if (CursorWithinEOL == 1 && CP.Col == LineLen()) { if (MoveDown()) return MoveLineStart(); else return 0; } SetPos(CP.Col + 1, CP.Row, tmRight); return 1; } int EBuffer::MoveUp() { if (LastUpDownColumn == -1) LastUpDownColumn = CP.Col; if (CP.Row == 0) return 0; SetPos(CP.Col, CP.Row - 1, tmLeft); if (CursorWithinEOL == 1) { MoveLineEnd(); if (CP.Col > LastUpDownColumn) SetPos(LastUpDownColumn, CP.Row); } return 1; } int EBuffer::MoveDown() { if (LastUpDownColumn == -1) LastUpDownColumn = CP.Col; if (CP.Row == VCount - 1) return 0; SetPos(CP.Col, CP.Row + 1, tmLeft); if (CursorWithinEOL == 1) { MoveLineEnd(); if (CP.Col > LastUpDownColumn) SetPos(LastUpDownColumn, CP.Row); } return 1; } int EBuffer::MovePrev() { if (MoveLeft()) return 1; if (MoveUp() && MoveLineEnd()) return 1; return 0; } int EBuffer::MoveNext() { if (CP.Col < LineLen()) if (MoveRight()) return 1; if (MoveDown() && MoveLineStart()) return 1; return 0; } int EBuffer::MoveWordLeftX(int start) { if (CP.Col > 0) { int wS = start, wE = 1 - start; PELine L = VLine(CP.Row); int C, P; C = CP.Col; P = CharOffset(L, C); if (P > L->Count) P = L->Count; if (P > 0) { while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == wE)) P--; while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == wS)) P--; C = ScreenPos(L, P); return SetPos(C, CP.Row); } else return 0; } else return 0; } int EBuffer::MoveWordRightX(int start) { PELine L = VLine(CP.Row); int C, P; int wS = start, wE = 1 - start; C = CP.Col; P = CharOffset(L, C); if (P >= L->Count) return 0; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == wS)) P++; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == wE)) P++; C = ScreenPos(L, P); return SetPos(C, CP.Row); } int EBuffer::MoveWordLeft() { return MoveWordLeftX(1); } int EBuffer::MoveWordRight() { return MoveWordRightX(1); } int EBuffer::MoveWordPrev() { if (MoveWordLeft()) return 1; if (MoveUp() && MoveLineEnd()) return 1; return 0; } int EBuffer::MoveWordNext() { if (MoveWordRight()) return 1; if (MoveDown() && MoveLineStart()) return 1; return 0; } int EBuffer::MoveWordEndLeft() { return MoveWordLeftX(0); } int EBuffer::MoveWordEndRight() { return MoveWordRightX(0); } int EBuffer::MoveWordEndPrev() { if (MoveWordEndLeft()) return 1; if (MoveUp() && MoveLineEnd()) return 1; return 0; } int EBuffer::MoveWordEndNext() { if (MoveWordEndRight()) return 1; if (MoveDown() && MoveLineStart()) return 1; return 0; } int EBuffer::MoveWordOrCapLeft() { if (CP.Col > 0) { PELine L = VLine(CP.Row); int C, P; C = CP.Col; P = CharOffset(L, C); if (P > L->Count) P = L->Count; if (P > 0) { while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == 0)) P--; while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == 1) && (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 0)) P--; while ((P > 0) && (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 1)) P--; C = ScreenPos(L, P); return SetPos(C, CP.Row); } else return 0; } else return 0; } int EBuffer::MoveWordOrCapRight() { PELine L = VLine(CP.Row); int C, P; C = CP.Col; P = CharOffset(L, C); if (P >= L->Count) return 0; while ((P < L->Count) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 1)) P++; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == 1) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 0)) P++; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == 0)) P++; C = ScreenPos(L, P); return SetPos(C, CP.Row); } int EBuffer::MoveWordOrCapPrev() { if (MoveWordOrCapLeft()) return 1; if (MoveUp() && MoveLineEnd()) return 1; return 0; } int EBuffer::MoveWordOrCapNext() { if (MoveWordOrCapRight()) return 1; if (MoveDown() && MoveLineStart()) return 1; return 0; } int EBuffer::MoveWordOrCapEndLeft() { if (CP.Col > 0) { PELine L = VLine(CP.Row); int C, P; C = CP.Col; P = CharOffset(L, C); if (P > L->Count) P = L->Count; if (P > 0) { while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == 1) && (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 0)) P--; while ((P > 0) && (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 1)) P--; while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == 0)) P--; C = ScreenPos(L, P); return SetPos(C, CP.Row); } else return 0; } else return 0; } int EBuffer::MoveWordOrCapEndRight() { PELine L = VLine(CP.Row); int C, P; C = CP.Col; P = CharOffset(L, C); if (P >= L->Count) return 0; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == 0)) P++; while ((P < L->Count) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 1)) P++; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == 1) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 0)) P++; C = ScreenPos(L, P); return SetPos(C, CP.Row); } int EBuffer::MoveWordOrCapEndPrev() { if (MoveWordOrCapEndLeft()) return 1; if (MoveUp() && MoveLineEnd()) return 1; return 0; } int EBuffer::MoveWordOrCapEndNext() { if (MoveWordOrCapEndRight()) return 1; if (MoveDown() && MoveLineStart()) return 1; return 0; } int EBuffer::MoveLineStart() { SetPos(0, CP.Row); return 1; } int EBuffer::MoveLineEnd() { SetPos(LineLen(VToR(CP.Row)), CP.Row); return 1; } int EBuffer::MovePageUp() { return ScrollDown(GetVPort()->Rows); } int EBuffer::MovePageDown() { return ScrollUp(GetVPort()->Rows); } int EBuffer::MovePageLeft() { return ScrollRight(GetVPort()->Cols); } int EBuffer::MovePageRight() { return ScrollRight(GetVPort()->Cols); } int EBuffer::MovePageStart() { SetPos(CP.Col, GetVPort()->TP.Row, tmLeft); return 1; } int EBuffer::MovePageEnd() { SetNearPos(CP.Col, GetVPort()->TP.Row + GetVPort()->Rows - 1, tmLeft); return 1; } int EBuffer::MoveFileStart() { SetPos(0, 0); return 1; } int EBuffer::MoveFileEnd() { SetPos(LineLen(VToR(VCount - 1)), VCount - 1); return 1; } int EBuffer::MoveBlockStart() { if (BB.Col == -1 && BB.Row == -1) return 0; assert(BB.Col >= 0 && BB.Row >= 0 && BB.Row < RCount); if (SetPosR(BB.Col, BB.Row)) return 1; return 0; } int EBuffer::MoveBlockEnd() { if (BE.Col == -1 && BE.Row == -1) return 0; assert(BE.Col >= 0 && BE.Row >= 0 && BE.Row < RCount); if (SetPosR(BE.Col, BE.Row)) return 1; return 0; } int EBuffer::MoveFirstNonWhite() { int C = 0, P = 0; PELine L = VLine(CP.Row); while (C < L->Count) { if (L->Chars[C] == ' ') P++; else if (L->Chars[C] == 9) P = NextTab(P, BFI(this, BFI_TabSize)); else break; C++; } if (SetPos(P, CP.Row) == 0) return 0; return 1; } int EBuffer::MoveLastNonWhite() { int C = LineLen(), P; PELine L = VLine(CP.Row); while (C > 0) { if (L->Chars[C - 1] == ' ' || L->Chars[C - 1] == 9) C--; else break; } P = ScreenPos(VLine(CP.Row), C); if (SetPos(P, CP.Row) == 0) return 0; return 1; } int EBuffer::MovePrevEqualIndent() { int L = VToR(CP.Row); int I = LineIndented(L); while (--L >= 0) if ((RLine(L)->Count > 0) && (LineIndented(L) == I)) return SetPosR(I, L); return 0; } int EBuffer::MoveNextEqualIndent() { int L = VToR(CP.Row); int I = LineIndented(L); while (L++ < RCount - 1) if ((RLine(L)->Count > 0) && (LineIndented(L) == I)) return SetPosR(I, L); return 0; } int EBuffer::MoveNextTab() { int P = CP.Col; P = NextTab(P, BFI(this, BFI_TabSize)); return SetPos(P, CP.Row); } int EBuffer::MovePrevTab() { int P = CP.Col; if (P > 0) { P = ((P - 1) / BFI(this, BFI_TabSize)) * BFI(this, BFI_TabSize); return SetPos(P, CP.Row); } else return 0; } int EBuffer::MoveLineTop() { if (View) if (GetVPort()->SetTop(GetVPort()->TP.Col, CP.Row) == 0) return 0; return 1; } int EBuffer::MoveLineCenter() { if (View) { int Row = CP.Row - GetVPort()->Rows / 2; if (Row < 0) Row = 0; if (GetVPort()->SetTop(GetVPort()->TP.Col, Row) == 0) return 0; } return 1; } int EBuffer::MoveLineBottom() { if (View) { int Row = CP.Row - GetVPort()->Rows + 1; if (Row < 0) Row = 0; if (GetVPort()->SetTop(GetVPort()->TP.Col, Row) == 0) return 0; } return 1; } int EBuffer::MovePrevPos() { if (PrevPos.Col == -1 || PrevPos.Row == -1) return 0; if (SetPosR(PrevPos.Col, PrevPos.Row) == 0) return 0; return 1; } int EBuffer::MoveSavedPosCol() { if (SavedPos.Col == -1) return 0; if (SetPos(SavedPos.Col, CP.Row) == 0) return 0; return 1; } int EBuffer::MoveSavedPosRow() { if (SavedPos.Row == -1) return 0; if (SetPosR(CP.Col, SavedPos.Row) == 0) return 0; return 1; } int EBuffer::MoveSavedPos() { if (SavedPos.Col == -1 || SavedPos.Row == -1) return 0; if (SetPosR(SavedPos.Col, SavedPos.Row) == 0) return 0; return 1; } int EBuffer::SavePos() { SavedPos = CP; SavedPos.Row = VToR(CP.Row); return 1; } int EBuffer::MoveTabStart() { PELine X = VLine(CP.Row); int C = CharOffset(X, CP.Col); if (C < X->Count) if (X->Chars[C] == 9) return SetPos(ScreenPos(X, C), CP.Row); return 1; } int EBuffer::MoveTabEnd() { PELine X = VLine(CP.Row); int C = CharOffset(X, CP.Col); if (C < X->Count) if (X->Chars[C] == 9) if (ScreenPos(X, C) < CP.Col) return SetPos(ScreenPos(X, C + 1), CP.Row); return 1; } int EBuffer::ScrollLeft(int Cols) { int C = GetVPort()->TP.Col; if (SetNearPos(CP.Col + Cols, CP.Row, tmLeft) == 0) return 0; if (GetVPort()->SetTop(C + Cols, GetVPort()->TP.Row) == 0) return 0; return 1; } int EBuffer::ScrollRight(int Cols) { int C = GetVPort()->TP.Col; if (SetNearPos(CP.Col - Cols, CP.Row, tmLeft) == 0) return 0; if (GetVPort()->SetTop(C - Cols, GetVPort()->TP.Row) == 0) return 0; return 1; } int EBuffer::ScrollDown(int Lines) { int L = GetVPort()->TP.Row; if (SetNearPos(CP.Col, CP.Row - Lines, tmLeft) == 0) return 0; if (GetVPort()->SetTop(GetVPort()->TP.Col, L - Lines) == 0) return 0; return 1; } int EBuffer::ScrollUp(int Lines) { int L = GetVPort()->TP.Row; if (SetNearPos(CP.Col, CP.Row + Lines, tmLeft) == 0) return 0; if (GetVPort()->SetTop(GetVPort()->TP.Col, L + Lines) == 0) return 0; return 1; } int EBuffer::MoveBeginOrNonWhite() { if (CP.Col == 0) return MoveFirstNonWhite(); else return MoveLineStart(); } int EBuffer::MoveBeginLinePageFile() { int L = GetVPort()->TP.Row; if (CP.Col == 0 && CP.Row == L) return MoveFileStart(); else if (CP.Col == 0) return MovePageStart(); else return MoveLineStart(); } int EBuffer::MoveEndLinePageFile() { int L = GetVPort()->TP.Row + GetVPort()->Rows - 1; int Len = LineLen(); if (CP.Col == Len && CP.Row == L) return MoveFileEnd(); else if (CP.Col == Len) if (MovePageEnd() == 0) return 0; return MoveLineEnd(); } int EBuffer::KillLine() { int Y = VToR(CP.Row); if (Y == RCount - 1) { if (DelText(Y, 0, LineLen())) return 1; } else if (DelLine(Y)) return 1; return 0; } int EBuffer::KillChar() { int Y = VToR(CP.Row); if (CP.Col < LineLen()) { if (DelText(Y, CP.Col, 1)) return 1; } else if (LineJoin()) return 1; return 0; } int EBuffer::KillCharPrev() { if (CP.Col == 0) { if (CP.Row > 0) if (ExposeRow(VToR(CP.Row) - 1) == 0) return 0; if (!MoveUp()) return 0; if (!MoveLineEnd()) return 0; if (LineJoin()) return 1; } else { if (!MovePrev()) return 0; if (DelText(CP.Row, CP.Col, 1)) return 1; } return 0; } int EBuffer::KillWord() { int Y = VToR(CP.Row); if (CP.Col >= LineLen()) { if (KillChar() == 0) return 0; } else { PELine L = RLine(Y); int P = CharOffset(L, CP.Col); int C; int Class = ChClassK(L->Chars[P]); while ((P < L->Count) && (ChClassK(L->Chars[P]) == Class)) P++; C = ScreenPos(L, P); if (DelText(Y, CP.Col, C - CP.Col) == 0) return 0; } return 1; } int EBuffer::KillWordPrev() { int Y = VToR(CP.Row); if (CP.Col == 0) { if (KillCharPrev() == 0) return 0; } else if (CP.Col > LineLen()) { if (SetPos(LineLen(), CP.Row) == 0) return 0; } else { PELine L = RLine(Y); int P = CharOffset(L, CP.Col); int C; int Class = ChClassK(L->Chars[P - 1]); while ((P > 0) && (ChClassK(L->Chars[P - 1]) == Class)) P--; C = ScreenPos(L, P); if (DelText(Y, C, CP.Col - C) == 0) return 0; if (SetPos(C, CP.Row) == 0) return 0; } return 1; } int EBuffer::KillWordOrCap() { int Y = VToR(CP.Row); if (CP.Col >= LineLen()) { if (KillChar() == 0) return 0; } else { PELine L = VLine(CP.Row); int P = CharOffset(L, CP.Col); int C; int Class = ChClassK(L->Chars[P]); if (Class == 1) { if (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 1) while ((P < L->Count) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 1)) P++; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == 1) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 0)) P++; } else while ((P < L->Count) && (ChClassK(L->Chars[P]) == Class)) P++; C = ScreenPos(L, P); if (DelText(Y, CP.Col, C - CP.Col) == 0) return 0; } return 1; } int EBuffer::KillWordOrCapPrev() { int Y = VToR(CP.Row); if (CP.Col == 0) { if (KillCharPrev() == 0) return 0; } else if (CP.Col > LineLen()) { if (SetPos(LineLen(), CP.Row) == 0) return 0; } else { PELine L = RLine(Y); int P = CharOffset(L, CP.Col); int C; int Class = ChClassK(L->Chars[P - 1]); if (Class == 1) { if (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 0) while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == 1) && (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 0)) P--; while ((P > 0) && (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 1)) P--; } else while ((P > 0) && (ChClassK(L->Chars[P - 1]) == Class)) P--; C = ScreenPos(L, P); if (DelText(Y, C, CP.Col - C) == 0) return 0; if (SetPos(C, CP.Row) == 0) return 0; } return 1; } int EBuffer::KillToLineStart() { int Y = VToR(CP.Row); if (DelText(Y, 0, CP.Col) == 0) return 0; if (MoveLineStart() == 0) return 0; return 1; } int EBuffer::KillToLineEnd() { int Y = VToR(CP.Row); if (DelText(Y, CP.Col, LineLen() - CP.Col)) return 1; return 0; } int EBuffer::KillBlock() { return BlockKill(); } int EBuffer::KillBlockOrChar() { if (CheckBlock() == 0) return KillChar(); else return BlockKill(); } int EBuffer::KillBlockOrCharPrev() { if (CheckBlock() == 0) return KillCharPrev(); else return BlockKill(); } int EBuffer::BackSpace() { int Y = VToR(CP.Row); if (CheckBlock() == 1 && BFI(this, BFI_BackSpKillBlock)) { if (BlockKill() == 0) return 0; } else if (BFI(this, BFI_WordWrap) == 2 && CP.Row > 0 && !IsLineBlank(Y - 1) && CP.Col <= BFI(this, BFI_LeftMargin) && CP.Col <= LineIndented(Y)) { if (SetPos(LineLen(Y - 1), CP.Row - 1) == 0) return 0; } else if (CP.Col == 0) { if (CP.Row > 0) if (ExposeRow(VToR(CP.Row) - 1) == 0) return 0; if (MoveUp() == 0) return 0; if (MoveLineEnd() == 0) return 0; if (LineJoin() == 0) return 0; } else { if (BFI(this, BFI_BackSpUnindents) && (LineIndented(Y) == CP.Col)) { int C = CP.Col, C1 = 0; int L = VToR(CP.Row); C1 = C; while (L > 0 && (IsLineBlank(L - 1) || (C1 = LineIndented(L - 1)) >= C)) L--; if (L == 0) C1 = 0; if (C1 == C) C1--; if (C1 < 0) C1 = 0; if (C1 > C) C1 = C; if (SetPos(C1, CP.Row) == 0) return 0; if (C > LineIndented(Y)) return 0; if (DelText(Y, C1, C - C1) == 0) return 0; if (BFI(this, BFI_Insert) == 0) if (InsText(Y, C1, 1, " ") == 0) return 0; } else if (BFI(this, BFI_BackSpKillTab)) { int P; int C = CP.Col, C1; P = CharOffset(RLine(Y), C - 1); C1 = ScreenPos(RLine(Y), P); if (SetPos(C1, CP.Row) == 0) return 0; if (DelText(Y, C1, C - C1) == 0) return 0; if (BFI(this, BFI_Insert) == 0) if (InsText(Y, C1, 1, " ") == 0) return 0; } else { if (MovePrev() == 0) return 0; ELine *L = RLine(Y); int C = CharOffset(L, CP.Col); if (L->Count > 0 && L->Chars[C] == 9) { /* We're on top of tab character. Skip over all spaces and tabs so that only the last space/tab gets deleted. */ while (C < L->Count && (L->Chars[C+1] == 9 || L->Chars[C+1] == ' ')) C++; } if (DelText(Y, ScreenPos(L, C), 1) == 0) return 0; if (BFI(this, BFI_Insert) == 0) if (InsText(Y, ScreenPos(L, C), 1, " ") == 0) return 0; } } if (BFI(this, BFI_WordWrap) == 2) { if (DoWrap(0) == 0) return 0; } if (BFI(this, BFI_Trim)) { Y = VToR(CP.Row); if (TrimLine(Y) == 0) return 0; } return 1; } int EBuffer::Delete() { int Y = VToR(CP.Row); if (CheckBlock() == 1 && BFI(this, BFI_DeleteKillBlock)) { if (BlockKill() == 0) return 0; } else if (CP.Col < LineLen()) { if (BFI(this, BFI_DeleteKillTab)) { int P; int C = CP.Col, C1; P = CharOffset(RLine(Y), C); C1 = ScreenPos(RLine(Y), P + 1); if (DelText(Y, C, C1 - C) == 0) return 0; } else { ELine *L = RLine(Y); int C = CharOffset(L, CP.Col); if (L->Count > 0 && L->Chars[C] == '\t') { /* We're on top of tab character. Skip over all spaces and tabs so that only the last space/tab gets deleted. */ while (C < L->Count && (L->Chars[C+1] == '\t' || L->Chars[C+1] == ' ')) C++; } if (DelText(Y, ScreenPos(L, C), 1) == 0) return 0; } } else if (LineJoin() == 0) return 0; if (BFI(this, BFI_WordWrap) == 2) { if (DoWrap(0) == 0) return 0; if (CP.Col >= LineLen(Y)) if (CP.Row < VCount - 1) { if (SetPos(BFI(this, BFI_LeftMargin), CP.Row + 1) == 0) return 0; } } if (BFI(this, BFI_Trim)) if (TrimLine(VToR(CP.Row)) == 0) return 0; return 1; } int EBuffer::LineInsert() { if (InsLine(VToR(CP.Row), 0)) return 1; return 0; } int EBuffer::LineAdd() { if (InsLine(VToR(CP.Row), 1) && MoveDown()) return 1; return 0; } int EBuffer::LineSplit() { if (SplitLine(VToR(CP.Row), CP.Col) == 0) return 0; if (BFI(this, BFI_Trim)) if (TrimLine(VToR(CP.Row)) == 0) return 0; return 1; } int EBuffer::LineJoin() { if (JoinLine(VToR(CP.Row), CP.Col)) return 1; return 0; } int EBuffer::LineNew() { if (SplitLine(VToR(CP.Row), CP.Col) == 0) return 0; if (!MoveDown()) return 0; if (CP.Col > 0) { if (!MoveLineStart()) return 0; //int Indent = LineIndented(VToR(CP.Row)); if (!LineIndent()) return 0; //if (Indent > 0) // if (InsText(Row, C, Indent, 0) == 0) // return 0; if (BFI(this, BFI_Trim)) if (TrimLine(VToR(CP.Row - 1)) == 0) return 0; } return 1; } int EBuffer::LineIndent() { int rc = 1; if (BFI(this, BFI_AutoIndent)) { int L = VToR(CP.Row); switch (BFI(this, BFI_IndentMode)) { case INDENT_C: rc = Indent_C(this, L, 1); break; case INDENT_REXX: rc = Indent_REXX(this, L, 1); break; case INDENT_SIMPLE: rc = Indent_SIMPLE(this, L, 1); break; default: rc = Indent_Plain(this, L, 1); break; } } if (rc == 0) return 0; if (BFI(this, BFI_Trim)) if (TrimLine(VToR(CP.Row)) == 0) return 0; return 1; } int EBuffer::LineLen() { return LineLen(VToR(CP.Row)); } int EBuffer::LineCount() { assert(1 == 0); return RCount; } int EBuffer::CLine() { assert(1 == 0); return VToR(CP.Row); } int EBuffer::CColumn() { return CP.Col; } int EBuffer::InsertChar(char aCh) { return InsertString(&aCh, 1); } int EBuffer::TypeChar(char aCh) { // does abbrev expansion if appropriate if (BFI(this, BFI_InsertKillBlock) == 1) if (CheckBlock() == 1) if (BlockKill() == 0) return 0; if (ChClass(aCh) == 0 && BFI(this, BFI_Abbreviations) == 1) { PELine L = VLine(CP.Row); int C, P, P1, C1, Len, R; char Str[256]; EAbbrev *ab; R = VToR(CP.Row); C = CP.Col; P = CharOffset(L, C); if (P >= 0 && P <= L->Count) { //fprintf(stderr, "TypeChar 1\n"); P1 = P; C1 = ScreenPos(L, P); while ((P > 0) && ((ChClass(L->Chars[P - 1]) == 1) || (L->Chars[P - 1] == '_'))) P--; Len = P1 - P; C = ScreenPos(L, P); assert(C1 - C == Len); if (Len > 0 && Len < int (sizeof(Str))) { //fprintf(stderr, "TypeChar 2\n"); memcpy(Str, L->Chars + P, Len); Str[Len] = 0; ab = Mode->FindAbbrev(Str); if (ab) { //fprintf(stderr, "TypeChar 3\n"); if (ab->Replace != 0) { //fprintf(stderr, "TypeChar 4\n"); if (DelText(R, C, C1 - C) == 0) return 0; if (ab->Replace) { //fprintf(stderr, "TypeChar 5 %s <- %s\n", ab->Replace, ab->Match); Len = strlen(ab->Replace); if (InsText(R, C, Len, ab->Replace) == 0) return 0; if (SetPos(C + Len, CP.Row) == 0) return 0; } else { if (SetPos(C, CP.Row) == 0) return 0; } } else { if (((EGUI *)gui)->ExecMacro(View->MView->Win, ab->Cmd) == 0) return 0; } } } } } return InsertString(&aCh, 1); } int EBuffer::InsertString(const char *aStr, int aCount) { int P; int C, L; int Y = VToR(CP.Row); if (BFI(this, BFI_InsertKillBlock) == 1) if (CheckBlock() == 1) if (BlockKill() == 0) return 0; if (BFI(this, BFI_Insert) == 0) if (CP.Col < LineLen()) if (KillChar() == 0) return 0; if (InsText(Y, CP.Col, aCount, aStr) == 0) return 0; C = CP.Col; L = VToR(CP.Row); P = CharOffset(RLine(L), C); P += aCount; C = ScreenPos(RLine(L), P); if (SetPos(C, CP.Row) == 0) return 0; if (BFI(this, BFI_Trim) && *aStr != '\t') if (TrimLine(L) == 0) return 0; if (BFI(this, BFI_WordWrap) == 2) { if (DoWrap(0) == 0) return 0; } else if (BFI(this, BFI_WordWrap) == 1) { int P, C = CP.Col; PELine LP; int L; if (C > BFI(this, BFI_RightMargin)) { L = CP.Row; C = BFI(this, BFI_RightMargin); P = CharOffset(LP = RLine(L), C); while ((C > BFI(this, BFI_LeftMargin)) && ((LP->Chars[P] != ' ') && (LP->Chars[P] != 9))) C = ScreenPos(LP, --P); if (P <= BFI(this, BFI_LeftMargin)) { C = BFI(this, BFI_RightMargin); } else C = ScreenPos(LP, P); if (SplitLine(L, C) == 0) return 0; IndentLine(L + 1, BFI(this, BFI_LeftMargin)); if (SetPos(CP.Col - C - 1 + BFI(this, BFI_LeftMargin), CP.Row + 1) == 0) return 0; } } return 1; } int EBuffer::InsertSpacesToTab(int TSize) { int P = CP.Col, P1; if (BFI(this, BFI_InsertKillBlock) == 1) if (CheckBlock() == 1) if (BlockKill() == 0) return 0; if (TSize <= 0) TSize = BFI(this, BFI_TabSize); P1 = NextTab(P, TSize); if (BFI(this, BFI_Insert) == 0) { if (CP.Col < LineLen()) if (DelText(VToR(CP.Row), CP.Col, P1 - P) == 0) return 0; } if (InsText(VToR(CP.Row), CP.Col, P1 - P, 0) == 0) return 0; if (SetPos(P1, CP.Row) == 0) return 0; return 1; } int EBuffer::InsertTab() { return (BFI(this, BFI_SpaceTabs)) ? InsertSpacesToTab(BFI(this, BFI_TabSize)) : InsertChar(9); } int EBuffer::InsertSpace() { return TypeChar(32); } int EBuffer::LineIndented(int Row, const char *indentchars) { ELine *l; if (Row < 0) return 0; if (Row >= RCount) return 0; l = RLine(Row); return ScreenPos(l, LineIndentedCharCount(l, indentchars)); } int EBuffer::LineIndentedCharCount(ELine *l, const char *indentchars) { char *PC; int CC, i; if (! l) return 0; if (! indentchars) indentchars = " \t"; CC = l->Count; PC = l->Chars; for (i = 0; i < CC; i++) { if (! strchr(indentchars, PC[i])) break; } return i; } int EBuffer::IndentLine(int Row, int Indent) { int I, C; int Ind = Indent; if (Row < 0) return 0; if (Row >= RCount) return 0; if (Indent < 0) Indent = 0; I = LineIndented(Row); if (Indent != I) { if (I > 0) if (DelText(Row, 0, I) == 0) return 0; if (Indent > 0) { C = 0; if (BFI(this, BFI_IndentWithTabs)) { char ch = 9; while (BFI(this, BFI_TabSize) <= Indent) { if (InsText(Row, C, 1, &ch) == 0) return 0; Indent -= BFI(this, BFI_TabSize); C += BFI(this, BFI_TabSize); } } if (Indent > 0) if (InsText(Row, C, Indent, 0) == 0) return 0; } } return Ind - I; } int EBuffer::CanUndo() { if (BFI(this, BFI_Undo) == 0) return 0; if (US.Num == 0 || US.UndoPtr == 0) return 0; return 1; } int EBuffer::CanRedo() { if (BFI(this, BFI_Undo) == 0) return 0; if (US.Num == 0 || US.UndoPtr == US.Num) return 0; return 1; } int EBuffer::IsLineBlank(int Row) { PELine X = RLine(Row); int P; for (P = 0; P < X->Count; P++) if (X->Chars[P] != ' ' && X->Chars[P] != 9) return 0; return 1; } #define WFAIL(x) return 0 /*do { puts(#x "\x7"); return -1; } while (0) */ int EBuffer::DoWrap(int WrapAll) { int L, Len, C, P, Ind; PELine LP; int Left = BFI(this, BFI_LeftMargin), Right = BFI(this, BFI_RightMargin); int FirstParaLine; int NoChange = 0, NoChangeX = 0; if (Left >= Right) return 0; L = VToR(CP.Row); FirstParaLine = 0; if (L > 0) if (IsLineBlank(L - 1)) FirstParaLine = L; while (L < RCount) { NoChange = 1; if (VToR(CP.Row) != L || L != FirstParaLine) { if (VToR(CP.Row) == L) if (CP.Col <= LineIndented(L)) if (SetPos(Left, CP.Row) == 0) WFAIL(1); Ind = IndentLine(L, Left); if (VToR(CP.Row) == L) if (SetPos((CP.Col + Ind > 0) ? CP.Col + Ind : 0, CP.Row) == 0) WFAIL(2); NoChange = 0; } Len = LineLen(L); if (IsLineBlank(L)) break; if (Len < Right) { int firstwordbeg = -1; int firstwordend = -1; int X; PELine lp; if (L < RCount - 1) { IndentLine(L + 1, 0); if ((ScreenPos(RLine(L + 1), RLine(L + 1)->Count) == 0) || (RLine(L + 1)->Chars[0] == '>') || (RLine(L + 1)->Chars[0] == '<')) break; } else break; if (L + 1 >= RCount) break; lp = RLine(L + 1); for (X = 0; X < lp->Count; X++) { if (firstwordbeg == -1 && ((lp->Chars[X] != ' ') && (lp->Chars[X] != '\t'))) { firstwordbeg = X; } else if (firstwordend == -1 && ((lp->Chars[X] == ' ' || lp->Chars[X] == '\t'))) { firstwordend = X - 1; } } if (firstwordbeg != -1) if (firstwordend == -1) firstwordend = lp->Count; if (firstwordend == -1) break; if (Right - Len > firstwordend - firstwordbeg) { if (JoinLine(L, Len + 1) == 0) WFAIL(3); NoChange = 0; continue; } else IndentLine(L + 1, Left); } else if (Len > Right) { C = Right; P = CharOffset(LP = RLine(L), C); while ((C > Left) && ((LP->Chars[P] != ' ') && (LP->Chars[P] != 9))) C = ScreenPos(LP, --P); if (P <= Left) { L++; continue; } C = ScreenPos(LP, P); if (SplitLine(L, C) == 0) WFAIL(4); IndentLine(L + 1, Left); if (L < RCount - 2 && LineLen(L + 1) == Left) { if (!IsLineBlank(L + 2)) { if (JoinLine(L + 1, Left) == 0) WFAIL(5); } } if (L == VToR(CP.Row) && CP.Col > C) { if (SetPos(Left + CP.Col - C - 1, CP.Row + 1) == 0) WFAIL(6); } NoChange = 0; L++; continue; } if (WrapAll == 0) if (NoChangeX) { //printf("\n\nBreak OUT = %d\n\x7", L); break; } L++; NoChangeX = NoChange; } if (WrapAll == 1) if (SetPosR(Left, (L < RCount - 2) ? (L + 2) : (L < RCount - 1) ? (L + 1) : (RCount - 1)) == 0) WFAIL(7); return 1; } int EBuffer::WrapPara() { while (VToR(CP.Row) < RCount - 1 && IsLineBlank(VToR(CP.Row))) if (SetPos(CP.Col, CP.Row + 1) == 0) return 0; return DoWrap(1); } int EBuffer::LineCenter() { if (LineTrim() == 0) return 0; int ind = LineIndented(VToR(CP.Row)); int left = BFI(this, BFI_LeftMargin); int right = BFI(this, BFI_RightMargin); int len = LineLen(); //int chs = len - ind; int newind = left + ((right - left) - (len - ind)) / 2; if (newind < left) newind = left; return IndentLine(VToR(CP.Row), newind); } int EBuffer::InsPrevLineChar() { int L = VToR(CP.Row); int C = CP.Col, P; if (L > 0) { L--; if (C < LineLen(L)) { P = CharOffset(RLine(L), C); return InsertChar(RLine(L)->Chars[P]); } } return 0; } int EBuffer::InsPrevLineToEol() { int L = VToR(CP.Row); int C = CP.Col, P; int Len; if (L > 0) { L--; P = CharOffset(RLine(L), C); Len = RLine(L)->Count - P; if (Len > 0) return InsertString(RLine(L)->Chars + P, Len); } return 0; } int EBuffer::LineDuplicate() { int Y = VToR(CP.Row); if (InsLine(Y, 1) == 0) return 0; if (InsChars(Y + 1, 0, RLine(Y)->Count, RLine(Y)->Chars) == 0) return 0; return 1; } int EBuffer::TrimLine(int Row) { PELine L = RLine(Row); int P, X, E; if (L->Count == 0) return 1; P = L->Count; while ((P > 0) && ((L->Chars[P - 1] == ' ') || (L->Chars[P - 1] == 9))) P--; X = ScreenPos(L, P); E = ScreenPos(L, L->Count); if (E - X > 0) if (DelText(Row, X, E - X, 1) == 0) return 0; return 1; } int EBuffer::LineTrim() { return TrimLine(VToR(CP.Row)); } int EBuffer::FileTrim() { for (int L = 0; L < RCount; L++) if (TrimLine(L) == 0) return 0; return 1; } int EBuffer::BlockTrim() { EPoint B, E; int L; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, E.Row); for (L = B.Row; L <= E.Row; L++) { switch (BlockMode) { case bmStream: if (L < E.Row || E.Col != 0) if (TrimLine(L) == 0) return 0; break; case bmLine: case bmColumn: if (L < E.Row) if (TrimLine(L) == 0) return 0; break; } } return 1; } #define TOGGLE(x) \ Flags.num[BFI_##x] = (Flags.num[BFI_##x]) ? 0 : 1; \ /*Msg(INFO, #x " is now %s.", Flags.num[BFI_##x] ? "ON" : "OFF");*/ \ return 1; #define TOGGLE_R(x) \ Flags.num[BFI_##x] = (Flags.num[BFI_##x]) ? 0 : 1; \ /*Msg(INFO, #x " is now %s.", Flags.num[BFI_##x] ? "ON" : "OFF");*/ \ FullRedraw(); \ return 1; int EBuffer::ToggleAutoIndent() { TOGGLE(AutoIndent); } int EBuffer::ToggleInsert() { TOGGLE(Insert); } int EBuffer::ToggleExpandTabs() { TOGGLE_R(ExpandTabs); } int EBuffer::ToggleShowTabs() { TOGGLE_R(ShowTabs); } int EBuffer::ToggleUndo() { FreeUndo(); TOGGLE(Undo); } int EBuffer::ToggleReadOnly() { TOGGLE(ReadOnly); } int EBuffer::ToggleKeepBackups() { TOGGLE(KeepBackups); } int EBuffer::ToggleMatchCase() { TOGGLE(MatchCase); } int EBuffer::ToggleBackSpKillTab() { TOGGLE(BackSpKillTab); } int EBuffer::ToggleDeleteKillTab() { TOGGLE(DeleteKillTab); } int EBuffer::ToggleSpaceTabs() { TOGGLE(SpaceTabs); } int EBuffer::ToggleIndentWithTabs() { TOGGLE(IndentWithTabs); } int EBuffer::ToggleBackSpUnindents() { TOGGLE(BackSpUnindents); } int EBuffer::ToggleTrim() { TOGGLE(Trim); } int EBuffer::ToggleShowMarkers() { TOGGLE_R(ShowMarkers); } int EBuffer::ToggleHilitTags() { TOGGLE_R(HilitTags); } int EBuffer::ToggleShowBookmarks() { TOGGLE_R(ShowBookmarks); } int EBuffer::ToggleMakeBackups() { TOGGLE(MakeBackups); } int EBuffer::ToggleWordWrap() { BFI(this, BFI_WordWrap) = (BFI(this, BFI_WordWrap) + 1) % 3; /*Msg(INFO, "WordWrap is now %s.", (BFI(this, BFI_WordWrap) == 2) ? "AUTO" : (BFI(this, BFI_WordWrap) == 1) ? "ON" : "OFF"); */ return 1; } int EBuffer::SetLeftMargin() { BFI(this, BFI_LeftMargin) = CP.Col; Msg(S_INFO, "LeftMargin set to %d.", BFI(this, BFI_LeftMargin) + 1); return 1; } int EBuffer::SetRightMargin() { BFI(this, BFI_RightMargin) = CP.Col; Msg(S_INFO, "RightMargin set to %d.", BFI(this, BFI_RightMargin) + 1); return 1; } int EBuffer::ChangeMode(char *AMode) { if (FindMode(AMode) != 0) { Mode = FindMode(AMode); Flags = Mode->Flags; HilitProc = 0; if (Mode && Mode->fColorize) HilitProc = GetHilitProc(Mode->fColorize->SyntaxParser); FullRedraw(); return 1; } Msg(S_ERROR, "Mode '%s' not found.", AMode); return 0; } int EBuffer::ChangeKeys(char *AMode) { if (FindMode(AMode) != 0) { Mode = FindMode(AMode); HilitProc = 0; if (Mode && Mode->fColorize) HilitProc = GetHilitProc(Mode->fColorize->SyntaxParser); FullRedraw(); return 1; } Msg(S_ERROR, "Mode '%s' not found.", AMode); return 0; } int EBuffer::ChangeFlags(char *AMode) { if (FindMode(AMode) != 0) { EMode *XMode; XMode = FindMode(AMode); Flags = XMode->Flags; HilitProc = 0; if (Mode && Mode->fColorize) HilitProc = GetHilitProc(Mode->fColorize->SyntaxParser); FullRedraw(); return 1; } Msg(S_ERROR, "Mode '%s' not found.", AMode); return 0; } efte-1.1/src/pm_tool.h0000664000076400007640000000163411041404761013735 0ustar laurilauri/* * pm_tool.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __TOOLBAR_H #define __TOOLBAR_H #define tiBITMAP 1 #define tiSEPARATOR 2 #define tfDISABLED 1 #define tfDEPRESSED 0x8000 #define WC_MTOOLBAR "MToolBar" typedef struct { ULONG ulType; ULONG ulId; ULONG ulCommand; ULONG ulFlags; HBITMAP hBitmap; } ToolBarItem; typedef struct { USHORT cb; LONG ulCount; ToolBarItem *pItems; LONG ulDepressed; } ToolBarData; MRESULT EXPENTRY ToolBarProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); void RegisterToolBarClass(HAB hab); HWND CreateToolBar(HWND parent, HWND owner, ULONG id, ULONG count, ToolBarItem *items); #endif efte-1.1/src/h_tex.cpp0000664000076400007640000000532611041404761013730 0ustar laurilauri/* h_tex.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #define hsTEX_Normal 0 #define hsTEX_Tag 1 #define hsTEX_Comment 2 #define hsTEX_Special 3 int Hilit_TEX(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); int j; for (i = 0; i < Line->Count;) { IF_TAB() else { switch (State) { case hsTEX_Normal: Color = CLR_Normal; if (*p == '%') { State = hsTEX_Comment; Color = CLR_Comment; goto hilit; } else if (*p == '\\') { State = hsTEX_Tag; Color = CLR_Tag; ColorNext(); continue; } else if (*p == '{' || *p == '}' || *p == '$' || *p == '&' || *p == '|') { State = hsTEX_Special; Color = CLR_Special; ColorNext(); State = hsTEX_Normal; continue; } goto hilit; case hsTEX_Tag: Color = CLR_Tag; if (isalpha(*p)) { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j])/* || (Line->Chars[i + j] == '_')*/) ) j++; if (BF->GetHilitWord(j, &Line->Chars[i], Color, 0)) { } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; Color = CLR_Normal; State = hsTEX_Normal; continue; } ColorNext(); Color = CLR_Normal; State = hsTEX_Normal; continue; case hsTEX_Comment: Color = CLR_Comment; goto hilit; default: State = hsTEX_Normal; Color = CLR_Normal; hilit: ColorNext(); continue; } } } if (State == hsTEX_Comment) State = hsTEX_Normal; *ECol = C; return 0; } efte-1.1/src/log.cpp0000664000076400007640000000772711041366545013420 0ustar laurilauri/******************************************************************** The author, Darin McBride, explicitly places this module under the LGPL license. This module must remain free for use, but will not cause software that uses it to be required to be under the GPL or any of its derivitives. ********************************************************************/ #include #include #include "sysdep.h" #include "log.h" #if defined(NO_NEW_CPP_FEATURES) #include #include #else #include #include using namespace std; #endif #ifndef FTE_NO_LOGGING /********************************************************************* * * Required variables: * *********************************************************************/ GlobalLog globalLog; bool GlobalLog::OpenLogFile() { if (!m_bOpened && m_strLogFile != NULL) { m_ofsLog.open(m_strLogFile, ios::out /*| ios::text*/ | ios::app /*append*/); if (!m_ofsLog) { m_strLogFile = NULL; m_bOpened = false; } else { m_bOpened = true; //no way with gcc3.0 m_ofsLog.setbuf(NULL, 0); } } return m_bOpened; } // // Operator(): // // useful variable for returning an invalid ofstream to kill off any // output to the logfile with wrong loglevel. static ofstream ofsInvalid; ostream& GlobalLog::operator()() { // Ensure the current file is open: if (!OpenLogFile()) // if it can't be opened, shortcut everything: return ofsInvalid; time_t tNow = time(NULL); struct tm* ptm = localtime(&tNow); char cOldFill = m_ofsLog.fill('0'); m_ofsLog << setw(4) << ptm->tm_year + 1900 << '-' << setw(2) << ptm->tm_mon << '-' << setw(2) << ptm->tm_mday << ' ' << setw(2) << ptm->tm_hour << ':' << setw(2) << ptm->tm_min << ':' << setw(2) << ptm->tm_sec << ' ' << "eFTE" << ' '; m_ofsLog.fill(cOldFill); return m_ofsLog; } FunctionLog::FunctionLog(GlobalLog& gl, const char* funcName, unsigned long line) : log(gl), func(funcName), myIndentLevel(++log.indent), indentChar('+') { OutputLine(line) << "Entered function" << ENDLINE; } FunctionLog::~FunctionLog() { indentChar = '+'; OutputLine() << "Exited function" << ENDLINE; --log.indent; } ostream& FunctionLog::RC(unsigned long line) { indentChar = '!'; return OutputLine() << "{" << line << "} Returning rc = "; } ostream& FunctionLog::OutputIndent(ostream& os) { os << FillChar('|', myIndentLevel - 1); //for (int i = 1; i < myIndentLevel; ++i) // os << '|'; os << indentChar << ' '; indentChar = '|'; // reset it to |'s. return os; } ostream& Log__osBinChar(ostream& os, char const& c) { char const cOldFill = os.fill('0'); os << (isprint(c) ? c : '.') << " [0x" << hex << (int)c << dec << "]"; os.fill(cOldFill); return os; } ostream& Log__osFillChar(ostream& os, char const& c, size_t const& len) { for (size_t i = 0; i < len; ++i) os << c; return os; } #define LINE_LENGTH 8 void Log__BinaryData(FunctionLog& LOGOBJNAME, void* bin_data, size_t len, unsigned long line) { for (size_t i = 0; i < len; i += LINE_LENGTH) { ostream& os = LOGOBJNAME.OutputLine(line); size_t j; // as characters for (j = i; j < i + LINE_LENGTH; ++j) { if (j < len) { char const c = ((char*)bin_data)[i+j]; os << (isprint(c) ? c : '.'); } else { os << ' '; } } os << " ["; // as hex values char const cOldFill = os.fill('0'); for (j = i; j < i + LINE_LENGTH; ++j) { if (j < len) { int const c = ((char*)bin_data)[i+j]; if (j != i) os << ','; os << hex << setw(2) << c << dec; } else { os << " "; } } os.fill(cOldFill); os << ']' << ENDLINE; } } #endif // FTE_NO_LOGGING efte-1.1/src/e_loadsave.cpp0000664000076400007640000005442211041404761014724 0ustar laurilauri/* e_loadsave.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int EBuffer::Load() { return LoadFrom(FileName); } int EBuffer::Reload() { int R = VToR(CP.Row), C = CP.Col; if (LoadFrom(FileName) == 0) return 0; SetNearPosR(C, R); return 1; } int EBuffer::Save() { if (BFI(this, BFI_ReadOnly)) { Msg(S_ERROR, "File is read-only."); return 0; } if (BFI(this, BFI_TrimOnSave)) FileTrim(); return SaveTo(FileName); } char FileBuffer[RWBUFSIZE]; int EBuffer::LoadFrom(const char *AFileName) { int fd; int len = 0, partLen; unsigned long numChars = 0, Lines = 0; char *p, *e, *m = NULL; int lm = 0; int lf; int SaveUndo, SaveReadOnly; int first = 1; int strip = BFI(this, BFI_StripChar); int lchar = BFI(this, BFI_LineChar); int margin = BFI(this, BFI_LoadMargin); FileOk = 0; fd = open(AFileName, O_RDONLY | O_BINARY, 0); if (fd == -1) { if (errno != ENOENT) { Msg(S_INFO, "Could not open file %s (errno=%d, %s) .", AFileName, errno, strerror(errno)); } else { Msg(S_INFO, "New file %s.", AFileName); } Loaded = 1; return 0; } Loading = 1; Clear(); BlockUnmark(); SaveUndo = BFI(this, BFI_Undo); SaveReadOnly = BFI(this, BFI_ReadOnly); BFI(this, BFI_Undo) = 0; BFI(this, BFI_ReadOnly) = 0; while ((len = read(fd, FileBuffer, sizeof(FileBuffer))) > 0) { if (first) { first = 0; if (BFI(this, BFI_DetectLineSep)) { int was_lf = 0, was_cr = 0; for (int c = 0; c < len; c++) { if (FileBuffer[c] == 10) { was_lf++; break; } else if (FileBuffer[c] == 13) { was_cr++; if (was_cr == 2) break; } } /* !!! fails if first line > 32k * ??? set first to 1 in that case ? */ if (was_cr || was_lf) { BFI(this, BFI_StripChar) = -1; BFI(this, BFI_LoadMargin) = -1; BFI(this, BFI_AddLF) = 0; BFI(this, BFI_AddCR) = 0; if (was_lf) { BFI(this, BFI_LineChar) = 10; BFI(this, BFI_AddLF) = 1; if (was_cr) { BFI(this, BFI_StripChar) = 13; BFI(this, BFI_AddCR) = 1; } } else if (was_cr) { BFI(this, BFI_LineChar) = 13; BFI(this, BFI_AddCR) = 1; } else { BFI(this, BFI_LineChar) = -1; BFI(this, BFI_LoadMargin) = 64; } strip = BFI(this, BFI_StripChar); lchar = BFI(this, BFI_LineChar); margin = BFI(this, BFI_LoadMargin); } } } p = FileBuffer; do { if (lchar != -1) { // do we have a LINE delimiter e = (char *)memchr((void *)p, lchar, FileBuffer - p + len); if (e == NULL) { e = FileBuffer + len; lf = 0; } else lf = 1; } else if (margin != -1) { // do we have a right margin for wrap if (FileBuffer + len >= p + margin) { e = p + margin; lf = 1; } else { e = FileBuffer + len; lf = 0; } } else { e = FileBuffer + len; lf = 0; } partLen = e - p; // # of chars in buffer for current line m = (char *)realloc((void *)m, (lm + partLen) + CHAR_TRESHOLD); if (m == NULL) goto fail; memcpy((void *)(m + lm), p, partLen); lm += partLen; numChars += partLen; if (lf) { // there is a new line, add it to buffer if (lm == 0 && m == NULL && (m = (char *)malloc(CHAR_TRESHOLD)) == 0) goto fail; #if 0 { // support for VIM tabsize commands char *t = strstr(m, "vi:ts="); int ts = 0; if (t && isdigit(t[6])) ts = atoi(&t[6]); if (ts > 0 && ts <= 16) BFI(this, BFI_TabSize) = ts; } #endif // Grow the line table if required, if (RCount == RAllocated) if (Allocate(RCount ? (RCount * 2) : 1) == 0) goto fail; if ((LL[RCount++] = new ELine((char *)m, lm)) == 0) goto fail; RGap = RCount; lm = 0; m = NULL; Lines++; } p = e; if (lchar != -1) // skip LINE terminator/separator p++; } while (lf); Msg(S_INFO, "Loading: %d lines, %d bytes.", Lines, numChars); } if ((RCount == 0) || (lm > 0) || !BFI(this, BFI_ForceNewLine)) { if (lm == 0 && m == NULL && (m = (char *)malloc(CHAR_TRESHOLD)) == 0) goto fail; // Grow the line table if required, if (RCount == RAllocated) if (Allocate(RCount ? (RCount * 2) : 1) == 0) goto fail; if ((LL[RCount++] = new ELine(m, lm)) == 0) goto fail; m = NULL; RGap = RCount; } // Next time when you introduce something like this // check all code paths - as the whole memory management // is broken - you have forget to clear 'm' two line above comment! // kabi@users.sf.net // this bug has caused serious text corruption which is the worst // thing for text editor if (m) free(m); m = NULL; // initialize folding array. // TODO: allocate only when folds are actually used. // needs fixing a lot of code in other places. VCount = RCount; VGap = VCount; if (AllocVis(VCount ? VCount : 1) == 0) goto fail; memset(VV, 0, VCount * sizeof(int)); if (strip != -1) { // strip CR character from EOL if specified // TODO: this should be done during load above to improve performance for (int l = 0; l < RCount; l++) { if (LL[l]->Count > 0) if (LL[l]->Chars[LL[l]->Count - 1] == strip) LL[l]->Count--; } } if ((BFI(this, BFI_SaveFolds) != 0) || BFI(this, BFI_SaveBookmarks) == 1 || BFI(this, BFI_SaveBookmarks) == 2) { int len_start = 0, len_end = 0; int level = 0, open = 0; int l; int pos = -1, startpos; char foldnum[3] = "00"; if (BFS(this, BFS_CommentStart) == 0) len_start = 0; else len_start = strlen(BFS(this, BFS_CommentStart)); if (BFS(this, BFS_CommentEnd) == 0) len_end = 0; else len_end = strlen(BFS(this, BFS_CommentEnd)); // How folds and bookmarks are saved in line comment: // // CommentStart((FOLD)|(fold)nn)?(BOOK(bookmark)+xllllb)?CommentEnd // // After comment start there can be a fold - open or closed - with level number (nn - decimal). // Then bookmarks can follow marked by BOOK "keyword". Last bookmark is terminated by 'x' // character followed by total length of bookmark info (llll - hex) and character 'b'. The // total length is needed when looking for comment start from the line end. // Each bookmark has format "ccccllname" - cccc (hex) is bookmark column, ll (hex) is length // of bookmark name and then the name itself follows. // // Example: FOLD01BOOK000a05mark1001005mark2x001ab // // Open first level fold, bookmark "mark1" at column 10 and bookmark "mark2" at column 16. // At the end is length of string from BOOK up to end of mark2 - 26 (0x1a). for (l = RCount - 1; l >= 0; l--) { if (LL[l]->Count >= len_start + len_end + 6) { for (int where = 1; where < 3; where++) { // where == 1 - start-of-line // where == 2 - end-of-line open = -1; level = -1; if (BFI(this, BFI_SaveFolds) != where && BFI(this, BFI_SaveBookmarks) != where) continue; if (where == 1) { pos = 0; } else { pos = LL[l]->Count - len_end; // Check if line ends with end comment (if defined) if (len_end != 0 && memcmp(LL[l]->Chars + pos, BFS(this, BFS_CommentEnd), len_end) != 0) continue; // Locate position of comment start - skip bookmarks and fold if (BFI(this, BFI_SaveBookmarks) == 2 && pos - 10 >= 0 && LL[l]->Chars[pos-1] == 'b') { char numbuf[5]; int i; memcpy(numbuf, LL[l]->Chars + pos - 5, 4); numbuf[4] = 0; if (1 != sscanf(numbuf, "%x", &i)) continue; pos -= i + 6; if (pos < 0) continue; } if (BFI(this, BFI_SaveFolds) == 2 && pos - 6 >= 0 && (memcmp(LL[l]->Chars + pos - 6, "FOLD", 4) == 0 || memcmp(LL[l]->Chars + pos - 6, "fold", 4) == 0)) pos -= 6; pos -= len_start; } // Check comment start if (pos < 0 || (len_start != 0 && memcmp(LL[l]->Chars + pos, BFS(this, BFS_CommentStart), len_start) != 0)) continue; // Check comment length - leave empty in file if (LL[l]->Count - pos == len_start + len_end) continue; startpos = pos; pos += len_start; // We have starting position after comment start // Now we will read fold and/or bookmark info and check // for end of comment (if where == 2, it must end at EOLN) // This code is not very good, since on error we stop // parsing comments (and leave it in file), but everything // already done is not undone (e.g. bookmarks, folds) // Folds come always first if (BFI(this, BFI_SaveFolds) == where && (pos + len_end + 6 <= LL[l]->Count)) { if (memcmp(LL[l]->Chars + pos, "FOLD", 4) == 0) { open = 1; } else if (memcmp(LL[l]->Chars + pos, "fold", 4) == 0) { open = 0; } else open = -1; } if (open != -1) { foldnum[0] = LL[l]->Chars[pos + 4]; foldnum[1] = LL[l]->Chars[pos + 4 + 1]; if (1 != sscanf(foldnum, "%2d", &level)) level = -1; if (!isdigit(LL[l]->Chars[pos + 4]) || !isdigit(LL[l]->Chars[pos + 5])) level = -1; if (level == -1 || open >= 100) continue; pos += 6; } // Now get bookmarks if (BFI(this, BFI_SaveBookmarks) == where && (pos + len_end + 10 <= LL[l]->Count) && memcmp(LL[l]->Chars + pos, "BOOK", 4) == 0) { int error = 0; int i, col, startBook; char numbuf[5], buf[256]; startBook = pos; pos += 4; while (pos + len_end + 6 + 6 <= LL[l]->Count) { // Read column memcpy(numbuf, LL[l]->Chars + pos, 4); numbuf[4] = 0; pos += 4; if (1 != sscanf(numbuf, "%x", &col)) { error = 1; break; } // Read length memcpy(numbuf, LL[l]->Chars + pos, 2); numbuf[2] = 0; pos += 2; if (1 != sscanf(numbuf, "%x", &i)) { error = 1; break; } if (pos + i + 6 + len_end > LL[l]->Count || i == 0) { error = 1; break; } if (i) { memcpy(buf, LL[l]->Chars + pos, i); buf[i] = 0; pos += i; if (PlaceUserBookmark(buf, EPoint(l, col)) == 0) goto fail; } if (LL[l]->Chars[pos] == 'x') { // Read total length (just test for correctness) memcpy(numbuf, LL[l]->Chars + pos + 1, 4); numbuf[4] = 0; if (1 != sscanf(numbuf, "%x", &i)) { error = 1; break; } if (i != pos - startBook || LL[l]->Chars[pos + 5] != 'b') error = 1; else pos += 6; break; } } // Stop parsing this comment if error occured if (error) continue; } // And last: check, if comment is properly terminated if (pos + len_end > LL[l]->Count) continue; if (len_end != 0 && memcmp(LL[l]->Chars + pos, BFS(this, BFS_CommentEnd), len_end) != 0) continue; // Not at EOLN, but should be (comment at EOLN) if (where == 2 && LL[l]->Count != pos + len_end) continue; pos += len_end; // Create fold if whole comment was successfully parsed if (open != -1) { int f; if (FoldCreate(l) == 0) goto fail; f = FindFold(l); assert(f != -1); FF[f].level = (char)(level & 0xFF); if (open == 0) if (FoldClose(l) == 0) goto fail; } // Now remove parsed comment from line memmove(LL[l]->Chars + startpos, LL[l]->Chars + pos, LL[l]->Count - pos); LL[l]->Count -= pos - startpos; } } } } if (SetPosR(0, 0) == 0) return 0; BFI(this, BFI_Undo) = SaveUndo; BFI(this, BFI_ReadOnly) = SaveReadOnly; if (stat(FileName, &FileStatus) == -1) { memset(&FileStatus, 0, sizeof(FileStatus)); FileOk = 0; goto fail; } else { if (!(FileStatus.st_mode & (S_IWRITE | S_IWGRP | S_IWOTH))) BFI(this, BFI_ReadOnly) = 1; else BFI(this, BFI_ReadOnly) = 0; } close(fd); FileOk = 1; Modified = 0; Loading = 0; Loaded = 1; Draw(0, -1); Msg(S_INFO, "Loaded %s.", AFileName); return 1; fail: BFI(this, BFI_Undo) = SaveUndo; BFI(this, BFI_ReadOnly) = SaveReadOnly; close(fd); Loading = 0; Draw(0, -1); View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Error loading %s.", AFileName); return 0; } int EBuffer::SaveTo(char *AFileName) { char ABackupName[MAXPATH]; struct stat StatBuf; FILE *fp; int l; PELine L; unsigned long ByteCount = 0, OldCount = 0; int f; char fold[64]; unsigned int foldlen = 0; int bindex; unsigned int blen = 0; char *bname, book[1024] = "BOOK"; EPoint bpos; unsigned int len_start = 0, len_end = 0; if (FileOk && (stat(FileName, &StatBuf) == 0)) { if (FileStatus.st_size != StatBuf.st_size || FileStatus.st_mtime != StatBuf.st_mtime) { switch (View->MView->Win->Choice(GPC_ERROR, "File Changed on Disk", 2, "&Save", "&Cancel", "%s", FileName)) { case 0: break; case 1: case -1: default: return 0; } } } if (RCount <= 0) return 0; // make only backups when user have requested a one if (BFI(this, BFI_MakeBackups) != 0) { Msg(S_INFO, "Backing up %s...", AFileName); if (MakeBackup(AFileName, (char *)ABackupName) == 0) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Could not create backup file."); return 0; } } Msg(S_INFO, "Writing %s...", AFileName); fp = 0; #ifdef OS2 // to preserve EA's ? fp = fopen(AFileName, "r+b"); if (fp != 0) #if defined(__IBMCPP__) || defined(__WATCOMC__) if (chsize(fileno(fp), 0) != 0) #else if (ftruncate(fileno(fp), 0) != 0) #endif // __IBMCPP__ || __WATCOMC__ goto erroropen; #endif // OS2 if (fp == 0) fp = fopen(AFileName, "wb"); if (fp == 0) goto erroropen; setvbuf(fp, FileBuffer, _IOFBF, sizeof(FileBuffer)); // Some initializations (to speed-up saving) if (BFS(this, BFS_CommentStart)) len_start = strlen(BFS(this, BFS_CommentStart)); if (BFS(this, BFS_CommentEnd)) len_end = strlen(BFS(this, BFS_CommentEnd)); for (l = 0; l < RCount; l++) { L = RLine(l); f = FindFold(l); foldlen = 0; // format fold if ((f != -1) && (BFI(this, BFI_SaveFolds) != 0)) { foldlen = sprintf(fold, FF[f].open ? "FOLD%02d" : "fold%02d", FF[f].level); } bindex = 0; blen = 0; if (BFI(this, BFI_SaveBookmarks) == 1 || BFI(this, BFI_SaveBookmarks) == 2) { blen = 4; // Just after "BOOK" while ((bindex = GetUserBookmarkForLine(bindex, l, bname, bpos)) != -1) { // Skip too long bookmarks if (strlen(bname) > 256 || blen + strlen(bname) + 6 + 6 > sizeof(book)) continue; blen += sprintf(book + blen, "%04x%02x%s", bpos.Col, (unsigned int)strlen(bname), bname); } if (blen != 4) { blen += sprintf(book + blen, "x%04xb", blen); } else blen = 0; // Signal, that no bookmarks were saved } // what - write at 1 = beginning / 2 = end of line for (int what = 1; what < 3; what++) { if ((BFI(this, BFI_SaveFolds) == what && foldlen) || (BFI(this, BFI_SaveBookmarks) == what && blen) ) { if (len_start) { if (fwrite(BFS(this, BFS_CommentStart), 1, len_start, fp) != len_start) goto fail; ByteCount += len_start; } if (BFI(this, BFI_SaveFolds) == what && foldlen) { if (fwrite(fold, 1, foldlen, fp) != foldlen) goto fail; ByteCount += foldlen; } if (BFI(this, BFI_SaveBookmarks) == what && blen) { if (fwrite(book, 1, blen, fp) != blen) goto fail; ByteCount += blen; } if (len_end) { if (fwrite(BFS(this, BFS_CommentEnd), 1, len_end, fp) != len_end) goto fail; ByteCount += len_end; } } if (what == 1) { // write data if ((int)(fwrite(L->Chars, 1, L->Count, fp)) != L->Count) goto fail; ByteCount += L->Count; } } // write eol if ((l < RCount - 1) || BFI(this, BFI_ForceNewLine)) { if (BFI(this, BFI_AddCR) == 1) { if (fputc(13, fp) < 0) goto fail; ByteCount++; } if (BFI(this, BFI_AddLF) == 1) { if (fputc(10, fp) < 0) goto fail; ByteCount++; } } if (ByteCount > OldCount + 65536) { Msg(S_INFO, "Saving: %d lines, %d bytes.", l, ByteCount); OldCount = ByteCount; } } if (fclose(fp) != 0) goto fail; Modified = 0; FileOk = 1; if (stat(FileName, &FileStatus) == -1) { memset(&FileStatus, 0, sizeof(FileStatus)); FileOk = 0; goto fail; } Msg(S_INFO, "Wrote %s.", AFileName); // make only backups when user have requested a one if (BFI(this, BFI_MakeBackups) != 0) { if (BFI(this, BFI_KeepBackups) == 0 // No backups for CVS logs || this == CvsLogView // No backups for SVN logs || this == SvnLogView ) { unlink(ABackupName); } } return 1; fail: fclose(fp); unlink(AFileName); if (rename(ABackupName, AFileName) == -1) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Error renaming backup file to original!"); } else { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Error writing file, backup restored."); } return 0; erroropen: View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Error writing %s (errno=%d).", AFileName, errno); return 0; } efte-1.1/src/fte-bcc2.mak0000664000076400007640000000324411041404761014171 0ustar laurilauri# # fte-bcc2.mak # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # LIBDIR = \BCOS2\LIB INCDIR = \BCOS2\INCLUDE .AUTODEPEND DEFINES=-DOS2 -DBCPP -DHEAPWALK -DINCL_32 DEBUG = #DEBUG=-v INIT = $(LIBDIR)\c02.obj CC = bcc LD = tlink CCFLAGS = $(DEFINES) -L$(LIBDIR) -I$(INCDIR) -H=fte.CSM \ -k- -sm -K -w -w-par -Ot -RT- -xd- -x- -vi- -d -a -y $(DEBUG) LDFLAGS = -L$(LIBDIR) $(DEBUG) -s -Toe -Oc -B:0x10000 OEXT=obj !include objs.inc .cpp.$(OEXT): $(CC) $(CCFLAGS) -c {$< } .c.$(OEXT): $(CC) $(CCFLAGS) -c {$< } all: cefte.exe efte.exe eftepm.exe clipserv.exe cliputil.exe defcfg.cnf: defcfg.fte cefte.exe cfte defcfg.fte defcfg.cnf defcfg.h: defcfg.cnf bin2c.exe bin2c defcfg.cnf >defcfg.h c_config.obj: defcfg.h bin2c.exe: bin2c.cpp $(CC) $(CCFLAGS) bin2c.cpp cefte.exe: $(CFTE_OBJS) $(LD) @&&| $(LDFLAGS) $(INIT) $**,cefte.exe,cfte.map,os2 c2mt,cfte.def | efte.exe: $(OBJS) $(VIOOBJS) $(LD) @&&| $(LDFLAGS) $(INIT) $**,efte.exe,fte.map,os2 c2mt,fte.def | eftepm.exe:: $(OBJS) $(PMOBJS) $(LD) @&&| $(LDFLAGS) $(INIT) $**,eftepm.exe,ftepm.map,c2mt os2,ftepm.def | rc -i $(INCDIR) ftepm.rc eftepm.exe clipserv.exe: clipserv.obj $(LD) @&&| $(LDFLAGS) $(INIT) $**,clipserv.exe,clipserv.map,c2mt os2,clipserv.def | cliputil.exe: cliputil.obj clip_vio.obj $(LD) @&&| $(LDFLAGS) $(INIT) $**,cliputil.exe,cliputil.map,c2mt os2,cliputil.def | eftepm.exe:: ftepm.res rc ftepm.res eftepm.exe ftepm.res: ftepm.rc pmdlg.rc rc -i $(INCDIR) -r ftepm.rc efte-1.1/src/c_config.h0000664000076400007640000000422011041527421014024 0ustar laurilauri/* c_config.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __CONFIG_H #define __CONFIG_H #include "sysdep.h" typedef struct _CurPos { unsigned int sz; char *a; char *c; char *z; int line; const char *name; // filename } CurPos; extern int CFteMain(); typedef struct { unsigned char tag; unsigned short len; void *obj; } CachedObject; // Cached objects #define CACHE_SIZE 512000 extern CachedObject cache[CACHE_SIZE]; extern unsigned int cpos; extern int verbosity; extern int ScreenSizeX; extern int ScreenSizeY; extern bool CursorBlink; extern bool CursorWithinEOL; extern int CursorInsertMask; extern int CursorOverMask; extern int SystemClipboard; extern int OpenAfterClose; extern int ShowMenuBar; extern int ShowToolBar; extern int SelectPathname; extern char DefaultModeName[32]; extern int WSStyleSearch; extern char PrintDevice[MAXPATH]; extern char CompileCommand[256]; extern int KeepHistory; extern int LoadDesktopOnEntry; extern int SaveDesktopOnExit; extern int KeepMessages; extern int ScrollBorderX; extern int ScrollBorderY; extern int ScrollJumpX; extern int ScrollJumpY; extern int GUIDialogs; extern int SevenBit; extern int WeirdScroll; extern int LoadDesktopMode; extern char HelpCommand[128]; extern char *ConfigSourcePath; extern char ConfigFileName[MAXPATH]; extern int IgnoreBufferList; extern char CvsCommand[256]; extern char CvsLogMode[32]; extern char SvnCommand[256]; extern char SvnLogMode[32]; extern int ReassignModelIds; extern int RecheckReadOnly; extern char XShellCommand[256]; extern char BackupDirectory[MAXPATH]; const char *GetGUICharacters(const char *which, const char *defChars); int LoadConfig(int argc, char **argv, char *CfgFileName); int LoadDefaultConfig(); int GetIndentMode(const char *Str); int GetHilitMode(const char *Str); int UseDefaultConfig(); int AddCRegexp(int file, int line, int msg, const char *regexp); int LoadFile(char *WhereName, char *CfgName); #endif efte-1.1/src/o_cvs.h0000664000076400007640000000273211041404761013375 0ustar laurilauri/* * o_cvs.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * Contributed by Martin Frydl * * Class providing access to most of CVS commands. */ #ifndef __CVS_H__ #define __CVS_H__ class ECvs: public ECvsBase { public: char *LogFile; int Commiting; ECvs(int createFlags, EModel **ARoot, char *Dir, char *ACommand, char *AOnFiles); ECvs(int createFlags, EModel **ARoot); ~ECvs(); void RemoveLogFile(); // Return marked files in allocated space separated list char *MarkedAsList(); // Return CVS status char of file or 0 if unknown // (if char is lowercase, state was guessed from last command invoked upon file) char GetFileStatus(char *file); virtual void ParseLine(char *line, int len); // Returns 0 if OK virtual int RunPipe(char *Dir, char *Command, char *OnFiles); virtual void ClosePipe(); // Start commit process (opens message buffer), returns 0 if OK int RunCommit(char *Dir, char *Command, char *OnFiles); // Finish commit process (called on message buffer close), returns 0 if OK int DoneCommit(int commit); virtual int CanQuit(); virtual int ConfQuit(GxView *V, int multiFile); virtual int GetContext() { return CONTEXT_CVS; } virtual EEventMap *GetEventMap(); }; extern ECvs *CvsView; #endif efte-1.1/src/egui.h0000664000076400007640000000516311041404761013216 0ustar laurilauri/* egui.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __EGUI_H__ #define __EGUI_H__ #include "gui.h" #include "c_bind.h" // KeySel class EEventMap; class EKeyMap; class GxView; class ExState; class EView; class EFrame: public GFrame { public: EEventMap *CMap; EModel *CModel; EFrame(int XSize, int YSize); virtual ~EFrame(); virtual void Update(); virtual void UpdateMenu(); }; class EGUI: public GUI { public: EKeyMap *ActiveMap; EKeyMap *OverrideMap; char CharMap[32]; EGUI(int &argc, char **argv, int XSize, int YSize); virtual ~EGUI(); virtual int ExecCommand(GxView *view, int Command, ExState &State); virtual int ExecMacro(GxView *view, int Macro); virtual int BeginMacro(GxView *view); void SetMsg(char *Msg); void SetOverrideMap(EKeyMap *aMap, char *ModeName); void SetMap(EKeyMap *aMap, KeySel *ks); // void CharEvent(TEvent &Event, char Ch); void DispatchKey(GxView *view, TEvent &Event); void DispatchCommand(GxView *view, TEvent &Event); virtual void DispatchEvent(GFrame *frame, GView *view, TEvent &Event); int FileCloseX(EView *View, int CreateNew, int XClose = 0); int FileClose(EView *View, ExState &State); int FileCloseAll(EView *View, ExState &State); int WinNext(GxView *view); int WinPrev(GxView *view); int WinHSplit(GxView *View); int WinClose(GxView *View); int WinZoom(GxView *View); int WinResize(ExState &State, GxView *View); int ExitEditor(EView *View); int FrameNew(); int FrameClose(GxView *View); int FrameNext(GxView *View); int FramePrev(GxView *View); int ShowEntryScreen(); int RunProgram(ExState &State, GxView *view); int RunProgramAsync(ExState &State, GxView *view); int MainMenu(ExState &State, GxView *View); int ShowMenu(ExState &State, GxView *View); int LocalMenu(GxView *View); int DesktopSaveAs(ExState &State, GxView *View); int DesktopLoad(ExState &State, GxView *View); int findDesktop(char *argv[]); void DoLoadDesktopOnEntry(int &argc, char **argv); void EditorInit(); int CmdLoadFiles(int &argc, char **argv); int InterfaceInit(int &argc, char **argv); void DoLoadHistoryOnEntry(int &argc, char **argv); void DoSaveHistoryOnExit(); void EditorCleanup(); void InterfaceCleanup(); virtual int Start(int &argc, char **argv); virtual void Stop(); }; #endif efte-1.1/src/cocoa.h0000664000076400007640000000021511041406031013332 0ustar laurilauri// // main.m // fte // // Created by Lauri Nurmi on 5.1.2008. // Copyright __MyCompanyName__ 2008. All rights reserved. // int cacao(); efte-1.1/src/i_oview.cpp0000664000076400007640000000401211041404761014251 0ustar laurilauri/* i_oview.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" ExView::ExView() { } ExView::~ExView() { } void ExView::Activate(int /*gotfocus*/) { } int ExView::IsActive() { if (Win) return Win->IsActive(); return 0; } EEventMap *ExView::GetEventMap() { return 0; } int ExView::ExecCommand(int /*Command*/, ExState &/*State*/) { return ErFAIL; } int ExView::BeginMacro() { return 1; } void ExView::HandleEvent(TEvent &Event) { if (Event.What == evKeyDown && kbCode(Event.Key.Code) == kbF12) Win->Parent->SelectNext(0); } void ExView::EndExec(int NewResult) { if (Win->Result == -2) { // hack Win->EndExec(NewResult); } else { if (Next) { delete Win->PopView(); // self } } } void ExView::UpdateView() { } void ExView::UpdateStatus() { } void ExView::RepaintView() { } void ExView::RepaintStatus() { } void ExView::Resize(int /*width*/, int /*height*/) { Repaint(); } int ExView::ConPutBox(int X, int Y, int W, int H, PCell Cell) { if (Win) return Win->ConPutBox(X, Y, W, H, Cell); return -1; } int ExView::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { if (Win) return Win->ConScroll(Way, X, Y, W, H, Fill, Count); return -1; } int ExView::ConQuerySize(int *X, int *Y) { if (Win) return Win->ConQuerySize(X, Y); return -1; } int ExView::ConSetCursorPos(int X, int Y) { if (Win) return Win->ConSetCursorPos(X, Y); return -1; } int ExView::ConShowCursor() { if (Win) return Win->ConShowCursor(); return -1; } int ExView::ConHideCursor() { if (Win) return Win->ConHideCursor(); return -1; } void ExView::ConSetInsertState(bool insert) { if (Win) Win->ConSetInsertState(insert); } efte-1.1/src/e_cvslog.cpp0000664000076400007640000001372411250205025014415 0ustar laurilauri/* * e_cvslog.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * Contributed by Martin Frydl * * Subclass of EBuffer for writing log for CVS commit. Creates temporary file * used for commit which is deleted when view is closed. Asks for commit or * discard on view close. */ #include "fte.h" ECvsLog *CvsLogView; ECvsLog::ECvsLog(int createFlags, EModel **ARoot, char *Directory, char *OnFiles): EBuffer(createFlags, ARoot, NULL) { int i, j, p; char msgFile[MAXPATH]; CvsLogView = this; // Create filename for message #ifdef UNIX // Use this in Unix - it says more to user sprintf(msgFile, "/tmp/efte%d-cvs-msg", (int)getpid()); #else tmpnam(msgFile); #endif SetFileName(msgFile, CvsLogMode); // Preload buffer with info InsertLine(0, 0, ""); InsertLine(1, 60, "CVS: -------------------------------------------------------"); InsertLine(2, 59, "CVS: Enter log. Lines beginning with 'CVS:' will be removed"); InsertLine(3, 4, "CVS:"); InsertLine(4, 18, "CVS: Commiting in "); InsText(4, 18, strlen(Directory), Directory); if (OnFiles[0]) { p = 5; // Go through files - use GetFileStatus to show what to do with files // First count files int cnt = 0; i = 0; while (1) { if (OnFiles[i] == 0 || OnFiles[i] == ' ') { while (OnFiles[i] == ' ') i++; cnt++; if (!OnFiles[i]) break; } else i++; } int *position = new int[cnt]; int *len = new int[cnt]; char *status = new char[cnt]; // Find out position and status for each file i = j = 0; position[0] = 0; while (1) { if (OnFiles[i] == 0 || OnFiles[i] == ' ') { // This is not thread-safe! len[j] = i - position[j]; char c = OnFiles[i]; OnFiles[i] = 0; status[j] = CvsView->GetFileStatus(OnFiles + position[j]); if (status[j] == 0) status[j] = 'x'; OnFiles[i] = c; while (OnFiles[i] == ' ') i++; if (!OnFiles[i]) break; position[++j] = i; } else i++; } // Go through status int fAdded = 0, fRemoved = 0, fModified = 0, fOther = 0; for (i = 0;i < cnt;i++) switch (status[i]) { case 'A': case 'a': fAdded++; break; case 'R': case 'r': fRemoved++; break; case 'M': case 'm': fModified++; break; default: fOther++; } // Now list files with given status ListFiles(p, fAdded, "Added", cnt, position, len, status, OnFiles, "Aa"); ListFiles(p, fRemoved, "Removed", cnt, position, len, status, OnFiles, "Rr"); ListFiles(p, fModified, "Modified", cnt, position, len, status, OnFiles, "Mm"); ListFiles(p, fOther, "Other", cnt, position, len, status, OnFiles, "AaRrMm", 1); delete [] position; delete [] len; delete [] status; } else { InsertLine(5, 4, "CVS:"); InsertLine(6, 30, "CVS: Commiting whole directory"); p = 7; } InsertLine(p, 4, "CVS:"); InsertLine(p + 1, 60, "CVS: -------------------------------------------------------"); SetPos(0, 0); FreeUndo(); Modified = 0; } ECvsLog::~ECvsLog() { CvsLogView = 0; } void ECvsLog::ListFiles(int &p, const int fCount, const char *title, const int cnt, const int *position, const int *len, const char *status, const char *list, const char *excinc, const int exc) { if (fCount) { InsertLine(p++, 4, "CVS:"); int i = strlen(title); InsertLine(p, 5, "CVS: "); InsText(p, 5, i, title); InsText(p, i += 5, 5, " file"); i += 5; if (fCount != 1) InsText(p, i++, 1, "s"); InsText(p++, i, 1, ":"); for (i = 0;i < cnt;i++) if (!!strchr(excinc, status[i]) ^ !!exc) { // Should be displayed InsertLine(p, 9, "CVS: "); InsText(p, 9, 1, status + i); InsText(p, 10, 1, " "); InsText(p++, 11, len[i], list + position[i]); } } } // Overridden because we don't want to load file EViewPort *ECvsLog::CreateViewPort(EView *V) { V->Port = new EEditPort(this, V); AddView(V); return V->Port; } int ECvsLog::CanQuit() { return 0; } int ECvsLog::ConfQuit(GxView *V, int /*multiFile*/) { int i; switch (V->Choice(GPC_ERROR, "CVS commit pending", 3, "C&ommit", "&Discard", "&Cancel", "")) { case 0: // Commit // First save - this is just try if (Save() == 0) return 0; // Now remove CVS: lines and really save for (i = 0;i < RCount;) { PELine l = RLine(i); if (l->Count >= 4 && strncmp(l->Chars, "CVS:", 4) == 0) DelLine(i); else i++; } Save(); // DoneCommit returns 0 if OK return !CvsView->DoneCommit(1); case 1: // Discard CvsView->DoneCommit(0); return 1; case 2: // Cancel default: return 0; } } // Shown in "Closing xxx..." message when closing model void ECvsLog::GetName(char *AName, int MaxLen) { strncpy(AName, "CVS log", MaxLen); } // Shown in buffer list void ECvsLog::GetInfo(char *AInfo, int /*MaxLen*/) { sprintf(AInfo, "%2d %04d:%03d%cCVS log: %-140s", ModelNo, 1 + CP.Row, 1 + CP.Col, Modified ? '*' : ' ', FileName); } // Normal and short title (normal for window, short for icon in X) void ECvsLog::GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen) { strncpy(ATitle, "CVS log", MaxLen); strncpy(ASTitle, "CVS log", SMaxLen); } efte-1.1/src/s_direct.h0000664000076400007640000000330711041404761014057 0ustar laurilauri/* s_direct.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __SDIRECT_H #define __SDIRECT_H // error handling needs some work #define fiUNKNOWN 0 #define fiFILE 1 #define fiDIRECTORY 2 class FileInfo { char *name; // minimum set of file information off_t size; time_t mtime; int type; public: FileInfo(char *Name, int type, off_t Size, time_t MTime); ~FileInfo(); const char *Name() const { return name; } off_t Size() const { return size; } int Type() const { return type; } time_t MTime() const { return mtime; } }; #define ffFAST 1 // optimization for UNIX (return name only, NO TYPE CHECK), ignored on OS/2 and NT #define ffFULLPATH 2 // return full path to files #define ffDIRECTORY 4 // return directories beside files (see ffFAST) #define ffHIDDEN 8 // return hidden files (dot-files for UNIX) #define ffLINK 16 // diagnose location of symbolic link, not link itself class FileFind { char *Directory; char *Pattern; int Flags; #if defined(USE_DIRENT) DIR *dir; #elif defined(OS2) && !defined(USE_DIRENT) unsigned long dir; // should be HDIR, but we don't #include huge os2.h globally #elif defined(NT) && !defined(USE_DIRENT) unsigned long dir; // should be HANDLE #endif public: FileFind(const char *aDirectory, const char *aPattern, int aFlags); ~FileFind(); int FindFirst(FileInfo **fi); int FindNext(FileInfo **fi); }; #endif efte-1.1/src/o_cvsbase.cpp0000664000076400007640000002655711041404761014576 0ustar laurilauri/* * o_cvsbase.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * Contributed by Martin Frydl * * Base class for all other CVS-related classes. This is similar to EMessages * - starts CVS and shows its messages in list view. */ #include "fte.h" #include "c_commands.h" #include "o_cvsbase.h" #define MAXREGEXP 32 static int CvsIgnoreRegexpCount = 0; static RxNode *CvsIgnoreRegexp[MAXREGEXP]; int AddCvsIgnoreRegexp(const char *regexp) { if (CvsIgnoreRegexpCount >= MAXREGEXP) return 0; if ((CvsIgnoreRegexp[CvsIgnoreRegexpCount] = RxCompile(regexp)) == NULL) return 0; CvsIgnoreRegexpCount++; return 1; } void FreeCvsIgnoreRegexp() { while (CvsIgnoreRegexpCount--) { RxFree(CvsIgnoreRegexp[CvsIgnoreRegexpCount]); } } ECvsBase::ECvsBase(int createFlags, EModel **ARoot, const char *title): EList(createFlags, ARoot, title) { LineCount = 0; Lines = 0; Running = 0; BufLen = 0; BufPos = 0; Command = 0; Directory = 0; OnFiles = 0; ReturnCode = -1; PipeId = -1; } ECvsBase::~ECvsBase() { gui->ClosePipe(PipeId); FreeLines(); free(Command); free(Directory); free(OnFiles); } void ECvsBase::FreeLines() { if (Lines) { for (int i = 0;i < LineCount;i++) { if (Lines[i]->Buf && Lines[i]->Line >= 0) { // Has buffer and line == bookmark -> remove it char book[16]; sprintf(book, "_CVS.%d", i); Lines[i]->Buf->RemoveBookmark(book); } free(Lines[i]->Msg); free(Lines[i]->File); free(Lines[i]); } free(Lines); } LineCount = 0; Lines = 0; BufLen = BufPos = 0; } void ECvsBase::AddLine(char *file, int line, const char* msg, int status) { CvsLine *l; l = (CvsLine *)malloc(sizeof(CvsLine)); if (l != 0) { l->File = file ? strdup(file) : 0; l->Line = line; l->Msg = msg ? strdup(msg) : 0; l->Buf = 0; l->Status = status; LineCount++; Lines = (CvsLine **)realloc(Lines, sizeof(CvsLine *) * LineCount); Lines[LineCount-1] = l; FindBuffer(LineCount - 1); UpdateList(); } } void ECvsBase::FindBuffer(int line) { assert(line >= 0 && line < LineCount); if (Lines[line]->File != 0) { EBuffer *B; Lines[line]->Buf = 0; char path[MAXPATH]; strcpy(path, Directory); Slash(path, 1); strcat(path, Lines[line]->File); B = FindFile(path); if (B != 0 && B->Loaded != 0) AssignBuffer(B, line); } } void ECvsBase::AssignBuffer(EBuffer *B, int line) { assert(line >= 0 && line < LineCount); char book[16]; EPoint P; Lines[line]->Buf = B; if (Lines[line]->Line >= 0) { sprintf(book, "_CVS.%d", line); P.Col = 0; P.Row = Lines[line]->Line; if (P.Row >= B->RCount) P.Row = B->RCount - 1; B->PlaceBookmark(book, P); } } void ECvsBase::FindFileLines(EBuffer *B) { char path[MAXPATH]; char *pos; strcpy(path, Directory); Slash(path, 1); pos = path + strlen(path); for (int i = 0;i < LineCount;i++) if (Lines[i]->Buf == 0 && Lines[i]->File != 0) { strcpy(pos, Lines[i]->File); if (filecmp(B->FileName, path) == 0) { AssignBuffer(B, i); } } } void ECvsBase::NotifyDelete(EModel *Deleting) { for (int i = 0;i < LineCount;i++) { if (Lines[i]->Buf == Deleting) { Lines[i]->Buf = 0; } } } int ECvsBase::GetLine(char *Line, int max) { int rc; char *p; int l; //fprintf(stderr, "GetLine: %d\n", Running); *Line = 0; if (Running && PipeId != -1) { rc = gui->ReadPipe(PipeId, MsgBuf + BufLen, sizeof(MsgBuf) - BufLen); //fprintf(stderr, "GetLine: ReadPipe rc = %d\n", rc); if (rc == -1) { ContinuePipe(); } if (rc > 0) BufLen += rc; } l = max - 1; if (BufLen - BufPos < l) l = BufLen - BufPos; //fprintf(stderr, "GetLine: Data %d\n", l); p = (char *)memchr(MsgBuf + BufPos, '\n', l); if (p) { *p = 0; strcpy(Line, MsgBuf + BufPos); l = strlen(Line); if (l > 0 && Line[l - 1] == '\r') Line[l - 1] = 0; BufPos = p + 1 - MsgBuf; //fprintf(stderr, "GetLine: Line %d\n", strlen(Line)); } else if (Running && sizeof(MsgBuf) != BufLen) { memmove(MsgBuf, MsgBuf + BufPos, BufLen - BufPos); BufLen -= BufPos; BufPos = 0; //fprintf(stderr, "GetLine: Line Incomplete\n"); return 0; } else { if (l == 0) return 0; memcpy(Line, MsgBuf + BufPos, l); Line[l] = 0; if (l > 0 && Line[l - 1] == '\r') Line[l - 1] = 0; BufPos += l; //fprintf(stderr, "GetLine: Line Last %d\n", l); } memmove(MsgBuf, MsgBuf + BufPos, BufLen - BufPos); BufLen -= BufPos; BufPos = 0; //fprintf(stderr, "GetLine: Got Line\n"); return 1; } void ECvsBase::ParseLine(char *line, int) { AddLine(0, -1, line); } void ECvsBase::NotifyPipe(int APipeId) { if (APipeId == PipeId) { char line[1024]; RxMatchRes RM; int i; while (GetLine((char *)line, sizeof(line))) { int len = strlen(line); if (len > 0 && line[len-1] == '\n') line[--len] = 0; for (i = 0;i < CvsIgnoreRegexpCount;i++) if (RxExec(CvsIgnoreRegexp[i], line, len, line, &RM) == 1) break; if (i == CvsIgnoreRegexpCount) ParseLine(line, len); } if (!Running) { char s[30]; sprintf(s, "[done, status=%d]", ReturnCode); AddLine(0, -1, s); } } } int ECvsBase::RunPipe(char *ADir, char *ACommand, char *AOnFiles) { free(Command); free(Directory); free(OnFiles); Command = strdup(ACommand); Directory = strdup(ADir); OnFiles = strdup(AOnFiles); ReturnCode = -1; Row = LineCount - 1; OnFilesPos = OnFiles; { char s[2*MAXPATH*4]; sprintf(s, "[running cvs in '%s']", Directory); AddLine(0, -1, s); } ChangeDir(Directory); return ContinuePipe(); } int ECvsBase::ContinuePipe() { char RealCommand[2048]; size_t space; if (!OnFilesPos) { // At the end of all files, terminate ClosePipe(); return 0; } else if (Running) { // Already running, close the pipe and continue ReturnCode = gui->ClosePipe(PipeId); } else { // Not running -> set to Running mode Running = 1; } // Make real command with some files from OnFiles, update OnFilesPos strcat(strcpy(RealCommand, Command), " "); space = sizeof(RealCommand) - strlen(RealCommand) - 1; if (space >= strlen(OnFilesPos)) { strcat(RealCommand, OnFilesPos); OnFilesPos = NULL; } else { char c = OnFilesPos[space]; OnFilesPos[space] = 0; char *s = strrchr(OnFilesPos, ' '); OnFilesPos[space] = c; if (!s) { ClosePipe(); return 0; } *s = 0; strcat(RealCommand, OnFilesPos); OnFilesPos = s + 1; while (*OnFilesPos == ' ') OnFilesPos++; if (!*OnFilesPos) OnFilesPos = NULL; } BufLen = BufPos = 0; { char s[sizeof(RealCommand)+32]; sprintf(s, "[continuing: '%s']", RealCommand); AddLine(0, -1, s); } PipeId = gui->OpenPipe(RealCommand, this); return 0; } void ECvsBase::ClosePipe() { ReturnCode = gui->ClosePipe(PipeId); PipeId = -1; Running = 0; } void ECvsBase::DrawLine(PCell B, int Line, int Col, ChColor color, int Width) { if (Line < LineCount) if (Col < (int)strlen(Lines[Line]->Msg)) { char str[1024]; int len; len = UnTabStr(str, sizeof(str), Lines[Line]->Msg, strlen(Lines[Line]->Msg)); if (len > Col) MoveStr(B, 0, Width, str + Col, color, Width); } } char *ECvsBase::FormatLine(int Line) { if (Line < LineCount) return strdup(Lines[Line]->Msg); else return 0; } void ECvsBase::UpdateList() { if (LineCount <= Row || Row >= Count - 1) Row = LineCount - 1; Count = LineCount; EList::UpdateList(); } int ECvsBase::Activate(int No) { ShowLine(View, No); return 1; } int ECvsBase::CanActivate(int Line) { return Line < LineCount && Lines[Line]->File; } int ECvsBase::IsHilited(int Line) { return Line < LineCount && (Lines[Line]->Status&1); } int ECvsBase::IsMarked(int Line) { return Line < LineCount && (Lines[Line]->Status&2); } int ECvsBase::Mark(int Line) { if (Line < LineCount) { if (Lines[Line]->Status&4) Lines[Line]->Status |= 2; return 1; } else return 0; } int ECvsBase::Unmark(int Line) { if (Line < LineCount) { if (Lines[Line]->Status&4) Lines[Line]->Status &= ~2; return 1; } else return 0; } int ECvsBase::ExecCommand(int Command, ExState &State) { switch (Command) { case ExChildClose: if (Running == 0 || PipeId == -1) break; ClosePipe(); { char s[30]; sprintf(s, "[aborted, status=%d]", ReturnCode); AddLine(0, -1, s); } return ErOK; case ExActivateInOtherWindow: ShowLine(View->Next, Row); return ErOK; } return EList::ExecCommand(Command, State); } void ECvsBase::ShowLine(EView *V, int line) { if (line >= 0 && line < LineCount && Lines[line]->File) { if (Lines[line]->Buf != 0) { V->SwitchToModel(Lines[line]->Buf); if (Lines[line]->Line != -1) { char book[16]; sprintf(book, "_CVS.%d", line); Lines[line]->Buf->GotoBookmark(book); } } else { char path[MAXPATH]; strcpy(path, Directory); Slash(path, 1); strcat(path, Lines[line]->File); if (FileLoad(0, path, 0, V) == 1) { V->SwitchToModel(ActiveModel); if (Lines[line]->Line != -1)((EBuffer *)ActiveModel)->CenterNearPosR(0, Lines[line]->Line); } } } } // Event map - this name is used in config files when defining eventmap EEventMap *ECvsBase::GetEventMap() { return FindEventMap("CVSBASE"); } // Shown in "Closing xxx..." message when closing model void ECvsBase::GetName(char *AName, int MaxLen) { strncpy(AName, Title, MaxLen); } // Shown in buffer list void ECvsBase::GetInfo(char *AInfo, int MaxLen) { char format[128]; sprintf(format, "%2d %04d/%03d %s (%%.%is) ", ModelNo, Row, Count, Title, MaxLen - 24 - (int)strlen(Title)); sprintf(AInfo, format, Command); } // Used to get default directory of model void ECvsBase::GetPath(char *APath, int MaxLen) { strncpy(APath, Directory, MaxLen); APath[MaxLen-1] = 0; Slash(APath, 0); } // Normal and short title (normal for window, short for icon in X) void ECvsBase::GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen) { char format[128]; sprintf(format, "%s: %%.%is", Title, MaxLen - 4 - (int)strlen(Title)); sprintf(ATitle, format, Command); strncpy(ASTitle, Title, SMaxLen); ASTitle[SMaxLen-1] = 0; } efte-1.1/src/i_input.cpp0000664000076400007640000002224211041404761014264 0ustar laurilauri/* i_input.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" ExInput::ExInput(const char *APrompt, char *ALine, unsigned int ABufLen, Completer AComp, int Select, int AHistId): ExView() { assert(ABufLen > 0); MaxLen = ABufLen - 1; Comp = AComp; SelStart = SelEnd = 0; Prompt = strdup(APrompt); Line = (char *) malloc(MaxLen + 1); MatchStr = (char *) malloc(MaxLen + 1); CurStr = (char *) malloc(MaxLen + 1); if (Line) { Line[MaxLen] = 0; strncpy(Line, ALine, MaxLen); Pos = strlen(Line); LPos = 0; } if (Select) SelEnd = Pos; TabCount = 0; HistId = AHistId; CurItem = 0; } ExInput::~ExInput() { if (Prompt) free(Prompt); if (Line) free(Line); if (MatchStr) free(MatchStr); if (CurStr) free(CurStr); Prompt = 0; Line = 0; } void ExInput::Activate(int gotfocus) { ExView::Activate(gotfocus); } int ExInput::BeginMacro() { return 1; } void ExInput::HandleEvent(TEvent &Event) { switch (Event.What) { case evKeyDown: switch (kbCode(Event.Key.Code)) { case kbLeft: if (Pos > 0) Pos--; SelStart = SelEnd = 0; TabCount = 0; Event.What = evNone; break; case kbRight: Pos++; SelStart = SelEnd = 0; TabCount = 0; Event.What = evNone; break; case kbLeft | kfCtrl: if (Pos > 0) { Pos--; while (Pos > 0) { if (isalnum(Line[Pos]) && !isalnum(Line[Pos - 1])) break; Pos--; } } SelStart = SelEnd = 0; TabCount = 0; Event.What = evNone; break; case kbRight | kfCtrl: { unsigned int len = strlen(Line); if (Pos < len) { Pos++; while (Pos < len) { if (isalnum(Line[Pos]) && !isalnum(Line[Pos - 1])) break; Pos++; } } } SelStart = SelEnd = 0; TabCount = 0; Event.What = evNone; break; case kbHome: Pos = 0; SelStart = SelEnd = 0; TabCount = 0; Event.What = evNone; break; case kbEnd: Pos = strlen(Line); SelStart = SelEnd = 0; TabCount = 0; Event.What = evNone; break; case kbEsc: EndExec(0); Event.What = evNone; break; case kbEnter: AddInputHistory(HistId, Line); EndExec(1); Event.What = evNone; break; case kbBackSp | kfCtrl | kfShift: SelStart = SelEnd = 0; Pos = 0; Line[0] = 0; TabCount = 0; break; case kbBackSp | kfCtrl: if (Pos > 0) { if (Pos > strlen(Line)) { Pos = strlen(Line); } else { char Ch; if (Pos > 0) do { Pos--; memmove(Line + Pos, Line + Pos + 1, strlen(Line + Pos + 1) + 1); if (Pos == 0) break; Ch = Line[Pos - 1]; } while (Pos > 0 && Ch != '\\' && Ch != '/' && Ch != '.' && isalnum(Ch)); } } SelStart = SelEnd = 0; TabCount = 0; Event.What = evNone; break; case kbBackSp: case kbBackSp | kfShift: if (SelStart < SelEnd) { memmove(Line + SelStart, Line + SelEnd, strlen(Line + SelEnd) + 1); Pos = SelStart; SelStart = SelEnd = 0; break; } if (Pos <= 0) break; Pos--; if (Pos < strlen(Line)) memmove(Line + Pos, Line + Pos + 1, strlen(Line + Pos + 1) + 1); TabCount = 0; Event.What = evNone; break; case kbDel: if (SelStart < SelEnd) { memmove(Line + SelStart, Line + SelEnd, strlen(Line + SelEnd) + 1); Pos = SelStart; SelStart = SelEnd = 0; break; } if (Pos < strlen(Line)) memmove(Line + Pos, Line + Pos + 1, strlen(Line + Pos + 1) + 1); TabCount = 0; Event.What = evNone; break; case kbDel | kfCtrl: if (SelStart < SelEnd) { memmove(Line + SelStart, Line + SelEnd, strlen(Line + SelEnd) + 1); Pos = SelStart; SelStart = SelEnd = 0; break; } SelStart = SelEnd = 0; Line[Pos] = 0; TabCount = 0; Event.What = evNone; break; case kbIns | kfShift: case 'V' | kfCtrl: { int len; if (SystemClipboard) GetPMClip(0); if (SSBuffer == 0) break; if (SSBuffer->RCount == 0) break; if (SelStart < SelEnd) { memmove(Line + SelStart, Line + SelEnd, strlen(Line + SelEnd) + 1); Pos = SelStart; SelStart = SelEnd = 0; } len = SSBuffer->LineChars(0); if (strlen(Line) + len < MaxLen) { memmove(Line + Pos + len, Line + Pos, strlen(Line + Pos) + 1); memcpy(Line + Pos, SSBuffer->RLine(0)->Chars, len); TabCount = 0; Event.What = evNone; Pos += len; } } break; case kbUp: SelStart = SelEnd = 0; if (CurItem == 0) strcpy(CurStr, Line); CurItem += 2; case kbDown: SelStart = SelEnd = 0; if (CurItem == 0) break; CurItem--; { int cnt = CountInputHistory(HistId); if (CurItem > cnt) CurItem = cnt; if (CurItem < 0) CurItem = 0; if (CurItem == 0) strcpy(Line, CurStr); else if (GetInputHistory(HistId, Line, MaxLen, CurItem)); else strcpy(Line, CurStr); Pos = strlen(Line); // SelStart = SelEnd = 0; } Event.What = evNone; break; case kbTab | kfShift: TabCount -= 2; case kbTab: if (Comp) { char *Str2 = (char *) malloc(MaxLen + 1); int n; assert(Str2); TabCount++; if (TabCount < 1) TabCount = 1; if ((TabCount == 1) && (kbCode(Event.Key.Code) == kbTab)) { strcpy(MatchStr, Line); } n = Comp(MatchStr, Str2, TabCount); if ((n > 0) && (TabCount <= n)) { strcpy(Line, Str2); Pos = strlen(Line); } else if (TabCount > n) TabCount = n; free(Str2); } SelStart = SelEnd = 0; Event.What = evNone; break; case 'Q' | kfCtrl: Event.What = evKeyDown; Event.Key.Code = Win->GetChar(0); default: { char Ch; if (GetCharFromEvent(Event, &Ch) && (strlen(Line) < MaxLen)) { if (SelStart < SelEnd) { memmove(Line + SelStart, Line + SelEnd, strlen(Line + SelEnd) + 1); Pos = SelStart; SelStart = SelEnd = 0; } memmove(Line + Pos + 1, Line + Pos, strlen(Line + Pos) + 1); Line[Pos++] = Ch; TabCount = 0; Event.What = evNone; } } break; } Event.What = evNone; break; } } void ExInput::UpdateView() { if (Next) { Next->UpdateView(); } } void ExInput::RepaintView() { if (Next) { Next->RepaintView(); } } void ExInput::UpdateStatus() { RepaintStatus(); } void ExInput::RepaintStatus() { TDrawBuffer B; int W, H, FLen, FPos; ConQuerySize(&W, &H); FPos = strlen(Prompt) + 2; FLen = W - FPos; if (Pos > strlen(Line)) Pos = strlen(Line); //if (Pos < 0) Pos = 0; if (LPos + FLen <= Pos) LPos = Pos - FLen + 1; if (Pos < LPos) LPos = Pos; MoveChar(B, 0, W, ' ', hcEntry_Field, W); MoveStr(B, 0, W, Prompt, hcEntry_Prompt, FPos); MoveChar(B, FPos - 2, W, ':', hcEntry_Prompt, 1); MoveStr(B, FPos, W, Line + LPos, hcEntry_Field, FLen); MoveAttr(B, FPos + SelStart - LPos, W, hcEntry_Selection, SelEnd - SelStart); ConSetCursorPos(FPos + Pos - LPos, H - 1); ConPutBox(0, H - 1, W, 1, B); ConSetInsertState(true); ConShowCursor(); } efte-1.1/src/h_sh.cpp0000664000076400007640000002464611041404761013550 0ustar laurilauri/* h_sh.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" enum { hsSH_Normal, hsSH_SQuote, hsSH_DQuote, hsSH_BQuote, hsSH_DBQuote, hsSH_Control, hsSH_Keyword, hsSH_Comment, hsSH_Variable, hsSH_EOF, hsSH_InOpt }; #define MAXSEOF 100 static char seof[MAXSEOF]; int Hilit_SH(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); int CommandStr = 0; int isEOF = 0; int parenCount = 0; int bracketCount = 0; for (i = 0; i < Line->Count;) { if (State == hsSH_EOF && 0 == i) { //printf("i=%d, len=%d, strlen(seof)=%d, seof=%s, Line-Chars=%s\n", // i, len, strlen(seof), seof, Line->Chars); // Skip past any leading tabs. char* iseof = Line->Chars; size_t len_left = len; while (*iseof == '\t') ++iseof, --len_left; isEOF = strlen(seof) == len_left && strncmp(seof, iseof, len_left) == 0; } IF_TAB() else { int j = 1; if (!isspace(*p)) CommandStr++; switch( *p ) { case '(': parenCount++; break; case ')': parenCount--; break; case '[': bracketCount++; break; case ']': bracketCount--; break; } Color = CLR_Normal; switch (State) { case hsSH_Normal: if (CommandStr == 1 && len > 2 && *p == '.' && isspace(p[1])) { Color = CLR_Keyword; } else if (isalpha(*p) || *p == '_' || ((CommandStr == 1) && (*p == '/' || *p == '.'))) { while (len > j && (isalnum(p[j]) || strchr("_-[]$", p[j]) != NULL || ((CommandStr == 1) && (p[j] == '/' || p[j] == '.')))) j++; if (p[j] == '=') Color = CLR_Variable; else if (p[j] == '*' || p[j] == ')') Color = CLR_Normal; else { if (!BF->GetHilitWord(j, p, Color, 0)) { // Color for good match is set by this function Color = (CommandStr == 1) ? CLR_Command : CLR_Normal; //printf("Command %d %c%c\n", //CommandStr, //Line->Chars[i],Line->Chars[i+1]); } else { if (i > 0 && p[-1] != ';' && p[-1] != '(' && !isspace(p[-1])) Color = CLR_Normal; else { int s; switch (j) { case 2: s = strncmp(p, "in", j); break; case 3: s = strncmp(p, "for", j); break; case 4: s = strncmp(p, "read", j); break; case 5: s = strncmp(p, "unset", j); break; case 6: s = strncmp(p, "export", j); break; default: s = 1; break; } if (s) CommandStr = 0; } } } break; } else if (*p == '[' || *p == ']' || (CommandStr == 1 && *p == '!')) { CommandStr = 0; Color = CLR_Keyword; //Colors[CLR_Control]; //static a=0; //if (!a) {for(int i=0;i= 2 && *p == '\\' && p[1] == '\'') { Color = CLR_String; ColorNext(); } else if (len >= 2 && *p == '\\' && p[1] == '"') { Color = CLR_String; ColorNext(); } else if (len >= 2 && *p == '\\' && p[1] == '`') { Color = CLR_Command; ColorNext(); } else if (*p == '`') { State = hsSH_BQuote; Color = CLR_Command; } else if (*p == '~') { Color = CLR_Variable; } else if (*p == '$') { State = hsSH_Variable; Color = CLR_Variable; } else if (*p == '#') { State = hsSH_Comment; Color = CLR_Comment; //} else if (isdigit(*p)) { //Color = CLR_Number; //while (len > 0 && (isdigit(*p))) //ColorNext(); //continue; } else if (len > 3 && parenCount < 1 && bracketCount < 1 && *p == '<' && p[1] == '<' && p[2] != '<' && ( i == 0 || p[-1] != '<' ) ) { // !!! this is a hack, doesn't work properly -- Mark char *s = seof; j++; if (p[2] == '-') j++; Color = CLR_Control; while (len > j && (isspace(p[j]) || p[j] == '\'' || p[j] == '"')) j++; if (p[j] == '\\') j++; while (len > j && !(isspace(p[j]) || p[j] == '\'' || p[j] == '"')) *s++ = p[j++]; if (len > j && (p[j] == '\'' || p[j] == '"')) j++; *s = 0; State = hsSH_EOF; break; } else if (*p == '=' || *p == '\\' || *p == '>' || *p == '<' || *p == '!' /*|| *p == ':'*/) { Color = CLR_Control; } else if (strchr(";|&(){}", *p) != NULL) { CommandStr = 0; Color = CLR_Control; } break; case hsSH_SQuote: Color = CLR_String; if ((len >= 2) && (*p == '\\')) j++; else if (*p == '\'') State = hsSH_Normal; break; case hsSH_DQuote: Color = CLR_String; if ((len >= 2) && (*p == '\\')) j++; else if (*p == '"') State = hsSH_Normal; else if (*p == '`') { Color = CLR_Command; State = hsSH_DBQuote; } break; case hsSH_BQuote: Color = CLR_Command; if ((len >= 2) && (*p == '\\')) j++; else if (*p == '`') State = hsSH_Normal; break; case hsSH_DBQuote: Color = CLR_Command; if ((len >= 2) && (*p == '\\')) j++; else if (*p == '`') State = hsSH_DQuote; break; case hsSH_Variable: Color = CLR_Variable; State = hsSH_Normal; if (!isdigit(*p)) { int b = 1; if (*p == '{') b = 2; else if (*p == '[') b = 3; while (b && len > 0 && (isalnum(*p) || (strchr("{}[]_", *p) != NULL) || (b == 2 && (strchr("#%:-=?+/", *p) != NULL)) || (b == 1 && (strchr("*@#?-$!", *p) != NULL) /*|| (b == 0, 1) ????? */) ) ) { // !!!!! ????? // in ${...}, once we hit a :, %, or #, anything goes. // Ideally, we'd do normal processing inside as well, // but that'll take much, much longer to figure out // how to do. if (b == 2 && strchr("#%:", *p) != NULL) { UntilMatchBrace('{', ColorNext()); break; } if (b == 2 && *p == '}') b = 0; else if (b == 3 && *p == ']') b = 0; ColorNext(); } continue; } break; case hsSH_Comment: Color = CLR_Comment; break; case hsSH_EOF: Color = CLR_String; if (isEOF) { Color = CLR_Control; State = hsSH_Normal; j += len - 1; } break; default: State = hsSH_Normal; Color = CLR_Normal; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, p, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; } } if (State == hsSH_Comment || State == hsSH_Variable) State = hsSH_Normal; *ECol = C; return 0; } efte-1.1/src/c_config.cpp0000664000076400007640000011025411163156165014374 0ustar laurilauri/* c_config.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "o_cvsbase.h" #include "o_svnbase.h" #include "log.h" typedef struct _GUICharactersEntry { struct _GUICharactersEntry *next; char *name; char *chars; } GUICharactersEntry; // C Indent extern int C_Indent; extern int C_BraceOfs; extern int C_CaseOfs; extern int C_CaseDelta; extern int C_ClassOfs; extern int C_ClassDelta; extern int C_ColonOfs; extern int C_CommentOfs; extern int C_CommentDelta; extern int C_FirstLevelWidth; extern int C_FirstLevelIndent; extern int C_Continuation; extern int C_ParenDelta; extern int FunctionUsesContinuation; // REXX Indent extern int REXX_Base_Indent; extern int REXX_Do_Offset; extern int ShowVScroll; extern int ShowHScroll; extern int ShowMenuBar; int SystemClipboard = 0; int ScreenSizeX = -1, ScreenSizeY = -1; int ScrollBarWidth = 1; bool CursorBlink = 0; // default is "no" (same as before) bool CursorWithinEOL = 0; // default is "no" (same as before) int CursorInsertMask = 0x77; int CursorOverMask = 0x44; int OpenAfterClose = 1; int SelectPathname = 0; char DefaultModeName[32] = ""; RxNode *CompletionFilter = NULL; char PrintDevice[MAXPATH] = "\\DEV\\PRN"; char CompileCommand[256] = "make"; int KeepHistory = 0; int LoadDesktopOnEntry = 0; int SaveDesktopOnExit = 0; char WindowFont[64] = ""; // Custom RGB colors (if console driver supports them) TRGBColor RGBColor[16]; // true if corresponding triplet in RGBColor is valid bool RGBColorValid [16]; int KeepMessages = 0; int ScrollBorderX = 0; int ScrollBorderY = 0; int ScrollJumpX = 8; int ScrollJumpY = 1; int GUIDialogs = 1; int PMDisableAccel = 0; int SevenBit = 0; int WeirdScroll = 0; int LoadDesktopMode = 0; char HelpCommand[128] = "man -a"; char *ConfigSourcePath = 0; int IgnoreBufferList = 0; static GUICharactersEntry *GUICharacters = NULL; char CvsCommand[256] = "cvs"; char CvsLogMode[32] = "PLAIN"; char SvnCommand[256] = "svn"; char SvnLogMode[32] = "PLAIN"; int ReassignModelIds = 0; int RecheckReadOnly = 0; char XShellCommand[256] = "xterm"; char BackupDirectory[MAXPATH] = ""; // Which characters to get. defaultCharacters if not set, rest filled // with defaultCharacters if too short // List of GUICharacters is freed, only one item remains const char *GetGUICharacters(const char *which, const char *defChars) { GUICharactersEntry *g, *gg, *found = NULL; char *s; unsigned int i; for (g = GUICharacters; g; g = gg) { gg = g->next; if (strcmp(g->name, which) == 0) { if ((i = strlen(g->chars)) < strlen(defChars)) { s = new char [strlen(defChars) + 1]; assert(s != NULL); strcpy(s, g->chars); strcpy(s + i, defChars + i); delete g->chars; g->chars = s; } if (found) { free(found->chars); free(found->name); free(found); } found = g; } else { free(g->name); free(g->chars); free(g); } } GUICharacters = found; if (found) return found->chars; else return defChars; } static void AppendGUICharacters(const char *string) { const char *s; GUICharactersEntry *g; s = strchr(string, ':'); if (s) { g = new GUICharactersEntry; assert(g != NULL); // allocate memory for name g->name = (char *)malloc((s - string) + 1); assert(g->name != NULL); // make sure we have zero at start of string *(g->name) = 0; // strncat makes sure that we have zero at the end... strncat(g->name, string, (s - string)); // copy text after ':' to chars... g->chars = strdup(s + 1); assert(g->chars != NULL); g->next = GUICharacters; GUICharacters = g; } } static int AddKeyword(ColorKeywords *tab, char color, const char *keyword) { int len; len = strlen(keyword); if (len < 1 || len >= CK_MAXLEN) return 0; if (tab->key[len]) { int lx = strlen(tab->key[len]); char *key; key = (char *)realloc(tab->key[len], lx + len + 1 + 1); assert(key != NULL); tab->key[len] = key; assert(tab->key[len] != 0); strcpy(tab->key[len] + lx, keyword); tab->key[len][lx + len] = color; tab->key[len][lx + len + 1] = 0; } else { tab->key[len] = (char *)malloc(len + 2); assert(tab->key[len] != 0); strcpy(tab->key[len], keyword); tab->key[len][len] = color; tab->key[len][len + 1] = 0; } tab->count[len]++; tab->TotalCount++; return 1; } static int SetModeNumber(EMode *mode, int what, int number) { int j = what; if (j == BFI_LeftMargin || j == BFI_RightMargin) number--; mode->Flags.num[j] = number; return 0; } static int SetModeString(EMode *mode, int what, const char *string) { int j = what; if (j == BFI_Colorizer) { mode->fColorize = FindColorizer(string); } else if (j == BFI_EventMap) { mode->fEventMap = FindEventMap(string); } else if (j == BFI_IndentMode) { mode->Flags.num[j] = GetIndentMode(string); } else if (j == BFS_WordChars) { SetWordChars(mode->Flags.WordChars, string); } else if (j == BFS_CapitalChars) { SetWordChars(mode->Flags.CapitalChars, string); } else if (j == BFS_FileNameRx) { if (mode->MatchName) free(mode->MatchName); if (mode->MatchNameRx) RxFree(mode->MatchNameRx); mode->MatchName = strdup(string); mode->MatchNameRx = RxCompile(string); } else if (j == BFS_FirstLineRx) { if (mode->MatchLine) free(mode->MatchLine); if (mode->MatchLineRx) RxFree(mode->MatchLineRx); mode->MatchLine = strdup(string); mode->MatchLineRx = RxCompile(string); } else { if (mode->Flags.str[j & 0xFF]) free(mode->Flags.str[j & 0xFF]); mode->Flags.str[j & 0xFF] = strdup(string); } return 0; } static int SetGlobalNumber(int what, int number) { STARTFUNC("SetGlobalNumber"); LOG << "What: " << what << " Number: " << number << ENDLINE; switch (what) { case FLAG_C_Indent: C_Indent = number; break; case FLAG_C_BraceOfs: C_BraceOfs = number; break; case FLAG_C_CaseOfs: C_CaseOfs = number; break; case FLAG_C_CaseDelta: C_CaseDelta = number; break; case FLAG_C_ClassOfs: C_ClassOfs = number; break; case FLAG_C_ClassDelta: C_ClassDelta = number; break; case FLAG_C_ColonOfs: C_ColonOfs = number; break; case FLAG_C_CommentOfs: C_CommentOfs = number; break; case FLAG_C_CommentDelta: C_CommentDelta = number; break; case FLAG_C_FirstLevelIndent: C_FirstLevelIndent = number; break; case FLAG_C_FirstLevelWidth: C_FirstLevelWidth = number; break; case FLAG_C_Continuation: C_Continuation = number; break; case FLAG_C_ParenDelta: C_ParenDelta = number; break; case FLAG_FunctionUsesContinuation: FunctionUsesContinuation = number; break; case FLAG_REXX_Indent: REXX_Base_Indent = number; break; case FLAG_REXX_Do_Offset: REXX_Do_Offset = number; break; case FLAG_ScreenSizeX: ScreenSizeX = number; break; case FLAG_ScreenSizeY: ScreenSizeY = number; break; case FLAG_CursorBlink: CursorBlink = number; break; case FLAG_SysClipboard: SystemClipboard = number; break; case FLAG_OpenAfterClose: OpenAfterClose = number; break; case FLAG_ShowVScroll: ShowVScroll = number; break; case FLAG_ShowHScroll: ShowHScroll = number; break; case FLAG_ScrollBarWidth: ScrollBarWidth = number; break; case FLAG_SelectPathname: SelectPathname = number; break; case FLAG_ShowMenuBar: ShowMenuBar = number; break; case FLAG_ShowToolBar: ShowToolBar = number; break; case FLAG_KeepHistory: KeepHistory = number; break; case FLAG_LoadDesktopOnEntry: LoadDesktopOnEntry = number; break; case FLAG_SaveDesktopOnExit: SaveDesktopOnExit = number; break; case FLAG_KeepMessages: KeepMessages = number; break; case FLAG_ScrollBorderX: ScrollBorderX = number; break; case FLAG_ScrollBorderY: ScrollBorderY = number; break; case FLAG_ScrollJumpX: ScrollJumpX = number; break; case FLAG_ScrollJumpY: ScrollJumpY = number; break; case FLAG_GUIDialogs: GUIDialogs = number; break; case FLAG_PMDisableAccel: PMDisableAccel = number; break; case FLAG_SevenBit: SevenBit = number; break; case FLAG_WeirdScroll: WeirdScroll = number; break; case FLAG_LoadDesktopMode: LoadDesktopMode = number; break; case FLAG_IgnoreBufferList: IgnoreBufferList = number; break; case FLAG_ReassignModelIds: ReassignModelIds = number; break; case FLAG_RecheckReadOnly: RecheckReadOnly = number; break; case FLAG_CursorWithinEOL: CursorWithinEOL = number; break; case FLAG_CursorInsertMask: CursorInsertMask = number; break; case FLAG_CursorOverMask: CursorOverMask = number; break; default: //printf("Unknown global number: %d\n", what); ENDFUNCRC(-1); } ENDFUNCRC(0); } static void SetRGBColor(const char *string) { int idx, r, g, b; if (sscanf(string, "%x:%x,%x,%x", &idx, &r, &g, &b) != 4) { fprintf(stderr, "Invalid RGB Definition: %s\n", string); return; } if (idx < 0 || idx > 15) { fprintf(stderr, "Invalid RGB index: (0-f only) (%s)\n", string); return; } if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255) { fprintf(stderr, "Invalid RGB palette values (00-ff only): %s\n", string); return; } RGBColorValid[idx] = true; RGBColor[idx].r = r; RGBColor[idx].g = g; RGBColor[idx].b = b; } static int SetGlobalString(long what, const char *string) { STARTFUNC("SetGlobalString"); LOG << "What: " << what << " String: " << string << ENDLINE; switch (what) { case FLAG_DefaultModeName: strlcpy(DefaultModeName, string, sizeof(DefaultModeName)); break; case FLAG_CompletionFilter: if ((CompletionFilter = RxCompile(string)) == NULL) return -1; break; case FLAG_PrintDevice: strlcpy(PrintDevice, string, sizeof(PrintDevice)); break; case FLAG_CompileCommand: strlcpy(CompileCommand, string, sizeof(CompileCommand)); break; case FLAG_WindowFont: strlcpy(WindowFont, string, sizeof(WindowFont)); break; case FLAG_HelpCommand: strlcpy(HelpCommand, string, sizeof(HelpCommand)); break; case FLAG_BackupDirectory: strlcpy(BackupDirectory, string, MAXPATH); break; case FLAG_GUICharacters: AppendGUICharacters(string); break; case FLAG_CvsCommand: strlcpy(CvsCommand, string, sizeof(CvsCommand)); break; case FLAG_CvsLogMode: strlcpy(CvsLogMode, string, sizeof(CvsLogMode)); break; case FLAG_SvnCommand: strlcpy(SvnCommand, string, sizeof(SvnCommand)); break; case FLAG_SvnLogMode: strlcpy(SvnLogMode, string, sizeof(SvnLogMode)); break; case FLAG_RGBColor: SetRGBColor(string); break; case FLAG_XShellCommand: strlcpy(XShellCommand, string, sizeof(XShellCommand)); break; default: //printf("Unknown global string: %ld\n", what); ENDFUNCRC(-1); } ENDFUNCRC(0); } static int SetEventString(EEventMap *Map, long what, const char *string) { STARTFUNC("SetEventString"); LOG << "What: " << what << " String: " << string << ENDLINE; switch (what) { case EM_MainMenu: case EM_LocalMenu: Map->SetMenu(what, string); break; default: ENDFUNCRC(-1); } ENDFUNCRC(0); } static int SetColorizeString(EColorize *Colorize, long what, const char *string) { STARTFUNC("SetColorizeString"); LOG << "What: " << what << " String: " << string << ENDLINE; switch (what) { case COL_SyntaxParser: Colorize->SyntaxParser = GetHilitMode(string); break; default: ENDFUNCRC(-1); } ENDFUNCRC(0); } static unsigned char GetObj(CurPos &cp, unsigned short &len) { len = 0; if (cpos < cp.sz) { //fprintf(stderr, "%i: GetObj type: %i\n", cpos, cache[cpos].tag); unsigned char c = (unsigned char)cache[cpos].tag; len = cache[cpos].len; return c; } return 0xFF; } static const char *GetCharStr(CurPos &cp, unsigned short len) { STARTFUNC("GetCharStr"); LOG << "Length: " << len << ENDLINE; char *p = (char *)malloc(cache[cpos].len); memcpy(p, cache[cpos].obj, cache[cpos].len); cpos++; ENDFUNCRC(p); } static int GetNum(CurPos &cp, long &num) { //fprintf(stderr, "%i: Reading a number, type: %i, len: %i\n", cpos, cache[cpos].tag, cache[cpos].len); unsigned char n[4]; if (cpos > cp.sz) return 0; memcpy(n, cache[cpos].obj, 4); num = (n[3] << 24) + (n[2] << 16) + (n[1] << 8) + n[0]; if ((n[3] > 127) && sizeof(long) > 4) num = num | (~0xFFFFFFFFUL); cpos++; return 1; } static int ReadCommands(CurPos &cp, const char *Name) { STARTFUNC("ReadCommands"); LOG << "Name = " << (Name != NULL ? Name : "(null)") << ENDLINE; unsigned char obj; unsigned short len; long Cmd = NewCommand(Name); long cmdno; if (GetObj(cp, len) != CF_INT) ENDFUNCRC(-1); if (GetNum(cp, cmdno) == 0) ENDFUNCRC(-1); if (cmdno != (Cmd | CMD_EXT)) { fprintf(stderr, "Bad Command map %s -> %ld != %ld\n", Name, Cmd, cmdno); ENDFUNCRC(-1); } while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_COMMAND: { // char *s; long cnt; long ign; long cmd; // if ((s = GetCharStr(cp, len)) == 0) return -1; if (GetNum(cp, cmd) == 0) ENDFUNCRC(-1); if (GetObj(cp, len) != CF_INT) ENDFUNCRC(-1); if (GetNum(cp, cnt) == 0) ENDFUNCRC(-1); if (GetObj(cp, len) != CF_INT) ENDFUNCRC(-1); if (GetNum(cp, ign) == 0) ENDFUNCRC(-1); // if (cmd != CmdNum(s)) { // fprintf(stderr, "Bad Command Id: %s -> %d\n", s, cmd); // return -1; // } if (AddCommand(Cmd, cmd, cnt, ign) == 0) { if (Name == 0 || strcmp(Name, "xx") != 0) { fprintf(stderr, "Bad Command Id: %ld\n", cmd); ENDFUNCRC(-1); } } } break; case CF_STRING: { const char *s = GetCharStr(cp, len); if (s == 0) ENDFUNCRC(-1); if (AddString(Cmd, s) == 0) ENDFUNCRC(-1); } break; case CF_INT: { long num; if (GetNum(cp, num) == 0) ENDFUNCRC(-1); if (AddNumber(Cmd, num) == 0) ENDFUNCRC(-1); } break; case CF_VARIABLE: { long num; if (GetNum(cp, num) == 0) ENDFUNCRC(-1); if (AddVariable(Cmd, num) == 0) ENDFUNCRC(-1); } break; case CF_CONCAT: cpos++; if (AddConcat(Cmd) == 0) ENDFUNCRC(-1); break; case CF_END: cpos++; ENDFUNCRC(Cmd); default: ENDFUNCRC(-1); } } ENDFUNCRC(-1); } static int ReadMenu(CurPos &cp, const char *MenuName) { unsigned char obj; unsigned short len; int menu = -1, item = -1; menu = NewMenu(MenuName); while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_ITEM: { if (len == 0) { item = NewItem(menu, 0); cpos++; } else { const char *s = GetCharStr(cp, len); int Cmd; if (s == 0) return -1; item = NewItem(menu, s); if ((obj = GetObj(cp, len)) != CF_MENUSUB) return -1; cpos++; if ((Cmd = ReadCommands(cp, 0)) == -1) return -1; Menus[menu].Items[item].Cmd = Cmd + 65536; } } break; case CF_SUBMENU: { const char *s = GetCharStr(cp, len); const char *w; if ((obj = GetObj(cp, len)) != CF_STRING) return -1; if ((w = GetCharStr(cp, len)) == 0) return -1; item = NewSubMenu(menu, s, GetMenuId(w), SUBMENU_NORMAL); } break; case CF_SUBMENUCOND: { const char *s = GetCharStr(cp, len); const char *w; if ((obj = GetObj(cp, len)) != CF_STRING) return -1; if ((w = GetCharStr(cp, len)) == 0) return -1; item = NewSubMenu(menu, s, GetMenuId(w), SUBMENU_CONDITIONAL); } break; case CF_END: cpos++; return 0; default: return -1; } } return -1; } static int ReadColors(CurPos &cp, const char *ObjName) { unsigned char obj; unsigned short len; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_STRING: { char cl[30]; const char *sname = GetCharStr(cp, len); const char *svalue; if (sname == 0) return -1; if ((obj = GetObj(cp, len)) != CF_STRING) return -1; if ((svalue = GetCharStr(cp, len)) == 0) return -1; strcpy(cl, ObjName); strcat(cl, "."); strcat(cl, sname); if (SetColor(cl, svalue) == 0) return -1; } break; case CF_END: cpos++; return 0; default: return -1; } } return -1; } static int ReadHilitColors(CurPos &cp, EColorize *Colorize, const char * /*ObjName*/) { unsigned char obj; unsigned short len; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_INT: { long cidx; const char *svalue; if (GetNum(cp, cidx) == 0) return -1; if ((obj = GetObj(cp, len)) != CF_STRING) return -1; if ((svalue = GetCharStr(cp, len)) == 0) return -1; if (Colorize->SetColor(cidx, svalue) == 0) return -1; } break; case CF_END: cpos++; return 0; default: return -1; } } return -1; } static int ReadKeywords(CurPos &cp, ColorKeywords *keywords, int color) { unsigned char obj; unsigned short len; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_STRING: { const char *kname = GetCharStr(cp, len); if (kname == 0) return -1; if (AddKeyword(keywords, (char) color, kname) != 1) return -1; } break; case CF_END: cpos++; return 0; default: return -1; } } return -1; } static int ReadEventMap(CurPos &cp, EEventMap *Map, const char * /*MapName*/) { unsigned char obj; unsigned short len; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_KEY: { EKey *Key; const char *s; int Cmd; if ((s = GetCharStr(cp, len)) == 0) return -1; if ((Key = SetKey(Map, s)) == 0) return -1; if ((obj = GetObj(cp, len)) != CF_KEYSUB) return -1; cpos++; if ((Cmd = ReadCommands(cp, 0)) == -1) return -1; Key->Cmd = Cmd; } break; case CF_ABBREV: { EAbbrev *Ab; const char *s; const char *x; int Cmd; if ((s = GetCharStr(cp, len)) == 0) return -1; obj = GetObj(cp, len); if (obj == CF_KEYSUB) { cpos++; if ((Cmd = ReadCommands(cp, 0)) == -1) return -1; Ab = new EAbbrev(s, Cmd); } else if (obj == CF_STRING) { x = GetCharStr(cp, len); Ab = new EAbbrev(s, x); } else return -1; if (Ab) { Map->AddAbbrev(Ab); } } break; case CF_SETVAR: { long what; if (GetNum(cp, what) == 0) return -1; switch (GetObj(cp, len)) { case CF_STRING: { const char *val = GetCharStr(cp, len); if (len == 0) return -1; if (SetEventString(Map, what, val) != 0) return -1; } break; /* case CF_INT: { long num; if (GetNum(cp, num) == 0) return -1; if (SetModeNumber(Mode, what, num) != 0) return -1; } break;*/ default: return -1; } } break; case CF_END: cpos++; return 0; default: return -1; } } return -1; } static int ReadColorize(CurPos &cp, EColorize *Colorize, const char *ModeName) { unsigned char obj; unsigned short len; long LastState = -1; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_COLOR: cpos++; if (ReadHilitColors(cp, Colorize, ModeName) == -1) return -1; break; case CF_KEYWORD: { const char *colorstr; if ((colorstr = GetCharStr(cp, len)) == 0) return -1; unsigned int Col; unsigned int ColBg, ColFg; if (sscanf(colorstr, "%1X %1X", &ColFg, &ColBg) != 2) return 0; Col = ColFg | (ColBg << 4); int color = ChColor(Col); if (ReadKeywords(cp, &Colorize->Keywords, color) == -1) return -1; } break; case CF_HSTATE: { long stateno; long color; if (Colorize->hm == 0) Colorize->hm = new HMachine(); assert(Colorize->hm != 0); if (GetNum(cp, stateno) == 0) return -1; assert(stateno == LastState + 1); obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, color) == 0) return -1; HState newState; newState.InitState(); newState.color = color; Colorize->hm->AddState(newState); LastState = stateno; } break; case CF_HTRANS: { HTrans newTrans; long nextState; long matchFlags; const char *match; long color; if (GetNum(cp, nextState) == 0) return -1; obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, matchFlags) == 0) return -1; obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, color) == 0) return -1; obj = GetObj(cp, len); assert(matchFlags & MATCH_REGEXP ? obj == CF_REGEXP : obj == CF_STRING); if ((match = GetCharStr(cp, len)) == 0) return -1; newTrans.InitTrans(); newTrans.matchFlags = matchFlags; newTrans.nextState = nextState; newTrans.color = color; if (newTrans.matchFlags & MATCH_REGEXP) { newTrans.regexp = RxCompile(match); newTrans.matchLen = 0; } else if ((newTrans.matchFlags & MATCH_SET) || (newTrans.matchFlags & MATCH_NOTSET)) { newTrans.matchLen = 1; newTrans.match = (char *)malloc(256 / 8); assert(newTrans.match != NULL); SetWordChars(newTrans.match, match); } else { newTrans.match = strdup(match); newTrans.matchLen = strlen(match); } Colorize->hm->AddTrans(newTrans); } break; case CF_HWTYPE: { long nextKwdMatchedState; long nextKwdNotMatchedState; long nextKwdNoCharState; long options; const char *wordChars; cpos++; obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, nextKwdMatchedState) == 0) return -1; obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, nextKwdNotMatchedState) == 0) return -1; obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, nextKwdNoCharState) == 0) return -1; obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, options) == 0) return -1; obj = GetObj(cp, len); assert(obj == CF_STRING); if ((wordChars = GetCharStr(cp, len)) == 0) return -1; Colorize->hm->LastState()->options = options; Colorize->hm->LastState()->nextKwdMatchedState = nextKwdMatchedState; Colorize->hm->LastState()->nextKwdNotMatchedState = nextKwdNotMatchedState; Colorize->hm->LastState()->nextKwdNoCharState = nextKwdNoCharState; if (wordChars && *wordChars) { Colorize->hm->LastState()->wordChars = (char *)malloc(256 / 8); assert(Colorize->hm->LastState()->wordChars != NULL); SetWordChars(Colorize->hm->LastState()->wordChars, wordChars); } } break; case CF_HWORDS: { const char *colorstr; int color; if ((colorstr = GetCharStr(cp, len)) == 0) return -1; color = hcPlain_Keyword; if (strcmp(colorstr, "-") != 0) { const char *Value = colorstr; int Col; if (*Value == '-') { Value++; if (sscanf(Value, "%1X", &Col) != 1) return -1; Col |= (hcPlain_Background & 0xF0); } else if (Value[1] == '-') { if (sscanf(Value, "%1X", &Col) != 1) return -1; Col <<= 4; Col |= (hcPlain_Background & 0x0F); } else { unsigned int ColBg, ColFg; if (sscanf(colorstr, "%1X %1X", &ColFg, &ColBg) != 2) return 0; Col = ColFg | (ColBg << 4); } color = Col; } if (ReadKeywords(cp, &Colorize->hm->LastState()->keywords, color) == -1) return -1; } break; case CF_SETVAR: { long what; if (GetNum(cp, what) == 0) return -1; switch (GetObj(cp, len)) { case CF_STRING: { const char *val = GetCharStr(cp, len); if (len == 0) return -1; if (SetColorizeString(Colorize, what, val) != 0) return -1; } break; /* case CF_INT: { long num; if (GetNum(cp, num) == 0) return -1; if (SetModeNumber(Mode, what, num) != 0) return -1; } break;*/ default: return -1; } } break; case CF_END: cpos++; return 0; default: return -1; } } return -1; } static int ReadMode(CurPos &cp, EMode *Mode, const char * /*ModeName*/) { unsigned char obj; unsigned short len; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_SETVAR: { long what; if (GetNum(cp, what) == 0) return -1; switch (GetObj(cp, len)) { case CF_STRING: { const char *val = GetCharStr(cp, len); if (len == 0) return -1; if (SetModeString(Mode, what, val) != 0) return -1; } break; case CF_INT: { long num; if (GetNum(cp, num) == 0) return -1; if (SetModeNumber(Mode, what, num) != 0) return -1; } break; default: return -1; } } break; case CF_END: cpos++; return 0; default: return -1; } } return -1; } static int ReadObject(CurPos &cp, const char *ObjName) { unsigned char obj; unsigned short len; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_COLOR: cpos++; if (ReadColors(cp, ObjName) == -1) return -1; break; case CF_COMPRX: { long file, line, msg; const char *regexp; cpos++; if (GetObj(cp, len) != CF_INT) return -1; if (GetNum(cp, file) == 0) return -1; if (GetObj(cp, len) != CF_INT) return -1; if (GetNum(cp, line) == 0) return -1; if (GetObj(cp, len) != CF_INT) return -1; if (GetNum(cp, msg) == 0) return -1; if (GetObj(cp, len) != CF_REGEXP) return -1; if ((regexp = GetCharStr(cp, len)) == 0) return -1; if (AddCRegexp(file, line, msg, regexp) == 0) return -1; } break; case CF_CVSIGNRX: { const char *regexp; cpos++; if (GetObj(cp, len) != CF_REGEXP) return -1; if ((regexp = GetCharStr(cp, len)) == 0) return -1; if (AddCvsIgnoreRegexp(regexp) == 0) return -1; } break; case CF_SVNIGNRX: { const char *regexp; cpos++; if (GetObj(cp, len) != CF_REGEXP) return -1; if ((regexp = GetCharStr(cp, len)) == 0) return -1; if (AddSvnIgnoreRegexp(regexp) == 0) return -1; } break; case CF_SETVAR: { long what; if (GetNum(cp, what) == 0) return -1; switch (GetObj(cp, len)) { case CF_STRING: { const char *val = GetCharStr(cp, len); if (len == 0) return -1; if (SetGlobalString(what, val) != 0) return -1; } break; case CF_INT: { long num; if (GetNum(cp, num) == 0) return -1; if (SetGlobalNumber(what, num) != 0) return -1; } break; default: return -1; } } break; case CF_END: cpos++; return 0; default: return -1; } } return -1; } static int ReadConfigFile(CurPos &cp) { unsigned char obj; unsigned short len; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_SUB: { const char *CmdName = GetCharStr(cp, len); if (ReadCommands(cp, CmdName) == -1) return -1; } break; case CF_MENU: { const char *MenuName = GetCharStr(cp, len); if (ReadMenu(cp, MenuName) == -1) return -1; } break; case CF_EVENTMAP: { EEventMap *EventMap = 0; const char *MapName = GetCharStr(cp, len); const char *UpMap = 0; if ((obj = GetObj(cp, len)) != CF_PARENT) return -1; if (len > 0) if ((UpMap = GetCharStr(cp, len)) == 0) return -1; // add new mode if ((EventMap = FindEventMap(MapName)) == 0) { EEventMap *OrgMap = 0; if (strcmp(UpMap, "") != 0) OrgMap = FindEventMap(UpMap); EventMap = new EEventMap(MapName, OrgMap); } else { if (EventMap->Parent == 0) EventMap->Parent = FindEventMap(UpMap); } if (ReadEventMap(cp, EventMap, MapName) == -1) return -1; } break; case CF_COLORIZE: { EColorize *Mode = 0; const char *ModeName = GetCharStr(cp, len); const char *UpMode = 0; if ((obj = GetObj(cp, len)) != CF_PARENT) return -1; if (len > 0) if ((UpMode = GetCharStr(cp, len)) == 0) return -1; // add new mode if ((Mode = FindColorizer(ModeName)) == 0) Mode = new EColorize(ModeName, UpMode); else { if (Mode->Parent == 0) Mode->Parent = FindColorizer(UpMode); } if (ReadColorize(cp, Mode, ModeName) == -1) return -1; } break; case CF_MODE: { EMode *Mode = 0; const char *ModeName = GetCharStr(cp, len); const char *UpMode = 0; if ((obj = GetObj(cp, len)) != CF_PARENT) return -1; if (len > 0) if ((UpMode = GetCharStr(cp, len)) == 0) return -1; // add new mode if ((Mode = FindMode(ModeName)) == 0) { EMode *OrgMode = 0; EEventMap *Map; if (strcmp(UpMode, "") != 0) OrgMode = FindMode(UpMode); Map = FindEventMap(ModeName); if (Map == 0) { EEventMap *OrgMap = 0; if (strcmp(UpMode, "") != 0) OrgMap = FindEventMap(UpMode); Map = new EEventMap(ModeName, OrgMap); } Mode = new EMode(OrgMode, Map, ModeName); Mode->fNext = Modes; Modes = Mode; } else { if (Mode->fParent == 0) Mode->fParent = FindMode(UpMode); } if (ReadMode(cp, Mode, ModeName) == -1) return -1; } break; case CF_OBJECT: { const char *ObjName; if ((ObjName = GetCharStr(cp, len)) == 0) return -1; if (ReadObject(cp, ObjName) == -1) return -1; } break; case CF_EOF: return 0; default: return -1; } } return -1; } int LoadDefaultConfig() { /* //char *buf = (char *)malloc(strlen(DefaultConfig) + 1); //strncpy(buf, DefaultConfig, strlen(DefaultConfig)); //buf[strlen(DefaultConfig)+1] = 0; ProcessConfigFile((char *)"built-in", DefaultConfig, 0); CurPos cp; cp.name = "built-in"; cp.sz = cpos; cp.a = 0;//buffer; cp.c = 0;//cp.a + 2 * 4; cp.z = 0;//cp.a + cp.sz; cp.line = 1; cpos = 0; int rc = ReadConfigFile(cp); if (rc == -1) { DieError(1, "Final Error %s offset %d\n", "built-in", cpos); } return rc; */ DieError(1, "Default config not yet implemented"); return 0; } int LoadConfig(int argc, char **argv, char *CfgFileName) { STARTFUNC("LoadConfig"); LOG << "Config file: " << CfgFileName << ENDLINE; int rc; CurPos cp; CFteMain(); cp.name = CfgFileName; cp.sz = cpos; cp.a = 0;//buffer; cp.c = 0;//cp.a + 2 * 4; cp.z = 0;//cp.a + cp.sz; cp.line = 1; cpos = 0; rc = ReadConfigFile(cp); if (rc == -1) { DieError(1, "Final Error %s offset %d\n", CfgFileName, cpos); } ENDFUNCRC(rc); } efte-1.1/src/o_routine.h0000664000076400007640000000233011041404761014261 0ustar laurilauri/* o_routine.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __ROUTINE_H__ #define __ROUTINE_H__ class RoutineView: public EList { public: EBuffer *Buffer; int RCount; int SearchLen; char SearchString[MAXISEARCH]; int SearchPos[MAXISEARCH]; RoutineView(int createFlags, EModel **ARoot, EBuffer *AB); virtual ~RoutineView(); virtual EEventMap *GetEventMap(); virtual int ExecCommand(int Command, ExState &State); virtual void HandleEvent(TEvent &Event); virtual int getMatchingLine(int start, int direction); virtual void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); virtual char* FormatLine(int Line); virtual int Activate(int No); void CancelSearch(); virtual void RescanList(); void UpdateList(); virtual int GetContext(); virtual void GetName(char *AName, int MaxLen); virtual void GetInfo(char *AInfo, int MaxLen); virtual void GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen); }; #endif efte-1.1/src/i_oview.h0000664000076400007640000000326611041404761013730 0ustar laurilauri/* i_oview.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __IOVIEW_H #define __IOVIEW_H class GxView; class EBuffer; class EWindow; class ExView { public: GxView *Win; ExView *Next; ExView(); virtual ~ExView(); virtual EEventMap *GetEventMap(); virtual int ExecCommand(int Command, ExState &State); virtual void Activate(int gotfocus); virtual int GetContext() { return CONTEXT_NONE; } virtual ExView *GetViewContext() { return this; } virtual ExView *GetStatusContext() { return this; } virtual int BeginMacro(); virtual void HandleEvent(TEvent &Event); virtual void UpdateView(); virtual void UpdateStatus(); virtual void RepaintView(); virtual void RepaintStatus(); virtual void Resize(int width, int height); virtual void EndExec(int NewResult); int IsActive(); void Repaint() { RepaintStatus(); RepaintView(); } void Update() { UpdateStatus(); UpdateView(); } int ConPutBox(int X, int Y, int W, int H, PCell Cell); int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count); int ConQuerySize(int *X, int *Y); int ConSetCursorPos(int X, int Y); int ConShowCursor(); int ConHideCursor(); void ConSetInsertState(bool insert); virtual int IsModelView() { return 0; } virtual void WnSwitchBuffer(EModel *M) { Next->WnSwitchBuffer(M); } }; #endif efte-1.1/src/h_perl.cpp0000664000076400007640000006271711041404761014101 0ustar laurilauri/* h_perl.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ /* * Perl Mode * * TODO: * here documents, formats * OS/2 EXTPROC..., * UNIX #! starts hilit ? * POD highlighting (need two keyword sets). * some tab handling (in & foo, etc -- if allowed)/ */ #include "fte.h" #define X_BIT 0x80 /* set if last was number, var, */ #define X_MASK 0x7F #define X_NOT(state) (!((state) & X_BIT)) #define kwd(x) (isalnum(x) || (x) == '_') #define IS_OBRACE(x) \ ((x) == '(' || (x) == '{' || (x) == '<' || (x) == '[') #define NUM_BRACE(x) \ ( \ (x) == '(' ? 0U : \ (x) == '{' ? 1U : \ (x) == '<' ? 2U : \ (x) == '[' ? 3U : 0U \ ) #define GET_BRACE(x) \ ( \ (x) == 0 ? '(' : \ (x) == 1 ? '{' : \ (x) == 2 ? '<' : \ (x) == 3 ? '[' : 0 \ ) #define IS_MBRACE(y,x) \ ( \ ((y) == '(' && (x) == ')') || \ ((y) == '{' && (x) == '}') ||\ ((y) == '<' && (x) == '>') ||\ ((y) == '[' && (x) == ']') \ ) #define QCHAR(state) ((char)(((state) >> 8) & 0xFF)) #define QSET(state, ch) ((unsigned short)((unsigned short)(state) | (((unsigned short)(ch)) << 8))) #define hsPerl_Punct 0 #define hsPerl_Comment 1 #define hsPerl_Normal 30 #define hsPerl_Keyword 4 #define hsPerl_String1 10 #define hsPerl_String2 11 #define hsPerl_StringBk 22 #define hsPerl_Variable 23 #define hsPerl_Number 24 #define hsPerl_Function 25 #define hsPerl_RegexpM 26 #define hsPerl_RegexpS1 28 #define hsPerl_RegexpS2 29 #define hsPerl_Docs 31 #define hsPerl_Data 32 #define hsPerl_RegexpS3 33 #define hsPerl_Quote1Op 35 #define hsPerl_Quote1 36 #define hsPerl_Quote1M 37 #define hsPerl_Regexp1Op 38 #define hsPerl_Regexp1 39 #define hsPerl_Regexp1M 40 #define hsPerl_Regexp2Op 41 #define hsPerl_Regexp2 42 #define hsPerl_Regexp2M 43 #define hsPerl_HereDoc 44 // hack (eod not detected properly) enum PerlOps { opQ, opQQ, opQW, opQX, opQR, opM, opS, opTR }; /*#define opQ 1 #define opQQ 2 #define opQW 3 #define opQX 4 #define opM 5 #define opS 6 #define opTR 7*/ int Hilit_PERL(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { int j; HILIT_VARS(BF->Mode->fColorize->Colors, Line); int firstnw = 0; int op; int setHereDoc = 0; int inSub = 0; #define MAXSEOF 100 static char hereDocKey[MAXSEOF]; C = 0; NC = 0; int isEOHereDoc = 0; if ((State & X_MASK) == hsPerl_HereDoc) { isEOHereDoc = strlen(hereDocKey) == (size_t)len && strncmp(hereDocKey, Line->Chars, len) == 0; if (isEOHereDoc) State = hsPerl_Normal | (State & X_BIT); } for (i = 0; i < Line->Count;) { if (*p != ' ' && *p != 9) firstnw++; if (*p == '{' && inSub) inSub = 0; IF_TAB() else { // printf("State = %d pos = %d", State, i); fflush(stdout); switch (State & X_MASK) { default: case hsPerl_Normal: if (i == 0 && X_NOT(State) && len == 8 && p[0] == '_' && p[1] == '_' && p[2] == 'D' && p[3] == 'A' && p[4] == 'T' && p[5] == 'A' && p[6] == '_' && p[7] == '_') { State = hsPerl_Data; Color = CLR_Comment; //hilit6: ColorNext(); hilit5: ColorNext(); hilit4: ColorNext(); //hilit3: ColorNext(); hilit2: ColorNext(); hilit: ColorNext(); continue; } else if ( i == 0 && X_NOT(State) && len == 7 && p[0] == '_' && p[1] == '_' && p[2] == 'E' && p[3] == 'N' && p[4] == 'D' && p[5] == '_' && p[6] == '_') { State = hsPerl_Data; Color = CLR_Comment; } else if ( i == 0 && X_NOT(State) && (*p == '=') && len > 4 && ( strncmp(p + 1, "head", 4) == 0 || strncmp(p + 1, "item", 4) == 0 || strncmp(p + 1, "over", 4) == 0 || strncmp(p + 1, "back", 4) == 0 ) ) { State = hsPerl_Docs; Color = CLR_Comment; goto hilit5; } else if ( i == 0 && X_NOT(State) && (*p == '=') && len > 3 && ( strncmp(p + 1, "pod", 3) == 0 ) ) { State = hsPerl_Docs; Color = CLR_Comment; goto hilit4; } else if (isalpha(*p) || *p == '_') { op = -1; j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_' || Line->Chars[i + j] == '\'')) ) j++; if (BF->GetHilitWord(j, &Line->Chars[i], Color)) { //Color = hcPERL_Keyword; State = hsPerl_Keyword; if (strncmp(p, "sub", 3) == 0) { inSub = 1; } } else { int x; x = i + j; while ((x < Line->Count) && ((Line->Chars[x] == ' ') || (Line->Chars[x] == 9))) x++; if ((x < Line->Count) && (Line->Chars[x] == '(')) { Color = CLR_Function; } else { Color = CLR_Normal; } State = hsPerl_Normal; } if (j == 1) { if (*p == 'q') op = opQ; else if (*p == 's' || *p == 'y') op = opS; else if (*p == 'm') op = opM; } else if (j >= 2) { if (*p == 'q') { if (p[1] == 'q') op = opQQ; else if (p[1] == 'w') op = opQW; else if (p[1] == 'r') op = opQR; else if (p[1] == 'x') op = opQX; } else if (*p == 't' && p[1] == 'r') op = opTR; if (op != -1 && j > 2 && p[2] == '\'') j = 2; else if (op != -1 && kwd(p[2])) op = -1; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; switch (op) { case opQ: State = hsPerl_Quote1Op; // q{} operator Color = CLR_Punctuation; continue; case opQQ: case opQW: case opQX: State = hsPerl_Quote1Op; // qq{} qx{} qw{} operators Color = CLR_Punctuation; continue; case opM: case opQR: State = hsPerl_Regexp1Op; // m{} qr{} operator Color = CLR_Punctuation; continue; case opTR: State = hsPerl_Regexp2Op; // tr{} operators Color = CLR_RegexpDelim; continue; case opS: State = hsPerl_Regexp2Op; // s{}{} operator Color = CLR_Punctuation; continue; default: State = hsPerl_Normal; continue; } } else if (len >= 2 && ((*p == '-' && p[1] == '-') || (*p == '+' && p[1] == '+'))) { hlState s = State; State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); ColorNext(); State = s; continue; } else if (inSub && *p == '(') { State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); Color = CLR_Variable; while (*p != ')' && len) ColorNext(); State = hsPerl_Normal; continue; } else if (len >= 2 && *p == '&' && (p[1] == '&' || isspace(p[1]))) { State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); ColorNext(); State = hsPerl_Normal; continue; } else if (*p == '&' && (len < 2 || p[1] != '&') && X_NOT(State)) { State = hsPerl_Function; Color = CLR_Function; ColorNext(); while ((len > 0) && (*p == '$' || *p == '@' || *p == '*' || *p == '%' || *p == '\\')) ColorNext(); while ((len > 0) && (isalnum(*p) || *p == '_' || *p == '\'')) ColorNext(); State = hsPerl_Normal | X_BIT; continue; } else if ((*p == '$') && (len > 1) && ((p[1] == '$') || p[1] == '"')) { State = hsPerl_Variable; Color = CLR_Variable; ColorNext(); ColorNext(); State = hsPerl_Normal | X_BIT; continue; } else if (*p == '*' && len > 1 && p[1] == '*') { hlState s = State; State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); ColorNext(); State = s; continue; } else if (*p == '$' || *p == '@' || *p == '\\' || (len > 2 && (*p == '%' || *p == '*') && X_NOT(State))) { char var_type = *p; State = hsPerl_Variable; Color = CLR_Variable; ColorNext(); while ((len > 0) && ((*p == ' ') || (*p == '\t'))) { IF_TAB() else ColorNext(); } /*while ((len > 0) && (*p == '$' || *p == '@' || *p == '*' || *p == '%' || *p == '\\')) ColorNext();*/ char first = *p; if (len > 0 && *p != ' ' && *p != '\t' && *p != '"') ColorNext(); // the following are one-character-ONLY if ( (var_type == '$' && strchr("_&`'+*.!/|,\\\";#%=-~:?$<>()[]", first) != NULL) || (var_type == '@' && strchr("_", first) != NULL) ) { // nothing. } // the following are one-or-two-characters-ONLY else if (first == '^') { if (len > 0 && isalpha(*p)) ColorNext(); } else if (first == '{') { UntilMatchBrace(first, ColorNext()); } else { while ((len > 0) && (isalnum(*p) || (first == '{' && (*p == '^' || *p == '}')) || *p == '_' || *p == '\'') ) ColorNext(); } State = hsPerl_Normal | X_BIT; continue; } else if ((len >= 2) && (*p == '0') && (*(p + 1) == 'x')) { State = hsPerl_Number; Color = CLR_Number; ColorNext(); ColorNext(); while (len && (isxdigit(*p) || *p == '_')) ColorNext(); // if (len && (toupper(*p) == 'U')) ColorNext(); // if (len && (toupper(*p) == 'L')) ColorNext(); State = hsPerl_Normal | X_BIT; continue; } else if (isdigit(*p)) { State = hsPerl_Number; Color = CLR_Number; ColorNext(); while (len && (isdigit(*p) || (*p == 'e' || *p == 'E' || *p == '_'))) ColorNext(); // if (len && (toupper(*p) == 'U')) ColorNext(); // if (len && (toupper(*p) == 'L')) ColorNext(); State = hsPerl_Normal | X_BIT; continue; } else if (*p == '\'') { State = QSET(hsPerl_String1, '\''); Color = CLR_String; goto hilit; } else if (*p == '"') { State = QSET(hsPerl_String2, '"'); Color = CLR_String; goto hilit; } else if (*p == '<' && len > 2 && p[1] == '<' && (p[2] == '"' || p[2] == '\'' || p[2] == '_' || (toupper(p[2]) >= 'A' && toupper(p[2]) <= 'Z'))) { int hereDocKeyLen; int offset = 2; if (p[2] == '"' || p[2] == '\'') offset++; setHereDoc++; for (hereDocKeyLen = 0; hereDocKeyLen < len && ( p[offset + hereDocKeyLen] == '_' || (toupper(p[offset + hereDocKeyLen]) >= 'A' && toupper(p[offset + hereDocKeyLen]) <= 'Z') ); ++hereDocKeyLen) { hereDocKey[hereDocKeyLen] = p[offset + hereDocKeyLen]; } hereDocKey[hereDocKeyLen] = '\0'; State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); State = hsPerl_Normal; continue; } else if (*p == '`') { State = QSET(hsPerl_StringBk, '`'); Color = CLR_String; goto hilit; } else if (*p == '#') { State = hsPerl_Comment | (State & X_BIT); continue; } else if (X_NOT(State) && *p == '/') { State = QSET(hsPerl_Regexp1, '/'); Color = CLR_RegexpDelim; goto hilit; } else if (X_NOT(State) && *p == '-' && len >= 2 && isalpha(p[1]) ) { Color = CLR_Normal; // default. if (strchr("wrxoRWXOezsfdlpSbctugkTB", p[1]) != NULL) { Color = CLR_Punctuation; // new default. if (len > 2) { switch (p[2]) { case '_': // there may be others... Color = CLR_Normal; break; default: if (isalnum(p[2])) Color = CLR_Normal; break; } } } ColorNext(); ColorNext(); State = hsPerl_Normal; continue; } else if (*p == ')' || *p == ']') { State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); State = hsPerl_Normal | X_BIT; continue; } else if (ispunct(*p)) { State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); State = hsPerl_Normal; continue; } Color = CLR_Normal; goto hilit; case hsPerl_Quote1Op: if (*p != ' ' && !kwd(*p)) { if (IS_OBRACE(*p)) { State = QSET(hsPerl_Quote1M, (1U << 2) | NUM_BRACE(*p)); } else { State = QSET(hsPerl_Quote1, *p); } Color = CLR_QuoteDelim; goto hilit; } else if (kwd(*p)) { State = hsPerl_Normal | X_BIT; continue; } Color = CLR_Punctuation; goto hilit; case hsPerl_Quote1: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == QCHAR(State)) { Color = CLR_QuoteDelim; ColorNext(); State = hsPerl_Normal | X_BIT; continue; } goto hilit; case hsPerl_Quote1M: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (GET_BRACE(QCHAR(State) & 3) == *p) { State += 1 << (2 + 8); goto hilit; } else if (IS_MBRACE(GET_BRACE(QCHAR(State) & 3), *p)) { State -= 1 << (2 + 8); if ((QCHAR(State) >> 2) == 0) { Color = CLR_QuoteDelim; ColorNext(); State = hsPerl_Normal | X_BIT; } else goto hilit; continue; } goto hilit; case hsPerl_Regexp1Op: if (*p != ' ') { // && !kwd(*p)) { if (IS_OBRACE(*p)) State = QSET(hsPerl_Regexp1M, (1U << 2) | NUM_BRACE(*p)); else State = QSET(hsPerl_Regexp1, *p); Color = CLR_RegexpDelim; goto hilit; } else if (kwd(*p)) { State = hsPerl_Normal | X_BIT; continue; } Color = CLR_Regexp; goto hilit; case hsPerl_Regexp1: Color = CLR_Regexp; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == QCHAR(State)) { Color = CLR_RegexpDelim; ColorNext(); Color = CLR_Punctuation; while (len > 0 && isalpha(*p)) ColorNext(); State = hsPerl_Normal | X_BIT; continue; } goto hilit; case hsPerl_Regexp1M: Color = CLR_Regexp; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (GET_BRACE(QCHAR(State) & 3) == *p) { State += 1 << (2 + 8); goto hilit; } else if (IS_MBRACE(GET_BRACE(QCHAR(State) & 3), *p)) { State -= 1 << (2 + 8); if ((QCHAR(State) >> 2) == 0) { Color = CLR_RegexpDelim; ColorNext(); Color = CLR_Punctuation; while (len > 0 && isalpha(*p)) ColorNext(); State = hsPerl_Normal | X_BIT; } else goto hilit; continue; } goto hilit; case hsPerl_Regexp2Op: if (*p != ' ') { // && !kwd(*p)) { if (IS_OBRACE(*p)) State = QSET(hsPerl_Regexp2M, (1U << 2) | NUM_BRACE(*p)); else State = QSET(hsPerl_Regexp2, *p); Color = CLR_RegexpDelim; goto hilit; } else if (kwd(*p)) { State = hsPerl_Normal | X_BIT; continue; } Color = CLR_Regexp; goto hilit; case hsPerl_Regexp2: Color = CLR_Regexp; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == QCHAR(State)) { Color = CLR_RegexpDelim; ColorNext(); /*State = hsPerl_Normal | X_BIT;*/ State = QSET(hsPerl_Regexp1, QCHAR(State)); continue; } goto hilit; case hsPerl_Regexp2M: Color = CLR_Regexp; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (GET_BRACE(QCHAR(State) & 3) == *p) { State += 1 << (2 + 8); goto hilit; } else if (IS_MBRACE(GET_BRACE(QCHAR(State) & 3), *p)) { State -= 1 << (2 + 8); if ((QCHAR(State) >> 2) == 0) { Color = CLR_RegexpDelim; ColorNext(); /*State = hsPerl_Normal | X_BIT;*/ State = hsPerl_Regexp1Op; } else goto hilit; continue; } goto hilit; case hsPerl_Data: Color = CLR_Comment; goto hilit; case hsPerl_HereDoc: if (!isEOHereDoc) { Color = CLR_String; goto hilit; } Color = CLR_Punctuation; setHereDoc = QCHAR(State); while (len > 0) ColorNext(); State = hsPerl_Normal | (State & X_BIT); continue; case hsPerl_Docs: Color = CLR_Comment; if (i == 0 && *p == '=' && len > 3 && p[1] == 'c' && p[2] == 'u' && p[3] == 't') { ColorNext(); ColorNext(); ColorNext(); ColorNext(); State = hsPerl_Normal; Color = CLR_Normal; continue; } goto hilit; case hsPerl_Comment: Color = CLR_Comment; goto hilit; case hsPerl_String1: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == QCHAR(State)) { ColorNext(); State = hsPerl_Normal | X_BIT; continue; } goto hilit; case hsPerl_String2: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == QCHAR(State)) { ColorNext(); State = hsPerl_Normal | X_BIT; continue; } goto hilit; case hsPerl_StringBk: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == QCHAR(State)) { ColorNext(); State = hsPerl_Normal | X_BIT; continue; } goto hilit; } } } if ((State & X_MASK) == hsPerl_Comment) State = hsPerl_Normal | (State & X_BIT); if (setHereDoc) State = QSET(hsPerl_HereDoc | (State & X_BIT), setHereDoc - 1); *ECol = C; return 0; } efte-1.1/src/o_directory.h0000664000076400007640000000322611041435604014605 0ustar laurilauri/* o_directory.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __ODIRECTORY_H #define __ODIRECTORY_H class EDirectory: public EList { public: char *Path; FileInfo **Files; int FCount; int SearchLen; char SearchName[MAXISEARCH]; int SearchPos[MAXISEARCH]; EDirectory(int createFlags, EModel **ARoot, char *aPath); virtual ~EDirectory(); virtual int GetContext(); virtual int GetMatchForward(int start=0); virtual int GetMatchBackward(int start=0); virtual EEventMap *GetEventMap(); virtual int ExecCommand(int Command, ExState &State); virtual void HandleEvent(TEvent &Event); virtual void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); virtual char *FormatLine(int Line); virtual int IsHilited(int Line); virtual void RescanList(); // virtual void UpdateList(); virtual void FreeList(); virtual int CanActivate(int Line); virtual int Activate(int No); virtual void GetName(char *AName, int MaxLen); virtual void GetPath(char *APath, int MaxLen); virtual void GetInfo(char *AInfo, int MaxLen); virtual void GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen); int isDir(int No); int FmChDir(const char* Name); int FmLoad(const char* Name, EView *View); int FmMvFile(const char* Name); int FmRmFile(const char* Name); int FmMkDir(); int ChangeDir(ExState &State); int RescanDir(); }; #endif efte-1.1/src/bmps/0000775000076400007640000000000011264420016013046 5ustar laurilauriefte-1.1/src/bmps/tagpop.bmp0000664000076400007640000000341607172436241015056 0ustar laurilauriBMNN@efte-1.1/src/bmps/errprev.bmp0000664000076400007640000000341611215511532015237 0ustar laurilauriBMNN@efte-1.1/src/bmps/next.bmp0000664000076400007640000000341611215511532014530 0ustar laurilauriBMNN@PPPPPPPPe P      PPe e           PP %             vP 5-&             r PB<4    3CU      PC"MCC=@1$@ :ܚ     P)[%Q!K)S(W)X,Q)H%ADZ     P !J.e)X)X)X$O0Z2U.O*H%BAW    P -b1i-b-b-b@i  ?\[}lҐpԕiҐX?d$A        efte-1.1/src/bmps/tagnext.bmp0000664000076400007640000000341607172436241015236 0ustar laurilauriBMNN@efte-1.1/src/bmps/pastecol.bmp0000664000076400007640000000341611215511532015364 0ustar laurilauriBMNN@Υoooooooooooooooooooooooooooo0=KKKKooƪoo0=RooeZeZޜeZκooK20-+ޥooeZeZޜeZ־ooK7530ooeZeZޜeZooK=:85ooeZeZޜeZooKB@=;ooeZeZޜeZooKHEB@ooeZeZޜeZooKNKHEooeZeZޜeZݥooKSQNKooeZeZޜeZΥooKYVTQooָooK_\YWooŴooKfc_\ooθԺooKjhfcooɶǻKjjjiooƭɽKjjjjooɩ׽KKjjjjooooooooooooooooooooZKKjjjjjjjjjigd`^_KKjmgddKKjpe_pe_pe_pe_pe_pe_pe_pe_pe_pe_{ihKKjohdʼohdjjKFޞpe_޷pe_zjPFK(s(sAmxojvlh+hmmKw_ipe_pe_pe_pe_pe_pe_w_iefte-1.1/src/bmps/errnext.bmp0000664000076400007640000000341611215511532015241 0ustar laurilauriBMNN@efte-1.1/src/bmps/copy.bmp0000664000076400007640000000341611215511532014524 0ustar laurilauriBMNN@͙͙͙͙͙͙͙͙͙͙͙͙͙͙͙͙͙͙͙͙͙͙~s~s~s~s~s~s~s~s~s͙͙͙͙͙͙͙͙͙͙͙͙͙͙~s~s~s~s~s~s~s~s~s͙͙͙͙͙͙͙͙~s~s~s~s͙߲~s~s~s~s~s~s~s~s~s͙͙͙ʽϽȳ͙͙͙͙͙~s~s~s~s͙͙͙͙ƭè͙͙οӿè͙߲~s~s~s~s͙ջè͙͙͙͙͙͙͙͙͙͙͙͙͙è͙è͙ƭè͙οӿè͙ջè͙͙͙͙͙͙͙͙͙͙͙efte-1.1/src/bmps/undo.bmp0000664000076400007640000000341611215511532014517 0ustar laurilauriBMNN@f(f(_%Y#S MGEEEEEEEEEEC<<΄4y/54~1w.p,j)h(h(h(h(h(h(h(h(h(j)j)S 6<΄4LQNKIGECBBBBBBBBBD?S <Ξ>UUQOMKHFDBBBBBBBBDDj)CΧAWVSQNMJHFCBAAAAAABBj)EαE\[XVTPcjigfR AAAAABBh(EζGcc]ZWTƟɆKAAABBh(EζGj k f`\Xvؼ׼׼׼ݰAABBh(EζGuvnfb[XTRPNKn%p/ABBh(EζG++ugg`\WUSQOM׋KᲇDCBh(EζG??~"j j d^XVTRPp#ƣGFDj)EζGLN+ml f^YWURW汀JIFs-MζGUX1onf\ZW:o LLIy/W"ζG[^7xfRPOL3b&ζG_f@}ظ7WUSRO6j)ζGdoK{ -rgeb_^\XVUR:u-ζGfy]~"-&sl l gd`_[YWU?~1ζGfy?7/&vrvngb__\[XA5ζG[zwocUF7)vk e`_]^[E9θHIgzuiYH3}ogc`^__I=θHWHYfig`XK<,xl fb_]^YC=ζGGGGGGGGGGGGGGGIGGAAefte-1.1/src/bmps/last.bmp0000664000076400007640000000341611215511532014515 0ustar laurilauriBMNN@6666666666k      `6666z        k JJ6W            h i 6[      ږ"3#  #,)h h 6      =O( %(.:/h 6       AT- %,15A"P'i 6       BY4+29="L8g*Wh 6        F]907?D$ROzJy) 6       Ic ?#F(L,R/Y!SXʁlӓ(I 6    '3p{%6%Mi#E>_ڡZ~2]RXʁڧ>e 6    )=+Fd-R5bR\˄Nw 6    2JIi7f"ThЎU} 6    ݞxԋݩy՚8h)ZؠQw 6   ޤ8h8h:i⸱Ac 6   8h8h8h]̆њ(A 6  8h8h8h8hlё J nЊ7g8h8h8hsԖأ5S J +7>GtӒAo8h8h+\gόκY~ Ji  %+2>GNR$V4d8h5enӓɷgό) i i*47>GNR$V4dR}ڥĝZɀ* i i +AJN"U1cGugЎ٤ܩkБ7W  i i 1G Q.^>lGr@f+H          efte-1.1/src/bmps/exit.bmp0000664000076400007640000000341607172436241014535 0ustar laurilauriBMNN@΄΄΄΄΄efte-1.1/src/bmps/cut.bmp0000664000076400007640000000341611215511532014345 0ustar laurilauriBMNN@΋((((΋((((((΋((΋((΋((΋((΋((((΋((΋((΋((((((΋(((΋((((((΋((΋((((((%(΋((΋(^+[%((*'΋((ΟB(&(B*΋(((y/sH4, (W#-((((ubW{tI5, M(((ubWTA4ubWubWx0ubWubWubWubW˱ubWubWubWĪubWubWubWubWubWubWɯubWubWubWubWɯubWubWubWubWubWubWubWubWubWubWo[QubWubWubWubWubWubWubWefte-1.1/src/bmps/prev.bmp0000664000076400007640000000341611215511532014526 0ustar laurilauriBMNN@66666666J6        66JJ            66i i             [6i i           W6i * % ݞ'3      6i +4++ޤp{      z6i A727%6        6 1J>>>)=        k6 GNGGGnЊxԋ2J+%      6 Q"UNNtӒŻź·鿶缵维纏ږ   6 .^1cRR   6 >lGu$V$V   6 GrgЎ4d4dAoݩIiFdMiIcF]BYAT=O"3   6 @f٤R}8h8h7g-R#E ?94-(#   6 +Hܩڥ5e8h8h8h>_#F0+ % `6 kБnӓ+\8h8h8hڡ(L72, % 6 7W⸵gό8h8h8h8hy՚Z~,R?91( # k 6 ZɀʻsԖ8h8h8h8h7f5b2]/YD=5., J *gόؗ]̆:i)Z"TRR!S$R"LA:)h J )Y~ѠؠhЎ\˄XʁXʁOz8g"P/h i   5SlёᶱƵɫⷈڧlӓJy*W'h h   (AAcQwU}Nw>e(I)h i         efte-1.1/src/bmps/paste.bmp0000664000076400007640000000341611215511532014666 0ustar laurilauriBMNN@Υoooooooooooooooooooooooooooo0=KKKKoooo0=RooooK20-+ޥoodXdXdXdXdXdXdXdXooK7530ooooK=:85ooooKB@=;oodXdXdXdXdXdXdXdXooKHEB@ooooKNKHEooݥooKSQNKooٞdXdXdXdXdXdXdXdXΥooKYVTQooԽλooK_\YWooŴooKfc_\ooθԺooKjhfcooɶǻKjjjiooƭɽKjjjjooɩ׽KKjjjjooooooooooooooooooooZKKjjjjjjjjjigd`^_KKjmgddKKjpe_pe_pe_pe_pe_pe_pe_pe_pe_pe_{ihKKjohdʼohdjjKFޞpe_޷pe_zjPFK(s(sAmxojvlh+hmmKw_ipe_pe_pe_pe_pe_pe_w_iefte-1.1/src/bmps/save.bmp0000664000076400007640000000341611215511532014510 0ustar laurilauriBMNN@+(+(+(+(+(+(+(+(+(NLJJJIAAYYɽįޱedz!!99DE+(+(QOJJNNEF<=yyNLedy ::HH+(+(PNJJMMDD@@yySPedy ::GG+(+(PNJJMMCCAAyySPedy ::GG+(+(PNJJMMCCBAyySPedx ::GG+(+(PNJJMMBBCCyySPedt99GG+(+(PNJJLLDDAAٱed''==FG+(+(QNJJKKJIFF[[ww{{tunollhhhhZZDCAACCIIEF+(+(JJJJDCKIQQPOMLMMMMMMMLMLLKPOXW[ZWWNNDE+(+(JJJJʌʌˏ̐̐̐̐̐̐̐̐̐̐̑ːUUJJ+(+(JJJJ״ݷKKJJ+(+(JJJJٸݷIHJJ+(+(JJJJٶݷIHJJ+(+(JJJJٶݷIHJJ+(+(JJJJٶݷIHJJ+(+(JJJJٶݷIHJJ+(+(JJJJٶݷIHJJ+(+(JJJJٶݷIHJJ+(+(JJJJٷݷJJJJ+(+(JJJJӱݸJJJJ+(+(+(ື+(+(efte-1.1/src/bmps/redo.bmp0000664000076400007640000000341611215511532014503 0ustar laurilauriBMNN@΀??z<t9n6h3b0`/`/`/`/`/`/`/`/`/`/^.V*V*ΜMHOMJGDA@@@@@@@@@AAn6P(V*ΜMglifdb`^]]]]]]]]]_Yn6V*βXppljhfca_]]]]]]]]__A^.κ\rqnliheca^]\\\\\\]]A`/`wvsqokhtԃ3с3΀3~3s$\\\\]]@`/b} } xurhϳ\\\\]]@`/b{ ̡序_]\\]]@`/b**S>omkifdc`]\]]@`/bCC*Хjwrpnljheca_^]@`/bYY8ܽByvsqokhfdba_A`/bgiCΣzzxwttkigedaEh3bpsJPWzxw}ljggdHr8bvyQ%ƔkjgL|=bzZ-3jnmjPAb~f6E9)wsqpmTFbŒx8E=1)!!{zvtrpYJbȗŒYQH=5,$,|zzwvs[NbvƓ̟ȘĐ}paQA, {zxyv`ScdƓʛʛȗÎtcL5 }{yzzdWcrct{sfVD/|zxyt^Wbbbbbbbbbbbbbbbdbb\\efte-1.1/src/bmps/tagfind.bmp0000664000076400007640000000341607172436241015200 0ustar laurilauriBMNN@efte-1.1/src/bmps/tagprev.bmp0000664000076400007640000000341607172436241015234 0ustar laurilauriBMNN@efte-1.1/src/bmps/open.bmp0000664000076400007640000000341611215511532014513 0ustar laurilauriBMNN@ σA7qxwoL@ ЯpstwyytiE8;MݬmrrrrsswyzxsND_ruuuuuuuuvvx|_udϢx{{{{{{{{zz{\fB0ؿ{_lh_cjcϒhrgDmώjdϿtϩmjhPϔϹuqqqnooJGϺ}yyyyyyxwKӞV(֝Nwϼefte-1.1/src/bmps/close.bmp0000664000076400007640000000321611215511532014655 0ustar laurilauriBMNN@AUar :0I,Qc1Gq-`s0I+-0H`s+0H                   efte-1.1/src/i_ascii.h0000664000076400007640000000134511041404761013663 0ustar laurilauri/* i_ascii.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __EXASCII_H #define __EXASCII_H class ExASCII: public ExView { public: int Pos, LPos; ExASCII(); virtual ~ExASCII(); virtual void Activate(int gotfocus); virtual ExView* GetViewContext() { return Next; } virtual int BeginMacro(); virtual void HandleEvent(TEvent &Event); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); }; #endif efte-1.1/src/clip.h0000664000076400007640000000104511041404761013207 0ustar laurilauri/* clip.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __CLIPLIB_H #define __CLIPLIB_H #ifdef __cplusplus extern "C" { #endif typedef struct { unsigned long fLen; char *fChar; } ClipData; int GetClipText(ClipData *cd); int PutClipText(ClipData *cd); #ifdef __cplusplus } #endif #endif efte-1.1/src/i_search.h0000664000076400007640000000201011041404761014026 0ustar laurilauri/* i_search.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __ISEARCH_H #define __ISEARCH_H #define MAXISEARCH 256 class ExISearch: public ExView { public: typedef enum { IOk, INoMatch, INoPrev, INoNext } IState; char ISearchStr[MAXISEARCH + 1]; EPoint Orig; EPoint stack[MAXISEARCH]; int len; int stacklen; EBuffer *Buffer; IState state; int Direction; ExISearch(EBuffer *B); virtual ~ExISearch(); virtual void Activate(int gotfocus); virtual ExView *GetViewContext() { return Next; } virtual int BeginMacro(); virtual void HandleEvent(TEvent &Event); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); void SetState(IState state); }; #endif efte-1.1/src/defcfg.fte0000664000076400007640000004433111041404761014032 0ustar laurilauri# # Default configuration to be built into eFTE # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # menu File { item "&Open...\tF3" { FileOpen } item "&Reload\tShift+F3" { FileReload } item "&Save\tF2" { FileSave } item "Save &As...\tShift+F2" { FileSaveAs } item "Save Al&l\tCtrl+F2" { FileSaveAll } item "&Close\tAlt+Q" { FileClose } item; item "&Next\tAlt+Left" { FileNext } item "&Previous\tAlt+Right" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu Edit { item "&Undo\tAlt+BackSp" { Undo } item "&Redo\tAlt+Shift+BackSp" { Redo } item; item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "&Delete line\tCtrl+Y" { KillLine } item "&Split line\tCtrl+L" { LineSplit } item "&Join line\tCtrl+J" { LineJoin } item; item "&Quote Literal...\tCtrl+Q" { InsertChar } } menu Translate { item "Upperc&ase" { BlockCaseUp } item "Low&ercase" { BlockCaseDown } item "Tog&glecase" { BlockCaseToggle } } menu Block { item "&Unmark\tEsc" { BlockUnmark } item "Mark &Line\tAlt+L" { BlockMarkLine } item "Mark &Stream\tAlt+A" { BlockMarkStream } item "Mark &Column\tAlt+K" { BlockMarkColumn } item; item "&Indent\tAlt+I" { BlockIndent } item "U&nindent\tAlt+U" { BlockUnindent } item; item "&Write..." { BlockWrite } item "&Read..." { BlockRead } item "&Print" { BlockPrint } item; submenu "Translat&e", Translate; } menu Search { item "&Find...\tCtrl+F" { Find } item "Find and &replace...\tCtrl+R" { FindReplace } item "Repeat &Last find\tCtrl+L" { FindRepeat } item "Repeat last find re&verse\tCtrl+B" { FindRepeatReverse } item "Repeat last find &once\tCtrl+N" { FindRepeatOnce } item "Incremental &search\tCtrl+S" { IncrementalSearch } item; item "&Place Bookmark..." { PlaceBookmark } item "Goto &Bookmark..." { GotoBookmark } item; item "&Match paren\tAlt+-" { MatchBracket } item "&Goto line...\tAlt+J" { MoveToLine } } menu Tools { item "&Compile\tF9" { Compile "make -k " } item "&Grep" { Compile "grep -n " } item; item "Sh&ell" { RunProgram "" } item; item "Go to prev &error\tF11" { CompilePrevError } item "Go to &next error\tF12" { CompileNextError } item; item "&Messages\tS+F9" { ViewMessages } } menu Window { item "Split &Horizontal\tShift+F2" { WinHSplit } item "&Close view\tCtrl+Alt+F4" { WinClose } item "Close &other views\tF5" { WinZoom } item; item "&Routines\tCtrl+I" { ListRoutines } item "&Buffers\tAlt+0" { ViewBuffers } item "&Directory\tC+M" { DirOpen } } menu Options { item "&Insert mode\tC+O C+I" { ToggleInsert } item "&Auto indent\tC+O C+A" { ToggleAutoIndent } item "&Case sensitive\tC+O C+C" { ToggleMatchCase } item "Trim &EOL spaces\tC+O C+E" { ToggleTrim } item "&Read only\tC+O C+R" { ToggleReadOnly } item "&Undo/Redo\tC+O C+U" { ToggleUndo } item "&Show markers\tC+O C+." { ToggleShowMarkers; WinRefresh } item; item "&Word wrap\tC+O C+W" { ToggleWordWrap } item "&Left margin...\tC+O A+[" { ChangeLeftMargin } item "Ri&ght margin...\tC+O A+]" { ChangeRightMargin } item; item "&Tab size...\tC+O C+T" { ChangeTabSize; WinRefresh } item "S&how tabs\tC+O Tab" { ToggleShowTabs; WinRefresh } item "E&xpand tabs\tC+O C+Tab" { ToggleExpandTabs; WinRefresh } item "&Print to... " { SetPrintDevice } } menu Help { item "&Show key" { ShowKey } item; item "&About..." { ShowVersion } } menu Main { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } menu Local { item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tAlt+Q" { FileClose } } eventmap MODEL { # basic commands, for files, directories, message view, etc. key [C+F2] { FileSaveAll } key [F3] { FileOpen } key [F4] { WinNext } key [C+F4] { WinHSplit } key [S+F4] { WinPrev } key [A+S-F4] { WinClose } key [F5] { WinZoom } key [F6] { FileNext } key [S+F6] { FilePrev } key [A+S-F6] { FileLast } key [F10] { MainMenu } key [C+F9] { RunProgram } key [S+F10] { LocalMenu } key [A+G-Up] { WinPrev } key [A+G-Down] { WinNext } key [A+G-Left] { FilePrev } key [A+G-Right] { FileNext } key [A+G-PgUp] { WinPrev; MovePageUp; WinNext } key [A+G-PgDn] { WinNext; MovePageDown; WinPrev } key [A+C+G-PgUp] { WinNext; MovePageUp; WinPrev } key [A+C+G-PgDn] { WinPrev; MovePageDown; WinNext } key [A+Q] { FileClose } key [A+X] { ExitEditor } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } # this is also useful for 'grep -n' etc. if configured key [F9] { Compile; ViewMessages } key [F11] { CompilePrevError } key [F12] { CompileNextError } key [S+F9] { ViewMessages } key [A+0] { ViewBuffers } key [A+1] { SwitchTo 1 } key [A+2] { SwitchTo 2 } key [A+3] { SwitchTo 3 } key [A+4] { SwitchTo 4 } key [A+5] { SwitchTo 5 } key [A+6] { SwitchTo 6 } key [A+7] { SwitchTo 7 } key [A+8] { SwitchTo 8 } key [A+9] { SwitchTo 9 } } eventmap PLAIN: MODEL { # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [Esc] { BlockMarkStream; BlockUnmark } key [F2] { FileSave } key [S+F2] { FileSaveAs } key [A+S-F2] { FileSave; FileClose } key [S+F3] { FileReload; WinRefresh } key [C+F3] { FileOpenInMode } key [F7] { BlockBegin } key [S+F7] { MoveBlockStart } key [F8] { BlockEnd } key [S+F8] { MoveBlockEnd } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } # key [A+G-Left] { ScrollLeft } # key [A+G-Right] { ScrollRight } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } # key [G+0] { ToggleInsert } # key [G+S+0] { InsertString 'foo' } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } key [A+G-S+Up] { BlockExtendBegin; ScrollUp; BlockExtendEnd } key [A+G-S+Down] { BlockExtendBegin; ScrollDown; BlockExtendEnd } key [A+G-S+Left] { BlockExtendBegin; ScrollLeft; BlockExtendEnd } key [A+G-S+Right] { BlockExtendBegin; ScrollRight; BlockExtendEnd } key [A+G-C+Up] { MovePrevEqualIndent } key [A+G-C+Down] { MoveNextEqualIndent } key [A+G-C+Left] { MovePrevTab } key [A+G-C+Right] { MoveNextTab } key [C+G-Ins] { BlockCopy } key [C+G-Del] { BlockKill } key [S+G-Ins] { BlockPasteStream } key [S+G-Del] { BlockCut } key [A+G-Ins] { BlockPasteColumn } key [A+G-S+Ins] { BlockPasteLine } key [G-Enter] { LineNew } key [BackSp] { BackSpace } key [G-Ins] { ToggleInsert } key [G-Del] { Delete } key [Tab] { InsertTab } key [S+Tab] { InsertSpacesToTab 10 } key [C+Tab] { CompleteWord } # key [C+Tab] { InsertTab } key [C+BackSp] { KillWordPrev } key [C+S+BackSp] { KillToLineStart } key [C+G-Enter] { LineSplit } key [G-S+Enter] { LineInsert } key [A+G-Enter] { LineAdd } key [A+G-Del] { KillWord } key [A+G-End] { KillToLineEnd } key [A+BackSp] { Undo } key [A+S+BackSp] { Redo } key [C+A_1] { GotoBookmark "1" } key [C+A_2] { GotoBookmark "2" } key [C+A_3] { GotoBookmark "3" } key [C+A_4] { GotoBookmark "4" } key [C+A_5] { GotoBookmark "5" } key [C+A_6] { GotoBookmark "6" } key [C+A_7] { GotoBookmark "7" } key [C+A_8] { GotoBookmark "8" } key [C+A_9] { GotoBookmark "9" } key [C+A_0] { GotoBookmark "0" } key [C+P_1] { PlaceBookmark "1" } key [C+P_2] { PlaceBookmark "2" } key [C+P_3] { PlaceBookmark "3" } key [C+P_4] { PlaceBookmark "4" } key [C+P_5] { PlaceBookmark "5" } key [C+P_6] { PlaceBookmark "6" } key [C+P_7] { PlaceBookmark "7" } key [C+P_8] { PlaceBookmark "8" } key [C+P_9] { PlaceBookmark "9" } key [C+P_0] { PlaceBookmark "0" } key [C+B] { FindRepeatReverse } key [C+C] { MoveToColumn } key [C+D] { LineDuplicate } key [C+F] { Find } key [C+I] { ListRoutines } key [C+J] { LineJoin } key [C+L] { FindRepeat } key [C+M] { DirOpen } key [C+N] { FindRepeatOnce } key [C+Q] { InsertChar } key [C+R] { FindReplace } key [C+T] { KillWord } key [C+Y] { KillLine } key [C+E] { LineTrim } key [A+A] { BlockMarkStream } key [A+B] { MainMenu 'B' } key [A+C] { BlockCopy } key [A+D] { MainMenu 'D' } key [A+E] { MainMenu 'E' } key [A+F] { MainMenu 'F' } key [A+G] { BlockCut } key [A+H] { MainMenu 'H' } key [A+I] { BlockIndent } key [A+J] { MoveToLine } key [A+K] { BlockMarkColumn } key [A+L] { BlockMarkLine } key [A+O] { MainMenu 'O' } key [A+R] { WrapPara } # Reformat key [A+S] { MainMenu 'S' } key [A+T] { MainMenu 'T' } key [A+U] { BlockUnindent } key [A+W] { MainMenu 'W' } key [C+S] { IncrementalSearch } key [C+O_C+A] { ToggleAutoIndent } key [C+O_C+C] { ToggleMatchCase } key [C+O_C+E] { ToggleTrim } key [C+O_C+I] { ToggleInsert } # key [C+O_C+M] { ChangeMode } # key [C+O_C+M] { ShowMenu 'MChangeMode' } key [C+O_C+R] { ToggleReadOnly } key [C+O_C+S] { ToggleSysClipboard } key [C+O_C+T] { ChangeTabSize } key [C+O_C+U] { ToggleUndo } key [C+O_C+W] { ToggleWordWrap } key [C+O_.] { ToggleShowMarkers } key [C+O_[] { SetLeftMargin } key [C+O_\]] { SetRightMargin } key [C+O_A+[] { ChangeLeftMargin } key [C+O_A+\]] { ChangeRightMargin } key [C+O_Tab] { ToggleShowTabs } key [C+O_C+Tab] { ToggleExpandTabs } key [C+O_Del] { ToggleDeleteKillTab } key [C+O_G-Ins] { ToggleInsert } key [C+O_BackSp] { ToggleBackSpKillTab } key [C+O_Space] { ToggleIndentWithTabs } key [C+O_C+BackSp] { ToggleBackSpUnindents } key [A+-] { MatchBracket } key [A+=] { HilitMatchBracket } key [C+Space] { InsPrevLineChar } key [A+Space] { InsPrevLineToEol } key [A+F5] { ShowEntryScreen } key [C+_] { ShowPosition } key [Center] { MoveLineCenter } key [C+X] { MovePrevPos } # key [C+S+A] { ASCIITable } key [G+*] { LineInsert ; MoveUp; ScrollUp } # key [G++] { DumpFold } key [A+G++] { FoldCreate } key [A+G+-] { FoldDestroy } key [G+S++] { FoldPromote } key [G+S+-] { FoldDemote } key [C+G++] { FoldOpen } key [C+G+-] { FoldClose } key [C+G+*] { FoldOpenNested } key [C+G+/] { FoldToggleOpenClose } key [A+G+*] { FoldOpenAll } key [A+G+/] { FoldCloseAll } # key [C+G-Up] { MoveFoldPrev } # key [C+G-Down] { MoveFoldNext } # key [A+C+A] { FileOpen 'BUFFER.CPP' } key [C+K] { ShowKey } key [A+,] { SearchWordPrev } key [A+.] { SearchWordNext } key [A+/] { HilitWord } } colorize PLAIN { SyntaxParser = 'PLAIN'; color { { 'Normal', '7 0' }, }; } mode PLAIN { Colorizer = 'PLAIN'; } eventmap LIST { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [A+G-Up] { ScrollUp } key [A+G-Down] { ScrollDown } key [A+G-Left] { ScrollLeft } key [A+G-Right] { ScrollRight } key [Esc] { Cancel } key [G-Enter] { Activate } } eventmap BUFFERS: LIST { key [C+F10] { FileClose } key [F2] { FileSave } } eventmap ROUTINES: LIST { } eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } # key [A+G-Left] { ScrollLeft } # key [A+G-Right] { ScrollRight } key [G-Enter] { Activate } } menu Directory { item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu Navigate { item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } # item "&/ Goto Dir\t/" { DirGoto } item "&\\ Goto Dir\t\\" { DirGoto } item; item '&A:\\' { DirGoto 'A:\\' } item '&B:\\' { DirGoto 'B:\\' } item '&C:\\' { DirGoto 'C:\\' } item '&D:\\' { DirGoto 'D:\\' } item '&E:\\' { DirGoto 'E:\\' } item '&F:\\' { DirGoto 'F:\\' } item '&G:\\' { DirGoto 'G:\\' } item '&H:\\' { DirGoto 'H:\\' } item '&I:\\' { DirGoto 'I:\\' } } menu DirMain { submenu "&Directory", Directory; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap DIRECTORY: MLIST { MainMenu = 'DirMain'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [C+D] { DeleteFile } key [A+D] { MainMenu 'D' } key [A+N] { MainMenu 'N' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } } menu Messages { item "&Close\tAlt+Q" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu MsgMain { submenu "&Messages", Messages; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap MESSAGES: MLIST { MainMenu = "MsgMain"; key [A+M] { MainMenu 'M' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } } efte-1.1/src/g_unix_pipe.cpp0000664000076400007640000000767511041404761015140 0ustar laurilauri/* * g_unix_pipe.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #define MAX_PIPES 4 #include #include #include "sysdep.h" #include "c_config.h" #include "console.h" #include "gui.h" typedef struct { int used; int id; int fd; int pid; int stopped; EModel *notify; } GPipe; static GPipe Pipes[MAX_PIPES] = { {0}, {0}, {0}, {0} }; /* If command pipes are open, wait for input on them or * external file descriptors if passed */ int WaitPipeEvent(TEvent *Event, int WaitTime, int *fds, int nfds) { fd_set readfds; struct timeval timeout; int have_pipes; int i; FD_ZERO(&readfds); have_pipes = 0; for (int p = 0; p < MAX_PIPES; p++) if (Pipes[p].used && Pipes[p].fd != -1) { FD_SET(Pipes[p].fd, &readfds); have_pipes = 1; } if (!have_pipes) return 0; for (i = 0; i < nfds; i++) { FD_SET(fds[i], &readfds); } if (WaitTime == -1) { if (select(sizeof(fd_set) * 8, &readfds, NULL, NULL, NULL) < 0) return -1; } else { timeout.tv_sec = WaitTime / 1000; timeout.tv_usec = (WaitTime % 1000) * 1000; if (select(sizeof(fd_set) * 8, &readfds, NULL, NULL, &timeout) < 0) return -1; } for (i = 0; i < nfds; i++) { if (FD_ISSET(fds[i], &readfds)) { return 0; } } for (int pp = 0; pp < MAX_PIPES; pp++) { if (Pipes[pp].used && Pipes[pp].fd != -1 && FD_ISSET(Pipes[pp].fd, &readfds) && Pipes[pp].notify) { Event->What = evNotify; Event->Msg.View = 0; Event->Msg.Model = Pipes[pp].notify; Event->Msg.Command = cmPipeRead; Event->Msg.Param1 = pp; Pipes[pp].stopped = 0; return 1; } //fprintf(stderr, "Pipe %d\n", Pipes[pp].fd); } return 0; } int GUI::OpenPipe(char *Command, EModel * notify) { int i; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) { int pfd[2]; Pipes[i].id = i; Pipes[i].notify = notify; Pipes[i].stopped = 1; if (pipe((int *) pfd) == -1) return -1; switch (Pipes[i].pid = fork()) { case -1: /* fail */ return -1; case 0: /* child */ signal(SIGPIPE, SIG_DFL); close(pfd[0]); close(0); dup2(pfd[1], 1); dup2(pfd[1], 2); close(pfd[1]); exit(system(Command)); default: close(pfd[1]); fcntl(pfd[0], F_SETFL, O_NONBLOCK); Pipes[i].fd = pfd[0]; } Pipes[i].used = 1; return i; } } return -1; } int GUI::SetPipeView(int id, EModel * notify) { if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; Pipes[id].notify = notify; return 0; } int GUI::ReadPipe(int id, void *buffer, int len) { int rc; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; rc = read(Pipes[id].fd, buffer, len); if (rc == 0) { close(Pipes[id].fd); Pipes[id].fd = -1; return -1; } if (rc == -1) { Pipes[id].stopped = 1; return 0; } return rc; } int GUI::ClosePipe(int id) { int status = -1; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; if (Pipes[id].fd != -1) close(Pipes[id].fd); kill(Pipes[id].pid, SIGHUP); alarm(1); waitpid(Pipes[id].pid, &status, 0); alarm(0); Pipes[id].used = 0; return WEXITSTATUS(status); } efte-1.1/src/con_ikcz.h0000664000076400007640000001650411041404761014065 0ustar laurilauri/* * con_ikcz.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __CON_IKCS_H #define __CON_IKCS_H #include "con_i18n.h" #include static struct remapKey keyboardStd[] = { { 0, } }; static struct remapKey keyboardHalfCz[] = { { XK_2, 0xff & '' }, {XK_3, 0xff & ''}, {XK_4, 0xff & ''}, {XK_5, 0xff & ''}, {XK_6, 0xff & ''}, {XK_7, 0xff & ''}, {XK_8, 0xff & ''}, {XK_9, 0xff & ''}, {XK_0, 0xff & ''}, {0, } }; static struct remapKey keyboardFullCz[] = { { XK_1, 0xff & '+' }, {XK_exclam, XK_1}, {XK_2, 0xff & ''}, {XK_at, XK_2}, {XK_3, 0xff & ''}, {XK_numbersign, XK_3}, {XK_4, 0xff & ''}, {XK_dollar, XK_4}, {XK_5, 0xff & ''}, {XK_percent, XK_5}, {XK_6, 0xff & ''}, {XK_asciicircum, XK_6}, {XK_7, 0xff & ''}, {XK_ampersand, XK_7}, {XK_8, 0xff & ''}, {XK_asterisk, XK_8}, {XK_9, 0xff & ''}, {XK_parenleft, XK_9}, {XK_0, 0xff & ''}, {XK_parenright, XK_0}, {XK_minus, XK_equal}, {XK_underscore, XK_percent}, {XK_bracketleft, 0xff & ''}, {XK_braceleft, 0xff & '/'}, {XK_bracketright, 0xff & ')'}, {XK_braceright, 0xff & '('}, {XK_semicolon, 0xff & ''}, {XK_apostrophe, 0xff & ''}, {XK_colon, 0xff & '"'}, {XK_quotedbl, 0xff & '!'}, {XK_comma, 0xff & ','}, {XK_less, 0xff & '?'}, {XK_period, 0xff & '.'}, {XK_greater, 0xff & ':'}, {XK_question, 0xff & '_'}, {XK_slash, 0xff & '-'}, {0, } }; static struct remapKey keyboardAcute[] = { { XK_w, 0xff & '' }, {XK_W, 0xff & ''}, {XK_e, 0xff & ''}, {XK_E, 0xff & ''}, {XK_r, 0xff & ''}, {XK_R, 0xff & ''}, {XK_t, 0xff & ''}, {XK_T, 0xff & ''}, {XK_y, 0xff & ''}, {XK_Y, 0xff & ''}, {XK_u, 0xff & ''}, {XK_U, 0xff & ''}, {XK_i, 0xff & ''}, {XK_I, 0xff & ''}, {XK_o, 0xff & ''}, {XK_O, 0xff & ''}, {XK_p, 0xff & ''}, {XK_P, 0xff & ''}, {XK_a, 0xff & ''}, {XK_A, 0xff & ''}, {XK_s, 0xff & ''}, {XK_S, 0xff & ''}, {XK_d, 0xff & ''}, {XK_D, 0xff & ''}, {XK_h, 0xff & ''}, {XK_H, 0xff & ''}, {XK_l, 0xff & ''}, {XK_L, 0xff & ''}, {XK_z, 0xff & ''}, {XK_Z, 0xff & ''}, {XK_x, 0xff & ''}, {XK_X, 0xff & ''}, {XK_c, 0xff & ''}, {XK_C, 0xff & ''}, {XK_b, 0xff & ''}, {XK_B, 0xff & ''}, {XK_n, 0xff & ''}, {XK_N, 0xff & ''}, {XK_equal, 0xff & ''}, {0, } }; static struct remapKey keyboardCaron[] = { { XK_e, 0xff & '' }, {XK_E, 0xff & ''}, {XK_r, 0xff & ''}, {XK_R, 0xff & ''}, {XK_t, 0xff & ''}, {XK_T, 0xff & ''}, {XK_u, 0xff & ''}, {XK_U, 0xff & ''}, {XK_i, 0xff & ''}, {XK_I, 0xff & ''}, {XK_o, 0xff & ''}, {XK_O, 0xff & ''}, {XK_a, 0xff & ''}, {XK_A, 0xff & ''}, {XK_s, 0xff & ''}, {XK_S, 0xff & ''}, {XK_d, 0xff & ''}, {XK_D, 0xff & ''}, {XK_l, 0xff & ''}, {XK_L, 0xff & ''}, {XK_z, 0xff & ''}, {XK_Z, 0xff & ''}, {XK_x, 0xff & ''}, {XK_X, 0xff & ''}, {XK_c, 0xff & ''}, {XK_C, 0xff & ''}, {XK_n, 0xff & ''}, {XK_N, 0xff & ''}, {XK_plus, 0xff & ''}, {0, } }; static struct remapKey keyboardFirst[] = { { XK_w, 0xff & '' }, {XK_W, 0xff & ''}, {XK_e, 0xff & ''}, {XK_E, 0xff & ''}, {XK_r, 0xff & ''}, {XK_R, 0xff & ''}, {XK_t, 0xff & ''}, {XK_T, 0xff & ''}, {XK_y, 0xff & ''}, {XK_Y, 0xff & ''}, {XK_u, 0xff & ''}, {XK_U, 0xff & ''}, {XK_i, 0xff & ''}, {XK_I, 0xff & ''}, {XK_o, 0xff & ''}, {XK_O, 0xff & ''}, {XK_p, 0xff & ''}, {XK_P, 0xff & ''}, {XK_a, 0xff & ''}, {XK_A, 0xff & ''}, {XK_s, 0xff & ''}, {XK_S, 0xff & ''}, {XK_d, 0xff & ''}, {XK_D, 0xff & ''}, {XK_h, 0xff & ''}, {XK_H, 0xff & ''}, {XK_l, 0xff & ''}, {XK_L, 0xff & ''}, {XK_z, 0xff & ''}, {XK_Z, 0xff & ''}, {XK_x, 0xff & ''}, {XK_X, 0xff & ''}, {XK_c, 0xff & ''}, {XK_C, 0xff & ''}, {XK_b, 0xff & ''}, {XK_B, 0xff & ''}, {XK_n, 0xff & ''}, {XK_N, 0xff & ''}, {0, } }; static struct remapKey keyboardSecond[] = { { XK_equal, 0xff & '' }, {XK_plus, 0xff & ''}, {XK_e, 0xff & ''}, {XK_E, 0xff & ''}, {XK_r, 0xff & ''}, {XK_R, 0xff & ''}, {XK_t, 0xff & ''}, {XK_T, 0xff & ''}, {XK_u, 0xff & ''}, {XK_U, 0xff & ''}, {XK_i, 0xff & ''}, {XK_I, 0xff & ''}, {XK_o, 0xff & ''}, {XK_O, 0xff & ''}, {XK_a, 0xff & ''}, {XK_A, 0xff & ''}, {XK_s, 0xff & ''}, {XK_S, 0xff & ''}, {XK_d, 0xff & ''}, {XK_D, 0xff & ''}, {XK_l, 0xff & ''}, {XK_L, 0xff & ''}, {XK_z, 0xff & ''}, {XK_Z, 0xff & ''}, {XK_x, 0xff & ''}, {XK_X, 0xff & ''}, {XK_c, 0xff & ''}, {XK_C, 0xff & ''}, {XK_n, 0xff & ''}, {XK_N, 0xff & ''}, {0, } }; static struct remapKey keyboardThird[] = { { XK_a, 0xff & '' }, {XK_A, 0xff & ''}, {XK_e, 0xff & ''}, {XK_E, 0xff & ''}, {XK_u, 0xff & ''}, {XK_U, 0xff & ''}, {XK_o, 0xff & ''}, {XK_O, 0xff & ''}, {XK_s, 0xff & ''}, {XK_S, 0xff & ''}, {XK_l, 0xff & ''}, {XK_L, 0xff & ''}, {XK_z, 0xff & ''}, {XK_Z, 0xff & ''}, {XK_c, 0xff & ''}, {XK_C, 0xff & ''}, {0, } }; static struct remapKey keyboardFourth[] = { { XK_a, 0xff & '' }, {XK_A, 0xff & ''}, {XK_e, 0xff & ''}, {XK_E, 0xff & ''}, {XK_u, 0xff & ''}, {XK_U, 0xff & ''}, {XK_o, 0xff & ''}, {XK_O, 0xff & ''}, {XK_l, 0xff & ''}, {XK_L, 0xff & ''}, {0, } }; static struct remapKey keyboardFifth[] = { { XK_a, 0xff & '' }, {XK_A, 0xff & ''}, {XK_o, 0xff & ''}, {XK_O, 0xff & ''}, {XK_l, 0xff & '|'}, {XK_L, 0xff & '|'}, {0, } }; #define KEYMAPS_MACRO \ {keyboardAcute, 0, 0}, /* 1 */ \ {keyboardCaron, 0, 0}, /* 2 */ \ {keyboardFirst, 0, 0}, /* 3 */ \ {keyboardSecond, 0, 0}, /* 4 */ \ {keyboardThird, 0, 0}, /* 5 */ \ {keyboardFourth, 0, 0}, /* 6 */ \ {keyboardFifth, 0, 0}, /* 7 */ #ifdef XK_dead_acute #define XKB_DEAD_KEYS \ {keyboardStd, XK_dead_acute, 1}, \ {keyboardStd, XK_dead_caron, 2}, \ {keyboardStd, XK_dead_iota, 3}, \ {keyboardStd, XK_dead_iota, 4}, \ {keyboardStd, XK_dead_iota, 5}, \ {keyboardStd, XK_dead_iota, 6}, \ {keyboardStd, XK_dead_iota, 7}, \ {keyboardStd, XK_dead_iota, 0}, #else #define XKB_DEAD_KEYS #endif #ifdef XK_F22 #define F22_DEAD_KEYS \ {keyboardStd, XK_F22, 3}, \ {keyboardStd, XK_F22, 4}, \ {keyboardStd, XK_F22, 5}, \ {keyboardStd, XK_F22, 6}, \ {keyboardStd, XK_F22, 7}, \ {keyboardStd, XK_F22, 0}, #else #define F22_DEAD_KEYS #endif #define KBD_MACRO \ {keyboardStd, XK_Print, 3}, \ {keyboardStd, XK_Print, 4}, \ {keyboardStd, XK_Print, 5}, \ {keyboardStd, XK_Print, 6}, \ {keyboardStd, XK_Print, 7}, \ {keyboardStd, XK_Print, 0}, \ XKB_DEAD_KEYS \ F22_DEAD_KEYS static struct keyboardRec kbdStdRec[] = { { keyboardStd, 0, 0 }, /* 0 */ KEYMAPS_MACRO KBD_MACRO {NULL, } }; static struct keyboardRec kbdHalfCzRec[] = { { keyboardHalfCz, 0, 0 }, /* 0 */ KEYMAPS_MACRO KBD_MACRO {NULL, } }; static struct keyboardRec kbdFullCzRec[] = { { keyboardFullCz, 0, 0 }, /* 0 */ KEYMAPS_MACRO {keyboardStd, XK_equal, 1}, {keyboardStd, XK_plus, 2}, KBD_MACRO {NULL, } }; /* * one standart keyboard and two national keyboards * (for programmers and for writers) */ static struct keyboardRec *nationalKey[] = { kbdStdRec, kbdHalfCzRec, kbdFullCzRec, 0 }; #endif efte-1.1/src/i_key.cpp0000664000076400007640000000226511041404761013720 0ustar laurilauri/* i_key.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" ExKey::ExKey(const char *APrompt): ExView() { if (APrompt) Prompt = strdup(APrompt); else Prompt = 0; } ExKey::~ExKey() { free(Prompt); } void ExKey::Activate(int gotfocus) { ExView::Activate(gotfocus); } int ExKey::BeginMacro() { return 1; } void ExKey::HandleEvent(TEvent &Event) { switch (Event.What) { case evKeyDown: Key = Event.Key.Code; if (!(Key & kfModifier)) // not ctrl,alt,shift, .... EndExec(1); Event.What = evNone; break; } } void ExKey::UpdateView() { if (Next) { Next->UpdateView(); } } void ExKey::RepaintView() { if (Next) { Next->RepaintView(); } } void ExKey::UpdateStatus() { RepaintStatus(); } void ExKey::RepaintStatus() { TDrawBuffer B; int W, H; ConQuerySize(&W, &H); MoveCh(B, ' ', 0x17, W); ConPutBox(0, H - 1, W, 1, B); } efte-1.1/src/e_search.cpp0000664000076400007640000011477711041434500014377 0ustar laurilauri/* e_search.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int ParseSearchOption(int replace, char c, unsigned long &opt) { switch (tolower(c)) { case 'a': opt |= SEARCH_ALL; break; // search all occurances case 'b': opt |= SEARCH_BLOCK; break; // search in block only case 'c': opt &= ~SEARCH_NEXT; break; // search from current position case 'd': opt |= SEARCH_DELETE; break; // delete found line case 'g': opt |= SEARCH_GLOBAL; break; // search globally case 'i': opt |= SEARCH_NCASE; break; // don't match case case 'j': opt |= SEARCH_JOIN; break; // join found line case 'r': opt |= SEARCH_BACK; break; // search reverse case 's': opt |= SEARCH_SPLIT; break; // split found line case 'w': opt |= SEARCH_WORDBEG | SEARCH_WORDEND; break; case '<': opt |= SEARCH_WORDBEG; break; case '>': opt |= SEARCH_WORDEND; break; case 'x': opt |= SEARCH_RE; break; // search using regexps default: if (!replace) return 0; switch (c) { case 'n': opt |= SEARCH_NASK; break; // don't ask before replacing default: return 0; } } return 1; } static int UnquoteString(char *str) { char *s, *d; s = str; d = str; while (*s) { if (*s == '\\') { s++; if (*s == 0) return 0; } *d++ = *s++; } *d = 0; return 1; } int ParseSearchOptions(int replace, const char *str, unsigned long &Options) { const char *p = str; Options = SEARCH_NEXT; while (*p) { if (ParseSearchOption(replace, *p, Options) == 0) return 0; p++; } return 1; } int ParseSearchReplace(EBuffer *B, const char *str, int replace, SearchReplaceOptions &opt) { int where = 0; int len = 0; const char *p = str; memset((void *)&opt, 0, sizeof(opt)); if (p == 0) return 0; if (replace) { if (ParseSearchOptions(replace, BFS(B, BFS_DefFindReplaceOpt), opt.Options) == 0) return 0; opt.Options |= SEARCH_REPLACE; } else { if (ParseSearchOptions(replace, BFS(B, BFS_DefFindOpt), opt.Options) == 0) return 0; } while (*p) { switch (*p) { case '\\': if (where == 0) { opt.strSearch[len++] = *p++; if (*p == 0) return 0; opt.strSearch[len++] = *p++; } else if (where == 1) { opt.strReplace[len++] = *p++; if (*p == 0) return 0; opt.strReplace[len++] = *p++; } else return 0; break; case '/': where++; if (!replace && where == 1) where++; if (where == 2) opt.Options = SEARCH_NEXT; if (where > 2) return 0; len = 0; p++; break; default: if (where == 0) opt.strSearch[len++] = *p++; else if (where == 1) opt.strReplace[len++] = *p++; else { char c = *p; p++; if (ParseSearchOption(replace, c, opt.Options) == 0) return 0; } } } if (opt.Options & SEARCH_RE); else { if (UnquoteString(opt.strSearch) == 0) return 0; if (opt.Options & SEARCH_REPLACE) if (UnquoteString(opt.strReplace) == 0) return 0; } opt.ok = 1; return 1; } int EBuffer::FindStr(char *Data, int Len, int Options) { SearchReplaceOptions opt; memset(&opt, 0, sizeof(opt)); opt.Options = Options; return FindStr(Data, Len, opt); } int EBuffer::FindStr(char *Data, int Len, SearchReplaceOptions &opt) { int Options = opt.Options; int LLen, Start, End; int C, L; PELine X; char *P; if (Options & SEARCH_RE) return 0; if (Len <= 0) return 0; if (Options & SEARCH_NOPOS) { C = Match.Col; L = Match.Row; } else { C = CP.Col; L = VToR(CP.Row); } if (Match.Row != -1) Draw(Match.Row, Match.Row); Match.Row = -1; Match.Col = -1; X = RLine(L); C = CharOffset(X, C); if (Options & SEARCH_NEXT) { int CC = MatchCount ? 1 : 0; if (Options & SEARCH_BACK) { C -= CC; if (C < 0) { if (L == 0) return 0; L--; X = RLine(L); C = X->Count; } } else { if (Options & SEARCH_REPLACE && opt.lastInsertLen > 0) { C += CC * opt.lastInsertLen; // 0 or opt.lastInsertLen } else { C += CC; } if (C >= X->Count) { C = 0; L++; if (L == RCount) return 0; } } } MatchLen = 0; MatchCount = 0; if (Options & SEARCH_BLOCK) { if (Options & SEARCH_BACK) { if (BlockMode == bmStream) { if (L > BE.Row) { L = BE.Row; C = BE.Col; } if (L == BE.Row && C > BE.Col) C = BE.Col; } else { if (L >= BE.Row && BE.Row > 0) { L = BE.Row - 1; C = RLine(L)->Count; } if (BlockMode == bmColumn) if (L == BE.Row - 1 && C >= BE.Col) C = BE.Col; } } else { if (L < BB.Row) { L = BB.Row; C = 0; } if (L == BB.Row && C < BB.Col) C = BB.Col; } } while (1) { if (Options & SEARCH_BLOCK) { if (BlockMode == bmStream) { if (L > BE.Row || L < BB.Row) break; } else if (L >= BE.Row || L < BB.Row) break; } else if (L >= RCount || L < 0) break; X = RLine(L); LLen = X->Count; P = X->Chars; Start = 0; End = LLen; if (Options & SEARCH_BLOCK) { if (BlockMode == bmColumn) { Start = CharOffset(X, BB.Col); End = CharOffset(X, BE.Col); } else if (BlockMode == bmStream) { if (L == BB.Row) Start = CharOffset(X, BB.Col); if (L == BE.Row) End = CharOffset(X, BE.Col); } } if (Options & SEARCH_BACK) { if (C >= End - Len) C = End - Len; } else { if (C < Start) C = Start; } while (((!(Options & SEARCH_BACK)) && (C <= End - Len)) || ((Options & SEARCH_BACK) && (C >= Start))) { if ((!(Options & SEARCH_WORDBEG) || (C == 0) || (WGETBIT(Flags.WordChars, P[C - 1]) == 0)) && (!(Options & SEARCH_WORDEND) || (C + Len >= End) || (WGETBIT(Flags.WordChars, P[C + Len]) == 0)) && ((!(Options & SEARCH_NCASE) && (P[C] == Data[0]) && (memcmp(P + C, Data, Len) == 0)) || ((Options & SEARCH_NCASE) && (toupper(P[C]) == toupper(Data[0])) && (strnicmp(P + C, Data, Len) == 0))) /* && BOL | EOL */ ) { Match.Col = ScreenPos(X, C); Match.Row = L; MatchCount = Len; MatchLen = ScreenPos(X, C + Len) - Match.Col; if (!(Options & SEARCH_NOPOS)) { if (Options & SEARCH_CENTER) CenterPosR(Match.Col, Match.Row); else SetPosR(Match.Col, Match.Row); } Draw(L, L); return 1; } if (Options & SEARCH_BACK) C--; else C++; } if (Options & SEARCH_BACK) { L--; if (L >= 0) C = RLine(L)->Count; } else { C = 0; L++; } } //SetPos(OC, OL); return 0; } int EBuffer::FindRx(RxNode *Rx, SearchReplaceOptions &opt) { int Options = opt.Options; int LLen, Start, End; int C, L; char *P; PELine X; RxMatchRes b; if (!(Options & SEARCH_RE)) return 0; if (Options & SEARCH_BACK) { // not supported View->MView->Win->Choice(GPC_ERROR, "FindRx", 1, "O&K", "Reverse regexp search not supported."); return 0; } if (Rx == 0) return 0; if (Match.Row != -1) Draw(Match.Row, Match.Row); Match.Row = -1; Match.Col = -1; C = CP.Col; L = VToR(CP.Row); X = RLine(L); C = CharOffset(X, C); if (Options & SEARCH_NEXT) { int CC = MatchCount ? MatchCount : 1; if (Options & SEARCH_BACK) { C -= CC; if (Options & SEARCH_BLOCK) { if (C < BB.Col && L == BB.Row) return 0; L--; X = RLine(L); C = X->Count; if (BlockMode == bmColumn) if (BE.Col < C) C = BE.Col; } else { if (C < 0 && L == 0) return 0; L--; X = RLine(L); C = X->Count; } } else { C += CC; if (Options & SEARCH_BLOCK) { if (BlockMode == bmStream || BlockMode == bmLine) { if (C >= X->Count) { C = 0; L++; if (BlockMode == bmLine) { if (L == BE.Row) return 0; } else if (L == BE.Row && (C >= BE.Col || C >= X->Count)) return 0; } } else if (BlockMode == bmColumn) { if (C >= X->Count || C >= BE.Col) { C = BB.Col; L++; if (L == BE.Row) return 0; } } } else { if (C >= X->Count) { C = 0; L++; if (L == RCount) return 0; } } } } MatchLen = 0; MatchCount = 0; if (Options & SEARCH_BLOCK) { if (Options & SEARCH_BACK) { if (BlockMode == bmStream) { if (L > BE.Row) { L = BE.Row; C = BE.Col; } if (L == BE.Row && C > BE.Col) C = BE.Col; } else { if (L >= BE.Row && BE.Row > 0) { L = BE.Row - 1; C = RLine(L)->Count; } if (BlockMode == bmColumn) if (L == BE.Row - 1 && C >= BE.Col) C = BE.Col; } } else { if (L < BB.Row) { L = BB.Row; C = 0; } if (L == BB.Row && C < BB.Col) C = BB.Col; } } while (1) { if (Options & SEARCH_BLOCK) { if (BlockMode == bmStream) { if (L > BE.Row || L < BB.Row) break; } else if (L >= BE.Row || L < BB.Row) break; } else if (L >= RCount || L < 0) break; X = RLine(L); LLen = X->Count; P = X->Chars; Start = 0; End = LLen; if (Options & SEARCH_BLOCK) { if (BlockMode == bmColumn) { Start = CharOffset(X, BB.Col); End = CharOffset(X, BE.Col); } else if (BlockMode == bmStream) { if (L == BB.Row) Start = CharOffset(X, BB.Col); if (L == BE.Row) End = CharOffset(X, BE.Col); } if (End > LLen) End = LLen; } if (Options & SEARCH_BACK) { if (C >= End) C = End; } else { if (C < Start) C = Start; } if (Start <= End) { if (RxExec(Rx, P + Start, End - Start, P + C, &b, (Options & SEARCH_NCASE) ? 0 : RX_CASE) == 1) { C = ScreenPos(X, b.Open[0] + Start); Match.Col = C; Match.Row = L; MatchCount = b.Close[0] - b.Open[0]; MatchLen = ScreenPos(X, b.Close[0] + Start) - C; for (int mm = 0; mm < NSEXPS; mm++) { b.Open[mm] += Start; b.Close[mm] += Start; } MatchRes = b; if (!(Options & SEARCH_NOPOS)) { if (Options & SEARCH_CENTER) CenterPosR(C, L); else SetPosR(C, L); } Draw(L, L); return 1; } } C = 0; L++; } //SetPos(OC, OL); return 0; } int EBuffer::Find(SearchReplaceOptions &opt) { int slen = strlen(opt.strSearch); int Options = opt.Options; int rlen = strlen(opt.strReplace); RxNode *R = NULL; opt.resCount = -1; opt.lastInsertLen = 0; if (slen == 0) return 0; if (Options & SEARCH_BLOCK) { if (CheckBlock() == 0) return 0; } if (Options & SEARCH_RE) { R = RxCompile(opt.strSearch); if (R == 0) { View->MView->Win->Choice(GPC_ERROR, "Find", 1, "O&K", "Invalid regular expression."); return 0; } } if (Options & SEARCH_GLOBAL) { if (Options & SEARCH_BLOCK) { if (Options & SEARCH_BACK) { if (SetPosR(BE.Col, BE.Row) == 0) goto error; } else { if (SetPosR(BB.Col, BB.Row) == 0) goto error; } } else { if (Options & SEARCH_BACK) { if (RCount < 1) goto error; if (SetPosR(LineLen(RCount - 1), RCount - 1) == 0) goto error; } else { if (SetPosR(0, 0) == 0) goto error; } } } opt.resCount = 0; while (1) { if (Options & SEARCH_RE) { if (FindRx(R, opt) == 0) goto end; } else { if (FindStr(opt.strSearch, slen, opt) == 0) goto end; } opt.resCount++; if (opt.Options & SEARCH_REPLACE) { char ask = 'A'; if (!(Options & SEARCH_NASK)) { char ch; while (1) { Draw(VToR(CP.Row), 1); Redraw(); switch (View->MView->Win->Choice(0, "Replace", 5, "&Yes", "&All", "&Once", "&Skip", "&Cancel", "Replace with %s?", opt.strReplace)) { case 0: ch = 'Y'; break; case 1: ch = 'A'; break; case 2: ch = 'O'; break; case 3: ch = 'N'; break; case 4: case -1: default: ch = 'Q'; break; } if (ch == 'Y') { ask = 'Y'; goto ok_rep; } if (ch == 'N') { ask = 'N'; goto ok_rep; } if (ch == 'Q') { ask = 'Q'; goto ok_rep; } if (ch == 'A') { ask = 'A'; goto ok_rep; } if (ch == 'O') { ask = 'O'; goto ok_rep; } } ok_rep: if (ask == 'N') goto try_join; if (ask == 'Q') goto end; if (ask == 'A') Options |= SEARCH_NASK; } if (Options & SEARCH_RE) { PELine L = RLine(Match.Row); int P, R; char *PR = 0; int LR = 0; R = Match.Row; P = Match.Col; P = CharOffset(L, P); if (0 == RxReplace(opt.strReplace, L->Chars, L->Count, MatchRes, &PR, &LR)) { if (DelText(R, Match.Col, MatchLen) == 0) goto error; if (PR && LR > 0) if (InsText(R, Match.Col, LR, PR) == 0) goto error; if (PR) free(PR); rlen = LR; } } else { if (DelText(Match.Row, Match.Col, MatchLen) == 0) goto error; if (InsText(Match.Row, Match.Col, rlen, opt.strReplace) == 0) goto error; // Cursor remains at start of inserted string. If there is recursive // replace pattern, fte can go it infinite loop. // Workaround: Move cursor to end of inserted string opt.lastInsertLen = strlen(opt.strReplace); } if (!(Options & SEARCH_BACK)) { MatchLen = rlen; MatchCount = rlen; } if (ask == 'O') goto end; } try_join: if (Options & SEARCH_JOIN) { char ask = 'A'; if (!(Options & SEARCH_NASK)) { char ch; while (1) { Draw(VToR(CP.Row), 1); Redraw(); switch (View->MView->Win->Choice(0, "Join Line", 5, "&Yes", "&All", "&Once", "&Skip", "&Cancel", "Join lines %d and %d?", 1 + VToR(CP.Row), 1 + VToR(CP.Row) + 1)) { case 0: ch = 'Y'; break; case 1: ch = 'A'; break; case 2: ch = 'O'; break; case 3: ch = 'N'; break; case 4: case -1: default: ch = 'Q'; break; } if (ch == 'Y') { ask = 'Y'; goto ok_join; } if (ch == 'N') { ask = 'N'; goto ok_join; } if (ch == 'Q') { ask = 'Q'; goto ok_join; } if (ch == 'A') { ask = 'A'; goto ok_join; } if (ch == 'O') { ask = 'O'; goto ok_join; } } ok_join: if (ask == 'N') goto try_split; if (ask == 'Q') goto end; if (ask == 'A') Options |= SEARCH_NASK; } if (JoinLine(Match.Row, Match.Col) == 0) goto error; if (ask == 'O') goto end; } try_split: if (Options & SEARCH_SPLIT) { char ask = 'A'; if (!(Options & SEARCH_NASK)) { char ch; while (1) { Draw(VToR(CP.Row), 1); Redraw(); switch(View->MView->Win->Choice(0, "Split Line", 5, "&Yes", "&All", "&Once", "&Skip", "&Cancel", "Split line %d?", VToR(CP.Row))) { case 0: ch = 'Y'; break; case 1: ch = 'A'; break; case 2: ch = 'O'; break; case 3: ch = 'S'; break; case 4: case -1: default: ch = 'Q'; break; } if (ch == 'Y') { ask = 'Y'; goto ok_split; } else if (ch == 'N') { ask = 'N'; goto ok_split; } else if (ch == 'Q') { ask = 'Q'; goto ok_split; } else if (ch == 'A') { ask = 'A'; goto ok_split; } else if (ch == 'O') { ask = 'O'; goto ok_split; } } ok_split: if (ask == 'N') goto try_delete; if (ask == 'Q') goto end; if (ask == 'A') Options |= SEARCH_NASK; } if (SplitLine(Match.Row, Match.Col + strlen(opt.strReplace)) == 0) goto error; if (ask == 'O') goto end; } try_delete: if (Options & SEARCH_DELETE) { char ask = 'A'; if (!(Options & SEARCH_NASK)) { char ch; while (1) { Draw(VToR(CP.Row), 1); Redraw(); switch (View->MView->Win->Choice(0, "Delete Line", 5, "&Yes", "&All", "&Once", "&Skip", "&Cancel", "Delete line %d?", VToR(CP.Row))) { case 0: ch = 'Y'; break; case 1: ch = 'A'; break; case 2: ch = 'O'; break; case 3: ch = 'N'; break; case 4: case -1: default: ch = 'Q'; break; } if (ch == 'Y') { ask = 'Y'; goto ok_delete; } if (ch == 'N') { ask = 'N'; goto ok_delete; } if (ch == 'Q') { ask = 'Q'; goto ok_delete; } if (ch == 'A') { ask = 'A'; goto ok_delete; } if (ch == 'O') { ask = 'O'; goto ok_delete; } } ok_delete: if (ask == 'N') goto next; if (ask == 'Q') goto end; if (ask == 'A') Options |= SEARCH_NASK; } if (Match.Row == RCount - 1) { if (DelText(Match.Row, 0, LineLen()) == 0) goto error; } else if (DelLine(Match.Row) == 0) goto error; if (ask == 'O') goto end; if (!(Options & SEARCH_ALL)) break; goto last; } next: if (!(Options & SEARCH_ALL)) break; Options |= SEARCH_NEXT; last: ; } end: // end of search if (R) RxFree(R); if (Options & SEARCH_ALL) Msg(S_INFO, "%d match(es) found.", opt.resCount); else { if (opt.resCount == 0) { Msg(S_INFO, "[%s] not found", opt.strSearch); return 0; } } return 1; error: if (R) { RxFree(R); } View->MView->Win->Choice(GPC_ERROR, "Find", 1, "O&K", "Error in search/replace."); return 0; } int EBuffer::CompleteWord() { return View->MView->Win->ICompleteWord(View); } int EBuffer::Search(ExState &State, char *aString, int Options, int /*CanResume*/) { char find[MAXSEARCH+1] = ""; int Case = BFI(this, BFI_MatchCase) ? 0 : SEARCH_NCASE; int Next = 0; int erc = 0; //int Changed; if (aString) strcpy(find, aString); else if (State.GetStrParam(View, find, sizeof(find)) == 0) if ((erc = View->MView->Win->GetStr("Find", sizeof(find), find, HIST_SEARCH)) == 0) return 0; if (strlen(find) == 0) return 0; if (erc == 2) Case ^= SEARCH_NCASE; //if (Changed == 0 && CanResume) // Next |= SEARCH_NEXT; LSearch.ok = 0; strcpy(LSearch.strSearch, find); LSearch.Options = Case | Next | (Options & ~SEARCH_NCASE); LSearch.ok = 1; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::SearchAgain(ExState &/*State*/, unsigned int Options) { if (LSearch.ok == 0) return 0; LSearch.Options |= SEARCH_NEXT; if ((Options & SEARCH_BACK) != (LSearch.Options & SEARCH_BACK)) LSearch.Options ^= SEARCH_BACK; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::SearchReplace(ExState &State, char *aString, char *aReplaceString, int Options) { char find[MAXSEARCH+1] = ""; char replace[MAXSEARCH+1] = ""; int Case = BFI(this, BFI_MatchCase) ? 0 : SEARCH_NCASE; if (aString) strcpy(find, aString); else if (State.GetStrParam(View, find, sizeof(find)) == 0) if (View->MView->Win->GetStr("Find", sizeof(find), find, HIST_SEARCH) == 0) return 0; if (strlen(find) == 0) return 0; if (aReplaceString) strcpy(replace, aReplaceString); else if (State.GetStrParam(View, replace, sizeof(replace)) == 0) if (View->MView->Win->GetStr("Replace", sizeof(replace), replace, HIST_SEARCH) == 0) return 0; LSearch.ok = 0; strcpy(LSearch.strSearch, find); strcpy(LSearch.strReplace, replace); LSearch.Options = Case | (Options & ~SEARCH_NCASE) | SEARCH_ALL | SEARCH_REPLACE; LSearch.ok = 1; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::Search(ExState &State) { return Search(State, 0, 0, 1); } int EBuffer::SearchB(ExState &State) { return Search(State, 0, SEARCH_BACK, 1); } int EBuffer::SearchRx(ExState &State) { return Search(State, 0, SEARCH_RE, 1); } int EBuffer::SearchAgain(ExState &State) { return SearchAgain(State, 0); } int EBuffer::SearchAgainB(ExState &State) { return SearchAgain(State, SEARCH_BACK); } int EBuffer::SearchReplace(ExState &State) { return SearchReplace(State, 0, 0, 0); } int EBuffer::SearchReplaceB(ExState &State) { return SearchReplace(State, 0, 0, SEARCH_BACK); } int EBuffer::SearchReplaceRx(ExState &State) { return SearchReplace(State, 0, 0, SEARCH_RE); } int EBuffer::ScanForRoutines() { RxNode *regx; int line; PELine L; RxMatchRes res; if (BFS(this, BFS_RoutineRegexp) == 0) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "No routine regexp."); return 0; } regx = RxCompile(BFS(this, BFS_RoutineRegexp)); if (regx == 0) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Failed to compile regexp '%s'", BFS(this, BFS_RoutineRegexp)); return 0; } if (rlst.Lines) { free(rlst.Lines); rlst.Lines = 0; } rlst.Lines = 0; rlst.Count = 0; Msg(S_BUSY, "Matching %s", BFS(this, BFS_RoutineRegexp)); for (line = 0; line < RCount; line++) { L = RLine(line); if (RxExec(regx, L->Chars, L->Count, L->Chars, &res) == 1) { rlst.Count++; rlst.Lines = (int *) realloc((void *) rlst.Lines, sizeof(int) * (rlst.Count | 0x1F)); rlst.Lines[rlst.Count - 1] = line; Msg(S_BUSY, "Routines: %d", rlst.Count); } } RxFree(regx); return 1; } int EBuffer::ShowPosition() { int CLine, NLines; int CAct, NAct; int CColumn, NColumns; int CCharPos, NChars; #ifdef HEAPWALK unsigned long MemUsed = 0, MemFree = 0, BlkUsed = 0, BlkFree = 0, BigFree = 0, BigUsed = 0; #endif if (!View) return 0; CLine = CP.Row + 1; NLines = VCount; CAct = VToR(CP.Row) + 1; NAct = RCount; CColumn = CP.Col + 1; NColumns = LineLen(CP.Row); CCharPos = CharOffset(VLine(CP.Row), CP.Col) + 1; NChars = VLine(CP.Row)->Count; #ifdef HEAPWALK if (_heapchk() != _HEAPOK) { MemUsed = -1; } else { _HEAPINFO hi; hi._pentry = NULL; while (_heapwalk(&hi) == _HEAPOK) { if (hi._useflag == _USEDENTRY) { BlkUsed++; MemUsed += hi._size; if (hi._size > BigUsed) BigUsed = hi._size; //fprintf(stderr, "USED %d\n", hi._size); } else { BlkFree++; MemFree += hi._size; if (hi._size > BigFree) BigFree = hi._size; //fprintf(stderr, "FREE %d\n", hi._size); } } } #endif int NN = -1; if (US.UndoPtr > 0) NN = US.Top[US.UndoPtr - 1]; Msg(S_INFO, #ifdef HEAPWALK "M%ld,%ld B%ld,%ld S%ld,%ld" #endif "L%d/%d G%d/%d/%d A%d/%d C%d/%d P%d/%d " "U%d/%d/%d " "H%d/%d/%d", #ifdef HEAPWALK MemUsed, MemFree, BlkUsed, BlkFree, BigUsed, BigFree, #endif CLine, NLines, RGap, RCount, RAllocated, CAct, NAct, CColumn, NColumns, CCharPos, NChars, US.UndoPtr, US.Num, NN, StartHilit, MinRedraw, MaxRedraw); return 1; } int EBuffer::PlaceBookmark(char *Name, EPoint P) { int i; EBookmark *p; assert(P.Row >= 0 && P.Row < RCount && P.Col >= 0); for (i = 0; i < BMCount; i++) { if (strcmp(Name, BMarks[i].Name) == 0) { BMarks[i].BM = P; return 1; } } p = (EBookmark *) realloc(BMarks, sizeof(EBookmark) * (1 + BMCount)); if (p == 0) return 0; BMarks = p; BMarks[BMCount].Name = strdup(Name); BMarks[BMCount].BM = P; BMCount++; return 1; } int EBuffer::RemoveBookmark(char *Name) { int i; for (i = 0; i < BMCount; i++) { if (strcmp(Name, BMarks[i].Name) == 0) { free(BMarks[i].Name); memmove(BMarks + i, BMarks + i + 1, sizeof(EBookmark) * (BMCount - i - 1)); BMCount--; BMarks = (EBookmark *) realloc(BMarks, sizeof(EBookmark) * BMCount); return 1; } } View->MView->Win->Choice(GPC_ERROR, "RemoveBookmark", 1, "O&K", "Bookmark %s not found.", Name); return 0; } int EBuffer::GetBookmark(char *Name, EPoint &P) { for (int i = 0; i < BMCount; i++) if (strcmp(Name, BMarks[i].Name) == 0) { P = BMarks[i].BM; return 1; } return 0; } /* * Searches bookmark list starting at given index (searchFrom) for next * bookmark for line searchForLine. It then returns its name and position * and index (used for next search) or -1 if none found. Name is pointer * directly into bookmark structure (not copied!). If searchForLine is -1, * this function returns any next bookmark -> can be used to enumerate * bookmarks. */ int EBuffer::GetBookmarkForLine(int searchFrom, int searchForLine, char *&Name, EPoint &P) { for (int i = searchFrom; i < BMCount; i++) if (searchForLine == -1 || BMarks[i].BM.Row == searchForLine) { Name = BMarks[i].Name; P = BMarks[i].BM; return i + 1; } return -1; } int EBuffer::GotoBookmark(char *Name) { for (int i = 0; i < BMCount; i++) if (strcmp(Name, BMarks[i].Name) == 0) { return CenterNearPosR(BMarks[i].BM.Col, BMarks[i].BM.Row); } View->MView->Win->Choice(GPC_ERROR, "GotoBookmark", 1, "O&K", "Bookmark %s not found.", Name); return 0; } int EBuffer::GetMatchBrace(EPoint &M, int MinLine, int MaxLine, int show) { int StateLen; hsState *StateMap = 0; int Pos; PELine L = VLine(M.Row); int dir = 0; hsState State; char Ch1, Ch2; int CountX = 0; int StateRow = -1; M.Row = VToR(CP.Row); Pos = CharOffset(L, M.Col); if (Pos >= L->Count) return 0; switch (L->Chars[Pos]) { case '{': dir = + 1; Ch1 = '{'; Ch2 = '}'; break; case '[': dir = + 1; Ch1 = '['; Ch2 = ']'; break; case '<': dir = + 1; Ch1 = '<'; Ch2 = '>'; break; case '(': dir = + 1; Ch1 = '('; Ch2 = ')'; break; case '}': dir = -1; Ch1 = '}'; Ch2 = '{'; break; case ']': dir = -1; Ch1 = ']'; Ch2 = '['; break; case '>': dir = -1; Ch1 = '>'; Ch2 = '<'; break; case ')': dir = -1; Ch1 = ')'; Ch2 = '('; break; default: return 0; } StateMap = 0; if (GetMap(M.Row, &StateLen, &StateMap) == 0) return 0; State = StateMap[Pos]; StateRow = M.Row; while (M.Row >= MinLine && M.Row < MaxLine) { while (Pos >= 0 && Pos < L->Count) { if (L->Chars[Pos] == Ch1 || L->Chars[Pos] == Ch2) { // update syntax state if needed if (StateRow != M.Row) { free(StateMap); StateMap = 0; GetMap(M.Row, &StateLen, &StateMap); if (StateMap == 0) return 0; StateRow = M.Row; } if (StateMap[Pos] == State) { if (L->Chars[Pos] == Ch1) CountX++; if (L->Chars[Pos] == Ch2) CountX--; if (CountX == 0) { M.Col = ScreenPos(L, Pos); free(StateMap); return 1; } } } Pos += dir; } M.Row += dir; if (M.Row >= 0 && M.Row < RCount) { L = RLine(M.Row); Pos = (dir == 1) ? 0 : (L->Count - 1); } } if (StateMap) free(StateMap); if (show) Msg(S_INFO, "No match (%d missing).", CountX); return 0; } int EBuffer::MatchBracket() { EPoint M = CP; if (GetMatchBrace(M, 0, RCount, 1) == 1) return SetPosR(M.Col, M.Row); return 0; } int EBuffer::HilitMatchBracket() { EPoint M = CP; if (View == 0) return 0; int Min = VToR(GetVPort()->TP.Row); int Max = GetVPort()->TP.Row + GetVPort()->Rows; if (Max >= VCount) Max = RCount; else Max = VToR(Max); if (Min < 0) Min = 0; if (Max < Min) return 0; if (GetMatchBrace(M, Min, Max, 0) == 1) { Match = M; MatchLen = 1; MatchCount = 1; Draw(Match.Row, Match.Row); return 1; } return 0; } int EBuffer::SearchWord(int SearchFlags) { char word[MAXSEARCH + 1]; PELine L = VLine(CP.Row); int P, len = 0; int Case = BFI(this, BFI_MatchCase) ? 0 : SEARCH_NCASE; P = CharOffset(L, CP.Col); while ((P > 0) && ((ChClass(L->Chars[P - 1]) == 1) || (L->Chars[P - 1] == '_'))) P--; while (len < int(sizeof(word)) && P < L->Count && (ChClass(L->Chars[P]) == 1 || L->Chars[P] == '_')) word[len++] = L->Chars[P++]; word[len] = 0; if (len == 0) return 0; return FindStr(word, len, Case | SearchFlags | SEARCH_WORD); } int EBuffer::FindTagWord(ExState &State) { char word[MAXSEARCH + 1]; PELine L = VLine(CP.Row); int P, len = 0; P = CharOffset(L, CP.Col); while ((P > 0) && ((ChClass(L->Chars[P - 1]) == 1) || (L->Chars[P - 1] == '_'))) P--; while (len < int(sizeof(word)) && P < L->Count && (ChClass(L->Chars[P]) == 1 || L->Chars[P] == '_')) word[len++] = L->Chars[P++]; word[len] = 0; if (len == 0) { Msg(S_INFO, "No word at cursor."); return 0; } int j = 2; while (j--) { int i; i = TagFind(this, View, word); if (i > 0) return 1; else if (j && (i < 0)) { /* Try autoload tags */ if (View->ExecCommand(ExTagLoad, State) == 0) break; } else { Msg(S_INFO, "Tag '%s' not found.", word); break; } } return 0; } efte-1.1/src/Makefile0000664000076400007640000001435511146600477013567 0ustar laurilauri# Makefile # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # UNAME=$(shell uname -s) ifndef $(TARGETS) TARGETS=efte nefte ifeq ($(UNAME),Linux) TARGETS := $(TARGETS) vefte endif endif # ============================================================================= # # System Options # # ============================================================================= # NOTE: Unix does not have stricmp, however, in sysdeps.h it is mapped to # strcasecmp which unix does have., thus stricmp is a valid function name ifndef $(X11_PATH) X11_PATH=/usr/X11R6 endif ifndef $(PREFIX) PREFIX=/usr/local endif DEFINES=-DUNIX -DHAVE_STRICMP CXXFLAGS=$(DEBUG) -Wall -Wno-long-long -pedantic -I$(X11_PATH)/include SYSTEM_LIBS= BASE_LIBS=-lstdc++ EFTE_LIBS=-L$(X11_PATH)/lib -lX11 -lXpm NEFTE_LIBS= VEFTE_LIBS= # System specific flags ifeq ($(UNAME),Linux) DEFINES := $(DEFINES) -DLINUX ifndef $(USE_GPM) USE_GPM=1 endif endif ifeq ($(UNAME),Darwin) DEFINES += -DDARWIN endif ifeq ($(UNAME),"HP/UX") DEFINES += -DHPUX -D_HPUX_SOURCE -DCASE_FD_SET_INT endif ifeq ($(UNAME),AIX) DEFINES += -DAIX -D_BSD_INCLUDES -DNO_NEW_CPP_FEATURES endif ifeq ($(UNAME),Irix) DEFINES += -DIRIX -DNO_NEW_CPP_FEATURES CXXFLAGS += -OPT:Olimit=3000 # -xc++ endif ifeq ($(UNAME),SunOS) DEFINES += -DSUNOS -DNO_NEW_CPP_FEATURES endif ifeq ($(UNAME),SCO) DEFINES += -DSCO CXXFLAGS += -b elf SYSTEM_LIBS += -lsocket endif ifeq ($(UNAME),NCR) DEFINES += -DNCR CXXFLAGS += -w3 SYSTEM_LIBS += -lsocket -lnsl -lc -lucb endif # Defaults ifneq ($(USE_LOCALE),0) DEFINES += -DUSE_LOCALE endif ifneq ($(USE_LOGGING),0) DEFINES += -DUSE_LOGGING endif ifneq ($(USE_XMB),0) DEFINES += -DUSE_XMB endif ifneq ($(USE_XICON),0) DEFINES += -DUSE_XICON endif # Optionals ifeq ($(USE_XLOCALE),1) DEFINES += -DUSE_XLOCALE endif ifeq ($(USE_XTINIT),1) DEFINES += -DUSE_XTINIT endif ifeq ($(USE_HARD_REMAP),1) DEFINES += -DUSE_HARD_REMAP endif ifeq ($(USE_GPM),1) DEFINES += -DUSE_GPM NEFTE_LIBS += -lgpm VEFTE_LIBS += -lgpm endif ifdef $(CURSES) NEFTE_LIBS += -l$(CURSES) else NEFTE_LIBS += -lncurses endif # # Compiler Setup # OEXT=o include objs.inc CXXFLAGS += $(DEFINES) CXXFLAGS += -g CXXFLAGS += -fomit-frame-pointer #CXXFLAGS += -fsched2-use-traces # ============================================================================= # # Targets # # ============================================================================= all: bin2c defcfg.h $(TARGETS) include .depend.mak nefte-setup: @echo "nefte :" $(NEFTE_LIBS) vefte-setup: @echo "vefte :" $(VEFTE_LIBS) efte-setup: @echo "efte :" $(EFTE_LIBS) basesetup: @echo "System name :" $(UNAME) @echo "Targets :" $(TARGETS) @echo "Compiler :" $(CXX) @echo "CXX Flag :" $(CXXFLAGS) @echo "System Libs :" $(SYSTEM_LIBS) setup: basesetup $(TARGETS:=-setup) clean: rm -f *.o .depend.mak cleanall: rm -f efte nefte vefte bin2c defcfg.h config.h .depend.mak help: @echo "" @echo "A simple ''make'' in most situations will work. This makefile, However," @echo "has been setup to enable you to turn many options on and off by command" @echo "line switches." @echo @echo "To use a switch: make SWITCH=VALUE" @echo @echo "Switches:" @echo " USE_GPM=0/1 Enable console mouse support via GPM" @echo " USE_LOCALE=0/1 Use normal locale support" @echo " USE_XLOCALE=0/1 Use X11 compiled in locale support" @echo " USE_XICON=0/1 Use libxicon to supply icons for the X version" @echo " USE_XTINIT=0/1 Use XtInitialize on init" @echo " USE_XMB=0/1 Use libxmb to draw fonts with locale support" @echo " USE_LOGGING=0/1 Enable trace logging within eFTE" @echo " USE_HARD_REMAP=0/1 Keyboard remapping by eFTE" @echo " CURSES=libname Specify an alternate curses library" @echo " X11_PATH=basepath Specify location of X11 installation" @echo @echo "Defaults:" @echo " Enabled : USE_LOCALE, USE_LOGGING, USE_XMB, USE_XICON" @echo " Disabled : USE_XLOCALE, USE_XTINIT, USE_HARD_REMAP" @echo " Curses : ncurses" @echo " X11 Path : /usr/X11R6" @echo @echo "Smart defaults:" @echo " Linux : USE_GPM=1" @echo " Non-Linux : USE_GPM=0" @echo @echo "Notes:" @echo " If for your system, you find that you have to change the defaults" @echo " in order to compile (not just for personal preference), please" @echo " help us make eFTE that much better for all and submit a bug" @echo " report to: http://sourceforge.net/projects/efte" @echo @echo "Individual target names:" @echo " help - Display this help message" @echo " setup - Display the setup that will be used to build" @echo " all - Build all binaries known to work on $(UNAME)" @echo " efte - Build the X11 version" @echo " nefte - Curses/NCurses version" @echo " vefte - Linux virtual console version" @echo " clean - Clean temporary build files" @echo " cleanall - Clean everything including built binaries" @echo " install - Install eFTE" @echo " uninstall - Uninstall eFTE" @echo bin2c: bin2c.cpp $(CXX) $(DEFINES) -o $@ $< defcfg.h: bin2c simple.fte ./bin2c simple.fte > defcfg.h config.h: sed s%\$$\{CMAKE_INSTALL_PREFIX\}%$(PREFIX)%g < config.h.in > config.h install: $(TARGETS) install -d $(DESTDIR)$(PREFIX)/bin install -m 755 $(TARGETS) $(DESTDIR)$(PREFIX)/bin install -d $(DESTDIR)$(PREFIX)/share/doc install -d $(DESTDIR)$(PREFIX)/share/doc/efte install -m 644 ../README ../COPYING ../Artistic ../HISTORY ../AUTHORS $(DESTDIR)$(PREFIX)/share/doc/efte install -d $(DESTDIR)$(PREFIX)/share/efte install -d $(DESTDIR)$(PREFIX)/share/efte/config cp -a ../config/* $(DESTDIR)$(PREFIX)/share/efte/config efte: config.h defcfg.h $(OBJS) $(XOBJS) $(CXX) -o efte $(OBJS) $(XOBJS) $(EFTE_LIBS) nefte: config.h defcfg.h $(OBJS) $(NOBJS) $(CXX) -o nefte $(OBJS) $(NOBJS) $(NEFTE_LIBS) vefte: config.h defcfg.h $(OBJS) $(VOBJS) $(CXX) -o vefte $(OBJS) $(VOBJS) $(VEFTE_LIBS) .cpp.$(OEXT): $(CXX) $(CXXFLAGS) -o $@ -c $< .depend.mak: Makefile which g++ 2>/dev/null >/dev/null && for f in $(addsuffix .cpp,$(basename $(OBJS) $(XOBJS) $(NOBJS) $(VOBJS) )) ; do \ g++ $(CXXFLAGS) -MM "$$f" >> "$@" 2>/dev/null ; done || touch "$@" efte-1.1/src/clip_os2.cpp0000664000076400007640000000404511041404761014330 0ustar laurilauri/* clip_os2.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "clip.h" int GetPMClip(int clipboard) { ClipData cd; unsigned int i, j, l, dx; EPoint P; if (clipboard != 0) { // only one clipboard supported return 0; } if (GetClipText(&cd) == 0) { SSBuffer->Clear(); j = 0; l = 0; for (i = 0; i < cd.fLen; i++) { if (cd.fChar[i] == 0x0A) { SSBuffer->AssertLine(l); P.Col = 0; P.Row = l++; dx = 0; if ((i > 0) && (cd.fChar[i-1] == 0x0D)) dx++; SSBuffer->InsertLine(P, i - j - dx, cd.fChar + j); j = i + 1; } } if (j < cd.fLen) { // remainder i = cd.fLen; SSBuffer->AssertLine(l); P.Col = 0; P.Row = l++; dx = 0; if ((i > 0) && (cd.fChar[i-1] == 0x0D)) dx++; SSBuffer->InsText(P.Row, P.Col, i - j - dx, cd.fChar + j); j = i + 1; } // now that we don't need cd.fChar anymore, free it free(cd.fChar); } return 0; } int PutPMClip(int clipboard) { char *p = 0; int l = 0; PELine L; int Len; ClipData cd; int rc; if (clipboard != 0) { // only one clipboard supported return 0; } for (int i = 0; i < SSBuffer->RCount; i++) { L = SSBuffer->RLine(i); p = (char *)realloc(p, l + (Len = L->Count) + 2); memcpy(p + l, L->Chars, L->Count); l += Len; if (i < SSBuffer->RCount - 1) { p[l++] = 13; p[l++] = 10; } } p = (char *)realloc(p, l + 1); p[l++] = 0; cd.fChar = p; cd.fLen = l; rc = (PutClipText(&cd) == 0); free(p); return rc ? 1 : 0; } efte-1.1/src/fte-xwin.mak0000664000076400007640000001362611041404761014352 0ustar laurilauri# # fte-xwin.mak # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # # fte-unix.make modified to be generic enough to work with WINNT or UNIX # versions of FTE to build # Versions: # xfte - using XLib (the most stable) # vfte - for Linux console directly (with limitations, see con_linux.cpp) #WINNT ESUF=.exe OEXT=obj OUTFLAG = -out: OUTEXEFLAG = /Fe #UNIX #ESUF= #OEXT=o #OUTFLAG = -o #OUTEXEFLAG = -o # -o must have a space after it above .SUFFIXES: .cpp .$(OEXT) TARGETS = xfte$(ESUF) #TARGETS = vfte$(ESUF) xfte$(ESUF) PRIMARY = xfte$(ESUF) # Comment or uncoment this two flags below if # you want to use: # Keyboard remaping by XFTE #REMAPFLAG = -DUSE_HARD_REMAP # Drawing fonts with locale support #XMBFLAG = -DUSE_XMB # System X11R6 is compiled with X_LOCALE #SYSTEM_X_LOCALE = -DX_LOCALE I18NOPTIONS = $(XMBFLAG) $(REMAPFLAG) $(SYSTEM_X_LOCALE) # Optionally, you can define: # -DDEFAULT_INTERNAL_CONFIG to use internal config by default # -DUSE_XTINIT to use XtInitialize on init APPOPTIONS = -DDEFAULT_INTERNAL_CONFIG -DUSE_XTINIT #gcc/g++ #COPTIONS = -Wall -Wpointer-arith -Wconversion -Wwrite-strings \ # -Wmissing-prototypes -Wmissing-declarations -Winline #CC = g++ #LD = g++ # try this for smaller/faster code and less dependencies #CC = g++ -fno-rtti -fno-exceptions #LD = gcc -fno-rtti -fno-exceptions # choose your os here ####################################################################### #MSVC/EXCEED XDK X_BASE = C:\win32app\Exceed\xdk X_LIBS = -LIBPATH:$(X_BASE)\lib \ HCLXm.lib HCLMrm.lib HCLXmu.lib HCLXt.lib Xlib.lib hclshm.lib xlibcon.lib \ # Xm.lib Mrm.lib Xmu.lib Xt.lib Xlib.lib hclshm.lib xlibcon.lib XINCDIR = -I:$(X_BASE)\include #optimize #OPTIMIZE = /Ox -DNDEBUG #debug #OPTIMIZE = /Od /Zi -D_DEBUG #LDOPTIMIZE = /DEBUG CC = cl LD = link CCFLAGS = $(OPTIMIZE) -DNT -DMSVC $(INCDIR) -DWIN32 -D_CONSOLE -DWINHCLX \ -nologo -W3 -J -DNONXP -DWINNT -D_X86_ -MD -Op -W3 -QIfdiv -GX \ $(XINCDIR) LDFLAGS = $(LDOPTIMIZE) $(LIBDIR) -nologo Advapi32.lib User32.lib Wsock32.lib \ -map /NODEFAULTLIB:libc.lib $(X_LIBS) ####################################################################### # Linux #UOS = -DLINUX #XLIBDIR = -L/usr/X11/lib ####################################################################### # HP/UX #UOS = -DHPUX -D_HPUX_SOURCE -DCAST_FD_SET_INT #UOS = -DHPUX -D_HPUX_SOURCE #CC = CC +a1 #LD = CC #CC = aCC #LD = aCC #XLIBDIR = -L/usr/lib/X11R6 #XINCDIR = -I/usr/include/X11R5 #XLIBDIR = -L/usr/lib/X11R5 #MINCDIR = -I/usr/include/Motif1.2 #MLIBDIR = -L/usr/lib/Motif1.2 ####################################################################### # AIX #UOS = -DAIX -D_BSD_INCLUDES # not recently tested (it did work) #CC = xlC #LD = xlC ####################################################################### # Irix # missing fnmatch, but otherwise ok (tested only on 64bit) # 6.x has fnmatch now ;-) # uncomment below to use SGI CC compiler #UOS = -DIRIX #CC = CC #LD = CC #COPTIONS = -xc++ ####################################################################### # SunOS (Solaris) #UOS = -DSUNOS #CC = CC #LD = CC #XINCDIR = -I/usr/openwin/include #XLIBDIR = -L/usr/openwin/lib ####################################################################### # for SCO CC # # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # If you have problems with the program "cfte" # try to compile this program without optimalization -O2 # use just -O # #UOS = -DSCO #CC = CC -b elf #LD = $(CC) #XLIBDIR = -L/usr/X11R6/lib #SOCKETLIB = -lsocket #COPTIONS = +.cpp ####################################################################### # NCR #CC = cc -Hnocopyr #LD = cc -Hnocopyr #COPTIONS = -w3 #UOS = -DNCR #XINCDIR = -I../../include #SOCKETLIB = -lsocket -lnsl -lc -lucb ####################################################################### #QTDIR = /users/markom/qt #QLIBDIR = -L$(QTDIR)/lib #QINCDIR = -I$(QTDIR)/include #QINCDIR = -I/usr/include/qt MOC = moc #LIBDIR = #INCDIR = #OPTIMIZE = -O -g #OPTIMIZE = -O2 #OPTIMIZE = -O2 -s #UNIX #CCFLAGS = $(OPTIMIZE) $(I18NOPTIONS) $(COPTIONS) -DUNIX $(UOS) $(INCDIR) $(XINCDIR) $(QINCDIR) $(MINCDIR) $(SINCDIR) #LDFLAGS = $(OPTIMIZE) $(LIBDIR) $(XLIBDIR) $(QLIBDIR) $(MLIBDIR) include objs.inc #UNIX # need -lXt below if USE_XTINIT #XLIBS = -lX11 -Xt $(SOCKETLIB) #VLIBS = -lgpm -lncurses # -ltermcap outdated by ncurses #QLIBS = -lqt #MLIBS = -lXm -lXp -lXt -lXpm -lXext .cpp.$(OEXT): $(CC) $(CCFLAGS) $(APPOPTIONS) -c $< .c.$(OEXT): $(CC) $(CCFLAGS) $(APPOPTIONS) -c $< .cpp.moc: $(MOC) $< -o $@ all: cfte$(ESUF) $(TARGETS) # rm -f fteln -s $(PRIMARY) fte cfte$(ESUF): cfte.$(OEXT) s_files.$(OEXT) $(LD) $(LDFLAGS) cfte.$(OEXT) s_files.$(OEXT) $(OUTFLAG)cfte$(ESUF) c_config.$(OEXT): defcfg.h #defcfg.h: defcfg.cnf # perl mkdefcfg.pl defcfg.h defcfg.h: defcfg.cnf bin2c$(ESUF) bin2c$(ESUF) defcfg.cnf >defcfg.h bin2c$(ESUF): bin2c.cpp $(CC) $(CCFLAGS) $(OUTEXEFLAG)bin2c$(ESUF) bin2c.cpp DEFAULT_FTE_CONFIG = simple.fte #DEFAULT_FTE_CONFIG = defcfg.fte #DEFAULT_FTE_CONFIG = defcfg2.fte #DEFAULT_FTE_CONFIG = ../config/main.fte defcfg.cnf: $(DEFAULT_FTE_CONFIG) cfte$(ESUF) cfte$(ESUF) $(DEFAULT_FTE_CONFIG) defcfg.cnf xfte$(ESUF): $(OBJS) $(XOBJS) $(LD) $(LDFLAGS) $(OBJS) $(XOBJS) $(XLIBS) $(OUTFLAG)xfte$(ESUF) qfte$(ESUF): g_qt.moc g_qt_dlg.moc $(OBJS) $(QOBJS) $(LD) $(LDFLAGS) $(OBJS) $(QOBJS) $(QLIBS) $(XLIBS) $(OUTFLAG)qfte$(ESUF) vfte$(ESUF): $(OBJS) $(VOBJS) $(LD) $(LDFLAGS) $(OBJS) $(VOBJS) $(VLIBS) $(OUTFLAG)vfte$(ESUF) mfte$(ESUF): $(OBJS) $(MOBJS) $(LD) $(LDFLAGS) $(OBJS) $(MOBJS) $(MLIBS) $(XLIBS) $(OUTFLAG)mfte$(ESUF) g_qt.$(OEXT): g_qt.moc g_qt_dlg.$(OEXT): g_qt_dlg.moc clean: rm -f *.$(OEXT) $(TARGETS) defcfg.h defcfg.cnf cfte$(ESUF) fte$(ESUF) efte-1.1/src/g_menu.cpp0000664000076400007640000000365211041404761014073 0ustar laurilauri/* g_menu.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include #include #include #include #include #include #if defined(MSVC) #include #endif #include "console.h" #include "gui.h" int MenuCount = 0; mMenu *Menus = 0; int NewMenu(const char *Name) { int n; Menus = (mMenu *) realloc((void *) Menus, sizeof(mMenu) * (MenuCount + 1)); n = MenuCount; Menus[n].Name = strdup(Name); Menus[n].Count = 0; Menus[n].Items = 0; MenuCount++; return n; } int NewItem(int menu, const char *Name) { int n; assert(menu < MenuCount); Menus[menu].Items = (mItem *) realloc(Menus[menu].Items, sizeof(mItem) * (Menus[menu].Count + 1)); n = Menus[menu].Count; Menus[menu].Items[n].SubMenu = -1; Menus[menu].Items[n].Name = Name ? strdup(Name) : 0; Menus[menu].Items[n].Arg = 0; Menus[menu].Items[n].Cmd = -1; Menus[menu].Count++; return n; } int NewSubMenu(int menu, const char *Name, int submenu, int Type) { int n; assert(menu < MenuCount); Menus[menu].Items = (mItem *) realloc(Menus[menu].Items, sizeof(mItem) * (Menus[menu].Count + 1)); n = Menus[menu].Count; Menus[menu].Items[n].SubMenu = submenu; Menus[menu].Items[n].Name = Name ? strdup(Name) : 0; Menus[menu].Items[n].Arg = 0; Menus[menu].Items[n].Cmd = Type; Menus[menu].Count++; return n; } int GetMenuId(const char *Name) { if (Name) for (int i = 0; i < MenuCount; i++) if (strcmp(Name, Menus[i].Name) == 0) return i; return -1; } efte-1.1/src/ftever.h0000664000076400007640000000132511257205413013556 0ustar laurilauri/* * ftever.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __FTEVER_H #define __FTEVER_H #define MAKE_VERSION(major,minor,release) ((major<<24L) | (minor << 16L) | release) #define PROG_FTE "efte" #define PROG_CFTE "cefte" #define PROGRAM PROG_FTE #define EXTRA_VERSION "" #define VERSION "1.1" EXTRA_VERSION #define VERNUM MAKE_VERSION(0x00, 0x62, 0x00) #define COPYRIGHT "Copyright (c) 2008-2009 eFTE Group\n" \ "Copyright (c) 2000-2006 Others\n" \ "Copyright (c) 1994-1998 Marko Macek" #endif // __FTEVER_H efte-1.1/src/h_pascal.cpp0000664000076400007640000001076411041404761014375 0ustar laurilauri/* h_pascal.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #define hsPas_Normal 0 #define hsPas_Comment1 1 #define hsPas_Comment2 2 #define hsPas_Keyword 3 #define hsPas_String1 4 #define hsPas_String2 5 int Hilit_PASCAL(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { int j = 0; int firstnw = 0; HILIT_VARS(BF->Mode->fColorize->Colors, Line); C = 0; NC = 0; for (i = 0; i < Line->Count;) { if (*p != ' ' && *p != 9) firstnw++; IF_TAB() else { switch (State) { default: case hsPas_Normal: if (isalpha(*p) || *p == '_') { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_')) ) j++; if (BF->GetHilitWord(j, &Line->Chars[i], Color, 1)) { // Color = hcC_Keyword; State = hsPas_Keyword; } else { Color = CLR_Normal; State = hsPas_Normal; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; State = hsPas_Normal; continue; } else if ((len >= 2) && (*p == '(') && (*(p + 1) == '*')) { State = hsPas_Comment1; Color = CLR_Comment; ColorNext(); goto hilit; } else if (*p == '{') { State = hsPas_Comment2; Color = CLR_Comment; goto hilit; } else if (*p == '$') { Color = CLR_HexNumber; ColorNext(); ColorNext(); while (len && isxdigit(*p)) ColorNext(); continue; } else if (isdigit(*p)) { Color = CLR_Number; ColorNext(); while (len && (isdigit(*p) || *p == 'e' || *p == 'E' || *p == '.')) ColorNext(); continue; } else if (*p == '\'') { State = hsPas_String1; Color = CLR_String; goto hilit; } else if (*p == '"') { State = hsPas_String2; Color = CLR_String; goto hilit; } else if (ispunct(*p) && *p != '_') { Color = CLR_Punctuation; goto hilit; } Color = CLR_Normal; goto hilit; case hsPas_Comment1: Color = CLR_Comment; if ((len >= 2) && (*p == '*') && (*(p + 1) == ')')) { ColorNext(); ColorNext(); State = hsPas_Normal; continue; } goto hilit; case hsPas_Comment2: Color = CLR_Comment; if (*p == '}') { ColorNext(); State = hsPas_Normal; continue; } goto hilit; case hsPas_String1: Color = CLR_String; if (*p == '\'') { ColorNext(); State = hsPas_Normal; continue; } goto hilit; case hsPas_String2: Color = CLR_String; if (*p == '"') { ColorNext(); State = hsPas_Normal; continue; } hilit: ColorNext(); continue; } } } switch (State) { case hsPas_String1: case hsPas_String2: State = hsPas_Normal; break; } *ECol = C; return 0; } efte-1.1/src/e_fold.cpp0000664000076400007640000003121411041404761014044 0ustar laurilauri/* e_fold.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int EBuffer::FindFold(int Line) { // optimize /*FOLD00*/ int f = FindNearFold(Line); if (f != -1) if (FF[f].line == Line) return f; return -1; } int EBuffer::FindNearFold(int Line) { /*FOLD00*/ int b = 0, B = FCount - 1, c; while (b <= B) { c = (b + B) / 2; // printf("%d %d %d %d %d\n", b, B, c, Line, FF[c].line); if (FF[c].line == Line) return c; if (c < FCount - 1) { if (FF[c].line <= Line && FF[c + 1].line > Line) return c; } else { if (FF[c].line <= Line) return c; } if (FF[c].line < Line) b = c + 1; else B = c - 1; if (b > B) break; } return -1; } int EBuffer::ShowRow(int Row) { /*FOLD00*/ int V = RToVN(Row), GapSize; // printf("Showing row %d\n", Row); assert(Row >= 0 && Row < RCount); // 0 cannot be hidden if (V + Vis(V) == Row) return 1; // already visible assert(VCount <= VAllocated); if (VCount == VAllocated) { if (AllocVis(VCount ? (VCount * 2) : 1) == 0) return 0; memmove(VV + VAllocated - (VCount - VGap), VV + VGap, sizeof(int) * (VCount - VGap)); } if (VGap != V + 1) if (MoveVGap(V + 1) == 0) return 0; VV[VGap] = Row - (VGap); VGap++; VCount++; GapSize = VAllocated - VCount; if (VGap != V + 2) if (MoveVGap(V + 2) == 0) return 0; for (int i = V + 2; i < VCount; i++) VV[i + GapSize]--; // Vis(i, Vis(i) - 1); UpdateVisible(Row, 1); // if (CP.Row > Row) // if (SetPos(CP.Col, CP.Row + 1) == 0) return 0; Draw(Row, -1); return 1; } int EBuffer::HideRow(int Row) { /*FOLD00*/ int V = RToV(Row), GapSize; assert(Row > 0 && Row < RCount); // 0 cannot be hidden if (V == -1) return 1; // already hidden UpdateVisible(Row, -1); if (VGap != V) if (MoveVGap(V) == 0) return 0; GapSize = VAllocated - VCount; VV[VGap + GapSize] = 0; VCount--; GapSize++; if (VAllocated - VAllocated / 2 > VCount) { memmove(VV + VGap + GapSize - VAllocated / 3, VV + VGap + GapSize, sizeof(int) * (VCount - VGap)); if (AllocVis(VAllocated - VAllocated / 3) == 0) return 0; } GapSize = VAllocated - VCount; if (VGap != V) if (MoveVGap(V) == 0) return 0; for (int i = V; i < VCount; i++) VV[i + GapSize]++; // Vis(i, Vis(i) + 1); // if (CP.Row > Row) // if (SetPos(CP.Col, CP.Row - 1) == 0) return 0; Draw(Row, -1); return 1; } int EBuffer::ExposeRow(int Row) { /*FOLD00*/ int V; int f, level, oldlevel = 100; //DumpFold(); assert(Row >= 0 && Row < RCount); // range V = RToV(Row); if (V != -1) return 1; // already exposed f = FindNearFold(Row); assert(f != -1); // if not visible, must be folded while (f >= 0) { level = FF[f].level; if (level < oldlevel) { if (FF[f].open == 0) { // printf("opening fold %d\n", f); if (FoldOpen(FF[f].line) == 0) return 0; } oldlevel = level; } f--; if (level == 0) break; } V = RToV(Row); // if (V == -1) { // printf("Expose Row = %d\n", Row); // DumpFold(); // } assert(V != -1); return 1; } void EBuffer::UpdateVis(EPoint &M, int Row, int Delta) { /*FOLD00*/ if (Delta < 0) { if (M.Row > Row) if (M.Row < Row - Delta) M.Row = Row; else M.Row += Delta; } else { if (M.Row >= Row) M.Row += Delta; } } void EBuffer::UpdateVisible(int Row, int Delta) { /*FOLD00*/ EView *w; Row = RToV(Row); UpdateVis(CP, Row, Delta); w = View; if (w) do { UpdateVis(GetViewVPort(w)->TP, Row, Delta); UpdateVis(GetViewVPort(w)->CP, Row, Delta); w = w->Next; } while (w != View); } int EBuffer::FoldCreate(int Line) { /*FOLD00*/ int n; if (Modify() == 0) return 0; if (FindFold(Line) != -1) return 1; // already exists if (BFI(this, BFI_Undo)) { if (PushULong(Line) == 0) return 0; if (PushUChar(ucFoldCreate) == 0) return 0; } n = FindNearFold(Line); n++; FF = (EFold *) realloc((void *)FF, sizeof(EFold) * ((1 + FCount) | 7)); assert(FF != 0); memmove(FF + n + 1, FF + n, sizeof(EFold) * (FCount - n)); FCount++; FF[n].line = Line; FF[n].level = 0; FF[n].open = 1; FF[n].flags = 0; Draw(Line, Line); return 1; } int EBuffer::FoldCreateByRegexp(char *Regexp) { /*FOLD00*/ RxNode *R; int err = 1; if (Modify() == 0) return 0; R = RxCompile(Regexp); if (R != NULL) { PELine X; int first = -1; int L; for (L = 0; L < RCount; L++) { RxMatchRes RM; X = RLine(L); if (RxExec(R, X->Chars, X->Count, X->Chars, &RM) == 1) { if (first >= 0) { int i; for (i = L; i > 0; i--) { PELine Y; Y = RLine(i); if ((Y->Count == 0) || strrchr(Y->Chars, '}')) { if ((L - i) > 2) { while ((i > 0) && (RLine(i - 1)->Count == 0)) i--; if ((first >= 0) && i && (FoldCreate(i) == 0)) err = 0; } break; } } } else first = L; if (FoldCreate(L) == 0) { err = 0; break; } } } RxFree(R); } return err; } int EBuffer::FoldCreateAtRoutines() { /*FOLD00*/ if (BFS(this, BFS_RoutineRegexp) == 0) return 0; return FoldCreateByRegexp(BFS(this, BFS_RoutineRegexp)); } int EBuffer::FoldDestroy(int Line) { /*FOLD00*/ int f = FindFold(Line); if (Modify() == 0) return 0; if (f == -1) return 0; if (FF[f].open == 0) if (FoldOpen(Line) == 0) return 0; if (BFI(this, BFI_Undo)) { if (PushULong(FF[f].level) == 0) return 0; if (PushULong(Line) == 0) return 0; if (PushUChar(ucFoldDestroy) == 0) return 0; } memmove(FF + f, FF + f + 1, sizeof(EFold) * (FCount - f - 1)); FCount--; FF = (EFold *) realloc((void *)FF, sizeof(EFold) * (FCount | 7)); Draw(Line, Line); return 1; } int EBuffer::FoldDestroyAll() { /*FOLD00*/ int l; if (Modify() == 0) return 0; for (l = 0; l < RCount; l++) if (FindFold(l) != -1) if (FoldDestroy(l) == 0) return 0; return 1; } int EBuffer::FoldPromote(int Line) { /*FOLD00*/ int f = FindFold(Line); if (Modify() == 0) return 0; if (f == -1) return 0; if (FF[f].open == 0) return 0; if (FF[f].level == 0) return 0; if (BFI(this, BFI_Undo)) { if (PushULong(Line) == 0) return 0; if (PushUChar(ucFoldPromote) == 0) return 0; } if ((FF[f].line > 0) && (ExposeRow(FF[f].line - 1) == 0)) return 0; FF[f].level--; Draw(Line, Line); return 1; } int EBuffer::FoldDemote(int Line) { /*FOLD00*/ int f = FindFold(Line); if (Modify() == 0) return 0; if (f == -1) return 0; if (FF[f].open == 0) return 0; if (FF[f].level == 99) return 0; if (BFI(this, BFI_Undo)) { if (PushULong(Line) == 0) return 0; if (PushUChar(ucFoldDemote) == 0) return 0; } if ((FF[f].line > 0) && (ExposeRow(FF[f].line - 1) == 0)) return 0; FF[f].level++; Draw(Line, Line); return 1; } int EBuffer::FoldOpen(int Line) { /*FOLD00*/ int f = FindFold(Line); int l; int level, toplevel; int top; if (f == -1) return 0; if (FF[f].open == 1) return 1; // already open if (Modify() == 0) return 0; if (BFI(this, BFI_Undo)) { if (PushULong(Line) == 0) return 0; if (PushUChar(ucFoldOpen) == 0) return 0; } FF[f].open = 1; top = FF[f].line; toplevel = FF[f].level; // printf("Fold starts with %d\n", FF[f].line); if (ShowRow(FF[f].line) == 0) return 0; while (f < FCount) { level = FF[f].level; if (FF[f].open == 1) { // fold is open if (f == FCount - 1) { for (l = FF[f].line; l < RCount; l++) if (l != top) if (ShowRow(l) == 0) return 0; } else { for (l = FF[f].line; l < FF[f + 1].line; l++) if (l != top) if (ShowRow(l) == 0) return 0; } f++; } else { // fold is closed // show head line if (ShowRow(FF[f].line) == 0) return 0; // skip closed folds while ((f < FCount) && (level < FF[f + 1].level)) f++; f++; } if (f < FCount && FF[f].level <= toplevel) break; } return 1; } int EBuffer::FoldOpenAll() { /*FOLD00*/ int l; for (l = 0; l < RCount; l++) if (FindFold(l) != -1) if (FoldOpen(l) == 0) return 0; return 1; } int EBuffer::FoldOpenNested() { /*FOLD00*/ int Line = VToR(CP.Row); int f = FindFold(Line); int l; int level; if (f == -1) return 0; level = FF[f].level; while (f + 1 < FCount && FF[f + 1].level > level) f++; if (f + 1 == FCount) { if (FoldOpen(Line) == 0) return 0; } else { for (l = Line; l < RCount && l < FF[f + 1].line; l++) { if (FindFold(l) != -1) if (FoldOpen(l) == 0) return 0; } } return 0; } int EBuffer::FoldClose(int Line) { /*FOLD00*/ int f = FindNearFold(Line); int l, top; int level; if (f == -1) return 0; if (FF[f].open == 0) return 1; // already closed if (Modify() == 0) return 0; if (SetPosR(CP.Col, FF[f].line, tmLeft) == 0) return 0; if (BFI(this, BFI_Undo)) { if (PushULong(Line) == 0) return 0; if (PushUChar(ucFoldClose) == 0) return 0; } FF[f].open = 0; top = FF[f].line; level = FF[f].level; while ((f < FCount - 1) && (FF[f + 1].level > level)) f++; /* performance tweak: do it in reverse (we'll see if it helps) */ if (f == FCount - 1) { for (l = RCount - 1; l > top; l--) if (HideRow(l) == 0) return 0; } else { for (l = FF[f + 1].line - 1; l > top; l--) if (HideRow(l) == 0) return 0; } /* yup, it does. try below for a (MUCH!) slower version */ /*if (f == FCount - 1) { for (l = top + 1; l < RCount; l++) if (HideRow(l) == 0) return 0; } else { for (l = top + 1; l < FF[f + 1].line; l++) if (HideRow(l) == 0) return 0; }*/ return 1; } int EBuffer::FoldCloseAll() { /*FOLD00*/ int l; for (l = RCount - 1; l >= 0; l--) if (FindFold(l) != -1) if (FoldClose(l) == 0) return 0; return 1; } int EBuffer::FoldToggleOpenClose() { /*FOLD00*/ int Line = VToR(CP.Row); int f; f = FindNearFold(Line); if (f == -1) return 0; if (FF[f].open) { if (FoldClose(Line) == 0) return 0; } else { if (FoldOpen(Line) == 0) return 0; } return 1; } int EBuffer::MoveFoldTop() { /*FOLD00*/ int f = FindNearFold(VToR(CP.Row)); if (f == 0 || f == -1) return 0; if (FF[f].line == VToR(CP.Row)) return 1; if (SetPosR(CP.Col, FF[f].line, tmLeft) == 0) return 0; return 1; } int EBuffer::MoveFoldPrev() { /*FOLD00*/ int f = FindNearFold(VToR(CP.Row)); if (f == 0 || f == -1) return 0; if (FF[f].line == VToR(CP.Row)) { do { f--; if (f < 0) return 0; if (RToV(FF[f].line) != -1) break; } while (1); } if (SetPosR(CP.Col, FF[f].line, tmLeft) == 0) return 0; return 1; } int EBuffer::MoveFoldNext() { /*FOLD00*/ int f = FindNearFold(VToR(CP.Row)); if (f == FCount - 1 || f == -1) return 0; do { f++; if (f == FCount) return 0; if (RToV(FF[f].line) != -1) break; } while (1); if (SetPosR(CP.Col, FF[f].line, tmLeft) == 0) return 0; return 1; } efte-1.1/src/watconvert.cpp0000664000076400007640000000204411250207354015010 0ustar laurilauri/* * watconvert.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * wmake uses '&' as a line continuation however objs.inc * uses '\' so this executable will read in objs.inc, convert * the file, and save as objs.mif for use by wmake * */ #include #include int main() { int i; char buffer[30]; FILE *input; FILE *output; input = fopen("objs.inc", "r"); if (input == NULL) { printf("objs.inc file not found\n"); return EXIT_FAILURE; } output = fopen("objs.mif", "w"); if (output == NULL) { fclose(input); printf("objs.mif not writable\n"); return EXIT_FAILURE; } while (fgets(buffer, 30, input) != NULL) { for (i = 0; i < 30; i++) if (buffer[i] == '\\') buffer[i] = '&'; fputs(buffer, output); } fclose(input); fclose(output); return EXIT_SUCCESS; } efte-1.1/src/ftepm.def0000664000076400007640000000013607045071303013703 0ustar laurilauriNAME ftepm WINDOWAPI DESCRIPTION 'FTE Text Editor - Presentation Manager GUI' STACKSIZE 49152 efte-1.1/src/clipprog.cpp0000664000076400007640000000275511041404761014443 0ustar laurilauri/* clipprog.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #define INCL_DOS #define INCL_PM #include #include #include #include #include #define SEM_PREFIX "\\SEM32\\PMCLIPS\\" #define MEM_PREFIX "\\SHAREMEM\\PMCLIPS\\" #define CMD_GET 1 #define CMD_PUT 2 HAB hab; HMQ hmq; QMSG qmsg; HMTX hmtxSyn; HEV hevGet; HEV hevPut; HEV hevEnd; HMUX hmuxWait; void clipsrv(void *foo) { HAB hab; HMQ hmq; ULONG Cmd; ULONG len; char *text; void *shmem = "the text"; hab = NULLHANDLE; if ((WinOpenClipbrd(hab) == TRUE) && ((text = (char *) WinQueryClipbrdData(hab, CF_TEXT)) != 0)) { DosGetSharedMem(text, PAG_READ); len = strlen(text); puts(text); } WinCloseClipbrd(hab); len = strlen(shmem); if (len) { DosAllocSharedMem((void **)&text, 0, len + 1, PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE | OBJ_GETTABLE); strcpy(text, shmem); } if (WinOpenClipbrd(hab) == TRUE) { if (!WinSetClipbrdData(hab, (ULONG) text, CF_TEXT, CFI_POINTER)) DosBeep(100, 1500); WinCloseClipbrd(hab); } } int main() { clipsrv(NULL); return 0; } efte-1.1/src/o_messages.h0000664000076400007640000000434711041404761014415 0ustar laurilauri/* o_messages.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __MESSAGES_H__ #define __MESSAGES_H__ typedef struct { char *file; int line; char *msg; char *text; int hilit; EBuffer *Buf; } Error; struct aDir { aDir* next; char* name; }; class EMessages: public EList { public: char *Command; char *Directory; int ErrCount; Error **ErrList; int Running; int BufLen; int BufPos; int PipeId; int ReturnCode; int MatchCount; char MsgBuf[4096]; aDir* curr_dir; // top of dir stack. EMessages(int createFlags, EModel **ARoot, char *Dir, char *ACommand); ~EMessages(); void freeDirStack(); virtual void NotifyDelete(EModel *Deleting); void FindErrorFiles(); void FindErrorFile(int err); void AddFileError(EBuffer *B, int err); void FindFileErrors(EBuffer *B); virtual int GetContext() { return CONTEXT_MESSAGES; } virtual EEventMap *GetEventMap(); virtual int ExecCommand(int Command, ExState &State); void AddError(Error *p); void AddError(char *file, int line, char *msg, const char *text, int hilit = 0); void FreeErrors(); int GetLine(char *Line, int maxim); void GetErrors(); int Compile(char *Command); void ShowError(EView *V, int err); void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); char* FormatLine(int Line); int IsHilited(int Line); void UpdateList(); int Activate(int No); int CanActivate(int Line); void NotifyPipe(int APipeId); virtual void GetName(char *AName, int MaxLen); virtual void GetInfo(char *AInfo, int MaxLen); virtual void GetPath(char *APath, int MaxLen); virtual void GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen); virtual int GetRowLength(int ARow); int RunPipe(char *Dir, char *Command); int CompilePrevError(EView *V); int CompileNextError(EView *V); }; extern EMessages *CompilerMsgs; void FreeCRegexp(); #endif efte-1.1/src/clipserv.def0000664000076400007640000000013207045071303014413 0ustar laurilauriNAME clipserv WINDOWAPI DESCRIPTION 'FTE Clipboard access server for VIO' STACKSIZE 49152 efte-1.1/src/objs.inc0000664000076400007640000000434311163156165013552 0ustar laurilauriOBJS = \ cfte.$(OEXT) \ indent.$(OEXT) \ e_mark.$(OEXT) \ o_modemap.$(OEXT) \ c_desktop.$(OEXT) \ c_bind.$(OEXT) \ c_color.$(OEXT) \ c_config.$(OEXT) \ c_history.$(OEXT) \ c_hilit.$(OEXT) \ c_mode.$(OEXT) \ e_block.$(OEXT) \ e_buffer.$(OEXT) \ e_cmds.$(OEXT) \ e_cvslog.$(OEXT) \ e_svnlog.$(OEXT) \ e_redraw.$(OEXT) \ e_file.$(OEXT) \ e_fold.$(OEXT) \ e_trans.$(OEXT) \ e_line.$(OEXT) \ e_loadsave.$(OEXT) \ e_regex.$(OEXT) \ e_print.$(OEXT) \ e_search.$(OEXT) \ e_undo.$(OEXT) \ e_tags.$(OEXT) \ g_draw.$(OEXT) \ g_menu.$(OEXT) \ h_ada.$(OEXT) \ h_c.$(OEXT) \ h_fte.$(OEXT) \ h_ipf.$(OEXT) \ h_make.$(OEXT) \ h_pascal.$(OEXT) \ h_perl.$(OEXT) \ h_plain.$(OEXT) \ h_msg.$(OEXT) \ h_rexx.$(OEXT) \ h_sh.$(OEXT) \ h_tex.$(OEXT) \ h_catbs.$(OEXT) \ h_simple.$(OEXT) \ i_complete.$(OEXT) \ i_ascii.$(OEXT) \ i_choice.$(OEXT) \ i_input.$(OEXT) \ i_key.$(OEXT) \ i_search.$(OEXT) \ i_view.$(OEXT) \ i_modelview.$(OEXT) \ i_oview.$(OEXT) \ o_buflist.$(OEXT) \ o_list.$(OEXT) \ o_messages.$(OEXT) \ o_model.$(OEXT) \ o_routine.$(OEXT) \ o_buffer.$(OEXT) \ o_directory.$(OEXT) \ o_cvsbase.$(OEXT) \ o_cvs.$(OEXT) \ o_cvsdiff.$(OEXT) \ o_svnbase.$(OEXT) \ o_svn.$(OEXT) \ o_svndiff.$(OEXT) \ s_files.$(OEXT) \ s_direct.$(OEXT) \ s_util.$(OEXT) \ s_string.$(OEXT) \ view.$(OEXT) \ gui.$(OEXT) \ egui.$(OEXT) \ fte.$(OEXT) \ commands.$(OEXT) \ log.$(OEXT) OS2OBJS = e_os2.$(OEXT) VIOOBJS = $(OS2OBJS) \ g_text.$(OEXT) \ menu_text.$(OEXT) \ con_os2.$(OEXT) \ clip_os2.$(OEXT) \ clip_pmv.$(OEXT) \ g_nodlg.$(OEXT) PMOBJS = $(OS2OBJS) \ g_pm.$(OEXT) \ clip_os2.$(OEXT) \ clip_pm.$(OEXT) UNIXOBJS = \ e_unix.$(OEXT) \ memicmp.$(OEXT) XOBJS = $(UNIXOBJS) \ g_text.$(OEXT) \ menu_text.$(OEXT) \ con_x11.$(OEXT) \ clip_x11.$(OEXT) \ con_i18n.$(OEXT) \ g_nodlg.$(OEXT) QOBJS = $(UNIXOBJS) \ g_qt.$(OEXT) \ g_qt_dlg.$(OEXT) \ clip_x11.$(OEXT) NOBJS = $(UNIXOBJS) \ g_text.$(OEXT) \ menu_text.$(OEXT) \ con_ncurses.$(OEXT) \ g_unix_pipe.$(OEXT) \ clip_no.$(OEXT) \ g_nodlg.$(OEXT) VOBJS = $(UNIXOBJS) \ g_text.$(OEXT) \ menu_text.$(OEXT) \ con_linux.$(OEXT) \ clip_no.$(OEXT) \ g_nodlg.$(OEXT) MOBJS = $(UNIXOBJS) \ g_motif.$(OEXT) \ clip_no.$(OEXT) \ g_nodlg.$(OEXT) NTOBJS = \ g_text.$(OEXT) \ menu_text.$(OEXT) \ con_nt.$(OEXT) \ clip_os2.$(OEXT) \ g_nodlg.$(OEXT) \ e_win32.$(OEXT) efte-1.1/src/h_fte.cpp0000664000076400007640000001266011041404761013705 0ustar laurilauri/* h_fte.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" // These states should match those in h_c.cpp to let autoindentation work #define hsFTE_Normal 0 #define hsFTE_Comment 1 #define hsFTE_Keyword 4 #define hsFTE_String1 10 #define hsFTE_String2 11 #define hsFTE_CPP 12 #define hsFTE_Regexp 15 #define hsFTE_KeySpec 16 int Hilit_FTE(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { int j = 0; HILIT_VARS(BF->Mode->fColorize->Colors, Line); int len1 = len; char *last = p + len1 - 1; C = 0; NC = 0; for (i = 0; i < Line->Count;) { IF_TAB() else { switch (State) { default: case hsFTE_Normal: if (isalpha(*p) || *p == '_') { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_')) ) j++; if (BF->GetHilitWord(j, &Line->Chars[i], Color)) { State = hsFTE_Keyword; } else { Color = CLR_Normal; State = hsFTE_Normal; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; State = hsFTE_Normal; continue; } else if (*p == '#') { State = hsFTE_Comment; Color = CLR_Comment; goto hilit; } else if (*p == '%') { State = hsFTE_CPP; Color = CLR_CPreprocessor; goto hilit; } else if (isdigit(*p)) { Color = CLR_Number; ColorNext(); while (len && (isdigit(*p) || *p == 'e' || *p == 'E' || *p == '.')) ColorNext(); if (len && (toupper(*p) == 'U')) ColorNext(); if (len && (toupper(*p) == 'L')) ColorNext(); continue; } else if (*p == '\'') { State = hsFTE_String1; Color = CLR_String; goto hilit; } else if (*p == '[') { State = hsFTE_KeySpec; Color = CLR_Command; goto hilit; } else if (*p == '"') { State = hsFTE_String2; Color = CLR_String; goto hilit; } else if (*p == '/') { State = hsFTE_Regexp; Color = CLR_Regexp; goto hilit; } else if (ispunct(*p)) { Color = CLR_Punctuation; ColorNext(); continue; } Color = CLR_Normal; ColorNext(); continue; case hsFTE_Comment: Color = CLR_Comment; goto hilit; case hsFTE_CPP: Color = CLR_CPreprocessor; goto hilit; case hsFTE_String1: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { hilit2: ColorNext(); hilit: ColorNext(); continue; } else if (*p == '\'') { ColorNext(); State = hsFTE_Normal; continue; } goto hilit; case hsFTE_String2: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == '"') { ColorNext(); State = hsFTE_Normal; continue; } goto hilit; case hsFTE_KeySpec: Color = CLR_Command; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == ']') { ColorNext(); State = hsFTE_Normal; continue; } goto hilit; case hsFTE_Regexp: Color = CLR_Regexp; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == '/') { ColorNext(); State = hsFTE_Normal; continue; } goto hilit; } } } if (State == hsFTE_Comment) State = hsFTE_Normal; if ((len1 == 0) || (*last != '\\')) { switch (State) { case hsFTE_CPP: case hsFTE_String1: case hsFTE_String2: case hsFTE_KeySpec: case hsFTE_Regexp: State = hsFTE_Normal; break; } } *ECol = C; return 0; } efte-1.1/src/c_color.h0000664000076400007640000000333011041404761013677 0ustar laurilauri/* c_color.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __COLOR_H #define __COLOR_H #include "c_mode.h" extern ChColor hcStatus_Normal; extern ChColor hcStatus_Active; extern ChColor hcPlain_Normal; extern ChColor hcPlain_Background; extern ChColor hcPlain_Selected; extern ChColor hcPlain_Markers; extern ChColor hcPlain_Found; extern ChColor hcPlain_Keyword; extern ChColor hcPlain_Folds[5]; extern ChColor hcPlain_HilitWord; extern ChColor hcPlain_Bookmark; extern ChColor hcEntry_Field; extern ChColor hcEntry_Prompt; extern ChColor hcEntry_Selection; //extern ChColor hcList_Border; extern ChColor hcList_Status; extern ChColor hcList_Normal; extern ChColor hcList_Selected; extern ChColor hcList_Hilited; extern ChColor hcList_HilitSelect; extern ChColor hcList_Marked; extern ChColor hcList_MarkSelect; extern ChColor hcList_MarkHilit; extern ChColor hcList_MarkHilitSel; extern ChColor hcScrollBar_Arrows; extern ChColor hcScrollBar_Back; extern ChColor hcScrollBar_Fore; extern ChColor hcAsciiChars; extern ChColor hcMenu_Background; extern ChColor hcMenu_ActiveItem; extern ChColor hcMenu_ActiveChar; extern ChColor hcMenu_NormalItem; extern ChColor hcMenu_NormalChar; extern ChColor hcChoice_Title; extern ChColor hcChoice_Param; extern ChColor hcChoice_Background; extern ChColor hcChoice_ActiveItem; extern ChColor hcChoice_ActiveChar; extern ChColor hcChoice_NormalItem; extern ChColor hcChoice_NormalChar; extern ChColor MsgColor[3]; int SetColor(const char *ChColor, const char *Value); #endif efte-1.1/src/s_string.h0000664000076400007640000000122611041422405014104 0ustar laurilauri/* * string.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __S_STRING_H__ #define __S_STRING_H__ int UnTabStr(char *dest, int maxlen, const char *source, int slen); #if !defined(HAVE_STRLCPY) size_t strlcpy(char *dst, const char *src, size_t size); #endif // !HAVE_STRLCPY #if !defined(HAVE_STRLCAT) size_t strlcat(char *dst, const char *src, size_t size); #endif // !HAVE_STRLCAT #if !defined(HAVE_STRICMP) int stricmp(const char *a, const char *b); #endif #endif // __S_STRING_H__ efte-1.1/src/o_modemap.cpp0000664000076400007640000001153511041404761014560 0ustar laurilauri/* o_modemap.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "o_modemap.h" EventMapView *TheEventMapView = 0; void EventMapView::AddLine(const char *Line) { if (BList) { BCount++; BList = (char **)realloc((void *)BList, sizeof(char *) * BCount); } else { BCount = 1; BList = (char **)malloc(sizeof(char *)); } assert(BList); BList[BCount - 1] = strdup(Line); } void EventMapView::DumpKey(const char *aPrefix, EKey *Key) { char KeyName[128] = ""; char Entry[2048] = ""; char *p; int id; if (aPrefix) { strcpy(KeyName, aPrefix); strcat(KeyName, "_"); } GetKeyName(KeyName + strlen(KeyName), sizeof(KeyName) - strlen(KeyName), Key->fKey); sprintf(Entry, "%13s ", KeyName); id = Key->Cmd; for (int i = 0; i < Macros[id].Count; i++) { p = Entry + strlen(Entry); if (Macros[id].cmds[i].type == CT_COMMAND) { if (Macros[id].cmds[i].repeat > 1) sprintf(p, "%d:%s ", Macros[id].cmds[i].repeat, GetCommandName(Macros[id].cmds[i].u.num)); else sprintf(p, "%s ", GetCommandName(Macros[id].cmds[i].u.num)); } else if (Macros[id].cmds[i].type == CT_NUMBER) { sprintf(p, "%ld ", Macros[id].cmds[i].u.num); } else if (Macros[id].cmds[i].type == CT_STRING) { sprintf(p, "'%s' ", Macros[id].cmds[i].u.string); } else if (Macros[id].cmds[i].type == CT_CONCAT) { strcat(p, ". "); } else if (Macros[id].cmds[i].type == CT_VARIABLE) { sprintf(p, "$(%ld) ", Macros[id].cmds[i].u.num); } if (strlen(Entry) > 70) { if (i != Macros[id].Count - 1) { // not the last entry AddLine(Entry); sprintf(Entry, "%13s ", ""); } } } AddLine(Entry); } void EventMapView::DumpMap(const char *aPrefix, EKeyMap *aKeyMap) { EKey *Key; Key = aKeyMap->fKeys; while (Key) { if (Key->fKeyMap) { char Prefix[32] = ""; if (aPrefix) { strcpy(Prefix, aPrefix); strcat(Prefix, "_"); } GetKeyName(Prefix + strlen(Prefix), sizeof(Prefix) - strlen(Prefix), Key->fKey); DumpMap(Prefix, Key->fKeyMap); } else { DumpKey(aPrefix, Key); } Key = Key->fNext; } } void EventMapView::DumpEventMap(EEventMap *aEventMap) { char name[256]; while (aEventMap) { strcpy(name, aEventMap->Name); if (aEventMap->Parent) { strcat(name, ": "); strcat(name, aEventMap->Parent->Name); } AddLine(name); if (aEventMap->KeyMap) DumpMap(0, aEventMap->KeyMap); aEventMap = aEventMap->Parent; if (aEventMap != 0) AddLine(""); } } EventMapView::EventMapView(int createFlags, EModel **ARoot, EEventMap *Map): EList(createFlags, ARoot, "Event Map") { BCount = 0; BList = 0; DumpEventMap(EMap = Map); TheEventMapView = this; } EventMapView::~EventMapView() { FreeView(); TheEventMapView = 0; } void EventMapView::FreeView() { if (BList) { for (int i = 0; i < BCount; i++) if (BList[i]) free(BList[i]); free(BList); } BCount = 0; BList = 0; } void EventMapView::ViewMap(EEventMap *Map) { FreeView(); DumpEventMap(EMap = Map); } EEventMap *EventMapView::GetEventMap() { return FindEventMap("EVENTMAPVIEW"); } int EventMapView::ExecCommand(int Command, ExState &State) { return EList::ExecCommand(Command, State); } int EventMapView::GetContext() { return CONTEXT_MAPVIEW; } void EventMapView::DrawLine(PCell B, int Line, int Col, ChColor color, int Width) { if (Line < BCount) if (Col < int(strlen(BList[Line]))) MoveStr(B, 0, Width, BList[Line] + Col, color, Width); } char *EventMapView::FormatLine(int Line) { return strdup(BList[Line]); } void EventMapView::UpdateList() { Count = BCount; EList::UpdateList(); } int EventMapView::CanActivate(int /*Line*/) { return 0; } void EventMapView::GetName(char *AName, int MaxLen) { strncpy(AName, "EventMapView", MaxLen); } void EventMapView::GetInfo(char *AInfo, int /*MaxLen*/) { sprintf(AInfo, "%2d %04d/%03d EventMapView (%s)", ModelNo, Row + 1, Count, EMap->Name); } void EventMapView::GetTitle(char *ATitle, int /*MaxLen*/, char *ASTitle, int SMaxLen) { sprintf(ATitle, "EventMapView: %s", EMap->Name); strncpy(ASTitle, "EventMapView", SMaxLen); ASTitle[SMaxLen - 1] = 0; } efte-1.1/src/log.h0000664000076400007640000002104711041366545013054 0ustar laurilauri// // General Logging... IN A CLASS! :-) // /******************************************************************** The author, Darin McBride, explicitly places this module under the LGPL license. This module must remain free for use, but will not cause software that uses it to be required to be under the GPL or any of its derivitives. ********************************************************************/ /** Class-based, OO-based logging This is intended to be used as a trace utility in C++, if you follow the following conventions. Note that all macros are intended to work like function calls - so you still need the terminating semicolon. At the top of each function, you must use STARTFUNC(x). The parameter to this macro is the name of the function. For example, STARTFUNC("main"). At the end of each function, or wherever you return from, use one of: ENDFUNCRC - trace the return code ENDFUNCRC_SAFE - same as above, but can be used when returning the value of something with side effects ENDFUNCAS - trace the return code, but pretend it's a different type ENDFUNCAS_SAFE - trace the return code of something with side effects, as if it were another type. Finally, to log trace points throughout your code, use the LOG() macro as if it were an ostream. To terminate each line, do not use endl, but use the ENDLINE macro. Yes, currently it's the same thing, but I'm reserving the right to change that in the future. For example: int main() { STARTFUNC("main"); LOG << "About to call foo" << ENDLINE; SomeObjectType baz; foo(baz); ENDFUNCRC(0); // no return - the macro does this for us. } void foo(SomeObjectType bar) { STARTFUNC("foo") // assumes bar has some meaningful way to be put into an ostream: LOG << "bar = " << bar << ENDLINE; // as void, no need to endfunc. } ENDFUNCRC_SAFE is used such as: ENDFUNCRC_SAFE(foo++); // side effect only happens once. // was: return foo++ The AS versions are only used to log as a different type than it currently is. For example, to log a HANDLE as if it were an unsigned long: HANDLE foo; ENDFUNCAS(unsigned long, foo); // was: return foo Finally, ENDFUNCAS_SAFE: ENDFUNCAS_SAFE(HANDLE, unsigned long, GetNextHandle()); // was: return GetNextHandle() */ #ifndef __LOGGING_HPP #define __LOGGING_HPP #if defined(NO_NEW_CPP_FEATURES) #include #include #include #include #else #include #include #include #include #endif #if !defined(NO_NEW_CPP_FEATURES) using namespace std; #endif #ifndef FTE_NO_LOGGING /** * GlobalLog handles the actual logging. */ class GlobalLog { friend class FunctionLog; private: char* m_strLogFile; ofstream m_ofsLog; bool m_bOpened; int indent; ostream& operator()(); public: GlobalLog() : m_strLogFile(NULL), m_bOpened(false) {} GlobalLog(char const* strLogFile) : m_strLogFile(strdup(strLogFile)), m_bOpened(false) {} virtual ~GlobalLog() { free(m_strLogFile); } void SetLogFile(char const* strNewLogFile) { if (m_strLogFile == NULL || strNewLogFile == NULL || strcmp(m_strLogFile, strNewLogFile) != 0) { free((void*)m_strLogFile); m_strLogFile = strNewLogFile == NULL ? (char *)NULL : strdup(strNewLogFile); m_bOpened = false; } } operator bool() { return !m_ofsLog.fail(); } protected: bool OpenLogFile(); // actually open it }; extern GlobalLog globalLog; /** * FunctionLog is the local object that handles logging inside a function. * All work is put through here. */ class FunctionLog { private: GlobalLog& log; char const* func; int myIndentLevel; char indentChar; public: // Enter: FunctionLog(GlobalLog& gl, const char* funcName, unsigned long line); // Exit: ~FunctionLog(); // RC? ostream& RC(unsigned long line); private: ostream& OutputLine() { return OutputIndent(log()) << '[' << func << "] "; } public: // output line. ostream& OutputLine(unsigned long line) { return OutputLine() << '{' << line << "} "; } private: ostream& OutputIndent(ostream& os); }; #define LOGOBJNAME functionLog__obj #define LOG LOGOBJNAME.OutputLine(__LINE__) #define ENDLINE endl #define STARTFUNC(func) FunctionLog LOGOBJNAME(globalLog, func, __LINE__) #define ENDFUNCRC(rc) do { LOGOBJNAME.RC(__LINE__) << (rc) << ENDLINE; return (rc); } while (0) #define ENDFUNCRC_SAFE(type,rc) do { type LOG__RC = (rc); LOGOBJNAME.RC(__LINE__) << LOG__RC << ENDLINE; return LOG__RC; } while (0) #define ENDFUNCAS(type,rc) do { LOGOBJNAME.RC(__LINE__) << (type)(rc) << ENDLINE; return (rc); } while (0) #define ENDFUNCAS_SAFE(logtype,rctype,rc) do { rctype LOG__RC = (rc); LOGOBJNAME.RC(__LINE__) << (logtype)LOG__RC << ENDLINE; return LOG__RC; } while (0) #define BOOLYESNO(x) ((x) ? "YES" : "NO") /********************************************************************/ /* Utility ostream functions. These are functions that only have anything to do with logging because logging is the only place we use IO streams. They're here to make tracing easier to capture more information. ********************************************************************** FUNCTION BinChar(char) CLASS IO Manipulator SAMPLE LOG << "this char is: " << BinChar(CharP) << ENDLINE; DESCRIPTION BinChar will insert the character followed by the hex value in brackets. If the character is non-printable, it will display as a dot. ********************************************************************** FUNCTION FillChar(char, length) CLASS IO Manipulator SAMPLE LOG << FillChar('*', 50) << ENDLINE; DESCRIPTION FillChar is available for pretty-printing. Use sparingly, if at all. ********************************************************************** FUNCTION LOGBINARYDATA(char*, int len) CLASS Macro SAMPLE LOG << "The value of some_binary_data is:" << ENDLINE LOGBINARYDATA(some_binary_data, int len); DESCRIPTION This macro will log some structure or array in basically a memory-dump style: 8 characters, followed by 8 hex values. If any character is non-printable, it will display as a dot. ********************************************************************** */ #define DECLARE_OSTREAM_FUNC1(type1) \ class ostream_func1_##type1 { \ private: \ ostream& (*osfunc)(ostream&, type1 const&); \ type1 const& o1; \ public: \ ostream_func1_##type1(ostream& (*osfunc_)(ostream&, type1 const&), type1 const& o1_) : osfunc(osfunc_), o1(o1_) {} \ ostream& operator()(ostream& os) const { return osfunc(os, o1); } \ }; \ inline ostream& operator <<(ostream& os, ostream_func1_##type1 const& ofunc) \ { return ofunc(os); } #define DECLARE_OSTREAM_FUNC2(type1,type2) \ class ostream_func2_##type1##_##type2 { \ private: \ ostream& (*osfunc)(ostream&, type1 const&, type2 const&); \ type1 const& o1; \ type2 const& o2; \ public: \ ostream_func2_##type1##_##type2(ostream& (*osfunc_)(ostream&, type1 const&, type2 const&), \ type1 const& o1_, type2 const& o2_) : \ osfunc(osfunc_), o1(o1_), o2(o2_) {} \ ostream& operator()(ostream& os) const { return osfunc(os, o1, o2); } \ }; \ inline ostream& operator <<(ostream& os, ostream_func2_##type1##_##type2 const& ofunc) \ { return ofunc(os); } DECLARE_OSTREAM_FUNC1(char) DECLARE_OSTREAM_FUNC2(char, size_t) ostream& Log__osBinChar(ostream&, char const&); inline ostream_func1_char BinChar(char c) { return ostream_func1_char(Log__osBinChar, c); } ostream& Log__osFillChar(ostream&, char const&, size_t const&); inline ostream_func2_char_size_t FillChar(char const& c, size_t const& num) { return ostream_func2_char_size_t(Log__osFillChar, c, num); } void Log__BinaryData(FunctionLog&, void* bin_data, size_t len, unsigned long line); #define LOGBINARYDATA(bin_data,len) Log__BinaryData(LOGOBJNAME,bin_data,len, __LINE__) #else // defined NO_LOGGING #define LOG while (0) { cout #define ENDLINE endl; } #define STARTFUNC(func) #define ENDFUNCRC(rc) return rc #define ENDFUNCRC_SAFE(type,rc) return rc #define ENDFUNCAS(type,rc) return rc #define ENDFUNCAS_SAFE(logtype,rctype,rc) return rc #define BOOLYESNO(x) ((x) ? "YES" : "NO") //Replacements for utility functions. #define BinChar(c) c #define LOGBINARYDATA(b,l) #endif // NO_LOGGING #endif // __LOGGING_HPP efte-1.1/src/h_make.cpp0000664000076400007640000000354011041404761014041 0ustar laurilauri/* h_make.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #define hsMAKE_Normal 0 #define hsMAKE_Comment 1 #define hsMAKE_DotCmd 2 #define hsMAKE_Command 3 int Hilit_MAKE(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); int len1 = len; char *last = p + len1 - 1; for (i = 0; i < Line->Count;) { if (i == 0 && *p == 9) { State = hsMAKE_Command; Color = CLR_Command; } IF_TAB() else { if (i == 0) { if (*p == '.') { State = hsMAKE_DotCmd; Color = CLR_Directive; goto hilit; } else if (*p == '#') { State = hsMAKE_Comment; Color = CLR_Comment; goto hilit; } } switch (State) { case hsMAKE_Comment: Color = CLR_Comment; goto hilit; case hsMAKE_DotCmd: Color = CLR_Directive; goto hilit; case hsMAKE_Command: Color = CLR_Command; goto hilit; default: State = hsMAKE_Normal; Color = CLR_Normal; hilit: ColorNext(); continue; } } } if ((len1 == 0) || (*last != '\\')) { if (State == hsMAKE_Comment || State == hsMAKE_DotCmd || State == hsMAKE_Command) State = hsMAKE_Normal; } *ECol = C; return 0; } efte-1.1/src/clipserv.cpp0000664000076400007640000001231311041404761014442 0ustar laurilauri/* clipserv.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #define INCL_DOS #define INCL_PM #include #include #include #include #include #include "sysdep.h" #define SEM_PREFIX "\\SEM32\\PMCLIPS\\" #define MEM_PREFIX "\\SHAREMEM\\PMCLIPS\\" #define CMD_GET 1 #define CMD_PUT 2 HAB hab; HMQ hmq; QMSG qmsg; HMTX hmtxSyn; HEV hevGet; HEV hevPut; HEV hevEnd; HMUX hmuxWait; void _LNK_CONV clipsrv(void *foo) { HAB hab; HMQ hmq; hab = WinInitialize(0); hmq = WinCreateMsgQueue(hab, 0); while (1) { ULONG ulPostCount; ULONG Cmd; ULONG len; char *text; void *shmem; WinWaitMuxWaitSem(hmuxWait, SEM_INDEFINITE_WAIT, &Cmd); switch (Cmd) { case CMD_GET: DosResetEventSem(hevGet, &ulPostCount); shmem = 0; if ((WinOpenClipbrd(hab) == TRUE) && ((text = (char *) WinQueryClipbrdData(hab, CF_TEXT)) != 0)) { len = strlen(text); puts(text); if (0 == DosAllocSharedMem(&shmem, MEM_PREFIX "CLIPDATA", len + 5, PAG_COMMIT | PAG_WRITE | PAG_READ)) { memcpy(shmem, (void *)&len, 4); memcpy((void *)(((char *)shmem) + sizeof(ULONG)), text, len + 1); } else { DosBeep(200, 500); } } else { /*DosBeep(100, 1500);*/ len = 0; if (0 == DosAllocSharedMem(&shmem, MEM_PREFIX "CLIPDATA", 4, PAG_COMMIT | PAG_WRITE | PAG_READ)) { memcpy(shmem, (void *)&len, 4); } } WinCloseClipbrd(hab); DosPostEventSem(hevEnd); DosWaitEventSem(hevGet, SEM_INDEFINITE_WAIT); DosResetEventSem(hevGet, &ulPostCount); if (shmem) DosFreeMem(shmem); break; case CMD_PUT: DosResetEventSem(hevPut, &ulPostCount); if (0 == DosGetNamedSharedMem(&shmem, MEM_PREFIX "CLIPDATA", PAG_READ | PAG_WRITE)) { if (WinOpenClipbrd(hab) == TRUE) { WinEmptyClipbrd(hab); len = strlen((char *)shmem + 4); if (len) { DosAllocSharedMem((void **)&text, 0, len + 1, PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE); strcpy(text, ((char *)shmem) + 4); if (!WinSetClipbrdData(hab, (ULONG) text, CF_TEXT, CFI_POINTER)) DosBeep(100, 1500); } WinCloseClipbrd(hab); } else { DosBeep(1500, 3500); } } else { DosBeep(500, 7500); } DosPostEventSem(hevEnd); DosWaitEventSem(hevPut, SEM_INDEFINITE_WAIT); DosResetEventSem(hevPut, &ulPostCount); if (shmem) DosFreeMem(shmem); break; } } WinDestroyMsgQueue(hmq); WinTerminate(hab); } int main() { SEMRECORD sem[2]; int rc; rc = DosCreateMutexSem(SEM_PREFIX "CLIPSYN", &hmtxSyn, 0, 0); if (rc != 0) return 1; puts("CLIPSYN"); rc = DosCreateEventSem(SEM_PREFIX "CLIPEND", &hevEnd, 0, 0); if (rc != 0) return 1; puts("CLIPEND"); rc = DosCreateEventSem(SEM_PREFIX "CLIPGET", &hevGet, 0, 0); if (rc != 0) return 1; puts("CLIPGET"); rc = DosCreateEventSem(SEM_PREFIX "CLIPPUT", &hevPut, 0, 0); if (rc != 0) return 1; puts("CLIPPUT"); sem[0].hsemCur = (PULONG) hevGet; sem[0].ulUser = CMD_GET; sem[1].hsemCur = (PULONG) hevPut; sem[1].ulUser = CMD_PUT; rc = DosCreateMuxWaitSem(0, &hmuxWait, 2, sem, DCMW_WAIT_ANY); if (rc != 0) return 1; puts("CLIPMUX"); hab = WinInitialize(0); hmq = WinCreateMsgQueue(hab, 0); #if defined(__EMX__) || defined(__TOS_OS2__) _beginthread(clipsrv, NULL, 8192, 0); #else _beginthread(clipsrv, 8192, 0); #endif while (WinGetMsg(hab, &qmsg, 0, 0, 0)) WinDispatchMsg(hab, &qmsg); WinDestroyMsgQueue(hmq); WinTerminate(hab); return 0; } efte-1.1/src/e_print.cpp0000664000076400007640000001300611041404761014253 0ustar laurilauri/* e_print.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int EBuffer::BlockPrint() { static char cr = 13; static char lf = 10; EPoint B, E; int L; int A, Z; PELine LL; FILE *fp; int bc = 0, lc = 0; int error = 0; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount == 0) return 0; B = BB; E = BE; Msg(S_INFO, "Printing to %s...", PrintDevice); #if !defined(__IBMCPP__) && !defined(__WATCOMC__) if (PrintDevice[0] == '|') fp = popen(PrintDevice + 1, "w"); else #endif fp = fopen(PrintDevice, "w"); if (fp == NULL) { Msg(S_INFO, "Failed to write to %s", PrintDevice); return 0; } for (L = B.Row; L <= E.Row; L++) { A = -1; Z = -1; LL = RLine(L); switch (BlockMode) { case bmLine: if (L < E.Row) { A = 0; Z = LL->Count; } break; case bmColumn: if (L < E.Row) { A = CharOffset(LL, B.Col); Z = CharOffset(LL, E.Col); } break; case bmStream: if (B.Row == E.Row) { A = CharOffset(LL, B.Col); Z = CharOffset(LL, E.Col); } else if (L == B.Row) { A = CharOffset(LL, B.Col); Z = LL->Count; } else if (L < E.Row) { A = 0; Z = LL->Count; } else if (L == E.Row) { A = 0; Z = CharOffset(LL, E.Col); } break; } if (A != -1 && Z != -1) { if (A < LL->Count) { if (Z > LL->Count) Z = LL->Count; if (Z > A) { if ((int)(fwrite(LL->Chars + A, 1, Z - A, fp)) != Z - A) { error++; break; } else bc += Z - A; } } if (BFI(this, BFI_AddCR) == 1) if (fwrite(&cr, 1, 1, fp) != 1) { error++; break; } else bc++; if (BFI(this, BFI_AddLF) == 1) if (fwrite(&lf, 1, 1, fp) != 1) { error++; break; } else { bc++; lc++; } if ((lc % 200) == 0) Msg(S_INFO, "Printing, %d lines, %d bytes.", lc, bc); } } if (!error) { fwrite("\f\n", 2, 1, fp); #if !defined(__IBMCPP__) && !defined(__WATCOMC__) if (PrintDevice[0] == '|') pclose(fp); else #endif fclose(fp); Msg(S_INFO, "Printing %d lines, %d bytes.", lc, bc); return 1; } #if !defined(__IBMCPP__) && !defined(__WATCOMC__) if (PrintDevice[0] == '|') pclose(fp); else #endif fclose(fp); Msg(S_INFO, "Failed to write to %s", PrintDevice); return 0; } int EBuffer::FilePrint() { static char cr = 13; static char lf = 10; int l; FILE *fp; unsigned long ByteCount = 0; int BChars; Msg(S_INFO, "Printing %s to %s...", FileName, PrintDevice); #if !defined(__IBMCPP__) && !defined(__WATCOMC__) if (PrintDevice[0] == '|') fp = popen(PrintDevice + 1, "w"); else #endif fp = fopen(PrintDevice, "w"); if (fp == NULL) { Msg(S_ERROR, "Error printing %s to %s.", FileName, PrintDevice); return 0; } BChars = 0; for (l = 0; l < RCount; l++) { if ((int) sizeof(FileBuffer) - (BChars + 2) < RLine(l)->Count) { if (BChars) { ByteCount += BChars; Msg(S_INFO, "Printing: %d lines, %d bytes.", l, ByteCount); if ((int)(fwrite(FileBuffer, 1, BChars, fp)) != BChars) goto fail; BChars = 0; } } if (RLine(l)->Count > int(sizeof(FileBuffer)) - 2) { assert(BChars == 0); ByteCount += RLine(l)->Count; Msg(S_INFO, "Printing: %d lines, %d bytes.", l, ByteCount); if (int(fwrite(RLine(l)->Chars, 1, RLine(l)->Count, fp)) != RLine(l)->Count) goto fail; } else { memcpy(FileBuffer + BChars, RLine(l)->Chars, RLine(l)->Count); BChars += RLine(l)->Count; } if ((l < RCount - 1) || BFI(this, BFI_ForceNewLine)) { assert(int(sizeof(FileBuffer)) >= BChars + 2); if (BFI(this, BFI_AddCR) == 1) FileBuffer[BChars++] = cr; if (BFI(this, BFI_AddLF) == 1) FileBuffer[BChars++] = lf; } } if (BChars) { ByteCount += BChars; Msg(S_INFO, "Printing: %d lines, %d bytes.", l, ByteCount); if ((int)(fwrite(FileBuffer, 1, BChars, fp)) != BChars) goto fail; } BChars = 0; #if !defined(__IBMCPP__) && !defined(__WATCOMC__) if (PrintDevice[0] == '|') pclose(fp); else #endif fclose(fp); Msg(S_INFO, "Printed %s.", FileName); return 1; fail: if (fp != NULL) { #if !defined(__IBMCPP__) && !defined(__WATCOMC__) if (PrintDevice[0] == '|') pclose(fp); else #endif fclose(fp); } Msg(S_ERROR, "Error printing %s to %s.", FileName, PrintDevice); return 0; } efte-1.1/src/menu_text.cpp0000664000076400007640000005063111043103617014626 0ustar laurilauri/* menu_text.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include #include #include #include #include #include #include #if defined(MSVC) #include #endif #include "console.h" #include "gui.h" #include "c_mode.h" #include "c_color.h" class UpMenu { public: class UpMenu *up; int id; int vert; int x, y, w, h; }; static int GetHOfsItem(int id, int cur) { int pos = 2; int i, len; for (i = 0; i < Menus[id].Count; i++) { if (i == cur) return pos; if (Menus[id].Items[i].Name) { len = CStrLen(Menus[id].Items[i].Name); pos += len + 2; } else pos++; } return -1; } static int GetHPosItem(int id, int X) { int pos = 1; int i, len; for (i = 0; i < Menus[id].Count; i++) { if (Menus[id].Items[i].Name) { len = CStrLen(Menus[id].Items[i].Name); if (X >= pos && X <= pos + len + 1) return i; pos += len + 2; } else pos++; } return -1; } static int DrawHMenu(int x, int y, int id, int active) { int pos = 1; TDrawBuffer B; int i, len; TAttr color1, color2; int Cols, Rows; ConQuerySize(&Cols, &Rows); MoveChar(B, 0, Cols, ' ', hcMenu_Background, Cols); if (id != -1) { for (i = 0; i < Menus[id].Count; i++) { if (i == active) { color1 = hcMenu_ActiveItem; color2 = hcMenu_ActiveChar; } else { color1 = hcMenu_NormalItem; color2 = hcMenu_NormalChar; } if (Menus[id].Items[i].Name) { len = CStrLen(Menus[id].Items[i].Name); MoveChar(B, pos, Cols, ' ', color1, len + 2); MoveCStr(B, pos + 1, Cols, Menus[id].Items[i].Name, color1, color2, len); pos += len + 2; } else { MoveChar(B, pos, Cols, ConGetDrawChar(DCH_V), hcMenu_Background, 1); pos++; } } } ConPutBox(x, y, Cols - x, 1, B); return 1; } static int GetVPosItem(int id, int w, int X, int Y) { if (Y <= 0 || Y > Menus[id].Count) return -1; if (Menus[id].Items[Y - 1].Name == 0) return -1; if (X <= 0 || X >= w - 1) return -1; return Y - 1; } static int GetVSize(int id, int &X, int &Y) { int xsize = 0; int len; Y = Menus[id].Count; for (int i = 0; i < Y; i++) { len = 0; if (Menus[id].Items[i].Name) len = CStrLen(Menus[id].Items[i].Name); if (len > xsize) xsize = len; } X = xsize; return 0; } static int DrawVMenu(int x, int y, int id, int active) { TDrawBuffer B; int i, len; TAttr color1, color2; int w, h; if (id == -1) return -1; GetVSize(id, w, h); w += 4; h += 2; MoveChar(B, 0, w, ConGetDrawChar(DCH_H), hcMenu_Background, w); MoveCh(B, ConGetDrawChar(DCH_C1), hcMenu_Background, 1); MoveCh(B + w - 1, ConGetDrawChar(DCH_C2), hcMenu_Background, 1); ConPutBox(x, y, w, 1, B); for (i = 0; i < Menus[id].Count; i++) { if (i == active) { color1 = hcMenu_ActiveItem; color2 = hcMenu_ActiveChar; } else { color1 = hcMenu_NormalItem; color2 = hcMenu_NormalChar; } if (Menus[id].Items[i].Name) { char name[128]; char *arg = 0; int len2 = 0; strcpy(name, Menus[id].Items[i].Name); arg = strchr(name, '\t'); if (arg) *arg++ = 0; len = CStrLen(name); if (arg) len2 = CStrLen(arg); MoveChar(B, 0, w, ' ', color1, w); MoveCh(B, ConGetDrawChar(DCH_V), hcMenu_Background, 1); MoveCh(B + w - 1, ConGetDrawChar(DCH_V), hcMenu_Background, 1); MoveCStr(B, 2, len + 2, Menus[id].Items[i].Name, color1, color2, len); if (arg) MoveCStr(B, w - len2 - 2, w + 4, arg, color1, color2, len2); if (Menus[id].Items[i].SubMenu != -1) { MoveCh(B + w - 2, ConGetDrawChar(DCH_RPTR), color1, 1); } } else { MoveChar(B, 0, w, ConGetDrawChar(DCH_H), hcMenu_Background, w); MoveCh(B, ConGetDrawChar(DCH_V), hcMenu_Background, 1); MoveCh(B + w - 1, ConGetDrawChar(DCH_V), hcMenu_Background, 1); } ConPutBox(x, y + i + 1, w, 1, B); } MoveChar(B, 0, w, ConGetDrawChar(DCH_H), hcMenu_Background, w); MoveCh(B, ConGetDrawChar(DCH_C3), hcMenu_Background, 1); MoveCh(B + w - 1, ConGetDrawChar(DCH_C4), hcMenu_Background, 1); ConPutBox(x, y + Menus[id].Count + 1, w, 1, B); return 1; } int ExecVertMenu(int x, int y, int id, TEvent &E, UpMenu *up) { int cur = 0; int abort; int w, h; PCell c; PCell SaveC = 0; int SaveX, SaveY, SaveW, SaveH; int wasmouse = 0; UpMenu here; int dovert = 0; int rx; int Cols, Rows; ConQuerySize(&Cols, &Rows); here.up = up; if (x < 0) x = 0; if (y < 0) y = 0; GetVSize(id, w, h); w += 4; h += 2; if (w > Cols) w = Cols; if (h > Rows) h = Rows; if ((x + w) > Cols) if (up && up->x == 0 && up->y == 0 && up->h == 1) { x = Cols - w; } else { if (up) x = up->x - w + 1; else x = x - w + 1; } if ((y + h) > Rows) if (up) y = y - h + 3; else { y = y - h + 1; } if (x < 0) x = 0; if (y < 0) y = 0; here.x = x; here.y = y; here.w = w; here.h = h; here.id = id; here.vert = 1; c = (PCell) malloc(w * h * sizeof(TCell)); if (c) ConGetBox(x, y, w, h, c); SaveC = c; SaveX = x; SaveY = y; SaveW = w; SaveH = h; if (E.What == evMouseMove || E.What == evMouseDown) { } if (E.What & evMouse) { cur = GetVPosItem(id, w, E.Mouse.X - x, E.Mouse.Y - y); dovert = 0; wasmouse = 1; E.What = evNone; } abort = -2; while (abort == -2) { DrawVMenu(x, y, id, cur); if (dovert) { if (cur != -1) { if (Menus[id].Items[cur].SubMenu != -1) { rx = ExecVertMenu(x + w - 1, y + cur, Menus[id].Items[cur].SubMenu, E, &here); if (rx == 1) { abort = 1; continue; } else if (rx == -3) { abort = -3; break; } else abort = -2; } } } ConHideCursor(); do { ConGetEvent(evCommand | evMouseDown | evMouseMove | evMouseUp | evKeyDown | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, frames->Active, E); } while (E.What & evNotify); if (E.What & evMouse) { //fprintf(stderr, "Mouse: %d %d %d\n", E.What, E.Mouse.X, E.Mouse.Y); } dovert = 0; switch (E.What) { case evCommand: if (E.Msg.Command == cmResize) abort = -3; break; case evKeyDown: switch (kbCode(E.Key.Code)) { case kbPgDn: case kbEnd: cur = Menus[id].Count; case kbUp: { int xcur = cur; do { cur--; if (cur < 0) cur = Menus[id].Count - 1; } while (cur != xcur && Menus[id].Items[cur].Name == 0); } break; case kbPgUp: case kbHome: cur = -1; case kbDown: { int xcur = cur; do { cur++; if (cur >= Menus[id].Count) cur = 0; } while (cur != xcur && Menus[id].Items[cur].Name == 0); } break; case kbEsc: abort = -1; break; case kbEnter: if (cur != -1) { if (Menus[id].Items[cur].SubMenu < 0) { E.What = evCommand; E.Msg.View = frames->Active; E.Msg.Command = Menus[id].Items[cur].Cmd; abort = 1; } else { dovert = 1; } } break; case kbLeft: case kbRight: gui->ConPutEvent(E); abort = -1; break; default: if (isAscii(E.Key.Code)) { char cc; int i; cc = char(toupper(char(E.Key.Code & 0xFF))); for (i = 0; i < Menus[id].Count; i++) { if (Menus[id].Items[i].Name) { char *o = strchr(Menus[id].Items[i].Name, '&'); if (o) if (toupper(o[1]) == cc) { cur = i; if (cur != -1) { if (Menus[id].Items[cur].SubMenu == -1) { E.What = evCommand; E.Msg.View = frames->Active; E.Msg.Command = Menus[id].Items[cur].Cmd; abort = 1; } else { dovert = 1; } } break; } } } } } break; case evMouseDown: if (E.Mouse.X >= x && E.Mouse.Y >= y && E.Mouse.X < x + w && E.Mouse.Y < y + h) { cur = GetVPosItem(id, w, E.Mouse.X - x, E.Mouse.Y - y); } else { if (up) gui->ConPutEvent(E); abort = -1; } wasmouse = 1; dovert = 1; break; case evMouseMove: if (E.Mouse.Buttons) { dovert = 1; if (E.Mouse.X >= x && E.Mouse.Y >= y && E.Mouse.X < x + w && E.Mouse.Y < y + h) { cur = GetVPosItem(id, w, E.Mouse.X - x, E.Mouse.Y - y); } else { UpMenu *p = up; int first = 1; if (wasmouse) { while (p) { if (E.Mouse.X >= p->x && E.Mouse.Y >= p->y && E.Mouse.X < p->x + p->w && E.Mouse.Y < p->y + p->h) { if (first == 1) { if (p->vert) { int i = GetVPosItem(p->id, p->w, E.Mouse.X - p->x, E.Mouse.Y - p->y); if (i != -1) if (Menus[p->id].Items[i].SubMenu == id) break; } else { int i = GetHPosItem(p->id, E.Mouse.X); if (i != -1) if (Menus[p->id].Items[i].SubMenu == id) break; } first = 0; } gui->ConPutEvent(E); abort = -1; break; } first = 0; p = p->up; } cur = -1; } else cur = -1; } } break; case evMouseUp: if (E.Mouse.X >= x && E.Mouse.Y >= y && E.Mouse.X < x + w && E.Mouse.Y < y + h) { cur = GetVPosItem(id, w, E.Mouse.X - x, E.Mouse.Y - y); } if (cur == -1) { if (up) { UpMenu *p = up; cur = 0; if (E.Mouse.X >= p->x && E.Mouse.Y >= p->y && E.Mouse.X < p->x + p->w && E.Mouse.Y < p->y + p->h) { if (p->vert) { int i = GetVPosItem(p->id, p->w, E.Mouse.X - p->x, E.Mouse.Y - p->y); if (i != -1) if (Menus[p->id].Items[i].SubMenu == id) break; } else { int i = GetHPosItem(p->id, E.Mouse.X); if (i != -1) if (Menus[p->id].Items[i].SubMenu == id) break; } abort = -1; } } else abort = -1; if (E.Mouse.X >= x && E.Mouse.Y >= y && E.Mouse.X < x + w && E.Mouse.Y < y + h); else { gui->ConPutEvent(E); abort = -3; } } else { if (Menus[id].Items[cur].Name != 0 && Menus[id].Items[cur].SubMenu == -1) { E.What = evCommand; E.Msg.View = frames->Active; E.Msg.Command = Menus[id].Items[cur].Cmd; //fprintf(stderr, "Command set = %d %d %d\n", id, cur, Menus[id].Items[cur].Cmd); abort = 1; } } break; } } if (SaveC) { ConPutBox(SaveX, SaveY, SaveW, SaveH, SaveC); free(SaveC); SaveC = 0; } ConShowCursor(); if (up && abort == -3) return -3; return (abort == 1) ? 1 : -1; } int ExecMainMenu(TEvent &E, char sub) { int cur = 0; int id = GetMenuId(frames->Menu); int abort; int dovert = 1; int rx; static UpMenu top = { 0, 0, 0, 0, 0, 0, 1 }; PCell topline[ConMaxCols]; int Cols, Rows; ConQuerySize(&Cols, &Rows); top.x = 0; top.y = 0; top.h = 1; top.w = Cols; top.id = id; top.vert = 0; ConGetBox(0, 0, Cols, 1, (PCell) topline); if (sub != 0) { int i; for (i = 0; i < Menus[id].Count; i++) { if (Menus[id].Items[i].Name) { char *o = strchr(Menus[id].Items[i].Name, '&'); if (o) if (toupper(o[1]) == toupper(sub)) { cur = i; break; } } } } if (E.What == evMouseDown) { cur = GetHPosItem(id, E.Mouse.X); dovert = 1; } abort = -2; while (abort == -2) { DrawHMenu(0, 0, id, cur); if (dovert) { if (cur != -1) { if (Menus[id].Items[cur].SubMenu != -1) { rx = ExecVertMenu(GetHOfsItem(id, cur) - 2, 1, Menus[id].Items[cur].SubMenu, E, &top); if (rx == 1) { abort = 1; continue; } else if (rx == -3) { abort = -1; break; } else abort = -2; } } } ConHideCursor(); do { ConGetEvent(evCommand | evMouseDown | evMouseMove | evMouseUp | evKeyDown | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, frames->Active, E); } while (E.What & evNotify); dovert = 0; switch (E.What) { case evCommand: if (E.Msg.Command == cmResize) abort = -1; break; case evKeyDown: switch (kbCode(E.Key.Code)) { case kbEnd: cur = Menus[id].Count; case kbLeft: dovert = 1; { int x = cur; do { cur--; if (cur < 0) cur = Menus[id].Count - 1; } while (cur != x && Menus[id].Items[cur].Name == 0); } break; case kbHome: cur = -1; case kbRight: dovert = 1; { int x = cur; do { cur++; if (cur >= Menus[id].Count) cur = 0; } while (cur != x && Menus[id].Items[cur].Name == 0); } break; case kbEsc: abort = -1; dovert = 0; break; case kbEnter: if (cur != -1) { if (Menus[id].Items[cur].SubMenu == -1) { E.What = evCommand; E.Msg.View = frames->Active; E.Msg.Command = Menus[id].Items[cur].Cmd; abort = 1; } else { dovert = 1; } } break; default: if (isAscii(E.Key.Code)) { char cc; int i; cc = char(toupper(char(E.Key.Code & 0xFF))); for (i = 0; i < Menus[id].Count; i++) { if (Menus[id].Items[i].Name) { char *o = strchr(Menus[id].Items[i].Name, '&'); if (o) if (toupper(o[1]) == cc) { cur = i; if (cur != -1) { if (Menus[id].Items[cur].SubMenu == -1) { E.What = evCommand; E.Msg.View = frames->Active; E.Msg.Command = Menus[id].Items[cur].Cmd; abort = 1; } else { dovert = 1; } } break; } } } } break; } break; case evMouseDown: if (E.Mouse.Y == 0) { int oldcur = cur; cur = GetHPosItem(id, E.Mouse.X); if (cur == oldcur) { abort = -1; } } else { cur = -1; abort = -1; } dovert = 1; break; case evMouseMove: if (E.Mouse.Buttons) { if (E.Mouse.Y == 0) cur = GetHPosItem(id, E.Mouse.X); else cur = -1; dovert = 1; } break; case evMouseUp: if (E.Mouse.Y == 0) cur = GetHPosItem(id, E.Mouse.X); if (cur == -1) abort = -1; else { if (Menus[id].Items[cur].Name != 0 && Menus[id].Items[cur].SubMenu == -1) { E.What = evCommand; E.Msg.View = frames->Active; E.Msg.Command = Menus[id].Items[cur].Cmd; abort = 1; } } break; } } DrawHMenu(0, 0, id, -1); ConPutBox(0, 0, Cols, 1, (PCell) topline); ConShowCursor(); return (abort == 1) ? 1 : -1; } void GFrame::DrawMenuBar() { int id = GetMenuId(Menu); DrawHMenu(0, 0, id, -1); } extern TEvent NextEvent; int GFrame::PopupMenu(const char *Name) { NextEvent.What = evCommand; NextEvent.Msg.Command = cmPopupMenu; NextEvent.Msg.Param1 = GetMenuId(Name); return 0; } efte-1.1/src/c_desktop.cpp0000664000076400007640000001003711041421333014561 0ustar laurilauri/* c_desktop.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #define DESKTOP_VER "eFTE Desktop 2\n" #define DESKTOP_VER1 "eFTE Desktop 1\n" char DesktopFileName[256] = ""; int SaveDesktop(char *FileName) { FILE *fp; EModel *M; fp = fopen(FileName, "w"); if (fp == 0) return 0; setvbuf(fp, FileBuffer, _IOFBF, sizeof(FileBuffer)); fprintf(fp, DESKTOP_VER); M = ActiveModel; while (M) { switch (M->GetContext()) { case CONTEXT_FILE: if (M != CvsLogView) { EBuffer *B = (EBuffer *)M; fprintf(fp, "F|%d|%s\n", B->ModelNo, B->FileName); } break; case CONTEXT_DIRECTORY: { EDirectory *D = (EDirectory *)M; fprintf(fp, "D|%d|%s\n", D->ModelNo, D->Path); } break; } M = M->Next; if (M == ActiveModel) break; } TagsSave(fp); markIndex.saveToDesktop(fp); fclose(fp); return 1; } int LoadDesktop(char *FileName) { FILE *fp; char line[512]; char *p, *e; int FLCount = 0; TagClear(); fp = fopen(FileName, "r"); if (fp == 0) return 0; //setvbuf(fp, FileBuffer, _IOFBF, sizeof(FileBuffer)); if (fgets(line, sizeof(line), fp) == 0 || (strcmp(line, DESKTOP_VER) != 0 && (strcmp(line, DESKTOP_VER1) != 0))) { fclose(fp); return 0; } while (fgets(line, sizeof(line), fp) != 0) { e = strchr(line, '\n'); if (e == 0) break; *e = 0; if ((line[0] == 'D' || line[0] == 'F') && line[1] == '|') { int ModelNo = -1; p = line + 2; if (isdigit(*p)) { ModelNo = atoi(p); while (isdigit(*p)) p++; if (*p == '|') p++; } if (line[0] == 'F') { // file if (FLCount > 0) suspendLoads = 1; if (FileLoad(0, p, 0, ActiveView)) FLCount++; suspendLoads = 0; } else if (line[0] == 'D') { // directory EModel *m = new EDirectory(0, &ActiveModel, p); if (m == 0 || ActiveModel == 0) { ActiveView->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Could not create directory view"); return 0; } } if (ActiveModel) { if (ModelNo != -1) { if (FindModelID(ActiveModel, ModelNo) == 0) ActiveModel->ModelNo = ModelNo; } if (ActiveModel != ActiveModel->Next) { suspendLoads = 1; ActiveView->SelectModel(ActiveModel->Next); suspendLoads = 0; } } } else { if (line[0] == 'T' && line[1] == '|') { // tag file TagsAdd(line + 2); } else if (line[0] == 'M' && line[1] == '|') { // mark char *name; char *file; EPoint P; //long l; char *c; p = line + 2; P.Row = strtol(p, &c, 10); if (*c != '|') break; p = c + 1; P.Col = strtol(p, &c, 10); if (*c != '|') break; p = c + 1; name = p; while (*p && *p != '|') p++; if (*p == '|') *p++ = 0; else break; file = p; markIndex.insert(name, file, P); } } } fclose(fp); return 1; } efte-1.1/src/o_svnbase.cpp0000664000076400007640000002660611041404761014604 0ustar laurilauri/* * o_svnbase.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * S.Pinigin copy o_cvsbase.cpp and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Base class for all other SVN-related classes. This is similar to EMessages * - starts SVN and shows its messages in list view. */ #include "fte.h" #include "c_commands.h" #include "o_svnbase.h" #define MAXREGEXP 32 static int SvnIgnoreRegexpCount = 0; static RxNode *SvnIgnoreRegexp[MAXREGEXP]; int AddSvnIgnoreRegexp(const char *regexp) { if (SvnIgnoreRegexpCount >= MAXREGEXP) return 0; if ((SvnIgnoreRegexp[SvnIgnoreRegexpCount] = RxCompile(regexp)) == NULL) return 0; SvnIgnoreRegexpCount++; return 1; } void FreeSvnIgnoreRegexp() { while (SvnIgnoreRegexpCount--) { RxFree(SvnIgnoreRegexp[SvnIgnoreRegexpCount]); } } ESvnBase::ESvnBase(int createFlags, EModel **ARoot, const char *title): EList(createFlags, ARoot, title) { LineCount = 0; Lines = 0; Running = 0; BufLen = 0; BufPos = 0; Command = 0; Directory = 0; OnFiles = 0; ReturnCode = -1; PipeId = -1; } ESvnBase::~ESvnBase() { gui->ClosePipe(PipeId); FreeLines(); free(Command); free(Directory); free(OnFiles); } void ESvnBase::FreeLines() { if (Lines) { for (int i = 0;i < LineCount;i++) { if (Lines[i]->Buf && Lines[i]->Line >= 0) { // Has buffer and line == bookmark -> remove it char book[16]; sprintf(book, "_SVN.%d", i); Lines[i]->Buf->RemoveBookmark(book); } free(Lines[i]->Msg); free(Lines[i]->File); free(Lines[i]); } free(Lines); } LineCount = 0; Lines = 0; BufLen = BufPos = 0; } void ESvnBase::AddLine(char *file, int line, const char* msg, int status) { SvnLine *l; l = (SvnLine *)malloc(sizeof(SvnLine)); if (l != 0) { l->File = file ? strdup(file) : 0; l->Line = line; l->Msg = msg ? strdup(msg) : 0; l->Buf = 0; l->Status = status; LineCount++; Lines = (SvnLine **)realloc(Lines, sizeof(SvnLine *) * LineCount); Lines[LineCount-1] = l; FindBuffer(LineCount - 1); UpdateList(); } } void ESvnBase::FindBuffer(int line) { assert(line >= 0 && line < LineCount); if (Lines[line]->File != 0) { EBuffer *B; Lines[line]->Buf = 0; char path[MAXPATH]; strcpy(path, Directory); Slash(path, 1); strcat(path, Lines[line]->File); B = FindFile(path); if (B != 0 && B->Loaded != 0) AssignBuffer(B, line); } } void ESvnBase::AssignBuffer(EBuffer *B, int line) { assert(line >= 0 && line < LineCount); char book[16]; EPoint P; Lines[line]->Buf = B; if (Lines[line]->Line >= 0) { sprintf(book, "_SVN.%d", line); P.Col = 0; P.Row = Lines[line]->Line; if (P.Row >= B->RCount) P.Row = B->RCount - 1; B->PlaceBookmark(book, P); } } void ESvnBase::FindFileLines(EBuffer *B) { char path[MAXPATH]; char *pos; strcpy(path, Directory); Slash(path, 1); pos = path + strlen(path); for (int i = 0;i < LineCount;i++) if (Lines[i]->Buf == 0 && Lines[i]->File != 0) { strcpy(pos, Lines[i]->File); if (filecmp(B->FileName, path) == 0) { AssignBuffer(B, i); } } } void ESvnBase::NotifyDelete(EModel *Deleting) { for (int i = 0;i < LineCount;i++) { if (Lines[i]->Buf == Deleting) { Lines[i]->Buf = 0; } } } int ESvnBase::GetLine(char *Line, int max) { int rc; char *p; int l; //fprintf(stderr, "GetLine: %d\n", Running); *Line = 0; if (Running && PipeId != -1) { rc = gui->ReadPipe(PipeId, MsgBuf + BufLen, sizeof(MsgBuf) - BufLen); //fprintf(stderr, "GetLine: ReadPipe rc = %d\n", rc); if (rc == -1) { ContinuePipe(); } if (rc > 0) BufLen += rc; } l = max - 1; if (BufLen - BufPos < l) l = BufLen - BufPos; //fprintf(stderr, "GetLine: Data %d\n", l); p = (char *)memchr(MsgBuf + BufPos, '\n', l); if (p) { *p = 0; strcpy(Line, MsgBuf + BufPos); l = strlen(Line); if (l > 0 && Line[l - 1] == '\r') Line[l - 1] = 0; BufPos = p + 1 - MsgBuf; //fprintf(stderr, "GetLine: Line %d\n", strlen(Line)); } else if (Running && sizeof(MsgBuf) != BufLen) { memmove(MsgBuf, MsgBuf + BufPos, BufLen - BufPos); BufLen -= BufPos; BufPos = 0; //fprintf(stderr, "GetLine: Line Incomplete\n"); return 0; } else { if (l == 0) return 0; memcpy(Line, MsgBuf + BufPos, l); Line[l] = 0; if (l > 0 && Line[l - 1] == '\r') Line[l - 1] = 0; BufPos += l; //fprintf(stderr, "GetLine: Line Last %d\n", l); } memmove(MsgBuf, MsgBuf + BufPos, BufLen - BufPos); BufLen -= BufPos; BufPos = 0; //fprintf(stderr, "GetLine: Got Line\n"); return 1; } void ESvnBase::ParseLine(char *line, int) { AddLine(0, -1, line); } void ESvnBase::NotifyPipe(int APipeId) { if (APipeId == PipeId) { char line[1024]; RxMatchRes RM; int i; while (GetLine((char *)line, sizeof(line))) { int len = strlen(line); if (len > 0 && line[len-1] == '\n') line[--len] = 0; for (i = 0;i < SvnIgnoreRegexpCount;i++) if (RxExec(SvnIgnoreRegexp[i], line, len, line, &RM) == 1) break; if (i == SvnIgnoreRegexpCount) ParseLine(line, len); } if (!Running) { char s[30]; sprintf(s, "[done, status=%d]", ReturnCode); AddLine(0, -1, s); } } } int ESvnBase::RunPipe(char *ADir, char *ACommand, char *AOnFiles) { free(Command); free(Directory); free(OnFiles); Command = strdup(ACommand); Directory = strdup(ADir); OnFiles = strdup(AOnFiles); ReturnCode = -1; Row = LineCount - 1; OnFilesPos = OnFiles; { char s[2*MAXPATH*4]; sprintf(s, "[running svn in '%s']", Directory); AddLine(0, -1, s); } ChangeDir(Directory); return ContinuePipe(); } int ESvnBase::ContinuePipe() { char RealCommand[2048]; size_t space; if (!OnFilesPos) { // At the end of all files, terminate ClosePipe(); return 0; } else if (Running) { // Already running, close the pipe and continue ReturnCode = gui->ClosePipe(PipeId); } else { // Not running -> set to Running mode Running = 1; } // Make real command with some files from OnFiles, update OnFilesPos strcat(strcpy(RealCommand, Command), " "); space = sizeof(RealCommand) - strlen(RealCommand) - 1; if (space >= strlen(OnFilesPos)) { strcat(RealCommand, OnFilesPos); OnFilesPos = NULL; } else { char c = OnFilesPos[space]; OnFilesPos[space] = 0; char *s = strrchr(OnFilesPos, ' '); OnFilesPos[space] = c; if (!s) { ClosePipe(); return 0; } *s = 0; strcat(RealCommand, OnFilesPos); OnFilesPos = s + 1; while (*OnFilesPos == ' ') OnFilesPos++; if (!*OnFilesPos) OnFilesPos = NULL; } BufLen = BufPos = 0; { char s[sizeof(RealCommand)+32]; sprintf(s, "[continuing: '%s']", RealCommand); AddLine(0, -1, s); } PipeId = gui->OpenPipe(RealCommand, this); return 0; } void ESvnBase::ClosePipe() { ReturnCode = gui->ClosePipe(PipeId); PipeId = -1; Running = 0; } void ESvnBase::DrawLine(PCell B, int Line, int Col, ChColor color, int Width) { if (Line < LineCount) if (Col < (int)strlen(Lines[Line]->Msg)) { char str[1024]; int len; len = UnTabStr(str, sizeof(str), Lines[Line]->Msg, strlen(Lines[Line]->Msg)); if (len > Col) MoveStr(B, 0, Width, str + Col, color, Width); } } char *ESvnBase::FormatLine(int Line) { if (Line < LineCount) return strdup(Lines[Line]->Msg); else return 0; } void ESvnBase::UpdateList() { if (LineCount <= Row || Row >= Count - 1) Row = LineCount - 1; Count = LineCount; EList::UpdateList(); } int ESvnBase::Activate(int No) { ShowLine(View, No); return 1; } int ESvnBase::CanActivate(int Line) { return Line < LineCount && Lines[Line]->File; } int ESvnBase::IsHilited(int Line) { return Line < LineCount && (Lines[Line]->Status&1); } int ESvnBase::IsMarked(int Line) { return Line < LineCount && (Lines[Line]->Status&2); } int ESvnBase::Mark(int Line) { if (Line < LineCount) { if (Lines[Line]->Status&4) Lines[Line]->Status |= 2; return 1; } else return 0; } int ESvnBase::Unmark(int Line) { if (Line < LineCount) { if (Lines[Line]->Status&4) Lines[Line]->Status &= ~2; return 1; } else return 0; } int ESvnBase::ExecCommand(int Command, ExState &State) { switch (Command) { case ExChildClose: if (Running == 0 || PipeId == -1) break; ClosePipe(); { char s[30]; sprintf(s, "[aborted, status=%d]", ReturnCode); AddLine(0, -1, s); } return ErOK; case ExActivateInOtherWindow: ShowLine(View->Next, Row); return ErOK; } return EList::ExecCommand(Command, State); } void ESvnBase::ShowLine(EView *V, int line) { if (line >= 0 && line < LineCount && Lines[line]->File) { if (Lines[line]->Buf != 0) { V->SwitchToModel(Lines[line]->Buf); if (Lines[line]->Line != -1) { char book[16]; sprintf(book, "_SVN.%d", line); Lines[line]->Buf->GotoBookmark(book); } } else { char path[MAXPATH]; strcpy(path, Directory); Slash(path, 1); strcat(path, Lines[line]->File); if (FileLoad(0, path, 0, V) == 1) { V->SwitchToModel(ActiveModel); if (Lines[line]->Line != -1)((EBuffer *)ActiveModel)->CenterNearPosR(0, Lines[line]->Line); } } } } // Event map - this name is used in config files when defining eventmap EEventMap *ESvnBase::GetEventMap() { return FindEventMap("SVNBASE"); } // Shown in "Closing xxx..." message when closing model void ESvnBase::GetName(char *AName, int MaxLen) { strncpy(AName, Title, MaxLen); } // Shown in buffer list void ESvnBase::GetInfo(char *AInfo, int MaxLen) { char format[128]; sprintf(format, "%2d %04d/%03d %s (%%.%is) ", ModelNo, Row, Count, Title, MaxLen - 24 - (int)strlen(Title)); sprintf(AInfo, format, Command); } // Used to get default directory of model void ESvnBase::GetPath(char *APath, int MaxLen) { strncpy(APath, Directory, MaxLen); APath[MaxLen-1] = 0; Slash(APath, 0); } // Normal and short title (normal for window, short for icon in X) void ESvnBase::GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen) { char format[128]; sprintf(format, "%s: %%.%is", Title, MaxLen - 4 - (int)strlen(Title)); sprintf(ATitle, format, Command); strncpy(ASTitle, Title, SMaxLen); ASTitle[SMaxLen-1] = 0; } efte-1.1/src/o_svndiff.cpp0000664000076400007640000001120511041404761014567 0ustar laurilauri/* * o_svndiff.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * S.Pinigin copy o_cvsdiff.cpp and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Class showing output from SVN diff command. Allows copying of lines * to clipboard and allows to jump to lines in real sources. */ #include "fte.h" ESvnDiff *SvnDiffView = 0; ESvnDiff::ESvnDiff(int createFlags, EModel ** ARoot, char *ADir, char *ACommand, char *AOnFiles): ESvnBase(createFlags, ARoot, "SVN diff") { SvnDiffView = this; CurrFile = 0; CurrLine = 0; ToLine = 0; InToFile = 0; RunPipe(ADir, ACommand, AOnFiles); } ESvnDiff::~ESvnDiff() { SvnDiffView = 0; free(CurrFile); } void ESvnDiff::ParseFromTo(char *line, int /*len */) { char *start; char *end; // "@@ -1,20 +1,20 @@" // ^ ^^ start = strchr(line, '+'); CurrLine = strtol(start, &end, 10) - 1; if (*end == ',') ToLine = CurrLine + atoi(end + 1); else ToLine = CurrLine + 1; if (!(CurrLine < ToLine && ToLine > 0)) CurrLine = ToLine = 0; } //AddLine(0, -1, line); - output only, default color //AddLine(CurrFile, -1, line); - output and tofile, default color //AddLine(CurrFile, CurrLine, line); - output and tofile in line, default color //AddLine(CurrFile, CurrLine, line, 1); - output and tofile in line, color 1 void ESvnDiff::ParseLine(char *line, int len) { if (len > 8 && strncmp(line, "+++ ", 4) == 0) { //"+++ test.txt\t...." free(CurrFile); CurrFile = strdup(line + 4); strtok(CurrFile, " \t"); CurrLine = ToLine = InToFile = 0; AddLine(CurrFile, -1, line); } else { if (len > 8 && strncmp(line, "@@ ", 3) == 0) { // To file or to hunk if (strcmp(line + len - 3, " @@") == 0) { // "@@ -1,20 +1,20 @@" // To hunk if (CurrFile) { ParseFromTo(line, len); AddLine(CurrFile, CurrLine, line, 2); } else { AddLine(0, -1, line); } } else { AddLine(0, -1, line); } } else { if (CurrLine < ToLine) { // Diff line (markable, if CurrFile is set, also hilited) if (*line == '+') { //"+(new line from file)" AddLine(CurrFile, CurrLine, line, 1); CurrLine++; } else { if (*line == '-') { //"-(deleted line from file)" AddLine(0, -1, line); } else { //" (line without change)" AddLine(CurrFile, CurrLine, line); CurrLine++; } } } else { AddLine(0, -1, line); } } } } int ESvnDiff::RunPipe(char *ADir, char *ACommand, char *AOnFiles) { FreeLines(); free(CurrFile); CurrLine = ToLine = InToFile = 0; CurrFile = 0; return ESvnBase::RunPipe(ADir, ACommand, AOnFiles); } int ESvnDiff::ExecCommand(int Command, ExState & State) { switch (Command) { case ExBlockCopy: return BlockCopy(0); case ExBlockCopyAppend: return BlockCopy(1); } return EList::ExecCommand(Command, State); } int ESvnDiff::BlockCopy(int Append) { if (SSBuffer == 0) return ErFAIL; if (Append) { if (SystemClipboard) GetPMClip(0); } else SSBuffer->Clear(); SSBuffer->BlockMode = bmLine; // How to set these two ? BFI(SSBuffer, BFI_TabSize) = 8; BFI(SSBuffer, BFI_ExpandTabs) = 0; BFI(SSBuffer, BFI_Undo) = 0; // Go through list of marked lines int last = -1, tl = 0; for (int i = 0; i < LineCount; i++) { if (Lines[i]->Status & 2) { // Marked if (last != i - 1 && tl) { // Gap between this and last marked line SSBuffer->InsLine(tl++, 0); } SSBuffer->InsertLine(tl++, strlen(Lines[i]->Msg + 2), Lines[i]->Msg + 2); last = i; } } if (SystemClipboard) PutPMClip(0); return ErOK; } // Event map - this name is used in config files when defining eventmap EEventMap * ESvnDiff::GetEventMap() { return FindEventMap("SVNDIFF"); } efte-1.1/src/bin2c.cpp0000664000076400007640000000150311041404761013607 0ustar laurilauri/* * bin2c - binary to C header compiler * */ #include "sysdep.h" #define BUFLEN (64 * 1024) unsigned char buf[BUFLEN]; int main(int argc, char **argv) { int fd; int i, n = 1, len; if (argc != 2) { fprintf(stderr, "Usage: %s filename\n", argv[0]); exit(1); } if ((fd = open(argv[1], O_RDONLY | O_BINARY)) == -1) { fprintf(stderr, "Open: %s, error=%d\n", argv[1], errno); exit(1); } printf("/* do not edit */\nunsigned char DefaultConfig[] = {\n"); while ((len = read(fd, buf, BUFLEN)) > 0) { for (i = 0; i < len; i++) { printf("0x%02.02X", buf[i]); if (n++ % 10) { printf(", "); } else { printf(",\n"); } } } close(fd); printf("\n};\n"); return 0; } efte-1.1/src/e_unix.cpp0000664000076400007640000000444111041404761014105 0ustar laurilauri/* e_unix.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1997, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifdef WINNT #include "e_win32.cpp" #else // UNIX specific routines #include "fte.h" #include #include int EView::SysShowHelp(ExState &State, const char *word) { char options[128] = ""; char command[1024]; char file[MAXPATH]; if (State.GetStrParam(this, options, sizeof(options) - 1) == 0) options[0] = 0; char wordAsk[64] = ""; if (word == 0) { if (State.GetStrParam(this, wordAsk, sizeof(wordAsk) - 1) == 0) if (MView->Win->GetStr("Keyword", sizeof(wordAsk) - 1, wordAsk, HIST_DEFAULT) == 0) return 0; word = wordAsk; } snprintf(file, sizeof(file) - 1, "/tmp/efte%d-man-%s", getpid(), word); snprintf(command, sizeof(command) - 1, "%s %s %s >'%s' 2>&1", HelpCommand, options, word, file); /// !!! why is this needed ??? #define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) pid_t pid; int err, status; Msg(S_INFO, "Retrieving man page for %s, please wait", word); if ((pid = fork()) == 0) { close(1); SYSCALL(err = open(file, O_CREAT | O_WRONLY | O_APPEND, S_IRWXU)); if (err != -1) { close(2); //dup(1); // ignore error output close(0); assert(open("/dev/null", O_RDONLY) == 0); execlp("man", "man", #ifndef AIX // current AIX's don't like the -a. "-a", #endif word, NULL); // execlp("/bin/sh", "sh", "-c", command, NULL); } perror("Can't Exec Command\n"); exit(-1); } else if (pid < 0) { perror("Can't fork"); return 0; } SYSCALL(err = waitpid(pid, &status, 0)); if (err == -1) { perror("Waitpid failed\n"); return 0; } // int rc = system(command); err = FileLoad(0, file, "CATBS", this); unlink(file); if (err == 0) { Msg(S_ERROR, "Error code %d retrieving manpage for %s", err, word); return 0; } return 1; } #endif efte-1.1/src/g_text.cpp0000664000076400007640000007415411041404761014120 0ustar laurilauri/* g_text.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include #include #include #include #include #include #if defined(MSVC) #include #endif #include "console.h" #include "gui.h" #include "c_mode.h" #include "c_color.h" #if defined(_DEBUG) && defined(MSVC) && defined(MSVCDEBUG) #include #define new new( _CLIENT_BLOCK, __FILE__, __LINE__) #endif //_DEBUG && MSVC && MSVCDEBUG int ShowVScroll = 1; int ShowHScroll = 1; int ShowMenuBar = 1; int ShowToolBar = 0; unsigned long HaveGUIDialogs = 0; // no gui dialogs in text gui GFrame *frames = 0; GUI *gui = 0; GView *MouseCapture = 0; GView *FocusCapture = 0; TEvent NextEvent = { 0 }; #define sfFocus 1 class UpMenu; extern int ExecMainMenu(TEvent &E, char sub); extern int ExecVertMenu(int x, int y, int id, TEvent &E, UpMenu *up); class GViewPeer { public: GView *View; int wX, wY, wW, wH, wState; int cX, cY, cVisible; int sbVstart, sbVamount, sbVtotal, sbVupdate; int sbHstart, sbHamount, sbHtotal, sbHupdate; int SbVBegin, SbVEnd, SbHBegin, SbHEnd; bool insertState; GViewPeer(GView *view, int XSize, int YSize); ~GViewPeer(); int ConPutBox(int X, int Y, int W, int H, PCell Cell); int ConGetBox(int X, int Y, int W, int H, PCell Cell); int ConPutLine(int X, int Y, int W, int H, PCell Cell); int ConSetBox(int X, int Y, int W, int H, TCell Cell); int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); int ConSetCursorPos(int X, int Y); int ConQueryCursorPos(int *X, int *Y); int ConShowCursor(); int ConHideCursor(); int ConCursorVisible(); void ConSetInsertState(bool insert); int CaptureMouse(int grab); int CaptureFocus(int grab); int QuerySbVPos(); int SetSbVPos(int Start, int Amount, int Total); int SetSbHPos(int Start, int Amount, int Total); int ExpandHeight(int DeltaY); int DrawScrollBar(); int UpdateCursor(); }; class GFramePeer { public: int fW, fH; GFrame *Frame; GFramePeer(GFrame *aFrame, int Width, int Height); ~GFramePeer(); int ConSetTitle(char *Title, char *STitle); int ConGetTitle(char *Title, int MaxLen, char *STitle, int SMaxLen); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); }; /////////////////////////////////////////////////////////////////////////// GViewPeer::GViewPeer(GView *view, int XSize, int YSize) { View = view; wX = 0; wY = 0; wW = XSize; wH = YSize; sbVtotal = 0; sbVstart = 0; sbVamount = 0; sbVupdate = 1; sbHtotal = 0; sbHstart = 0; sbHamount = 0; sbHupdate = 1; wState = 0; cVisible = 1; cX = cY = 0; } GViewPeer::~GViewPeer() { if (MouseCapture == View) MouseCapture = 0; if (FocusCapture == View) FocusCapture = 0; } int GViewPeer::ConPutBox(int X, int Y, int W, int H, PCell Cell) { return ::ConPutBox(X + wX, Y + wY, W, H, Cell); } int GViewPeer::ConGetBox(int X, int Y, int W, int H, PCell Cell) { return ::ConGetBox(X + wX, Y + wY, W, H, Cell); } int GViewPeer::ConPutLine(int X, int Y, int W, int H, PCell Cell) { return ::ConPutLine(X + wX, Y + wY, W, H, Cell); } int GViewPeer::ConSetBox(int X, int Y, int W, int H, TCell Cell) { return ::ConSetBox(X + wX, Y + wY, W, H, Cell); } int GViewPeer::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { return ::ConScroll(Way, X + wX, Y + wY, W, H, Fill, Count); } int GViewPeer::ConSetSize(int X, int Y) { wW = X; wH = Y; return 1; } int GViewPeer::ConQuerySize(int *X, int *Y) { if (X) *X = wW; if (Y) *Y = wH; return 1; } int GViewPeer::ConSetCursorPos(int X, int Y) { if (X < 0) X = 0; if (X >= wW) X = wW - 1; if (Y < 0) Y = 0; if (Y >= wH) Y = wH - 1; cX = X; cY = Y; if (wState & sfFocus) return ::ConSetCursorPos(cX + wX, cY + wY); else return 1; } int GViewPeer::ConQueryCursorPos(int *X, int *Y) { if (X) *X = cX; if (Y) *Y = cY; return 1; } int GViewPeer::ConShowCursor() { cVisible = 1; if (wState & sfFocus) return ::ConShowCursor(); else return 1; } int GViewPeer::ConHideCursor() { cVisible = 0; if (wState & sfFocus) return ::ConHideCursor(); else return 1; } int GViewPeer::ConCursorVisible() { return cVisible; } void GViewPeer::ConSetInsertState(bool insert) { insertState = insert; ::ConSetInsertState(insert); } int GViewPeer::CaptureMouse(int grab) { if (MouseCapture == 0) { if (grab) MouseCapture = View; else return 0; } else { if (grab || MouseCapture != View) return 0; else MouseCapture = 0; } return 1; } int GViewPeer::CaptureFocus(int grab) { if (FocusCapture == 0) { if (grab) FocusCapture = View; else return 0; } else { if (grab || FocusCapture != View) return 0; else FocusCapture = 0; } return 1; } int GViewPeer::ExpandHeight(int DeltaY) { if (View->Parent->Top == View->Next) return -1; if (DeltaY + wH < 3) DeltaY = - (wH - 3); if (View->Next->Peer->wH - DeltaY < 3) DeltaY = View->Next->Peer->wH - 3; View->Peer->ConSetSize(wW, wH + DeltaY); View->Next->Peer->wY += DeltaY; View->Next->Peer->ConSetSize(View->Next->Peer->wW, View->Next->Peer->wH - DeltaY); View->Resize(View->Peer->wW, View->Peer->wH); View->Next->Resize(View->Next->Peer->wW, View->Next->Peer->wH); return 0; } int GViewPeer::QuerySbVPos() { return sbVstart; } int GViewPeer::SetSbVPos(int Start, int Amount, int Total) { if (sbVstart != Start || sbVamount != Amount || sbVtotal != Total) { sbVstart = Start; sbVamount = Amount; sbVtotal = Total; sbVupdate = 1; // DrawScrollBar(); } return 1; } int GViewPeer::SetSbHPos(int Start, int Amount, int Total) { if (sbHstart != Start || sbHamount != Amount || sbHtotal != Total) { sbHstart = Start; sbHamount = Amount; sbHtotal = Total; sbHupdate = 1; // DrawScrollBar(); } return 1; } int GViewPeer::UpdateCursor() { ConSetCursorPos(cX, cY); ConSetInsertState(insertState); if (cVisible) ConShowCursor(); else ConHideCursor(); return 0; } int GViewPeer::DrawScrollBar() { TDrawBuffer B; int NRows, NCols, I; int W, H; char fore = ConGetDrawChar(DCH_HFORE); char back = ConGetDrawChar(DCH_HBACK); ConQuerySize(&W, &H); if (ShowVScroll) { MoveCh(B, ConGetDrawChar(DCH_AUP), hcScrollBar_Arrows, 1); ConPutBox(W, 0, 1, 1, B); MoveCh(B, ConGetDrawChar(DCH_ADOWN), hcScrollBar_Arrows, 1); ConPutBox(W, H - 1, 1, 1, B); NRows = H - 2; if (sbVtotal <= NRows) { SbVBegin = 0; SbVEnd = NRows - 1; } else { SbVBegin = NRows * sbVstart / sbVtotal; SbVEnd = SbVBegin + NRows * sbVamount / sbVtotal; } for (I = 0; I < NRows; I++) { if (I >= SbVBegin && I <= SbVEnd) MoveCh(B, fore, hcScrollBar_Fore, 1); else MoveCh(B, back, hcScrollBar_Back, 1); ConPutBox(W, I + 1, 1, 1, B); } } if (ShowHScroll) { MoveCh(B, ConGetDrawChar(DCH_ALEFT), hcScrollBar_Arrows, 1); ConPutBox(0, H, 1, 1, B); MoveCh(B, ConGetDrawChar(DCH_ARIGHT), hcScrollBar_Arrows, 1); ConPutBox(W - 1, H, 1, 1, B); NCols = W - 2; if (sbHtotal <= NCols) { SbHBegin = 0; SbHEnd = NCols - 1; } else { SbHBegin = NCols * sbHstart / sbHtotal; SbHEnd = SbHBegin + NCols * sbHamount / sbHtotal; } // could be made faster for (I = 0; I < NCols; I++) { if (I >= SbHBegin && I <= SbHEnd) MoveCh(B, fore, hcScrollBar_Fore, 1); else MoveCh(B, back, hcScrollBar_Back, 1); ConPutBox(I + 1, H, 1, 1, B); } } if (ShowVScroll && ShowHScroll) { MoveCh(B, ' ', hcScrollBar_Arrows, 1); ConPutBox(W, H, 1, 1, B); } return 0; } /////////////////////////////////////////////////////////////////////////// GView::GView(GFrame *parent, int XSize, int YSize) { Parent = parent; Prev = Next = 0; Peer = new GViewPeer(this, XSize, YSize); if (Parent) Parent->AddView(this); } GView::~GView() { if (Parent) Parent->RemoveView(this); delete Peer; } int GView::ConClear() { int W, H; TDrawBuffer B; ConQuerySize(&W, &H); MoveChar(B, 0, W, ' ', 0x07, 1); ConSetBox(0, 0, W, H, B[0]); return 1; } int GView::ConPutBox(int X, int Y, int W, int H, PCell Cell) { return Peer->ConPutBox(X, Y, W, H, Cell); } int GView::ConGetBox(int X, int Y, int W, int H, PCell Cell) { return Peer->ConGetBox(X, Y, W, H, Cell); } int GView::ConPutLine(int X, int Y, int W, int H, PCell Cell) { return Peer->ConPutLine(X, Y, W, H, Cell); } int GView::ConSetBox(int X, int Y, int W, int H, TCell Cell) { return Peer->ConSetBox(X, Y, W, H, Cell); } int GView::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { return Peer->ConScroll(Way, X, Y, W, H, Fill, Count); } int GView::ConSetSize(int X, int Y) { if (Peer->ConSetSize(X, Y)) Resize(X, Y); else return 0; return 1; } int GView::ConQuerySize(int *X, int *Y) { return Peer->ConQuerySize(X, Y); } int GView::ConSetCursorPos(int X, int Y) { return Peer->ConSetCursorPos(X, Y); } int GView::ConQueryCursorPos(int *X, int *Y) { return Peer->ConQueryCursorPos(X, Y); } int GView::ConShowCursor() { return Peer->ConShowCursor(); } int GView::ConHideCursor() { return Peer->ConHideCursor(); } int GView::ConCursorVisible() { return Peer->ConCursorVisible(); } void GView::ConSetInsertState(bool insert) { Peer->ConSetInsertState(insert); } int GView::CaptureMouse(int grab) { return Peer->CaptureMouse(grab); } int GView::CaptureFocus(int grab) { return Peer->CaptureFocus(grab); } int GView::QuerySbVPos() { return Peer->QuerySbVPos(); } int GView::SetSbVPos(int Start, int Amount, int Total) { return Peer->SetSbVPos(Start, Amount, Total); } int GView::SetSbHPos(int Start, int Amount, int Total) { return Peer->SetSbHPos(Start, Amount, Total); } int GView::ExpandHeight(int DeltaY) { return Peer->ExpandHeight(DeltaY); } void GView::Update() { } void GView::Repaint() { } void GView::HandleEvent(TEvent &/*Event*/) { } void GView::Resize(int /*width*/, int /*height*/) { Repaint(); } void GView::EndExec(int NewResult) { Result = NewResult; } int GView::Execute() { int SaveRc = Result; int NewResult; int didFocus = 0; if (FocusCapture == 0) { if (CaptureFocus(1) == 0) return -1; didFocus = 1; } else if (FocusCapture != this) return -1; Result = -2; while (Result == -2 && frames != 0) gui->ProcessEvent(); NewResult = Result; Result = SaveRc; if (didFocus) CaptureFocus(0); return NewResult; } int GView::IsActive() { return (Parent->Active == this); } void GView::Activate(int gotfocus) { if (gotfocus) { Peer->wState |= sfFocus; Peer->UpdateCursor(); } else { Peer->wState &= ~sfFocus; } Repaint(); } /////////////////////////////////////////////////////////////////////////// GFramePeer::GFramePeer(GFrame *aFrame, int Width, int Height) { Frame = aFrame; if (Width != -1 && Height != -1) ConSetSize(Width, Height); ConQuerySize(&fW, &fH); } GFramePeer::~GFramePeer() { } int GFramePeer::ConSetSize(int X, int Y) { return ::ConSetSize(X, Y); } int GFramePeer::ConQuerySize(int *X, int *Y) { ::ConQuerySize(&fW, &fH); if (X) *X = fW; if (Y) *Y = fH; return 1; } //int GFrame::ConQuerySize(int *X, int *Y) { // ::ConQuerySize(X, Y); // if (ShowVScroll) // --*X; //} int GFramePeer::ConSetTitle(char *Title, char *STitle) { ::ConSetTitle(Title, STitle); return 0; } int GFramePeer::ConGetTitle(char *Title, int MaxLen, char *STitle, int SMaxLen) { return ::ConGetTitle(Title, MaxLen, STitle, SMaxLen); } /////////////////////////////////////////////////////////////////////////// GFrame::GFrame(int XSize, int YSize) { Menu = 0; if (frames == 0) { frames = Prev = Next = this; } else { Next = frames->Next; Prev = frames; frames->Next->Prev = this; frames->Next = this; frames = this; } Top = Active = 0; Peer = new GFramePeer(this, XSize, YSize); } GFrame::~GFrame() { if (Peer) { delete Peer; Peer = 0; } if (Next == this) { frames = 0; // printf("No more frames\x7\x7\n"); } else { Next->Prev = Prev; Prev->Next = Next; frames = Next; } Next = Prev = 0; if (Menu) free(Menu); } int GFrame::ConSetTitle(char *Title, char *STitle) { return Peer->ConSetTitle(Title, STitle); } int GFrame::ConGetTitle(char *Title, int MaxLen, char *STitle, int SMaxLen) { return Peer->ConGetTitle(Title, MaxLen, STitle, SMaxLen); } int GFrame::ConSetSize(int X, int Y) { return Peer->ConSetSize(X, Y); } int GFrame::ConQuerySize(int *X, int *Y) { return Peer->ConQuerySize(X, Y); } int GFrame::ConSplitView(GView *view, GView *newview) { int dmy; newview->Parent = this; newview->Peer->wX = 0; ConQuerySize(&newview->Peer->wW, &dmy); if (ShowVScroll) newview->Peer->wW--; newview->Peer->wY = view->Peer->wY + view->Peer->wH / 2; newview->Peer->wH = view->Peer->wH - view->Peer->wH / 2; if (ShowHScroll) { newview->Peer->wY++; newview->Peer->wH--; } view->Peer->wH /= 2; view->ConSetSize(view->Peer->wW, view->Peer->wH); newview->ConSetSize(newview->Peer->wW, newview->Peer->wH); InsertView(view, newview); return 0; } int GFrame::ConCloseView(GView * /*view*/) { return 0; } int GFrame::ConResizeView(GView * /*view*/, int /*DeltaY*/) { return 0; } int GFrame::AddView(GView *view) { if (Active != 0) { return ConSplitView(Active, view); } else { int W, H; view->Parent = this; view->Prev = view->Next = 0; view->Peer->wX = 0; if (ShowMenuBar) view->Peer->wY = 1; else view->Peer->wY = 0; ConQuerySize(&W, &H); if (ShowMenuBar) H--; if (ShowVScroll) W--; if (ShowHScroll) H--; view->ConSetSize(W, H); InsertView(Top, view); return 0; } } void GFrame::Update() { GView *v = Active; UpdateMenu(); while (v) { v->Update(); if ((ShowVScroll || ShowHScroll) && (v->Peer->sbVupdate || v->Peer->sbHupdate)) { v->Peer->DrawScrollBar(); v->Peer->sbVupdate = 0; v->Peer->sbHupdate = 0; } v = v->Next; if (v == Active) break; } } void GFrame::UpdateMenu() { if (ShowMenuBar) DrawMenuBar(); } void GFrame::Repaint() { GView *v = Active; if (ShowMenuBar) DrawMenuBar(); while (v) { v->Repaint(); if (ShowVScroll || ShowHScroll) { v->Peer->DrawScrollBar(); v->Peer->sbVupdate = 0; v->Peer->sbHupdate = 0; } v = v->Next; if (v == Active) break; } } void GFrame::InsertView(GView *prev, GView *view) { if (!view) return ; if (prev) { view->Prev = prev; view->Next = prev->Next; prev->Next = view; view->Next->Prev = view; } else { view->Prev = view->Next = view; Top = view; } if (Active == 0) { Active = view; Active->Activate(1); } } void GFrame::RemoveView(GView *view) { if (!view) return ; if (Active == view) Active->Activate(0); if (view->Next == view) { Top = Active = 0; delete this; } else { view->Next->Prev = view->Prev; view->Prev->Next = view->Next; if (Top == view) { Top = view->Next; Top->Peer->wY -= view->Peer->wH; Top->ConSetSize(Top->Peer->wW, Top->Peer->wH + view->Peer->wH + (ShowHScroll ? 1 : 0)); } else { view->Prev->ConSetSize(view->Prev->Peer->wW, view->Prev->Peer->wH + view->Peer->wH + (ShowHScroll ? 1 : 0)); } if (Active == view) { Active = view->Prev; Active->Activate(1); } } } void GFrame::SelectNext(int back) { GView *c = Active; if (c == 0 && Top == 0) return; if (FocusCapture != 0) return ; else if (c == 0) c = Active = Top; else if (back) { Active = Active->Prev; } else { Active = Active->Next; } if (c != Active) { if (c) c->Activate(0); if (Active) Active->Activate(1); } } int GFrame::SelectView(GView *view) { if (Top == 0) return 0; if (FocusCapture != 0) view = view; if (Active) Active->Activate(0); Active = view; if (Active) Active->Activate(1); return 1; } void GFrame::Resize(int width, int height) { GView *V; int count = 0; V = Top; while (V) { count++; if (V == Top) break; } if (height < 2 * count + 2 || width < 16) { ::ConSetSize(16, 2 * count + 1); return; } if (!Top) return; if (ShowVScroll) width--; if (ShowHScroll) height--; // fprintf(stderr, "Resize: %d %d\n", width, height); V = Top->Prev; while (V != Top) { int h, y; h = V->Peer->wH; y = V->Peer->wY; if (y >= height - 2) { y = height - 2; } if (y + h != height) { h = height - y; } V->Peer->wY = y; V->ConSetSize(width, h); height = y; V = V->Prev; } if (ShowMenuBar) height--; Top->ConSetSize(width, height); Repaint(); // fprintf(stderr, "Resize: %d %d Done\n", width, height); } int GFrame::ExecMainMenu(char Sub) { NextEvent.What = evCommand; NextEvent.Msg.Command = cmMainMenu; NextEvent.Msg.Param1 = Sub; return 0; } int GFrame::SetMenu(const char *Name) { if (Menu) free(Menu); Menu = strdup(Name); return 0; } void GFrame::Show() { } void GFrame::Activate() { frames = this; } int GUI::ConGrabEvents(TEventMask /*EventMask*/) { return 0; } void GUI::DispatchEvent(GFrame * /*frame*/, GView *view, TEvent &Event) { if (Event.What != evNone) { if (view) view->HandleEvent(Event); } } int GUI::ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete, GView **view) { if (view) *view = 0; return ::ConGetEvent(EventMask, Event, WaitTime, Delete); } int GUI::ConPutEvent(TEvent Event) { return ::ConPutEvent(Event); } int GUI::ConFlush(void) { return 0; } static inline int scrollBreak(TEvent &E) { return (E.What == evMouseUp); } static void HandleVScroll(GView *view, TEvent &E) { int y; //, x int wY, wH; TEvent E1; //x = E.Mouse.X; y = E.Mouse.Y; wY = view->Peer->wY; wH = view->Peer->wH; if (y == wY) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmVScrollUp; E1.Msg.Param1 = 1; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else if (y == wY + wH - 1) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmVScrollDown; E1.Msg.Param1 = 1; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else if (y < wY + view->Peer->SbVBegin + 1) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmVScrollPgUp; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else if (y > wY + view->Peer->SbVEnd + 1) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmVScrollPgDn; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else { int delta = y - 1 - view->Peer->SbVBegin - wY; do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmVScrollMove; E1.Msg.Param1 = (E.Mouse.Y - wY - 1 - delta + 1) * view->Peer->sbVtotal / (wH - 2); // printf("YPos = %d %d %d \n\x7", E.Mouse.Y, wY, delta); gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } E.What = evNone; } static void HandleHScroll(GView *view, TEvent &E) { int x; //, x int wX, wW; TEvent E1; //x = E.Mouse.X; x = E.Mouse.X; wX = view->Peer->wX; wW = view->Peer->wW; if (x == wX) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmHScrollLeft; E1.Msg.Param1 = 1; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else if (x == wX + wW - 1) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmHScrollRight; E1.Msg.Param1 = 1; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else if (x < wX + view->Peer->SbHBegin + 1) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmHScrollPgLt; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else if (x > wX + view->Peer->SbHEnd + 1) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmHScrollPgRt; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else { int delta = x - 1 - view->Peer->SbHBegin - wX; do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmHScrollMove; E1.Msg.Param1 = (E.Mouse.X - wX - 1 - delta + 1) * view->Peer->sbHtotal / (wW - 2); // printf("YPos = %d %d %d \n\x7", E.Mouse.Y, wY, delta); gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } E.What = evNone; } void GUI::ProcessEvent() { TEvent E; E = NextEvent; if (E.What != evNone) { NextEvent.What = evNone; } if (E.What == evNone && (ConGetEvent(evMouse | evCommand | evKeyboard, &E, 0, 1, 0) == -1 || E.What == evNone) ) { frames->Update(); while (ConGetEvent(evMouse | evCommand | evKeyboard, &E, -1, 1, 0) == -1 || (E.What == evMouseMove && E.Mouse.Buttons == 0)); } if (E.What != evNone) { GView *view = frames->Active; if (E.What & evMouse) { if (E.What == evMouseDown && E.Mouse.Y == 0 && ShowMenuBar && MouseCapture == 0 && FocusCapture == 0) { frames->Update(); // sync before menu if (ExecMainMenu(E, 0) == -1) { if (E.What == evCommand && E.Msg.Command == cmResize) { int X, Y; ConQuerySize(&X, &Y); frames->Resize(X, Y); } E.What = evNone; } // fprintf(stderr, "Command got = %d\n", E.Msg.Command); } if (E.What == evMouseDown && MouseCapture == 0 && FocusCapture == 0) { GView *V = frames->Active; while (V) { if (E.Mouse.Y >= V->Peer->wY && E.Mouse.Y < V->Peer->wY + V->Peer->wH + (ShowHScroll ? 1 : 0)) { frames->SelectView(V); view = V; break; } V = V->Next; if (V == frames->Active) break; } } if (ShowVScroll && ShowHScroll && E.What == evMouseDown && MouseCapture == 0 && FocusCapture == 0 && E.Mouse.Y == view->Peer->wY + view->Peer->wH && E.Mouse.X == view->Peer->wX + view->Peer->wW) { } else { if (ShowVScroll && E.What == evMouseDown && MouseCapture == 0 && FocusCapture == 0 && E.Mouse.X == view->Peer->wX + view->Peer->wW) { HandleVScroll(view, E); return ; } if (ShowHScroll && E.What == evMouseDown && MouseCapture == 0 && FocusCapture == 0 && E.Mouse.Y == view->Peer->wY + view->Peer->wH) { HandleHScroll(view, E); return ; } } if (E.What & evMouse) { E.Mouse.Y -= view->Peer->wY; E.Mouse.X -= view->Peer->wX; } } if (E.What == evCommand) { switch (E.Msg.Command) { case cmResize: { int X, Y; ConQuerySize(&X, &Y); frames->Resize(X, Y); } break; case cmMainMenu: { char Sub = (char)E.Msg.Param1; frames->Update(); // sync before menu if (::ExecMainMenu(E, Sub) != 1) { ; if (E.What == evCommand && E.Msg.Command == cmResize) { int X, Y; ConQuerySize(&X, &Y); frames->Resize(X, Y); } E.What = evNone; } } break; case cmPopupMenu: { int id = E.Msg.Param1; int Cols, Rows; if (id == -1) return; frames->ConQuerySize(&Cols, &Rows); int x = Cols / 2, y = Rows / 2; ConQueryMousePos(&x, &y); frames->Update(); // sync before menu if (::ExecVertMenu(x, y, id, E, 0) != 1) { if (E.What == evCommand && E.Msg.Command == cmResize) { int X, Y; ConQuerySize(&X, &Y); frames->Resize(X, Y); } E.What = evNone; } } break; } } if (E.What != evNone) DispatchEvent(frames, view, E); } } int GUI::Run() { if (Start(fArgc, fArgv) == 0) { doLoop = 1; while (doLoop) ProcessEvent(); Stop(); return 0; } return 1; } int GUI::multiFrame() { return 0; } void DieError(int rc, const char *msg, ...) { va_list ap; va_start(ap, msg); vfprintf(stderr, msg, ap); va_end(ap); fprintf(stderr, "\n"); exit(rc); } efte-1.1/src/e_tags.h0000664000076400007640000000137611041404761013531 0ustar laurilauri/* * e_tags.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __TAGS_H #define __TAGS_H #include // FILE class EView; class EBuffer; int TagsAdd(char *FileName); int TagsSave(FILE *fp); int TagsLoad(int id); int TagLoad(char *FileName); void TagClear(); int TagGoto(EView *V, char *Tag); int TagDefined(const char *Tag); int TagFind(EBuffer *B, EView *V, char *Tag); int TagComplete(char **Words, int *WordsPos, int WordsMax, char *Tag); int TagNext(EView *V); int TagPrev(EView *V); int TagPop(EView *V); #endif // __TAGS_H efte-1.1/src/FTETextAreaView.m0000664000076400007640000000533611041406031015173 0ustar laurilauri#import "FTETextAreaView.h" @implementation FTETextAreaView extern unsigned char *ScreenBuffer; extern unsigned int ScreenCols, ScreenRows; - (id)initWithFrame:(NSRect)frameRect { NSRect realSize = NSMakeRect(0, 0, ScreenCols*9, ScreenRows * 18); //[[self window] setContentSize:NSMakeSize(10.0,8.0)]; if ((self = [super initWithFrame:frameRect]) != nil) { // Add initialization code here MyDispatchEvent(); } return self; } void MyResizeWindow(int x, int y); - (void)viewDidEndLiveResize { NSLog(@"size changed"); NSRect mySize = [self bounds]; MyResizeWindow(mySize.size.width, mySize.size.height); [self setNeedsDisplay:YES]; } static const NSColor* getNSColorForDOSColor(int color) { const NSColor *table[] = { [NSColor blackColor], // 0 [NSColor blueColor], // 1 [NSColor greenColor], // 2 [NSColor cyanColor], // 3 [NSColor redColor], // 4 [NSColor purpleColor],// 5 [NSColor brownColor], // 6 [NSColor lightGrayColor],// 7 [NSColor darkGrayColor], // 8 [NSColor blueColor], // !!! [NSColor greenColor],// !!! [NSColor cyanColor],// 11 [NSColor redColor],// !!! [NSColor magentaColor],//13 [NSColor yellowColor], //14 [NSColor whiteColor], // 15 }; return table[color]; } - (void)drawRect:(NSRect)rect { [[NSColor redColor] set]; NSRect bounds = [self bounds]; NSRectFill([self bounds]); NSMutableDictionary *attribs = [NSMutableDictionary dictionary]; int x, y; const unsigned char *sb = ScreenBuffer; [attribs setObject:[NSFont fontWithName:@"Courier" size:14] forKey:NSFontAttributeName]; fprintf(stderr, "size: %d x %d, %fx%f\n", ScreenRows, ScreenCols, bounds.size.width, bounds.size.height); for(y = 0; y < ScreenRows; y++) for(x = 0; x < ScreenCols; x++) { int fore = sb[1] & 0xf, back = (sb[1] >> 4); char theChar[2] = {0}; //fprintf(stderr, "color: %d %d ", fore, back ); [attribs setObject:getNSColorForDOSColor(fore) forKey:NSForegroundColorAttributeName]; [attribs setObject:getNSColorForDOSColor(back) forKey:NSBackgroundColorAttributeName]; if(sb[0] < 32 || sb[0] > 126) *theChar = '?'; else *theChar = sb[0]; NSString *hello = [NSString stringWithCString:theChar length:1]; sb += 2; [hello drawAtPoint:NSMakePoint(8*x, bounds.size.height-18*(y+1)) withAttributes:attribs]; } } - (BOOL)acceptsFirstResponder { return YES; } - (void)mouseDown:(NSEvent *)theEvent { [super mouseDown:theEvent]; NSLog(@"mouse"); } void *theGlobalGUI = 0; void MyDispatchEvent(); - (void)keyDown:(NSEvent *)theEvent { NSLog(@"key pressed"); NSLog([theEvent characters]); MyDispatchKeyEvent([theEvent characters]); [self setNeedsDisplay:YES]; // DispatchEvent(frames, NextEvent.Msg.View, NextEvent); // NextEvent.What = evNone; } @end efte-1.1/src/i_modelview.cpp0000664000076400007640000000275311041404761015125 0ustar laurilauri/* i_modelview.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" ExModelView::ExModelView(EView *AView): ExView() { View = AView; View->MView = this; MouseCaptured = 0; MouseMoved = 0; } ExModelView::~ExModelView() { if (View) { // close it delete View; View = 0; } } int ExModelView::GetContext() { return View->GetContext(); } void ExModelView::Activate(int gotfocus) { ExView::Activate(gotfocus); View->Activate(gotfocus); } EEventMap *ExModelView::GetEventMap() { return View->GetEventMap(); } int ExModelView::ExecCommand(int Command, ExState &State) { return View->ExecCommand(Command, State); } int ExModelView::BeginMacro() { return View->BeginMacro(); } void ExModelView::HandleEvent(TEvent &Event) { ExView::HandleEvent(Event); View->HandleEvent(Event); } void ExModelView::UpdateView() { View->UpdateView(); } void ExModelView::RepaintView() { View->RepaintView(); } void ExModelView::RepaintStatus() { View->RepaintStatus(); } void ExModelView::UpdateStatus() { View->UpdateStatus(); } void ExModelView::Resize(int width, int height) { View->Resize(width, height); } void ExModelView::WnSwitchBuffer(EModel *B) { if (View) View->SwitchToModel(B); } efte-1.1/src/i_complete.cpp0000664000076400007640000002562511041404761014745 0ustar laurilauri/* i_complete.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1998, Zdenek Kabelac * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #define STRCOMPLETE "Complete Word: [" #define STRNOCOMPLETE "No word for completition..." #if defined(__IBMCPP__) static int _LNK_CONV CmpStr(const void *p1, const void *p2) { #else static int CmpStr(const void *p1, const void *p2) { #endif // defined(__IBMCPP__) return strcoll(*(const char **)p1, *(const char **)p2); } /** * Create Sorted list of possible word extensions */ ExComplete::ExComplete(EBuffer *B): ExView() { Buffer = B; Orig = Buffer->CP; WordBegin = NULL; WordFixed = WordPos = WordsLast = 0; Words = new char *[MAXCOMPLETEWORDS + 2]; if (Words != NULL) RefreshComplete(); } ExComplete::~ExComplete() { // fprintf(stderr, "W %p %p %p %d\n", Words, WordContinue, WordBegin, WordsLast); if (WordBegin != NULL) delete[] WordBegin; if (Words != NULL) { for (int i = 0; i < WordsLast; i++) delete[] Words[i]; delete[] Words; } } void ExComplete::Activate(int gotfocus) { ExView::Activate(gotfocus); } int ExComplete::BeginMacro() { return 1; } bool ExComplete::IsSimpleCase() { if (WordsLast < 2) return true; return false; } int ExComplete::DoCompleteWord() { int rc = 0; if (WordsLast <= 0 || !Words[WordPos]) return rc; int l = strlen(Words[WordPos]); if (Buffer->InsText(Buffer->VToR(Orig.Row), Orig.Col, l, Words[WordPos], 1) && Buffer->SetPos(Orig.Col + l, Orig.Row)) { Buffer->Draw(Buffer->VToR(Orig.Row), Buffer->VToR(Orig.Row)); rc = 1; } return rc; } void ExComplete::HandleEvent(TEvent &Event) { unsigned long kb = kbCode(Event.Key.Code); int DoQuit = 0; int i = 0; if (WordsLast < 2) { if ((WordsLast == 1) && (kb != kbEsc)) { DoQuit = 1; } else { EndExec(0); Event.What = evNone; } } else if (Event.What == evKeyDown) { switch (kb) { case kbPgUp: case kbLeft: // if there would not be locale sort, we could check only // the next string, but with `locale sort` this is impossible!! // this loop is little inefficient but it's quite short & nice for (i = WordPos; i-- > 0;) if (strncmp(Words[WordPos], Words[i], WordFixed) == 0) { WordPos = i; break; } Event.What = evNone; break; case kbPgDn: case kbRight: for (i = WordPos; i++ < WordsLast - 1;) if (strncmp(Words[WordPos], Words[i], WordFixed) == 0) { WordPos = i; break; } Event.What = evNone; break; case kbHome: for (i = 0; i < WordPos; i++) if (strncmp(Words[WordPos], Words[i], WordFixed) == 0) WordPos = i; Event.What = evNone; break; case kbEnd: for (i = WordsLast - 1; i > WordPos; i--) if (strncmp(Words[WordPos], Words[i], WordFixed) == 0) WordPos = i; Event.What = evNone; break; case kbTab: while (WordPos < WordsLast - 1) { WordPos++; if (strncmp(Words[WordPos], Words[WordPos - 1], WordFixed + 1)) break; } Event.What = evNone; break; case kbTab | kfShift: while (WordPos > 0) { WordPos--; if (strncmp(Words[WordPos], Words[WordPos + 1], WordFixed + 1)) break; } Event.What = evNone; break; case kbIns: case kbUp: FixedUpdate(1); Event.What = evNone; break; case kbBackSp: case kbDel: case kbDown: FixedUpdate(-1); Event.What = evNone; break; case kbEsc: EndExec(0); Event.What = evNone; break; case kbEnter: case kbSpace: case kbTab | kfCtrl: DoQuit = 1; break; default: if (CheckASCII(Event.Key.Code&~kfShift)) { char *s = new char[WordFixed + 2]; if (s != NULL) { if (WordFixed > 0) strncpy(s, Words[WordPos], WordFixed); s[WordFixed] = (unsigned char)(Event.Key.Code & 0xFF); s[WordFixed + 1] = 0; for (int i = 0; i < WordsLast; i++) if (strncmp(s, Words[i], WordFixed + 1) == 0) { WordPos = i; if (WordFixedCount == 1) DoQuit = 1; else FixedUpdate(1); break; } delete[] s; } Event.What = evNone; } break; } } if (DoQuit) { /* int rc = 0; int l = strlen(Words[WordPos]); if (Buffer->InsText(Buffer->VToR(Orig.Row), Orig.Col, l, Words[WordPos], 1) && Buffer->SetPos(Orig.Col + l, Orig.Row)) { Buffer->Draw(Buffer->VToR(Orig.Row), Buffer->VToR(Orig.Row)); rc = 1; }*/ int rc = DoCompleteWord(); EndExec(rc); Event.What = evNone; } } void ExComplete::UpdateView() { if (Next) { Next->UpdateView(); } } void ExComplete::RepaintView() { if (Next) { Next->RepaintView(); } } void ExComplete::UpdateStatus() { RepaintStatus(); } void ExComplete::RepaintStatus() { TDrawBuffer B; int W, H; // Currently use this fixed colors - maybe there are some better defines?? #define COM_NORM 0x17 #define COM_ORIG 0x1C #define COM_HIGH 0x1E #define COM_MARK 0x2E #define COM_ERR 0x1C ConQuerySize(&W, &H); MoveCh(B, ' ', COM_NORM, W); if ((WordsLast > 0) && (WordBegin != NULL) && (Words != NULL) && (Words[WordPos]) != NULL) { const char *sc = STRCOMPLETE; int p = sizeof(STRCOMPLETE) - 1; if (W < 35) { // if the width is quite small sc += p - 1; // jump to last character p = 1; } MoveStr(B, 0, W, sc, COM_NORM, W); // int cur = p; MoveStr(B, p, W, WordBegin, COM_ORIG, W); p += strlen(WordBegin); int l = strlen(Words[WordPos]); if (WordFixed > 0) { MoveStr(B, p, W, Words[WordPos], COM_MARK, W); p += WordFixed; l -= WordFixed; } MoveStr(B, p, W, Words[WordPos] + WordFixed, (WordFixedCount == 1) ? COM_ORIG : COM_HIGH, W); p += l; char s[100]; sprintf(s, "] (T:%d/%d S:%d)", WordPos + 1, WordsLast, (int)WordFixedCount); MoveStr(B, p, W, s, COM_NORM, W); // ConSetCursorPos(cur + WordFixed, H - 1); } else MoveStr(B, 0, W, STRNOCOMPLETE, COM_ERR, W); ConPutBox(0, H - 1, W, 1, B); ConShowCursor(); } int ExComplete::RefreshComplete() { if ((Buffer->CP.Col == 0) || (Buffer->SetPos(Buffer->CP.Col, Buffer->CP.Row) == 0)) return 0; PELine L = Buffer->VLine(Buffer->CP.Row); int C = Buffer->CP.Col; int P = Buffer->CharOffset(L, C); if (!P || P > L->Count) return 0; int P1 = P; while ((P > 0) && CheckASCII(L->Chars[P - 1])) P--; int wlen = P1 - P; if (!wlen) return 0; WordBegin = new char[wlen + 1]; if (WordBegin == NULL) return 0; strncpy(WordBegin, L->Chars + P, wlen); WordBegin[wlen] = 0; // fprintf(stderr, "Calling %d %s\n", wlen, WordBegin); // Search words in TAGS TagComplete(Words, &WordsLast, MAXCOMPLETEWORDS, WordBegin); // fprintf(stderr, "Located %d words\n", WordsLast); // these words are already sorted // Search words in current TEXT Buffer->Match.Col = Buffer->Match.Row = 0; // this might look strange but it is necessary to catch // the first word at position 0,0 for match :-) unsigned long mask = SEARCH_NOPOS | SEARCH_WORDBEG; while (Buffer->FindStr(L->Chars + P, wlen, mask) == 1) { mask |= SEARCH_NEXT; PELine M = Buffer->RLine(Buffer->Match.Row); int X = Buffer->CharOffset(M, Buffer->Match.Col); if ((L->Chars == M->Chars) && (P == X)) continue; int XL = X; while ((XL < M->Count) && CheckASCII(M->Chars[XL])) XL++; int len = XL - X - wlen; if (len == 0) continue; char *s = new char[len + 1]; if (s != NULL) { strncpy(s, M->Chars + X + wlen, len); s[len] = 0; int c = 1, H = 0, L = 0, R = WordsLast; // using sort to insert only unique words while (L < R) { H = (L + R) / 2; c = strcmp(s, Words[H]); if (c < 0) R = H; else if (c > 0) L = H + 1; else break; } if (c != 0) { // Loop exited without finding the word. Instead, // it found the spot where the new should be inserted. WordsLast++; int i = WordsLast; while (i > L) { Words[i] = Words[i-1]; i--; } Words[i] = s; if (WordsLast >= MAXCOMPLETEWORDS) break; } else { // word was already listed, free duplicate. delete[] s; } } } Buffer->Match.Row = Buffer->Match.Col = -1; Buffer->MatchLen = Buffer->MatchCount = 0; // sort by current locales qsort(Words, WordsLast, sizeof(Words[0]), CmpStr); FixedUpdate(0); //for(int i = 0; i < WordsLast; i++) //if (Words[i]) //fprintf(stderr, "%3d:\t%10p\t%s\n", i, Words[i], Words[i]); //fprintf(stderr, "Words %3d\n", WordsLast); return WordsLast; } void ExComplete::FixedUpdate(int add) { if (add < 0) { if (WordFixed > 0) WordFixed += add; } else if (add > 0) { if (strlen(Words[WordPos]) > WordFixed) WordFixed += add; } if (WordFixed > 0) { WordFixedCount = 0; for (int i = 0; i < WordsLast; i++) if (strncmp(Words[WordPos], Words[i], WordFixed) == 0) WordFixedCount++; } else WordFixedCount = WordsLast; } efte-1.1/src/CMakeLists.txt0000664000076400007640000002112011163156165014652 0ustar laurilauri# # Build system for eFTE # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # # ============================================================================= # # OPTION DEFINITIONS # # ============================================================================= # Build choices OPTION( BUILD_X "Build X version of eFTE" ON ) OPTION( BUILD_CONSOLE "Build console version of eFTE" ON ) # Optional use flags OPTION( USE_GPM "Compile console versions with gpm support" UNKNOWN ) OPTION( USE_LOCALE "Use normal locale support" ON ) OPTION( USE_XMB "Use libxmb to draw fonts with locale support" ON) OPTION( USE_XLOCALE "Use X11 compiled in support" OFF ) OPTION( USE_XICON "Use libxicon to supply icons for the X version" ON ) OPTION( USE_XTINIT "Use XtInitialize on init" OFF ) OPTION( USE_HARD_REMAP "Keyboard remapping by XEFTE" OFF ) OPTION( USE_LOGGING "Enable trace logging within efte" ON ) OPTION( USE_DEFAULT_CONFIG "Use default config built into efte" ON ) # Setup global options right now platform dependent options will appear later # more near thier actual use IF( USE_LOCALE ) ADD_DEFINITIONS( -DUSE_LOCALE ) ENDIF( USE_LOCALE ) IF( USE_XLOCALE ) ADD_DEFINITIONS( -DX_LOCALE ) ENDIF( USE_XLOCALE ) IF( NOT USE_LOGGING ) ADD_DEFINITIONS( -DFTE_NO_LOGGING ) ENDIF( NOT USE_LOGGING ) IF( USE_GPM ) ADD_DEFINITIONS( -DUSE_GPM ) ENDIF( USE_GPM ) # ============================================================================= # # SOURCE FILES # # ============================================================================= SET( BASE_FTE_SOURCES cfte.cpp c_bind.cpp c_color.cpp c_config.cpp c_desktop.cpp c_hilit.cpp c_history.cpp c_mode.cpp commands.cpp e_block.cpp e_buffer.cpp e_cmds.cpp e_cvslog.cpp e_file.cpp e_fold.cpp e_line.cpp e_loadsave.cpp e_mark.cpp e_print.cpp e_redraw.cpp e_regex.cpp e_search.cpp e_svnlog.cpp e_tags.cpp e_trans.cpp e_undo.cpp egui.cpp fte.cpp g_draw.cpp g_menu.cpp gui.cpp h_ada.cpp h_c.cpp h_catbs.cpp h_fte.cpp h_ipf.cpp h_make.cpp h_msg.cpp h_pascal.cpp h_perl.cpp h_plain.cpp h_rexx.cpp h_sh.cpp h_simple.cpp h_tex.cpp i_ascii.cpp i_choice.cpp i_complete.cpp i_input.cpp i_key.cpp i_modelview.cpp i_oview.cpp i_search.cpp i_view.cpp indent.cpp log.cpp o_buffer.cpp o_buflist.cpp o_cvs.cpp o_cvsbase.cpp o_cvsdiff.cpp o_directory.cpp o_list.cpp o_messages.cpp o_model.cpp o_modemap.cpp o_routine.cpp o_svn.cpp o_svnbase.cpp o_svndiff.cpp s_direct.cpp s_files.cpp s_string.cpp s_util.cpp view.cpp ${CMAKE_CURRENT_BINARY_DIR}/defcfg.h ) SET( UNIX_SOURCES e_unix.cpp memicmp.cpp ) SET( XFTE_SOURCES clip_x11.cpp con_i18n.cpp con_x11.cpp g_nodlg.cpp g_text.cpp menu_text.cpp ) SET( NFTE_SOURCES clip_no.cpp con_ncurses.cpp g_nodlg.cpp g_text.cpp g_unix_pipe.cpp menu_text.cpp ) SET( VFTE_SOURCES clip_no.cpp con_linux.cpp g_nodlg.cpp g_text.cpp menu_text.cpp ) SET( WFTE_SOURCES clip_os2.cpp con_nt.cpp e_win32.cpp g_nodlg.cpp g_text.cpp menu_text.cpp ftewin32.rc ) # ============================================================================= # # PLATFORM SETUP # # ============================================================================= SET( SYSTEM_LIBS "" ) IF( UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" ) SET( OSX 1 ) ENDIF( UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" ) IF( CMAKE_COMPILER_IS_GNUCC ) SET( CMAKE_CXX_FLAGS "-pedantic -Wall -Wno-long-long -Wpointer-arith -Wconversion -Wwrite-strings -Winline -fno-rtti -fno-exceptions" ) ENDIF( CMAKE_COMPILER_IS_GNUCC ) IF( CMAKE_SYSTEM_NAME MATCHES "HP/UX" ) ADD_DEFINITIONS( -DHPUX -D_HPUX_SOURCE -DCAST_FD_SET_INT ) ENDIF( CMAKE_SYSTEM_NAME MATCHES "HP/UX" ) IF( CMAKE_SYSTEM_NAME MATCHES "AIX" ) ADD_DEFINITIONS( -DAIX -D_BSD_INCLUDES -DNO_NEW_CPP_FEATURES ) ENDIF( CMAKE_SYSTEM_NAME MATCHES "AIX" ) IF( CMAKE_SYSTEM_NAME MATCHES "Irix" ) ADD_DEFINITIONS( -DIRIX -DNO_NEW_CPP_FEATURES ) SET( CMAKE_CXX_FLAGS "-OPT:Olimit=3000" ) # -xc++ ENDIF( CMAKE_SYSTEM_NAME MATCHES "Irix" ) IF( CMAKE_SYSTEM_NAME MATCHES "SunOS" ) # Solaris ADD_DEFINITIONS( -DSUNOS -DNO_NEW_CPP_FEATURES ) ENDIF( CMAKE_SYSTEM_NAME MATCHES "SunOS" ) IF( CMAKE_SYSTEM_NAME MATCHES "SCO" ) ADD_DEFINITIONS( -DSCO ) SET( CMAKE_CXX_FLAGS "-b elf" ) SET( SYSTEM_LIBS ${SYSTEM_LIBS} socket ) ENDIF( CMAKE_SYSTEM_NAME MATCHES "SCO" ) IF( CMAKE_SYSTEM_NAME MATCHES "NCR" ) ADD_DEFINITIONS( -DNCR ) SET( CMAKE_CXX_FLAGS "-w3" ) SET( SYSTEM_LIBS ${SYSTEM_LIBS} socket nsl c ucb ) ENDIF( CMAKE_SYSTEM_NAME MATCHES "NCR" ) IF( WIN32 ) IF( BORLAND ) ADD_DEFINITIONS( -DBCPP ) ENDIF( BORLAND ) IF( CYGWIN ) ENDIF( CYGWIN) IF( MINGW ) ENDIF( MINGW) IF( MSVC ) ADD_DEFINITIONS( -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DMSVC ) ENDIF( MSVC ) IF( WATCOM ) ENDIF( WATCOM ) ENDIF( WIN32 ) CONFIGURE_FILE(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}") # ============================================================================= # # PLATFORM INDEPENDENT BUILDS # # ============================================================================= ADD_LIBRARY( eftebase STATIC ${BASE_FTE_SOURCES} ) ADD_EXECUTABLE( bin2c bin2c.cpp ) GET_TARGET_PROPERTY( BIN2C_EXE bin2c LOCATION ) # ===== # # Binary config compiler that will soon disappear # # ===== ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/defcfg.h COMMAND ${BIN2C_EXE} ${CMAKE_CURRENT_SOURCE_DIR}/simple.fte > ${CMAKE_CURRENT_BINARY_DIR}/defcfg.h DEPENDS bin2c simple.fte ) # ============================================================================= # # PLATFORM SPECIFIC BUILDS # # ============================================================================= IF( UNIX ) IF( USE_XMB ) ADD_DEFINITIONS( -DUSE_XMB ) ENDIF( USE_XMB) IF( USE_XICON ) ADD_DEFINITIONS( -DUSE_XICON ) ENDIF( USE_XICON ) ADD_DEFINITIONS( -DUNIX ) IF( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" ) ADD_DEFINITIONS( -DLINUX ) SET( LINUX ON ) ENDIF( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" ) IF( BUILD_X ) INCLUDE(FindX11) IF( X11_LIBRARIES ) MESSAGE( STATUS "X11 found on system, X11 enabled efte will be built" ) INCLUDE_DIRECTORIES( ${X11_INCLUDE_DIR} ) ADD_EXECUTABLE( efte ${UNIX_SOURCES} ${XFTE_SOURCES} ) FIND_LIBRARY( XPM_LIBRARY Xpm ) IF( NOT XPM_LIBRARY ) MESSAGE( SEND_ERROR "Could not find Xpm library which is required for X11 version" ) ENDIF( NOT XPM_LIBRARY ) TARGET_LINK_LIBRARIES( efte eftebase ${X11_LIBRARIES} ${XPM_LIBRARY} ${SYSTEM_LIBS} ) INSTALL( TARGETS efte RUNTIME DESTINATION bin ) ELSE( X11_LIBRARIES ) MESSAGE( STATUS "X11 not found, X11 enabled efte will not be built" ) ENDIF( X11_LIBRARIES ) ENDIF( BUILD_X ) IF( BUILD_CONSOLE ) IF( USE_GPM ) FIND_LIBRARY( FOUND_GPM_LIBRARY gpm ) IF( FOUND_GPM_LIBRARY ) SET( GPM_LIBRARY ${FOUND_GPM_LIBRARY} ) ELSE( FOUND_GPM_LIBRARY ) MESSAGE( SEND_ERROR "Could not find gpm library" ) MESSAGE( SEND_ERROR "Please install or disable the use of gpm:" ) MESSAGE( SEND_ERROR "Add: -DUSE_GPM=OFF to your cmake command line" ) ENDIF( FOUND_GPM_LIBRARY ) ELSE( USE_GPM ) SET( GPM_LIBRARY "" ) ENDIF( USE_GPM ) INCLUDE(FindCurses) IF( CURSES_LIBRARY ) MESSAGE( STATUS "Curses found on system, nefte will be built" ) ADD_EXECUTABLE( nefte ${UNIX_SOURCES} ${NFTE_SOURCES} ) TARGET_LINK_LIBRARIES( nefte eftebase ${CURSES_LIBRARY} ${GPM_LIBRARY} ${SYSTEM_LIBS} ) INSTALL( TARGETS nefte RUNTIME DESTINATION bin ) ELSE( CURSES_LIBRARY ) MESSAGE( SEND_ERROR "Could not find curses library" ) MESSAGE( SEND_ERROR "Please install or disable building a console version:" ) MESSAGE( SEND_ERROR "Add: -DBUILD_CONSOLE=OFF to your cmake command line" ) ENDIF( CURSES_LIBRARY ) IF( LINUX ) MESSAGE( STATUS "Using Linux, vefte will be build" ) ADD_EXECUTABLE( vefte ${UNIX_SOURCES} ${VFTE_SOURCES} ) TARGET_LINK_LIBRARIES( vefte eftebase ${GPM_LIBRARY} ${SYSTEM_LIBS} ) INSTALL( TARGETS vefte RUNTIME DESTINATION bin ) ENDIF( LINUX ) ENDIF( BUILD_CONSOLE ) ELSEIF( WIN32 ) ADD_DEFINITIONS( -DNT -DNTCONSOLE -DWIN32 -D_CONSOLE ) ADD_EXECUTABLE( efte ${CMAKE_CURRENT_BINARY_DIR}/defcfg.h ${WFTE_SOURCES} ) TARGET_LINK_LIBRARIES( efte eftebase ${SYSTEM_LIBS} ) ENDIF( UNIX ) # ============================================================================= # # PLATFORM INDEPENDENT BUILDS # # ============================================================================= efte-1.1/src/o_svn.cpp0000664000076400007640000001407211041404761013743 0ustar laurilauri/* * o_svn.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * S.Pinigin copy o_cvs.cpp and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Class providing access to most of SVN commands. */ #include "fte.h" static int SameDir(char *D1, char *D2) { if (!D1 || !D2) return 0; int l1 = strlen(D1); int l2 = strlen(D2); if (l1 < l2) return strncmp(D1, D2, l1) == 0 && strcmp(D2 + l1, SSLASH) == 0; else if (l1 == l2) return !strcmp(D1, D2); else return strncmp(D1, D2, l2) == 0 && strcmp(D1 + l1, SSLASH) == 0; } const char *SvnStatusChars = "?XUPMCAR"; ESvn *SvnView = 0; ESvn::ESvn(int createFlags, EModel **ARoot, char *ADir, char *ACommand, char *AOnFiles): ESvnBase(createFlags, ARoot, "SVN") { SvnView = this; LogFile = 0; Commiting = 0; RunPipe(ADir, ACommand, AOnFiles); } ESvn::ESvn(int createFlags, EModel **ARoot): ESvnBase(createFlags, ARoot, "SVN") { SvnView = this; LogFile = 0; } ESvn::~ESvn() { SvnView = 0; RemoveLogFile(); } void ESvn::RemoveLogFile() { if (LogFile) { unlink(LogFile); free(LogFile); LogFile = 0; } } char *ESvn::MarkedAsList() { int i; int len = 0; // First pass - calculate size for (i = 0;i < LineCount;i++) if (Lines[i]->Status&2) len += strlen(Lines[i]->File) + 1; if (len == 0) { // Nothing marked, use the file at cursor if (Lines[Row]->Status&4) return strdup(Lines[Row]->File); else return NULL; } char *s = (char *)malloc(len + 1); s[0] = 0; for (i = 0;i < LineCount;i++) if (Lines[i]->Status&2) strcat(strcat(s, Lines[i]->File), " "); s[strlen(s)-1] = 0; return s; } char ESvn::GetFileStatus(char *file) { // Search backward, file can be present several times (old messages) for (int i = LineCount - 1;i >= 0;i--) if (Lines[i]->File && filecmp(Lines[i]->File, file) == 0) return Lines[i]->Msg[0]; return 0; } // ப ᫥ 믮 'svn st' // ப 稭騥 ᨬ SvnStatusChars // ᢥ稢 ३ 䠩 void ESvn::ParseLine(char *line, int len) { if (len > 2 && line[1] == ' ' && strchr(SvnStatusChars, line[0])) AddLine(line + 7, -1, line, 5); else AddLine(0, -1, line); } int ESvn::RunPipe(char *ADir, char *ACommand, char *AOnFiles) { Commiting = 0; if (!SameDir(Directory, ADir)) FreeLines(); return ESvnBase::RunPipe(ADir, ACommand, AOnFiles); } void ESvn::ClosePipe() { ESvnBase::ClosePipe(); if (Commiting && !ReturnCode) { // Successful commit - reload files // Is it safe to do this ? Currently not done, manual reload is needed } Commiting = 0; } int ESvn::RunCommit(char *ADir, char *ACommand, char *AOnFiles) { if (!SameDir(Directory, ADir)) FreeLines(); free(Command); free(Directory); free(OnFiles); Command = strdup(ACommand); Directory = strdup(ADir); OnFiles = strdup(AOnFiles); RemoveLogFile(); // Disallow any SVN command while commiting Running = 1; // Create message buffer ESvnLog *svnlog = new ESvnLog(0, &ActiveModel, Directory, OnFiles); LogFile = strdup(svnlog->FileName); View->SwitchToModel(svnlog); AddLine(LogFile, -1, "SVN commit start - enter message text", 1); return 0; } extern BufferView *BufferList;//!!! int ESvn::DoneCommit(int commit) { Running = 0; // Remove line with link to log free(Lines[LineCount-1]->File); free(Lines[LineCount-1]->Msg); LineCount--; UpdateList(); if (commit) { // We need a copy of Command/Directory/OnFiles because RunPipe deletes them! char *ACommand = (char *)malloc(strlen(Command) + strlen(LogFile) + 10); char *ADirectory = strdup(Directory); char *AOnFiles = strdup(OnFiles); sprintf(ACommand, "%s -F %s", Command, LogFile); int ret = RunPipe(ADirectory, ACommand, AOnFiles); free(ACommand); free(ADirectory); free(AOnFiles); // We set Commiting after RunPipe since it sets it to 0 // This is OK since FTE is not multi-threaded Commiting = 1; if (ActiveView->Model == SvnLogView) { // SvnLogView is currently active, move SvnView just after it if (SvnLogView->Next != SvnView) { // Need to move, is not at right place yet // Here we use the fact that if current model is closed, // the one just after it (Next) is focused. SvnView->Prev->Next = SvnView->Next; SvnView->Next->Prev = SvnView->Prev; SvnView->Next = SvnLogView->Next; SvnLogView->Next->Prev = SvnView; SvnLogView->Next = SvnView; SvnView->Prev = SvnLogView; } } // else - SvnLogView is not active, there is need to make SvnView // active some other way. However, SwitchToModel() or SelectModel() // calls does not work. Currently I don't know how to do this. !!! return ret; } else { RemoveLogFile(); UpdateList(); return 0; } } // If running, can't be closed without asking int ESvn::CanQuit() { if (Running) return 0; else return 1; } // Ask user if we can close this model int ESvn::ConfQuit(GxView *V, int multiFile) { if (SvnLogView) { // Log is open if (SvnLogView->ConfQuit(V, multiFile)) { // Commit confirmed or discarded - depends on Running ActiveView->DeleteModel(SvnLogView); } else return 0; } if (Running) { // SVN command in progress switch (V->Choice(GPC_ERROR, "SVN command is running", 2, "&Kill", "&Cancel", "")) { case 0: // Kill return 1; case 1: // Cancel default: return 0; } } else return 1; } // Event map - this name is used in config files when defining eventmap EEventMap *ESvn::GetEventMap() { return FindEventMap("SVN"); } efte-1.1/src/o_cvsbase.h0000664000076400007640000000502311041404761014224 0ustar laurilauri/* * o_cvsbase.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * Contributed by Martin Frydl * * Base class for all other CVS-related classes. This is similar to EMessages * - starts CVS and shows its messages in list view. */ #ifndef __CVSBASE_H__ #define __CVSBASE_H__ typedef struct { char *File; // Relative to view's directory int Line; char *Msg; EBuffer *Buf; char Status; // bit 0 - hilited // bit 1 - marked // bit 2 - markable } CvsLine; class ECvsBase: public EList { public: char *Command; char *Directory; char *OnFiles; char *OnFilesPos; int LineCount; CvsLine **Lines; int Running; int BufLen; int BufPos; int PipeId; int ReturnCode; char MsgBuf[4096]; ECvsBase(int createFlags, EModel **ARoot, const char *ATitle); ~ECvsBase(); void FreeLines(); void AddLine(char *file, int line, const char *msg, int hilit = 0); void FindBuffer(int line); void AssignBuffer(EBuffer *B, int line); void FindFileLines(EBuffer *B); virtual void NotifyDelete(EModel *Deleting); int GetLine(char *Line, int max); virtual void ParseLine(char *line, int len); void NotifyPipe(int APipeId); // Returns 0 if OK - calls ContinuePipe() several times to complete command for all files virtual int RunPipe(char *Dir, char *Command, char *OnFiles); // Returns 0 if OK - continue with next files in queue virtual int ContinuePipe(); // Reads ReturnCode, sets Running to 0, PipeId to -1 virtual void ClosePipe(); void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); char *FormatLine(int Line); void UpdateList(); int Activate(int No); int CanActivate(int Line); virtual int IsHilited(int Line); virtual int IsMarked(int Line); virtual int Mark(int Line); virtual int Unmark(int Line); virtual int ExecCommand(int Command, ExState &State); void ShowLine(EView *V, int err); virtual int GetContext() { return CONTEXT_CVSBASE; } virtual EEventMap *GetEventMap(); virtual void GetName(char *AName, int MaxLen); virtual void GetInfo(char *AInfo, int MaxLen); virtual void GetPath(char *APath, int MaxLen); virtual void GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen); }; int AddCvsIgnoreRegexp(const char *); void FreeCvsIgnoreRegexp(); #endif efte-1.1/src/c_mode.h0000664000076400007640000002037011163156165013517 0ustar laurilauri/* c_mode.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __EMODE_H__ #define __EMODE_H__ #define CMD_EXT 0x1000 // max 4096 internal commands, check cfte.cpp #define CONTEXT_NONE 0 #define CONTEXT_FILE 1 #define CONTEXT_DIRECTORY 2 #define CONTEXT_MESSAGES 3 #define CONTEXT_SHELL 4 #define CONTEXT_INPUT 5 #define CONTEXT_CHOICE 6 #define CONTEXT_LIST 7 #define CONTEXT_CHAR 8 #define CONTEXT_BUFFERS 9 #define CONTEXT_ROUTINES 10 #define CONTEXT_MAPVIEW 11 #define CONTEXT_CVSBASE 12 #define CONTEXT_CVS 13 #define CONTEXT_CVSDIFF 14 #define CONTEXT_SVNBASE 15 #define CONTEXT_SVN 16 #define CONTEXT_SVNDIFF 17 //typedef unsigned char ChColor; typedef int ChColor; #define HILIT_PLAIN 0 #define HILIT_C 1 #define HILIT_HTML 2 #define HILIT_MAKE 3 #define HILIT_REXX 4 #define HILIT_DIFF 5 #define HILIT_IPF 6 #define HILIT_PERL 7 #define HILIT_MERGE 8 #define HILIT_ADA 9 #define HILIT_MSG 10 #define HILIT_SH 11 #define HILIT_PASCAL 12 #define HILIT_TEX 13 #define HILIT_FTE 14 #define HILIT_CATBS 15 #define HILIT_SIMPLE 16 #define INDENT_PLAIN 0 #define INDENT_C 1 #define INDENT_REXX 2 #define INDENT_SIMPLE 3 #define BFI_AutoIndent 0 #define BFI_Insert 1 #define BFI_DrawOn 2 #define BFI_HilitOn 3 #define BFI_ExpandTabs 4 #define BFI_Trim 5 #define BFI_TabSize 6 #define BFI_ShowTabs 9 #define BFI_HardMode 15 #define BFI_Undo 16 #define BFI_ReadOnly 17 #define BFI_AutoSave 18 #define BFI_KeepBackups 19 #define BFI_MatchCase 22 #define BFI_BackSpKillTab 23 #define BFI_DeleteKillTab 24 #define BFI_BackSpUnindents 25 #define BFI_SpaceTabs 26 #define BFI_IndentWithTabs 27 #define BFI_SeeThruSel 30 #define BFI_ShowMarkers 32 #define BFI_CursorThroughTabs 33 #define BFI_MultiLineHilit 35 #define BFI_WordWrap 31 #define BFI_LeftMargin 28 #define BFI_RightMargin 29 #define BFI_Colorizer 7 #define BFI_IndentMode 8 #define BFI_LineChar 10 #define BFI_StripChar 11 #define BFI_AddLF 12 #define BFI_AddCR 13 #define BFI_ForceNewLine 14 #define BFI_LoadMargin 20 #define BFI_SaveFolds 34 #define BFI_UndoLimit 21 #define BFI_AutoHilitParen 36 #define BFI_Abbreviations 37 #define BFI_BackSpKillBlock 38 #define BFI_DeleteKillBlock 39 #define BFI_PersistentBlocks 40 #define BFI_InsertKillBlock 41 #define BFI_EventMap 42 #define BFI_UndoMoves 43 #define BFI_DetectLineSep 44 #define BFI_TrimOnSave 45 #define BFI_SaveBookmarks 46 #define BFI_HilitTags 47 #define BFI_ShowBookmarks 48 #define BFI_MakeBackups 49 #define BFI_COUNT 50 #define BFS_RoutineRegexp (0 | 256) #define BFS_DefFindOpt (1 | 256) #define BFS_DefFindReplaceOpt (2 | 256) #define BFS_CommentStart (3 | 256) #define BFS_CommentEnd (4 | 256) #define BFS_FileNameRx (5 | 256) #define BFS_FirstLineRx (6 | 256) #define BFS_CompileCommand (7 | 256) #define BFS_COUNT 8 #define BFS_WordChars (100 | 256) // ext #define BFS_CapitalChars (101 | 256) #define BFI(y,x) ((y)->Flags.num[(x) & 0xFF]) #define BFI_SET(y,x,v) ((y)->Flags.num[(x) & 0xFF]=(v)) #define BFS(y,x) ((y)->Flags.str[(x) & 0xFF]) #define WSETBIT(x,y,z) \ ((x)[(unsigned char)(y) >> 3] = char((z) ? \ ((x)[(unsigned char)(y) >> 3] | (1 << ((unsigned char)(y) & 0x7))) : \ ((x)[(unsigned char)(y) >> 3] & ~(1 << ((unsigned char)(y) & 0x7))))) #define WGETBIT(x,y) \ (((x)[(unsigned char)(y) / 8] & (1 << ((unsigned char)(y) % 8))) ? 1 : 0) typedef struct { int num[BFI_COUNT]; char *str[BFS_COUNT]; char WordChars[32]; char CapitalChars[32]; } EBufferFlags; extern EBufferFlags DefaultBufferFlags; /* globals */ #define FLAG_C_Indent 1 #define FLAG_C_BraceOfs 2 #define FLAG_REXX_Indent 3 #define FLAG_ScreenSizeX 6 #define FLAG_ScreenSizeY 7 #define FLAG_SysClipboard 12 #define FLAG_ShowHScroll 13 #define FLAG_ShowVScroll 14 #define FLAG_ScrollBarWidth 15 #define FLAG_SelectPathname 16 #define FLAG_C_CaseOfs 18 #define FLAG_DefaultModeName 19 #define FLAG_CompletionFilter 20 #define FLAG_ShowMenuBar 22 #define FLAG_C_CaseDelta 23 #define FLAG_C_ClassOfs 24 #define FLAG_C_ClassDelta 25 #define FLAG_C_ColonOfs 26 #define FLAG_C_CommentOfs 27 #define FLAG_C_CommentDelta 28 #define FLAG_OpenAfterClose 30 #define FLAG_PrintDevice 31 #define FLAG_CompileCommand 32 #define FLAG_REXX_Do_Offset 33 #define FLAG_KeepHistory 34 #define FLAG_LoadDesktopOnEntry 35 #define FLAG_SaveDesktopOnExit 36 #define FLAG_WindowFont 37 #define FLAG_KeepMessages 38 #define FLAG_ScrollBorderX 39 #define FLAG_ScrollBorderY 40 #define FLAG_ScrollJumpX 41 #define FLAG_ScrollJumpY 42 #define FLAG_ShowToolBar 43 #define FLAG_GUIDialogs 44 #define FLAG_PMDisableAccel 45 #define FLAG_SevenBit 46 #define FLAG_WeirdScroll 47 #define FLAG_LoadDesktopMode 48 #define FLAG_HelpCommand 49 #define FLAG_C_FirstLevelIndent 50 #define FLAG_C_FirstLevelWidth 51 #define FLAG_C_Continuation 52 #define FLAG_C_ParenDelta 53 #define FLAG_FunctionUsesContinuation 54 #define FLAG_IgnoreBufferList 55 #define FLAG_GUICharacters 56 #define FLAG_CvsCommand 57 #define FLAG_CvsLogMode 58 #define FLAG_ReassignModelIds 59 #define FLAG_RecheckReadOnly 60 #define FLAG_XShellCommand 61 #define FLAG_RGBColor 62 #define FLAG_CursorBlink 63 #define FLAG_SvnCommand 64 #define FLAG_SvnLogMode 65 #define FLAG_CursorWithinEOL 66 #define FLAG_CursorInsertMask 67 #define FLAG_CursorOverMask 68 #define FLAG_BackupDirectory 69 #define EM_MENUS 2 #define EM_MainMenu 0 #define EM_LocalMenu 1 #define COL_SyntaxParser 1 #define CLR_Normal 0 #define CLR_Keyword 1 #define CLR_String 2 #define CLR_Comment 3 #define CLR_CPreprocessor 4 #define CLR_Regexp 5 #define CLR_Header 6 #define CLR_Quotes 7 #define CLR_Number 8 #define CLR_HexNumber 9 #define CLR_OctalNumber 10 #define CLR_FloatNumber 11 #define CLR_Function 12 #define CLR_Command 13 #define CLR_Tag 14 #define CLR_Punctuation 15 #define CLR_New 16 #define CLR_Old 17 #define CLR_Changed 18 #define CLR_Control 19 #define CLR_Separator 20 #define CLR_Variable 21 #define CLR_Symbol 22 #define CLR_Directive 23 #define CLR_Label 24 #define CLR_Special 25 #define CLR_QuoteDelim 26 #define CLR_RegexpDelim 27 #define COUNT_CLR 28 #define MATCH_MUST_BOL 0x0001 #define MATCH_MUST_BOLW 0x0002 #define MATCH_MUST_EOL 0x0004 #define MATCH_MUST_EOLW 0x0008 #define MATCH_NO_CASE 0x0010 #define MATCH_SET 0x0020 #define MATCH_NOTSET 0x0040 #define MATCH_QUOTECH 0x0100 #define MATCH_QUOTEEOL 0x0200 #define MATCH_NOGRAB 0x0400 #define MATCH_NEGATE 0x0800 #define MATCH_TAGASNEXT 0x1000 #define MATCH_REGEXP 0x2000 #define ACTION_NXSTATE 0x0001 #define STATE_NOCASE 0x0001 #define STATE_TAGASNEXT 0x0002 #define STATE_NOGRAB 0x0004 typedef enum { mvFilePath = 1, /* directory + name + extension */ mvFileName, /* name + extension */ mvFileDirectory, /* directory + '/' */ mvFileBaseName, /* without the last extension */ mvFileExtension, /* the last one */ mvCurDirectory, mvCurRow, mvCurCol, mvChar, mvWord, mvLine, mvFTEVer, mvGet0, mvGet1, mvGet2, mvGet3, mvGet4, mvGet5, mvGet6, mvGet7, mvGet8, mvGet9 } MacroVariable; #endif efte-1.1/src/c_color.cpp0000664000076400007640000001073511041404761014241 0ustar laurilauri/* c_color.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" ChColor MsgColor[3] = { 0x07, 0x0B, 0x04 }; /* Status line */ ChColor hcStatus_Normal = 0x30; ChColor hcStatus_Active = 0x70; ChColor hcEntry_Field = 0x07; ChColor hcEntry_Prompt = 0x0F; ChColor hcEntry_Selection = 0x2F; /* Plain */ ChColor hcPlain_Normal = 0x07; ChColor hcPlain_Background = 0x07; ChColor hcPlain_Selected = 0x30; ChColor hcPlain_Markers = 0x03; ChColor hcPlain_Found = 0x40; ChColor hcPlain_Keyword = 0x0F; ChColor hcPlain_Folds[5] = { 0x0A, 0x0A, 0x0A, 0x0A, 0x0A }; ChColor hcPlain_HilitWord = 0x0D; ChColor hcPlain_Bookmark = 0x20; /* LIST */ //ChColor hcList_Border = 0x03; ChColor hcList_Status = 0x70; ChColor hcList_Normal = 0x07; ChColor hcList_Selected = 0x1F; ChColor hcList_Hilited = 0x0F; ChColor hcList_HilitSelect = 0x1F; ChColor hcList_Marked = 0xB0; ChColor hcList_MarkSelect = 0x1B; ChColor hcList_MarkHilit = 0xB1; ChColor hcList_MarkHilitSel = 0x1B; ChColor hcScrollBar_Arrows = 0x70; ChColor hcScrollBar_Back = 0x07; ChColor hcScrollBar_Fore = 0x07; ChColor hcAsciiChars = 0x07; ChColor hcMenu_Background = 0x70; ChColor hcMenu_ActiveItem = 0x1F; ChColor hcMenu_ActiveChar = 0x1C; ChColor hcMenu_NormalItem = 0x70; ChColor hcMenu_NormalChar = 0x74; ChColor hcChoice_Title = 0x1F; ChColor hcChoice_Param = 0x1B; ChColor hcChoice_Background = 0x17; ChColor hcChoice_ActiveItem = 0x20; ChColor hcChoice_ActiveChar = 0x2F; ChColor hcChoice_NormalItem = 0x1F; ChColor hcChoice_NormalChar = 0x1E; static const struct { const char *Name; ChColor *C; } Colors[] = { { "Status.Normal", &hcStatus_Normal }, { "Status.Active", &hcStatus_Active }, { "Message.Normal", &MsgColor[0] }, { "Message.Bold", &MsgColor[1] }, { "Message.Error", &MsgColor[2] }, { "Entry.Field", &hcEntry_Field }, { "Entry.Prompt", &hcEntry_Prompt }, { "Entry.Selection", &hcEntry_Selection }, { "LIST.Status", &hcList_Status }, { "LIST.Normal", &hcList_Normal }, { "LIST.Selected", &hcList_Selected }, { "LIST.Hilited", &hcList_Hilited }, { "LIST.HilitSelect", &hcList_HilitSelect }, { "LIST.Marked", &hcList_Marked }, { "LIST.MarkSelect", &hcList_MarkSelect }, { "LIST.MarkHilit", &hcList_MarkHilit }, { "LIST.MarkHilitSel", &hcList_MarkHilitSel }, { "PLAIN.Normal", &hcPlain_Normal }, { "PLAIN.Background", &hcPlain_Background }, { "PLAIN.Selected", &hcPlain_Selected }, { "PLAIN.Markers", &hcPlain_Markers }, { "PLAIN.Found", &hcPlain_Found }, { "PLAIN.Keyword", &hcPlain_Keyword }, { "PLAIN.Folds", &hcPlain_Folds[0] }, // added some backwards compatibility { "PLAIN.Folds0", &hcPlain_Folds[0] }, { "PLAIN.Folds1", &hcPlain_Folds[1] }, { "PLAIN.Folds2", &hcPlain_Folds[2] }, { "PLAIN.Folds3", &hcPlain_Folds[3] }, { "PLAIN.Folds4", &hcPlain_Folds[4] }, { "PLAIN.HilitWord", &hcPlain_HilitWord }, { "PLAIN.Bookmark", &hcPlain_Bookmark }, { "ScrollBar.Arrows", &hcScrollBar_Arrows }, { "ScrollBar.Back", &hcScrollBar_Back }, { "ScrollBar.Fore", &hcScrollBar_Fore }, { "ASCII.Chars", &hcAsciiChars }, { "Menu.Background", &hcMenu_Background }, { "Menu.ActiveItem", &hcMenu_ActiveItem }, { "Menu.ActiveChar", &hcMenu_ActiveChar }, { "Menu.NormalItem", &hcMenu_NormalItem }, { "Menu.NormalChar", &hcMenu_NormalChar }, { "Choice.Title", &hcChoice_Title }, { "Choice.Param", &hcChoice_Param }, { "Choice.Background", &hcChoice_Background }, { "Choice.ActiveItem", &hcChoice_ActiveItem }, { "Choice.ActiveChar", &hcChoice_ActiveChar }, { "Choice.NormalItem", &hcChoice_NormalItem }, { "Choice.NormalChar", &hcChoice_NormalChar }, }; int SetColor(const char *ColorV, const char *Value) { unsigned int ColBg, ColFg; if (sscanf(Value, "%1X %1X", &ColFg, &ColBg) != 2) return 0; ChColor C = ChColor(ColFg | (ColBg << 4)); for (unsigned i = 0; i < sizeof(Colors) / sizeof(Colors[0]); i++) { if (strcmp(ColorV, Colors[i].Name) == 0) { *Colors[i].C = C; return 1; } } return 0; } efte-1.1/src/c_cmdtab.h0000664000076400007640000002003411043103617014011 0ustar laurilauri/* c_cmdtab.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef CMDTAB_H #define CMDTAB_H #include "c_commands.h" #define TAB(x) \ { Ex##x, #x } const struct { unsigned short CmdId; const char *Name; } Command_Table[] = { TAB(Nop), TAB(Fail), TAB(MoveLeft), TAB(MoveRight), TAB(MoveUp), TAB(MoveDown), TAB(MovePrev), TAB(MoveNext), TAB(MoveWordLeft), TAB(MoveWordRight), TAB(MoveWordPrev), TAB(MoveWordNext), TAB(MoveWordEndLeft), TAB(MoveWordEndRight), TAB(MoveWordEndPrev), TAB(MoveWordEndNext), TAB(MoveWordOrCapLeft), TAB(MoveWordOrCapRight), TAB(MoveWordOrCapPrev), TAB(MoveWordOrCapNext), TAB(MoveWordOrCapEndLeft), TAB(MoveWordOrCapEndRight), TAB(MoveWordOrCapEndPrev), TAB(MoveWordOrCapEndNext), TAB(MoveLineStart), TAB(MoveLineEnd), TAB(MovePageUp), TAB(MovePageDown), TAB(MovePageLeft), TAB(MovePageRight), TAB(MovePageStart), TAB(MovePageEnd), TAB(MoveFileStart), TAB(MoveFileEnd), TAB(MoveBlockStart), TAB(MoveBlockEnd), TAB(MoveFirstNonWhite), TAB(MoveLastNonWhite), TAB(MovePrevEqualIndent), TAB(MoveNextEqualIndent), TAB(MovePrevTab), TAB(MoveNextTab), TAB(MoveLineTop), TAB(MoveLineCenter), TAB(MoveLineBottom), TAB(ScrollLeft), TAB(ScrollRight), TAB(ScrollDown), TAB(ScrollUp), TAB(MoveTabStart), TAB(MoveTabEnd), TAB(KillLine), TAB(KillChar), TAB(KillCharPrev), TAB(KillWord), TAB(KillWordPrev), TAB(KillWordOrCap), TAB(KillWordOrCapPrev), TAB(KillToLineStart), TAB(KillToLineEnd), TAB(KillBlock), TAB(KillBlockOrChar), TAB(KillBlockOrCharPrev), TAB(BackSpace), TAB(Delete), TAB(CharCaseUp), TAB(CharCaseDown), TAB(CharCaseToggle), TAB(LineCaseUp), TAB(LineCaseDown), TAB(LineCaseToggle), TAB(LineInsert), TAB(LineAdd), TAB(LineSplit), TAB(LineJoin), TAB(LineNew), TAB(LineIndent), TAB(LineTrim), TAB(FileTrim), TAB(BlockTrim), TAB(InsertSpacesToTab), TAB(InsertTab), TAB(InsertSpace), TAB(WrapPara), TAB(InsPrevLineChar), TAB(InsPrevLineToEol), TAB(LineDuplicate), TAB(BlockBegin), TAB(BlockEnd), TAB(BlockUnmark), TAB(BlockCut), TAB(BlockCopy), TAB(BlockCutAppend), TAB(BlockCopyAppend), TAB(ClipClear), TAB(BlockPaste), TAB(BlockKill), TAB(BlockSort), TAB(BlockSortReverse), TAB(BlockIndent), TAB(BlockUnindent), TAB(BlockClear), TAB(BlockMarkStream), TAB(BlockMarkLine), TAB(BlockMarkColumn), TAB(BlockCaseUp), TAB(BlockCaseDown), TAB(BlockCaseToggle), TAB(BlockExtendBegin), TAB(BlockExtendEnd), TAB(BlockReIndent), TAB(BlockSelectWord), TAB(BlockSelectLine), TAB(BlockSelectPara), TAB(Undo), TAB(Redo), TAB(MatchBracket), TAB(MovePrevPos), TAB(MoveSavedPosCol), TAB(MoveSavedPosRow), TAB(MoveSavedPos), TAB(SavePos), TAB(CompleteWord), TAB(MoveToLine), TAB(MoveToColumn), TAB(BlockPasteStream), TAB(BlockPasteLine), TAB(BlockPasteColumn), TAB(BlockPasteOver), TAB(ShowPosition), TAB(FoldCreate), TAB(FoldCreateByRegexp), TAB(FoldDestroy), TAB(FoldDestroyAll), TAB(FoldPromote), TAB(FoldDemote), TAB(FoldOpen), TAB(FoldOpenNested), TAB(FoldClose), TAB(FoldOpenAll), TAB(FoldCloseAll), TAB(FoldToggleOpenClose), TAB(MoveFoldTop), TAB(MoveFoldPrev), TAB(MoveFoldNext), TAB(PlaceBookmark), TAB(RemoveBookmark), TAB(GotoBookmark), TAB(InsertString), TAB(SelfInsert), TAB(FilePrev), TAB(FileNext), TAB(FileLast), TAB(SwitchTo), TAB(FileReload), TAB(FileSave), TAB(FileSaveAll), TAB(FileSaveAs), TAB(FileWriteTo), TAB(FileOpen), TAB(FileOpenInMode), TAB(FilePrint), TAB(BlockPrint), TAB(BlockRead), TAB(BlockReadStream), TAB(BlockReadLine), TAB(BlockReadColumn), TAB(BlockWrite), TAB(IncrementalSearch), TAB(Find), TAB(FindReplace), TAB(FindRepeat), TAB(FindRepeatOnce), TAB(FindRepeatReverse), TAB(InsertChar), TAB(FileClose), TAB(FileCloseAll), TAB(WinRefresh), TAB(WinHSplit), TAB(WinNext), TAB(WinPrev), TAB(WinClose), TAB(WinZoom), TAB(WinResize), TAB(ExitEditor), TAB(ViewBuffers), TAB(ListRoutines), TAB(DirOpen), TAB(Compile), TAB(CompilePrevError), TAB(CompileNextError), TAB(ViewMessages), TAB(ShowKey), TAB(ShowEntryScreen), TAB(RunProgram), TAB(HilitWord), TAB(SearchWordPrev), TAB(SearchWordNext), TAB(HilitMatchBracket), TAB(MainMenu), TAB(LocalMenu), TAB(ShowMenu), TAB(ChangeMode), TAB(ChangeKeys), TAB(ChangeFlags), TAB(ToggleAutoIndent), TAB(ToggleInsert), TAB(ToggleExpandTabs), TAB(ToggleShowTabs), TAB(ToggleUndo), TAB(ToggleReadOnly), TAB(ToggleKeepBackups), TAB(ToggleMatchCase), TAB(ToggleBackSpKillTab), TAB(ToggleDeleteKillTab), TAB(ToggleSpaceTabs), TAB(ToggleIndentWithTabs), TAB(ToggleBackSpUnindents), TAB(ToggleWordWrap), TAB(ToggleTrim), TAB(ToggleShowMarkers), TAB(ToggleHilitTags), TAB(ToggleShowBookmarks), TAB(ToggleMakeBackups), TAB(SetLeftMargin), TAB(SetRightMargin), TAB(SetPrintDevice), TAB(ChangeTabSize), TAB(ChangeLeftMargin), TAB(ChangeRightMargin), TAB(ToggleSysClipboard), TAB(Cancel), TAB(Activate), TAB(Rescan), TAB(CloseActivate), TAB(ActivateInOtherWindow), TAB(DirGoUp), TAB(DirGoDown), TAB(DirGoRoot), TAB(DirGoto), TAB(DirSearchCancel), TAB(DirSearchNext), TAB(DirSearchPrev), TAB(DeleteFile), TAB(RenameFile), TAB(MakeDirectory), TAB(ShowVersion), TAB(ASCIITable), TAB(TypeChar), TAB(CharTrans), TAB(LineTrans), TAB(BlockTrans), TAB(DesktopSave), TAB(DesktopSaveAs), TAB(DesktopLoad), TAB(ChildClose), TAB(BufListFileSave), TAB(BufListFileClose), TAB(BufListSearchCancel), TAB(BufListSearchNext), TAB(BufListSearchPrev), TAB(ViewModeMap), TAB(ClearMessages), TAB(BlockUnTab), TAB(BlockEnTab), TAB(TagFind), TAB(TagFindWord), TAB(TagNext), TAB(TagPrev), TAB(TagPop), TAB(TagLoad), TAB(TagClear), TAB(TagGoto), TAB(BlockMarkFunction), TAB(IndentFunction), TAB(MoveFunctionPrev), TAB(MoveFunctionNext), TAB(Search), TAB(SearchB), TAB(SearchRx), TAB(SearchAgain), TAB(SearchAgainB), TAB(SearchReplace), TAB(SearchReplaceB), TAB(SearchReplaceRx), TAB(InsertDate), TAB(InsertUid), TAB(FrameNew), TAB(FrameClose), TAB(FrameNext), TAB(FramePrev), TAB(ShowHelpWord), TAB(ShowHelp), TAB(ConfigRecompile), TAB(PlaceGlobalBookmark), TAB(RemoveGlobalBookmark), TAB(GotoGlobalBookmark), TAB(MoveBeginOrNonWhite), TAB(MoveBeginLinePageFile), TAB(MoveEndLinePageFile), TAB(PushGlobalBookmark), TAB(PopGlobalBookmark), TAB(SetCIndentStyle), TAB(SetIndentWithTabs), TAB(RunCompiler), TAB(FoldCreateAtRoutines), TAB(LineCenter), TAB(RunProgramAsync), TAB(ListMark), TAB(ListUnmark), TAB(ListToggleMark), TAB(ListMarkAll), TAB(ListUnmarkAll), TAB(ListToggleMarkAll), TAB(Cvs), TAB(RunCvs), TAB(ViewCvs), TAB(ClearCvsMessages), TAB(CvsDiff), TAB(RunCvsDiff), TAB(ViewCvsDiff), TAB(CvsCommit), TAB(RunCvsCommit), TAB(ViewCvsLog), TAB(Svn), TAB(RunSvn), TAB(ViewSvn), TAB(ClearSvnMessages), TAB(SvnDiff), TAB(RunSvnDiff), TAB(ViewSvnDiff), TAB(SvnCommit), TAB(RunSvnCommit), TAB(ViewSvnLog), TAB(GetString), TAB(RegExp), TAB(ExpandTemplate) }; #endif // CMDTAB_H efte-1.1/src/commands.cpp0000664000076400007640000000134711041404761014421 0ustar laurilauri/* commands.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int GetDefaultDirectory(EModel *M, char *Path, int MaxLen) { if (M) M->GetPath(Path, MaxLen); if (!M || Path[0] == 0) if (ExpandPath(".", Path, MaxLen) == -1) return 0; SlashDir(Path); return 1; } int SetDefaultDirectory(EModel *M) { char Path[MAXPATH]; if (GetDefaultDirectory(M, Path, sizeof(Path)) == 0) return 0; if (ChangeDir(Path) == -1) return 0; return 1; } efte-1.1/src/e_svnlog.h0000664000076400007640000000317211041404761014077 0ustar laurilauri/* * e_svnlog.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * S.Pinigin copy o_cvslog.h and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Subclass of EBuffer for writing log for SVN commit. Creates temporary file * used for commit which is deleted when view is closed. Asks for commit or * discard on view close. */ #ifndef _SVNLOG_H_ #define _SVNLOG_H_ #include "e_buffer.h" class ESvnLog: public EBuffer { public: ESvnLog(int createFlags, EModel **ARoot, char *Directory, char *OnFiles); ~ESvnLog(); // List files into buffer // p - line where to print // fCount - number of files which will be printed // title - title // cnt - total number of files // position - positions of files in list // len - length of files // status - status of files // list - list of filenames // incexc - status of files to print/not to print // exc - incexc is exclusion void ListFiles(int &p, const int fCount, const char *title, const int cnt, const int *position, const int *len, const char *status, const char *list, const char *excinc, const int exc = 0); virtual int CanQuit(); virtual int ConfQuit(GxView *V, int multiFile = 0); virtual EViewPort *CreateViewPort(EView *V); virtual void GetName(char *AName, int MaxLen); virtual void GetInfo(char *AInfo, int MaxLen); virtual void GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen); }; extern ESvnLog *SvnLogView; #endif efte-1.1/src/o_list.cpp0000664000076400007640000004133711255421212014111 0ustar laurilauri/* o_list.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" EListPort::EListPort(EList *L, EView *V): EViewPort(V) { List = L; OldTopRow = OldLeftCol = OldRow = OldCount = -1; GetPos(); } EListPort::~EListPort() { StorePos(); } void EListPort::StorePos() { List->Row = Row; List->TopRow = TopRow; List->LeftCol = LeftCol; List->NeedsUpdate = 1; } void EListPort::GetPos() { Row = List->Row; TopRow = List->TopRow; LeftCol = List->LeftCol; } void EListPort::HandleEvent(TEvent &Event) { int W = 1; int H = 1; EViewPort::HandleEvent(Event); if (View && View->MView && View->MView->Win) { View->MView->ConQuerySize(&W, &H); H--; } switch (Event.What) { case evCommand: switch (Event.Msg.Command) { case cmVScrollUp: List->ScrollDown(Event.Msg.Param1); Event.What = evNone; break; case cmVScrollDown: List->ScrollUp(Event.Msg.Param1); Event.What = evNone; break; case cmVScrollPgUp: List->MovePageUp(); Event.What = evNone; break; case cmVScrollPgDn: List->MovePageDown(); Event.What = evNone; break; case cmVScrollMove: { int ypos; ypos = List->Row - List->TopRow; List->TopRow = Event.Msg.Param1; List->Row = List->TopRow + ypos; } Event.What = evNone; break; case cmHScrollLeft: List->ScrollRight(Event.Msg.Param1); Event.What = evNone; break; case cmHScrollRight: List->ScrollLeft(Event.Msg.Param1); Event.What = evNone; break; case cmHScrollPgLt: List->ScrollRight(W); Event.What = evNone; break; case cmHScrollPgRt: List->ScrollLeft(W); Event.What = evNone; break; case cmHScrollMove: List->LeftCol = Event.Msg.Param1; Event.What = evNone; break; } break; case evMouseDown: case evMouseUp: case evMouseMove: case evMouseAuto: HandleMouse(Event); break; } } void EListPort::HandleMouse(TEvent &Event) { int W, H; int x, y, xx, yy; View->MView->ConQuerySize(&W, &H); x = Event.Mouse.X; y = Event.Mouse.Y; yy = y + TopRow; xx = x + LeftCol; // if (yy >= Selected) yy = Window->Buffer->VCount - 1; if (yy < 0) yy = 0; if (xx < 0) xx = 0; switch (Event.What) { case evMouseDown: if (Event.Mouse.Y == H - 1) break; if (View->MView->Win->CaptureMouse(1)) View->MView->MouseCaptured = 1; else break; if (Event.Mouse.Buttons == 1) if (yy < List->Count && yy >= 0) { List->SetPos(yy, LeftCol); if (Event.Mouse.Count == 2) { if (List->CanActivate(List->Row)) { View->MView->Win->CaptureMouse(0); if (List->Activate() == 1) { //View->MView->EndExec(1); } } } } if (Event.Mouse.Buttons == 2) if (yy < List->Count && yy >= 0) List->SetPos(yy, LeftCol); Event.What = evNone; break; case evMouseAuto: case evMouseMove: if (View->MView->MouseCaptured) { if (Event.Mouse.Buttons == 1 || Event.Mouse.Buttons == 2) if (yy < List->Count && yy >= 0) { List->SetPos(yy, LeftCol); } Event.What = evNone; } break; case evMouseUp: if (View->MView->MouseCaptured) View->MView->Win->CaptureMouse(0); else break; if (Event.Mouse.Buttons == 2) { EEventMap *Map = View->MView->Win->GetEventMap(); const char *MName = 0; if (yy < List->Count && yy >= 0) { List->SetPos(yy, LeftCol); } if (Map) MName = Map->GetMenu(EM_LocalMenu); if (MName == 0) MName = "Local"; View->MView->Win->Parent->PopupMenu(MName); } View->MView->MouseCaptured = 0; Event.What = evNone; break; } } void EListPort::UpdateView() { if (OldLeftCol != LeftCol || OldTopRow != TopRow || OldCount != List->Count) List->NeedsRedraw = List->NeedsUpdate = 1; if (List->NeedsUpdate) { List->UpdateList(); List->FixPos(); if (List->View == View) GetPos(); if (OldLeftCol != LeftCol || OldTopRow != TopRow || OldCount != List->Count) List->NeedsRedraw = List->NeedsUpdate = 1; PaintView(List->NeedsRedraw); OldRow = Row; OldTopRow = TopRow; OldLeftCol = LeftCol; OldCount = List->Count; List->NeedsUpdate = 0; List->NeedsRedraw = 0; } } void EListPort::RepaintView() { PaintView(1); OldRow = Row; OldTopRow = TopRow; OldLeftCol = LeftCol; OldCount = List->Count; List->NeedsUpdate = 0; List->NeedsRedraw = 0; } void EListPort::PaintView(int PaintAll) { TDrawBuffer B; int I; ChColor color; int W, H; if (List->NeedsRedraw) PaintAll = 1; if (View == 0 || View->MView == 0 || View->MView->Win == 0) return ; View->MView->ConQuerySize(&W, &H); H--; if (View->MView->Win->GetViewContext() != View->MView) return; for (I = 0; I < H; I++) { if (PaintAll || I + TopRow == Row || I + TopRow == OldRow) { int mark = List->IsMarked(I + TopRow); int hilit = List->IsHilited(I + TopRow); color = ((Row == I + TopRow) && View->MView->Win->IsActive()) ? (mark ? (hilit ? hcList_MarkHilitSel : hcList_MarkSelect) : (hilit ? hcList_HilitSelect : hcList_Selected)) : (mark ? (hilit ? hcList_MarkHilit : hcList_Marked) : (hilit ? hcList_Hilited : hcList_Normal)); MoveChar(B, 0, W, ' ', color, W); if (I + TopRow < List->Count) List->DrawLine(B, I + TopRow, LeftCol, color, W); View->MView->ConPutBox(0, I, W, 1, B); } } } void EListPort::UpdateStatus() { RepaintStatus(); } void EListPort::RepaintStatus() { TDrawBuffer B; char s[80]; int W, H; char SColor; if (View == 0 || View->MView == 0 || View->MView->Win == 0) return ; View->MView->ConQuerySize(&W, &H); List->UpdateList(); List->FixPos(); if (List->View == View) GetPos(); if (View->MView->Win->GetStatusContext() != View->MView) return; View->MView->Win->SetSbVPos(TopRow, H, List->Count + (WeirdScroll ? H - 1 : 0)); View->MView->Win->SetSbHPos(LeftCol, W, 1024 + (WeirdScroll ? W - 1 : 0)); if (View->MView->IsActive()) // hack SColor = hcStatus_Active; else SColor = hcStatus_Normal; MoveCh(B, ' ', SColor, W); if (View->CurMsg == 0) { if (List->Title) MoveStr(B, 0, W, List->Title, SColor, W); sprintf(s, "%c%d/%d", ConGetDrawChar(DCH_V), Row + 1, List->Count); MoveStr(B, W - strlen(s), W, s, SColor, W); } else { MoveStr(B, 0, W, View->CurMsg, SColor, W); } View->MView->ConPutBox(0, H - 1, W, 1, B); if (View->MView->Win->GetStatusContext() == View->MView && View->MView->Win->IsActive()) View->MView->Win->ConSetCursorPos(0, Row - TopRow); } EList::EList(int createFlags, EModel **ARoot, const char *aTitle): EModel(createFlags, ARoot) { Title = strdup(aTitle); Row = TopRow = Count = LeftCol = 0; NeedsUpdate = 1; NeedsRedraw = 1; MouseMoved = 0; MouseCaptured = 0; } EList::~EList() { free(Title); } EViewPort *EList::CreateViewPort(EView *V) { V->Port = new EListPort(this, V); AddView(V); return V->Port; } EListPort *EList::GetViewVPort(EView *V) { return (EListPort *)V->Port; } EListPort *EList::GetVPort() { return (EListPort *)View->Port; } void EList::SetTitle(char *ATitle) { if (Title) free(Title); Title = strdup(ATitle); if (View && View->MView) View->MView->RepaintStatus(); } int EList::ExecCommand(int Command, ExState &State) { int W = 1; int H = 1; if (View && View->MView && View->MView->Win) { View->MView->ConQuerySize(&W, &H); H--; } FixPos(); switch (Command) { case ExMoveLeft: return MoveLeft(); case ExMoveRight: return MoveRight(); case ExMoveUp: return MoveUp(); case ExMoveDown: return MoveDown(); case ExMovePageUp: return MovePageUp(); case ExMovePageDown: return MovePageDown(); case ExScrollLeft: return ScrollLeft(8); case ExScrollRight: return ScrollRight(8); case ExMovePageStart: return MovePageStart(); case ExMovePageEnd: return MovePageEnd(); case ExMoveFileStart: return MoveFileStart(); case ExMoveFileEnd: return MoveFileEnd(); case ExMoveLineStart: return MoveLineStart(); case ExMoveLineEnd: return MoveLineEnd(); case ExRescan: RescanList(); return ErOK; case ExActivate: return Activate(); case ExListMark: return Mark(); case ExListUnmark: return Unmark(); case ExListToggleMark: return ToggleMark(); case ExListMarkAll: return MarkAll(); case ExListUnmarkAll: return UnmarkAll(); case ExListToggleMarkAll: return ToggleMarkAll(); } return EModel::ExecCommand(Command, State); } EEventMap *EList::GetEventMap() { return FindEventMap("LIST"); } void EList::HandleEvent(TEvent &/*Event*/) { } void EList::DrawLine(PCell /*B*/, int /*Line*/, int /*Col*/, ChColor /*color*/, int /*Width*/) { } char *EList::FormatLine(int /*Line*/) { return 0; } void EList::RescanList() {} void EList::UpdateList() { NeedsUpdate = 1; } void EList::FreeList() {} void EList::FixPos() { int W, H; int OTopRow = TopRow; int OLeftCol = LeftCol; int ORow = Row; if (View == 0 || View->MView == 0 || View->MView->Win == 0) return ; View->MView->Win->ConQuerySize(&W, &H); H--; //int scrollJumpX = Min(ScrollJumpX, W / 2); int scrollJumpY = Min(ScrollJumpY, H / 2); //int scrollBorderX = Min(ScrollBorderX, W / 2); int scrollBorderY = Min(ScrollBorderY, H / 2); if (LeftCol < 0) LeftCol = 0; if (Row >= Count) Row = Count - 1; if (!WeirdScroll) if (TopRow + H > Count) TopRow = Count - H; if (Row < 0) Row = 0; if (GetVPort()->ReCenter) { TopRow = Row - H / 2; GetVPort()->ReCenter = 0; } if (TopRow + scrollBorderY > Row) TopRow = Row - scrollJumpY + 1 - scrollBorderY; if (TopRow + H - scrollBorderY <= Row) TopRow = Row - H + 1 + scrollJumpY - 1 + scrollBorderY; if (TopRow < 0) TopRow = 0; if (OTopRow != TopRow || OLeftCol != LeftCol || ORow != Row) { NeedsRedraw = 1; NeedsUpdate = 1; } } int EList::GetContext() { return CONTEXT_LIST; } int EList::BeginMacro() { return 1; } int EList::CanActivate(int /*Line*/) { return 1; } int EList::Activate(int /*No*/) { return 0; } int EList::IsHilited(int /*Line*/) { return 0; } int EList::IsMarked(int /*Line*/) { return 0; } int EList::Mark(int /*Line*/) { return 1; } int EList::Unmark(int /*Line*/) { return 1; } int EList::SetPos(int ARow, int ACol) { Row = ARow; LeftCol = ACol; NeedsUpdate = 1; return ErOK; } int EList::MoveLeft() { if (LeftCol == 0) return ErFAIL; LeftCol--; NeedsUpdate = 1; return ErOK; } int EList::MoveRight() { LeftCol++; NeedsUpdate = 1; return ErOK; } int EList::MoveUp() { if (Row == 0) return ErFAIL; Row--; NeedsUpdate = 1; return ErOK; } int EList::MoveDown() { if (Row == Count - 1) return ErFAIL; Row++; NeedsUpdate = 1; return ErOK; } int EList::MoveLineStart() { if (LeftCol != 0) { NeedsUpdate = 1; LeftCol = 0; } return ErOK; } // Move current column position to end of line, if line is shorter, stay at // begining of line, if it is long enough move it to end and subtract // screen width / 2 from actual length int EList::MoveLineEnd() { int W, H, len; View->MView->Win->ConQuerySize(&W, &H); H--; len = GetRowLength(Row); if (len < W) { if (LeftCol != 0) { LeftCol = 0; NeedsUpdate = 1; } } else if (LeftCol != len - W / 2) { LeftCol = len - W / 2; NeedsUpdate = 1; } return ErOK; } int EList::MovePageUp() { int W, H; if (Row == 0) return ErFAIL; View->MView->Win->ConQuerySize(&W, &H); H--; Row -= H; TopRow -= H; if (Row < 0) Row = 0; if (TopRow < 0) TopRow = 0; NeedsUpdate = 1; return ErOK; } int EList::MovePageDown() { int W, H; if (Row == Count - 1) return ErFAIL; View->MView->Win->ConQuerySize(&W, &H); H--; Row += H; TopRow += H; if (Row >= Count) Row = Count - 1; if (TopRow > Row) TopRow = Row; if (Row < 0) Row = 0; if (TopRow < 0) TopRow = 0; NeedsUpdate = 1; return ErOK; } int EList::ScrollRight(int Cols) { if (LeftCol >= Cols) { LeftCol -= Cols; NeedsUpdate = 1; } else if (LeftCol != 0) { LeftCol = 0; NeedsUpdate = 1; } else return ErFAIL; return ErOK; } int EList::ScrollLeft(int Cols) { LeftCol += Cols; NeedsUpdate = 1; return ErOK; } int EList::ScrollUp(int Rows) { if (TopRow == Count - 1) return ErFAIL; TopRow += Rows; Row += Rows; if (Row >= Count) Row = Count - 1; if (Row < 0) Row = 0; if (TopRow > Row) TopRow = Row; NeedsUpdate = 1; return ErOK; } int EList::ScrollDown(int Rows) { TopRow -= Rows; Row -= Rows; if (Row < 0) Row = 0; if (TopRow < 0) TopRow = 0; NeedsUpdate = 1; return ErOK; } int EList::MovePageStart() { if (Row <= TopRow) return ErFAIL; Row = TopRow; NeedsUpdate = 1; return ErOK; } int EList::MovePageEnd() { int W, H; if (Row == Count - 1) return ErOK; View->MView->Win->ConQuerySize(&W, &H); H--; if (Row == TopRow + H - 1) return ErOK; Row = TopRow + H - 1; if (Row >= Count) Row = Count - 1; if (Row < 0) Row = 0; NeedsUpdate = 1; return ErOK; } int EList::MoveFileStart() { if (Row == 0 && LeftCol == 0) return ErOK; Row = 0; LeftCol = 0; NeedsUpdate = 1; return ErOK; } int EList::MoveFileEnd() { if (Row == Count - 1 && LeftCol == 0) return 0; Row = Count - 1; if (Row < 0) Row = 0; NeedsUpdate = 1; LeftCol = 0; return ErOK; } int EList::Activate() { if (Count > 0) if (CanActivate(Row)) if (Activate(Row) == 1) return ErOK; return ErFAIL; } int EList::Mark() { if (Count > 0 && ! IsMarked(Row) && Mark(Row) == 1) { NeedsRedraw = 1; return ErOK; } else return ErFAIL; } int EList::Unmark() { if (Count > 0 && IsMarked(Row) && Unmark(Row) == 1) { NeedsRedraw = 1; return ErOK; } else return ErFAIL; } int EList::ToggleMark() { if (Count > 0) { if (IsMarked(Row)) { if (Unmark(Row) == 1) { NeedsRedraw = 1; return ErOK; } } else { if (Mark(Row) == 1) { NeedsRedraw = 1; return ErOK; } } } return ErFAIL; } int EList::MarkAll() { NeedsRedraw = 1; for (int i = 0; i < Count; i++) { if (! IsMarked(i)) if (Mark(i) != 1) return ErFAIL; } return ErOK; } int EList::UnmarkAll() { NeedsRedraw = 1; for (int i = 0; i < Count; i++) { if (IsMarked(i)) if (Unmark(i) != 1) return ErFAIL; } return ErOK; } int EList::ToggleMarkAll() { NeedsRedraw = 1; for (int i = 0; i < Count; i++) { if (IsMarked(i)) { if (Unmark(i) != 1) return ErFAIL; } else { if (Mark(i) != 1) return ErFAIL; } } return ErOK; } efte-1.1/src/c_bind.h0000664000076400007640000000710011042635671013503 0ustar laurilauri/* c_bind.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __BIND_H #define __BIND_H #include "console.h" #include "o_model.h" #include "c_mode.h" // EM_MENUS #include "e_regex.h" #define ABBREV_HASH 16 class EMode; class EEventMap; class EKeyMap; class EKey; class EAbbrev; class EView; class EColorize; typedef struct { TKeyCode Mask; TKeyCode Key; } KeySel; typedef struct { RxNode *regex; int look_line; int affect_line; int indent; int flags; } IndentRx; class EMode { public: EMode *fNext; char *fName; char *MatchName; char *MatchLine; RxNode *MatchNameRx; RxNode *MatchLineRx; EBufferFlags Flags; EEventMap *fEventMap; EMode *fParent; EColorize *fColorize; IndentRx indents[25]; int indent_count; char filename[256]; EMode(EMode *aMode, EEventMap *Map, const char *aName); ~EMode(); EAbbrev *FindAbbrev(const char *string); void AddIndentRx(int look_line, int affect_line, int indent, const char *regex, int flags); }; class EKeyMap { public: EKeyMap *fParent; EKey *fKeys; EKeyMap(); ~EKeyMap(); void AddKey(EKey *aKey); EKey *FindKey(TKeyCode aKey); }; class EEventMap { public: EEventMap *Next; EEventMap *Parent; char *Name; EKeyMap *KeyMap; char *Menu[EM_MENUS]; // main + local EAbbrev *abbrev[ABBREV_HASH]; EEventMap(const char *AName, EEventMap *AParent); ~EEventMap(); void SetMenu(int which, const char *What); char *GetMenu(int which); int AddAbbrev(EAbbrev *ab); }; #define CT_COMMAND 0 #define CT_NUMBER 1 #define CT_STRING 2 #define CT_VARIABLE 3 #define CT_CONCAT 4 /* concatenate strings */ typedef struct { int type; short repeat; short ign; union { long num; char *string; } u; } CommandType; typedef struct { char *Name; int Count; CommandType *cmds; } ExMacro; class EKey { public: KeySel fKey; int Cmd; EKeyMap *fKeyMap; EKey *fNext; EKey(char *aKey); EKey(char *aKey, EKeyMap *aKeyMap); ~EKey(); }; class EAbbrev { public: EAbbrev *next; int Cmd; char *Match; char *Replace; EAbbrev(const char *aMatch, const char *aReplace); EAbbrev(const char *aMatch, int aCmd); ~EAbbrev(); }; class ExState { // state of macro execution public: int Macro; int Pos; int GetStrParam(EView *view, char *str, int buflen); int GetIntParam(EView *view, int *value); }; extern EMode *Modes; extern EEventMap *EventMaps; extern int CMacros; extern ExMacro *Macros; int GetCharFromEvent(TEvent &E, char *Ch); const char *GetCommandName(int Command); EMode *FindMode(const char *Name); EEventMap *FindEventMap(const char *Name); EEventMap *FindActiveMap(EMode *Mode); EMode *GetModeForName(const char *FileName); int CmdNum(const char *Cmd); void ExecKey(EKey *Key); EKey *SetKey(EEventMap *aMap, const char *Key); int ParseKey(const char *Key, KeySel &ks); int GetKeyName(char *Key, int KeySize, KeySel &ks); void DefineWord(const char *s); int NewCommand(const char *Name); int RunCommand(int Command); int AddCommand(int no, int cmd, int count, int ign); int AddString(int no, const char *Command); int AddNumber(int no, long number); int AddVariable(int no, int number); int AddConcat(int no); int HashStr(const char *str, int maxim); void SetWordChars(char *w, const char *s); #endif efte-1.1/src/i_complete.h0000664000076400007640000000242311041404761014401 0ustar laurilauri/* i_ascii.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __EXCOMPLETE_H #define __EXCOMPLETE_H #include // maximum words which will be presented to the user #define MAXCOMPLETEWORDS 300 class ExComplete: public ExView { EPoint Orig; EBuffer *Buffer; int WordsLast; char **Words; char *WordBegin; char *WordContinue; int WordPos; size_t WordFixed; size_t WordFixedCount; int RefreshComplete(); inline int CheckASCII(int c) { return ((c < 256) && (isalnum(c) || (c == '_') || (c == '.'))) ? 1 : 0; } void FixedUpdate(int add); public: ExComplete(EBuffer *B); virtual ~ExComplete(); virtual void Activate(int gotfocus); virtual ExView* GetViewContext() { return Next; } virtual int BeginMacro(); virtual void HandleEvent(TEvent &Event); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); virtual bool IsSimpleCase(); virtual int DoCompleteWord(); }; #endif efte-1.1/src/dialog.h0000664000076400007640000000106111041404761013515 0ustar laurilauri/* dialog.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __DIALOG_H__ #define __DIALOG_H__ #define askYes 0 #define askNo 1 #define askCancel 2 #define askOK 3 int AskString(char *Prompt, char *String, int MaxLen); int AskYesNo(char *Prompt); int AskYesNoCancel(char *Prompt); int AskOKCancel(char *Prompt); #endif efte-1.1/src/console.h0000664000076400007640000001174111041404761013726 0ustar laurilauri/* console.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __CONSOLE_H__ #define __CONSOLE_H__ /* don't change these, used as index */ #define DCH_C1 0 #define DCH_C2 1 #define DCH_C3 2 #define DCH_C4 3 #define DCH_H 4 #define DCH_V 5 #define DCH_M1 6 #define DCH_M2 7 #define DCH_M3 8 #define DCH_M4 9 #define DCH_X 10 #define DCH_RPTR 11 #define DCH_EOL 12 #define DCH_EOF 13 #define DCH_END 14 #define DCH_AUP 15 #define DCH_ADOWN 16 #define DCH_HFORE 17 #define DCH_HBACK 18 #define DCH_ALEFT 19 #define DCH_ARIGHT 20 #define ConMaxCols 256 #define ConMaxRows 128 #define csUp 0 #define csDown 1 #define csLeft 2 #define csRight 3 #define evNone 0 #define evKeyDown 0x0001 #define evKeyUp 0x0002 #define evMouseDown 0x0010 #define evMouseUp 0x0020 #define evMouseMove 0x0040 #define evMouseAuto 0x0080 #define evCommand 0x0100 #define evBroadcast 0x0200 #define evNotify 0x0400 #define evKeyboard (evKeyDown | evKeyUp) #define evMouse (evMouseDown | evMouseUp | evMouseMove | evMouseAuto) #define evMessage (evCommand | evBroadcast) #include "conkbd.h" #define cmRefresh 1 #define cmResize 2 #define cmClose 3 #define cmPipeRead 4 #define cmMainMenu 5 #define cmPopupMenu 6 /* vertical scroll */ #define cmVScrollUp 10 #define cmVScrollDown 11 #define cmVScrollPgUp 12 #define cmVScrollPgDn 13 #define cmVScrollMove 14 /* horizontal scroll */ #define cmHScrollLeft 15 #define cmHScrollRight 16 #define cmHScrollPgLt 17 #define cmHScrollPgRt 18 #define cmHScrollMove 19 #define cmDroppedFile 30 #define cmRenameFile 31 /* TODO: in-place editing of titlebar */ typedef unsigned char TAttr; typedef TAttr *PAttr; #ifdef NTCONSOLE typedef unsigned long TCell; #else typedef unsigned short TCell; #endif typedef TCell *PCell; typedef TCell TDrawBuffer[ConMaxCols]; typedef TDrawBuffer *PDrawBuffer; typedef unsigned long TEventMask; typedef unsigned long TKeyCode; typedef unsigned long TCommand; class EModel; // forward class GView; typedef struct { TEventMask What; GView* View; TKeyCode Code; } TKeyEvent; typedef struct { TEventMask What; GView* View; long X; long Y; unsigned short Buttons; unsigned short Count; TKeyCode KeyMask; } TMouseEvent; typedef struct { TEventMask What; GView *View; EModel *Model; TCommand Command; long Param1; void *Param2; } TMsgEvent; typedef union { TEventMask What; TKeyEvent Key; TMouseEvent Mouse; TMsgEvent Msg; char fill[32]; } TEvent; #define SUBMENU_NORMAL (-1) #define SUBMENU_CONDITIONAL (-2) typedef struct _mItem { char *Name; char *Arg; int SubMenu; int Cmd; } mItem; typedef struct _mMenu { char *Name; int Count; mItem *Items; } mMenu; extern int MenuCount; extern mMenu *Menus; int ConInit(int XSize, int YSize); int ConDone(); int ConSuspend(); int ConContinue(); int ConSetTitle(char *Title, char *STitle); int ConGetTitle(char *Title, int MaxLen, char *STitle, int SMaxLen); int ConClear(); int ConPutBox(int X, int Y, int W, int H, PCell Cell); int ConGetBox(int X, int Y, int W, int H, PCell Cell); int ConPutLine(int X, int Y, int W, int H, PCell Cell); int ConSetBox(int X, int Y, int W, int H, TCell Cell); int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); int ConSetCursorPos(int X, int Y); int ConQueryCursorPos(int *X, int *Y); int ConShowCursor(); int ConHideCursor(); int ConCursorVisible(); void ConSetInsertState(bool insert); int ConSetMousePos(int X, int Y); int ConQueryMousePos(int *X, int *Y); int ConShowMouse(); int ConHideMouse(); int ConMouseVisible(); int ConQueryMouseButtons(int *ButtonCount); int ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete); int ConPutEvent(TEvent Event); void MoveCh(PCell B, char Ch, TAttr Attr, int Count); void MoveChar(PCell B, int Pos, int Width, const char Ch, TAttr Attr, int Count); void MoveMem(PCell B, int Pos, int Width, const char* Ch, TAttr Attr, int Count); void MoveStr(PCell B, int Pos, int Width, const char* Ch, TAttr Attr, int MaxCount); void MoveCStr(PCell B, int Pos, int Width, const char* Ch, TAttr A0, TAttr A1, int MaxCount); void MoveAttr(PCell B, int Pos, int Width, TAttr Attr, int Count); void MoveBgAttr(PCell B, int Pos, int Width, TAttr Attr, int Count); int CStrLen(const char *s); int NewMenu(const char *Name); int NewItem(int menu, const char *Name); int NewSubMenu(int menu, const char *Name, int submenu, int type); int GetMenuId(const char *Name); char ConGetDrawChar(int index); extern char WindowFont[64]; typedef struct { unsigned char r, g, b; } TRGBColor; extern TRGBColor RGBColor[16]; extern bool RGBColorValid[16]; #endif efte-1.1/src/simple.fte0000664000076400007640000003115611042237774014117 0ustar laurilauricolor_palette {{"black","0 0"},{"gray","7 7"}} color_palette {{"black","0 0"}, {"darkBlue","1 1"},{"darkGreen","2 2"},{"darkCyan","3 3"},{"darkRed","4 4"}, {"darkMagenta","5 5"},{"brown","6 6"},{"gray","7 7"},{"darkGray","8 8"}, {"blue","9 9"},{"green","A A"},{"cyan","B B"},{"red","C C"},{"magenta","D D"}, {"yellow","E E"},{"white","F F"}} color_palette { {"ScrollBar_Arrows","black:gray"}, {"ScrollBar_Background","gray:black"}, {"ScrollBar_Slider","black:gray"}, {"Status_Normal","black:darkCyan"}, {"Status_Active","black:gray"}, {"Message_Normal","Status_Normal"}, {"Message_Error","white:darkBlue"}, {"Message_Bold","white:darkRed"}, {"EntryField_Field","cyan:darkBlue"}, {"EntryField_Prompt","white:darkBlue"}, {"EntryField_Selection","black:darkGreen"}, {"List_Status","black:gray"}, {"List_Normal","gray:black"}, {"List_Selected","white:darkBlue"}, {"List_Hilited","white:black"}, {"List_HilitSelect","white:darkBlue"}, {"List_Marked","yellow:black"}, {"List_MarkSelect","yellow:darkBlue"}, {"List_MarkHilit","yellow:black"}, {"List_MarkHilitSel","yellow:darkBlue"}, {"ASCII_Chars","gray:black"}, {"Menu_Background","black:gray"}, {"Menu_ActiveItem","white:darkBlue"}, {"Menu_ActiveChar","red:darkBlue"}, {"Menu_NormalItem","black:gray"}, {"Menu_NormalChar","red:gray"}, {"Choice_Title","white:darkBlue"}, {"Choice_Param","cyan:darkBlue"}, {"Choice_Background","gray:darkBlue"}, {"Choice_ActiveItem","black:darkGreen"}, {"Choice_ActiveChar","white:darkGreen"}, {"Choice_NormalItem","white:darkBlue"}, {"Choice_NormalChar","yellow:darkBlue"}, {"bg","gray:black"}, {"fg","gray:black"}, {"Editor_Selected","black:darkCyan"}, {"Editor_Markers","darkCyan:bg"}, {"Editor_FoundText","white:darkRed"}, {"Editor_HilitWord","red:bg"}, {"Editor_Default","fg:bg"}, {"Editor_Bold","cyan:bg"}, {"Editor_Keywords","white:bg"}, {"Editor_Keywords2","cyan:bg"}, {"Editor_Keywords3","green:bg"}, {"Editor_Keywords4","magenta:bg"}, {"Editor_Keywords5","darkCyan:bg"}, {"Comment","brown:bg"}, {"String","yellow:bg"}, {"Lang_Default","Editor_Default"}, {"Lang_Number","red:bg"}, {"Lang_DecimalNumber","Lang_Number"}, {"Lang_HexNumber","magenta:bg"}, {"Lang_OctalNumber","magenta:bg"}, {"Lang_BinaryNumber","magenta:bg"}, {"Lang_Punctuation","darkCyan:bg"}, {"Lang_String","String"}, {"Lang_Comment","Comment"}, {"Lang_Preprocessor","green:bg"}, {"Lang_Function","cyan:bg"}, {"Lang_Label","red:bg"}, {"Lang_Command","cyan:bg"}, {"Lang_Regexp","magenta:bg"}, {"Lang_Variable","gray:bg"}, {"Lang_Control","darkCyan:bg"}, {"Lang_Assembler","blue:bg"}} colorize PLAIN {SyntaxParser = "PLAIN";color {{"Normal","Editor_Default"}};} mode PLAIN { Abbreviations = 1;AddCR = 1;AddLF = 1;AutoIndent = 1;BackSpKillBlock = 0; BackSpKillTab = 0;BackSpUnindents = 1;Colorizer = "PLAIN";CursorThroughTabs = 1; DefFindOpt = "i";DefFindReplaceOpt = "a";DeleteKillBlock = 0;DeleteKillTab = 0; DetectLineSep = 1;ExpandTabs = 1;ForceNewLine = 0;HilitOn = 0;HilitTags = 0; IndentMode = "PLAIN";IndentWithTabs = 0;Insert = 1;InsertKillBlock = 0; KeepBackups = 1;LeftMargin = 1;LineChar = 10;LoadMargin = -1;MatchCase = 0; MultiLineHilit = 0;PersistentBlocks = 1;RightMargin = 72;SaveBookmarks = 0; MakeBackups = 1;SeeThruSel = 0;ShowMarkers = 1;ShowTabs = 0;SpaceTabs = 0; StripChar = 13;TabSize = 8;Trim = 0;TrimOnSave = 0;Undo = 1;UndoLimit = 1023; UndoMoves = 0;WordWrap = 0; } mode SOURCE:PLAIN {} object GLOBAL { DefaultModeName = "PLAIN"; WindowFont = "9x15"; #WindowFont = "*-fixed-bold-*-15*,*-fixed-bold-*-16*"; } menu Object { item "&Open...\tF3" {FileOpen;} item; item "&Next\tAlt+Right" {FileNext;} item "&Previous\tAlt+Left" {FilePrev;} item; item "&Close\tAlt+Q" {FileClose;} item "Close All" {FileCloseAll;} item; item "E&xit\tAlt+X" {ExitEditor;} } menu Tools { item "&Grep..." {AskCompiler "grep -n";} item; item "&Shell\tAlt+F9" {RunProgram;} item "&Run...\tCtrl+F9" {RunProgram;} item; item "&Messages\tS+F9" {ViewMessages;} item "C&lear Messages" {ClearMessages;} } menu Window { item "Split &Horizontal\tCtrl+F4" {WinHSplit;} item "&Close view\tCtrl+Alt+F4" {WinClose;} item "Close &other views\tF5" {WinZoom;} } menu Help { item "&Keyboard\tF1" {ViewModeMap;} item "&Show key" {ShowKey;} item; item "&About..." {ShowVersion;} } menu Navigate { item "&Reload\tCtrl+R" {Rescan;} item; item "Go &< level\tCtrl+PgUp" {DirGoUp;} item "Go &> level\tCtrl+PgDn" {DirGoDown;} item "Go to &\\\tCtrl+\\" {DirGoRoot;} item "&/ Goto Dir\t/" {DirGoto;} item; item "R&ename File" {RenameFile;} item "&Make Directory" {MakeDirectory;} item; item "Delete &File\tCtrl+D" {DeleteFile;} } menu File { item "&Open...\tF3" {FileOpen;} item "Open &Directory\tC+M" {DirOpen;} item "&Reload\tShift+F3" {FileReload;} item; item "&Save\tF2" {FileSave;} item "Save &As...\tShift+F2" {FileSaveAs;} item "Save Al&l\tCtrl+F2" {FileSaveAll;} item; item "&Next\tAlt+Right" {FileNext;} item "&Previous\tAlt+Left" {FilePrev;} item; item "&Close\tAlt+Q" {FileClose;} item "Close All" {FileCloseAll;} item; item "E&xit\tAlt+X" {ExitEditor;} } menu Edit { item "&Undo\tAlt+BackSp" {Undo;} item "&Redo\tAlt+Shift+BackSp" {Redo;} item; item "Cu&t\tShift+Del" {BlockCut;} item "&Copy\tCtrl+Ins" {BlockCopy;} item "Cut&-Append" {BlockCutAppend;} item "Copy-Appe&nd" {BlockCopyAppend;} item "&Paste Stream\tShift+Ins" {BlockPasteStream;} item "Paste Colu&mn\tAlt+Ins" {BlockPasteColumn;} item "Paste Li&ne" {BlockPasteLine;} item "Cl&ear\tCtrl+Del" {BlockKill;} } menu Block { item "&Unmark\tEsc" {BlockUnmark;} item "Mark &Stream\tAlt+A" {BlockMarkStream;} item "Mark &Column\tAlt+K" {BlockMarkColumn;} item "Mark &Line\tAlt+L" {BlockMarkLine;} } menu SearchWords { item "Search &Prev\tAlt+," {SearchWordPrev;} item "Search &Next\tAlt+." {SearchWordNext;} item "&Highlight\tAlt+/" {HilitWord;} } menu Search { item "&Find...\tCtrl+F" {Find;} item "Find &Next\tCtrl+G" {FindRepeat;} item "Find &Prev\tCtrl+H" {FindRepeatReverse;} item "Find and &Replace...\tCtrl+R" {FindReplace;} item; item "&Goto Line...\tAlt+J" {MoveToLine;} item "Goto &Column..." {MoveToColumn;} } menu Main { submenu "&File",File; submenu "&Edit",Edit; submenu "&Block",Block; submenu "&Search",Search; submenu "&Tools",Tools; submenu "&Window",Window; submenu "&Options",Options; submenu "&Help",Help; } menu Local { item "&Unmark\tEsc" {BlockUnmark;} item "Cu&t\tShift+Del" {BlockCut;} item "&Copy\tCtrl+Ins" {BlockCopy;} item "&Paste\tShift+Ins" {BlockPasteStream;} item "P&aste Column\tAlt+Ins" {BlockPasteColumn;} item; item "Delete &line\tCtrl+Y" {KillLine;} item "Delete to &EOL\tAlt+End" {KillToLineEnd;} item; item "&Save\tF2" {FileSave;} item "Cl&ose\tAlt+Q" {FileClose;} } menu DirectoryFile { item "&Selected\tEnter" {Activate;} item; item "&Open...\tF3" {FileOpen;} item; item "&Next\tAlt+Right" {FileNext;} item "&Previous\tAlt+Left" {FilePrev;} item; item "&Close\tAlt+Q" {FileClose;} item; item "E&xit\tAlt+X" {ExitEditor;} } menu DirectoryMain { submenu "&File",DirectoryFile; submenu "&Navigate",Navigate; submenu "&Tools",Tools; submenu "&Window",Window; submenu "&Help",Help; } menu MessagesMain { submenu "&File",Object; submenu "&Tools",Tools; submenu "&Window",Window; submenu "&Help",Help; } menu RoutinesMain { submenu "&File",Object; submenu "&Tools",Tools; submenu "&Window",Window; submenu "&Help",Help; } menu BufferListMain { submenu "&File",Object; submenu "&Tools",Tools; submenu "&Window",Window; submenu "&Help",Help; } menu EventMapViewMain { submenu "&File",Object; submenu "&Tools",Tools; submenu "&Window",Window; submenu "&Help",Help; } menu DirectoryLocal { item "&Open" {Activate;} item; item "&Reload\tCtrl+R" {Rescan;} item; item "Go &< level\tCtrl+PgUp" {DirGoUp;} item "Go &> level\tCtrl+PgDn" {DirGoDown;} item "Go to &\\\tCtrl+\\" {DirGoRoot;} item "&/ Goto Dir\t/" {DirGoto;} item; item "R&ename File" {RenameFile;} item "&Make Directory" {MakeDirectory;} item; item "Delete &File\tCtrl+D" {DeleteFile;} } menu BufferListLocal { item "&View\tEnter" {Activate;} item; item "&Save\tCtrl+S" {BufListFileSave;} item "&Close\tCtrl+C" {BufListFileClose;} } menu RoutinesLocal { item "&View\tEnter" {Activate;} } menu EventMapViewLocal { item "&Close view\tAlt+Q" {FileClose;} } menu MessagesLocal { item "&View error\tEnter" {Activate;} item; item "&Previous error\tF11" {CompilePrevError;} item "&Next error\tF12" {CompileNextError;} } eventmap MODEL { key [F1] {ViewModeMap;} key [C+F2] {FileSaveAll;} key [F3] {FileOpen;} key [F4] {WinNext;} key [C+F4] {WinHSplit;} key [S+F4] {WinPrev;} key [A+S+F4] {WinClose;} key [F5] {WinZoom;} key [F6] {FileNext;} key [S+F6] {FilePrev;} key [A+S-F6] {FileLast;} key [F7] {Find $Word;} key [F10] {MainMenu;} key [C+F10] {FileClose;} key [C+F9] {RunProgram;} key [A+F9] {RunProgram;} key [S+F10] {LocalMenu;} key [A+G-Up] {WinPrev;} key [A+G-Down] {WinNext;} key [A+G-Left] {FilePrev;} key [A+G-Right] {FileNext;} key [A+G-PgUp] {WinPrev MovePageUp WinNext;} key [A+G-PgDn] {WinNext MovePageDown WinPrev;} key [A+C+G-PgUp] {WinNext MovePageUp WinPrev;} key [A+C+G-PgDn] {WinPrev MovePageDown WinNext;} key [A+X] {ExitEditor;} key [A+Q] {FileClose;} key [C+S+G-Up] {WinResize -1;} key [C+S+G-Down] {WinResize +1;} key [S+F9] {ViewMessages;} key [A+F5] {ShowEntryScreen;} key [A+0] {ViewBuffers;} key [A+F] {MainMenu "F";} key [A+T] {MainMenu "T";} key [A+W] {MainMenu "W";} key [A+H] {MainMenu "H";} } eventmap MLIST: MODEL { key [G-Left] {MoveLeft;} key [G-Right] {MoveRight;} key [G-Up] {MoveUp;} key [G-Down] {MoveDown;} key [G-Home] {MoveFileStart;} key [C+G-Home] {MovePageStart;} key [G-End] {MoveFileEnd;} key [C+G-End] {MovePageEnd;} key [G-PgUp] {MovePageUp;} key [C+G-PgUp] {MoveFileStart;} key [G-PgDn] {MovePageDown;} key [C+G-PgDn] {MoveFileEnd;} key [C+G-Left] {ScrollRight;} key [C+G-Right] {ScrollLeft;} key [G-Enter] {Activate;} key [Space] {ActivateInOtherWindow;} key [S+G-Enter] {CloseActivate;} key [C+R] {Rescan;} } eventmap DIRECTORY: MLIST { MainMenu = "DirectoryMain"; LocalMenu = "DirectoryLocal"; key [C+G-PgUp] {DirGoUp;} key [C+G-PgDn] {DirGoDown;} key [C+\\] {DirGoRoot;} key [/] {DirGoto;} key [\\] {DirGoto;} key [C+D] {DeleteFile;} key [Esc] {FileClose;} key [C+G] {DirSearchNext;} key [C+H] {DirSearchPrev;} key [A+N] {MainMenu "N";} } eventmap BUFFERS: MLIST { MainMenu = "BufferListMain"; LocalMenu = "BufferListLocal"; key [Esc] {FileClose;} key [C+C] {BufListFileClose;} key [G-Del] {BufListFileClose;} key [C+S] {BufListFileSave;} key [F2] {BufListFileSave;} } eventmap MESSAGES: MLIST { MainMenu = "MessagesMain"; LocalMenu = "MessagesLocal"; key [C+C] {ChildClose;} key [G-Home] {MoveLineStart;} key [G-End] {MoveLineEnd;} } eventmap EVENTMAPVIEW: MLIST { MainMenu = "EventMapViewMain"; LocalMenu = "EventMapViewLocal"; key [Esc] {FileClose;} } eventmap PLAIN: MODEL { MainMenu = "Main"; LocalMenu = "Local"; key [Esc] {BlockMarkStream BlockUnmark;} key [F2] {FileSave;} key [S+F2] {FileSaveAs;} key [A+S+F2] {FileSave FileClose;} key [S+F3] {FileReload WinRefresh;} key [C+F3] {FileOpenInMode;} key [F7] {BlockBegin;} key [S+F7] {MoveBlockStart;} key [F8] {BlockEnd;} key [S+F8] {MoveBlockEnd;} key [G-Left] {MoveLeft;} key [C+G-Left] {MoveWordPrev;} key [G-Right] {MoveRight;} key [C+G-Right] {MoveWordNext;} key [G-Up] {MoveUp;} key [G-Down] {MoveDown;} key [G-Home] {MoveLineStart;} key [C+G-Home] {MovePageStart;} key [G-End] {MoveLineEnd;} key [C+G-End] {MovePageEnd;} key [G-PgUp] {MovePageUp;} key [C+G-PgUp] {MoveFileStart;} key [G-PgDn] {MovePageDown;} key [C+G-PgDn] {MoveFileEnd;} key [C+G-Ins] {BlockCopy;} key [C+G-Del] {BlockKill;} key [S+G-Ins] {BlockPasteStream;} key [S+G-Del] {BlockCut;} key [A+G-Ins] {BlockPasteColumn;} key [A+G-S+Ins] {BlockPasteLine;} key [G-Enter] {LineNew;} key [S-BackSp] {BackSpace;} key [G-Del] {Delete;} key [Tab] {InsertTab;} key [C+Tab] {CompleteWord;} key [C+BackSp] {KillWordPrev;} key [C+S+BackSp] {KillToLineStart;} key [C+G-Enter] {LineSplit;} key [G-S+Enter] {LineInsert;} key [A+G-Enter] {LineAdd;} key [A+G-Del] {KillWord;} key [A+G-End] {KillToLineEnd;} key [A+BackSp] {Undo;} key [A+S+BackSp] {Redo;} key [C+C] {BlockCopy;} key [C+V] {BlockPaste;} key [C+X] {BlockCut;} key [C+Z] {Undo;} key [C+S+Z] {Redo;} key [C+D] {LineDuplicate;} key [C+F] {Find;} key [C+G] {FindRepeat;} key [C+J] {LineJoin;} key [C+H] {FindRepeatReverse;} key [C+M] {DirOpen;} key [C+R] {FindReplace;} key [C+T] {KillWord;} key [C+Y] {KillLine;} key [A+A] {BlockMarkStream;} key [A+B] {MainMenu "B";} key [A+C] {BlockCopy;} key [A+D] {MainMenu "D";} key [A+E] {MainMenu "E";} key [A+G] {BlockCut;} key [A+J] {MoveToLine;} key [A+K] {BlockMarkColumn;} key [A+L] {BlockMarkLine;} key [A+O] {MainMenu "O";} key [A+R] {WrapPara;} key [A+S] {MainMenu "S";} key [C+S] {IncrementalSearch;} key [A+-] {MatchBracket;} key [A+=] {HilitMatchBracket;} key [C+Space] {InsPrevLineChar;} key [A+Space] {InsPrevLineToEol;} key [C+_] {ShowPosition;} key [C+-] {ShowPosition;} key [A+,] {SearchWordPrev;} key [A+.] {SearchWordNext;} key [A+/] {HilitWord;}} efte-1.1/src/o_buflist.cpp0000664000076400007640000001457511041404761014615 0ustar laurilauri/* o_buflist.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" BufferView *BufferList = 0; BufferView::BufferView(int createFlags, EModel **ARoot): EList(createFlags, ARoot, "Buffers") { ModelNo = 0; // trick BList = 0; BCount = 0; SearchLen = 0; } BufferView::~BufferView() { if (BList) { for (int i = 0; i < BCount; i++) if (BList[i]) free(BList[i]); free(BList); } BufferList = 0; } EEventMap *BufferView::GetEventMap() { return FindEventMap("BUFFERS"); } int BufferView::GetContext() { return CONTEXT_BUFFERS; } void BufferView::DrawLine(PCell B, int Line, int Col, ChColor color, int Width) { if (Line < BCount) if (Col < int(strlen(BList[Line]))) MoveStr(B, 0, Width, BList[Line] + Col, color, Width); } char* BufferView::FormatLine(int Line) { return strdup(BList[Line]); } void BufferView::UpdateList() { EModel *B = ActiveModel; int No; char s[512] = ""; if (BList) { for (int i = 0; i < BCount; i++) if (BList[i]) free(BList[i]); free(BList); } BList = 0; BCount = 0; while (B) { BCount++; B = B->Next; if (B == ActiveModel) break; } BList = (char **) malloc(sizeof(char *) * BCount); assert(BList != 0); B = ActiveModel; No = 0; while (B) { B->GetInfo(s, sizeof(s) - 1); BList[No++] = strdup(s); B = B->Next; if (B == ActiveModel) break; if (No >= BCount) break; } Count = BCount; NeedsUpdate = 1; } EModel *BufferView::GetBufferById(int No) { EModel *B; B = ActiveModel; while (B) { if (No == 0) { return B; } No--; B = B->Next; if (B == ActiveModel) break; } return 0; } int BufferView::ExecCommand(int Command, ExState &State) { switch (Command) { case ExCloseActivate: { EModel *B; CancelSearch(); B = GetBufferById(Row); if (B && B != this) { View->SwitchToModel(B); delete this; return ErOK; } } return ErFAIL; case ExBufListFileClose: { EModel *B = GetBufferById(Row); CancelSearch(); if (B && B != this && Count > 1) { if (B->ConfQuit(View->MView->Win)) { View->DeleteModel(B); } UpdateList(); return ErOK; } } return ErFAIL; case ExBufListFileSave: { EModel *B = GetBufferById(Row); if (B && B->GetContext() == CONTEXT_FILE) if (((EBuffer *)B)->Save()) return ErOK; } return ErFAIL; case ExActivateInOtherWindow: { EModel *B = GetBufferById(Row); CancelSearch(); if (B) { View->Next->SwitchToModel(B); return ErOK; } } return ErFAIL; case ExBufListSearchCancel: CancelSearch(); return ErOK; case ExBufListSearchNext: // Find next matching line if (SearchLen) { int i = Row + 1; i = getMatchingLine(i == BCount ? 0 : i, 1); // Never returns -1 since something already found before call Row = SearchPos[SearchLen] = i; } return ErOK; case ExBufListSearchPrev: // Find prev matching line if (SearchLen) { int i = Row - 1; i = getMatchingLine(i == -1 ? BCount - 1 : i, -1); // Never returns -1 since something already found before call Row = SearchPos[SearchLen] = i; } return ErOK; } return EList::ExecCommand(Command, State); } void BufferView::HandleEvent(TEvent &Event) { int resetSearch = 1; EModel::HandleEvent(Event); switch (Event.What) { case evKeyUp: resetSearch = 0; break; case evKeyDown: switch (kbCode(Event.Key.Code)) { case kbBackSp: resetSearch = 0; if (SearchLen > 0) { SearchString[--SearchLen] = 0; Row = SearchPos[SearchLen]; Msg(S_INFO, "Search: [%s]", SearchString); } else Msg(S_INFO, ""); break; case kbEsc: Msg(S_INFO, ""); break; default: resetSearch = 0; if (isAscii(Event.Key.Code) && (SearchLen < MAXISEARCH)) { char Ch = (char) Event.Key.Code; SearchPos[SearchLen] = Row; SearchString[SearchLen] = Ch; SearchString[++SearchLen] = 0; int i = getMatchingLine(Row, 1); if (i == -1) SearchString[--SearchLen] = 0; else Row = i; Msg(S_INFO, "Search: [%s]", SearchString); } break; } } if (resetSearch) { SearchLen = 0; } } /** * Search for next line containing SearchString starting from line 'start'. * Direction should be 1 for ascending and -1 for descending. * Returns line found or -1 if none. */ int BufferView::getMatchingLine(int start, int direction) { int i = start; do { // Find SearchString at any place in string for line i for (int j = 0; BList[i][j]; j++) if (BList[i][j] == SearchString[0] && strnicmp(SearchString, BList[i] + j, SearchLen) == 0) { return i; } i += direction; if (i == BCount) i = 0; else if (i == -1) i = BCount - 1; } while (i != start); return -1; } int BufferView::Activate(int No) { EModel *B; CancelSearch(); B = GetBufferById(No); if (B) { View->SwitchToModel(B); return 1; } return 0; } void BufferView::CancelSearch() { SearchLen = 0; Msg(S_INFO, ""); } void BufferView::GetInfo(char *AInfo, int /*MaxLen*/) { sprintf(AInfo, "%2d %04d/%03d Buffers", ModelNo, Row + 1, Count); } void BufferView::GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen) { strncpy(ATitle, "Buffers", MaxLen); ATitle[MaxLen - 1] = 0; strncpy(ASTitle, "Buffers", SMaxLen); ASTitle[SMaxLen - 1] = 0; } efte-1.1/src/i_key.h0000664000076400007640000000141211041404761013356 0ustar laurilauri/* i_key.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __EXKEY_H #define __EXKEY_H class ExKey: public ExView { public: char *Prompt; TKeyCode Key; char ch; ExKey(const char *APrompt); virtual ~ExKey(); virtual void Activate(int gotfocus); virtual ExView* GetViewContext() { return Next; } virtual int BeginMacro(); virtual void HandleEvent(TEvent &Event); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); }; #endif efte-1.1/src/i_ascii.cpp0000664000076400007640000000704311041404761014217 0ustar laurilauri/* i_ascii.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" static int SPos = 0; static int SLPos = 0; ExASCII::ExASCII(): ExView() { Pos = SPos; LPos = SLPos; } ExASCII::~ExASCII() { SPos = Pos; SLPos = LPos; } void ExASCII::Activate(int gotfocus) { ExView::Activate(gotfocus); } int ExASCII::BeginMacro() { return 1; } void ExASCII::HandleEvent(TEvent &Event) { int W, H; ConQuerySize(&W, &H); switch (Event.What) { case evKeyDown: switch (kbCode(Event.Key.Code)) { case kbLeft: Pos--; Event.What = evNone; break; case kbRight: Pos++; Event.What = evNone; break; case kbHome: Pos = 0; Event.What = evNone; break; case kbEnd: Pos = 255; Event.What = evNone; break; case kbLeft + kfCtrl: Pos -= 16; Event.What = evNone; break; case kbRight + kfCtrl: Pos += 16; Event.What = evNone; break; case kbUp: Pos -= W; LPos -= W; Event.What = evNone; break; case kbDown: Pos += W; LPos += W; Event.What = evNone; break; case kbEsc: EndExec(-1); Event.What = evNone; break; case kbEnter: EndExec(Pos); Event.What = evNone; break; } break; #if 0 case evMouseDown: if (E.Mouse.X < XPos || E.Mouse.X >= XPos + 34 || E.Mouse.Y < YPos || E.Mouse.Y >= YPos + 10) { abort = 2; break; } do { x = E.Mouse.X - XPos - 1; y = E.Mouse.Y - YPos - 1; if (x >= 0 && x < 32 && y >= 0 && y < 8) { X = x; Y = y; if (X >= 32) X = 31; if (Y >= 8) Y = 7; if (X < 0) X = 0; if (Y < 0) Y = 0; frames->ConSetCursorPos(X + XPos + 1, Y + YPos + 1); sprintf(s, "0%03o %03d 0x%02X", X + Y * 32, X + Y * 32, X + Y * 32); MoveStr(B, 0, 13, s, hcAsciiStatus, 13); frames->ConPutBox(XPos + 2, YPos + 9, 13, 1, B); } if (E.Mouse.Count == 2) { abort = 1; break; } gui->ConGetEvent(evMouse, &E, -1, 1); if (E.What == evMouseUp) break; } while (1); break; #endif } } void ExASCII::UpdateView() { if (Next) { Next->UpdateView(); } } void ExASCII::RepaintView() { if (Next) { Next->RepaintView(); } } void ExASCII::UpdateStatus() { RepaintStatus(); } void ExASCII::RepaintStatus() { TDrawBuffer B; int W, H; ConQuerySize(&W, &H); if (Pos > 255) Pos = 255; if (Pos < 0) Pos = 0; if (LPos + W < Pos) LPos = Pos - W + 1; if (LPos > 255 - W) LPos = 255 - W + 1; if (LPos > Pos) LPos = Pos; if (LPos < 0) LPos = 0; for (int i = 0; i < W; i++) MoveCh(B + i, char(i + LPos), hcAsciiChars, 1); ConSetCursorPos(Pos - LPos, H - 1); ConShowCursor(); ConPutBox(0, H - 1, W, 1, B); } efte-1.1/src/clip_no.cpp0000664000076400007640000000061111041404761014234 0ustar laurilauri/* clip_no.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int GetPMClip(int clipboard) { return 0; } int PutPMClip(int clipboard) { return 0; } efte-1.1/src/o_directory.cpp0000664000076400007640000003717011201221177015141 0ustar laurilauri/* o_directory.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "log.h" #include "s_files.h" #include "s_util.h" #include "o_directory.h" #include "c_commands.h" #include "c_history.h" EDirectory::EDirectory(int createFlags, EModel **ARoot, char *aPath): EList(createFlags, ARoot, aPath) { char XPath[MAXPATH]; Files = 0; FCount = 0; SearchLen = 0; ExpandPath(aPath, XPath, sizeof(XPath)); Slash(XPath, 1); Path = strdup(XPath); RescanList(); } EDirectory::~EDirectory() { if (Files) { for (int i = 0; i < FCount; i++) delete Files[i]; free(Files); } free(Path); } EEventMap *EDirectory::GetEventMap() { return FindEventMap("DIRECTORY"); } void EDirectory::DrawLine(PCell B, int Line, int Col, ChColor color, int Width) { char s[1024]; MoveCh(B, ' ', color, Width); if (Files && Line >= 0 && Line < FCount) { int Year, Mon, Day, Hour, Min, Sec; struct tm *t; time_t tim; off_t Size = Files[Line]->Size(); char SizeStr[16]; tim = Files[Line]->MTime(); t = localtime(&tim); if (t) { Year = t->tm_year + 1900; Mon = t->tm_mon + 1; Day = t->tm_mday; Hour = t->tm_hour; Min = t->tm_min; Sec = t->tm_sec; } else { Year = Mon = Day = Hour = Min = Sec = 0; } if (Size >= 10 * 1024 * 1024) { Size /= 1024; if (Size >= 1024 * 1024 * 1024) sprintf(SizeStr, "%7ldG", (long)(Size / 1024 / 1024)); else if (Size >= 1024 * 1024) sprintf(SizeStr, "%7ldM", (long)(Size / 1024)); else sprintf(SizeStr, "%7ldK", (long) Size); } else sprintf(SizeStr, "%8ld", (long) Size); sprintf(s, " %04d/%02d/%02d %02d:%02d:%02d %s ", Year, Mon, Day, Hour, Min, Sec, SizeStr); strcat(s, Files[Line]->Name()); s[strlen(s) + 1] = '\0'; s[strlen(s)] = (Files[Line]->Type() == fiDIRECTORY) ? SLASH : ' '; if (Col < int(strlen(s))) MoveStr(B, 0, Width, s + Col, color, Width); } } int EDirectory::IsHilited(int Line) { return (Line >= 0 && Line < FCount) ? Files[Line]->Type() == fiDIRECTORY : 0; } int _LNK_CONV FileNameCmp(const void *a, const void *b) { const FileInfo *A = *(const FileInfo **)a; const FileInfo *B = *(const FileInfo **)b; if (!(A->Type() == fiDIRECTORY) && (B->Type() == fiDIRECTORY)) return 1; if ((A->Type() == fiDIRECTORY) && !(B->Type() == fiDIRECTORY)) return -1; return filecmp(A->Name(), B->Name()); } void EDirectory::RescanList() { char Dir[256]; char Name[256]; int DirCount = 0; unsigned long SizeCount = 0; FileFind *ff; FileInfo *fi; int rc; if (Files) FreeList(); Count = 0; FCount = 0; if (JustDirectory(Path, Dir, sizeof(Dir)) != 0) return; JustFileName(Path, Name, sizeof(Name)); // we don't want any special information about symbolic links, just to browse files ff = new FileFind(Dir, "*", ffDIRECTORY | ffHIDDEN | ffLINK); if (ff == 0) return ; rc = ff->FindFirst(&fi); while (rc == 0) { assert(fi != 0); if (strcmp(fi->Name(), ".") != 0) { Files = (FileInfo **)realloc((void *)Files, ((FCount | 255) + 1) * sizeof(FileInfo *)); if (Files == 0) { delete fi; delete ff; return; } Files[FCount] = fi; SizeCount += Files[FCount]->Size(); if (fi->Type() == fiDIRECTORY && (strcmp(fi->Name(), "..") != 0)) DirCount++; Count++; FCount++; } else delete fi; rc = ff->FindNext(&fi); } delete ff; { char CTitle[256]; sprintf(CTitle, "%d files%c%d dirs%c%lu bytes%c%-200.200s", FCount, ConGetDrawChar(DCH_V), DirCount, ConGetDrawChar(DCH_V), SizeCount, ConGetDrawChar(DCH_V), Dir); SetTitle(CTitle); } qsort(Files, FCount, sizeof(FileInfo *), FileNameCmp); NeedsRedraw = 1; } void EDirectory::FreeList() { if (Files) { for (int i = 0; i < FCount; i++) delete Files[i]; free(Files); } Files = 0; FCount = 0; } int EDirectory::isDir(int No) { char FilePath[256]; JustDirectory(Path, FilePath, sizeof(FilePath)); Slash(FilePath, 1); strcat(FilePath, Files[No]->Name()); return IsDirectory(FilePath); } int EDirectory::ExecCommand(int Command, ExState &State) { switch (Command) { case ExActivateInOtherWindow: SearchLen = 0; Msg(S_INFO, ""); if (Files && Row >= 0 && Row < FCount) { if (isDir(Row)) { } else { return FmLoad(Files[Row]->Name(), View->Next); } } return ErFAIL; case ExRescan: if (RescanDir() == 0) return ErFAIL; return ErOK; case ExDirGoUp: SearchLen = 0; Msg(S_INFO, ""); FmChDir(SDOT SDOT); return ErOK; case ExDirGoDown: SearchLen = 0; Msg(S_INFO, ""); if (Files && Row >= 0 && Row < FCount) { if (isDir(Row)) { FmChDir(Files[Row]->Name()); return ErOK; } } return ErFAIL; case ExDirGoto: SearchLen = 0; Msg(S_INFO, ""); return ChangeDir(State); case ExDirGoRoot: SearchLen = 0; Msg(S_INFO, ""); FmChDir(SSLASH); return ErOK; case ExDirSearchCancel: // Kill search when moving SearchLen = 0; Msg(S_INFO, ""); return ErOK; case ExDirSearchNext: // Find next matching file, search is case in-sensitive while sorting is sensitive if (SearchLen) { int found = GetMatchForward(Row + 1); if (found != -1) { Row = found; break; } } return ErOK; case ExDirSearchPrev: // Find prev matching file, search is case in-sensitive while sorting is sensitive if (SearchLen) { int found = GetMatchBackward(Row - 1); if (found != -1) { Row = found; break; } } return ErOK; case ExRenameFile: SearchLen = 0; Msg(S_INFO, ""); return FmMvFile(Files[Row]->Name()); case ExDeleteFile: SearchLen = 0; Msg(S_INFO, ""); return FmRmFile(Files[Row]->Name()); case ExMakeDirectory: SearchLen = 0; Msg(S_INFO, ""); return FmMkDir(); } return EList::ExecCommand(Command, State); } int EDirectory::Activate(int No) { SearchLen = 0; Msg(S_INFO, ""); if (Files && No >= 0 && No < FCount) { if (isDir(No)) { FmChDir(Files[No]->Name()); return 0; } else { return FmLoad(Files[No]->Name(), View); } } return 1; } int EDirectory::GetMatchForward(int start) { if (start == 0) { // try to first select the file that starts with the search word for (int i = 0; i < FCount; i++) { const char *fname = Files[i]->Name(); if (strnicmp(SearchName, fname, SearchLen) == 0) return i; } } for (int i = start; i < FCount; i++) { const char *fname = Files[i]->Name(); for (int j=0; fname[j]; j++) { if (strnicmp(SearchName, fname + j, SearchLen) == 0) return i; } } return -1; } int EDirectory::GetMatchBackward(int start) { for (int i = start; i > 0; i--) { const char *fname = Files[i]->Name(); for (int j=0; fname[j]; j++) { if (strnicmp(SearchName, fname + j, SearchLen) == 0) return i; } } return -1; } void EDirectory::HandleEvent(TEvent &Event) { STARTFUNC("EDirectory::HandleEvent"); int resetSearch = 0; EModel::HandleEvent(Event); switch (Event.What) { case evKeyUp: resetSearch = 0; break; case evKeyDown: LOG << "Key Code: " << kbCode(Event.Key.Code) << ENDLINE; resetSearch = 1; switch (kbCode(Event.Key.Code)) { case kbBackSp: LOG << "Got backspace" << ENDLINE; resetSearch = 0; if (SearchLen > 0) { SearchName[--SearchLen] = 0; Row = SearchPos[SearchLen]; Msg(S_INFO, "Search: [%s]", SearchName); } else Msg(S_INFO, ""); break; case kbEsc: Msg(S_INFO, ""); break; default: resetSearch = 0; // moved here - its better for user // otherwice there is no way to find files like i_ascii if (isAscii(Event.Key.Code) && (SearchLen < MAXISEARCH)) { char Ch = (char) Event.Key.Code; int Found; LOG << " -> " << BinChar(Ch) << ENDLINE; SearchPos[SearchLen] = Row; SearchName[SearchLen] = Ch; SearchName[++SearchLen] = 0; LOG << "Comparing " << SearchName << ENDLINE; Found = GetMatchForward(); if (Found != -1) Row = Found; else SearchName[--SearchLen] = 0; Msg(S_INFO, "Search: [%s]", SearchName); } break; } } if (resetSearch) { SearchLen = 0; } LOG << "SearchLen = " << SearchLen << ENDLINE; } int EDirectory::RescanDir() { char CName[256] = ""; if (Row >= 0 && Row < FCount) strcpy(CName, Files[Row]->Name()); Row = 0; RescanList(); if (CName[0] != 0) { for (int i = 0; i < FCount; i++) { if (filecmp(Files[i]->Name(), CName) == 0) { Row = i; break; } } } return 1; } int EDirectory::FmChDir(const char *Name) { char Dir[256]; char CName[256] = ""; if (strcmp(Name, SSLASH) == 0) { JustRoot(Path, Dir, sizeof(Dir)); } else if (strcmp(Name, SDOT SDOT) == 0) { Slash(Path, 0); JustFileName(Path, CName, sizeof(CName)); JustDirectory(Path, Dir, sizeof(Dir)); } else { JustDirectory(Path, Dir, sizeof(Dir)); Slash(Dir, 1); strlcat(Dir, Name, sizeof(Dir)); } Slash(Dir, 1); free(Path); Path = strdup(Dir); Row = 0; RescanList(); if (CName[0] != 0) { for (int i = 0; i < FCount; i++) { if (filecmp(Files[i]->Name(), CName) == 0) { Row = i; break; } } } UpdateTitle(); return 1; } int EDirectory::FmMvFile(const char *Name) { char FullName[MAXPATH]; char Dir[MAXPATH]; char Dir2[MAXPATH]; strcpy(FullName, Path); Slash(FullName, 1); strcat(FullName, Name); strcpy(Dir, Path); if (View->MView->Win->GetStr("New file name", sizeof(Dir), Dir, HIST_PATH) == 0) { return 0; } if (ExpandPath(Dir, Dir2, sizeof(Dir2)) == -1) { Msg(S_INFO, "Failed to expand destination %s", Name); return 0; } int status = rename(FullName, Dir2); if (status == 0) { RescanDir(); return 1; } const char *msg = strerror(errno); Msg(S_INFO, "Failed to rename %s: %s", FullName, msg); return 0; } int EDirectory::FmRmFile(char const* Name) { char FilePath[256]; strcpy(FilePath, Path); Slash(FilePath, 1); strcat(FilePath, Name); int choice = View->MView->Win->Choice(GPC_CONFIRM, "Remove File", 2, "O&K", "&Cancel", "Remove %s?", Name); if (choice == 0) { if (unlink(FilePath) == 0) { // put the cursor to the previous row --Row; // There has to be a more efficient way of doing this ... return RescanDir(); } else if (rmdir(FilePath) == 0) { --Row; return RescanDir(); } else { Msg(S_INFO, "Failed to remove %s", Name); return 0; } } else { Msg(S_INFO, "Cancelled"); return 0; } } int EDirectory::FmMkDir() { char Dir[MAXPATH]; char Dir2[MAXPATH]; strcpy(Dir, Path); if (View->MView->Win->GetStr("New directory name", sizeof(Dir), Dir, HIST_PATH) == 0) { return 0; } if (ExpandPath(Dir, Dir2, sizeof(Dir2)) == -1) { Msg(S_INFO, "Failed to create directory, path did not expand"); return 0; } #if defined(MSVC) || defined(BCPP) || defined(WATCOM) || defined(__WATCOM_CPLUSPLUS__) int status = mkdir(Dir2); #else int status = mkdir(Dir2, 509); #endif if (status == 0) { return RescanDir(); } Msg(S_INFO, "Failed to create directory %s", Dir2); return 0; } int EDirectory::FmLoad(const char *Name, EView *XView) { char FilePath[256]; JustDirectory(Path, FilePath, sizeof(FilePath)); Slash(FilePath, 1); strcat(FilePath, Name); return FileLoad(0, FilePath, NULL, XView); } void EDirectory::GetName(char *AName, int MaxLen) { strncpy(AName, Path, MaxLen); AName[MaxLen - 1] = 0; Slash(AName, 0); } void EDirectory::GetPath(char *APath, int MaxLen) { strncpy(APath, Path, MaxLen); APath[MaxLen - 1] = 0; Slash(APath, 0); } void EDirectory::GetInfo(char *AInfo, int /*MaxLen*/) { char buf[256] = {0}; char winTitle[256] = {0}; JustFileName(Path, buf, sizeof(buf)); if (buf[0] == '\0') // if there is no filename, try the directory name. JustLastDirectory(Path, buf, sizeof(buf)); if (buf[0] != 0) { // if there is a file/dir name, stick it in here. strncat(winTitle, buf, sizeof(winTitle) - 1 - strlen(winTitle)); strncat(winTitle, "/ - ", sizeof(winTitle) - 1 - strlen(winTitle)); } strncat(winTitle, Path, sizeof(winTitle) - 1 - strlen(winTitle)); winTitle[sizeof(winTitle) - 1] = 0; sprintf(AInfo, "%2d %04d/%03d %-150s", ModelNo, Row + 1, FCount, winTitle); /* sprintf(AInfo, "%2d %04d/%03d %-150s", ModelNo, Row + 1, FCount, Path);*/ } void EDirectory::GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen) { strncpy(ATitle, Path, MaxLen - 1); ATitle[MaxLen - 1] = 0; { char P[MAXPATH]; strlcpy(P, Path, sizeof(P)); Slash(P, 0); JustDirectory(P, ASTitle, SMaxLen); Slash(ASTitle, 1); } } int EDirectory::ChangeDir(ExState &State) { char Dir[MAXPATH]; char Dir2[MAXPATH]; if (State.GetStrParam(View, Dir, sizeof(Dir)) == 0) { strcpy(Dir, Path); if (View->MView->Win->GetStr("Set directory", sizeof(Dir), Dir, HIST_PATH) == 0) return 0; } if (ExpandPath(Dir, Dir2, sizeof(Dir2)) == -1) return 0; #if 0 // is this needed for other systems as well ? Slash(Dir2, 1); #endif if (Path) free(Path); Path = strdup(Dir2); Row = -1; UpdateTitle(); return RescanDir(); } int EDirectory::GetContext() { return CONTEXT_DIRECTORY; } char *EDirectory::FormatLine(int /*Line*/) { return 0; } int EDirectory::CanActivate(int /*Line*/) { return 1; } efte-1.1/src/owconvert.mak0000664000076400007640000000230711144356106014634 0ustar laurilauri# # owconvert.mak # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # # #---------------------------------------------------------------------------- # # Makefile for NT/ECS-OS2 convert objs.inc using OpenWatcom 1.4 wmake # # watconvert reads in objs.inc, converts '\' character to '&', and saves # as objs.mif. objs.mif will be included by the OW14 NT and ECS-OS2 makefiles # #---------------------------------------------------------------------------- CC = wpp386 LD = wlink # Machine type -5r Pent -6r Pent Pro MACHINE= -6r !ifdef __OS2__ SYSTEM=os2 LDSYSTEM=os2v2 !endif !ifdef __NT__ SYSTEM=nt LDSYSTEM=nt !endif #Optimization None: -od Time opt: -ot Fastest possible: -otexan #OPT= -otexan OPT=-od INCLUDE = $(%watcom)\h;$(%watcom)\h\nt;.\ CFLAGS = -i=$(INCLUDE) -d0 -w4 -e25 -zq $(OPT) $(MACHINE) -bm -bt=$(SYSTEM) -mf -xs -xr LDFLAGS = op m op maxe=25 op q op symf op el OEXT = obj .cpp.obj: $(CC) $(CFLAGS) $< all: watconvert.exe watconvert.exe: watconvert.obj $(LD) NAME watconvert SYS $(LDSYSTEM) $(LDFLAGS) FILE {watconvert.obj} watconvert efte-1.1/src/e_mark.h0000664000076400007640000000312711041404761013521 0ustar laurilauri/* * e_mark.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __EMARK_H #define __EMARK_H #include "e_buffer.h" #include // FILE class EMark { public: EMark(char *aName, char *aFileName, EPoint aPoint, EBuffer *aBuffer = 0); ~EMark(); int setBuffer(EBuffer *aBuffer); int removeBuffer(EBuffer *aBuffer); char *getName() { return Name; } char *getFileName() { return FileName; } EPoint &getPoint(); EBuffer *getBuffer() { return Buffer; } private: /* bookmark */ char *Name; EPoint Point; char *FileName; /* bookmark in file */ EBuffer *Buffer; }; class EMarkIndex { public: EMarkIndex(); ~EMarkIndex(); EMark *insert(char *aName, char *aFileName, EPoint aPoint, EBuffer *aBuffer = 0); EMark *insert(char *aName, EBuffer *aBuffer, EPoint aPoint); EMark *locate(char *aName); int remove(char *aName); int view(EView *aView, char *aName); // int MarkPush(EBuffer *B, EPoint P); // int MarkPop(EView *V); // int MarkSwap(EView *V, EBuffer *B, EPoint P); // int MarkNext(EView *V); // int MarkPrev(EView *V); EMark *pushMark(EBuffer *aBuffer, EPoint P); int popMark(EView *aView); int retrieveForBuffer(EBuffer *aBuffer); int storeForBuffer(EBuffer *aBuffer); int saveToDesktop(FILE *fp); private: int markCount; EMark **marks; }; extern EMarkIndex markIndex; #endif efte-1.1/src/o_modemap.h0000664000076400007640000000244511041404761014225 0ustar laurilauri/* o_modemap.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef __MAPVIEW_H__ #define __MAPVIEW_H__ class EventMapView: public EList { public: char **BList; int BCount; EEventMap *EMap; void AddLine(const char *Line); void DumpKey(const char *aPrefix, EKey *Key); void DumpMap(const char *aPrefix, EKeyMap *aKeyMap); void DumpEventMap(EEventMap *aEventMap); EventMapView(int createFlags, EModel **ARoot, EEventMap *Map); virtual ~EventMapView(); void FreeView(); void ViewMap(EEventMap *Map); virtual int ExecCommand(int Command, ExState &State); virtual EEventMap *GetEventMap(); virtual int GetContext(); virtual void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); virtual char* FormatLine(int Line); virtual void UpdateList(); virtual int CanActivate(int Line); virtual void GetName(char *AName, int MaxLen); virtual void GetInfo(char *AInfo, int MaxLen); virtual void GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen); }; extern EventMapView *TheEventMapView; #endif efte-1.1/src/cfte.cpp0000664000076400007640000017565011166004041013545 0ustar laurilauri/* cfte.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1997, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include #include #include #include #include #include #include #include #include #include "ftever.h" #include "sysdep.h" #include "c_fconfig.h" #include "s_files.h" #include "s_string.h" #include "c_mode.h" #include "console.h" #include "c_hilit.h" #include "fte.h" #include "config.h" #define slen(s) ((s) ? (strlen(s) + 1) : 0) #define ACTION "[%-11s] " typedef struct { char *Name; char *FileName; int LineNo; } DefinedMacro; char ConfigDir[MAXPATH] = "."; // Cached objects CachedObject cache[CACHE_SIZE]; // Cached index (also acts as count) unsigned int cpos = 0; static unsigned int CCFteMacros = 0; static DefinedMacro *CFteMacros = 0; static int lntotal = 0; int verbosity = 0; #include "c_commands.h" #include "c_cmdtab.h" static void cleanup(int xerrno) { exit(xerrno); } static void Fail(CurPos &cp, const char *s, ...) { va_list ap; char msgbuf[1024]; va_start(ap, s); vsprintf(msgbuf, s, ap); va_end(ap); fprintf(stderr, "%s:%d: Error: %s\n", cp.name, cp.line, msgbuf); fprintf(stderr, "Use: efte -! -l%i %s to repair error\n", cp.line, cp.name); cleanup(1); } static int LoadFile(const char *WhereName, const char *CfgName, int Level = 1, int optional = 0); static void PutObject(CurPos &cp, int xtag, int xlen, void *obj) { unsigned char tag = (unsigned char)xtag; unsigned short len = (unsigned short)xlen; cache[cpos].tag = tag; cache[cpos].len = len; cache[cpos].obj = 0; if (obj != 0) { cache[cpos].obj = malloc(len); memcpy(cache[cpos].obj, obj, len); } cpos++; if (cpos >= CACHE_SIZE) Fail(cp, "Cache exceeded"); } static void PutNull(CurPos &cp, int xtag) { PutObject(cp, xtag, 0, 0); } static void PutString(CurPos &cp, int xtag, char *str) { PutObject(cp, xtag, slen(str), str); } static void PutNumber(CurPos &cp, int xtag, long num) { unsigned long l = num; unsigned char b[4]; b[0] = (unsigned char)(l & 0xFF); b[1] = (unsigned char)((l >> 8) & 0xFF); b[2] = (unsigned char)((l >> 16) & 0xFF); b[3] = (unsigned char)((l >> 24) & 0xFF); PutObject(cp, xtag, 4, b); } int CFteMain() { DefineWord("OS_" #if defined(OS2) "OS2" #elif defined(UNIX) "UNIX" #elif defined(NT) "NT" #endif ); CurPos cp; cp.sz = 0; cp.c = 0; cp.a = cp.c = 0; cp.z = cp.a + cp.sz; cp.line = 0; cp.name = ""; // Make a copy of the root dir from main config file to // be able to search in main config's directory first for all includes strcpy(ConfigDir, ConfigFileName); for (int i = strlen(ConfigDir) - 1; i >= 0; i--) { if (ISSLASH(ConfigDir[i])) { ConfigDir[i] = 0; break; } } if (LoadFile("", ConfigFileName, 0) != 0) { fprintf(stderr, "\nCompile failed\n"); cleanup(1); } return 0; } #define MODE_BFI(x) { #x, BFI_##x } #define MODE_BFS(x) { #x, BFS_##x } #define MODE_FLG(x) { #x, FLAG_##x } #define EVENT_FLG(x) { #x, EM_##x } #define COLORIZE_FLG(x) { #x, COL_##x } #define HILIT_CLR(x) { #x, CLR_##x } typedef struct _OrdLookup { const char *Name; int num; } OrdLookup; static const OrdLookup mode_num[] = { MODE_BFI(AutoIndent), MODE_BFI(Insert), MODE_BFI(DrawOn), MODE_BFI(HilitOn), MODE_BFI(ExpandTabs), MODE_BFI(Trim), MODE_BFI(TabSize), MODE_BFI(ShowTabs), MODE_BFI(LineChar), MODE_BFI(StripChar), MODE_BFI(AddLF), MODE_BFI(AddCR), MODE_BFI(ForceNewLine), MODE_BFI(HardMode), MODE_BFI(Undo), MODE_BFI(ReadOnly), MODE_BFI(AutoSave), MODE_BFI(KeepBackups), MODE_BFI(LoadMargin), MODE_BFI(UndoLimit), MODE_BFI(MatchCase), MODE_BFI(BackSpKillTab), MODE_BFI(DeleteKillTab), MODE_BFI(BackSpUnindents), MODE_BFI(SpaceTabs), MODE_BFI(IndentWithTabs), MODE_BFI(LeftMargin), MODE_BFI(RightMargin), MODE_BFI(SeeThruSel), MODE_BFI(WordWrap), MODE_BFI(ShowMarkers), MODE_BFI(CursorThroughTabs), MODE_BFI(SaveFolds), MODE_BFI(MultiLineHilit), MODE_BFI(AutoHilitParen), MODE_BFI(Abbreviations), MODE_BFI(BackSpKillBlock), MODE_BFI(DeleteKillBlock), MODE_BFI(PersistentBlocks), MODE_BFI(InsertKillBlock), MODE_BFI(UndoMoves), MODE_BFI(DetectLineSep), MODE_BFI(TrimOnSave), MODE_BFI(SaveBookmarks), MODE_BFI(HilitTags), MODE_BFI(ShowBookmarks), MODE_BFI(MakeBackups), { 0, 0 }, }; static const OrdLookup mode_string[] = { MODE_BFI(Colorizer), MODE_BFI(IndentMode), MODE_BFS(RoutineRegexp), MODE_BFS(DefFindOpt), MODE_BFS(DefFindReplaceOpt), MODE_BFS(CommentStart), MODE_BFS(CommentEnd), MODE_BFS(WordChars), MODE_BFS(CapitalChars), MODE_BFS(FileNameRx), MODE_BFS(FirstLineRx), MODE_BFS(CompileCommand), MODE_BFI(EventMap), { 0, 0 }, }; static const OrdLookup global_num[] = { MODE_FLG(C_Indent), MODE_FLG(C_BraceOfs), MODE_FLG(C_CaseOfs), MODE_FLG(C_CaseDelta), MODE_FLG(C_ClassOfs), MODE_FLG(C_ClassDelta), MODE_FLG(C_ColonOfs), MODE_FLG(C_CommentOfs), MODE_FLG(C_CommentDelta), MODE_FLG(C_FirstLevelWidth), MODE_FLG(C_FirstLevelIndent), MODE_FLG(C_Continuation), MODE_FLG(C_ParenDelta), MODE_FLG(FunctionUsesContinuation), MODE_FLG(REXX_Indent), MODE_FLG(REXX_Do_Offset), MODE_FLG(ScreenSizeX), MODE_FLG(ScreenSizeY), MODE_FLG(SysClipboard), MODE_FLG(OpenAfterClose), MODE_FLG(ShowVScroll), MODE_FLG(ShowHScroll), MODE_FLG(ScrollBarWidth), MODE_FLG(SelectPathname), MODE_FLG(ShowToolBar), MODE_FLG(ShowMenuBar), MODE_FLG(KeepHistory), MODE_FLG(LoadDesktopOnEntry), MODE_FLG(SaveDesktopOnExit), MODE_FLG(KeepMessages), MODE_FLG(ScrollBorderX), MODE_FLG(ScrollBorderY), MODE_FLG(ScrollJumpX), MODE_FLG(ScrollJumpY), MODE_FLG(GUIDialogs), MODE_FLG(PMDisableAccel), MODE_FLG(SevenBit), MODE_FLG(WeirdScroll), MODE_FLG(LoadDesktopMode), MODE_FLG(IgnoreBufferList), MODE_FLG(ReassignModelIds), MODE_FLG(RecheckReadOnly), MODE_FLG(CursorBlink), MODE_FLG(CursorWithinEOL), MODE_FLG(CursorInsertMask), MODE_FLG(CursorOverMask), { 0, 0 }, }; static const OrdLookup global_string[] = { MODE_FLG(DefaultModeName), MODE_FLG(CompletionFilter), MODE_FLG(PrintDevice), MODE_FLG(CompileCommand), MODE_FLG(WindowFont), MODE_FLG(HelpCommand), MODE_FLG(GUICharacters), MODE_FLG(CvsCommand), MODE_FLG(CvsLogMode), MODE_FLG(SvnCommand), MODE_FLG(SvnLogMode), MODE_FLG(XShellCommand), MODE_FLG(RGBColor), MODE_FLG(BackupDirectory), { 0, 0 }, }; static const OrdLookup event_string[] = { EVENT_FLG(MainMenu), EVENT_FLG(LocalMenu), { 0, 0 }, }; static const OrdLookup colorize_string[] = { COLORIZE_FLG(SyntaxParser), { 0, 0 }, }; static const OrdLookup hilit_colors[] = { HILIT_CLR(Normal), HILIT_CLR(Keyword), HILIT_CLR(String), HILIT_CLR(Comment), HILIT_CLR(CPreprocessor), HILIT_CLR(Regexp), HILIT_CLR(Header), HILIT_CLR(Quotes), HILIT_CLR(Number), HILIT_CLR(HexNumber), HILIT_CLR(OctalNumber), HILIT_CLR(FloatNumber), HILIT_CLR(Function), HILIT_CLR(Command), HILIT_CLR(Tag), HILIT_CLR(Punctuation), HILIT_CLR(New), HILIT_CLR(Old), HILIT_CLR(Changed), HILIT_CLR(Control), HILIT_CLR(Separator), HILIT_CLR(Variable), HILIT_CLR(Symbol), HILIT_CLR(Directive), HILIT_CLR(Label), HILIT_CLR(Special), HILIT_CLR(QuoteDelim), HILIT_CLR(RegexpDelim), { 0, 0 }, }; static int Lookup(const OrdLookup *where, char *what) { int i; for (i = 0; where[i].Name != 0; i++) { if (stricmp(what, where[i].Name) == 0) return where[i].num; } return -1; } #define P_EOF 0 // end of file #define P_SYNTAX 1 // unknown #define P_WORD 2 // a-zA-Z_ #define P_NUMBER 3 // 0-9 #define P_STRING 4 // "'` #define P_ASSIGN 5 // = #define P_EOS 6 // ; #define P_KEYSPEC 7 // [] #define P_OPENBRACE 8 // { #define P_CLOSEBRACE 9 // } #define P_COLON 10 // : #define P_COMMA 11 // , #define P_QUEST 12 #define P_VARIABLE 13 // $ #define P_DOT 14 // . (concat) #define K_UNKNOWN 0 #define K_MODE 1 #define K_KEY 2 #define K_COLOR 3 #define K_KEYWORD 4 #define K_OBJECT 5 #define K_MENU 6 #define K_ITEM 7 #define K_SUBMENU 8 #define K_COMPILERX 9 #define K_EXTERN 10 #define K_INCLUDE 11 #define K_SUB 12 #define K_EVENTMAP 13 #define K_COLORIZE 14 #define K_ABBREV 15 #define K_HSTATE 16 #define K_HTRANS 17 #define K_HWORDS 18 #define K_SUBMENUCOND 19 #define K_HWTYPE 20 #define K_COLPALETTE 21 #define K_CVSIGNRX 22 #define K_SVNIGNRX 23 #define K_OINCLUDE 24 // Optional include, i.e. do not fail if it does not exist. typedef char Word[64]; static const OrdLookup CfgKW[] = { { "mode", K_MODE }, { "eventmap", K_EVENTMAP }, { "key", K_KEY }, { "color", K_COLOR }, { "color_palette", K_COLPALETTE }, { "keyword", K_KEYWORD }, { "object", K_OBJECT }, { "menu", K_MENU }, { "item", K_ITEM }, { "submenu", K_SUBMENU }, { "CompileRx", K_COMPILERX }, { "extern", K_EXTERN }, { "oinclude", K_OINCLUDE }, { "include", K_INCLUDE }, { "sub", K_SUB }, { "colorize", K_COLORIZE }, { "abbrev", K_ABBREV }, { "h_state", K_HSTATE }, { "h_trans", K_HTRANS }, { "h_words", K_HWORDS }, { "h_wtype", K_HWTYPE }, { "submenucond", K_SUBMENUCOND }, { "CvsIgnoreRx", K_CVSIGNRX }, { "SvnIgnoreRx", K_SVNIGNRX }, { 0, 0 }, }; static const OrdLookup CfgVar[] = { { "FilePath", mvFilePath }, { "FileName", mvFileName }, { "FileDirectory", mvFileDirectory }, { "FileBaseName", mvFileBaseName }, { "FileExtension", mvFileExtension }, { "CurDirectory", mvCurDirectory }, { "CurRow", mvCurRow, }, { "CurCol", mvCurCol }, { "Char", mvChar }, { "Word", mvWord }, { "Line", mvLine }, { "FTEVer", mvFTEVer }, { "Str0", mvGet0 }, { "Str1", mvGet1 }, { "Str2", mvGet2 }, { "Str3", mvGet3 }, { "Str4", mvGet4 }, { "Str5", mvGet5 }, { "Str6", mvGet6 }, { "Str7", mvGet7 }, { "Str8", mvGet8 }, { "Str9", mvGet9 }, { 0, 0 }, }; static char **words = 0; static unsigned int wordCount = 0; static int DefinedWord(const char *w) { if (words == 0 || wordCount == 0) return 0; for (unsigned int i = 0; i < wordCount; i++) if (strcmp(w, words[i]) == 0) return 1; return 0; } void DefineWord(const char *w) { if (!w || !w[0]) return ; if (!DefinedWord(w)) { if (verbosity > 0) { fprintf(stderr, ACTION "%s\n", "define", w); } words = (char **)realloc(words, sizeof(char *) * (wordCount + 1)); assert(words != 0); words[wordCount] = strdup(w); assert(words[wordCount] != 0); wordCount++; } } static int colorCount; static struct _color { char *colorName; char *colorValue; } *colors; static int DefineColor(char *name, char *value) { if (!name || !value) return 0; colors = (struct _color *)realloc(colors, sizeof(struct _color) * (colorCount + 1)); assert(colors != 0); colors[colorCount].colorName = strdup(name); colors[colorCount].colorValue = strdup(value); assert(colors != NULL); assert(colors[colorCount].colorName != 0); assert(colors[colorCount].colorValue != 0); colorCount++; return 1; } static char *DefinedColor(char *name) { if (colors == 0 || colorCount == 0) return 0; for (int i = 0; i < colorCount; i++) if (strcmp(name, colors[i].colorName) == 0) return colors[i].colorValue; return 0; } static char *GetColor(CurPos &cp, char *name) { char *c; static char color[4]; // add support for fore:back and remove it from fte itself if ((c = strchr(name, ' ')) != NULL) { } else if ((c = strchr(name, ':')) != NULL) { char clr[4]; *c++ = 0; clr[0] = GetColor(cp, name)[0]; clr[1] = ' '; clr[2] = GetColor(cp, c)[2]; clr[3] = 0; memcpy((void *)color, (void *)clr, sizeof(color)); name = (char *)color; } else { char *p = DefinedColor(name); if (!p) Fail(cp, "Unknown symbolic color %s", name); name = p; } if (!isxdigit(name[0]) && name[1] != ' ' && !isxdigit(name[2]) && name[3] != 0) { Fail(cp, "malformed color specification: %s", name); } return name; } static int GetWord(CurPos &cp, char *w) { char *p = w; int len = 0; while (len < int(sizeof(Word)) && cp.c < cp.z && ((*cp.c >= 'a' && *cp.c <= 'z') || (*cp.c >= 'A' && *cp.c <= 'Z') || (*cp.c >= '0' && *cp.c <= '9') || (*cp.c == '_'))) { *p++ = *cp.c++; len++; } if (len == sizeof(Word)) return -1; *p = 0; return 0; } static int Parse(CurPos &cp) { while (cp.c < cp.z) { switch (*cp.c) { #ifndef UNIX case '\x1A': /* ^Z :-* */ return P_EOF; #endif case '#': while (cp.c < cp.z && *cp.c != '\n') cp.c++; break; case '\n': cp.line++; lntotal++; case ' ': case '\t': case '\r': cp.c++; break; case '=': return P_ASSIGN; case ';': return P_EOS; case ',': return P_COMMA; case ':': return P_COLON; case '.': return P_DOT; case '\'': case '"': case '`': case '/': return P_STRING; case '[': return P_KEYSPEC; case '{': return P_OPENBRACE; case '}': return P_CLOSEBRACE; case '?': return P_QUEST; case '$': return P_VARIABLE; case '-': case '+': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return P_NUMBER; default: if ((*cp.c >= 'a' && *cp.c <= 'z') || (*cp.c >= 'A' && *cp.c <= 'Z') || (*cp.c == '_')) return P_WORD; else return P_SYNTAX; } } return P_EOF; } static void GetOp(CurPos &cp, int what) { switch (what) { case P_COMMA: case P_OPENBRACE: case P_CLOSEBRACE: case P_ASSIGN: case P_EOS: case P_COLON: case P_QUEST: case P_VARIABLE: case P_DOT: cp.c++; break; } } static char *GetString(CurPos &cp) { char c = *cp.c; char *p = cp.c; char *d = cp.c; int n; if (c == '[') c = ']'; cp.c++; // skip '"` while (cp.c < cp.z) { if (*cp.c == '\\') { if (c == '/') *p++ = *cp.c; cp.c++; if (cp.c == cp.z) return 0; if (c == '"') { switch (*cp.c) { case 'e': *cp.c = '\x1B'; break; case 't': *cp.c = '\t'; break; case 'r': *cp.c = '\r'; break; case 'n': *cp.c = '\n'; break; case 'b': *cp.c = '\b'; break; case 'v': *cp.c = '\v'; break; case 'a': *cp.c = '\a'; break; case 'x': cp.c++; if (cp.c == cp.z) return 0; if (*cp.c >= '0' && *cp.c <= '9') n = *cp.c - '0'; else if (*cp.c >= 'a' && *cp.c <= 'f') n = *cp.c - 'a' + 10; else if (*cp.c >= 'A' && *cp.c <= 'F') n = *cp.c - 'A' + 10; else return 0; cp.c++; if (cp.c == cp.z) cp.c--; else if (*cp.c >= '0' && *cp.c <= '9') n = n * 16 + *cp.c - '0'; else if (*cp.c >= 'a' && *cp.c <= 'f') n = n * 16 + *cp.c - 'a' + 10; else if (*cp.c >= 'A' && *cp.c <= 'F') n = n * 16 + *cp.c - 'A' + 10; else cp.c--; *cp.c = n; break; } } } else if (*cp.c == c) { cp.c++; *p = 0; return d; } else if (*cp.c == '\n') { cp.line++; return 0; } else if (*cp.c == '\r') { cp.c++; if (cp.c == cp.z) return 0; } *p++ = *cp.c++; } return 0; } static int GetNumber(CurPos &cp) { int value = 0; int neg = 0; if (cp.c < cp.z && *cp.c == '-' || *cp.c == '+') { if (*cp.c == '-') neg = 1; cp.c++; } while (cp.c < cp.z && (*cp.c >= '0' && *cp.c <= '9')) { value = value * 10 + (*cp.c - '0'); cp.c++; } return neg ? -value : value; } static int CFteCmdNum(const char *Cmd) { unsigned int i; if (Cmd == NULL) return 0; for (i = 0; i < sizeof(Command_Table) / sizeof(Command_Table[0]); i++) if (stricmp(Cmd, Command_Table[i].Name) == 0) return Command_Table[i].CmdId; for (i = 0; i < CCFteMacros; i++) if (CFteMacros[i].Name && (stricmp(Cmd, CFteMacros[i].Name)) == 0) return i | CMD_EXT; return 0; // Nop } int NewCommand(CurPos &cp, const char *Name) { if (Name == 0) Name = ""; CFteMacros = (DefinedMacro *) realloc(CFteMacros, sizeof(DefinedMacro) * (1 + CCFteMacros)); CFteMacros[CCFteMacros].Name = strdup(Name); CFteMacros[CCFteMacros].FileName = strdup(cp.name); CFteMacros[CCFteMacros].LineNo = cp.line; CCFteMacros++; return CCFteMacros - 1; } static int ParseCommands(CurPos &cp, char *Name) { //if (!Name) // return 0; Word cmd; int p; long Cmd = CFteCmdNum(Name); long cnt; long ign = 0; if (Cmd != 0) { Fail(cp, "%s has already been defined in %s:%i", Name, CFteMacros[Cmd^CMD_EXT].FileName, CFteMacros[Cmd^CMD_EXT].LineNo); } Cmd = NewCommand(cp, Name) | CMD_EXT; PutNumber(cp, CF_INT, Cmd); GetOp(cp, P_OPENBRACE); cnt = 1; while (1) { p = Parse(cp); if (p == P_CLOSEBRACE) break; if (p == P_EOF) Fail(cp, "Unexpected EOF"); if (p == P_DOT) { GetOp(cp, P_DOT); PutNull(cp, CF_CONCAT); } else if (p == P_NUMBER) { long num = GetNumber(cp); if (Parse(cp) != P_COLON) { PutNumber(cp, CF_INT, num); } else { cnt = num; GetOp(cp, P_COLON); } } else if (p == P_WORD) { long Command; if (GetWord(cp, cmd) == -1) Fail(cp, "Syntax error"); Command = CFteCmdNum(cmd); if (Command == 0) Fail(cp, "Unrecognized command: %s", cmd); PutNumber(cp, CF_COMMAND, Command); PutNumber(cp, CF_INT, cnt); PutNumber(cp, CF_INT, ign); ign = 0; cnt = 1; } else if (p == P_STRING) { char *s = GetString(cp); PutString(cp, CF_STRING, s); } else if (p == P_QUEST) { ign = 1; GetOp(cp, P_QUEST); } else if (p == P_VARIABLE) { GetOp(cp, P_VARIABLE); if (Parse(cp) != P_WORD) Fail(cp, "Syntax error (variable name expected)"); Word w; if (GetWord(cp, w) != 0) Fail(cp, "Syntax error (bad variable name)"); long var = Lookup(CfgVar, w); if (var == -1) Fail(cp, "Unrecognized variable: %s", w); PutNumber(cp, CF_VARIABLE, var); } else if (p == P_EOS) { GetOp(cp, P_EOS); cnt = 1; } else Fail(cp, "Syntax error"); } GetOp(cp, P_CLOSEBRACE); return 0; } static int ParseConfigFile(CurPos &cp) { Word w = ""; char *s = 0; int p = 0; Word ObjName = "", UpMode = ""; while (1) { p = Parse(cp); switch (p) { case P_WORD: if (GetWord(cp, w) != 0) Fail(cp, "Syntax error"); switch (Lookup(CfgKW, w)) { case K_SUB: { Word Name; if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, Name) != 0) Fail(cp, "Syntax error"); PutString(cp, CF_SUB, Name); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); if (ParseCommands(cp, strdup(Name)) == -1) Fail(cp, "Parse failed"); PutNull(cp, CF_END); } break; case K_MENU: { Word MenuName; //int menu = -1, item = -1; if (Parse(cp) != P_WORD) Fail(cp, "Syntax error");; if (GetWord(cp, MenuName) != 0) Fail(cp, "Syntax error");; if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutString(cp, CF_MENU, MenuName); while (1) { p = Parse(cp); if (p == P_CLOSEBRACE) break; if (p == P_EOF) Fail(cp, "Unexpected EOF"); if (p != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) != 0) Fail(cp, "Parse failed"); switch (Lookup(CfgKW, w)) { case K_ITEM: // menu::item switch (Parse(cp)) { case P_EOS: PutNull(cp, CF_ITEM); break; case P_STRING: s = GetString(cp); PutString(cp, CF_ITEM, s); break; default: Fail(cp, "Syntax error");; } if (Parse(cp) == P_EOS) { GetOp(cp, P_EOS); break; } if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); PutNull(cp, CF_MENUSUB); if (ParseCommands(cp, 0) == -1) Fail(cp, "Parse failed"); PutNull(cp, CF_END); break; case K_SUBMENU: // menu::submenu if (Parse(cp) != P_STRING) Fail(cp, "String expected"); s = GetString(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) == -1) Fail(cp, "Parse failed"); PutString(cp, CF_SUBMENU, s); PutString(cp, CF_STRING, w); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); break; case K_SUBMENUCOND: // menu::submenu if (Parse(cp) != P_STRING) Fail(cp, "String expected"); s = GetString(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) == -1) Fail(cp, "Parse failed"); PutString(cp, CF_SUBMENUCOND, s); PutString(cp, CF_STRING, w); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); break; default: // menu:: Fail(cp, "Syntax error"); } } GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_END); } break; case K_EVENTMAP: { if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, ObjName) != 0) Fail(cp, "Parse failed"); PutString(cp, CF_EVENTMAP, ObjName); UpMode[0] = 0; if (Parse(cp) == P_COLON) { GetOp(cp, P_COLON); if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, UpMode) != 0) Fail(cp, "Parse failed"); } PutString(cp, CF_PARENT, UpMode); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); while (1) { p = Parse(cp); if (p == P_CLOSEBRACE) break; if (p == P_EOF) Fail(cp, "Unexpected EOF"); if (p != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) != 0) Fail(cp, "Parse failed"); switch (Lookup(CfgKW, w)) { case K_KEY: // mode::key if (Parse(cp) != P_KEYSPEC) Fail(cp, "'[' expected"); s = GetString(cp); PutString(cp, CF_KEY, s); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); PutNull(cp, CF_KEYSUB); if (ParseCommands(cp, 0) == -1) Fail(cp, "Parse failed"); PutNull(cp, CF_END); break; case K_ABBREV: if (Parse(cp) != P_STRING) Fail(cp, "String expected"); s = GetString(cp); PutString(cp, CF_ABBREV, s); switch (Parse(cp)) { case P_OPENBRACE: PutNull(cp, CF_KEYSUB); if (ParseCommands(cp, 0) == -1) Fail(cp, "Parse failed"); PutNull(cp, CF_END); break; case P_STRING: s = GetString(cp); PutString(cp, CF_STRING, s); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); break; default: Fail(cp, "Syntax error"); } break; default: // mode:: if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); switch (Parse(cp)) { /* case P_NUMBER: { long var; long num; num = GetNumber(cp); var = LookupEventNumber(w); if (var == -1) return -1; PutObj(cp, CF_SETVAR, sizeof(long), &var); PutObj(cp, CF_INT, sizeof(long), &num); } break;*/ case P_STRING: { long var; s = GetString(cp); if (s == 0) Fail(cp, "String expected"); var = Lookup(event_string, w); if (var == -1) Fail(cp, "Lookup of '%s' failed", w); PutNumber(cp, CF_SETVAR, var); PutString(cp, CF_STRING, s); } break; default: return -1; } if (Parse(cp) != P_EOS) return -1; GetOp(cp, P_EOS); break; } } GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_END); } break; case K_COLORIZE: { long LastState = -1; if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, ObjName) != 0) Fail(cp, "Parse failed"); PutString(cp, CF_COLORIZE, ObjName); UpMode[0] = 0; if (Parse(cp) == P_COLON) { GetOp(cp, P_COLON); if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, UpMode) != 0) Fail(cp, "Parse failed"); } PutString(cp, CF_PARENT, UpMode); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); while (1) { p = Parse(cp); if (p == P_CLOSEBRACE) break; if (p == P_EOF) Fail(cp, "Unexpected EOF"); if (p != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) != 0) Fail(cp, "Parse failed"); switch (Lookup(CfgKW, w)) { case K_COLOR: // mode::color if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutNull(cp, CF_COLOR); while (1) { char *sname, *svalue; long cidx; if (Parse(cp) == P_CLOSEBRACE) break; if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); sname = GetString(cp); if ((cidx = Lookup(hilit_colors, sname)) == -1) Fail(cp, "Lookup of '%s' failed", sname); PutNumber(cp, CF_INT, cidx); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); svalue = GetString(cp); svalue = GetColor(cp, svalue); PutString(cp, CF_STRING, svalue); if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); if (Parse(cp) != P_COMMA) break; else GetOp(cp, P_COMMA); } if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); PutNull(cp, CF_END); break; case K_KEYWORD: { // mode::keyword char *colorstr, *kname; //int color; if (Parse(cp) != P_STRING) Fail(cp, "String expected"); colorstr = GetString(cp); colorstr = GetColor(cp, colorstr); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutString(cp, CF_KEYWORD, colorstr); while (1) { if (Parse(cp) == P_CLOSEBRACE) break; if (Parse(cp) != P_STRING) Fail(cp, "String expected"); kname = GetString(cp); if (strlen(kname) >= CK_MAXLEN) Fail(cp, "Keyword name is too long"); PutString(cp, CF_STRING, kname); if (Parse(cp) != P_COMMA) break; else GetOp(cp, P_COMMA); } } if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); PutNull(cp, CF_END); break; case K_HSTATE: { long stateno; char *cname; long cidx; if (Parse(cp) != P_NUMBER) Fail(cp, "state index expected"); stateno = GetNumber(cp); if (stateno != LastState + 1) Fail(cp, "invalid state index"); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutNumber(cp, CF_HSTATE, stateno); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); cname = GetString(cp); if ((cidx = Lookup(hilit_colors, cname)) == -1) Fail(cp, "Lookup of '%s' failed", cname); PutNumber(cp, CF_INT, cidx); if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); LastState = stateno; } break; case K_HTRANS: { long next_state; char *opts, *match; long match_opts; char *cname; long cidx; if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); if (Parse(cp) != P_NUMBER) Fail(cp, "next_state index expected"); next_state = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "match options expected"); opts = GetString(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "match string expected"); match = GetString(cp); PutNumber(cp, CF_HTRANS, next_state); match_opts = 0; if (strchr(opts, '^')) match_opts |= MATCH_MUST_BOL; if (strchr(opts, '$')) match_opts |= MATCH_MUST_EOL; //if (strchr(opts, 'b')) match_opts |= MATCH_MUST_BOLW; //if (strchr(opts, 'e')) match_opts |= MATCH_MUST_EOLW; if (strchr(opts, 'i')) match_opts |= MATCH_NO_CASE; if (strchr(opts, 's')) match_opts |= MATCH_SET; if (strchr(opts, 'S')) match_opts |= MATCH_NOTSET; if (strchr(opts, '-')) match_opts |= MATCH_NOGRAB; if (strchr(opts, '<')) match_opts |= MATCH_TAGASNEXT; if (strchr(opts, '>')) match_opts &= ~MATCH_TAGASNEXT; //if (strchr(opts, '!')) match_opts |= MATCH_NEGATE; if (strchr(opts, 'q')) match_opts |= MATCH_QUOTECH; if (strchr(opts, 'Q')) match_opts |= MATCH_QUOTEEOL; if (strchr(opts, 'x')) match_opts |= MATCH_REGEXP; if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); cname = GetString(cp); if ((cidx = Lookup(hilit_colors, cname)) == -1) Fail(cp, "Lookup of '%s' failed", cname); PutNumber(cp, CF_INT, match_opts); PutNumber(cp, CF_INT, cidx); PutString(cp, match_opts & MATCH_REGEXP ? CF_REGEXP : CF_STRING, match); if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); } break; case K_HWTYPE: if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); { long options = 0; long nextKwdMatchedState; long nextKwdNotMatchedState; long nextKwdNoCharState; char *opts; char *wordChars; if (Parse(cp) != P_NUMBER) Fail(cp, "next_state index expected"); nextKwdMatchedState = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_NUMBER) Fail(cp, "next_state index expected"); nextKwdNotMatchedState = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_NUMBER) Fail(cp, "next_state index expected"); nextKwdNoCharState = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); opts = GetString(cp); if (strchr(opts, 'i')) options |= STATE_NOCASE; if (strchr(opts, '<')) options |= STATE_TAGASNEXT; if (strchr(opts, '>')) options &= ~STATE_TAGASNEXT; if (strchr(opts, '-')) options |= STATE_NOGRAB; if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); wordChars = GetString(cp); PutNull(cp, CF_HWTYPE); PutNumber(cp, CF_INT, nextKwdMatchedState); PutNumber(cp, CF_INT, nextKwdNotMatchedState); PutNumber(cp, CF_INT, nextKwdNoCharState); PutNumber(cp, CF_INT, options); PutString(cp, CF_STRING, wordChars); } if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); break; case K_HWORDS: { char *colorstr, *kname; //int color; if (Parse(cp) != P_STRING) Fail(cp, "String expected"); colorstr = GetString(cp); colorstr = GetColor(cp, colorstr); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutString(cp, CF_HWORDS, colorstr); while (1) { if (Parse(cp) == P_CLOSEBRACE) break; if (Parse(cp) != P_STRING) Fail(cp, "String expected"); kname = GetString(cp); PutString(cp, CF_STRING, kname); if (Parse(cp) != P_COMMA) break; else GetOp(cp, P_COMMA); } } if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_END); break; default: if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); switch (Parse(cp)) { /*case P_NUMBER: { long var; long num; num = GetNumber(cp); var = LookupColorizeNumber(w); if (var == -1) return -1; PutObj(cp, CF_SETVAR, sizeof(long), &var); PutObj(cp, CF_INT, sizeof(long), &num); } break;*/ case P_STRING: { long var; s = GetString(cp); if (s == 0) Fail(cp, "Parse failed"); var = Lookup(colorize_string, w); if (var == -1) Fail(cp, "Lookup of '%s' failed", w); PutNumber(cp, CF_SETVAR, var); PutString(cp, CF_STRING, s); } break; default: return -1; } if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); break; } } GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_END); } break; case K_MODE: { // mode:: if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, ObjName) != 0) Fail(cp, "Parse failed, expecting a word"); PutString(cp, CF_MODE, ObjName); UpMode[0] = 0; if (Parse(cp) == P_COLON) { GetOp(cp, P_COLON); if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, UpMode) != 0) Fail(cp, "Parse failed, expecting a mode name"); } PutString(cp, CF_PARENT, UpMode); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); while (1) { p = Parse(cp); if (p == P_CLOSEBRACE) break; if (p == P_EOF) Fail(cp, "Unexpected EOF"); if (p != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) != 0) Fail(cp, "Parse failed, expecting a variable name"); if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); switch (Parse(cp)) { case P_NUMBER: { long var; long num; num = GetNumber(cp); var = Lookup(mode_num, w); if (var == -1) Fail(cp, "Lookup of '%s' failed", w); PutNumber(cp, CF_SETVAR, var); PutNumber(cp, CF_INT, num); } break; case P_STRING: { long var; s = GetString(cp); if (s == 0) Fail(cp, "Parse failed, expected a string"); var = Lookup(mode_string, w); if (var == -1) Fail(cp, "Lookup of '%s' failed", w); PutNumber(cp, CF_SETVAR, var); PutString(cp, CF_STRING, s); } break; default: return -1; } if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); } GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_END); } break; case K_OBJECT: { if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, ObjName) != 0) Fail(cp, "Parse failed"); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutString(cp, CF_OBJECT, ObjName); while (1) { p = Parse(cp); if (p == P_CLOSEBRACE) break; if (p == P_EOF) Fail(cp, "Unexpected EOF"); if (p != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) != 0) Fail(cp, "Parse failed"); switch (Lookup(CfgKW, w)) { case K_COLOR: // mode::color if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutNull(cp, CF_COLOR); while (1) { char *sname, *svalue; if (Parse(cp) == P_CLOSEBRACE) break; if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); sname = GetString(cp); PutString(cp, CF_STRING, sname); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); svalue = GetString(cp); svalue = GetColor(cp, svalue); PutString(cp, CF_STRING, svalue); if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); if (Parse(cp) != P_COMMA) break; else GetOp(cp, P_COMMA); } if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); PutNull(cp, CF_END); break; case K_COMPILERX: { long file, line, msg; char *regexp; if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); if (Parse(cp) != P_NUMBER) Fail(cp, "Number expected"); file = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_NUMBER) Fail(cp, "Number expected"); line = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_NUMBER) Fail(cp, "Number expected"); msg = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); regexp = GetString(cp); if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_COMPRX); PutNumber(cp, CF_INT, file); PutNumber(cp, CF_INT, line); PutNumber(cp, CF_INT, msg); PutString(cp, CF_REGEXP, regexp); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); } break; case K_CVSIGNRX: { char *regexp; if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); regexp = GetString(cp); PutNull(cp, CF_CVSIGNRX); PutString(cp, CF_REGEXP, regexp); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); } break; case K_SVNIGNRX: { char *regexp; if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); regexp = GetString(cp); PutNull(cp, CF_SVNIGNRX); PutString(cp, CF_REGEXP, regexp); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); } break; default: // mode:: if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); switch (Parse(cp)) { case P_NUMBER: { long var; long num; num = GetNumber(cp); var = Lookup(global_num, w); if (var == -1) Fail(cp, "Lookup of '%s' failed", w); PutNumber(cp, CF_SETVAR, var); PutNumber(cp, CF_INT, num); } break; case P_STRING: { long var; s = GetString(cp); if (s == 0) Fail(cp, "Parse failed"); var = Lookup(global_string, w); if (var == -1) Fail(cp, "Lookup of '%s' failed", w); PutNumber(cp, CF_SETVAR, var); PutString(cp, CF_STRING, s); } break; default: Fail(cp, "Syntax error"); } if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); break; } } GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_END); } break; case K_COLPALETTE: { if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); while (1) { char *sname, *svalue; if (Parse(cp) == P_CLOSEBRACE) break; if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); sname = GetString(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); svalue = GetString(cp); svalue = GetColor(cp, svalue); if (DefineColor(sname, svalue) != 1) Fail(cp, "DefineColor failed\n"); if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); if (Parse(cp) != P_COMMA) break; else GetOp(cp, P_COMMA); } if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); } break; case K_INCLUDE: { char *fn; if (Parse(cp) != P_STRING) Fail(cp, "String expected"); fn = GetString(cp); if (verbosity > 0) fprintf(stderr, ACTION "%s... ", "include", fn); if (LoadFile(cp.name, fn) != 0) Fail(cp, "Include of file '%s' failed", fn); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); } break; case K_OINCLUDE: { char *fn; if (Parse(cp) != P_STRING) Fail(cp, "String expected"); fn = GetString(cp); if (verbosity > 1) fprintf(stderr, ACTION "%s... ", "opt include", fn); if (LoadFile(cp.name, fn, 1, 1) != 0) { if (verbosity > 1) fprintf(stderr, "not found\n"); GetOp(cp, P_EOS); continue; // This is an optional include } if (verbosity == 1) fprintf(stderr, ACTION "%s... found: %s\n", "opt include", fn, cp.name); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); } break; default: Fail(cp, "Syntax error"); } break; case P_EOF: return 0; default: Fail(cp, "Syntax error"); } } } static int PreprocessConfigFile(CurPos &cp) { char *wipe = NULL; char *wipe_end = NULL; bool rem_active = false; bool string_open = false; while (cp.c < cp.z) { switch (*cp.c) { case '#': if (string_open == true) break; rem_active = true; break; case '\\': cp.c++; break; case '"': case '\'': if (rem_active == true) break; string_open = !string_open; break; case '%': if (string_open == true) break; if (rem_active == true) break; wipe = cp.c; wipe_end = NULL; if (cp.c + 8 < cp.z && strncmp(cp.c, "%define(", 8) == 0) { Word w; cp.c += 8; while (cp.c < cp.z && *cp.c != ')') { GetWord(cp, w); //printf("define '%s'\n", w); DefineWord(w); if (cp.c < cp.z && *cp.c != ',' && *cp.c != ')') Fail(cp, "unexpected: %c", cp.c[0]); if (cp.c < cp.z && *cp.c == ',') cp.c++; } cp.c++; /* } else if (cp.c + 6 && strcmp(cp.c, "undef(", 6) == 0) { Word w; cp.c += 6; while (cp.c < cp.z && *cp.c != ')') { GetWord(cp, w); UndefWord(w); }*/ } else if (cp.c + 4 < cp.z && strncmp(cp.c, "%if(", 4) == 0) { Word w; int wasWord = 0; cp.c += 4; while (cp.c < cp.z && *cp.c != ')') { int neg = 0; if (*cp.c == '!') { cp.c++; neg = 1; } GetWord(cp, w); if (DefinedWord(w)) wasWord = 1; if (neg) wasWord = wasWord ? 0 : 1; if (cp.c < cp.z && *cp.c != ',' && *cp.c != ')') Fail(cp, "unexpected: %c", cp.c[0]); if (cp.c < cp.z && *cp.c == ',') cp.c++; } cp.c++; if (!wasWord) { int nest = 1; while (cp.c < cp.z) { if (*cp.c == '\n') { cp.line++; lntotal++; } else if (*cp.c == '%') { if (cp.c + 6 < cp.z && strncmp(cp.c, "%endif", 6) == 0) { cp.c += 6; if (--nest == 0) break; } if (cp.c + 3 < cp.z && strncmp(cp.c, "%if", 3) == 0) { cp.c += 3; ++nest; } } else if (*cp.c == '#') { // we really shouldn't process hashed % directives while (cp.c < cp.z && *cp.c != '\n') cp.c++; // workaround to make line numbering correct cp.line++; lntotal++; } cp.c++; } } } else if (cp.c + 6 < cp.z && strncmp(cp.c, "%endif", 6) == 0) { cp.c += 6; } if (cp.c < cp.z && *cp.c != '\n' && *cp.c != '\r') Fail(cp, "syntax error %30.30s", cp.c); wipe_end = cp.c; // wipe preprocessor macros with space while (wipe < wipe_end) { *wipe++ = ' '; } break; case '\n': cp.line++; rem_active = false; string_open = false; break; default: break; } cp.c++; } return 0; } int ProcessConfigFile(char *filename, char *buffer, int Level) { CurPos cp; cp.sz = strlen(buffer); cp.a = cp.c = buffer; cp.z = cp.a + cp.sz; cp.line = 1; cp.name = filename; // preprocess configuration file int rc = PreprocessConfigFile(cp); if (rc == -1) { Fail(cp, "Preprocess failed"); } // reset pointers cp.a = cp.c = buffer; cp.z = cp.a + cp.sz; cp.line = 1; rc = ParseConfigFile(cp); if (Level == 0) { PutNull(cp, CF_EOF); } if (rc == -1) { Fail(cp, "Parse failed"); } if (strcmp(filename, "built-in") != 0) free(buffer); return rc; } static int LoadFile(const char *WhereName, const char *CfgName, int Level, int optional) { int fd; char *buffer = 0; struct stat statbuf; char last[MAXPATH]; char Cfg[MAXPATH]; JustDirectory(WhereName, last, sizeof(last)); if (IsFullPath(CfgName)) { strlcpy(Cfg, CfgName, sizeof(Cfg)); } else { #if PATHTYPE == PT_UNIXISH # define SEARCH_PATH_LEN 6 char dirs[SEARCH_PATH_LEN][MAXPATH]; snprintf(dirs[0], MAXPATH, "%s/%s", ConfigDir, CfgName); snprintf(dirs[1], MAXPATH, "~/.efte/%s", CfgName); snprintf(dirs[2], MAXPATH, "%s/share/efte/local/%s", EFTE_INSTALL_DIR, CfgName); snprintf(dirs[3], MAXPATH, "/etc/efte/local/%s", CfgName); snprintf(dirs[4], MAXPATH, "%s/share/efte/config/%s", EFTE_INSTALL_DIR, CfgName); snprintf(dirs[5], MAXPATH, "/etc/efte/config/%s", CfgName); #else // if PT_UNIXISH # define SEARCH_PATH_LEN 11 char dirs[SEARCH_PATH_LEN][MAXPATH]; snprintf(dirs[0], MAXPATH, "%s/%s", ConfigDir, CfgName); snprintf(dirs[1], MAXPATH, "~/.efte/%s", CfgName); snprintf(dirs[2], MAXPATH, "~/efte/%s", CfgName); snprintf(dirs[3], MAXPATH, "/efte/local/%s", CfgName); snprintf(dirs[4], MAXPATH, "/efte/config/%s", CfgName); snprintf(dirs[5], MAXPATH, "/Program Files/efte/local/%s", CfgName); snprintf(dirs[6], MAXPATH, "/Program Files/efte/config/%s", CfgName); snprintf(dirs[7], MAXPATH, "/Program Files (x86)/efte/local/%s", CfgName); snprintf(dirs[8], MAXPATH, "/Program Files (x86)/efte/config/%s", CfgName); const char *pf = getenv("ProgramFiles"); snprintf(dirs[9], MAXPATH, "%s/eFTE/local/%s", pf ? pf : "C:", CfgName); snprintf(dirs[10], MAXPATH, "%s/eFTE/config/%s", pf ? pf : "C:", CfgName); #endif // if PT_UNIXISH char tmp[MAXPATH]; bool found = false; for (int idx=0; idx #include #include #include #include #include #include #include "con_i18n.h" #define KEYMASK 0xff #define KEYBYTEMAX 0xf00 #ifdef USE_HARD_REMAP /* * This part is used when your Xserver doesn't work well with XKB extension */ /* Keyboard definition file - currently only Czech national keyboard * write your own keyboard for your language * And remember - this is supposed to be used only if your Xserver * is not supporting keyboard extension */ #include "con_ikcz.h" /* * Quite a complex function to convert normal keys * to dead-keys and remapped keys */ static int i18n_key_analyze(XKeyEvent * keyEvent, KeySym * key, /*FOLD00*/ char *keyName, int nbytes) { static long prev_state = 0, local_switch = 0, keypos = 0, last_keypos = 0, remap = 0; long i; struct keyboardRec *kbdActual; /* Find the state of keyboard * Check for different ISO group or modifier 5 * So to activate remaping, you need to press at least * ScrollLock which is usually mapped as modifier 5 */ i = ((keyEvent->state | local_switch) & 0xFFA0); if (i != prev_state) { /* reset table position */ last_keypos = keypos = 0; prev_state = i; } if (keyEvent->type == KeyPress) { if (i && ((*key == XK_Pause) || (*key == XK_F21))) { remap = !remap; return 0; } else if (*key == XK_F23) { local_switch ^= (1UL << 12); return 0; } } /* * Check for already remapped ISO8859-X keys * this should not normaly happen :-) * as we need to use this hack */ if ((*key > KEYMASK) && (*key < KEYBYTEMAX) || (*key > 0xffffff00)) { *key &= KEYMASK; keyName[0] = (char) * key; return 1; } /* Select keyboard map */ if (!i) kbdActual = nationalKey[0]; else if (!remap) kbdActual = nationalKey[1]; else kbdActual = nationalKey[2]; if (keyEvent->type == KeyPress) { long i = last_keypos; /* * Search for DeadKey -> do loop over all tables. * * Note: We can define ONE DeadKey and use * it for several tables sequentially */ for (;;) { i++; if ((kbdActual[0].tab == NULL) || kbdActual[i].tab == NULL) { i = 0; if (kbdActual[i].tab == NULL) { /* Looks like empty table -> IGNORE */ keypos = i; return nbytes; } } if (i == last_keypos) break; if (kbdActual[i].deadkey == *key) { keypos = kbdActual[i].next; /* Found DeadKey -> delete it * and mark actual position for next search */ last_keypos = i; keyName[0] = *key = 0; return 0; } } } else if (keypos) return 0; /* ignore key release */ /* Now we know it is not a DeadKey and we * are in selected remaping keyboard table */ /* printf("** key:%5d\tstatus:0x%x\n", *key, prev_state); */ if (*key < KEYBYTEMAX) { /* * this is selected constant and will change when * this editor will be able to write in japan :-) */ int i = 0; /* remaping only real keys */ while (kbdActual[keypos].tab[i].key_english != 0) { if (*key == kbdActual[keypos].tab[i].key_english) { *key = kbdActual[keypos].tab[i].key_remap; break; } i++; } last_keypos = keypos = kbdActual[keypos].next; /* printf("** remap: %3d %3d\n", keypos, *key); */ keyName[0] = *key && KEYMASK; return 1; } return 0; } /*FOLD00*/ #else /********************************************* * * * Standart methods for reading Keyboard * * * *********************************************/ /* ISO-8859-2 key-change * All these functions are for keyboard reading. * Correct displaing of this text is another thing, * but as I only need ISO-8859 encoding support, * I don't care about this (for now). */ static int i18n_key_analyze(XKeyEvent * /*keyEvent*/, KeySym * key, /*FOLD00*/ char *keyName, int nbytes) { KeySym t = (unsigned char) keyName[0]; /* * ISO-8859-2 is using some characters from 8859-1 and * rest of them is located between 0x100 - 0x200 in 'X' so * with ISO-8859-2 font we'll remap them down bellow < 0x100 * This is mostly true for all Latin-X alphas, just * special font to display them correctly is needed. * This jobs does Xserver - and keysymbol is returned * in the 1st. byte of keyName string. */ if ((nbytes == 1) && *key < KEYBYTEMAX) *key = t; #ifdef USE_HACK_FOR_BAD_XSERVER /* * this is really hack - but some Xservers are somewhat * strange, so we remap character manually */ else if (!nbytes && (*key > KEYMASK) && (*key < KEYBYTEMAX)) { *key &= KEYMASK; keyName[0] = *key & KEYMASK; nbytes = 1; } #endif return nbytes; } /*FOLD00*/ #endif /* * Initialize I18N functions - took me hours to * figure out how this works even though it was * cut & pasted from 'xterm' sources, but as 'xterm' * is using Xt Toolkit some things have to be made * different */ i18n_context_t* i18n_open(Display * display, Window win, unsigned long *mask) { /*FOLD00*/ *mask = 0; #if XlibSpecificationRelease >= 6 char *s, tmp[256]; int found = False; i18n_context_t* ctx = (i18n_context_t*) malloc(sizeof(i18n_context_t)); memset(ctx, 0, sizeof(i18n_context_t)); /* Locale setting taken from XtSetLanguageProc */ if (!(s = setlocale(LC_ALL, ""))) fprintf(stderr, "I18N warning: Locale not supported by C library, " "locale unchanged!\n"); if (!XSupportsLocale()) { fprintf(stderr, "I18N warning: Locale not supported by Xlib, " "locale set to C!\n"); s = setlocale(LC_ALL, "C"); } if (!XSetLocaleModifiers("")) fprintf(stderr, "I18N warning: X locale modifiers not supported, " "using default\n"); ctx->xim = XOpenIM(display, NULL, NULL, NULL); if (ctx->xim == NULL) { // there are languages without Input Methods ???? fprintf(stderr, "I18N warning: Input method not specified\n"); i18n_destroy(&ctx); return NULL; } if (XGetIMValues(ctx->xim, XNQueryInputStyle, &ctx->xim_styles, NULL) || ctx->xim_styles == NULL) { fprintf(stderr, "I18N error: Input method doesn't support any style\n"); i18n_destroy(&ctx); return NULL; } /* * This is some kind of debugging message to inform user * that something is wrong with his system */ if (s != NULL && (strstr(s, XLocaleOfIM(ctx->xim)) == NULL)) fprintf(stderr, "I18N warning: System locale: \"%s\" differs from " "IM locale: \"%s\"...\n", s, XLocaleOfIM(ctx->xim)); /* * This part is cut&paste from other sources * There is no reason to do it this way, because * the only input style currently supported is Root * but for the future extension I'll leave it here */ strcpy(tmp, XIM_INPUT_STYLE); for (s = tmp; s && !found;) { char *ns, *end; int i; while ((*s != 0) && isspace(*s)) s++; if (*s == 0) break; if ((ns = end = strchr(s, ',')) != 0) ns++; else end = s + strlen(s); while (isspace(*end)) end--; *end = '\0'; if (!strcmp(s, "OverTheSpot")) ctx->input_style = (XIMPreeditPosition | XIMStatusArea); else if (!strcmp(s, "OffTheSpot")) ctx->input_style = (XIMPreeditArea | XIMStatusArea); else if (!strcmp(s, "Root")) ctx->input_style = (XIMPreeditNothing | XIMStatusNothing); for (i = 0; (unsigned short) i < ctx->xim_styles->count_styles; i++) if (ctx->input_style == ctx->xim_styles->supported_styles[i]) //if (ctx->xim_styles->supported_styles[i] & (XIMPreeditNothing | XIMPreeditNone) && // ctx->xim_styles->supported_styles[i] & (XIMStatusNothing | XIMStatusNone)) { found = True; /* do not modify this! * unless consulted with kabi@users.sf.net */ //ctx->input_style = ctx->xim_styles->supported_styles[i]; break; } s = ns; } XFree(ctx->xim_styles); if (!found) { fprintf(stderr, "I18N error: Input method doesn't support my " "preedit type\n"); i18n_destroy(&ctx); return NULL; } /* This program only understand the Root preedit_style yet */ if (ctx->input_style != (XIMPreeditNothing | XIMStatusNothing)) { fprintf(stderr, "I18N error: This program only supports the " "'Root' preedit type\n"); i18n_destroy(&ctx); return NULL; } ctx->xic = XCreateIC(ctx->xim, XNInputStyle, ctx->input_style, XNClientWindow, win, XNFocusWindow, win, NULL); if (ctx->xic == NULL) { fprintf(stderr, "I18N error: Failed to create input context\n"); i18n_destroy(&ctx); } else if (XGetICValues(ctx->xic, XNFilterEvents, mask, NULL)) fprintf(stderr, "I18N error: Can't get Event Mask\n"); return ctx; #else return NULL; #endif } /*FOLD00*/ void i18n_destroy(i18n_context_t** ctx) { if (ctx && *ctx) { if ((*ctx)->xic) XDestroyIC((*ctx)->xic); if ((*ctx)->xim) XCloseIM((*ctx)->xim); free(*ctx); *ctx = NULL; } } void i18n_focus_in(i18n_context_t* ctx) { /*FOLD00*/ #if XlibSpecificationRelease >= 6 if (ctx->xic != NULL) XSetICFocus(ctx->xic); #endif } /*FOLD00*/ void i18n_focus_out(i18n_context_t* ctx) { /*FOLD00*/ #if XlibSpecificationRelease >= 6 if (ctx->xic != NULL) XUnsetICFocus(ctx->xic); #endif } /*FOLD00*/ /* * Lookup correct keysymbol from keymap event */ int i18n_lookup_sym(XKeyEvent * keyEvent, char *keyName, int keySize, /*FOLD00*/ KeySym * key, XIC xic) { static int showKeys = 0; int nbytes = 0; #if XlibSpecificationRelease >= 6 if (xic != NULL) { if (keyEvent->type == KeyPress) { Status status_return; /* No KeyRelease events here ! */ #if 1 nbytes = XmbLookupString(xic, keyEvent, keyName, keySize, key, &status_return); #else wchar_t wk; nbytes = XwcLookupString(xic, keyEvent, &wk, 1, key, &status_return); printf("code=%0X\n", wk); keySize = 1; keyName[0] = wk & 0xFF; #endif } } else #endif do { static XComposeStatus compose_status = { NULL, 0 }; nbytes = XLookupString(keyEvent, keyName, keySize, key, &compose_status); } while (0); if (showKeys) { fprintf(stderr, "Key: 0x%04lx '%s'\tKeyEventState:0x%x\t", *key, XKeysymToString(*key), keyEvent->state); if (nbytes && isprint(keyName[0])) { keyName[nbytes] = 0; fprintf(stderr, "String:'%s' Size:%2d ", keyName, nbytes); } fputs("\n", stderr); } if (((*key == XK_F1) || (*key == XK_F11)) && ((keyEvent->state & (ShiftMask | ControlMask)) == (ShiftMask | ControlMask)) && (keyEvent->type == KeyPress)) showKeys = !showKeys; return i18n_key_analyze(keyEvent, key, keyName, nbytes); } /*FOLD00*/ efte-1.1/src/i_search.cpp0000664000076400007640000001177111041404761014377 0ustar laurilauri/* i_search.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" static char PrevISearch[MAXISEARCH] = ""; ExISearch::ExISearch(EBuffer *B) { Buffer = B; strcpy(ISearchStr, ""); len = 0; stacklen = 0; Orig = Buffer->CP; // ? Direction = 0; state = INoMatch; } ExISearch::~ExISearch() { if (ISearchStr[0] != 0) strcpy(PrevISearch, ISearchStr); } void ExISearch::Activate(int gotfocus) { ExView::Activate(gotfocus); } int ExISearch::BeginMacro() { return 1; } void ExISearch::HandleEvent(TEvent &Event) { int Case = BFI(Buffer, BFI_MatchCase) ? 0 : SEARCH_NCASE; ExView::HandleEvent(Event); switch (Event.What) { case evKeyDown: SetState(IOk); switch (kbCode(Event.Key.Code)) { case kbEsc: Buffer->SetPos(Orig.Col, Orig.Row); EndExec(0); break; case kbEnter: EndExec(1); break; case kbBackSp: if (len > 0) { if (stacklen > 0) { stacklen--; if (Buffer->CenterPos(stack[stacklen].Col, stack[stacklen].Row) == 0) return; } len--; ISearchStr[len] = 0; if (len > 0 && Buffer->FindStr(ISearchStr, len, Case | Direction) == 0) { SetState(INoMatch); } } else { if (Buffer->CenterPos(Orig.Col, Orig.Row) == 0) return; } break; case kbUp: Buffer->ScrollDown(1); break; case kbDown: Buffer->ScrollUp(1); break; case kbLeft: Buffer->ScrollRight(8); break; case kbRight: Buffer->ScrollLeft(8); break; case kbPgDn: Buffer->MovePageDown(); break; case kbPgUp: Buffer->MovePageUp(); break; case kbPgUp | kfCtrl: Buffer->MoveFileStart(); break; case kbPgDn | kfCtrl: Buffer->MoveFileEnd(); break; case kbHome: Buffer->MoveLineStart(); break; case kbEnd: Buffer->MoveLineEnd(); break; case kbTab | kfShift: Direction = SEARCH_BACK; if (len == 0) { strcpy(ISearchStr, PrevISearch); len = strlen(ISearchStr); if (len == 0) break; } if (Buffer->FindStr(ISearchStr, len, Case | Direction | SEARCH_NEXT) == 0) { Buffer->FindStr(ISearchStr, len, Case); SetState(INoPrev); } break; case kbTab: Direction = 0; if (len == 0) { strcpy(ISearchStr, PrevISearch); len = strlen(ISearchStr); if (len == 0) break; } if (Buffer->FindStr(ISearchStr, len, Case | Direction | SEARCH_NEXT) == 0) { Buffer->FindStr(ISearchStr, len, Case); SetState(INoNext); } break; case 'Q' | kfCtrl: Event.What = evKeyDown; Event.Key.Code = Win->GetChar(0); default: if (isAscii(Event.Key.Code) && (len < MAXISEARCH)) { char Ch = (char) Event.Key.Code; stack[stacklen++] = Buffer->CP; ISearchStr[len++] = Ch; ISearchStr[len] = 0; if (Buffer->FindStr(ISearchStr, len, Case | Direction) == 0) { SetState(INoMatch); len--; stacklen--; ISearchStr[len] = 0; Buffer->FindStr(ISearchStr, len, Case | Direction); } else { } } break; } } } void ExISearch::UpdateView() { if (Next) { Next->UpdateView(); } } void ExISearch::RepaintView() { if (Next) { Next->RepaintView(); } } void ExISearch::UpdateStatus() { RepaintStatus(); } void ExISearch::RepaintStatus() { TDrawBuffer B; char s[MAXISEARCH + 1]; const char *p; int W, H; ConQuerySize(&W, &H); switch (state) { case INoMatch: p = " No Match. "; break; case INoPrev: p = " No Prev Match. "; break; case INoNext: p = " No Next Match. "; break; case IOk: default: p = ""; break; } sprintf(s, "ISearch [%s]%s", ISearchStr, p); MoveCh(B, ' ', 0x17, W); MoveStr(B, 0, W, s, 0x17, W); ConPutBox(0, H - 1, W, 1, B); ConSetCursorPos(strlen(s) - 1, H - 1); ConShowCursor(); } void ExISearch::SetState(IState s) { state = s; RepaintView(); } efte-1.1/src/c_hilit.cpp0000664000076400007640000001566611163156165014253 0ustar laurilauri/* c_hilit.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" static const struct { const char *Name; int Num; SyntaxProc Proc; } HilitModes[] = { { "PLAIN", HILIT_PLAIN, Hilit_Plain }, { "C", HILIT_C, Hilit_C }, { "REXX", HILIT_REXX, Hilit_REXX }, { "PERL", HILIT_PERL, Hilit_PERL }, { "MAKE", HILIT_MAKE, Hilit_MAKE }, { "IPF", HILIT_IPF, Hilit_IPF }, { "Ada", HILIT_ADA, Hilit_ADA }, { "MSG", HILIT_MSG, Hilit_MSG }, { "SH", HILIT_SH, Hilit_SH }, { "PASCAL", HILIT_PASCAL, Hilit_PASCAL }, { "TEX", HILIT_TEX, Hilit_TEX }, { "FTE", HILIT_FTE, Hilit_FTE }, { "CATBS", HILIT_CATBS, Hilit_CATBS }, { "SIMPLE", HILIT_SIMPLE, Hilit_SIMPLE }, }; static const struct { const char *Name; int Num; } IndentModes[] = { { "C", INDENT_C }, { "REXX", INDENT_REXX }, { "SIMPLE", INDENT_REXX }, { "PLAIN", INDENT_PLAIN }, }; EColorize *Colorizers = 0; int GetIndentMode(const char *Str) { for (unsigned int i = 0; i < sizeof(IndentModes) / sizeof(IndentModes[0]); i++) if (strcmp(Str, IndentModes[i].Name) == 0) return IndentModes[i].Num; return 0; } int GetHilitMode(const char *Str) { for (unsigned int i = 0; i < sizeof(HilitModes) / sizeof(HilitModes[0]); i++) if (strcmp(Str, HilitModes[i].Name) == 0) return HilitModes[i].Num; return HILIT_PLAIN; } SyntaxProc GetHilitProc(int id) { for (unsigned int i = 0; i < sizeof(HilitModes) / sizeof(HilitModes[0]); i++) if (id == HilitModes[i].Num) return HilitModes[i].Proc; return 0; } int EBuffer::HilitAddWord(const char *Word) { if (HilitFindWord(Word) == 1) return 1; WordList = (char **)realloc((void *)WordList, (1 + WordCount) * sizeof(char *)); if (WordList == 0) return 0; WordList[WordCount++] = strdup(Word); FullRedraw(); return 1; } int EBuffer::HilitFindWord(const char *Word) { for (int i = 0; i < WordCount; i++) { if (BFI(this, BFI_MatchCase) == 1) { if (strcmp(Word, WordList[i]) == 0) return 1; } else { if (stricmp(Word, WordList[i]) == 0) return 1; } } return 0; } int EBuffer::HilitRemoveWord(const char *Word) { for (int i = 0; i < WordCount; i++) { if (BFI(this, BFI_MatchCase) == 1) { if (strcmp(Word, WordList[i]) != 0) continue; } else { if (stricmp(Word, WordList[i]) != 0) continue; } free(WordList[i]); memmove(WordList + i, WordList + i + 1, sizeof(char *) * (WordCount - i - 1)); WordCount--; WordList = (char **)realloc((void *)WordList, WordCount * sizeof(char *)); FullRedraw(); return 1; } return 0; } int EBuffer::HilitWord() { PELine L = VLine(CP.Row); char s[CK_MAXLEN + 2]; int P, len = 0; P = CharOffset(L, CP.Col); while ((P > 0) && ((ChClass(L->Chars[P - 1]) == 1) || (L->Chars[P - 1] == '_'))) P--; while (len < CK_MAXLEN && P < L->Count && (ChClass(L->Chars[P]) == 1 || L->Chars[P] == '_')) s[len++] = L->Chars[P++]; if (len == 0) return 0; s[len] = 0; return (HilitFindWord(s)) ? HilitRemoveWord(s) : HilitAddWord(s); } /* ======================================================================= */ EColorize::EColorize(const char *AName, const char *AParent) { Name = strdup(AName); SyntaxParser = HILIT_PLAIN; Next = Colorizers; hm = 0; Colorizers = this; Parent = FindColorizer(AParent); memset((void *)&Keywords, 0, sizeof(Keywords)); memset((void *)Colors, 0, sizeof(Colors)); if (Parent) { SyntaxParser = Parent->SyntaxParser; memcpy((void *)Colors, (void *)Parent->Colors, sizeof(Colors)); } else { SyntaxParser = HILIT_PLAIN; } } EColorize::~EColorize() { free(Name); for (int i = 0; i < CK_MAXLEN; i++) free(Keywords.key[i]); delete hm; } EColorize *FindColorizer(const char *AName) { EColorize *p = Colorizers; while (p) { if (strcmp(AName, p->Name) == 0) return p; p = p->Next; } return 0; } int EColorize::SetColor(int idx, const char *Value) { unsigned int ColBg, ColFg; if (sscanf(Value, "%1X %1X", &ColFg, &ColBg) != 2) return 0; if (idx < 0 || idx >= COUNT_CLR) return 0; Colors[idx] = ColFg | (ColBg << 4); return 1; } /* ======================================================================= */ void HTrans::InitTrans() { match = 0; matchLen = 0; matchFlags = 0; nextState = 0; color = 0; regexp = 0; } /* ======================================================================= */ void HState::InitState() { memset((void *)&keywords, 0, sizeof(keywords)); firstTrans = 0; transCount = 0; color = 0; wordChars = 0; options = 0; nextKwdMatchedState = -1; nextKwdNotMatchedState = -1; nextKwdNoCharState = -1; } int HState::GetHilitWord(int len, char *str, ChColor &clr) { char *p; if (len >= CK_MAXLEN || len < 1) return 0; p = keywords.key[len]; if (options & STATE_NOCASE) { while (p && *p) { if (strnicmp(p, str, len) == 0) { clr = COUNT_CLR + ((unsigned char*)p)[len]; return 1; } p += len + 1; } } else { while (p && *p) { if (memcmp(p, str, len) == 0) { clr = COUNT_CLR + ((unsigned char*)p)[len]; return 1; } p += len + 1; } } return 0; } /* ======================================================================= */ HMachine::HMachine() { stateCount = 0; state = 0; transCount = 0; trans = 0; } HMachine::~HMachine() { // free states if (state) { int i; while (stateCount--) { for (i = 0; i < CK_MAXLEN; i++) free(state[stateCount].keywords.key[i]); free(state[stateCount].wordChars); } free(state); } // free transes if (trans) { while (transCount--) { if (trans[transCount].match) free(trans[transCount].match); if (trans[transCount].regexp) RxFree(trans[transCount].regexp); } free(trans); } } void HMachine::AddState(HState &aState) { state = (HState *)realloc(state, (stateCount + 1) * sizeof(HState)); assert(state); state[stateCount] = aState; state[stateCount].firstTrans = transCount; stateCount++; } void HMachine::AddTrans(HTrans &aTrans) { assert(stateCount > 0); trans = (HTrans *)realloc(trans, (transCount + 1) * sizeof(HTrans)); assert(trans); state[stateCount - 1].transCount++; trans[transCount] = aTrans; transCount++; } efte-1.1/src/g_draw.cpp0000664000076400007640000001544311041404761014065 0ustar laurilauri/* g_draw.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "console.h" #ifdef NTCONSOLE # define WIN32_LEAN_AND_MEAN 1 # include #endif int CStrLen(const char *p) { int len = 0, was = 0; while (*p) { len++; if (*p == '&' && !was) { len--; was = 1; } p++; was = 0; } return len; } #ifndef NTCONSOLE void MoveCh(PCell B, char CCh, TAttr Attr, int Count) { unsigned char *p = (unsigned char *) B; while (Count > 0) { *p++ = (unsigned char) CCh; *p++ = (unsigned char) Attr; Count--; } } void MoveChar(PCell B, int Pos, int Width, const char CCh, TAttr Attr, int Count) { unsigned char *p = (unsigned char *) B; if (Pos < 0) { Count += Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + Count > Width) Count = Width - Pos; if (Count <= 0) return; for (p += sizeof(TCell) * Pos; Count > 0; Count--) { *p++ = (unsigned char) CCh; *p++ = (unsigned char) Attr; } } void MoveMem(PCell B, int Pos, int Width, const char* Ch, TAttr Attr, int Count) { unsigned char *p = (unsigned char *) B; if (Pos < 0) { Count += Pos; Ch -= Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + Count > Width) Count = Width - Pos; if (Count <= 0) return; for (p += sizeof(TCell) * Pos; Count > 0; Count--) { *p++ = (unsigned char)(*Ch++); *p++ = (unsigned char) Attr; } } void MoveStr(PCell B, int Pos, int Width, const char* Ch, TAttr Attr, int MaxCount) { unsigned char *p = (unsigned char *) B; if (Pos < 0) { MaxCount += Pos; Ch -= Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + MaxCount > Width) MaxCount = Width - Pos; if (MaxCount <= 0) return; for (p += sizeof(TCell) * Pos; MaxCount > 0 && (*Ch != 0); MaxCount--) { *p++ = (unsigned char)(*Ch++); *p++ = (unsigned char) Attr; } } void MoveCStr(PCell B, int Pos, int Width, const char* Ch, TAttr A0, TAttr A1, int MaxCount) { unsigned char *p = (unsigned char *) B; char was = 0; if (Pos < 0) { MaxCount += Pos; Ch -= Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + MaxCount > Width) MaxCount = Width - Pos; if (MaxCount <= 0) return; for (p += sizeof(TCell) * Pos; MaxCount > 0 && (*Ch != 0); MaxCount--) { if (*Ch == '&' && !was) { Ch++; MaxCount++; was = 1; continue; } *p++ = (unsigned char)(*Ch++); if (was) { *p++ = (unsigned char) A1; was = 0; } else *p++ = (unsigned char) A0; } } void MoveAttr(PCell B, int Pos, int Width, TAttr Attr, int Count) { unsigned char *p = (unsigned char *) B; if (Pos < 0) { Count += Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + Count > Width) Count = Width - Pos; if (Count <= 0) return; for (p += sizeof(TCell) * Pos; Count > 0; Count--) { p++; *p++ = (unsigned char) Attr; } } void MoveBgAttr(PCell B, int Pos, int Width, TAttr Attr, int Count) { char *p = (char *) B; if (Pos < 0) { Count += Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + Count > Width) Count = Width - Pos; if (Count <= 0) return; for (p += sizeof(TCell) * Pos; Count > 0; Count--) { p++; *p = ((unsigned char)(*p & 0x0F)) | ((unsigned char) Attr); p++; } } #else void MoveCh(PCell B, char Ch, TAttr Attr, int Count) { PCHAR_INFO p = (PCHAR_INFO) B; while (Count > 0) { p->Char.AsciiChar = Ch; p->Attributes = Attr; p++; Count--; } } void MoveChar(PCell B, int Pos, int Width, const char Ch, TAttr Attr, int Count) { PCHAR_INFO p = (PCHAR_INFO) B; if (Pos < 0) { Count += Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + Count > Width) Count = Width - Pos; if (Count <= 0) return; for (p += Pos; Count > 0; Count--) { p->Char.AsciiChar = Ch; p->Attributes = Attr; p++; } } void MoveMem(PCell B, int Pos, int Width, const char* Ch, TAttr Attr, int Count) { PCHAR_INFO p = (PCHAR_INFO) B; if (Pos < 0) { Count += Pos; Ch -= Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + Count > Width) Count = Width - Pos; if (Count <= 0) return; for (p += Pos; Count > 0; Count--) { p->Char.AsciiChar = *Ch++; p->Attributes = Attr; p++; } } void MoveStr(PCell B, int Pos, int Width, const char* Ch, TAttr Attr, int MaxCount) { PCHAR_INFO p = (PCHAR_INFO) B; if (Pos < 0) { MaxCount += Pos; Ch -= Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + MaxCount > Width) MaxCount = Width - Pos; if (MaxCount <= 0) return; for (p += Pos; MaxCount > 0 && (*Ch != 0); MaxCount--) { p->Char.AsciiChar = *Ch++; p->Attributes = Attr; p++; } } void MoveCStr(PCell B, int Pos, int Width, const char* Ch, TAttr A0, TAttr A1, int MaxCount) { PCHAR_INFO p = (PCHAR_INFO) B; char was; //TAttr A; if (Pos < 0) { MaxCount += Pos; Ch -= Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + MaxCount > Width) MaxCount = Width - Pos; if (MaxCount <= 0) return; was = 0; for (p += Pos; MaxCount > 0 && (*Ch != 0); MaxCount--) { if (*Ch == '&' && !was) { Ch++; MaxCount++; was = 1; continue; } p->Char.AsciiChar = (unsigned char)(*Ch++); if (was) { p->Attributes = A1; was = 0; } else p->Attributes = A0; p++; } } void MoveAttr(PCell B, int Pos, int Width, TAttr Attr, int Count) { PCHAR_INFO p = (PCHAR_INFO) B; if (Pos < 0) { Count += Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + Count > Width) Count = Width - Pos; if (Count <= 0) return; for (p += Pos; Count > 0; Count--, p++) p->Attributes = Attr; } void MoveBgAttr(PCell B, int Pos, int Width, TAttr Attr, int Count) { PCHAR_INFO p = (PCHAR_INFO) B; if (Pos < 0) { Count += Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + Count > Width) Count = Width - Pos; if (Count <= 0) return; for (p += Pos; Count > 0; Count--) { p->Attributes = ((unsigned char)(p->Attributes & 0xf)) | ((unsigned char) Attr); p++; } } #endif efte-1.1/src/s_files.cpp0000664000076400007640000002723111151611072014241 0ustar laurilauri/* s_files.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "sysdep.h" #include "s_files.h" #include "s_util.h" #include "s_string.h" #include // getenv #include #include #if defined(OS2) #define INCL_DOS #include #endif #if defined(NT) # define WIN32_LEAN_AND_MEAN 1 # include #else # include #endif char *Slash(char *Path, int Add) { int len = strlen(Path); if (Add) { if ((len == 0) || !ISSLASH(Path[len - 1])) { Path[len] = SLASH; Path[len+1] = 0; } } else { if ((len > 1) #if PATHTYPE == PT_DOSISH && ((len > 3) || (Path[1] != ':')) #endif ) { if (ISSLASH(Path[len - 1])) { Path[len - 1] = 0; } } } return Path; } char *SlashDir(char *Path) { int len = strlen(Path); if (len > 1) { #if PATHTYPE == PT_DOSISH if ((len == 2) && Path[1] == ':') { Path[2] = SLASH; Path[3] = 0; } else #endif if (!ISSLASH(Path[len - 1])) { struct stat statbuf; if (stat(Path, &statbuf) == 0) { if (S_ISDIR(statbuf.st_mode)) { Path[len] = SLASH; Path[len+1] = 0; } } } } return Path; } int IsDirectory(const char *Path) { int len = strlen(Path); if (len > 0) { #if PATHTYPE == PT_DOSISH if ((len == 2) && Path[1] == ':') return 1; else #endif if (!ISSLASH(Path[len - 1])) { int res; struct stat statbuf; #if PATHTYPE == PT_UNIXISH if (Path[0] == '~') { char Expanded[MAXPATH]; if (ExpandPath(Path, Expanded, sizeof(Expanded)) == -1) return 0; res = stat(Expanded, &statbuf); } else #endif res = stat(Path, &statbuf); if (res == 0) { if (S_ISDIR(statbuf.st_mode)) { return 1; } } return 0; } else return 1; } return 0; } #if PATHTYPE == PT_DOSISH static int GetDiskCurDir(int drive, char *dir) { if (drive < 1 || drive > 26) return -1; #if defined(__EMX__) return (_getcwd1(dir, (char)(drive + 'A' - 1)) == 0) ? 0 : -1; #elif defined(OS2) { ULONG len = MAXPATH - 4; // 'c:\0' return (DosQueryCurrentDir(drive, dir, &len) == 0) ? 0 : -1; } #elif defined(NT) { char orig[MAXPATH], newdrive[MAXPATH]; // set to new drive, get directory and restore original directory if (!GetCurrentDirectory(sizeof(orig), orig)) return -1; newdrive[0] = drive + 'A' - 1; newdrive[1] = ':'; newdrive[2] = 0; if (!SetCurrentDirectory(newdrive)) return -1; if (!GetCurrentDirectory(sizeof(newdrive), newdrive)) return -1; strcpy(dir, newdrive + 3); SetCurrentDirectory(orig); // ? check return 0; } #endif } static int SetDrive(int drive) { // 1 = A, 2 = B, 3 = C, ... if (drive < 1 || drive > 26) return -1; // mess // _chdrive seems to be most portable between dosish systems, // but seem to take different arguments ??? #if defined(__EMX__) return _chdrive(drive + 'A' - 1); #elif defined(OS2) return (DosSetDefaultDisk(drive) == 0) ? 0 : -1; #elif defined(NT) char buf[3]; buf[0] = (char)(drive + 'A' - 1); buf[1] = ':'; buf[2] = '\0'; return SetCurrentDirectory(buf) ? 0 : -1; #endif } #endif #if PATHTYPE == PT_UNIXISH int RemoveDots(char *Source, char *Dest) { char *p; char *d; p = Source; d = Dest; while (*p) { // if ((strncmp(p, SSLASH SSLASH, 2) == 0)) { if (ISSLASH(p[0]) && ISSLASH(p[1])) { p++; // } else if ((strncmp(p, SSLASH ".." SSLASH, 4) == 0) || (strcmp(p, SSLASH "..") == 0)) { } else if (ISSLASH(p[0]) && p[1] == '.' && p[2] == '.' && (ISSLASH(p[3]) || p[3] == 0)) { p += 3; while ((d > Dest) && !ISSEP(*d)) d--; *d = 0; continue; // } else if ((strncmp(p, SSLASH "." SSLASH, 3) == 0) || (strcmp(p, SSLASH ".") == 0)) { } else if (ISSLASH(p[0]) && p[1] == '.' && (ISSLASH(p[2]) || p[2] == 0)) { p += 2; continue; } *d++ = *p++; *d = 0; } *d = 0; return 0; } #endif int ExpandPath(const char *Path, char *Expand, int ExpandSize) { char Name[MAXPATH]; if (Path[0] == 0) { Expand[0] = 0; return 0; } #if PATHTYPE == PT_DOSISH int slashed = 0; char *path; strlcpy(Name, Path, sizeof(Name)); // Normalize slashes for (size_t idx = 0; idx < strlen(Name); idx++) if (Name[idx] == '/') Name[idx] = '\\'; if (Name[0] != 0) slashed = ISSLASH(Name[strlen(Name)-1]); Slash(Name, 0); path = Name; switch (Name[0]) { case SLASH: break; case 0: slashed = ISSLASH(Name[strlen(Name)-1]); break; case '~': { char Name2[MAXPATH]; if (Name[1] == SLASH || Name[1] == 0) { path = Name + 1; char *homePath = getenv("HOMEPATH"); // Windows Vista if (homePath == NULL) homePath = getenv("USERPROFILE"); // Windows XP if (homePath == NULL) strlcpy(Name2, "C:\\", sizeof(Name2)); // Windows 95/98 do not have home path else strlcpy(Name2, homePath, sizeof(Name2)); } if (path[0] != SLASH) Slash(Name2, 1); strlcat(Name2, path, sizeof(Name2)); strlcpy(Name, Name2, sizeof(Name)); } break; } if (Path[0] != SLASH) Slash(Name, 0); if (Name[0] && Name[1] == ':' && Name[2] == 0) { // '?:' int drive = Name[0]; strlcpy(Expand, Name, ExpandSize); Expand[2] = '\\'; Expand[3] = 0; drive = (int)(toupper(Name[0]) - 'A' + 1); if (GetDiskCurDir(drive, Expand + 3) == -1) return -1; } else { #if defined(__EMX__) if (_fullpath(Expand, Name, MAXPATH) == -1) return -1; #else if (_fullpath(Expand, Name, MAXPATH) == NULL) return -1; #endif } #if defined(__EMX__) { char *p = Expand; if (p && *p) do { if (ISSLASH(*p)) *p = SLASH; } while (*p++); } #endif if (slashed) SlashDir(Expand); return 0; #endif #if PATHTYPE == PT_UNIXISH char Name2[MAXPATH]; char *path, *p; strlcpy(Name, Path, sizeof(Name)); switch (Name[0]) { case SLASH: break; case '~': if (Name[1] == SLASH || Name[1] == 0) { const char *Home = getenv("HOME"); if (Home == 0) Home = "/"; path = Name + 1; strlcpy(Name2, Home, sizeof(Name2)); } else { struct passwd *pwd; p = Name; p++; while (*p && (*p != SLASH)) p++; if (*p == SLASH) { path = p + 1; *p = 0; } else { path = p; } pwd = getpwnam(Name + 1); if (pwd == NULL) return -1; strlcpy(Name2, pwd->pw_dir, sizeof(Name2)); } if (path[0] != SLASH) Slash(Name2, 1); strlcat(Name2, path, sizeof(Name2)); strlcpy(Name, Name2, sizeof(Name)); break; default: if (getcwd(Name, MAXPATH) == NULL) return -1; Slash(Name, 1); strlcat(Name, Path, sizeof(Name)); break; } return RemoveDots(Name, Expand); #endif } int IsSameFile(const char *Path1, const char *Path2) { char p1[MAXPATH], p2[MAXPATH]; if (ExpandPath(Path1, p1, sizeof(p1)) == -1) return -1; if (ExpandPath(Path2, p2, sizeof(p2)) == -1) return -1; if (filecmp(p1, p2) == 0) return 1; return 0; } int JustDirectory(const char *Path, char *Dir, int DirSize) { char *p; if (ExpandPath(Path, Dir, DirSize) == -1) strlcpy(Dir, Path, DirSize); p = SepRChr(Dir); if (p) { p[1] = 0; } else Dir[0] = 0; return 0; } int JustLastDirectory(const char *Path, char *Dir, int DirSize) { int lastSlash = strlen(Path); while (lastSlash > 0 && !ISSEP(Path[lastSlash])) lastSlash--; int secondLastSlash = lastSlash; while (secondLastSlash > 0 && !ISSEP(Path[secondLastSlash - 1])) secondLastSlash--; if ((lastSlash - secondLastSlash) >= (DirSize - 1)) { // how unfortunate, we didn't have enough space for directory name // just copy as many characters as possible while leaving room for NUL. lastSlash = secondLastSlash + DirSize - 2; } strncpy(Dir, Path + secondLastSlash, lastSlash - secondLastSlash); Dir[lastSlash - secondLastSlash] = 0; return 0; } int JustFileName(const char *Path, char *Name, int NameSize) { int len = strlen(Path); while (len > 0 && !ISSEP(Path[len - 1])) len--; strlcpy(Name, Path + len, NameSize); return 0; } int JustRoot(const char *Path, char *Root, int RootSize) { #if PATHTYPE == PT_UNIXISH strlcpy(Root, SSLASH, RootSize); #else if (RootSize >= 4) { strncpy(Root, Path, 3); Root[3] = 0; } #endif return 0; } int FileExists(const char *Path) { return (access(Path, 0) == 0) ? 1 : 0; } int IsFullPath(const char *Path) { if (ISSLASH(Path[0]) #if PATHTYPE == PT_DOSISH || (Path[0] != 0 && Path[1] == ':') #endif || (Path[0] != 0 && Path[1] != 0 && Path[0] == '.' && ISSLASH(Path[1]) ) ) return 1; else return 0; } const char *ShortFName(const char *Path, int len) { static char P[MAXPATH]; char p1[MAXPATH]; int l1; if (len < 10) len = 10; if (len > (int)(sizeof(P) - 1)) len = sizeof(P) - 1; if (ExpandPath(Path, p1, sizeof(p1)) == -1) return Path; l1 = strlen(p1); if (l1 < len) { strlcpy(P, p1, sizeof(P)); } else { strncpy(P, p1, 3); strcpy(P + 3, "..."); strncpy(P + 6, p1 + l1 - len, len - 6); } return P; } int ChangeDir(char *Dir) { Slash(Dir, 0); // remove last \ except in case of ?: #if PATHTYPE == PT_DOSISH if (Dir[0] && Dir[1] == ':') if (SetDrive(toupper(Dir[0]) - 'A' + 1) == -1) return -1; #endif if (chdir(Dir) == -1) return -1; return 0; } int JoinDirFile(char *Dest, const char *Dir, const char *Name) { strcpy(Dest, Dir); Slash(Dest, 1); strcat(Dest, Name); return 0; } char *SepRChr(char *Dir) { char *p; if (Dir && Dir[0]) { for (p = Dir + strlen(Dir); p > Dir; p--) if (ISSEP(p[-1])) return p -1; } return NULL; } // Returns relative path of Path with respect to Dir // Ex: Dir = /home/martin/src/ Path = /home/martin/src/Fte/s_files.cpp -> Fte/s_files.cpp int RelativePathName(const char *Dir, const char *Path, char *RelPath, int RelPathSize) { char d[MAXPATH], p[MAXPATH], c; int dl, pl; if (ExpandPath(Dir, d, sizeof(d)) == -1) return -1; if (ExpandPath(Path, p, sizeof(p)) == -1) return -1; dl = strlen(d); pl = strlen(p); if (dl <= pl) { c = p[dl]; p[dl] = 0; if (filecmp(d, p) == 0) { p[dl] = c; strlcpy(RelPath, p + dl, RelPathSize); return 0; } } return -1; } efte-1.1/src/e_buffer.h0000664000076400007640000005352211043103617014042 0ustar laurilauri/* e_buffer.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef _BUFFER_H_ #define _BUFFER_H_ #include "gui.h" #include "o_model.h" #include "c_mode.h" #include "e_regex.h" #include "c_hilit.h" // hlState #include class EBuffer; class EMode; #define bmLine 0 #define bmStream 1 #define bmColumn 2 #define E_OK 0 // all ok #define E_CANCEL 1 // operation cancelled #define E_ERROR 2 // error #define E_NOMEM 3 // out of memory #define umDelete 0 #define umInsert 1 #define umSplitLine 2 #define umJoinLine 3 #define tmNone 0 #define tmLeft 1 #define tmRight 2 typedef unsigned char TransTable[256]; #define RWBUFSIZE 32768 extern char FileBuffer[RWBUFSIZE]; #define ChClass(x) (WGETBIT(Flags.WordChars, (x)) ? 1 : 0) #define ChClassK(x) (((x) == ' ' || (x) == 9) ? 2 : ChClass(x)) #define InRange(a,x,b) (((a) <= (x)) && ((x) < (b))) #define Min(a,b) (((a) < (b))?(a):(b)) #define Max(a,b) (((a) > (b))?(a):(b)) #define NextTab(pos,ts) (((pos) / (ts) + 1) * (ts)) // x before gap -> x // x less than count -> after gap // count - 1 before gap -> count - 1 // after gap -> allocated - 1 //#define GapLine(x,g,c,a) (((x) < (g)) ? (x) : (x) < (c) ? ((x) + (a) - (c)) : (c) - 1 < (g) ? (c) - 1 : (a) - 1 ) // Use inline to make it easier to read/debug static inline int GapLine(int No, int Gap, int Count, int Allocated) { int rc = -1; if (No < Gap) rc = No; else if (No < Count) rc = No + Allocated - Count; else if (Count - 1 < Gap) rc = Count - 1; else rc = Allocated - 1; return rc; } typedef class ELine* PELine; typedef class EPoint* PEPoint; #define CHAR_TRESHOLD 0x3U class ELine { public: int Count; char *Chars; hlState StateE; int IndentContinuation; ELine(int ACount, const char *AChars); ELine(char *AChars, int ACount); ~ELine(); int Allocate(unsigned int Bytes); // int Length(EBufferFlags *CurFlags); }; class EPoint { public: int Row; int Col; // EPoint(EPoint &M) { Row = M.Row; Col = M.Col; } EPoint(int aRow = 0, int aCol = 0) { Row = aRow; Col = aCol; } ~EPoint() {} }; typedef struct _UndoStack { int NextCmd, Record, Undo; int UndoPtr; int Num; void **Data; int *Top; } UndoStack; class RoutineView; typedef struct _RoutineList { int Count; int *Lines; } RoutineList; typedef struct _EBookmark { char *Name; EPoint BM; } EBookmark; typedef struct { int line; unsigned char level; unsigned char open; unsigned short flags; } EFold; class EEditPort: public EViewPort { public: EBuffer *Buffer; EPoint TP, OldTP; EPoint CP; int Rows, Cols; EEditPort(EBuffer *B, EView *V); virtual ~EEditPort(); virtual void HandleEvent(TEvent &Event); virtual void HandleMouse(TEvent &Event); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); virtual void Resize(int Width, int Height); int SetTop(int Col, int Row); virtual void GetPos(); virtual void StorePos(); void DrawLine(int L, TDrawBuffer B); void ScrollY(int Delta); void RedrawAll(); }; class EBuffer: public EModel { public: char GetStrVars[10][50]; //char *Name; char *FileName; int Modified; EPoint TP; EPoint CP; EPoint BB; EPoint BE; EPoint PrevPos; EPoint SavedPos; EBufferFlags Flags; EMode *Mode; int BlockMode; int ExtendGrab; int AutoExtend; int Loaded; UndoStack US; struct stat FileStatus; int FileOk; int Loading; int RAllocated; // text line allocation int RGap; int RCount; PELine *LL; int VAllocated; // visible lines int VGap; int VCount; int *VV; int FCount; EFold *FF; EPoint Match; int MatchLen; int MatchCount; RxMatchRes MatchRes; int BMCount; EBookmark *BMarks; RoutineList rlst; RoutineView *Routines; int MinRedraw, MaxRedraw; int RedrawToEos; char **WordList; int WordCount; SyntaxProc HilitProc; int StartHilit, EndHilit; int LastUpDownColumn; // For CursorWithinEOL movement // constructors EBuffer(int createFlags, EModel **ARoot, const char *AName); virtual ~EBuffer(); virtual void DeleteRelated(); virtual EViewPort *CreateViewPort(EView *V); EEditPort *GetViewVPort(EView *V); EEditPort *GetVPort(); virtual int CanQuit(); virtual int ConfQuit(GxView *V, int multiFile = 0); virtual int GetContext(); virtual EEventMap *GetEventMap(); virtual int BeginMacro(); virtual int ExecCommand(int Command, ExState &State); virtual void HandleEvent(TEvent &Event); virtual void GetName(char *AName, int MaxLen); virtual void GetPath(char *APath, int MaxLen); virtual void GetInfo(char *AInfo, int MaxLen); virtual void GetTitle(char *ATitle, int MaxLen, char *ASTitle, int SMaxLen); PELine RLine(int No) { #ifdef DEBUG_EDITOR int N = GapLine(No, RGap, RCount, RAllocated); if (!((No < RCount) && (No >= 0) && (LL[N]))) { printf("Get No = %d/%d Gap=%d RAlloc = %d, VCount = %d\n", No, RCount, RGap, RAllocated, VCount); assert((No < RCount) && (No >= 0) && (LL[N])); } #endif return LL[GapLine(No, RGap, RCount, RAllocated)]; } void RLine(int No, PELine L) { #ifdef DEBUG_EDITOR if (!((No >= 0))) printf("Set No = %d\n", No); assert((No >= 0)); #endif LL[GapLine(No, RGap, RCount, RAllocated)] = L; } int Vis(int No) { #ifdef DEBUG_EDITOR if (No < 0 || No >= VCount) { printf("Vis get no %d of %d\n", No, VCount); assert(No >= 0 && No < VCount); } #endif return VV[GapLine(No, VGap, VCount, VAllocated)]; } void Vis(int No, int V) { #ifdef DEBUG_EDITOR if (No < 0 || No >= VCount) { printf("Vis set no %d of %d to %d\n", No, VCount, V); assert(No >= 0 && No < VCount); } #endif VV[GapLine(No, VGap, VCount, VAllocated)] = V; } PELine VLine(int No) { #ifdef DEBUG_EDITOR if (!((No < VCount) && (No >= 0))) { printf("VGet No = %d\n", No); assert((No < VCount) && (No >= 0)); } if (Vis(No) < 0) assert(1 == 0); #endif return RLine(No + Vis(No)); } void VLine(int No, PELine L) { #ifdef DEBUG_EDITOR if (!((No >= 0))) { printf("VSet No = %d\n", No); assert((No >= 0)); } if (VV[No] < 0) assert(1 == 0); #endif RLine(No + Vis(No), L); } int VToR(int No) { #ifdef DEBUG_EDITOR if (!(No < VCount)) { printf("Get No = %d\n", No); assert((No < VCount)); } #endif return No + Vis(No); } int RToV(int No); int RToVN(int No); // allocation int Allocate(int ACount); int MoveRGap(int RPos); int AllocVis(int ACount); int MoveVGap(int VPos); int Modify(); int Clear(); int FreeUndo(); // internal primitives int ValidPos(EPoint W); int RValidPos(EPoint W); int LoadRegion(EPoint *A, int FH, int StripChar, int LineChar); int SaveRegion(EPoint *A, EPoint *Z, int FH, int AddCR, int AddLF, int Mode); int AssertLine(int Line); int InsertLine(EPoint Pos, int ACount, const char *AChars); int UpdateMarker(int Type, int Line, int Col, int Lines, int Cols); int UpdateMark(EPoint &M, int Type, int Line, int Col, int Lines, int Cols); void UpdateVis(EPoint &M, int Row, int Delta); void UpdateVisible(int Row, int Delta); int LoadFrom(const char *AFileName); int SaveTo(char *AFileName); int IsBlockStart(); int IsBlockEnd(); int BlockType(int Mode); int BeginExtend(); int EndExtend(); int CheckBlock(); int BlockRedraw(); int SetBB(EPoint M); int SetBE(EPoint M); int Load(); int Save(); int Reload(); int FilePrint(); int SetFileName(const char *AFileName, const char *AMode); int SetPos(int Col, int Row, int tabMode = tmNone); int SetPosR(int Col, int Row, int tabMode = tmNone); int CenterPos(int Col, int Row, int tabMode = tmNone); int CenterPosR(int Col, int Row, int tabMode = tmNone); int SetNearPos(int Col, int Row, int tabMode = tmNone); int SetNearPosR(int Col, int Row, int tabMode = tmNone); int CenterNearPos(int Col, int Row, int tabMode = tmNone); int CenterNearPosR(int Col, int Row, int tabMode = tmNone); int LineLen(int Row); int LineChars(int Row); ///////////////////////////////////////////////////////////////////////////// // Undo/Redo Routines ///////////////////////////////////////////////////////////////////////////// int NextCommand(); int PushUData(void *data, int len); int PushULong(unsigned long l); int PushUChar(unsigned char ch); int PopUData(void *data, int len); int GetUData(int No, int pos, void **data, int len); int Undo(int undo); int Undo(); int Redo(); int BeginUndo(); int EndUndo(); int PushBlockData(); ///////////////////////////////////////////////////////////////////////////// // Primitive Editing ///////////////////////////////////////////////////////////////////////////// //int ExpReg(int Row, int Ofs, int ACount, int &B, int &E); int ScreenPos(ELine *L, int Offset); int CharOffset(ELine *L, int ScreenPos); int DelLine(int Row, int DoMark = 1); int UnTabPoint(int Row, int Col); int InsLine(int Row, int DoAppend, int DoMark = 1); int DelChars(int Row, int Ofs, int ACount); int InsChars(int Row, int Ofs, int ACount, const char *Buffer); int InsertIndent(int Row, int Ofs, int ACount); int ChgChars(int Row, int Ofs, int ACount, const char *Buffer); int DelText(int Row, int Col, int ACount, int DoMark = 1); int InsText(int Row, int Col, int ACount, const char *Buffer, int DoMark = 1); int InsLineText(int Row, int Col, int ACount, int Pos, PELine Line); int SplitLine(int Row, int Col); int JoinLine(int Row, int Col); int CanUnfold(int Row); int PadLine(int Row, int Length); int ShowRow(int Row); int HideRow(int Row); int ExposeRow(int Row); // make row visible (open all folds containing) ///////////////////////////////////////////////////////////////////////////// // Redraw/Windowing Routines ///////////////////////////////////////////////////////////////////////////// void Draw(int Line0, int LineE); void DrawLine(TDrawBuffer B, int L, int C, int W, int &HilitX); void Hilit(int FromRow); void Rehilit(int ToRow); void Redraw(); void FullRedraw(); int GetHilitWord(int len, char *str, ChColor &clr, int IgnCase = 0); ///////////////////////////////////////////////////////////////////////////// // Utility Routines ///////////////////////////////////////////////////////////////////////////// int LineIndented(int Row, const char *indentchars = 0); int LineIndentedCharCount(ELine *l, const char *indentchars); int IndentLine(int Row, int Indent); int GetMap(int Row, int *StateLen, hsState **StateMap); int FindStr(char *Data, int Len, int Options); int FindStr(char *Data, int Len, SearchReplaceOptions &opt); int FindRx(RxNode *Rx, SearchReplaceOptions &opt); int Find(SearchReplaceOptions &opt); int IsLineBlank(int Row); int TrimLine(int Row); int ScanForRoutines(); ///////////////////////////////////////////////////////////////////////////// // Bookmark Routines ///////////////////////////////////////////////////////////////////////////// int PlaceBookmark(char *Name, EPoint P); int RemoveBookmark(char *Name); int GetBookmark(char *Name, EPoint &P); int GotoBookmark(char *Name); int GetBookmarkForLine(int searchFrom, int searchForLine, char *&Name, EPoint &P); ///////////////////////////////////////////////////////////////////////////// // Editing Routines ///////////////////////////////////////////////////////////////////////////// int MoveLeft(); int MoveRight(); int MoveUp(); int MoveDown(); int MovePrev(); int MoveNext(); int MoveWordLeftX(int start); int MoveWordRightX(int start); int MoveWordLeft(); int MoveWordRight(); int MoveWordPrev(); int MoveWordNext(); int MoveWordEndLeft(); int MoveWordEndRight(); int MoveWordEndPrev(); int MoveWordEndNext(); int MoveWordOrCapLeft(); int MoveWordOrCapRight(); int MoveWordOrCapPrev(); int MoveWordOrCapNext(); int MoveWordOrCapEndLeft(); int MoveWordOrCapEndRight(); int MoveWordOrCapEndPrev(); int MoveWordOrCapEndNext(); // int MoveWordStart(); // int MoveWordEnd(); int MoveLineStart(); int MoveLineEnd(); int MovePageUp(); int MovePageDown(); int MovePageLeft(); int MovePageRight(); int MovePageStart(); int MovePageEnd(); int MoveFileStart(); int MoveFileEnd(); int MoveBlockStart(); int MoveBlockEnd(); int ScrollLeft(int Cols); int ScrollRight(int Cols); int ScrollDown(int Lines); int ScrollUp(int Lines); int MoveToLine(); int MoveToColumn(); int MoveFirstNonWhite(); int MoveLastNonWhite(); int MovePrevEqualIndent(); int MoveNextEqualIndent(); int MovePrevTab(); int MoveNextTab(); int MoveLineTop(); int MoveLineCenter(); int MoveLineBottom(); int MovePrevPos(); int MoveSavedPosCol(); int MoveSavedPosRow(); int MoveSavedPos(); int SavePos(); int MoveTabStart(); int MoveTabEnd(); int MoveFoldTop(); int MoveFoldPrev(); int MoveFoldNext(); int MoveBeginOrNonWhite(); int MoveBeginLinePageFile(); int MoveEndLinePageFile(); int KillLine(); int KillChar(); int KillCharPrev(); int KillWord(); int KillWordPrev(); int KillWordOrCap(); int KillWordOrCapPrev(); int KillToLineStart(); int KillToLineEnd(); int KillBlock(); int BackSpace(); int Delete(); int CompleteWord(); int KillBlockOrChar(); int KillBlockOrCharPrev(); #define ccUp 0 #define ccDown 1 #define ccToggle 2 int CharTrans(TransTable tab); int CharCaseUp(); int CharCaseDown(); int CharCaseToggle(); int LineTrans(TransTable tab); int LineCaseUp(); int LineCaseDown(); int LineCaseToggle(); int BlockTrans(TransTable tab); int BlockCaseUp(); int BlockCaseDown(); int BlockCaseToggle(); int CharTrans(ExState &State); int LineTrans(ExState &State); int BlockTrans(ExState &State); int GetTrans(ExState &State, TransTable tab); int LineInsert(); int LineAdd(); int LineSplit(); int LineJoin(); int LineNew(); int LineIndent(); int LineTrim(); int LineCenter(); int FileTrim(); int BlockTrim(); int CanUndo(); int CanRedo(); int LineLen(); int LineCount(); int CLine(); int CColumn(); int InsertChar(char aCh); int TypeChar(char aCh); int InsertString(const char *aStr, int aCount); int InsertSpacesToTab(int TSize); int InsertTab(); int InsertSpace(); int SelfInsert(); int DoWrap(int WrapAll); int WrapPara(); int InsPrevLineChar(); int InsPrevLineToEol(); int LineDuplicate(); int GetMatchBrace(EPoint &M, int MinLine, int MaxLine, int show); int MatchBracket(); int HilitMatchBracket(); int BlockBegin(); int BlockEnd(); int BlockUnmark(); int BlockCut(int Append); int BlockCopy(int Append, int clipboard = 0); int BlockPaste(int clipboard = 0); int BlockKill(); int BlockIndent(); int BlockUnindent(); int BlockClear(); int BlockMarkStream(); int BlockMarkLine(); int BlockMarkColumn(); int BlockReadFrom(const char *aFileName, int blockMode); int BlockWriteTo(const char *aFileName, int Append = 0); int BlockExtendBegin(); int BlockExtendEnd(); int BlockReIndent(); int BlockIsMarked(); int BlockPasteStream(int clipboard = 0); int BlockPasteLine(int clipboard = 0); int BlockPasteColumn(int clipboard = 0); int BlockPasteOver(int clipboard = 0); int BlockSelectWord(); int BlockSelectLine(); int BlockSelectPara(); int BlockPrint(); int BlockSort(int Reverse); int ClipClear(int clipboard = 0); int BlockUnTab(); int BlockEnTab(); int ToggleAutoIndent(); int ToggleInsert(); int ToggleExpandTabs(); int ToggleShowTabs(); int ToggleUndo(); int ToggleReadOnly(); int ToggleKeepBackups(); int ToggleMatchCase(); int ToggleBackSpKillTab(); int ToggleDeleteKillTab(); int ToggleSpaceTabs(); int ToggleIndentWithTabs(); int ToggleBackSpUnindents(); int ToggleWordWrap(); int ToggleTrim(); int ToggleShowMarkers(); int ToggleHilitTags(); int ToggleShowBookmarks(); int ToggleMakeBackups(); int SetLeftMargin(); int SetRightMargin(); int ShowPosition(); int Search(ExState &State, char *aString, int Options, int CanResume = 0); int SearchAgain(ExState &State, unsigned int Options); int SearchReplace(ExState &State, char *aString, char *aReplaceString, int Options); int Search(ExState &State); int SearchB(ExState &State); int SearchRx(ExState &State); int SearchAgain(ExState &State); int SearchAgainB(ExState &State); int SearchReplace(ExState &State); int SearchReplaceB(ExState &State); int SearchReplaceRx(ExState &State); int HilitAddWord(const char *Word); int HilitFindWord(const char *Word); int HilitRemoveWord(const char *Word); int HilitWord(); int SearchWord(int Flags); int FindFold(int Line); int FindNearFold(int Line); int FoldCreate(int Line); int FoldCreateByRegexp(char *Regexp); int FoldDestroy(int Line); int FoldDestroyAll(); int FoldPromote(int Line); int FoldDemote(int Line); int FoldOpen(int Line); int FoldOpenAll(); int FoldOpenNested(); int FoldClose(int Line); int FoldCloseAll(); int FoldToggleOpenClose(); int ChangeMode(char *Mode); int ChangeKeys(char *Mode); int ChangeFlags(char *Mode); int ScrollLeft(ExState &State); int ScrollRight(ExState &State); int ScrollDown(ExState &State); int ScrollUp(ExState &State); /* editor functions with user interface */ int MoveToColumn(ExState &State); int MoveToLine(ExState &State); int FoldCreateByRegexp(ExState &State); int PlaceUserBookmark(const char *n, EPoint P); int RemoveUserBookmark(const char *n); int GotoUserBookmark(const char *n); int GetUserBookmarkForLine(int searchFrom, int searchForLine, char *&Name, EPoint &P); int PlaceBookmark(ExState &State); int RemoveBookmark(ExState &State); int GotoBookmark(ExState &State); int InsertString(ExState &State); int SelfInsert(ExState &State); int FileReload(ExState &State); int FileSaveAs(char *FileName); int FileSaveAs(ExState &State); int FileWriteTo(char *FileName); int FileWriteTo(ExState &State); int BlockReadX(ExState &State, int BlockMode); int BlockRead(ExState &State); int BlockReadStream(ExState &State); int BlockReadLine(ExState &State); int BlockReadColumn(ExState &State); int BlockWrite(ExState &State); int Find(ExState &State); int FindReplace(ExState &State); int FindRepeat(ExState &State); int FindRepeatOnce(ExState &State); int FindRepeatReverse(ExState &State); int InsertChar(ExState &State); int TypeChar(ExState &State); int ChangeMode(ExState &State); int ChangeKeys(ExState &State); int ChangeFlags(ExState &State); int ChangeTabSize(ExState &State); int ChangeRightMargin(ExState &State); int ChangeLeftMargin(ExState &State); int ASCIITable(ExState &State); int FindTag(ExState &State); int FindTagWord(ExState &State); int SetCIndentStyle(ExState &State); int FindFunction(int delta, int way); int BlockMarkFunction(); int IndentFunction(); int MoveFunctionPrev(); int MoveFunctionNext(); int InsertDate(ExState& state); int InsertUid(); int ShowHelpWord(ExState &State); int PlaceGlobalBookmark(ExState &State); int PushGlobalBookmark(); virtual int GetStrVar(int var, char *str, int buflen); virtual int GetIntVar(int var, int *value); int SetIndentWithTabs(ExState &State); int FoldCreateAtRoutines(); int GetString(ExState &State); int RegExp(ExState &State); int ExpandTemplate(ExState &State); }; extern EBuffer *SSBuffer; extern SearchReplaceOptions LSearch; extern int suspendLoads; int DoneEditor(); EBuffer *FindFile(char *FileName); int ParseSearchOption(int replace, char c, unsigned long &opt); int ParseSearchOptions(int replace, const char *str, unsigned long &Options); int ParseSearchReplace(EBuffer *B, const char *str, int replace, SearchReplaceOptions &opt); #endif efte-1.1/src/c_history.cpp0000664000076400007640000003015211041404761014617 0ustar laurilauri/* c_history.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #define HISTORY_VER "eFTE History 1\n" char HistoryFileName[256] = ""; static FPosHistory **FPHistory = 0; static int FPHistoryCount = 0; static InputHistory inputHistory = { 0, 0, 0 }; void ClearHistory() { /*FOLD00*/ // free filenames from all entries while (FPHistoryCount--) { free(FPHistory[FPHistoryCount]->FileName); free(FPHistory[FPHistoryCount]); } // free history list free(FPHistory); // free input history { while (inputHistory.Count--) { free(inputHistory.Line[inputHistory.Count]); } free(inputHistory.Line); free(inputHistory.Id); } } int SaveHistory(char *FileName) { /*FOLD00*/ FILE *fp; fp = fopen(FileName, "w"); if (fp == 0) return 0; setvbuf(fp, FileBuffer, _IOFBF, sizeof(FileBuffer)); fprintf(fp, HISTORY_VER); if (FPHistory) { // file position history int i, j; for (i = 0; i < FPHistoryCount; i++) { fprintf(fp, "F|%d|%d|%s\n", FPHistory[i]->Row, FPHistory[i]->Col, FPHistory[i]->FileName); for (j = 0;j < FPHistory[i]->BookCount;j++) fprintf(fp, "B|%d|%d|%s\n", FPHistory[i]->Books[j]->Row, FPHistory[i]->Books[j]->Col, FPHistory[i]->Books[j]->Name); } } { // input history, store in reverse order to preserve order when loading for (int i = inputHistory.Count - 1; i >= 0; i--) { fprintf(fp, "I|%d|%s\n", inputHistory.Id[i], inputHistory.Line[i]); } } fclose(fp); return 1; } int LoadHistory(char *FileName) { /*FOLD00*/ FILE *fp; char line[2048]; char *p, *e; FPosHistory *last = NULL; HBookmark **nb; fp = fopen(FileName, "r"); if (fp == 0) return 0; setvbuf(fp, FileBuffer, _IOFBF, sizeof(FileBuffer)); if (fgets(line, sizeof(line), fp) == 0 || strcmp(line, HISTORY_VER) != 0) { fclose(fp); return 0; } while (fgets(line, sizeof(line), fp) != 0) { if (line[0] == 'F' && line[1] == '|') { // file position history int r, c, L, R, M, cmp; p = line + 2; r = strtol(p, &e, 10); if (e == p) break; if (*e == '|') e++; else break; c = strtol(p = e, &e, 10); if (e == p) break; if (*e == '|') e++; else break; e = strchr(p = e, '\n'); if (e == 0) break; *e = 0; last = NULL; if (UpdateFPos(p, r, c) == 0) break; // Get current file's record for storing bookmarks L = 0; R = FPHistoryCount; while (L < R) { M = (L + R) / 2; cmp = filecmp(p, FPHistory[M]->FileName); if (cmp == 0) { last = FPHistory[M]; break; } else if (cmp < 0) { R = M; } else { L = M + 1; } } } else if (line[0] == 'B' && line[1] == '|') { // bookmark history for last file if (last) { int r, c; p = line + 2; r = strtol(p, &e, 10); if (e == p) break; if (*e == '|') e++; else break; c = strtol(p = e, &e, 10); if (e == p) break; if (*e == '|') e++; else break; e = strchr(p = e, '\n'); if (e == 0) break; *e = 0; nb = (HBookmark **)realloc(last->Books, sizeof(HBookmark *) * (last->BookCount + 1)); if (nb) { last->Books = nb; nb[last->BookCount] = (HBookmark *)malloc(sizeof(HBookmark)); if (nb[last->BookCount]) { nb[last->BookCount]->Row = r; nb[last->BookCount]->Col = c; nb[last->BookCount]->Name = strdup(p); last->BookCount++; } } } } else if (line[0] == 'I' && line[1] == '|') { // input history int i; p = line + 2; i = strtol(p, &e, 10); if (e == p) break; if (*e == '|') e++; else break; e = strchr(p = e, '\n'); if (e == 0) break; *e = 0; AddInputHistory(i, p); } } fclose(fp); return 1; } int UpdateFPos(char *FileName, int Row, int Col) { /*FOLD00*/ int L = 0, R = FPHistoryCount, M, N; FPosHistory *fp, **NH; int cmp; if (FPHistory != 0) { while (L < R) { M = (L + R) / 2; cmp = filecmp(FileName, FPHistory[M]->FileName); if (cmp == 0) { FPHistory[M]->Row = Row; FPHistory[M]->Col = Col; return 1; } else if (cmp < 0) { R = M; } else { L = M + 1; } } } else { FPHistoryCount = 0; L = 0; } assert(L >= 0 && L <= FPHistoryCount); fp = (FPosHistory *)malloc(sizeof(FPosHistory)); if (fp == 0) return 0; fp->Row = Row; fp->Col = Col; fp->FileName = strdup(FileName); fp->Books = NULL; fp->BookCount = 0; if (fp->FileName == 0) { free(fp); return 0; } N = 64; while (N <= FPHistoryCount) N *= 2; NH = (FPosHistory **)realloc((void *)FPHistory, N * sizeof(FPosHistory *)); if (NH == 0) { free(fp->FileName); free(fp); return 0; } FPHistory = NH; if (L < FPHistoryCount) memmove(FPHistory + L + 1, FPHistory + L, (FPHistoryCount - L) * sizeof(FPosHistory *)); FPHistory[L] = fp; FPHistoryCount++; return 1; } int RetrieveFPos(char *FileName, int &Row, int &Col) { /*FOLD00*/ int L = 0, R = FPHistoryCount, M; int cmp; if (FPHistory == 0) return 0; while (L < R) { M = (L + R) / 2; cmp = filecmp(FileName, FPHistory[M]->FileName); if (cmp == 0) { Row = FPHistory[M]->Row; Col = FPHistory[M]->Col; return 1; } else if (cmp < 0) { R = M; } else { L = M + 1; } } return 0; } int AddInputHistory(int Id, char *String) { /*FOLD00*/ char *s = NULL; // get rid of a "might not be initialised" warning int i; // First check if it is already in list for (i = 0; i < inputHistory.Count; i++) { if (inputHistory.Id[i] == Id && strcmp(String, inputHistory.Line[i]) == 0) { // Found, will be moved to the beginning of list s = inputHistory.Line[i]; break; } } if (s == NULL) { // Not in list s = strdup(String); if (inputHistory.Count < MAX_INPUT_HIST) { inputHistory.Count++; inputHistory.Line = (char **) realloc((void *) inputHistory.Line, inputHistory.Count * sizeof(char *)); inputHistory.Id = (int *) realloc((void *) inputHistory.Id, inputHistory.Count * sizeof(int *)); } else { i--; free(inputHistory.Line[inputHistory.Count - 1]); } } memmove(inputHistory.Line + 1, inputHistory.Line, i * sizeof(char *)); memmove(inputHistory.Id + 1, inputHistory.Id, i * sizeof(int *)); inputHistory.Id[0] = Id; inputHistory.Line[0] = s; return 1; } int CountInputHistory(int Id) { /*FOLD00*/ int i, c = 0; for (i = 0; i < inputHistory.Count; i++) if (inputHistory.Id[i] == Id) c++; return c; } int GetInputHistory(int Id, char *String, int len, int Nth) { /*FOLD00*/ int i = 0; assert(len > 0); while (i < inputHistory.Count) { if (inputHistory.Id[i] == Id) { Nth--; if (Nth == 0) { strncpy(String, inputHistory.Line[i], len); String[len - 1] = 0; return 1; } } i++; } return 0; } /* * Get bookmarks for given Buffer (file) from history. */ int RetrieveBookmarks(EBuffer *buffer) { /*FOLD00*/ int L = 0, R = FPHistoryCount, M, i; int cmp; HBookmark *bmk; char name[256+4] = "_BMK"; EPoint P; assert(buffer != NULL); if (FPHistoryCount == 0) return 1; while (L < R) { M = (L + R) / 2; cmp = filecmp(buffer->FileName, FPHistory[M]->FileName); if (cmp == 0) { // Now "copy" bookmarks to Buffer for (i = 0;i < FPHistory[M]->BookCount;i++) { bmk = FPHistory[M]->Books[i]; strcpy(name + 4, bmk->Name); P.Row = bmk->Row; P.Col = bmk->Col; if (P.Row < 0) P.Row = 0; else if (P.Row >= buffer->RCount) P.Row = buffer->RCount - 1; if (P.Col < 0) P.Col = 0; buffer->PlaceBookmark(name, P); } return 1; } else if (cmp < 0) { R = M; } else { L = M + 1; } } return 1; } /* * Store given Buffer's bookmarks to history. */ int StoreBookmarks(EBuffer *buffer) { /*FOLD00*/ int L = 0, R = FPHistoryCount, M, i, j; int cmp; char *name; EPoint P; HBookmark *bmk; assert(buffer != NULL); if (RetrieveFPos(buffer->FileName, i, j) == 0) { // File not found in FPHistory -> add it if (UpdateFPos(buffer->FileName, 0, 0) == 0) return 0; } // Now file is surely in FPHistory while (L < R) { M = (L + R) / 2; cmp = filecmp(buffer->FileName, FPHistory[M]->FileName); if (cmp == 0) { // First delete previous bookmarks for (i = 0;i < FPHistory[M]->BookCount;i++) { bmk = FPHistory[M]->Books[i]; if (bmk->Name) free(bmk->Name); free(bmk); } free(FPHistory[M]->Books); FPHistory[M]->Books = NULL; // Now add new bookmarks - first get # of books to store for (i = j = 0;(i = buffer->GetUserBookmarkForLine(i, -1, name, P)) >= 0;j++); FPHistory[M]->BookCount = j; if (j) { // Something to store FPHistory[M]->Books = (HBookmark **)malloc(sizeof(HBookmark *) * j); if (FPHistory[M]->Books) { for (i = j = 0;(i = buffer->GetUserBookmarkForLine(i, -1, name, P)) >= 0;j++) { bmk = FPHistory[M]->Books[j] = (HBookmark *)malloc(sizeof(HBookmark)); if (bmk) { bmk->Row = P.Row; bmk->Col = P.Col; bmk->Name = strdup(name); } else { // Only part set FPHistory[M]->BookCount = j; return 0; } } return 1; } else { // Alloc error FPHistory[M]->BookCount = 0; return 0; } } return 1; } else if (cmp < 0) { R = M; } else { L = M + 1; } } // Should not get here return 0; } efte-1.1/src/pmdlg.h0000664000076400007640000000207611215511532013366 0ustar laurilauri/* * pmdlg.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #define IDD_ABOUT 400 #define ID_RESOURCE 401 #define IDD_ICON1 402 #define IDD_ICON2 403 #define IDD_INFO 100 #define INFO_TITLE 101 #define INFO_TEXT 102 #define IDD_ERROR 103 #define INFO_ETITLE 104 #define INFO_ETEXT 105 #define IDD_PROMPT 300 #define IDS_PROMPT 301 #define IDE_FIELD 302 #define IDD_FINDREPLACE 201 #define IDD_FIND 202 #define IDL_FIND 211 #define IDL_REPLACE 212 #define IDE_FIND 221 #define IDE_REPLACE 222 #define IDC_IGNORECASE 231 #define IDC_REGEXPS 232 #define IDC_WORDS 233 #define IDC_BLOCK 234 #define IDC_GLOBAL 235 #define IDC_REVERSE 236 #define IDC_ALLOCCURENCES 237 #define IDC_NOPROMPTING 238 #define IDC_JOINLINE 239 #define IDC_DELETELINE 240 efte-1.1/src/o_svn.h0000664000076400007640000000275611041404761013416 0ustar laurilauri/* * o_svn.h * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * * S.Pinigin copy o_cvs.h and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Class providing access to most of SVN commands. */ #ifndef __SVN_H__ #define __SVN_H__ class ESvn: public ESvnBase { public: char *LogFile; int Commiting; ESvn(int createFlags, EModel **ARoot, char *Dir, char *ACommand, char *AOnFiles); ESvn(int createFlags, EModel **ARoot); ~ESvn(); void RemoveLogFile(); // Return marked files in allocated space separated list char *MarkedAsList(); // Return SVN status char of file or 0 if unknown // (if char is lowercase, state was guessed from last command invoked upon file) char GetFileStatus(char *file); virtual void ParseLine(char *line, int len); // Returns 0 if OK virtual int RunPipe(char *Dir, char *Command, char *OnFiles); virtual void ClosePipe(); // Start commit process (opens message buffer), returns 0 if OK int RunCommit(char *Dir, char *Command, char *OnFiles); // Finish commit process (called on message buffer close), returns 0 if OK int DoneCommit(int commit); virtual int CanQuit(); virtual int ConfQuit(GxView *V, int multiFile); virtual int GetContext() { return CONTEXT_SVN; } virtual EEventMap *GetEventMap(); }; extern ESvn *SvnView; #endif efte-1.1/src/con_linux.cpp0000664000076400007640000007702111041404761014620 0ustar laurilauri/* con_linux.cpp * * Copyright (c) 2008, eFTE SF Group (see AUTHORS file) * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // If you're searching for portability it is not here ;-) #define USE_SCRNMAP // use USER translation table instead of direct mapping // The translation table is assumed to be invertible (more or less). // How do we get other translation tables from kernel, the USER one // is null mapping by default (not very useful)? // PROBLEM: we use raw mode, and this disables the console // switching (consoles cannot be switched when the editor is busy). // probably needs to be fixed in the kernel (IMO kernel should // switch consoles when raw mode is used, unless console is under // VT_PROCESS control). Why does kernel trust user processes to do it? // FIX: caps lock is ignored (I haven't pressed it in years, except by mistake). // FIX: access GPM clipboard. how? // Also: num lock is ignored // ... some more comments below #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef USE_GPM extern "C" { #include } #endif #include "sysdep.h" #include "c_config.h" #include "console.h" #include "gui.h" #define MAX_PIPES 4 //#define PIPE_BUFLEN 4096 typedef struct { int used; int id; int fd; int pid; int stopped; EModel *notify; } GPipe; static GPipe Pipes[MAX_PIPES] = { { 0 }, { 0 }, { 0 }, { 0 } }; #define die(s) { printf("%s\n", s); exit(1); } while(0); unsigned int VideoCols = 80; unsigned int VideoRows = 25; unsigned int CursorX = 0; unsigned int CursorY = 0; int CursorVisible = 1; int VtNum = -1; static int VtFd = -1; static int VcsFd = -1; struct termios Save_termios; struct kbdiacrs diacr_table; #ifdef USE_GPM int GpmFd = -1; #endif int LastMouseX = 0, LastMouseY = 0; int WindowChanged = 0; int drawPointer = 1; int mouseDrawn = 0; TCell MousePosCell; #ifdef USE_SCRNMAP static int noCharTrans = 0; static unsigned char toScreen[256]; static unsigned char fromScreen[256]; #endif #define MEM_PAGE_SIZE 4096 #define VIDEO_SIZE (VideoCols * VideoRows * 2) #define VIDEO_MAP_SIZE ((VIDEO_SIZE | (MEM_PAGE_SIZE - 1)) + 1) int GetKeyEvent(TEvent *Event); int GetMouseEvent(TEvent *Event); static void mouseShow() { #ifdef USE_GPM if (GpmFd != -1 && VcsFd != -1 && drawPointer && mouseDrawn == 0) { int pos = (LastMouseX + LastMouseY * VideoCols) * 2 + 4; lseek(VcsFd, pos, SEEK_SET); read(VcsFd, &MousePosCell, 2); TCell newCell = MousePosCell ^ 0x7700; // correct ? lseek(VcsFd, pos, SEEK_SET); write(VcsFd, &newCell, 2); mouseDrawn = 1; } #endif } static void mouseHide() { #ifdef USE_GPM if (GpmFd != -1 && VcsFd != -1 && drawPointer && mouseDrawn == 1) { int pos = (LastMouseX + LastMouseY * VideoCols) * 2 + 4; lseek(VcsFd, pos, SEEK_SET); write(VcsFd, &MousePosCell, 2); mouseDrawn = 0; } #endif } void SigWindowChanged(int /*arg*/) { signal(SIGWINCH, SigWindowChanged); WindowChanged = 1; } static void Cleanup() { ConDone(); } static void Die(int) { ConDone(); exit(66); } int ConInit(int /*XSize*/, int /*YSize*/) { int tmp; int mode; struct termios newt; //char ttyname[20]; char vcsname[20]; // struct vt_mode vtm; //long free_tty; // struct winsize ws; struct stat stb; unsigned char vc_data[4]; #ifdef USE_GPM Gpm_Connect conn; #endif VtFd = 2; /* try stderr as output */ if (isatty(VtFd) == 0) { die("not a terminal."); } if (fstat(VtFd, &stb) != 0) { perror("stat"); die("stat failed"); } VtNum = MINOR(stb.st_rdev); if (MAJOR(stb.st_rdev) != TTY_MAJOR) die("Not running in a virtual console."); if (ioctl(VtFd, KDGKBMODE, &mode) != 0) die("failed to get kbdmode"); #if 0 if (mode != K_XLATE) { // X, etc... sprintf(ttyname, "/dev/console"); if ((VtFd = open(ttyname, O_RDWR)) == -1) die("failed to open /dev/console"); if (ioctl(VtFd, VT_OPENQRY, &free_tty) < 0 || free_tty == -1) die("could not find a free tty\n"); close(VtFd); VtNum = free_tty; sprintf(ttyname, "/dev/tty%d", VtNum); if ((VtFd = open(ttyname, O_RDWR)) == -1) die("could not open tty"); } #endif sprintf(vcsname, "/dev/vcsa%d", VtNum); /* * This is the _only_ place that we use our extra privs if any, * If there is an error, we drop them prior to calling recovery * functions, if we succeed we go back as well. * * Ben Collins */ extern uid_t effuid; extern gid_t effgid; seteuid(effuid); setegid(effgid); VcsFd = open(vcsname, O_RDWR); setuid(getuid()); setgid(getgid()); if (VcsFd == -1) { perror("open"); die("failed to open /dev/vcsa*"); } if (read(VcsFd, &vc_data, 4) != 4) { perror("read"); die("failed to read from /dev/vcsa*"); } VideoRows = vc_data[0]; VideoCols = vc_data[1]; CursorX = vc_data[2]; CursorY = vc_data[3]; #ifdef USE_SCRNMAP if (ioctl(VtFd, GIO_SCRNMAP, &toScreen) == -1) die("could not get screen character mapping!"); { int c; for (c = 0; c < 256; c++) fromScreen[c] = 0; for (c = 0; c < 256; c++) fromScreen[toScreen[c]] = c; } #endif tmp = tcgetattr(VtFd, &Save_termios); if (tmp) fprintf(stderr, "tcsetattr = %d\n", tmp); tmp = tcgetattr(VtFd, &newt); if (tmp) fprintf(stderr, "tcsetattr = %d\n", tmp); newt.c_lflag &= ~(ICANON | ECHO | ISIG); newt.c_iflag = 0; newt.c_cc[VMIN] = 16; newt.c_cc[VTIME] = 1; tmp = tcsetattr(VtFd, TCSAFLUSH, &newt); if (tmp) fprintf(stderr, "tcsetattr = %d\n", tmp); /* set keyboard to return MEDIUMRAW mode */ if (ioctl(VtFd, KDSKBMODE, K_MEDIUMRAW) != 0) { perror("Could not activate K_MEDIUMRAW mode"); tmp = tcsetattr(VtFd, 0, &Save_termios); die("could not activate medium raw mode\n"); } /* get keyboard diacritics table */ if (ioctl(VtFd, KDGKBDIACR, &diacr_table) != 0) { perror("Could not get diacritics table"); diacr_table.kb_cnt = 0; } signal(SIGWINCH, SigWindowChanged); signal(SIGSEGV, Die); signal(SIGBUS, Die); signal(SIGIOT, Die); signal(SIGQUIT, Die); signal(SIGTERM, Die); signal(SIGPIPE, SIG_IGN); signal(SIGALRM, SIG_IGN); signal(SIGHUP, Die); atexit(Cleanup); #ifdef USE_GPM conn.eventMask = (unsigned short)~0U; conn.defaultMask = GPM_DRAG; conn.minMod = 0; conn.maxMod = (unsigned short)~0U; GpmFd = Gpm_Open(&conn, 0); mouseShow(); #endif return 0; } int ConDone() { if (VtFd != -1) { int tmp; #ifdef USE_GPM if (GpmFd != -1) { mouseHide(); Gpm_Close(); GpmFd = -1; } #endif ioctl(VtFd, KDSKBMODE, K_XLATE); tmp = tcsetattr(VtFd, 0, &Save_termios); if (tmp) fprintf(stderr, "tcsetattr = %d\n", tmp); } return 0; } int ConSuspend() { int tmp; #ifdef USE_GPM mouseHide(); Gpm_Close(); GpmFd = -1; #endif ioctl(VtFd, KDSKBMODE, K_XLATE); tmp = tcsetattr(VtFd, 0, &Save_termios); if (tmp) fprintf(stderr, "tcsetattr = %d\n", tmp); return 0; } int ConContinue() { #ifdef USE_GPM Gpm_Connect conn; #endif struct termios newt; int tmp; newt.c_lflag &= ~(ICANON | ECHO | ISIG); newt.c_iflag = 0; newt.c_cc[VMIN] = 16; newt.c_cc[VTIME] = 1; tmp = tcsetattr(VtFd, TCSAFLUSH, &newt); if (tmp) fprintf(stderr, "tcsetattr = %d\n", tmp); /* set keyboard to return MEDIUMRAW mode */ if (ioctl(VtFd, KDSKBMODE, K_MEDIUMRAW) != 0) { perror("ioctl KDSKBMODE"); die("could not activate medium raw mode\n"); } #ifdef USE_GPM conn.eventMask = (unsigned short)~0U; conn.defaultMask = GPM_DRAG; conn.minMod = 0; conn.maxMod = (unsigned short)~0U; GpmFd = Gpm_Open(&conn, 0); mouseShow(); #endif return 0; } #ifdef USE_SCRNMAP static int conread(int fd, void *p, int len) { // len should be a multiple of 2 char buf[512]; char *c = (char *)p; char *s = buf; if (noCharTrans || (len > 512)) { return read(fd, p, len); } else { int rlen = read(fd, buf, len); for (int n = 0; n < rlen; n += 2) { *c++ = fromScreen[(unsigned char)*s++]; *c++ = *s++; } return rlen; } } static int conwrite(int fd, void *p, int len) { // len should be a multiple of 2 char buf[512]; char *s = (char *)p; char *c = buf; if (noCharTrans || (len > 512)) { return write(fd, p, len); } else { for (int n = 0; n < len; n += 2) { *c++ = toScreen[(unsigned char)*s++]; *c++ = *s++; } return write(fd, buf, len); } } #else #define conread(fd,b,len) read(fd,b,len) #define conwrite(fd,b,len) write(fd,b,len) #endif int ConClear() { int X, Y; TCell Cell = ' ' | (0x07 << 8); ConQuerySize(&X, &Y); ConSetBox(0, 0, X, Y, Cell); ConSetCursorPos(0, 0); return 0; } int ConSetTitle(char */*Title*/, char */*STitle*/) { return 0; } int ConGetTitle(char *Title, int /*MaxLen*/, char */*STitle*/, int /*SMaxLen*/) { *Title = 0; return 0; } int ConPutBox(int X, int Y, int W, int H, PCell Cell) { int i, hidden = 0; for (i = 0; i < H; i++) { if (LastMouseY == Y + i) { mouseHide(); hidden = 1; } lseek(VcsFd, 4 + ((Y + i) * VideoCols + X) * 2, SEEK_SET); conwrite(VcsFd, Cell, 2 * W); Cell += W; if (hidden) mouseShow(); } return 0; } int ConGetBox(int X, int Y, int W, int H, PCell Cell) { int i, hidden = 0; for (i = 0; i < H; i++) { if (LastMouseY == Y + i) { mouseHide(); hidden = 1; } lseek(VcsFd, 4 + ((Y + i) * VideoCols + X) * 2, SEEK_SET); conread(VcsFd, Cell, 2 * W); Cell += W; if (hidden) mouseShow(); } return 0; } int ConPutLine(int X, int Y, int W, int H, PCell Cell) { int i, hidden = 0; for (i = 0; i < H; i++) { if (LastMouseY == Y + i) { mouseHide(); hidden = 1; } lseek(VcsFd, 4 + ((Y + i) * VideoCols + X) * 2, SEEK_SET); conwrite(VcsFd, Cell, 2 * W); if (hidden) mouseShow(); } return 0; } int ConSetBox(int X, int Y, int W, int H, TCell Cell) { TDrawBuffer B; MoveCh(B, Cell & 0xFF, Cell >> 8, W); ConPutLine(X, Y, W, H, B); return 0; } int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { PCell C; TDrawBuffer B; if (Count == 0 || Count > H) return 0; C = (PCell)malloc(2 * W * H); if (C == 0) return -1; #ifdef USE_SCRNMAP noCharTrans = 1; #endif MoveCh(B, ' ', Fill, W); ConGetBox(X, Y, W, H, C); if (Way == csUp) { ConPutBox(X, Y, W, H - Count, C + W * Count); ConPutLine(X, Y + H - Count, W, Count, B); } else { ConPutBox(X, Y + Count, W, H - Count, C); ConPutLine(X, Y, W, Count, B); } #ifdef USE_SCRNMAP noCharTrans = 0; #endif free((void *)C); return 0; } int ConSetSize(int /*X*/, int /*Y*/) { return -1; } int ConQuerySize(int *X, int *Y) { if (X) *X = VideoCols; if (Y) *Y = VideoRows; return 0; } int ConSetCursorPos(int X, int Y) { char pos[2]; if (X >= 0 && X < int(VideoCols)) CursorX = X; if (Y >= 0 && Y < int(VideoRows)) CursorY = Y; pos[0] = CursorX; pos[1] = CursorY; lseek(VcsFd, 2, SEEK_SET); write(VcsFd, pos, 2); return 0; } int ConQueryCursorPos(int *X, int *Y) { if (X) *X = CursorX; if (Y) *Y = CursorY; return 0; } int ConShowCursor(void) { return 0; } int ConHideCursor(void) { return 0; } int ConCursorVisible(void) { return 1; } int ConSetMousePos(int /*X*/, int /*Y*/) { return -1; } void ConSetInsertState(bool insert) { } int ConQueryMousePos(int *X, int *Y) { if (X) *X = LastMouseX; if (Y) *Y = LastMouseY; return -1; } int ConShowMouse(void) { return -1; } int ConHideMouse(void) { return -1; } int ConMouseVisible(void) { return 0; } int ConQueryMouseButtons(int *ButtonCount) { if (ButtonCount) *ButtonCount = 0; return 0; } static TEvent Prev = { evNone }; int ConGetEvent(TEventMask /*EventMask*/, TEvent *Event, int WaitTime, int Delete) { fd_set readfds; struct timeval timeout; if (Prev.What != evNone) { *Event = Prev; if (Delete) Prev.What = evNone; return 1; } Event->What = evNone; FD_ZERO(&readfds); FD_SET(VtFd, &readfds); #ifdef USE_GPM if (GpmFd != -1) FD_SET(GpmFd, &readfds); #endif for (int p = 0; p < MAX_PIPES; p++) if (Pipes[p].used) if (Pipes[p].fd != -1) FD_SET(Pipes[p].fd, &readfds); if (WaitTime == -1) { if (select(sizeof(fd_set) * 8, &readfds, NULL, NULL, NULL) < 0) return -1; } else { timeout.tv_sec = WaitTime / 1000; timeout.tv_usec = (WaitTime % 1000) * 1000; if (select(sizeof(fd_set) * 8, &readfds, NULL, NULL, &timeout) < 0) return -1; } if (FD_ISSET(VtFd, &readfds)) { GetKeyEvent(Event); if (!Delete) Prev = *Event; return 1; #ifdef USE_GPM } else if (GpmFd != -1 && FD_ISSET(GpmFd, &readfds)) { GetMouseEvent(Event); if (!Delete) Prev = *Event; return 1; #endif } else { for (int pp = 0; pp < MAX_PIPES; pp++) { if (Pipes[pp].used) if (Pipes[pp].fd != -1) if (FD_ISSET(Pipes[pp].fd, &readfds)) { if (Pipes[pp].notify) { Event->What = evNotify; Event->Msg.View = 0; Event->Msg.Model = Pipes[pp].notify; Event->Msg.Command = cmPipeRead; Event->Msg.Param1 = pp; Pipes[pp].stopped = 0; } //fprintf(stderr, "Pipe %d\n", Pipes[pp].fd); return 0; } } return -1; } return 0; } int ConPutEvent(TEvent Event) { Prev = Event; return 0; } int ConFlush(void) { return 0; } int ConGrabEvents(TEventMask /*EventMask*/) { return 0; } static int shift_state = 0; static int lock_state = 0; static int slock_state = 0; static char dead_key = 0; static const struct { unsigned long KeySym; unsigned long KeyCode; } KeyTrans[] = { { K(KT_FN, K_F1), kbF1 }, { K(KT_FN, K_F2), kbF2 }, { K(KT_FN, K_F3), kbF3 }, { K(KT_FN, K_F4), kbF4 }, { K(KT_FN, K_F5), kbF5 }, { K(KT_FN, K_F6), kbF6 }, { K(KT_FN, K_F7), kbF7 }, { K(KT_FN, K_F8), kbF8 }, { K(KT_FN, K_F9), kbF9 }, { K(KT_FN, K_F10), kbF10 }, { K(KT_FN, K_F11), kbF11 }, { K(KT_FN, K_F12), kbF12 }, { K(KT_FN, K_INSERT), kbIns | kfGray }, { K(KT_FN, K_REMOVE), kbDel | kfGray }, { K(KT_FN, K_FIND), kbHome | kfGray }, { K(KT_FN, K_SELECT), kbEnd | kfGray }, { K(KT_FN, K_PGUP), kbPgUp | kfGray }, { K(KT_FN, K_PGDN), kbPgDn | kfGray }, { K(KT_CUR, K_UP), kbUp | kfGray }, { K(KT_CUR, K_DOWN), kbDown | kfGray }, { K(KT_CUR, K_LEFT), kbLeft | kfGray }, { K(KT_CUR, K_RIGHT), kbRight | kfGray }, { K(KT_SPEC, K_ENTER), kbEnter }, { K(KT_PAD, K_PENTER), kbEnter | kfGray }, { K(KT_PAD, K_PPLUS), '+' | kfGray }, { K(KT_PAD, K_PMINUS), '-' | kfGray }, { K(KT_PAD, K_PSTAR), '*' | kfGray }, { K(KT_PAD, K_PSLASH), '/' | kfGray }, { K(KT_PAD, K_P0), kbIns }, { K(KT_PAD, K_PDOT), kbDel }, { K(KT_PAD, K_P1), kbEnd }, { K(KT_PAD, K_P2), kbDown }, { K(KT_PAD, K_P3), kbPgDn }, { K(KT_PAD, K_P4), kbLeft }, { K(KT_PAD, K_P5), kbCenter }, { K(KT_PAD, K_P6), kbRight }, { K(KT_PAD, K_P7), kbHome }, { K(KT_PAD, K_P8), kbUp }, { K(KT_PAD, K_P9), kbPgUp }, { K(KT_FN, K_PAUSE), kbPause }, { K(KT_LATIN, 27), kbEsc }, { K(KT_LATIN, 13), kbEnter }, { K(KT_LATIN, 8), kbBackSp }, { K(KT_LATIN, 127), kbDel }, { K(KT_LATIN, 9), kbTab }, { K(KT_SHIFT, KG_SHIFT), kbShift | kfSpecial | kfModifier }, { K(KT_SHIFT, KG_SHIFTL), kbShift | kfSpecial | kfModifier }, { K(KT_SHIFT, KG_SHIFTR), kbShift | kfSpecial | kfModifier | kfGray }, { K(KT_SHIFT, KG_CTRL), kbCtrl | kfSpecial | kfModifier }, { K(KT_SHIFT, KG_CTRLL), kbCtrl | kfSpecial | kfModifier }, { K(KT_SHIFT, KG_CTRLR), kbCtrl | kfSpecial | kfModifier | kfGray }, { K(KT_SHIFT, KG_ALT), kbAlt | kfSpecial | kfModifier }, { K(KT_SHIFT, KG_ALTGR), kbAlt | kfSpecial | kfModifier | kfGray }, { 0, 0 } }; static const struct { unsigned long KeySym; char Diacr; } DeadTrans[] = { { K_DGRAVE, '`' }, { K_DACUTE, '\'' }, { K_DCIRCM, '^' }, { K_DTILDE, '~' }, { K_DDIERE, '"' }, { K_DCEDIL, ',' } }; int GetKeyEvent(TEvent *Event) { char keycode; Event->What = evNone; if (read(VtFd, &keycode, 1) != 1) return -1; int key = keycode & 0x7F; int press = (keycode & 0x80) ? 0 : 1; unsigned int keysym; int rc; struct kbentry kbe; int shift_final; int ShiftFlags; TKeyCode KeyCode; kbe.kb_index = key; kbe.kb_table = 0; rc = ioctl(VtFd, KDGKBENT, &kbe); keysym = kbe.kb_value; //printf("rc = %d, value = %04X, ktype=%d, kval=%d\n", // rc, keysym, KTYP(keysym), KVAL(keysym)); int ksv = KVAL(keysym); switch (KTYP(keysym)) { case KT_SHIFT: // :-(((, have to differentiate between shifts. if (ksv == KG_SHIFT) { if (key == 54) ksv = KG_SHIFTR; else ksv = KG_SHIFTL; } else if (ksv == KG_CTRL) { if (key == 97) ksv = KG_CTRLR; else ksv = KG_CTRLL; } if (press) shift_state |= (1 << ksv); else shift_state &= ~(1 << ksv); break; case KT_LOCK: // if (press) // lock_state |= (1 << ksv); // else // lock_state &= ~(1 << ksv); if (press) lock_state ^= (1 << ksv); break; case KT_SLOCK: if (press) slock_state |= (1 << ksv); else slock_state &= ~(1 << ksv); break; } shift_final = shift_state ^ lock_state ^ slock_state; if (shift_final & ((1 << KG_SHIFT) | (1 << KG_SHIFTL) | (1 << KG_SHIFTR))) { shift_final |= (1 << KG_SHIFT); shift_final &= ~((1 << KG_SHIFTL) | (1 << KG_SHIFTR)); } if (shift_final & ((1 << KG_CTRL) | (1 << KG_CTRLL) | (1 << KG_CTRLR))) { shift_final |= (1 << KG_CTRL); shift_final &= ~((1 << KG_CTRLL) | (1 << KG_CTRLR)); } ShiftFlags = 0; if ((shift_final & (1 << KG_SHIFT)) || (shift_final & (1 << KG_SHIFTL)) || (shift_final & (1 << KG_SHIFTR))) ShiftFlags |= kfShift; if ((shift_final & (1 << KG_CTRL)) || (shift_final & (1 << KG_CTRLL)) || (shift_final & (1 << KG_CTRLR))) ShiftFlags |= kfCtrl; // if ((shift_final & (1 << KG_ALT)) || // (shift_final & (1 << KG_ALTGR))) if (shift_final & (1 << KG_ALT)) ShiftFlags |= kfAlt; // printf("shift: %X, lock: %X, slock: %X, final: %X, ShiftFlags: %X\n", // shift_state, lock_state, slock_state, shift_final, ShiftFlags); if (KTYP(keysym) != KT_SLOCK) slock_state = 0; KeyCode = 0; if (key == 14 && keysym == K(KT_LATIN, 127)) { // we are running on a system with broken backspace key KeyCode = kbBackSp; } else for (unsigned int i = 0; i < sizeof(KeyTrans) / sizeof(KeyTrans[0]); i++) { if (KeyTrans[i].KeySym == keysym) { KeyCode = KeyTrans[i].KeyCode; break; } } if (KeyCode == 0) { switch (KTYP(keysym)) { case KT_CONS: case KT_FN: //case KT_SPEC: case KT_LOCK: case KT_SLOCK: //case KT_META: case KT_CUR: default: //if (!(shift_final & KG_ALTGR)) // break; dead_key = 0; break; case KT_SHIFT: break; case KT_LETTER: // take caps into account if (0) { ShiftFlags ^= kfShift; shift_final ^= (1 << KG_SHIFT); } // no break case KT_LATIN: // if (shift_final & (1 << KG_ALTGR)) // ShiftFlags &= ~kfAlt; if (ShiftFlags & kfAlt) shift_final &= ~(1 << KG_SHIFT); kbe.kb_index = key; kbe.kb_table = shift_final; rc = ioctl(VtFd, KDGKBENT, &kbe); if (rc != 0) break; keysym = kbe.kb_value; //if (KTYP(keysym) != KT_LATIN && // KTYP(keysym) != KT_LETTER && // KTYP(keysym) != KT_ASCII) // break; KeyCode = KVAL(keysym); if (ShiftFlags & kfAlt) KeyCode = toupper(KeyCode); if (KTYP(keysym) == KT_DEAD) { for (int i = 0;(unsigned) i < sizeof(DeadTrans) / sizeof(DeadTrans[0]); i++) { if (DeadTrans[i].KeySym == keysym) { dead_key = DeadTrans[i].Diacr; return -1; } } dead_key = 0; return -1; } if (!(ShiftFlags & (kfAlt | kfCtrl)) && dead_key) { for (int i = 0; (unsigned) i < diacr_table.kb_cnt; i++) { if (diacr_table.kbdiacr[i].base == KeyCode && diacr_table.kbdiacr[i].diacr == dead_key) { KeyCode = diacr_table.kbdiacr[i].result; break; } } } dead_key = 0; break; } } if (KeyCode == 0) return -1; if (ShiftFlags & kfCtrl) if (KeyCode < 32) KeyCode += 64; KeyCode |= ShiftFlags; if (!press) KeyCode |= kfKeyUp; if (KeyCode != 0) { if (KTYP(keysym) != KT_SHIFT) dead_key = 0; if (KeyCode & kfKeyUp) Event->What = evKeyUp; else Event->What = evKeyDown; Event->Key.Code = KeyCode & ~kfKeyUp; // switching consoles should be done by the kernel, but // it is not (why, since I am not using VT_PROCESS??). // this has a delay if the app is working. // there is also a problem with shift-states (should update it // after getting back, but how to know when that happens, without // using VT_PROCESS?). { int vc = -1; // switch (kbCode(Event->Key.Code) | kfCtrl) { switch (kbCode(Event->Key.Code)) { case kfAlt | kfCtrl | kbF1: vc = 1; break; case kfAlt | kfCtrl | kbF2: vc = 2; break; case kfAlt | kfCtrl | kbF3: vc = 3; break; case kfAlt | kfCtrl | kbF4: vc = 4; break; case kfAlt | kfCtrl | kbF5: vc = 5; break; case kfAlt | kfCtrl | kbF6: vc = 6; break; case kfAlt | kfCtrl | kbF7: vc = 7; break; case kfAlt | kfCtrl | kbF8: vc = 8; break; case kfAlt | kfCtrl | kbF9: vc = 9; break; case kfAlt | kfCtrl | kbF10: vc = 10; break; case kfAlt | kfCtrl | kbF11: vc = 11; break; case kfAlt | kfCtrl | kbF12: vc = 12; break; } if (vc != -1) { /* perform the console switch */ ioctl(VtFd, VT_ACTIVATE, vc); Event->What = evNone; // shift_state = lock_state = slock_state = 0; // bad shift_state = slock_state = 0; // bad return -1; } } return 0; } return -1; } int GetMouseEvent(TEvent *Event) { #ifdef USE_GPM Gpm_Event e; Event->What = evNone; int rc = Gpm_GetEvent(&e); if (rc == 0) { Gpm_Close(); GpmFd = -1; } else if (rc == -1) { } else { //Gpm_FitEvent(&e); if ((e.type & GPM_MOVE) || (e.type & GPM_DRAG)) Event->What = evMouseMove; else if (e.type & GPM_DOWN) Event->What = evMouseDown; else if (e.type & GPM_UP) Event->What = evMouseUp; else return 0; Event->Mouse.Count = (e.type & GPM_SINGLE) ? 1 : (e.type & GPM_DOUBLE) ? 2 : (e.type & GPM_TRIPLE) ? 3 : 1; Event->Mouse.Buttons = ((e.buttons & GPM_B_LEFT) ? 1 : 0) | ((e.buttons & GPM_B_RIGHT) ? 2 : 0) | ((e.buttons & GPM_B_MIDDLE) ? 4 : 0); e.x--; e.y--; if (e.x < 0) e.x = 0; if (e.y < 0) e.y = 0; if (e.x >= int(VideoCols)) e.x = VideoCols - 1; if (e.y >= int(VideoRows)) e.y = VideoRows - 1; Event->Mouse.X = e.x; Event->Mouse.Y = e.y; Event->Mouse.KeyMask = ((e.modifiers & 1) ? kfShift : 0) | ((e.modifiers & (2 | 8)) ? kfAlt : 0) | ((e.modifiers & 4) ? kfCtrl : 0); if (LastMouseX != e.x || LastMouseY != e.y) { mouseHide(); LastMouseX = e.x; LastMouseY = e.y; mouseShow(); } } #else Event->What = evNone; #endif return 0; } static PCell SavedScreen = 0; static int SavedX, SavedY, SaveCursorPosX, SaveCursorPosY; int SaveScreen() { if (SavedScreen) free(SavedScreen); ConQuerySize(&SavedX, &SavedY); SavedScreen = (PCell) malloc(SavedX * SavedY * sizeof(PCell)); if (SavedScreen) ConGetBox(0, 0, SavedX, SavedY, SavedScreen); ConQueryCursorPos(&SaveCursorPosX, &SaveCursorPosY); return 0; } int RestoreScreen() { if (SavedScreen) { ConPutBox(0, 0, SavedX, SavedY, SavedScreen); ConSetCursorPos(SaveCursorPosX, SaveCursorPosY); } return 1; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) { fArgc = argc; fArgv = argv; ::ConInit(-1, -1); SaveScreen(); ::ConSetSize(XSize, YSize); gui = this; } GUI::~GUI() { RestoreScreen(); ::ConDone(); if (SavedScreen) { free(SavedScreen); SavedScreen = 0; } gui = 0; } int GUI::ConSuspend(void) { RestoreScreen(); return ::ConSuspend(); } int GUI::ConContinue(void) { SaveScreen(); return ::ConContinue(); } int GUI::ShowEntryScreen() { TEvent E; ConHideMouse(); RestoreScreen(); do { gui->ConGetEvent(evKeyDown, &E, -1, 1, 0); } while (E.What != evKeyDown); ConShowMouse(); if (frames) frames->Repaint(); return 1; } int GUI::OpenPipe(char *Command, EModel *notify) { int i; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) { int pfd[2]; Pipes[i].id = i; Pipes[i].notify = notify; Pipes[i].stopped = 1; if (pipe((int *)pfd) == -1) return -1; switch (Pipes[i].pid = fork()) { case - 1: /* fail */ return -1; case 0: /* child */ signal(SIGPIPE, SIG_DFL); VtFd = -1; // for atexit handler close(VtFd); close(pfd[0]); close(0); dup2(pfd[1], 1); dup2(pfd[1], 2); close(pfd[1]); exit(system(Command)); default: close(pfd[1]); fcntl(pfd[0], F_SETFL, O_NONBLOCK); Pipes[i].fd = pfd[0]; } Pipes[i].used = 1; //fprintf(stderr, "Pipe Open: %d\n", i); return i; } } return -1; } int GUI::SetPipeView(int id, EModel *notify) { if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; //fprintf(stderr, "Pipe View: %d %08X\n", id, notify); Pipes[id].notify = notify; return 0; } int GUI::ReadPipe(int id, void *buffer, int len) { int rc; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; //fprintf(stderr, "Pipe Read: Get %d %d\n", id, len); rc = read(Pipes[id].fd, buffer, len); //fprintf(stderr, "Pipe Read: Got %d %d\n", id, len); if (rc == 0) { close(Pipes[id].fd); Pipes[id].fd = -1; return -1; } if (rc == -1) { Pipes[id].stopped = 1; return 0; } return rc; } int GUI::ClosePipe(int id) { int status = -1; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; if (Pipes[id].fd != -1) close(Pipes[id].fd); kill(Pipes[id].pid, SIGHUP); alarm(1); waitpid(Pipes[id].pid, &status, 0); alarm(0); //fprintf(stderr, "Pipe Close: %d\n", id); Pipes[id].used = 0; return WEXITSTATUS(status); } int GUI::RunProgram(int /*mode*/, char *Command) { int rc, W, H, W1, H1; ConQuerySize(&W, &H); ConHideMouse(); ConSuspend(); if (*Command == 0) // empty string = shell Command = getenv("SHELL"); rc = system(Command); ConContinue(); ConShowMouse(); ConQuerySize(&W1, &H1); if (W != W1 || H != H1) { frames->Resize(W1, H1); } frames->Repaint(); return rc; } char ConGetDrawChar(int idx) { static const char *tab = NULL; if (!tab) { if (getenv("ISOCONSOLE")) { tab = GetGUICharacters("Linux", "++++-|+++++>.*-^v :[>"); } else { tab = GetGUICharacters("Linux", "ڿijô\x1A\x1B\x1A"); // tab=GetGUICharacters ("Linux","\x0D\x0C\x0E\x0B\x12\x19____+>\x1F\x01\x12 "); } } assert(idx >= 0 && idx < int(strlen(tab))); #ifdef USE_SCRNMAP return fromScreen[(int)tab[idx]]; #else return tab[idx]; #endif } efte-1.1/src/cocoa.mm0000664000076400007640000000044511041406261013526 0ustar laurilauri// // main.m // fte // // Created by Lauri Nurmi on 5.1.2008. // Copyright __MyCompanyName__ 2008. All rights reserved. // #import int cacao() { int argc = 1; char *myarg = ""; char **argv = &myarg; return NSApplicationMain(argc, (const char **) argv); } efte-1.1/macosx/0000775000076400007640000000000011264420021012604 5ustar laurilauriefte-1.1/macosx/Info.plist0000664000076400007640000000160411041406031014553 0ustar laurilauri CFBundleDevelopmentRegion English CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier com.yourcompany.fte CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleSignature ???? CFBundleShortVersionString 1.0 CFBundleVersion 1 NSMainNibFile MainMenu NSPrincipalClass NSApplication efte-1.1/macosx/eFTE.xcodeproj/0000775000076400007640000000000011264420021015363 5ustar laurilauriefte-1.1/macosx/eFTE.xcodeproj/project.pbxproj0000664000076400007640000017143611244200731020455 0ustar laurilauri// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 42; objects = { /* Begin PBXBuildFile section */ 532F6AA70D30192E00C0ED59 /* cut.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 532F696E0D30192B00C0ED59 /* cut.bmp */; }; 532F6AA90D30192E00C0ED59 /* errprev.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 532F69700D30192B00C0ED59 /* errprev.bmp */; }; 532F6AAB0D30192E00C0ED59 /* last.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 532F69720D30192B00C0ED59 /* last.bmp */; }; 532F6AAD0D30192E00C0ED59 /* open.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 532F69740D30192B00C0ED59 /* open.bmp */; }; 532F6AAE0D30192E00C0ED59 /* paste.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 532F69750D30192B00C0ED59 /* paste.bmp */; }; 532F6AAF0D30192E00C0ED59 /* pastecol.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 532F69760D30192B00C0ED59 /* pastecol.bmp */; }; 532F6AB00D30192E00C0ED59 /* prev.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 532F69770D30192B00C0ED59 /* prev.bmp */; }; 532F6AB10D30192E00C0ED59 /* redo.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 532F69780D30192B00C0ED59 /* redo.bmp */; }; 532F6AB20D30192E00C0ED59 /* save.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 532F69790D30192B00C0ED59 /* save.bmp */; }; 532F6AB30D30192E00C0ED59 /* tagfind.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 532F697A0D30192B00C0ED59 /* tagfind.bmp */; }; 532F6AB50D30192E00C0ED59 /* tagpop.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 532F697C0D30192B00C0ED59 /* tagpop.bmp */; }; 532F6AB60D30192E00C0ED59 /* tagprev.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 532F697D0D30192B00C0ED59 /* tagprev.bmp */; }; 532F6AB70D30192E00C0ED59 /* undo.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 532F697E0D30192B00C0ED59 /* undo.bmp */; }; 532F6AB80D30192E00C0ED59 /* c_bind.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F697F0D30192B00C0ED59 /* c_bind.cpp */; }; 532F6ABA0D30192E00C0ED59 /* c_color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69830D30192B00C0ED59 /* c_color.cpp */; }; 532F6ABC0D30192E00C0ED59 /* c_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69870D30192B00C0ED59 /* c_config.cpp */; }; 532F6ABE0D30192E00C0ED59 /* c_desktop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F698A0D30192B00C0ED59 /* c_desktop.cpp */; }; 532F6AC00D30192E00C0ED59 /* c_hilit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F698E0D30192B00C0ED59 /* c_hilit.cpp */; }; 532F6AC20D30192E00C0ED59 /* c_history.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69910D30192B00C0ED59 /* c_history.cpp */; }; 532F6AC40D30192E00C0ED59 /* c_mode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69940D30192B00C0ED59 /* c_mode.cpp */; }; 532F6ACB0D30192E00C0ED59 /* clip_no.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F699D0D30192B00C0ED59 /* clip_no.cpp */; }; 532F6AD70D30192E00C0ED59 /* commands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69A90D30192B00C0ED59 /* commands.cpp */; }; 532F6AE70D30192E00C0ED59 /* e_block.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69BF0D30192C00C0ED59 /* e_block.cpp */; }; 532F6AE90D30192E00C0ED59 /* e_buffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69C10D30192C00C0ED59 /* e_buffer.cpp */; }; 532F6AEB0D30192E00C0ED59 /* e_cmds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69C40D30192C00C0ED59 /* e_cmds.cpp */; }; 532F6AED0D30192E00C0ED59 /* e_cvslog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69C60D30192C00C0ED59 /* e_cvslog.cpp */; }; 532F6AF00D30192E00C0ED59 /* e_file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69CA0D30192C00C0ED59 /* e_file.cpp */; }; 532F6AF20D30192E00C0ED59 /* e_fold.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69CC0D30192C00C0ED59 /* e_fold.cpp */; }; 532F6AF40D30192E00C0ED59 /* e_line.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69CE0D30192C00C0ED59 /* e_line.cpp */; }; 532F6AF60D30192E00C0ED59 /* e_loadsave.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69D00D30192C00C0ED59 /* e_loadsave.cpp */; }; 532F6AF80D30192E00C0ED59 /* e_mark.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69D20D30192C00C0ED59 /* e_mark.cpp */; }; 532F6AFB0D30192E00C0ED59 /* e_print.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69D60D30192C00C0ED59 /* e_print.cpp */; }; 532F6AFD0D30192E00C0ED59 /* e_redraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69D80D30192C00C0ED59 /* e_redraw.cpp */; }; 532F6AFF0D30192E00C0ED59 /* e_regex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69DA0D30192C00C0ED59 /* e_regex.cpp */; }; 532F6B010D30192E00C0ED59 /* e_search.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69DD0D30192C00C0ED59 /* e_search.cpp */; }; 532F6B030D30192E00C0ED59 /* e_svnlog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69DF0D30192C00C0ED59 /* e_svnlog.cpp */; }; 532F6B050D30192E00C0ED59 /* e_tags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69E20D30192C00C0ED59 /* e_tags.cpp */; }; 532F6B070D30192E00C0ED59 /* e_trans.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69E50D30192C00C0ED59 /* e_trans.cpp */; }; 532F6B090D30192E00C0ED59 /* e_undo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69E70D30192C00C0ED59 /* e_undo.cpp */; }; 532F6B0B0D30192E00C0ED59 /* e_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69EA0D30192C00C0ED59 /* e_unix.cpp */; }; 532F6B0E0D30192E00C0ED59 /* egui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69ED0D30192C00C0ED59 /* egui.cpp */; }; 532F6B1B0D30192E00C0ED59 /* fte.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F69FD0D30192C00C0ED59 /* fte.cpp */; }; 532F6B220D30192E00C0ED59 /* g_draw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A060D30192C00C0ED59 /* g_draw.cpp */; }; 532F6B240D30192E00C0ED59 /* g_menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A080D30192C00C0ED59 /* g_menu.cpp */; }; 532F6B270D30192E00C0ED59 /* g_nodlg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A0B0D30192C00C0ED59 /* g_nodlg.cpp */; }; 532F6B2C0D30192E00C0ED59 /* g_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A100D30192C00C0ED59 /* g_text.cpp */; }; 532F6B2F0D30192E00C0ED59 /* gui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A130D30192C00C0ED59 /* gui.cpp */; }; 532F6B310D30192E00C0ED59 /* h_ada.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A160D30192C00C0ED59 /* h_ada.cpp */; }; 532F6B330D30192E00C0ED59 /* h_c.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A180D30192C00C0ED59 /* h_c.cpp */; }; 532F6B350D30192E00C0ED59 /* h_catbs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A1A0D30192C00C0ED59 /* h_catbs.cpp */; }; 532F6B370D30192E00C0ED59 /* h_fte.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A1C0D30192C00C0ED59 /* h_fte.cpp */; }; 532F6B390D30192E00C0ED59 /* h_ipf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A1E0D30192C00C0ED59 /* h_ipf.cpp */; }; 532F6B3B0D30192E00C0ED59 /* h_make.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A200D30192C00C0ED59 /* h_make.cpp */; }; 532F6B3D0D30192E00C0ED59 /* h_msg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A220D30192C00C0ED59 /* h_msg.cpp */; }; 532F6B3F0D30192E00C0ED59 /* h_pascal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A240D30192C00C0ED59 /* h_pascal.cpp */; }; 532F6B410D30192E00C0ED59 /* h_perl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A260D30192C00C0ED59 /* h_perl.cpp */; }; 532F6B430D30192E00C0ED59 /* h_plain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A280D30192C00C0ED59 /* h_plain.cpp */; }; 532F6B450D30192E00C0ED59 /* h_rexx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A2A0D30192C00C0ED59 /* h_rexx.cpp */; }; 532F6B470D30192E00C0ED59 /* h_sh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A2C0D30192C00C0ED59 /* h_sh.cpp */; }; 532F6B490D30192E00C0ED59 /* h_simple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A2E0D30192C00C0ED59 /* h_simple.cpp */; }; 532F6B4B0D30192E00C0ED59 /* h_tex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A300D30192C00C0ED59 /* h_tex.cpp */; }; 532F6B4D0D30192E00C0ED59 /* i_ascii.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A320D30192C00C0ED59 /* i_ascii.cpp */; }; 532F6B4F0D30192E00C0ED59 /* i_choice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A350D30192C00C0ED59 /* i_choice.cpp */; }; 532F6B510D30192E00C0ED59 /* i_complete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A380D30192C00C0ED59 /* i_complete.cpp */; }; 532F6B530D30192E00C0ED59 /* i_input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A3B0D30192C00C0ED59 /* i_input.cpp */; }; 532F6B550D30192E00C0ED59 /* i_key.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A3E0D30192C00C0ED59 /* i_key.cpp */; }; 532F6B570D30192E00C0ED59 /* i_modelview.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A410D30192C00C0ED59 /* i_modelview.cpp */; }; 532F6B590D30192E00C0ED59 /* i_oview.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A440D30192C00C0ED59 /* i_oview.cpp */; }; 532F6B5B0D30192E00C0ED59 /* i_search.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A470D30192C00C0ED59 /* i_search.cpp */; }; 532F6B5D0D30192E00C0ED59 /* i_view.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A4A0D30192C00C0ED59 /* i_view.cpp */; }; 532F6B650D30192F00C0ED59 /* indent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A540D30192C00C0ED59 /* indent.cpp */; }; 532F6B670D30192F00C0ED59 /* log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A560D30192C00C0ED59 /* log.cpp */; }; 532F6B6A0D30192F00C0ED59 /* memicmp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A5A0D30192C00C0ED59 /* memicmp.cpp */; }; 532F6B6C0D30192F00C0ED59 /* menu_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A5C0D30192C00C0ED59 /* menu_text.cpp */; }; 532F6B700D30192F00C0ED59 /* o_buffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A610D30192C00C0ED59 /* o_buffer.cpp */; }; 532F6B720D30192F00C0ED59 /* o_buflist.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A630D30192C00C0ED59 /* o_buflist.cpp */; }; 532F6B740D30192F00C0ED59 /* o_cvs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A660D30192C00C0ED59 /* o_cvs.cpp */; }; 532F6B760D30192F00C0ED59 /* o_cvsbase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A690D30192C00C0ED59 /* o_cvsbase.cpp */; }; 532F6B780D30192F00C0ED59 /* o_cvsdiff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A6C0D30192C00C0ED59 /* o_cvsdiff.cpp */; }; 532F6B7A0D30192F00C0ED59 /* o_directory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A6F0D30192C00C0ED59 /* o_directory.cpp */; }; 532F6B7C0D30192F00C0ED59 /* o_list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A720D30192C00C0ED59 /* o_list.cpp */; }; 532F6B7E0D30192F00C0ED59 /* o_messages.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A750D30192C00C0ED59 /* o_messages.cpp */; }; 532F6B800D30192F00C0ED59 /* o_model.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A780D30192C00C0ED59 /* o_model.cpp */; }; 532F6B820D30192F00C0ED59 /* o_modemap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A7B0D30192C00C0ED59 /* o_modemap.cpp */; }; 532F6B840D30192F00C0ED59 /* o_routine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A7E0D30192C00C0ED59 /* o_routine.cpp */; }; 532F6B860D30192F00C0ED59 /* o_svn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A810D30192C00C0ED59 /* o_svn.cpp */; }; 532F6B880D30192F00C0ED59 /* o_svnbase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A840D30192C00C0ED59 /* o_svnbase.cpp */; }; 532F6B8A0D30192F00C0ED59 /* o_svndiff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A870D30192C00C0ED59 /* o_svndiff.cpp */; }; 532F6B910D30192F00C0ED59 /* s_direct.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A920D30192C00C0ED59 /* s_direct.cpp */; }; 532F6B930D30192F00C0ED59 /* s_files.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A950D30192C00C0ED59 /* s_files.cpp */; }; 532F6B950D30192F00C0ED59 /* s_string.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A980D30192C00C0ED59 /* s_string.cpp */; }; 532F6B970D30192F00C0ED59 /* s_util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6A9B0D30192C00C0ED59 /* s_util.cpp */; }; 532F6B9A0D30192F00C0ED59 /* view.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532F6AA00D30192C00C0ED59 /* view.cpp */; }; 536371520D417E4F0021126C /* cocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 536371500D417E4F0021126C /* cocoa.mm */; }; 536371530D417E4F0021126C /* con_cocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 536371510D417E4F0021126C /* con_cocoa.cpp */; }; 5363715B0D417EEB0021126C /* FTETextAreaView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5363715A0D417EEB0021126C /* FTETextAreaView.m */; }; 53C00BF30F2D432300EB3E6A /* cfte.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 538B51870D414C740092CDDF /* cfte.cpp */; }; 53EBAEEA104133660047FD93 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 53EBAEE9104133660047FD93 /* Info.plist */; }; 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* eFTE_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eFTE_Prefix.pch; sourceTree = ""; }; 532F696E0D30192B00C0ED59 /* cut.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = cut.bmp; sourceTree = ""; }; 532F69700D30192B00C0ED59 /* errprev.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = errprev.bmp; sourceTree = ""; }; 532F69720D30192B00C0ED59 /* last.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = last.bmp; sourceTree = ""; }; 532F69740D30192B00C0ED59 /* open.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = open.bmp; sourceTree = ""; }; 532F69750D30192B00C0ED59 /* paste.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = paste.bmp; sourceTree = ""; }; 532F69760D30192B00C0ED59 /* pastecol.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = pastecol.bmp; sourceTree = ""; }; 532F69770D30192B00C0ED59 /* prev.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = prev.bmp; sourceTree = ""; }; 532F69780D30192B00C0ED59 /* redo.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = redo.bmp; sourceTree = ""; }; 532F69790D30192B00C0ED59 /* save.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = save.bmp; sourceTree = ""; }; 532F697A0D30192B00C0ED59 /* tagfind.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = tagfind.bmp; sourceTree = ""; }; 532F697C0D30192B00C0ED59 /* tagpop.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = tagpop.bmp; sourceTree = ""; }; 532F697D0D30192B00C0ED59 /* tagprev.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = tagprev.bmp; sourceTree = ""; }; 532F697E0D30192B00C0ED59 /* undo.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = undo.bmp; sourceTree = ""; }; 532F697F0D30192B00C0ED59 /* c_bind.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_bind.cpp; sourceTree = ""; }; 532F69800D30192B00C0ED59 /* c_bind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_bind.h; sourceTree = ""; }; 532F69820D30192B00C0ED59 /* c_cmdtab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_cmdtab.h; sourceTree = ""; }; 532F69830D30192B00C0ED59 /* c_color.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_color.cpp; sourceTree = ""; }; 532F69840D30192B00C0ED59 /* c_color.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_color.h; sourceTree = ""; }; 532F69860D30192B00C0ED59 /* c_commands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_commands.h; sourceTree = ""; }; 532F69870D30192B00C0ED59 /* c_config.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_config.cpp; sourceTree = ""; }; 532F69880D30192B00C0ED59 /* c_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_config.h; sourceTree = ""; }; 532F698A0D30192B00C0ED59 /* c_desktop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_desktop.cpp; sourceTree = ""; }; 532F698B0D30192B00C0ED59 /* c_desktop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_desktop.h; sourceTree = ""; }; 532F698D0D30192B00C0ED59 /* c_fconfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_fconfig.h; sourceTree = ""; }; 532F698E0D30192B00C0ED59 /* c_hilit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_hilit.cpp; sourceTree = ""; }; 532F698F0D30192B00C0ED59 /* c_hilit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_hilit.h; sourceTree = ""; }; 532F69910D30192B00C0ED59 /* c_history.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_history.cpp; sourceTree = ""; }; 532F69920D30192B00C0ED59 /* c_history.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_history.h; sourceTree = ""; }; 532F69940D30192B00C0ED59 /* c_mode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_mode.cpp; sourceTree = ""; }; 532F69950D30192B00C0ED59 /* c_mode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_mode.h; sourceTree = ""; }; 532F699B0D30192B00C0ED59 /* clip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clip.h; sourceTree = ""; }; 532F699D0D30192B00C0ED59 /* clip_no.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clip_no.cpp; sourceTree = ""; }; 532F69A90D30192B00C0ED59 /* commands.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = commands.cpp; sourceTree = ""; }; 532F69B10D30192B00C0ED59 /* con_ikcz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = con_ikcz.h; sourceTree = ""; }; 532F69B80D30192C00C0ED59 /* conkbd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conkbd.h; sourceTree = ""; }; 532F69B90D30192C00C0ED59 /* console.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = console.h; sourceTree = ""; }; 532F69BE0D30192C00C0ED59 /* dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dialog.h; sourceTree = ""; }; 532F69BF0D30192C00C0ED59 /* e_block.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_block.cpp; sourceTree = ""; }; 532F69C10D30192C00C0ED59 /* e_buffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_buffer.cpp; sourceTree = ""; }; 532F69C20D30192C00C0ED59 /* e_buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = e_buffer.h; sourceTree = ""; }; 532F69C40D30192C00C0ED59 /* e_cmds.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_cmds.cpp; sourceTree = ""; }; 532F69C60D30192C00C0ED59 /* e_cvslog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_cvslog.cpp; sourceTree = ""; }; 532F69C70D30192C00C0ED59 /* e_cvslog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = e_cvslog.h; sourceTree = ""; }; 532F69CA0D30192C00C0ED59 /* e_file.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_file.cpp; sourceTree = ""; }; 532F69CC0D30192C00C0ED59 /* e_fold.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_fold.cpp; sourceTree = ""; }; 532F69CE0D30192C00C0ED59 /* e_line.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_line.cpp; sourceTree = ""; }; 532F69D00D30192C00C0ED59 /* e_loadsave.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_loadsave.cpp; sourceTree = ""; }; 532F69D20D30192C00C0ED59 /* e_mark.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_mark.cpp; sourceTree = ""; }; 532F69D30D30192C00C0ED59 /* e_mark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = e_mark.h; sourceTree = ""; }; 532F69D60D30192C00C0ED59 /* e_print.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_print.cpp; sourceTree = ""; }; 532F69D80D30192C00C0ED59 /* e_redraw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_redraw.cpp; sourceTree = ""; }; 532F69DA0D30192C00C0ED59 /* e_regex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_regex.cpp; sourceTree = ""; }; 532F69DB0D30192C00C0ED59 /* e_regex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = e_regex.h; sourceTree = ""; }; 532F69DD0D30192C00C0ED59 /* e_search.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_search.cpp; sourceTree = ""; }; 532F69DF0D30192C00C0ED59 /* e_svnlog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_svnlog.cpp; sourceTree = ""; }; 532F69E00D30192C00C0ED59 /* e_svnlog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = e_svnlog.h; sourceTree = ""; }; 532F69E20D30192C00C0ED59 /* e_tags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_tags.cpp; sourceTree = ""; }; 532F69E30D30192C00C0ED59 /* e_tags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = e_tags.h; sourceTree = ""; }; 532F69E50D30192C00C0ED59 /* e_trans.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_trans.cpp; sourceTree = ""; }; 532F69E70D30192C00C0ED59 /* e_undo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_undo.cpp; sourceTree = ""; }; 532F69E80D30192C00C0ED59 /* e_undo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = e_undo.h; sourceTree = ""; }; 532F69EA0D30192C00C0ED59 /* e_unix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = e_unix.cpp; sourceTree = ""; }; 532F69ED0D30192C00C0ED59 /* egui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = egui.cpp; sourceTree = ""; }; 532F69EE0D30192C00C0ED59 /* egui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = egui.h; sourceTree = ""; }; 532F69F10D30192C00C0ED59 /* fnmatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fnmatch.h; sourceTree = ""; }; 532F69FD0D30192C00C0ED59 /* fte.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fte.cpp; sourceTree = ""; }; 532F69FF0D30192C00C0ED59 /* fte.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fte.h; sourceTree = ""; }; 532F6A040D30192C00C0ED59 /* ftever.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftever.h; sourceTree = ""; }; 532F6A060D30192C00C0ED59 /* g_draw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = g_draw.cpp; sourceTree = ""; }; 532F6A080D30192C00C0ED59 /* g_menu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = g_menu.cpp; sourceTree = ""; }; 532F6A0B0D30192C00C0ED59 /* g_nodlg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = g_nodlg.cpp; sourceTree = ""; }; 532F6A100D30192C00C0ED59 /* g_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = g_text.cpp; sourceTree = ""; }; 532F6A130D30192C00C0ED59 /* gui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gui.cpp; sourceTree = ""; }; 532F6A140D30192C00C0ED59 /* gui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gui.h; sourceTree = ""; }; 532F6A160D30192C00C0ED59 /* h_ada.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_ada.cpp; sourceTree = ""; }; 532F6A180D30192C00C0ED59 /* h_c.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_c.cpp; sourceTree = ""; }; 532F6A1A0D30192C00C0ED59 /* h_catbs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_catbs.cpp; sourceTree = ""; }; 532F6A1C0D30192C00C0ED59 /* h_fte.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_fte.cpp; sourceTree = ""; }; 532F6A1E0D30192C00C0ED59 /* h_ipf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_ipf.cpp; sourceTree = ""; }; 532F6A200D30192C00C0ED59 /* h_make.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_make.cpp; sourceTree = ""; }; 532F6A220D30192C00C0ED59 /* h_msg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_msg.cpp; sourceTree = ""; }; 532F6A240D30192C00C0ED59 /* h_pascal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_pascal.cpp; sourceTree = ""; }; 532F6A260D30192C00C0ED59 /* h_perl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_perl.cpp; sourceTree = ""; }; 532F6A280D30192C00C0ED59 /* h_plain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_plain.cpp; sourceTree = ""; }; 532F6A2A0D30192C00C0ED59 /* h_rexx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_rexx.cpp; sourceTree = ""; }; 532F6A2C0D30192C00C0ED59 /* h_sh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_sh.cpp; sourceTree = ""; }; 532F6A2E0D30192C00C0ED59 /* h_simple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_simple.cpp; sourceTree = ""; }; 532F6A300D30192C00C0ED59 /* h_tex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = h_tex.cpp; sourceTree = ""; }; 532F6A320D30192C00C0ED59 /* i_ascii.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = i_ascii.cpp; sourceTree = ""; }; 532F6A330D30192C00C0ED59 /* i_ascii.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = i_ascii.h; sourceTree = ""; }; 532F6A350D30192C00C0ED59 /* i_choice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = i_choice.cpp; sourceTree = ""; }; 532F6A360D30192C00C0ED59 /* i_choice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = i_choice.h; sourceTree = ""; }; 532F6A380D30192C00C0ED59 /* i_complete.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = i_complete.cpp; sourceTree = ""; }; 532F6A390D30192C00C0ED59 /* i_complete.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = i_complete.h; sourceTree = ""; }; 532F6A3B0D30192C00C0ED59 /* i_input.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = i_input.cpp; sourceTree = ""; }; 532F6A3C0D30192C00C0ED59 /* i_input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = i_input.h; sourceTree = ""; }; 532F6A3E0D30192C00C0ED59 /* i_key.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = i_key.cpp; sourceTree = ""; }; 532F6A3F0D30192C00C0ED59 /* i_key.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = i_key.h; sourceTree = ""; }; 532F6A410D30192C00C0ED59 /* i_modelview.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = i_modelview.cpp; sourceTree = ""; }; 532F6A420D30192C00C0ED59 /* i_modelview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = i_modelview.h; sourceTree = ""; }; 532F6A440D30192C00C0ED59 /* i_oview.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = i_oview.cpp; sourceTree = ""; }; 532F6A450D30192C00C0ED59 /* i_oview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = i_oview.h; sourceTree = ""; }; 532F6A470D30192C00C0ED59 /* i_search.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = i_search.cpp; sourceTree = ""; }; 532F6A480D30192C00C0ED59 /* i_search.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = i_search.h; sourceTree = ""; }; 532F6A4A0D30192C00C0ED59 /* i_view.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = i_view.cpp; sourceTree = ""; }; 532F6A4B0D30192C00C0ED59 /* i_view.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = i_view.h; sourceTree = ""; }; 532F6A540D30192C00C0ED59 /* indent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = indent.cpp; sourceTree = ""; }; 532F6A560D30192C00C0ED59 /* log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = log.cpp; sourceTree = ""; }; 532F6A570D30192C00C0ED59 /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = ""; }; 532F6A5A0D30192C00C0ED59 /* memicmp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = memicmp.cpp; sourceTree = ""; }; 532F6A5C0D30192C00C0ED59 /* menu_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = menu_text.cpp; sourceTree = ""; }; 532F6A5F0D30192C00C0ED59 /* namemaps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = namemaps.h; sourceTree = ""; }; 532F6A610D30192C00C0ED59 /* o_buffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_buffer.cpp; sourceTree = ""; }; 532F6A630D30192C00C0ED59 /* o_buflist.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_buflist.cpp; sourceTree = ""; }; 532F6A640D30192C00C0ED59 /* o_buflist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = o_buflist.h; sourceTree = ""; }; 532F6A660D30192C00C0ED59 /* o_cvs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_cvs.cpp; sourceTree = ""; }; 532F6A670D30192C00C0ED59 /* o_cvs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = o_cvs.h; sourceTree = ""; }; 532F6A690D30192C00C0ED59 /* o_cvsbase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_cvsbase.cpp; sourceTree = ""; }; 532F6A6A0D30192C00C0ED59 /* o_cvsbase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = o_cvsbase.h; sourceTree = ""; }; 532F6A6C0D30192C00C0ED59 /* o_cvsdiff.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_cvsdiff.cpp; sourceTree = ""; }; 532F6A6D0D30192C00C0ED59 /* o_cvsdiff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = o_cvsdiff.h; sourceTree = ""; }; 532F6A6F0D30192C00C0ED59 /* o_directory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_directory.cpp; sourceTree = ""; }; 532F6A700D30192C00C0ED59 /* o_directory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = o_directory.h; sourceTree = ""; }; 532F6A720D30192C00C0ED59 /* o_list.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_list.cpp; sourceTree = ""; }; 532F6A730D30192C00C0ED59 /* o_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = o_list.h; sourceTree = ""; }; 532F6A750D30192C00C0ED59 /* o_messages.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_messages.cpp; sourceTree = ""; }; 532F6A760D30192C00C0ED59 /* o_messages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = o_messages.h; sourceTree = ""; }; 532F6A780D30192C00C0ED59 /* o_model.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_model.cpp; sourceTree = ""; }; 532F6A790D30192C00C0ED59 /* o_model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = o_model.h; sourceTree = ""; }; 532F6A7B0D30192C00C0ED59 /* o_modemap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_modemap.cpp; sourceTree = ""; }; 532F6A7C0D30192C00C0ED59 /* o_modemap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = o_modemap.h; sourceTree = ""; }; 532F6A7E0D30192C00C0ED59 /* o_routine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_routine.cpp; sourceTree = ""; }; 532F6A7F0D30192C00C0ED59 /* o_routine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = o_routine.h; sourceTree = ""; }; 532F6A810D30192C00C0ED59 /* o_svn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_svn.cpp; sourceTree = ""; }; 532F6A820D30192C00C0ED59 /* o_svn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = o_svn.h; sourceTree = ""; }; 532F6A840D30192C00C0ED59 /* o_svnbase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_svnbase.cpp; sourceTree = ""; }; 532F6A850D30192C00C0ED59 /* o_svnbase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = o_svnbase.h; sourceTree = ""; }; 532F6A870D30192C00C0ED59 /* o_svndiff.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = o_svndiff.cpp; sourceTree = ""; }; 532F6A880D30192C00C0ED59 /* o_svndiff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = o_svndiff.h; sourceTree = ""; }; 532F6A920D30192C00C0ED59 /* s_direct.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = s_direct.cpp; sourceTree = ""; }; 532F6A930D30192C00C0ED59 /* s_direct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = s_direct.h; sourceTree = ""; }; 532F6A950D30192C00C0ED59 /* s_files.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = s_files.cpp; sourceTree = ""; }; 532F6A960D30192C00C0ED59 /* s_files.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = s_files.h; sourceTree = ""; }; 532F6A980D30192C00C0ED59 /* s_string.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = s_string.cpp; sourceTree = ""; }; 532F6A990D30192C00C0ED59 /* s_string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = s_string.h; sourceTree = ""; }; 532F6A9B0D30192C00C0ED59 /* s_util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = s_util.cpp; sourceTree = ""; }; 532F6A9C0D30192C00C0ED59 /* s_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = s_util.h; sourceTree = ""; }; 532F6A9F0D30192C00C0ED59 /* sysdep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sysdep.h; sourceTree = ""; }; 532F6AA00D30192C00C0ED59 /* view.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = view.cpp; sourceTree = ""; }; 5363714F0D417E4F0021126C /* cocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa.h; sourceTree = ""; }; 536371500D417E4F0021126C /* cocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa.mm; sourceTree = ""; }; 536371510D417E4F0021126C /* con_cocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = con_cocoa.cpp; sourceTree = ""; }; 536371590D417EEB0021126C /* FTETextAreaView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTETextAreaView.h; sourceTree = ""; }; 5363715A0D417EEB0021126C /* FTETextAreaView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FTETextAreaView.m; sourceTree = ""; }; 538B51870D414C740092CDDF /* cfte.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cfte.cpp; sourceTree = ""; }; 53EBAEE9104133660047FD93 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Info.plist; sourceTree = SOURCE_ROOT; }; 8D1107320486CEB800E47090 /* eFTE.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = eFTE.app; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8D11072E0486CEB800E47090 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( ); name = Classes; sourceTree = ""; }; 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, ); name = "Linked Frameworks"; sourceTree = ""; }; 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { isa = PBXGroup; children = ( 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, 29B97325FDCFA39411CA2CEA /* Foundation.framework */, ); name = "Other Frameworks"; sourceTree = ""; }; 19C28FACFE9D520D11CA2CBB /* Products */ = { isa = PBXGroup; children = ( 8D1107320486CEB800E47090 /* eFTE.app */, ); name = Products; sourceTree = ""; }; 29B97314FDCFA39411CA2CEA /* eFTE */ = { isa = PBXGroup; children = ( 532F69670D30192B00C0ED59 /* src */, 080E96DDFE201D6D7F000001 /* Classes */, 29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97317FDCFA39411CA2CEA /* Resources */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, ); name = eFTE; sourceTree = ""; }; 29B97315FDCFA39411CA2CEA /* Other Sources */ = { isa = PBXGroup; children = ( 32CA4F630368D1EE00C91783 /* eFTE_Prefix.pch */, ); name = "Other Sources"; sourceTree = ""; }; 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( 53EBAEE9104133660047FD93 /* Info.plist */, 29B97318FDCFA39411CA2CEA /* MainMenu.nib */, ); name = Resources; sourceTree = ""; }; 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, ); name = Frameworks; sourceTree = ""; }; 532F69670D30192B00C0ED59 /* src */ = { isa = PBXGroup; children = ( 536371590D417EEB0021126C /* FTETextAreaView.h */, 5363715A0D417EEB0021126C /* FTETextAreaView.m */, 5363714F0D417E4F0021126C /* cocoa.h */, 536371500D417E4F0021126C /* cocoa.mm */, 536371510D417E4F0021126C /* con_cocoa.cpp */, 532F696B0D30192B00C0ED59 /* bmps */, 538B51870D414C740092CDDF /* cfte.cpp */, 532F697F0D30192B00C0ED59 /* c_bind.cpp */, 532F69800D30192B00C0ED59 /* c_bind.h */, 532F69820D30192B00C0ED59 /* c_cmdtab.h */, 532F69830D30192B00C0ED59 /* c_color.cpp */, 532F69840D30192B00C0ED59 /* c_color.h */, 532F69860D30192B00C0ED59 /* c_commands.h */, 532F69870D30192B00C0ED59 /* c_config.cpp */, 532F69880D30192B00C0ED59 /* c_config.h */, 532F698A0D30192B00C0ED59 /* c_desktop.cpp */, 532F698B0D30192B00C0ED59 /* c_desktop.h */, 532F698D0D30192B00C0ED59 /* c_fconfig.h */, 532F698E0D30192B00C0ED59 /* c_hilit.cpp */, 532F698F0D30192B00C0ED59 /* c_hilit.h */, 532F69910D30192B00C0ED59 /* c_history.cpp */, 532F69920D30192B00C0ED59 /* c_history.h */, 532F69940D30192B00C0ED59 /* c_mode.cpp */, 532F69950D30192B00C0ED59 /* c_mode.h */, 532F699B0D30192B00C0ED59 /* clip.h */, 532F699D0D30192B00C0ED59 /* clip_no.cpp */, 532F69A90D30192B00C0ED59 /* commands.cpp */, 532F69B10D30192B00C0ED59 /* con_ikcz.h */, 532F69B80D30192C00C0ED59 /* conkbd.h */, 532F69B90D30192C00C0ED59 /* console.h */, 532F69BE0D30192C00C0ED59 /* dialog.h */, 532F69BF0D30192C00C0ED59 /* e_block.cpp */, 532F69C10D30192C00C0ED59 /* e_buffer.cpp */, 532F69C20D30192C00C0ED59 /* e_buffer.h */, 532F69C40D30192C00C0ED59 /* e_cmds.cpp */, 532F69C60D30192C00C0ED59 /* e_cvslog.cpp */, 532F69C70D30192C00C0ED59 /* e_cvslog.h */, 532F69CA0D30192C00C0ED59 /* e_file.cpp */, 532F69CC0D30192C00C0ED59 /* e_fold.cpp */, 532F69CE0D30192C00C0ED59 /* e_line.cpp */, 532F69D00D30192C00C0ED59 /* e_loadsave.cpp */, 532F69D20D30192C00C0ED59 /* e_mark.cpp */, 532F69D30D30192C00C0ED59 /* e_mark.h */, 532F69D60D30192C00C0ED59 /* e_print.cpp */, 532F69D80D30192C00C0ED59 /* e_redraw.cpp */, 532F69DA0D30192C00C0ED59 /* e_regex.cpp */, 532F69DB0D30192C00C0ED59 /* e_regex.h */, 532F69DD0D30192C00C0ED59 /* e_search.cpp */, 532F69DF0D30192C00C0ED59 /* e_svnlog.cpp */, 532F69E00D30192C00C0ED59 /* e_svnlog.h */, 532F69E20D30192C00C0ED59 /* e_tags.cpp */, 532F69E30D30192C00C0ED59 /* e_tags.h */, 532F69E50D30192C00C0ED59 /* e_trans.cpp */, 532F69E70D30192C00C0ED59 /* e_undo.cpp */, 532F69E80D30192C00C0ED59 /* e_undo.h */, 532F69EA0D30192C00C0ED59 /* e_unix.cpp */, 532F69ED0D30192C00C0ED59 /* egui.cpp */, 532F69EE0D30192C00C0ED59 /* egui.h */, 532F69F10D30192C00C0ED59 /* fnmatch.h */, 532F69FD0D30192C00C0ED59 /* fte.cpp */, 532F69FF0D30192C00C0ED59 /* fte.h */, 532F6A040D30192C00C0ED59 /* ftever.h */, 532F6A060D30192C00C0ED59 /* g_draw.cpp */, 532F6A080D30192C00C0ED59 /* g_menu.cpp */, 532F6A0B0D30192C00C0ED59 /* g_nodlg.cpp */, 532F6A100D30192C00C0ED59 /* g_text.cpp */, 532F6A130D30192C00C0ED59 /* gui.cpp */, 532F6A140D30192C00C0ED59 /* gui.h */, 532F6A160D30192C00C0ED59 /* h_ada.cpp */, 532F6A180D30192C00C0ED59 /* h_c.cpp */, 532F6A1A0D30192C00C0ED59 /* h_catbs.cpp */, 532F6A1C0D30192C00C0ED59 /* h_fte.cpp */, 532F6A1E0D30192C00C0ED59 /* h_ipf.cpp */, 532F6A200D30192C00C0ED59 /* h_make.cpp */, 532F6A220D30192C00C0ED59 /* h_msg.cpp */, 532F6A240D30192C00C0ED59 /* h_pascal.cpp */, 532F6A260D30192C00C0ED59 /* h_perl.cpp */, 532F6A280D30192C00C0ED59 /* h_plain.cpp */, 532F6A2A0D30192C00C0ED59 /* h_rexx.cpp */, 532F6A2C0D30192C00C0ED59 /* h_sh.cpp */, 532F6A2E0D30192C00C0ED59 /* h_simple.cpp */, 532F6A300D30192C00C0ED59 /* h_tex.cpp */, 532F6A320D30192C00C0ED59 /* i_ascii.cpp */, 532F6A330D30192C00C0ED59 /* i_ascii.h */, 532F6A350D30192C00C0ED59 /* i_choice.cpp */, 532F6A360D30192C00C0ED59 /* i_choice.h */, 532F6A380D30192C00C0ED59 /* i_complete.cpp */, 532F6A390D30192C00C0ED59 /* i_complete.h */, 532F6A3B0D30192C00C0ED59 /* i_input.cpp */, 532F6A3C0D30192C00C0ED59 /* i_input.h */, 532F6A3E0D30192C00C0ED59 /* i_key.cpp */, 532F6A3F0D30192C00C0ED59 /* i_key.h */, 532F6A410D30192C00C0ED59 /* i_modelview.cpp */, 532F6A420D30192C00C0ED59 /* i_modelview.h */, 532F6A440D30192C00C0ED59 /* i_oview.cpp */, 532F6A450D30192C00C0ED59 /* i_oview.h */, 532F6A470D30192C00C0ED59 /* i_search.cpp */, 532F6A480D30192C00C0ED59 /* i_search.h */, 532F6A4A0D30192C00C0ED59 /* i_view.cpp */, 532F6A4B0D30192C00C0ED59 /* i_view.h */, 532F6A4D0D30192C00C0ED59 /* icons */, 532F6A540D30192C00C0ED59 /* indent.cpp */, 532F6A560D30192C00C0ED59 /* log.cpp */, 532F6A570D30192C00C0ED59 /* log.h */, 532F6A5A0D30192C00C0ED59 /* memicmp.cpp */, 532F6A5C0D30192C00C0ED59 /* menu_text.cpp */, 532F6A5F0D30192C00C0ED59 /* namemaps.h */, 532F6A610D30192C00C0ED59 /* o_buffer.cpp */, 532F6A630D30192C00C0ED59 /* o_buflist.cpp */, 532F6A640D30192C00C0ED59 /* o_buflist.h */, 532F6A660D30192C00C0ED59 /* o_cvs.cpp */, 532F6A670D30192C00C0ED59 /* o_cvs.h */, 532F6A690D30192C00C0ED59 /* o_cvsbase.cpp */, 532F6A6A0D30192C00C0ED59 /* o_cvsbase.h */, 532F6A6C0D30192C00C0ED59 /* o_cvsdiff.cpp */, 532F6A6D0D30192C00C0ED59 /* o_cvsdiff.h */, 532F6A6F0D30192C00C0ED59 /* o_directory.cpp */, 532F6A700D30192C00C0ED59 /* o_directory.h */, 532F6A720D30192C00C0ED59 /* o_list.cpp */, 532F6A730D30192C00C0ED59 /* o_list.h */, 532F6A750D30192C00C0ED59 /* o_messages.cpp */, 532F6A760D30192C00C0ED59 /* o_messages.h */, 532F6A780D30192C00C0ED59 /* o_model.cpp */, 532F6A790D30192C00C0ED59 /* o_model.h */, 532F6A7B0D30192C00C0ED59 /* o_modemap.cpp */, 532F6A7C0D30192C00C0ED59 /* o_modemap.h */, 532F6A7E0D30192C00C0ED59 /* o_routine.cpp */, 532F6A7F0D30192C00C0ED59 /* o_routine.h */, 532F6A810D30192C00C0ED59 /* o_svn.cpp */, 532F6A820D30192C00C0ED59 /* o_svn.h */, 532F6A840D30192C00C0ED59 /* o_svnbase.cpp */, 532F6A850D30192C00C0ED59 /* o_svnbase.h */, 532F6A870D30192C00C0ED59 /* o_svndiff.cpp */, 532F6A880D30192C00C0ED59 /* o_svndiff.h */, 532F6A920D30192C00C0ED59 /* s_direct.cpp */, 532F6A930D30192C00C0ED59 /* s_direct.h */, 532F6A950D30192C00C0ED59 /* s_files.cpp */, 532F6A960D30192C00C0ED59 /* s_files.h */, 532F6A980D30192C00C0ED59 /* s_string.cpp */, 532F6A990D30192C00C0ED59 /* s_string.h */, 532F6A9B0D30192C00C0ED59 /* s_util.cpp */, 532F6A9C0D30192C00C0ED59 /* s_util.h */, 532F6A9F0D30192C00C0ED59 /* sysdep.h */, 532F6AA00D30192C00C0ED59 /* view.cpp */, ); name = src; path = ../src; sourceTree = ""; }; 532F696B0D30192B00C0ED59 /* bmps */ = { isa = PBXGroup; children = ( 532F696E0D30192B00C0ED59 /* cut.bmp */, 532F69700D30192B00C0ED59 /* errprev.bmp */, 532F69720D30192B00C0ED59 /* last.bmp */, 532F69740D30192B00C0ED59 /* open.bmp */, 532F69750D30192B00C0ED59 /* paste.bmp */, 532F69760D30192B00C0ED59 /* pastecol.bmp */, 532F69770D30192B00C0ED59 /* prev.bmp */, 532F69780D30192B00C0ED59 /* redo.bmp */, 532F69790D30192B00C0ED59 /* save.bmp */, 532F697A0D30192B00C0ED59 /* tagfind.bmp */, 532F697C0D30192B00C0ED59 /* tagpop.bmp */, 532F697D0D30192B00C0ED59 /* tagprev.bmp */, 532F697E0D30192B00C0ED59 /* undo.bmp */, ); path = bmps; sourceTree = ""; }; 532F6A4D0D30192C00C0ED59 /* icons */ = { isa = PBXGroup; children = ( ); path = icons; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 8D1107260486CEB800E47090 /* eFTE */ = { isa = PBXNativeTarget; buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "eFTE" */; buildPhases = ( 8D1107290486CEB800E47090 /* Resources */, 8D11072C0486CEB800E47090 /* Sources */, 8D11072E0486CEB800E47090 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); name = eFTE; productInstallPath = "$(HOME)/Applications"; productName = eFTE; productReference = 8D1107320486CEB800E47090 /* eFTE.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "eFTE" */; hasScannedForEncodings = 1; mainGroup = 29B97314FDCFA39411CA2CEA /* eFTE */; projectDirPath = ""; targets = ( 8D1107260486CEB800E47090 /* eFTE */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 8D1107290486CEB800E47090 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */, 532F6AA70D30192E00C0ED59 /* cut.bmp in Resources */, 532F6AA90D30192E00C0ED59 /* errprev.bmp in Resources */, 532F6AAB0D30192E00C0ED59 /* last.bmp in Resources */, 532F6AAD0D30192E00C0ED59 /* open.bmp in Resources */, 532F6AAE0D30192E00C0ED59 /* paste.bmp in Resources */, 532F6AAF0D30192E00C0ED59 /* pastecol.bmp in Resources */, 532F6AB00D30192E00C0ED59 /* prev.bmp in Resources */, 532F6AB10D30192E00C0ED59 /* redo.bmp in Resources */, 532F6AB20D30192E00C0ED59 /* save.bmp in Resources */, 532F6AB30D30192E00C0ED59 /* tagfind.bmp in Resources */, 532F6AB50D30192E00C0ED59 /* tagpop.bmp in Resources */, 532F6AB60D30192E00C0ED59 /* tagprev.bmp in Resources */, 532F6AB70D30192E00C0ED59 /* undo.bmp in Resources */, 53EBAEEA104133660047FD93 /* Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8D11072C0486CEB800E47090 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 532F6AB80D30192E00C0ED59 /* c_bind.cpp in Sources */, 532F6ABA0D30192E00C0ED59 /* c_color.cpp in Sources */, 532F6ABC0D30192E00C0ED59 /* c_config.cpp in Sources */, 532F6ABE0D30192E00C0ED59 /* c_desktop.cpp in Sources */, 532F6AC00D30192E00C0ED59 /* c_hilit.cpp in Sources */, 532F6AC20D30192E00C0ED59 /* c_history.cpp in Sources */, 532F6AC40D30192E00C0ED59 /* c_mode.cpp in Sources */, 532F6ACB0D30192E00C0ED59 /* clip_no.cpp in Sources */, 532F6AD70D30192E00C0ED59 /* commands.cpp in Sources */, 532F6AE70D30192E00C0ED59 /* e_block.cpp in Sources */, 532F6AE90D30192E00C0ED59 /* e_buffer.cpp in Sources */, 532F6AEB0D30192E00C0ED59 /* e_cmds.cpp in Sources */, 532F6AED0D30192E00C0ED59 /* e_cvslog.cpp in Sources */, 532F6AF00D30192E00C0ED59 /* e_file.cpp in Sources */, 532F6AF20D30192E00C0ED59 /* e_fold.cpp in Sources */, 532F6AF40D30192E00C0ED59 /* e_line.cpp in Sources */, 532F6AF60D30192E00C0ED59 /* e_loadsave.cpp in Sources */, 532F6AF80D30192E00C0ED59 /* e_mark.cpp in Sources */, 532F6AFB0D30192E00C0ED59 /* e_print.cpp in Sources */, 532F6AFD0D30192E00C0ED59 /* e_redraw.cpp in Sources */, 532F6AFF0D30192E00C0ED59 /* e_regex.cpp in Sources */, 532F6B010D30192E00C0ED59 /* e_search.cpp in Sources */, 532F6B030D30192E00C0ED59 /* e_svnlog.cpp in Sources */, 532F6B050D30192E00C0ED59 /* e_tags.cpp in Sources */, 532F6B070D30192E00C0ED59 /* e_trans.cpp in Sources */, 532F6B090D30192E00C0ED59 /* e_undo.cpp in Sources */, 532F6B0B0D30192E00C0ED59 /* e_unix.cpp in Sources */, 532F6B0E0D30192E00C0ED59 /* egui.cpp in Sources */, 532F6B1B0D30192E00C0ED59 /* fte.cpp in Sources */, 532F6B220D30192E00C0ED59 /* g_draw.cpp in Sources */, 532F6B240D30192E00C0ED59 /* g_menu.cpp in Sources */, 532F6B270D30192E00C0ED59 /* g_nodlg.cpp in Sources */, 532F6B2C0D30192E00C0ED59 /* g_text.cpp in Sources */, 532F6B2F0D30192E00C0ED59 /* gui.cpp in Sources */, 532F6B310D30192E00C0ED59 /* h_ada.cpp in Sources */, 532F6B330D30192E00C0ED59 /* h_c.cpp in Sources */, 532F6B350D30192E00C0ED59 /* h_catbs.cpp in Sources */, 532F6B370D30192E00C0ED59 /* h_fte.cpp in Sources */, 532F6B390D30192E00C0ED59 /* h_ipf.cpp in Sources */, 532F6B3B0D30192E00C0ED59 /* h_make.cpp in Sources */, 532F6B3D0D30192E00C0ED59 /* h_msg.cpp in Sources */, 532F6B3F0D30192E00C0ED59 /* h_pascal.cpp in Sources */, 532F6B410D30192E00C0ED59 /* h_perl.cpp in Sources */, 532F6B430D30192E00C0ED59 /* h_plain.cpp in Sources */, 532F6B450D30192E00C0ED59 /* h_rexx.cpp in Sources */, 532F6B470D30192E00C0ED59 /* h_sh.cpp in Sources */, 532F6B490D30192E00C0ED59 /* h_simple.cpp in Sources */, 532F6B4B0D30192E00C0ED59 /* h_tex.cpp in Sources */, 532F6B4D0D30192E00C0ED59 /* i_ascii.cpp in Sources */, 532F6B4F0D30192E00C0ED59 /* i_choice.cpp in Sources */, 532F6B510D30192E00C0ED59 /* i_complete.cpp in Sources */, 532F6B530D30192E00C0ED59 /* i_input.cpp in Sources */, 532F6B550D30192E00C0ED59 /* i_key.cpp in Sources */, 532F6B570D30192E00C0ED59 /* i_modelview.cpp in Sources */, 532F6B590D30192E00C0ED59 /* i_oview.cpp in Sources */, 532F6B5B0D30192E00C0ED59 /* i_search.cpp in Sources */, 532F6B5D0D30192E00C0ED59 /* i_view.cpp in Sources */, 532F6B650D30192F00C0ED59 /* indent.cpp in Sources */, 532F6B670D30192F00C0ED59 /* log.cpp in Sources */, 532F6B6A0D30192F00C0ED59 /* memicmp.cpp in Sources */, 532F6B6C0D30192F00C0ED59 /* menu_text.cpp in Sources */, 532F6B700D30192F00C0ED59 /* o_buffer.cpp in Sources */, 532F6B720D30192F00C0ED59 /* o_buflist.cpp in Sources */, 532F6B740D30192F00C0ED59 /* o_cvs.cpp in Sources */, 532F6B760D30192F00C0ED59 /* o_cvsbase.cpp in Sources */, 532F6B780D30192F00C0ED59 /* o_cvsdiff.cpp in Sources */, 532F6B7A0D30192F00C0ED59 /* o_directory.cpp in Sources */, 532F6B7C0D30192F00C0ED59 /* o_list.cpp in Sources */, 532F6B7E0D30192F00C0ED59 /* o_messages.cpp in Sources */, 532F6B800D30192F00C0ED59 /* o_model.cpp in Sources */, 532F6B820D30192F00C0ED59 /* o_modemap.cpp in Sources */, 532F6B840D30192F00C0ED59 /* o_routine.cpp in Sources */, 532F6B860D30192F00C0ED59 /* o_svn.cpp in Sources */, 532F6B880D30192F00C0ED59 /* o_svnbase.cpp in Sources */, 532F6B8A0D30192F00C0ED59 /* o_svndiff.cpp in Sources */, 532F6B910D30192F00C0ED59 /* s_direct.cpp in Sources */, 532F6B930D30192F00C0ED59 /* s_files.cpp in Sources */, 532F6B950D30192F00C0ED59 /* s_string.cpp in Sources */, 532F6B970D30192F00C0ED59 /* s_util.cpp in Sources */, 532F6B9A0D30192F00C0ED59 /* view.cpp in Sources */, 536371520D417E4F0021126C /* cocoa.mm in Sources */, 536371530D417E4F0021126C /* con_cocoa.cpp in Sources */, 5363715B0D417EEB0021126C /* FTETextAreaView.m in Sources */, 53C00BF30F2D432300EB3E6A /* cfte.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = { isa = PBXVariantGroup; children = ( 29B97319FDCFA39411CA2CEA /* English */, ); name = MainMenu.nib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; INSTALL_PATH = "$(HOME)/Applications"; PRODUCT_NAME = eFTE; WRAPPER_EXTENSION = app; }; name = Debug; }; C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = ( ppc, i386, ); GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_MODEL_TUNING = G5; INSTALL_PATH = "$(HOME)/Applications"; PRODUCT_NAME = eFTE; WRAPPER_EXTENSION = app; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = Info.plist; OTHER_CFLAGS = ( "-DUNIX", "-DMACOSX", ); PREBINDING = NO; SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = ( ppc, i386, ); GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = Info.plist; OTHER_CFLAGS = ( "-DUNIX", "-DMACOSX", ); PREBINDING = NO; SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "eFTE" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4B08A954540054247B /* Debug */, C01FCF4C08A954540054247B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C01FCF4E08A954540054247B /* Build configuration list for PBXProject "eFTE" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4F08A954540054247B /* Debug */, C01FCF5008A954540054247B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; } efte-1.1/macosx/English.lproj/0000775000076400007640000000000011264420021015322 5ustar laurilauriefte-1.1/macosx/English.lproj/MainMenu.nib/0000775000076400007640000000000011264420021017602 5ustar laurilauriefte-1.1/macosx/English.lproj/MainMenu.nib/info.nib0000664000076400007640000000122411041406031021224 0ustar laurilauri IBDocumentLocation 142 57 365 245 0 0 1024 746 IBEditorPositions 29 117 287 345 44 0 0 1024 746 IBFramework Version 489.0 IBLockedObjects 224 IBOpenObjects 21 29 IBSystem Version 8S165 efte-1.1/macosx/English.lproj/MainMenu.nib/classes.nib0000664000076400007640000000122411041406031021726 0ustar laurilauri{ IBClasses = ( { ACTIONS = {juttu = id; }; CLASS = Controller; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = {keyPressPlease = id; teeJotain = id; }; CLASS = FTETextAreaView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, { ACTIONS = {myAction = id; myAction1 = id; }; CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, {CLASS = NSSegmentedControl; LANGUAGE = ObjC; SUPERCLASS = NSControl; } ); IBVersion = 1; }efte-1.1/INSTALL0000664000076400007640000000011711041303457012350 0ustar laurilauriPlease see the wiki for installation information: http://efte.sourceforge.net/efte-1.1/config/0000775000076400007640000000000011264420007012563 5ustar laurilauriefte-1.1/config/m_text.fte0000664000076400007640000000025511157534024014573 0ustar laurilauri mode TEXT: PLAIN { # Text files (wordwrap) FileNameRx = /\.\c{TXT}|{DOC}$/; # try also 1 WordWrap = 2; } oinclude 'mym_text.fte'; efte-1.1/config/m_gawk.fte0000664000076400007640000001535511157534024014547 0ustar laurilauri# # FTE highlighting rules for GAWK/AWK scripts # # Contributor: Wirawan Purwanto # Created: 4-Mar-2002 # Updated: 20-May-2002 # # The syntax highlighting is heavily biased toward GNU AWK. # # CAVEAT: The syntax highlighting for REGEX is not perfect at all: # ordinary divisions WILL be misunderstood as regex. Unless you have # divisions in your awk scripts (which is a kind of unlikely for typical # scripts), this should not be a big trouble. # # The original source code is m_gawk.src.fte. DO NOT EDIT FILE m_gawk.fte! # colorize GAWK { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Regexp', 'Lang_Regexp' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, { 'Tag', 'Markup_Tag' }, }; keyword 'Editor_Keywords' { # any missing ? 'BEGIN', 'END', 'print', 'printf', 'delete', 'if', 'else', 'for', 'in', 'while', 'do', 'break', 'continue', 'next', 'nextfile', 'function', 'return', 'exit', 'getline', }; # Standard functions supplied bu AWK keyword 'Lang_Function' { # any missing ? # math-oriented: 'int', 'sqrt', 'exp', 'log', 'sin', 'cos', 'atan2', 'rand', 'srand', # string-oriented: 'index', 'length', 'match', 'split', 'sprintf', 'strtonum', 'sub', 'gsub', 'gensub', 'substr', 'tolower', 'toupper', # file i/o: 'open', 'close', 'fflush', 'system', # GAWK-specific extensions --------- # string-oriented: 'asort', # bit oriented: (AWK/GAWK???) 'and', 'or', 'xor', 'compl', 'lshift', 'rshift', # timestamp functions: 'systime', 'mktime', 'strftime', # internationalization 'dcgettext', 'bindtextdomain', }; # standard library procedure/function names # Standard variables supplied by AWK keyword 'Lang_Variable' { # built-in/special-meaning variables 'CONVFMT', 'FS', 'OFMT', 'OFS', 'ORS', 'RS', 'SUBSEB', 'ARGC', 'ARGV', 'ENVIRON', 'ERRNO', 'FILENAME', 'FNR', 'NF', 'NR', 'PROCINFO', 'RLENGTH', 'RSTART', # gawk specific 'BINMODE', 'FIELDWIDTH', 'IGNORECASE', 'LINT', 'TEXTDOMAIN', 'ARGIND', 'RT', }; # default state h_state 0 { 'Punctuation' } h_trans { 2, '-s', '_a-zA-Z', 'Normal' } h_trans { 6, '-s', '0-9', 'Normal' } h_trans { 3, '<', '#', 'Comment' } h_trans { 4, '<', '"', 'String' } # h_trans { 5, '<', '\'', 'String' } # metachar (except tab -- how to include it?) h_trans { 0, '', '$', 'CPreprocessor' } h_trans { 0, '$', '\\', 'Punctuation' } # literal char # h_trans { 1, '', '\\', 'Punctuation' } -- this is not recognized here! h_trans { 7, '<', '/', 'Keyword' } # h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' } # quote h_state 1 { 'String' } h_trans { 0, 'S', '', 'String' } h_trans { 0, '$', '', 'Normal' } # word h_state 2 { 'Normal' } h_wtype { -1, -1, -1, '', '_a-zA-Z0-9' } # end of a word h_trans { 0, '$', '', 'Normal' } h_trans { 0, '-S', '_a-zA-Z0-9', 'Normal' } # comment h_state 3 { 'Comment' } h_trans { 0, '$<', '', 'Normal' } # string ("-quoted) h_state 4 { 'String' } h_trans { 0, '>', '"', 'String' } h_trans { 4, '', '\\"', 'String' } h_trans { 4, '', '\\\\', 'String' } h_trans { 4, '$', '\\', 'Punctuation' } # not allowed in gawk/awk: ## string ('-quoted) h_state 5 { 'String' } h_trans { 0, '>', '\'', 'String' } h_trans { 5, '>', '\\\'', 'String' } h_trans { 5, '$', '\\', 'Punctuation' } # number h_state 6 { 'Number' } h_trans { 0, '-S', '.0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } # The regular-expression part: # regexp h_state 7 { 'Regexp' } h_trans { 8, '', '\\', 'Punctuation' } # regexp operators: h_trans { 7, 's', '^$.+*|()?', 'Punctuation' } h_trans { 9, '<', '[', 'Punctuation' } h_trans { 11,'<', '{', 'Punctuation' } h_trans { 0, '', '/', 'Keyword' } # h_trans { 12, '$>', '', 'Normal' } # literal quotation h_state 8 { 'Regexp' } h_trans { 7, 's', 'abfnrtv', 'Punctuation' } h_trans { 7, 'S', '', 'Regexp' } h_trans { 12, '$', '', 'Normal' } # grouping using [ ] h_state 9 { 'Regexp' } h_trans { 10, '', '\\', 'Punctuation' } h_trans { 9, '', '^', 'Punctuation' } h_trans { 9, '', '-', 'Punctuation' } h_trans { 7, '>', ']', 'Punctuation' } h_trans { 12, '$', '', 'Normal' } # regexpgroupquote h_state 10 { 'Regexp' } h_trans { 9, 's', 'abfnrtv', 'Punctuation' } h_trans { 9, 'S', '', 'Regexp' } h_trans { 12, '$', '', 'Normal' } # repeat count h_state 11 { 'Number' } h_trans { 11,'s', '0-9', 'Number' } h_trans { 11,'', ',', 'Punctuation' } h_trans { 7, '>', '}', 'Punctuation' } h_trans { 12, 'S', '', 'Normal' } h_trans { 12, '$', '', 'Normal' } # error h_state 12 { 'Tag' } # all the way to the end :-) } mode GAWK: SOURCE { # AWK mode with GNU extensions FirstLineRx = /^\#\![ ]*[^ ]*awk>/; FileNameRx = /\.\c{{AWK}|{GAWK}}$/; HilitOn = 1; Colorizer = 'GAWK'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /^\s*function\s+[A-Za-z_][A-Za-z_0-9]*\s*\(.*/; # RoutineRx ^\w[\w_:*&]+[\w\s_:*&]@\( # RoutineRx ^{[a-zA-Z0-9_:*&]#\s*}+\( SaveFolds = 2; # save fold info at end of line CommentStart = ' #'; CommentEnd = ''; } oinclude 'mym_gawk.fte'; efte-1.1/config/pal_blk.fte0000664000076400007640000001230311157534024014674 0ustar laurilauri# color palette (black background) # the color palette is the definition of the symbolic colors # that are used everywhere else in the configuration files # syntax of the color specification is: # # fore back # or # symbolic_fore:symbolic_back # or # symbolic color_palette { { 'ScrollBar_Arrows', 'black:gray' }, { 'ScrollBar_Background', 'gray:black' }, { 'ScrollBar_Slider', 'black:gray' }, { 'Status_Normal', 'black:darkCyan' }, { 'Status_Active', 'black:gray' }, { 'Message_Normal', 'Status_Normal' }, { 'Message_Error', 'white:darkBlue' }, { 'Message_Bold', 'white:darkRed' }, { 'EntryField_Field', 'cyan:darkBlue' }, { 'EntryField_Prompt', 'white:darkBlue' }, { 'EntryField_Selection', 'black:darkGreen' }, { 'List_Status', 'black:gray' }, { 'List_Normal', 'gray:black' }, { 'List_Selected', 'white:darkBlue' }, { 'List_Hilited', 'white:black' }, { 'List_HilitSelect', 'white:darkBlue' }, { 'List_Marked', 'yellow:black' }, { 'List_MarkSelect', 'yellow:darkBlue' }, { 'List_MarkHilit', 'yellow:black' }, { 'List_MarkHilitSel', 'yellow:darkBlue' }, { 'ASCII_Chars', 'gray:black' }, { 'Menu_Background', 'black:gray' }, { 'Menu_ActiveItem', 'white:darkBlue' }, { 'Menu_ActiveChar', 'red:darkBlue' }, { 'Menu_NormalItem', 'black:gray' }, { 'Menu_NormalChar', 'red:gray' }, { "Choice_Title", 'white:darkBlue' }, { "Choice_Param", 'cyan:darkBlue' }, { "Choice_Background", 'gray:darkBlue' }, { "Choice_ActiveItem", 'black:darkGreen' }, { "Choice_ActiveChar", 'white:darkGreen' }, { "Choice_NormalItem", 'white:darkBlue' }, { "Choice_NormalChar", 'yellow:darkBlue' }, { "bg", 'gray:black' }, # background { "fg", 'gray:black' }, # foreground { 'Editor_Selected', 'black:darkCyan' }, { 'Editor_Markers', 'darkCyan:bg' }, { 'Editor_FoundText', 'white:darkRed' }, { 'Editor_Folds0', 'green:bg' }, { 'Editor_Folds1', 'blue:bg' }, { 'Editor_Folds2', 'magenta:bg' }, { 'Editor_Folds3', 'magenta:bg' }, { 'Editor_Folds4', 'magenta:bg' }, { 'Editor_HilitWord', 'red:bg' }, { 'Editor_Default', 'fg:bg' }, { 'Editor_Bold', 'cyan:bg' }, { 'Editor_Keywords', 'white:bg' }, { 'Editor_Keywords2', 'cyan:bg' }, { 'Editor_Keywords3', 'green:bg' }, { 'Editor_Keywords4', 'magenta:bg' }, { 'Editor_Keywords5', 'darkCyan:bg' }, { 'Msg_Header', 'darkCyan:bg' }, { 'Msg_Quotes', 'green:bg' }, { 'Msg_Tag', 'white:bg' }, { 'Msg_Signature', 'darkCyan:bg' }, { 'Comment', 'brown:bg' }, { 'String', 'yellow:bg' }, { 'Lang_Default', 'Editor_Default' }, { 'Lang_Number', 'red:bg' }, { 'Lang_DecimalNumber', 'Lang_Number' }, { 'Lang_HexNumber', 'magenta:bg' }, { 'Lang_OctalNumber', 'magenta:bg' }, { 'Lang_BinaryNumber', 'magenta:bg' }, { 'Lang_Punctuation', 'darkCyan:bg' }, { 'Lang_String', 'String' }, { 'Lang_Comment', 'Comment' }, { 'Lang_Preprocessor', 'green:bg' }, { 'Lang_Function', 'cyan:bg' }, { 'Lang_Label', 'red:bg' }, { 'Lang_Command', 'cyan:bg' }, { 'Lang_Regexp', 'magenta:bg' }, { 'Lang_Variable', 'gray:bg' }, { 'Lang_Control', 'darkCyan:bg' }, { 'Lang_Assembler', 'blue:bg' }, # embedded assembler (Pascal) { 'Markup_Default', 'gray:bg' }, { 'Markup_Punctuation', 'darkCyan:bg' }, { 'Markup_String', 'String' }, { 'Markup_Symbol', 'green:bg' }, { 'Markup_Tag', 'cyan:bg' }, { 'Markup_Comment', 'Comment' }, { 'Markup_Special', 'red:bg' }, { 'Markup_Control', 'magenta:bg' }, { 'Markup_Quotes', 'yellow:bg' }, { 'Markup_Math', 'red:bg' }, # diff/diff3 { 'DIFF_Old', 'brown:bg' }, { 'DIFF_New', 'yellow:bg' }, { 'DIFF_Changed', 'darkCyan:bg' }, # rcsmerge { 'MERGE_Changed', 'white:bg' }, { 'MERGE_Old', 'gray:bg' }, { 'MERGE_New', 'red:bg' }, { 'MERGE_Control', 'yellow:bg' }, } efte-1.1/config/m_bin.fte0000664000076400007640000000176611157534024014367 0ustar laurilaurimode BIN: PLAIN { # Binary Mode # FileNameRx = /\.\c{EXE}|{DLL}|{LIB}|{OBJ}|{BIN}|{ZIP}|{TAR}|{Z}|{GZ}|{COM}$/; # OBJ is file for Alias Wavefront FileNameRx = /\.\c{EXE}|{DLL}|{LIB}|{BIN}|{ZIP}|{TAR}|{Z}|{GZ}|{COM}$/; FirstLineRx = /[^\r\n\t -\xFF]/; HilitOn = 0; AutoIndent = 0; ShowTabs = 1; DetectLineSep = 0; StripChar = -1; LineChar = -1; AddCR = 0; AddLF = 0; ExpandTabs = 0; ForceNewLine = 0; TabSize = 8; LoadMargin = 64; SpaceTabs = 0; BackSpKillTab = 1; DeleteKillTab = 1; BackSpUnindents = 0; Trim = 0; ShowMarkers = 1; WordWrap = 0; MatchCase = 1; ReadOnly = 1; MultiLineHilit = 0; AutoHilitParen = 0; Abbreviations = 0; } oinclude 'mym_bin.fte'; efte-1.1/config/ui_fte.fte0000664000076400007640000000070111157534024014542 0ustar laurilauri# FTE include 'ui_m_fte.fte'; include 'ui_k_fte.fte'; include 'menu/m_c.fte'; include 'menu/m_groovy.fte'; include 'menu/m_html.fte'; include 'menu/m_rexx.fte'; include 'menu/m_sgml.fte'; include 'menu/m_rst.fte'; include 'kbd/k_c.fte'; include 'kbd/k_groovy.fte'; include 'kbd/k_java.fte'; include 'kbd/k_perl.fte'; include 'kbd/k_rexx.fte'; include 'kbd/k_fte.fte'; include 'kbd/k_html.fte'; include 'kbd/k_sgml.fte'; include 'kbd/k_rst.fte'; efte-1.1/config/m_texi.fte0000664000076400007640000001132411157534024014557 0ustar laurilauri# some stuff copied from m_texi.org. # need to add all assembler commands colorize TEXINFO { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Punctuation', 'Markup_Punctuation' }, { 'Special', 'Markup_Special' }, }; keyword 'Editor_Keywords' { # global keywords ... 'TeX{}', 'bullet{}', 'copyright{}', 'dots{}', 'equiv{}', 'error{}', 'expansion{}', 'minus{}', 'point{}', 'print{}', 'result{}', 'today{}', 'AA{}', 'aa{}', 'AE{}', 'ae{}', 'enddots{}', 'equiv{}', 'exclamdown{}', 'L{}', 'l{}', 'expansion{}', }; h_state 0 { 'Normal' } h_trans { 3, '', '%', 'Comment' } h_trans { 3, '', '@c ', 'Comment' } h_trans { 1, '^', '@', 'Keyword' } h_trans { 2, '', '@', 'Keyword' } h_trans { 0, 's', '{}\\', 'Punctuation' } h_state 1 { 'Keyword' } # bol only keywors h_trans { 0, '$', '', 'Normal' } h_trans { 0, 'S', 'a-zA-Z_', 'Special' } h_wtype { 0, 4, 0, '->', 'a-zA-Z_{}' } h_words 'Editor_Keywords' { 'appendix', 'appendixsec', 'appendixsections', 'appendixsubsec', 'appendixsubsubsec', 'author', 'bye', 'center', 'contents', 'centerchap', 'chapheading', 'chapter', 'cindex', 'clear', 'defcodeindex', 'defcv', 'deffn', 'defindex', 'defivar', 'defmac', 'defmethod', 'defop', 'defopt', 'defspec', 'deftp', 'deftypfn', 'deftypefun', 'deftypevr', 'deftypevar', 'deffun', 'defvar', 'defvr', 'dircategory', 'direntry', 'display', 'end', 'enumerate', 'enumerate', 'evenfooting', 'evenheading', 'everyfooting', 'everyheading', 'example', 'exdent', 'finalout', 'findex', 'flushleft', 'flushright', 'footnotestyle', 'format', 'ftable', 'group', 'heading', 'headings', 'ifclear', 'ifinfo', 'ifhtml', 'ifset', 'iftex', 'ignore', 'include', 'item', 'item', 'itemize', 'itemize', 'itemx', 'itemx', 'kindex', 'lisp', 'majorheading', 'menu', 'need', 'node', 'noindent', 'oddfooting', 'oddheading', 'page', 'paragraphindent', 'pindex', 'printindex', 'printindex', 'quotation', 'refill', 'section', 'set', 'setchapternewpage', 'setfilename', 'settitle', 'shortcontens', 'smallbook', 'smallexample', 'smalllisp', 'sp', 'strong', 'subheading', 'subsection', 'subsubheading', 'subsubsection', 'subtitle', 'summarycontents', 'syncodeindex', 'synindex', 'table', 'tex', 'thischapter', 'thischaptername', 'thisfile', 'thispage', 'thistitle', 'tindex', 'title', 'titlepage', 'top', 'unnumbered', 'unnumberedsec', 'unnumberedsubsec', 'unnumberedsubsubsec', 'vindex', 'vskip', 'vtable', } h_state 2 { 'Keyword' } h_trans { 0, 'S', 'a-zA-Z_', 'Special' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 4, 0, '->', 'a-zA-Z_{}' } h_state 3 { 'Comment' } h_trans { 0, '$', '', 'Normal' } h_state 4 { 'Keyword' } h_trans { 0, '$', '', 'Normal' } h_wtype { 5, 0, 0, '>', 'a-zA-Z_' } h_words 'Editor_Keywords' { 'value', 'b', 'code', 'file', 'email', 'H', 'cite', 'xref', 'pref', 'ref', 'samp', 'kbd', 'footnote', } h_state 5 { 'Normal' } h_trans { 6, '', '{', 'Punctuation' } h_trans { 0, '', '', 'Normal' } h_state 6 { 'String' } h_trans { 0, '', '}', 'Punctuation' } } mode TEXINFO: MARKUP { FileNameRx = /\.\cTEXI$/; HilitOn = 1; Colorizer = 'TEXINFO'; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' %'; CommentEnd = ''; } oinclude 'mym_texi.fte'; efte-1.1/config/m_falcon.fte0000664000076400007640000000264411157534024015055 0ustar laurilauri# FTE mode for editing Falcon files colorize FALCON { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_Number' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, }; keyword 'Editor_Keywords' { 'case', 'catch', 'class', 'default', 'elif', 'else', 'end', 'export', 'for','function', 'if', 'init', 'loop', 'object', 'switch', 'select', 'try', 'while' }; keyword 'Editor_Keywords2' { 'and', 'attributes', 'break', 'const', 'continue', 'dropping', 'forall', 'forfirst', 'forlast', 'from', 'global', 'in', 'include', 'int', 'launch', 'let', 'load', 'nil', 'not', 'notin', 'to', 'or', 'provides', 'return', 'static', 'step' }; } mode FALCON: SOURCE { # Falcon Mode FileNameRx = '\\.{fal}|{ftd}$'; Colorizer = 'FALCON'; HilitOn = 1; AutoIndent = 1; IndentMode = 'PLAIN'; TabSize = 3; RoutineRegexp = /^[\s\t]*{class}|{function}\s/; SaveFolds = 2; # save fold info at end of line CommentStart = '/*'; CommentEnd = '*/'; } oinclude 'mym_falcon.fte'; efte-1.1/config/m_sql.fte0000664000076400007640000001045311157534024014407 0ustar laurilauri# # SQL mode # colorize SQL { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, }; keyword 'Editor_Keywords' { # Kosina # 'select', 'where', 'insert', 'into', # 'update', 'from', 'in', 'order', 'by', # 'and', 'or', 'not', 'union', 'distinct', 'join', 'all', # 'group', 'ADD','EXIT','PREPARE', 'ALL','FETCH','PRIMARY', 'ALTER','FILE','PRINT', 'AND','FILLFACTOR','PRIVILEGES', 'ANY','FLOPPY','PROC', 'AS','FOR','PROCEDURE', 'ASC','FOREIGN','PROCESSEXIT', 'AUTHORIZATION','FREETEXT','PUBLIC', 'AVG','FREETEXTTABLE','RAISERROR', 'BACKUP','FROM','READ', 'BEGIN','FULL','READTEXT', 'BETWEEN','GOTO','RECONFIGURE', 'BREAK','GRANT','REFERENCES', 'BROWSE','GROUP','REPEATABLE', 'BULK','HAVING','REPLICATION', 'BY','HOLDLOCK','RESTORE', 'CASCADE','IDENTITY','RESTRICT', 'CASE','IDENTITY_INSERT','RETURN', 'CHECK','IDENTITYCOL','REVOKE', 'CHECKPOINT','IF','RIGHT', 'CLOSE','IN','ROLLBACK', 'CLUSTERED','INDEX','ROWCOUNT', 'COALESCE','INNER','ROWGUIDCOL', 'COLUMN','INSERT','RULE', 'COMMIT','INTERSECT','SAVE', 'COMMITTED','INTO','SCHEMA', 'COMPUTE','IS','SELECT', 'CONFIRM','ISOLATION','SERIALIZABLE', 'CONSTRAINT','JOIN','SESSION_USER', 'CONTAINS','KEY','SET', 'CONTAINSTABLE','KILL','SETUSER', 'CONTINUE','LEFT','SHUTDOWN', 'CONTROLROW','LEVEL','SOME', 'CONVERT','LIKE','STATISTICS', 'COUNT','LINENO','SUM', 'CREATE','LOAD','SYSTEM_USER', 'CROSS','MAX','TABLE', 'CURRENT','MIN','TAPE', 'CURRENT_DATE','MIRROREXIT','TEMP', 'CURRENT_TIME','NATIONAL','TEMPORARY', 'CURRENT_TIMESTAMP','NOCHECK','TEXTSIZE', 'CURRENT_USER','NONCLUSTERED','THEN', 'CURSOR','NOT','TO', 'DATABASE','NULL','TOP', 'DBCC','NULLIF','TRAN', 'DEALLOCATE','OF','TRANSACTION', 'DECLARE','OFF','TRIGGER', 'DEFAULT','OFFSETS','TRUNCATE', 'DELETE','ON','TSEQUAL', 'DENY','ONCE','UNCOMMITTED', 'DESC','ONLY','UNION', 'DISK','OPEN','UNIQUE', 'DISTINCT','OPENDATASOURCE','UPDATE', 'DISTRIBUTED','OPENQUERY','UPDATETEXT', 'DOUBLE','OPENROWSET','USE', 'DROP','OPTION','USER', 'DUMMY','OR','VALUES', 'DUMP','ORDER','VARYING', 'ELSE','OUTER','VIEW', 'END','OVER','WAITFOR', 'ERRLVL','PERCENT','WHEN', 'ERROREXIT','PERM','WHERE', 'ESCAPE','PERMANENT','WHILE', 'EXCEPT','PIPE','WITH', 'EXEC','PLAN','WORK', 'EXECUTE','PRECISION','WRITETEXT', 'EXISTS', 'GO' }; h_state 0 { 'Normal' } h_trans { 4, '-s', 'a-zA-Z_', 'Normal' } h_trans { 1, '<', '/*', 'Comment' } h_trans { 2, '<', '\'', 'String' } h_trans { 3, '', '*/', 'Comment' } h_state 2 { 'String' } h_trans { 0, '>', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 3 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 4 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_' } # Kosina h_state 5 { 'Comment' } h_trans { 0, '$', '', 'Normal' } # Kosina h_state 6 { 'String' } h_trans { 0, '>', '\"', 'String' } h_trans { 0, '$', '', 'String' } } mode SQL: SOURCE { # SQL Mode FileNameRx = /\.\cSQL$/; HilitOn = 1; Colorizer = 'SQL'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; } oinclude 'mym_sql.fte'; efte-1.1/config/ui_k_fte.fte0000664000076400007640000003200611157534024015057 0ustar laurilauri eventmap MODEL { key [F1] { ViewModeMap } key [C+F2] { FileSaveAll } key [F3] { FileOpen } key [F4] { WinNext } key [C+F4] { WinHSplit } key [S+F4] { WinPrev } key [A+S+F4] { WinClose } key [F5] { WinZoom } key [F6] { FileNext } key [S+F6] { FilePrev } key [A+S-F6] { FileLast } key [F7] { Find $Word } key [F10] { MainMenu } key [C+F10] { FileClose } key [C+F9] { RunProgram } key [A+F9] { RunProgram "" } key [S+F10] { LocalMenu } key [A+G-Up] { WinPrev } key [A+G-Down] { WinNext } key [A+G-Left] { FilePrev } key [A+G-Right] { FileNext } key [A+C+G-Left] { FramePrev } key [A+C+G-Right] { FrameNext } key [A+G-PgUp] { WinPrev; MovePageUp; WinNext } key [A+G-PgDn] { WinNext; MovePageDown; WinPrev } key [A+C+G-PgUp] { WinNext; MovePageUp; WinPrev } key [A+C+G-PgDn] { WinPrev; MovePageDown; WinNext } key [A+X] { ExitEditor } key [A+Q] { FileClose } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } # this is also useful for 'grep -n' etc. if configured key [F9] { Compile; ViewMessages } key [F11] { CompilePrevError } key [F12] { CompileNextError } key [S+F9] { ViewMessages } key [A+F5] { ShowEntryScreen } key [A+0] { ViewBuffers } key [A+1] { SwitchTo 1 } key [A+2] { SwitchTo 2 } key [A+3] { SwitchTo 3 } key [A+4] { SwitchTo 4 } key [A+5] { SwitchTo 5 } key [A+6] { SwitchTo 6 } key [A+7] { SwitchTo 7 } key [A+8] { SwitchTo 8 } key [A+9] { SwitchTo 9 } key [A+F] { MainMenu 'F' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } key [A+H] { MainMenu 'H' } } # List Viewers eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveFileStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveFileEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [C+G-Left] { ScrollRight } key [C+G-Right] { ScrollLeft } key [G-Enter] { Activate } key [Space] { ActivateInOtherWindow } key [S+G-Enter] { CloseActivate } key [C+R] { Rescan } } eventmap CVSDIFF: MLIST { key [C+G-Ins] { BlockCopy } key [Esc] { FileClose } } eventmap CVS: MLIST { LocalMenu = "MCvs"; } eventmap SVNDIFF: MLIST { key [C+G-Ins] { BlockCopy } key [Esc] { FileClose } } eventmap SVN: MLIST { LocalMenu = "MSvn"; } eventmap DIRECTORY: MLIST { MainMenu = 'DirectoryMain'; LocalMenu = 'DirectoryLocal'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [C+D] { DeleteFile } key [Esc] { FileClose 0 } key [C+G] { DirSearchNext } key [C+H] { DirSearchPrev } key [A+N] { MainMenu 'N' } key [C+O_C+V] { ShowMenu 'MCvs' } key [C+O_C+N] { ShowMenu 'MSvn' } } # Buffer List eventmap BUFFERS: MLIST { MainMenu = "BufferListMain"; LocalMenu = "BufferListLocal"; key [Esc] { FileClose 0 } # 0 = do not open directory when last closed, overrides OpenAfterClose default. key [C+C] { BufListFileClose } key [G-Del] { BufListFileClose } key [C+S] { BufListFileSave } key [F2] { BufListFileSave } key [C+O_C+V] { ShowMenu 'MCvs' } key [C+O_C+N] { ShowMenu 'MSvn' } } # Routine List eventmap ROUTINES: MLIST { MainMenu = "RoutinesMain"; LocalMenu = "RoutinesLocal"; key [Esc] { FileClose } } eventmap MESSAGES: MLIST { MainMenu = "MessagesMain"; LocalMenu = "MessagesLocal"; key [C+C] { ChildClose } # does NOT kill, just closes pipe key [G-Home] { MoveLineStart } key [G-End] { MoveLineEnd } } # Event Map View eventmap EVENTMAPVIEW: MLIST { MainMenu = "EventMapViewMain"; LocalMenu = "EventMapViewLocal"; key [Esc] { FileClose 0 } } eventmap PLAIN: MODEL { # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [Esc] { BlockMarkStream; BlockUnmark } key [F2] { FileSave } key [S+F2] { FileSaveAs } key [A+S+F2] { FileSave; FileClose } key [S+F3] { FileReload; WinRefresh } key [C+F3] { FileOpenInMode } key [F7] { BlockBegin } key [S+F7] { MoveBlockStart } key [F8] { BlockEnd } key [S+F8] { MoveBlockEnd } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } # key [A+G-Left] { ScrollLeft } # key [A+G-Right] { ScrollRight } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } # key [A+G-S+Up] { BlockExtendBegin; ScrollUp; BlockExtendEnd } # key [A+G-S+Down] { BlockExtendBegin; ScrollDown; BlockExtendEnd } # key [A+G-S+Left] { BlockExtendBegin; ScrollLeft; BlockExtendEnd } # key [A+G-S+Right] { BlockExtendBegin; ScrollRight; BlockExtendEnd } key [A+G-C+Up] { MovePrevEqualIndent } key [A+G-C+Down] { MoveNextEqualIndent } # key [A+G-C+Left] { MovePrevTab } # key [A+G-C+Right] { MoveNextTab } key [C+G-Ins] { BlockCopy } key [C+G-Del] { BlockKill } key [S+G-Ins] { BlockPasteStream } key [S+G-Del] { BlockCut } key [A+G-Ins] { BlockPasteColumn } key [A+G-S+Ins] { BlockPasteLine } key [G-Enter] { LineNew } key [S-BackSp] { BackSpace } key [G-Ins] { ToggleInsert } key [G-Del] { Delete } key [Tab] { InsertTab } key [S+Tab] { InsertSpacesToTab 10 } key [C+Tab] { CompleteWord } # key [C+Tab] { InsertTab } key [C+BackSp] { KillWordPrev } key [C+S+BackSp] { KillToLineStart } key [C+G-Enter] { LineSplit } key [G-S+Enter] { LineInsert } key [A+G-Enter] { LineAdd } key [A+G-Del] { KillWord } key [A+G-End] { KillToLineEnd } key [A+BackSp] { Undo } key [A+S+BackSp] { Redo } key [C+C] { BlockCopy } key [C+V] { BlockPaste } key [C+X] { BlockCut } key [C+Z] { Undo } key [C+S+Z] { Redo } key [C+A_1] { GotoBookmark "1" } key [C+A_2] { GotoBookmark "2" } key [C+A_3] { GotoBookmark "3" } key [C+A_4] { GotoBookmark "4" } key [C+A_5] { GotoBookmark "5" } key [C+A_6] { GotoBookmark "6" } key [C+A_7] { GotoBookmark "7" } key [C+A_8] { GotoBookmark "8" } key [C+A_9] { GotoBookmark "9" } key [C+A_0] { GotoBookmark "0" } key [C+P_1] { PlaceBookmark "1" } key [C+P_2] { PlaceBookmark "2" } key [C+P_3] { PlaceBookmark "3" } key [C+P_4] { PlaceBookmark "4" } key [C+P_5] { PlaceBookmark "5" } key [C+P_6] { PlaceBookmark "6" } key [C+P_7] { PlaceBookmark "7" } key [C+P_8] { PlaceBookmark "8" } key [C+P_9] { PlaceBookmark "9" } key [C+P_0] { PlaceBookmark "0" } #key [C+C] { MoveToColumn } key [C+D] { LineDuplicate } key [C+F] { Find } key [C+G] { FindRepeat } key [C+I] { ListRoutines } key [C+J] { LineJoin } key [C+H] { FindRepeatReverse } key [C+M] { DirOpen } key [C+Q] { InsertChar } key [C+R] { FindReplace } key [C+T] { KillWord } key [C+Y] { KillLine } # key [C+E] { LineTrim } key [A+A] { BlockMarkStream } key [A+B] { MainMenu 'B' } key [A+C] { BlockCopy } key [A+D] { MainMenu 'D' } key [A+E] { MainMenu 'E' } key [A+G] { BlockCut } key [A+I] { BlockIndent } key [A+J] { MoveToLine } key [A+K] { BlockMarkColumn } key [A+L] { BlockMarkLine } key [A+O] { MainMenu 'O' } key [A+R] { WrapPara } # Reformat key [A+S] { MainMenu 'S' } key [A+U] { BlockUnindent } key [C+S] { IncrementalSearch } key [C+O_C+A] { ToggleAutoIndent } key [C+O_C+C] { ToggleMatchCase } key [C+O_C+E] { ToggleTrim } key [C+O_C+I] { ToggleInsert } key [C+O_C+M] { ShowMenu 'MChangeMode' } key [C+O_S-M] { ChangeMode } key [C+O_C+R] { ToggleReadOnly } key [C+O_C+S] { ToggleSysClipboard } key [C+O_C+T] { ChangeTabSize } key [C+O_C+U] { ToggleUndo } key [C+O_C+W] { ToggleWordWrap } key [C+O_C+V] { ShowMenu 'MCvs' } key [C+O_C+N] { ShowMenu 'MSvn' } key [C+O_.] { ToggleShowMarkers } key [C+O_[] { SetLeftMargin } # set margin to current cursor pos key [C+O_\]] { SetRightMargin } key [C+O_A+[] { ChangeLeftMargin } key [C+O_A+\]] { ChangeRightMargin } key [C+O_Tab] { ToggleShowTabs ; WinRefresh } key [C+O_C+Tab] { ToggleExpandTabs ; WinRefresh } key [C+O_G-Del] { ToggleDeleteKillTab } key [C+O_G-Ins] { ToggleInsert } key [C+O_BackSp] { ToggleBackSpKillTab } key [C+O_Space] { ToggleIndentWithTabs } key [C+O_C+BackSp] { ToggleBackSpUnindents } key [A+-] { MatchBracket } key [A+=] { HilitMatchBracket } key [C+Space] { InsPrevLineChar } key [A+Space] { InsPrevLineToEol } key [C+_] { ShowPosition } key [C+-] { ShowPosition } key [Center] { MoveLineCenter } #key [C+X] { MovePrevPos } key [C+S+A] { ASCIITable } # key [G+*] { LineInsert ; MoveUp; ScrollUp } key [A+G++] { FoldCreate } key [A+G+-] { FoldDestroy } key [G+S++] { FoldPromote } key [G+S+-] { FoldDemote } key [C+G++] { FoldOpen } key [C+G+-] { FoldClose } key [C+G+*] { FoldOpenNested } key [C+G+/] { FoldToggleOpenClose } key [A+G+*] { FoldOpenAll } key [A+G+/] { FoldCloseAll } # key [C+G-Up] { MoveFoldPrev } # key [C+G-Down] { MoveFoldNext } key [A+,] { SearchWordPrev } key [A+.] { SearchWordNext } key [A+/] { HilitWord } key [C+\]] { TagFindWord } key [C+S+\]] { TagFind } key [C+[] { TagPop } key [A+\]] { TagNext } key [A+[] { TagPrev } key [S+Tab] { InsertTab; LineTrim } key [A+\\] { BlockReIndent; } } efte-1.1/config/m_ipf.fte0000664000076400007640000006175611212414105014367 0ustar laurilauri# Alternate FTE mode for editing CSS files # maintained by alfredo@netropolis-si.com # # Standing issues: # # -Since FTE saves its folds as comments and IPFC only allows single-line # comments that must start with '.*' (which restricts useful values of # SaveFolds to 0 or 1), each line where a FTE text fold begins becomes # automatically a comment as a whole for IPFC and is therefore left out of the # final document. To prevent accidentally commenting lines out of the document # when creating text folds, a line break is appended at the end of each one. # However, this prevents FTE from recognizing those comments as its very own # text folds when the file is loaded again. So for now it's better not to save # folds at all -> FileClutterUponSave prevented :) # # Latest changes: # # Revision 2006/10/06 # # -Fixed mispelled keywords, and added '_' as attribute value legal char # # Revision 2006/09/13 # # -Minor changes to the entities <-> chars conv. table # -Slight reword of previous 'Standing issues' # # Revision 2006/09/03 (first public release) # # -Complete re-write of original m_ipf.fte # # -Decent syntax parsing: # -keywords are defined on a per state basis instead of globally, so only # relevant keywords are highlighted each time # -attribute/value states inside open tags # -non-closed tags, double colons (::) etc. analysis matches IPFC's as # closely as possible. # -More flexible routine definition: headers are allowed to have attributes # when defining a routine ;) # -Fixed a NASTY bug that makes me suspect no one actually tried IPF mode before: # comments are not translated to text and inserted into the doc anymore. # FileMessUponLoad prevented as well :) # -Changed SaveFolds from 1 to 0 because of the standing issue. # -Changed CommentEnd to "\r\n" to prevent accidentally commenting text parts # out of the doc # colorize IPF { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'String', 'Lang_String' }, { 'Symbol', 'Markup_Symbol' }, # Not needed anymore: all valid (known) tags are defined as keywords # { 'Tag', 'Markup_Tag' }, { 'Control', 'Markup_Control' }, # Alfredo's addition to colour space { 'Punctuation', 'Lang_Punctuation' }, { 'Comment', 'Lang_Comment' }, { 'Special', 'Editor_HilitWord' } }; # Now for the states machine & syntax parsing itself... # 0: Just entering the file - NOW WHAT? # Everything other than a comment or a ':userdoc.' tag should be wrong # but we'll just distinguish 'text' and 'tags' h_state 0 { 'Normal' } h_trans { 1, '-', ':', 'Normal' } # This could just open a tag, but NOT h_trans { 3, '<', '&', 'Symbol' } h_trans { 8, '^<', '.*', 'Comment' } h_trans { 7, '^<', '.', 'Control' } # 1: Trying to decide if we're inside a tag or not # At least no check is needed BEFORE the colon. # If followed by a space, a colon will be recognised by IPFC as normal # text; otherwise it is assumed to be opening a tag... h_state 1 { 'Normal' } # remember: the pointer wasn't advanced before getting here # -> we just drop out of tag mode or advance the pointer and get into it! h_trans { 0, '>', ': ', 'Normal' } h_trans { 0, '$>', ':', 'Normal' } # EOL considered harmful as a place to open tags :) h_trans { 2, '>', '::', 'Special' } # Warning the user, still get to 'tag' mode h_trans { 2, '>', ':', 'Punctuation' } # 2: We just got inside a tag # As soon as a space is found we go into attribute mode, so ": p." # is interpreted as 'no tag, attribute p' just as IPFC does h_state 2 { 'Special' } h_words 'Editor_Keywords' { # Structural, block-level tags: 'userdoc', 'euserdoc', 'title', 'docprof', 'ctrldef', 'ectrldef', 'ctrl', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'acviewport', #acviewport must follow a primary heading 'i1', 'i2', 'p', 'xmp', 'exmp', } h_words 'Editor_Keywords2' { # less important tags 'cgraphic', 'ecgraphic', 'artlink', 'eartlink', 'artwork', 'caution', 'ecaution', 'color', 'ddf', 'fig', 'efig', 'figcap', 'font', 'fn', 'efn', 'hp1', 'ehp1', 'hp2', 'ehp2', 'hp3', 'ehp3', 'hp4', 'ehp4', 'hp5', 'ehp5', 'hp6', 'ehp6', 'hp7', 'ehp7', 'hp8', 'ehp8', 'hp9', 'ehp9', 'hide', 'ehide', 'icmd', 'isyn', 'lines', 'elines', 'link', 'elink', 'lm', 'note', 'nt', 'ent', 'pbutton', 'rm', 'warning', 'ewarning', 'dl', 'edl', 'dthd', 'ddhd', 'dt', 'dd', 'li', 'lp', 'ol', 'eol', 'parml', 'eparml', 'pt', 'pd', 'sl', 'esl', 'table', 'etable', 'row', 'c', 'ul', 'eul', } h_wtype { 4, 4, 4, '', 'a-zA-Z0-9' } # one tag and go into attributes h_trans { 0, '>', '.', 'Tag' } # 3: entity definition - freestyle, we just check for the trailing . h_state 3 { 'Symbol' } h_trans { 0, '>', '.', 'Symbol' } h_trans { 0, '$', '', 'Normal' } # if the symbol is not closed before EOL, IPFC truncates it and reverts to 'normal' # 4: Attribute name - only keywords allowed here, so the default is 'Special' h_state 4 { 'Special' } h_words 'Editor_Keywords3' { # attribute names 'dll', 'objectname', 'objectinfo', 'objectid', 'vpx', 'vpy', 'vpcx', 'vpcy', 'name', 'align', 'linkfile', 'runin', 'fit', 'text', 'fc', 'bc', 'ctrlid', 'controls', 'page', 'coverpage', 'res', 'compact', 'tsize', 'break', 'toc', 'ctrlarea', 'facename', 'size', 'codepage', 'id', 'global', 'tutorial', 'x', 'y', 'width', 'height', 'group', 'viewport', 'clear', 'titlebar', 'scroll', 'rules', 'nosearch', 'noprint', 'hide', 'ctrlrefid', 'key', 'roots', 'sortkey', 'refid', 'root', 'reftype', 'database', 'object', 'data', 'auto', 'dependent', 'split', 'margin', 'break', 'cols', 'rules', 'frame', 'face', 'left', 'right', 'center', 'index', } h_wtype { -1, -1, -1, '', 'a-z' } h_trans { 9, '^<', '.*', 'Comment' } # comments work as usual h_trans { 5, '', ' =', 'Special' } # no spaces around '=' h_trans { 5, '', '=', 'Punctuation' } # go for attribute values h_trans { 0, '>', '.', 'Punctuation' } # This is still a substate of 'tags' so an . ends it # Now ':' is interpreted by IPFC as closing the current [malformed] tag # and opening a new one - won't people be so wicked ever? ;) h_trans { 0, '-', ':', 'Tag' } # 5: Attribute value: one free-style word or check for ' to go into string mode h_state 5 { 'Normal' } h_wtype { 4, 4, 4, '', 'a-zA-Z0-9%_' } h_trans { 6, '<', '\'', 'String' } # 6: Single-quote enclosed attribute values h_state 6 { 'String' } h_trans { 5, '>', '\'', 'String' } # 7: 'Strange' IPF control structures - only 4 keywords allowed h_state 7 { 'Special' } h_words 'Markup_Control' { 'br', 'ce', 'im', 'nameit' } h_wtype { 0, -1, 0, '', 'a-zA-Z' } h_trans { 0, '$', '', 'Comment' } # 8: Single-line comment, from 'text' mode h_state 8 { 'Comment' } h_trans { 0, '$', '', 'Comment' } # 9: Single-line comment, from 'inside tag -> atributes' mode h_state 9 { 'Comment' } h_trans { 4, '$', '', 'Comment' } } mode IPF: PLAIN { # .IPF files FileNameRx = /\.\cIPF$/; HilitOn = 1; Colorizer = 'IPF'; MultiLineHilit = 1; RoutineRegexp = ':[Hh][0-6].*\.'; SaveFolds = 0; # 1 = save fold info at beginning of line CommentStart = '.*'; CommentEnd = "\r\n"; } # IPF entities <-> plain text conversions sub IPF_ent_ascii { # ?FindReplace /&./ /&/ "agn" ; ?FindReplace /&and./ /^/ "agn" ; ?FindReplace /&apos./ /'/ "agn" ; ?FindReplace /&asterisk./ /*/ "agn" ; ?FindReplace /&atsign./ /@/ "agn" ; ?FindReplace /&bslash./ "\\" "agn" ; ?FindReplace /&bsl./ "\\" "agn" ; ?FindReplace /&bullet./ // "agn" ; ?FindReplace /&bul./ // "agn" ; ?FindReplace /&caret./ /^/ "agn" ; ?FindReplace /&cdq./ /"/ "agn" ; ?FindReplace /&csq./ /'/ "agn" ; ?FindReplace /&comma./ /,/ "agn" ; ?FindReplace /&colon./ /:/ "agn" ; ?FindReplace /&dash./ /-/ "agn" ; ?FindReplace /&dollar./ /$/ "agn" ; ?FindReplace /&darrow./ // "agn" ; ?FindReplace /&emdash./ /---/ "agn" ; ?FindReplace /&endash./ /--/ "agn" ; ?FindReplace /&eq./ /=/ "agn" ; ?FindReplace /&equals./ /=/ "agn" ; ?FindReplace /&eqsym./ /=/ "agn" ; ?FindReplace /&xclm./ /!/ "agn" ; ?FindReplace /&xclam./ /!/ "agn" ; ?FindReplace /&grave./ /`/ "agn" ; ?FindReplace />./ />/ "agn" ; ?FindReplace />sym./ />/ "agn" ; ?FindReplace /&house./ // "agn" ; ?FindReplace /&hyphen./ /-/ "agn" ; ?FindReplace /&inve./ // "agn" ; ?FindReplace /&invq./ // "agn" ; ?FindReplace /&larrow./ // "agn" ; ?FindReplace /&lahead./ // "agn" ; ?FindReplace /&lbrace./ /{/ "agn" ; ?FindReplace /&lbrc./ /{/ "agn" ; ?FindReplace /&lbracket./ /[/ "agn" ; ?FindReplace /&lbrk./ /[/ "agn" ; ?FindReplace /&lpar./ /(/ "agn" ; ?FindReplace /&lparen./ /(/ "agn" ; ?FindReplace /<./ // />./ "agn" ; ?FindReplace // /&house./ "agn" ; # ?FindReplace /-/ /&hyphen./ "agn" ; ?FindReplace // /&larrow./ "agn" ; ?FindReplace /{/ /&lbrc./ "agn" ; ?FindReplace /[/ /&lbrk./ "agn" ; ?FindReplace /(/ /&lpar./ "agn" ; ?FindReplace /', '|||||||', 'Control' } h_trans { 3, '^>', '=======', 'Control' } h_state 2 { 'Old' } h_trans { 3, '^>', '=======', 'Control' } h_state 3 { 'New' } h_trans { 0, '^>', '>>>>>>>', 'Control' } } mode MERGE: PLAIN { # unix/gnu rscmerge FileNameRx = /\.\cMRG$/; HilitOn = 1; Colorizer = 'MERGE'; MultiLineHilit = 0; } oinclude 'mym_merge.fte'; efte-1.1/config/m_java.fte0000664000076400007640000000455111157534024014533 0ustar laurilauri sub JAVA_Base { MoveFileStart; InsertString "package /* package name */;"; 2:LineNew; InsertString "import java.util.*;"; LineNew; InsertString "import javax.swing.*;"; 2:LineNew; InsertString "public class "; InsertString $FileBaseName; LineNew; InsertString "{"; LineIndent; 2:LineNew; InsertString "public "; InsertString $FileBaseName; InsertString "()"; LineIndent; LineNew; InsertString "{"; LineIndent; 2:LineNew; InsertString "}"; LineIndent; 2:LineNew; InsertString "}"; LineIndent; LineNew; MoveFileStart; 8:MoveRight; } colorize JAVA { SyntaxParser = 'C'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'abstract', 'default', 'goto', 'null', 'synchronized', 'boolean', 'do', 'if', 'package', 'this', 'break', 'double', 'implements', 'private', 'threadsafe', 'byte', 'else', 'import', 'protected', 'throw', 'byvalue', 'extends', 'instanceof', 'public', 'transient', 'case', 'false', 'int', 'return', 'true', 'catch', 'final', 'interface', 'short', 'try', 'char', 'finally', 'long', 'static', 'void', 'class', 'float', 'native', 'super', 'while', 'const', 'for', 'new', 'switch', 'continue', 'throws' }; } mode JAVA: SOURCE { # JAVA Mode FileNameRx = /\.\c{JAVA}$/; HilitOn = 1; Colorizer = 'JAVA'; AutoIndent = 1; IndentMode = 'C'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /^\s*\w[\w._]+{\s+[\w._]+}+[\w_]+\s*\([^;]*$/; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; } oinclude 'mym_java.fte'; efte-1.1/config/m_diff.fte0000664000076400007640000000207311157534024014517 0ustar laurilauricolorize DIFF { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Old', 'DIFF_Old' }, { 'New', 'DIFF_New' }, { 'Changed', 'DIFF_Changed' }, { 'CPreprocessor', 'Lang_Preprocessor' }, }; h_state 0 { 'Normal' } h_trans { 1, '^', 'New' } h_trans { 2, '^ h_trans { 4, '^<', '@@', 'CPreprocessor' } h_state 1 { 'New' } h_trans { 0, '$', '', 'Normal' } h_state 2 { 'Old' } h_trans { 0, '$', '', 'Normal' } h_state 3 { 'Changed' } h_trans { 0, '$', '', 'Normal' } # just to mark the hunk boundaries (unified diff) h_state 4 { 'CPreprocessor' } h_trans { 0, '$', '', 'Normal' } } mode DIFF: PLAIN { # unix/gnu diff FileNameRx = /\.\c{{DIFF?}|{D?PATCH}}$/; FirstLineRx = /^diff /; HilitOn = 1; Colorizer = 'DIFF'; MultiLineHilit = 0; } oinclude 'mym_diff.fte'; efte-1.1/config/ui_brief.fte0000664000076400007640000000045411157534024015060 0ustar laurilauri# Brief (work in progress) include 'ui_m_fte.fte'; # TODO include 'k_brief.fte'; # incomplete include 'menu/m_c.fte'; include 'menu/m_html.fte'; include 'kbd/k_c.fte'; include 'kbd/k_java.fte'; include 'kbd/k_perl.fte'; include 'kbd/k_rexx.fte'; include 'kbd/k_fte.fte'; include 'kbd/k_html.fte'; efte-1.1/config/ui_m_ws.fte0000664000076400007640000003315711157534024014744 0ustar laurilauri# Basic Commands (Global) menu MOpenInMode { item "&Plain" { FileOpenInMode 'PLAIN' } item "&Text" { FileOpenInMode 'TEXT' } item "&C" { FileOpenInMode 'C' } item "&EMail" { FileOpenInMode 'MSG' } item "&HTML" { FileOpenInMode 'HTML' } item "&IPF" { FileOpenInMode 'IPF' } item "&Ada" { FileOpenInMode 'Ada' } item "&REXX" { FileOpenInMode 'REXX' } item "MAKE" { FileOpenInMode 'MAKE' } item "&FTE" { FileOpenInMode 'FTE' } item "Resource" { FileOpenInMode 'RESOURCE' } item "&DIFF" { FileOpenInMode 'DIFF' } item "&MERGE" { FileOpenInMode 'MERGE' } item "&SH" { FileOpenInMode 'SH' } item "PER&L" { FileOpenInMode 'PERL' } item "PASCAL" { FileOpenInMode 'PASCAL' } item "&JAVA" { FileOpenInMode 'JAVA' } item "TE&X" { FileOpenInMode 'TEX' } item "&BIN" { FileOpenInMode 'BIN' } } menu Object { item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; item "Open &Binary" { FileOpenInMode 'BIN' } item; item "Open &Directory\tC+M" { DirOpen } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu MCvs { item "CVS C&heck" { RunCvs "-n update" } item "CVS &Update" { RunCvs "update -d" } item "CVS &Diff" { CvsDiff "" } item "CVS &Commit" { RunCvsCommit "" } item "CVS &Add" { RunCvs "add" } item "CVS &Remove" { RunCvs "remove" } item "CVS S&tatus" { RunCvs "status -v" } item "CV&S" { Cvs } item; item "&View CVS" { ViewCvs } item "View CVS Di&ff" { ViewCvsDiff } item "View CVS &log" { ViewCvsLog } item; item "Cl&ear CVS messages" { ClearCvsMessages } } menu MSvn { item "SVN C&heck" { RunSvn "-n update" } item "SVN &Update" { RunSvn "update -d" } item "SVN &Diff" { SvnDiff "" } item "SVN &Commit" { RunSvnCommit "" } item "SVN &Add" { RunSvn "add" } item "SVN &Remove" { RunSvn "remove" } item "SVN S&tatus" { RunSvn "status -v" } item "SV&N" { Svn } item; item "&View SVN" { ViewSvn } item "View SVN Di&ff" { ViewSvnDiff } item "View SVN &log" { ViewSvnLog } item; item "Cl&ear SVN messages" { ClearSvnMessages } } menu Tools { item "&Compile\tF9" { Compile "make -k " } item "&Grep" { Compile "grep -n " } item; item "Sh&ell\tAlt+F9" { RunProgram "" } item; item "Go to prev &error\tF11" { CompilePrevError } item "Go to &next error\tF12" { CompileNextError } item; item "&Messages\tS+F9" { ViewMessages } item; submenu "C&VS\tC+O_C+V", MCvs; submenu "SV&N\tC+O_C+N", MSvn; } menu Window { # item "&New " { WinNewFrame } # item; item "Split &Horizontal\tCtrl+F4" { WinHSplit } item "&Close view\tCtrl+Alt+F4" { WinClose } item "Close &other views\tF5" { WinZoom } item; item "Sa&ve Desktop" { DesktopSave } item "Save Desktop &As" { DesktopSaveAs } item; item "&Routines\tCtrl+I" { ListRoutines } item "&Buffers\tAlt+0" { ViewBuffers } item "&Directory\tC+M" { DirOpen } # item "&Shell" { } } menu Help { item "&Keyboard\tF1" { ViewModeMap } item "&Show key" { ShowKey } item; item "&About..." { ShowVersion } } # Directory Browser menu Directory { item "&Reload\tCtrl+R" { Rescan } item "&Close\tCtrl+F10" { FileClose } item; item "&Open file...\tF3" { FileOpen } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu Navigate { item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } item "&/ Goto Dir\t/" { DirGoto } item "&Delete File\tCtrl+D" { DeleteFile } item; item '&A:\\' { DirGoto 'A:\\' } item '&B:\\' { DirGoto 'B:\\' } item '&C:\\' { DirGoto 'C:\\' } item '&D:\\' { DirGoto 'D:\\' } item '&E:\\' { DirGoto 'E:\\' } item '&F:\\' { DirGoto 'F:\\' } item '&G:\\' { DirGoto 'G:\\' } item '&H:\\' { DirGoto 'H:\\' } item '&I:\\' { DirGoto 'I:\\' } } # Message List menu Messages { item "&Close\tCtrl+F10" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu MsgMain { submenu "&Messages", Messages; submenu "&Tools", Tools; submenu "&Window", Window; } menu MChangeMode { item "&Plain" { ChangeMode 'PLAIN' } item "&Text" { ChangeMode 'TEXT' } item "&C" { ChangeMode 'C' } item "&EMail" { ChangeMode 'MSG' } item "&HTML" { ChangeMode 'HTML' } item "&IPF" { ChangeMode 'IPF' } item "&Ada" { ChangeMode 'Ada' } item "&REXX" { ChangeMode 'REXX' } item "MAKE" { ChangeMode 'MAKE' } item "&FTE" { ChangeMode 'FTE' } item "Resource" { ChangeMode 'RESOURCE' } item "&DIFF" { ChangeMode 'DIFF' } item "&MERGE" { ChangeMode 'MERGE' } item "&SH" { ChangeMode 'SH' } item "PER&L" { ChangeMode 'PERL' } item "PASCAL" { ChangeMode 'PASCAL' } item "&JAVA" { ChangeMode 'JAVA' } item "TE&X" { ChangeMode 'TEX' } item "&BIN" { ChangeMode 'BIN' } } menu File { item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; # item "Open &Binary" { FileOpenInMode 'BIN' } item "&Reload\tShift+F3" { FileReload } item "&Save\tF2" { FileSave } item "Save &As...\tShift+F2" { FileSaveAs } item "Save Al&l\tCtrl+F2" { FileSaveAll } item "Write &To..." { FileWriteTo } # item "Sa&ve and Close\tAlt+F2" { FileSave; FileClose } item "Prin&t" { FilePrint } item "&Close\tCtrl+F10" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu Edit { item "&Undo\tAlt+BackSp" { Undo } item "&Redo\tAlt+Shift+BackSp" { Redo } item; item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; # item "&Insert line\tShift+Enter" { LineInsert } item "&Delete line\tCtrl+Y" { KillLine } item "&Split line\tCtrl+N" { LineSplit } item "&Join line\tCtrl+J" { LineJoin } # item "Dup&licate line\tCtrl+D" { LineDuplicate } # item "Delete to line &end\tAlt+End" { KillToLineEnd } # item "Delete to li&ne start\tCtrl+Shift+BackSp" { KillToLineStart } item; item "&Quote Literal...\tCtrl+Q" { InsertChar } item "&ASCII Table...\tCtrl+Shift+A" { ASCIITable } } menu Translate { item "&Uppercase" { BlockCaseUp } item "&Lowercase" { BlockCaseDown } item "&Togglecase" { BlockCaseToggle } item "&Rot13" { BlockTrans 'A-Za-z' 'N-ZA-Mn-za-m' } item; item "User &specified..." { BlockTrans } } menu Block { item "&Unmark\tEsc" { BlockUnmark } item "Mark &Line\tAlt+L" { BlockMarkLine } item "Mark &Stream\tAlt+A" { BlockMarkStream } item "Mark &Column\tAlt+K" { BlockMarkColumn } item; # item "Select Wor&d" { BlockSelectWord } # item "Selec&t Line" { BlockSelectLine } # item; item "&Indent\tAlt+I" { BlockIndent } item "U&nindent\tAlt+U" { BlockUnindent } item; item "&Write..." { BlockWrite } item "&Read..." { BlockRead } item "&Print" { BlockPrint } item; submenu "Translat&e", Translate; } menu Search { item "&Find...\tCtrl+Q Ctrl+W" { Find } item "Find and &replace...\tCtrl+Q Ctrl+A" { FindReplace } item "Repeat &Last find\tCtrl+L" { FindRepeat } item "Repeat last find re&verse" { FindRepeatReverse } item "Repeat last find &once" { FindRepeatOnce } item "Incremental &search\tCtrl+Q Tab" { IncrementalSearch } item; item "&Place Bookmark..." { PlaceBookmark } item "Goto &Bookmark..." { GotoBookmark } item; item "&Match paren\tCtrl+Q Ctrl+[" { MatchBracket } item "&Goto line...\tCtrl+Q Ctrl+J" { MoveToLine } } menu Fold { item "&Create fold\tAlt+Gray++" { FoldCreate } item "Create folds by ®exp..." { FoldCreateByRegexp } item "&Destroy fold\tAlt+Gray+-" { FoldDestroy } item; item "&Open fold\tCtrl+Gray++" { FoldOpen } item "Open &nested folds\tCtrl+Gray+*" { FoldOpenNested } item "C&lose fold\tCtrl+Gray+-" { FoldClose } item "&Toggle fold open/close\tCtrl+Gray+/" { FoldToggleOpenClose } item; item "&Promote fold\tShift+Gray+-" { FoldPromote } item "De&mote fold\tShift+Gray++" { FoldDemote } item; item "Open &all folds\tAlt+Gray+*" { FoldOpenAll } item "Close all &folds\tAlt+Gray+/" { FoldCloseAll } item "Destro&y all folds" { FoldDestroyAll } } menu Options { submenu "Change &mode\tC+O C+M", MChangeMode; item; item "&Insert mode\tC+O C+I" { ToggleInsert } item "&Auto indent\tC+O C+A" { ToggleAutoIndent } item "&Case sensitive\tC+O C+C" { ToggleMatchCase } item "Trim &EOL spaces\tC+O C+E" { ToggleTrim } item "&Read only\tC+O C+R" { ToggleReadOnly } item "&Undo/Redo\tC+O C+U" { ToggleUndo } item "&Show markers\tC+O C+." { ToggleShowMarkers; WinRefresh } item "Highlight tags" { ToggleHilitTags; WinRefresh } item "Show &bookmarks" { ToggleShowBookmarks; WinRefresh } item; item "&Word wrap\tC+O C+W" { ToggleWordWrap } item "&Left margin...\tC+O A+[" { ChangeLeftMargin } item "Ri&ght margin...\tC+O A+]" { ChangeRightMargin } item; item "&Tab size...\tC+O C+T" { ChangeTabSize; WinRefresh } item "S&how tabs\tC+O Tab" { ToggleShowTabs; WinRefresh } item "E&xpand tabs\tC+O C+Tab" { ToggleExpandTabs; WinRefresh } item "&Print to... " { SetPrintDevice } } menu Main { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } menu Local { item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tC+F10" { FileClose } } menu DirectoryFile { item "&Selected\tEnter" { Activate } item; item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; item "Open &Binary" { FileOpenInMode 'BIN' } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu DirectoryMain { submenu "&File", DirectoryFile; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu MessagesMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu RoutinesMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu BufferListMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu EventMapViewMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu DirectoryLocal { item "&Open" { Activate } item; item "&Reload\tCtrl+R" { Rescan } item; item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } item "&/ Goto Dir\t/" { DirGoto } } menu BufferListLocal { item "&View\tEnter" { Activate } item; item "&Save\tCtrl+S" { BufListFileSave } item "&Close\tCtrl+C" { BufListFileClose } } menu RoutinesLocal { item "&View\tEnter" { Activate } } menu EventMapViewLocal { item "&Close view\tAlt+Q" { FileClose } } menu MessagesLocal { item "&View error\tEnter" { Activate } item; item "&Previous error\tF11" { CompilePrevError } item "&Next error\tF12" { CompileNextError } } efte-1.1/config/m_lisaac.fte0000664000076400007640000000433511163156165015051 0ustar laurilauri# # eFTE mode for Lisaac (http://isaacproject.u-strasbg.fr) # colorize LISAAC { SyntaxParser = "SIMPLE"; color { { "Normal", "Editor_Default" }, { "Function", "Lang_Function" }, { "Number", "Lang_DecimalNumber" }, { "Comment", "Lang_Comment" }, { "String", "Lang_String" }, { "Punctuation", "Lang_Punctuation" }, }; keyword "Editor_Keywords" { "by", "do", "downto", "else", "elseif", "if", "if_false", "if_true", "or", "self", "shrink", "then", "to", "when", "while", "while_do" }; keyword "Editor_Keywords2" { "Expanded", "Header", "Inherit", "Insert", "Interrupt", "Left", "Mapping", "Old", "Private", "Public", "Right", "Section", "Self", "Strict" }; h_state 0 { "Normal" } h_trans { 1, "-s", "_a-z", "Normal" } h_trans { 2, "<", "//", "Comment" } h_trans { 3, "<", "/*", "Comment" } h_trans { 4, "", "\"", "String" } h_trans { 5, "", "'", "String" } h_trans { 6, "", "*/", "Comment" } h_state 4 { "String" } h_trans { 0, "", "\"", "String" } h_trans { 0, "$", "", "String" } h_trans { 4, "Qq", "\\", "String" } h_state 5 { "String" } h_trans { 0, "", "'", "String" } h_trans { 0, "$", "", "String" } h_trans { 5, "Qq", "\\", "String" } h_state 6 { "Number" } h_trans { 0, "-S", "0-9", "Normal" } h_trans { 0, "$", "", "Normal" } h_state 7 { "Function" } h_trans { 0, "-S", "A-Z", "Normal" } } mode LISAAC: SOURCE { FileNameRx = /\c\.li/; HilitOn = 1; Colorizer = "LISAAC"; AutoIndent = 1; IndentMode = "PLAIN"; MatchCase = 1; MultiLineHilit = 1; AutoHilitParen = 1; } oinclude "mym_lisaac.fte";efte-1.1/config/color.fte0000664000076400007640000000443011157534024014410 0ustar laurilauriobject ScrollBar { color { { 'Arrows', 'ScrollBar_Arrows' }, { 'Back', 'ScrollBar_Background' }, { 'Fore', 'ScrollBar_Slider' }, }; } object Status { color { { 'Normal', 'Status_Normal' }, { 'Active', 'Status_Active' }, }; } object Message { color { { 'Normal', 'Message_Normal' }, { 'Bold', 'Message_Bold' }, { 'Error', 'Message_Error' }, }; } object Entry { color { { 'Field', 'EntryField_Field' }, { 'Prompt', 'EntryField_Prompt' }, { 'Selection', 'EntryField_Selection' }, }; } object LIST { color { { 'Status', 'List_Status' }, { 'Normal', 'List_Normal' }, { 'Selected', 'List_Selected' }, { 'Hilited', 'List_Hilited' }, { 'HilitSelect', 'List_HilitSelect' }, { 'Marked', 'List_Marked' }, { 'MarkSelect', 'List_MarkSelect' }, { 'MarkHilit', 'List_MarkHilit' }, { 'MarkHilitSel', 'List_MarkHilitSel' }, }; } object ASCII { color { { 'Chars', 'ASCII_Chars' }, }; } object Menu { color { { 'Background', 'Menu_Background' }, { 'ActiveItem', 'Menu_ActiveItem' }, { 'ActiveChar', 'Menu_ActiveChar' }, { 'NormalItem', 'Menu_NormalItem' }, { 'NormalChar', 'Menu_NormalChar' }, }; } object Choice { color { { "Title", 'Choice_Title' }, { "Param", 'Choice_Param' }, { "Background", 'Choice_Background' }, { "ActiveItem", 'Choice_ActiveItem' }, { "ActiveChar", 'Choice_ActiveChar' }, { "NormalItem", 'Choice_NormalItem' }, { "NormalChar", 'Choice_NormalChar' }, }; } object PLAIN { color { { 'Background', 'Editor_Default' }, { 'Selected', 'Editor_Selected' }, { 'Markers', 'Editor_Markers' }, { 'Found', 'Editor_FoundText' }, { 'Keyword', 'Editor_Keywords' }, { 'Folds0', 'Editor_Folds0' }, { 'Folds1', 'Editor_Folds1' }, { 'Folds2', 'Editor_Folds2' }, { 'Folds3', 'Editor_Folds3' }, { 'Folds4', 'Editor_Folds4' }, { 'HilitWord', 'Editor_HilitWord' }, }; } efte-1.1/config/m_xslt.fte0000664000076400007640000003113011157534024014575 0ustar laurilauri# FTE mode for editing XSLT files # created by Philippe Kirsanov # philippe@mail333.com # http://members.shaw.ca/phwp71/IT/ # Revision October 03, 2003 # XML+XSLT declaration sub XSLT_Base { MoveFileStart; MoveLineStart; InsertString ""; LineNew; InsertString ""; LineNew; InsertString ""; LineNew; InsertString ""; 2:LineNew; 4:MoveLeft; LineNew; InsertString ""; LineNew; 2:MoveUp; MoveLineStart; } sub XSLT_Template { InsertString ""; LineNew; InsertString "<\/xsl:template>"; LineNew; 2:MoveUp; MoveLineEnd; 10:MoveLeft; } sub XSLT_Param { InsertString ""; LineNew; 1:MoveUp; MoveLineEnd; 4:MoveLeft; } sub XSLT_Variable { InsertString ""; LineNew; 1:MoveUp; MoveLineEnd; 14:MoveLeft; } sub XSLT_ApplyTemplate { InsertString ""; LineNew; 4:MoveRight; InsertString ""; LineNew; InsertString ""; LineNew; 4:MoveLeft; InsertString ""; LineNew; 4:MoveUp; MoveLineEnd; 10:MoveLeft; } sub XSLT_CallTemaplate { InsertString ""; LineNew; 4:MoveRight; InsertString ""; LineNew; 4:MoveLeft; InsertString ""; LineNew; 3:MoveUp; MoveLineEnd; 2:MoveLeft; } sub XSLT_If { InsertString ""; LineNew; InsertString ""; LineNew; 2:MoveUp; MoveLineEnd; 2:MoveLeft; } sub XSLT_CopyOf { InsertString ""; LineNew; 1:MoveUp; MoveLineEnd; 4:MoveLeft; } sub XSLT_Copy { InsertString ""; LineNew; InsertString ""; LineNew; 2:MoveUp; MoveLineEnd; 2:MoveLeft; } sub XSLT_ValueOf { InsertString ""; LineNew; 1:MoveUp; MoveLineEnd; 33:MoveLeft; } sub XSLT_Text { InsertString ""; InsertString ""; LineNew; 1:MoveUp; MoveLineEnd; 11:MoveLeft; } sub XSLT_ForEach { InsertString ""; LineNew; InsertString ""; LineNew; 2:MoveUp; MoveLineEnd; 2:MoveLeft; } sub XSLT_Choose { InsertString ""; LineNew; 4:MoveRight; InsertString ""; LineNew; InsertString ""; LineNew; InsertString ""; LineNew; InsertString ""; LineNew; 4:MoveLeft; InsertString ""; LineNew; 5:MoveUp; MoveLineEnd; 2:MoveLeft; } sub XSLT_Key { InsertString ""; LineNew; 1:MoveUp; MoveLineStart; 15:MoveRight; } sub XSLT_Sort { InsertString ""; LineNew; 1:MoveUp; MoveLineStart; 18:MoveRight; } colorize XSLT { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Command', 'Markup_Punctuation' }, { 'String', 'Markup_String' }, { 'Symbol', 'Markup_Control' }, { 'Tag', 'Markup_Tag' }, { 'Comment', 'Markup_Comment' }, { 'Directive', 'Markup_Symbol' }, { 'Special', 'Markup_Special' }, { 'Variable', 'Lang_Variable' }, { 'Keyword', 'Editor_Keywords' }, }; keyword "Editor_Keywords" { # HTML 4.0 keywords "a", "abbr", "acronym", "address", "area", "b", "base", "bdo", "big", "blockquote", "body", "br", "button", "caption", "cite", "code", "col", "colgroup", "dd", "del", "dfn", "div", "dl", "dt", "em", "fieldset", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "map", "meta", "noframes", "noscript", "object", "ol", "optgroup", "option", "p", "param", "pre", "q", "samp", "script", "select", "small", "span", "strong", "style", "sub", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "title", "tr", "tt", "ul", "var" }; keyword "Editor_Keywords2" { # Secondary keywords "above", "absbottom", "action", "align", "alink", "all", "alt", "auto", "background", "baseline", "below", "bgcolor", "border", "bordercolor", "bottom", "box", "button", "cellpadding", "cellspacing", "center", "checkbox", "checked", "circle", "class", "clear", "codebase", "color", "cols", "colspan", "compact", "coords", "datetime", "default", "dir", "disc", "enctype", "face", "file", "for", "frame", "frameborder", "get", "groups", "height", "hidden", "href", "hsides", "hspace", "image", "ismap", "justify", "label", "language", "left", "lhs", "link", "ltr", "mailto", "marginheight", "marginwidth", "maxlength", "method", "middle", "multiple", "name", "no", "nohref", "none", "noresize", "noshade", "nowrap", "onclick", "onmouseout", "onmouseover", "param", "password", "poly", "post", "prompt", "public", "radio", "rect", "rel", "reset", "rev", "rhs", "right", "rows", "rowspan", "rtl", "rules", "scrolling", "selected", "shape", "size", "square", "src", "start", "subject", "submit", "target", "text", "top", "type", "usemap", "valign", "value", "vlink", "void", "vsides", "vspace", "width", "yes", "_blank", "_parent", "_self", "_top", "id" }; keyword "Editor_Keywords5" { # Deprecated in HTML 4.01 "basefont", "font", "s", "strike", "u", "applet", "dir", "isindex", "menu" }; h_state 0 { 'Normal' } h_trans { 10, '<', '', '>', 'Command' } # End h_trans { 3, '<', '\'', 'String' } # String h_trans { 4, '<', '"', 'String' } # String h_trans { 7, '<', '?>', 'Special' } # Begin h_wtype { -1, -1, -1, 'i', 'a-zA-Z0-9_\-' } # Tag Text # Entity h_state 2 { 'Symbol' } h_trans { 0, '>', ';', 'Symbol' } # End h_trans { 0, '-S', '#a-zA-Z0-9', 'Symbol' } # Entity Text # String h_state 3 { 'String' } h_trans { 8, '<', '&', 'Symbol' } # Entity h_trans { 1, '>', '\'', 'String' } # End # String h_state 4 { 'String' } h_trans { 9, '<', '&', 'Symbol' } # Entity h_trans { 1, '>', '"', 'String' } # End # Format Comment End Symbols h_state 5 { 'Comment' } h_trans { 6, '>', '--', 'Comment' } # End (Symbols) h_state 6 { 'Special' } h_trans { 5, '>', '--', 'Comment' } # Format Comment End Symbols h_trans { 0, '>', '>', 'Comment' } # End # Processing Instructions h_state 7 { 'Special' } h_trans { 1, '-S', '', 'Special' } # End # Entity h_state 8 { 'Symbol' } h_trans { 3, '>', ';', 'Symbol' } # End h_trans { 3, '-S', '#a-zA-Z0-9', 'Symbol' } # Entity Text # Entity h_state 9 { 'Symbol' } h_trans { 4, '>', ';', 'Symbol' } # End h_trans { 4, '-S', '#a-zA-Z0-9', 'Symbol' } # Entity Text # XSLT tags h_state 10 { 'Special' } h_wtype { -1, 15, 15, '', 'a-z\-' } # Tags h_words 'Markup_Symbol' { 'apply-imports', 'apply-templates', 'attribute', 'attribute-set', 'call-template', 'choose', 'comment', 'copy', 'copy-of', 'decimal-format', 'element', 'fallback', 'for-each', 'if', 'import', 'include', 'key', 'message', 'namespace-alias', 'number', 'otherwise', 'output', 'param', 'preserve-space', 'processing-instruction', 'sort', 'strip-space', 'stylesheet', 'template', 'text', 'transform', 'value-of', 'variable', 'when', 'with-param' } # String inside XSLT tag h_state 11 { 'String' } h_trans { 13, '<', '&', 'Symbol' } # Entity h_trans { 16, '<', '$', 'Variable' } # Variable h_trans { 11, 's', ':.*|@[]()', 'Tag' } # Special Symbols h_trans { 15, '>', '\'', 'String' } # End of String # String inside XSLT tag h_state 12 { 'String' } h_trans { 14, '<', '&', 'Symbol' } # Entity h_trans { 17, '<', '$', 'Variable' } # Variable h_trans { 12, 's', ':.*|@[]()', 'Tag' } # Special Symbols h_trans { 15, '>', '"', 'String' } # End of String # Entity h_state 13 { 'Symbol' } h_trans { 11, '>', ';', 'Symbol' } # End of Entity h_trans { 11, '-S', '#a-zA-Z0-9', 'Symbol' }# Entity Text # Entity h_state 14 { 'Symbol' } h_trans { 12, '>', ';', 'Symbol' } # End of Entity h_trans { 12, '-S', '#a-zA-Z0-9', 'Symbol' }# Entity Text # Process XSLT tag h_state 15 { 'Command' } h_trans { 0, '>', '>', 'Directive' } # End of Tag h_trans { 11, '<', '\'', 'String' } # String h_trans { 12, '<', '"', 'String' } # String h_trans { 19, '<', 'xmlns:', 'Keyword' } # Namespace h_wtype { -1, -1, -1, '', 'a-z\-' } # Tags # h_words 'Markup_Control' { # XSLT attributes h_words 'Markup_Symbol' { 'test', 'select', 'mode', 'name', 'namespace', 'use-attribute-sets', 'decimal-separator', 'grouping-separator', 'infinity', 'minus-sign', 'NaN', 'percent', 'per-mille', 'zero-digit', 'digit', 'pattern-separator', 'href', 'match', 'use', 'terminate', 'stylesheet-prefix', 'result-prefix', 'level', 'count', 'from', 'value', 'format', 'lang', 'letter-value', 'grouping-size', 'method', 'version', 'encoding', 'omit-xml-declaration', 'standalone', 'doctype-public', 'doctype-system', 'cdata-section-elements', 'indent', 'media-type', 'elements', 'data-type', 'order', 'case-order', 'id', 'extension-element-prefixes', 'exclude-result-prefixes', 'priority', 'disable-output-escaping' } # Variable h_state 16 { 'Variable' } h_trans { 11, '-S', 'a-zA-Z0-9_\$', 'Variable' } # Variable h_state 17 { 'Variable' } h_trans { 12, '-S', 'a-zA-Z0-9_\$', 'Variable' } # CDATA h_state 18 { 'String' } h_trans { 0, '<', ']]>', 'Keyword' } # >>> Namespace h_state 19 { 'Special' } h_trans { 15, '>', '=', 'Command' } # End of Namespace h_trans { 20, '-s', 'a-z\_', 'Tag' } # First qname is azure h_state 20 { 'Tag' } h_wtype { -1, 21, 21, '', 'a-z0-9\-\_' } # Second qname must be red h_state 21 { 'Special' } h_trans { 15, '>', '=', 'Command' } # <<< Namespace } mode XSLT: HTML { FileNameRx = /\.\c{{XSLT?}|{XML}|{XDR}|{WSC}}$/; TabSize = 4; SpaceTabs = 0; ShowTabs = 1; HilitOn = 1; Colorizer = "XSLT"; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /\', '>', 'Command' } h_trans { 3, '<', '\'', 'String' } h_trans { 4, '<', '"', 'String' } h_trans { 8, '>', '/', 'Command' } h_wtype { -1, -1, -1, 'i', 'a-zA-Z0-9_\-' } h_state 2 { 'Symbol' } h_trans { 0, '>', ';', 'Symbol' } h_trans { 0, '-S', '#a-zA-Z0-9', 'Symbol' } h_state 3 { 'String' } h_trans { 1, '>', '\'', 'String' } h_state 4 { 'String' } h_trans { 1, '>', '"', 'String' } h_state 5 { 'Comment' } h_trans { 6, '>', '--', 'Comment' } h_state 6 { 'Special' } h_trans { 5, '>', '--', 'Comment' } h_trans { 0, '>', '>', 'Comment' } h_state 7 { 'Command' } h_trans { 0, '>', '>', 'Command' } h_trans { 3, '<', '\'', 'String' } h_trans { 4, '<', '"', 'String' } h_wtype { -1, -1, -1, 'i', 'a-zA-Z0-9_\-' } h_state 8 { 'Tag' } h_trans { 0, '>', '/', 'Command' } } mode LDSGML: MARKUP { FileNameRx = /\.\c{SGML?}$/; HilitOn = 1; Colorizer = "LDSGML"; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /\c\/; SaveFolds = 2; # save fold info at end of line CommentStart = " "; } oinclude 'mym_ldsgml.fte'; efte-1.1/config/m_basic.fte0000664000076400007640000000560411157534024014673 0ustar laurilauri# # eFTE mode for Basic # build from docs on FreeBasic (http://www.freebasic.net) # colorize BASIC { SyntaxParser = "SIMPLE"; color { { "Normal", "Editor_Default" }, { "Function", "Lang_Function" }, { "Number", "Lang_DecimalNumber" }, { "Comment", "Lang_Comment" }, { "String", "Lang_String" }, { "Punctuation", "Lang_Punctuation" }, }; keyword "Editor_Keywords" { # Generic "with", # Variable Declarations "dim", "const", "scope", "static", "shared", "var", # User defined types "enum", "type", "union", "field", "constructor", "deconstructor", "function", "operator", "property", "sub", "static", "const", # Control flow statements "goto", "gosub", "on", "return", "if", "end", "else", "select", "case", "exit", "while", "wend", "for", "next", "do", "loop", "continue", "then", # Procedures "declare", "overload", "alias", "export", "lib", "byref", "byval", "any", "VA_FIRST", "VA_ARG", "VA_NEXT", "call", "stdcall", "cdecl", "pascal", "as", # Modularizing "common", "dylibfree", "dylibload", "dylibsymbol", "extern", "import", "namespace", "using", # Error Handling "error" }; keyword "Editor_Keywords2" { "this", "public", "private", "protected" }; keyword "Editor_Keywords3" { # Operators "let", "mod", "and", "eqv", "imp", "or", "xor", "shl", "shr", "not", "andalso", "orelse", "strptr", "varptr", "procptr", "new", "delete" }; h_state 0 { "Normal" } h_trans { 1, "-s", /_a-zA-Z&$/, "Normal" } h_trans { 2, "<", "''", "Comment" } h_trans { 3, "", "\"", "String" } h_trans { 4, "", "'", "String" } h_trans { 5, "s", "-+0-9eE+-", "Number" } h_trans { 0, "S", /_a-zA-Z0-9$/, "Punctuation" } h_state 1 { "Normal" } h_trans { 0, "$", "", "Normal" } h_wtype { 1, 1, 0, "", /_a-zA-Z0-9$/ } h_state 2 { "Comment" } h_trans { 0, "$", "", "String" } h_state 3 { "String" } h_trans { 0, "", "\"", "String" } h_trans { 0, "$", "", "String" } h_trans { 3, "Qq", "\\", "String" } h_state 4 { "String" } h_trans { 0, "", "'", "String" } h_trans { 0, "$", "", "String" } h_trans { 4, "Qq", "\\", "String" } h_state 5 { "Number" } h_trans { 0, "-S", "-+0-9eE+-", "Normal" } h_trans { 0, "$", "", "Normal" } } mode BASIC: SOURCE { FileNameRx = /\c\.{{bas}|{bi}}$/; HilitOn = 1; Colorizer = "BASIC"; AutoIndent = 1; IndentMode = "PLAIN"; MatchCase = 0; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 0; RoutineRegexp = /^\s*{{sub}|{function}|{type}}\s+/; } oinclude 'mym_basic.fte'; efte-1.1/config/m_vi.fte0000664000076400007640000000705611157534024014233 0ustar laurilauri# does not work at this time. needs fixing # # just an experiment, do not take this seriously :) # mode VIMODE: MODEOPTS { # VI mode key [i] { ChangeKeys 'VI_INS' } key [I] { MoveLineStart; ChangeKeys 'VI_INS' } key [o] { LineAdd; MoveDown; MoveLineStart; ChangeKeys 'VI_INS' } key [O] { LineInsert; MoveLineStart; ChangeKeys 'VI_INS' } key [a] { MoveRight; ChangeKeys 'VI_INS' } key [A] { MoveLineEnd; ChangeKeys 'VI_INS' } key [r] { ToggleInsert; InsertChar; ToggleInsert } key [R] { ChangeKeys 'VI_OVER'; ToggleInsert } key [d] { ChangeKeys 'VI_DELETE' } key [D] { KillToLineEnd } key [y] { ChangeKeys 'VI_YANK' } key [x] { KillChar } key [X] { KillCharPrev } key [h] { MoveLeft } key [j] { MoveDown } key [k] { MoveUp } key [l] { MoveRight } key [$] { MoveLineEnd } key [0] { MoveLineStart } key [^] { MoveFirstNonWhite } key [:] { MainMenu } key [/] { SearchRx } key [n] { SearchAgain } key [P] { BlockPaste } key [p] { MoveRight; BlockPaste } key [B] { MoveWordPrev } key [b] { MoveWordPrev } key [w] { MoveWordNext } key [W] { MoveWordNext } key [c] { ChangeKeys 'VI_CHANGE' } key [C+N] { MoveDown } key [C+P] { MoveUp } key [C+B] { MovePageUp } key [%] { MatchBracket } key [u] { Undo } key [U] { Redo } key [BackSp] { MoveLeft } key [Space] { MoveRight } key [G-Enter] { MoveDown; MoveLineStart } key [-] { MoveUp; MoveLineStart } key [+] { MoveDown; MoveLineStart } key [J] { LineJoin } key [C] { KillToLineEnd; ChangeKeys 'VI_INS' } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [G-C+PgDn] { MoveFileEnd } } mode VI_INS: MODEOPTS { key [Esc] { ChangeKeys 'VIMODE'; MoveLeft } key [G-Enter] { LineNew } key [Space] { InsertSpace } key [BackSp] { KillCharPrev } key [Tab] { InsertTab } } mode VI_OVER: VI_INS { Insert = 0; key [Esc] { ChangeKeys 'VIMODE'; MoveLeft; ToggleInsert } } mode VI_DELETE: MODEOPTS { key [Esc] { ChangeKeys 'VIMODE' } key [d] { BlockSelectLine; BlockCut; ChangeKeys 'VIMODE' } key [$] { BlockUnmark; BlockMarkStream; MoveLineEnd; BlockMarkStream; BlockCut; ChangeKeys 'VIMODE' } key [0] { BlockUnmark; BlockMarkStream; MoveLineStart; BlockMarkStream; BlockCut; ChangeKeys 'VIMODE' } key [w] { KillWord; ChangeKeys 'VIMODE' } } mode VI_CHANGE: MODEOPTS { key [Esc] { ChangeKeys 'VIMODE' } key [w] { KillWord; ChangeKeys 'VI_INS' } key [$] { KillToLineEnd; ChangeKeys "VI_INS" } key [c] { MoveLineStart; KillToLineEnd; ChangeKeys "VI_INS" } } mode VI_YANK: MODEOPTS { key [Esc] { ChangeKeys 'VIMODE' } key [d] { BlockSelectLine; BlockCopy; ChangeKeys 'VIMODE' } key [$] { BlockUnmark; BlockMarkStream; MoveLineEnd; BlockMarkStream; BlockCopy; MovePrevPos; ChangeKeys 'VIMODE' } key [0] { BlockUnmark; BlockMarkStream; MoveLineStart; BlockMarkStream; BlockCopy; MovePrevPos; ChangeKeys 'VIMODE' } key [w] { KillWord; ChangeKeys 'VIMODE' } } oinclude 'mym_vi.fte'; efte-1.1/config/m_source.fte0000664000076400007640000000031411157534024015103 0ustar laurilauri# SOURCE mode # # All source modes should inherit from this mode which enables the # user to easily modify preferences for all source code file types # mode SOURCE: PLAIN { } oinclude 'mym_source.fte'; efte-1.1/config/m_ocaml.fte0000664000076400007640000000423011177363664014713 0ustar laurilauri# OCAML mode # # Vlad Seryakov # vlad@crystalballinc.com colorize OCAML { SyntaxParser = 'SIMPLE'; color { {'Normal', 'Editor_Default'}, {'Number', 'Lang_DecimalNumber'}, {'Punctuation','Lang_Preprocessor'}, {'String','Lang_String'}, {'Comment','Lang_Comment'}, {'Label','Lang_Label'}, {'Function','Lang_Function'} }; keyword 'Editor_Keywords' { 'and', 'as', 'assert', 'asr', 'begin', 'class', 'constraint', 'do', 'done', 'downto', 'else', 'end', 'exception', 'external', 'false', 'for', 'fun', 'function', 'functor', 'if', 'in', 'include', 'inherit', 'initializer', 'land', 'lazy', 'let', 'lor', 'lsl', 'lsr', 'lxor', 'match', 'method', 'mod', 'module', 'mutable', 'new', 'object', 'of', 'open', 'or', 'private', 'rec', 'sig', 'struct', 'then', 'to', 'true', 'try', 'type', 'val', 'virtual', 'when', 'while', 'with' }; h_state 0 {'Normal'} h_trans {1, '>', '(*', 'Comment'} h_trans {2, '', '"', 'String'} h_trans {3, 's', '0-9', 'Number'} h_trans {0, 'S', '_a-zA-Z0-9', 'Punctuation'} h_trans {4, '-s', 'a-zA-Z_', 'Normal' } h_state 1 {'Comment'} h_trans {0, '<', '*)', 'Comment'} h_state 2 {'String'} h_trans {0, '', '"', 'String'} h_state 3 {'Number'} h_trans {0, 'S-', '0-9\.', 'Number'} h_state 4 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_' } } mode OCAML: PLAIN { FileNameRx = /\.\c{ML}|{MLI}$/; HilitOn = 1; Colorizer = 'OCAML'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; CommentStart = ' (*'; CommentEnd = '*)'; RoutineRegexp = /^{let}|{module}|{type}\ .+}/; } efte-1.1/config/m_rpm.fte0000664000076400007640000000231611157534024014405 0ustar laurilauri# m_rpm.fte # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # # eFTE mode for editing RPM spec files # colorize RPM { SyntaxParser = "SIMPLE"; color { { "Normal", "Editor_Default" }, { "Comment", "Lang_Comment" }, { "Command", "Lang_Command" }, { "String", "Lang_String" }, { "Number", "Lang_DecimalNumber" }, { "Punctuation", "Lang_Punctuation" }, }; # Header (0) h_state 0 { "Normal" } h_trans { 2, "^", "%", "String" } h_trans { 3, "x", "^[A-Za-z0-9_]", "Command" } h_state 1 { "Normal" } h_trans { 2, "^", "%", "String" } h_trans { 1, "$", "", "Normal" } # Section Header h_state 2 { "String" } h_trans { 1, "$", "", "String" } # Header command h_state 3 { "Command" } h_trans { 0, "", ":", "Command" } } mode RPM: SOURCE { FileNameRx = "\\.{spec}$"; Colorizer = "RPM"; HilitOn = 1; AutoIndent = 1; IndentMode = "PLAIN"; } oinclude "mym_rpm.fte"; efte-1.1/config/m_html.fte0000664000076400007640000005173011157534024014557 0ustar laurilauri# FTE mode for editing HTML files # maintained by m_debusk@sourceforge.com # Revision 2001-11-18 # Runs current file in browser sub HTML_View { RunProgram "netscape.exe -browser -l en_US file:///" . $FilePath; } # Runs Dave Ragget's HTML Tidy on current file sub HTML_Tidy { RunProgram "f:\\os2_apps\\tidy\\tidy.exe -m " . $FilePath; } # Basic stuff sub HTML_BR { InsertString "
"; } sub HTML_HR { InsertString "
"; } sub HTML_HTM { ?MoveBlockStart; InsertString ""; 2:LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; 2:LineNew; InsertString ""; MoveSavedPos; } sub HTML_HEAD { ?MoveBlockStart; InsertString ""; LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; LineNew; InsertString ""; MoveSavedPos; } sub HTML_TITLE { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 8:MoveLeft; BlockUnmark; } sub HTML_BODY { ?MoveBlockStart; InsertString ""; 2:LineNew; ?MoveBlockEnd; SavePos; 2:LineNew; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_META { MoveFileStart; ?Find // "i"; MoveLineEnd; LineNew; InsertString ""; 15:MoveLeft } sub HTML_BASEURL { MoveFileStart; ?Find // "i"; MoveLineEnd; LineNew InsertString ""; 4:MoveLeft } sub HTML_P { ?MoveBlockStart; InsertString "

"; ?MoveBlockEnd; InsertString "

"; 4:MoveLeft; BlockUnmark; } sub HTML_CENTER { # shouldn't really do this, but it's convenient. ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 7:MoveLeft; } # Comment sub HTML_COMMENT { ?MoveBlockStart; InsertString ""; 4:MoveLeft; BlockUnmark; } # DTDs sub HTML_DTD_X1S { # XHTML 1.0 Strict MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_X1T { # XHTML 1.0 Transitional MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_X1F { # XHTML 1.0 Frameset MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_4S { # HTML 4.01 Strict MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_4T { # HTML 4.01 Transitional MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_4F { # HTML 4.01 Frameset MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_32F { # HTML 3.2 Final MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_2 { # HTML 2.0; Why not? MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } # headers sub HTML_H1 { ?MoveBlockStart; InsertString "

"; ?MoveBlockEnd; InsertString "

"; 5:MoveLeft; BlockUnmark; } sub HTML_H2 { ?MoveBlockStart; InsertString "

"; ?MoveBlockEnd; InsertString "

"; 5:MoveLeft; BlockUnmark; } sub HTML_H3 { ?MoveBlockStart; InsertString "

"; ?MoveBlockEnd; InsertString "

"; 5:MoveLeft; BlockUnmark; } sub HTML_H4 { ?MoveBlockStart; InsertString "

"; ?MoveBlockEnd; InsertString "

"; 5:MoveLeft; BlockUnmark; } sub HTML_H5 { ?MoveBlockStart; InsertString "
"; ?MoveBlockEnd; InsertString "
"; 5:MoveLeft; BlockUnmark; } sub HTML_H6 { ?MoveBlockStart; InsertString "
"; ?MoveBlockEnd; InsertString "
"; 5:MoveLeft; BlockUnmark; } # Character Format sub HTML_B { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 4:MoveLeft; BlockUnmark; } sub HTML_STRONG { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 9:MoveLeft; BlockUnmark; } sub HTML_I { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 4:MoveLeft; BlockUnmark; } sub HTML_EM { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 5:MoveLeft; BlockUnmark; } sub HTML_BIG { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 6:MoveLeft; BlockUnmark; } sub HTML_SMALL { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 8:MoveLeft; BlockUnmark; } sub HTML_SUP { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 6:MoveLeft; BlockUnmark; } sub HTML_SUB { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 6:MoveLeft; BlockUnmark; } sub HTML_BDO { ?MoveBlockStart; InsertString ""; 6:MoveLeft; SavePos; 6:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } # Output Format sub HTML_PRE { ?MoveBlockStart; InsertString "
"; LineNew;
    ?MoveBlockEnd; SavePos; BlockUnmark; LineNew;
    InsertString "
"; MoveSavedPos; } sub HTML_CODE { ?MoveBlockStart; InsertString ""; #LineNew; ?MoveBlockEnd; #SavePos; BlockUnmark; #LineNew; InsertString ""; 7:MoveLeft; #MoveSavedPos; } sub HTML_TT { ?MoveBlockStart; InsertString ""; #LineNew; ?MoveBlockEnd; #SavePos; BlockUnmark; #LineNew; InsertString ""; 5:MoveLeft; #MoveSavedPos; } sub HTML_KBD { ?MoveBlockStart; InsertString ""; #LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; #LineNew; InsertString ""; MoveSavedPos; } sub HTML_VAR { ?MoveBlockStart; InsertString ""; LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; LineNew; InsertString ""; MoveSavedPos; } sub HTML_SAMP { ?MoveBlockStart; InsertString ""; LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; LineNew; InsertString ""; MoveSavedPos; } # Blocks sub HTML_ACRONYM { ?MoveBlockStart; InsertString ""; 2:MoveLeft; SavePos; 2:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_ABBR { ?MoveBlockStart; InsertString ""; 2:MoveLeft; SavePos; 2:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_ADDRESS { ?MoveBlockStart; InsertString "
"; LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; LineNew; InsertString "
"; MoveSavedPos; } sub HTML_BLOCKQUOTE { ?MoveBlockStart; InsertString "
"; LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; LineNew; InsertString "
"; MoveSavedPos; } sub HTML_Q { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 4:MoveLeft; BlockUnmark; } sub HTML_CITE { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 7:MoveLeft; BlockUnmark; } sub HTML_INS { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 6:MoveLeft; BlockUnmark; } sub HTML_DEL { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 6:MoveLeft; BlockUnmark; } # forms sub HTML_INPUT { InsertString ""; 4:MoveLeft; } sub HTML_FORM { InsertString "
"; LineNew; HTML_INPUT; SavePos; 4:MoveRight; LineNew; InsertString "
"; MoveSavedPos; } sub HTML_TEXTAREA { ?MoveBlockStart; InsertString ""; MoveSavedPos; } sub HTML_BUTTON { InsertString ""; 9:MoveLeft; } sub HTML_OPTION { InsertString ""; LineNew; HTML_OPTION; SavePos; 4:MoveRight; LineNew; HTML_OPTION; 4:MoveRight; LineNew; InsertString ""; MoveSavedPos; } sub HTML_LABEL { ?MoveBlockStart; InsertString ""; MoveSavedPos; } sub HTML_FIELDSET { InsertString "
"; LineNew; HTML_INPUT; SavePos; 4:MoveRight; LineNew; InsertString "
"; MoveSavedPos; } sub HTML_LEGEND { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 9:MoveLeft; BlockUnmark; } # lists sub HTML_DFN { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 6:MoveLeft; BlockUnmark; } sub HTML_LI { ?MoveBlockStart; InsertString "
  • "; ?MoveBlockEnd; InsertString "
  • "; 5:MoveLeft; BlockUnmark; } sub HTML_DT { ?MoveBlockStart; InsertString "
    "; ?MoveBlockEnd; InsertString "
    "; 5:MoveLeft; BlockUnmark; } sub HTML_DD { ?MoveBlockStart; InsertString "
    "; ?MoveBlockEnd; InsertString "
    "; 5:MoveLeft; BlockUnmark; } sub HTML_UL { ?MoveBlockStart; InsertString "
      "; ?MoveBlockEnd; InsertString "
    "; 5:MoveLeft; BlockUnmark; } sub HTML_OL { ?MoveBlockStart; InsertString "
      "; ?MoveBlockEnd; InsertString "
    "; 5:MoveLeft; BlockUnmark; } sub HTML_DL { ?MoveBlockStart; InsertString "
    "; ?MoveBlockEnd; InsertString "
    "; 5:MoveLeft; BlockUnmark; } # Images sub HTML_IMG { InsertString "\"\""; 30:MoveLeft; } sub HTML_MAP { InsertString "\"\""; 41:MoveLeft; SavePos; MoveLineEnd; LineNew; InsertString ""; LineNew; InsertString "\"\""; LineNew; InsertString ""; MoveSavedPos; } sub HTML_AREA { InsertString "\"\""; MoveLineStart; } # anchors sub HTML_ANAME { ?MoveBlockStart; InsertString ""; 2:MoveLeft; SavePos; 2:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_AHREF { ?MoveBlockStart; InsertString ""; 2:MoveLeft; SavePos; 2:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_LINK { InsertString ""; 20:MoveLeft } # tables sub HTML_TABLE { ?MoveBlockStart; InsertString ""; 2:MoveLeft; SavePos; 2:MoveRight; LineNew; ?MoveBlockEnd; LineNew; InsertString "
    "; BlockUnmark; MoveSavedPos; } sub HTML_CAPTION { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 10:MoveLeft; BlockUnmark; } sub HTML_TH { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 5:MoveLeft; BlockUnmark; } sub HTML_TR { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 5:MoveLeft; BlockUnmark; } sub HTML_TD { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 5:MoveLeft; BlockUnmark; } sub HTML_COL { ?MoveBlockStart; InsertString ""; 11:MoveLeft; SavePos; 11:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_COLGROUP { ?MoveBlockStart; InsertString ""; 11:MoveLeft; SavePos; 11:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_THEAD { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 8:MoveLeft; BlockUnmark; } sub HTML_TFOOT { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 8:MoveLeft; BlockUnmark; } sub HTML_TBODY { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 8:MoveLeft; BlockUnmark; } # Frames sub HTML_FRAME { ?MoveBlockStart; InsertString ""; 2:LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; 2:LineNew; InsertString ""; MoveSavedPos; } sub HTML_NOFRAMES { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 11:MoveLeft; BlockUnmark; } sub HTML_FRAMESET { ?MoveBlockStart; InsertString ""; 2:LineNew; InsertString ""; 11:MoveLeft; SavePos; 11:MoveRight; 2:LineNew; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_IFRAME { ?MoveBlockStart; InsertString ""; BlockUnmark; MoveSavedPos; } # Styles sub HTML_STYLE { InsertString ""; MoveSavedPos; } sub HTML_DIV { ?MoveBlockStart; InsertString "
    "; MoveLeft; SavePos; MoveRight; LineNew; ?MoveBlockEnd; BlockUnmark; LineNew; InsertString "
    "; MoveSavedPos; MoveRight; } sub HTML_SPAN { ?MoveBlockStart; InsertString ""; MoveLeft; SavePos; MoveRight; ?MoveBlockEnd; BlockUnmark; InsertString ""; 8:MoveLeft; MoveSavedPos; MoveRight; } # Programming sub HTML_SCRIPT { InsertString ""; 11:MoveLeft; SavePos; 11:MoveRight; LineNew; InsertString ""; LineNew; InsertString ""; MoveSavedPos; } sub HTML_NOSCRIPT { ?MoveBlockStart; InsertString ""; 11:MoveLeft; BlockUnmark; } sub HTML_OBJECT { InsertString ""; 9:MoveLeft; } sub HTML_PARAM { InsertString ""; 8:MoveLeft; } # basic document skeleton sub HTML_Base { MoveFileStart; InsertString ""; 2:LineNew; InsertString ""; 2:LineNew; InsertString ""; LineNew; InsertString ""; 4:MoveLeft; InsertDate "%Y"; InsertString " by "; InsertUid; MoveLineEnd; LineNew; InsertString ""; LineNew; InsertString ""; 4:MoveLeft; InsertUid; InsertString ","; InsertDate "%Y-%m-%d"; MoveLineEnd; LineNew; InsertString ""; LineNew; InsertString ""; LineNew; InsertString ""; 4:MoveLeft; InsertUid; 4:MoveRight; LineNew; InsertString ""; LineNew; InsertString ""; InsertString $FileBaseName; InsertString ""; LineNew; InsertString ""; 2:LineNew; InsertString ""; 2:LineNew; MoveFileEnd; LineAdd; MoveLineStart; InsertString ""; 2:LineNew; InsertString ""; MoveFileStart; 8:MoveDown; MoveLineEnd; 4:MoveLeft; } # Converts plain text to HTML sub HTML_TXT { MoveFileStart; ?FindReplace /&/ /&/ "agn" ; ?FindReplace // />/ "agn" ; ?FindReplace /tm/ "agn"; MoveFileStart; LineInsert; InsertString "
    "; MoveFileEnd;
        LineNew; InsertString "
    "; HTML_Base; } # basic frame skeleton sub HTML_BaseFrame { HTML_Base; SavePos; MoveFileStart; KillLine; HTML_DTD_X1F; ?FindReplace /body>/ /frameset>/ "agn"; MoveSavedPos; } colorize HTML { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Command', 'Markup_Punctuation' }, { 'Symbol', 'Markup_Symbol' }, { 'Tag', 'Markup_Tag' }, { 'Special', 'Markup_Special' }, }; keyword "Editor_Keywords" { # XHTML 1.0 keywords "a", "abbr", "acronym", "address", "area", "b", "base", "bdo", "big", "blockquote", "body", "br", "button", "caption", "cite", "code", "col", "colgroup", "dd", "del", "dfn", "div", "dl", "dt", "em", "fieldset", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "map", "meta", "noframes", "noscript", "object", "ol", "optgroup", "option", "p", "param", "pre", "q", "samp", "script", "select", "small", "span", "strong", "style", "sub", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "title", "tr", "tt", "ul", "var" }; keyword "Editor_Keywords2" { # Secondary keywords "abbr", "above", "absbottom", "accept", "accept-charset", "accesskey", "action", "align", "all", "alt", "archive", "auto", "axis", "baseline", "below", "border", "bordercolor", "bottom", "box", "button", "cellpadding", "cellspacing", "char", "charoff", "charset", "checkbox", "checked", "circle", "cite", "class", "classid", "clear", "codebase", "codetype", "color", "cols", "colspan", "compact", "content", "coords", "data", "datetime", "declare", "default", "defer", "dir", "disabled", "disc", "enctype", "face", "file", "for", "frame", "frameborder", "get", "groups", "headers", "height", "hidden", "href", "hreflang","hsides", "hspace", "http-equiv", "id", "image", "ismap", "justify", "label", "lang", "left", "lhs", "longdesc", "ltr", "mailto", "marginheight", "marginwidth", "maxlength", "media", "method", "middle", "multiple", "name", "no", "nohref", "none", "noresize", "noshade", "nowrap", "param", "password", "poly", "post", "profile", "prompt", "radio", "readonly", "rect", "rel", "reset", "rev", "rhs", "right", "rows", "rowspan", "rtl", "rules", "scheme", "scope", "scrolling", "selected", "shape", "size", "span", "square", "src", "standby", "start", "style", "subject", "submit", "summary", "tabindex", "target", "title", "top", "type", "usemap", "valign", "value", "valuetype", "void", "vsides", "vspace", "width", "wrap", "yes", "_blank", "_parent", "_self", "_top", # DTD "doctype", "public", }; keyword "Editor_Keywords3" { # Event attributes "onfocus", "onblur", "onchange", "onclick", "ondblclick", "onfocus", "onload", "onkeydown", "onkeypress", "onkeyup", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onreset", "onselect", "onsubmit", }; keyword "Editor_Keywords5" { # Deprecated in XHTML 1.0 "applet", "basefont", "center", "dir", "font", "isindex", "listing", "menu", "plaintext", "s", "strike", "u", "xmp", # depricated attributes "alink", "background", "bgcolor", "language", "link", "text", "vlink", }; h_state 0 { 'Normal' } h_trans { 5, '<', '"; } oinclude 'mym_html.fte'; efte-1.1/config/ui_mew.fte0000664000076400007640000007645211157534024014574 0ustar laurilauri# mew_ui.fte # FTE configuration file to mimic the Multi Edit for Windows UI # # Basic Commands (Global) #FOLD00 menu Window { #FOLD01 item "Split &Horizontal\tCtrl+F4" { WinHSplit } item "&Close view\tCtrl+Alt+F4" { WinClose } item "Close &other views\tF5" { WinZoom } item; item "Sa&ve Desktop" { DesktopSave } item "Save Desktop &As" { DesktopSaveAs } item; item "&Routines\tCtrl+I" { ListRoutines } item "&Buffers\tAlt+0" { ViewBuffers } item "&Directory\tC+M" { DirOpen } } menu Help { #FOLD01 item "&Keyboard" { ViewModeMap } item; item "&About..." { ShowVersion } } eventmap MODEL { #FOLD01 key [F1] { ViewModeMap } key [C+F2] { FileSaveAll } key [F3] { FileOpen } key [F4] { WinNext } # key [C+F4] { WinHSplit } key [S+F4] { WinPrev } # key [C+F4] { WinClose } key [A+Z] { WinZoom } key [F6] { FileNext } key [S+F6] { FilePrev } key [A+S-F6] { FileLast } key [F10] { MainMenu } key [C+F4] { FileClose } key [C+F9] { RunProgram } key [A+F9] { RunProgram "" } key [S+F10] { LocalMenu } key [C+G-Up] { WinPrev } key [C+G-Down] { WinNext } key [A+G-PgUp] { WinPrev; MovePageUp; WinNext } key [A+G-PgDn] { WinNext; MovePageDown; WinPrev } key [A+C+G-PgUp] { WinNext; MovePageUp; WinPrev } key [A+C+G-PgDn] { WinPrev; MovePageDown; WinNext } key [A+X] { ExitEditor } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } # this is also useful for 'grep -n' etc. if configured key [F9] { FileSaveAll; Compile "make"; ViewMessages } key [F11] { CompilePrevError } key [F12] { CompileNextError } key [S+F9] { ViewMessages } key [C+F6] { ViewBuffers } key [A+1] { SwitchTo 1 } key [A+2] { SwitchTo 2 } key [A+3] { SwitchTo 3 } key [A+4] { SwitchTo 4 } key [A+5] { SwitchTo 5 } key [A+6] { SwitchTo 6 } key [A+7] { SwitchTo 7 } key [A+8] { SwitchTo 8 } key [A+9] { SwitchTo 9 } } # List Viewers #FOLD00 eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveFileStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveFileEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [C+G-Left] { ScrollLeft } key [C+G-Right] { ScrollRight } key [G-Enter] { Activate } key [Space] { ActivateInOtherWindow } key [S+G-Enter] { CloseActivate } key [C+R] { Rescan } } # Directory Browser #FOLD00 menu Directory { #FOLD01 item "&Reload\tCtrl+R" { Rescan } item "&Close\tCtrl+F10" { FileClose } item; item "&Open file...\tF3" { FileOpen } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu Navigate { #FOLD01 item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } item "&/ Goto Dir\t/" { DirGoto } item "&Delete File\tCtrl+D" { DeleteFile } item; item '&A:\\' { DirGoto 'A:\\' } item '&B:\\' { DirGoto 'B:\\' } item '&C:\\' { DirGoto 'C:\\' } item '&D:\\' { DirGoto 'D:\\' } item '&E:\\' { DirGoto 'E:\\' } item '&F:\\' { DirGoto 'F:\\' } item '&G:\\' { DirGoto 'G:\\' } item '&H:\\' { DirGoto 'H:\\' } item '&I:\\' { DirGoto 'I:\\' } } menu DirMain { #FOLD01 submenu "&Directory", Directory; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap DIRECTORY: MLIST { #FOLD01 MainMenu = 'DirMain'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [Esc] { FileClose 0 } key [A+D] { MainMenu 'D' } key [A+N] { MainMenu 'N' } key [A+W] { MainMenu 'W' } key [A+T] { MainMenu 'T' } } # Buffer List #FOLD00 eventmap BUFFERS: MLIST { key [Esc] { FileClose 0 } # 0 = do not open directory when last closed, overrides OpenAfterClose default. key [C+C] { BufListFileClose } key [F2] { BufListFileSave } } # Routine List #FOLD00 eventmap ROUTINES: MLIST { key [Esc] { FileClose } } # Message List #FOLD00 menu Messages { item "&Close\tCtrl+F10" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu MsgMain { submenu "&Messages", Messages; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap MESSAGES: MLIST { MainMenu = "MsgMain"; key [A+M] { MainMenu 'M' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } key [C+C] { ChildClose } # does NOT kill, just closes pipe } # Event Map View #FOLD00 eventmap EVENTMAPVIEW: MLIST { key [Esc] { FileClose 0 } } # Editor - Editing Modes #FOLD00 # PLAIN #FOLD01 # menus #FOLD02 menu MChangeMode { #FOLD03 item "&Plain" { ChangeMode 'PLAIN' } item "&Text" { ChangeMode 'TEXT' } item "&C" { ChangeMode 'C' } item "&EMail" { ChangeMode 'MSG' } item "&HTML" { ChangeMode 'HTML' } item "&IPF" { ChangeMode 'IPF' } item "&Ada" { ChangeMode 'Ada' } item "&REXX" { ChangeMode 'REXX' } item "MAKE" { ChangeMode 'MAKE' } item "&FTE" { ChangeMode 'FTE' } item "Resource" { ChangeMode 'RESOURCE' } item "&DIFF" { ChangeMode 'DIFF' } item "&MERGE" { ChangeMode 'MERGE' } item "&SH" { ChangeMode 'SH' } item "PER&L" { ChangeMode 'PERL' } item "PASCAL" { ChangeMode 'PASCAL' } item "&JAVA" { ChangeMode 'JAVA' } item "TE&X" { ChangeMode 'TEX' } item "&BIN" { ChangeMode 'BIN' } item "4&GL" { ChangeMode 'GL' } } menu MOpenInMode { #FOLD03 item "&Plain" { FileOpenInMode 'PLAIN' } item "&Text" { FileOpenInMode 'TEXT' } item "&C" { FileOpenInMode 'C' } item "&EMail" { FileOpenInMode 'MSG' } item "&HTML" { FileOpenInMode 'HTML' } item "&IPF" { FileOpenInMode 'IPF' } item "&Ada" { FileOpenInMode 'Ada' } item "&REXX" { FileOpenInMode 'REXX' } item "MAKE" { FileOpenInMode 'MAKE' } item "&FTE" { FileOpenInMode 'FTE' } item "Resource" { FileOpenInMode 'RESOURCE' } item "&DIFF" { FileOpenInMode 'DIFF' } item "&MERGE" { FileOpenInMode 'MERGE' } item "&SH" { FileOpenInMode 'SH' } item "PER&L" { FileOpenInMode 'PERL' } item "PASCAL" { FileOpenInMode 'PASCAL' } item "&JAVA" { FileOpenInMode 'JAVA' } item "TE&X" { FileOpenInMode 'TEX' } item "&BIN" { FileOpenInMode 'BIN' } item "4&GL" { FileOpenInMode 'GL' } } menu File { #FOLD03 item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; # item "Open &Binary" { FileOpenInMode 'BIN' } item "&Reload\tShift+F3" { FileReload } item "&Save\tF2" { FileSave } # OpenDoc UI Guide recomments using Write To only, not Save As, hmm. item "Save &As...\tCtrl+F2" { FileSaveAs } item "Save Al&l" { FileSaveAll } item "Write &To..." { FileWriteTo } # item "Sa&ve and Close\tAlt+F2" { FileSave; FileClose } item "Prin&t" { FilePrint } item "&Close\tCtrl+F4" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu Edit { #FOLD03 item "&Undo\tAlt+BackSp" { Undo } item "&Redo\tAlt+Enter" { Redo } item; item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Append\tAlt+Ins" { BlockCopyAppend } item "Cut a&nd Append\tCtrl+Num-" { BlockCutAppend } item "&Paste\tShift+Ins" { BlockPasteStream } # item; # item "&Insert line\tShift+Enter" { LineInsert } # item "&Delete line\tAlt+Shift+BackSp" { KillLine } # item "&Split line\tCtrl+Enter" { LineSplit } # item "&Join line\tCtrl+J" { LineJoin } # item "Dup&licate line\tCtrl+D" { LineDuplicate } # item "Delete to line &end\tAlt+End" { KillToLineEnd } # item "Delete to li&ne start\tCtrl+Shift+BackSp" { KillToLineStart } # item; # item "&Quote Literal...\tCtrl+Q" { InsertChar } } menu Translate { #FOLD03 item "&Uppercase" { BlockCaseUp } item "&Lowercase" { BlockCaseDown } item "&Togglecase" { BlockCaseToggle } item "&Rot13" { BlockTrans 'A-Za-z' 'N-ZA-Mn-za-m' } item; item "User &specified..." { BlockTrans } } menu Block { #FOLD03 item "&Delete Block\tCtrl+F8" { BlockKill } item; item "Save &Block to Disk...\tShift+F2" { BlockWrite } item "&Indent\tAlt+F3" { BlockIndent } item "&Unindent\tAlt+F2" { BlockUnindent } item; item "Mark &Lines of Text\tF7" { BlockMarkLine } item "Mark &Stream of Text\tCtrl+F7" { BlockMarkStream } item "Mark C&olumns of Text\tShift+F7" { BlockMarkColumn } item "Turn Marking O&ff\tEsc" { BlockUnmark } item; # item "Select Wor&d" { BlockSelectWord } # item "Selec&t Line" { BlockSelectLine } # item; item "&Read..." { BlockRead } item "&Print" { BlockPrint } item; item "Sor&t" { BlockSort } item "Sort Re&verse" { BlockSortReverse } submenu "Translat&e", Translate; } menu Search { #FOLD03 item "&Search...\tF5" { Find } item "Search and &Replace...\tShift+F5" { FindReplace } item "&Again\tCtrl+F5" { FindRepeat } item "&Incremental Search\tAlt+I" { IncrementalSearch } item "Repeat last find re&verse\tCtrl+Shift+F5" { FindRepeatReverse } item "Repeat last find &once\tCtrl+N" { FindRepeatOnce } item; item "&Place Bookmark..." { PlaceBookmark } item "Goto &Bookmark..." { GotoBookmark } item; item "&Match paren\tAlt+-" { MatchBracket } item "Search Prev Word\tAlt+," { SearchWordPrev } item "Search Next Word\tAlt+." { SearchWordNext } item "&Highlight Current Word\tAlt+/" { HilitWord } item "Goto Line &Number...\tAlt+F5" { MoveToLine } } menu Fold { #FOLD03 item "&Create fold\tAlt+Gray++" { FoldCreate } item "Create folds by ®exp..." { FoldCreateByRegexp } item "&Destroy fold\tAlt+Gray+-" { FoldDestroy } item; item "&Open fold\tCtrl+Gray++" { FoldOpen } item "Open &nested folds\tCtrl+Gray+*" { FoldOpenNested } item "C&lose fold\tCtrl+Gray+-" { FoldClose } item "&Toggle fold open/close\tCtrl+Gray+/" { FoldToggleOpenClose } item; item "&Promote fold\tShift+Gray+-" { FoldPromote } item "De&mote fold\tShift+Gray++" { FoldDemote } item; item "Open &all folds\tAlt+Gray+*" { FoldOpenAll } item "Close all &folds\tAlt+Gray+/" { FoldCloseAll } item "Destro&y all folds" { FoldDestroyAll } } menu Options { #FOLD03 submenu "Change &mode\tC+O C+M", MChangeMode; item; item "&Insert mode\tC+O C+I" { ToggleInsert } item "&Auto indent\tC+O C+A" { ToggleAutoIndent } item "&Case sensitive\tC+O C+C" { ToggleMatchCase } item "Trim &EOL spaces\tC+O C+E" { ToggleTrim } item "&Read only\tC+O C+R" { ToggleReadOnly } item "&Undo/Redo\tC+O C+U" { ToggleUndo } item "&Show markers\tC+O C+." { ToggleShowMarkers; WinRefresh } item; item "&Word wrap\tC+O C+W" { ToggleWordWrap } item "&Left margin...\tC+O A+[" { ChangeLeftMargin } item "Ri&ght margin...\tC+O A+]" { ChangeRightMargin } item; item "&Tab size...\tC+O C+T" { ChangeTabSize; WinRefresh } item "S&how tabs\tC+O Tab" { ToggleShowTabs; WinRefresh } item "E&xpand tabs\tC+O C+Tab" { ToggleExpandTabs; WinRefresh } item "&Print to... " { SetPrintDevice } } menu MCvs { item "CVS C&heck" { RunCvs "-n update" } item "CVS &Update" { RunCvs "update -d" } item "CVS &Diff" { CvsDiff "" } item "CVS &Commit" { RunCvsCommit "" } item "CVS &Add" { RunCvs "add" } item "CVS &Remove" { RunCvs "remove" } item "CVS S&tatus" { RunCvs "status -v" } item "CV&S" { Cvs } item; item "&View CVS" { ViewCvs } item "View CVS Di&ff" { ViewCvsDiff } item "View CVS &log" { ViewCvsLog } item; item "Cl&ear CVS messages" { ClearCvsMessages } } menu MSvn { item "SVN C&heck" { RunSvn "-n update" } item "SVN &Update" { RunSvn "update -d" } item "SVN &Diff" { SvnDiff "" } item "SVN &Commit" { RunSvnCommit "" } item "SVN &Add" { RunSvn "add" } item "SVN &Remove" { RunSvn "remove" } item "SVN S&tatus" { RunSvn "status -v" } item "SV&N" { Svn } item; item "&View SVN" { ViewSvn } item "View SVN Di&ff" { ViewSvnDiff } item "View SVN &log" { ViewSvnLog } item; item "Cl&ear SVN messages" { ClearSvnMessages } } menu Tools { item "&Compile\tF9" { FileSaveAll; Compile "make" } item "&Grep" { Compile "grep -n " } item; item "&Shell\tAlt+F9" { RunProgram "" } item; item "Go to prev &error\tF11" { CompilePrevError } item "Go to &next error\tF12" { CompileNextError } item; item "&Messages\tS+F9" { ViewMessages } item; item "&ASCII Table...\tCtrl+Shift+A" { ASCIITable } item; submenu "C&VS\tC+O_C+V", MCvs; submenu "SVN\tC+O_C+N", MSvn; item; submenu "Customi&ze", Options; } menu Text { submenu "C&ollapse...", Fold; } menu Main { #FOLD03 submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "&Text", Text; submenu "&Macro", Macro; submenu "T&ools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu Local { #FOLD03 item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tC+F10" { FileClose } } eventmap PLAIN: MODEL { #FOLD02 # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu #------------------------------------------------------------------- # # The first section implements the keys promised by the menus # #---- The FILE menu key [F3] { FileOpen } key [C+F3] { FileOpenInMode } key [S+F3] { FileReload; WinRefresh } key [F2] { FileSave } key [C+F2] { FileSaveAs } key [C+F4] { FileClose } #---- The EDIT menu key [A+BackSp] { Undo } key [A+Enter] { Redo } key [S+G-Del] { BlockCut } key [C+G-Ins] { BlockCopy } key [A+G-Ins] { BlockCopyAppend } key [C+G+-] { BlockCutAppend } key [S+G-Ins] { BlockPasteStream } #---- The BLOCK menu key [C+F8] { BlockKill } key [A+F3] { BlockIndent } key [A+F2] { BlockUnindent } key [F7] { BlockMarkLine } key [C+F7] { BlockMarkStream } key [S+F7] { BlockMarkColumn } key [Esc] { BlockMarkStream; BlockUnmark } #---- The SEARCH menu key [F5] { Find } key [S+F5] { FindReplace } key [C+F5] { FindRepeat } key [A+I] { IncrementalSearch } key [A+F5] { MoveToLine } #---- The TEXT menu #---- The MACRO menu #---- The TOOLS menu #---- The WINDOW menu #---- The HELP menu key [C+O_C+V] { ShowMenu 'MCvs' } key [C+O_C+N] { ShowMenu 'MSvn' } #------------------------------------------------------------------- key [A+S-F2] { FileSave; FileClose } # key [F7] { BlockBegin } # key [S+F7] { MoveBlockStart } key [F8] { BlockEnd } key [S+F8] { MoveBlockEnd } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [A+G-Up] { ScrollUp } key [A+G-Down] { ScrollDown } key [A+G-Left] { ScrollLeft } key [A+G-Right] { ScrollRight } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } key [A+G-S+Up] { BlockExtendBegin; ScrollUp; BlockExtendEnd } key [A+G-S+Down] { BlockExtendBegin; ScrollDown; BlockExtendEnd } key [A+G-S+Left] { BlockExtendBegin; ScrollLeft; BlockExtendEnd } key [A+G-S+Right] { BlockExtendBegin; ScrollRight; BlockExtendEnd } key [A+G-C+Up] { MovePrevEqualIndent } key [A+G-C+Down] { MoveNextEqualIndent } key [A+G-C+Left] { MovePrevTab } key [A+G-C+Right] { MoveNextTab } key [A+G-Ins] { BlockPasteColumn } key [A+G-S+Ins] { BlockPasteLine } key [G-Enter] { LineNew } key [BackSp] { BackSpace } key [G-Ins] { ToggleInsert } key [G-Del] { Delete } key [Tab] { InsertTab } key [S+Tab] { InsertSpacesToTab 10 } key [C+Tab] { CompleteWord } # key [C+Tab] { InsertTab } key [C+BackSp] { KillWordPrev } key [C+S+BackSp] { KillToLineStart } key [C+G-Enter] { LineSplit } key [G-S+Enter] { LineInsert } key [A+G-Enter] { LineAdd } key [A+G-Del] { KillWord } key [A+G-End] { KillToLineEnd } key [A+S+BackSp] { KillLine } key [C+G-Del] { KillWord } key [C+A_1] { GotoBookmark "1" } key [C+A_2] { GotoBookmark "2" } key [C+A_3] { GotoBookmark "3" } key [C+A_4] { GotoBookmark "4" } key [C+A_5] { GotoBookmark "5" } key [C+A_6] { GotoBookmark "6" } key [C+A_7] { GotoBookmark "7" } key [C+A_8] { GotoBookmark "8" } key [C+A_9] { GotoBookmark "9" } key [C+A_0] { GotoBookmark "0" } key [C+P_1] { PlaceBookmark "1" } key [C+P_2] { PlaceBookmark "2" } key [C+P_3] { PlaceBookmark "3" } key [C+P_4] { PlaceBookmark "4" } key [C+P_5] { PlaceBookmark "5" } key [C+P_6] { PlaceBookmark "6" } key [C+P_7] { PlaceBookmark "7" } key [C+P_8] { PlaceBookmark "8" } key [C+P_9] { PlaceBookmark "9" } key [C+P_0] { PlaceBookmark "0" } key [C+S+F5] { FindRepeatReverse } key [C+C] { MoveToColumn } key [C+D] { LineDuplicate } key [C+I] { ListRoutines } key [C+J] { LineJoin } key [C+M] { DirOpen } key [C+N] { FindRepeatOnce } key [C+Q] { InsertChar } key [C+T] { KillWord } key [C+Y] { KillLine } key [C+E] { LineTrim } key [A+B] { MainMenu 'B' } key [A+C] { BlockCopy } key [A+D] { MainMenu 'D' } key [A+E] { MainMenu 'E' } key [A+F] { MainMenu 'F' } key [A+G] { BlockCut } key [A+H] { MainMenu 'H' } key [S+F2] { BlockWrite } key [A+O] { MainMenu 'O' } key [A+R] { WrapPara } # Reformat key [A+S] { MainMenu 'S' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } key [C+O_C+A] { ToggleAutoIndent } key [C+O_C+C] { ToggleMatchCase } key [C+O_C+E] { ToggleTrim } key [C+O_C+I] { ToggleInsert } key [C+O_C+M] { ShowMenu 'MChangeMode' } key [C+O_S-M] { ChangeMode } key [C+O_C+R] { ToggleReadOnly } key [C+O_C+S] { ToggleSysClipboard } key [C+O_C+T] { ChangeTabSize } key [C+O_C+U] { ToggleUndo } key [C+O_C+W] { ToggleWordWrap } key [C+O_.] { ToggleShowMarkers } key [C+O_[] { SetLeftMargin } # set margin to current cursor pos key [C+O_\]] { SetRightMargin } key [C+O_A+[] { ChangeLeftMargin } key [C+O_A+\]] { ChangeRightMargin } key [C+O_Tab] { ToggleShowTabs } key [C+O_C+Tab] { ToggleExpandTabs } key [C+O_G-Del] { ToggleDeleteKillTab } key [C+O_G-Ins] { ToggleInsert } key [C+O_BackSp] { ToggleBackSpKillTab } key [C+O_Space] { ToggleIndentWithTabs } key [C+O_C+BackSp] { ToggleBackSpUnindents } key [A+-] { MatchBracket } key [A+=] { HilitMatchBracket } # key [A+,] { GetPMClip } # key [A+.] { PutPMClip } key [C+Space] { InsPrevLineChar } key [A+Space] { InsPrevLineToEol } key [C+_] { ShowPosition } key [Center] { MoveLineCenter } key [C+X] { MovePrevPos } key [C+S+A] { ASCIITable } # key [G+*] { LineInsert ; MoveUp; ScrollUp } key [A+G++] { FoldCreate } key [A+G+-] { FoldDestroy } key [G+S++] { FoldPromote } key [G+S+-] { FoldDemote } key [C+G++] { FoldOpen } # key [C+G+-] { FoldClose } key [C+G+*] { FoldOpenNested } key [C+G+/] { FoldToggleOpenClose } key [A+G+*] { FoldOpenAll } key [A+G+/] { FoldCloseAll } # key [C+G-Up] { MoveFoldPrev } # key [C+G-Down] { MoveFoldNext } key [C+K] { ShowKey } key [A+,] { SearchWordPrev } key [A+.] { SearchWordNext } key [A+/] { HilitWord } } mode PLAIN { EventMap = 'PLAIN'; } # C #FOLD01 menu Local_C { #FOLD02 item "&Unmark\tEsc" { BlockMarkStream; BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tCtrl+F10" { FileClose } item; item "&Indent line\tTab" { LineIndent } item "I&ndent block\tAlt+\\" { BlockReIndent } } eventmap C: PLAIN { #FOLD02 LocalMenu = 'Local_C'; # local menu key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [{] { SelfInsert; ?LineIndent } key [}] { SelfInsert; ?LineIndent; MoveLeft; ?HilitMatchBracket; MoveRight } key [)] { SelfInsert; MoveLeft; ?HilitMatchBracket; MoveRight } key [\]] { SelfInsert; MoveLeft; ?HilitMatchBracket; MoveRight } key [:] { SelfInsert; ?LineIndent } key [#] { SelfInsert; ?LineIndent } key [A+\\] { BlockReIndent } # do some smart indents key [A+G-Enter] { LineAdd; LineIndent } key [S+G-Enter] { LineInsert; LineIndent } } mode C { #FOLD02 EventMap = 'C'; } # REXX #FOLD01 eventmap REXX: PLAIN { #FOLD02 key [Tab] { LineIndent LineTrim } key [G-Enter] { LineIndent LineNew } key [:] { SelfInsert LineIndent } key [A+\\] { BlockReIndent } } mode REXX { EventMap = 'REXX'; } #FOLD02 # PERL #FOLD01 eventmap PERL: PLAIN { #FOLD02 key [Tab] { LineIndent LineTrim } key [G-Enter] { LineIndent LineNew } key [#] { SelfInsert LineIndent } key [{] { SelfInsert LineIndent } key [}] { SelfInsert LineIndent } key [A+\\] { BlockReIndent } } mode PERL { EventMap = 'PERL'; } #FOLD02 # JAVA #FOLD01 eventmap JAVA: PLAIN { #FOLD02 key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [{] { SelfInsert; LineIndent } key [}] { SelfInsert; LineIndent } key [:] { SelfInsert; LineIndent } key [#] { SelfInsert; LineIndent } key [A+\\] { BlockReIndent } } mode JAVA { EventMap = 'JAVA'; } #FOLD02 # HTML #FOLD01 menu HTML_Physical { #FOLD02 item "&Bold \tC-E C-B" { HTML_B } item "&Italic \tC-E C-I" { HTML_I } item "&Typewriter \tC-E C-T" { HTML_TT } } menu HTML_Logical { #FOLD02 item "&Definition \tC-E C-D" { HTML_DFN } item "&Emphasize \tC-E C-E" { HTML_EM } item "Citati&on \tC-E C-O" { HTML_CITE } item "&Code \tC-E C-C" { HTML_CODE } item "&Kbd entry \tC-E C-K" { HTML_KBD } item "Sam&ple msg \tC-E C-M" { HTML_SAMP } item "&Strong EM \tC-E C-S" { HTML_STRONG } item "&Variable \tC-E C-V" { HTML_VAR } } menu HTML_Header { #FOLD02 item "&1

    \tC-E 1" { HTML_H1 } item "&2

    \tC-E 2" { HTML_H2 } item "&3

    \tC-E 3" { HTML_H3 } item "&4

    \tC-E 4" { HTML_H4 } item "&5

    \tC-E 5" { HTML_H5 } item "&6
    \tC-E 6" { HTML_H6 } } menu HTML_List { #FOLD02 item "List &item
  • \tC-E i" { HTML_LI } item "&Unordered list \tC-E u" { HTML_UL } item "&Ordered list
      \tC-E o" { HTML_OL } item "Definition &list
      \tC-E l" { HTML_DL } item "Definition &tag
      \tC-E t" { HTML_DT } item "&Definition
      \tC-E d" { HTML_DD } } menu HTML_Table { #FOLD02 item "&Table \tC-E A-T" { HTML_TABLE } item "&Caption \tC-E A-R" { HTML_TR } item "&Data
      \tC-E A-C" { HTML_CAPTION } item "&Header
      \tC-E A-H" { HTML_TH } item "&Row
      \tC-E A-D" { HTML_TD } } menu HTMLTags { #FOLD02 item "&Paragraph

      \tC-E C-P " { HTML_P } item "Line brea&k
      \tC-E Enter" { HTML_BR } item "Horiz.line


      \tC-E &- " { HTML_HR } item; submenu "P&hysical styles ", HTML_Physical; submenu "Logical &styles ", HTML_Logical; submenu "&Header ", HTML_Header; submenu "&Lists ", HTML_List; submenu "&Tables ", HTML_Table; item; item "Pre&formatted
      \tC-E C-F  " { HTML_PRE }
          item    "&Centered      
      \tC-E . " { HTML_CENTER } item; item "Anchor &Name \tC-E C-N " { HTML_ANAME } item "Anchor H&Ref \tC-E C-H " { HTML_AHREF } item; item "Basic document\tC-E &0 " { HTML_Base } } menu Main_HTML { #FOLD02 submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "HT&ML", HTMLTags; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } eventmap HTML: PLAIN { #FOLD02 MainMenu = "Main_HTML"; # menu for menubar key [C+E_0] { HTML_Base } # headers key [C+E_1] { HTML_H1 } key [C+E_2] { HTML_H2 } key [C+E_3] { HTML_H3 } key [C+E_4] { HTML_H4 } key [C+E_5] { HTML_H5 } key [C+E_6] { HTML_H6 } # physical key [C+E_C+B] { HTML_B } key [C+E_C+I] { HTML_I } key [C+E_C+T] { HTML_TT } # logical key [C+E_C+D] { HTML_DFN } key [C+E_C+E] { HTML_EM } key [C+E_C+O] { HTML_CITE } key [C+E_C+C] { HTML_CODE } key [C+E_C+K] { HTML_KBD } key [C+E_C+M] { HTML_SAMP } key [C+E_C+S] { HTML_STRONG } key [C+E_C+V] { HTML_VAR } # lists key [C+E_i] { HTML_LI } key [C+E_u] { HTML_UL } key [C+E_o] { HTML_OL } key [C+E_l] { HTML_DL } key [C+E_t] { HTML_DT } key [C+E_d] { HTML_DD } # tables key [C+E_A+T] { HTML_TABLE } key [C+E_A+C] { HTML_CAPTION } key [C+E_A+H] { HTML_TH } key [C+E_A+R] { HTML_TR } key [C+E_A+D] { HTML_TD } # anchors key [C+E_C+N] { HTML_ANAME } key [C+E_C+H] { HTML_AHREF } key [C+E_C+G] { HTML_IMG } key [C+E_C+F] { HTML_PRE } key [C+E_G-Enter] { HTML_BR } key [C+E_-] { HTML_HR } key [C+E_.] { HTML_CENTER } key [C+E_C+P] { HTML_P } # character escapes key [C+E_&] { InsertString "&"; } key [C+E_<] { InsertString "<"; } key [C+E_>] { InsertString ">"; } key [C+E_"] { InsertString """; } # hilit bug } # make sure proper eventmap is used mode HTML { EventMap = 'HTML'; } #FOLD02 # FTE #FOLD01 eventmap FTE: PLAIN { #FOLD02 key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [{] { SelfInsert; LineIndent } key [}] { SelfInsert; LineIndent } } # make sure proper eventmap is used mode FTE { EventMap = 'FTE'; } #FOLD02 efte-1.1/config/pal_b_kb.fte0000664000076400007640000000051311157534024015021 0ustar laurilauri # color palette (black background) # different colors prefered by kabi # some values must be predefined here - # as only the first setting is used color_palette { { "bg", 'gray:black' }, # background { 'Lang_Punctuation', 'cyan:bg' }, { 'Lang_Preprocessor', 'cyan:bg' }, { 'Lang_Function', 'green:bg' }, } efte-1.1/config/ui_ws.fte0000664000076400007640000000040311157534024014414 0ustar laurilauri# FTE include 'ui_m_ws.fte'; include 'ui_k_ws.fte'; include 'menu/m_c.fte'; include 'menu/m_html.fte'; include 'kbd/k_c.fte'; include 'kbd/k_java.fte'; include 'kbd/k_perl.fte'; include 'kbd/k_rexx.fte'; include 'kbd/k_fte.fte'; include 'kbd/k_html.fte'; efte-1.1/config/m_xp.fte0000664000076400007640000000710111157534024014233 0ustar laurilauri# eXPErimental C syntax parser # does everything that internal does except function( and label: # colorize XPE { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_Number' }, { 'HexNumber', 'Lang_HexNumber' }, { 'OctalNumber', 'Lang_OctalNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; h_state 0 { 'Normal' } h_trans { 13, '-s', 'a-zA-Z_', 'Normal' } h_trans { 1, '', '/*', 'Comment' } h_trans { 2, '', '//', 'Comment' } h_trans { 3, '^', '#', 'CPreprocessor' } h_trans { 4, '', '"', 'String' } h_trans { 5, '', '\'', 'String' } h_trans { 10, '', '0x', 'HexNumber' } h_trans { 11, '', '0', 'OctalNumber' } h_trans { 12, 's', '0-9', 'Number' } h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '', '*/', 'Comment' } h_state 2 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 3 { 'CPreprocessor' } h_trans { 17, '-s', 'a-zA-Z_', 'Normal' } h_trans { 0, '$', '', 'CPreprocessor' } h_trans { 3, 'qQ', '\\', 'CPreprocessor' } h_trans { 8, '', '/*', 'Comment' } h_trans { 9, '', '//', 'Comment' } h_trans { 6, '', '"', 'String' } h_trans { 7, '', '\'', 'String' } h_trans { 14, '', '0x', 'HexNumber' } h_trans { 15, '', '0', 'OctalNumber' } h_trans { 16, 's', '0-9', 'Number' } h_state 4 { 'String' } h_trans { 0, '', '"', 'String' } h_trans { 0, '$', '', 'String' } h_trans { 4, 'Qq', '\\', 'String' } h_state 5 { 'String' } h_trans { 0, '', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_trans { 5, 'Qq', '\\', 'String' } h_state 6 { 'String' } h_trans { 3, '', '"', 'String' } h_trans { 3, '$', '', 'String' } h_trans { 6, 'Qq', '\\', 'String' } h_state 7 { 'String' } h_trans { 3, '', '\'', 'String' } h_trans { 3, '$', '', 'String' } h_trans { 7, 'qQ', '\\', 'String' } h_state 8 { 'Comment' } h_trans { 3, '', '*/', 'Comment' } h_state 9 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 10 { 'HexNumber' } h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 11 { 'OctalNumber' } h_trans { 0, '-S', '0-7', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 12 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 13 { 'Normal' } h_trans { 0, '-S', 'a-zA-Z0-9_', 'Punctuation' } h_trans { 0, '$', '', 'Normal' } h_state 14 { 'HexNumber' } h_trans { 3, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 3, '$', '', 'Normal' } h_state 15 { 'OctalNumber' } h_trans { 3, '-S', '0-7', 'Normal' } h_trans { 3, '$', '', 'Normal' } h_state 16 { 'Number' } h_trans { 3, '-S', '0-9', 'Normal' } h_trans { 3, '$', '', 'Normal' } h_state 17 { 'CPreprocessor' } h_trans { 3, '-S', 'a-zA-Z0-9_', 'Punctuation' } h_trans { 3, '$', '', 'Normal' } } mode XPE: SOURCE { FileNameRx = /\.\cXPE$/; HilitOn = 1; Colorizer = 'XPE'; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; } oinclude 'mym_xp.fte'; efte-1.1/config/m_rexx.fte0000664000076400007640000002402011157534024014571 0ustar laurilauri# FTE mode for editing REXX files # enhanced from the original by Michael DeBusk # debu4335@eclipsetel.com # Revision March 19, 2001 # Header Comment # Note: If the environment variable USER is set, # This macro will insert the contents after the # word "Author:" and leave the cursor after # "Purpose:". If it is not set, the macro will # fail after "Author:". sub REXX_Heading { InsertString "/*"; LineNew; InsertString "* Filename: "; InsertString $FileName; LineNew; InsertString "* Author: "; LineNew; InsertString "* Created: "; InsertDate; LineNew; InsertString "* Purpose: "; LineNew; InsertString "* Changes: "; LineNew; InsertString "*/"; 4:MoveUp; MoveLineEnd; InsertUid; 2:MoveDown; MoveLineEnd; } #Comment a blocked string sub REXX_Comment { ?MoveBlockStart; InsertString "/* "; ?MoveBlockEnd; InsertString " */"; BlockUnmark; } # Load external functions sub REXX_RexxUtil { InsertString "/* Load RexxUtil Library */"; LineNew; InsertString "If RxFuncQuery('SysLoadFuncs') Then"; LineNew; InsertString "Do"; LineNew; InsertString "Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'"; LineNew; InsertString "Call SysLoadFuncs"; LineNew; InsertString "End"; 2:LineNew; } %if(OS_OS2) sub REXX_RxSock { InsertString "/* Load RxSock Library */"; LineNew; InsertString "If RxFuncQuery('SockLoadFuncs') Then"; LineNew; InsertString "Do"; LineNew; InsertString "Call RxFuncAdd 'SockLoadFuncs','RxSock','SockLoadFuncs'"; LineNew; InsertString "Call SockLoadFuncs"; LineNew; InsertString "End"; 2:LineNew; } sub REXX_RxFTP { InsertString "/* Load RxFTP Library */"; LineNew; InsertString "If RxFuncQuery('FTPLoadFuncs') Then"; LineNew; InsertString "Do"; LineNew; InsertString "Call RxFuncAdd 'FTPLoadFuncs','RxFTP','FTPLoadFuncs'"; LineNew; InsertString "Call FTPLoadFuncs"; LineNew; InsertString "End"; 2:LineNew; } %endif # Constructs sub REXX_Do { InsertString "DO [TO] [BY] [FOR] "; 2:LineNew; InsertString "END"; LineNew; 3:MoveUp; MoveLineStart; 3:MoveRight; } sub REXX_DoUntil { InsertString "DO [TO] [BY] [FOR] UNTIL "; 2:LineNew; InsertString "END"; LineNew; 3:MoveUp; MoveLineStart; 3:MoveRight; } sub REXX_DoWhile { InsertString "DO [TO] [BY] [FOR] WHILE "; 2:LineNew; InsertString "END"; LineNew; 3:MoveUp; MoveLineStart; 3:MoveRight; } sub REXX_DoForever { InsertString "DO FOREVER"; 2:LineNew; InsertString "END"; LineNew; 2:MoveUp; MoveLineEnd; } sub REXX_If { InsertString "IF THEN"; 2:LineNew; InsertString "ELSE"; LineNew; 3:MoveUp; MoveLineStart; 3:MoveRight; } sub REXX_Select { InsertString "SELECT"; LineNew; InsertString "WHEN THEN"; LineNew; InsertString "/* instruction */"; LineNew; InsertString "WHEN THEN"; LineNew; InsertString "/* instruction */"; LineNew; InsertString "WHEN THEN"; LineNew; InsertString "/* instruction */"; LineNew; InsertString "OTHERWISE"; LineNew; InsertString "/* instruction */"; LineNew; InsertString "END"; LineNew; 9:MoveUp; MoveLineStart; 9:MoveRight; } colorize REXX { SyntaxParser = 'REXX'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_Number' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, }; # REXX Keyword Instructions keyword 'Editor_Keywords' { 'ADDRESS', 'ARG', 'CALL', 'DO', 'DROP', 'EXIT', 'EXPOSE', 'FORWARD', 'GUARD', 'IF', 'INTERPRET', 'ITERATE', 'LEAVE', 'NOP', 'NUMERIC', 'OPTIONS', 'PARSE', 'PROCEDURE', 'PULL', 'PUSH', 'QUEUE', 'RAISE', 'REPLY', 'RETURN', 'SAY', 'SELECT', 'SELF', 'SIGNAL', 'SUPER', 'TRACE', 'USE', }; # Parameters for keywords and functions keyword 'Editor_Keywords2' { 'ADDITIONAL', 'ANY', 'APPEND', 'ARRAY', 'BINARY', 'BOTH', 'BY', 'CASELESS', 'CHAR', 'CLOSE', 'DATETIME', 'DIGITS', 'ELSE', 'END', 'ENGINEERING', 'ERROR', 'EXISTS', 'FAILURE', 'FLUSH', 'FOR', 'FOREVER', 'FORM', 'FUZZ', 'HALT', 'HANDLE', 'LINE', 'LOSTDIGITS', 'LOWER', 'NAME', 'NOBUFFER', 'NOMETHOD', 'NORMAL', 'NOSTRING', 'NOTREADY', 'NOVALUE', 'OBJECT', 'OFF', 'ON', 'OPEN', 'OTHERWISE', 'OVER', 'POSITION', 'QUERY', 'READ', 'RECLENGTH', 'REPLACE', 'SCIENTIFIC', 'SEEK', 'SIZE', 'SOURCE', 'STREAMTYPE', 'SYNTAX', 'SYS', 'THEN', 'TIMESTAMP', 'TO', 'UNTIL', 'UPPER', 'USER', 'VALUE', 'VAR', 'VARIABLE', 'VERSION', 'WHEN', 'WHILE', 'WITH', 'WRITE', }; # Built-in functions keyword 'Editor_Keywords3' { 'ABBREV', 'ABS', 'ADDRESS', 'ARG', 'BEEP', 'BITAND', 'BITOR', 'BITXOR', 'B2X', 'CENTER', 'CENTRE', 'CHANGESTR', 'CHARIN', 'CHAROUT', 'CHARS', 'COMPARE', 'CONDITION', 'COPIES', 'COUNTSTR', 'C2D', 'C2X', 'DATATYPE', 'DATE', 'DELSTR', 'DELWORD', 'D2C', 'D2X', 'DIRECTORY', 'ERRORTEXT', 'ENDLOCAL', 'FILESPEC', 'FORMAT', 'INSERT', 'LASTPOS', 'LEFT', 'LENGTH', 'LINEIN', 'LINEOUT', 'LINES', 'MAX', 'METHODS', 'MIN', 'OVERLAY', 'POS', 'QUEUED', 'RANDOM', 'REVERSE', 'RIGHT', 'RS', 'RXFUNCADD', 'RXFUNCDROP', 'RXFUNCQUERY', 'RXQUEUE', 'SETLOCAL', 'SIGN', 'SOURCELINE', 'SPACE', 'STREAM', 'STRIP', 'SUBSTR', 'SUBWORD', 'SYMBOL', 'TIME', 'TRACE', 'TRANSLATE', 'TRUNC', 'VERIFY', 'WORD', 'WORDINDEX', 'WORDLENGTH', 'WORDPOS', 'WORDS', 'XRANGE', 'X2B', 'X2C', 'X2D', }; } mode REXX: SOURCE { # REXX mode FileNameRx = /\.\c{CMD}|{REXX?}$/; HilitOn = 1; Colorizer = 'REXX'; TabSize = 8; AutoIndent = 1; IndentMode = 'REXX'; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; RoutineRegexp = /^[\w_]+:/; } colorize NETREXX: REXX { SyntaxParser = 'REXX'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_Number' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, }; # keywords don't inherit? they probably should... # REXX Keyword Instructions keyword 'Editor_Keywords' { 'ADDRESS', 'ARG', 'CALL', 'CLASS', 'DO', 'DROP', 'EXIT', 'EXPOSE', 'IF', 'IMPORT', 'INTERPRET', 'ITERATE', 'LEAVE', 'LOOP', 'METHOD', 'NOP', 'NUMERIC', 'OPTIONS', 'PACKAGE', 'PARSE', 'PROCEDURE', 'PROPERTIES', 'PULL', 'PUSH', 'QUEUE', 'RETURN', 'SAY', 'SELECT', 'SIGNAL', 'TRACE', }; # Parameters for keywords and functions keyword 'Editor_Keywords2' { 'ALL', 'ABSTRACT', 'BY', 'CATCH', 'CONSTANT', 'DIGITS', 'ELSE', 'END', 'ENGINEERING', 'ERROR', 'EXTENDS', 'FAILURE', 'FINAL', 'FINALLY', 'FOR', 'FOREVER', 'FORM', 'FUZZ', 'HALT', 'IMPLEMENTS', 'INHERITABLE', 'INTERFACE', 'LABEL', 'METHODS', 'NAME', 'NATIVE', 'NOTREADY', 'NOVALUE', 'OFF', 'ON', 'OTHERWISE', 'OVER', 'PRIVATE', 'PROTECT', 'PUBLIC', 'RESULTS', 'RETURNS', 'SCIENTIFIC', 'SIGNALS', 'SOURCE', 'STATIC', 'SYNTAX', 'THEN', 'TO', 'UNTIL', 'UPPER', 'USES', 'VALUE', 'VAR', 'VERSION', 'VOLATILE', 'WHEN', 'WHILE', 'WITH', }; # Primitives and other stuff keyword 'Editor_Keywords3' { 'BOOLEAN', 'BYTE', 'CHAR', 'CROSSREF', 'DIAG', 'DOUBLE', 'FLOAT', 'INT', 'LONG', 'NOCROSSREF', 'NODIAG', 'NOFORMAT', 'NOREPLACE', 'NOSTRICTARGS', 'NOSTRICTASSIGN', 'NOSTRICTCASE', 'NOSTRICTSIGNAL', 'NOTRACE', 'NOUTF9', 'NOVERBOSE', 'NOVERBOSEX', 'NULL', 'REXX', 'SHORT', 'STRICTARGS', 'STRICTASSIGN', 'STRICTCASE', 'STRICTSIGNAL', 'UTF9', 'VERBOSE', 'VERBOSEX', }; } mode NETREXX: REXX { FileNameRx = /\.\c{NRX}$/; Colorizer = 'NETREXX'; } oinclude 'mym_rexx.fte'; efte-1.1/config/ab_java.fte0000664000076400007640000000360611157534024014661 0ustar laurilauri# Java language templates eventmap JAVA { # these work well for default indentation settings # changes may be necessary if you use different indentation # typical usage would be typing ifx and . # useful command here is which adds # a new line after the current one, and indents it properly. # in cmode defined as LineAdd; LineIndent; abbrev 'ifx' { KillWordPrev; %if(BSD_BRACE) InsertString 'if ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'if () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; # do not insert typed character } abbrev 'whx' { KillWordPrev; %if(BSD_BRACE) InsertString 'while ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'while () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; } abbrev 'swx' { KillWordPrev; %if(BSD_BRACE) InsertString 'switch ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'switch () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; } abbrev 'cax' { KillWordPrev; InsertString 'case :'; LineIndent; LineNew; InsertString 'break;'; LineIndent; MoveUp; MoveLineEnd; MovePrev; Fail; } abbrev 'dex' { KillWordPrev; InsertString 'default:'; LineIndent; 2:LineNew; InsertString 'break;'; LineIndent; MoveUp; LineIndent; Fail; } } efte-1.1/config/main.fte0000664000076400007640000002212311177363664014231 0ustar laurilauri# Main FTE Configuration File # operating system is now defined by CFTE # OS_UNIX, OS_OS2, OS_DOS32, OS_NT # uncomment for appropriate keybindings and menus #%define(UI_KB) %define(UI_FTE) #%define(UI_WS) #%define(UI_NE) #%define(UI_BRIEF) # experimental %if(!BSD_BRACE) %define(1TBS_BRACE) %endif #%define(COLORS_GRAY_BG) #%define(COLORS_WHITE_BG) %define(COLORS_BLACK_BG) #%define(COLORS_BLUE_BG) #%define(COLORS_BLUEZ_BG) #%define(COLORS_NCE_BG) %if(OS_OS2) %define(GUI_PM) %endif %if(OS_UNIX) %define(GUI_X11) %endif # to customize FTE to your preferences you should only need # to add stuff in this file. # Some examples are below. If you find something that cannot be # configured here, tell me about it. # If you wish to modify only a specific mode, add customizations # at the end of file. To also modify all of the descendants, # put customizations right after the include statement for mode. # The current hierarchy of modes is: # PLAIN # TEXT # MSG # C # ... # BIN # The order of things in this file is important! If you change a setting # before the default is set in one of the included files, your # setting will have no effect. # The file is processed in one pass, so everything should be defined, # before it is used. # My ultimate goal is to have the default files unmodifiable and # have all customization done here, but this is not currently possible for # all things (menus come to mind). include 'global.fte'; include 'pal_base.fte'; #color_palette { # { 'Comment', 'green:black' }, #} %if(COLORS_BLACK_BG) %if(UI_KB) include 'pal_b_kb.fte'; %endif include 'pal_blk.fte'; %endif %if(COLORS_WHITE_BG) include 'pal_wht.fte'; %endif %if(COLORS_GRAY_BG) include 'pal_gray.fte'; %endif %if(COLORS_BLUE_BG) include 'pal_blue.fte'; %endif %if(COLORS_BLUEZ_BG) include 'pal_bluez.fte'; # alternate blue from andyz @ sf.net %endif %if(COLORS_NCE_BG) include 'pal_nce.fte'; %endif object GLOBAL { # fonts for GUI version %if(GUI_PM) # PM # Only System VIO fonts are used. Some listed below. XX*YY. # WindowFont = "8x8"; # WindowFont = "6x10"; # WindowFont = "8x10"; # WindowFont = "5x12"; # WindowFont = "8x12"; # WindowFont = "6x14"; WindowFont = "8x14"; # WindowFont = "5x16"; # WindowFont = "8x16"; # WindowFont = "8x18"; %endif %if(GUI_X11) # X11 # Any fixed-width font should do. Make sure it has all 256 characters # defined or weird things can happen. # WindowFont = "fixed"; # WindowFont = "6x8"; # WindowFont = "7x13"; # WindowFont = "8x13"; # WindowFont = "9x15"; WindowFont = "9x15"; %if(UI_KB) WindowFont = "*-fixed-bold-*-15*,*-fixed-bold-*-16*"; %endif # We need some font, which can be 'LOCALIZED' - and this can't be done # with font names like 9x15 (actually we can, but this would need # highly skilled users :)) # WindowFont = "10x20"; %endif } include 'color.fte'; # change background color # must be here to be inherited by other modes # object PLAIN { color { { 'Background', '17' } }; } # in this mode are declared all basic values # these are inherited in other modes - so basicaly # change only necessary values in submodes # must be here to be inherited by other modes include 'm_plain.fte'; # In addition to just PLAIN, there are two other special modes # SOURCE and MARKUP. All programming language modes inherit from # SOURCE and all markup modes, such has HTML, LaTeX, etc, inherit # from MARKUP. Both SOURCE and MARKUP inherit from PLAIN. include 'm_source.fte'; include 'm_markup.fte'; # UNIX files have no CR at the end of line %if(OS_UNIX) mode PLAIN { # Don't autodetect line separator DetectLineSep = 0; # Don't add CR at EOL when saving AddCR = 0; # Don't remove CR if at EOL when loading StripChar = -1; } %endif eventmap TEX: PLAIN { key [F9] { Compile "latex " #. $FileName } } include 'm_4gl.fte'; include 'm_a51.fte'; include 'm_ada.fte'; include 'm_asm.fte'; include 'm_asm370.fte'; include 'm_basic.fte'; include 'm_bin.fte'; include 'm_c.fte'; include 'm_catbs.fte'; include 'm_clario.fte'; include 'm_css.fte'; include 'm_diff.fte'; include 'm_ebnf.fte'; include 'm_eiffel.fte'; include 'm_euphoria.fte'; include 'm_fort90.fte'; include 'm_falcon.fte'; include 'm_fte.fte'; include 'm_gawk.fte'; include 'm_groovy.fte'; include 'm_html.fte'; include 'm_icon.fte'; include 'm_idl.fte'; include 'm_ipf.fte'; include 'm_java.fte'; include 'm_ldsgml.fte'; include 'm_lisaac.fte'; include 'm_lua.fte'; include 'm_make.fte'; include 'm_merge.fte'; include 'm_mod3.fte'; include 'm_msg.fte'; include 'm_pascal.fte'; include 'm_perl.fte'; include 'm_php.fte'; include 'm_py.fte'; include 'm_resdlg.fte'; include 'm_rexx.fte'; include 'm_rpm.fte'; include 'm_ruby.fte'; include 'm_sgml.fte'; include 'm_sh.fte'; include 'm_siod.fte'; include 'm_sl.fte'; include 'm_sml.fte'; include 'm_sql.fte'; include 'm_tcl.fte'; include 'm_tex.fte'; include 'm_texi.fte'; include 'm_text.fte'; include 'm_unrealscript.fte'; include 'm_vhdl.fte'; include 'm_xml.fte'; include 'm_xslt.fte'; include 'm_rst.fte'; include 'm_ocaml.fte'; # Must be included AFTER m_text.fte in order for the filename regexp to # match correctly (i.e. CMakeLists.txt should match CMAKE mode, not TEXT mode) include 'm_cmake.fte'; # C indentation style menu include 'uicstyle.fte'; # When doing large customizations of keyboard/menus # you should probably write your own version of these files. # to change a menu, predefine it before including the ui_*.fte file. # to add/override keybindings add them after including ui_*.fte file. # ui*.fte -files define all keyboard bindings and menus. # pick only one file. %if(UI_FTE) include 'ui_fte.fte'; # fte CUA style bindings %endif %if(UI_WS) include 'ui_ws.fte'; # wordstar like %endif %if(UI_NE) include 'ui_ne.fte'; # norton classic editor - incomplete %endif %if(UI_MEW) include 'ui_mew.fte'; # MultiEdit4Windows %endif %if(UI_BRIEF) include 'ui_brief.fte'; # BRIEF/CRISP %endif ##include 'ui_vi.fte'; # VI - very incomplete # todo: brief, epm, emacs, VI # some templates and abbreviations include 'ab_c.fte'; %if(OS_OS2) include 'ab_c_os2.fte'; %endif include 'ab_rexx.fte'; include 'ab_sh.fte'; include 'ab_java.fte'; include 'ab_perl.fte'; # some customizations object GLOBAL { SelectPathname = 0; ShowToolBar = 1; # PM only GUIDialogs = 1; # PM only SysClipboard = 1; # use PM clipboard, or X11 selection for clipboard # PMDisableAccel = 0; # disable Alt+Fx PM accelerators # enable common cursor movements (always staying within EOL) # CursorWithinEOL = 1; } # some editors have a SmartPaste feature. We can do that too. #eventmap C { key [S+G-Ins] { BlockPasteStream; BlockReIndent } } eventmap PLAIN { key [A+S+-] { # select block between {}()[]<> BlockUnmark; BlockMarkStream; MatchBracket; BlockMarkStream; SavePos; MoveBlockEnd; 2:MoveNext; ?MoveLeft; # do this to mark a newline after })>] BlockEnd; MoveSavedPos; } key [A+C+F] { IndentFunction } key [A+C+M] { BlockMarkFunction } key [A+C+[] { MoveFunctionPrev } key [A+C+\]] { MoveFunctionNext } key [C+F1] { ShowHelpWord %if(OS_OS2) # OS/2 - helpfile (can be contatenated) "CPREF+PMWIN+PMMSG+PMGPI+PMREL+PMFUN+PMHOK" %endif %if(OS_UNIX) # UNIX - specify options to MAN "" %endif %if(OS_NT) # Win32 - helpfile # "" %endif } %if(OS_OS2) key [S+F1] { ShowHelpWord "EMXDEV+EMXGNU+EMXLIB+EMXRT+EMXBSD" } %if(!UI_BRIEF) key [F1] { ShowHelp "FTE" "" } %endif %endif #key [C+A+F1] { # InsertString $FileName # InsertString $FilePath # InsertString $CurDirectory #} key [C+A+U] { MoveLineStart; ?FindReplace /^\/\/ / // "xnc"; MoveDown #MoveLineStart; ?FindReplace /^(\s*)\/\// /\1/ "xnc"; MoveDown } key [C+A+C] { MoveLineStart; ?FindReplace /^(\s*)/ /\/\/ \1/ "xnc"; MoveDown #MoveLineStart; ?FindReplace /^(\s*)\/\// /\1/ "xnc"; #MoveLineStart; ?FindReplace /^(\s*)/ /\1\/\// "xnc"; MoveDown } key [G-Home] { MoveBeginOrNonWhite } key [C+G-Up] { PopGlobalBookmark } key [C+G-Down] { PushGlobalBookmark } #key [C+A+S+F] { # LineNew; # InsertString "path:" . $FilePath; LineNew; # InsertString "name:" . $FileName; LineNew; # InsertString "dir:" . $FileDirectory; LineNew; # InsertString "base:" . $FileBaseName; LineNew;. # InsertString "ext:" . $FileExtension; LineNew; #} } #and here is my function noumlaut: sub noumlaut { PlaceBookmark "0"; ?FindReplace // /\"a/ "agn" ; ?FindReplace // /\"o/ "agn" ; ?FindReplace // /\"u/ "agn" ; ?FindReplace // /\"A/ "agn" ; ?FindReplace // /\"O/ "agn" ; ?FindReplace // /\"U/ "agn" ; ?FindReplace // /{\ss}/ "agn" ; GotoBookmark "0"; } object GLOBAL { # SevenBit = 1; # seven bit characters only for user interface... } eventmap PLAIN { #left arrow at the beginning of line moves to previous line # key [G-Left] { MovePrev } #right arrow at the end of line moves to next line # key [G-Right] { MoveNext } key [A+C+Enter] { noumlaut; RunProgram "latex " . $FileName; } } efte-1.1/config/rgbcolor.fte0000664000076400007640000000070211157534024015101 0ustar laurilauriobject GLOBAL { RGBColor = '0:00,00,00'; RGBColor = '1:00,24,54'; RGBColor = '2:04,7c,34'; RGBColor = '3:00,7c,9c'; RGBColor = '4:98,00,00'; RGBColor = '5:00,a8,fc'; RGBColor = '6:88,88,00'; RGBColor = '7:a8,a8,a8'; RGBColor = '8:40,40,40'; RGBColor = '9:54,7c,ac'; RGBColor = 'a:54,f4,90'; RGBColor = 'b:54,e0,fc'; RGBColor = 'c:fc,68,54'; RGBColor = 'd:fc,84,b0'; RGBColor = 'e:fc,fc,54'; RGBColor = 'f:fc,fc,e4'; } efte-1.1/config/mymain.fte0000664000076400007640000000054711157534024014571 0ustar laurilauri# Default personal main fte config file. # The purpose of this file is to allow individual users to add extra # functionality over and above what the sysadmin may have made available # without adversely affecting other users. # include the system main config - usually in /usr/local/fte/localconfig. include 'systemmain.fte'; # Personal settings go here. efte-1.1/config/m_css.fte0000664000076400007640000000761311157534024014404 0ustar laurilauri# # eFTE mode for CSS files # colorize CSS { SyntaxParser = "SIMPLE"; color { { "Normal", "Editor_Default" }, { "Function", "Lang_Function" }, { "Number", "Lang_DecimalNumber" }, { "Comment", "Lang_Comment" }, { "String", "Lang_String" }, { "Punctuation", "Lang_Punctuation" }, }; keyword "Editor_Keywords" { "a", "abbr", "acronym", "address", "area", "b", "base", "bdo", "big", "blockquote", "body", "br", "button", "caption", "cite", "code", "col", "colgroup", "dd", "del", "dfn", "div", "dl", "dt", "em", "fieldset", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "map", "meta", "noframes", "noscript", "object", "ol", "optgroup", "option", "p", "param", "pre", "q", "samp", "script", "select", "small", "span", "strong", "style", "sub", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "title", "tr", "tt", "ul", "var" }; keyword "Editor_Keywords2" { "font-family", "font-style", "font-variant", "font-weight", "font-size", "font", "background-color", "background-image", "background-repeat", "background-attachment", "background-position", "color", "background", "word-spacing", "letter-spacing", "border-top-width", "border-right-width", "border-left-width", "border-bottom-width", "border-width", "list-style-type", "list-style-image", "list-style-position", "text-decoration", "vertical-align", "text-transform", "text-align", "text-indent", "line-height", "margin-top", "margin-right", "margin-bottom", "margin-left", "margin", "padding-top", "padding-right", "padding-bottom", "padding-left", "padding", "border-top", "border-right", "border-bottom", "border-left", "border", "width", "height", "float", "clear", "display", "list-style", "white-space", "border-style", "border-color" }; keyword "Editor_Keywords3" { "azimuth", "border-bottom-color", "border-bottom-style", "border-collapse", "border-left-color", "border-left-style", "border-right-color", "border-right-style", "border-top-color", "border-top-style", "caption-side", "cell-spacing", "clip", "column-span", "content", "cue", "cue-after", "cue-before", "cursor", "direction", "elevation", "font-size-adjust", "left", "marks", "max-height", "max-width", "middle", "min-height", "min-width", "orphans", "overflow", "page-break-after", "page-break-before", "pause", "pause-after", "pause-before", "pitch", "pitch-range", "play-during", "position", "richness", "right", "row-span", "size", "speak", "speak-date", "speak-header", "speak-punctuation", "speak-time", "speech-rate", "stress", "table-layout", "text-shadow", "top", "visibility", "voice-family", "volume", "widows", "z-index" }; keyword "Editor_Keywords4" { "@import", "@page", "@font-face" }; h_state 0 { "Normal" } h_trans { 1, "-s", /a-zA-Z_\-@/, "Normal" } h_trans { 2, "<", '/*', "Comment" } h_trans { 3, "", "#", "Number" } h_trans { 0, "S", /_a-zA-Z0-9\-@/, "Punctuation" } h_state 1 { "Normal" } h_trans { 0, "$", "", "Normal" } h_wtype { 1, 1, 0, "", /a-zA-Z0-9_\-@/ } h_state 2 { "Comment" } h_trans { 0, ">", '*/', "Comment" } h_state 3 { "Number" } h_trans { 0, "-S", /0-9A-Fa-f/, "Normal" } } mode CSS: SOURCE { FileNameRx = /\c\.css$/; HilitOn = 1; Colorizer = "CSS"; AutoIndent = 1; MatchCase = 0; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; CommentStart = ' /*'; CommentEnd = '*/'; } oinclude "mym_css.fte"; efte-1.1/config/ab_perl.fte0000664000076400007640000000302611157534024014676 0ustar laurilauri# perl language templates eventmap PERL { # these work well for default indentation settings # changes may be necessary if you use different indentation # typical usage would be typing ifx and . # useful command here is which adds # a new line after the current one, and indents it properly. # in cmode defined as LineAdd; LineIndent; abbrev 'ifx' { KillWordPrev; %if(BSD_BRACE) InsertString 'if ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'if () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; # do not insert typed character } abbrev 'whx' { KillWordPrev; %if(BSD_BRACE) InsertString 'while ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'while () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; } abbrev 'unx' { KillWordPrev; %if(BSD_BRACE) InsertString 'unless ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'unless () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; } } efte-1.1/config/m_xml.fte0000664000076400007640000000412511157534024014407 0ustar laurilauri# # basic Syntaxhighliting for xml documents # based on HTML Mode sub XML_Base { InsertString '";'; LineNew; MoveLineStart; } colorize XML { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Keywords' }, { 'Command', 'Editor_Default' }, { 'Comment', 'Lang_Comment' }, { 'String', 'Lang_String' }, { 'Symbol', 'Markup_Symbol' }, { 'Tag', 'Markup_Tag' }, { 'Special', 'Markup_Special' }, }; keyword "Editor_Keywords" { "DOCTYPE", "PUBLIC", }; h_state 0 { 'Normal' } h_trans { 5, '<', '"; } eventmap XML { abbrev '_xml' { KillWordPrev; InsertString ''; LineNew; MoveLineStart; Fail; } } oinclude 'mym_xml.fte'; efte-1.1/config/pal_blue.fte0000664000076400007640000001231411157534024015055 0ustar laurilauri# color palette (blue background) # the color palette is the definition of the symbolic colors # that are used everywhere else in the configuration files # syntax of the color specification is: # # fore back # or # symbolic_fore:symbolic_back # or # symbolic color_palette { { 'ScrollBar_Arrows', 'black:gray' }, { 'ScrollBar_Background', 'gray:black' }, { 'ScrollBar_Slider', 'black:gray' }, { 'Status_Normal', 'black:darkCyan' }, { 'Status_Active', 'black:gray' }, { 'Message_Normal', 'cyan:darkBlue' }, { 'Message_Error', 'white:darkBlue' }, { 'Message_Bold', 'yellow:darkBlue' }, { 'EntryField_Field', 'darkCyan:gray' }, { 'EntryField_Prompt', 'black:gray' }, { 'EntryField_Selection', 'black:darkCyan' }, { 'List_Status', 'black:gray' }, { 'List_Normal', 'gray:darkBlue' }, { 'List_Selected', 'black:darkCyan' }, { 'List_Hilited', 'white:darkBlue' }, { 'List_HilitSelect', 'white:darkCyan' }, { 'List_Marked', 'yellow:darkBlue' }, { 'List_MarkSelect', 'yellow:darkCyan' }, { 'List_MarkHilit', 'yellow:darkBlue' }, { 'List_MarkHilitSel', 'yellow:darkCyan' }, { 'ASCII_Chars', 'black:gray' }, { 'Menu_Background', 'black:gray' }, { 'Menu_ActiveItem', 'white:darkCyan' }, { 'Menu_ActiveChar', 'darkRed:darkCyan' }, { 'Menu_NormalItem', 'black:gray' }, { 'Menu_NormalChar', 'darkRed:gray' }, { "Choice_Title", 'black:gray' }, { "Choice_Param", 'darkCyan:gray' }, { "Choice_Background", 'black:gray' }, { "Choice_ActiveItem", 'black:darkCyan' }, { "Choice_ActiveChar", 'darkRed:darkCyan' }, { "Choice_NormalItem", 'black:gray' }, { "Choice_NormalChar", 'darkRed:gray' }, { "bg", 'yellow:darkBlue' }, # background { "fg", 'yellow:darkBlue' }, # foreground { 'Editor_Selected', 'black:darkCyan' }, { 'Editor_Markers', 'darkCyan:bg' }, { 'Editor_FoundText', 'black:gray' }, { 'Editor_Folds0', 'cyan:bg' }, { 'Editor_Folds1', 'green:bg' }, { 'Editor_Folds2', 'magenta:bg' }, { 'Editor_Folds3', 'magenta:bg' }, { 'Editor_Folds4', 'magenta:bg' }, { 'Editor_HilitWord', 'black:gray' }, { 'Editor_Default', 'fg:bg' }, { 'Editor_Bold', 'cyan:bg' }, { 'Editor_Keywords', 'white:bg' }, { 'Editor_Keywords2', 'cyan:bg' }, { 'Editor_Keywords3', 'green:bg' }, { 'Editor_Keywords4', 'yellow:bg' }, { 'Editor_Keywords5', 'magenta:bg' }, { 'Msg_Header', 'darkCyan:bg' }, { 'Msg_Quotes', 'green:bg' }, { 'Msg_Tag', 'white:bg' }, { 'Msg_Signature', 'cyan:bg' }, { 'Comment', 'gray:bg' }, { 'String', 'cyan:bg' }, { 'Lang_Default', 'Editor_Default' }, { 'Lang_Number', 'cyan:bg' }, { 'Lang_DecimalNumber', 'Lang_Number' }, { 'Lang_HexNumber', 'cyan:bg' }, { 'Lang_OctalNumber', 'magenta:bg' }, { 'Lang_BinaryNumber', 'magenta:bg' }, { 'Lang_Punctuation', 'white:bg' }, { 'Lang_String', 'String' }, { 'Lang_Comment', 'Comment' }, { 'Lang_Preprocessor', 'green:bg' }, { 'Lang_Function', 'green:bg' }, { 'Lang_Label', 'red:bg' }, { 'Lang_Command', 'cyan:bg' }, { 'Lang_Regexp', 'magenta:bg' }, { 'Lang_Variable', 'gray:bg' }, { 'Lang_Control', 'darkCyan:bg' }, { 'Lang_Assembler', 'red:bg' }, # embedded assembler (Pascal) { 'Markup_Default', 'Editor_Default' }, { 'Markup_Punctuation', 'white:bg' }, { 'Markup_String', 'String' }, { 'Markup_Symbol', 'gray:bg' }, { 'Markup_Tag', 'yellow:bg' }, { 'Markup_Comment', 'Comment' }, { 'Markup_Special', 'white:bg' }, { 'Markup_Control', 'magenta:bg' }, { 'Markup_Quotes', 'green:bg' }, { 'Markup_Math', 'white:bg' }, # diff/diff3 { 'DIFF_Old', 'gray:bg' }, { 'DIFF_New', 'white:bg' }, { 'DIFF_Changed', 'darkCyan:bg' }, # rcsmerge { 'MERGE_Changed', 'magenta:bg' }, { 'MERGE_Old', 'yellow:bg' }, { 'MERGE_New', 'cyan:bg' }, { 'MERGE_Control', 'white:bg' }, } efte-1.1/config/ui_k_ws.fte0000664000076400007640000003410411157534024014733 0ustar laurilaurieventmap MODEL { key [F1] { ViewModeMap } key [C+F2] { FileSaveAll } key [F3] { FileOpen } key [F4] { WinNext } key [C+F4] { WinHSplit } key [S+F4] { WinPrev } key [A+S-F4] { WinClose } key [F5] { WinZoom } key [F6] { FileNext } key [S+F6] { FilePrev } key [A+S-F6] { FileLast } key [F10] { MainMenu } key [C+F10] { FileClose } key [C+F9] { RunProgram } key [A+F9] { RunProgram "" } key [S+F10] { LocalMenu } key [C+Q_C-S-Q] { FileClose } key [C+G-Up] { WinPrev } key [C+G-Down] { WinNext } key [A+G-PgUp] { WinPrev; MovePageUp; WinNext } key [A+G-PgDn] { WinNext; MovePageDown; WinPrev } key [A+C+G-PgUp] { WinNext; MovePageUp; WinPrev } key [A+C+G-PgDn] { WinPrev; MovePageDown; WinNext } key [A+X] { ExitEditor } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } # this is also useful for 'grep -n' etc. if configured key [F9] { Compile; ViewMessages } key [F11] { CompilePrevError } key [F12] { CompileNextError } key [S+F9] { ViewMessages } key [A+0] { ViewBuffers } key [A+1] { SwitchTo 1 } key [A+2] { SwitchTo 2 } key [A+3] { SwitchTo 3 } key [A+4] { SwitchTo 4 } key [A+5] { SwitchTo 5 } key [A+6] { SwitchTo 6 } key [A+7] { SwitchTo 7 } key [A+8] { SwitchTo 8 } key [A+9] { SwitchTo 9 } } # List Viewers eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [C+Left] { ScrollRight } key [C+Right] { ScrollLeft } key [C+S] { MoveLeft } key [C+D] { MoveRight } key [C+E] { MoveUp } key [C+X] { MoveDown } key [C+R] { MovePageUp } key [C+C] { MovePageDown } key [C+Q_C-S-R] { MoveFileStart } key [C+Q_C-S-C] { MoveFileEnd } key [G-Enter] { Activate } key [Space] { ActivateInOtherWindow } key [S+Enter] { CloseActivate } key [C+N] { Rescan } } eventmap CVSDIFF: MLIST { key [C+G-Ins] { BlockCopy } key [Esc] { FileClose } } eventmap CVS: MLIST { LocalMenu = "MCvs"; } eventmap SVNDIFF: MLIST { key [C+G-Ins] { BlockCopy } key [Esc] { FileClose } } eventmap SVN: MLIST { LocalMenu = "MSvn"; } eventmap DIRECTORY: MLIST { MainMenu = 'DirectoryMain'; LocalMenu = 'DirectoryLocal'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [Esc] { FileClose 0 } key [A+D] { MainMenu 'D' } key [A+N] { MainMenu 'N' } key [A+W] { MainMenu 'W' } } # Buffer List eventmap BUFFERS: MLIST { MainMenu = "BufferListMain"; LocalMenu = "BufferListLocal"; key [Esc] { FileClose 0 } # 0 = do not open directory when last closed, overrides OpenAfterClose default. key [C+L] { BufListFileClose } key [F2] { BufListFileSave } } # Routine List eventmap ROUTINES: MLIST { MainMenu = "RoutinesMain"; LocalMenu = "RoutinesLocal"; key [Esc] { FileClose } } eventmap MESSAGES: MLIST { MainMenu = "MessagesMain"; LocalMenu = "MessagesLocal"; key [A+M] { MainMenu 'M' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } key [C+L] { ChildClose } # does NOT kill, just closes pipe } eventmap EVENTMAPVIEW: MLIST { MainMenu = "EventMapViewMain"; LocalMenu = "EventMapViewLocal"; key [Esc] { FileClose 0 } } eventmap PLAIN: MODEL { # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [Esc] { BlockMarkStream; BlockUnmark } key [F2] { FileSave } key [S+F2] { FileSaveAs } key [A+S-F2] { FileSave; FileClose } key [S+F3] { FileReload; WinRefresh } key [C+F3] { FileOpenInMode } key [F7] { BlockBegin } key [S+F7] { MoveBlockStart } key [F8] { BlockEnd } key [S+F8] { MoveBlockEnd } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [A+G-Up] { ScrollUp } key [A+G-Down] { ScrollDown } key [A+G-Left] { ScrollLeft } key [A+G-Right] { ScrollRight } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } key [A+G-S+Up] { BlockExtendBegin; ScrollUp; BlockExtendEnd } key [A+G-S+Down] { BlockExtendBegin; ScrollDown; BlockExtendEnd } key [A+G-S+Left] { BlockExtendBegin; ScrollLeft; BlockExtendEnd } key [A+G-S+Right] { BlockExtendBegin; ScrollRight; BlockExtendEnd } key [A+G-C+Up] { MovePrevEqualIndent } key [A+G-C+Down] { MoveNextEqualIndent } key [A+G-C+Left] { MovePrevTab } key [A+G-C+Right] { MoveNextTab } key [C+G-Ins] { BlockCopy } key [C+G-Del] { BlockKill } key [S+G-Ins] { BlockPasteStream } key [S+G-Del] { BlockCut } key [A+G-Ins] { BlockPasteColumn } key [A+G-S+Ins] { BlockPasteLine } key [G-Enter] { LineNew } key [BackSp] { BackSpace } key [G-Ins] { ToggleInsert } key [G-Del] { Delete } key [Tab] { InsertTab } key [S+Tab] { InsertSpacesToTab 10 } key [C+Tab] { CompleteWord } # key [C+Tab] { InsertTab } key [C+BackSp] { KillWordPrev } key [C+S+BackSp] { KillToLineStart } key [C+G-Enter] { LineSplit } key [G-S+Enter] { LineInsert } key [A+G-Enter] { LineAdd } key [A+G-Del] { KillWord } key [A+G-End] { KillToLineEnd } key [A+BackSp] { Undo } key [A+S+BackSp] { Redo } key [C+K_1] { PlaceBookmark "1" } key [C+K_2] { PlaceBookmark "2" } key [C+K_3] { PlaceBookmark "3" } key [C+K_4] { PlaceBookmark "4" } key [C+K_5] { PlaceBookmark "5" } key [C+K_6] { PlaceBookmark "6" } key [C+K_7] { PlaceBookmark "7" } key [C+K_8] { PlaceBookmark "8" } key [C+K_9] { PlaceBookmark "9" } key [C+K_0] { PlaceBookmark "0" } key [C+Q_1] { GotoBookmark "1" } key [C+Q_2] { GotoBookmark "2" } key [C+Q_3] { GotoBookmark "3" } key [C+Q_4] { GotoBookmark "4" } key [C+Q_5] { GotoBookmark "5" } key [C+Q_6] { GotoBookmark "6" } key [C+Q_7] { GotoBookmark "7" } key [C+Q_8] { GotoBookmark "8" } key [C+Q_9] { GotoBookmark "9" } key [C+Q_0] { GotoBookmark "0" } key [C+A] { MoveWordPrev } key [C+B] { ViewBuffers } key [C+C] { MovePageDown } key [C+D] { MoveRight } key [C+E] { MoveUp } key [C+F] { MoveWordNext } key [C+G] { KillChar } key [C+H] { KillCharPrev } key [C+I] { InsertTab } key [C+J] { LineJoin } key [C+K_C-S-A] { BlockMarkStream } key [C+K_C-S-B] { BlockBegin } key [C+K_C-S-C] { BlockCopy; BlockPaste } key [C+K_C-S-D] { FileSave; FileClose } key [C+K_C-S-E] { FileOpen } key [C+K_C-S-H] { BlockUnmark } key [C+K_C-S-I] { BlockIndent } key [C+K_C-S-K] { BlockEnd } key [C+K_C-S-L] { BlockMarkLine } key [C+K_C-S-M] { BlockMarkColumn } key [C+K_C-S-Q] { FileClose } key [C+K_C-S-R] { BlockRead } key [C+K_C-S-S] { FileSave } key [C+K_C-S-U] { BlockUnindent } key [C+K_C-S-V] { BlockCut; BlockPaste } key [C+K_C-S-W] { BlockWrite } key [C+K_C-S-X] { FileSave; FileClose } key [C+K_C-S-Y] { BlockKill } key [C+L] { FindRepeat } key [C+M] { LineNew } key [C+N] { LineSplit } key [C+P] { InsertChar } key [C+Q_C-S-A] { FindReplace } key [C+Q_C-S-C] { MoveFileEnd } key [C+Q_C-S-D] { MoveLineEnd } key [C+Q_C-S-E] { MovePageStart } key [C+Q_C-S-F] { Find } key [C+Q_C-S-I] { IncrementalSearch } key [C+Q_C-S-J] { MoveToLine } key [C+Q_C-S-L] { Undo } key [C+Q_C-S-R] { MoveFileStart } key [C+Q_C-S-S] { MoveLineStart } key [C+Q_C-S-X] { MovePageEnd } key [C+Q_C-S-Y] { KillToLineEnd } key [C+Q_C-\[] { MatchBracket } key [C+Q_C-\]] { MatchBracket } key [C+R] { MovePageUp } key [C+S] { MoveLeft } key [C+T] { KillWord } key [C+U] { Undo } key [C+V] { ToggleInsert } key [C+W] { ScrollDown } key [C+X] { MoveDown } key [C+Y] { KillLine } key [C+Z] { ScrollUp } key [A+A] { BlockMarkStream } key [A+B] { MainMenu 'B' } key [A+C] { BlockCopy } key [A+D] { MainMenu 'D' } key [A+E] { MainMenu 'E' } key [A+F] { MainMenu 'F' } key [A+G] { BlockCut } key [A+H] { MainMenu 'H' } key [A+I] { BlockIndent } key [A+J] { MoveToLine } key [A+K] { BlockMarkColumn } key [A+L] { BlockMarkLine } key [A+O] { MainMenu 'O' } key [A+R] { WrapPara } key [A+S] { MainMenu 'S' } key [A+T] { MainMenu 'T' } key [A+U] { BlockUnindent } key [A+W] { MainMenu 'W' } key [A+X] { ExitEditor } key [C+O_C+A] { ToggleAutoIndent } key [C+O_C+C] { ToggleMatchCase } key [C+O_C+E] { ToggleTrim } key [C+O_C+I] { ToggleInsert } key [C+O_S-M] { ChangeMode } key [C+O_C+M] { ShowMenu 'MChangeMode' } key [C+O_C+R] { ToggleReadOnly } key [C+O_C+S] { ToggleSysClipboard } key [C+O_C+T] { ChangeTabSize } key [C+O_C+U] { ToggleUndo } key [C+O_C+W] { ToggleWordWrap } key [C+O_.] { ToggleShowMarkers } key [C+O_[] { SetLeftMargin } key [C+O_\]] { SetRightMargin } key [C+O_A+[] { ChangeLeftMargin } key [C+O_A+\]] { ChangeRightMargin } key [C+O_Tab] { ToggleShowTabs } key [C+O_C+Tab] { ToggleExpandTabs } key [C+O_Del] { ToggleDeleteKillTab } key [C+O_G-Ins] { ToggleInsert } key [C+O_BackSp] { ToggleBackSpKillTab } key [C+O_Space] { ToggleIndentWithTabs } key [C+O_C+BackSp] { ToggleBackSpUnindents } key [A+-] { MatchBracket } key [A+=] { HilitMatchBracket } # key [A+,] { GetPMClip } # key [A+.] { PutPMClip } key [C+Space] { InsPrevLineChar } key [A+Space] { InsPrevLineToEol } key [A+F5] { ShowEntryScreen } key [C+_] { ShowPosition } key [Center] { MoveLineCenter } key [C+X] { MovePrevPos } key [C+S+A] { ASCIITable } key [G+*] { LineInsert ; MoveUp; ScrollUp } # key [G++] { DumpFold } key [A+G++] { FoldCreate } key [A+G+-] { FoldDestroy } key [G+S++] { FoldPromote } key [G+S+-] { FoldDemote } key [C+G++] { FoldOpen } key [C+G+-] { FoldClose } key [C+G+*] { FoldOpenNested } key [C+G+/] { FoldToggleOpenClose } key [A+G+*] { FoldOpenAll } key [A+G+/] { FoldCloseAll } # key [C+G-Up] { MoveFoldPrev } # key [C+G-Down] { MoveFoldNext } key [C+Q_Tab] { IncrementalSearch } key [A+,] { SearchWordPrev } key [A+.] { SearchWordNext } key [A+/] { HilitWord } } efte-1.1/config/m_groovy.fte0000664000076400007640000000410111163156165015131 0ustar laurilauri sub GROOVY_Base { MoveFileStart; InsertString "package "; 2:LineNew; InsertString "public class "; InsertString $FileBaseName; InsertString " {"; LineIndent; 2:LineNew; InsertString "}"; LineIndent; LineNew; MoveFileStart; 8:MoveRight; } colorize GROOVY { SyntaxParser = 'C'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'abstract', 'def', 'default', 'goto', 'null', 'synchronized', 'boolean', 'do', 'if', 'package', 'this', 'break', 'double', 'implements', 'private', 'threadsafe', 'byte', 'else', 'import', 'protected', 'throw', 'byvalue', 'extends', 'instanceof', 'public', 'transient', 'case', 'false', 'int', 'return', 'true', 'catch', 'final', 'interface', 'short', 'try', 'char', 'finally', 'long', 'static', 'void', 'class', 'float', 'native', 'super', 'while', 'const', 'for', 'new', 'switch', 'continue', 'throws' }; } mode GROOVY: SOURCE { # GROOVY Mode FileNameRx = /\.\c{GROOVY}$/; HilitOn = 1; Colorizer = 'GROOVY'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /^\s*\w[\w._]+{\s+[\w._]+}+[\w_]+\s*\([^;]*$/; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; } oinclude 'mym_groovy.fte'; efte-1.1/config/m_make.fte0000664000076400007640000000601111157534024014520 0ustar laurilauricolorize MAKE { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Comment', 'Lang_Comment' }, { 'Directive', 'Lang_Control' }, { 'Command', 'Lang_Command' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Punctuation', 'Lang_Punctuation' }, { 'Label', 'Lang_Label' }, # Should be Macro }; # Macros keyword 'Lang_Label' { '__MSDOS__', '__NT__', '__OS2__', '__MAKEOPTS__', '__MAKEFILES__', }; # Directives keyword 'Lang_Control' { '.autodepend', '.symbolic', '.precious', '.ignore', '.erase', '.hold', '.silent', '.block', '.nocheck', '.continue', '.optimize', '.extensions:', '.before', '.after', }; # Commands keyword 'Lang_Command' { 'break', 'call', 'chdir', 'cd', 'cls', 'cmd', 'command', 'copy', 'ctty', 'date', 'del', 'dir', 'echo', 'echo.', 'erase', 'for', 'if', 'md', 'mkdir', 'path', 'pause', 'prompt', 'ren', 'rename', 'rmdir', 'rd', 'set', 'time', 'type', 'ver', 'verify', 'vol', # Internal command (other color might be good idea) '%null', '%stop', '%quit', '%abort', '%make', '%create', '%write', '%append', }; h_state 0 { 'Normal' } h_trans { 1, '', '#' , 'Comment' } h_trans { 2, '-^', '!', 'Normal' } h_trans { 4, '<', '$', 'Label' } h_trans { 3, 's', '=+;:@!*', 'Punctuation' } h_wtype { -1, -1, -1, 'i', 'a-zA-Z0-9_.:%' } h_state 1 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 2 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { -1, 0, -1, 'i', 'a-zA-Z0-9!' } h_words 'Lang_Preprocessor' { '!', 'include', 'error', 'define', 'undef', 'ifeq', 'ifneq', 'ifdef', 'ifndef', 'else', 'endif', '!include', '!error', '!define', '!undef', '!ifeq', '!ifneq', '!ifdef', '!ifndef', '!else', '!endif', } h_state 3 { 'Normal' } h_trans { 0, '', '', 'Normal' } h_state 4 { 'Label' } h_trans { 0, '$', '', 'Normal' } h_trans { 3, 's', '$#@*', ')', 'Label' } h_trans { 0, '-S', 'a-zA-Z0-9_', 'Normal' } h_state 6 { 'Label' } h_trans { 3, 's', '@*&.:', 'Label' } h_trans { 0, '', '', 'Normal' } h_state 7 { 'Label' } h_trans { 0, '-S', 'a-zA-Z0-9_', 'Normal' } } mode MAKE: PLAIN { FileNameRx = /\c{makefile}|{\.{MAK}|{MAKE}|{MK}|{MIF}$}/; FirstLineRx = /^\#\!.*make\s+-f/; HilitOn = 1; Colorizer = 'MAKE'; IndentWithTabs = 1; # use tabs for auto-indent RoutineRegexp = '^[^:\#]+:'; SaveFolds = 2; # save fold info at end of line CommentStart = ' #'; CommentEnd = ''; } oinclude 'mym_make.fte'; efte-1.1/config/m_fort90.fte0000664000076400007640000001174011157534024014733 0ustar laurilauri# FORTRAN-90 mode # Contributed by: Andrew Pitonyak # Operators include +, -, *, /, **, %, // # Comments start with ! and go to the end of the line # Comparison operators <, <=, ==, >, >=, /=, .LT, .LTE., .EQ., .GT.,.GTE., .NE. # Logical operators, .AND., .OR., .NOT. # # I should probably add the things like .EQ. to the keywords, I already # added .OR. and such. # How about a line comment command and then this will be pretty much # finished! # # In Fortran, arrays are accessed with () so you can not assume that # xpy() means that a function call is about to happen, it # could be an # array reference or a substring reference. colorize FORTRAN { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'abs', 'achar', 'acos', 'adjustl', 'adjustr', 'aimag', 'aint', 'all', 'allocatable', 'allocate', 'allocated', '.and.', 'anint', 'any', 'asin', 'assignment', 'associated', 'atan', 'atan2', 'backspace', 'bit_size', 'block', 'blockdata', 'btest', 'call', 'random_number', 'random_seed', 'system_clock', 'call', 'case', 'ceiling', 'char', 'character', 'close', 'cmplx', 'common', 'complex', 'conjg', 'contains', 'continue', 'cos', 'cosh', 'count', 'cshift', 'cycle', 'data', 'date_and_time', 'dble', 'deallocate', 'default', 'digits', 'dim', 'dimension', 'do', 'dot_product', 'double', 'doubleprecision', 'dprod', 'else', 'elseif', 'elsewhere', 'end', 'endblock', 'endblockdata', 'enddo', 'endfile', 'endif', 'endinterface', 'endselect', 'endtype', 'endwhere', 'entry', 'eoshift', 'epsilon', 'equivalence', 'exit', 'exp', 'exponent', 'external', 'file', 'floor', 'format.', 'fraction', 'function', 'go', 'goto', 'huge', 'iachar', 'iand', 'ibclr', 'ibits', 'ibset', 'ichar', 'ieor', 'if', 'implicit', 'in', 'index', 'inout', 'inquire', 'int', 'integer', 'intent', 'interface', 'intrinsic', 'iolength', 'ior', 'ishftc', 'ishift', 'kind', 'lbound', 'len', 'len_trim', 'lge', 'lgt', 'lle', 'llt', 'log', 'log10', 'logical', 'matmul', 'max', 'maxexponent', 'maxloc', 'maxval', 'merge', 'min', 'minexponent', 'minloc', 'minval', 'mod', 'module', 'modulo', 'mvbits', 'namelist', 'nearest', 'nint', 'none', '.not.', 'nullify', 'only', 'open', 'operator', 'optional', '.or.', 'out', 'pack', 'parameter', 'pointer', 'precision', 'present', 'print', 'private', 'procedure', 'product', 'program', 'public', 'radix', 'rangereal', 'read', 'real', 'recursive', 'repeat', 'reshape', 'result', 'return', 'rewrind', 'rrspacing', 'save', 'scale', 'scan', 'select', 'selectcase', 'selected_int_kind', 'selected_real_kind', 'sequence', 'set_exponent', 'shape', 'sign', 'sin', 'sinh', 'size', 'spacing', 'spread', 'sqrt', 'stop', 'subroutine', 'sum', 'tan', 'tanh', 'target', 'then', 'tiny', 'to', 'transfer', 'transpose', 'trim', 'type', 'unbound', 'unpack', 'use', 'verify', 'where', 'while', 'write' }; # Syntax Parser by Marko Macek # not complete, see comments below h_state 0 { 'Normal' } h_trans { 1, '-s', 'a-zA-Z_', 'Normal' } h_trans { 2, '<', '!', 'Comment' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '<', '\'', 'String' } h_trans { 5, '', '"', 'String' } # how can things be quoted? h_trans { 0, '$', '', 'String' } h_state 4 { 'String' } h_trans { 0, '>', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 5 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } } mode FORTRAN: SOURCE { FileNameRx = /\.\c{F||{F90}|{F9P}|{FPP}}$/; HilitOn = 1; Colorizer = 'FORTRAN'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' !'; CommentEnd = ''; # ? RoutineRegexp = /^\w[\w_:*&~]+[\w\s_:*&~]@\([^;]*$/; } oinclude 'mym_fort90.fte'; efte-1.1/config/kbd/0000775000076400007640000000000011264420006013322 5ustar laurilauriefte-1.1/config/kbd/k_c.fte0000664000076400007640000000123211044154601014555 0ustar laurilaurieventmap C { key [Tab] { LineIndent; LineTrim } key [{] { SelfInsert; ?LineIndent } key [}] { SelfInsert; ?LineIndent; MoveLeft; ?HilitMatchBracket; MoveRight } key [)] { SelfInsert; MoveLeft; ?HilitMatchBracket; MoveRight } key [\]] { SelfInsert; MoveLeft; ?HilitMatchBracket; MoveRight } key [:] { SelfInsert; ?LineIndent } key [#] { SelfInsert; ?LineIndent } #key [A+\\] { BlockReIndent; FileTrim; WinRefresh } key [G-Enter] { LineIndent; LineNew; } key [A+G-Enter] { LineIndent; LineAdd; LineIndent } key [S+G-Enter] { LineIndent; LineInsert; LineIndent } } efte-1.1/config/kbd/k_sgml.fte0000664000076400007640000000136011041366545015310 0ustar laurilauri# this file defines additional keybindings for SGML mode. # SGML_* macros are defined in ../m_sgml.fte # menus are defined in ../menu/m_sgml.fte # this file is included from ../ui.fte eventmap SGML { key [C+E_0] { SGML_Base } key [C+E_C+B] { SGML_BO } key [C+E_C+I] { SGML_IT } key [C+E_C+P] { SGML_PA } key [C+E_C+S] { SGML_SE } key [C+E_C+C] { SGML_CH } key [C+E_C+R] { SGML_REF } key [C+E_C+X] { SGML_EX } key [C+E_x] { SGML_EX } # character escapes key [C+E_&] { InsertString "&"; } key [C+E_<] { InsertString "<"; } key [C+E_>] { InsertString ">"; } key [C+E_@] { InsertString "©"; } } efte-1.1/config/kbd/k_rexx.fte0000664000076400007640000000144211041410327015321 0ustar laurilauri# FTE keybindings for REXX mode # enhanced from the original by Michael DeBusk # debu4335@eclipsetel.com # Revision March 19, 2001 eventmap REXX { key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew; LineIndent } key [:] { SelfInsert; LineIndent } key [A+\\] { BlockReIndent } key [C+E_c] { REXX_Comment } # key [C+E_u] { REXX_RexxUtil } # key [C+E_s] { REXX_RxSock } # key [C+E_f] { REXX_RxFTP } # key [C+E_0] { REXX_Heading } # key [C+E_1] { REXX_Do } # key [C+E_2] { REXX_DoWhile } # key [C+E_3] { REXX_DoUntil } # key [C+E_4] { REXX_DoForever } # key [C+E_5] { REXX_If } # key [C+E_6] { REXX_Select } } efte-1.1/config/kbd/k_rst.fte0000664000076400007640000000325111041366545015157 0ustar laurilauri# FTE keybindings for editing reStructuredText files # maintained by: Sergey Pinigin # Revision: 2006-08-29 # # this file defines additional keybindings for RST mode. # RST_* macros are defined in ../m_rst.fte # menus are defined in ../menu/m_rst.fte # this file is included from ../ui_fte.fte eventmap reST { # Sections # Press after input Section name key [C+E_1] { RST_H1 } key [C+E_2] { RST_H2 } key [C+E_3] { RST_H3 } key [C+E_4] { RST_H4 } key [C+E_5] { RST_H5 } key [C+G+Up] { RST_ROLE_EMP } key [C+G+Down] { RST_ROLE_STR } key [C+E_C+L] { RST_ROLE_LIT } key [A+G+Up] { RST_INLINE_EMP } key [A+G+Down] { RST_INLINE_STR } key [C+E_0] { RST_INLINE_INT } key [C+E_9] { RST_INLINE_LIT } key [C+E_C+H] { RST_INLINE_HLINK } key [C+E_C+U] { RST_INLINE_ELINK } key [C+E_C+T] { RST_INLINE_ITAG } key [C+E_C+R] { RST_INLINE_REF } # []_ key [C+E_C+A] { RST_INLINE_REFA } # [#]_ key [C+E_C+\\] { RST_INLINE_REFS } # ||_ key [C+E_A+A] { RST_ADM_ATTE } key [C+E_A+C] { RST_ADM_CAUT } key [C+E_A+D] { RST_ADM_DANG } key [C+E_A+E] { RST_ADM_ERRO } key [C+E_A+H] { RST_ADM_HINT } key [C+E_A+I] { RST_ADM_IMPO } key [C+E_A+N] { RST_ADM_NOTE } key [C+E_A+T] { RST_ADM_TIP } key [C+E_A+W] { RST_ADM_WARN } key [C+E_A+L] { RST_ADM_TITL } key [C+E_A+O] { RST_ADM_ADMO } key [C+E_C+I] { RST_IMAGE } key [C+E_C+F] { RST_FIGURE } # List Enter key [C+Enter] { RST_LISTS_1ENT } } efte-1.1/config/kbd/k_fte.fte0000664000076400007640000000045211041410327015111 0ustar laurilauri# additional keybindings for FTE edit mode # included from ../ui.fte eventmap FTE { key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew; LineIndent } key [{] { SelfInsert; LineIndent } key [}] { SelfInsert; LineIndent } } efte-1.1/config/kbd/k_html.fte0000664000076400007640000000647711041366545015330 0ustar laurilauri# FTE keybindings for editing HTML files # maintained by m_debusk@sourceforge.com # Revision 2001-11-18 # this file defines additional keybindings for HTML mode. # HTML_* macros are defined in ../m_html.fte # menus are defined in ../menu/m_html.fte # this file is included from ../ui.fte eventmap HTML { # Entities key [C+E_&] { InsertString "&"; } key [C+E_<] { InsertString "<"; } key [C+E_>] { InsertString ">"; } key [C+E_"] { InsertString """; } key [C+E_Space] { InsertString " "; } key [C+Space] { InsertString " "; } # HTML Skeleton key [C+E_0] { HTML_Base } # Run the browser key [F9] { HTML_View } # Convert text to HTML key [C+E_x] { HTML_TXT } # Basic Tags ## Document Types key [C+E_A+F] { HTML_DTD_X1F } key [C+E_A+K] { HTML_DTD_X1S } key [C+E_A+N] { HTML_DTD_X1T } ## Headers key [C+E_1] { HTML_H1 } key [C+E_2] { HTML_H2 } key [C+E_3] { HTML_H3 } key [C+E_4] { HTML_H4 } key [C+E_5] { HTML_H5 } key [C+E_6] { HTML_H6 } ## Other Basic Stuff key [C+E_9] { HTML_BODY } key [C+E_C+Z] { HTML_HTM } key [C+E_C+P] { HTML_P } key [C+E_G-Enter] { HTML_BR } key [C+E_-] { HTML_HR } key [C+E_c] { HTML_COMMENT } key [C+E_C] { HTML_COMMENT } # Character Format key [C+E_C+B] { HTML_B } key [C+E_C+S] { HTML_STRONG } key [C+E_C+I] { HTML_I } key [C+E_C+E] { HTML_EM } key [C+E_A+B] { HTML_BIG } key [C+E_A+S] { HTML_SMALL } key [C+E_A+U] { HTML_SUB } key [C+E_A+P] { HTML_SUP } key [C+E_A+O] { HTML_BDO } # Output key [C+E_C+F] { HTML_PRE } key [C+E_C+C] { HTML_CODE } key [C+E_C+T] { HTML_TT } key [C+E_C+K] { HTML_KBD } key [C+E_C+V] { HTML_VAR } key [C+E_C+M] { HTML_SAMP } # Blocks key [C+E_C+Y] { HTML_ACRONYM } key [C+E_C+A] { HTML_ABBR } key [C+E_A+A] { HTML_ADDRESS } key [C+E_C+Q] { HTML_BLOCKQUOTE } key [C+E_A+Q] { HTML_Q } key [C+E_C+O] { HTML_CITE } key [C+E_A+I] { HTML_INS } key [C+E_A+E] { HTML_DEL } # Links key [C+E_C+H] { HTML_AHREF } key [C+E_C+N] { HTML_ANAME } key [C+E_C+L] { HTML_LINK } # Frames key [C+E_7] { HTML_FRAMESET } key [C+E_C+R] { HTML_NOFRAMES } key [C+E_A+F] { HTML_FRAME } # Input # Lists key [C+E_u] { HTML_UL } key [C+E_o] { HTML_OL } key [C+E_i] { HTML_LI } key [C+E_l] { HTML_DL } key [C+E_t] { HTML_DT } key [C+E_C+D] { HTML_DFN } key [C+E_d] { HTML_DD } # Images key [C+E_C+G] { HTML_IMG } key [C+E_A+M] { HTML_MAP } # Tables key [C+E_A+C] { HTML_CAPTION } key [C+E_A+G] { HTML_COLGROUP } key [C+E_A+T] { HTML_TABLE } key [C+E_b] { HTML_TBODY } key [C+E_f] { HTML_TFOOT } key [C+E_h] { HTML_THEAD } key [C+E_A+H] { HTML_TH } key [C+E_A+R] { HTML_TR } key [C+E_A+D] { HTML_TD } # Styles key [C+E_A+L] { HTML_STYLE } key [C+E_A+V] { HTML_DIV } key [C+E_C+W] { HTML_SPAN } key [C+E_.] { HTML_CENTER } # Meta Information key [C+E_C+U] { HTML_BASEURL } key [C+E_8] { HTML_HEAD } # Programming key [C+E_C+J] { HTML_OBJECT } } efte-1.1/config/kbd/k_java.fte0000664000076400007640000000073611041410327015261 0ustar laurilauri# additional keybindings for JAVA mode # included from ../ui.fte eventmap JAVA { key [C+E_0] { JAVA_Base } key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew; LineIndent } key [{] { SelfInsert; LineIndent } key [}] { SelfInsert; LineIndent } key [:] { SelfInsert; LineIndent } key [#] { SelfInsert; LineIndent } key [A+\\] { BlockReIndent } } efte-1.1/config/kbd/k_perl.fte0000664000076400007640000000057711041410327015305 0ustar laurilauri# additional keybindings for PERL mode # included from ../ui.fte eventmap PERL { key [Tab] { LineIndent LineTrim } key [G-Enter] { LineIndent LineNew LineIndent } key [#] { SelfInsert LineIndent } key [{] { SelfInsert LineIndent } key [}] { SelfInsert LineIndent } key [A+\\] { BlockReIndent } } efte-1.1/config/kbd/k_groovy.fte0000664000076400007640000000002611152610277015666 0ustar laurilaurieventmap GROOVY { } efte-1.1/config/global.fte0000664000076400007640000001115211157534024014531 0ustar laurilauriobject GLOBAL { # ScreenSizeX = 80; ScreenSizeY = 25; CursorBlink = 0; # set to 1 to have a blinking cursor. CursorInsertMask = 127; CursorOverMask = 68; SysClipboard = 1; # use system (PM) clipboard if available SelectPathname = 1; # select pathname when asking for file OpenAfterClose = 1; # prompt to load new file after closing last ShowMenuBar = 1; # show main menu bar ShowToolBar = 1; # builtin tool bar (OS/2 PM version only) # 0=none, 1=top 1=bottom of window ShowVScroll = 1; # show vertical scroll bar (text) ShowHScroll = 0; # show horizontal scroll bar (text) WeirdScroll = 0; PMDisableAccel = 0; # disable Alt+Fx PM accelerators DefaultModeName = 'PLAIN'; KeepHistory = 1; # load/save history on entry/exit LoadDesktopOnEntry = 0; # load desktop on fte start (2 = when no files) SaveDesktopOnExit = 0; # save desktop in ExitEditor IgnoreBufferList = 0; # skip buffer list in FileNext/Prev/Last ReassignModelIds = 0; # assign first empty number for newly created buffer RecheckReadOnly = 0; # recheck read only status when trying to modify file (only performed on when read only is set) CompletionFilter = /^{\c.+\.o|a|{bak}|{exe}|{lib}|{class}|{jar}|{zip}|{gz}|{tar.gz}|{tgz}}|{.+~}|{CVS}|{SVN}$/; # {obj} file is also ASCII Object File Format for MAYA graphics editor # so it is removed from Completion Filter %if(OS_UNIX) PrintDevice = "|lpr"; %endif %if(!OS_UNIX) PrintDevice = '\\DEV\\PRN'; %endif CompileCommand = 'make '; KeepMessages = 1; CvsCommand = 'cvs'; SvnCommand = 'svn'; %if(OS_UNIX) HelpCommand = "man"; %endif %if(OS_OS2) HelpCommand = "start view.exe"; %endif ScrollBorderX = 0; ScrollBorderY = 0; ScrollJumpX = 8; ScrollJumpY = 1; # smart indentation. C_Indent = 4; C_Continuation = 4; C_BraceOfs = 0; C_CaseOfs = 0; C_CaseDelta = 4; C_ClassOfs = 0; C_ClassDelta = 4; C_ColonOfs = -4; C_CommentOfs = 0; C_CommentDelta = 1; C_FirstLevelWidth = -1; C_FirstLevelIndent = 4; C_ParenDelta = -1; # if this is true (1), function parameters will only indent # as much as C_Continuation says, rather than line up one column # to the right of the '('. FunctionUsesContinuation = 0; REXX_Indent = 4; # REXX_Do_Offset = 0; # Compiler Regular Expressions # 1 = Filename # 2 = Line number # 3 = Message # Ant (groovy) CompileRx = { 2, 4, 3, /^([\w:._\-\+\/\\]+):\d+:\s[^\/\\]*([\w:._\-\+\/\\]+):\s(.#)\s\@\sline\s(\d+),\scolumn\s\d+.$/ }; # Ant (javac) CompileRx = { 1, 2, 3, /^.*\s([\w:._\-\+\/\\]+):(\d+):\s(.*)$/ }; # grep -n CompileRx = { 1, 2, 3, /^([\w:._\-\+\/\\]#):(\d+):/ }; # GCC CompileRx = { 1, 2, 3, /^([\w:._\-\+\/\\]+):(\d+):\s(.*)$/ }; # Borland C++ CompileRx = { 1, 2, 3, /^{Error}|{Warning}\s(\S+)\s(\d+):\s(.*)$/ }; # Borland C++ 5.5 command line CompileRx = { 1, 2, 3, /^{Error E}|{Warning W}\d+\s(\S+)\s(\d+):\s(.*)$/ }; # CSet++ CompileRx = { 1, 2, 3, /^([\w:._\-\+\/\\]+)\((\d+):\d+\)(.*)$/ }; # Watcom C++ CompileRx = { 1, 2, 3, /^([\w:._\-\+\/\\]+)\((\d+)\):\x20{Error!}|{Warning!}(.*)$/ }; # xlC (AIX) CompileRx = { 1, 2, 3, /^"([\w:._\-\+\/\\]+)", line (\d+){.\d+}?: (.*)$/ }; # IPF compiler CompileRx = { 1, 2, 3, /^\<([^:]+):(\d+)\> (.*)$/ }; CompileRx = { 1, 2, 3, /^([\w:._\-\+\/\\]+)\((\d+)\)\s*:\s*(.*)$/ }; CompileRx = { 2, 3, 1, /^([^\t]+)\t([^\t]+)\t(\d+)$/ }; CompileRx = { 2, 3, 1, /^\s*at\s*([^\(]+)\(([^\:]+)\:(\d+)\)$/ }; # PAF@design.ru # jikes +E (tested with version 1.18) CompileRx = { 1, 2, 3, /^.*\s([\w._\-\+\/\\]+):(\d+):\d+:\d+:\d+:\s(.*)$/ }; # Python interpreter tracebacks CompileRx = { 1, 2, 3, /^\s*File\s+"([\w:._\-\+\/\\]+)",\s+line\s+(\d+)(.*)$/ }; # bash: CompileRx = { 1, 2, 3, /^([\w:._\-\/\\]+): line (\d+):\s(.*)$/ }; # perl: CompileRx = { 2, 3, 1, /^(.*) at ([^ ]+) line ([0-9]+)/ }; CvsIgnoreRx = /^cvs update: Updating /; CvsIgnoreRx = /^cvs server: Updating /; SvnIgnoreRx = /^svn update: Updating /; SvnIgnoreRx = /^svn server: Updating /; } efte-1.1/config/m_sml.fte0000664000076400007640000000314611157534024014404 0ustar laurilauri# SML mode # # Chris Inacio # inacio@ece.cmu.edu colorize SML { SyntaxParser = 'SIMPLE'; color { {'Normal', 'Editor_Default'}, {'Number', 'Lang_DecimalNumber'}, {'Punctuation','Lang_Preprocessor'}, {'String','Lang_String'}, {'Comment','Lang_Comment'}, {'Label','Lang_Label'}, {'Function','Lang_Function'} }; keyword 'Editor_Keywords' { 'structure', 'and', 'local', 'in', 'end', 'signature', 'functor', 'struct', 'let', 'sig', 'where type', 'val', 'eqtype', 'type', 'datatype', 'exception', 'sharing', 'include', 'fun', 'abstype', 'open', 'infix', 'infixr', 'nonfix', 'raise', 'if', 'while', 'case', 'fn', 'op', }; h_state 0 {'Normal'} h_trans {1, '>', '(*', 'Comment'} h_trans {2, '', '"', 'String'} h_trans {3, 's', '0-9', 'Number'} h_trans {0, 'S', '_a-zA-Z0-9', 'Punctuation'} h_trans {4, '-s', 'a-zA-Z_', 'Normal' } h_state 1 {'Comment'} h_trans {0, '<', '*)', 'Comment'} h_state 2 {'String'} h_trans {0, '', '"', 'String'} h_state 3 {'Number'} h_trans {0, 'S-', '0-9\.', 'Number'} h_state 4 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_' } } mode SML: SOURCE { FileNameRx = /\.\c{SML}$/; HilitOn = 1; Colorizer = 'SML'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; CommentStart = ' (*'; CommentEnd = '*)'; } oinclude 'mym_sml.fte'; efte-1.1/config/m_perl.fte0000664000076400007640000000707611157534024014561 0ustar laurilauri # syntax hilit needs to handle <', '*/', 'Comment' } h_state 3 { 'Comment' } h_trans { 0, '$', '', 'Normal' } h_state 4 { 'String' } h_trans { 0, '>', '"', 'String' } h_trans { 4, 'qQ', '\\', 'String' } h_state 5 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } } mode CMAKE: PLAIN { FileNameRx = /{\.\ccmake}|{CMakeLists.txt}/; HilitOn = 1; Colorizer = 'CMAKE'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; CommentStart = '/*'; CommentEnd = '*/'; } oinclude 'mym_cmake.fte'; efte-1.1/config/ui_k_ne.fte0000664000076400007640000001777711157534024014725 0ustar laurilaurieventmap MODEL { key [F3_G-Down] { WinNext } key [F3_G-Up] { WinPrev } key [F3_G-Left] { FilePrev } key [F3_G-Right] { FileNext } key [F3_=] { WinHSplit } key [F3_-] { WinClose } key [F3_S-X] { FileLast } key [F3_S-N] { FileOpen } key [F3_S-Q] { FileClose } key [F6_S-V] { ShowVersion } key [F9] { RunProgram "" } key [F10] { MainMenu } key [A+X] { ExitEditor } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } } # List Viewers eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } key [C+Left] { ScrollRight } key [C+Right] { ScrollLeft } key [G-Enter] { Activate } key [Space] { ActivateInOtherWindow } key [S+Enter] { CloseActivate } key [C+R] { Rescan } } eventmap CVSDIFF: MLIST { key [C+G-Ins] { BlockCopy } key [Esc] { FileClose } } eventmap CVS: MLIST { LocalMenu = "MCvs"; } eventmap SVNDIFF: MLIST { key [C+G-Ins] { BlockCopy } key [Esc] { FileClose } } eventmap SVN: MLIST { LocalMenu = "MSvn"; } eventmap DIRECTORY: MLIST { MainMenu = 'DirectoryMain'; LocalMenu = 'DirectoryLocal'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [C+D] { DeleteFile } key [Esc] { FileClose 0 } key [A+D] { MainMenu 'D' } key [A+N] { MainMenu 'N' } key [A+W] { MainMenu 'W' } } # Buffer List eventmap BUFFERS: MLIST { MainMenu = "BufferListMain"; LocalMenu = "BufferListLocal"; key [Esc] { FileClose 0 } # 0 = do not open directory when last closed, overrides OpenAfterClose default. key [C+C] { BufListFileClose } key [F2] { BufListFileSave } } # Routine List eventmap ROUTINES: MLIST { MainMenu = "RoutinesMain"; LocalMenu = "RoutinesLocal"; key [Esc] { FileClose } } eventmap MESSAGES: MLIST { MainMenu = "MessagesMain"; LocalMenu = "MessagesLocal"; key [A+M] { MainMenu 'M' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } key [C+C] { ChildClose } # does NOT kill, just closes pipe } eventmap EVENTMAPVIEW: MLIST { MainMenu = "EventMapViewMain"; LocalMenu = "EventMapViewLocal"; key [Esc] { FileClose 0 } } eventmap PLAIN: MODEL { # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [F3_S-S] { FileSave } key [F3_S-E] { FileSave; FileClose } key [F3_S-I] { BlockRead } key [F3_S-B] { BlockWrite } key [F4_S-S] { BlockMarkStream } key [F4_S-U] { BlockUnmark } key [F4_S-D] { BlockCut } key [F4_S-C] { BlockCopy; BlockPaste } key [F4_S-M] { BlockCut; BlockPaste } key [F4_S-L] { BlockSelectLine } key [F4_S-E] { BlockBegin; MoveLineEnd; BlockEnd; } key [F4_S-F] { MoveBlockStart } key [F5_S-L] { ChangeRightMargin } key [F5_S-W] { ToggleWordWrap } # tri-state ! key [F5_S-F] { WrapPara } key [F5_S-T] { ChangeTabSize } key [F5_S-I] { ToggleAutoIndent } key [F6_S-G] { MoveToLine } key [F6_S-M] { MatchBracket } key [F7_S-P] { FilePrint } key [F7_S-B] { BlockPrint } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [A+G-Up] { ScrollUp } key [A+G-Down] { ScrollDown } key [A+G-Left] { ScrollLeft } key [A+G-Right] { ScrollRight } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } key [A+G-S+Up] { BlockExtendBegin; ScrollUp; BlockExtendEnd } key [A+G-S+Down] { BlockExtendBegin; ScrollDown; BlockExtendEnd } key [A+G-S+Left] { BlockExtendBegin; ScrollLeft; BlockExtendEnd } key [A+G-S+Right] { BlockExtendBegin; ScrollRight; BlockExtendEnd } key [C+G-Ins] { BlockCopy } key [C+G-Del] { BlockKill } key [S+G-Ins] { BlockPasteStream } key [S+G-Del] { BlockCut } key [A+G-Ins] { BlockPasteColumn } key [A+G-S+Ins] { BlockPasteLine } key [G-Enter] { LineNew } key [G-Ins] { ToggleInsert } key [Tab] { InsertTab } key [S+Tab] { InsertSpacesToTab 10 } key [C+Tab] { CompleteWord } key [C+BackSp] { KillWordPrev } key [C+S+BackSp] { KillToLineStart } key [C+G-Enter] { LineSplit } key [G-S+Enter] { LineInsert } key [A+G-Enter] { LineAdd } key [A+G-Del] { KillWord } key [A+G-End] { KillToLineEnd } key [A+BackSp] { Undo } key [A+S+BackSp] { Redo } key [BackSp] { BackSpace } key [G-Del] { Delete } key [C+W] { KillWordPrev } key [A+W] { KillWord } key [C+L] { KillToLineStart } key [A+L] { KillToLineEnd } key [A+K] { KillLine } key [C+V] { BlockEnd; MoveLineStart; BlockBegin; BlockCaseToggle; MoveBlockEnd; BlockUnmark; } key [A+V] { BlockEnd; MoveLineEnd; BlockBegin; BlockCaseToggle; MoveBlockEnd; BlockUnmark; } key [A+U] { Undo } key [C+U] { Redo } key [C+P] { InsertChar } # key [G++] { DumpFold } key [A+G++] { FoldCreate } key [A+G+-] { FoldDestroy } key [G+S++] { FoldPromote } key [G+S+-] { FoldDemote } key [C+G++] { FoldOpen } key [C+G+-] { FoldClose } key [C+G+*] { FoldOpenNested } key [C+G+/] { FoldToggleOpenClose } key [A+G+*] { FoldOpenAll } key [A+G+/] { FoldCloseAll } } efte-1.1/config/m_plain.fte0000664000076400007640000000610311157534024014710 0ustar laurilauri# PLAIN mode colorize PLAIN { SyntaxParser = 'PLAIN'; color { { 'Normal', 'Editor_Default' }, }; } mode PLAIN { #WordChars = 'A-Za-z0-9_'; Abbreviations = 1; AddCR = 1; # add CR when saving AddLF = 1; # add LF when saving AutoIndent = 1; # autoindent BackSpKillBlock = 0; # to delete block if marked BackSpKillTab = 0; # backspace kills entire tabs BackSpUnindents = 1; # backspace at bol unindents Colorizer = 'PLAIN'; CursorThroughTabs = 1; DefFindOpt = 'i'; # default find options DefFindReplaceOpt = 'a'; # default find/replace options DeleteKillBlock = 0; # "" DeleteKillTab = 0; # delete kills entire tabs DetectLineSep = 1; # autodetect eol separator ExpandTabs = 1; # expand tabs on display ForceNewLine = 0; # force CR/LF on last saved line HilitOn = 0; # syntax hilit on HilitTags = 0; IndentMode = 'PLAIN'; # indentation mode IndentWithTabs = 0; # use tabs for auto-indent Insert = 1; # insert mode InsertKillBlock = 0; # inserting char kills selected block KeepBackups = 1; # save backup files LeftMargin = 1; # wrap left margin LineChar = 10; # line separator for loading LoadMargin = -1; # right margin for loading MatchCase = 0; # find text case sensitively MultiLineHilit = 0; PersistentBlocks = 1; # 1 = persistent blocks, 0 = transient RightMargin = 72; # wrap right margin SaveBookmarks = 0; # save bookmarks (off = 0, start line = 1, end line = 2, history = 3) MakeBackups = 1; # save backups of files. SeeThruSel = 0; # transparent selections ShowMarkers = 1; # visible eol/eof markers ShowTabs = 0; # show tabs as small circle on display SpaceTabs = 0; # insert tabs as spaces StripChar = 13; # remove this char at eol when loading TabSize = 8; # tab size 1-32 Trim = 0; # remove whitespace from eol when editing TrimOnSave = 0; # remove whitespace before saving Undo = 1; # undo/redo enabled UndoLimit = 1023; # num of changes to save UndoMoves = 0; # undo cursor movement commands WordWrap = 0; # word wrap (off = 0, line = 1, paragraph=2) # UNIX files have no CR at the end of line %if(OS_UNIX) # Don't autodetect line separator DetectLineSep = 0; # Don't add CR at EOL when saving AddCR = 0; # Don't remove CR if at EOL when loading StripChar = -1; %endif } oinclude 'mym_plain.fte'; efte-1.1/config/ui_m_ne.fte0000664000076400007640000003217311157534024014712 0ustar laurilaurimenu Object { item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; item "Open &Binary" { FileOpenInMode 'BIN' } item; item "Open &Directory\tC+M" { DirOpen } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu MCvs { item "CVS C&heck" { RunCvs "-n update" } item "CVS &Update" { RunCvs "update -d" } item "CVS &Diff" { CvsDiff "" } item "CVS &Commit" { RunCvsCommit "" } item "CVS &Add" { RunCvs "add" } item "CVS &Remove" { RunCvs "remove" } item "CVS S&tatus" { RunCvs "status -v" } item "CV&S" { Cvs } item; item "&View CVS" { ViewCvs } item "View CVS Di&ff" { ViewCvsDiff } item "View CVS &log" { ViewCvsLog } item; item "Cl&ear CVS messages" { ClearCvsMessages } } menu MSvn { item "SVN C&heck" { RunSvn "-n update" } item "SVN &Update" { RunSvn "update -d" } item "SVN &Diff" { SvnDiff "" } item "SVN &Commit" { RunSvnCommit "" } item "SVN &Add" { RunSvn "add" } item "SVN &Remove" { RunSvn "remove" } item "SVN S&tatus" { RunSvn "status -v" } item "SV&N" { Svn } item; item "&View SVN" { ViewSvn } item "View SVN Di&ff" { ViewSvnDiff } item "View SVN &log" { ViewSvnLog } item; item "Cl&ear SVN messages" { ClearSvnMessages } } menu Tools { item "&Compile\tF9" { Compile "make -k " } item "&Grep" { Compile "grep -n " } # item "&Diff" { Compile "cvs diff" } item; item "Go to prev &error\tF11" { CompilePrevError } item "Go to &next error\tF12" { CompileNextError } item; item "&Messages\tS+F9" { ViewMessages } item; submenu "C&VS\tC+O_C+V", MCvs; submenu "SV&N\tC+O_C+N", MSvn; } menu Window { # item "&New " { WinNewFrame } # item; item "Split &Horizontal\tShift+F2" { WinHSplit } item "&Close view\tCtrl+Alt+F4" { WinClose } item "Close &other views\tF5" { WinZoom } item; item "Sa&ve Desktop" { DesktopSave } item "Save Desktop &As" { DesktopSaveAs } item; item "&Routines\tCtrl+I" { ListRoutines } item "&Buffers\tAlt+0" { ViewBuffers } item "&Directory\tC+M" { DirOpen } # item "&Shell" { } } menu Help { item "&About..." { ShowVersion } } # Directory Browser menu Directory { item "&Reload\tCtrl+R" { Rescan } item "&Close\tCtrl+F10" { FileClose } item; item "&Open file...\tF3" { FileOpen } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "Sh&ell" { RunProgram "" } item "E&xit\tAlt+X" { ExitEditor } } menu Navigate { item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } # item "&/ Goto Dir\t/" { DirGoto } item "&\\ Goto Dir\t\\" { DirGoto } item "&Delete File\tCtrl+D" { DeleteFile } item "&Delete File\tCtrl+D" { DeleteFile } item; item '&A:\\' { DirGoto 'A:\\' } item '&B:\\' { DirGoto 'B:\\' } item '&C:\\' { DirGoto 'C:\\' } item '&D:\\' { DirGoto 'D:\\' } item '&E:\\' { DirGoto 'E:\\' } item '&F:\\' { DirGoto 'F:\\' } item '&G:\\' { DirGoto 'G:\\' } item '&H:\\' { DirGoto 'H:\\' } item '&I:\\' { DirGoto 'I:\\' } } # Editor - Editing Modes # PLAIN # menus menu MChangeMode { item "&Plain" { ChangeMode 'PLAIN' } item "&Text" { ChangeMode 'TEXT' } item "&C" { ChangeMode 'C' } item "&EMail" { ChangeMode 'MSG' } item "&HTML" { ChangeMode 'HTML' } item "&IPF" { ChangeMode 'IPF' } item "&Ada" { ChangeMode 'Ada' } item "&REXX" { ChangeMode 'REXX' } item "MAKE" { ChangeMode 'MAKE' } item "&FTE" { ChangeMode 'FTE' } item "Resource" { ChangeMode 'RESOURCE' } item "&DIFF" { ChangeMode 'DIFF' } item "&MERGE" { ChangeMode 'MERGE' } item "&SH" { ChangeMode 'SH' } item "PER&L" { ChangeMode 'PERL' } item "PASCAL" { ChangeMode 'PASCAL' } item "&JAVA" { ChangeMode 'JAVA' } item "TE&X" { ChangeMode 'TEX' } item "&BIN" { ChangeMode 'BIN' } } menu MOpenInMode { item "&Plain" { FileOpenInMode 'PLAIN' } item "&Text" { FileOpenInMode 'TEXT' } item "&C" { FileOpenInMode 'C' } item "&EMail" { FileOpenInMode 'MSG' } item "&HTML" { FileOpenInMode 'HTML' } item "&IPF" { FileOpenInMode 'IPF' } item "&Ada" { FileOpenInMode 'Ada' } item "&REXX" { FileOpenInMode 'REXX' } item "MAKE" { FileOpenInMode 'MAKE' } item "&FTE" { FileOpenInMode 'FTE' } item "Resource" { FileOpenInMode 'RESOURCE' } item "&DIFF" { FileOpenInMode 'DIFF' } item "&MERGE" { FileOpenInMode 'MERGE' } item "&SH" { FileOpenInMode 'SH' } item "PER&L" { FileOpenInMode 'PERL' } item "PASCAL" { FileOpenInMode 'PASCAL' } item "&JAVA" { FileOpenInMode 'JAVA' } item "TE&X" { FileOpenInMode 'TEX' } item "&BIN" { FileOpenInMode 'BIN' } } menu File { item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; # item "Open &Binary" { FileOpenInMode 'BIN' } item "&Reload\tShift+F3" { FileReload } item "&Save\tF2" { FileSave } item "Save &As...\tShift+F2" { FileSaveAs } item "Save Al&l\tCtrl+F2" { FileSaveAll } item "Write &To..." { FileWriteTo } # item "Sa&ve and Close\tAlt+F2" { FileSave; FileClose } item "Prin&t" { FilePrint } # Save Rain Forest item "&Close\tCtrl+F10" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "Sh&ell" { RunProgram "" } item "E&xit\tAlt+X" { ExitEditor } } menu Edit { item "&Undo\tAlt+BackSp" { Undo } item "&Redo\tAlt+Shift+BackSp" { Redo } item; item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; # item "&Insert line\tShift+Enter" { LineInsert } item "&Delete line\tCtrl+Y" { KillLine } item "&Split line\tCtrl+Enter" { LineSplit } item "&Join line\tCtrl+J" { LineJoin } # item "Dup&licate line\tCtrl+D" { LineDuplicate } # item "Delete to line &end\tAlt+End" { KillToLineEnd } # item "Delete to li&ne start\tCtrl+Shift+BackSp" { KillToLineStart } item; item "&Quote Literal...\tCtrl+Q" { InsertChar } item "&ASCII Table...\tCtrl+Shift+A" { ASCIITable } } menu Translate { item "&Uppercase" { BlockCaseUp } item "&Lowercase" { BlockCaseDown } item "&Togglecase" { BlockCaseToggle } item "&Rot13" { BlockTrans 'A-Za-z' 'N-ZA-Mn-za-m' } item; item "User &specified..." { BlockTrans } } menu Block { item "&Unmark\tEsc" { BlockUnmark } item "Mark &Line\tAlt+L" { BlockMarkLine } item "Mark &Stream\tAlt+A" { BlockMarkStream } item "Mark &Column\tAlt+K" { BlockMarkColumn } item; # item "Select Wor&d" { BlockSelectWord } # item "Selec&t Line" { BlockSelectLine } # item; item "&Indent\tAlt+I" { BlockIndent } item "U&nindent\tAlt+U" { BlockUnindent } item; item "&Write..." { BlockWrite } item "&Read..." { BlockRead } item "&Print" { BlockPrint } item; submenu "Translat&e", Translate; } menu Search { item "&Find...\tCtrl+Q C+W" { Find } item "Find and &replace...\tCtrl+R" { FindReplace } item "Repeat &Last find\tCtrl+L" { FindRepeat } item "Repeat last find re&verse\tCtrl+B" { FindRepeatReverse } item "Repeat last find &once\tCtrl+N" { FindRepeatOnce } item "Incremental &search\tCtrl+S" { IncrementalSearch } item; item "&Place Bookmark..." { PlaceBookmark } item "Goto &Bookmark..." { GotoBookmark } item; item "&Match paren\tAlt+-" { MatchBracket } item "&Goto line...\tAlt+J" { MoveToLine } } menu Fold { item "&Create fold\tAlt+Gray++" { FoldCreate } item "Create folds by ®exp..." { FoldCreateByRegexp } item "&Destroy fold\tAlt+Gray+-" { FoldDestroy } item; item "&Open fold\tCtrl+Gray++" { FoldOpen } item "Open &nested folds\tCtrl+Gray+*" { FoldOpenNested } item "C&lose fold\tCtrl+Gray+-" { FoldClose } item "&Toggle fold open/close\tCtrl+Gray+/" { FoldToggleOpenClose } item; item "&Promote fold\tShift+Gray+-" { FoldPromote } item "De&mote fold\tShift+Gray++" { FoldDemote } item; item "Open &all folds\tAlt+Gray+*" { FoldOpenAll } item "Close all &folds\tAlt+Gray+/" { FoldCloseAll } item "Destro&y all folds" { FoldDestroyAll } } menu Options { submenu "Change &mode\tC+O C+M", MChangeMode; item; item "&Insert mode\tC+O C+I" { ToggleInsert } item "&Auto indent\tC+O C+A" { ToggleAutoIndent } item "&Case sensitive\tC+O C+C" { ToggleMatchCase } item "Trim &EOL spaces\tC+O C+E" { ToggleTrim } item "&Read only\tC+O C+R" { ToggleReadOnly } item "&Undo/Redo\tC+O C+U" { ToggleUndo } item "&Show markers\tC+O C+." { ToggleShowMarkers; WinRefresh } item "Highlight tags" { ToggleHilitTags; WinRefresh } item "Show &bookmarks" { ToggleShowBookmarks; WinRefresh } item; item "&Word wrap\tC+O C+W" { ToggleWordWrap } item "&Left margin...\tC+O A+[" { ChangeLeftMargin } item "Ri&ght margin...\tC+O A+]" { ChangeRightMargin } item; item "&Tab size...\tC+O C+T" { ChangeTabSize; WinRefresh } item "S&how tabs\tC+O Tab" { ToggleShowTabs; WinRefresh } item "E&xpand tabs\tC+O C+Tab" { ToggleExpandTabs; WinRefresh } item "&Print to... " { SetPrintDevice } } menu Main { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } menu Local { item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tC+F10" { FileClose } } menu DirectoryFile { item "&Selected\tEnter" { Activate } item; item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; item "Open &Binary" { FileOpenInMode 'BIN' } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu DirectoryMain { submenu "&File", DirectoryFile; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu MessagesMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu RoutinesMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu BufferListMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu EventMapViewMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu DirectoryLocal { item "&Open" { Activate } item; item "&Reload\tCtrl+R" { Rescan } item; item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } item "&/ Goto Dir\t/" { DirGoto } item "&Delete File\tCtrl+D" { DeleteFile } } menu BufferListLocal { item "&View\tEnter" { Activate } item; item "&Save\tCtrl+S" { BufListFileSave } item "&Close\tCtrl+C" { BufListFileClose } } menu RoutinesLocal { item "&View\tEnter" { Activate } } menu EventMapViewLocal { item "&Close view\tAlt+Q" { FileClose } } menu MessagesLocal { item "&View error\tEnter" { Activate } item; item "&Previous error\tF11" { CompilePrevError } item "&Next error\tF12" { CompileNextError } } efte-1.1/config/m_lua.fte0000664000076400007640000000703011163156165014371 0ustar laurilauri# m_lua.fte # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # # # eFTE mode for editing Lua files # colorize Lua { SyntaxParser = "SIMPLE"; color { { "Normal", "Editor_Default" }, { "Number", "Lang_DecimalNumber" }, { "String", "Lang_String" }, { "Comment", "Lang_Comment" }, { "Regexp", "Lang_Regexp" }, { "Punctuation", "Lang_Punctuation" }, { "Command", "Lang_Command" }, { "CPreprocessor", "Lang_Preprocessor" }, }; keyword "Editor_Keywords" { "do", "end", "while", "repeat", "until", "if", "elseif", "then", "else", "for", "in", "function", "local", "return", "dofile", "require", "include" }; keyword "Editor_Keywords2" { "debug", "string", "math", "table", "io", "coroutine", "os" }; keyword "Editor_Keywords3" { # Io "close", "flush", "input", "lines", "open", "output", "popen", "read", "tmpfile", "type", "write", # Math "abs", "acos", "asin", "atan2", "atan", "ceil", "cosh", "cos", "deg", "exp", "floor", "fmod", "frexp", "huge", "ldexp", "log10", "log", "max", "min", "modf", "pi", "pow", "rad", "random", "randomseed", "sinh", "tan", # OS "clock", "date", "difftime", "execute", "exit", "getenv", "remove", "rename", "setlocale", "time", "tmpname", # Package "cpath", "loaded", "loadlib", "path", "preload", "seeall", # String "byte", "char", "dump", "find", "format", "gmatch", "gsub", "len", "lower", "match", "rep", "reverse", "sub", "upper", # Table "concat", "insert", "maxn", "remove", "sort", # Coroutine "create", "resume", "running", "status", "wrap", "yield", # Debug "debug", "getfenv", "gethook", "getinfo", "getlocal", "getmetatable", "getregistry", "getupvalue", "setfenv", "sethook", "setlocal", "setmetatable", "setupvalue", "traceback" }; keyword "Editor_Keywords4" { ":close", ":flush", ":lines", ":read", ":seek", ":setvbuf", ":write" }; keyword "Editor_Keywords5" { "false", "nil", "true", }; h_state 0 { "Normal" } h_trans { 1, "", "--", "Comment" } h_trans { 2, "", "\"", "String" } h_trans { 3, "", "\'", "String" } h_trans { 4, "s", "0-9", "Number" } h_trans { 5, "^", "=start", "Comment" } h_trans { 0, "S", "a-zA-Z0-9_%", "Punctuation" } h_wtype { 0, 0, 0, "", "a-zA-Z0-9_" } h_state 1 { "Comment" } h_trans { 0, "$", "", "Normal" } h_state 2 { "String" } h_trans { 0, "", "\"", "String" } h_trans { 2, "Qq", "\\", "String" } h_state 3 { "String" } h_trans { 0, "", "\'", "String" } h_trans { 3, "Qq", "\\", "String" } h_state 4 { "Number" } h_trans { 0, "-S", "0-9", "Normal" } h_trans { 0, "$", "", "Normal" } h_state 5 { "Comment" } h_trans { 0, "^", "=end", "Comment" } } mode Lua: SOURCE { FileNameRx = /\.\clua$/; Colorizer = "Lua"; HilitOn = 1; AutoIndent = 1; IndentMode = "PLAIN"; MatchCase = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; CommentStart = "--"; CommentEnd = ""; RoutineRegexp = /^\s*{local }*function /; } oinclude "mym_lua.fte"; efte-1.1/config/k_brief.fte0000664000076400007640000002035611157534024014700 0ustar laurilauri eventmap MODEL { key [F1_G-Down] { WinNext } key [F1_G-Up] { WinPrev } key [F2_G-Down] { WinResize +1 } key [F2_G-Up] { WinResize -1 } key [F3_G-Down] { WinHSplit } key [F3_G-Up] { WinHSplit; WinPrev } key [F4_G-Down] { WinClose; } key [F4_G-Up] { WinNext; WinClose } key [C+N] { FileNext } key [C+P] { FilePrev } key [A+B] { ViewBuffers } key [A+E] { FileOpen } key [A+H] { ViewModeMap } key [A+N] { FileNext } key [A+P] { FilePrev } key [A+X] { ExitEditor } key [A+Z] { RunProgram "" } key [A+F4] { ExitEditor } key [C+Z] { WinZoom } key [C+X] { ExitEditor } key [C+_] { FileClose } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } # this is also useful for 'grep -n' etc. if configured key [F9] { Compile; ViewMessages } key [F11] { CompilePrevError } key [F12] { CompileNextError } key [S+F9] { ViewMessages } key [A+F5] { ShowEntryScreen } key [A+0] { ViewBuffers } key [A+1] { SwitchTo 1 } key [A+2] { SwitchTo 2 } key [A+3] { SwitchTo 3 } key [A+4] { SwitchTo 4 } key [A+5] { SwitchTo 5 } key [A+6] { SwitchTo 6 } key [A+7] { SwitchTo 7 } key [A+8] { SwitchTo 8 } key [A+9] { SwitchTo 9 } #key [A+F] { MainMenu 'F' } #key [A+T] { MainMenu 'T' } #key [A+W] { MainMenu 'W' } #key [A+H] { MainMenu 'H' } } # List Viewers eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveFileStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveFileEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [C+G-Left] { ScrollRight } key [C+G-Right] { ScrollLeft } key [G-Enter] { Activate } key [Space] { ActivateInOtherWindow } key [S+G-Enter] { CloseActivate } key [C+R] { Rescan } } eventmap DIRECTORY: MLIST { MainMenu = 'DirectoryMain'; LocalMenu = 'DirectoryLocal'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [C+D] { DeleteFile } key [Esc] { FileClose 0 } key [A+N] { MainMenu 'N' } } # Buffer List eventmap BUFFERS: MLIST { MainMenu = "BufferListMain"; LocalMenu = "BufferListLocal"; key [Esc] { FileClose 0 } # 0 = do not open directory when last closed, overrides OpenAfterClose default. key [C+C] { BufListFileClose } key [G-Del] { BufListFileClose } key [C+S] { BufListFileSave } key [F2] { BufListFileSave } } # Routine List eventmap ROUTINES: MLIST { MainMenu = "RoutinesMain"; LocalMenu = "RoutinesLocal"; key [Esc] { FileClose } } eventmap MESSAGES: MLIST { MainMenu = "MessagesMain"; LocalMenu = "MessagesLocal"; key [C+C] { ChildClose } # does NOT kill, just closes pipe } # Event Map View eventmap EVENTMAPVIEW: MLIST { MainMenu = "EventMapViewMain"; LocalMenu = "EventMapViewLocal"; key [Esc] { FileClose 0 } } eventmap PLAIN: MODEL { # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [Esc] { BlockUnmark } key [F5] { Find } key [F6] { FindReplace } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } # key [A+G-Left] { ScrollLeft } # key [A+G-Right] { ScrollRight } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } # key [A+G-S+Up] { BlockExtendBegin; ScrollUp; BlockExtendEnd } # key [A+G-S+Down] { BlockExtendBegin; ScrollDown; BlockExtendEnd } # key [A+G-S+Left] { BlockExtendBegin; ScrollLeft; BlockExtendEnd } # key [A+G-S+Right] { BlockExtendBegin; ScrollRight; BlockExtendEnd } key [A+G-C+Up] { MovePrevEqualIndent } key [A+G-C+Down] { MoveNextEqualIndent } # key [A+G-C+Left] { MovePrevTab } # key [A+G-C+Right] { MoveNextTab } key [C+G-Ins] { BlockCopy } key [C+G-Del] { BlockKill } key [S+G-Ins] { BlockPasteStream } key [S+G-Del] { BlockCut } key [A+G-Ins] { BlockPasteColumn } key [A+G-S+Ins] { BlockPasteLine } key [G-Enter] { LineNew } key [BackSp] { BackSpace } key [G-Ins] { ToggleInsert } key [G-Del] { Delete } key [Tab] { InsertTab } key [S+Tab] { InsertSpacesToTab 10 } key [C+Tab] { CompleteWord } # key [C+Tab] { InsertTab } key [C+BackSp] { KillWordPrev } key [C+S+BackSp] { KillToLineStart } key [C+G-Enter] { LineSplit } key [G-S+Enter] { LineInsert } key [A+G-Enter] { LineAdd } key [A+G-Del] { KillWord } key [A+G-End] { KillToLineEnd } key [A+BackSp] { Undo } key [A+S+BackSp] { Redo } #key [C+A] key [C+B] { MoveLineBottom } key [C+C] { MoveLineCenter } #key [C+E] #key [C+F] key [C+G] { ListRoutines } key [C+H] { BackSpace } key [C+I] { InsertTab } key [C+K] { KillWordPrev } key [C+L] { KillWord } #key [C+R] key [C+T] { MoveLineTop } key [C+U] { Redo } key [C+V] { InsertChar } key [C+\]] { TagFindWord } key [C+^] { MatchBracket } key [A+/] { CompleteWord } key [A+A] { BlockMarkStream } key [A+C] { BlockMarkColumn } key [A+D] { KillLine } key [A+G] { MoveToLine } key [A+I] { ToggleInsert } key [A+J] { GotoBookmark } key [A+K] { KillToLineEnd } key [A+L] { BlockMarkLine } key [A+M] { BlockMarkStream } key [A+O] { FileSaveAs } key [A+Q] { InsertChar } key [A+R] { BlockRead } key [A+S] { Find } key [A+T] { FindReplace } key [A+U] { Undo } key [A+V] { ShowVersion } key [A+W] { FileSave } #key [A+Y] { Find ?? "r" } } efte-1.1/config/m_ruby.fte0000664000076400007640000000607211157534024014573 0ustar laurilauricolorize Ruby { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_Number' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, { 'Regexp', 'Lang_Regexp' }, }; keyword 'Editor_Keywords' { 'if', 'else', 'elsif', 'while', 'case', 'when', 'unless', 'until', 'for', 'in', 'loop', 'then', 'do', 'return', 'break', 'next', 'redo', 'retry', 'rescue', 'ensure', 'def', 'begin', 'end', 'yield', 'proc', 'class', 'module', 'nil', 'TRUE', 'true', 'FALSE', 'false', 'self', 'super', '__LINE__', '__FILE__', 'not', 'or', 'and', 'defined', 'undef', 'attr_reader', 'attr_writer', 'attr_accessor', 'alias', 'include', 'load', 'require' }; h_state 0 { 'Normal' } h_trans { 5, '-s', 'a-zA-Z_', 'Normal' } h_trans { 1, '', '#', 'Comment' } h_trans { 1, '^', '=begin', 'Comment' } # h_trans { 1, '', '//', 'Comment' } h_trans { 3, '', '"', 'String' } h_trans { 4, '', '\'', 'String' } h_trans { 6, 's', '0-9', 'Number' } h_trans { 7, '', '/', 'String' } h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' } h_state 1 { 'Comment' } # single line comment h_trans { 0, '$', '', 'Normal' } h_state 2 { 'Comment' } # multiline comment h_trans { 0, '^', '=end', 'Comment' } h_state 3 { 'String' } # Single quote h_trans { 0, '', '"', 'String' } h_trans { 0, '$', '', 'String' } h_trans { 4, 'Qq', '\\', 'String' } h_state 4 { 'String' } # Double quote h_trans { 0, '', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 5 { 'Normal' } h_trans { 0, '$', '', 'Normal' } # h_trans { 0, '', '[a-zA-Z_][a-zA-Z0-9_]*', 'Function' } h_wtype { 0, 0, 0, '', 'a-zA-Z0-9_' } h_state 6 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 7 { 'Regexp' } # Regular Expressions h_trans { 7, '', '\\/', 'Regexp' } h_trans { 0, 's', '/', 'String' } } mode Ruby: SOURCE { # Ruby mode FileNameRx = '\\.{rb}|{ruby}$'; Colorizer = 'Ruby'; HilitOn = 1; AutoIndent = 1; IndentMode = 'PLAIN'; TabSize = 8; SpaceTabs = 1; MatchCase = 1; Trim = 1; MultiLineHilit = 0; AutoHilitParen = 1; RoutineRegexp = /^\s*{def}\s/; SaveFolds = 2; # save fold info at end of line CommentStart = ' #'; CommentEnd = ''; } oinclude 'mym_ruby.fte'; efte-1.1/config/m_markup.fte0000664000076400007640000000030711157534024015104 0ustar laurilauri# MARKUP mode # # All markup modes should inherit from this mode which enables the # user to easily modify preferences for all markup file types # mode MARKUP: PLAIN { } oinclude 'mym_markup.fte'; efte-1.1/config/m_php.fte0000664000076400007640000002030511157534024014374 0ustar laurilauricolorize PHP { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Special', 'Lang_Preprocessor' }, { 'Variable', 'Lang_Variable' }, }; keyword 'Editor_Keywords' { 'if', 'else', 'elseif', 'endif', 'while', 'for', 'class', 'extends', 'case', 'switch', 'global', 'function', 'var', 'new', 'break', 'continue', 'require', 'include', 'abs', 'acos', 'array', 'array_keys', 'array_merge', 'array_pop', 'array_push', 'array_shift', 'array_slice', 'array_splice', 'array_unshift', 'array_values', 'array_walk', 'array', 'arsort', 'asin', 'asort', 'aspell_check_raw', 'aspell_check', 'aspell_new', 'aspell_suggest', 'atan', 'atan2', 'base_convert', 'base64_decode', 'base64_encode', 'basename', 'bcadd', 'bccomp', 'bcdiv', 'bcmod', 'bcmul', 'bcpow', 'bcscale', 'bcsqrt', 'bcsub', 'bin2hex', 'bindec', 'ceil', 'chdir', 'checkdate', 'checkdnsrr', 'chgrp', 'chmod', 'chop', 'chown', 'chr', 'chunk_split', 'clearstatcache', 'closedir', 'closelog', 'compact', 'connection_aborted', 'connection_status', 'connection_timeout', 'convert_cyr_string', 'copy', 'cos', 'count', 'crypt', 'current', 'date', 'debugger_off', 'debugger_on', 'decbin', 'dechex', 'decoct', 'delete', 'die', 'dirname', 'diskfreespace', 'dl', 'doubleval', 'each', 'easter_date', 'easter_days', 'echo', 'empty', 'end', 'ereg_replace', 'ereg', 'eregi_replace', 'eregi', 'error_log', 'error_reporting', 'escapeshellcmd', 'eval', 'exec', 'exit', 'exp', 'explode', 'extension_loaded', 'extract', 'fclose', 'feof', 'fgetc', 'fgetcsv', 'fgets', 'fgetss', 'file_exists', 'file', 'fileatime', 'filectime', 'filegroup', 'fileinode', 'filemtime', 'fileowner', 'fileperms', 'filesize', 'filetype', 'flock', 'floor', 'flush', 'fopen', 'fpassthru', 'fputs', 'fread', 'frenchtojd', 'fseek', 'fsockopen', 'ftell', 'function_exists', 'fwrite', 'get_cfg_var', 'get_current_user', 'get_magic_quotes_gpc', 'get_magic_quotes_runtime', 'get_meta_tags', 'getallheaders', 'getdate', 'getenv', 'gethostbyaddr', 'gethostbyname', 'gethostbynamel', 'getimagesize', 'getlastmod', 'getmxrr', 'getmyinode', 'getmypid', 'getmyuid', 'getrandmax', 'getrusage', 'gettimeofday', 'gettype', 'gmdate', 'gmmktime', 'gmstrftime', 'gregoriantojd', 'header', 'hexdec', 'htmlentities', 'htmlspecialchars', 'hw_children', 'hw_childrenobj', 'hw_close', 'hw_connect', 'hw_cp', 'hw_deleteobject', 'hw_docbyanchor', 'hw_docbyanchorobj', 'hw_documentattributes', 'hw_documentbodytag', 'hw_documentcontent', 'hw_documentsetcontent', 'hw_documentsize', 'hw_edittext', 'hw_error', 'hw_errormsg', 'hw_free_document', 'hw_getanchors', 'hw_getanchorsobj', 'hw_getandlock', 'hw_getchildcoll', 'hw_getchildcollobj', 'hw_getchilddoccoll', 'hw_getchilddoccollobj', 'hw_getobject', 'hw_getobjectbyquery', 'hw_getobjectbyquerycoll', 'hw_getobjectbyquerycollobj', 'hw_getobjectbyqueryobj', 'hw_getparents', 'hw_getparentsobj', 'hw_getremote', 'hw_getremotechildren', 'hw_getsrcbydestobj', 'hw_gettext', 'hw_getusername', 'hw_identify', 'hw_incollections', 'hw_info', 'hw_inscoll', 'hw_insdoc', 'hw_insertdocument', 'hw_insertobject', 'hw_modifyobject', 'hw_mv', 'hw_new_document', 'hw_objrec2array', 'hw_outputdocument', 'hw_pconnect', 'hw_pipedocument', 'hw_root', 'hw_unlock', 'hw_who', 'ignore_user_abort', 'implode', 'in_array', 'include', 'intval', 'iptcparse', 'is_array', 'is_dir', 'is_double', 'is_executable', 'is_file', 'is_float', 'is_int', 'is_integer', 'is_link', 'is_long', 'is_object', 'is_readable', 'is_real', 'is_string', 'is_writeable', 'isset', 'jddayofweek', 'jdmonthname', 'jdtofrench', 'jdtogregorian', 'jdtojewish', 'jdtojulian', 'jewishtojd', 'join', 'juliantojd', 'key', 'ksort', 'leak', 'link', 'linkinfo', 'list', 'log', 'log10', 'lstat', 'ltrim', 'mail', 'max', 'md5', 'microtime', 'min', 'mkdir', 'mktime', 'next', 'nl2br', 'number_format', 'octdec', 'opendir', 'openlog', 'ord', 'pack', 'parse_str', 'parse_url', 'passthru', 'pclose', 'pfsockopen', 'phpinfo', 'phpversion', 'pi', 'popen', 'pos', 'pow', 'preg_grep', 'preg_match_all', 'preg_match', 'preg_quote', 'preg_replace', 'preg_split', 'prev', 'print', 'printf', 'putenv', 'quoted_printable_decode', 'quotemeta', 'rand', 'range', 'rawurldecode', 'rawurlencode', 'readdir', 'readfile', 'readgzfile', 'readlink', 'register_shutdown_function', 'rename', 'require', 'reset', 'rewind', 'rewinddir', 'rmdir', 'round', 'rsort', 'sem_acquire', 'sem_get', 'sem_release', 'serialize', 'set_file_buffer', 'set_magic_quotes_runtime', 'set_socket_blocking', 'set_time_limit', 'setcookie', 'setlocale', 'settype', 'shm_attach', 'shm_detach', 'shm_get_var', 'shm_put_var', 'shm_remove_var', 'shm_remove', 'shuffle', 'similar_text', 'sin', 'sizeof', 'sleep', 'sort', 'soundex', 'split', 'sprintf', 'sql_regcase', 'sqrt', 'srand', 'stat', 'str_replace', 'strchr', 'strcmp', 'strcspn', 'strftime', 'strip_tags', 'stripslashes', 'strlen', 'strpos', 'strrchr', 'strrev', 'strrpos', 'strspn', 'strstr', 'strtok', 'strtolower', 'strtoupper', 'strtr', 'strval', 'substr', 'sybase_affected_rows', 'symlink', 'syslog', 'system', 'tan', 'tempnam', 'time', 'touch', 'trim', 'uasort', 'ucfirst', 'ucwords', 'uksort', 'umask', 'uniqid', 'unlink', 'unpack', 'unserialize', 'unset', 'urldecode', 'urlencode', 'usleep', 'usort', 'utf8_decode', 'utf8_encode', 'virtual', 'vm_addalias', 'vm_adduser', 'vm_delalias', 'vm_deluser', 'vm_passwd' }; h_state 0 { 'Special' } h_trans { 9, '>', '', '', '*/', 'Comment' } h_state 2 { 'Comment' } h_trans { 9, '$', '', 'Comment' } h_state 3 { 'String' } h_trans { 9, '>', '"', 'String' } #h_trans { 9, '$', '', 'String' } h_trans { 3, 'qQ', '\\', 'String' } h_state 4 { 'String' } h_trans { 9, '>', '\'', 'String' } #h_trans { 9, '$', '', 'String' } h_trans { 4, 'qQ', '\\', 'String' } h_state 5 { 'Normal' } h_trans { 9, '$', '', 'Normal' } h_wtype { 9, 9, 9, 'i', 'a-zA-Z0-9_' } h_state 6 { 'HexNumber' } h_trans { 9, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 9, '$', '', 'Normal' } h_state 7 { 'Number' } h_trans { 9, '-S', '0-9', 'Normal' } h_trans { 9, '$', '', 'Normal' } h_state 8 { 'Variable' } h_trans { 9, '-S', 'a-zA-Z0-9_\$', 'Variable' } h_state 9 { 'Normal' } h_trans { 8, '<', '$', 'Variable' } h_trans { 5, '-s', 'a-zA-Z_', 'Normal' } h_trans { 1, '<', '/*', 'Comment' } h_trans { 2, '<', '//', 'Comment' } h_trans { 2, '<', '#', 'Comment' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '<', '\'', 'String' } h_trans { 10, '<', '`', 'String' } h_trans { 0, '<', '?>', 'Special' } h_trans { 6, '<', '0x', 'HexNumber' } h_trans { 7, '', '`', 'String' } h_trans { 10, 'qQ', '\\', 'String' } } mode PHP: SOURCE { # PHP Mode FileNameRx = /\.\c{PHP3}|{PHP4}|{PHP}|{PHTML}$/; HilitOn = 1; Colorizer = 'PHP'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; RoutineRegexp = '^{class}|{function}'; } oinclude 'mym_php.fte'; efte-1.1/config/m_catbs.fte0000664000076400007640000000076411157534024014710 0ustar laurilauri# for viewing nroff output (do NOT use for editing). colorize CATBS { SyntaxParser = 'CATBS'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Symbol', 'Editor_Bold' }, }; } mode CATBS: PLAIN { FileNameRx = /\.\c{MAN}|{CAT}$/; # == never HilitOn = 1; Colorizer = 'CATBS'; ReadOnly = 1; # this mode cannot edit properly } oinclude 'mym_catbs.fte'; efte-1.1/config/pal_nce.fte0000664000076400007640000001251411157534024014675 0ustar laurilauri# color palette (black background) # the color palette is the definition of the symbolic colors # that are used everywhere else in the configuration files # syntax of the color specification is: # # fore back # or # symbolic_fore:symbolic_back # or # symbolic color_palette { { 'ScrollBar_Arrows', 'cyan:darkBlue' }, { 'ScrollBar_Background', 'cyan:darkBlue' }, { 'ScrollBar_Slider', 'darkBlue:cyan' }, { 'Status_Normal', 'black:gray' }, { 'Status_Active', 'black:darkCyan' }, { 'Message_Normal', 'cyan:darkBlue' }, { 'Message_Error', 'white:darkBlue' }, { 'Message_Bold', 'white:darkRed' }, { 'EntryField_Field', 'black:darkCyan' }, { 'EntryField_Prompt', 'black:gray' }, { 'EntryField_Selection', 'darkCyan:black' }, { 'List_Status', 'cyan:darkBlue' }, { 'List_Normal', 'cyan:darkBlue' }, { 'List_Selected', 'black:darkCyan' }, { 'List_Hilited', 'white:darkBlue' }, { 'List_HilitSelect', 'black:darkCyan' }, { 'List_Marked', 'yellow:darkBlue' }, { 'List_MarkSelect', 'yellow:darkCyan' }, { 'List_MarkHilit', 'yellow:darkBlue' }, { 'List_MarkHilitSel', 'yellow:darkCyan' }, { 'ASCII_Chars', 'gray:black' }, { 'Menu_Background', 'white:darkCyan' }, { 'Menu_ActiveItem', 'white:black' }, { 'Menu_ActiveChar', 'yellow:black' }, { 'Menu_NormalItem', 'white:darkCyan' }, { 'Menu_NormalChar', 'yellow:darkCyan' }, { "Choice_Title", 'white:darkCyan' }, { "Choice_Param", 'black:darkCyan' }, { "Choice_Background", 'white:darkCyan' }, { "Choice_ActiveItem", 'white:black' }, { "Choice_ActiveChar", 'yellow:black' }, { "Choice_NormalItem", 'white:darkCyan' }, { "Choice_NormalChar", 'yellow:darkCyan' }, { "bg", 'gray:darkBlue' }, # background { "fg", 'gray:darkBlue' }, # foreground { 'Editor_Selected', 'black:darkCyan' }, { 'Editor_Markers', 'darkCyan:bg' }, { 'Editor_FoundText', 'white:darkRed' }, { 'Editor_Folds0', 'green:bg' }, { 'Editor_Folds1', 'blue:bg' }, { 'Editor_Folds2', 'magenta:bg' }, { 'Editor_Folds3', 'magenta:bg' }, { 'Editor_Folds4', 'magenta:bg' }, { 'Editor_HilitWord', 'red:bg' }, { 'Editor_Default', 'fg:bg' }, { 'Editor_Bold', 'cyan:bg' }, { 'Editor_Keywords', 'white:bg' }, { 'Editor_Keywords2', 'cyan:bg' }, { 'Editor_Keywords3', 'magenta:bg' }, { 'Editor_Keywords4', 'green:bg' }, { 'Editor_Keywords5', 'red:bg' }, { 'Msg_Header', 'darkCyan:bg' }, { 'Msg_Quotes', 'green:bg' }, { 'Msg_Tag', 'red:bg' }, { 'Msg_Signature', 'darkCyan:bg' }, { 'Comment', 'darkGray:bg' }, { 'String', 'cyan:bg' }, { 'Lang_Default', 'Editor_Default' }, { 'Lang_Number', 'red:bg' }, { 'Lang_DecimalNumber', 'Lang_Number' }, { 'Lang_HexNumber', 'magenta:bg' }, { 'Lang_OctalNumber', 'magenta:bg' }, { 'Lang_BinaryNumber', 'magenta:bg' }, { 'Lang_Punctuation', 'yellow:bg' }, { 'Lang_String', 'String' }, { 'Lang_Comment', 'Comment' }, { 'Lang_Preprocessor', 'green:bg' }, { 'Lang_Function', 'cyan:bg' }, { 'Lang_Label', 'red:bg' }, { 'Lang_Command', 'cyan:bg' }, { 'Lang_Regexp', 'magenta:bg' }, { 'Lang_Variable', 'gray:bg' }, { 'Lang_Control', 'white:bg' }, { 'Lang_Assembler', 'green:bg' }, # embedded assembler (Pascal) { 'Markup_Default', 'gray:bg' }, { 'Markup_Punctuation', 'yellow:bg' }, { 'Markup_String', 'String' }, { 'Markup_Symbol', 'green:bg' }, { 'Markup_Tag', 'cyan:bg' }, { 'Markup_Comment', 'Comment' }, { 'Markup_Special', 'red:bg' }, { 'Markup_Control', 'magenta:bg' }, { 'Markup_Quotes', 'yellow:bg' }, { 'Markup_Math', 'red:bg' }, # diff/diff3 { 'DIFF_Default', 'Editor_Default' }, { 'DIFF_Old', 'brown:bg' }, { 'DIFF_New', 'yellow:bg' }, { 'DIFF_Changed', 'darkCyan:bg' }, # rcsmerge { 'MERGE_Default', 'Editor_Default' }, { 'MERGE_Changed', 'white:bg' }, { 'MERGE_Old', 'gray:bg' }, { 'MERGE_New', 'red:bg' }, { 'MERGE_Control', 'yellow:bg' }, } efte-1.1/config/ab_c_os2.fte0000664000076400007640000000253011157534024014740 0ustar laurilauri# abbreviations for OS/2 api. eventmap C { abbrev 'wswp' 'WinSetWindowPos'; abbrev 'wcsw' 'WinCreateStdWindow'; abbrev 'wrc' 'WinRegisterClass'; abbrev 'wdwp' 'WinDefWindowProc'; abbrev 'wdw' 'WinDestroyWindow'; abbrev 'wir' 'WinInvalidateRect'; abbrev 'wbp' 'WinBeginPaint'; abbrev 'wdb' 'WinDrawBitmap'; abbrev 'wdt' 'WinDrawText'; abbrev 'wep' 'WinEndPaint'; abbrev 'wi' 'WinInitialize'; abbrev 'wt' 'WinTerminate'; abbrev 'wsm' 'WinSendMsg'; abbrev 'wpm' 'WinPostMsg'; abbrev 'MR' 'MRESULT'; abbrev 'MP' 'MPARAM'; # MPFROMxxx abbrev 'MPV' 'MPVOID'; abbrev 'MPP' 'MPFROMP'; abbrev 'MPHW' 'MPFROMHWND'; abbrev 'MPC' 'MPFROMCHAR'; abbrev 'MPS' 'MPFROMSHORT'; abbrev 'MPS2' 'MPFROMSHORT2'; abbrev 'MPL' 'MPFROMLONG'; # xxxFROMMP abbrev 'PMP' 'PVOIDFROMMP'; abbrev 'HWMP' 'HWNDFROMMP'; abbrev 'C1MP' 'CHAR1FROMMP'; abbrev 'C2MP' 'CHAR2FROMMP'; abbrev 'C3MP' 'CHAR3FROMMP'; abbrev 'C4MP' 'CHAR4FROMMP'; # MRFROMxxx abbrev 'MRP' 'MRFROMP'; abbrev 'MRS' 'MRFROMSHORT'; abbrev 'MR2S' 'MRFROM2SHORT'; abbrev 'MRL' 'MRFROMLONG'; # xxxFROMMR abbrev 'PMR' 'PVOIDFROMMR'; abbrev 'S1MR' 'SHORT1FROMMR'; abbrev 'S2MR' 'SHORT2FROMMR'; abbrev 'LMR' 'LONGFROMMR'; } efte-1.1/config/m_ada.fte0000664000076400007640000000463311157534024014340 0ustar laurilauricolorize Ada { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_Number' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, }; keyword 'Editor_Keywords' { 'abort', 'else', 'new', 'return', 'abs', 'elsif', 'not', 'reverse', 'abstract', 'end', 'null', 'accept', 'entry', 'select', 'access', 'exception', 'separate', 'aliased', 'exit', 'of', 'subtype', 'all', 'or', 'and', 'for', 'others', 'tagged', 'array', 'function', 'out', 'task', 'at', 'terminate', 'generic', 'package', 'then', 'begin', 'goto', 'pragma', 'type', 'body', 'private', 'if', 'procedure', 'case', 'in', 'protected', 'until', 'constant', 'is', 'use', 'raise', 'declare', 'range', 'when', 'delay', 'limited', 'record', 'while', 'delta', 'loop', 'rem', 'with', 'digits', 'renames', 'do', 'mod', 'requeue', 'xor', }; h_state 0 { 'Normal' } h_trans { 4, '-s', 'a-zA-Z_', 'Normal' } h_trans { 1, '', '--', 'Comment' } h_trans { 2, '', '"', 'String' } h_trans { 3, '', '\'', 'String' } h_trans { 5, 's', '0-9', 'Number' } h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '$', '', 'Normal' } h_state 2 { 'String' } h_trans { 0, '', '"', 'String' } h_trans { 0, '$', '', 'String' } h_trans { 4, 'Qq', '\\', 'String' } h_state 3 { 'String' } h_trans { 0, '', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 4 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, '', 'a-zA-Z0-9_' } h_state 5 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } } mode Ada: SOURCE { # Ada mode FileNameRx = '\\.\\c{ADS}|{ADB}$'; Colorizer = 'Ada'; HilitOn = 1; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 0; AutoHilitParen = 1; RoutineRegexp = /^\s*{function}|{procedure}\s/; SaveFolds = 2; # save fold info at end of line CommentStart = ' --'; CommentEnd = ''; } oinclude 'mym_ada.fte'; efte-1.1/config/m_euphoria.fte0000664000076400007640000000537511163156165015436 0ustar laurilauri# # eFTE mode for Euphoria (http://rapideuphoria.com) # colorize EUPHORIA { SyntaxParser = "SIMPLE"; color { { "Normal", "Editor_Default" }, { "Function", "Lang_Function" }, { "Number", "Lang_DecimalNumber" }, { "Comment", "Lang_Comment" }, { "String", "Lang_String" }, { "Punctuation", "Lang_Punctuation" }, }; keyword "Editor_Keywords" { "as", "and", "by", "case", "constant", "do", "end", "else", "elsif", "enum", "export", "for", "function", "global", "include", "if", "label", "loop", "not", "or", "override", "procedure", "public", "switch", "then", "type", "to", "until", "while", "xor" }; keyword "Editor_Keywords2" { "object", "sequence", "integer", "atom" }; keyword "Editor_Keywords3" { "break", "continue", "entry", "exit", "goto", "glabel", "retry", "return" }; keyword "Editor_Keywords4" { "ifdef", "elsifdef", "elsedef", "trace", "with", "without" }; h_state 0 { "Normal" } h_trans { 1, "-s", "a-zA-Z_", "Normal" } h_trans { 2, "<", "--", "Comment" } h_trans { 3, "", "\"", "String" } h_trans { 4, "", "\'", "String" } h_trans { 5, "", "*/", "Comment" } } mode EUPHORIA: SOURCE { FileNameRx = /\c{{\.{e}|{ew}|{eu}|{ed}|{ex}|{exu}|{exw}|{exd}$}|{ex.err}}/; HilitOn = 1; Colorizer = "EUPHORIA"; AutoIndent = 1; IndentMode = "PLAIN"; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 0; RoutineRegexp = /^{{override}|{public}|{global}|{export}}*\s*{{function}|{procedure}|{type}}\s+/; } oinclude "mym_euphoria.fte"; efte-1.1/config/uicstyle.fte0000664000076400007640000000073211157534024015134 0ustar laurilauri# C indentation style menu menu MChangeCIndentStyle { item "&Default" { ChangeTabSize 8; SetIndentWithTabs 0 SetCIndentStyle 4 0 -1 0 4 0 4 -4 0 1 -1 4 4 } item "&Linux kernel" { ChangeTabSize 8; SetIndentWithTabs 1 SetCIndentStyle 8 0 -1 0 8 0 8 -8 0 1 -1 8 8 } item "&GNU" { ChangeTabSize 8; SetIndentWithTabs 1 SetCIndentStyle 2 2 -1 0 2 0 2 -2 0 1 -1 2 2 } # more... } efte-1.1/config/m_clario.fte0000664000076400007640000000430211157534024015055 0ustar laurilauri# CLARION # Contributed by: thoye@sn.no (Thore Harald Hoye) colorize CLARION { SyntaxParser = 'Ada'; # ? color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_Number' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, }; keyword 'Editor_Keywords' { 'accept', 'and', 'begin', 'break', 'by', 'case', 'compile', 'cycle', 'do','eject', 'else', 'elsif', 'embed', 'end', 'endembed', 'execute', 'exit', 'function', 'goto', 'if', 'include', 'loop', 'member', 'not', 'of', 'omit', 'or', 'orof', 'procedure', 'program', 'return', 'routine', 'section', 'then', 'times', 'to', 'until', 'while', 'xor', }; keyword 'Editor_Keywords4' { 'application', 'code', 'detail', 'file', 'footer', 'form', 'group', 'header', 'item', 'map', 'menu', 'menubar', 'module', 'option', 'queue', 'record', 'report', 'subtitle', 'title', 'toolbar', 'view', 'window', }; keyword 'Editor_Keywords2' { 'localrequest', 'originalrequest', 'localresponse', 'windowopened', 'windowinitialized', 'forcerefresh', 'currenttab', 'globalrequest', 'requestcancelled', 'globalresponse', 'selectrecord', 'recordfiltered', }; keyword 'Editor_Keywords3' { 'initializewindow', 'refreshwindow', 'syncwindow', 'main', }; keyword 'Editor_Keywords5' { 'byte', 'short', 'ushort', 'long', 'ulong', 'sreal', 'real', 'bfloat4', 'bfloat8', 'date', 'time', 'string', 'decimal', 'pdecimal', 'pstring', 'cstring', 'group', }; } mode CLARION: SOURCE { # CLARION mode FileNameRx = '\\.\\c{CLW}$'; Colorizer = 'CLARION'; HilitOn = 1; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 0; RoutineRegexp = /^\s*{function}|{procedure}\s/; # SaveFolds = 2; # save fold info at end of line # CommentStart = ' --'; # CommentEnd = ''; } oinclude 'mym_clario.fte'; efte-1.1/config/menu/0000775000076400007640000000000011264420006013526 5ustar laurilauriefte-1.1/config/menu/m_html.fte0000664000076400007640000001777211157533205015533 0ustar laurilauri# eFTE menus for editing HTML files # contributed by m_debusk@sourceforge.com # Revision 2008-08-01 # HTML menu HTML_DTD { item "XHTML 1.0 &Transitional" { HTML_DTD_X1T } item "XHTML 1.0 &Strict" { HTML_DTD_X1S } item "XHTML 1.0 &Frameset" { HTML_DTD_X1F } item; item "HTML &4.01 Transitional" { HTML_DTD_4T } item "HTML 4.0&1 Strict" { HTML_DTD_4S } item "HTML 4.&01 Frameset" { HTML_DTD_4F } item; item "HTML &3.2 Final" { HTML_DTD_32F } item; item "HTML &2.0" { HTML_DTD_2 } } menu HTML_Character { item "&Bold C-E C-B" { HTML_B } item "&Strong C-E C-S" { HTML_STRONG } item "&Italic C-E C-I" { HTML_I } item "&Emphasize C-E C-E" { HTML_EM } item "Bi&g C+E A+B" { HTML_BIG } item "S&mall C+E A+S" { HTML_SMALL } item "S&ubscript C+E A+U" { HTML_SUB } item "Superscri&pt C+E A+P" { HTML_SUP } item "Bidirecti&on C+E A+O" { HTML_BDO } } menu HTML_Output { item "Pre&formatted
        C-E C-F" { HTML_PRE }
          item    "&Code           C-E C-C" { HTML_CODE }
          item    "&Typewriter       C-E C-T" { HTML_TT }
          item    "&Kbd entry       C-E C-K" { HTML_KBD }
          item    "&Variable        C-E C-V" { HTML_VAR }
          item    "Sam&ple msg     C-E C-M" { HTML_SAMP }
      }
      
      menu HTML_Header {
          item    "&1  

      C-E 1" { HTML_H1 } item "&2

      C-E 2" { HTML_H2 } item "&3

      C-E 3" { HTML_H3 } item "&4

      C-E 4" { HTML_H4 } item "&5

      C-E 5" { HTML_H5 } item "&6
      C-E 6" { HTML_H6 } } menu HTML_List { item "List &item
    1. C-E i " { HTML_LI } item "&Unordered list C-E u " { HTML_UL } item "&Ordered list
        C-E o " { HTML_OL } item "&Definition C-E C-D" { HTML_DFN } item "Definition &list
        C-E l " { HTML_DL } item "Definition &tag
        C-E t " { HTML_DT } item "Definition D&ata
        C-E d " { HTML_DD } } menu HTML_Table { item "&Table C-E A-T " { HTML_TABLE } item "&Caption C-E A-R" { HTML_TR } item "&Data " { HTML_COL } item "Column &Group C+E A+G" { HTML_COLGROUP } item "TH&ead C+E h " { HTML_THEAD } item "TFo&ot C+E f " { HTML_TFOOT } item "TBod&y C+E b " { HTML_TBODY } } menu HTML_Colors { item "&Black " { InsertString "#000000" } item "Bl&ue " { InsertString "#0000ff" } item "&Cyan " { InsertString "#00ffff" } item "&Gray " { InsertString "#808080" } item "Gr&een " { InsertString "#008000" } item "&Lime " { InsertString "#00ff00" } item "&Magenta" { InsertString "#ff00ff" } item "M&aroon " { InsertString "#800000" } item "&Navy " { InsertString "#000080" } item "&Olive " { InsertString "#808000" } item "&Purple " { InsertString "#800080" } item "&Red " { InsertString "#ff0000" } item "&Silver " { InsertString "#c0c0c0" } item "&Teal " { InsertString "#008080" } item "&White " { InsertString "#ffffff" } item "&Yellow " { InsertString "#ffff00" } } menu HTML_Blocks { item "&Abbreviation C+E C+A" { HTML_ABBR } item "Acron&ym C+E C+Y" { HTML_ACRONYM } item "Addre&ss
        C+E A+A" { HTML_ADDRESS } item "&Blockquote
        C+E C+Q" { HTML_BLOCKQUOTE } item "&Citation C-E C-O" { HTML_CITE } item "&Deleted Text C+E A+E" { HTML_DEL } item "&Inserted Text C+E A+I" { HTML_INS } item "&Quote C+E A+Q" { HTML_Q } } menu HTML_Links { item "Anchor &Name C-E C-N" { HTML_ANAME } item "Anchor H&Ref C-E C-H" { HTML_AHREF } item "Resource &Link C+E C+L" { HTML_LINK } } menu HTML_Frames { item "&Frameset C+E 7 " { HTML_FRAMESET } item "F&rame C+E A+F" { HTML_FRAME } item "&No Frames C+E C+R" { HTML_NOFRAMES } item "&Inline Frame <iframe> " { HTML_IFRAME } } menu HTML_Input { item "&Form <form> " { HTML_FORM } item "&Input Field <input> " { HTML_INPUT } item "&Text Area <textarea> " { HTML_TEXTAREA } item "Push &Button <button> " { HTML_BUTTON } item "&Selectable list <select> " { HTML_SELECT } item "&List box item <option> " { HTML_OPTION } item "&Option group <optgroup> " { HTML_OPTGROUP } item "La&bel <label> " { HTML_LABEL } item "Fiel&dset <fieldset> " { HTML_FIELDSET } item "Fi&eldset title <legend> " { HTML_LEGEND } } menu HTML_Images { item "Ima&ge Source <img src> C-E C-G" { HTML_IMG } item "Image &Map <map> C+E A+M" { HTML_MAP } item "Image Map &Area <area> " { HTML_AREA } } menu HTML_Styles { submenu "C&olors ", HTML_Colors; item; item "&Style <style> C+E A+L" { HTML_STYLE } item "&Division <div> C+E A+V" { HTML_DIV } item "S&pan Style <span> C+E C+W" { HTML_SPAN } item "&Centered <center> C-E . " { HTML_CENTER } } menu HTML_Prog { item "&Script <script> " { HTML_SCRIPT } item "&Parameters <param> " { HTML_PARAM } item "Script &Alternative <noscript> " { HTML_NOSCRIPT } item "Ob&ject <object> C+E C+J" { HTML_OBJECT } } menu HTML_Doc { submenu "Document T&ype Definitions ", HTML_DTD; submenu "&Frames ", HTML_Frames; item; item "&Body <body> C+E 9 " { HTML_BODY } item "Declare &HTML <html> C+E C+Z" { HTML_HTM } item "Convert Te&xt C-E &x " { HTML_TXT } item "Co&mment block <!-- --> C-E c " { HTML_COMMENT } item "Hea&d <head> C+E 8 " { HTML_HEAD } item "&Title <title> " { HTML_TITLE } item "Meta &Info <meta /> " { HTML_META } item "Ba&se <base /> C+E C+U" { HTML_BASEURL } } menu HTMLTags { item "&Paragraph <p> C-E C-P" { HTML_P } item "Line brea&k <br> C-E Enter" { HTML_BR } item "Horiz. rule <hr> C-E &-" { HTML_HR } item "Basic document C-E &0" { HTML_Base } item "Basic Frame Document" { HTML_BaseFrame } item; submenu "Do&cument Tags", HTML_Doc; submenu "C&haracter Format", HTML_Character; submenu "Output &Format", HTML_Output; submenu "&Blocks", HTML_Blocks; submenu "Hea&der", HTML_Header; submenu "&Lists", HTML_List; submenu "&Tables", HTML_Table; submenu "L&inks", HTML_Links; submenu "F&orms", HTML_Input; submenu "Ima&ges", HTML_Images; submenu "St&yles", HTML_Styles; submenu "P&rogramming", HTML_Prog; item; item "&View in Browser\tF9" { FileSave; HTML_View } item "Save and &Tidy" { FileSave; HTML_Tidy; FileReload; } item "Save and &ISpell" { FileSave; RunProgram "E:\\ISPELL40\\ispell.exe " . $FilePath; FileReload; } } menu Main_HTML { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "HT&ML", HTMLTags; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } eventmap HTML { MainMenu = "Main_HTML"; # menu for menubar key [A+M] { MainMenu 'M' } } ������efte-1.1/config/menu/m_rexx.fte���������������������������������������������������������������������0000664�0000764�0000764�00000045770�11157533205�015554� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# FTE pull-down menu for REXX mode # by Michael DeBusk # debu4335@eclipsetel.com # Revision March 19, 2001 # Decide if you want menus for libraries # Uncomment to include %define(REXXUtil) #%define(RxFTP) #%define(RxSock) menu REXX_Comments { item "&Header\theadx" { REXX_Heading } item "&Comment\tC+E c" { REXX_Comment } } menu REXX_Constructs { item "&Do\tdox" { REXX_Do } item "Do &While\tdwx" { REXX_DoWhile } item "Do &Until\tdux" { REXX_DoUntil } item "Do &Forever\tdfx" { REXX_DoForever } item "&If-Then-Else\tifx" { REXX_If } item "&Select\tselx" { REXX_Select } } # Keywords menu REXX_Call { item "&Call" { InsertString "CALL name [expression]"; } item "Call &On" { InsertString "CALL ON condition [NAME trapname]"; } item "Call O&ff" { InsertString "CALL OFF condition"; } } menu REXX_Numeric { item "&Digits" { InsertString "NUMERIC DIGITS [expression]"; } item "&Form" { InsertString "NUMERIC FORM [SCIENTIFIC | ENGINEERING | [VALUE] exp]"; } item "Fu&zz" { InsertString "NUMERIC FUZZ [exp]"; } } menu REXX_Parse { item "&Arg" { InsertString "PARSE [UPPER] ARG [template]"; } item "&LineIn" { InsertString "PARSE [UPPER] LINEIN [template]"; } item "&Pull" { InsertString "PARSE [UPPER] PULL [template]"; } item "&Source" { InsertString "PARSE [UPPER] SOURCE [template]"; } item "&Value" { InsertString "PARSE [UPPER] VALUE [expression] WITH [template]"; } item "Va&r" { InsertString "PARSE [UPPER] VAR [template]"; } item "Ver&sion" { InsertString "PARSE [UPPER] VERSION [template]"; } } menu REXX_Signal { item "&Signal" { InsertString "SIGNAL labelname"; } item "&Value" { InsertString "SIGNAL [VALUE] expression"; } item "&On" { InsertString "SIGNAL ON condition [NAME trapname]"; } item "O&ff" { InsertString "SIGNAL OFF condition"; } } menu REXX_Trace { item "&All" { InsertString "TRACE 'A'"; } item "&Commands" { InsertString "TRACE 'C'"; } item "&Error" { InsertString "TRACE 'E'"; } item "&Failure" { InsertString "TRACE 'F'"; } item "&Intermediates" { InsertString "TRACE 'I'"; } item "&Labels" { InsertString "TRACE 'L'"; } item "&Normal" { InsertString "TRACE 'N'"; } item "&Off" { InsertString "TRACE 'O'"; } item "&Results" { InsertString "TRACE 'R'"; } } menu REXX_Keywords { item "Address" { InsertString "ADDRESS [environment/value] [expression]"; } item "Ar&g" { InsertString "ARG [template]"; } submenu "&Call", REXX_Call; item "&Drop" { InsertString "DROP variable-list"; } item "E&xit" { InsertString "EXIT expression"; } item "Interpret" { InsertString "INTERPRET expression"; } item "Iterate" { InsertString "ITERATE name"; } item "Le&ave" { InsertString "LEAVE name"; } item "&NOP" { InsertString "NOP"; } submenu "Numer&ic", REXX_Numeric; item "&Options" { InsertString "OPTIONS expression"; } submenu "&Parse", REXX_Parse; item "Proc&edure" { InsertString ": PROCEDURE [EXPOSE variable-list]"; } item "Pu&ll" { InsertString "PULL [TEMPLATE]"; } item "P&ush" { InsertString "PUSH [expression]"; } item "&Queue" { InsertString "QUEUE [expression]"; } item "&Return" { InsertString "RETURN [expression]"; } item "Sa&y" { InsertString "SAY [expression]"; } submenu "&Signal", REXX_Signal; submenu "&Trace", REXX_Trace; } # Built-in Functions menu REXX_API { item "&Create Queue" { InsertString "RxQueue( Create [, queuename] )"; } item "&Delete Queue" { InsertString "RxQueue( Delete, queuename )"; } item "&Get Queue" { InsertString "RxQueue( Get )"; } item "&Set Queue" { InsertString "RxQueue( Set, newqueuename )"; } item "&Queued" { InsertString "Queued()"; } item "RxFunc&Add" { InsertString "RxFuncAdd( name, module, procedure )"; } item "RxFuncD&rop" { InsertString "RxFuncDrop( name )"; } item "RxFuncQuer&y" { InsertString "RxFuncQuery( name )"; } } menu REXX_Comp { item "Bit&And" { InsertString "BitAnd(string1 [, string2 ] [, pad ] )"; } item "Bit&Or" { InsertString "BitOr( string1 [, string2 ] [, pad ] )"; } item "Bit&Xor" { InsertString "BitXor( string1 [, string2 ] [, pad ] )"; } item "&Compare" { InsertString "Compare( string1, string2 [,pad] )"; } item "&Datatype" { InsertString "Datatype( string [, type ] )"; } item "&Translate" { InsertString "Translate(string, [[,tableo [,tablei [, pad]]]])"; } item "&Value" { InsertString "Value(name, [, [newvalue] [,selector]])"; } item "Veri&fy" { InsertString "Verify(string, reference [, [option] [,start]])"; } item "X&Range" { InsertString "XRange([start] [, end])"; } } menu REXX_Conv { item "B2X\t&1" { InsertString "B2X( binary_string )"; } item "C2D\t&2" { InsertString "C2D( string [, n] )"; } item "C2X\t&3" { InsertString "C2X( string )"; } item "D2C\t&4" { InsertString "D2C(number)[,n]"; } item "D2X\t&5" { InsertString "D2X(number[, n])"; } item "X2B\t&6" { InsertString "X2B(hexstring)"; } item "X2C\t&7" { InsertString "X2C(hexstring)"; } item "X2D\t&8" { InsertString "X2D(hextring [,n])"; } } menu REXX_Date { item "&Basedate" { InsertString "DATE('B')"; } item "&Days" { InsertString "DATE('D')"; } item "&European" { InsertString "DATE('E')"; } item "&Language" { InsertString "DATE('L')"; } item "&Month" { InsertString "DATE('M')"; } item "&Normal" { InsertString "DATE('N')"; } item "&Ordered" { InsertString "DATE('O')"; } item "&Sorted" { InsertString "DATE('S')"; } item "&USA" { InsertString "DATE('U')"; } item "&Weekday" { InsertString "DATE('W')"; } } menu REXX_Num { item "&Abs" { InsertString "Abs(number)"; } item "&Digits" { InsertString "Digits()"; } item "&Form" { InsertString "Form()"; } item "Fo&rmat" { InsertString "Format( number, [before [, after [, expp] [,expt] ]])"; } item "Fu&zz" { InsertString "Fuzz()"; } item "Ma&x" { InsertString "Max( number [, number ...] )"; } item "Mi&n" { InsertString "Min( number [, number ...] )"; } item "Rando&m" { InsertString "Random([min], [max] [, seed])"; } item "&Sign" { InsertString "Sign(number)"; } item "&Trunc" { InsertString "Trunc(number [,n])"; } } menu REXX_Stream { item "&Command" { InsertString "Stream(name, 'C]', streamcommand)"; } item "&Description" { InsertString "Stream(name, 'D')"; } item "&State" { InsertString "Stream(name, 'S')"; } } menu REXX_Strings { item "&Abbrev" { InsertString "Abbrev(information, info [,length])"; } item "Arg" { InsertString "Arg([n [, option]])"; } item "&Center" { InsertString "Center( string, length [, pad ] )"; } item "Char&In" { InsertString "CharIn( [name] [, start, length ] )"; } item "Char&Out" { InsertString "CharOut( [name] [, string, start ] )"; } item "Chars" { InsertString "Chars( [name] )"; } item "Copies" { InsertString "Copies( string, n )"; } item "&DelStr" { InsertString "DelStr( string, n, [, length] )"; } item "I&nsert" { InsertString "Insert( new, target [, [n] [, [length] [,pad]]])"; } item "&LastPos" { InsertString "LastPos( needle, haystack [,start])"; } item "Le&ft" { InsertString "Left( string, length [,pad] )"; } item "Lengt&h" { InsertString "Length( string )"; } item "Lin&eIn" { InsertString "LineIn( [name] [, [line] [,count] ] )"; } item "LineOu&t" { InsertString "LineOut( [name] [, [string] [,line]] )"; } item "Line&s" { InsertString "Lines( [name] )"; } item "O&verlay" { InsertString "Overlay(new, target [, [n] [, [length] [,pad]]])"; } item "Pos" { InsertString "Pos( needle, haystack [, start] )"; } item "&Reverse" { InsertString "Reverse( string )"; } item "Ri&ght" { InsertString "Right( string, length, [,pad] )"; } item "S&pace" { InsertString "Space( string [, [n] [,pad]] )"; } item "Strip" { InsertString "Strip(string [, [option] [, char]])"; } item "Su&bstr" { InsertString "Substr(string, n [, [length] [, pad]])"; } item "S&ymbol" { InsertString "Symbol(name)"; } } menu REXX_Sys { item "&Address" { InsertString "Address()"; } item "&Beep" { InsertString "Beep(frequency, duration)"; } item "&Condition" { InsertString "Condition( option )"; } item "&Directory" { InsertString "Directory([newdirectory])"; } item "Error&Text" { InsertString "ErrorText(n)"; } item "&EndLocal" { InsertString "EndLocal()"; } item "&FileSpec" { InsertString "FileSpec(element, filespec)"; } item "Set&Local" { InsertString "SetLocal()"; } item "&SourceLine" { InsertString "SourceLine([n])"; } item "T&race" { InsertString "Trace([option])"; } } menu REXX_Time { item "&24-Hour" { InsertString "TIME()"; } item "&Civil" { InsertString "TIME('C')"; } item "&Elapsed" { InsertString "TIME('E')"; } item "&Hours" { InsertString "TIME('H')"; } item "&Long" { InsertString "TIME('L')"; } item "&Minutes" { InsertString "TIME('M')"; } item "&Normal" { InsertString "TIME('N')"; } item "&Reset" { InsertString "TIME('R')"; } item "&Seconds" { InsertString "TIME('S')"; } } menu REXX_Word { item "&DelWord" { InsertString "DelWord( string, n [, length] )"; } item "&SubWord" { InsertString "SubWord(string, n [,length])"; } item "&Word" { InsertString "Word(string, n)"; } item "Word&Index" { InsertString "WordIndex(string, n)"; } item "Word&Length" { InsertString "WordLength(string, n)"; } item "Word&Pos" { InsertString "WordPos(phrase, string [,start])"; } item "Wor&ds" { InsertString "Words(string)"; } } menu REXX_BuiltIn { submenu "&API", REXX_API; submenu "Com&parison", REXX_Comp; submenu "&Conversion", REXX_Conv; submenu "&Date", REXX_Date; submenu "&Numbers", REXX_Num; submenu "&Stream", REXX_Stream; submenu "Strin&gs", REXX_Strings; submenu "S&ystem", REXX_Sys; submenu "&Time", REXX_Time; submenu "&Word", REXX_Word; } #REXXUtil Functions %if(REXXUtil) menu REXX_Disk { item "SysDrive&Info" { InsertString "info = SysDriveInfo(drive)"; } item "SysDrive&Map" { InsertString "map = SysDriveMap([drive], [opt])"; } item "SysFile&Delete" { InsertString "rc = SysFileDelete(file)"; } item "SysFile&Tree" { InsertString "rc = SysFileTree(filespec, stem, [options], [tattrib], [nattrib])"; } item "SysFile&Search" { InsertString "CALL SysFileSearch target, file, stem, [options]"; } item "Sys&GetEA" { InsertString "result = SysGetEA(file, name, variable)"; } item "SysM&kDir" { InsertString "rc = SysMkDir(dirspec)"; } item "Sys&PutEA" { InsertString "result = SysPutEA(file, name, value)"; } item "Sys&RmDir" { InsertString "rc = SysRmDir(dirspec)"; } item "SysSear&chPath" { InsertString "filespec = SysSearchPath(path, filename)"; } item "SysTemp&FileName" { InsertString "file = SysTempFileName(template, [filter])"; } } menu REXX_INI { item "&Set key value" { InsertString "result = SysIni([inifile], app, key, val)"; } item "&Query key value" { InsertString "result = SysIni([inifile], app, key)"; } item "&Delete key" { InsertString "result = SysIni([inifile], app, key, 'DELETE:')"; } item "Delete &application" { InsertString "result = SysIni([inifile], app, ['DELETE:'])"; } item "Query application &keys" { InsertString "result = SysIni([inifile], app, 'ALL:', 'stem')"; } item "Query a&ll apps" { InsertString "result = SysIni([inifile], 'ALL:', 'stem')"; } } menu REXX_Misc { item "Rx&MessageBox" { InsertString "action = RxMessageBox(text, [title], [button], [icon])"; } item "Sys&DropFuncs" { InsertString "CALL SysDropFuncs"; } item "Sys&GetMessage" { InsertString "msg = SysGetMessage(num, [file] [str1],...[str9])"; } item "Sys&OS2Ver" { InsertString "ver = SysOS2Ver()"; } item "Sys&Sleep" { InsertString "CALL SysSleep secs"; } item "Sys&WaitNamedPipe" { InsertString "result = SysWaitNamedPipe(name, [timeout])"; } } menu REXX_TxtScr { item "Sys&Cls" { InsertString "CALL SysCls"; } item "SysC&urPos" { InsertString "pos = SysCurPos([row, col])"; } item "SysCu&rState" { InsertString "CALL SysCurState ON/OFF"; } item "Sys&GetKey" { InsertString "key = SysGetKey([ECHO/NOECHO])"; } item "Sys&TextScreenRead" { InsertString "string = SysTextScreenRead(row, col, [len])"; } item "SysTe&xtScreenSize" { InsertString "result = SysTextScreenSize()"; } } menu REXX_WPS { item "Sys&CreateObject" { InsertString "rc = SysCreateObject(classname, title, location [,setup] [,option])"; } item "Sys&DeregisterObjectClass" { InsertString "rc = SysDeregisterObjectClass(class)"; } item "SysDe&stroyObject" { InsertString "result = SysDestroyObject(name)"; } item "Sys&QueryClassList" { InsertString "CALL SysQueryClassList stem"; } item "Sys&RegisterObjectClass" { InsertString "rc = SysRegisterObjectClass(class, module)"; } item "SysSet&Icon" { InsertString "rc = SysSetIcon(filename, iconfilename)"; } item "SysSet&ObjectData" { InsertString "rc = SysSetObjectData(name, setup)"; } item "SysCo&pyObject" {InsertString "rc = SysCopyObject(objectName, objectDest)"; } item "SysCr&eateShadow" {InsertString "rc = SysCreateShadow(objectName, objectDest)"; } item "SysMo&veObject" {InsertString "rc = SysMoveObject(objectName, objectDest)"; } item "SysS&aveObject" {InsertString "rc = SysSaveObject(name, fAsync)"; } item "SysOpe&nObject" {InsertString "rc = SysOpenObject(name, View, Flag)"; } } menu REXX_RU { item "&Load REXXUtil\tutilx" { REXX_RexxUtil } submenu "&Disk Services", REXX_Disk; submenu "&Miscellaneous", REXX_Misc; submenu "&SysIni", REXX_INI; submenu "&Text Screen Svc", REXX_TxtScr; submenu "&WPS Services", REXX_WPS; } %endif # REXXSock %if(OS_OS2) %if(RxSock) menu REXX_RS { item "&Load REXXSock\tsockx" { REXX_RxSock } item "Sock&Accept" { InsertString "socket = SockAccept(socket[,address])"; } item "Sock&Bind" { InsertString "rc = SockBind(socket,address)"; } item "Sock&Close" { InsertString "rc = SockClose(socket)"; } item "SockConnec&t" { InsertString "rc = SockConnect(socket,address)"; } item "Sock&DropFuncs" { InsertString "rc = SockDropFuncs()"; } item "Sock&GetHostByAddr" { InsertString "rc = SockGetHostByAddr(dotAddress,host[,domain])"; } item "SockGetHostBy&Name" { InsertString "rc = SockGetHostByName(nameAddress,host])"; } item "SockGetHost&Id" { InsertString "dotAddress = SockGetHostId()"; } item "SockGetP&eerName" { InsertString "rc = SockGetPeerName(socket,address)"; } item "SockGetSockNa&me" { InsertString "rc = SockGetSockName(socket,address)"; } item "SockGetSockO&pt" { InsertString "rc = SockGetSockOpt(socket,level,optVar,optVal"; } item "&SockInit" { InsertString "rc = SockInit()"; } item "SockI&octl" { InsertString "rc = SockIoctl(socket,ioctlCmd,ioctlData)"; } item "Soc&kListen" { InsertString "rc = SockListen(socket,backlog)"; } item "SockPSock_Errno" { InsertString "SockPSock_Errno([error_string])"; } item "SockRec&v" { InsertString "rc = SockRecv(socket,var,len[,flags])"; } item "SockRecv&From" { InsertString "rc = SockRecvFrom(socket,var,len[,flags],address)"; } item "SockSelect" { InsertString "rc = SockSelect(reads,writes,excepts[,timeout])"; } item "SockSend" { InsertString "rc = SockSend(socket,data[,flags])"; } item "SockSendTo" { InsertString "rc = SockSendTo(socket,data[,flags],address)"; } item "SockSetSockOpt" { InsertString "rc = SockSetSockOpt(socket,level,optVar,optVal)"; } item "SockShutDo&wn" { InsertString "rc = SockShutDown(socket,how)"; } item "SockSock_E&rrno" { InsertString "errno = SockSock_Errno()"; } item "SockSocket" { InsertString "socket = SockSocket(domain,type,protocol)"; } item "SockSoClose" { InsertString "rc = SockSoClose(socket)"; } item "SockVersion" { InsertString "vers = SockVersion()"; } } %endif # RxFTP %if(RxFTP) menu REXX_F { item "&Load REXXFTP\tftpx" { REXX_RxFTP } item "&Append to Remote File" { InsertString "rc = FtpAppend(localFile,remoteFile[,'Binary'|'Ascii'])"; } item "&ChDir Remote" { InsertString "rc = FtpChDir(directory)"; } item "&Delete Remote File" { InsertString "FtpDelete(remoteFile)"; } item "&Remote Dir Listing" { InsertString "FtpDir(pattern,stem)"; } item "Dr&op RxFTP Functions" { InsertString "FtpDropFuncs()"; } item "Do&wnload File" { InsertString "FtpGet(localFile,remoteFile[,'Binary'|'Ascii'])"; } item "Lo&goff" { InsertString "FtpLogoff()"; } item "Remote L&s Listing" { InsertString "FtpLs(pattern,stem)"; } item "M&kDir Remote" { InsertString "FtpMkDir(directory)"; } item "&Ping Host" { InsertString "FtpPing(host,length)"; } item "Copy by Pro&xy" { InsertString "FtpProxy(rc = FtpProxy(host1,userid1,password1,account1,host2,userid2,password2,account2,file1,file2[,'Binary'|'Ascii']))"; } item "Upload &File" { InsertString "FtpPut(localFile,remoteFile[,'Binary'|'Ascii'])"; } item "Upload File, Uni&que" { InsertString "FtpPutUnique(localFile,remoteFile[,'Binary'|'Ascii'])"; } item "G&et Current Remote Dir" { InsertString "FtpPwd(dirName)"; } item "Se&nd a String" { InsertString "FtpQuote(quote)"; } item "Rena&me Remote File" { InsertString "FtpRename(oldFile,newFile)"; } item "RmD&ir Remote" { InsertString "FtpRmDir(directory)"; } item "&Binary or ASCII" { InsertString "FtpSetBinary('Binary'|'Ascii')"; } item "Set &User Information" { InsertString "FtpSetUser(host,userid,password[,account])"; } item "Sen&d Site Information" { InsertString "FtpSite(site)"; } item "Get Remo&te Operating System" { InsertString "FtpSys(operSys)"; } item "&Version of RxFTP API" { InsertString "FtpVersion(variable)"; } } %endif %endif menu REXX_Libraries { %if(REXXUtil) submenu "REXX&Util", REXX_RU; %endif %if(OS_OS2) %if(RxSock) submenu "REXX&Sock", REXX_RS; %endif %if(RxFTP) submenu "REXX&FTP", REXX_F; %endif %endif } menu REXXTags { submenu "&Comments", REXX_Comments; submenu "Co&nstructs", REXX_Constructs; submenu "&Keywords", REXX_Keywords; submenu "&Libraries", REXX_Libraries; submenu "&Functions", REXX_BuiltIn; } menu Main_REXX { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "&REXX", REXXTags; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } eventmap REXX { MainMenu = "Main_REXX"; # menu for menubar key [A+R] { MainMenu 'R' } } ��������efte-1.1/config/menu/m_groovy.fte�������������������������������������������������������������������0000664�0000764�0000764�00000002474�11157533205�016105� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# menu definitions for Groovy mode menu Local_GROOVY { item "&Unmark\tEsc" { BlockMarkStream; BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tAlt+Q" { FileClose } item; item "&Indent line\tTab" { LineIndent } item "I&ndent block\tAlt+\\" { BlockReIndent } item; item "&Build via Ant\tF9" { Compile "ant -emacs -find build.xml " } } menu Groovy { item "&Build via Ant\tF9" { Compile "ant -emacs -find build.xml " } } menu Main_GROOVY { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "&Groovy", Groovy; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } eventmap GROOVY { LocalMenu = "Local_GROOVY"; MainMenu = "Main_GROOVY"; key [A+G] { MainMenu 'M' } key [F9] { Compile "ant -emacs -find build.xml " } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/menu/m_sgml.fte���������������������������������������������������������������������0000664�0000764�0000764�00000003602�11157533205�015514� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# SGML menu SGML_Meta { item "Ampersand" { InsertString "&amp;"; } item "Less Than\tC-E <" { InsertString "&lt;"; } item "Greater Than\tC-E >" { InsertString "&gt;"; } item "CopyRight\tC-E @" { InsertString "&copy;"; } } menu SGML_Ref { item "Reference" { SGML_REF } item "Example" { SGML_EX } item "Manual Refernce" { SGML_MRF } item "Email" { SGML_EML } item "Ftp Site" { SGML_FTPS } item "Ftp Path" { SGML_FTPP } item "HTTP Site" { SGML_HTPS } item "HTTP Path" { SGML_HTPP } item "URL" { SGML_URL } } menu SGML_List { item "Ordinary List" { SGML_ORD } item "Numbered List" { SGML_NUM } item "Tagged List" { SGML_TAG } item "Compact Style" { InsertString " compact"; } item "List Item" { InsertString "<item> "; } } menu SGML_Style { item "Strong" { SGML_BO } item "Italic" { SGML_IT } item "TT" { SGML_TT } item "VAR" { SGML_VAR } item "Package" { SGML_PAK } item "PRGN" { SGML_PGN } item "File" { SGML_FIL } } menu SGMLTags { item "Paragraph <p> " { SGML_PA } item "Section <sect> " { SGML_SE } item "Chapter <chapt> " { SGML_CH } item; submenu "Character Styles", SGML_Style; submenu "Lists", SGML_List; submenu "Cross Reference", SGML_Ref; submenu "Meta Characters", SGML_Meta; item; item "Blank Document " { SGML_Base } } menu Main_SGML { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "SG&ML", SGMLTags; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } eventmap SGML { MainMenu = "Main_SGML"; # menu for menubar key [A+M] { MainMenu 'M' } } ������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/menu/m_rst.fte����������������������������������������������������������������������0000664�0000764�0000764�00000011470�11157533205�015364� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# FTE menus for editing reStructureedText files # maintained by: Sergey Pinigin # Revision: 2006-08-29 # # RST_* macros are defined in ../m_rst.fte # keybindings are defined in ../kbd/k_rst.fte # this file is included from ../ui_fte.fte menu RST_Sections { item "Section C-E &1" { RST_H1 } item "Section C-E &2" { RST_H2 } item "Section C-E &3" { RST_H3 } item "Section C-E &4" { RST_H4 } item "Section C-E &5" { RST_H5 } } menu RST_Role { item "&Emphasis C+G+Up" { RST_ROLE_EMP } item "&Strong C+G+Down" { RST_ROLE_STR } item "&Literal C+E_C+L" { RST_ROLE_LIT } item "Su&bscript " { RST_ROLE_SUB } item "Su&perscript" { RST_ROLE_SUP } item "&Title" { RST_ROLE_TIT } item "P&EP" { RST_ROLE_PEP } item "&RFC" { RST_ROLE_RFC } item; item "r&aw-X" { RST_ROLE_RAW } item "&define raw-X" { RST_ROLE_DRAW } } menu RST_INLINE { item "&Emphasis A+G+Up" { RST_INLINE_EMP } item "&Strong A+G+Down" { RST_INLINE_STR } item "&Interpreted C+E_0" { RST_INLINE_INT } item "&Literals C+E_9" { RST_INLINE_LIT } item; item "&Hyperlink ``_ C+E_C+H" { RST_INLINE_HLINK } item "Embedded &URIs`<>`_ C+E_C+U" { RST_INLINE_ELINK } item "Int. &Targets _`` C+E_C+T" { RST_INLINE_ITAG } item "Footnote &Ref.[]_ C+E_C+R" { RST_INLINE_REF } item "&Auto Ref. [#]_ C+E_C+A" { RST_INLINE_REFA } item "&Sub. Ref. ||_ C+E_C+\\" { RST_INLINE_REFS } } menu RST_ADMON { item "&Attention C+E_A+A" { RST_ADM_ATTE } item "&Caution C+E_A+C" { RST_ADM_CAUT } item "&Danger C+E_A+D" { RST_ADM_DANG } item "&Error C+E_A+E" { RST_ADM_ERRO } item "&Hint C+E_A+H" { RST_ADM_HINT } item "&Important C+E_A+I" { RST_ADM_IMPO } item "&Note C+E_A+N" { RST_ADM_NOTE } item "&Tip C+E_A+T" { RST_ADM_TIP } item "&Warning C+E_A+W" { RST_ADM_WARN } item "Tit&le C+E_A+L" { RST_ADM_TITL } item "Adm&onition C+E_A+O" { RST_ADM_ADMO } } menu RST_IMAG { item "&Image C+E_C+I" { RST_IMAGE } item "I&mage, parameters " { RST_IMAGE_FULL } item "&Figure C+E_C+F" { RST_FIGURE } item "Fi&gure, parameters " { RST_FIGURE_FULL } } #Body Elements menu RST_BODY { item "&Topic" { RST_BOEL_TOPI } item "&Sidebar" { RST_BOEL_SIDE } item "&Line Block" { RST_BOEL_LBLK } item "&Parsed Block" { RST_BOEL_PLIT } item "&Rubric" { RST_BOEL_RUBR } item "&Epigraph" { RST_BOEL_EPIG } item "&Highlights" { RST_BOEL_HIGH } item "Pull-&Quote" { RST_BOEL_PQUO } item "&Compound" { RST_BOEL_COMP } item "C&ontainer" { RST_BOEL_CONT } item; item "&Include" { RST_INC } } menu RST_TABLE { item "&Simple 2 column" { RST_TABS_2C } item "Simple 2*2,&head" { RST_TABS_22H } item "Simple 2*2,s&pan" { RST_TABS_22S } item "&Grid 2*2" { RST_TABG_22 } item "G&rid 2*2,head" { RST_TABG_22H } item "&Table title" { RST_TAB_TIT } item; item "&CSV-table" { RST_TABCSV } item "&List-table" { RST_TABLIST } } menu RST_PARTS { item "&Contents" { RST_PART_CON } item "C&ontents, options" { RST_PART_CON_ } item "&Sectnum" { RST_PART_SEC } item "S&ectnum, options" { RST_PART_SEC_ } item "&Header" { RST_PART_HEAD } item "&Footer" { RST_PART_FOOT } } #Substitution Definitions #menu RST_SDEF { # item "" { } # } menu RSTTags { submenu "&Roles", RST_Role; submenu "In&line", RST_INLINE; submenu "&Admonition", RST_ADMON; submenu "&Images", RST_IMAG; submenu "&Body Elements", RST_BODY; submenu "&Document Parts", RST_PARTS; submenu "&Sections", RST_Sections; submenu "&Tables", RST_TABLE; item "&List enter C+Enter" { RST_LISTS_1ENT } item "Literal Bloc&k " { RST_CODE } } #==================================================================== menu Main_RST { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "&reST", RSTTags; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } eventmap reST { MainMenu = "Main_RST"; # menu for menubar key [A+R] { MainMenu 'R' } # reload 'A+R' } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/menu/m_c.fte������������������������������������������������������������������������0000664�0000764�0000764�00000001336�11157533205�014776� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# menu definitions for C mode menu Local_C { item "&Unmark\tEsc" { BlockMarkStream; BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tAlt+Q" { FileClose } item; item "&Indent line\tTab" { LineIndent } item "I&ndent block\tAlt+\\" { BlockReIndent } } eventmap C { LocalMenu = 'Local_C'; # local menu for C mode } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/ui_vi.fte���������������������������������������������������������������������������0000664�0000764�0000764�00000060726�11157534024�014417� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Basic Commands (Global) #FOLD00 menu Tools { #fold01 item "&Compile\tF9" { Compile "make -k " } item "&Grep" { Compile "grep -n " } # item "&Diff" { Compile "cvs diff" } item; item "Go to prev &error\tF11" { CompilePrevError } item "Go to &next error\tF12" { CompileNextError } item; item "&Messages\tS+F9" { ViewMessages } } menu Window { #FOLD01 # item "&New " { WinNewFrame } # item; item "Split &Horizontal\tShift+F2" { WinHSplit } item "&Close view\tCtrl+Alt+F4" { WinClose } item "Close &other views\tF5" { WinZoom } item; item "Sa&ve Desktop" { DesktopSave } item "Save Desktop &As" { DesktopSaveAs } item; item "&Routines\tCtrl+I" { ListRoutines } item "&Buffers\tAlt+0" { ViewBuffers } item "&Directory\tC+M" { DirOpen } # item "&Shell" { } } menu Help { #fold01 item "&About..." { ShowVersion } } eventmap MODEL { #fold01 key [C+F2] { FileSaveAll } key [F3] { FileOpen } key [F4] { WinNext } key [C+F4] { WinHSplit } key [S+F4] { WinPrev } key [A+S-F4] { WinClose } key [F5] { WinZoom } key [F6] { FileNext } key [S+F6] { FilePrev } key [A+S-F6] { FileLast } key [F10] { MainMenu } key [C+F10] { FileClose } key [C+F9] { RunProgram } key [S+F10] { LocalMenu } key [C+G-Up] { WinPrev } key [C+G-Down] { WinNext } key [A+G-PgUp] { WinPrev; MovePageUp; WinNext } key [A+G-PgDn] { WinNext; MovePageDown; WinPrev } key [A+C+G-PgUp] { WinNext; MovePageUp; WinPrev } key [A+C+G-PgDn] { WinPrev; MovePageDown; WinNext } key [A+X] { ExitEditor } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } # this is also useful for 'grep -n' etc. if configured key [F9] { Compile; ViewMessages } key [F11] { CompilePrevError } key [F12] { CompileNextError } key [S+F9] { ViewMessages } key [A+0] { ViewBuffers } key [A+1] { SwitchTo 1 } key [A+2] { SwitchTo 2 } key [A+3] { SwitchTo 3 } key [A+4] { SwitchTo 4 } key [A+5] { SwitchTo 5 } key [A+6] { SwitchTo 6 } key [A+7] { SwitchTo 7 } key [A+8] { SwitchTo 8 } key [A+9] { SwitchTo 9 } } # List Viewers #FOLD00 eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } key [C+Left] { ScrollRight } key [C+Right] { ScrollLeft } key [G-Enter] { Activate } key [Space] { ActivateInOtherWindow } key [S+Enter] { CloseActivate } key [C+R] { Rescan } } # Directory Browser #FOLD00 menu Directory { #fold01 item "&Reloadrl+R" { Rescan } item "&Close\tCtrl+F10" { FileClose } item; item "&Open file...\tF3" { FileOpen } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "Sh&ell" { RunProgram "" } item "E&xit\tAlt+X" { ExitEditor } } menu Navigate { #FOLD01 item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } # item "&/ Goto Dir\t/" { DirGoto } item "&\\ Goto Dir\t\\" { DirGoto } item "&Delete File\tCtrl+D" { DeleteFile } item; item '&A:\\' { DirGoto 'A:\\' } item '&B:\\' { DirGoto 'B:\\' } item '&C:\\' { DirGoto 'C:\\' } item '&D:\\' { DirGoto 'D:\\' } item '&E:\\' { DirGoto 'E:\\' } item '&F:\\' { DirGoto 'F:\\' } item '&G:\\' { DirGoto 'G:\\' } item '&H:\\' { DirGoto 'H:\\' } item '&I:\\' { DirGoto 'I:\\' } } menu DirMain { #fold01 submenu "&Directory", Directory; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap DIRECTORY: MLIST { #FOLD01 MainMenu = 'DirMain'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [Esc] { FileClose 0 } key [C+D] { DeleteFile } key [A+D] { MainMenu 'D' } key [A+N] { MainMenu 'N' } key [A+W] { MainMenu 'W' } key [A+T] { MainMenu 'T' } } # Buffer List #fold00 eventmap BUFFERS: MLIST { key [Esc] { FileClose 0 } # 0 = do not open directory when last closed, overrides OpenAfterClose default. key [C+C] { BufListFileClose } key [F2] { BufListFileSave } } # Routine List #fold00 eventmap ROUTINES: MLIST { key [Esc] { FileClose } } # Message List #fold00 menu Messages { item "&Close\tCtrl+F10" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "Sh&ell" { RunProgram "" } item "E&xit\tAlt+X" { ExitEditor } } menu MsgMain { submenu "&Messages", Messages; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap MESSAGES: MLIST { MainMenu = "MsgMain"; key [A+M] { MainMenu 'M' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } key [C+C] { ChildClose } # does NOT kill, just closes pipe } # Editor - Editing Modes #FOLD00 # PLAIN #FOLD01 # menus #FOLD02 menu MChangeMode { #FOLD03 item "&Plain" { ChangeMode 'PLAIN' } item "&Text" { ChangeMode 'TEXT' } item "&C" { ChangeMode 'C' } item "&EMail" { ChangeMode 'MSG' } item "&HTML" { ChangeMode 'HTML' } item "&IPF" { ChangeMode 'IPF' } item "&Ada" { ChangeMode 'Ada' } item "&REXX" { ChangeMode 'REXX' } item "MAKE" { ChangeMode 'MAKE' } item "&FTE" { ChangeMode 'FTE' } item "Resource" { ChangeMode 'RESOURCE' } item "&DIFF" { ChangeMode 'DIFF' } item "&MERGE" { ChangeMode 'MERGE' } item "&SH" { ChangeMode 'SH' } item "PER&L" { ChangeMode 'PERL' } item "PASCAL" { ChangeMode 'PASCAL' } item "&JAVA" { ChangeMode 'JAVA' } item "TE&X" { ChangeMode 'TEX' } item "&BIN" { ChangeMode 'BIN' } } menu MOpenInMode { #FOLD03 item "&Plain" { FileOpenInMode 'PLAIN' } item "&Text" { FileOpenInMode 'TEXT' } item "&C" { FileOpenInMode 'C' } item "&EMail" { FileOpenInMode 'MSG' } item "&HTML" { FileOpenInMode 'HTML' } item "&IPF" { FileOpenInMode 'IPF' } item "&Ada" { FileOpenInMode 'Ada' } item "&REXX" { FileOpenInMode 'REXX' } item "MAKE" { FileOpenInMode 'MAKE' } item "&FTE" { FileOpenInMode 'FTE' } item "Resource" { FileOpenInMode 'RESOURCE' } item "&DIFF" { FileOpenInMode 'DIFF' } item "&MERGE" { FileOpenInMode 'MERGE' } item "&SH" { FileOpenInMode 'SH' } item "PER&L" { FileOpenInMode 'PERL' } item "PASCAL" { FileOpenInMode 'PASCAL' } item "&JAVA" { FileOpenInMode 'JAVA' } item "TE&X" { FileOpenInMode 'TEX' } item "&BIN" { FileOpenInMode 'BIN' } } menu File { #fold03 item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; # item "Open &Binary" { FileOpenInMode 'BIN' } item "&Reload\tShift+F3" { FileReload } item "&Save\tF2" { FileSave } # OpenDoc UI Guide recomments using Write To only, not Save As, hmm. item "Save &As...\tShift+F2" { FileSaveAs } item "Save Al&l\tCtrl+F2" { FileSaveAll } item "Write &To..." { FileWriteTo } # item "Sa&ve and Close\tAlt+F2" { FileSave; FileClose } item "Prin&t" { FilePrint } item "&Close\tCtrl+F10" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "Sh&ell" { RunProgram "" } item "E&xit\tAlt+X" { ExitEditor } } menu Edit { #FOLD03 item "&Undo\tAlt+BackSp" { Undo } item "&Redo\tAlt+Shift+BackSp" { Redo } item; item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; # item "&Insert line\tShift+Enter" { LineInsert } item "&Delete line\tCtrl+Y" { KillLine } item "&Split line\tCtrl+Enter" { LineSplit } item "&Join line\tCtrl+J" { LineJoin } # item "Dup&licate line\tCtrl+D" { LineDuplicate } # item "Delete to line &end\tAlt+End" { KillToLineEnd } # item "Delete to li&ne start\tCtrl+Shift+BackSp" { KillToLineStart } item; item "&Quote Literal...\tCtrl+Q" { InsertChar } item "&ASCII Table...\tCtrl+Shift+A" { ASCIITable } } menu Translate { #fold03 item "&Uppercase" { BlockCaseUp } item "&Lowercase" { BlockCaseDown } item "&Togglecase" { BlockCaseToggle } item "&Rot13" { BlockTrans 'A-Za-z' 'N-ZA-Mn-za-m' } item; item "User &specified..." { BlockTrans } } menu Block { #fold03 item "&Unmark\tEsc" { BlockUnmark } item "Mark &Line\tAlt+L" { BlockMarkLine } item "Mark &Stream\tAlt+A" { BlockMarkStream } item "Mark &Column\tAlt+K" { BlockMarkColumn } item; # item "Select Wor&d" { BlockSelectWord } # item "Selec&t Line" { BlockSelectLine } # item; item "&Indent\tAlt+I" { BlockIndent } item "U&nindent\tAlt+U" { BlockUnindent } item; item "&Write..." { BlockWrite } item "&Read..." { BlockRead } item "&Print" { BlockPrint } item; submenu "Translat&e", Translate; } menu Search { #FOLD03 item "&Find...\tCtrl+Q C+W" { Find } item "Find and &replace...\tCtrl+R" { FindReplace } item "Repeat &Last find\tCtrl+L" { FindRepeat } item "Repeat last find re&verse\tCtrl+B" { FindRepeatReverse } item "Repeat last find &once\tCtrl+N" { FindRepeatOnce } item "Incremental &search\tCtrl+S" { IncrementalSearch } item; item "&Place Bookmark..." { PlaceBookmark } item "Goto &Bookmark..." { GotoBookmark } item; item "&Match paren\tAlt+-" { MatchBracket } item "&Goto line...\tAlt+J" { MoveToLine } } menu Fold { #fold03 item "&Create fold\tAlt+Gray++" { FoldCreate } item "Create folds by &regexp..." { FoldCreateByRegexp } item "&Destroy fold\tAlt+Gray+-" { FoldDestroy } item; item "&Open fold\tCtrl+Gray++" { FoldOpen } item "Open &nested folds\tCtrl+Gray+*" { FoldOpenNested } item "C&lose fold\tCtrl+Gray+-" { FoldClose } item "&Toggle fold open/close\tCtrl+Gray+/" { FoldToggleOpenClose } item; item "&Promote fold\tShift+Gray+-" { FoldPromote } item "De&mote fold\tShift+Gray++" { FoldDemote } item; item "Open &all folds\tAlt+Gray+*" { FoldOpenAll } item "Close all &folds\tAlt+Gray+/" { FoldCloseAll } item "Destro&y all folds" { FoldDestroyAll } } menu Options { #fold03 submenu "Change &mode\tC+O C+M", MChangeMode; item; item "&Insert mode\tC+O C+I" { ToggleInsert } item "&Auto indent\tC+O C+A" { ToggleAutoIndent } item "&Case sensitive\tC+O C+C" { ToggleMatchCase } item "Trim &EOL spaces\tC+O C+E" { ToggleTrim } item "&Read only\tC+O C+R" { ToggleReadOnly } item "&Undo/Redo\tC+O C+U" { ToggleUndo } item "&Show markers\tC+O C+." { ToggleShowMarkers; WinRefresh } item; item "&Word wrap\tC+O C+W" { ToggleWordWrap } item "&Left margin...\tC+O A+[" { ChangeLeftMargin } item "Ri&ght margin...\tC+O A+]" { ChangeRightMargin } item; item "&Tab size...\tC+O C+T" { ChangeTabSize; WinRefresh } item "S&how tabs\tC+O Tab" { ToggleShowTabs; WinRefresh } item "E&xpand tabs\tC+O C+Tab" { ToggleExpandTabs; WinRefresh } item "&Print to... " { SetPrintDevice } } menu Main { #fold03 submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } menu Local { #fold03 item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tC+F10" { FileClose } } eventmap PLAIN: MODEL { #FOLD02 # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [i] { ChangeKeys 'VI_INS' } key [I] { MoveLineStart; ChangeKeys 'VI_INS' } key [o] { LineAdd; MoveDown; MoveLineStart; ChangeKeys 'VI_INS' } key [O] { LineInsert; MoveLineStart; ChangeKeys 'VI_INS' } key [a] { MoveRight; ChangeKeys 'VI_INS' } key [A] { MoveLineEnd; ChangeKeys 'VI_INS' } key [r] { ToggleInsert; InsertChar; ToggleInsert } key [R] { ChangeKeys 'VI_OVER'; ToggleInsert } key [d] { ChangeKeys 'VI_DELETE' } key [D] { KillToLineEnd } key [y] { ChangeKeys 'VI_YANK' } key [x] { KillChar } key [X] { KillCharPrev } key [h] { MoveLeft } key [j] { MoveDown } key [k] { MoveUp } key [l] { MoveRight } key [$] { MoveLineEnd } key [0] { MoveLineStart } key [^] { MoveFirstNonWhite } key [:_q] { FileClose } key [:_w] { FileSave } key [:_e] { FileOpen } key [:_n] { FileNext } key [:_N] { FilePrev } #key [/] { SearchRx } #key [n] { SearchAgain } key [P] { BlockPaste } key [p] { BlockPaste } key [B] { MoveWordPrev } key [b] { MoveWordPrev } key [w] { MoveWordNext } key [W] { MoveWordNext } key [e] { MoveWordEndNext } key [E] { MoveWordEndNext } key [c] { ChangeKeys 'VI_CHANGE' } key [C+N] { MoveDown } key [C+P] { MoveUp } key [C+B] { MovePageUp } key [C+F] { MovePageDown } key [%] { MatchBracket } key [u] { Undo } key [C+R] { Redo } key [BackSp] { MoveLeft } key [Space] { MoveRight } key [G-Enter] { MoveDown; MoveLineStart } key [-] { MoveUp; MoveLineStart } key [+] { MoveDown; MoveLineStart } key [J] { LineJoin } key [C] { KillToLineEnd; ChangeKeys 'VI_INS' } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [G-C+PgDn] { MoveFileEnd } } eventmap VI_INS: MODEOPTS { key [Esc] { ChangeKeys; MoveLeft } key [G-Enter] { LineNew } key [Space] { InsertSpace } key [BackSp] { KillCharPrev } key [Tab] { InsertTab } } eventmap VI_OVER: VI_INS { #Insert = 0; key [Esc] { ChangeKeys; MoveLeft; ToggleInsert } } eventmap VI_DELETE: MODEOPTS { key [Esc] { ChangeKeys } key [d] { BlockSelectLine; BlockCut; ChangeKeys } key [$] { BlockUnmark; BlockMarkStream; MoveLineEnd; BlockMarkStream; BlockCut; ChangeKeys 'VIMODE' } key [0] { BlockUnmark; BlockMarkStream; MoveLineStart; BlockMarkStream; BlockCut; ChangeKeys 'VIMODE' } key [w] { KillWord; ChangeKeys } } eventmap VI_CHANGE: MODEOPTS { key [Esc] { ChangeKeys } key [w] { KillWord; ChangeKeys 'VI_INS' } key [$] { KillToLineEnd; ChangeKeys "VI_INS" } key [c] { MoveLineStart; KillToLineEnd; ChangeKeys "VI_INS" } } eventmap VI_YANK: MODEOPTS { key [Esc] { ChangeKeys } key [y] { BlockSelectLine; BlockCopy; ChangeKeys } key [$] { BlockUnmark; BlockMarkStream; MoveLineEnd; BlockMarkStream; BlockCopy; MovePrevPos; ChangeKeys 'VIMODE' } key [0] { BlockUnmark; BlockMarkStream; MoveLineStart; BlockMarkStream; BlockCopy; MovePrevPos; ChangeKeys 'VIMODE' } key [w] { KillWord; ChangeKeys } } mode PLAIN { EventMap = 'PLAIN'; } # C #fold01 menu Local_C { #fold02 item "&Unmark\tEsc" { BlockMarkStream; BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tCtrl+F10" { FileClose } item; item "&Indent line\tTab" { LineIndent } item "I&ndent block\tAlt+\\" { BlockReIndent } } eventmap C: PLAIN { #fold02 LocalMenu = 'Local_C'; # local menu key [=] { LineIndent; LineTrim } key [O] { LineIndent; LineNew } key [{] { SelfInsert; ?LineIndent } key [}] { SelfInsert; ?LineIndent; MoveLeft; ?HilitMatchBracket; MoveRight } key [)] { SelfInsert; MoveLeft; ?HilitMatchBracket; MoveRight } key [\]] { SelfInsert; MoveLeft; ?HilitMatchBracket; MoveRight } key [:] { SelfInsert; ?LineIndent } key [#] { SelfInsert; ?LineIndent } # key [A+\\] { BlockReIndent } # do some smart indents key [A+G-Enter] { LineAdd; LineIndent } key [S+G-Enter] { LineInsert; LineIndent } } mode C { #fold02 EventMap = 'C'; } # REXX #fold01 eventmap REXX: PLAIN { #fold02 key [Tab] { LineIndent LineTrim } key [G-Enter] { LineIndent LineNew } key [:] { SelfInsert LineIndent } key [A+\\] { BlockReIndent } } mode REXX { EventMap = 'REXX'; } #fold02 # PERL #fold01 eventmap PERL: PLAIN { #fold02 key [Tab] { LineIndent LineTrim } key [G-Enter] { LineIndent LineNew } key [#] { SelfInsert LineIndent } key [{] { SelfInsert LineIndent } key [}] { SelfInsert LineIndent } key [A+\\] { BlockReIndent } } mode PERL { EventMap = 'PERL'; } #fold02 # JAVA #fold01 eventmap JAVA: PLAIN { #fold02 key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [{] { SelfInsert; LineIndent } key [}] { SelfInsert; LineIndent } key [:] { SelfInsert; LineIndent } key [#] { SelfInsert; LineIndent } key [A+\\] { BlockReIndent } } mode JAVA { EventMap = 'JAVA'; } #fold02 # HTML #fold01 menu HTML_Physical { #fold02 item "&Bold <B> C-E C-B" { HTML_B } item "&Italic <I> C-E C-I" { HTML_I } item "&Typewriter <TT> C-E C-T" { HTML_TT } } menu HTML_Logical { #fold02 item "&Definition <DFN> C-E C-D" { HTML_DFN } item "&Emphasize <EM> C-E C-E" { HTML_EM } item "Citati&on <CITE> C-E C-O" { HTML_CITE } item "&Code <CODE> C-E C-C" { HTML_CODE } item "&Kbd entry <KBD> C-E C-K" { HTML_KBD } item "Sam&ple msg <SAMP> C-E C-M" { HTML_SAMP } item "&Strong EM <STRONG> C-E C-S" { HTML_STRONG } item "&Variable <VAR> C-E C-V" { HTML_VAR } } menu HTML_Header { #fold02 item "&1 <H1> C-E 1" { HTML_H1 } item "&2 <H2> C-E 2" { HTML_H2 } item "&3 <H3> C-E 3" { HTML_H3 } item "&4 <H4> C-E 4" { HTML_H4 } item "&5 <H5> C-E 5" { HTML_H5 } item "&6 <H6> C-E 6" { HTML_H6 } } menu HTML_List { #fold02 item "List &item <LI> C-E i" { HTML_LI } item "&Unordered list <UI> C-E u" { HTML_UL } item "&Ordered list <OL> C-E o" { HTML_OL } item "Definition &list <DL> C-E l" { HTML_DL } item "Definition &tag <DT> C-E t" { HTML_DT } item "&Definition <DD> C-E d" { HTML_DD } } menu HTML_Table { #fold02 item "&Table <TABLE> C-E A-T" { HTML_TABLE } item "&Caption <CAPTION> C-E A-C" { HTML_CAPTION } item "&Header <TH> C-E A-H" { HTML_TH } item "&Row <TR> C-E A-R" { HTML_TR } item "&Data <TD> C-E A-D" { HTML_TD } } menu HTMLTags { #fold02 item "&Paragraph <P> C-E C-P " { HTML_P } item "Line brea&k <BR> C-E Enter" { HTML_BR } item "Horiz.line <HR> C-E &- " { HTML_HR } item; submenu "P&hysical styles ", HTML_Physical; submenu "Logical &styles ", HTML_Logical; submenu "&Header ", HTML_Header; submenu "&Lists ", HTML_List; submenu "&Tables ", HTML_Table; item; item "Pre&formatted <PRE> C-E C-F " { HTML_PRE } item "&Centered <CENTER> C-E . " { HTML_CENTER } item; item "Anchor &Name <A NAME> C-E C-N " { HTML_ANAME } item "Anchor H&Ref <A HREF> C-E C-H " { HTML_AHREF } item; item "Basic document C-E &0 " { HTML_Base } } menu Main_HTML { #fold02 submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "HT&ML", HTMLTags; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } eventmap HTML: PLAIN { #fold02 MainMenu = "Main_HTML"; # menu for menubar key [C+E_0] { HTML_Base } # headers key [C+E_1] { HTML_H1 } key [C+E_2] { HTML_H2 } key [C+E_3] { HTML_H3 } key [C+E_4] { HTML_H4 } key [C+E_5] { HTML_H5 } key [C+E_6] { HTML_H6 } # physical key [C+E_C+B] { HTML_B } key [C+E_C+I] { HTML_I } key [C+E_C+T] { HTML_TT } # logical key [C+E_C+D] { HTML_DFN } key [C+E_C+E] { HTML_EM } key [C+E_C+O] { HTML_CITE } key [C+E_C+C] { HTML_CODE } key [C+E_C+K] { HTML_KBD } key [C+E_C+M] { HTML_SAMP } key [C+E_C+S] { HTML_STRONG } key [C+E_C+V] { HTML_VAR } # lists key [C+E_i] { HTML_LI } key [C+E_u] { HTML_UL } key [C+E_o] { HTML_OL } key [C+E_l] { HTML_DL } key [C+E_t] { HTML_DT } key [C+E_d] { HTML_DD } # tables key [C+E_A+T] { HTML_TABLE } key [C+E_A+C] { HTML_CAPTION } key [C+E_A+H] { HTML_TH } key [C+E_A+R] { HTML_TR } key [C+E_A+D] { HTML_TD } # anchors key [C+E_C+N] { HTML_ANAME } key [C+E_C+H] { HTML_AHREF } key [C+E_C+G] { HTML_IMG } key [C+E_C+F] { HTML_PRE } key [C+E_G-Enter] { HTML_BR } key [C+E_-] { HTML_HR } key [C+E_.] { HTML_CENTER } key [C+E_C+P] { HTML_P } # character escapes key [C+E_&] { InsertString "&amp;"; } key [C+E_<] { InsertString "&lt;"; } key [C+E_>] { InsertString "&gt;"; } key [C+E_"] { InsertString "&quot;"; } # hilit bug } # make sure proper eventmap is used mode HTML { EventMap = 'HTML'; } #fold02 # FTE #fold01 eventmap FTE: PLAIN { #fold02 key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [{] { SelfInsert; LineIndent } key [}] { SelfInsert; LineIndent } } # make sure proper eventmap is used mode FTE { EventMap = 'FTE'; } #fold02 ������������������������������������������efte-1.1/config/m_resdlg.fte������������������������������������������������������������������������0000664�0000764�0000764�00000001712�11157534024�015066� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# OS/2 and Win* resource file (.RC) colorize RESOURCE { SyntaxParser = 'C'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; # keywords need to be defined... for os2 and win* } mode RESOURCE: PLAIN { # Resource file FileNameRx = /\.\c{RC}|{DLG}$/; HilitOn = 1; Colorizer = 'RESOURCE'; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; } oinclude 'mym_resdlg.fte'; ������������������������������������������������������efte-1.1/config/pal_wht.fte�������������������������������������������������������������������������0000664�0000764�0000764�00000012430�11157534024�014727� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# color palette (white background) # the color palette is the definition of the symbolic colors # that are used everywhere else in the configuration files # syntax of the color specification is: # # fore back # or # symbolic_fore:symbolic_back # or # symbolic color_palette { { 'ScrollBar_Arrows', 'black:gray' }, { 'ScrollBar_Background', 'gray:black' }, { 'ScrollBar_Slider', 'gray:black' }, { 'Status_Normal', 'black:darkCyan' }, { 'Status_Active', 'black:gray' }, { 'Message_Normal', 'cyan:darkBlue' }, { 'Message_Error', 'white:darkBlue' }, { 'Message_Bold', 'white:darkRed' }, { 'EntryField_Field', 'cyan:darkBlue' }, { 'EntryField_Prompt', 'white:darkBlue' }, { 'EntryField_Selection', 'black:darkGreen' }, { 'List_Status', 'black:gray' }, { 'List_Normal', 'black:white' }, { 'List_Selected', 'white:darkBlue' }, { 'List_Hilited', 'white:black' }, { 'List_HilitSelect', 'white:darkBlue' }, { 'List_Marked', 'yellow:black' }, { 'List_MarkSelect', 'yellow:darkBlue' }, { 'List_MarkHilit', 'yellow:black' }, { 'List_MarkHilitSel', 'yellow:darkBlue' }, { 'ASCII_Chars', 'gray:black' }, { 'Menu_Background', 'black:gray' }, { 'Menu_ActiveItem', 'white:darkBlue' }, { 'Menu_ActiveChar', 'red:darkBlue' }, { 'Menu_NormalItem', 'black:gray' }, { 'Menu_NormalChar', 'red:gray' }, { "Choice_Title", 'white:darkBlue' }, { "Choice_Param", 'cyan:darkBlue' }, { "Choice_Background", 'gray:darkBlue' }, { "Choice_ActiveItem", 'black:darkGreen' }, { "Choice_ActiveChar", 'white:darkGreen' }, { "Choice_NormalItem", 'white:darkBlue' }, { "Choice_NormalChar", 'yellow:darkBlue' }, { "bg", 'black:white' }, # background { "fg", 'black:white' }, # foreground { 'Editor_Selected', 'black:darkCyan' }, { 'Editor_Markers', 'darkCyan:bg' }, { 'Editor_FoundText', 'white:darkRed' }, { 'Editor_Folds0', 'darkGreen:bg' }, { 'Editor_Folds1', 'darkBlue:bg' }, { 'Editor_Folds2', 'darkMagenta:bg' }, { 'Editor_Folds3', 'darkMagenta:bg' }, { 'Editor_Folds4', 'darkMagenta:bg' }, { 'Editor_HilitWord', 'darkRed:bg' }, { 'Editor_Default', 'fg:bg' }, { 'Editor_Bold', 'darkCyan:bg' }, { 'Editor_Keywords', 'darkBlue:bg' }, { 'Editor_Keywords2', 'darkCyan:bg' }, { 'Editor_Keywords3', 'darkGreen:bg' }, { 'Editor_Keywords4', 'brown:bg' }, { 'Editor_Keywords5', 'darkBlue:bg' }, { 'Msg_Header', 'darkCyan:bg' }, { 'Msg_Quotes', 'green:bg' }, { 'Msg_Tag', 'white:bg' }, { 'Msg_Signature', 'darkCyan:bg' }, { 'Comment', 'brown:bg' }, { 'String', 'darkGreen:bg' }, { 'Lang_Default', 'Editor_Default' }, { 'Lang_Number', 'darkRed:bg' }, { 'Lang_DecimalNumber', 'Lang_Number' }, { 'Lang_HexNumber', 'darkMagenta:bg' }, { 'Lang_OctalNumber', 'darkMagenta:bg' }, { 'Lang_BinaryNumber', 'darkMagenta:bg' }, { 'Lang_Punctuation', 'darkCyan:bg' }, { 'Lang_String', 'String' }, { 'Lang_Comment', 'Comment' }, { 'Lang_Preprocessor', 'darkGreen:bg' }, { 'Lang_Function', 'darkCyan:bg' }, { 'Lang_Label', 'darkRed:bg' }, { 'Lang_Command', 'darkCyan:bg' }, { 'Lang_Regexp', 'darkMagenta:bg' }, { 'Lang_Variable', 'darkBlue:bg' }, { 'Lang_Control', 'darkCyan:bg' }, { 'Lang_Assembler', 'darkBlue:bg' }, # embedded assembler (Pascal) { 'Markup_Default', 'gray:bg' }, { 'Markup_Punctuation', 'darkCyan:bg' }, { 'Markup_String', 'String' }, { 'Markup_Symbol', 'green:bg' }, { 'Markup_Tag', 'cyan:bg' }, { 'Markup_Comment', 'Comment' }, { 'Markup_Special', 'red:bg' }, { 'Markup_Control', 'magenta:bg' }, { 'Markup_Quotes', 'yellow:bg' }, { 'Markup_Math', 'red:bg' }, # diff/diff3 { 'DIFF_Old', 'gray:bg' }, { 'DIFF_New', 'white:bg' }, { 'DIFF_Changed', 'darkCyan:bg' }, # rcsmerge { 'MERGE_Changed', 'white:bg' }, { 'MERGE_Old', 'gray:bg' }, { 'MERGE_New', 'red:bg' }, { 'MERGE_Control', 'yellow:bg' }, } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_sgml.fte��������������������������������������������������������������������������0000664�0000764�0000764�00000014527�11163156165�014563� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# SGML markup by Patrick L. McGillan # feel free to change and send changes to package maintainer # basic document sub SGML_Base { InsertString "<!doctype debiandoc system>"; LineNew; InsertString "<debiandoc>"; LineNew; 2:MoveRight; InsertString "<book>"; LineNew; 2:MoveRight; InsertString "<titlepag>"; LineNew; 2:MoveRight; InsertString "<title></title>"; LineNew; 2:MoveRight; InsertString "<author>"; LineNew; 2:MoveRight; InsertString "<name></name>"; LineNew; InsertString "<email></email>"; LineNew; 2:MoveLeft; InsertString "</author>"; LineNew; 2:MoveLeft; InsertString "<version><date></version>"; LineNew; InsertString "<abstract>"; LineNew; InsertString "</abstract>"; LineNew; InsertString "<copyright>"; LineNew; 2:MoveRight; InsertString "<copyrightsummary>"; LineNew; InsertString "</copyrightsummary>"; LineNew; 2:MoveLeft; InsertString "</copyright>"; LineNew; 2:MoveLeft; InsertString "</titlepag>"; LineNew; InsertString "<toc>"; LineNew; InsertString "<chapt>"; LineNew; InsertString "</chapt>"; LineNew; 2:MoveLeft; InsertString "</book>"; LineNew; 2:MoveLeft; InsertString "</debiandoc>"; } sub SGML_CH { InsertString "<chapt id=\"\">"; LineNew; InsertString "<heading></heading>"; LineNew; InsertString "<p>"; SavePos; LineNew; InsertString "</chapt>"; MoveSavedPos; } sub SGML_SE { InsertString "<sect>"; } sub SGML_PA { InsertString "<p>"; } sub SGML_MRF { InsertString "<manref name=\"\" section=\"\">"; } sub SGML_EML { InsertString "<email>"; } sub SGML_FTPS { InsertString "<ftpsite>"; } sub SGML_FTPP { InsertString "<ftppath>"; } sub SGML_HTPS { InsertString "<httpsite>"; } sub SGML_HTPP { InsertString "<httppath>"; } sub SGML_URL { InsertString "<url id=\"\" name=\"\">"; } sub SGML_EX { MoveBlockStart; LineNew; InsertString "<example>"; LineNew; MoveBlockEnd; LineNew; InsertString "</example>"; BlockUnmark; } sub SGML_REF { MoveBlockStart; InsertString "<ref id=\""; MoveBlockEnd; InsertString "\">"; BlockUnmark; } sub SGML_BO { MoveBlockStart; InsertString "<strong>"; MoveBlockEnd; InsertString "</strong>"; 4:MoveLeft; BlockUnmark; } sub SGML_IT { MoveBlockStart; InsertString "<em>"; MoveBlockEnd; InsertString "</em>"; 4:MoveLeft; BlockUnmark; } sub SGML_TT { MoveBlockStart; InsertString "<tt>"; MoveBlockEnd; InsertString "</tt>"; 4:MoveLeft; BlockUnmark; } sub SGML_VAR { InsertString "<var>"; } sub SGML_PAK { InsertString "<package>"; } sub SGML_PGN { InsertString "<program>"; } sub SGML_FIL { InsertString "<file>"; } sub SGML_ORD { InsertString "<list>"; LineNew; InsertString "<item>"; SavePos; LineNew; InsertString "</list>"; MoveSavedPos; } sub SGML_NUM { InsertString "<enumlist>"; LineNew; InsertString "<item>"; SavePos; LineNew; InsertString "</enumlist>"; MoveSavedPos; } sub SGML_TAG { InsertString "<taglist>"; LineNew; InsertString "<item>"; SavePos; LineNew; InsertString "</taglist>"; MoveSavedPos; } colorize SGML { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Command', 'Markup_Punctuation' }, { 'Symbol', 'Markup_Symbol' }, { 'Tag', 'Markup_Tag' }, { 'Special', 'Markup_Special' }, }; keyword "Editor_Keywords" { # should be SGML 3.2 complete "ABSTRACT", "ARTICLE", "AUTHOR", "BF", "BOOK", "CHAPT", "CODE", "COPYRIGHT", "DATE", "DEBIANDOC", "DESCRIP", "DOCTYPE", "EM", "EMAIL", "ENUM", "ENUMLIST", "EXAMPLE", "FOOTNOTE", "FTPSITE", "FTPPATH", "HEADING", "HTMLURL", "HTTPSITE", "HTTPPATH", "IT", "ITEM", "ITEMIZE", "LABEL", "LIST", "MANREF", "NAME", "P", "PRGN", "PUBLIC", "QREF", "QUOTE", "REF", "SECT", "SECT1", "SECT2", "SECT3", "SECT4", "STRONG", "SYSTEM", "TAG", "TAGLIST", "TITLE", "TITLEPAG", "TOC", "TSCREEN", "TT", "URL", "VAR", "VERB", "VERSION", }; keyword "Editor_Keywords2" { "COMPACT", "ID", "NAME", "SECTION", }; h_state 0 { 'Normal' } h_trans { 4, '<', '<!--', 'Comment' } h_trans { 8, '<', '</', 'Command' } h_trans { 1, '<', '<', 'Command' } h_trans { 2, '<', '&', 'Symbol' } h_state 1 { 'Command' } h_trans { 0, '>', '>', 'Command' } h_trans { 0, '>', '<', 'Command' } h_trans { 0, '>', '/>', 'Command' } h_trans { 6, '<', '/', 'Command' } h_trans { 3, '<', '"', 'String' } h_wtype { -1, -1, -1, 'i', 'a-zA-Z0-9_\-' } h_state 2 { 'Symbol' } h_trans { 0, '>', ';', 'Symbol' } h_trans { 0, '-S', '#a-zA-Z0-9', 'Symbol' } h_state 3 { 'String' } h_trans { 1, '>', '"', 'String' } h_state 4 { 'Comment' } h_trans { 5, '>', '--', 'Comment' } h_state 5 { 'Special' } h_trans { 4, '>', '--', 'Comment' } h_trans { 0, '>', '>', 'Comment' } h_state 6 { 'Symbol' } h_trans { 7, '-', '//', 'Command' } h_trans { 0, '>', '/', 'Command' } h_trans { 0, '>', '>', 'Symbol' } h_trans { 7, '>', '</', 'Command' } h_trans { 1, '>', '<', 'Command' } h_state 7 { 'Command' } h_trans { 6, '>', '/', 'Command' } h_state 8 { 'Command' } h_trans { 0, '>', '>', 'Command' } h_trans { 3, '<', '"', 'String' } h_wtype { -1, -1, -1, 'i', 'a-zA-Z0-9_\-' } } mode SGML: MARKUP { FileNameRx = /\.\c{SGML?}|{SGML?}$/; HilitOn = 1; Colorizer = "SGML"; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /\<[Hh]\d\>/; SaveFolds = 2; # save fold info at end of line CommentStart = "<!--"; CommentEnd = "-->"; WordWrap = 2; RightMargin = 85; AutoIndent = 1; Insert = 1; IndentMode = "PLAIN"; Trim = 1; } oinclude 'mym_sgml.fte'; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_rst.fte���������������������������������������������������������������������������0000664�0000764�0000764�00000052340�11157534024�014421� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # FTE mode for editing ReStucturedText files # # ReStucturedText homepage: http://docutils.sourceforge.net/ # # Contributed by: Sergey Pinigin # # VER: alpha 11 [2006-08-29] # # Files: # m_rst.fte Macros, colorize, mode reST (include on main.fte) # menu/m_rst.fte Menus reST (include on ui_fte.fte) # kbd/k_rst.fte Keybindings reST(include on ui_fte.fte) # # # For testing reST-mode in FTE: # You mast open in FTE *.txt from Docutils documentation # and change mode to 'reST'. # # #### SUBs #### sub RST_LISTS_1ENT { LineNew; MoveUp; MoveWordRight; MoveDown; } sub RST_CODE { InsertString "::"; 2:LineNew; MoveUp; 2:MoveRight; } sub RST_INC { LineNew; MoveLineStart; InsertString ".. include:: "; } # ROLE ======================================================================== sub RST_ROLE_EMP { InsertString ":emphasis:``"; MoveLeft; } sub RST_ROLE_LIT { InsertString ":literal:``"; MoveLeft; } sub RST_ROLE_STR { InsertString ":strong:``"; MoveLeft; } sub RST_ROLE_SUB { InsertString ":sub:``"; MoveLeft; } sub RST_ROLE_SUP { InsertString ":sup:``"; MoveLeft; } sub RST_ROLE_TIT { InsertString ":title:``"; MoveLeft; } sub RST_ROLE_PEP { InsertString ":PEP:``"; MoveLeft; } sub RST_ROLE_RFC { InsertString ":RFC:``"; MoveLeft; } sub RST_ROLE_RAW { InsertString "raw-:``"; 3:MoveLeft; } sub RST_ROLE_DRAW { LineNew; InsertString ".. role:: raw-(raw)"; LineNew; InsertString " :format: "; LineNew; 2:MoveUp; 11:MoveRight; } # Inline ====================================================================== sub RST_INLINE_EMP { InsertString "**"; MoveLeft; } sub RST_INLINE_STR { InsertString "****"; 2:MoveLeft; } sub RST_INLINE_INT { InsertString "``"; MoveLeft; } sub RST_INLINE_LIT { InsertString "````"; 2:MoveLeft; } sub RST_INLINE_HLINK { InsertString "``_"; 2:MoveLeft; } sub RST_INLINE_ELINK { InsertString "`<>`_"; 4:MoveLeft; } sub RST_INLINE_ITAG { InsertString "_``"; MoveLeft; } # not set parse sub RST_INLINE_REF { InsertString "[]_"; 2:MoveLeft; } sub RST_INLINE_REFA { InsertString "[#]_"; 2:MoveLeft; } sub RST_INLINE_REFS { InsertString "||_"; 2:MoveLeft; } # Admonitions ================================================================= sub RST_ADM_ATTE { LineNew; MoveLineStart; InsertString ".. attention:: "; } sub RST_ADM_CAUT { LineNew; MoveLineStart; InsertString ".. caution:: "; } sub RST_ADM_DANG { LineNew; MoveLineStart; InsertString ".. danger:: "; } sub RST_ADM_ERRO { LineNew; MoveLineStart; InsertString ".. error:: "; } sub RST_ADM_HINT { LineNew; MoveLineStart; InsertString ".. hint:: "; } sub RST_ADM_IMPO { LineNew; MoveLineStart; InsertString ".. important:: "; } sub RST_ADM_NOTE { LineNew; MoveLineStart; InsertString ".. note:: "; } sub RST_ADM_TIP { LineNew; MoveLineStart; InsertString ".. tip:: "; } sub RST_ADM_WARN { LineNew; MoveLineStart; InsertString ".. warning:: "; } sub RST_ADM_ADMO { LineNew; MoveLineStart; InsertString ".. admonition:: "; } sub RST_ADM_TITL { LineNew; MoveLineStart; InsertString ".. title:: "; } # Document Parts ============================================================== sub RST_PART_CON { LineNew; MoveLineStart; InsertString ".. contents:: "; } sub RST_PART_CON_ { LineNew; MoveLineStart; InsertString ".. contents:: "; LineNew; InsertString " :depth:"; LineNew; InsertString ":backlinks:"; LineNew; InsertString ":local:"; LineNew; 4:MoveUp; MoveLineEnd; } sub RST_PART_SEC { LineNew; MoveLineStart; InsertString ".. sectnum:: "; } sub RST_PART_SEC_ { LineNew; MoveLineStart; InsertString ".. sectnum:: "; LineNew; InsertString " :depth:"; LineNew; InsertString ":prefix:"; LineNew; InsertString ":suffix:"; LineNew; InsertString ":start:"; LineNew; 5:MoveUp; MoveLineEnd; } sub RST_PART_HEAD { LineNew; MoveLineStart; InsertString ".. header:: "; } sub RST_PART_FOOT { LineNew; MoveLineStart; InsertString ".. footer:: "; } # Image ======================================================================= sub RST_IMAGE_FULL{ LineNew; MoveLineStart; InsertString ".. image:: "; LineNew; InsertString " :alt:"; LineNew; InsertString ":height:"; LineNew; InsertString ":width:"; LineNew; InsertString ":scale:"; LineNew; InsertString ":align:"; LineNew; InsertString ":target:"; LineNew; 7:MoveUp; MoveLineEnd; } sub RST_IMAGE { InsertString ".. image:: "; } sub RST_FIGURE_FULL{ LineNew; MoveLineStart; InsertString ".. figure:: "; LineNew; InsertString " :figwidth:"; LineNew; InsertString ":figclass:"; LineNew; InsertString ":align:"; LineNew; 4:MoveUp; MoveLineEnd; } sub RST_FIGURE { InsertString ".. figure:: "; } # Body Elements =============================================================== sub RST_BOEL_TOPI { LineNew; MoveLineStart; InsertString ".. topic:: "; } sub RST_BOEL_SIDE { LineNew; MoveLineStart; InsertString ".. sidebar:: "; } sub RST_BOEL_LBLK { LineNew; MoveLineStart; InsertString ".. line-block:: "; } sub RST_BOEL_PLIT { LineNew; MoveLineStart; InsertString ".. parsed-literal:: "; } sub RST_BOEL_RUBR { LineNew; MoveLineStart; InsertString ".. rubric:: "; } sub RST_BOEL_EPIG { LineNew; MoveLineStart; InsertString ".. epigraph:: "; } sub RST_BOEL_HIGH { LineNew; MoveLineStart; InsertString ".. highlights:: "; } sub RST_BOEL_PQUO { LineNew; MoveLineStart; InsertString ".. pull-quote:: "; } sub RST_BOEL_COMP { LineNew; MoveLineStart; InsertString ".. compound:: "; } sub RST_BOEL_CONT { LineNew; MoveLineStart; InsertString ".. container:: "; } # Table ======================================================================= sub RST_TAB_TIT { LineNew; MoveLineStart; InsertString ".. table:: "; } sub RST_TABS_2C { LineNew; InsertString "===== ====="; LineNew; LineNew; InsertString "===== ====="; LineNew; 2:MoveUp; MoveLineEnd; } sub RST_TABS_22H { LineNew; InsertString "===== ====="; LineNew; LineNew; InsertString "===== ====="; LineNew; LineNew; LineNew; InsertString "===== ====="; LineNew; 5:MoveUp; MoveLineEnd; } sub RST_TABS_22S { LineNew; InsertString "===== ===== ======"; LineNew; LineNew; InsertString "------------ ------"; LineNew; LineNew; InsertString "===== ===== ======"; LineNew; LineNew; LineNew; InsertString "===== ===== ======"; LineNew; 7:MoveUp; MoveLineEnd; } sub RST_TABG_22 { LineNew; InsertString "+-----------+----------+"; LineNew; InsertString "| | |" LineNew; InsertString "+-----------+----------+"; LineNew; InsertString "| | |" LineNew; InsertString "+-----------+----------+"; LineNew; 4:MoveUp; MoveRight; } sub RST_TABG_22H { LineNew; InsertString "+-----------+----------+"; LineNew; InsertString "| | |" LineNew; InsertString "+===========+==========+"; LineNew; InsertString "| | |" LineNew; InsertString "+-----------+----------+"; LineNew; InsertString "| | |" LineNew; InsertString "+-----------+----------+"; LineNew; 6:MoveUp; MoveRight; } sub RST_TABCSV { LineNew; } sub RST_TABLIST { LineNew; MoveLineStart; InsertString ".. list-table:: "; LineNew; InsertString " :widths:"; LineNew; InsertString ":header-rows:"; LineNew; InsertString ":stub-columns:"; LineNew; LineNew; InsertString "* - "; LineNew; InsertString " - "; LineNew; 2:MoveLeft; InsertString "* - "; LineNew; InsertString " - "; LineNew; 9:MoveUp; MoveLineEnd; } #csv-table #header #file #url #encoding #delim #quote #keepspace #escape sub RST_H1 { MoveLineEnd; LineNew; 100:InsertString "="; # ========= MoveUp; MoveLineEnd; LineTrim;MoveLineEnd; MoveDown; KillToLineEnd; } sub RST_H2 { MoveLineEnd; LineNew; 100:InsertString "-"; # --------- MoveUp; MoveLineEnd; LineTrim;MoveLineEnd; MoveDown; KillToLineEnd; } sub RST_H3 { MoveLineEnd; LineNew; 100:InsertString "\""; # """"""""" MoveUp; MoveLineEnd; LineTrim;MoveLineEnd; MoveDown; KillToLineEnd; } sub RST_H4 { MoveLineEnd; LineNew; 100:InsertString "'"; # ''''''''' MoveUp; MoveLineEnd; LineTrim;MoveLineEnd; MoveDown; KillToLineEnd; } sub RST_H5 { MoveLineEnd; LineNew; 100:InsertString "`"; # ````````` MoveUp; MoveLineEnd; LineTrim;MoveLineEnd; MoveDown; KillToLineEnd; } sub RST_T { MoveLineEnd; LineNew; 100:InsertString "="; # ========= MoveUp; MoveLineEnd; LineTrim;MoveLineEnd; MoveDown; KillToLineEnd; } colorize reST { SyntaxParser = 'SIMPLE'; %if(COLORS_BLUE_BG) color { { 'Normal', 'Editor_Default' }, # Text { 'String', 'Editor_Keywords' }, # Emphasis, literal, strong .. { 'Comment', 'Lang_Comment' }, # Comment { 'Punctuation', 'Editor_Default' }, # .,:() .. { 'Special', 'Markup_Special' }, # :: { 'Tag', 'Editor_Keywords3' }, # .. _text; .. []; __ text; _``; { 'Directive', 'Markup_Symbol' }, { 'Symbol', 'String' }, # `text`_; word_ { 'Keyword', 'Editor_Keywords' }, }; %endif %if(COLORS_BLACK_BG) color { { 'Normal', 'Editor_Default' }, # Text { 'String', 'Lang_String' }, # Emphasis, literal, strong .. { 'Comment', 'Lang_Comment' }, # Comment { 'Punctuation', 'Markup_Punctuation' }, # .,:() .. { 'Special', 'Markup_Special' }, # :: { 'Tag', 'Markup_Tag' }, # .. _text; .. []; __ text; _``; { 'Directive', 'Markup_Symbol' }, { 'Symbol', 'Markup_Control' }, # `text`_; word_ { 'Keyword', 'Editor_Keywords' }, }; %endif # directives keyword 'Editor_Keywords' { # global keywords ... 'admonition', 'image', 'figure', 'topic', 'sidebar', 'line-block', 'parsed-literal', 'rubric', 'epigraph', 'highlights', 'pull-quote', 'compound', 'container', 'table', 'csv-table', 'list-table', 'contents', 'sectnum', 'section-numbering', 'header', 'footer', 'meta', 'replace', 'unicode', 'date', 'include', 'raw', 'class', 'role', 'default-role', 'title', 'restructuredtext-test-directive', 'style' }; # parameters keyword 'Editor_Keywords2' { ':target:', ':scale:', ':height:', ':width:', ':subtitle:', ':figclass:', ':figwidth:', ':alt:', ':align:', #-("top", "middle", "bottom", "left", "center", or "right" ) ':escape:', ':keepspace:', ':quote:', ':delim:', ':header:', ':widths:', ':header-rows:', ':stub-columns:', ':local:', ':backlinks:', ':depth:', ':prefix:', ':suffix:', ':start:', ':ltrim:', ':rtrim:', ':trim:', ':literal:', ':encoding:', ':file:', ':url:' }; keyword 'Editor_Keywords5' { 'attention', 'caution', 'danger', 'error', 'hint', 'important', 'note', 'tip', 'warning' }; #============================== h_state 0 { 'Normal' } #h_trans { 0, '<', /\\/, 'Normal' } # (\*.txt) #h_trans { 0, 's', /[.,;:()"\'{}\[\]]/, 'Punctuation' } h_trans { 0, '<x', /^\s*"+\s*$/,'Punctuation' } # skip /"""""""""""""""/ h_trans { 21, '<', '"', 'Normal' } h_trans { 0, '<x', /^\s*'+\s*$/,'Punctuation' } # skip /'''''''''''''''/ h_trans { 0, '<x', /[^ ']'/, 'Normal' } # skip: doesn't, Tables' h_trans { 23, '<', '\'', 'Normal' } h_trans { 24, '^x', /\s*\.\.\s*$/, 'Directive' } # .. h_trans { 1, '^x', /\s*\.\.\s+/, 'Directive' } # .. text h_trans { 0, '<x', /^\s*\.+\s*$/,'Punctuation' } # skip /.............../ h_trans { 5, '^x', /\s*__\s+/, 'Tag' } # __ # Skip Grid Tables h_trans { 19, '^x', /^\s*\+[-=]+\+/, 'Normal' } # `string` ``string`` *string* **string** h_trans { 0, '<x', /[\s(\[{]\*[^ *][^*]*[^ *]\*[ )\]};:.,]/, 'String' } h_trans { 0, '<x', /[\s(\[{]\*\*[^ *][^*]*[^ ]\*\*[ )\]};:.,]/, 'String' } h_trans { 0, '<x', /\*[^ *][^*]*[^ *]\*/, 'String' } h_trans { 0, '<x', /\*\*[^ *][^*]*[^ *]\*\*/, 'String' } h_trans { 0, '<x', /[\s(\[{]\`[^ \`][^\`]+[^ \`]\`[ )\]};:.,]/, 'String' } #h_trans { 0, '<x', /[\s(\[{]\`\`[^ \`][^\`]+[^ ]\`\`[ )\]};:.,]/, 'String' } h_trans { 0, '<x', /\`[^ \`][^\`]+[^ \`]\`[^_]+/, 'String' } h_trans { 0, '<x', /\`[^ \`][^\`]+[^ \`]\`$/, 'String' } #h_trans { 0, '<x', /\`[^ \`][^\`]+[^ \`]\`_/, 'Symbol' } #h_trans { 0, '<x', /\`\`[^ \`][^\`]+[^ \`]\`\`/, 'String' } h_trans { 0, '<x', /\`\`[^ \`]\`\`/, 'String' } h_trans { 22, '<x', /\`\`[^ \`]/, 'String' } # _`text` h_trans { 18, '<', '_`', 'Tag' } # `text`_ #h_trans { 9, '<x', /\s*\`[^\` ]/, 'Symbol' } h_trans { 9, '<x', /\`[^\` ]/, 'Symbol' } # || h_trans { 0, '<x', /\|.*\|_\s*/, 'Symbol' } h_trans { 11,'<x', /\s\|./, 'String' } h_trans { 11,'^x', /\|./, 'String' } # :: h_trans { 13, '<x', /\s*::$/, 'Special' } # [word]_ h_trans { 0, '<x', /\[.+\]_/, 'Symbol' } # [23]_ # word_ h_trans { 0, '<x', /[^ ]+_\s/, 'Symbol' } # target_ h_trans { 0, '<x', /[^ ]+_$/, 'Symbol' } # target_ (end of line) # word__ h_trans { 0, '<x', /[^ ]+__\s/, 'Symbol' } # target__ h_trans { 0, '<x', /[^ ]+__$/, 'Symbol' } # target__ (end of line) # Roles h_trans { 15, 's', ':', 'Punctuation' } #h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' } # English only h_trans { 0, 'S', '_a-zA-Z0-9--', 'Punctuation' } # + dos866 codepage #h_trans { 0, 'S', '_a-zA-Z0-9-', 'Punctuation' } # + win1251 codepage # .. Directive #============================== h_state 1 { 'Keyword' } h_trans { 7, '<x', /[_|]./, 'Tag' } h_trans { 17, '<', '[', 'Tag' } h_trans { 2, '<x', /\s*::[ ]*/, 'Directive' } h_wtype { 2, 3, 3, '<', '-a-zA-Z' } #============================== h_state 2 { 'Tag' } h_trans { 1, '^x', /\s.+/, 'Tag' } h_trans { 1, '$', '', 'Tag' } h_trans { 0, '<x', /\s*::[ ]*/, 'Directive' } h_trans { 0, '', '', 'Normal'} # // Comment #============================== h_state 3 { 'Comment' } h_trans { 4, '$', '', 'Comment' } #============================== h_state 4 { 'Comment' } h_trans { 0, '^-x', /[^\s]+/, 'Normal'} # Not empty string: one or more space and char h_trans { 3, '^x', /\s+.+/, 'Comment' } # Char in first position #h_trans { 0, '$', '', 'Normal'} #__ link text #============================== h_state 5 { 'Tag' } h_trans { 6, '$', '', 'Tag' } #============================== h_state 6 { 'Tag' } h_trans { 5, '^x', /\s+.+/, 'Tag' } h_trans { 0, '', '', 'Normal' } #.. _Text: text #.. |Text| gfhgh :: text #============================== h_state 7 { 'Tag' } h_trans { 8, '$', '', 'Tag' } #============================== h_state 8 { 'Tag' } h_trans { 7, '^x', /\s+.+/, 'Tag' } h_trans { 0, '', '', 'Normal' } # `Text <link>`_ #============================== h_state 9 { 'Symbol' } h_trans { 0, '>', ' < ', 'Symbol' } h_trans { 10, '>', ' <', 'Tag' } h_trans { 0, '>', '`__', 'Symbol' } h_trans { 0, '>', '`_', 'Symbol' } # <> #============================== h_state 10 { 'Tag' } h_trans { 9, '<', '>', 'Tag' } # |data| # | Quote text #============================== h_state 11 { 'String' } h_trans { 0, '<x', /.\|/, 'String' } h_trans { 12, '$', '', 'String' } #============================== h_state 12 { 'String' } h_trans { 11, '^x', /\s+.+/, 'String' } h_trans { 0, '', '', 'Normal' } # :: #============================== h_state 13 { 'Punctuation' } h_trans { 14, '$', '', 'Punctuation' } #============================== h_state 14 { 'Punctuation' } h_trans { 13, '^x', /\s+.*/, 'Punctuation' } h_trans { 0, '^-x', /./, 'Normal'} # roles # :strong:`STRONG TEXT` #============================== h_state 15 { 'String' } h_trans { 0, '$','', 'Normal'} h_trans { 16, '>', ':`', 'Punctuation' } h_wtype { -1, 0, 0, '<', 'a-zA-Z' } h_words 'String'{ 'emphasis', 'literal', 'strong', 'pep-reference', 'PEP', 'rfc-reference', 'RFC', 'subscript', 'sub', 'superscript', 'sup', 'title-reference', 'title', 't' } #============================== h_state 16 { 'String' } h_trans { 0, '>', '`', 'Punctuation' } #.. [Text] text #============================== h_state 17 { 'Tag' } h_trans { 0, '>', ']', 'Tag' } # _`text` entry #============================== h_state 18 { 'Tag' } h_trans { 0, '', '`', 'Tag' } # Skip Grid Tables #============================== h_state 19 { 'Normal' } h_trans { 20, '$', '', 'Normal' } #============================== h_state 20 { 'Normal' } h_trans { 19, '>x', /\s*[\+\|]+/, 'Normal' } h_trans { 0, '$', '', 'Normal' } # Skip "" #============================== h_state 21 { 'Normal' } h_trans { 0, '>', '"', 'Normal' } # ``text`` entry #============================== h_state 22 { 'String' } h_trans { 0, '>', '``', 'String' } # Skip '' #============================== h_state 23 { 'Normal' } h_trans { 0, '>', '\'', 'Normal' } # first line comment #============================== h_state 24 { 'Special' } h_trans { 25, '$', '', 'Normal' } # up to EOL h_state 25 { 'Special' } h_trans { 0, '$', '', 'Normal' } # empty string h_trans { 0, '<x', /^\s+$/, 'Normal' } # string contains only space and tabs h_trans { 3, '', '', 'Normal' } } mode reST: PLAIN { FileNameRx = /\.\c{RST}|{REST}|{RSTX}$/; # /\.\cRST$/; FirstLineRx = /^=====+/; # !!!!!! HilitOn = 1; Colorizer = 'reST'; MultiLineHilit = 1; AutoHilitParen = 1; %if(COLORS_BLUE_BG) # for bialix # but not work macros RST_Hx, need (RightMargin-1):InsertString WordWrap = 1; RightMargin = 79; %endif SaveFolds = 0; # save fold info at end of line CommentStart = ' ..'; CommentEnd = ''; } oinclude 'mym_rst.fte'; ################################################### #!!!!!!!!!!!!!!!!! BUGS: !!!!!!!!!!!!!!!!! ################################################### # (``[1]_``) # (1_) #**1** #.................... #'' #("_") #- asterisks: * "*" '*' (*) (* [*] {*} 1*x BOM32_* #backquotes (`) around the text #(quickref__) #| This is a line block. It ends with a blank line. #| Each new line begins with a vertical bar ("|"). #| Line breaks and initial indents are preserved. #| Continuation lines are wrapped portions of long lines; # they begin with a space in place of the vertical bar. #| The left edge of a continuation line need not be aligned with # the left edge of the text above it. # +-------+-------------------------------+ # | ".. " | directive type "::" directive | # +-------+ block | # | | # +-------------------------------+ # # .. content:: text # # .. image:: text # # .. |reST| replace:: reStructuredText # # .. |symbol here| image:: symbol.png # # .. |the text in Texas| style:: big # # # ....... :strong:`text` ..... :literal:`text` # # [1]_ # # .. [1] A footnote contains body elements, consistently # indented by at least 3 spaces. # #.. [CIT2002] Just like a footnote, except the label is # textual. # # # .. comment text comment # #+------------------------------+ #| paragraph | #| (ends with "::") | #+------------------------------+ # +---------------------------+ # | indented literal block | # +---------------------------+ # # quoting characters ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ #+------------------------------+ #| paragraph | #| (ends with "::") | #+------------------------------+ #+------------------------------+ #| ">" per-line-quoted | #| ">" contiguous literal block | #+------------------------------+ # #+------+-----------------------+ #| "| " | line | #+------| continuation line | # +-----------------------+ #+-------+----------------------+ #| ".. " | "_" name ":" link | #+-------+ block | # | | # +----------------------+ #+-------+----------------------+ #| ".. " | comment | #+-------+ block | # | | # +----------------------+ # #emphasis: "*" #strong emphasis: "**" #interpreted text: "`" #inline literals: "``" #substitution references: "|" ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_unrealscript.fte������������������������������������������������������������������0000664�0000764�0000764�00000003640�11157534024�016323� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# C mode colorize UNREALSCRIPT { SyntaxParser = 'C'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'class', 'extends', 'function', 'defaultproperties', 'Super', 'var', 'if', 'return', 'bool', 'true', 'false', 'string', 'local', 'Begin', 'Object', 'array', 'int', 'float', 'enum', 'localized', 'struct', 'config', 'for', 'else', 'event', 'exec', 'state', 'while', 'break', 'continue', 'native', 'simulated', 'abstract', 'native', 'nativereplication', 'const', 'final', 'iterator', 'static', 'color', 'simulated', 'replication', 'unreliable', 'foreach', 'optional', 'out', 'switch', 'transient', 'name', 'export', 'delegate', 'cpptext', 'globalconfig', 'self', 'preoperator', 'postoperator', 'operator', 'coerce', 'noexport', 'ignores', }; } mode UNREALSCRIPT: C { # UScript Mode FileNameRx = /\.\c{UC}$/; HilitOn = 1; Colorizer = 'UNREALSCRIPT'; AutoIndent = 0; IndentMode = 'C'; MatchCase = 0; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /^\s*(({cpptext}|{defaultproperties}|{replication})\s*)|((({native}|{native\(\d+\)}|{final}|{static}|{simulated}|{exec})\s+)*({function}|{event})\s+(.+\s+)?[\w_]+\s*\([^;]*)$/; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; } oinclude 'mym_unrealscript.fte'; ������������������������������������������������������������������������������������������������efte-1.1/config/ab_sh.fte���������������������������������������������������������������������������0000664�0000764�0000764�00000002244�11157534024�014347� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������eventmap SH { abbrev 'ifx' { KillWordPrev; InsertString 'if [ ]'; LineIndent; LineNew; InsertString 'then'; LineIndent; LineNew; InsertString 'fi'; LineIndent; 2:MoveUp; MoveLineEnd; 2:MoveLeft; Fail; # do not insert typed character } abbrev 'fox' { KillWordPrev; InsertString 'for in'; LineIndent; LineNew; InsertString 'do'; LineIndent; LineNew; InsertString 'done'; LineIndent; 2:MoveUp; MoveLineEnd; 3:MoveLeft; Fail; # do not insert typed character } abbrev 'whx' { KillWordPrev; InsertString 'while [ ]'; LineIndent; LineNew; InsertString 'do'; LineIndent; LineNew; InsertString 'done'; LineIndent; 2:MoveUp; MoveLineEnd; 2:MoveLeft; Fail; } abbrev 'cax' { KillWordPrev; InsertString 'case of'; LineIndent; LineNew; InsertString 'esac'; LineIndent; MoveUp; MoveLineEnd; 3:MoveLeft; Fail; } abbrev 'dox' { KillWordPrev; InsertString 'do'; LineIndent; 2:LineNew; InsertString 'done'; LineIndent; MoveUp; LineIndent; MoveLineEnd; Fail; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_sh.fte����������������������������������������������������������������������������0000664�0000764�0000764�00000004076�11157534024�014226� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������colorize SH { SyntaxParser = 'SH'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'Comment', 'Lang_Comment' }, { 'String', 'Lang_String' }, { 'Control', 'Lang_Command' }, { 'Command', 'Lang_Function' }, { 'Punctuation','Lang_Punctuation' }, { 'Variable', 'Lang_Label' }, }; # keyword 'Lang_Label' { # 'PPID', 'PWD', 'OLDPWD', 'REPLY', 'UID', # 'EUID', 'GROUPS', 'BASH', 'BASH_VERSION', # 'BASH_VERSINFO', 'SHLVL', 'RANDOM', # 'SECONDS', 'LINEND', 'HISTCMD', 'DIRSTACK', # 'PIPESTATUS', 'OPTARG', 'OPTIND', 'HOSTNAME', # 'HOSTTYPE', 'OSTYPE', 'MACHTYPE', 'SHELLOPTS', # 'IFS', 'PATH', 'HOME', 'CDPATH', 'BASH_ENV', # 'MAIL', 'MAILCHECK', 'MAILPATH', 'PS1', # 'PS2', 'PS3', 'PS4', 'TIMEFORMAT', 'HISTSIZE', # 'HISTFILE', 'HISTFILESIZE', 'OPTERR', 'LANG', # 'LC_ALL', 'LC_COLLATE', 'LC_MESSAGES', # 'PROMPT_COMMAND', 'IGNOREEOF', 'TMOUT', # 'FCEDIT', 'FIGNORE', 'GLOBIGNORE', 'INPUTRC', # 'HISTCONTROL', 'HISTIGNORE', 'HOSTFILE', # # 'TERM', 'LD_LIBRARY_PATH', 'XAUTHORITY', # 'WINTERM', # }; keyword 'Editor_Keywords' { 'case', 'do', 'done', 'elif', 'else', 'esac', 'fi', 'for', 'function', 'if', 'in', 'then', 'until', 'while', 'exec', 'export', 'set', 'echo', 'exit', 'select', 'source', 'unset', 'alias', 'unalias', 'shift', 'break', 'read', 'return', }; } mode SH: SOURCE { # *sh FileNameRx = /{\.\cSH$}|{configure.{in}|{ac}}/; FirstLineRx = /^\#\![ ]*[^ ]*sh>/; RoutineRegexp = /^\s*{function\s\s*\S\S*\s*}|{\S\S*\s*\(\)}\s*$/; HilitOn = 1; Colorizer = 'SH'; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' #'; CommentEnd = ''; } oinclude 'mym_sh.fte'; ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/systemmain.fte����������������������������������������������������������������������0000664�0000764�0000764�00000001065�11157534024�015464� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Default system main fte config file. # The purpose of this file is to allow the system to have customizations # suitable for the owner of the machine or the corporation as required. This # allows the sysadmin to add new functionality in the system config that # all users will get while still being able to add the new configs that will # be made available with new versions of FTE. New versions of FTE will not # overwrite customizations this way. # include the main config - usually in /usr/local/efte/config. include 'main.fte'; # Local settings go here. ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_4gl.fte���������������������������������������������������������������������������0000664�0000764�0000764�00000012711�11157534024�014275� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# GL mode colorize GL { # SyntaxParser = 'C'; SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, # { 'CPreprocessor', 'Lang_Preprocessor' }, # { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { # any missing ? 'ABSOLUTE', 'AFTER', 'ALTER', 'AND', 'ARRAY', 'AT', 'ATTRIBUTE', 'AUTONEXT', 'BEFORE', 'BEGIN', 'BOTTOM', 'BY', 'CASE', 'CHAR', 'CHARACTER', 'CLEAR', 'CLIPPED', 'CLOSE', 'COLUMNS', 'COMMIT', 'CONSTRUCT', 'CONTINUE', 'CREATE', 'CURRENT', 'CURSOR', 'DATABASE', 'DATE', 'DATETIME', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULTS', 'DEFER', 'DEFINE', 'DELETE', 'DISPLAY', 'DOUBLE PRECISION', 'DROP', 'ELSE', 'END', 'ERROR', 'EVERY', 'EXECUTE', 'EXIT', 'FETCH', 'FIELD', 'FINISH', 'FIRST', 'FLOAT', 'FLUSH', 'FOR', 'FOREACH', 'FORM', 'FORMAT', 'FREE', 'FROM', 'GLOBALS', 'GOTO', 'GRANT', 'IF', 'INITIALIZE', 'INPUT', 'INSERT', 'INT', 'INTEGER', 'INTERVAL', 'INTO', 'IS', 'KEY', 'LABEL', 'LAST', 'LEFT', 'LENGTH', 'LET', 'LIKE', 'LINE', 'LOAD', 'LOCATE', 'LOCK', 'MAIN', 'MARGIN', 'MENU', 'MESSAGE', 'MONEY', 'NEXT', 'NOT', 'NUMERIC', 'ON', 'OPEN', 'OPTIONS', 'OR', 'OTHERWISE', 'OUTPUT', 'PAGE', 'PREPARE', 'PREVIOUS', 'PRINT', 'PRINTER', 'PROGRAM', 'PROMPT', 'PUT', 'REAL', 'RECORD', 'RECOVER', 'RENAME', 'REPORT', 'RETURN', 'RETURNING', 'REVOKE', 'RIGHT', 'ROLLBACK', 'ROLLFORWARD', 'ROW', 'ROWS', 'RUN', 'SCROLL', 'SELECT', 'SERIAL', 'SET', 'SLEEP', 'SMALLFLOAT', 'SMALLINT', 'START', 'THEN', 'TO', 'TOP', 'UNION', 'UNLOAD', 'UNLOCK', 'UPDATE', 'UPSHIFT', 'VALIDATE', 'WHEN', 'WHENEVER', 'WHERE', 'WHILE', 'WINDOW', 'WITH', 'WITHOUT', 'WRAP', #'FUNCTION', 'CALL', }; keyword 'Editor_Keywords2' { 'BORDER', 'DATE', 'FALSE', 'INT_FLAG', 'NOTFOUND', 'NULL', 'QUIT_FLAG', 'REVERSE', 'STATUS', 'TIME', 'TODAY', 'TRUE', }; keyword 'Editor_Keywords3' { 'FGL_GETENV', 'FGL_KEYVAL', 'FGL_LASTKEY', 'FIELD_TOUCHED', 'GET_FLDBUF', }; h_state 0 { 'Normal' } h_trans {1, '<', '#', 'Comment' } h_trans {2, '<', '{', 'Comment' } h_trans {3, '<', '"', 'String' } h_trans {4, '<', '\'', 'String' } h_trans {5, '<', '0x', 'HexNumber' } h_trans {6, '<s', '0-9', 'Number'} h_trans {0, 'S', '_a-zA-Z0-9', 'Punctuation' } h_trans {7, '<', 'CALL', 'Keyword' } h_trans {7, '<', 'FUNCTION', 'Keyword' } h_trans {8, '-s', 'a-zA-Z_', 'Normal' } h_state 1 { 'Comment'} h_trans {0, '$', '', 'Comment' } h_state 2 { 'Comment' } h_trans { 0, '>', '}', 'Comment' } h_state 3 { 'String' } h_trans {0, '>', '"', 'String'} h_state 4 { 'String' } h_trans {0, '>', '\'', 'String'} h_state 5 { 'HexNumber' } h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 6 { 'Number' } h_trans { 0, 'S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 7 { 'Function' } h_trans { 0, '->', '(', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 8 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'S', 'a-zA-Z0-9_' } } mode GL: SOURCE { # 4GL Mode FileNameRx = /\.\c{4GL}|{4BL}$/; HilitOn = 1; Colorizer = 'GL'; AutoIndent = 1; IndentMode = 'PLAIN'; SpaceTabs = 0; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; # RoutineRegexp = /FUNCTION/; # RoutineRegexp = /^\w[\w_:*&~]+[\w\s_:*&~]@\([^;]*$/; # RoutineRegexp = /[\w\s_:*&~]@\(*/; # RoutineRx ^\w[\w_:*&]+[\w\s_:*&]@\( # RoutineRx ^{[a-zA-Z0-9_:*&]#\s*}+\( SaveFolds = 2; # save fold info at end of line CommentStart = ' {'; CommentEnd = '}'; CursorThroughTabs = 0; DeleteKillTab = 1; DeleteKillBlock = 1; BackSpKillTab = 1; Abbreviations = 1; # IndentWithTabs = 1; # BackSpUnindents = 0; # SpaceTabs = 0; } oinclude 'mym_4gl.fte'; �������������������������������������������������������efte-1.1/config/m_mvsasm.fte������������������������������������������������������������������������0000664�0000764�0000764�00000003546�11157534024�015123� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������colorize MVSASM { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'mov', 'push', 'pop', 'movzx', 'movsx', 'shl', 'shr', 'and', 'or', 'xor', 'not', 'add', 'sub', 'neg', 'mul', 'div', 'idiv', 'imul', 'test', 'cmp', 'inc', 'dec', 'enter', 'leave', }; h_state 0 { 'Normal' } h_trans { 1, '^', '*', 'Comment' } # '*' at bol is COMMENT h_trans { 2, '^-S', ' ', 'Label' } # word at bol is LABEL h_trans { 3, '-S', ' ', 'Normal' } # word at non-bol is INSTRUCTION h_state 1 { 'Comment' } # comment h_trans { 0, '$', '', 'Normal' } h_state 2 { 'Label' } # first column is LABEL h_trans { 0, '$', '', 'Normal' } h_trans { 0, '-s', ' ', 'Label' } h_state 3 { 'Normal' } # keywords in second column h_trans { 0, '$', '', 'Normal' } h_trans { 1, '-s', ' ', 'Comment' } h_wtype { 1, 1, 1, '', 'a-zA-Z_' } # keywords here or global h_state 4 { 'Normal' } # eat non-keywords in second col h_trans { 0, '$', '', 'Normal' } h_trans { 1, '-s', ' ', 'Comment' } } mode MVSASM: SOURCE { FileNameRx = /\.\cMVSA$/; HilitOn = 1; Colorizer = 'MVSASM'; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' ;'; CommentEnd = ''; } oinclude 'mym_mvsasm.fte'; ����������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/ui_m_fte.fte������������������������������������������������������������������������0000664�0000764�0000764�00000041744�11157534024�015072� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# FTE default menus menu MOpenInMode { item "&Plain" { FileOpenInMode 'PLAIN' } item "&Text" { FileOpenInMode 'TEXT' } item "&C" { FileOpenInMode 'C' } item "&EMail" { FileOpenInMode 'MSG' } item "&HTML" { FileOpenInMode 'HTML' } item "&IPF" { FileOpenInMode 'IPF' } item "&Ada" { FileOpenInMode 'Ada' } item "&REXX" { FileOpenInMode 'REXX' } item "MA&KE" { FileOpenInMode 'MAKE' } item "&FTE" { FileOpenInMode 'FTE' } item "&Win Resource" { FileOpenInMode 'RESOURCE' } item "&DIFF" { FileOpenInMode 'DIFF' } item "&MERGE" { FileOpenInMode 'MERGE' } item "&SH" { FileOpenInMode 'SH' } item "PER&L" { FileOpenInMode 'PERL' } item "PASCAL" { FileOpenInMode 'PASCAL' } item "&JAVA" { FileOpenInMode 'JAVA' } item "TE&X" { FileOpenInMode 'TEX' } item "&BIN" { FileOpenInMode 'BIN' } item "4&GL" { FileOpenInMode 'GL' } item "PHP" { FileOpenInMode 'PHP' } item "P&ython" { FileOpenInMode 'PYTHON' } item "reST" { FileOpenInMode 'reST' } } menu MChangeMode { item "&Plain" { ChangeMode 'PLAIN' } item "&Text" { ChangeMode 'TEXT' } item "&C" { ChangeMode 'C' } item "&EMail" { ChangeMode 'MSG' } item "&HTML" { ChangeMode 'HTML' } item "&IPF" { ChangeMode 'IPF' } item "&Ada" { ChangeMode 'Ada' } item "&REXX" { ChangeMode 'REXX' } item "MA&KE" { ChangeMode 'MAKE' } item "&FTE" { ChangeMode 'FTE' } item "&Win Resource" { ChangeMode 'RESOURCE' } item "&DIFF" { ChangeMode 'DIFF' } item "&MERGE" { ChangeMode 'MERGE' } item "&SH" { ChangeMode 'SH' } item "PER&L" { ChangeMode 'PERL' } item "PASCAL" { ChangeMode 'PASCAL' } item "&JAVA" { ChangeMode 'JAVA' } item "TE&X" { ChangeMode 'TEX' } item "&BIN" { ChangeMode 'BIN' } item "4&GL" { ChangeMode 'GL' } item "PHP" { ChangeMode 'PHP' } item "P&ython" { ChangeMode 'PYTHON' } item "reST" { ChangeMode 'reST' } } menu MOpenInModeMore { item "ASM" { FileOpenInMode 'ASM' } item "ASM 370 (.CPY,.MLC)" { FileOpenInMode 'ASM370' } item "TCL" { FileOpenInMode 'TCL' } item "Fortran 90" { FileOpenInMode 'FORTRAN' } item "IPF" { FileOpenInMode 'IPF' } item "A51" { FileOpenInMode 'A51' } item "CLARION (.CLW)" { FileOpenInMode 'CLARION' } item "EBFN" { FileOpenInMode 'EBFN' } item "SGML" { FileOpenInMode 'SGML' } item "SIOD (.cscm)" { FileOpenInMode 'SIOD' } item "S&Lang" { FileOpenInMode 'sl' } item "Module 3" { FileOpenInMode 'MODULA3' } item "Tex Info" { FileOpenInMode 'TEXINFO' } item "Diff" { FileOpenInMode 'DIFF' } item "Merge" { FileOpenInMode 'MERGE' } item "Man pages" { FileOpenInMode 'CATBS' } } menu MChangeModeMore { item "ASM" { ChangeMode 'ASM' } item "ASM 370 (.CPY,.MLC)" { ChangeMode 'ASM370' } item "TCL" { ChangeMode 'TCL' } item "Fortran 90" { ChangeMode 'FORTRAN' } item "IPF" { ChangeMode 'IPF' } item "A51" { ChangeMode 'A51' } item "CLARION (.CLW)" { ChangeMode 'CLARION' } item "EBFN" { ChangeMode 'EBFN' } item "SGML" { ChangeMode 'SGML' } item "SIOD (.cscm)" { ChangeMode 'SIOD' } item "S&Lang" { ChangeMode 'sl' } item "Module 3" { ChangeMode 'MODULA3' } item "Tex Info" { ChangeMode 'TEXINFO' } item "Diff" { ChangeMode 'DIFF' } item "Merge" { ChangeMode 'MERGE' } item "Man pages" { ChangeMode 'CATBS' } } menu Object { item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; submenu "Open in Mode more..", MOpenInModeMore; item "Open &Binary" { FileOpenInMode 'BIN' } item; item "Open &Directory\tC+M" { DirOpen } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item "Close All" { FileCloseAll } item; item "E&xit\tAlt+X" { ExitEditor } } menu MCvs { item "CVS C&heck" { RunCvs "-n update" } item "CVS &Update" { RunCvs "update -d" } item "CVS &Diff" { CvsDiff "" } item "CVS &Commit" { RunCvsCommit "" } item "CVS &Add" { RunCvs "add" } item "CVS &Remove" { RunCvs "remove" } item "CVS S&tatus" { RunCvs "status -v" } item "CV&S" { Cvs } item; item "&View CVS" { ViewCvs } item "View CVS Di&ff" { ViewCvsDiff } item "View CVS &log" { ViewCvsLog } item; item "Cl&ear CVS messages" { ClearCvsMessages } } menu MSvn { item "SVN S&tatus" { RunSvn "status" } item "SVN &Update" { RunSvn "update" } item "SVN &Diff" { SvnDiff "" } item "SVN &Commit" { RunSvnCommit "" } item "SVN &Add" { RunSvn "add" } item "SVN &Remove" { RunSvn "remove" } item "SVN Lo&g" { RunSvn "log" } item "SVN Re&vert" { RunSvn "revert" } item "SVN &Blame" { RunSvn "blame" } item "SV&N" { Svn } item; item "&View SVN" { ViewSvn } item "View SVN Di&ff" { ViewSvnDiff } item "View SVN &log" { ViewSvnLog } item; item "Cl&ear SVN messages" { ClearSvnMessages } } menu Tools { item "&Compile...\tF9" { Compile "make -k " } item "&Grep..." { Compile "grep -n " } item "Save and &ISpell" { FileSave; RunProgram "ispell " . $FilePath; FileReload } item; item "&Shell\tAlt+F9" { RunProgram "" } item "&Run...\tCtrl+F9" { RunProgram } item; item "&Previous error\tF11" { CompilePrevError } item "&Next error\tF12" { CompileNextError } item; item "&Messages\tS+F9" { ViewMessages } item "C&lear Messages" { ClearMessages } item; submenu "C&VS\tC+O_C+V", MCvs; submenu "SVN\tC+O_C+N", MSvn; } menu Window { item "New &Frame" { FrameNew } item; item "Split &Horizontal\tCtrl+F4" { WinHSplit } item "&Close view\tCtrl+Alt+F4" { WinClose } item "Close &other views\tF5" { WinZoom } item; item "&Load Desktop" { DesktopLoad } item "Sa&ve Desktop" { DesktopSave } item "Save Desktop &As" { DesktopSaveAs } item; item "&Routines\tCtrl+I" { ListRoutines } item "&Buffers\tAlt+0" { ViewBuffers } item "&Directory\tC+M" { DirOpen } } menu Help { item "&Keyboard\tF1" { ViewModeMap } item "&Show key" { ShowKey } item; item "&About..." { ShowVersion } } menu Navigate { item "&Reload\tCtrl+R" { Rescan } item; item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } item "&/ Goto Dir\t/" { DirGoto } item; item "R&ename File" { RenameFile } item "&Make Directory" { MakeDirectory } item; item "Delete &File\tCtrl+D" { DeleteFile } # item; # item '&C:\\' { DirGoto 'H:\\' } } menu File { item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; submenu "Open in more", MOpenInModeMore; item "Open &Binary..." { FileOpenInMode 'BIN' } item "Open &Directory\tC+M" { DirOpen } item "&Reload\tShift+F3" { FileReload } item; item "&Save\tF2" { FileSave } item "Save &As...\tShift+F2" { FileSaveAs } item "Save Al&l\tCtrl+F2" { FileSaveAll } item "Write &To..." { FileWriteTo } item; item "Prin&t" { FilePrint } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item "Close All" { FileCloseAll } item; item "E&xit\tAlt+X" { ExitEditor } } menu Line { item "&Insert line\tShift+Enter" { LineInsert } item "&Add line\tAlt+Enter" { LineAdd } item "&Split line\tCtrl+Enter" { LineSplit } item "&Join line\tCtrl+J" { LineJoin } item "Dup&licate line\tCtrl+D" { LineDuplicate } item "&Delete line\tCtrl+Y" { KillLine } item "&Center line" { LineCenter } item; item "Delete to line &end\tAlt+End" { KillToLineEnd } item "Delete to li&ne start\tCtrl+Sh+BackSp" { KillToLineStart } item; item "Comment\tCtrl+Alt+C" { MoveLineStart; ?FindReplace /^(\s*)/ /\/\/ \1/ "xnc"; MoveDown } item "Uncomment\tCtrl+Alt+U" { MoveLineStart; ?FindReplace /^[\/][\/] / // "xnc"; MoveDown } item; item "&Uppercase" { LineCaseUp } item "&Lowercase" { LineCaseDown } item "&Togglecase" { LineCaseToggle } item "&Rot13" { LineTrans 'A-Za-z' 'N-ZA-Mn-za-m' } item; item "User &specified..." { LineTrans } } menu Edit { item "&Undo\tAlt+BackSp" { Undo } item "&Redo\tAlt+Shift+BackSp" { Redo } item; item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "Cut&-Append" { BlockCutAppend } item "Copy-Appe&nd" { BlockCopyAppend } item "&Paste Stream\tShift+Ins" { BlockPasteStream } item "Paste Colu&mn\tAlt+Ins" { BlockPasteColumn } item "Paste Li&ne" { BlockPasteLine } item "Cl&ear\tCtrl+Del" { BlockKill } item; submenu "&Line", Line; item; item "&Quote Literal...\tCtrl+Q" { InsertChar } item "&ASCII Table...\tCtrl+Sh+A" { ASCIITable } } menu Translate { item "&Uppercase" { BlockCaseUp } item "&Lowercase" { BlockCaseDown } item "&Togglecase" { BlockCaseToggle } item "&Rot13" { BlockTrans 'A-Za-z' 'N-ZA-Mn-za-m' } item; item "User &specified..." { BlockTrans } } menu Block { item "&Unmark\tEsc" { BlockUnmark } item "Mark &Stream\tAlt+A" { BlockMarkStream } item "Mark &Column\tAlt+K" { BlockMarkColumn } item "Mark &Line\tAlt+L" { BlockMarkLine } item; item "Select Wor&d" { BlockSelectWord } item "Selec&t Line" { BlockSelectLine } item; item "&Write..." { BlockWrite } item "&Read Stream..." { BlockReadStream } item "Re&ad Column..." { BlockReadColumn } item "Rea&d Line..." { BlockReadLine } item "&Print" { BlockPrint } item; item "&Indent\tAlt+I" { BlockIndent } item "U&nindent\tAlt+U" { BlockUnindent } item "R&eIndent\tAlt+\\" { BlockReIndent } item; submenu "Translat&e", Translate; item "E&xpand Tabs" { BlockUnTab } item "&Generate Tabs" { BlockEnTab } item "Sor&t" { BlockSort } item "Sort Re&verse" { BlockSortReverse } } menu Tags { item "&Find word\tCtrl+]" { TagFindWord } item "&Search tag...\tCtrl+Sh+]" { TagFind } item "&Go back\tCtrl+[" { TagPop } item "&Next tag\tAlt+]" { TagNext } item "&Previous tag\tAlt+[" { TagPrev } item; item "&Load tags..." { TagLoad } item "&Clear tags" { TagClear } } menu SearchWords { item "Search &Prev\tAlt+," { SearchWordPrev } item "Search &Next\tAlt+." { SearchWordNext } item "&Highlight\tAlt+/" { HilitWord } } menu Search { item "&Find...\tCtrl+F" { Find } item "Find &Next\tCtrl+G" { FindRepeat } item "Find &Prev\tCtrl+H" { FindRepeatReverse } item "Find and &Replace...\tCtrl+R" { FindReplace } item; item "P&lace Bookmark..." { PlaceBookmark } item "Goto &Bookmark..." { GotoBookmark } item; submenu "&Tags", Tags; item "&Match Paren\tAlt+-" { MatchBracket } item "&Goto Line...\tAlt+J" { MoveToLine } item "Goto &Column..." { MoveToColumn } submenu "&Words", SearchWords; } menu Fold { item "&Open fold\tCtrl+Gr+" { FoldOpen } item "Open &nested folds\tCtrl+Gr*" { FoldOpenNested } item "Open &all folds\tAlt+Gr*" { FoldOpenAll } item; item "C&lose fold\tCtrl+Gr-" { FoldClose } #item "Close &nested folds\tCtrl+Gray+/" { FoldCloseNested } item "Close all &folds\tAlt+Gr/" { FoldCloseAll } item; item "&Create fold\tAlt+Gr+" { FoldCreate } item "Create folds by &regexp..." { FoldCreateByRegexp } item "Create folds at routine&s" { FoldCreateAtRoutines } item; item "&Destroy fold\tAlt+Gr-" { FoldDestroy } item "Destro&y all folds" { FoldDestroyAll } item; item "&Promote\tSh+Gr-" { FoldPromote } item "De&mote\tSh+Gr+" { FoldDemote } item; item "&Toggle\tCtrl+Gr/" { FoldToggleOpenClose } } eventmap PLAIN: MODEL { key [A+\`] { CharCaseToggle ; MoveRight } } menu Toggle { item "Charac&ter case\tA+`" { CharCaseToggle } item "&Auto indent\tC+O C+A" { ToggleAutoIndent } item "&Case sensitive\tC+O C+C" { ToggleMatchCase } item "Trim &EOL spaces\tC+O C+E" { ToggleTrim } item "&Undo/Redo\tC+O C+U" { ToggleUndo } item "&Read only\tC+O C+R" { ToggleReadOnly } item "&Keep backups" { ToggleKeepBackups } item "&Make backups" { ToggleMakeBackups } item "&Backspace Unindents" { ToggleBackSpUnindents } item; item "I&ndent with tabs" { ToggleIndentWithTabs } item "S&pace tabs" { ToggleSpaceTabs } item "Backspace k&ill tab" { ToggleBackSpKillTab } item "&Delete kill tab" { ToggleDeleteKillTab } } menu Options { submenu "Change &mode\tC+O C+M", MChangeMode; submenu "Change mode more", MChangeModeMore; submenu "Change C in&dent style", MChangeCIndentStyle; item; submenu "&Toggle", Toggle; item "&Insert mode\tC+O C+I" { ToggleInsert } item "&Word wrap\tC+O C+W" { ToggleWordWrap } item; item "&Left margin...\tC+O A+[" { ChangeLeftMargin } item "Ri&ght margin...\tC+O A+]" { ChangeRightMargin } item; item "&Show markers\tC+O C+." { ToggleShowMarkers; WinRefresh } item "Highlight tags" { ToggleHilitTags; WinRefresh } item "Show &bookmarks" { ToggleShowBookmarks; WinRefresh } item "S&how tabs\tC+O Tab" { ToggleShowTabs; WinRefresh } item "&Tab size...\tC+O C+T" { ChangeTabSize; WinRefresh } item "E&xpand tabs\tC+O C+Tab" { ToggleExpandTabs; WinRefresh } item "&Insert tabulator\tS+Tab" { InsertTab } item "File Trim &EOL" { FileTrim; WinRefresh } item "I&ndent block\tAlt+\\" { BlockReIndent; FileTrim; WinRefresh } item "&Print to..." { SetPrintDevice } } menu Main { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } menu Local { item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "I&ndent block\tAlt+\\" { BlockReIndent; FileTrim; WinRefresh } item; item "&Save\tF2" { FileSave } item "Cl&ose\tAlt+Q" { FileClose } } menu DirectoryFile { item "&Selected\tEnter" { Activate } item; item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; item "Open &Binary" { FileOpenInMode 'BIN' } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu DirectoryMain { submenu "&File", DirectoryFile; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu MessagesMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu RoutinesMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu BufferListMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu EventMapViewMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu DirectoryLocal { item "&Open" { Activate } item; item "&Reload\tCtrl+R" { Rescan } item; item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } item "&/ Goto Dir\t/" { DirGoto } item; item "R&ename File" { RenameFile } item "&Make Directory" { MakeDirectory } item; item "Delete &File\tCtrl+D" { DeleteFile } } menu BufferListLocal { item "&View\tEnter" { Activate } item; item "&Save\tCtrl+S" { BufListFileSave } item "&Close\tCtrl+C" { BufListFileClose } } menu RoutinesLocal { item "&View\tEnter" { Activate } } menu EventMapViewLocal { item "&Close view\tAlt+Q" { FileClose } } menu MessagesLocal { item "&View error\tEnter" { Activate } item; item "&Previous error\tF11" { CompilePrevError } item "&Next error\tF12" { CompileNextError } } ����������������������������efte-1.1/config/m_asm.fte���������������������������������������������������������������������������0000664�0000764�0000764�00000014473�11157534024�014376� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# x86 instruction list now nearly complete, # also added floating point registers and some nasm directives # jsvendsen 07-24-2001 colorize ASM { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'mov', 'push', 'pop', 'popad', 'movzx', 'movsx', 'lea', 'hlt', 'sal', 'sar', 'shl', 'shr', 'and', 'or', 'xor', 'not', 'ibts', 'add', 'adc', 'adb', 'sub', 'sbb', 'neg', 'mul', 'div', 'idiv', 'imul', 'test', 'cmp', 'inc', 'dec', 'popa', 'popaw', 'popf', 'popfw', 'popfd', 'pusha', 'pushad', 'pushaw', 'pushf', 'pushfd', 'pushfw', 'scasd', 'scasw', 'scasb', 'movsd', 'movsw', 'movsb', 'stosd', 'stosw', 'stosb', 'out', 'outsd', 'outsw', 'outsb', 'in', 'insd', 'insw', 'insb', 'int', 'nop', 'rep', 'repz', 'repnz', 'repe', 'repne', 'int1', 'icepb', 'int01', 'int3', 'into', 'cld', 'clc', 'cli', 'clts', 'stc', 'aaa', 'aas', 'aam', 'aad', 'daa', 'das', 'arpl', 'bound', 'bsf', 'bswap', 'bt', 'btc', 'btr', 'bts', 'cbw', 'cwd', 'cdq', 'cwde', 'cmc', 'cpuid', 'emms', 'cmpsb', 'cmpsw', 'cmpsd', 'cmpxchg', 'cmpxchg486', 'cmpxchg8b', 'f2xm1', 'fabs', 'fadd', 'faddp', 'to', 'fbld', 'fbstp', 'fchs', 'fclex', 'fcmovb', 'fcmovbe', 'fcmove', 'fcmovnb', 'fcmovnbe', 'fcmovne', 'fcmovnu', 'fcmovu', 'fcom', 'fcomp', 'fcompp', 'fcomi', 'fcomip', 'fcos', 'fdecstp', 'fdisi', 'fndisi', 'feni', 'fneni', 'fdiv', 'fdivp', 'fdivr', 'fdivrp', 'fcos', 'ffree', 'fiadd', 'ficom', 'ficomp', 'fidiv', 'fidivr', 'fild', 'fist', 'fistp', 'fimul', 'fincstp', 'finit', 'fninit', 'fisub', 'fisubr', 'fld', 'fld1', 'fldl2e', 'fldl2t', 'fldlg2', 'fldln2', 'fldpi', 'fldz', 'fldcw', 'fldenv', 'fmul', 'fmulp', 'fnop', 'fpatan', 'fptan', 'fprem', 'fprem1', 'frndint', 'fsave', 'frstor', 'fscale', 'fsetpm', 'fsin', 'fsincos', 'fsqrt', 'fst', 'fstp', 'fstcw', 'fstenv', 'fnstenv', 'fsub', 'fsubr', 'fsubp', 'fsubrp', 'ftst', 'fucom', 'fucomp', 'fucompp', 'fucomi', 'fucomip', 'fxam', 'fxch', 'fxtract', 'fyl2x', 'fyl2xp1', 'invd', 'invlpg', 'lahf', 'lar', 'lds', 'les', 'lfs', 'lgs', 'lss', 'lgdt', 'lidt', 'lldt', 'sgdt', 'sidt', 'sldt', 'lmsw', 'smsw', 'loadall', 'loadall286', 'lsl', 'ltr', 'movd', 'movq', 'packssdw', 'packsswb', 'packuswb', 'paddb', 'paddw', 'paddd', 'paddsb', 'paddsw', 'paddusb', 'paddusw', 'paddsiw', 'pand', 'pandn', 'paveb', 'pcmpeqb', 'pcmpeqw', 'pcmpeqd', 'pcmpgtb', 'pcmpgtw', 'pcmpgtd', 'pdistib', 'pmachriw', 'pmulhriw', 'pmaddwd', 'pmagw', 'pmulhrw', 'pmulhw', 'pmullw', 'pmvzb', 'pmvnzb', 'pmvlzb', 'pmvgezb', 'por', 'psllw', 'pslld', 'psllq', 'psraw', 'psrad', 'psrlw', 'psrld', 'psrlq', 'psubb', 'psubw', 'psubd', 'psubsb', 'psubsw', 'psubusb', 'psubusw', 'psubsiw', 'punpckhbw', 'punpckhwd', 'punpckhdq', 'punpcklbw', 'punpcklwd', 'punpckldq', 'pxor', 'rcl', 'rcr', 'rdmsr', 'rdpmc', 'rdtsc', 'rol', 'ror', 'rsm', 'sahf', 'salc', 'shld', 'shrd', 'smi', 'stc', 'std', 'sti', 'str', 'umov', 'verr', 'verw', 'wait', 'wbinvd', 'wrmsr', 'xadd', 'xbts', 'xchg', 'xlatb', 'enter', 'leave', }; keyword 'Editor_Keywords3' { 'eax', 'ax', 'ah', 'al', 'ebx', 'bx', 'bh', 'bl', 'ecx', 'cx', 'ch', 'cl', 'edx', 'dx', 'dh', 'dl', 'si', 'di', 'esi', 'edi', 'cs', 'ss', 'ds', 'es', 'fs', 'gs', 'bp', 'ebp', 'sp', 'esp', 'ip', 'eip', 'st', 'st0', 'st1', 'st2', 'st3', 'st4', 'st5', 'st6', 'st7', }; keyword 'Editor_Keywords2' { 'call', 'ret', 'retf', 'retn', 'iret', 'iretw', 'iretd', 'jmp', 'je', 'jne', 'jz', 'jnz', 'jl', 'jle', 'jg', 'jge', 'jnge', 'jng', 'jnle', 'jnl', 'jb', 'jbe', 'ja', 'jae', 'jnae', 'jna', 'jnbe', 'jnb', 'jo', 'jns', 'jcxz', 'jecxz', 'loop', 'loope', 'loopz', 'loopne', 'loopnz', }; keyword 'Editor_Keywords4' { 'near', 'far', 'short', 'seg', 'offset', 'ptr', 'word', 'byte', 'dword', 'qword', 'dup', }; keyword 'Editor_Keywords5' { 'assume', 'label', 'group', 'if', 'ifdef', 'ifndef', 'endif', 'else', 'public', 'extrn', 'macro', 'endm', 'end', 'proc', 'endp', 'equ', 'define', 'segment', 'section', 'seg', 'wrt', 'ends', 'use32', 'use16', 'db', 'dw', 'dd', 'dq', 'dt', 'resb', 'resw', 'resd', 'resq', 'rest', 'model', 'ideal', 'codeseg', 'dataseg', 'stack', 'include', 'locals', 'incbin', 'bits', 'times' ,'org', }; h_state 0 { 'Normal' } h_trans { 5, '-s', 'a-zA-Z_$@', 'Normal' } h_trans { 1, '<', ';', 'Comment' } h_trans { 2, '<', '\'', 'String' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '-s', '0-9', 'Number' } h_trans { 0, 'S', 'a-zA-Z0-9_$@', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 2 { 'String' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '', '\'', 'String' } h_state 3 { 'String' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '', '"', 'String' } h_state 4 { 'Number' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, 's', 'Hh', 'Number' } h_trans { 0, '-S', '0-9A-Fa-f', 'Number' } h_state 5 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_$@' } } mode ASM: SOURCE { FileNameRx = /\.\cASM$/; HilitOn = 1; Colorizer = 'ASM'; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' ;'; CommentEnd = ''; } oinclude 'mym_asm.fte'; �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_mod3.fte��������������������������������������������������������������������������0000664�0000764�0000764�00000012712�11157534024�014452� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#From: Richard Glidden <rrglidden@uwaterloo.ca> # # I just spent an hour or so configuring FTE to recognize Modula-3. # This file is almost complete (there are two minor bugs - Keywords # immediately following punctuation don't highlight correctly, and # RoutineRegexp isn't set to recognize Procedures unless they start at # column 1), but I thought you'd like a copy of it anyway to include with # FTE. colorize MODULA3 { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Command', 'Lang_Assembler' }, # Pragma }; keyword 'Editor_Keywords' { 'ABS', 'ADDRESS', 'ADR', 'ADRSIZE', 'AND', 'ANY', 'ARRAY', 'AS', 'BEGIN', 'BITS', 'BITSIZE', 'BOOLEAN', 'BRANDED', 'BY', 'BYTESIZE', 'CARDINAL', 'CASE', 'CEILING', 'CHAR', 'CONST', 'DEC', 'DISPOSE', 'DIV', 'DO', 'ELSE', 'ELSIF', 'END', 'EVAL', 'EXCEPT', 'EXCEPTION', 'EXIT', 'EXPORTS', 'EXTENDED', 'FALSE', 'FINALLY', 'FIRST', 'FLOAT', 'FLOOR', 'FOR', 'FROM', 'GENERIC', 'IF', 'IMPORT', 'IN', 'INC', 'INTEGER', 'INTERFACE', 'ISTYPE', 'LAST', 'LOCK', 'LONGREAL', 'LOOP', 'LOOPHOLE', 'MAX', 'METHODS', 'MIN', 'MOD', 'MODULE', 'MUTEX', 'NARROW', 'NEW', 'NIL', 'NOT', 'NULL', 'NUMBER', 'OBJECT', 'OF', 'OR', 'ORD', 'OVERRIDES', 'PROCEDURE', 'RAISE', 'RAISES', 'READONLY', 'REAL', 'RECORD', 'REF', 'REFANY', 'REPEAT', 'RETURN', 'REVEAL', 'ROOT', 'ROUND', 'SET', 'SUBARRAY', 'TEXT', 'THEN', 'TO', 'TRUE', 'TRUNC', 'TRY', 'TYPE', 'TYPECASE', 'TYPECODE', 'UNSAFE', 'UNTIL', 'UNTRACED', 'VAL', 'VALUE', 'VAR', 'WHILE', 'WITH', }; # The following h_states are lengthy, but work VERY well. Unlike the # m_pascal.fte file (which m_modul3.fte is based on), punctuation # colours do not get 'stuck' on Normal text. # BUG: Keywords immediately following punctuation (ie: .IF) do not # highlight. Please add a space between all punctuation and keywords, # for now. h_state 0 { 'Normal' } h_trans { 2, '<', '"', 'String' } h_trans { 3, '<', '\'', 'String' } h_trans { 4, '<', '(*', 'Comment' } h_trans { 8, '<', '<*', 'Command' } h_trans { 5, '<', '2_', 'HexNumber' } h_trans { 5, '<', '3_', 'HexNumber' } h_trans { 5, '<', '4_', 'HexNumber' } h_trans { 5, '<', '5_', 'HexNumber' } h_trans { 5, '<', '6_', 'HexNumber' } h_trans { 5, '<', '7_', 'HexNumber' } h_trans { 5, '<', '8_', 'HexNumber' } h_trans { 5, '<', '9_', 'HexNumber' } h_trans { 5, '<', '10_', 'HexNumber' } h_trans { 5, '<', '11_', 'HexNumber' } h_trans { 5, '<', '12_', 'HexNumber' } h_trans { 5, '<', '13_', 'HexNumber' } h_trans { 5, '<', '14_', 'HexNumber' } h_trans { 5, '<', '15_', 'HexNumber' } h_trans { 5, '<', '16_', 'HexNumber' } h_trans { 6, '<-s', '0-9', 'Number' } h_trans { 1, '-s', 'a-zA-Z_', 'Normal' } h_trans { 0, 's', ' ', 'Normal' } h_trans { 7, 'S', '_a-zA-Z0-9 ', 'Punctuation' } h_state 1 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, '', 'a-zA-Z0-9_' } h_state 2 { 'String' } h_trans { 0, '>', '"', 'String' } h_trans { 0, '$', '', 'String' } h_state 3 { 'String' } h_trans { 0, '>', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 4 { 'Comment' } h_trans { 0, '>', '*)', 'Comment' } h_state 5 { 'HexNumber' } h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 6 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 7 { 'Punctuation' } h_trans { 2, '<', '"', 'String' } h_trans { 3, '<', '\'', 'String' } h_trans { 4, '<', '(*', 'Comment' } h_trans { 8, '<', '<*', 'Command' } h_trans { 5, '<', '2_', 'HexNumber' } h_trans { 5, '<', '3_', 'HexNumber' } h_trans { 5, '<', '4_', 'HexNumber' } h_trans { 5, '<', '5_', 'HexNumber' } h_trans { 5, '<', '6_', 'HexNumber' } h_trans { 5, '<', '7_', 'HexNumber' } h_trans { 5, '<', '8_', 'HexNumber' } h_trans { 5, '<', '9_', 'HexNumber' } h_trans { 5, '<', '10_', 'HexNumber' } h_trans { 5, '<', '11_', 'HexNumber' } h_trans { 5, '<', '12_', 'HexNumber' } h_trans { 5, '<', '13_', 'HexNumber' } h_trans { 5, '<', '14_', 'HexNumber' } h_trans { 5, '<', '15_', 'HexNumber' } h_trans { 5, '<', '16_', 'HexNumber' } h_trans { 0, 's', '_a-zA-Z ', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_trans { 7, '<s', '0-9', 'Number' } h_state 8 { 'Command' } h_trans { 0, '>', '*>', 'Command' } } mode MODULA3: SOURCE { # Modula-3 Mode FileNameRx = /\.\c{m3}|{i3}$/; HilitOn = 1; Colorizer = 'MODULA3'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' (*'; CommentEnd = '*)'; # Needs to be modified to allow PROCEDURE to start anywhere on a line, # not just column 1. RoutineRegexp = '^{PROCEDURE}'; } oinclude 'mym_mod3.fte'; ������������������������������������������������������efte-1.1/config/m_py.fte����������������������������������������������������������������������������0000664�0000764�0000764�00000026122�11163156165�014243� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # My python miscellany page is: http://www.vex.net/~x/python_stuff.html # Edited by Bastian Kleineidam <calvin@users.sourceforge.net> # # Small changes/fixes by Jon Svendsen (jsvendsen@bergen.frisurf.no) # # problems... # is block comment/uncomment possible via macro? # colorize PYTHON { SyntaxParser = "SIMPLE"; color { { "Normal", "Editor_Default" }, { "Keyword", "Editor_Keywords"}, { "Number", "Lang_DecimalNumber" }, { "HexNumber", "Lang_Number" }, { "Punctuation", "Lang_Punctuation" }, { "String", "Lang_String" }, { "Comment", "Lang_Comment" }, { "CPreprocessor", "Lang_Preprocessor" }, { "Function", "Lang_Function" }, { "Label", "Lang_Label" }, { "Command", "Lang_Command" }, # assembler }; # reserved words as of Python 2.5.2 # See http://www.python.org/doc/2.5.2/ref/keywords.html keyword "Editor_Keywords" { "and", "as", "assert", "break", "class", "continue", "def", "del", "elif", "else", "except", "exec", "finally", "for", "from", "global", "if", "import", "in", "is", "lambda", "not", "or", "pass", "print", "raise", "return", "try", "while", "with", "yield", }; # built-in functions as of Python 2.5.2 keyword "Editor_Keywords2" { # built-in functions # See http://www.python.org/doc/2.5.2/lib/built-in-funcs.html "__import__", "abs", "all", "any", "basestring", "bool", "callable", "chr", "classmethod", "cmp", "compile", "complex", "delattr", "dict", "dir", "divmod", "enumerate", "eval", "execfile", "file", "filter", "float", "frozenset", "getattr", "globals", "hasattr", "hash", "help", "hex", "id", "input", "int", "isinstance", "issubclass", "iter", "len", "list", "locals", "long", "map", "max", "min", "object", "oct", "open", "ord", "pow", "property", "range", "raw_input", "reduce", "reload", "repr", "reversed", "round", "set", "setattr", "slice", "sorted", "staticmethod", "str", "sum", "super", "tuple", "type", "unichr", "unicode", "vars", "xrange", "zip", # non-essential built-in functions # http://www.python.org/doc/2.5.2/lib/non-essential-built-in-funcs.html "apply", "buffer", "coerce", "intern", # Constants # http://www.python.org/doc/2.5.2/lib/node8.html "None", "True", "False", "NotImplemented", "Ellipsis", }; # standard modules as of Python 2.5.2 # See http://www.python.org/doc/2.5.2/lib/lib.html keyword "Editor_Keywords3" { # String Services "string", "re", "struct", "difflib", "fpformat", "StringIO", "cStringIO", "textwrap", "codecs", "encodings", "unicodedata", "stringprep", # Data types "datetime", "calendar", "collections", "heapq", "bisect", "array", "sets", "sched", "mutex", "Queue", "weakref", "UserDict", "UserList", "UserString", "types", "new", "copy", "pprint", "repr", # Numeric and Mathematical Modules "math", "cmath", "decimal", "random", "itertools", "functools", "operator", # Internet Data Handling "email", "mailcap", "mailbox", "mhlib", "mimetools", "mimetypes", "MimeWriter", "mimify", "multifile", "rfc822", "base64", "binhex", "binascii", "quopri", "uu", # Structured Markup Processing Tools "HTMLParser", "sgmllib", "htmllib", "htmlentitydefs", "xml.parsers.expat", "xml.dom", "xml.sax", "xml.etree", # File Formats "csv", "ConfigParser", "robotparser", "netrc", "xdrlib", # Cryptographic Services "hashlib", "hmac", "md5", "sha", # File and Directory Access "os.path", "fileinput", "stat", "statvfs", "filecmp", "tempfile", "glob", "fnmatch", "linecache", "shutil", "dircache", # Data Compression and Archiving "zlib", "gzip", "bz2", "zipfile", "tarfile", # Data Persistence "pickle", "cPickle", "copy_reg", "shelve", "marshal", "anydbm", "whichdb", "dbm", "gdbm", "dbhash", "bsddb", "dumbdbm", "sqlite3", # Generic Operating System Services "os", "time", "optparse", "getopt", "logging", "getpass", "curses", "platform", "errno", "ctypes", # Optional Operating System Services "select", "thread", "threading", "dummy_thread", "dummy_threading", "mmap", "readline", "rlcompleter", # Unix Specific Services "posix", "pwd", "spwd", "grp", "crypt", "dl", "termios", "tty", "pty", "fcntl", "pipes", "posixfile", "resource", "nis", "syslog", "commands", # Interprocess Communication and Networking "subprocess", "socket", "signal", "popen2", "asyncore", "asynchat", # Internet Protocols and Support "webbrowser", "cgi", "cgitb", "wsgiref", "urllib", "urllib2", "httplib", "ftplib", "gopherlib", "poplib", "imaplib", "nntplib", "smtplib", "smtpd", "telnetlib", "uuid", "urlparse", "SocketServer", "BaseHTTPServer", "SimpleHTTPServer", "CGIHTTPServer", "cookielib", "Cookie", "xmlrpclib", "SimpleXMLRPCServer", "DocXMLRPCServer", # Multimedia Services "audioop", "imageop", "aifc", "sunau", "wave", "chunk", "colorsys", "rgbimg", "imghdr", "sndhrd", "ossaudiodev",# # Graphical User Interfaces with Tk "Tkinter", "Tix", "ScrolledText", "turtle", "Idle", # Internationalization "gettext", "locale", # Program Frameworks "cmd", "shlex", # Development Tools "pydoc", "doctest", "unittest", "test", # The Python Profilers "profile", "cProfile", "hotshot", "timeit", "trace", # Python Runtime Services "sys", "__builtin__", "__main__", "warnings", "contextlib", "atexit", "traceback", "__future__", "gc", "inspect", "site", "user", "fpectl", # Custom Python Interpreters "code", "codeop", # Restricted Execution "rexec", # Importing Modules "imp", "zipimport", "pkgutil", "modulefinder", "runpy", # Python Language Services "parser", "symbol", "token", "keyword", "tokenize", "tabnanny", "pyclbr", "py_compile", "compileall", "dis", "pickletools", "distutils", # Miscellaneous Services "formatter", # SGI IRIX Specific Services "al", "AL", "cd", "fl", "FL", "flp", "fm", "gl", "DEVICE", "GL", "imgfile", "jpeg", # SunOS Specific Services "sunaudiodev", "SUNAUDIODEV", # MS Windows Specific Services "msilib", "msvcrt", "_winreg", "winsound", # Undocumented "bdb", "ihooks", "ntpath", "posixpath", "bsddb185", "audiodev", "linuxaudiodev", "sunaudio", "toaiff", "timing", "cl", "sv", }; # built-in exceptions as of Python 2.5.2 # See http://www.python.org/doc/2.5.2/lib/module-exceptions.html keyword "Editor_Keywords4" { # Exceptions "BaseException", "Exception", "StandardError", "ArithmeticError", "LookupError", "EnvironmentError", "AssertionError", "AttributeError", "EOFError", "FloatingPointError", "GeneratorExit", "IOError", "ImportError", "IndexError", "IndentationError", "KeyError", "KeyboardInterrupt", "MemoryError", "NameError", "NotImplementedError", "OSError", "OverflowError", "ReferenceError", "RuntimeError", "StopIteration", "SyntaxError", "SystemError", "SystemExit", "TypeError", "UnboundLocalError", "UnicodeError", "UnicodeEncodeError", "UnicodeDecodeError", "UnicodeTranslateError", "ValueError", "WindowsError", "ZeroDivisionError", # Warnings "Warning", "UserWarning", "DeprecationWarning", "PendingDeprecationWarning", "SyntaxWarning", "RuntimeWarning", "FutureWarning", "ImportWarning", "UnicodeWarning", }; keyword "Lang_Assembler" { "self", "spam", "monty", "python", "lemon_curry", "silly_walks", "Chapman", "Cleese", "Gilliam", "Idle", "Jones", "Palin", }; h_state 0 { "Normal" } h_trans { 13, "", "@", "Keyword" } h_trans { 8, "", "def ", "Keyword" } h_trans { 9, "", "class ", "Keyword" } h_trans { 1, "<", "#", "Comment" } h_trans { 2, "<i", `u"""`, "String" } h_trans { 2, "<i", `r"""`, "String" } h_trans { 2, "<", `"""`, "String" } h_trans { 10, "<i", "u'''", "String" } h_trans { 10, "<i", "r'''", "String" } h_trans { 10, "<", "'''", "String" } h_trans { 3, "<i", `u"`, "String" } h_trans { 3, "<i", `r"`, "String" } h_trans { 3, "<", `"`, "String" } h_trans { 4, "<i", "u'", "String" } h_trans { 4, "<i", "r'", "String" } h_trans { 4, "<", "'", "String" } h_trans { 5, "-s", "a-zA-Z_", "Normal" } h_trans { 6, "<", "0x", "HexNumber" } h_trans { 7, "<s", "0-9", "Number" } h_trans { 0, "S", "_a-zA-Z0-9", "Punctuation" } h_state 1 { "Comment" } h_trans { 0, "$", "", "Normal" } h_state 2 { "String" } h_trans { 2, ">", "\\\\", "String" } h_trans { 0, ">", `"""`, "String" } h_trans { 2, ">", `\\"`, "String" } h_state 3 { "String" } h_trans { 3, ">", "\\\\", "String" } #special case for strings like "\\" h_trans { 3, ">", `\\"`, "String" } h_trans { 11, ">", "\\", "String" } h_trans { 0, ">", `"`, "String" } h_trans { 0, "$", "", "String" } h_state 4 { "String" } h_trans { 4, ">", "\\\\", "String" } #special case for strings like "\\" h_trans { 4, ">", "\\'", "String" } h_trans { 12, ">", "\\", "String" } h_trans { 0, ">", "'", "String" } h_trans { 0, "$", "", "String" } h_state 5 { "Normal" } h_trans { 0, "$", "", "Normal" } h_wtype { 0, 0, 0, "i", "a-zA-Z0-9_" } h_state 6 { "HexNumber" } h_trans { 0, "-S", "0-9A-Fa-f", "Normal" } h_trans { 0, "$", "", "Normal" } h_state 7 { "Number" } h_trans { 0, "-S", "0-9", "Normal" } h_trans { 0, "$", "", "Normal" } h_state 8 { "Command" } h_trans { 0, "", "(", "Punctuation" } h_state 9 { "Command" } h_trans { 0, "", ":", "Punctuation" } h_state 10 { "String" } h_trans { 10, ">", "\\\\", "String" } h_trans { 10, ">", "\\'", "String" } h_trans { 0, ">", "'''", "String" } h_state 11 { "String" } h_trans { 3, ">", "", "String" } h_state 12 { "String" } h_trans { 4, ">", "", "String" } h_state 13 { "Command" } h_trans { 0, "", "(", "Punctuation" } h_trans { 0, "", " ", "Normal" } h_trans { 0, "$", "", "Normal" } } mode PYTHON: SOURCE { FileNameRx = /\.\cPY$/; HilitOn = 1; Colorizer = "PYTHON"; IndentMode = "PLAIN"; AutoIndent = 1; MultiLineHilit = 1; AutoHilitParen = 1; Trim = 1; SpaceTabs = 1; MatchCase = 1; FirstLineRx = `^\#\!.*python`; RoutineRegexp = `def[ ]+[^ ]`; SaveFolds = 2; # save fold info at end of line CommentStart = " #"; CommentEnd = ""; } oinclude "mym_py.fte"; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/pal_bluez.fte�����������������������������������������������������������������������0000664�0000764�0000764�00000012165�11212414105�015240� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# color palette (black background) # the color palette is the definition of the symbolic colors # that are used everywhere else in the configuration files # syntax of the color specification is: # # fore back # or # symbolic_fore:symbolic_back # or # symbolic color_palette { { 'ScrollBar_Arrows', 'black:darkCyan' }, { 'ScrollBar_Background', 'black:darkCyan' }, { 'ScrollBar_Slider', 'black:cyan' }, { 'Status_Normal', 'black:gray' }, { 'Status_Active', 'black:gray' }, { 'Message_Normal', 'Status_Normal' }, { 'Message_Error', 'white:darkRed' }, { 'Message_Bold', 'yellow:darkRed' }, { 'EntryField_Field', 'black:gray' }, { 'EntryField_Prompt', 'darkBlue:gray' }, { 'EntryField_Selection', 'white:darkBlue' }, { 'List_Status', 'black:gray' }, { 'List_Normal', 'gray:darkBlue' }, { 'List_Selected', 'black:darkCyan' }, { 'List_Hilited', 'white:darkBlue' }, { 'List_HilitSelect', 'black:darkCyan' }, { 'List_Marked', 'yellow:darkBlue' }, { 'List_MarkSelect', 'yellow:darkCyan' }, { 'List_MarkHilit', 'yellow:darkBlue' }, { 'List_MarkHilitSel', 'yellow:darkCyan' }, { 'ASCII_Chars', 'gray:darkBlue' }, { 'Menu_Background', 'black:gray' }, { 'Menu_ActiveItem', 'white:black' }, { 'Menu_ActiveChar', 'red:black' }, { 'Menu_NormalItem', 'black:gray' }, { 'Menu_NormalChar', 'darkRed:gray' }, { "Choice_Title", 'black:gray' }, { "Choice_Param", 'darkCyan:gray' }, { "Choice_Background", 'black:gray' }, { "Choice_ActiveItem", 'white:black' }, { "Choice_ActiveChar", 'red:black' }, { "Choice_NormalItem", 'black:gray' }, { "Choice_NormalChar", 'darkRed:gray' }, { "bg", 'gray:darkBlue' }, # background { "fg", 'gray:darkBlue' }, # foreground { 'Editor_Selected', 'black:gray' }, { 'Editor_Markers', 'darkCyan:bg' }, { 'Editor_FoundText', 'white:darkCyan' }, { 'Editor_Folds0', 'green:bg' }, { 'Editor_Folds1', 'blue:bg' }, { 'Editor_Folds2', 'magenta:bg' }, { 'Editor_Folds3', 'magenta:bg' }, { 'Editor_Folds4', 'magenta:bg' }, { 'Editor_HilitWord', 'red:bg' }, { 'Editor_Default', 'fg:bg' }, { 'Editor_Bold', 'cyan:bg' }, { 'Editor_Keywords', 'yellow:bg' }, { 'Editor_Keywords2', 'cyan:bg' }, { 'Editor_Keywords3', 'green:bg' }, { 'Editor_Keywords4', 'yellow:bg' }, { 'Editor_Keywords5', 'blue:bg' }, { 'Msg_Header', 'darkCyan:bg' }, { 'Msg_Quotes', 'green:bg' }, { 'Msg_Tag', 'white:bg' }, { 'Msg_Signature', 'darkCyan:bg' }, { 'Comment', 'white:bg' }, { 'String', 'green:bg' }, { 'Lang_Number', 'cyan:bg' }, { 'Lang_DecimalNumber', 'Lang_Number' }, { 'Lang_HexNumber', 'cyan:bg' }, { 'Lang_OctalNumber', 'cyan:bg' }, { 'Lang_BinaryNumber', 'cyan:bg' }, { 'Lang_Punctuation', 'darkMagenta:bg' }, { 'Lang_String', 'String' }, { 'Lang_Comment', 'Comment' }, { 'Lang_Preprocessor', 'darkGreen:bg' }, { 'Lang_Function', 'cyan:bg' }, { 'Lang_Label', 'red:bg' }, { 'Lang_Command', 'cyan:bg' }, { 'Lang_Regexp', 'magenta:bg' }, { 'Lang_Variable', 'gray:bg' }, { 'Lang_Control', 'darkCyan:bg' }, { 'Lang_Assembler', 'blue:bg' }, # embedded assembler (Pascal) { 'Markup_Default', 'gray:bg' }, { 'Markup_Punctuation', 'darkCyan:bg' }, { 'Markup_Symbol', 'green:bg' }, { 'Markup_String', 'String' }, { 'Markup_Comment', 'Comment' }, { 'Markup_Tag', 'cyan:bg' }, { 'Markup_Special', 'red:bg' }, { 'Markup_Control', 'magenta:bg' }, { 'Markup_Quotes', 'yellow:bg' }, { 'Markup_Math', 'red:bg' }, # diff/diff3 { 'DIFF_Old', 'brown:bg' }, { 'DIFF_New', 'yellow:bg' }, { 'DIFF_Changed', 'darkCyan:bg' }, # rcsmerge { 'MERGE_Changed', 'white:bg' }, { 'MERGE_Old', 'gray:bg' }, { 'MERGE_New', 'red:bg' }, { 'MERGE_Control', 'yellow:bg' }, } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_idl.fte���������������������������������������������������������������������������0000664�0000764�0000764�00000002501�11157534024�014353� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# IDL mode - Don Mahurin colorize IDL { SyntaxParser = 'C'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'struct', 'typedef', 'int', 'enum', 'char', 'void', 'long', 'const', 'float', 'short', 'union', 'double', 'public', 'signed', 'static', 'private', 'virtual', 'unsigned', 'bool', }; } mode IDL: C { # IDL Mode FileNameRx = /\.\c{IDL}$/; HilitOn = 1; Colorizer = 'IDL'; AutoIndent = 1; IndentMode = 'C'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /^\w[\w_:*&~]+[\w\\s_:*&~]@\(.*\){\s*\{}?\s*$/; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; } oinclude 'mym_idl.fte'; �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_eiffel.fte������������������������������������������������������������������������0000664�0000764�0000764�00000004624�11157534024�015045� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # eFTE mode for Eiffel # colorize Eiffel { SyntaxParser = "SIMPLE"; color { { "Normal", "Editor_Default" }, { "Function", "Lang_Function" }, { "Punctuation", "Lang_Punctuation" }, { "Number", "Lang_DecimalNumber" }, { "Comment", "Lang_Comment" }, { "String", "Lang_String" }, }; keyword "Editor_Keywords" { "indexing", "feature", "creation", "inherit", "insert", "class" }; keyword "Editor_Keywords2" { "end", "is", "do", "once", "deferred", "unique", "local", "agent", "create", "attribute", "unique", "expanded", "obsolete", "separate", "frozen", "prefix", "infix", "rename", "redefine", "undefine", "select", "export", "as", "all", "external", "alias", "if", "else", "elseif", "inspect", "when", "then", "require", "ensure", "check", "debug", "from", "until", "loop", "variant", "invariant", "rescue", "retry" }; keyword "Editor_Keywords3" { "and", "or", "xor", "implies", "not", "strip", "old", "$" }; h_state 0 { "Normal" } h_trans { 4, "-s", "A-Za-z0-9_", "Normal" } h_trans { 1, "", "--", "Comment" } h_trans { 2, "", "\"", "String" } h_trans { 3, "s", "0-9", "Number" } h_trans { 0, "S", "_a-zA-Z0-9", "Punctuation" } h_state 1 { "Comment" } h_trans { 0, "$", "", "Normal" } h_state 2 { "String" } h_trans { 0, "", "\"", "String" } h_trans { 2, "Qq", "%", "String" } h_state 3 { "Number" } h_trans { 0, "-S", "0-9", "Normal" } h_trans { 0, "$", "", "Normal" } h_state 4 { "Normal" } h_trans { 0, "$", "", "Normal" } h_wtype { 0, 0, 0, "", "A-Za-z0-9_" } } mode Eiffel: SOURCE { FileNameRx = `\.\c{e}$`; Colorizer = "Eiffel"; HilitOn = 1; IndentMode = "PLAIN"; MatchCase = 0; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = "--"; CommentEnd = ""; #RoutineRegexp = `^{mode}|{sub}|{menu}|{object}|{eventmap}|{colorize} `; # Indenting AutoIndent = 1; ExpandTabs = 1; TabSize = 4; SpaceTabs = 0; BackSpKillTab = 1; DeleteKillTab = 1; IndentWithTabs = 1; CursorThroughTabs = 0; } oinclude "mym_eiffel.fte"; ������������������������������������������������������������������������������������������������������������efte-1.1/config/ui_ne.fte���������������������������������������������������������������������������0000664�0000764�0000764�00000000401�11157534024�014363� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# NE include 'ui_m_ne.fte'; include 'ui_k_ne.fte'; include 'menu/m_c.fte'; include 'menu/m_html.fte'; include 'kbd/k_c.fte'; include 'kbd/k_java.fte'; include 'kbd/k_perl.fte'; include 'kbd/k_rexx.fte'; include 'kbd/k_fte.fte'; include 'kbd/k_html.fte'; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_a51.fte���������������������������������������������������������������������������0000664�0000764�0000764�00000011026�11157534024�014173� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# 8051 assembler mode colorize ASM51 { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'mov', 'push', 'pop', 'movc', 'movx', 'anl', 'da', 'orl', 'xrl', 'nop', 'add', 'addc', 'subb', 'mul', 'div', 'clr', 'setb', 'cpl', 'xch', 'xchd', 'inc', 'dec', 'rl', 'rlc', 'rrc', }; keyword 'Editor_Keywords3' { 'a', 'acc', 'b', 'dpl', 'dph', 'dptr', 'R0', 'R1', 'R2', 'R3', 'R4', 'R5', 'R6', 'R7', 'IE', 'IP', 'P0', 'P1', 'P2', 'P3', 'PCON', 'PSW', 'PSW', 'SBUF', 'SCON', 'SP', 'TCON', 'TH0', 'TH1', 'TL0', 'TL1', 'TMOD', 'T2CON', 'TH2', 'TL2', 'RCAP2H', 'RCAP2L', }; keyword 'Editor_Keywords4' { 'SM0', 'SM1', 'SM2', 'REN', 'TB8', 'RB8', 'TI', 'RI', 'E0', 'E1', 'E2', 'E3', 'E4', 'E5', 'E6', 'E7', 'F0', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'EA', 'ES', 'ET1', 'EX1', 'ET0', 'EX0', 'T2', 'T2EX', 'TF1', 'TR1', 'TF0', 'TR0', 'IE1', 'IT1', 'IE0', 'IT0', 'TF2', 'EXF2', 'RCLK', 'TCLK', 'EXEN2', 'TR2', 'C/T2', 'CP/RL2', 'P0.0', 'P0.1', 'P0.2', 'P0.3', 'P0.4', 'P0.5', 'P0.6', 'P0.7', 'P1.0', 'P1.1', 'P1.2', 'P1.3', 'P1.4', 'P1.5', 'P1.6', 'P1.7', 'P2.0', 'P2.1', 'P2.2', 'P2.3', 'P2.4', 'P2.5', 'P2.6', 'P2.7', 'P3.0', 'P3.1', 'P3.2', 'P3.3', 'P3.4', 'P3.5', 'P3.6', 'P3.7', }; # keyword '1C' { keyword 'Editor_Keywords2' { 'acall', 'lcall', 'ret', 'reti', 'jmp', 'jb', 'jnb', 'jc', 'jnc', 'jbc', 'ajmp', 'ljmp', 'sjmp', 'jz', 'jnz', 'cjne', 'djnz', }; keyword 'Editor_Keywords5' { 'cseg', 'dseg', 'dw', 'db', 'AND', 'OR', 'LE', 'GT', 'EQ', 'if', 'ifdef', 'ifndef', 'endif', 'else', 'public', 'extrn', 'macro', 'endm', 'end', 'org', 'proc', 'endp', 'equ', 'define', '$TT', '$DA', '$EJ', '$PW', 'db', 'dw', 'model', 'ideal', 'codeseg', 'dataseg', 'stack', 'include', 'locals', }; # keyword '1A' { # 'AND', 'OR', 'LE', 'GT', 'EQ', # 'if', 'ifdef', 'ifndef', 'endif', 'else', # 'public', 'extrn', # 'macro', 'endm', # 'end', 'org', # 'proc', 'endp', 'equ', 'define', # '$TT', '$DA', '$EJ', '$PW', # 'db', 'dw', # 'model', 'ideal', 'codeseg', 'dataseg', 'stack', 'include', 'locals', # }; h_state 0 { 'Normal' } h_trans { 5, '-s', 'a-zA-Z_$@', 'Normal' } h_trans { 1, '<', ';', 'Comment' } h_trans { 2, '<', '\'', 'String' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '-s', '0-9', 'Number' } h_trans { 0, 'S', 'a-zA-Z0-9_$@', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 2 { 'String' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '', '\'', 'String' } h_state 3 { 'String' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '', '"', 'String' } h_state 4 { 'Number' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, 's', 'Hh', 'Number' } h_trans { 0, '-S', '0-9A-Fa-f', 'Number' } h_state 5 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_$@' } } mode ASM51: SOURCE { # C/C++ Mode FileNameRx = /\.\c{a51}}$/; HilitOn = 1; Colorizer = 'ASM51'; AutoIndent = 1; IndentMode = 'C'; TabSize = 8; # think twice before changing this, historically # it's been known to cause a mess in sources ;-) SpaceTabs = 0; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; # RoutineRegexp = /^\w[\w_:*&~]+[\w\\s_:*&~]@\(.*\){\s*\{}?\s*$/; RoutineRegexp = /^\w[\w_:*&~]+[\w\s_:*&~]@\([^;]*$/; # RoutineRx ^\w[\w_:*&]+[\w\s_:*&]@\( # RoutineRx ^{[a-zA-Z0-9_:*&]#\s*}+\( SaveFolds = 2; # save fold info at end of line CommentStart = ' ;'; CommentEnd = ''; } oinclude 'mym_a51.fte'; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_tex.fte���������������������������������������������������������������������������0000664�0000764�0000764�00000031253�11157534024�014411� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������colorize TEX { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Comment', 'Lang_Comment' }, { 'Tag', 'Markup_Tag' }, { 'Special', 'Markup_Special' }, { 'Symbol', 'Markup_Symbol' }, { 'Quotes', 'Markup_Quotes' }, { 'Function', 'Markup_Math' }, }; keyword 'Editor_Keywords' { 'documentstyle', 'document', 'documentclass', 'pagestyle', 'pagenumbering', 'thispagestyle', 'title', 'author', 'date', 'maketitle', 'begin', 'end', 'part', 'chapter', 'section', 'subsection', 'subsubsection', 'paragraph', 'subparagraph', 'appendix', 'tableofcontents', 'listoffigures', 'listoftables', 'rm', 'em', 'bf', 'sc', 'it', 'sl', 'sf', 'tt', 'tiny', 'scriptsize', 'footnotesize', 'small', 'normalsize', 'large', 'Large', 'LARGE', 'huge', 'HUGE', 'bibitem', 'cite', 'label', 'ref', 'pageref', 'footnote', 'item', 'caption', 'kill', 'hline', 'cline', 'multicolumn', 'def', 'hspace', 'vspace', 'linebreak', 'nolinebreak', 'newpage', 'clearpage', 'pagebreak', 'nopagebreak', 'samepage', 'newcommand', 'renewcommand', 'newenvironment', 'newtheorem', 'newcounter', 'setcounter', 'addtocounter', 'value', 'stepcounter', # \the* 'newlength', 'setlength', 'addtolength', 'settowidth', 'textheight', 'textwidth', 'topmargin', 'hoffset', 'voffset', 'oddsidemargin', 'evensidemargin', 'mbox', 'makebox', 'fbos', 'framebox', 'newsavebox', 'sbox', 'savebox', 'usebox', 'raisebox', 'put', 'framebox', 'dashbox', 'line', 'vector', 'circle', 'oval', 'frame', 'shortstack', 'multiput', 'thinlines', 'thicklines', 'linethickness', 'font', 'magnification', 'magstephalf', 'magstep', 'hsize', 'vsize', 'voffset', 'hoffset', 'topskip', 'leftskip', 'rightskip', 'eject', 'vfill', 'eject', 'goodbreak', 'nobreak', 'nopagenumbers', 'headline', 'headheight', 'headsep', 'footnote', 'pageno', 'folio', 'par', 'parindent', 'noindent', 'break', 'hfill', 'break', 'line', 'rightline', 'centerline', 'includegraphics', 'enskip', 'hskip', 'hfil', 'hfill', 'hss', 'smallskip', 'vskip', 'vglue', 'vfil' ,'vfill', 'vss', 'baselineskip', 'parskip', 'topinsert', 'midinsert', 'handindent', 'footnote', 'hrule', 'vrule', 'leaders', 'hrulefill', 'settabs', 'haling', 'hbox', 'vbox', 'newbox', 'setbox', 'arccos', 'cos', 'csc', 'exp', 'ker', 'limsup', 'min', 'sinh', 'arcsin', 'cosh', 'deg', 'gcd', 'lg', 'ln', 'Pr', 'sup', 'arctan', 'cot', 'det', 'hom', 'lim', 'log', 'sec', 'tan', 'arg', 'coth', 'dim', 'inf', 'liminfo', 'max', 'sin', 'tanh', 'displaystyle', 'textstyle', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'varepsilon', 'zeta', 'eta', 'theta', 'vartheta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'o', 'pi', 'varpi', 'rho', 'varrho', 'sigma', 'varsigma', 'tau', 'upsilon', 'phi', 'varphi', 'chi', 'psi', 'omega', 'Gamma', 'Delta', 'Theta', 'Lambda', 'Xi', 'Pi', 'Sigma', 'Upsilon', 'Phi', 'Psi', 'Omega', 'aleph', 'hbar', 'imath', 'jmath', 'ell', 'wp', 'Re', 'Im', 'partial', 'infty', 'backslash', 'prime', 'emptyset', 'nabla', 'surd', 'triangle', 'angle', 'bot', 'top', 'forall', 'exists', 'neg', 'lnot', 'flat', 'natural', 'sharp', 'clubsuit', 'diamondsuit', 'heartsuit', 'spadesuit', 'pm', 'mp', 'setminus', 'cdot', 'times', 'ast', 'star', 'diamond', 'circ', 'bullet', 'triangleleft', 'cap', 'cup', 'uplus', 'sqcap', 'sqcup', 'amalg', 'div', 'wr', 'bigcirc', 'vee', 'lor', 'wedge', 'land', 'oplus', 'ominus', 'otimes', 'oslash', 'odot', 'dagger', 'ddagger', 'bigtriangleleft', 'bigtriangledown', 'sum', 'prod', 'coprod', 'int', 'oint', 'bigcap', 'bigcup', 'bigsqcup', 'bigvee', 'bigwedge', 'bigodot', 'bigotimes', 'bigoplus', 'biguplus', 'hat', 'acute', 'ddot', 'vec', 'check', 'grave', 'breve', 'tilde', 'dot', 'bar', 'widehat', 'widetilde', 'ldots', 'vdots', 'cdots', 'ddots', 'leq', 'le', 'prec', 'preceq', 'll', 'subset', 'subsetqe', 'supsetqe', 'in', 'vdash', 'smile', 'frown', 'geq', 'ge', 'succ', 'succeq', 'gg', 'supset', 'sqsubseteq', 'sqsupsetqe', 'ni', 'owns', 'dashv', 'mid', 'parallel', 'equiv', 'sim', 'simeq', 'asymp', 'approx', 'cong', 'bowtie', 'propto', 'models', 'doteq', 'perp', 'not', 'leftarrow', 'Leftarrow', 'gets', 'longleftarrow', 'Longleftarrow', 'rightarrow', 'Rightarrow', 'to', 'longrightarrow', 'Longrightarrow', 'leftrightarrow', 'Leftrightarrow', 'longleftrightarrow', 'Longleftrightarrow', 'mapsto', 'longmapsto', 'hookleftarrow', 'hookrightarrow', 'leftharpoonup', 'rightharpoonup', 'leftharpoondown', 'rightharpoondown', 'uparrow', 'Uparrow', 'downarrow', 'Downarrow', 'updownarrow', 'Updownarrow', 'nearrow', 'searrow', 'swarrow', 'nwarrow', 'lbrack', 'lfloor', 'rbrack', 'rfloor', 'lceil', 'lbrace', 'langle', 'rceil', 'rbrace', 'rangle', 'quad', 'qquad', 'Biggl', 'biggl', 'Bigl', 'bigl', 'bigr', 'Bigr', 'biggr', 'Biggr', 'lgroup', 'rgroup', 'langle', 'rangle', 'vert', 'Vert', 'uparrow', 'left', 'right', 'overline', 'overrightarrow', 'overleftarrow', 'overbrace', 'underbrace', 'atop', 'choose', 'brack', 'above', 'brace', 'pmatrix', 'matrix', 'bordermatrix', 'eqalign', 'eqno', 'eqalignno', 'quad', 'def', 'gdef', 'edef', 'newcount', 'advance', 'multiply', 'divide', 'number', 'romannumeral', 'newdimen', 'newread', 'openin', 'closein', 'input', 'endinput', 'newwrite', 'openouput', 'closeout', 'write', 'jobname', 'if', 'else', 'fi', 'ifx', 'ifeof', 'ifhmode', 'ifvmode', 'ifmmode', 'ifcat', 'ifnum', 'ifdim', 'ifodd', 'ifcase', 'or', 'loop', 'repeat', 'beginpicture', 'setcoordinatesystem', 'endpicture', 'plotheading', 'lines', 'putrule', 'linethickness', 'setlinear', 'setquadratic', 'sethistograms', 'setsolid', 'setdashes', 'setdots', 'setdashpattern', 'setplotsymbol', 'plot', 'arrow', 'put', 'multiput', 'circulararc', 'ellipticarc', 'startrotation', 'stoprotation', 'setshadegrid', 'setshadesymbol', 'shaderectangleson', 'sharerectanglesoff', 'vshade', 'setquadratic', 'hshade', 'setplotarea', 'inboundscheckon', 'inboundscheckoff', 'axis', 'setbox', 'endpicturesave', 'newdimen', 'Alph', 'AtBeginDocument', 'AtBeginDvi', 'AtEndDocument', 'AtEndOfPackage', 'Big', 'Bigg', 'Box', 'CheckCommand', 'ClassError', 'ClassInfo', 'ClassWarning', 'ClassWarningNoLine', 'DeclareErrorFont', 'DeclareFixedFont', 'DeclareFontEncoding', 'DeclareFontEncodingDefaults', 'DeclareFontFamily', 'DeclareFontShape', 'DeclareFontSubstitution', 'DeclareMathAccent', 'DeclareMathAlphabet', 'DeclareMathDelimiter', 'DeclareMathRadical', 'DeclareMathSizes', 'DeclareMathSymbol', 'DeclareMathVersion', 'DeclareOldFontCommand', 'DeclareOption', 'DeclarePreloadSizes', 'DeclareRobustCommand', 'DeclareSizeFunction', 'DeclareSymbolFont', 'DeclareSymbolFontAlphabet', 'DeclareTextAccent', 'DeclareTextAccentDefault', 'DeclareTextCommand', 'DeclareTextCommandDefault', 'DeclareTextComposite', 'DeclareTextCompositeCommand', 'DeclareTextFontCommand', 'DeclareTextSymbol', 'DeclareTextSymbolDefault', 'ExecuteOptions', 'IfFileExists', 'InputIfFileExists', 'Join', 'LoadClass', 'LoadClassWithOptions', 'MessageBreak', 'NeedsTeXFormat', 'OptionNotUsed', 'PackageError', 'PackageInfo', 'PackageWarning', 'PackageWarningNoLine', 'PassOptionsToClass', 'PassOptionsToPackage', 'ProcessOptions', 'ProvideTextCommand', 'ProvideTextCommandDefault', 'ProvidesFile', 'ProvidesPackage', 'RequirePackage', 'RequirePackageWithOptions', 'Roman', 'SetMathAlphabet', 'SetSymbolFont', 'TeX', 'TextSymbolUnavailable', 'UseTextAccent', 'UseTextSymbol', 'addcontentsline', 'addpenalty', 'addtocontents', 'addtoversion', 'addvspace', 'afterassignment', 'allocationnumber', 'allowbreak', 'alph', 'arrayrulewidth', 'arraystretch', 'baselinestretch', 'bezier', 'bfdefault', 'bfseries', 'bibcite', 'bibliography', 'bibliographystyle', 'big', 'bigbreak', 'bigg', 'bigskip', 'bigskipamount', 'bigskipamount', 'bmod', 'boldmath', 'buildrel', 'cases', 'catcode', 'center', 'centering', 'chardef', 'cleardoublepage', 'contentsline', 'countdef', 'cr', 'csname', 'depth', 'discretionary', 'displaymath', 'dospecials', 'dotfill', 'encodingdefault', 'endcsname', 'everycr', 'expandafter', 'expandafter', 'extracolsep', 'familydefault', 'familydefault', 'fbox', 'filbreak', 'flushleft', 'flushright', 'fmtname', 'fmtversion', 'fontencoding', 'fontfamily', 'fontseries', 'fontshape', 'footnotemark', 'footnoterule', 'footnotetext', 'frac', 'frenchspacing', 'fussy', 'futurelet', 'global', 'glossary', 'halign', 'height', 'hphantom', 'ifinner', 'immediate', 'include', 'includeonly', 'itdefault', 'iterate', 'kern', 'lastskip', 'leadsto', 'leavevmode', 'lefteqn', 'leftline', 'leftmark', 'let', 'lhd', 'liminf', 'lineskip', 'lower', 'lowercase', 'makeatletter', 'makeatother', 'makeglossary', 'makeindex', 'marginpar', 'markboth', 'markright', 'mathclose', 'mathop', 'mathopen', 'mathrel', 'mathstrut', 'mddefault', 'medbreak', 'medmuskip', 'medskip', 'mho', 'minipage', 'mskip', 'multispan', 'narrower', 'negthinspace', 'newfont', 'newhelp', 'newif', 'newinsert', 'newlabel', 'newlanguage', 'newline', 'newmathalphabet', 'newmuskip', 'newskip', 'newtoks', 'nocite', 'nocorrlist', 'noexpand', 'nointerlineskip', 'nolimits', 'nonfrenchspacing', 'nonumber', 'normalbaselines', 'normallineskip', 'normalmarginpar', 'null', 'numberline', 'obeylines', 'obeyspaces', 'offinterlineskip', 'onecolumn', 'openup', 'pagenumberin', 'parbox', 'penalty', 'phantom', 'pmod', 'protect', 'providecommand', 'raggedbottom', 'raggedleft', 'raggedright', 'refstepcounter', 'relax', 'removelastskip', 'renewenvironment', 'reversemarginpar', 'rhd', 'rightmark', 'rlap', 'rmdefault', 'roman', 'root', 'rq', 'rule', 'scdefault', 'secdef', 'selectfont', 'seriesdefault', 'settodepth', 'settoheight', 'sfdefault', 'shapedefault', 'showhyphens', 'showoutput', 'showoverfull', 'sldefault', 'sloppy', 'sloppypar', 'smallbreak', 'space', 'spacefactor', 'sqsubset', 'stackrel', 'stretch', 'strut', 'suppressfloats', 'symbol', 'tabskip', 'thanks', 'thefootnote', 'thickmuskip', 'thinmuskip', 'thinspace', 'today', 'tracingfonts', 'tracingoutput', 'trivlist', 'ttdefault', 'twocolumn', 'typein', 'typeout', 'unboldmath', 'undefinedpagestyle', 'underbar', 'underline', 'unlhd', 'unrhd', 'updefault', 'usecounter', 'usefont', 'usepackage', 'vcenter', 'verb', 'verbatim', 'vline', 'vphantom', 'width', 'wlog', 'xdef', }; h_state 0 { 'Normal' } h_trans { 1, '', '\\begin{verbatim}', 'Quotes' } h_trans { 2, '', '\\', 'Special' } h_trans { 0, 's', '{}', 'Special' } h_trans { 4, '', '$', 'Function' } h_trans { 5, '', '$$', 'Function' } h_trans { 3, '', '%', 'Comment' } h_state 1 { 'Quotes' } h_trans { 0, '', '\\end{verbatim}', 'Quotes' } h_state 2 { 'Tag' } h_trans { 0, 'S', 'a-zA-Z0-9_', 'Symbol' } h_wtype { 0, 0, 0, '', 'a-zA-Z0-9_' } h_state 3 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 4 { 'Function' } h_trans { 0, '', '$', 'Function' } h_state 5 { 'Function' } h_trans { 0, '', '$$', 'Function' } #h_state 5 { 0, 'i', 'a-zA-Z', 'Keyword' } #h_trans { 0, 'S', 'a-zA-Z', 'Normal' } #h_trans { 0, '$', '', 'Normal' } } mode TEX: MARKUP { FileNameRx = /\.\c{TEX}|{STY}|{CLS}|{CLO}|{LTX}|{FD}|{DTX}$/; HilitOn = 1; Colorizer = 'TEX'; MultiLineHilit = 1; RoutineRegexp = /^\s*\\(title)|(section)|(subsection)\s*\{/; SaveFolds = 2; # save fold info at end of line CommentStart = '%'; CommentEnd = ''; } oinclude 'mym_tex.fte'; �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/ab_rexx.fte�������������������������������������������������������������������������0000664�0000764�0000764�00000003017�11157534024�014722� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# FTE Abbrevs for REXX mode # by Michael DeBusk # debu4335@eclipsetel.com # Revision March 19, 2001 eventmap REXX { # Header Comment # Note: If the environment variable USER is set, # This macro will insert the contents after the # word "Author:" and leave the cursor after # "Purpose:". If it is not set, the macro will # fail after "Author:". abbrev 'headx' { KillWordPrev; REXX_Heading; Fail; # do not insert typed character } abbrev 'utilx' { KillWordPrev; REXX_RexxUtil; Fail; # do not insert typed character } %if(OS_OS2) abbrev 'sockx' { KillWordPrev; REXX_RxSock; Fail; # do not insert typed character } abbrev 'ftpx' { KillWordPrev; REXX_RxFTP; Fail; # do not insert typed character } %endif abbrev 'dox' { KillWordPrev; REXX_Do; Fail; # do not insert typed character } abbrev 'dux' { KillWordPrev; REXX_DoUntil; Fail; # do not insert typed character } abbrev 'dwx' { KillWordPrev; REXX_DoWhile; Fail; # do not insert typed character } abbrev 'dfx' { KillWordPrev; REXX_DoForever; Fail; # do not insert typed character } abbrev 'ifx' { KillWordPrev; REXX_If; Fail; # do not insert typed character } abbrev 'selx' { KillWordPrev; REXX_Select; Fail; # do not insert typed character } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_sl.fte����������������������������������������������������������������������������0000664�0000764�0000764�00000005066�11157534024�014232� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# SLang mode colorize sl { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, }; h_state 0 { 'Normal' } h_trans { 1, '', '%' , 'Comment' } h_trans { 2, '-s', 'a-zA-Z_', 'Normal' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '<', '\'', 'String' } h_trans { 5, '<', '0x', 'HexNumber' } h_trans { 6, '<s', '0-9', 'Number' } h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '$', '', 'Normal' } h_state 2 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, '', 'a-zA-Z0-9_' } h_state 3 { 'String' } h_trans { 0, '>', '"', 'String' } h_trans { 0, '$', '', 'String' } h_state 4 { 'String' } h_trans { 0, '>', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 5 { 'HexNumber' } h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 6 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } keyword 'Editor_Keywords' { # any missing ? 'and', 'or', 'not', 'xor', 'shl', 'shr', 'andelse', 'orelse', 'variable', 'if', 'else', '!if', 'switch', 'case', 'while', 'do', 'for', 'loop', 'forever', 'break', 'return', 'continue', 'define', 'return', 'EXIT_BLOCK', 'struct', 'typedef', 'ERROR_BLOCK' }; } mode sl: SOURCE { # SLang Mode FileNameRx = /\.\cSL$/; HilitOn = 1; Colorizer = 'sl'; AutoIndent = 1; IndentMode = 'sl'; TabSize = 3; # think twice before changing this, historically # it's been known to cause a mess in sources ;-) MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = '^define'; # RoutineRegexp = /^\w[\w_:*&~]+[\w\\s_:*&~]@\(.*\){\s*\{}?\s*$/; # RoutineRegexp = /^define \w[\w_:*&~]+[\w\s_:*&~]@\([^;]*$/; # RoutineRx ^\w[\w_:*&]+[\w\s_:*&]@\( # RoutineRx ^{[a-zA-Z0-9_:*&]#\s*}+\( SaveFolds = 2; # save fold info at end of line CommentStart = ' %'; CommentEnd = ''; } oinclude 'mym_sl.fte'; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_asm370.fte������������������������������������������������������������������������0000664�0000764�0000764�00000007320�11157534024�014621� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Contributed by: # # Michael Taylor # miket@pcug.org.au Michael_Taylor@splwg.com. # http://www.pcug.org.au/~miket/ colorize ASM370 { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; # assembler commands keyword 'Editor_Keywords' { 'a', 'ah', 'al', 'alr', 'ap', 'ar', 'b', 'bal', 'balr', 'bc', 'bcr', 'bct', 'bctr', 'be', 'bh', 'bhe', 'bl', 'ble', 'bne', 'bnh', 'bnl', 'bnlr', 'bnz', 'bnzr', 'br', 'bxhr', 'bxh', 'bxle', 'bxler', 'bzr', 'bz', 'bmr', 'bm', 'bor', 'bo', 'bnor', 'bno', 'bpr', 'bp', 'bnpr', 'bnp', 'c', 'cl', 'clc', 'cli', 'clr', 'clm', 'clcl', 'cp', 'cr', 'cs', 'cds', 'ch', 'cvb', 'cvd', 'd', 'dp', 'dr', 'ed', 'edmk', 'ex', 'ic', 'icm', 'l', 'la', 'lm', 'lr', 'ltr', 'lh', 'lcr', 'lnr', 'lpr', 'm', 'mc', 'mh', 'mp', 'mr', 'mvc', 'mvi', 'mvn', 'mvo', 'mvz', 'n', 'nc', 'ni', 'nr', 'o', 'or', 'oc', 'oi', 'pack', 's', 'sp', 'sr', 'srp', 'st', 'sll', 'srl', 'sh', 'stc', 'stcm', 'stck', 'sth', 'stm', 'spm', 'slda', 'srda', 'sra', 'sla', 'srdl', 'sldl', 'slr', 'sl', 'ts', 'tm', 'tr', 'trt', 'unpk', 'x', 'xr', 'xc', 'xi', 'zap' }; # define storage, define constant keyword 'Editor_Keywords2' { 'ds', 'dc' }; # assembler directives keyword 'Editor_Keywords3' { 'end', 'equ', 'csect', 'dsect', 'ltorg', 'org', 'using', 'drop', 'eject', 'title', 'copy', 'aif', 'anop', 'ago' }; # extended assmebler directives - used by MicroFocus 370 Assembler keyword 'Editor_Keywords4' { 'xdeco', 'xdeci', 'xdump', 'xprnt', 'xread' }; keyword 'Editor_Keywords5' { 'r0', 'r1', 'r2', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10', 'r11', 'r12', 'r13', 'r14', 'r15' }; h_state 0 { 'Normal' } h_trans { 5, '-s', 'a-zA-Z_$@', 'Normal' } h_trans { 1, '<', '*', 'Comment' } h_trans { 2, '<', '\'', 'String' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '-s', '0-9', 'Number' } h_trans { 0, 'S', 'a-zA-Z0-9_$@', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 2 { 'String' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '', '\'', 'String' } h_state 3 { 'String' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '', '"', 'String' } h_state 4 { 'Number' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, 's', 'Hh', 'Number' } h_trans { 0, '-S', '0-9A-Fa-f', 'Number' } h_state 5 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_$@' } } mode ASM370: SOURCE { FileNameRx = /\.\c{{CPY}|{MLC}}$/; HilitOn = 1; Colorizer = 'ASM370'; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = '*'; CommentEnd = ''; KeepBackups = 0; AutoIndent = 1; Trim = 1; } oinclude 'mym_asm370.fte'; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_icon.fte��������������������������������������������������������������������������0000664�0000764�0000764�00000005777�11163156165�014560� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # eFTE mode for Icon (http://www.cs.arizona.edu/icon/) # colorize ICON { SyntaxParser = "SIMPLE"; color { { "Normal", "Editor_Default" }, { "Function", "Lang_Function" }, { "Number", "Lang_DecimalNumber" }, { "Comment", "Lang_Comment" }, { "String", "Lang_String" }, { "Punctuation", "Lang_Punctuation" }, }; keyword "Editor_Keywords" { "break", "by", "case", "create", "default", "do", "else", "end", "every", "fail", "global", "if", "initial", "invocable", "link", "local", "next", "not", "of", "procedure", "record", "repeat", "return", "static", "suspend", "then", "to", "until", "while" }; keyword "Editor_Keywords2" { "&allocated", "&ascii", "&clock", "&collections", "&cset", "&current", "&date", "&dateline", "&digits", "&dump", "&e", "&error", "&errornumber", "&errortext", "&errorvalue", "&errout", "&fail", "&features", "&file", "&host", "&input", "&lcase", "&letters", "&level", "&line", "&main", "&null", "&output", "&phi", "&pi", "&pos", "&progname", "&random", "&regions", "&source", "&storage", "&subject", "&time", "&trace", "&ucase", "&version" }; keyword "Editor_Keywords3" { "$define", "$else", "$endif", "$error", "$ifdef", "$ifndef", "$include", "$line", "$undef", "_MACINTOSH", "_MSDOS", "_MSDOS_386", "_MS_WINDOWS_NT", "_OS2", "_UNIX", "_VMS", "_WINDOW_FUNCTIONS", "_MS_WINDOWS", "_X_WINDOW_SYSTEM", "_PIPES", "_SYSTEM_FUNCTION" }; h_state 0 { "Normal" } h_trans { 1, "-s", /_a-zA-Z&$/, "Normal" } h_trans { 2, "<", "#", "Comment" } h_trans { 3, "", "\"", "String" } h_trans { 4, "", "'", "String" } h_trans { 5, "s", "-+0-9eE+-", "Number" } h_trans { 0, "S", /_a-zA-Z0-9&$/, "Punctuation" } h_state 1 { "Normal" } h_trans { 0, "$", "", "Normal" } h_wtype { 1, 1, 0, "", /_a-zA-Z0-9&$/ } h_state 2 { "Comment" } h_trans { 0, "$", "", "String" } h_state 3 { "String" } h_trans { 0, "", "\"", "String" } h_trans { 0, "$", "", "String" } h_trans { 3, "Qq", "\\", "String" } h_state 4 { "String" } h_trans { 0, "", "'", "String" } h_trans { 0, "$", "", "String" } h_trans { 4, "Qq", "\\", "String" } h_state 5 { "Number" } h_trans { 0, "-S", "-+0-9eE+-", "Normal" } h_trans { 0, "$", "", "Normal" } } mode ICON: SOURCE { FileNameRx = /\c\.icn$/; HilitOn = 1; Colorizer = "ICON"; AutoIndent = 1; IndentMode = "PLAIN"; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 0; RoutineRegexp = /^\s*{{procedure}}\s+/; } oinclude 'mym_icon.fte'; �efte-1.1/config/m_pascal.fte������������������������������������������������������������������������0000664�0000764�0000764�00000012420�11157534024�015047� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ colorize PASCAL { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Command', 'Lang_Assembler' }, # assembler { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Keyword', 'Editor_Keywords' }, }; keyword 'Editor_Keywords' { 'program', 'const', 'type', 'var', 'begin', 'end', 'array', 'set', 'record', 'string', 'if', 'then', 'else', 'while', 'for', 'to', 'downto', 'do', 'with', 'repeat', 'until', 'case', 'of', 'goto', 'exit', 'label', 'procedure', 'function', 'nil', 'file', 'and', 'or', 'not', 'xor', 'div', 'mod', 'unit', 'uses', 'implementation', 'interface', 'asm', 'inline', 'object', 'constructor', 'destructor', 'inherited', 'except', 'finally', 'initialization', 'out', 'property', 'resourcestring', 'try', 'exports', 'library', 'packed', 'raise', 'as', 'class', 'dispinterface', 'in', 'shl', 'shr', 'threadvar', 'finalization', 'is', 'at', 'on', 'private', 'protected', 'public', 'published', 'automated', 'absolute', 'abstract', 'cdecl', 'contains', 'default', 'dispid', 'dynamic', 'export', 'external', 'far', 'assembler', 'virtual', 'near', 'forward', 'implements', 'index', 'message', 'name', 'nodefault', 'overload', 'override', 'package', 'pascal', 'read', 'readonly', 'register', 'reintroduce', 'requires', 'resident', 'safecall', 'stdcall', 'stored', 'write', 'writeonly', 'result', 'integer', 'cardinal', 'shortint', 'smallint', 'longint', 'int64', 'byte', 'word', 'longword', 'char', 'boolean', 'bytebool', 'wordbool', 'longbool', 'real48', 'single', 'smallword', 'double', 'extended', 'comp', 'currency', 'real', 'shortstring', 'ansistring', 'widestring', }; keyword 'Lang_DecimalNumber' { 'true', 'false', }; h_state 0 { 'Normal' } h_trans { 10, '<', '(*&', 'CPreprocessor' } h_trans { 10, '<', '(*$', 'CPreprocessor' } h_trans { 9, '<', '{&', 'CPreprocessor' } h_trans { 9, '<', '{$', 'CPreprocessor' } h_trans { 8, '', 'asm', 'Command' } # workaround for bug 854418 h_trans { 17, '<-x', /\c{while}|{if}|{until}|{not}|{and}|{or}|{xor}|{div}|{mod}\s*\(/, 'Keyword' } h_trans { 16, '<-x', /[_a-zA-Z0-9]+\s*\(/, 'Function' } h_trans { 5, '-s', 'a-zA-Z_', 'Normal' } h_trans { 11, '<', '//', 'Comment' } h_trans { 1, '<', '(*', 'Comment' } h_trans { 2, '<', '{', 'Comment' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '<', '\'', 'String' } h_trans { 6, '<', '0x', 'HexNumber' } h_trans { 6, '<', '$', 'HexNumber' } h_trans { 7, '<s', '0-9', 'Number' } h_trans { 15, '<', '#$', 'String' } h_trans { 14, '<', '#', 'String' } h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '>', '*)', 'Comment' } h_state 2 { 'Comment' } h_trans { 0, '>', '}', 'Comment' } h_state 3 { 'String' } h_trans { 0, '>', '"', 'String' } h_trans { 0, '$', '', 'String' } h_state 4 { 'String' } h_trans { 0, '>', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 5 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_' } h_state 6 { 'HexNumber' } h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 7 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 8 { 'Command' } h_trans { 0, '', 'end', 'Command' } h_trans { 12, '<', '(*', 'Comment' } h_trans { 13, '<', '{', 'Comment' } h_state 9 { 'CPreprocessor' } h_trans { 0, '>', '}', 'CPreprocessor' } h_state 10 { 'CPreprocessor' } h_trans { 0, '>', '*)', 'CPreprocessor' } h_state 11 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 12 { 'Comment' } h_trans { 8, '>', '*)', 'Comment' } h_state 13 { 'Comment' } h_trans { 8, '>', '}', 'Comment' } h_state 14 { 'String' } # character of the form #ddd h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 15 { 'String' } # character of the form #$xx h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 16 { 'Function' } h_trans { 0, '->', '(', 'Normal' } h_state 17 { 'Keyword' } h_trans { 0, '->', '(', 'Normal' } } mode PASCAL: SOURCE { # Pascal Mode FileNameRx = /\.\c{{PAS}|{PP}|{INC}}$/; HilitOn = 1; Colorizer = 'PASCAL'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 0; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' (*'; CommentEnd = '*)'; RoutineRegexp = '^{procedure}|{function}>'; } oinclude 'mym_pascal.fte'; ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_vhdl.fte��������������������������������������������������������������������������0000664�0000764�0000764�00000005632�11157534024�014550� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # eFTE mode for VHDL # colorize VHDL { SyntaxParser = "SIMPLE"; color { { "Normal", "Editor_Default" }, { "Function", "Lang_Function" }, { "Number", "Lang_DecimalNumber" }, { "Comment", "Lang_Comment" }, { "String", "Lang_String" }, { "Punctuation", "Lang_Punctuation" }, }; keyword "Editor_Keywords" { "abs", "access", "after", "alias", "all", "and", "architecture", "array", "assert", "attribute", "begin", "block", "body", "buffer", "bus", "case", "component", "configuration", "constant", "disconnect", "downto", "else", "elsif", "end", "entity", "exit", "file", "for", "function", "generate", "generic", "group", "guarded", "if", "impure", "in", "inertial", "inout", "is", "label", "literal", "loop", "map", "mod", "nand", "new", "next", "nor", "not", "null", "of", "on", "open", "or", "others", "out", "package", "port", "postponed", "procedure", "process", "protected", "pure", "range", "record", "register", "reject", "rem", "report", "return", "rol", "ror", "select", "severity", "signal", "shared", "sla", "sll", "sra", "srl", "subtype", "then", "to", "transport", "type", "unaffected", "units", "until", "variable", "wait", "when", "while", "with", "xnor", "xor" }; keyword "Editor_Keywords2" { "library", "use" }; keyword "Editor_Keywords3" { "boolean", "bit", "bit_vector", "std_ulogic", "std_ulogic_vector", "std_logic", "std_logic_vector", "integer", "natural", "real", "complex", "complex_vector", "complex_polar", "signed", "unsigned", "line", "text", "side", "width", "character", "string", "time" }; h_state 0 { "Normal" } h_trans { 1, "-s", "a-zA-Z_", "Normal" } h_trans { 2, "<", "--", "Comment" } h_trans { 3, "", "\"", "String" } h_trans { 4, "x", "'.'", "String" } h_trans { 5, "<s", "0-9", "Number" } h_trans { 0, "S", "_a-zA-Z0-9", "Punctuation" } h_state 1 { "Normal" } h_trans { 0, "$", "", "Normal" } h_wtype { 1, 1, 0, "", "a-zA-Z0-9_" } h_state 2 { "Comment" } h_trans { 0, "$", "", "String" } h_state 3 { "String" } h_trans { 0, "", "\"", "String" } h_trans { 0, "$", "", "String" } h_trans { 3, "Qq", "\\", "String" } h_state 4 { "String" } h_trans { 0, "", "", "String" } h_state 5 { "Number" } h_trans { 0, "-S", "0-9_", "Normal" } h_trans { 0, "$", "", "Normal" } } mode VHDL: SOURCE { FileNameRx = '\\.{vhdl}|{vhd}|{v93}|{v87}$'; Colorizer = "VHDL"; IndentMode = "PLAIN"; AutoIndent = 1; HilitOn = 1; MatchCase = 0; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = `^{{architecture}|{entity}} `; } oinclude "mym_vhdl.fte"; ������������������������������������������������������������������������������������������������������efte-1.1/config/pal_gray.fte������������������������������������������������������������������������0000664�0000764�0000764�00000012452�11157534024�015073� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# color palette (black background) # the color palette is the definition of the symbolic colors # that are used everywhere else in the configuration files # syntax of the color specification is: # # fore back # or # symbolic_fore:symbolic_back # or # symbolic color_palette { { 'ScrollBar_Arrows', 'black:gray' }, { 'ScrollBar_Background', 'gray:black' }, { 'ScrollBar_Slider', 'gray:black' }, { 'Status_Normal', 'black:darkCyan' }, { 'Status_Active', 'black:darkCyan' }, { 'Message_Normal', 'cyan:darkBlue' }, { 'Message_Error', 'white:darkBlue' }, { 'Message_Bold', 'white:darkRed' }, { 'EntryField_Field', 'cyan:darkBlue' }, { 'EntryField_Prompt', 'white:darkBlue' }, { 'EntryField_Selection', 'black:darkGreen' }, { 'List_Status', 'black:darkCyan' }, { 'List_Normal', 'black:white' }, { 'List_Selected', 'white:darkBlue' }, { 'List_Hilited', 'white:black' }, { 'List_HilitSelect', 'white:darkBlue' }, { 'List_Marked', 'yellow:black' }, { 'List_MarkSelect', 'yellow:darkBlue' }, { 'List_MarkHilit', 'yellow:black' }, { 'List_MarkHilitSel', 'yellow:darkBlue' }, { 'ASCII_Chars', 'gray:black' }, { 'Menu_Background', 'black:darkBlue' }, { 'Menu_ActiveItem', 'white:darkCyan' }, { 'Menu_ActiveChar', 'yellow:darkCyan' }, { 'Menu_NormalItem', 'white:darkBlue' }, { 'Menu_NormalChar', 'yellow:darkBlue' }, { "Choice_Title", 'white:darkBlue' }, { "Choice_Param", 'cyan:darkBlue' }, { "Choice_Background", 'gray:darkBlue' }, { "Choice_ActiveItem", 'black:darkGreen' }, { "Choice_ActiveChar", 'white:darkGreen' }, { "Choice_NormalItem", 'white:darkBlue' }, { "Choice_NormalChar", 'yellow:darkBlue' }, { "bg", 'black:gray' }, # background { "fg", 'black:gray' }, # foreground { 'Editor_Selected', 'black:darkCyan' }, { 'Editor_Markers', 'darkCyan:bg' }, { 'Editor_FoundText', 'white:darkRed' }, { 'Editor_Folds0', 'darkGreen:bg' }, { 'Editor_Folds1', 'darkBlue:bg' }, { 'Editor_Folds2', 'darkMagenta:bg' }, { 'Editor_Folds3', 'darkMagenta:bg' }, { 'Editor_Folds4', 'darkMagenta:bg' }, { 'Editor_HilitWord', 'darkRed:bg' }, { 'Editor_Default', 'fg:bg' }, { 'Editor_Bold', 'darkCyan:bg' }, { 'Editor_Keywords', 'red:bg' }, { 'Editor_Keywords2', 'green:bg' }, { 'Editor_Keywords3', 'darkGreen:bg' }, { 'Editor_Keywords4', 'brown:bg' }, { 'Editor_Keywords5', 'darkBlue:bg' }, { 'Msg_Header', 'darkCyan:bg' }, { 'Msg_Quotes', 'green:bg' }, { 'Msg_Tag', 'white:bg' }, { 'Msg_Signature', 'darkCyan:bg' }, { 'Comment', 'darkBlue:bg' }, { 'String', 'blue:bg' }, { 'Lang_Default', 'Editor_Default' }, { 'Lang_Number', 'blue:bg' }, { 'Lang_DecimalNumber', 'Lang_Number' }, { 'Lang_HexNumber', 'Lang_Number' }, { 'Lang_OctalNumber', 'Lang_Number' }, { 'Lang_BinaryNumber', 'Lang_Number' }, { 'Lang_Punctuation', 'Editor_Default' }, { 'Lang_String', 'String' }, { 'Lang_Comment', 'Comment' }, { 'Lang_Preprocessor', 'darkMagenta:bg' }, { 'Lang_Function', 'darkBlue:bg' }, { 'Lang_Label', 'darkRed:bg' }, { 'Lang_Command', 'darkGreen:bg' }, { 'Lang_Regexp', 'darkMagenta:bg' }, { 'Lang_Variable', 'darkBlue:bg' }, { 'Lang_Control', 'cyan:bg' }, { 'Lang_Assembler', 'darkBlue:bg' }, # embedded assembler (Pascal) { 'Markup_Default', 'Editor_Default' }, { 'Markup_Punctuation', 'darkCyan:bg' }, { 'Markup_String', 'String' }, { 'Markup_Symbol', 'green:bg' }, { 'Markup_Tag', 'cyan:bg' }, { 'Markup_Comment', 'Comment' }, { 'Markup_Special', 'red:bg' }, { 'Markup_Control', 'magenta:bg' }, { 'Markup_Quotes', 'yellow:bg' }, { 'Markup_Math', 'red:bg' }, # diff/diff3 { 'DIFF_Old', 'darkGray:bg' }, { 'DIFF_New', 'white:bg' }, { 'DIFF_Changed', 'darkRed:bg' }, # rcsmerge { 'MERGE_Changed', 'white:bg' }, { 'MERGE_Old', 'darkGray:bg' }, { 'MERGE_New', 'red:bg' }, { 'MERGE_Control', 'yellow:bg' }, } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/ui_k_joe.fte������������������������������������������������������������������������0000664�0000764�0000764�00000002733�11157534024�015062� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # My basic joe like keybindings # # Copyright (C) 2002 Elrond <Elrond@Wunder-Nett.org> # # The GNU General Public License applies. # eventmap MODEL { key [C+C] { FileClose } } eventmap PLAIN: MODEL { key [C+S-_] { Undo } key [C+^] { Redo } key [C+A] { MoveLineStart } key [C+C] { FileClose } key [C+D] { Delete } key [C+E] { MoveLineEnd } key [C+G] { MatchBracket } # key [C+K_/] { Filter_Block_Through_Command } key [C+K_Space] { ShowPosition } # joe shows more useful information key [C+K_.] { BlockIndent } key [C+K_,] { BlockUnindent } key [C+K_a] { LineCenter; MoveDown } key [C+K_b] { BlockBegin } key [C+K_c] { BlockCopy; BlockPaste } key [C+K_e] { FileOpen } key [C+K_f] { Find } # key [C+K_g] { make_win_greater } key [C+K_h] { BlockUnmark } # joe: help # key [C+K_i] { show_all_windows / show_one_window } # key [C+K_j] { fmtblk } key [C+K_k] { BlockEnd } key [C+K_C+K] { BlockEnd } key [C+K_l] { MoveToLine } key [C+K_m] { BlockCut; BlockPaste } key [C+K_C+M] { BlockCut; BlockPaste } key [C+K_n] { WinNext } # key [C+K_o] { Splitwindow } key [C+K_p] { WinPrev } key [C+K_r] { BlockRead } key [C+K_s] { FileSave } # key [C+K_t] { make_win_tinyer } key [C+K_u] { MoveFileStart } key [C+K_v] { MoveFileEnd } key [C+K_w] { BlockWrite } key [C+K_x] { FileCloseAll; } # Should not ask to save... key [C+K_y] { BlockKill } # or KillBlock ? key [C+L] { FindRepeat } key [C+Q_a] { FindReplace } key [C+Q_f] { Find } } �������������������������������������efte-1.1/config/m_tcl.fte���������������������������������������������������������������������������0000664�0000764�0000764�00000010720�11157534024�014367� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # TCL keyword highlighting (initial version) # # Contributor: Wirawan Purwanto <wirawan0@softhome.net> [2003-01-22] # Submitted to FTE community: 2003-05-20 # # NOTE: # All the keywords originally listed in this file were deleted: they # were 100% WRONG! They were SH keywords! # colorize TCL { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Comment', 'Lang_Comment' }, { 'String', 'Lang_String' }, { 'Punctuation', 'Lang_Punctuation' }, { 'Variable', 'Lang_Variable' }, { 'Directive', 'Lang_Preprocessor' }, { 'Special', 'Lang_Control' }, }; keyword 'Editor_Keywords' { 'after', 'append', 'apply', 'array', 'auto_execok', 'auto_import', 'auto_load', 'auto_mkindex', 'auto_mkindex_old', 'auto_qualify', 'auto_reset', 'bgerror', 'binary', 'break', 'catch', 'cd', 'chan', 'clock', 'close', 'concat', 'continue', 'dde', 'dict', 'encoding', 'eof', 'error', 'eval', 'exec', 'exit', 'expr', 'fblocked', 'fconfigure', 'fcopy', 'file', 'file', 'fileevent', 'flush', 'for', 'foreach', 'format', 'gets', 'glob', 'global', 'history', 'http', 'if', 'incr', 'info', 'interp', 'join', 'lappend', 'lassign', 'lindex', 'linsert', 'list', 'llength', 'load', 'lrange', 'lrepeat', 'lreplace', 'lreverse', 'lsearch', 'lset', 'lsort', 'memory', 'msgcat', 'my', 'name', 'namespace', 'next', 'open', 'package', 'parray', 'pid', 'pkg_mkIndex', 'platform', 'prefix', 'proc', 'puts', 'pwd', 'read', 'refchan', 'regexp', 'registry', 'regsub', 'rename', 'return', 'scan', 'seek', 'self', 'set', 'socket', 'source', 'split', 'string', 'subst', 'switch', 'tcltest', 'tclvars', 'tcl_endOfWord', 'tcl_findLibrary', 'tcl_startOfNextWord', 'tcl_startOfPreviousWord', 'tcl_wordBreakAfter', 'tcl_wordBreakBefore', 'tell', 'throw', 'time', 'tm', 'trace', 'transchan', 'try', 'unknown', 'unload', 'unset', 'update', 'uplevel', 'upvar', 'variable', 'vwait', 'while', 'zlib' }; # Namespaces keyword 'Editor_Keywords2' { 'oo', 'platform', 'pkg', 'tcl', 'mathfunc' }; # Functions under namespaces keyword 'Editor_Keywords3' { # oo 'class', 'copy', 'define', 'objdefine', 'object', # pkg 'create', # platform 'shell', # tcl::mathfunc 'abs', 'acos', 'asin', 'atan', 'atan2', 'bool', 'ceil', 'cos', 'cosh', 'double', 'entier', 'exp', 'floor', 'fmod', 'hypot', 'int', 'isqrt', 'log', 'log10', 'max', 'min', 'pow', 'pand', 'round', 'sin', 'sinh', 'sqrt', 'srand', 'tan', 'tanh', 'wide' }; # Variables keyword 'Editor_Keywords4' { 'auto_execs', 'auto_index', 'auto_noexec', 'auto_noload', 'auto_path', 'env', 'tcl_nonwordchars', 'tcl_wordchars' }; h_state 0 { 'Normal' } h_trans { 1, '-s', 'a-zA-Z0-9_', 'Normal' } h_trans { 5, '<', '$', 'Variable' } h_trans { 6, '<', '-', 'Directive' } h_trans { 7, '<', '.', 'Special' } h_trans { 2, '<', '#', 'Comment' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '<', '`', 'String' } h_trans { 0, 'S', 'a-zA-Z0-9_', 'Punctuation' } h_state 1 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, '', 'a-zA-Z0-9_' } h_state 2 { 'Comment' } h_trans { 0, '$', '', 'Normal' } h_state 3 { 'String' } h_trans { 0, '>', '"', 'String' } h_trans { 3, 'qQ', '\\', 'String' } h_state 4 { 'String' } h_trans { 0, '>', '`', 'String' } h_trans { 4, 'qQ', '\\', 'String' } h_state 5 { 'Variable' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '-S', 'a-zA-Z0-9_', 'Normal' } h_state 6 { 'Directive' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '-S', 'a-zA-Z0-9_', 'Normal' } h_state 7 { 'Special' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '-S', 'a-zA-Z0-9_', 'Normal' } } mode TCL: SOURCE { # TCL FileNameRx = /\.\ctcl$/; FirstLineRx = /^\#\![^ ]*{{wish>}|{tclsh>}}/; HilitOn = 1; Colorizer = 'TCL'; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' #'; CommentEnd = ''; } oinclude 'mym_tcl.fte'; ������������������������������������������������efte-1.1/config/m_fte.fte���������������������������������������������������������������������������0000664�0000764�0000764�00000020444�11177576123�014377� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������colorize FTE { SyntaxParser = 'FTE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Regexp', 'Lang_Regexp' }, { 'Punctuation', 'Lang_Punctuation' }, { 'Command', 'Lang_Command' }, { 'CPreprocessor', 'Lang_Preprocessor' }, }; keyword 'Editor_Keywords' { 'mode', 'object', 'key', 'keyword', 'color', 'menu', 'submenu', 'item', 'extern', 'include', 'oinclude', 'sub', 'eventmap', 'abbrev', 'colorize', 'h_state', 'h_trans', 'h_words', 'h_wtype', 'submenucond', 'color_palette', }; keyword 'Editor_Keywords2' { # macro commands 'Activate', 'ActivateInOtherWindow', 'ASCIITable', 'BackSpace', 'BlockBegin', 'BlockCaseDown', 'BlockCaseToggle', 'BlockCaseUp', 'BlockClear', 'BlockCopy', 'BlockCopyAppend', 'BlockCut', 'BlockCutAppend', 'BlockEnd', 'BlockEnTab', 'BlockExtendBegin', 'BlockExtendEnd', 'BlockIndent', 'BlockKill', 'BlockMarkColumn', 'BlockMarkFunction', 'BlockMarkLine', 'BlockMarkStream', 'BlockPaste', 'BlockPasteColumn', 'BlockPasteLine', 'BlockPasteStream', 'BlockPasteOver', 'BlockPrint', 'BlockRead', 'BlockReadColumn', 'BlockReadLine', 'BlockReadStream', 'BlockReIndent', 'BlockSelectLine', 'BlockSelectPara', 'BlockSelectWord', 'BlockSort', 'BlockSortReverse', 'BlockTrans', 'BlockTrim', 'BlockUnindent', 'BlockUnmark', 'BlockUnTab', 'BlockWrite', 'BufferViewNext', 'BufferViewPrev', 'BufListFileClose', 'BufListFileSave', 'Cancel', 'ChangeFlags', 'ChangeKeys', 'ChangeLeftMargin', 'ChangeMode', 'ChangeRightMargin', 'ChangeTabSize', 'CharCaseDown', 'CharCaseToggle', 'CharCaseUp', 'CharTrans', 'ChildClose', 'ClearMessages', 'ClipClear', 'CloseActivate', 'Compile', 'CompileNextError', 'CompilePrevError', 'CompleteWord', 'ConfigRecompile', 'Delete', 'DeleteFile', 'DesktopLoad', 'DesktopSave', 'DesktopSaveAs', 'DirOpen', 'DirGoUp', 'DirGoDown', 'DirGoRoot', 'DirGoto', 'ExitEditor', 'ExpandTemplate', 'Fail', 'FileClose', 'FileCloseAll', 'FileLast', 'FileNext', 'FileOpen', 'FileOpenInMode', 'FilePrev', 'FilePrint', 'FileReload', 'FileSave', 'FileSaveAll', 'FileSaveAs', 'FileTrim', 'FileWriteTo', 'Find', 'FindRepeat', 'FindRepeatOnce', 'FindRepeatReverse', 'FindReplace', 'FoldClose', 'FoldCloseAll', 'FoldCreate', 'FoldCreateAtRoutines', 'FoldCreateByRegexp', 'FoldDemote', 'FoldDestroy', 'FoldDestroyAll', 'FoldOpen', 'FoldOpenAll', 'FoldOpenNested', 'FoldPromote', 'FoldToggleOpenClose', 'FrameClose', 'FrameNew', 'FrameNext', 'FramePrev', 'GetString', 'GotoBookmark', 'GotoGlobalBookmark', 'HilitMatchBracket', 'HilitWord', 'IncrementalSearch', 'IndentFunction', 'InsertChar', 'InsertDate', 'InsertSpace', 'InsertSpacesToTab', 'InsertString', 'InsertTab', 'InsertUid', 'InsPrevLineChar', 'InsPrevLineToEol', 'KillBlock', 'KillBlockOrChar', 'KillBlockOrCharPrev', 'KillChar', 'KillCharPrev', 'KillLine', 'KillToLineEnd', 'KillToLineStart', 'KillWord', 'KillWordPrev', 'LineAdd', 'LineCaseDown', 'LineCaseToggle', 'LineCaseUp', 'LineCenter', 'LineDuplicate', 'LineIndent', 'LineInsert', 'LineJoin', 'LineNew', 'LineSplit', 'LineTrans', 'LineTrim', 'ListRoutines', 'LocalMenu', 'MakeDirectory', 'MainMenu', 'MatchBracket', 'MoveBeginLinePageFile', 'MoveBeginOrNonWhite', 'MoveBlockEnd', 'MoveBlockStart', 'MoveDown', 'MoveEndLinePageFile', 'MoveFileEnd', 'MoveFileStart', 'MoveFirstNonWhite', 'MoveFoldNext', 'MoveFoldPrev', 'MoveFoldTop', 'MoveFunctionNext', 'MoveFunctionPrev', 'MoveLastNonWhite', 'MoveLeft', 'MoveLineBottom', 'MoveLineCenter', 'MoveLineEnd', 'MoveLineStart', 'MoveLineTop', 'MoveNext', 'MoveNextEqualIndent', 'MoveNextTab', 'MovePageDown', 'MovePageEnd', 'MovePageLeft', 'MovePageRight', 'MovePageStart', 'MovePageUp', 'MovePrev', 'MovePrevEqualIndent', 'MovePrevPos', 'MovePrevTab', 'MoveRight', 'MoveSavedPos', 'MoveSavedPosCol', 'MoveSavedPosRow', 'MoveTabEnd', 'MoveTabStart', 'MoveToColumn', 'MoveToLine', 'MoveUp', 'MoveWordEndLeft', 'MoveWordEndNext', 'MoveWordEndPrev', 'MoveWordEndRight', 'MoveWordLeft', 'MoveWordNext', 'MoveWordPrev', 'MoveWordRight', 'PlaceBookmark', 'PlaceGlobalBookmark', 'PopGlobalBookmark', 'PushGlobalBookmark', 'Redo', 'RegExp', 'RemoveBookmark', 'RemoveGlobalBookmark', 'RenameFile', 'Rescan', 'RunCompiler', 'RunProgram', 'SavePos', 'ScrollDown', 'ScrollLeft', 'ScrollRight', 'ScrollUp', 'SearchWordPrev', 'SearchWordNext', 'SelfInsert', 'SetCIndentStyle', 'SetLeftMargin', 'SetPrintDevice', 'SetRightMargin', 'ShowEntryScreen', 'ShowHelp', 'ShowHelpWord', 'ShowKey', 'ShowMenu', 'ShowPosition', 'ShowVersion', 'SwitchTo', 'TagClear', 'TagFind', 'TagFindWord', 'TagGoto', 'TagLoad', 'TagNext', 'TagPop', 'TagPrev', 'ToggleAutoIndent', 'ToggleBackSpKillTab', 'ToggleBackSpUnindents', 'ToggleDeleteKillTab', 'ToggleExpandTabs', 'ToggleHilitTags', 'ToggleIndentWithTabs', 'ToggleInsert', 'ToggleKeepBackups', 'ToggleMakeBackups', 'ToggleMatchCase', 'ToggleReadOnly', 'ToggleShowBookmarks', 'ToggleShowMarkers', 'ToggleShowTabs', 'ToggleSpaceTabs', 'ToggleSysClipboard', 'ToggleTrim', 'ToggleUndo', 'ToggleWordWrap', 'TypeChar', 'Undo', 'ViewBuffers', 'RunCvs', 'RunCvsCommit', 'Cvs', 'CvsDiff', 'ViewCvs', 'ViewCvsDiff', 'ViewCvsLog', 'ClearCvsMessages', 'RunSvn', 'RunSvnCommit', 'Svn', 'SvnDiff', 'ViewSvn', 'ViewSvnDiff', 'ViewSvnLog', 'ClearSvnMessages', 'ViewMessages', 'ViewModeMap', 'WinClose', 'WinHSplit', 'WinNext', 'WinPrev', 'WinRefresh', 'WinResize', 'WinZoom', 'WrapPara' }; keyword 'Editor_Keywords3' { 'Abbreviations', 'AddCR', 'AddLF', 'AutoHilitParen', 'AutoIndent', 'BackSpKillBlock', 'BackSpKillTab', 'BackSpUnindents', 'BackupDirectory', 'C_BraceOfs', 'C_CaseDelta', 'C_CaseOfs', 'C_ClassDelta', 'C_ClassOfs', 'C_ColonOfs', 'C_CommentDelta', 'C_CommentOfs', 'C_Continuation', 'C_FirstLevelIndent', 'C_FirstLevelWidth', 'C_Indent', 'C_ParenDelta', 'Colorizer', 'CommentEnd', 'CommentStart', 'CompileCommand', 'CompileRx', 'CompletionFilter', 'CursorBlink', 'CursorInsertMask', 'CursorOverMask', 'CursorThroughTabs', 'CursorWithinEOL', 'CvsCommand', 'CvsIgnoreRx', 'DefaultModeName', 'DefFindOpt', 'DefFindReplaceOpt', 'DeleteKillBlock', 'DeleteKillTab', 'DetectLineSep', 'ExpandTabs', 'FileNameRx', 'FirstLineRx', 'ForceNewLine', 'FunctionUsesContinuation', 'HelpCommand', 'HilitOn', 'HilitTags', 'IgnoreBufferList', 'IndentMode', 'IndentWithTabs', 'Insert', 'InsertKillBlock', 'KeepBackups', 'KeepHistory', 'KeepMessages', 'LeftMargin', 'LineChar', 'LoadDesktopOnEntry', 'LoadMargin', 'MakeBackups', 'MatchCase', 'MultiLineHilit', 'OpenAfterClose', 'PersistentBlocks', 'PMDisableAccel', 'PrintDevice', 'ReadOnly', 'ReassignModelIds', 'RecheckReadOnly', 'REXX_Do_Offset', 'REXX_Indent', 'RightMargin', 'RoutineRegexp', 'SaveBookmarks', 'SaveDesktopOnExit', 'SaveFolds', 'ScrollBorderX', 'ScrollBorderY', 'ScrollJumpX', 'ScrollJumpY', 'SeeThruSel', 'SelectPathname', 'ShowHScroll', 'ShowMarkers', 'ShowMenuBar', 'ShowTabs', 'ShowToolBar', 'ShowVScroll', 'SpaceTabs', 'StripChar', 'SvnCommand', 'SvnIgnoreRx','SyntaxParser', 'SysClipboard', 'TabSize', 'Trim', 'TrimOnSave', 'UndoLimit', 'UndoMoves', 'WeirdScroll', 'WordChars', 'WordWrap', 'XShellCommand' }; } mode FTE: SOURCE { FileNameRx = /\.\cfte$/; HilitOn = 1; Colorizer = 'FTE'; IndentMode = 'C'; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' #'; CommentEnd = ''; RoutineRegexp = /^{mode}|{sub}|{menu}|{object}|{eventmap}|{colorize}\s+/; } oinclude 'mym_fte.fte'; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_ebnf.fte��������������������������������������������������������������������������0000664�0000764�0000764�00000001657�11157534024�014530� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������colorize EBNF { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'String', 'Lang_String' }, { 'Symbol', 'Lang_Function' }, { 'Punctuation', 'Lang_Punctuation' }, { 'Comment', 'Lang_Comment' }, }; h_state 0 { 'Normal' } h_trans { 1, '', '#', 'Comment' } h_trans { 2, '<', '"', 'String' } h_trans { 0, 's', '.|{}=[]()', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '$', '', 'Normal' } h_state 2 { 'Symbol' } h_trans { 0, '>', '"', 'String' } h_trans { 0, '$', '', 'String' } h_trans { 2, 'Qq', '\\', 'Symbol' } } mode EBNF: PLAIN { FileNameRx = '\\.\\c{EBNF}$'; Colorizer = 'EBNF'; HilitOn = 1; AutoIndent = 1; IndentMode = 'PLAIN'; MultiLineHilit = 1; AutoHilitParen = 1; } oinclude 'mym_ebnf.fte'; ���������������������������������������������������������������������������������efte-1.1/config/m_c.fte�����������������������������������������������������������������������������0000664�0000764�0000764�00000006062�11157534024�014033� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# C mode colorize C { SyntaxParser = 'C'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { # any missing ? # standard C keywords 'asm', 'break', 'case', 'const', 'continue', 'default', 'do', 'else', 'enum', 'extern', 'for', 'goto', 'if', 'inline', 'return', 'sizeof', 'struct', 'switch', 'typedef', 'union', 'while', # C++ keywords 'catch', 'class', 'const_cast', 'delete', 'dynamic_cast', 'export', 'except', 'explicit', 'friend', 'finally', 'namespace', 'new', 'operator', 'private', 'protected', 'public', 'reinterpret_cast', 'static_cast', 'template', 'this', 'throw', 'try', 'typeid', 'type_info', 'typename', 'typeof', 'using', 'virtual', 'and', 'and_eq', 'bad_cast', 'bad_typeid', 'bitand', 'bitor', 'compl', 'not', 'not_eq', 'or', 'or_eq', 'xor', 'xor_eq', # types 'auto', 'char', 'double', 'float', 'int', 'int16_t', 'int32_t', 'int64_t', 'int8_t', 'long', 'off_t', 'ptrdiff_t', 'register', 'short', 'signed', 'size_t', 'ssize_t', 'static', 'time_t', 'uint', 'uint16_t', 'uint32_t', 'uint64_t', 'uint8_t', 'unsigned', 'void', 'volatile', # types C++ 'mutable', 'bool', # wide char (from new C/C++ 1998/1999 standards): 'wchar_t', 'cdecl', 'pascal', '_asm', '__asm', '_far16', '__far16', '_pascal', '_cdecl', '__cdecl', '_export', '__pascal', '_stdcall', '_syscall', '__stdcall', '__syscall', '_fastcall', '__fastcall', '__export', # some gcc extensions '__asm__', '__attribute__', '__format__', '__printf__', }; # show these as numbers # True, TRUE, False, FALSE, NULL are commonly defined values # but they are not part of C lang keyword 'Lang_DecimalNumber' { 'true', 'True', 'TRUE', 'false', 'False', 'FALSE', 'NULL', }; } mode C: SOURCE { # C/C++ Mode FileNameRx = /\.\c{c|h|{cpp}|{cxx}|{hpp}|{cc}|{cu}|m|{mm}|{xs}}$/; HilitOn = 1; Colorizer = 'C'; AutoIndent = 1; IndentMode = 'C'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; # RoutineRegexp = /^\w[\w_:*&~]+[\w\\s_:*&~]@\(.*\){\s*\{}?\s*$/; RoutineRegexp = /^\w[\w_:*&~]+[\w\s_:*&~]@\([^;]*$/; # RoutineRx ^\w[\w_:*&]+[\w\s_:*&]@\( # RoutineRx ^{[a-zA-Z0-9_:*&]#\s*}+\( SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; %if(UI_KB) TabSize = 8; # think twice before changing this, historically # it's been known to cause a mess in sources ;-) SpaceTabs = 0; IndentWithTabs = 1; CursorThroughTabs = 1; DeleteKillTab = 0; DeleteKillBlock = 0; BackSpKillTab = 0; BackSpUnindents = 0; Abbreviations = 1; UndoMoves = 0; %endif } oinclude 'mym_c.fte'; ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/pal_base.fte������������������������������������������������������������������������0000664�0000764�0000764�00000002156�11157534024�015043� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# The basic symbol names for all colors. # # written by Elrond <Elrond@Wunder-Nett.org> # the color palette is the definition of the symbolic colors # that are used everywhere else in the configuration files # syntax of the color specification is: # # fore back # or # symbolic_fore:symbolic_back # or # symbolic color_palette { # map system colors to symbolic { 'black', '0 0' }, { 'darkBlue', '1 1' }, { 'darkGreen', '2 2' }, { 'darkCyan', '3 3' }, { 'darkRed', '4 4' }, { 'darkMagenta', '5 5' }, { 'brown', '6 6' }, { 'gray', '7 7' }, { 'darkGray', '8 8' }, { 'blue', '9 9' }, { 'green', 'A A' }, { 'cyan', 'B B' }, { 'red', 'C C' }, { 'magenta', 'D D' }, { 'yellow', 'E E' }, { 'white', 'F F' }, } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_msg.fte���������������������������������������������������������������������������0000664�0000764�0000764�00000001232�11157534024�014371� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ colorize MSG { SyntaxParser = 'MSG'; color { { 'Normal', 'Editor_Bold' }, { 'Header', 'Msg_Header' }, { 'Quotes', 'Msg_Quotes' }, { 'Tag', 'Msg_Tag' }, { 'Control', 'Msg_Signature' }, }; } mode MSG: TEXT { # EMail messages FileNameRx = /\c{\.{MSG}|{YEP}|{SND}}|{^SLRN.\d+}|{{\.{article}|{letter}}|{snd}\.\d+}$/; # try also 1 WordWrap = 1; # automagic wordwrap HilitOn = 1; # enable highlight Colorizer = 'MSG'; # Highilight messages RoutineRegexp = /^Subject:/; } oinclude 'mym_msg.fte'; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/ab_c.fte����������������������������������������������������������������������������0000664�0000764�0000764�00000003577�11157534024�014171� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# c language templates eventmap C { # these work well for default indentation settings # changes may be necessary if you use different indentation # typical usage would be typing ifx and <space>. # useful command here is <A+Enter> which adds # a new line after the current one, and indents it properly. # in cmode defined as LineAdd; LineIndent; abbrev 'ifx' { KillWordPrev; %if(BSD_BRACE) InsertString 'if ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'if () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; # do not insert typed character } abbrev 'whx' { KillWordPrev; %if(BSD_BRACE) InsertString 'while ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'while () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; } abbrev 'swx' { KillWordPrev; %if(BSD_BRACE) InsertString 'switch ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'switch () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; } abbrev 'cax' { KillWordPrev; InsertString 'case :'; LineIndent; LineNew; InsertString 'break;'; LineIndent; MoveUp; MoveLineEnd; MovePrev; Fail; } abbrev 'dex' { KillWordPrev; InsertString 'default:'; LineIndent; 2:LineNew; InsertString 'break;'; LineIndent; MoveUp; LineIndent; Fail; } } ���������������������������������������������������������������������������������������������������������������������������������efte-1.1/config/m_siod.fte��������������������������������������������������������������������������0000664�0000764�0000764�00000015322�11157534024�014546� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# From: Keith Humphreys <keith@ViaThe.Net> # # FTE is wonderful. # Several months ago I was looking at SIOD, and I hacked a "fte config" file # which is 98% accurate. :-) # # Anyway, as it might be of use, here it is: # ! colors probably need fixing --Mark colorize SIOD { SyntaxParser = 'SIMPLE'; # 0, 8 - black # 1, 9 - blue # 2, A - green # 3, B - cyan # 4, C - red # 5, D - magenta # 6, E - orange # 7, F - white color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Symbol', 'Lang_Command' }, { 'Comment', 'Lang_Comment' }, { 'Special', 'Lang_Control' }, }; # Hmmm, it appears that exit and quit aren't even recommended! keyword 'Editor_Keywords4' { #Scheme's essential procedures:. 'abs', 'alarm', 'and', 'append', 'apply', 'ass', 'assoc', 'assq', 'assv', 'base64decode', 'base64encode', 'begin', 'caaar', 'caadr', 'caar', 'cadar', 'caddr', 'cadr', 'car', 'cdaar', 'cdadr', 'cdar', 'cddar', 'cdddr', 'cddr', 'cdr', 'cond', 'cons-array', 'define', 'eq?', 'equal?', 'eqv?', 'eval', 'exec', 'exit', 'fclose', 'fopen', 'if', 'lambda', 'length', 'let', 'let*', 'letrec', 'list', 'load', 'max', 'min', 'member', 'memq', 'memv', 'nil', 'not', 'null?', 'number?', 'number->string', 'or', 'pair?', 'quit', 'quote', 'set!', 'set-car!', 'set-cdr!', 'string->number', 'string-length', 'string?', 'string-append', 'substring', 'symbol?', 'read', 'reverse', }; keyword 'Lang_Function' { #These are recommended by the standard. 'acos', 'asin', 'atan', 'cos', 'exp', 'log', 'sin', 'tan', 'sqrt', }; #note: varables t, nil have been removed from the standard, # but are here. keyword 'Editor_Keywords' { #These are siod extras. '%%%memref', '%%closure', '%%closure-code', '%%closure-env', '%%stack-limit', '*after-gc*', '*args*', '*catch', '*env*', '*eval-history-ptr*', '*pi*', '*plists*', '*throw', '*traced*', 'F_GETLK', 'F_SETLK', 'F_SETLKW', 'access-problem?', 'allocate-heap', 'apropos', 'aref', 'array->hexstr', 'aset', 'ash', 'atan2', 'benchmark-eval', 'benchmark-funcall1', 'benchmark-funcall2', 'bit-and', 'bit-not', 'bit-or', 'bit-xor', 'butlast', 'bytes-append', 'chdir', 'chmod', 'chown', 'closedir', 'copy-list', 'cpu-usage-limits', 'crypt', 'current-resource-usage', 'datlength', 'datref', 'decode-file-mode', 'delete-file', 'delq', 'encode-file-mode', 'encode-open-flags', 'endpwent', 'env-lookup', 'eof-val', 'errobj', 'error', 'fast-load', 'fast-print', 'fast-read', 'fast-save', 'fchmod', 'fflush', 'file-times', 'first', 'fmod', 'fnmatch', 'fork', 'fread', 'fseek', 'fstat', 'ftell', 'fwrite', 'gc', 'gc-info', 'gc-status', 'get', 'getc', 'getcwd', 'getenv', 'getgid', 'getgrgid', 'getpass', 'getpgrp', 'getpid', 'getppid', 'getpwent', 'getpwnam', 'getpwuid', 'gets', 'getuid', 'gmtime', 'hexstr->bytes', 'href', 'hset', 'html-encode', 'intern', 'kill', 'larg-default', 'last', 'last-c-error', 'lchown', 'link', 'lkey-default', 'load-so', 'localtime', 'lref-default', 'lstat', 'make-list', 'mapcar', 'md5-final', 'md5-init', 'md5-update', 'mkdatref', 'mkdir', 'mktime', 'nconc', 'nice', 'nreverse', 'nth', 'opendir', 'os-classification', 'parse-number', 'pclose', 'popen', 'pow', 'prin1', 'print', 'print-to-string', 'prog1', 'putc', 'putenv', 'putprop', 'puts', 'qsort', 'rand', 'random', 'read-from-string', 'readdir', 'readline', 'readlink', 'realtime', 'rename', 'require', 'require-so', 'rest', 'rld-pathnames', 'rmdir', 'runtime', 'save-forms', 'sdatref', 'set-eval-history', 'set-symbol-value!', 'setprop', 'setpwent', 'setuid', 'siod-lib', 'sleep', 'so-ext', 'srand', 'srandom', 'stat', 'strbreakup', 'strcat', 'strcmp', 'strcpy', 'strcspn', 'strftime', 'string-dimension', 'string-downcase', 'string-lessp', 'string-search', 'string-trim', 'string-trim-left', 'string-trim-right', 'string-upcase', 'strptime', 'strspn', 'subset', 'substring-equal?', 'swrite', 'sxhash', 'symbol-bound?', 'symbol-value', 'symbolconc', 'symlink', 'system', 't', 'the-environment', 'trace', 'trunc', 'typeof', 'unbreakupstr', 'ungetc', 'unix-ctime', 'unix-time', 'unix-time->strtime', 'unlink', 'untrace', 'url-decode', 'url-encode', 'utime', 'verbose', 'wait', 'while', 'writes', }; h_state 0 { 'Normal' } h_trans { 1, '-s', 'A-Za-z_%*', 'Normal' } #Keyword starters. h_trans { 2, '<', ';', 'Comment' } h_trans { 3, '>', '\'', 'Symbol' } h_trans { 4, '>', '0x', 'HexNumber' } h_trans { 5, '>s', '0-9', 'Number' } h_trans { 6, '>', '"', 'String' } h_trans { 0, 's', '()', 'Special' } # h_trans { 0, '', ',', 'Punctuation' } h_state 1 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_trans { 2, '<', ';', 'Comment'} h_wtype { 0, 0, 0, '', '-a-zA-Z0-9_*%:?!>' } #Keyword internals h_state 2 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 3 { 'Symbol' } h_trans { 2, '<', ';', 'Comment'} h_trans { 0, '>', ' ', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '>s', '()', 'Special' } h_state 4 { 'HexNumber' } h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 5 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 6 { 'String' } h_trans { 0, '<', '"', 'String' } h_trans { 6, 'q', '\\', 'String' } # 'q' "igores" next char. } mode SIOD: SOURCE { # siod Mode FileNameRx = /\.\cscm$/; HilitOn = 1; Colorizer = 'SIOD'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 0; #scheme is case insensitive. Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' ;'; CommentEnd = ''; WordChars = '-A-Za-z0-9*%:?!>'; #first noticed in m_plain.fte # RoutineRegexp = '('; } oinclude 'mym_siod.fte'; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/CMakeLists.txt�����������������������������������������������������������������������������0000664�0000764�0000764�00000002363�11041374612�014065� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # Build system for eFTE # # Copyright (c) 2008, eFTE SF Group (see AUTHORS file) # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # cmake_minimum_required(VERSION 2.4) PROJECT( eFTE ) ADD_SUBDIRECTORY( src ) INSTALL( DIRECTORY config DESTINATION share/efte FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PATTERN ".svn" EXCLUDE PATTERN "*~" EXCLUDE PATTERN "config/*" ) INSTALL( FILES AUTHORS Artistic COPYING HISTORY README DESTINATION share/doc/efte PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) INSTALL( FILES packaging/shared/efte.desktop DESTINATION share/applications PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) INSTALL( FILES packaging/shared/efte16x16.xpm packaging/shared/efte32x32.xpm packaging/shared/efte48x48.xpm packaging/shared/efte64x64.xpm DESTINATION share/pixmaps PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/README�������������������������������������������������������������������������������������0000664�0000764�0000764�00000003260�11257205413�012203� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ eFTE, Version 1.1 Copyright 2008-2009 by eFTE SF Group. Copyright 1994-1998 by Marko Macek. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of either: a) the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version, or b) the "Artistic License" which comes with this Kit. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details. You should have received a copy of the Artistic License with this Kit, in the file named "Artistic". If not, I'll be glad to provide one. You should also have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ----------------------------------------------------------------------- WWW: http://efte.sourceforge.net Current Authors (alphabetical order): Jeremy Cowgar..... jeremy_c@users.sourceforge.net Lauri Nurmi....... lanurmi@users.sourceforge.net Original Author: Marko Macek Original URL: http://fte.sourceforge.net FTE Contributors: - Timo Sirainen - F.Jalvingh NT/Win95/DOS port. - Markus F.X.J. Oberhumer <markus.oberhumer@jk.uni-linz.ac.at> DOS port (DJGPP) See file HISTORY for a list of recent changes. ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/���������������������������������������������������������������������������������0000775�0000764�0000764�00000000000�11264420006�013241� 5����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/windows/�������������������������������������������������������������������������0000775�0000764�0000764�00000000000�11264420006�014733� 5����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/windows/x86.iss������������������������������������������������������������������0000664�0000764�0000764�00000003730�11257205413�016110� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! [Setup] AppName=eFTE AppVerName=eFTE 1.1 AppPublisher=eFTE SF Group AppPublisherURL=http://efte.cowgar.com AppSupportURL=http://efte.cowgar.com AppUpdatesURL=http://efte.cowgar.com DefaultDirName={pf}\eFTE DefaultGroupName=eFTE LicenseFile=C:\efte\COPYING OutputDir=C:\efte\packaging\windows\x86 OutputBaseFilename=efte-1.1 Compression=lzma SolidCompression=yes [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] Source: "C:\efte\build\src\efte.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "C:\efte\config\*"; DestDir: "{app}\config"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "C:\efte\AUTHORS"; DestDir: "{app}"; Flags: ignoreversion Source: "C:\efte\Artistic"; DestDir: "{app}"; Flags: ignoreversion Source: "C:\efte\COPYING"; DestDir: "{app}"; Flags: ignoreversion Source: "C:\efte\HISTORY"; DestDir: "{app}"; Flags: ignoreversion Source: "C:\efte\README"; DestDir: "{app}"; Flags: ignoreversion Source: "C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.dll"; DestDir: "{app}" [Icons] Name: "{group}\eFTE"; Filename: "{app}\efte.exe" Name: "{group}\{cm:ProgramOnTheWeb,eFTE}"; Filename: "http://efte.cowgar.com" Name: "{group}\{cm:UninstallProgram,eFTE}"; Filename: "{uninstallexe}" Name: "{commondesktop}\eFTE"; Filename: "{app}\efte.exe"; Tasks: desktopicon Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\eFTE"; Filename: "{app}\efte.exe"; Tasks: quicklaunchicon [Run] Filename: "{app}\efte.exe"; Description: "{cm:LaunchProgram,eFTE}"; Flags: nowait postinstall skipifsilent ����������������������������������������efte-1.1/packaging/source/��������������������������������������������������������������������������0000775�0000764�0000764�00000000000�11264420000�014533� 5����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/source/build.sh������������������������������������������������������������������0000664�0000764�0000764�00000002332�11126051452�016176� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/bash NAME=efte VERSIONFILE="../../src/ftever.h" DEFAULTVERSION="$(sed -n 's/^\#define VERSION *\"//p' $VERSIONFILE |sed 's/\".*$//')" VERSION=${1:-$DEFAULTVERSION} # use DEFAULT version if not specified on command line [[ -z $VERSION ]] && exit 1 # no version, so exit if none specified and none found BASEPACKNAME=${NAME}-${VERSION} if [[ -d ${BASEPACKNAME} ]] ; then echo "Destination already exists. Previous packages with the same version number" echo "will be removed and existing destination will be renamed." echo "CTRL-C to abort, ENTER to continue..." read mv "$BASEPACKNAME" "${BASEPACKNAME}.$(date +%s)" rm -f "$BASEPACKNAME.tar.gz" "$BASEPACKNAME.tar.bz2" "$BASEPACKNAME.zip" fi svn co http://$NAME.svn.sourceforge.net/svnroot/$NAME/tags/${BASEPACKNAME} ${BASEPACKNAME} && find "$BASEPACKNAME" -type d -name .svn | while read DIR ; do rm -r "$DIR" ; done tar czf ${BASEPACKNAME}.tar.gz ${BASEPACKNAME} tar cjf ${BASEPACKNAME}.tar.bz2 ${BASEPACKNAME} zip -r ${BASEPACKNAME}.zip ${BASEPACKNAME} echo "" echo "Upload to SourceForge? CTRL-C to abort, ENTER to continue..." read ncftpput upload.sourceforge.net /incoming \ ${BASEPACKNAME}.tar.bz2 ${BASEPACKNAME}.tar.gz ${BASEPACKNAME}.zip ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/macports/������������������������������������������������������������������������0000775�0000764�0000764�00000000000�11264420006�015071� 5����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/macports/Portfile����������������������������������������������������������������0000664�0000764�0000764�00000002013�11257205413�016601� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Id$ PortSystem 1.0 name efte version 1.1 categories editors platforms darwin maintainers jeremy@cowgar.com description configurable programmers editor long_description \ eFTE is a lightweight, extendable, folding text editor \ geared toward the programmer. eFTE is a fork of FTE with goals of \ taking FTE to the next step, hence, Enhanced FTE. homepage http://efte.cowgar.com master_sites http://downloads.sourceforge.net/sourceforge/efte/ checksums efte-${version}.tar.gz md5 20c5ca30ed1990f473581e6cafda6a4b depends_build bin:cmake:cmake configure.args -DCMAKE_BUIL_TYPE=Release \ -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \ -DUSE_GPM=OFF -DBUILD_CONSOLE=ON -DBUILD_X=OFF configure { system "cd ${worksrcpath} && ${configure.env} cmake ${configure.args} ${worksrcpath}" } variant x11 { depends_build-append lib:libX11:XFree86 configure.args-delete "-DBUILD_X=OFF" configure.args-append "-DBUILD_X=ON" } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/��������������������������������������������������������������������������0000775�0000764�0000764�00000000000�11264420000�014455� 5����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/efte.1��������������������������������������������������������������������0000664�0000764�0000764�00000006321�10750354533�015504� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������.TH eFTE 1 .SH NAME efte \- Text editor .SH SYNOPSIS .B efte .I " [[options] files ...]" .BR .B vefte .I "[[options] files ...]" .BR .B nefte .I "[[options] files ...]" .BR .\" .I "[[options] files ...]" .SH "DESCRIPTION" This manual page documents briefly the .BR "efte" . This manual page was written for the Debian GNU/Linux distribution (but may be used by others), because the original program does not have a manual page. Instead, it has documentation in html format; see below. .PP .B efte is a powerful text editor which closely resembles Borlands programming editors for M$\-DOS, but is far more flexible and configurable. .SH OPTIONS .BR efte uses a command line syntax, which is a little bit different from most of Debian GNU/Linux apps. .TP .B \-h \-? \--help Help on command line options. .TP .B \-! Ignore any external configuration file and use internal configuration. .TP .BI \-l <line>[,<column>] Go to line (and column) in next file on command line. .TP .BI \-# <line>[<,column>] Same as \fB-l\fP. Do not use this option. .TP .BI \-m [<mode>] Set mode for next files to <mode>. If just plain \fB\-m\fP, then use default mode. .TP .BI \-C [<.cnf>] Use specified configuration file (compiled). Plain \fB\-C\fP does the same as \fB\-!\fP. .TP .BI \-D [<.dsk>] Load/save desktop from file <.dsk>. If no argument, disable desktop load/save. .TP .BI \-H [<.his>] Load/save history from file <.his>. If no argument, disable history load/save. .TP .BI \-T <tagfile> Load 'tagfile' at startup. .TP .BI \-t <tag> Lookup tag 'tag' and display file containing it. .TP .B \-\- The rest of the arguments are not options, but filenames. .TP .B \-+ The next argument is not an option even if starting with a '-'. Useful when loading files that begin with a -. .TP .B \-noxmb Do not use XMB functions in \fBxefte\fP - useful if you have incorrect locales and you want to use just english fonts. .TP .B \-font Select XWindow font to use with \fBxefte\fP. See \fBVIOFONT\fP also. .SH ENVIRONMENTAL VARIABLES This is list of variable which might change behavior of some \ internals of \fBefte\fP. .TP \fBVIOFONT\fP \- select font used by xefte .TP \fBISOCONSOLE\fP \- when set, vefte is usign ascii symbols to draw tables. \ This is useful when iso latin charset is used on console. .SH EXAMPLES .TP .BI "efte \-m" "BIN /usr/bin/vefte" load /usr/bin/vefte in BIN mode .TP \fBefte \-m\fP\fIBIN\fP \fB\-+\fP \fI\-bla\-\fP load file -bla- in BIN mode .TP .BI "efte \-l" "100,30 win.c" go to (100,30) in win.c .TP .BI efte " window.cpp" load file window.cpp .TP .BI "efte \-\-" " \-1 \-2 \-3 \-4 \-5 \-6" load files \-1, \-2, \-3, \-4, \-5, \-6 .TP .BI "efte \-D \-H" " efte.dsk efte.his" disable desktop and history loading and saving and load files efte.dsk and efte.his .SH FILES .I ~/.efterc .br .BI /usr/local/etc/ efte/system.fterc .br .BI /etc/ efte/system.fterc Default configuration files. Includes all keybindings and menus compiled with .BR "cefte"(1) from config files in \fB/usr/share/doc/\fP\fIefte/config-example.tar.gz\fP. .SH "SEE ALSO" .BR cefte (1), .BI /usr/share/doc/ efte/contents.html .SH AUTHORS This manual page was written by Riku Voipio and Zdenek Kabelac <riku.voipio@iki.fi> <kabi@debian.org> for the Debian GNU/Linux system. .SH DATE 18 Nov 1999 ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/fte-console.menu����������������������������������������������������������0000664�0000764�0000764�00000000176�10502063423�017573� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������?package(fte-console):needs="vc" section="Apps/Editors"\ title="VFte" longtitle="VFte, a console text editor" command="vfte" ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/postrm��������������������������������������������������������������������0000664�0000764�0000764�00000000302�07045071303�015731� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # remove FTECFG entry FTECFG=/etc/fte if [ -d $FTECFG ] ; then if [ `find $FTECFG | wc -l` -eq 1 ]; then rm -rf $FTECFG echo "Directory \`/etc/fte' removed" fi fi #DEBHELPER# ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/rules���������������������������������������������������������������������0000664�0000764�0000764�00000007456�11041362100�015545� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/make -f # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # This is the debhelper compatability version to use. export DH_COMPAT=1 # This has to be exported to make some magic below work. export DH_OPTIONS # # Modified to be a prototype for debmake by Christoph Lameter <clameter@debian.org> # # Modified to work for fte by Riku Voipio <riku.voipio@iki.fi> # # Modified to work for fte by Zdenek Kabelac <kabi@debian.org> INST=install -p DEBSTD=debstd package=fte docs=$(package)-docs console=$(package)-console terminal=$(package)-terminal xwindow=$(package)-xwindow allpackages=\ debian/tmp\ debian/$(docs)\ debian/$(console)\ debian/$(terminal)\ debian/$(xwindow) build: @dh_testdir $(MAKE) -C src -j 2 -f fte-unix.mak touch build cleanB: @dh_testdir @dh_clean clean: cleanB @dh_testdir @rm -f build @$(MAKE) -C src -f fte-unix.mak clean binary-indep: # There are no architecture-independent files to be uploaded # generated by this package. If there were any they would be # made here. binary-arch: cleanB checkroot checkscripts build @dh_testdir @echo ":: Preparing packages" # @$(INST) -d debian # @cd debian; install -d `cat *.dirs` dh_testdir dh_testroot dh_installdirs @echo "/etc/fte/system.fterc" >debian/conffiles ## find config -type f | sed -e 's/^/\/etc\/fte\//g' >>debian/conffiles @$(INST) -s src/cfte debian/tmp/usr/bin/ @tar cf debian/$(docs)/usr/share/doc/fte/config-example.tar config @$(INST) -s -m 4755 src/vfte debian/$(console)/usr/bin/ @$(INST) -s src/sfte debian/$(terminal)/usr/bin/ @$(INST) -s src/xfte debian/$(xwindow)/usr/X11R6/bin/ @$(INST) -m 755 debian/fte debian/tmp/usr/bin/fte @ln -s ../../../share/man/man1/fte.1.gz debian/$(xwindow)/usr/X11R6/man/man1/xfte.1.gz @ln -s fte.1.gz debian/$(console)/usr/share/man/man1/vfte.1.gz @ln -s fte.1.gz debian/$(terminal)/usr/share/man/man1/sfte.1.gz @cp -a debian/fte-console.lintian debian/$(console)/usr/share/lintian/overrides/fte-console # @cp -a debian/cfte.1 debian/$(docs)/usr/share/man/man1 # @find doc -type f | grep -v INDEX >debian/$(docs).docs # Must have debmake installed for this to work. Otherwise please copy # /usr/bin/debstd into the debian directory and change debstd to debian/debstd # @chown -R root.root $(allpackages) # @chmod -R go=rX $(allpackages) # @$(DEBSTD) -m BUGS HISTORY README TODO dh_installdocs BUGS HISTORY README TODO dh_installexamples dh_installchangelogs # this way we are saving few inodes and making it more user friendly @rm -rf debian/$(docs)/usr/share/doc/$(docs) @rm -rf debian/$(console)/usr/share/doc/$(console) @rm -rf debian/$(terminal)/usr/share/doc/$(terminal) @rm -rf debian/$(xwindow)/usr/share/doc/$(xwindow) @ln -s fte debian/$(docs)/usr/share/doc/$(docs) @ln -s fte debian/$(console)/usr/share/doc/$(console) @ln -s fte debian/$(terminal)/usr/share/doc/$(terminal) @ln -s fte debian/$(xwindow)/usr/share/doc/$(xwindow) @cp -a doc/*.html debian/$(docs)/usr/share/doc/$(docs) dh_installmenu dh_installcron dh_installmanpages -pfte dh_movefiles dh_strip dh_compress dh_fixperms -Xvfte #obsoleted dh_suidregister dh_shlibdeps dh_gencontrol dh_makeshlibs dh_installdeb dh_md5sums dh_builddeb -v # dpkg-shlibdeps debian/tmp/usr/X11R6/bin/xfte -drecommends debian/tmp/usr/bin/vfte debian/tmp/usr/bin/cfte # @dpkg-gencontrol -pfte # dpkg --build debian/tmp .. checkscripts: @echo ":: Checking scripts" @bash -n debian/postrm @bash -n debian/postinst # Below here is fairly generic really binary: binary-indep binary-arch source diff: @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false checkroot: @dh_testdir @echo ":: Checking ROOT user" @test root = "`whoami`" .PHONY: binary binary-indep binary-arch clean checkroot ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/builddeb������������������������������������������������������������������0000775�0000764�0000764�00000000102�07312100724�016155� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh dpkg-buildpackage -sgpg -pgpg -rfakeroot # debchanges ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/fte-docs.dirs�������������������������������������������������������������0000664�0000764�0000764�00000000022�07045071303�017050� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������usr/share/doc/fte ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/fte-console.suid����������������������������������������������������������0000664�0000764�0000764�00000000015�07045071303�017567� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������usr/bin/vfte �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/fte-xwindow.menu����������������������������������������������������������0000664�0000764�0000764�00000000576�10502062252�017633� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������?package(fte-xwindow):needs="x11" section="Apps/Editors" icon="mini-edit.xpm"\ title="Fte" longtitle="FTE, a powerful text editor"\ command="/usr/bin/xfte" #?package(fte-xwindow):needs="dwww" section="Apps/Editors" title="Fte Homepage"\ # command="http://www.ixtas.fri.uni-lj.si/~markom/fte"\ # longtitle="Fte Homepage"\ # description="This is the homepage of the fte creator" ����������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/control�������������������������������������������������������������������0000664�0000764�0000764�00000004554�07703461262�016112� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Source: fte Section: editors Priority: optional Maintainer: Zdenek Kabelac <kabi@debian.org> Standards-Version: 3.1.1.1 Build-Depends: debhelper, perl5, xlibs-dev, libgpmg1-dev, libncurses5-dev, slang1-dev, patch, Package: fte Architecture: any Depends: ${shlibs:Depends}, fte-xwindow | fte-terminal | fte-console Conflicts: fte-console (<< 0.49.13-3), fte-cfgdocs (<< 0.49.13-3) Suggests: fte-docs, exuberant-ctags Description: Text editor for programmers - base package Package contains files necessary to build configuration file and some elementary documentation. There is no editor in this package. Please select some from the list of suggested binary packages. Package: fte-docs Architecture: any Depends: fte (= ${Source-Version}) Replaces: fte-cfgdocs (<< 0.49.13-3) Description: HTML documentation and example of configuration. Package constains documentation files for editor. Package: fte-xwindow Architecture: any Depends: ${shlibs:Depends}, fte (= ${Source-Version}) Replaces: fte (<< 0.49.2-1) Description: Text editor for X Window System with I18N support. (for programmers) Color syntax highlighting for many more languages. Smart indentation for C, C++, Java, Perl. Multiple file/window editing, Column blocks, configurable menus and keyboard bindings, mouse support, undo/redo, regular expression search and replace, folding, background compiler execution. X Window System edition. Package: fte-console Architecture: any Depends: ${shlibs:Depends}, fte (= ${Source-Version}) Conflicts: suidmanager (<< 0.50) Description: Text editor for console (no I18N support). (for programmers) Color syntax highlighting for many more languages. Smart indentation for C, C++, Java, Perl. Multiple file/window editing, Column blocks, configurable menus and keyboard bindings, mouse support, undo/redo, regular expression search and replace, folding, background compiler execution. Linux console edition. Package: fte-terminal Architecture: any Depends: ${shlibs:Depends}, fte (= ${Source-Version}) Description: Text editor for terminals. (for programmers) Color syntax highlighting for many more languages. Smart indentation for C, C++, Java, Perl. Multiple file/window editing, Column blocks, configurable menus and keyboard bindings, mouse support, undo/redo, regular expression search and replace, folding, background compiler execution. Terminal (e.g.: xterm, vt100) edition. ����������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/fte-console.postinst������������������������������������������������������0000664�0000764�0000764�00000000265�07045071303�020515� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh -e echo " \`vfte' - editor for linux console /dev/vcsaXX - has SUID bit set!" echo " however this is used only for opening console device... " #DEBHELPER# �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/cefte.1�������������������������������������������������������������������0000664�0000764�0000764�00000002643�11041262562�015644� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������.TH CEFTE 1 .SH NAME cefte \- Compiles efte config files .SH SYNOPSIS .BI cefte " sourcefile [destfile]" .SH "DESCRIPTION" This manual page documents briefly the .BR "cfte". This manual page was written for the Debian GNU/Linux distribution (but may be used by others), because the original program does not have a manual page. Instead, it has documentation in html format; see below. .PP .B cefte compiles the .I .efterc binary for .BR "efte"(1) from human readable sources. Example of these source files can be found at \fB/usr/share/doc/\fP\fIefte/config-example.tar.gz\fP. .SH EXAMPLES .TP .BI cefte " /usr/share/doc/fte/config/main.fte" compiles the example config tree to .IR efte-new.cnf .TP .BI cefte " main.fte ~/.efterc" compiles the main.fte (in current directory) to .IR ~/.efterc .SH FILES .TP .IR ~/.efterc Default Configuration file. Includes All keybinding and menus compiled with .B cefte from config files in \fB/usr/share/doc/\fP\fIefte/config/main.fte\fP. There is a sample \fI.efterc\fP in \fB/etc/\fP\fIefte/system.fterc\fP. .TP .I *.fte Configuration sources. The syntax of these files is explained in \fB/usr/share/doc/\fP\fIefte/contents.html\fP. .SH "SEE ALSO" .BR efte (1), .BR vefte (1), .BR nefte (1), .BI /usr/share/doc/ efte/contents.html .SH AUTHORS This manual page was written by Riku Voipio and Zdenek Kabelac <riku.voipio@iki.fi> <kabi@debian.org> for the Debian GNU/Linux system. .SH DATE 28 Sep 1999 ���������������������������������������������������������������������������������������������efte-1.1/packaging/debian/copyright�����������������������������������������������������������������0000664�0000764�0000764�00000001027�07703461262�016432� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������This package was debianized by Riku Voipio <riku.voipio@sci.fi> on Wed, 14 Oct 1998 17:00:34 +0200. Currently it's maintained by Zdenek Kabelac <kabi@debian.org> Sources for actual fte package have been downloaded from CVS archive URL: http://sourceforge.net/projects/fte/ Previous packages have been using archive files from this place: URL: http://www.kiss.uni-lj.si/~k4fr0235/fte fte-%ver.src.tar.gz This was the official home page for this editor. Copyright: GPL (see /usr/share/common-licenses/GPL) or Artistic (see README) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/fte-console.lintian�������������������������������������������������������0000664�0000764�0000764�00000000067�07325553617�020306� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������fte-console: setuid-binary usr/bin/vfte 4755 root/root �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/postinst������������������������������������������������������������������0000664�0000764�0000764�00000000261�07307134001�016270� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh update-alternatives --install /usr/bin/editor editor /usr/bin/fte 11\ --slave /usr/share/man/man1/editor.1.gz editor.1.gz /usr/share/man/man1/fte.1.gz #DEBHELPER# �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/changelog�����������������������������������������������������������������0000664�0000764�0000764�00000022001�07703461262�016344� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������fte (0.50.0-1) unstable; urgency=low * CVS 2003/07/10 * fixed spelling (Closes: 12468, 12469) * applied patch (Closes: 118734) * added linda override file * add mini-edit.xpm fte icon based on icons/fte16x16.xpm with reduced colors (Closes: #127877) * if user has set DISPLAY it's correct it will open xfte even over ssh - it's correct behaviour - not bug (Closes: 118734) * actualized README.Debian (Closes: 151674) -- Zdenek Kabelac <kabi@debian.org> Thu, 7 Jul 2003 14:04:21 +0200 fte (0.49.13-15) unstable; urgency=low * fixed bug in o_message.cpp causing unexpected crash * some gcc-3.0 compilation fixes (Closes: #104809) * added lintian override file for fte-console -- Zdenek Kabelac <kabi@debian.org> Thu, 17 Jul 2001 14:04:21 +0200 fte (0.49.13-14) unstable; urgency=high * CVS 2001/06/21 * fixed some serious text corruption bug - introduced into CVS by some "unexperienced" programmer -- Zdenek Kabelac <kabi@debian.org> Thu, 21 Jun 2001 14:04:21 +0200 fte (0.49.13-13) unstable; urgency=low * CVS 2001/06/14 * fixed building dependency bug (Closes: #100052) * fixed X Window System description bug (Closes: #76078) * (Closes: #96444) - it was not the fault of fte -- Zdenek Kabelac <kabi@debian.org> Thu, 7 Jun 2001 14:04:21 +0200 fte (0.49.13-12) unstable; urgency=low * CVS 2001/06/07 * fixed bug in colorizing of floating point numbers -- Zdenek Kabelac <kabi@debian.org> Thu, 7 Jun 2001 14:04:21 +0200 fte (0.49.13-11) unstable; urgency=low * update after some long time - using CVS 2001/06/05 * removed usage of dh_suidregister * fixed bug in reading to large $HOME shell variable (Closes: #68435) * fixed update-alternatives for editor (Closes: #71213) * fixed control file for fte-xwindow added Replaces: (Closes: #71574) * fixed bug in fte init wrapper script (Closes: #72908) -- Zdenek Kabelac <kabi@debian.org> Sun, 3 Jun 2001 16:04:21 +0200 fte (0.49.13-10) frozen unstable; urgency=low * fixed typo in debian/rules script * fixed Build-Depends (missing dependencies) (Closes: #57254) -- Zdenek Kabelac <kabi@debian.org> Tue, 15 Feb 2000 16:04:21 +0100 fte (0.49.13-9) frozen unstable; urgency=low * fixed problem with wrong character on linux console for both terminal and console version (Closes: #54764, 54765) (linux console is using iso character for borders, slang version uses slightly modified table for linux terminal) * addeded PHP mode (MIGUEL HERNANDEZ MARTOS x4278303@fedro.ugr.es) * fixed problem with wrong recognization of shell file (e.g. file beginning with #! /bin/sh is shell file) * fixed comment/uncomment option to Edit/Line menu -- Zdenek Kabelac <kabi@debian.org> Wed, 2 Feb 2000 20:13:44 +0100 fte (0.49.13-8) unstable; urgency=low * applied bugfix from freshmeat December 28th 1999, 21:30 EST * changed one dependency line from Recommends: to Depenends: for the fte package (Closes: #53299) * slightly improved fte running script * upgraded Standards-Version number and Build-Depends field * fixed minor problem with version number (Closes: #53635) * -- Zdenek Kabelac <kabi@debian.org> Wed, 2 Feb 2000 20:13:44 +0100 fte (0.49.13-7) unstable; urgency=low * fixed some minor problems with tabulators (e.g. tabs are now generated in Makefiles) * (Closes: #53015) - doesn't happen with 0.49 series * using gpg -- Zdenek Kabelac <kabi@debian.org> Mon, 3 Jan 2000 19:38:41 +0100 fte (0.49.13-6) unstable; urgency=low * fixed fte running script (Closes: #49895) * improved error handling when opening XWindow font * some lines added to manpage * extended the name of the default font for better adaptability and improved opening of localized font (Closes: #50082) (thanks Alexander Shumakovitch for cooperation) -- Zdenek Kabelac <kabi@debian.org> Mon, 13 Dec 1999 20:00:05 +0100 fte (0.49.13-5) unstable; urgency=low * added more colorizer modes to menus * improvements & bugfixes in some colorizers * added check for the ISOCONSOLE shell variable - users can use iso-8859-x fonts on linux console with VFTE * removed colors from ctaged keywords (looks ugly) * added ctags suggestion * added explanation of shell variable to manpage * unreleased -- Zdenek Kabelac <kabi@debian.org> Sun, 24 Nov 1999 22:00:05 +0100 fte (0.49.13-4) unstable; urgency=low * fixed problem with line auto-indenting * fixed suid registering for vfte -- Zdenek Kabelac <kabi@debian.org> Sun, 10 Oct 1999 16:54:05 +0100 fte (0.49.13-3) unstable; urgency=low * small fixes in building scripts -- Zdenek Kabelac <kabi@debian.org> Tue, 4 Oct 1999 21:34:25 +0100 fte (0.49.13-2) unstable; urgency=low * changed design of debian packages * using debmake * following FSH directions * fixed various bugs in X-Windows version -- Zdenek Kabelac <kabi@debian.org> Tue, 28 Sep 1999 19:34:25 +0200 fte (0.49.13-1) unstable; urgency=low * new upstream version * as usual bug fixes * added comments to international usage of the fte (8bit) * unreleased -- Zdenek Kabelac <kabi@debian.org> Sun, 30 May 1999 16:46:45 +0200 fte (0.49.2-1) unstable; urgency=low * a lot of changes again * various bug fixes * new binary - sfte based upon slang library (usable in xterm) * much better completition mode (Ctrl+Tab) * this was prerelease version and was not publicly available -- Zdenek Kabelac <kabi@debian.org> Wed, 16 Dec 1998 19:05:50 +0100 fte (0.46b5-4.2) frozen unstable; urgency=low * non-maintainer upload * moved the seteuid(getuid()) call to beginning of main() where it does the most good. Added dropping of privs in case the open failed which would have left it privileged until die() finished and the program exited. Also added code in case the binary was ever sgid to handle dropping privileges. -- Ben Collins <bcollins@debian.org> Sat, 5 Dec 1998 19:05:59 -0500 fte (0.46b5-4.1) frozen unstable; urgency=low * non-maintainer upload * edited con_linux.c to give use suid root permissions only to open the virtual console. (closes #30384) This was a critical security related bug. * enabled use of gpm in fte-console (really should be there IMO) -- Ben Collins <bcollins@debian.org> Sat, 5 Dec 1998 12:04:02 -0500 fte (0.46b5-4) frozen unstable; urgency=low * changed frozen to frozen unstable * fixed bug with ctags -- Zdenek Kabelac <kabi@debian.org> Mon, 16 Nov 1998 19:05:50 +0100 fte (0.46b5-3) frozen; urgency=low * extensive changes in debian/rules * added SGML mode (for Debian) and small fixes in HTML mode * package splited in three parts * lowered editors' priority for update-menus (now is below VI) * small changes in fte wrapper script * vfte is SUID -- Zdenek Kabelac <kabi@debian.org> Sun, 1 Nov 1998 23:05:50 +0100 fte (0.46b5-2) unstable; urgency=low * removed vfte completely from distribution * changed maintainers email address * i18n support -- Zdenek Kabelac <kabi@debian.org> Wed, 14 Oct 1998 17:05:50 +0100 fte (0.46b5-1) unstable; urgency=low * new version and maintainer * support for i18n in X version * more locale fixes (e.g. upper and lower case switch) * man pages and dwww entries changes and fixes * vfte is made for now SUID (because of login security fix) * new configuration made by maintainer * removed any lintian errors and warnings * not publically released -- Zdenek Kabelac <kabi@debian.org> Sun, 04 Oct 1998 14:05:50 +0100 fte (0.45-5) unstable; urgency=low * added dwww menu * added /usr/bin/editor -> /usr/bin/fte * added fte wrapper script -- Riku Voipio <riku.voipio@iki.fi> Tue, 21 Oct 1997 03:25:50 +0300 fte (0.45-4) unstable; urgency=low * fully libc6 * up to latest standards -- Riku Voipio <riku.voipio@iki.fi> Thu, 11 Sep 1997 17:02:37 +0300 fte (0.45-3) unstable; urgency=low * now uses libc6 (seems to work, even if xlib is still libc5) * menu 1.0 -- Riku Voipio <riku.voipio@iki.fi> Wed, 18 Jun 1997 22:49:18 +0300 fte (0.45-2) frozen unstable; urgency=low * standard 2.1.3.0 * new maintainer Address * now installs a /etc/fte/system.fterc * fixed some typos :) * routine update to make debstd complain less -- Riku Voipio <riku.voipio@iki.fi> Thu, 1 May 1997 17:23:41 +0300 fte (0.45-1) unstable; urgency=low * new upstream release * corrected depencies (now only recommends xlib6) -- Riku Voipio <riku.voipio@sci.fi> Wed, 19 Feb 1997 19:55:37 +0200 fte (0.44-3) unstable; urgency=low * fixed bug #7172 (files missing from distribution....) * going to type 100 times "never release anything without running debc" -- Riku Voipio <riku.voipio@sci.fi> Sun, 9 Feb 1997 12:00:48 +0200 fte (0.44-2) unstable; urgency=low * wrote manpages (#6629) * removed some non-unix modes from sample.fterc * changed to depend on xlib6 instead on elf-x11r6lib -- Riku Voipio <riku.voipio@sci.fi> Sat, 18 Jan 1997 12:35:18 +0200 fte (0.44-1) unstable; urgency=low * initial Release. -- Riku Voipio <riku.voipio@sci.fi> Wed, 25 Dec 1996 20:41:34 +0200 Local variables: mode: debian-changelog End: �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/fte-console.dirs����������������������������������������������������������0000664�0000764�0000764�00000000067�07325062013�017572� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������usr/bin usr/share/man/man1 usr/share/lintian/overrides �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/fte-docs.menu�������������������������������������������������������������0000664�0000764�0000764�00000000537�10502063423�017062� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������?package(fte-docs):needs="dwww" section="Apps/Editors"\ title="Fte Manual" longtitle="Fte Users Manual"\ command="/usr/share/doc/fte/contents.html" ?package(fte-docs):needs="dwww" section="Apps/Editors"\ title="Fte detailed reference"\ longtitle="Detailed reference card for default Fte user interface"\ command="/usr/share/doc/fte/command.html" �����������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/fte-terminal.dirs���������������������������������������������������������0000664�0000764�0000764�00000000033�07045071303�017735� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������usr/bin usr/share/man/man1 �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/fte.dirs������������������������������������������������������������������0000664�0000764�0000764�00000000020�07045071303�016120� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������etc/fte usr/bin ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/README.debian�������������������������������������������������������������0000664�0000764�0000764�00000003162�07703461262�016602� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������fte for DEBIAN ---------------------- * if you are using some non-iso encondings like KOI8-R please check your Compose file if you are worried about warning message. This problem is known - if you know how to fix this, please let me know. * usage of vfte on linux console together with iso8859-X fonts might be better if ISOCONSOLE shell variable is set. (e.g. for bash export ISOCONSOLE=y ; fte) * before reporting bugs about problems with i18n support for xfte try to make sure, your locales are correct and you use them properly (e.g. LANG=en_US xfte) * try to use sfte instead of vfte * vfte requires access to dev/vcsa* as the of the security problem with write access to this device this program has to be suid - however only for the opening this device - than it gives up its root privileges and goes back to the normal user uid,gid * And since vfte uses dev/vcsa directly, you can't use it on anything else but a virtual console. * vfte is not compiled with GPM support, because it's buggy and I didn't want vfte to be the reason to buy a mouse. * fte has still bugs, so use with caution (especially vfte, cuz it locks the keyboard if it crashes...), and report any reproducable bugs found. * To make your own configurations, make sure you have the package fte-docs installed on your system and unpack the file config-example.tar.gz to $HOME/.fte/. Run the program: cfte $HOME/.fte/main.fte Report any useful improvements and new Color modes. * read the BUGS file. Zdenek Kabelac <kabi@debian.org> Riku Voipio <riku.voipio@iki.fi> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/prerm���������������������������������������������������������������������0000664�0000764�0000764�00000000154�07045071303�015537� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh if [ "$1" != "upgrade" ] then update-alternatives --remove editor /usr/bin/fte fi #DEBHELPER# ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/fte-xwindow.dirs����������������������������������������������������������0000664�0000764�0000764�00000000033�10502072020�017606� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������usr/bin usr/share/man/man1 �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/debian/conffiles�����������������������������������������������������������������0000664�0000764�0000764�00000000000�11041362100�016335� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/gentoo/��������������������������������������������������������������������������0000775�0000764�0000764�00000000000�11264420006�014534� 5����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/gentoo/efte-0.97.ebuild����������������������������������������������������������0000664�0000764�0000764�00000001456�11041357017�017252� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header$ DESCRIPTION="A fast text editor supporting folding, syntax highlighting, etc." HOMEPAGE="http://efte.cowgar.com" SRC_URI="http://downloads.sourceforge.net/${PN}/${P}.tar.gz" LICENSE="GPL-2 Artistic" SLOT="0" KEYWORDS="~alpha ~amd64 ~ppc ~sparc ~x86" IUSE="gpm X" RDEPEND="sys-libs/ncurses gpm? ( sys-libs/gpm ) X? ( x11-base/xorg-x11 x11-libs/libXpm )" DEPEND="${RDEPEND} dev-util/cmake" src_compile() { cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ -DBUILD_GPM=$(use gpm && echo ON || echo OFF) \ -DBUILD_X=$(use X && echo ON || echo OFF) \ ./ emake || die "emake failed" } src_install() { emake DESTDIR="${D}" install || die "emake install failed" } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/gentoo/efte-0.96.ebuild����������������������������������������������������������0000664�0000764�0000764�00000001766�11041357017�017255� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/app-editors/efte/efte-0.96.ebuild,v 1.1 2008/02/18 00:24:27 omp Exp $ DESCRIPTION="A fast text editor supporting folding, syntax highlighting, etc." HOMEPAGE="http://efte.sourceforge.net" SRC_URI="http://downloads.sourceforge.net/${PN}/${P}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="gpm X" RDEPEND="sys-libs/ncurses gpm? ( sys-libs/gpm ) X? ( x11-base/xorg-x11 x11-libs/libXpm )" DEPEND="${RDEPEND} dev-util/cmake" src_compile() { cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ -DBUILD_GPM=$(use gpm && echo ON || echo OFF) \ -DBUILD_X=$(use X && echo ON || echo OFF) \ ./ emake || die "emake failed" # Compile a default configuration file. src/cefte config/mymain.fte system.fterc } src_install() { emake DESTDIR="${D}" install || die "emake install failed" insinto /usr/share/efte doins system.fterc } ����������efte-1.1/packaging/gentoo/efte-0.95.ebuild����������������������������������������������������������0000664�0000764�0000764�00000002000�11041357017�017232� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ DESCRIPTION="A fast text editor supporting folding, syntax highlighting, etc." HOMEPAGE="http://efte.sourceforge.net" SRC_URI="http://downloads.sourceforge.net/${PN}/${P}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="gpm X" RDEPEND="sys-libs/ncurses gpm? ( sys-libs/gpm ) X? ( x11-base/xorg-x11 x11-libs/libXpm )" DEPEND="${RDEPEND} dev-util/cmake" src_compile() { cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ -DBUILD_GPM=$(use gpm && echo ON || echo OFF) \ -DBUILD_X=$(use X && echo ON || echo OFF) \ ./ emake || die "emake failed" # Compile a default configuration file. src/cefte config/mymain.fte system.fterc } src_install() { emake DESTDIR="${D}" install || die "emake install failed" insinto /usr/share/efte doins system.fterc }efte-1.1/packaging/archlinux/�����������������������������������������������������������������������0000775�0000764�0000764�00000000000�11264420006�015236� 5����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/archlinux/PKGBUILD���������������������������������������������������������������0000664�0000764�0000764�00000001242�11257205413�016366� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Contributor: Jeremy Cowgar <jeremy@cowgar.com> pkgname=efte pkgver=1.1 pkgrel=1 pkgdesc="Fast configurable programmers editor" license=('GPL', 'custom') url="http://efte.cowgar.com" source=(http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz) md5sums=('') arch=('i686' 'x86_64') build() { cd $startdir/src/$pkgname-$pkgver cmake -DBUILD_X=ON -DBUILD_CONSOLE=ON -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr . || return 1 make || return 1 make DESTDIR=$startdir/pkg install || return 1 install -D -m 644 $startdir/pkg/usr/share/licenses/efte/Artistic \ $startdir/pkg/usr/share/licenses/efte/Artistic || return 1 } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/rpm/�����������������������������������������������������������������������������0000775�0000764�0000764�00000000000�11264420006�014037� 5����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/rpm/efte.spec��������������������������������������������������������������������0000664�0000764�0000764�00000001712�11257205413�015644� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Summary: eFTE Text Editor Name: efte Version: 1.1 Release: 1 License: GPLv2+, Artistic Group: Applications/Editors BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root Source: http://downloads.sourceforge.net/efte/%{name}-%{version}.tar.gz Requires: gpm Requires: ncurses Requires: libX11 Requires: libXpm BuildRequires: gcc-c++ BuildRequires: gpm-devel BuildRequires: ncurses-devel BuildRequires: libX11-devel BuildRequires: libXpm-devel %description eFTE Text Editor Folding. Color syntax highlighting for many languages. Smart indentation for C,C++,Java,Perl. Fast. No mouse required :) File/line size limited by virtual memory. %prep rm -rf $RPM_BUILD_ROOT %setup -q %build cd src && make PREFIX=/usr %install install -d $RPM_BUILD_ROOT/etc/efte cd src && make install PREFIX=/usr DESTDIR=$RPM_BUILD_ROOT %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,sys) /usr/bin/efte /usr/bin/nefte /usr/bin/vefte /usr/share/doc/efte /usr/share/efte/config ������������������������������������������������������efte-1.1/packaging/shared/��������������������������������������������������������������������������0000775�0000764�0000764�00000000000�11264420006�014507� 5����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/shared/efte256x256.xpm�����������������������������������������������������������0000664�0000764�0000764�00000202171�11041617576�017062� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char * eFTE2_256x256_xpm[] = { "256 256 4 1", " c None", ". c #000000", "+ c #FF0000", "@ c #FFFFFF", " ", " ", " ", " ", " ", " ", " ", " ", " ........................................................ ", " ........................................................ ", " ........................................................ ", " ........................................................ ", " ........................................................ ", " ........................................................ ", " ........................................................ ", " ........................................................ ", " ........++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++++++++++++++++++................................................................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++++++++++++++++++................................................................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++++++++++++++++++................................................................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++++++++++++++++++................................................................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++++++++++++++++++................................................................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++++++++++++++++++................................................................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++++++++++++++++++................................................................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++++++++++++++++++................................................................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " ........++++++++++++++++........................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........................................ ........++++++++++++++++........ ........++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........................................ ........++++++++++++++++........ ........++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........................................ ........++++++++++++++++........ ........++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........................................ ........++++++++++++++++........ ........++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........................................ ........++++++++++++++++........ ........++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........................................ ........++++++++++++++++........ ........++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........................................ ........++++++++++++++++........ ........++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........................................ ........++++++++++++++++........ ........++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@................++++++++++++++++++++++++++++++++........@@@@@@@@........++++++++++++++++........@@@@@@@@................................++++++++++++++++++++++++................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@................++++++++++++++++++++++++++++++++........@@@@@@@@........++++++++++++++++........@@@@@@@@................................++++++++++++++++++++++++................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@................++++++++++++++++++++++++++++++++........@@@@@@@@........++++++++++++++++........@@@@@@@@................................++++++++++++++++++++++++................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@................++++++++++++++++++++++++++++++++........@@@@@@@@........++++++++++++++++........@@@@@@@@................................++++++++++++++++++++++++................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@................++++++++++++++++++++++++++++++++........@@@@@@@@........++++++++++++++++........@@@@@@@@................................++++++++++++++++++++++++................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@................++++++++++++++++++++++++++++++++........@@@@@@@@........++++++++++++++++........@@@@@@@@................................++++++++++++++++++++++++................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@................++++++++++++++++++++++++++++++++........@@@@@@@@........++++++++++++++++........@@@@@@@@................................++++++++++++++++++++++++................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@................++++++++++++++++++++++++++++++++........@@@@@@@@........++++++++++++++++........@@@@@@@@................................++++++++++++++++++++++++................................@@@@@@@@@@@@@@@@@@@@@@@@ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++................................................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++................................................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++................................................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++................................................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++................................................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++................................................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++................................................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++................................................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++................++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................++++++++++++++++................++++++++++++++++................................................++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++........................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++........................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++........................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++........................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++........................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++........................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++........................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++........................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " ........++++++++++++++++........................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " @@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ........++++++++++++++++................................................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................................................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................................................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................................................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................................................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................................................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................................................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++................................................++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@........++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " ........++++++++++++++++++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++++++++++++++++++........ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ................................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ................................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ................................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ................................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ................................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ................................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ................................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ................................ ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " ........++++++++++++++++........ ........++++++++++++++++++++++++........++++++++++++++++........................................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ................................ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ................................ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ................................ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ................................ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ................................ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ................................ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ................................ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ................................ ........++++++++++++++++++++++++........++++++++++++++++++++++++++++++++++++++++++++++++........ ", " ................................................................................................ ", " ................................................................................................ ", " ................................................................................................ ", " ................................................................................................ ", " ................................................................................................ ", " ................................................................................................ ", " ................................................................................................ ", " ................................................................................................ ", " ", " ", " ", " ", " ", " ", " ", " "}; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/shared/efte16x16.xpm�������������������������������������������������������������0000664�0000764�0000764�00000000671�11042241120�016662� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static const char * efte16x16_xpm[] = { "16 16 4 1", " c None", ". c #000000", "+ c #FFFFFF", "@ c #FF0000", " .... ", " ++++.@@.....++ ", " ....@ @@@@@ ", " .@@@.@ .@. ", " .@.@.@@@.@.@@@ ", " .@.@.@...@.@.. ", " .@@..@++.@.@++ ", " .@ .@ .@.@.. ", " .@ .@ .@.@@@ ", " .@@@.@++.@.@++ ", " .. .@ .@.@ ", " .@ .@.@ ", " ++++.@++.@.@++ ", " .@ .@.@.. ", " .. .@.@@@ ", " "}; �����������������������������������������������������������������������efte-1.1/packaging/shared/efte64x64.xpm�������������������������������������������������������������0000664�0000764�0000764�00000010571�11042241120�016670� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static const char * efte64x64_xpm[] = { "64 64 4 1", " c None", ". c #000000", "+ c #FF0000", "@ c #FFFFFF", " ", " ", " .............. ", " .............. ", " ..++++++++++.. ", " ..++++++++++.. ", " @@@@@@@@@@@@@@@@@@..++++++++++....................@@@@@@ ", " @@@@@@@@@@@@@@@@@@..++++++++++....................@@@@@@ ", " ..++++......++++++++++++++++++.. ", " ..++++......++++++++++++++++++.. ", " .......... ..++++.. ..++++++++++++++++++.. ", " .......... ..++++.. ..++++++++++++++++++.. ", " @@....++++++++..@@..++++..@@........++++++........@@@@@@ ", " @@....++++++++..@@..++++..@@........++++++........@@@@@@ ", " ..++++++++++++....++++.. ..++++++.. ", " ..++++++++++++....++++.. ..++++++.. ", " ..++++....++++....++++............++++++................ ", " ..++++....++++....++++............++++++................ ", " ..++++....++++....++++++++++++....++++++..++++++++++++.. ", " ..++++....++++....++++++++++++....++++++..++++++++++++.. ", " @@..++++....++++....++++++++++++....++++++..++++++++++++.. ", " @@..++++....++++....++++++++++++....++++++..++++++++++++.. ", " ..++++....++++....++++............++++++..++++.......... ", " ..++++....++++....++++............++++++..++++.......... ", " ..++++++++++++....++++.. ..++++++..++++.. ", " ..++++++++++++....++++.. ..++++++..++++.. ", " @@..++++++++++......++++..@@@@@@@@..++++++..++++..@@@@@@ ", " @@..++++++++++......++++..@@@@@@@@..++++++..++++..@@@@@@ ", " ..++++...... ..++++.. ..++++++..++++.. ", " ..++++...... ..++++.. ..++++++..++++.. ", " ..++++.. ..++++.. ..++++++..++++.......... ", " ..++++.. ..++++.. ..++++++..++++.......... ", " @@..++++..@@@@@@@@..++++..@@@@@@@@..++++++..++++++++++++.. ", " @@..++++..@@@@@@@@..++++..@@@@@@@@..++++++..++++++++++++.. ", " ..++++.. ..++++.. ..++++++..++++++++++++.. ", " ..++++.. ..++++.. ..++++++..++++++++++++.. ", " ..++++............++++.. ..++++++..++++.......... ", " ..++++............++++.. ..++++++..++++.......... ", " @@..++++++++++++....++++..@@@@@@@@..++++++..++++..@@@@@@ ", " @@..++++++++++++....++++..@@@@@@@@..++++++..++++..@@@@@@ ", " ..++++++++.. ..++++.. ..++++++..++++.. ", " ..++++++++.. ..++++.. ..++++++..++++.. ", " ........ ..++++.. ..++++++..++++.. ", " ........ ..++++.. ..++++++..++++.. ", " @@@@@@@@@@@@@@@@@@..++++..@@@@@@@@..++++++..++++..@@@@@@ ", " @@@@@@@@@@@@@@@@@@..++++..@@@@@@@@..++++++..++++..@@@@@@ ", " ..++++.. ..++++++..++++.. ", " ..++++.. ..++++++..++++.. ", " ..++++.. ..++++++..++++.. ", " ..++++.. ..++++++..++++.. ", " @@@@@@@@@@@@@@@@@@..++++..@@@@@@@@..++++++..++++..@@@@@@ ", " @@@@@@@@@@@@@@@@@@..++++..@@@@@@@@..++++++..++++..@@@@@@ ", " ..++++.. ..++++++..++++.. ", " ..++++.. ..++++++..++++.. ", " ..++++.. ..++++++..++++.......... ", " ..++++.. ..++++++..++++.......... ", " @@@@@@@@@@@@@@@@@@..++++..@@@@@@@@..++++++..++++++++++++.. ", " @@@@@@@@@@@@@@@@@@..++++..@@@@@@@@..++++++..++++++++++++.. ", " ........ ..++++++..++++++++++++.. ", " ........ ..++++++..++++++++++++.. ", " ........................ ", " ........................ ", " ", " "}; ���������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/shared/efte512x512.xpm�����������������������������������������������������������0000664�0000764�0000764�00001004171�11041617576�017051� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char * eFTE2_512x512_xpm[] = { "512 512 4 1", " c None", ". c #000000", "+ c #FF0000", "@ c #FFFFFF", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................................................................................................................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................................................................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................................................................................................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " ................++++++++++++++++++++++++++++++++................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++................................................................................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................ ................++++++++++++++++++++++++++++++++++++++++++++++++................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ................................................................................................................................................................................................ ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/shared/efte20x20_simple.xpm������������������������������������������������������0000664�0000764�0000764�00000001074�11063301647�020235� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char * efte20x20_simple_xpm[] = { "20 20 2 1", " c None", ". c #FF0000", " ", " ... ", " . ..... ", " . . ", " .... . . ", " . . .... . .... ", " . . . . . ", " ... . . . ", " . . . . ", " . . . . ", " . . . .... ", " ... . . . ", " . . . ", " . . . ", " . . . ", " . . . ", " . . . ", " . . ", " . .... ", " "}; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/shared/efte32x32.xpm�������������������������������������������������������������0000664�0000764�0000764�00000002371�11042241120�016655� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static const char * efte32x32_xpm[] = { "32 32 4 1", " c None", ". c #000000", "+ c #FF0000", "@ c #FFFFFF", " ", " ....... ", " .+++++. ", " @@@@@@@@@.+++++..........@@@ ", " .++...+++++++++. ", " ..... .++. .+++++++++. ", " @..++++.@.++.@....+++....@@@ ", " .++++++..++. .+++. ", " .++..++..++......+++........ ", " .++..++..++++++..+++.++++++. ", " @.++..++..++++++..+++.++++++. ", " .++..++..++......+++.++..... ", " .++++++..++. .+++.++. ", " @.+++++...++.@@@@.+++.++.@@@ ", " .++... .++. .+++.++. ", " .++. .++. .+++.++..... ", " @.++.@@@@.++.@@@@.+++.++++++. ", " .++. .++. .+++.++++++. ", " .++......++. .+++.++..... ", " @.++++++..++.@@@@.+++.++.@@@ ", " .++++. .++. .+++.++. ", " .... .++. .+++.++. ", " @@@@@@@@@.++.@@@@.+++.++.@@@ ", " .++. .+++.++. ", " .++. .+++.++. ", " @@@@@@@@@.++.@@@@.+++.++.@@@ ", " .++. .+++.++. ", " .++. .+++.++..... ", " @@@@@@@@@.++.@@@@.+++.++++++. ", " .... .+++.++++++. ", " ............ ", " "}; �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/shared/efte.desktop��������������������������������������������������������������0000664�0000764�0000764�00000003112�11257205413�017027� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������[Desktop Entry] Name=eFTE Version=1.1 GenericName=Text Editor GenericName[cz]=Textový editor GenericName[de]=Texteditor GenericName[en_US@piglatin]=Extay Editoray GenericName[eo]=Tekstredaktilo GenericName[et]=Tekstiredaktor GenericName[fi]=Tekstieditori GenericName[fr]=Editeur de texte GenericName[it]=Editor di testo GenericName[ja]=テキストエディタ GenericName[nl]=Tekst editor GenericName[pl]=Edytor tekstu GenericName[sv]=Textredigerare Comment=Fast, extendable programmers' text editor Comment[cz]=Rychlý a rozšiřitelný textový editor pro programátory Comment[de]=Schneller, erweiterbarer Texteditor für Programmierer Comment[en_US@piglatin]=Astfay extendableay rogrammerspay exttay editoray Comment[eo]=Rapida, etendabla tekstredaktilo por programado Comment[et]=Kiire, paindlik programmeerijate tekstiredaktor Comment[fi]=Nopea, laajennettava ohjelmoijien tekstieditori Comment[it]=Veloce, espandibile editor di programmi Comment[ja]=高速で、拡張可能なプログラマー向けテキストエディタ Comment[fr]=Editeur rapide et extensible, pour les programmeurs Comment[nl]=Snelle, uitbreidbare tekst editor voor programmeurs Comment[pl]=Szybki, zaawansowany i elastyczny edytor tekstu dla programistów Comment[sv]=Snabb, utbyggbar textredigerare för programmerare MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; Exec=efte %f Icon=efte Type=Application Terminal=false Categories=Development;TextEditor; StartupWMClass=Efte ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/shared/efte128x128.xpm�����������������������������������������������������������0000664�0000764�0000764�00000041171�11041617576�017057� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char * eFTE2_128x128_xpm[] = { "128 128 4 1", " c None", ". c #000000", "+ c #FF0000", "@ c #FFFFFF", " ", " ", " ", " ", " ............................ ", " ............................ ", " ............................ ", " ............................ ", " ....++++++++++++++++++++.... ", " ....++++++++++++++++++++.... ", " ....++++++++++++++++++++.... ", " ....++++++++++++++++++++.... ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++++++++++++++........................................@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++++++++++++++........................................@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++++++++++++++........................................@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++++++++++++++........................................@@@@@@@@@@@@ ", " ....++++++++............++++++++++++++++++++++++++++++++++++.... ", " ....++++++++............++++++++++++++++++++++++++++++++++++.... ", " ....++++++++............++++++++++++++++++++++++++++++++++++.... ", " ....++++++++............++++++++++++++++++++++++++++++++++++.... ", " .................... ....++++++++.... ....++++++++++++++++++++++++++++++++++++.... ", " .................... ....++++++++.... ....++++++++++++++++++++++++++++++++++++.... ", " .................... ....++++++++.... ....++++++++++++++++++++++++++++++++++++.... ", " .................... ....++++++++.... ....++++++++++++++++++++++++++++++++++++.... ", " @@@@........++++++++++++++++....@@@@....++++++++....@@@@................++++++++++++................@@@@@@@@@@@@ ", " @@@@........++++++++++++++++....@@@@....++++++++....@@@@................++++++++++++................@@@@@@@@@@@@ ", " @@@@........++++++++++++++++....@@@@....++++++++....@@@@................++++++++++++................@@@@@@@@@@@@ ", " @@@@........++++++++++++++++....@@@@....++++++++....@@@@................++++++++++++................@@@@@@@@@@@@ ", " ....++++++++++++++++++++++++........++++++++.... ....++++++++++++.... ", " ....++++++++++++++++++++++++........++++++++.... ....++++++++++++.... ", " ....++++++++++++++++++++++++........++++++++.... ....++++++++++++.... ", " ....++++++++++++++++++++++++........++++++++.... ....++++++++++++.... ", " ....++++++++........++++++++........++++++++........................++++++++++++................................ ", " ....++++++++........++++++++........++++++++........................++++++++++++................................ ", " ....++++++++........++++++++........++++++++........................++++++++++++................................ ", " ....++++++++........++++++++........++++++++........................++++++++++++................................ ", " ....++++++++........++++++++........++++++++++++++++++++++++........++++++++++++....++++++++++++++++++++++++.... ", " ....++++++++........++++++++........++++++++++++++++++++++++........++++++++++++....++++++++++++++++++++++++.... ", " ....++++++++........++++++++........++++++++++++++++++++++++........++++++++++++....++++++++++++++++++++++++.... ", " ....++++++++........++++++++........++++++++++++++++++++++++........++++++++++++....++++++++++++++++++++++++.... ", " @@@@....++++++++........++++++++........++++++++++++++++++++++++........++++++++++++....++++++++++++++++++++++++.... ", " @@@@....++++++++........++++++++........++++++++++++++++++++++++........++++++++++++....++++++++++++++++++++++++.... ", " @@@@....++++++++........++++++++........++++++++++++++++++++++++........++++++++++++....++++++++++++++++++++++++.... ", " @@@@....++++++++........++++++++........++++++++++++++++++++++++........++++++++++++....++++++++++++++++++++++++.... ", " ....++++++++........++++++++........++++++++........................++++++++++++....++++++++.................... ", " ....++++++++........++++++++........++++++++........................++++++++++++....++++++++.................... ", " ....++++++++........++++++++........++++++++........................++++++++++++....++++++++.................... ", " ....++++++++........++++++++........++++++++........................++++++++++++....++++++++.................... ", " ....++++++++++++++++++++++++........++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++++++++++++++++++........++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++++++++++++++++++........++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++++++++++++++++++........++++++++.... ....++++++++++++....++++++++.... ", " @@@@....++++++++++++++++++++............++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " @@@@....++++++++++++++++++++............++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " @@@@....++++++++++++++++++++............++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " @@@@....++++++++++++++++++++............++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " ....++++++++............ ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++............ ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++............ ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++............ ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++.... ....++++++++.... ....++++++++++++....++++++++.................... ", " ....++++++++.... ....++++++++.... ....++++++++++++....++++++++.................... ", " ....++++++++.... ....++++++++.... ....++++++++++++....++++++++.................... ", " ....++++++++.... ....++++++++.... ....++++++++++++....++++++++.................... ", " @@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++++++++++++++++++.... ", " @@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++++++++++++++++++.... ", " @@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++++++++++++++++++.... ", " @@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++++++++++++++++++.... ", " ....++++++++.... ....++++++++.... ....++++++++++++....++++++++++++++++++++++++.... ", " ....++++++++.... ....++++++++.... ....++++++++++++....++++++++++++++++++++++++.... ", " ....++++++++.... ....++++++++.... ....++++++++++++....++++++++++++++++++++++++.... ", " ....++++++++.... ....++++++++.... ....++++++++++++....++++++++++++++++++++++++.... ", " ....++++++++........................++++++++.... ....++++++++++++....++++++++.................... ", " ....++++++++........................++++++++.... ....++++++++++++....++++++++.................... ", " ....++++++++........................++++++++.... ....++++++++++++....++++++++.................... ", " ....++++++++........................++++++++.... ....++++++++++++....++++++++.................... ", " @@@@....++++++++++++++++++++++++........++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " @@@@....++++++++++++++++++++++++........++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " @@@@....++++++++++++++++++++++++........++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " @@@@....++++++++++++++++++++++++........++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " ....++++++++++++++++.... ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++++++++++.... ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++++++++++.... ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++++++++++.... ....++++++++.... ....++++++++++++....++++++++.... ", " ................ ....++++++++.... ....++++++++++++....++++++++.... ", " ................ ....++++++++.... ....++++++++++++....++++++++.... ", " ................ ....++++++++.... ....++++++++++++....++++++++.... ", " ................ ....++++++++.... ....++++++++++++....++++++++.... ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++.... ....++++++++++++....++++++++.... ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++....@@@@@@@@@@@@ ", " ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++.... ....++++++++++++....++++++++.... ", " ....++++++++.... ....++++++++++++....++++++++.................... ", " ....++++++++.... ....++++++++++++....++++++++.................... ", " ....++++++++.... ....++++++++++++....++++++++.................... ", " ....++++++++.... ....++++++++++++....++++++++.................... ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++++++++++++++++++.... ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++++++++++++++++++.... ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++++++++++++++++++.... ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....++++++++....@@@@@@@@@@@@@@@@....++++++++++++....++++++++++++++++++++++++.... ", " ................ ....++++++++++++....++++++++++++++++++++++++.... ", " ................ ....++++++++++++....++++++++++++++++++++++++.... ", " ................ ....++++++++++++....++++++++++++++++++++++++.... ", " ................ ....++++++++++++....++++++++++++++++++++++++.... ", " ................................................ ", " ................................................ ", " ................................................ ", " ................................................ ", " ", " ", " ", " "}; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/shared/efte40x40.xpm�������������������������������������������������������������0000664�0000764�0000764�00000003523�11063277741�016700� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char * efte40x40_xpm[] = { "40 40 4 1", " c None", ". c #000000", "+ c #FF0000", "@ c #FFFFFF", " ", " ........ ", " .++++++. ", " .++++++. ", " @@@@@@@@@@@@.++++++.............@@@ ", " .++....+++++++++++.. ", " ...... .++.. .+++++++++++.. ", " ..+++++. .++.. .....+++...... ", " @@..+++++.@@.++..@.....+++......@@@ ", " .+++++++...++.. .+++.. ", " .++...++...++........+++........... ", " .++...++...+++++++...+++..+++++++.. ", " @@.++...++...+++++++...+++..+++++++.. ", " .++...++...+++++++...+++..+++++++.. ", " .++...++...++........+++..++....... ", " .+++++++...++.. .+++..++.. ", " @@.++++++....++..@@@@@.+++..++..@@@ ", " .++.... .++.. .+++..++.. ", " .++.... .++.. .+++..++.. ", " .++.. .++.. .+++..++....... ", " @@.++..@@@@@.++..@@@@@.+++..+++++++.. ", " .++.. .++.. .+++..+++++++.. ", " .++... .++.. .+++..++....... ", " .++...... .++.. .+++..++....... ", " @@.+++++++.@.++..@@@@@.+++..++..@@@ ", " .+++++. .++.. .+++..++.. ", " ..... .++.. .+++..++.. ", " @@@@@@@@@@@@.++..@@@@@.+++..++..@@@ ", " .++.. .+++..++.. ", " .++.. .+++..++.. ", " .++.. .+++..++.. ", " @@@@@@@@@@@@.++..@@@@@.+++..++..@@@ ", " .++.. .+++..++.. ", " .++.. .+++..++.. ", " .++.. .+++..++....... ", " @@@@@@@@@@@@.++..@@@@@.+++..+++++++.. ", " ..... .+++..+++++++.. ", " ............... ", " ............... ", " "}; �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/shared/eftewin32.ico�������������������������������������������������������������0000664�0000764�0000764�00000006276�11043434577�017041� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ���� �����(��� ���@���������� �� �� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������a!����a������������!����??����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������efte-1.1/packaging/shared/efte16x16_simple.xpm������������������������������������������������������0000664�0000764�0000764�00000000634�11063277741�020257� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char * efte16x16_simple_xpm[] = { "16 16 2 1", " c None", ". c #FF0000", " ", " .. ", " . ..... ", " ... . . ", " . . ... . ... ", " . . . . . ", " .. . . . ", " . . . . ", " . . . ... ", " ... . . . ", " . . . ", " . . . ", " . . . ", " . . . ", " . ... ", " "}; ����������������������������������������������������������������������������������������������������efte-1.1/packaging/shared/efte48x48.xpm�������������������������������������������������������������0000664�0000764�0000764�00000005063�11063275366�016722� 0����������������������������������������������������������������������������������������������������ustar �lauri���������������������������lauri������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char * efte48x48_xpm[] = { "48 48 4 1", " c None", ". c #000000", "+ c #FF0000", "@ c #FFFFFF", " ", " ........... ", " ........... ", " ..+++++++.. ", " @@@@@@@@@@@@@..+++++++...............@@@@@ ", " @@@@@@@@@@@@@..+++++++...............@@@@@ ", " ..+++....++++++++++++++. ", " ........ ..+++. .++++++++++++++. ", " ........ ..+++. .++++++++++++++. ", " @...++++++..@..+++.@@......++++......@@@@@ ", " ..+++++++++...+++. ..++++.. ", " ..+++++++++...+++. ..++++.. ", " ..+++...+++...+++.........++++............ ", " ..+++...+++...+++++++++...++++..+++++++++. ", " ..+++...+++...+++++++++...++++..+++++++++. ", " @..+++...+++...+++++++++...++++..+++++++++. ", " ..+++...+++...+++.........++++..+++....... ", " ..+++...+++...+++.........++++..+++....... ", " ..+++++++++...+++. ..++++..+++. ", " @..+++++++.....+++.@@@@@@..++++..+++.@@@@@ ", " @..+++++++.....+++.@@@@@@..++++..+++.@@@@@ ", " ..+++.... ..+++. ..++++..+++. ", " ..+++. ..+++. ..++++..+++....... ", " ..+++. ..+++. ..++++..+++....... ", " @..+++.@@@@@@..+++.@@@@@@..++++..+++++++++. ", " ..+++. ..+++. ..++++..+++++++++. ", " ..+++. ..+++. ..++++..+++++++++. ", " ..+++.........+++. ..++++..+++....... ", " @..+++++++++...+++.@@@@@@..++++..+++.@@@@@ ", " @..+++++++++...+++.@@@@@@..++++..+++.@@@@@ ", " .++++++.. ..+++. ..++++..+++. ", " ...... ..+++. ..++++..+++. ", " ...... ..+++. ..++++..+++. ", " @@@@@@@@@@@@@..+++.@@@@@@..++++..+++.@@@@@ ", " ..+++. ..++++..+++. ", " ..+++. ..++++..+++. ", " ..+++. ..++++..+++. ", " @@@@@@@@@@@@@..+++.@@@@@@..++++..+++.@@@@@ ", " @@@@@@@@@@@@@..+++.@@@@@@..++++..+++.@@@@@ ", " ..+++. ..++++..+++. ", " ..+++. ..++++..+++....... ", " ..+++. ..++++..+++....... ", " @@@@@@@@@@@@@..+++.@@@@@@..++++..+++++++++. ", " ...... ..++++..+++++++++. ", " ...... ..++++..+++++++++. ", " .................. ", " ", " "}; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
        C-E A-C" { HTML_CAPTION } item "&Header
        C-E A-H" { HTML_TH } item "&Row
        C-E A-D" { HTML_TD } item "Co&lumn