From 1400fab143934ad7e42c890a47a346309a6a1fc4 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Wed, 11 Jul 2018 22:12:41 -0400 Subject: [PATCH] wmmisc: Add version 1.1 to repository. From http://distro.ibiblio.org/amigolinux/download/DockApps/wmmisc-1.1/wmmisc-1.1.tar.bz2 --- wmmisc/COPYING | 340 ++++++++++++++++++++++ wmmisc/ChangeLog | 36 +++ wmmisc/INSTALL | 7 + wmmisc/Makefile | 8 + wmmisc/README | 52 ++++ wmmisc/src/Makefile | 51 ++++ wmmisc/src/dockapp_draw.c | 332 ++++++++++++++++++++++ wmmisc/src/dockapp_draw.h | 78 ++++++ wmmisc/src/dockapp_main.c | 171 +++++++++++ wmmisc/src/dockapp_main.h | 49 ++++ wmmisc/src/dockapp_utils.c | 343 +++++++++++++++++++++++ wmmisc/src/dockapp_utils.h | 69 +++++ wmmisc/src/general.mk | 70 +++++ wmmisc/src/wmgeneral.c | 530 +++++++++++++++++++++++++++++++++++ wmmisc/src/wmgeneral.h | 57 ++++ wmmisc/src/wmmisc-master.xpm | 173 ++++++++++++ 16 files changed, 2366 insertions(+) create mode 100644 wmmisc/COPYING create mode 100644 wmmisc/ChangeLog create mode 100644 wmmisc/INSTALL create mode 100644 wmmisc/Makefile create mode 100644 wmmisc/README create mode 100644 wmmisc/src/Makefile create mode 100644 wmmisc/src/dockapp_draw.c create mode 100644 wmmisc/src/dockapp_draw.h create mode 100644 wmmisc/src/dockapp_main.c create mode 100644 wmmisc/src/dockapp_main.h create mode 100644 wmmisc/src/dockapp_utils.c create mode 100644 wmmisc/src/dockapp_utils.h create mode 100644 wmmisc/src/general.mk create mode 100644 wmmisc/src/wmgeneral.c create mode 100644 wmmisc/src/wmgeneral.h create mode 100644 wmmisc/src/wmmisc-master.xpm diff --git a/wmmisc/COPYING b/wmmisc/COPYING new file mode 100644 index 0000000..96e4591 --- /dev/null +++ b/wmmisc/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/wmmisc/ChangeLog b/wmmisc/ChangeLog new file mode 100644 index 0000000..9e25160 --- /dev/null +++ b/wmmisc/ChangeLog @@ -0,0 +1,36 @@ +09.01.06 Jesse S. + * Version 1.1 + + * src/dockapp_main.c: Fixed not exiting with -h and -v. + Also update a copyright date that I missed. (Never code while tired.) + + * src/dockapp_main.h: Update the version number, which I forgot to do before. Oops. + + * src/dockapp_utils.h: Reduced amount of calculations needed for time macros. + + * src/dockapp_draw.h: #if 0 some unused code. #endif + +07.01.06 Jesse S. + * Version 1.0 + + * README: Updated various bits of information. + + * src/general.mk, src/Makefile: Support for modular X.Org (use 'make MODULAR_X=1' and + 'make MODULAR_X=1 install'). + + * src/general.mk: Add conditional (FASTER_MATH) to use faster math optimizations (use + 'make FASTER_MATH=1' to enable), also replaced -Wextra with -W, as some people still + use versions of GCC older than 3.4. + + * src/wmgeneral.c (open_window): Removed invalid free() + + * src/*.[ch]: Code reformatted, various clean ups, updated copyright and + license information (FSF has a new address). + +24.04.04 Jesse S. + * Version 0.9 + + * src/dockapp_util.c: Properly get the user count. Thanks to gkrellm for this improved + method. + + * src/*.c: Clean-ups, removed unused/dead code, etc. diff --git a/wmmisc/INSTALL b/wmmisc/INSTALL new file mode 100644 index 0000000..11ec7b7 --- /dev/null +++ b/wmmisc/INSTALL @@ -0,0 +1,7 @@ +Installing is simple: + + $ make + $ su + # make install + +This will install the binary (wmmisc) in /usr/X11R6/bin. diff --git a/wmmisc/Makefile b/wmmisc/Makefile new file mode 100644 index 0000000..6d4cc7d --- /dev/null +++ b/wmmisc/Makefile @@ -0,0 +1,8 @@ +all: + make -C src all + +install: + make -C src install + +clean: + make -C src clean diff --git a/wmmisc/README b/wmmisc/README new file mode 100644 index 0000000..b32560a --- /dev/null +++ b/wmmisc/README @@ -0,0 +1,52 @@ + This is a simple dockapp written to replace some of the features that gkrellm +contains. It was written due to no other dockapp existing that has these features +and gkrellm uses too much memory for what it does. + +What this dockapp does: + 1. Shows count of currently logged in users. + 2. Shows count of currently running processes. + 3. Shows count of currently (active) running processes. + 4. Shows uptime (HH:MM). + 5. Shows uptime (days). + 6. Shows uptime (weeks). + 7. Shows system load (5 min). + +This dockapp was written for GNU/Linux and has not been tested, by me, on other platforms. +It may work on FreeBSD with /proc file system support, but I honestly have no idea. + +Please note: This source tree includes a modified version of wmgeneral. I am NOT the +original author, though I have rewritten parts of it. However, all other code is my own. +This dockapp is a good base if you plan on writing your own. I have provided simple functions +for drawing text and numbers on the canvas. There are also functions in place for drawing +bars, but it is currently unused and may contain bugs. However, I currently know of no bugs. +If you find any, let me know (via email). + +To compile and install, run: + + for older X systems: + + $ make + + $ sudo make install + + or (as root): + + # make install + + The binary, wmmisc, will be placed in /usr/X11R6/bin + + for newer, modular X systems (X.Org >= 7.0): + + $ make MODULAR_X=1 + + $ sudo make MODULAR_X=1 install + + or (as root): + + # make MODULAR_X=1 install + + The binary will be placed in `pkg-config --variable=prefix xorg-server`/bin + +Enjoy. + +- Jesse S. diff --git a/wmmisc/src/Makefile b/wmmisc/src/Makefile new file mode 100644 index 0000000..2cf480a --- /dev/null +++ b/wmmisc/src/Makefile @@ -0,0 +1,51 @@ +include general.mk + +#CPPFLAGS += -DUSE_MTRACE + +objects = wmgeneral.o \ + dockapp_draw.o \ + dockapp_utils.o \ + dockapp_main.o + +headers = wmgeneral.h \ + dockapp_draw.h \ + dockapp_utils.h \ + dockapp_main.h + +sources = wmgeneral.c \ + dockapp_draw.c \ + dockapp_utils.c \ + dockapp_main.c + +package = wmmisc + +all: $(package) + +$(package): $(objects) + rm -f $(package) + $(CC) $(CFLAGS) -o $(package) $(objects) $(LDFLAGS) + +wmgeneral.o: wmgeneral.c wmgeneral.h + rm -f wmgeneral.o + $(CC) $(CPPFLAGS) $(INCLUDES) $(CFLAGS) -c -o wmgeneral.o wmgeneral.c + +dockapp_draw.o: dockapp_draw.c wmgeneral.h dockapp_draw.h + rm -f dockapp_draw.o + $(CC) $(CPPFLAGS) $(INCLUDES) $(CFLAGS) -c -o dockapp_draw.o dockapp_draw.c + +dockapp_utils.o: dockapp_utils.c wmgeneral.h dockapp_draw.h dockapp_utils.h + rm -f dockapp_utils.o + $(CC) $(CPPFLAGS) $(INCLUDES) $(CFLAGS) -c -o dockapp_utils.o dockapp_utils.c + +dockapp_main.o: dockapp_main.c wmgeneral.h dockapp_draw.h dockapp_utils.h dockapp_main.h + rm -f dockapp_main.o + $(CC) $(CPPFLAGS) $(INCLUDES) $(CFLAGS) -c -o dockapp_main.o dockapp_main.c + +install: + install -c -s -o root -g root -m 755 $(package) $(BINDIR) + +uninstall: + rm -f $(BINDIR)/$(package) + +clean: + rm -f $(package) $(objects) *~ core core.* gmon.out diff --git a/wmmisc/src/dockapp_draw.c b/wmmisc/src/dockapp_draw.c new file mode 100644 index 0000000..b183897 --- /dev/null +++ b/wmmisc/src/dockapp_draw.c @@ -0,0 +1,332 @@ +/* + * wmmisc - WindowMaker Dockapp for monitoring misc. information. + * Copyright (C) 2003-2006 Jesse S. (luxorfalls@sbcglobal.net) + * + * wmmisc 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. + * + * wmmisc 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 wmmisc; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include +#include +#include + +#include +#include +#include + +#include "wmgeneral.h" +#include "dockapp_draw.h" +#include "dockapp_utils.h" + +static dockapp_proc_t dockapp_proc; + +void +dockapp_draw_big_digit( unsigned int digit_value, + int digit_zero_count, + int digit_draw_location_x, + int digit_draw_location_y ) +{ + int digit_value_of_ten = 1; + int digit_maximum_value_of_ten = 0; + int digit_new_draw_location_x = 0; + + if ( ( ( DOCKAPP_WIDTH - DOCKAPP_BIG_CHAR_WIDTH ) < digit_draw_location_x + || ( DOCKAPP_HEIGHT - DOCKAPP_BIG_CHAR_HEIGHT ) < digit_draw_location_y ) + || ( 0 > digit_draw_location_x || 0 > digit_draw_location_y ) ) + { + fprintf( stderr, + "%s: Invalid x,y position: %d,%d\n", + __func__, + digit_draw_location_x, + digit_draw_location_y ); + return; + } + + for ( digit_maximum_value_of_ten = 0; + digit_maximum_value_of_ten < digit_zero_count; + ++digit_maximum_value_of_ten ) + { + digit_value_of_ten *= 10; + } + + digit_new_draw_location_x = digit_draw_location_x; + + do + { + copy_xpm_area( ( ( ( digit_value / digit_value_of_ten ) % 10 ) * + DOCKAPP_BIG_CHAR_WIDTH + DOCKAPP_BIG_DIGIT_X ), + DOCKAPP_BIG_DIGIT_Y, + DOCKAPP_BIG_CHAR_WIDTH, + DOCKAPP_BIG_CHAR_HEIGHT, + digit_new_draw_location_x, + digit_draw_location_y ); + + digit_value_of_ten /= 10; + digit_new_draw_location_x += DOCKAPP_BIG_CHAR_WIDTH; + } while ( 0 < digit_value_of_ten ); + + redraw_window(); +} + +void +dockapp_draw_small_digit( unsigned int d_value, + int d_zero, + int digit_draw_location_x, + int digit_draw_location_y ) +{ + int digit_value_of_ten = 1; + int digit_maximum_value_of_ten = 0; + int digit_new_draw_location_x = 0; + + if ( ( ( DOCKAPP_WIDTH - DOCKAPP_BIG_CHAR_WIDTH ) < digit_draw_location_x + || ( DOCKAPP_HEIGHT - DOCKAPP_BIG_CHAR_HEIGHT ) < digit_draw_location_y ) + || ( 0 > digit_draw_location_x || 0 > digit_draw_location_y ) ) + { + fprintf( stderr, + "%s: Invalid x,y position: %d,%d\n", + __func__, + digit_draw_location_x, + digit_draw_location_y ); + return; + } + + for ( digit_maximum_value_of_ten = 0; + digit_maximum_value_of_ten < d_zero; + ++digit_maximum_value_of_ten ) + { + digit_value_of_ten *= 10; + } + + digit_new_draw_location_x = digit_draw_location_x; + + do + { + copy_xpm_area( ( ( ( d_value / digit_value_of_ten) % 10) * + DOCKAPP_SMALL_CHAR_WIDTH + DOCKAPP_SMALL_DIGIT_X ), + DOCKAPP_SMALL_DIGIT_Y, + DOCKAPP_SMALL_CHAR_WIDTH, + DOCKAPP_SMALL_CHAR_HEIGHT, + digit_new_draw_location_x, + digit_draw_location_y ); + + digit_value_of_ten /= 10; + digit_new_draw_location_x += DOCKAPP_SMALL_CHAR_WIDTH; + } while ( 0 < digit_value_of_ten ); + + redraw_window(); +} + +void +dockapp_draw_big_str( const char* string_to_draw, + int digit_draw_location_x, + int digit_draw_location_y ) +{ + int string_length = 0; + int string_character_position = 0; + int string_character = 0; + int digit_new_draw_location_x = 0; + + string_length = strlen( string_to_draw ); + + if ( ( ( DOCKAPP_WIDTH - DOCKAPP_BIG_CHAR_WIDTH ) < digit_draw_location_x + || ( DOCKAPP_HEIGHT - DOCKAPP_BIG_CHAR_HEIGHT ) < digit_draw_location_y ) + || ( 0 > digit_draw_location_x || 0 > digit_draw_location_y ) ) + { + fprintf( stderr, + "%s: Invalid x,y position: %d,%d\n", + __func__, + digit_draw_location_x, + digit_draw_location_y ); + + return; + } + else if ( 0 == string_length ) + { + fprintf( stderr, "%s: Draw string is empty!\n", __func__ ); + return; + } + else if ( ( DOCKAPP_WIDTH / DOCKAPP_BIG_CHAR_WIDTH ) < string_length ) + { + fprintf( stderr, "%s: Draw string is too long!", __func__ ); + return; + } + + digit_new_draw_location_x = digit_draw_location_x; + + for ( string_character_position = 0; + string_character_position < string_length; + ++string_character_position ) + { + string_character = dockapp_utils_get_char( string_to_draw[string_character_position] ); + + copy_xpm_area( string_character * DOCKAPP_BIG_CHAR_WIDTH + DOCKAPP_BIG_LETTER_X, + DOCKAPP_BIG_LETTER_Y, + DOCKAPP_BIG_CHAR_WIDTH, + DOCKAPP_BIG_CHAR_HEIGHT, + digit_new_draw_location_x, + digit_draw_location_y ); + + digit_new_draw_location_x += DOCKAPP_BIG_CHAR_WIDTH; + } + + redraw_window(); +} + +void +dockapp_draw_small_str( const char* string_to_draw, + int digit_draw_location_x, + int digit_draw_location_y ) +{ + int string_length = 0; + int string_character_position = 0; + int string_character = 0; + int digit_new_draw_location_x = 0; + + string_length = strlen( string_to_draw ); + + if ( ( ( DOCKAPP_WIDTH - DOCKAPP_BIG_CHAR_WIDTH ) < digit_draw_location_x + || ( DOCKAPP_HEIGHT - DOCKAPP_BIG_CHAR_HEIGHT ) < digit_draw_location_y ) + || ( 0 > digit_draw_location_x || 0 > digit_draw_location_y ) ) + { + fprintf( stderr, + "%s: Invalid x,y position: %d,%d\n", + __func__, + digit_draw_location_x, + digit_draw_location_y ); + return; + } + else if ( 0 == string_length ) + { + fprintf( stderr, "%s: Draw string is empty!\n", __func__ ); + return; + } + else if ( ( DOCKAPP_WIDTH / DOCKAPP_SMALL_CHAR_WIDTH ) < string_length ) + { + fprintf( stderr, "%s: Draw string is too long!", __func__ ); + return; + } + + digit_new_draw_location_x = digit_draw_location_x; + + for (string_character_position = 0; + string_character_position < string_length; + ++string_character_position ) + { + string_character = dockapp_utils_get_char( string_to_draw[string_character_position] ); + + copy_xpm_area( string_character * DOCKAPP_SMALL_CHAR_WIDTH + DOCKAPP_SMALL_LETTER_X, + DOCKAPP_SMALL_LETTER_Y, + DOCKAPP_SMALL_CHAR_WIDTH, + DOCKAPP_SMALL_CHAR_HEIGHT, + digit_new_draw_location_x, + digit_draw_location_y ); + + digit_new_draw_location_x += DOCKAPP_SMALL_CHAR_WIDTH; + } + + redraw_window(); +} + +#if 0 +void +dockapp_draw_bar( int bar_draw_width, + int bar_draw_x, + int bar_draw_y, + int bar_x, + int bar_y ) +{ + if ( 0 > bar_draw_width || DOCKAPP_BAR_WIDTH < bar_draw_width ) + { + fprintf( stderr, "%s: Invalid bar width!\n", __func__ ); + return; + } + else if ( ( 0 > bar_draw_x || DOCKAPP_WIDTH < bar_draw_x ) || + ( 0 > bar_draw_y || DOCKAPP_WIDTH < bar_draw_y ) ) + { + fprintf( stderr, + "%s: Invalid x,y position: %d,%d\n", + __func__, + bar_draw_x, + bar_draw_y ); + return; + } + else if ( 0 >= bar_x || 0 >= bar_y ) + { + fprintf( stderr, + "%s: Invalid x,y position: %d,%d\n", + __func__, + bar_x, + bar_y ); + return; + } + + copy_xpm_area( bar_x, + bar_y, + bar_draw_width, + DOCKAPP_BAR_HEIGHT, + bar_draw_x, + bar_draw_y ); + + redraw_window(); +} + +void +dockapp_draw_bar_calculate( float draw_size, int bar_draw_x, int bar_draw_y ) +{ + float draw_percent_f; + int draw_percent; + + draw_percent_f = ( GET_HRS_F( draw_size ) / DOCKAPP_BAR_WIDTH ) * 100.0f; + draw_percent = ( int ) nearbyint( draw_percent_f ); + + if ( DOCKAPP_BAR_WIDTH == draw_percent ) + { + dockapp_draw_bar( draw_percent, + bar_draw_x, + bar_draw_y, + DOCKAPP_BAR_OFF_X, + DOCKAPP_BAR_OFF_Y ); + } + else + { + dockapp_draw_bar( draw_percent, + bar_draw_x, + bar_draw_y, + DOCKAPP_BAR_ON_X, + DOCKAPP_BAR_ON_Y ); + } +} +#endif + +void +dockapp_draw_data( void ) +{ + dockapp_proc = dockapp_utils_get_proc(); + + dockapp_draw_small_digit( dockapp_proc.users, 2, 45, 4 ); + dockapp_draw_small_digit( dockapp_proc.total, 2, 45, 11 ); + dockapp_draw_small_digit( dockapp_proc.running, 2, 45, 18 ); + + dockapp_draw_small_digit( dockapp_proc.hours, 1, 36, 28 ); + dockapp_draw_small_digit( dockapp_proc.minutes, 1, 50, 28 ); + + dockapp_draw_small_digit( dockapp_proc.days, 0, 55, 37 ); + dockapp_draw_small_digit( dockapp_proc.weeks, 2, 45, 44 ); + + dockapp_draw_small_digit( dockapp_proc.load[0], 1, 36, 53 ); + dockapp_draw_small_digit( dockapp_proc.load[1], 1, 50, 53 ); + + redraw_window(); +} diff --git a/wmmisc/src/dockapp_draw.h b/wmmisc/src/dockapp_draw.h new file mode 100644 index 0000000..6f223de --- /dev/null +++ b/wmmisc/src/dockapp_draw.h @@ -0,0 +1,78 @@ +/* + * wmmisc - WindowMaker Dockapp for monitoring misc. information. + * Copyright (C) 2003-2006 Jesse S. (luxorfalls@sbcglobal.net) + * + * wmmisc 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. + * + * wmmisc 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 wmmisc; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef __dockapp_draw_h +#define __dockapp_draw_h + +#define DOCKAPP_WIDTH 64 +#define DOCKAPP_HEIGHT 64 + +#define DOCKAPP_BIG_CHAR_WIDTH 6 +#define DOCKAPP_BIG_CHAR_HEIGHT 8 +#define DOCKAPP_SMALL_CHAR_WIDTH 5 +#define DOCKAPP_SMALL_CHAR_HEIGHT 6 + +#define DOCKAPP_BIG_DIGIT_X 3 +#define DOCKAPP_BIG_DIGIT_Y 65 +#define DOCKAPP_SMALL_DIGIT_X 3 +#define DOCKAPP_SMALL_DIGIT_Y 86 + +#define DOCKAPP_BIG_LETTER_X 3 +#define DOCKAPP_BIG_LETTER_Y 75 +#define DOCKAPP_SMALL_LETTER_X 3 +#define DOCKAPP_SMALL_LETTER_Y 94 + +#define DOCKAPP_DOT_X 64 +#define DOCKAPP_DOT_Y 85 + +#define DOCKAPP_DOT_WIDTH 2 +#define DOCKAPP_DOT_HEIGHT 6 + +#if 0 +#define DOCKAPP_BAR_WIDTH 55 +#define DOCKAPP_BAR_HEIGHT 2 + +#define DOCKAPP_BAR_ON_X 82 +#define DOCKAPP_BAR_ON_Y 71 +#define DOCKAPP_BAR_OFF_X 82 +#define DOCKAPP_BAR_OFF_Y 69 +#endif + +/* + * Function protoypes. + */ + +void dockapp_draw_small_digit( unsigned int, int, int, int ); + +void dockapp_draw_big_digit( unsigned int, int, int, int ); + +void dockapp_draw_big_str( const char*, int, int ); + +void dockapp_draw_small_str( const char*, int, int ); + +#if 0 +void dockapp_draw_bar( int, int, int, int, int ); + +void dockapp_draw_bar_calculate( float, int, int ); +#endif + +void dockapp_draw_data( void ); + +#endif /* !__dockapp_draw_h */ diff --git a/wmmisc/src/dockapp_main.c b/wmmisc/src/dockapp_main.c new file mode 100644 index 0000000..f3e5d8b --- /dev/null +++ b/wmmisc/src/dockapp_main.c @@ -0,0 +1,171 @@ +/* + * wmmisc - WindowMaker Dockapp for monitoring misc. information. + * Copyright (C) 2003-2006 Jesse S. (luxorfalls@sbcglobal.net) + * + * wmmisc 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. + * + * wmmisc 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 wmmisc; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include + +#ifdef USE_MTRACE +#include +#endif /* USE_MTRACE */ + +#include +#include +#include + +#include "wmgeneral.h" + +#include "wmmisc-master.xpm" +#include "dockapp_main.h" +#include "dockapp_draw.h" +#include "dockapp_utils.h" + +void +dockapp_show_help( const char* wm_name ) +{ + printf( "Usage: %s [OPTION]...\n", wm_name ); + printf( "This is a simple WindowMaker 'DockApp' that will monitor the following:\n" ); + printf( "Number of users logged in, total processes, total number of processes running,\n" ); + printf( "the system's fork count and load average.\n\n" ); + printf( " -h display this help and exit\n" ); + printf( " -v output version information and exit\n\n" ); + printf( "Report bugs to <" DOCKAPP_AUTHOR_EMAIL ">.\n" ); +} + +void +dockapp_show_version( void ) +{ + printf( "%s %d.%d\n", + DOCKAPP_NAME, + DOCKAPP_MAJOR_VERSION, + DOCKAPP_MINOR_VERSION ); + printf( "Written by %s <%s>\n\n", DOCKAPP_AUTHOR, DOCKAPP_AUTHOR_EMAIL ); + printf( "Copyright (C) 2003-2006 %s\n", DOCKAPP_AUTHOR ); + printf( "This is free software; see the source for copying conditions. There is NO\n" ); + printf( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" ); +} + +void +dockapp_exit( int signal_received ) +{ +#ifdef USE_MTRACE + muntrace(); +#endif /* USE_MTRACE */ + +#ifdef DEBUG + fprintf( stderr, + "%s: Exiting cleanly with signal %d\n", + DOCKAPP_NAME, + signal_received ); +#endif /* DEBUG */ + + exit( 0 ); +} + +void +dockapp_crash( int signal_received ) +{ + fprintf( stderr, + "%s: got signal %d -- bailing out!\n", + DOCKAPP_NAME, + signal_received ); + fprintf( stderr, + "It appears that %s has encountered an error.\n", + DOCKAPP_NAME ); + fprintf( stderr, + "If this continues to happen, please run '%s core' from a debugger,\n", + DOCKAPP_NAME ); + fprintf( stderr, + "such as gdb, and report the output to <%s>.\n", + DOCKAPP_AUTHOR_EMAIL ); + + abort(); +} + +int +main( int argc, char** argv ) +{ + int opt = 0; + +#ifdef USE_MTRACE + mtrace(); +#endif /* USE_MTRACE */ + + signal( SIGINT, dockapp_exit ); + signal( SIGSEGV, dockapp_crash ); + + opt = getopt( argc, argv, "hv" ); + + while ( -1 != opt ) + { + switch ( opt ) + { + case 'h': + { + dockapp_show_help( argv[0] ); + exit( 1 ); + /* Never reached. */ + } + + case 'v': + { + dockapp_show_version(); + exit( 1 ); + /* Never reached. */ + } + } + + opt = getopt( argc, argv, "hv" ); + } + + create_xbm_from_xpm( wmmisc_mask_bits, + wmmisc_master_xpm, + wmmisc_mask_width, + wmmisc_mask_height ); + + open_window( argc, + argv, + wmmisc_master_xpm, + wmmisc_mask_bits, + wmmisc_mask_width, + wmmisc_mask_height ); + + redraw_window(); + + dockapp_draw_small_str( "USERS", 4, 4 ); + dockapp_draw_small_str( "PROCS", 4, 11 ); + dockapp_draw_small_str( "ACTIVE", 4, 18 ); + + dockapp_draw_small_str( "UP", 4, 28 ); + dockapp_draw_small_str( "DAYS", 4, 37 ); + dockapp_draw_small_str( "WEEKS", 4, 44 ); + + dockapp_draw_small_str( "LOAD", 4, 53 ); + + do + { + dockapp_draw_data(); + usleep( 250000L ); + } while( 1 ); + + return 0; +} diff --git a/wmmisc/src/dockapp_main.h b/wmmisc/src/dockapp_main.h new file mode 100644 index 0000000..8e04aa3 --- /dev/null +++ b/wmmisc/src/dockapp_main.h @@ -0,0 +1,49 @@ +/* + * wmmisc - WindowMaker Dockapp for monitoring misc. information. + * Copyright (C) 2003-2006 Jesse S. (luxorfalls@sbcglobal.net) + * + * wmmisc 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. + * + * wmmisc 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 wmmisc; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef __dockapp_main_h +#define __dockapp_main_h + +#define DOCKAPP_AUTHOR "Jesse S." +#define DOCKAPP_AUTHOR_EMAIL "luxorfalls@sbcglobal.net" + +#define DOCKAPP_NAME "wmmisc" + +#define DOCKAPP_MAJOR_VERSION 1 +#define DOCKAPP_MINOR_VERSION 1 +#define DOCKAPP_VERSION "1.1" + +static char wmmisc_mask_bits[64 * 64]; +static int wmmisc_mask_width = 64; +static int wmmisc_mask_height = 64; + +/* + * Function prototypes. + */ + +void dockapp_show_help( const char* ); + +void dockapp_show_version( void ); + +void dockapp_exit( int ); + +void dockapp_crash( int ); + +#endif /* !__dockapp_main_h */ diff --git a/wmmisc/src/dockapp_utils.c b/wmmisc/src/dockapp_utils.c new file mode 100644 index 0000000..f491683 --- /dev/null +++ b/wmmisc/src/dockapp_utils.c @@ -0,0 +1,343 @@ +/* + * wmmisc - WindowMaker Dockapp for monitoring misc. information. + * Copyright (C) 2003-2006 Jesse S. (luxorfalls@sbcglobal.net) + * + * wmmisc 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. + * + * wmmisc 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 wmmisc; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "dockapp_utils.h" + +static dockapp_proc_t dockapp_proc; + +dockapp_proc_t +dockapp_utils_get_proc( void ) +{ + FILE* pla_buf = NULL; + int p_load[2]; + int p_run = 0; + int p_total = 0; + FILE* put_buf = NULL; + float p_uptime = 0.00; + + dockapp_utils_get_users(); + + pla_buf = fopen( "/proc/loadavg", "r" ); + + if ( NULL != pla_buf ) + { + fscanf( pla_buf, + "%d.%d %*s %*s %d/%d %*s", + &p_load[0], + &p_load[1], + &p_run, + &p_total ); + fclose( pla_buf ); + + dockapp_proc.total = p_total; + dockapp_proc.running = p_run; + dockapp_proc.load[0] = p_load[0]; + dockapp_proc.load[1] = p_load[1]; + } + else + { + dockapp_proc.total = 0; + dockapp_proc.running = 0; + dockapp_proc.load[0] = 0; + dockapp_proc.load[1] = 0; + } + + put_buf = fopen( "/proc/uptime", "r" ); + + if ( NULL != put_buf ) + { + fscanf( put_buf, "%f %*s", &p_uptime ); + fclose( put_buf ); + + dockapp_proc.jiffies = p_uptime; + dockapp_proc.seconds = GET_SECS( p_uptime ); + dockapp_proc.minutes = GET_MINS( p_uptime ); + dockapp_proc.hours = GET_HRS( p_uptime ); + dockapp_proc.days = GET_DAYS( p_uptime ); + dockapp_proc.weeks = GET_WEEKS( p_uptime ); + +#if 0 + printf( "Uptime: %.2d:%.2d:%.2d, %d day%c, %.3d week%c\n", + dockapp_proc.hours, + dockapp_proc.minutes, + dockapp_proc.seconds, + dockapp_proc.days, + ( ( dockapp_proc.days > 1 || !dockapp_proc.days ) ? 's' : '\0' ), + dockapp_proc.weeks, + ( ( dockapp_proc.weeks > 1 || !dockapp_proc.weeks ) ? 's' : '\0' ) ); +#endif + } + else + { + dockapp_proc.jiffies = 0.00; + dockapp_proc.seconds = 0; + dockapp_proc.minutes = 0; + dockapp_proc.hours = 0; + dockapp_proc.days = 0; + dockapp_proc.weeks = 0; + } + + return dockapp_proc; +} + +/* + * Get the number of users logged onto the system. + * + * This code was taken from gkrellm and modified for + * this program. + */ + +void +dockapp_utils_get_users( void ) +{ + struct utmp* ut; + struct stat stt; + static time_t utmp_mtime; + int p_users = 0; + + if ( 0 == stat( _PATH_UTMP, &stt ) && stt.st_mtime != utmp_mtime ) + { + setutent(); + + ut = getutent(); + + while ( NULL != ut ) + { + if ( USER_PROCESS == ut->ut_type && '\0' != ut->ut_name[0] ) + { + ++p_users; + } + + ut = getutent(); + } + + endutent(); + + utmp_mtime = stt.st_mtime; + dockapp_proc.users = p_users; + } +} + +int +dockapp_utils_get_char( char d_char ) +{ + int n_char = 0; + + switch ( d_char ) + { + case 'a': + case 'A': + { + n_char = 0; + break; + } + + case 'b': + case 'B': + { + n_char = 1; + break; + } + + case 'c': + case 'C': + { + n_char = 2; + break; + } + + case 'd': + case 'D': + { + n_char = 3; + break; + } + + case 'e': + case 'E': + { + n_char = 4; + break; + } + + case 'f': + case 'F': + { + n_char = 5; + break; + } + + case 'g': + case 'G': + { + n_char = 6; + break; + } + + case 'h': + case 'H': + { + n_char = 7; + break; + } + + case 'i': + case 'I': + { + n_char = 8; + break; + } + + case 'j': + case 'J': + { + n_char = 9; + break; + } + + case 'k': + case 'K': + { + n_char = 10; + break; + } + + case 'l': + case 'L': + { + n_char = 11; + break; + } + + case 'm': + case 'M': + { + n_char = 12; + break; + } + + case 'n': + case 'N': + { + n_char = 13; + break; + } + + case 'o': + case 'O': + { + n_char = 14; + break; + } + + case 'p': + case 'P': + { + n_char = 15; + break; + } + + case 'q': + case 'Q': + { + n_char = 16; + break; + } + + case 'r': + case 'R': + { + n_char = 17; + break; + } + + case 's': + case 'S': + { + n_char = 18; + break; + } + + case 't': + case 'T': + { + n_char = 19; + break; + } + + case 'u': + case 'U': + { + n_char = 20; + break; + } + + case 'v': + case 'V': + { + n_char = 21; + break; + } + + case 'w': + case 'W': + { + n_char = 22; + break; + } + + case 'x': + case 'X': + { + n_char = 23; + break; + } + + case 'y': + case 'Y': + { + n_char = 24; + break; + } + + case 'z': + case 'Z': + { + n_char = 25; + break; + } + + default: + { + n_char = 26; /* Blank. */ + break; + } + } + + return n_char; +} diff --git a/wmmisc/src/dockapp_utils.h b/wmmisc/src/dockapp_utils.h new file mode 100644 index 0000000..d1273af --- /dev/null +++ b/wmmisc/src/dockapp_utils.h @@ -0,0 +1,69 @@ +/* + * wmmisc - WindowMaker Dockapp for monitoring misc. information. + * Copyright (C) 2003-2006 Jesse S. (luxorfalls@sbcglobal.net) + * + * wmmisc 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. + * + * wmmisc 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 wmmisc; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef __dockapp_utils_h +#define __dockapp_utils_h + +#include + +typedef struct +{ + unsigned int users; + unsigned int total; + unsigned int running; + int load[2]; + + float jiffies; + int seconds; + int minutes; + int hours; + int days; + int weeks; +} dockapp_proc_t; + +/* + * Define some math macros. + */ + +/* Integer math. */ +#define GET_SECS( j ) ( ( int ) nearbyint( j ) % 60 ) +#define GET_MINS( j ) ( ( int ) ( nearbyint( j ) / 60 ) % 60 ) +#define GET_HRS( j ) ( ( int ) ( nearbyint( j ) / 3600 ) % 24 ) +#define GET_DAYS( j ) ( ( int ) ( nearbyint( j ) / 86400 ) % 7 ) +#define GET_WEEKS( j ) ( ( int ) nearbyint( j ) / 604800 ) + +/* Floating-point math. */ +#define GET_SECS_F( j ) ( fmodf( j, 60 ) ) +#define GET_MINS_F( j ) ( fmodf( ( j / 60 ), 60 ) ) +#define GET_HRS_F( j ) ( fmodf( ( j / 3600 ), 24 ) ) +#define GET_DAYS_F( j ) ( fmodf( ( j / 86400 ), 7 ) ) +#define GET_WEEKS_F( j ) ( ( float ) j / 604800 ) + +/* + * Function prototypes. + */ + +dockapp_proc_t dockapp_utils_get_proc( void ); + +void dockapp_utils_get_users( void ); + +int dockapp_utils_get_char( char ); + +#endif /* !__dockapp_utils_h */ diff --git a/wmmisc/src/general.mk b/wmmisc/src/general.mk new file mode 100644 index 0000000..4f41d8b --- /dev/null +++ b/wmmisc/src/general.mk @@ -0,0 +1,70 @@ +######################################################### +# This is included in a Makefile. +# +# e.g.: +# include general.mk +######################################################### + +ifeq ($(MODULAR_X),1) +PREFIX = $(shell pkg-config --variable=prefix xorg-server) +else +PREFIX = /usr/X11R6 +endif +BINDIR = $(PREFIX)/bin +LIBDIR = $(PREFIX)/lib +INCDIR = $(PREFIX)/include +MANDIR = $(PREFIX)/share/man +# Set some destination locations. + +CC = gcc +CXX = g++ +# Set the compilers. + +#CFLAGS = -O2 +#CXXFLAGS = $(CFLAGS) +# Safe for all systems. + +ifeq ($(CFLAGS),) + CFLAGS = -march=pentium3 -O2 -fomit-frame-pointer -pipe + CXXFLAGS = $(CFLAGS) +endif +# This is what I use on my box (Intel Celeron (Coppermine) 800MHz). + +ifeq ($(FASTER_MATH),1) + CFLAGS += -mfpmath=sse -ffast-math +endif + +CFLAGS += -std=c99 +CFLAGS += -Wall -W +CXXFLAGS += -std=c99 +CXXFLAGS += -Wall -W +# Set the compiler flags. + +AS = as +ASFLAGS = +# Set the assembler and flags. + +LD = ld +LDFLAGS = -lm +ifeq ($(MODULAR_X),1) +LDFLAGS += $(shell pkg-config --libs x11 xpm xext) +else +LDFLAGS += -L/usr/X11R6/lib -lX11 -lXpm -lXext +endif +LDFLAGS += -Wl,-O1 +# Set the linker and flags. + +AR = ar +ARFLAGS = cruv +RANLIB = ranlib + +CPPFLAGS = -D_GNU_SOURCE +# Set the preprocessor flags. + +ifeq ($(MODULAR_X),1) +INCLUDES = $(shell pkg-config --cflags x11 xpm xext) +else +INCLUDES = -I/usr/X11R6/include +endif +INCLUDES += -I. +# Set the include locations. diff --git a/wmmisc/src/wmgeneral.c b/wmmisc/src/wmgeneral.c new file mode 100644 index 0000000..9366376 --- /dev/null +++ b/wmmisc/src/wmgeneral.c @@ -0,0 +1,530 @@ +/* + * wmmisc - WindowMaker Dockapp for monitoring misc. information. + * Copyright (C) 2003-2006 Jesse S. (luxorfalls@sbcglobal.net) + * + * wmmisc 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. + * + * wmmisc 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 wmmisc; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "wmgeneral.h" + +static Display *da_display; +static Window da_root_window; +static int da_screen; +static int da_x_fd; +static int da_display_depth; +static XSizeHints da_size_hints; +static XWMHints da_wm_hints; +static Pixel da_bg_pixel; +static Pixel da_fg_pixel; +static char* da_geometry = NULL; +static Window da_icon_window; +static Window da_window; +static GC da_normal_gc; +static xpm_icon da_window_icon; +static Pixmap da_pixmask; + +typedef struct +{ + int enable; + int top; + int bottom; + int left; + int right; +} mouse_region_t; + +mouse_region_t mouse_region[MAX_MOUSE_REGION]; + +void +get_xpm( xpm_icon* window_icon, char** pixmap_bytes ) +{ + XWindowAttributes attributes; + int err; + + XGetWindowAttributes( da_display, da_root_window, &attributes ); + + window_icon->attributes.valuemask |= ( XpmReturnPixels | XpmReturnExtensions ); + + err = XpmCreatePixmapFromData( da_display, + da_root_window, + pixmap_bytes, + &window_icon->pixmap, + &window_icon->mask, + &window_icon->attributes ); + + if ( XpmSuccess != err ) + { + fprintf( stderr, "Not enough free color cells.\n" ); + exit( 1 ); + } +} + +Pixel +get_color_by_name( const char* color_name ) +{ + XColor color; + XWindowAttributes attributes; + + XGetWindowAttributes( da_display, da_root_window, &attributes ); + + color.pixel = 0; + + if ( 0 == XParseColor( da_display, attributes.colormap, color_name, &color ) ) + { + fprintf( stderr, "wmmisc: Can't parse color name: '%s'\n", color_name ); + return 0; + } + + if ( 0 == XAllocColor( da_display, attributes.colormap, &color )) + { + fprintf( stderr, "wmmisc: Can't allocate memory for color: '%s'\n", color_name ); + return 0; + } + + return color.pixel; +} + +int +flush_expose( Window window ) +{ + XEvent dummy; + int i = 0; + + while ( 0 != XCheckTypedWindowEvent( da_display, window, Expose, &dummy ) ) + { + ++i; + } + + return i; +} + +void +redraw_window( void ) +{ + flush_expose( da_icon_window ); + + XCopyArea( da_display, + da_window_icon.pixmap, + da_icon_window, + da_normal_gc, + 0, + 0, + da_window_icon.attributes.width, + da_window_icon.attributes.height, + 0, + 0 ); + + flush_expose( da_window ); + + XCopyArea( da_display, + da_window_icon.pixmap, + da_window, + da_normal_gc, + 0, + 0, + da_window_icon.attributes.width, + da_window_icon.attributes.height, + 0, + 0 ); +} + +void +redraw_window_coords( int x, int y ) +{ + flush_expose( da_icon_window ); + + XCopyArea( da_display, + da_window_icon.pixmap, + da_icon_window, + da_normal_gc, + x, + y, + da_window_icon.attributes.width, + da_window_icon.attributes.height, + 0, + 0 ); + + flush_expose( da_window ); + + XCopyArea( da_display, + da_window_icon.pixmap, + da_window, + da_normal_gc, + x, + y, + da_window_icon.attributes.width, + da_window_icon.attributes.height, + 0, + 0 ); +} + +void +add_mouse_region( int m_index, + int m_left, + int m_top, + int m_right, + int m_bottom ) +{ + if ( MAX_MOUSE_REGION > m_index ) + { + mouse_region[m_index].enable = 1; + mouse_region[m_index].top = m_top; + mouse_region[m_index].left = m_left; + mouse_region[m_index].bottom = m_bottom; + mouse_region[m_index].right = m_right; + } +} + +int +check_mouse_region( int x, int y ) +{ + int i; + int found; + + found = 0; + + for ( i = 0; MAX_MOUSE_REGION > i && 0 == found; ++i ) + { + if ( 0 != mouse_region[i].enable && + x <= mouse_region[i].right && + x >= mouse_region[i].left && + y <= mouse_region[i].bottom && + y >= mouse_region[i].top ) + { + found = 1; + } + } + + if ( 0 == found ) + { + return -1; + } + + return --i; +} + +void +create_xbm_from_xpm( char* xbm, char** xpm, int sx, int sy ) +{ + int i; + int j; + int k; + int width; + int height; + int numcol; + int depth; + int zero = 0; + unsigned char bwrite; + int bcount; + int curpixel; + + sscanf( *xpm, "%d %d %d %d", &width, &height, &numcol, &depth ); + + for ( k = 0; k != depth; ++k ) + { + zero <<= 8; + zero |= xpm[2][k]; + } + + for ( i = numcol + 1; i < ( numcol + sy + 1 ); ++i ) + { + bcount = 0; + bwrite = 0; + + for ( j = 0; j < sx * depth; j += depth ) + { + bwrite >>= 1; + + curpixel = 0; + + for ( k = 0; k != depth; ++k ) + { + curpixel <<= 8; + curpixel |= xpm[i][j + k]; + } + + if ( curpixel != zero ) + { + bwrite += 128; + } + + bcount++; + + if ( bcount == 8 ) + { + *xbm = bwrite; + ++xbm; + bcount = 0; + bwrite = 0; + } + } + } +} + +void +copy_xpm_area( int x, + int y, + unsigned int sx, + unsigned int sy, + int dx, + int dy ) +{ + XCopyArea( da_display, + da_window_icon.pixmap, + da_window_icon.pixmap, + da_normal_gc, + x, + y, + sx, + sy, + dx, + dy ); +} + +void +copy_xbm_area( int x, + int y, + unsigned int sx, + unsigned int sy, + int dx, + int dy ) +{ + XCopyArea( da_display, + da_window_icon.mask, + da_window_icon.pixmap, + da_normal_gc, + x, + y, + sx, + sy, + dx, + dy ); +} + +void +set_mask_coords( int x, int y ) +{ + XShapeCombineMask( da_display, + da_window, + ShapeBounding, + x, + y, + da_pixmask, + ShapeSet ); + XShapeCombineMask( da_display, + da_icon_window, + ShapeBounding, + x, + y, + da_pixmask, + ShapeSet ); +} + +void +open_window( int argc, + char** argv, + char** pixmap_bytes, + char* pixmask_bits, + int pixmask_width, + int pixmask_height ) +{ + unsigned int borderwidth = 1; + XClassHint classHint; + char* display_name = NULL; + char* wname = NULL; + XTextProperty name; + XGCValues gcv; + unsigned long gcm; + char* geometry = NULL; + int dummy = 0; + int i; + int wx; + int wy; + + wname = argv[0]; + + for ( i = 1; i < argc; ++i ) + { + if ( 0 == strcmp( argv[i], "-display" ) ) + { + display_name = argv[++i]; + } + + if ( 0 == strcmp( argv[i], "-geometry" ) ) + { + geometry = argv[++i]; + } + } + + da_display = XOpenDisplay( display_name ); + + if ( NULL == da_display ) + { + fprintf( stderr, + "%s: Can't open display: '%s'\n", + wname, + XDisplayName( display_name ) ); + exit( 1 ); + } + + da_screen = DefaultScreen( da_display ); + da_root_window = RootWindow( da_display, da_screen ); + da_display_depth = DefaultDepth( da_display, da_screen ); + da_x_fd = XConnectionNumber( da_display ); + + /* Convert XPM to XImage */ + get_xpm( &da_window_icon, pixmap_bytes ); + + /* Create a window to hold the stuff */ + da_size_hints.flags = USSize | USPosition; + da_size_hints.x = 0; + da_size_hints.y = 0; + + da_bg_pixel = get_color_by_name( "white" ); + da_fg_pixel = get_color_by_name( "black" ); + + XWMGeometry( da_display, + da_screen, + da_geometry, + NULL, + borderwidth, + &da_size_hints, + &da_size_hints.x, + &da_size_hints.y, + &da_size_hints.width, + &da_size_hints.height, + &dummy ); + + da_size_hints.width = 64; + da_size_hints.height = 64; + + da_window = XCreateSimpleWindow( da_display, + da_root_window, + da_size_hints.x, + da_size_hints.y, + da_size_hints.width, + da_size_hints.height, + borderwidth, + da_fg_pixel, + da_bg_pixel ); + + da_icon_window = XCreateSimpleWindow( da_display, + da_window, + da_size_hints.x, + da_size_hints.y, + da_size_hints.width, + da_size_hints.height, + borderwidth, + da_fg_pixel, + da_bg_pixel ); + + /* Activate hints */ + XSetWMNormalHints( da_display, da_window, &da_size_hints ); + classHint.res_name = wname; + classHint.res_class = wname; + XSetClassHint( da_display, da_window, &classHint ); + XSelectInput( da_display, + da_window, + ( ButtonPressMask | + ExposureMask | + ButtonReleaseMask | + PointerMotionMask | + StructureNotifyMask ) ); + XSelectInput( da_display, + da_icon_window, + ( ButtonPressMask | + ExposureMask | + ButtonReleaseMask | + PointerMotionMask | + StructureNotifyMask ) ); + + if ( 0 == XStringListToTextProperty( &wname, 1, &name ) ) + { + fprintf( stderr, "%s: can't allocate window name\n", wname ); + exit( 1 ); + } + + XSetWMName( da_display, da_window, &name ); + + /* Create GC for drawing */ + gcm = GCForeground | GCBackground | GCGraphicsExposures; + gcv.foreground = da_fg_pixel; + gcv.background = da_bg_pixel; + gcv.graphics_exposures = 0; + da_normal_gc = XCreateGC( da_display, da_root_window, gcm, &gcv ); + + /* ONLYSHAPE ON */ + da_pixmask = XCreateBitmapFromData( da_display, + da_window, + pixmask_bits, + pixmask_width, + pixmask_height ); + + XShapeCombineMask( da_display, + da_window, + ShapeBounding, + 0, + 0, + da_pixmask, + ShapeSet ); + XShapeCombineMask( da_display, + da_icon_window, + ShapeBounding, + 0, + 0, + da_pixmask, + ShapeSet ); + + /* ONLYSHAPE OFF */ + da_wm_hints.initial_state = WithdrawnState; + da_wm_hints.icon_window = da_icon_window; + da_wm_hints.icon_x = da_size_hints.x; + da_wm_hints.icon_y = da_size_hints.y; + da_wm_hints.window_group = da_window; + da_wm_hints.flags = ( StateHint | + IconWindowHint | + IconPositionHint | + WindowGroupHint ); + + XSetWMHints( da_display, da_window, &da_wm_hints ); + XSetCommand( da_display, da_window, argv, argc ); + XMapWindow( da_display, da_window ); + + if ( NULL != geometry ) + { + if ( 2 != sscanf( geometry, "+%d+%d", &wx, &wy ) ) + { + fprintf( stderr, "Bad geometry string.\n" ); + exit( 1 ); + } + + XMoveWindow( da_display, da_window, wx, wy ); + } + + if ( NULL != display_name ) + { + free( display_name ); + } +} diff --git a/wmmisc/src/wmgeneral.h b/wmmisc/src/wmgeneral.h new file mode 100644 index 0000000..25fcf15 --- /dev/null +++ b/wmmisc/src/wmgeneral.h @@ -0,0 +1,57 @@ +/* + * wmmisc - WindowMaker Dockapp for monitoring misc. information. + * Copyright (C) 2003-2006 Jesse S. (luxorfalls@sbcglobal.net) + * + * wmmisc 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. + * + * wmmisc 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 wmmisc; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef __dockapp_wmgeneral_h +#define __dockapp_wmgeneral_h + +#define MAX_MOUSE_REGION ( 16 ) + +typedef struct +{ + Pixmap pixmap; + Pixmap mask; + XpmAttributes attributes; +} xpm_icon; + +void get_xpm( xpm_icon*, char** ); + +Pixel get_color_by_name( const char* ); + +int flush_expose( Window ); + +void redraw_window( void ); + +void redraw_window_coords( int, int ); + +void add_mouse_region( int, int, int, int, int ); + +int check_mouse_region( int, int ); + +void create_xbm_from_xpm( char*, char**, int, int ); + +void copy_xpm_area( int, int, unsigned int, unsigned int, int, int ); + +void copy_xbm_area( int, int, unsigned int, unsigned int, int, int ); + +void set_mask_coords( int, int ); + +void open_window( int, char**, char**, char*, int, int ); + +#endif /* !__dockapp_wmgeneral_h */ diff --git a/wmmisc/src/wmmisc-master.xpm b/wmmisc/src/wmmisc-master.xpm new file mode 100644 index 0000000..3c941a5 --- /dev/null +++ b/wmmisc/src/wmmisc-master.xpm @@ -0,0 +1,173 @@ +/* XPM */ +static char * wmmisc_master_xpm[] = { +"200 100 70 1", +" c None", +". c #0000FF", +"+ c #000000", +"@ c #333133", +"# c #666366", +"$ c #202020", +"% c #999599", +"& c #004941", +"* c #C7C3C7", +"= c #00FFF2", +"- c #20B2AE", +"; c #188A86", +"> c #00FF00", +", c #02FD00", +"' c #06F800", +") c #0BF300", +"! c #10EF00", +"~ c #15EA00", +"{ c #19E600", +"] c #1DE200", +"^ c #22DD00", +"/ c #27D800", +"( c #2CD400", +"_ c #30D000", +": c #34CC00", +"< c #39C700", +"[ c #3EC200", +"} c #43BE00", +"| c #48B900", +"1 c #4CB500", +"2 c #50B100", +"3 c #55AC00", +"4 c #5AA700", +"5 c #5FA300", +"6 c #639E00", +"7 c #679A00", +"8 c #6C9600", +"9 c #719100", +"0 c #768D00", +"a c #7A8800", +"b c #7E8400", +"c c #837F00", +"d c #887B00", +"e c #8D7600", +"f c #917200", +"g c #966E00", +"h c #9A6900", +"i c #9F6400", +"j c #A46000", +"k c #A95B00", +"l c #AD5700", +"m c #B15300", +"n c #B64E00", +"o c #BB4A00", +"p c #C04500", +"q c #C54000", +"r c #C93C00", +"s c #CD3800", +"t c #D23300", +"u c #D72F00", +"v c #DC2A00", +"w c #E12500", +"x c #E52100", +"y c #E91D00", +"z c #EE1800", +"A c #F31400", +"B c #F80F00", +"C c #22332F", +"D c #1E1E27", +"E c #1F1F22", +"........................................................................................................................................................................................................", +"........................................................................................................................................................................................................", +"..++++++++++++++++++++++++++++++++++++++++++++++++++++++++++@#..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$$$$$&&$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$&$$&$&$$&$&$$&$&$$&$&$$&$$$$$$$$$$$$$$$$$&$$&$&$$&$&$$&$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$$$$$&&$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$&$$&$&$$&$&$$&$&$$&$&$$&$$$$$$$$$$$$$$$$$&$$&$&$$&$&$$&$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$$$$$&&$$$&&$$$&&$$$*..........................................................................................................................................", +"..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$$$$$&&$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$&$$&$&$$&$&$$&$&$$&$&$$&$$$$$$$$$$$$$$$$$&$$&$&$$&$&$$&$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$$$$$&&$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$&$$&$&$$&$&$$&$&$$&$&$$&$$$$$$$$$$$$$$$$$&$$&$&$$&$&$$&$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$$$$$&&$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..$$$&&$$$&&$$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$&&$$$&&$$$&&$$$*..........................................................................................................................................", +"..$$&$$&$&$$&$&$$&$&$$&$&$$&$&$$&$$$$$$$$$$$$&$$&$&$$&$&$$&$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$&&$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$&$$&$&$$&$&$$&$&$$&$&$$&$&$$&$$$$$$$$$$$$&$$&$&$$&$&$$&$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$&&$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$*..........................................................................................................................................", +"..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$$$$$$$$$$$$$$$$$$$$$$$&&$$$&&$$$$$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$&$$&$&$$&$$$$$$$$$$$$$$$$$$$$$$$&$$&$&$$&$$=$$&$$&$&$$&$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$$$$$$$$$$$$$$$$$$$$$$$&&$$$&&$$$$$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$&$$&$&$$&$$$$$$$$$$$$$$$$$$$$$$$&$$&$&$$&$$=$$&$$&$&$$&$$*..........................................................................................................................................", +"..$$$&&$$$&&$$$$$$$$$$$$$$$$$$$$$$$$$&&$$$&&$$$$$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&$$$*..........................................................................................................................................", +"..+$&$$&$&$$&$&$$&$&$$&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&$$&$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&$$$*..........................................................................................................................................", +"..+$&$$&$&$$&$&$$&$&$$&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&$$&$$*..........................................................................................................................................", +"..$$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&$$$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$$$$$&&$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$&$$&$&$$&$&$$&$&$$&$&$$&$$$$$$$$$$$$$$$$$&$$&$&$$&$&$$&$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$$$$$&&$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$&$$&$&$$&$&$$&$&$$&$&$$&$$$$$$$$$$$$$$$$$&$$&$&$$&$&$$&$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$$$$$&&$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$&&$$$&&$$$$$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$&$$&$&$$&$&$$&$&$$&$$$$$$$$$$$$$&$$&$&$$&$$$$$&$$&$&$$&$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$&&$$$&&$$$$$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$&$$&$&$$&$&$$&$&$$&$$$$$$$$$$$$$&$$&$&$$&$$$$$&$$&$&$$&$$*..........................................................................................................................................", +"..+$$&&$$$&&$$$&&$$$&&$$$$$$$$$$$$$$$&&$$$&&$$$=$$$&&$$$&&$$$*..........................................................................................................................................", +"..+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$*..........................................................................................................................................", +"..@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........................................................................................................................................", +"..#%**********************************************************..........................................................................................................................................", +"........................................................................................................................................................................................................", +"........................................................................................................................................................................................................", +"..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$.......................................................................................................................", +"..$$---$$$&&&;$;---;$;---;$;&&&;$;---;$;---;$;---;$;---;$;---;$$$$$$$$$$$$$$$$$$$.......................................................................................................................", +"..$-$$$-$&$$$-$&$$$-$&$$$-$-$$$-$-$$$&$-$$$&$&$$$-$-$$$-$-$$$-$$$$$$$$$$$$-$$$$$$.......................................................................................................................", +"..$-$$$-$&$$$-$&$$$-$&$$$-$-$$$-$-$$$&$-$$$&$&$$$-$-$$$-$-$$$-$$$$$$$-$$$$-$$$$$$.......................................................................................................................", +"..$;&&&;$$&&&;$;---;$$---;$;---;$;---;$;---;$$&&&;$;---;$;---;$$;-$$$;$$$-$$$$$$$.......................................................................................................................", +"..$-$$$-$&$$$-$-$$$&$&$$$-$&$$$-$&$$$-$-$$$-$&$$$-$-$$$-$&$$$-$$$$$$$$$$$-$$$$$$$.$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$...............................................................", +"..$-$$$-$&$$$-$-$$$&$&$$$-$&$$$-$&$$$-$-$$$-$&$$$-$-$$$-$&$$$-$$$$$$$-$$-$$$$$$$$.$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$...............................................................", +"..$$---$$$&&&;$;---;$;---;$$&&&;$;---;$;---;$$&&&;$;---;$;---;$$$$$$$;$$-$$$$$$$$.>,')!~{]^/(_:<[}|1234567890abcdefghijklmnopqrstuvwxyzAB...............................................................", +"..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$.>,')!~{]^/(_:<[}|1234567890abcdefghijklmnopqrstuvwxyzAB...............................................................", +"........................................................................................................................................................................................................", +"..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$...................................", +"..$&---&$;---$$$---;$;---$$;---;$;---;$;---;$;&&&;$$&&&;$$&&&;$;&&&;$;&&&$$-&&&-$;---$$;---;$;---;$;---;$;---;$;---;$;---;$;&&&;$;&&&;$;&&&;$;&&&;$;&&&;$;---;$C&&&C$...................................", +"..$-$$$-$-$$$-$-$$$&$-$$$-$-$$$&$-$$$&$-$$$&$-$$$-$&$$$-$&$$$-$-$$$-$-$$$&$--$--$-$$$-$-$$$-$-$$$-$-$$$-$-$$$-$-$$$&$&$-$&$-$$$-$-$$$-$-$$$-$-$$$-$-$$$-$&$$$-$&$$$&$...................................", +"..$-$$$-$-$$$-$-$$$&$-$$$-$-$$$&$-$$$&$-$$$&$-$$$-$&$$$-$&$$$-$-$$$-$-$$$&$-$-$-$-$$$-$-$$$-$-$$$-$-$$$-$-$$$-$-$$$&$&$-$&$-$$$-$-$$$-$-$$$-$$-$-$$-$$$-$&$$-&$&$$$&$...................................", +"..$;---;$;---$$;&&&$$;&&&;$;---$$;---$$;&;-;$;---;$$&&&;$$&&&;$;---$$;&&&$$;&&&;$;&&&;$;&&&;$;---;$;-&&;$;---$$;---;$$&;&$$;&&&;$;&&&;$;&&&;$$$-$$$;---;$$&-&$$C&&&C$...................................", +"..$-$$$-$-$$$-$-$$$&$-$$$-$-$$$&$-$$$&$-$$$-$-$$$-$&$$$-$&$$$-$-$$$-$-$$$&$-$$$-$-$$$-$-$$$-$-$$$&$-$-$-$-$$$-$&$$$-$&$-$&$-$$$-$-$$$-$-$-$-$$-$-$$&$$$-$&-$$&$&$$$&$...................................", +"..$-$$$-$-$$$-$-$$$&$-$$$-$-$$$&$-$$$&$-$$$-$-$$$-$&$$$-$&$$$-$-$$$-$-$$$&$-$$$-$-$$$-$-$$$-$-$$$&$-$$--$-$$$-$&$$$-$&$-$&$-$$$-$-$$$-$--$--$-$$$-$&$$$-$-$$$&$&$$$&$...................................", +"..$;&&&;$;---$$$---;$;---$$;---;$;&&&$$;---;$;&&&;$$&&&;$;---;$;&&&;$;---;$;&&&;$;&&&;$;---;$;&&&$$;---;$;&&&;$;---;$$&;&$$;----$$---$$;&&&;$;&&&;$;---;$;---;$C&&&C$...................................", +"..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$...................................", +"........................................................................................................................................................................................................", +"........................................................................................................................................................................................................", +"..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$.........................................................................................................................", +"..$$--$$$&&;$;--;$;--;$;&&;$;--;$;--;$;--;$;--;$;--;$$$$$$$$$$$$$$$$$;-&$$$&-;$.........................................................................................................................", +"..$-$$-$&$$-$&$$-$&$$-$-$$-$-$$&$-$$&$&$$-$-$$-$-$$-$$$$$$$$$$-$$$;-$-$$&$&$$-$.........................................................................................................................", +"..$;&&;$$&&;$;--;$$--;$;--;$;--;$;--;$$&&;$;--;$;--;$$;-$$-$$-$$$$DE$;&&$$$&&;$.........................................................................................................................", +"..$-$$-$&$$-$-$$&$&$$-$&$$-$&$$-$-$$-$&$$-$-$$-$&$$-$$$$$$$$$-$$$$;-$-$$&$&$$-$.........................................................................................................................", +"..$$--$$$&&;$;--;$;--;$$&&;$;--;$;--;$$&&;$;--;$;--;$$$$$$-$-$$$=$$$$;-&$$$&-;$.........................................................................................................................", +"..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$.........................................................................................................................", +"........................................................................................................................................................................................................", +"..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$..............................................................", +"..$&--&$;--$$$--;$;--$$;--;$;--;$;--;$;&&;$$&&;$$&&;$;&&;$;&&$$-&&-$;--$$;--;$;--;$;--;$;--;$;--;$;--;$;&&;$;&&;$;&&;$;&&;$;&&;$;--;$$&&$$..............................................................", +"..$-$$-$-$$-$-$$&$-$$-$-$$&$-$$&$-$$&$-$$-$&$$-$&$$-$-$-$$-$$&$----$-$$-$-$$-$-$$-$-$$-$-$$-$-$$&$&$-&$-$$-$-$$-$-$$-$-$$-$-$$-$&$$-$&$$&$..............................................................", +"..$;--;$;--$$;&&$$;&&;$;--$$;--$$;&;;$;--;$$&&;$$&&;$;-$$$;&&$$;&&;$;&&;$;&&;$;--;$;-&;$;--$$;--;$$&;$$;&&;$;&&;$;&&;$$--$$;--;$$&-$$$&&$$..............................................................", +"..$-$$-$-$$-$-$$&$-$$-$-$$&$-$$&$-$$-$-$$-$&$$-$&$$-$-$-$$-$$&$-$$-$-$$-$-$$-$-$$&$-$--$-$$-$&$$-$&$-&$-$$-$-$$-$----$-$$-$&$$-$&-$&$&$$&$..............................................................", +"..$;&&;$;--$$$--;$;--$$;--;$;&&$$;--;$;&&;$$&&;$;--;$;&&;$;--;$;&&;$;&&;$;--;$;&&$$;---$;&&;$;--;$$&;$$;---$$--$$-&&-$;&&;$;--;$;--;$$&&$$..............................................................", +"..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$.............................................................."};