diff options
Diffstat (limited to 'ycurses')
54 files changed, 3479 insertions, 0 deletions
diff --git a/ycurses/COPYING b/ycurses/COPYING new file mode 100644 index 0000000..27058a5 --- /dev/null +++ b/ycurses/COPYING @@ -0,0 +1,338 @@ + 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 + 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. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + 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. + + <signature of Ty Coon>, 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. diff --git a/ycurses/Makefile b/ycurses/Makefile new file mode 100644 index 0000000..6e1e203 --- /dev/null +++ b/ycurses/Makefile @@ -0,0 +1,69 @@ +MAKE=`tail -n 1 make.version` +PREFIX=`grep "define PREFIX" src/glob.h | cut -d'"' -f2` +all: version base + @echo If you want to help the ycurses project please run gmake mail + @echo so that the developers receive an email about the platform + @echo being used. + @echo WARNING! This software is EXPERIMENTAL! +mail: + @echo "VERSION:" > mail.tmp + @${MAKE} version >> mail.tmp + @echo >> mail.tmp + @echo "UNAME:" >> mail.tmp + @uname -a >> mail.tmp + @echo >> mail.tmp + @echo "DATE:" >> mail.tmp + @date >> mail.tmp + @echo >> mail.tmp + @echo "COMPILER AND MAKE:" >> mail.tmp + @cat g++.version make.version >> mail.tmp + @cat mail.tmp | mail -s "Successfull build of ycurses" successfullbuild@yhttpd.org + @rm -f mail.tmp +install: deinstall +uninstall: deinstall +deinstall: + @echo Install/deinstall is not supported! + @echo Start ycurses with ./bin/ycurses instead! + @exit 1 +base: + @if test -f bin/ycurses; then echo "Backing up old binary";if test -f bin/ycurses.old; then rm -f bin/ycurses.old; fi; mv bin/ycurses bin/ycurses.old; fi + @perl ./scripts/buildnr.pl + @perl ./scripts/setglobvals.pl + @${MAKE} -C ./src +clean_base: + @${MAKE} -C ./src clean +stats: + @perl scripts/stats.pl +run: + ./bin/ycurses +base_start: base + ./bin/ycurses +gpl: + @more COPYING +clean: clean_base +help: + @echo "You may run ${MAKE} with the following parameters:" + @grep "^ ${MAKE} " README + @echo "For more questions read the README file or contact mail@ycurses.org!" +setup: + @./configure + @${MAKE} +config: + @sh -c "scripts/config.sh" + @echo If you run ${MAKE} config from the command line then you may need + @echo to rerun ./configure and recompile all now! + +mrproper: clean + @if test -f src/glob.h.org; then mv -f src/glob.h.org src/glob.h;fi + @if test -f g++.version; then rm -f g++.version; fi + @if test -f make.version; then rm -f make.version; fi + @if test -f src/Makefile; then rm -f src/Makefile; fi + @if test -f bin/ycurses; then find bin/ -name "ycurses*" | xargs rm -f; fi + @find . -name "*.add" | xargs rm -f + @ls | grep core | xargs rm -f +version: + @./scripts/version.sh +debug: + @gdb bin/ycurses ycurses.core +confdebug: + ./configure -g3 -ggdb diff --git a/ycurses/README b/ycurses/README new file mode 100644 index 0000000..e2e9237 --- /dev/null +++ b/ycurses/README @@ -0,0 +1,382 @@ +yCurses; Version 0.1-CURRENT + +Copyright (C) 2005 EXA Digital Solutions GbR +----------------------------------------------------------------- +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +----------------------------------------------------------------- + +YCURSES TABLE OF CONTENTS: + +1.0.0 REQUIREMENTS +2.0.0 LICENSE + +1.0.0 REQUIREMENTS: + +- GNU GCC G++ + The GNU C++ compiler version 3.1 or up. + +- GNU make 3.80 (gmake) or higher + If you dont have a gmake executable but make is gnu make then you need + to add a symlink or alias from gmake to make. + yChat Makefiles only have been tested with GNU make and may not work with + other make versions. + +- ncurses 5.x + Includes libncurses and the ncurses.h header files. + +- Perl 5.x + Is needed for some scripts. Is not needed if you use precompiled binaries. + +2.0.0 LICENSE + + 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. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + 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. + + <signature of Ty Coon>, 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. diff --git a/ycurses/SHORTDESC b/ycurses/SHORTDESC new file mode 100644 index 0000000..ac17c13 --- /dev/null +++ b/ycurses/SHORTDESC @@ -0,0 +1,3 @@ +ycurses is a small C++ wrapper around the C ncurses API designed to be used in +the yChat core. + diff --git a/ycurses/TODO b/ycurses/TODO new file mode 100644 index 0000000..53c0ef4 --- /dev/null +++ b/ycurses/TODO @@ -0,0 +1,3 @@ +Adopt ychat coding style. +Message box +Curses obj counter diff --git a/ycurses/configure b/ycurses/configure new file mode 100755 index 0000000..9aab971 --- /dev/null +++ b/ycurses/configure @@ -0,0 +1,77 @@ +#!/bin/sh + +if ! ./scripts/checkperl.sh +then + exit 1 +fi + +perl -e ' + use strict; + $|=1; + sub check_gcc { + my $f = shift; + my $s = shift; + my $r = 0; + print "Checking for GNU G++ $f.$s\n"; + if ( `g++ -v 2> g++.version && tail -n 1 g++.version` =~ / $f\.$s/ ) { + `echo $f.$s >> g++.version`; + `echo g++ >> g++.version`; + $r = 1; + } else { + if (`g++$f$s -v 2> g++.version && tail -n 1 g++.version` =~ / $f\.$s/) { + `echo $f.$s >> g++.version`; + `echo g++$f$s >> g++.version`; + $r = 1; + } + } + print "No " if $r == 0; + print "GNU G++ $f.$s found!\n"; + return $r; + } + sub check_make { + print "Checking for GNU make\n"; + my $err = "No GNU make found.\nPlease install a version of GNU make!\n"; + my $make; + if (`which gmake`) { + $make = "gmake"; + } elsif ( `which make` ) { + $make = "make"; + } else { + print $err; + exit(1); + } + + `sh -c "$make -v > make.version 2>/dev/null"`; + if ( `cat make.version` =~ /GNU Make/ ) { + `echo $make >> make.version`; + } else { + print $err; + exit(1); + } + } + &check_make; + print "Checking compiler version\n"; + my $r = 0; + for (my $i = 4; $i > 0 && $r == 0; --$i ) { + $r = &check_gcc(3,$i); + } + if ($r == 0) { + print "No suitable g++ compiler found!\n"; + print "Please install a right version of GNU G++!\n"; + exit(1); + } + + system("perl \"scripts/config.pl\""); + chdir("src"); + system("./configure ".join(" ", @ARGV)); + chdir(".."); + + exit(0); +' `echo "$*" | sed "s/-//g"` + +if test -f err +then + rm -f err +else + echo You are ready to type gmake now! +fi diff --git a/ycurses/scripts/README b/ycurses/scripts/README new file mode 100644 index 0000000..e44cc2d --- /dev/null +++ b/ycurses/scripts/README @@ -0,0 +1,6 @@ +All scripts should be run from the ycurses main directory, example: + +./scripts/makeycurses.pl + + +A ./makeycurses.pl WILL NOT work :) diff --git a/ycurses/scripts/astyle.sh b/ycurses/scripts/astyle.sh new file mode 100755 index 0000000..f986cde --- /dev/null +++ b/ycurses/scripts/astyle.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# The ycurses Project (2004) +# +# This uses "astyle" to format C++ code into a specific code style! + +for f in h cpp tmpl +do + for i in `find . -name "*.$f"` + do + echo $i + astyle --style=ansi -s2 $i + rm -f $i.orig + done +done diff --git a/ycurses/scripts/buildnr.pl b/ycurses/scripts/buildnr.pl new file mode 100755 index 0000000..7867787 --- /dev/null +++ b/ycurses/scripts/buildnr.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl + +# The ycurses Project (2003) +# +# This script increases the BUILNR of src/msgs.h each time the ycurses +# gets recompiled! + +use strict; + +open MSGS, "src/msgs.h"; +my @msgs = <MSGS>; +close MSGS; + +foreach (@msgs) +{ + if ( /define BUILDNR/ ) + { + s/(BUILDNR )(.+)$/$1.($2+1)/e; + print; + next; + } +} + +open MSGS, ">src/msgs.h"; +print MSGS @msgs; +close MSGS; diff --git a/ycurses/scripts/checkperl.sh b/ycurses/scripts/checkperl.sh new file mode 100755 index 0000000..418087f --- /dev/null +++ b/ycurses/scripts/checkperl.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# The ycurses Project (2005) +# +# This scripts checks for a perl installation + +if ! which perl >/dev/null +then + echo You need to have Perl in your PATH! + exit 1 +fi + +echo Using `which perl` +exit 0 diff --git a/ycurses/scripts/config.pl b/ycurses/scripts/config.pl new file mode 100755 index 0000000..afb4d76 --- /dev/null +++ b/ycurses/scripts/config.pl @@ -0,0 +1,144 @@ +#!/usr/bin/perl + +# The ycurses Project (2004, 2005) +# +# This script modifues the src/glob.h file. + +use strict; +use scripts::modules::file; + +print <<END; +Welcome to the ycurses configurator! +You may also edit the src/glob.h file manually instead of using +this configurator option. Please also notice that this are only +before-compile options. All setups which can be made after com- +iling are placed in the ycurses configuration file. +END + +my $sep = "================================================================\n"; +my $stdin; + +for (;;) +{ + print "$sep Do you want to use the default before-compile options?\n"; + print " (yes/no) [default is NO] "; + $stdin = <STDIN>; + chomp $stdin; + prove_if_default(\$stdin); + print "\n"; + + if ( $stdin eq "yes") + { + print " You chose to use all the default before-compile options. Exiti-\n"; + print " ng the configurator now!\n"; + print $sep; + exit(0); + } + + last if $stdin eq "no" or $stdin eq ""; + print " Wrong input: You need to specify yes or no!\n"; +} # for + +`cp src/glob.h src/glob.h.org` unless -f "src/glob.h.org"; + +my @glob = fopen("src/glob.h.org"); +my $flag = 0; + +for (@glob) +{ + if ( $flag == 0 && /- CONFIG -/ ) + { + print $sep; + $flag = 1; + next; + } + + elsif ( $flag == 1 ) + { + if ( /\*\// ) + { + $flag = 2; + } + + else + { + print; + } + + next; + } + + elsif ( $flag == 2 ) + { + if ( /#define (.+) (.+)/ ) + { + my $def = $1; + my $val = $2; + my $flg = 0; + + $flg = 1 if $val =~ s/"//g; + + print " [Press enter to use default value: $val] "; + $stdin = <STDIN>; + chomp $stdin; + + unless ( prove_if_default(\$stdin) ) + { + $stdin = "\"$stdin\"" if $flg == 1; + $_ = "#define $def $stdin\n"; + } + + print "\n"; + $flag = 0; + next; + } + + elsif ( /#define .+/ ) + { + my $default = "true"; + my $stdin; + + for (;;) + { + $default = "false" if /\/\/#define/; + + print " [Press enter to use default value: $default] "; + $stdin = <STDIN>; + chomp $stdin; + + last if $stdin eq "" || $stdin eq "true" || $stdin eq "false"; + print " Wrong input: You need to specify true or false!\n"; + } + + if ( $default eq "true" ) + { + $_ = "//$_" + unless prove_if_default(\$stdin); + } + + else + { + s/^\/\/// + unless prove_if_default(\$stdin); + } + + print "\n"; + $flag = 0; + next; + } + } +} // for + + fwrite("src/glob.h", @glob); + +sub prove_if_default +{ + my $val = shift; + if ( $$val eq "" ) + { + print " -> Using default option!\n"; + return 1; + } + print " -> Using new option $$val!\n"; + return 0; +} diff --git a/ycurses/scripts/modules/file.pm b/ycurses/scripts/modules/file.pm new file mode 100644 index 0000000..b11e2b3 --- /dev/null +++ b/ycurses/scripts/modules/file.pm @@ -0,0 +1,28 @@ +sub dopen +{ + my $shift = shift; + opendir DIR, $shift or die "$shift: $!\n"; + my @dir = readdir(DIR); + closedir DIR; + return @dir; +} + +sub fopen +{ + my $shift = shift; + open FILE, $shift or die "$shift: $!\n"; + my @file = <FILE>; + close FILE; + return @file; +} + +sub fwrite +{ + my $shift = shift; + my @file = @_; + open FILE, ">$shift" or die "$shift: $!\n"; + print FILE @file; + close FILE; +} + +1; diff --git a/ycurses/scripts/screen.sh b/ycurses/scripts/screen.sh new file mode 100755 index 0000000..23d4e66 --- /dev/null +++ b/ycurses/scripts/screen.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +screen -S ycurses ./bin/ycurses diff --git a/ycurses/scripts/setglobvals.pl b/ycurses/scripts/setglobvals.pl new file mode 100755 index 0000000..f0763ac --- /dev/null +++ b/ycurses/scripts/setglobvals.pl @@ -0,0 +1,32 @@ +#!/usr/bin/perl + +# The ycurses Project (2003) +# +# This script sets up some variables in src/glob.h + +use strict; + +use scripts::modules::file; + +my $file = 'src/glob.h'; +my $gmake = `which gmake`; +my @glob = fopen($file); +chomp($gmake); + +print "-> Setting values in $file\n"; + +my $modified = 0; +foreach (@glob) +{ + if (/^(#define GMAKE) "(.*)"/) + { + if ($2 ne "$gmake \\0") + { + s/^$1 "$2"/#define GMAKE "$gmake \\0"/; + print " -> Set $gmake\n"; + fwrite($file,@glob); + last; + } + } +} + diff --git a/ycurses/scripts/stats.pl b/ycurses/scripts/stats.pl new file mode 100755 index 0000000..222c16e --- /dev/null +++ b/ycurses/scripts/stats.pl @@ -0,0 +1,95 @@ +#!/usr/bin/perl + +# The ycurses Project (2003 - 2004) +# +# This script generates source code and project statistics + +use strict; + +use scripts::modules::file; + +my %stats; +my $param = shift; + +&recursive("."); + +$stats{"Lines total"} = $stats{"Lines of source"} + + $stats{"Lines of scripts"} + + $stats{"Lines of text"} + + $stats{"Lines of HTML"}; + +unless (defined $param) { + + print "$_ = " . $stats{$_} . "\n" + for ( sort keys %stats ); + +} else { + + print $stats{$_} . " " + for sort keys %stats; + +} + +print "\n"; + +sub recursive +{ + my $shift = shift; + my @dir = &dopen($shift); + + foreach (@dir) + { + next if /^\.$/ or /^\.{2}$/; + + if ( -f "$shift/$_" ) + { + $stats{"Number of files total"}++; + &filestats("$shift/$_"); + } + elsif ( -d "$shift/$_" ) + { + $stats{"Number of dirs total"}++; + &recursive("$shift/$_"); + } + } +} + +sub filestats +{ + my $shift = shift; + if ( $shift =~ /\.(cpp|h|tmpl)$/ ) + { + $stats{"Number of source files"}++; + $stats{"Lines of source"} += countlines($shift); + } + elsif ( $shift =~ /\.(html|css)$/ ) + { + $stats{"Number of HTML files"}++; + $stats{"Lines of HTML"} += countlines($shift); + } + elsif ( $shift =~ /\.(gif|png|jpg)$/ ) + { + $stats{"Number of gfx files"}++; + } + elsif ( $shift =~ /(\.pl|\.sh|configure.*|Makefile.*)$/ ) + { + $stats{"Number of script files"}++; + $stats{"Lines of scripts"} += countlines($shift); + } + elsif ( $shift =~ /(\.txt|README|INSTALL|COPYING|NEWS|SNAPSHOT|CHANGES|RELEASES)$/ ) + { + $stats{"Number of text files"}++; + $stats{"Lines of text"} += countlines($shift); + } + elsif ( $shift =~ /\.so$/ ) + { + $stats{"Number of compiled module files"}++; + } +} + +sub countlines +{ + my $shift = shift; + my @file = fopen($shift); + return $#file; +} diff --git a/ycurses/scripts/version.sh b/ycurses/scripts/version.sh new file mode 100755 index 0000000..8bb9bdd --- /dev/null +++ b/ycurses/scripts/version.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# The ycurses Project (2005) +# +# This script shows ycurses VERSION-BRANCH Build BUILDNUMBER + +version=`grep VERSION src/msgs.h | head -n 1 | cut -d'"' -f2` +branch=`grep BRANCH src/msgs.h | head -n 1 | cut -d'"' -f2` +build=`grep BUILD src/msgs.h | tail -n 1 | cut -d' ' -f3` +echo "ycurses $version-$branch Build $build" + + diff --git a/ycurses/src/Makefile.in b/ycurses/src/Makefile.in new file mode 100644 index 0000000..7723d45 --- /dev/null +++ b/ycurses/src/Makefile.in @@ -0,0 +1,21 @@ +SRCS=WILLBEADDEDBYCONFIGURE +OBJS=$(addprefix ../obj/,$(SRCS:.cpp=.o)) +CC=WILLBEADDEDBYCONFIGURE +LIBADD=`cat libs.add` +LDFLAGS=$(LIBADD) -lstdc++ +LDADD= +INCLUDES=`cat includes.add` +CFLAGS=-fno-inline -fno-default-inline -frepo +all: ycurses +$(SRCS): + $(CC) $(INCLUDES) $(CFLAGS) -c $*.cpp +infotext: + @echo Compiling base +ycurses: infotext $(OBJS) + $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDADD) + @mv ycurses ../bin + @echo -n "Size of linked executable: " + @du -hc ../bin/ycurses | tail -n 1 +clean: + @echo Cleaning base obj + @if test -d ../obj; then rm -Rf ../obj; fi diff --git a/ycurses/src/configure b/ycurses/src/configure new file mode 100755 index 0000000..cb7c9ff --- /dev/null +++ b/ycurses/src/configure @@ -0,0 +1,330 @@ +#!/bin/sh + +# +# The ycurses Project (2003 - 2005) +# + +if ! ../scripts/checkperl.sh +then + exit 1 +fi + +if ! test -f ../g++.version +then + echo You need to run ./configure of the top level source dir first + exit 1 +fi + +perl -e ' + use strict; + $|=1; + + my %libadd; + my %incadd; + my $deepness = 500; + + my @headers = ( + "ncurses.h", + "menu.h", + "panel.h" + ); + + my @libs = ( + "libpanel.so", + "libmenu.so", + "libncurses.so" + ); + + my @headerpaths = ( + $ENV{HOME}."/include", + $ENV{HOME}."/usr/include", + "/include", + "/usr/include", + "/usr/local/include", + "/usr/lib/", + "/usr/pkg/include", + "/opt/include", + "/opt/local/include" + ); + + my @libpaths = ( + $ENV{HOME}."/lib", + $ENV{HOME}."/usr/lib", + "/lib", + "/usr/lib", + "/usr/local/lib", + "/usr/pkg/lib", + "/opt/lib", + "/opt/local/lib" + ); + + open FILE, "glob.h" or die "glob.h: $!\n"; + while(<FILE>) + { + if ( /\/\/#define DATABASE/ ) + { + remove_from_array("mysql/mysql.h",\@headers); + remove_from_array("libmysqlclient.so",\@libs); + } + + elsif ( /\/\/#define NCURSES/ ) + { + remove_from_array("ncurses.h",\@headers); + remove_from_array("libncurses.so",\@libs); + } + } + close FILE; + + if ( defined $ENV{YHTTPDHEADERPATHS} ) + { + map { print "Adding $_...\n"; + unshift @headerpaths, $_ } split /:/, $ENV{YHTTPDHEADERPATHS}; + } + + if ( defined $ENV{YHTTPDLIBPATHS} ) + { + map { print "Adding $_...\n"; + unshift @libpaths, $_ } split /:/, $ENV{YHTTPDLIBPATHS}; + } + + + print "Headers:\n"; + + my $testit = 0; + map { $incadd{&check($deepness, $_, @headerpaths)}++ } + @headers; + + $testit = 0; + print "Libraries:\n"; + map { $libadd{&check($deepness, $_, @libpaths)}++ } + @libs; + + my $incadd = &make_add("-I", \%incadd); + my $libadd = &make_add("-L", \%libadd); + + for ( @libs ) + { + $libadd .= "-l$_ " if s/^lib// and s/\.so$//; + } + + print "Incadd: $incadd\n"; + print "Libadd: $libadd\n"; + + `echo $incadd > includes.add`; + `echo $libadd > libs.add`; + + print "Creating new base Makefile...\n"; + unlink("Makefile") if -f "Makefile"; + unlink("../err") if -f "../err"; + open Fin, "Makefile.in" or die "Makefile.in: $!\n"; + open Fout, ">Makefile" or die "Makefile: $!\n"; + +# my $cpp = `echo *.cpp */*.cpp contrib/*/*.cpp | sort`; + my $cpp = `echo *.cpp */*.cpp | sort`; + my $compiler = `tail -n 1 ../g++.version`; + my $version = `tail -n 2 ../g++.version | head -n 1`; + my $uname = `uname -srm`; + my $compopt = join "; ", split /\n/, `cat ../g++.version`; + + chomp $uname; + chomp $compopt; + + print "Configuring for $uname...\n"; + chomp $cpp; + chomp $version; + + while (<Fin>) + { + s/^(CC=).*\n/$1$compiler/; + s/^(SRCS=).*/$1$cpp/; + s/ -frepo//; # unless $version =~ /3\.4/; + if ( $uname !~ /Linux/i ) { + print "Disabling -ldl flag...\n" if s/ -ldl//; + } + print Fout; + } + close Fin; + + my $args = join(" -",@ARGV); + $args = "-".$args unless $args eq ""; + + for my $cppfile (split / /, $cpp) + { + my $ofile = $cppfile; + $ofile =~ s/\.cpp/\.o/; + print Fout "../obj/$ofile: $cppfile\n"; + print Fout "\t\@if ! test -d `dirname ../obj/$ofile`; then mkdir -p `dirname ../obj/$ofile`; fi\n"; + my $class = $ofile; + $class =~ s/\.o//; + if ( $class =~ /contrib\/.+/ ) + { + my $dirname = `dirname $class`; + print Fout "\t\@echo -n \"Compiling contributed class $class \"\n"; + } + + else + { + print Fout "\t\@echo -n \"Compiling base class $class \"\n"; + } + + print Fout "\t\@\$(CC) \$(CFLAGS) \$(INCLUDES) $args -c -o ../obj/$ofile $cppfile\n"; + print Fout "\t\@du -hc ../obj/$ofile | tail -n 1 | sed s/total// | sed \"s/ //g\"\n"; + } + + close Fout; + + open F, "msgs.h" or die "msgs.h: $!\n"; + my @msgs = <F>; + close F; + unlink("msgs.h"); + open F, ">msgs.h" or die "msgs.h: $!\n"; + + for (@msgs) + { + s/(UNAME)(.+)$/UNAME "$uname"/; + s/(COMPOPT)(.+)$/COMPOPT "$compopt"/; + print F; + } + close F; + + if ( -d "mods" ) + { + chdir("mods"); + my $cflags = "-fno-inline -fno-default-inline"; + + $cflags .= " -nostdlib" if $uname =~ /FreeBSD/i && `uname -r` =~ /^4\./; + + system("echo $cflags > cflags.add"); + system("./configure"); + chdir(".."); + } + + sub remove_from_array + { + my $elem = shift; + my $array = shift; + + for ( my $i = 0; $i <= $#$array; ++$i ) + { + if ( $$array[$i] eq $elem ) + { + splice(@$array,$i,1); + last; + } + } # for + } + + sub check { + my $deep = shift; + + if ($deep == 0) { + print "Looking too deep! ($deepness)\n"; + exit(1); + } + + my $check = shift; + $testit = 1 if $check =~ s/::test:://; + + my $print = 1; + if ( $_[-1] eq "subsearch" ) { + $print = 0; + pop(@_); + } + + if ($print) + { + print "Checking for $check..."; + print "\n" if $testit; + } + + for (@_) + { + if ( -f "$_/$check" ) + { + if ($testit) + { + return $_ if test_include($_, $check); + return ""; + } + + else + { + print "OK\n"; + return "" if $_ eq "/usr/lib" or $_ eq "/usr/include"; + return $_; + } + } + } + + for (@_) + { + next unless -d $_; + opendir D, $_ or warn "$_: $!\n"; + my @dir = readdir(D); + closedir D; + + for my $dir ( @dir ) + { + next if $dir =~ /^\.+$/ or !-d "$_/$dir"; + my $path = &check($deep-1, $check, "$_/$dir", "subsearch"); + return $path if $path ne ""; + } + } + + if ($print) + { + print "NOT OK\n"; + print "Please make sure that you have the needed software installed!\n"; + print "If you have a special path for your includes then edit src/configure!\n"; + print "Or set the environment variables YHTTPDHEADERPATHS and YHTTPDLIBPATHS.\n"; + print " Example: setenv YHTTPDHEADERPATHS \"/your/header/includes:/a/includes\"\n"; + print "(The environment variables have to be seperated by an :)\n"; + print "PS: You may use the locate and/or find command to search for files.\n"; + exit(1); + } + + `touch ../err`; + return ""; + } + + sub make_add { + my $flag = shift; + my $add = shift; + my $ret = ""; + + for (reverse keys %$add) { + next unless /.+/; + $ret .= "$flag$_ "; + } + return $ret; + } + + sub test_include + { + my $shift = shift; + my $check = shift; + my $return = 0; + print "Testing $shift/$check..."; + + `echo "\#include \\"maps/hashmap.h\\"" > __test.cpp`; + `echo "int main(void){return 0;}" >> __test.cpp`; + my $cmd = "`tail -n 1 ../g++.version` -I$shift __test.cpp -o /dev/null 2>/dev/null"; + system $cmd; + + unless ($?) + { + print "OK\n"; + $return = 1; + } + + else + { + print "Not OK\n"; + } + + unlink "__test.cpp" if -f "__test.cpp"; + return $return; + } + + exit(0); +' `echo "$*" | sed "s/-//g"` diff --git a/ycurses/src/curses/attributes.cpp b/ycurses/src/curses/attributes.cpp new file mode 100644 index 0000000..b859da0 --- /dev/null +++ b/ycurses/src/curses/attributes.cpp @@ -0,0 +1,80 @@ +#ifndef ATTRIBUTES_CPP +#define ATTRIBUTES_CPP + +#include "attributes.h" + +attributes::attributes() +{ + init(); +} + +attributes::attributes(int i_attr) +{ + init(); + set(true, i_attr); +} + +attributes::attributes(color& r_color) +{ + init(); + set_color(r_color); +} + +void +attributes::init() +{ + p_color = 0; +} + +void +attributes::use_wattron(WINDOW* p_window) +{ + std::set<int>::iterator iter; + for (iter = set_attr.begin(); iter != set_attr.end(); ++iter) + wattron(p_window, *iter); + + if (p_color) + wattron(p_window, COLOR_PAIR(p_color->get_num())); +} + +void +attributes::use_wattroff(WINDOW* p_window) +{ + std::set<int>::iterator iter; + for (iter = set_attr.begin(); iter != set_attr.end(); ++iter) + wattroff(p_window, *iter); + + if (p_color) + wattroff(p_window, COLOR_PAIR(p_color->get_num())); +} + + +void +attributes::unset_all() +{ + set_attr.clear(); + p_color = 0; +} + +bool +attributes::get(int i_attr) +{ + return set_attr.find(i_attr) != set_attr.end(); +} + +void +attributes::set(bool b, int i_attr) +{ + if ((set_attr.find(i_attr) != set_attr.end() ) == b) + return; + + set_attr.insert(i_attr); +} + +void +attributes::set_color(color& r_color) +{ + this->p_color = &r_color; +} + +#endif diff --git a/ycurses/src/curses/attributes.h b/ycurses/src/curses/attributes.h new file mode 100644 index 0000000..2bc58d6 --- /dev/null +++ b/ycurses/src/curses/attributes.h @@ -0,0 +1,70 @@ +#ifndef ATTRIBUTES_H +#define ATTRIBUTES_H + +#include <set> +#include "incl.h" +#include "color.h" + +using namespace std; + +const int Normal = A_NORMAL; +const int Standout = A_STANDOUT; +const int Underline = A_UNDERLINE; +const int Reverse = A_REVERSE; +const int Blink = A_BLINK; +const int Dim = A_DIM; +const int Bold = A_BOLD; +const int Protect = A_PROTECT; +const int Invis = A_INVIS; +const int AltCharSet = A_ALTCHARSET; +const int CharText = A_CHARTEXT; + +class attributes +{ +private: + void init(); + set<int> set_attr; + bool get(int i_attr); + void set(bool b, int i_attr); + color* p_color; + + friend class window; + void use_wattron(WINDOW* p_window); + void use_wattroff(WINDOW* p_window); + +public: + attributes(); + attributes(int i_attr); + attributes(color& r_color); + + void set(int i_attr) { set(true, i_attr); } + void unset(int i_attr ) { set(false, i_attr); } + void unset_all(); + void set_color(color& r_color); + + void set_normal(bool b) { set(b, Normal); } + void set_standout(bool b) { set(b, Standout); } + void set_underline(bool b) { set(b, Underline); } + void set_reverse(bool b) { set(b, Reverse); } + void set_blink(bool b) { set(b, Blink); } + void set_dim(bool b) { set(b, Dim); } + void set_bold(bool b) { set(b, Bold); } + void set_protect(bool b) { set(b, Protect); } + void set_invisible(bool b) { set(b, Invis); } + void set_altcharset(bool b) { set(b, AltCharSet); } + void set_chartext(bool b) { set(b, CharText); } + + bool get_normal() { return get(Normal); } + bool get_standout() { return get(Standout); } + bool get_underline() { return get(Underline); } + bool get_reverse() { return get(Reverse); } + bool get_blink() { return get(Blink); } + bool get_dim() { return get(Dim); } + bool get_bold() { return get(Bold); } + bool get_protect() { return get(Protect); } + bool get_invisible() { return get(Invis); } + bool get_altcharset() { return get(AltCharSet); } + bool get_chartext() { return get(CharText); } +}; + +#endif diff --git a/ycurses/src/curses/color.cpp b/ycurses/src/curses/color.cpp new file mode 100644 index 0000000..190d343 --- /dev/null +++ b/ycurses/src/curses/color.cpp @@ -0,0 +1,54 @@ +#ifndef COLOR_CPP +#define COLOR_CPP + +#include "color.h" + +bool color::b_activated = false; +int color::i_pair_count = 0; + +color::color(short i, short j) + : i_foreground(i), i_background(j) +{ + init(); + + i_pair = ++i_pair_count; + + /* + * Simple color assignment. color pair 0 cannot + * be redefined. + */ + init_pair(i_pair, i_foreground, i_background); +} + +color::~color() +{ +} + +void +color::init() +{ + if ( !b_activated ) + { + if (has_colors()) + { + start_color(); + b_activated = true; + } + } +} + +void +color::enable() +{ + attron(COLOR_PAIR(i_pair)); +} + +void +color::disable() +{ + attroff(COLOR_PAIR(i_pair)); +} + + +#endif + diff --git a/ycurses/src/curses/color.h b/ycurses/src/curses/color.h new file mode 100644 index 0000000..a59727c --- /dev/null +++ b/ycurses/src/curses/color.h @@ -0,0 +1,39 @@ + +#ifndef COLOR_H +#define COLOR_H + +#include "incl.h" + +using namespace std; + +const short Red = COLOR_RED; +const short Green = COLOR_GREEN; +const short Yellow = COLOR_YELLOW; +const short Blue = COLOR_BLUE; +const short Cyan = COLOR_CYAN; +const short Magenta = COLOR_MAGENTA; +const short White = COLOR_WHITE; +const short Black = COLOR_BLACK; + +class color +{ + private: + void init(); + + static int i_pair_count; + short i_pair; + short i_foreground; + short i_background; + static bool b_activated; + + friend class curses; + + public: + color(short i, short j); + ~color(); + void enable(); + void disable(); + short get_num() { return i_pair; } +}; + +#endif diff --git a/ycurses/src/curses/coordinate.cpp b/ycurses/src/curses/coordinate.cpp new file mode 100644 index 0000000..efdf9e2 --- /dev/null +++ b/ycurses/src/curses/coordinate.cpp @@ -0,0 +1,134 @@ +#ifndef COORDONATE_CPP +#define COORDONATE_CPP + +#include "coordinate.h" + +coordinate::coordinate() +{ + y = x = 0; +} + +coordinate::coordinate(coordinate_type type, dummy_window& r_win) +{ + set(type, r_win); +} + +coordinate::coordinate(coordinate_type type) +{ + set(type); +} + +coordinate::coordinate(int y, int x) +{ + this->y = y; + this->x = x; +} + +coordinate& +coordinate::set(coordinate_type type, dummy_window& r_win) +{ + switch (type) + { + case Absolutecoord: + getyx(r_win.get_WINDOW(), y, x); + break; + + case Relativecoord: + getparyx(r_win.get_WINDOW(), y, x); + break; + + case Beginningcoord: + getbegyx(r_win.get_WINDOW(), y, x); + break; + + case windowSize: + getmaxyx(r_win.get_WINDOW(), y, x); + break; + + default: + set(type); + } + + return *this; +} + +coordinate& +coordinate::set(coordinate_type type) +{ + switch (type) + { + case TerminalSize: + y = COLS; + x = LINES; + break; + + case TerminalCenter: + y = static_cast<int>(COLS / 2); + x = static_cast<int>(LINES / 2); + break; + } + + return *this; +} + +coordinate& +coordinate::left() +{ + return left(1); +} + +coordinate& +coordinate::right() +{ + return right(1); +} + +coordinate& +coordinate::up() +{ + return up(1); +} + +coordinate& +coordinate::down() +{ + return down(1); +} + +coordinate& +coordinate::left(int i) +{ + x -= i; + return *this; +} + +coordinate& +coordinate::right(int i) +{ + x += i; + return *this; +} + +coordinate& +coordinate::up(int i) +{ + y -= i; + return *this; +} + +coordinate& +coordinate::down(int i) +{ + y += i; + return *this; +} + +coordinate& +coordinate::displace(int i_y, int i_x) +{ + y += i_y; + x += i_x; + return *this; +} + +#endif diff --git a/ycurses/src/curses/coordinate.h b/ycurses/src/curses/coordinate.h new file mode 100644 index 0000000..c17b36b --- /dev/null +++ b/ycurses/src/curses/coordinate.h @@ -0,0 +1,43 @@ +#ifndef COORDINATE_H +#define COORDINATE_H + +#include "incl.h" +#include "dummy.h" + +using namespace std; + +enum coordinate_type +{ + Absolutecoord, + Relativecoord, + Beginningcoord, + windowSize, + TerminalSize, + TerminalCenter +}; + + +struct coordinate +{ + int y, x; + + coordinate(); + coordinate(coordinate_type type, dummy_window& r_win); + coordinate(coordinate_type type); + coordinate(int y, int x); + + coordinate& set(coordinate_type type, dummy_window& r_win); + coordinate& set(coordinate_type type); + coordinate& left(); + coordinate& right(); + coordinate& up(); + coordinate& down(); + coordinate& left(int i); + coordinate& right(int i); + coordinate& up(int i); + coordinate& down(int i); + coordinate& displace(int i_y, int i_x); + +}; + +#endif diff --git a/ycurses/src/curses/coordinate.impl b/ycurses/src/curses/coordinate.impl new file mode 100644 index 0000000..8bdf17c --- /dev/null +++ b/ycurses/src/curses/coordinate.impl @@ -0,0 +1,17 @@ +template<class T> +coordinate +create_coordinate(dummy_window& d_window) +{ + coordinate coord; + T(d_window, coord.x, coord.y); + return coord; +} + +template<class T> +coordinate +create_coordinate() +{ + coordinate coord; + T(coord.x, coord.y); + return coord; +} diff --git a/ycurses/src/curses/curses.cpp b/ycurses/src/curses/curses.cpp new file mode 100644 index 0000000..3605e59 --- /dev/null +++ b/ycurses/src/curses/curses.cpp @@ -0,0 +1,86 @@ +#ifndef CURSES_CPP +#define CURSES_CPP + +#include "curses.h" + +int curses::i_self_counter = 0; + +curses::curses() +{ + if ( ++i_self_counter == 1 ) + { + initscr(); + raw(); + keypad(stdscr, TRUE); + noecho(); + } +} + +curses::~curses() +{ + if ( --i_self_counter == 0 ) + { +/* + Factory<attributes>::destroyAll(); + Factory<color>::destroyAll(); + Factory<window>::destroyAll(); + Factory<menu>::destroyAll(); + Factory<pwindow>::destroyAll(); + */ + clear(); + endwin(); + } +} + +void +curses::finish() +{ +} + +int +curses::get_char() +{ + return getch(); +} + +string +curses::get_string() +{ + char c[1024]; + getstr(c); + return string(c); +} + +void +curses::pause() +{ + getch(); +} + +void +curses::disable() +{ + refresh(); + def_prog_mode(); + endwin(); +} + +void +curses::enable() +{ + reset_prog_mode(); + refresh(); +} + +void +curses::clear() +{ + coordinate coord(LINES, COLS); + for ( int i = 0; i < coord.y; ++i ) + for ( int j = 0; j < coord.x; ++j ) + mvaddch(i, j, ' '); + + refresh(); +} + +#endif diff --git a/ycurses/src/curses/curses.h b/ycurses/src/curses/curses.h new file mode 100644 index 0000000..04ed707 --- /dev/null +++ b/ycurses/src/curses/curses.h @@ -0,0 +1,55 @@ +#ifndef CURSES_H +#define CURSES_H + +#include "attributes.h" +#include "incl.h" +#include "color.h" +#include "cursor.h" +#include "menu.h" +#include "pwindow.h" +#include "tool.h" +#include "window.h" +#include "coordinate.h" + +using namespace std; + +/* This class is representing the base of curses, it has to be instantiated + * in order to use curses. + */ +class curses +{ + private: + static int i_self_counter; + + public: + /* Initializes curses before its first use */ + curses(); + + /* Removes all curses elements, all objects (such as window, color etc) + * be finished as well! + */ + ~curses(); + + /* Waits for user intput and returns the ASCII code being typed */ + static int get_char(); + + /* Returns the string being typed until the first return */ + static string get_string(); + + /* Waits intil the user hits a key */ + static void pause(); + + static void disable(); + static void enable(); + + /* Removes all curses elements, all objects (such as window, color etc) will + * be finished as well! This method will be called by ~curses internally. + * You can also use this method instead of the destructor if you wanna use + * another shutdown routine like catching SIGINT first, deleting your own + * stuff, and then running curses::finish();! + */ + static void finish(); + static void clear(); +}; + +#endif diff --git a/ycurses/src/curses/cursor.cpp b/ycurses/src/curses/cursor.cpp new file mode 100644 index 0000000..eaa10a7 --- /dev/null +++ b/ycurses/src/curses/cursor.cpp @@ -0,0 +1,32 @@ +#ifndef CURSOR_CPP +#define CURSOR_CPP + +#include "cursor.h" + +cursor::cursor() +{ +} + +cursor::cursor(cursorType t) +{ + set(t); +} + +cursor::cursor(coordinate& r_coord) +{ + set(r_coord); +} + +void +cursor::set(cursorType t) +{ + curs_set(t); +} + +void +cursor::set(coordinate& r_coord) +{ + move(r_coord.y, r_coord.x); +} + +#endif diff --git a/ycurses/src/curses/cursor.h b/ycurses/src/curses/cursor.h new file mode 100644 index 0000000..504a44c --- /dev/null +++ b/ycurses/src/curses/cursor.h @@ -0,0 +1,30 @@ +#ifndef CURSOR_H +#define CURSOR_H + +#include "incl.h" +#include "coordinate.h" + +using namespace std; + +enum cursorType +{ + Invisible = 0, + Visible, + VeryVisible +}; + +struct cursor +{ + cursor(); + cursor(cursorType t); + cursor(coordinate& r_coord); + + static void set(cursorType t); + static void set(coordinate& r_coord); + + static void set_invisible() { set(Invisible); } + static void setVisible() { set(Visible); } + static void setVeryVisible() { set(VeryVisible); } +}; + +#endif diff --git a/ycurses/src/curses/dummy.cpp b/ycurses/src/curses/dummy.cpp new file mode 100644 index 0000000..eab2b13 --- /dev/null +++ b/ycurses/src/curses/dummy.cpp @@ -0,0 +1,11 @@ +#ifndef DUMMY_CPP +#define DUMMY_CPP + +#include "dummy.h" + +WINDOW* dummy_window::get_WINDOW() +{ + return 0; +} + +#endif diff --git a/ycurses/src/curses/dummy.h b/ycurses/src/curses/dummy.h new file mode 100644 index 0000000..d691e1c --- /dev/null +++ b/ycurses/src/curses/dummy.h @@ -0,0 +1,11 @@ +#ifndef DUMMY_H +#define DUMMY_H + +#include "incl.h" + +struct dummy_window +{ + virtual WINDOW* get_WINDOW(); +}; + +#endif diff --git a/ycurses/src/curses/hidden.cpp b/ycurses/src/curses/hidden.cpp new file mode 100644 index 0000000..9f9b39f --- /dev/null +++ b/ycurses/src/curses/hidden.cpp @@ -0,0 +1,29 @@ +#ifndef HIDDEN_CPP +#define HIDDEN_CPP + +#include "hidden.h" + +hidden::hidden() +{ + show(); +} + +void +hidden::hide() +{ + b_hidden = true; +} + +void +hidden::show() +{ + b_hidden = false; +} + +bool +hidden::is_hidden() +{ + return b_hidden; +} + +#endif diff --git a/ycurses/src/curses/hidden.h b/ycurses/src/curses/hidden.h new file mode 100644 index 0000000..f0f632a --- /dev/null +++ b/ycurses/src/curses/hidden.h @@ -0,0 +1,21 @@ +#ifndef HIDDEN_H +#define HIDDEN_H + +#include "incl.h" + +using namespace std; + +class hidden +{ + private: + bool b_hidden; + + public: + hidden(); + virtual void hide(); + virtual void show(); + bool is_hidden(); +}; + +#endif + diff --git a/ycurses/src/curses/incl.h b/ycurses/src/curses/incl.h new file mode 100644 index 0000000..b31d1ff --- /dev/null +++ b/ycurses/src/curses/incl.h @@ -0,0 +1,8 @@ +#include <iostream> +#include <map> +#include <string> +#include <vector> + +#include <ncurses.h> +#include <menu.h> +#include <panel.h> diff --git a/ycurses/src/curses/menu.cpp b/ycurses/src/curses/menu.cpp new file mode 100644 index 0000000..e240566 --- /dev/null +++ b/ycurses/src/curses/menu.cpp @@ -0,0 +1,117 @@ +#ifndef MENU_CPP +#define MENU_CPP + +#include "menu.h" + +menu::menu(vector<string>& vec_choices) +{ + init(vec_choices); +} + +menu::~menu() +{ + if (p_items) + { + for (int i = 0; i < i_choices; ++i) + free_item(p_items[i]); + + delete [] p_items; + p_items = 0; + } + + if (p_menu) + { + free_menu(p_menu); + p_menu = 0; + } + + if (p_win) + { + delete p_win; + p_win = 0; + } +} + +void +menu::init(vector<string>& vec_choices) +{ + i_choices = vec_choices.size(); + i_current = 0; + + int i_choices = vec_choices.size(); + int iMaxLen = 0; + p_items = new ITEM*[i_choices]; + + for (int i = 0; i < i_choices; ++i) + { + p_items[i] = new_item(vec_choices.at(i).c_str(), ""); + int iLen = vec_choices.at(i).length(); + if (iLen > iMaxLen) + iMaxLen = iLen; + } + + p_menu = new_menu(p_items); + + p_win = new window(i_choices+2, iMaxLen+4, 4, 4); + WINDOW* p_window = p_win->get_WINDOW(); + + set_menu_win(p_menu, p_window); + set_menu_sub(p_menu, derwin(p_window, i_choices, iMaxLen+2, 1, 1)); + + refresh(); + post_menu(p_menu); + wrefresh(p_window); +} + +window& +menu::get_window() +{ + return *p_win; +} + +int +menu::run() +{ + WINDOW* p_window = p_win->get_WINDOW(); + keypad(p_window, 1); + int i_choice; + + while( (i_choice = wgetch(p_window)) ) + { + switch(i_choice) + { + case KEY_DOWN: + case 'j': // Vi mode + if ( i_current < i_choices-1 ) + ++i_current; + menu_driver(p_menu, REQ_DOWN_ITEM); + break; + + case KEY_UP: + case 'k': // Vi mode + if ( i_current > 0 ) + --i_current; + menu_driver(p_menu, REQ_UP_ITEM); + break; + + case 'h': // Vi mode + case 'q': // Vi mode + case 27: // ESC + i_current = i_choices-1; // Select last entry. + + case 'l': // Vi mode + case 10: // Enter + case 32: // Space + keypad(p_window, 0); + return i_current; + } + +// window win_root(root); +// win_root.print(i_choice); + + wrefresh(p_window); + } +} + +#endif + diff --git a/ycurses/src/curses/menu.h b/ycurses/src/curses/menu.h new file mode 100644 index 0000000..3b672c3 --- /dev/null +++ b/ycurses/src/curses/menu.h @@ -0,0 +1,28 @@ +#ifndef MENU_H +#define MENU_H + +#include "incl.h" +#include "window.h" + +using namespace std; + +class menu +{ + private: + void init(vector<string>& vec_choices); + + int i_choices, i_current; + ITEM** p_items; + MENU* p_menu; + window* p_win; + + public: + menu(vector<string>& vec_choices); + menu(string s_name, vector<string>& vec_choices); + ~menu(); + + window& get_window(); + int run(); +}; + +#endif diff --git a/ycurses/src/curses/pwindow.cpp b/ycurses/src/curses/pwindow.cpp new file mode 100644 index 0000000..9ef2d80 --- /dev/null +++ b/ycurses/src/curses/pwindow.cpp @@ -0,0 +1,99 @@ +#ifndef PANEL_CPP +#define PANEL_CPP + +#include "pwindow.h" + +pwindow::pwindow(window& r_win) +{ + p_window = &r_win; + init(); +} + +void +pwindow::reinit(window& r_win) +{ + p_window = &r_win; + init(); +} + +pwindow::~pwindow() +{ + remove(); +} + +void +pwindow::remove() +{ + if (p_panel) + { + del_panel(p_panel); + p_panel = 0; + } + + update(); +} + +void +pwindow::init() +{ + p_panel = new_panel(p_window->get_WINDOW()); + update(); +} + +void +pwindow::update() +{ + update_panels(); + doupdate(); +} + +void +pwindow::on_bottom() +{ + bottom_panel(p_panel); + update(); +} + +void +pwindow::on_top() +{ + top_panel(p_panel); + update(); +} + +void +pwindow::hide() +{ + hidden::hide(); + hide_panel(p_panel); + update(); +} + +void +pwindow::show() +{ + hidden::show(); + show_panel(p_panel); + update(); +} + +void +pwindow::move(coordinate& r_coord) +{ + move(r_coord.y, r_coord.x); +} + +void +pwindow::move(int y, int x) +{ + move_panel(p_panel, y, x); + update(); +} + +PANEL* +pwindow::get_PANEL() +{ + return p_panel; +} + +#endif diff --git a/ycurses/src/curses/pwindow.h b/ycurses/src/curses/pwindow.h new file mode 100644 index 0000000..49b1d75 --- /dev/null +++ b/ycurses/src/curses/pwindow.h @@ -0,0 +1,37 @@ +#ifndef PWINDOW_H +#define PWINDOW_H + +using namespace std; + +#include "incl.h" +#include "coordinate.h" +#include "hidden.h" +#include "window.h" + +class pwindow : public hidden +{ + + private: + PANEL* p_panel; + window* p_window; + void init(); + + public: + pwindow(window& r_win); + ~pwindow(); + void init(window& r_win); + void reinit(window& r_win); + + void remove(); + void on_bottom(); + void on_top(); + void hide(); + void show(); + void move(int y, int x); + void move(coordinate& r_coord); + + static void update(); + PANEL* get_PANEL(); +}; + +#endif diff --git a/ycurses/src/curses/tool.cpp b/ycurses/src/curses/tool.cpp new file mode 100644 index 0000000..1bce76f --- /dev/null +++ b/ycurses/src/curses/tool.cpp @@ -0,0 +1,37 @@ +#ifndef TOOL_CPP +#define TOOL_CPP + +#include "tool.h" + +string +tool::int2string(int i_int) +{ + char buf[64]; + sprintf(buf, "%d", i_int); + return buf; +} + +int +tool::string2int(string s) +{ + const char *p = s.c_str(); + int i_res = 0; + + // Convert each digit char and add into result. + while (*p >= '0' && *p <='9') + { + i_res = (i_res * 10) + (*p - '0'); + p++; + } + + // Check that there were no non-digits at end. + if (*p != 0) + { + return -1; + } + + return i_res; +} + +#endif + diff --git a/ycurses/src/curses/tool.h b/ycurses/src/curses/tool.h new file mode 100644 index 0000000..130bd09 --- /dev/null +++ b/ycurses/src/curses/tool.h @@ -0,0 +1,15 @@ +#ifndef TOOL_H +#define TOOL_H + +#include "incl.h" + +using namespace std; + +class tool +{ +public: + static string int2string( int i_int ); + static int string2int( string s ); +}; + +#endif diff --git a/ycurses/src/curses/window.cpp b/ycurses/src/curses/window.cpp new file mode 100644 index 0000000..d5ce37c --- /dev/null +++ b/ycurses/src/curses/window.cpp @@ -0,0 +1,367 @@ +#ifndef WINDOW_CPP +#define WINDOW_CPP + +#include "window.h" + +bool window::b_is_rootoot = false; + +window::window(window_type t) +{ + b_is_rootoot = true; + init(); + p_window = stdscr; +} + +window::window(int i_height, int i_width) +{ + init(); + + this->i_height = i_height; + this->i_width = i_width; + this->i_start_y = (LINES - i_height) / 2; + this->i_start_x = (COLS - i_width) / 2; + + p_window = create_new_win(i_height, i_width, i_start_y, i_start_x); +} + +window::window(int i_height, int i_width, coordinate& r_coord) +{ + init(); + + this->i_height = i_height; + this->i_width = i_width; + this->i_start_y = r_coord.y; + this->i_start_x = r_coord.x; + + p_window = create_new_win(i_height, i_width, i_start_y, i_start_x); +} + +window::window(int i_height, int i_width, int i_start_y, int i_start_x) +{ + init(); + + this->i_height = i_height; + this->i_width = i_width; + this->i_start_y = i_start_y; + this->i_start_x = i_start_x; + + p_window = create_new_win(i_height, i_width, i_start_y, i_start_x); +} + +window::~window() +{ + if (p_window) + { + if(!is_root_win()) + destroy_win(p_window); + + p_window = 0; + } +} + +bool +window::is_root_win() +{ + return b_is_rootoot; +} + +void +window::init() +{ +} + +WINDOW* +window::create_new_win(int i_height, int i_width, int i_start_y, int i_start_x) +{ + WINDOW *p_local_win = newwin(i_height, i_width, i_start_y, i_start_x); + box(p_local_win, 0 , 0); /* 0, 0 gives default characters + * for the vertical and horizontal + * lines */ + wrefresh(p_local_win); /* Show that box */ + + return p_local_win; +} + +void +window::destroy_win(WINDOW *p_local_win) +{ + /* box(local_win, ' ', ' '); : This won't produce the desired + * result of erasing the window. It will leave it's four corners + * and so an ugly remnant of window. + */ + + wborder(p_local_win, ' ', ' ', ' ',' ',' ',' ',' ',' '); + /* The parameters taken are + * 1. win: the window on which to operate + * 2. ls: character to be used for the left side of the window + * 3. rs: character to be used for the right side of the window + * 4. ts: character to be used for the top side of the window + * 5. bs: character to be used for the bottom side of the window + * 6. tl: character to be used for the top left corner of the window + * 7. tr: character to be used for the top right corner of the window + * 8. bl: character to be used for the bottom left corner of the window + * 9. br: character to be used for the bottom right corner of the window + */ + + wrefresh(p_local_win); + delwin(p_local_win); +} + +void +window::hide() +{ + hidden::hide(); + + if (p_window) + destroy_win(p_window); +} + +void +window::show() +{ + if (!is_hidden()) + return; + + hidden::show(); + + p_window = create_new_win(i_height, i_width, i_start_y, i_start_x); + + refresh(); +} + +void +window::refresh() +{ + wrefresh(p_window); +} + +void +window::set_attributes(attributes& r_attr) +{ + r_attr.use_wattron(p_window); +} + +void +window::unset_attributes(attributes& r_attr) +{ + r_attr.use_wattroff(p_window); +} + +int +window::save_attributes() +{ + return attr_get(&sr_attributes, &sr_pair, sr_options); +} + +int +window::restore_attributes() +{ + return attr_set(sr_attributes, sr_pair, sr_options); +} + +void +window::print(int i) +{ + print(tool::int2string(i)); +} + +void +window::print(coordinate &r_coord, string s) +{ + print(r_coord.y, r_coord.x, s); +} + +void +window::print(int i_y, int i_x, int i) +{ + print(i_y, i_x, tool::int2string(i)); +} + +void +window::print(coordinate &r_coord, int i) +{ + print(r_coord, tool::int2string(i)); +} + +void +window::println(int i) +{ + println(tool::int2string(i)); +} + +void +window::println(coordinate &r_coord, string s) +{ + println(r_coord.y, r_coord.x, s); +} + +void +window::println(int i_y, int i_x, int i) +{ + println(i_y, i_x, tool::int2string(i)); +} + +void +window::println(coordinate &r_coord, int i) +{ + println(r_coord, tool::int2string(i)); +} + +void +window::print(string s) +{ + wprintw(p_window, const_cast<char*>(s.c_str())); + refresh(); +} + +void +window::print(int i_y, int i_x, string s) +{ + mvwprintw(p_window, i_y, i_x, const_cast<char*>(s.c_str())); + refresh(); +} + +void +window::println(string s) +{ + wprintw(p_window, const_cast<char*>((s+"\n").c_str())); + refresh(); +} + +void +window::println(int i_y, int i_x, string s) +{ + mvwprintw(p_window, i_y, i_x, const_cast<char*>((s+"\n").c_str())); + refresh(); +} + +void +window::print(int i, attributes& r_attr) +{ + save_attributes(); + set_attributes(r_attr); + print(tool::int2string(i)); + restore_attributes(); +} + +void +window::print(coordinate &r_coord, string s, attributes& r_attr) +{ + save_attributes(); + set_attributes(r_attr); + print(r_coord.y, r_coord.x, s); + restore_attributes(); +} + +void +window::print(int i_y, int i_x, int i, attributes& r_attr) +{ + save_attributes(); + set_attributes(r_attr); + print(i_y, i_x, tool::int2string(i)); + restore_attributes(); +} + +void +window::print(coordinate &r_coord, int i, attributes& r_attr) +{ + save_attributes(); + set_attributes(r_attr); + print(r_coord, tool::int2string(i)); + restore_attributes(); +} + +void +window::println(int i, attributes& r_attr) +{ + save_attributes(); + set_attributes(r_attr); + println(tool::int2string(i)); + restore_attributes(); +} + +void +window::println(coordinate &r_coord, string s, attributes& r_attr) +{ + save_attributes(); + set_attributes(r_attr); + println(r_coord.y, r_coord.x, s); + restore_attributes(); +} + +void +window::println(int i_y, int i_x, int i, attributes& r_attr) +{ + save_attributes(); + set_attributes(r_attr); + println(i_y, i_x, tool::int2string(i)); + restore_attributes(); +} + +void +window::println(coordinate &r_coord, int i, attributes& r_attr) +{ + save_attributes(); + set_attributes(r_attr); + println(r_coord, tool::int2string(i)); + restore_attributes(); +} + +void +window::print(string s, attributes& r_attr) +{ + save_attributes(); + set_attributes(r_attr); + wprintw(p_window, const_cast<char*>(s.c_str())); + refresh(); + restore_attributes(); +} + +void +window::print(int i_y, int i_x, string s, attributes& r_attr) +{ + save_attributes(); + set_attributes(r_attr); + mvwprintw(p_window, i_y, i_x, const_cast<char*>(s.c_str())); + refresh(); + restore_attributes(); +} + +void +window::println(string s, attributes& r_attr) +{ + save_attributes(); + set_attributes(r_attr); + wprintw(p_window, const_cast<char*>((s+"\n").c_str())); + refresh(); + restore_attributes(); +} + +void +window::println(int i_y, int i_x, string s, attributes& r_attr) +{ + save_attributes(); + set_attributes(r_attr); + mvwprintw(p_window, i_y, i_x, const_cast<char*>((s+"\n").c_str())); + refresh(); + restore_attributes(); +} + +void +window::move_cursor(coordinate& r_coord) +{ + move_cursor(r_coord.y, r_coord.x); +} + +void +window::move_cursor(int i_y, int i_x) +{ + if (!p_window) + return; + + wmove(p_window, i_y, i_x); + refresh(); +} + + +#endif diff --git a/ycurses/src/curses/window.h b/ycurses/src/curses/window.h new file mode 100644 index 0000000..d194e2f --- /dev/null +++ b/ycurses/src/curses/window.h @@ -0,0 +1,85 @@ +#ifndef WINDOW_H +#define WINDOW_H + +#include "attributes.h" +#include "color.h" +#include "coordinate.h" +#include "dummy.h" +#include "hidden.h" +#include "incl.h" +#include "tool.h" + +using namespace std; + +enum window_type +{ + root +}; + +class window : public dummy_window, hidden +{ + private: + WINDOW* p_window; + int i_height, i_width, i_start_y, i_start_x; + static bool b_is_rootoot; + + /* For save_attributes and restore_attributes */ + attr_t sr_attributes; short sr_pair; void *sr_options; + + WINDOW *create_new_win(int i_height, int i_width, int i_start_y, int i_start_x); + void destroy_win(WINDOW *p_local_win); + + /* Called by the constructors */ + void init(); + + public: + window(window_type t); + window(int i_height, int i_width, coordinate& r_coord); + window(int i_height, int i_width, int i_start_y, int i_start_x); + window(int i_height, int i_width); + ~window(); + + void hide(); + void show(); + void refresh(); + void set_attributes(attributes& r_attr); + void unset_attributes(attributes& r_attr); + bool is_root_win(); + + WINDOW* get_WINDOW() { return p_window; } + + int save_attributes(); + int restore_attributes(); + + void move_cursor(coordinate& r_coord); + void move_cursor(int i_y, int i_x); + + void print(string s); + void print(int i_y, int i_x, string s); + void println(string s); + void println(int i_y, int i_x, string s); + void print(int i); + void print(coordinate &r_coord, string s); + void print(int i_y, int i_x, int i); + void print(coordinate &r_coord, int i); + void println(int i); + void println(coordinate &r_coord, string s); + void println(int i_y, int i_x, int i); + void println(coordinate &r_coord, int i); + + void print(string s, attributes& r_attr); + void print(int i_y, int i_x, string s, attributes& r_attr); + void println(string s, attributes& r_attr); + void println(int i_y, int i_x, string s, attributes& r_attr); + void print(int i, attributes& r_attr); + void print(coordinate &r_coord, string s, attributes& r_attr); + void print(int i_y, int i_x, int i, attributes& r_attr); + void print(coordinate &r_coord, int i, attributes& r_attr); + void println(int i, attributes& r_attr); + void println(coordinate &r_coord, string s, attributes& r_attr); + void println(int i_y, int i_x, int i, attributes& r_attr); + void println(coordinate &r_coord, int i, attributes& r_attr); +}; + +#endif + diff --git a/ycurses/src/curses/ycurses.h b/ycurses/src/curses/ycurses.h new file mode 100644 index 0000000..1699e96 --- /dev/null +++ b/ycurses/src/curses/ycurses.h @@ -0,0 +1,6 @@ +#ifndef YCURSES_H +#define YCURSES_H + +#include "curses.h" + +#endif diff --git a/ycurses/src/examples/example1.cpp b/ycurses/src/examples/example1.cpp new file mode 100644 index 0000000..239e476 --- /dev/null +++ b/ycurses/src/examples/example1.cpp @@ -0,0 +1,80 @@ +#include "example1.h" + +int example1() +{ + /* Initialize the ycurses object at first! You MUST also delete this as the last! */ + curses cur; + + /* Make the cursor invisible. + * All available options are: + * Invisible + * Visible + * VeryVisible + */ + cursor::set_invisible(); + + /* Get the root-window */ + window win_root(root); + + /* + * There are standard colors defined which can be mixed together to + * get foreground/background color pairs: + * Red, Green, Yellow, Blue, Cyan, Magenta and White + */ + color col1(Cyan, Blue); // 1. With implicit Name. + // color col1("col1", Cyan, Blue); // 2. With explicit Name. + + /* Now we define attributes, and pass them the color */ + attributes attr1(col1); + win_root.set_attributes(attr1); + + /* Print out some text on the cursor location, with line break */ + win_root.println(0, 0, "Hello, welcome to ncurses in cyan-blue"); + + win_root.unset_attributes(attr1); + + /* Create a new centeralized window with the specified height and width */ + window win1(20, 78); + + color col2(Yellow, Black); + attributes attr2(col2); + attr1.set_bold(true); + + win1.set_attributes(attr2); + win1.print(2, 2, "Print into window at pos 2-2 w/out newline in yellow-black-bold!"); + + /* Create yet another window */ + window win2(10, 20); + + /* Print out the y and the x component of the absolute coordinates of win1 */ + coordinate coord_win(Absolutecoord,win1); + coordinate coord_text(10,11); + + /* Other available coordinates + * + * coordinate(Absolutecoord,win1); // Gets window's absolute position. + * coordinate(Relativecoord,win1); // Gets window's relative position. + * coordinate(Beginningcoord,win1); // Gets window's beginning coords. + * coordinate(windowSize,win1); // Gets window's size. + * coordinate(TerminalSize); // Gets the total terminal size. + * coordinate(TerminalCenter); // Gets the center of the terminal + */ + + attributes attr_bold(Bold); + // Hint: you can use Normal instead of Bold to set all attributes to default. + + win_root.print(coord_text, "Demonstration output", attr_bold); + win_root.print(coord_text.down(), "coordinate y:"); + win_root.print(coord_text.displace(1,1), coord_win.y, attr_bold); + win_root.print(coord_text.displace(1,-1), "coordinate x:"); + win_root.print(coord_text.displace(1,1), coord_win.x, attr_bold); + + /* Wait for user key stroke */ + cur.pause(); + + /* Deletes all curses elements from memory, also all pointers + Because the ycurses Objekt will get out of scope now. + */ + return 0; +} + diff --git a/ycurses/src/examples/example1.h b/ycurses/src/examples/example1.h new file mode 100644 index 0000000..dc5e753 --- /dev/null +++ b/ycurses/src/examples/example1.h @@ -0,0 +1,8 @@ +#ifndef EXAMPLE1_H +#define EXAMPLE1_H + +#include "../curses/ycurses.h" + +int example1(); + +#endif diff --git a/ycurses/src/examples/example2.cpp b/ycurses/src/examples/example2.cpp new file mode 100644 index 0000000..c93d79c --- /dev/null +++ b/ycurses/src/examples/example2.cpp @@ -0,0 +1,52 @@ +#include "example2.h" + +int example2() +{ + curses cur; + cursor::set_invisible(); + + window win_root(root); + win_root.print(1, 1, "Press any key to continue..."); + + coordinate coord(2, 0);; + + window win1(10, 40, coord); + window win2(10, 40, coord.displace(3, 6)); + window win3(10, 40, coord.displace(3, 6)); + + win1.print(1, 1, "window 1"); + win2.print(1, 1, "window 2"); + win3.print(1, 1, "window 3"); + + /* Initialize pwindows. */ + pwindow pwindow1(win1); + pwindow pwindow2(win2); + pwindow pwindow3(win3); + + + /* Remove pwindow3, pwindow3 doesnt contain a valid pwindow any more! + * DONT USE THIS OBJECT AGAIN until re-init!!! + */ + pwindow3.remove(); + + /* Re-init a new pwindow, using the old variable. Now the object + * can be used again. + */ + pwindow3.reinit(win3); + cur.pause(); + + /* Remove the center pwindow. */ + pwindow2.remove(); + win3.print(2, 1, "pwindow 2 removed!"); + cur.pause(); + + win1.print(2, 1, "Some text!"); + cur.pause(); + + pwindow3.remove(); + win1.print(3, 1, "pwindow 3 removed!"); + cur.pause(); + + return 0; +} + diff --git a/ycurses/src/examples/example2.h b/ycurses/src/examples/example2.h new file mode 100644 index 0000000..fbdc6c7 --- /dev/null +++ b/ycurses/src/examples/example2.h @@ -0,0 +1,8 @@ +#ifndef EXAMPLE2_H +#define EXAMPLE2_H + +#include "../curses/ycurses.h" + +int example2(); + +#endif diff --git a/ycurses/src/examples/example3.cpp b/ycurses/src/examples/example3.cpp new file mode 100644 index 0000000..5fee1f8 --- /dev/null +++ b/ycurses/src/examples/example3.cpp @@ -0,0 +1,45 @@ +#include "example3.h" + +int example3() +{ + curses cur; + cursor::set_invisible(); + + window win_root(root); + win_root.print(1, 1, "Press any key to continue..."); + + coordinate coord(2, 0);; + window win1(10, 30, coord); + window win2(10, 30, coord.displace(3, 6)); + + win1.print(1, 1, "pwindow 1"); + win2.print(1, 1, "pwindow 2"); + + pwindow pwindow1(win1); + pwindow pwindow2(win2); + + cur.pause(); + + pwindow1.hide(); + win2.print(2, 1, "pwindow 1 hidden"); + cur.pause(); + + pwindow1.show(); + pwindow1.on_bottom(); + win2.print(3, 1, "pwindow 1 back"); + cur.pause(); + + win1.print(2, 1, "Some pwindow 1 text"); + cur.pause(); + + pwindow1.on_top(); + win1.print(3, 1, "pwindow 2 is on bottom"); + cur.pause(); + + win1.print(4, 1, "Moved pwindow 2 to 10-10"); + pwindow2.move(10,10); + cur.pause(); + + return 0; +} + diff --git a/ycurses/src/examples/example3.h b/ycurses/src/examples/example3.h new file mode 100644 index 0000000..80f1575 --- /dev/null +++ b/ycurses/src/examples/example3.h @@ -0,0 +1,8 @@ +#ifndef EXAMPLE3_H +#define EXAMPLE3_H + +#include "../curses/ycurses.h" + +int example3(); + +#endif diff --git a/ycurses/src/examples/example4.cpp b/ycurses/src/examples/example4.cpp new file mode 100644 index 0000000..7e0e317 --- /dev/null +++ b/ycurses/src/examples/example4.cpp @@ -0,0 +1,22 @@ +#include "example4.h" + +int example4() +{ + curses cur; + cursor::set_invisible(); + + window win_root(root); + win_root.print(1, 1, "Class menu example..."); + + vector<string> vec_choices; + vec_choices.push_back("Hallo das ist asd asdas d asd asda sd asd asd a"); + vec_choices.push_back("Bdsfsdsa das d asd asd asd as das djf"); + vec_choices.push_back("s das d asd saa sdCsdfsdf"); + menu menu1(vec_choices); + + menu1.run(); + + return 0; +} + + diff --git a/ycurses/src/examples/example4.h b/ycurses/src/examples/example4.h new file mode 100644 index 0000000..1bf0cbb --- /dev/null +++ b/ycurses/src/examples/example4.h @@ -0,0 +1,8 @@ +#ifndef EXAMPLE4_H +#define EXAMPLE4_H + +#include "../curses/ycurses.h" + +int example4(); + +#endif diff --git a/ycurses/src/glob.h b/ycurses/src/glob.h new file mode 100644 index 0000000..d37ae37 --- /dev/null +++ b/ycurses/src/glob.h @@ -0,0 +1,21 @@ +/* + Notice: + + All #defines which start with an CONFIG can be edited through + gmake config in the main directory! +*/ + +// global variables. +#ifndef GLOB_H +#define GLOB_H + +// Definition of boolean values. +#define true 1 +#define false 0 + +/* - DISABLED - + Enable debugging options. +*/ +//#define DEBUG + +#endif diff --git a/ycurses/src/main.cpp b/ycurses/src/main.cpp new file mode 100644 index 0000000..1ede8da --- /dev/null +++ b/ycurses/src/main.cpp @@ -0,0 +1,110 @@ +#include <iostream> +#include <signal.h> + +#include "curses/ycurses.h" +#include "examples/example1.h" +#include "examples/example2.h" +#include "examples/example3.h" +#include "examples/example4.h" + +using namespace std; + +static void finish_demo(int i_signal); + +int main(int argc, char* argv[]) +{ + /* Catch SIGINT for proper shutdown */ + signal(SIGINT, finish_demo); + + curses cur; + + color col(Red,Black); + attributes attr(col); + attr.set_bold(true); + + coordinate coord(5,5); + + for (;;) + { + cursor::set_invisible(); + + window win_root(root); + win_root.print(1, 2, "Examples of ycurses", attr); + win_root.print(2, 2, "See src/examples/* for the sample code!"); + + vector<string> vec_choices; + vec_choices.push_back("1. Example with mixed stuff"); + vec_choices.push_back("2. Class pwindow basic usage"); + vec_choices.push_back("3. Class pwindow usage #2"); + vec_choices.push_back("4. Class menu usage"); + vec_choices.push_back("5. Move menu left"); + vec_choices.push_back("6. Move menu right"); + vec_choices.push_back("7. Move menu up"); + vec_choices.push_back("8. Move menu down"); + vec_choices.push_back("9. Exit"); + + menu menu(vec_choices); + window& menu_window = menu.get_window(); + pwindow pan(menu_window); + pan.move(coord); + + switch ( menu.run() ) + { + case 0: + cur.clear(); + pan.hide(); + example1(); + break; + + case 1: + pan.hide(); + cur.clear(); + example2(); + break; + + case 2: + pan.hide(); + cur.clear(); + example3(); + break; + + case 3: + pan.hide(); + cur.clear(); + example4(); + break; + + case 4: + pan.move(coord.left()); + break; + + case 5: + pan.move(coord.right()); + break; + + case 6: + pan.move(coord.up()); + break; + + case 7: + pan.move(coord.down()); + break; + + case 8: + return 0; + } + + cur.clear(); + pan.show(); + } + + return 0; +} + +static void finish_demo(int i_signal) +{ + curses::finish(); + + cout << "Process received SIGINT" << endl; + exit(0); +} diff --git a/ycurses/src/msgs.h b/ycurses/src/msgs.h new file mode 100644 index 0000000..355aa45 --- /dev/null +++ b/ycurses/src/msgs.h @@ -0,0 +1,11 @@ +#ifndef MSGS_H +#define MSGS_H + +#define APPNAME "curses" +#define VERSION "0.1" +#define BRANCH "CURRENT" +#define BUILDNR 1661 +#define UNAME "FreeBSD 5.3-RELEASE-p15 i386" +#define COMPOPT "Using built-in specs.; Configured with: FreeBSD/i386 system compiler; Thread model: posix; gcc version 3.4.2 [FreeBSD] 20040728; 3.4; g++" + +#endif |
