xwpe-1.5.30a/0000755000076400007640000000000010413525655011764 5ustar dulsidulsixwpe-1.5.30a/COPYING0000644000076400007640000004307610263105405013017 0ustar dulsidulsi GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. xwpe-1.5.30a/INSTALL0000644000076400007640000000314210263105405013003 0ustar dulsidulsiThis is the file INSTALL for the xwpe distribution, version 1.5.11a. IMPORTANT NOTE: The configuration file format has changed since version 1.5.10a. Old configuration files will not work. To compile this package: 1. Configure the package for your system. In the directory that this file is in, type `./configure'. If you're using `csh' on an old version of System V, you might need to type `sh configure' instead to prevent `csh' from trying to execute `configure' itself. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation, and creates the Makefile. It also creates a file `config.status' that you can run in the future to recreate the current configuration. Running `configure' takes a minute or two. While it is running, it prints some messages that tell what it is doing. By default, xwpe files will be installed in the /usr/local directories. You can specify an installation prefix other than /usr/local by giving `configure' the option `--prefix=PATH'. If you need to do unusual things to compile the package, we encourage you to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the README so we can include them in the next release. 2. Type `make' to compile the package. 3. Type `make install' to install programs, data files, and documentation. (For german-speaking people: Type `make install_german' to install programs, data files and german documentation) 4. You can remove the program binaries and object files from the source directory by typing `make clean'. xwpe-1.5.30a/configure0000755000076400007640000054003210263105405013665 0ustar dulsidulsi#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="Xwpe.h" ac_default_prefix=/usr/local ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LN_S RANLIB ac_ct_RANLIB XDB PRNTCMD X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-x use the X Window System Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep if test $ac_cv_c_compiler_gnu = yes; then echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 if test "${ac_cv_prog_gcc_traditional+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi if test "x$CC" != xcc; then echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5 echo $ECHO_N "checking whether $CC and cc understand -c and -o together... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5 echo $ECHO_N "checking whether cc understands -c and -o together... $ECHO_C" >&6 fi set dummy $CC; ac_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest.$ac_objext >&5' if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&5' if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 cat >>confdefs.h <<\_ACEOF #define NO_MINUS_C_MINUS_O 1 _ACEOF fi echo "$as_me:$LINENO: checking for ${CC-cc} option to accept ANSI C" >&5 echo $ECHO_N "checking for ${CC-cc} option to accept ANSI C... $ECHO_C" >&6 if test "${cf_cv_ansi_cc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cf_cv_ansi_cc=no cf_save_CFLAGS="$CFLAGS" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) for cf_arg in "-DCC_HAS_PROTOS" "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc do CFLAGS="$cf_save_CFLAGS $cf_arg" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef CC_HAS_PROTOS #if !defined(__STDC__) || __STDC__ != 1 choke me #endif #endif int main () { int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_ansi_cc="$cf_arg"; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done CFLAGS="$cf_save_CFLAGS" fi echo "$as_me:$LINENO: result: $cf_cv_ansi_cc" >&5 echo "${ECHO_T}$cf_cv_ansi_cc" >&6 if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then CFLAGS="$CFLAGS $cf_cv_ansi_cc" else cat >>confdefs.h <<\_ACEOF #define CC_HAS_PROTOS 1 _ACEOF fi fi echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; ccp = (char const *const *) p; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi echo "$as_me:$LINENO: checking for main in -lncurses" >&5 echo $ECHO_N "checking for main in -lncurses... $ECHO_C" >&6 if test "${ac_cv_lib_ncurses_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ncurses_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ncurses_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_main" >&5 echo "${ECHO_T}$ac_cv_lib_ncurses_main" >&6 if test $ac_cv_lib_ncurses_main = yes; then LIBS="${LIBS} -lncurses" CURSES="yes" echo "$as_me:$LINENO: checking for main in -lmytinfo" >&5 echo $ECHO_N "checking for main in -lmytinfo... $ECHO_C" >&6 if test "${ac_cv_lib_mytinfo_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmytinfo $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_mytinfo_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_mytinfo_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_mytinfo_main" >&5 echo "${ECHO_T}$ac_cv_lib_mytinfo_main" >&6 if test $ac_cv_lib_mytinfo_main = yes; then LIBS="${LIBS} -lmytinfo" fi else echo "$as_me:$LINENO: checking for main in -lcurses" >&5 echo $ECHO_N "checking for main in -lcurses... $ECHO_C" >&6 if test "${ac_cv_lib_curses_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_curses_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_curses_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_curses_main" >&5 echo "${ECHO_T}$ac_cv_lib_curses_main" >&6 if test $ac_cv_lib_curses_main = yes; then LIBS="${LIBS} -lcurses" CURSES="yes" else cat >>confdefs.h <<\_ACEOF #define TERMCAP 1 _ACEOF echo "$as_me:$LINENO: checking for main in -ltermlib" >&5 echo $ECHO_N "checking for main in -ltermlib... $ECHO_C" >&6 if test "${ac_cv_lib_termlib_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltermlib $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_termlib_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_termlib_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_termlib_main" >&5 echo "${ECHO_T}$ac_cv_lib_termlib_main" >&6 if test $ac_cv_lib_termlib_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBTERMLIB 1 _ACEOF LIBS="-ltermlib $LIBS" fi echo "$as_me:$LINENO: checking for main in -ltermcap" >&5 echo $ECHO_N "checking for main in -ltermcap... $ECHO_C" >&6 if test "${ac_cv_lib_termcap_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltermcap $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_termcap_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_termcap_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_main" >&5 echo "${ECHO_T}$ac_cv_lib_termcap_main" >&6 if test $ac_cv_lib_termcap_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBTERMCAP 1 _ACEOF LIBS="-ltermcap $LIBS" fi fi fi echo "$as_me:$LINENO: checking for main in -lgpm" >&5 echo $ECHO_N "checking for main in -lgpm... $ECHO_C" >&6 if test "${ac_cv_lib_gpm_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgpm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_gpm_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_gpm_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_gpm_main" >&5 echo "${ECHO_T}$ac_cv_lib_gpm_main" >&6 if test $ac_cv_lib_gpm_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBGPM 1 _ACEOF LIBS="-lgpm $LIBS" fi echo "$as_me:$LINENO: checking for main in -lz" >&5 echo $ECHO_N "checking for main in -lz... $ECHO_C" >&6 if test "${ac_cv_lib_z_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_z_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_z_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_z_main" >&5 echo "${ECHO_T}$ac_cv_lib_z_main" >&6 if test $ac_cv_lib_z_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF LIBS="-lz $LIBS" fi echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi echo "$as_me:$LINENO: checking for symlink" >&5 echo $ECHO_N "checking for symlink... $ECHO_C" >&6 if test "${ac_cv_func_symlink+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define symlink to an innocuous variant, in case declares symlink. For example, HP-UX 11i declares gettimeofday. */ #define symlink innocuous_symlink /* System header to define __stub macros and hopefully few prototypes, which can conflict with char symlink (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef symlink /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char symlink (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_symlink) || defined (__stub___symlink) choke me #else char (*f) () = symlink; #endif #ifdef __cplusplus } #endif int main () { return f != symlink; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_symlink=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_symlink=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_symlink" >&5 echo "${ECHO_T}$ac_cv_func_symlink" >&6 if test $ac_cv_func_symlink = yes; then : else cat >>confdefs.h <<\_ACEOF #define NOSYMLINKS 1 _ACEOF fi echo "$as_me:$LINENO: checking for tparm" >&5 echo $ECHO_N "checking for tparm... $ECHO_C" >&6 if test "${ac_cv_func_tparm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define tparm to an innocuous variant, in case declares tparm. For example, HP-UX 11i declares gettimeofday. */ #define tparm innocuous_tparm /* System header to define __stub macros and hopefully few prototypes, which can conflict with char tparm (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef tparm /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tparm (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_tparm) || defined (__stub___tparm) choke me #else char (*f) () = tparm; #endif #ifdef __cplusplus } #endif int main () { return f != tparm; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_tparm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_tparm=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_tparm" >&5 echo "${ECHO_T}$ac_cv_func_tparm" >&6 if test $ac_cv_func_tparm = yes; then : else cat >>confdefs.h <<\_ACEOF #define NOTPARM 1 _ACEOF fi for ac_func in mkdtemp do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test -n "${HAVE_MKDTEMP}"; then for ac_func in tempnam do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi if test "${RANLIB}" = 'ranlib'; then cat >>confdefs.h <<\_ACEOF #define RANDLIB 1 _ACEOF fi # Extract the first word of "xdb", so it can be a program name with args. set dummy xdb; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_XDB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$XDB"; then ac_cv_prog_XDB="$XDB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_XDB="xdb" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi XDB=$ac_cv_prog_XDB if test -n "$XDB"; then echo "$as_me:$LINENO: result: $XDB" >&5 echo "${ECHO_T}$XDB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "${XDB}" = 'xdb'; then cat >>confdefs.h <<\_ACEOF #define XDB 1 _ACEOF fi echo "$as_me:$LINENO: checking for strstr" >&5 echo $ECHO_N "checking for strstr... $ECHO_C" >&6 if test "${ac_cv_func_strstr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define strstr to an innocuous variant, in case declares strstr. For example, HP-UX 11i declares gettimeofday. */ #define strstr innocuous_strstr /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strstr (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef strstr /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strstr (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_strstr) || defined (__stub___strstr) choke me #else char (*f) () = strstr; #endif #ifdef __cplusplus } #endif int main () { return f != strstr; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_strstr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_strstr=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_strstr" >&5 echo "${ECHO_T}$ac_cv_func_strstr" >&6 if test $ac_cv_func_strstr = yes; then : else cat >>confdefs.h <<\_ACEOF #define NOSTRSTR 1 _ACEOF fi # Extract the first word of "lpr", so it can be a program name with args. set dummy lpr; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_PRNTCMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PRNTCMD"; then ac_cv_prog_PRNTCMD="$PRNTCMD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PRNTCMD="lpr" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi PRNTCMD=$ac_cv_prog_PRNTCMD if test -n "$PRNTCMD"; then echo "$as_me:$LINENO: result: $PRNTCMD" >&5 echo "${ECHO_T}$PRNTCMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test -z "${PRNTCMD}"; then # Extract the first word of "lp", so it can be a program name with args. set dummy lp; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_PRNTCMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PRNTCMD"; then ac_cv_prog_PRNTCMD="$PRNTCMD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PRNTCMD="lp" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi PRNTCMD=$ac_cv_prog_PRNTCMD if test -n "$PRNTCMD"; then echo "$as_me:$LINENO: result: $PRNTCMD" >&5 echo "${ECHO_T}$PRNTCMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -n "${PRNTCMD}"; then cat >>confdefs.h <<_ACEOF #define PRNTCMD "$PRNTCMD" _ACEOF else cat >>confdefs.h <<\_ACEOF #define PRNTCMD "" _ACEOF fi echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" fi; # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -fr conftest.dir if mkdir conftest.dir; then cd conftest.dir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'_ACEOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' _ACEOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -fr conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Intrinsic.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Intrinsic.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lXt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XtMalloc (0) ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/libXt.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. cat >>confdefs.h <<\_ACEOF #define X_DISPLAY_MISSING 1 _ACEOF X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case `(uname -sr) 2>/dev/null` in "SunOS 5"*) echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5 echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_nospace=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_nospace=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_R_nospace = yes; then echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_space=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_space=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_R_space = yes; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 X_LIBS="$X_LIBS -R $x_libraries" else echo "$as_me:$LINENO: result: neither works" >&5 echo "${ECHO_T}neither works" >&6 fi fi LIBS=$ac_xsave_LIBS esac fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn Johnson says this is needed for Ultrix, if the X # libraries were built with DECnet support. And Karl Berry says # the Alpha needs dnet_stub (dnet does not exist). ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XOpenDisplay (); int main () { XOpenDisplay (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_dnet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_stub_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. echo "$as_me:$LINENO: checking for gethostbyname" >&5 echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define gethostbyname to an innocuous variant, in case declares gethostbyname. For example, HP-UX 11i declares gettimeofday. */ #define gethostbyname innocuous_gethostbyname /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef gethostbyname /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) choke me #else char (*f) () = gethostbyname; #endif #ifdef __cplusplus } #endif int main () { return f != gethostbyname; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 if test $ac_cv_func_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 if test $ac_cv_lib_nsl_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5 echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 if test $ac_cv_lib_bsd_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says Simon Leinen: it contains gethostby* # variants that don't use the name server (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. echo "$as_me:$LINENO: checking for connect" >&5 echo $ECHO_N "checking for connect... $ECHO_C" >&6 if test "${ac_cv_func_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define connect to an innocuous variant, in case declares connect. For example, HP-UX 11i declares gettimeofday. */ #define connect innocuous_connect /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef connect /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_connect) || defined (__stub___connect) choke me #else char (*f) () = connect; #endif #ifdef __cplusplus } #endif int main () { return f != connect; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6 if test $ac_cv_func_connect = no; then echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); int main () { connect (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 if test $ac_cv_lib_socket_connect = yes; then X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi # Guillermo Gomez says -lposix is necessary on A/UX. echo "$as_me:$LINENO: checking for remove" >&5 echo $ECHO_N "checking for remove... $ECHO_C" >&6 if test "${ac_cv_func_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define remove to an innocuous variant, in case declares remove. For example, HP-UX 11i declares gettimeofday. */ #define remove innocuous_remove /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef remove /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_remove) || defined (__stub___remove) choke me #else char (*f) () = remove; #endif #ifdef __cplusplus } #endif int main () { return f != remove; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_remove=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5 echo "${ECHO_T}$ac_cv_func_remove" >&6 if test $ac_cv_func_remove = no; then echo "$as_me:$LINENO: checking for remove in -lposix" >&5 echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 if test "${ac_cv_lib_posix_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); int main () { remove (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_posix_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_posix_remove=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5 echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 if test $ac_cv_lib_posix_remove = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo "$as_me:$LINENO: checking for shmat" >&5 echo $ECHO_N "checking for shmat... $ECHO_C" >&6 if test "${ac_cv_func_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shmat to an innocuous variant, in case declares shmat. For example, HP-UX 11i declares gettimeofday. */ #define shmat innocuous_shmat /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shmat /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shmat) || defined (__stub___shmat) choke me #else char (*f) () = shmat; #endif #ifdef __cplusplus } #endif int main () { return f != shmat; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shmat=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5 echo "${ECHO_T}$ac_cv_func_shmat" >&6 if test $ac_cv_func_shmat = no; then echo "$as_me:$LINENO: checking for shmat in -lipc" >&5 echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 if test "${ac_cv_lib_ipc_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); int main () { shmat (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ipc_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ipc_shmat=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5 echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 if test $ac_cv_lib_ipc_shmat = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS=$LDFLAGS test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char IceConnectionNumber (); int main () { IceConnectionNumber (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ICE_IceConnectionNumber=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi LDFLAGS=$ac_save_LDFLAGS fi if test -n "${no_x}"; then cat >>confdefs.h <<\_ACEOF #define NO_XWINDOWS 1 _ACEOF else X_EXTRA_LIBS="${X_EXTRA_LIBS} -lX11" fi if man -s 1 ls > /dev/null 2> /dev/null; then cat >>confdefs.h <<\_ACEOF #define MAN_S_OPT 1 _ACEOF fi if eval 'grep -s "[ ]putc[ (]" /usr/include/*.h > /dev/null'; then :; else cat >>confdefs.h <<\_ACEOF #define DEFPGC 1 _ACEOF fi if eval 'grep -s "[ ]tputs[ (]" /usr/include/*.h > /dev/null'; then :; else cat >>confdefs.h <<\_ACEOF #define DEFTPUTS 1 _ACEOF fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@LN_S@,$LN_S,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@XDB@,$XDB,;t t s,@PRNTCMD@,$PRNTCMD,;t t s,@X_CFLAGS@,$X_CFLAGS,;t t s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t s,@X_LIBS@,$X_LIBS,;t t s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi xwpe-1.5.30a/README0000644000076400007640000000501510263105405012633 0ustar dulsidulsi XWPE ALPHA README What is xwpe? Xwpe is a development environment designed for use on UNIX systems. Fred Kruse wrote xwpe and released the software for free under the GNU Public License. The user interface was designed to mimic the Borland C and Pascal family. Extensive support is provided for programming. Syntax highlighting for many programming languages are included and others may be added if necessary. Any compiler can easily be used by the program. By compiling within xwpe, errors in the source code can be jumped to and swiftly corrected. Support for three different debuggers are provided within the development environment. Variables and the stack can be easily displayed. Setting and unsetting breakpoints can done directly within the source code. The program can be run in several forms. Xwpe runs the X windows version of the programming environment. Wpe simply runs a terminal programming environment. Xwe and we provide a simple text editor for X windows and terminal modes respectively. On-line help describes the complete use of xwpe. What is xwpe-alpha? The xwpe-alpha project is an attempt to reorganize the source code to improve readability. It will also incorporate as many bug fixes as available. Attempts to contact the author of xwpe have received no response so xwpe-alpha should be considered unsupported by Fred Kruse. To signify the difference xwpe-alpha has increased the version number from 1.4.x to 1.5.x despite relatively few changes at present. Also xwpe-alpha release end in 'a' (e.g. 1.5.4a). Why release it now? The source code is still largely unchanged at this point. The purpose in the release is to discover problems early in the modifications. Since not all platforms are accessible to the developers come changes could inadvertently break compilation on another system. Also understanding and modifying the structure of xwpe is a large undertaking and will take a long time to complete. Copyright Copyright (C) 1993 Fred Kruse xwpe is free; anyone may redistribute copies of xwpe to anyone under the terms stated in the GNU General Public License. The author assumes no responsibility for errors or omissions or damages resulting from the use of xwpe or this manual. Maintainer This version is unofficial update to xwpe and is not supported by Fred Kruse. Updates will be made available on the unofficial xwpe homepage, http://www.identicalsoftware.com/xwpe/. Send questions or problems to Dennis Payne, dulsi@identicalsoftware.com. xwpe-1.5.30a/attrb.h0000644000076400007640000000117210263105405013240 0ustar dulsidulsi/* attrb.h */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ /* define proprietary attribute byte */ #undef A_STANDOUT #undef A_UNDERLINE #undef A_REVERSE #undef A_BLINK #undef A_DIM #undef A_BOLD #undef A_ALTCHARSET #define A_STANDOUT 0x01 #define A_UNDERLINE 0x02 #define A_REVERSE 0x04 #define A_BLINK 0x08 #define A_DIM 0x10 #define A_BOLD 0x20 #define A_ALTCHARSET 0x100 xwpe-1.5.30a/we_fl_unix.c0000644000076400007640000031551310263105405014265 0ustar dulsidulsi/* we_fl_unix.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "messages.h" #include "edit.h" #ifdef UNIX #include #include #include struct dirfile *e_make_win_list(FENSTER * f); extern char *e_tmp_dir; #ifdef NOSYMLINKS #define readlink(x, y, z) -1 #define WpeRenameLink(x, y, z, f) 0 #define WpeLinkFile(x, y, sw, f) link(x, y) #define lstat(x,y) stat(x,y) #undef S_ISLNK #define S_ISLNK(x) 0 #else #include #endif #define WPE_PATHMAX 2048 /* buffer size for copying */ #define E_C_BUFFERSIZE 524288 /* 1/2 Mega Byte */ #ifdef DEBUG int SpecialError(char *text, int sw, FARBE *f, char *file, int line) { fprintf(stderr, "\nFile \"%s\" line %d\n", file, line); return e_error(text, sw, f); } #define e_error(text, sw, f) SpecialError(text, sw, f, __FILE__, __LINE__) #endif /* setup the file-manager structures 'dirct' or the current dir. is used to search for directories and files */ /* sw | file manager type ------------------------ 0 | open/new file 1 | read block of text from file 2 | write block of text to file 3 | execute file 4 | save as 5 | add file to project 6 | wastebasket */ int WpeCreateFileManager(int sw, ECNT *cn, char *dirct) { extern char *e_hlp_str[]; extern WOPT *fblst, *rblst, *wblst, *xblst, *sblst, *ablst; FENSTER *f; int i, j; FLBFFR *b; int allocate_size; /* inital memory size for allocation */ char *sfile; /* check whether we reached the maximum number of windows */ if(cn->mxedt >= MAXEDT) { e_error(e_msg[ERR_MAXWINS], 0, cn->fb); return(-1); } /* search for a not used window ID number (j) */ for(j = 1; j <= MAXEDT; j++) { for(i = 1; i <= cn->mxedt && cn->edt[i] != j; i++) ; if(i > cn->mxedt) break; } /* change the shape of the mouse :-) */ WpeMouseChangeShape(WpeWorkingShape); /* currently active window, one more window in the system, its number is j */ cn->curedt = j; (cn->mxedt)++; cn->edt[cn->mxedt] = j; /* allocate window structure */ if((f = (FENSTER *)MALLOC(sizeof(FENSTER))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); /* allocate buffer related to the window (NOT proper type, later casted) */ if((b = (FLBFFR *) MALLOC(sizeof(FLBFFR))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); f->fb = cn->fb; cn->f[cn->mxedt] = f; /* store the window structure at appropriate place */ f->a = e_set_pnt(11, 2); /* beginning of the box */ f->e = e_set_pnt(f->a.x + 55, f->a.y + 20); /* other coord. of the box */ f->winnum = cn->curedt; f->dtmd = DTMD_FILEMANAGER; f->ins = 1; f->save = 0; f->zoom = 0; f->ed = cn; f->c_sw = NULL; f->c_st = NULL; f->pic = NULL; if(sw == 6) { sw = 0; f->datnam = "Wastebasket"; f->save = 1; } else f->datnam = "File-Manager"; /* window header text */ /* status line text for different mode */ if(sw == 0) { f->blst = fblst; f->nblst = 8; } else if(sw == 1) { f->blst = rblst; f->nblst = 4; } else if(sw == 2) { f->blst = wblst; f->nblst = 4; } else if(sw == 3) { f->blst = xblst; f->nblst = 4; } else if(sw == 4) { f->blst = sblst; f->nblst = 5; } else if(sw == 5) { f->blst = ablst; f->nblst = 4; } if(sw == 3) f->hlp_str = e_hlp_str[5]; else f->hlp_str = e_hlp_str[4]; if(!dirct || dirct[0] == '\0') { /* no working directory has been given */ f->dirct = WpeGetCurrentDir(cn); } else { /* working directory is given, copy it over */ allocate_size = strlen(dirct); if((f->dirct = MALLOC(allocate_size+1)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); strcpy(f->dirct, dirct); } strcpy(f->fd.search, ""); strcpy(f->fd.replace, ""); strcpy(f->fd.file, SUDIR); f->fd.dirct = WpeStrdup(f->dirct); f->fd.sw = 16; f->fd.sn = 0; f->fd.rn = 0; f->b = (BUFFER *)b; /* the find pattern can only be 79 see FIND structure */ if((b->rdfile = MALLOC(80)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); strcpy(b->rdfile, f->fd.file); /* find file pattern */ b->sw = sw; /* window for files */ if((b->fw = (FLWND *) MALLOC(sizeof(FLWND))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); /* window for directory */ if((b->dw = (FLWND *) MALLOC(sizeof(FLWND))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); if((sfile = MALLOC(strlen(f->dirct)+strlen(b->rdfile)+2)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); /* determine current directory */ b->cd = WpeCreateWorkingDirTree(f->save, cn); /* it is necessary to do this, because the file manager may not be in the appropriate directory here */ sprintf(sfile, "%s/%s", f->dirct, SUDIR); /* find all other directories in the current */ b->dd = e_find_dir(sfile, f->ed->flopt & FM_SHOW_HIDDEN_DIRS ? 1 : 0); /* setup the drawing in the dir tree window */ b->dw->df = WpeGraphicalDirTree(b->cd, b->dd, cn); i = f->ed->flopt & FM_SHOW_HIDDEN_FILES ? 1 : 0; if(sw == 3) i |= 2; /* finds all files matching the pattern */ sprintf(sfile, "%s/%s", f->dirct, b->rdfile); b->df = e_find_files(sfile, i); FREE(sfile); /* setup the drawing in the file list window */ b->fw->df = WpeGraphicalFileList(b->df, f->ed->flopt >> 9, cn); /* file box - geometry and vertical slider settings */ b->fw->mxa = f->a.x; b->fw->mxe = f->e.x; b->fw->mya = f->a.y; b->fw->mye = f->e.y; b->fw->xa = f->e.x - 33; b->fw->xe = f->e.x - 17; b->fw->ya = f->a.y + 6; b->fw->ye = f->a.y + 17; b->fw->f = f; b->fw->ia = b->fw->nf = b->fw->nxfo = b->fw->nyfo = 0; b->fw->srcha = b->fw->ja = 12; /* directory box - geometry and vertical slider settings */ b->dw->mxa = f->a.x; b->dw->mxe = f->e.x; b->dw->mya = f->a.y; b->dw->mye = f->e.y; b->dw->xa = f->a.x + 3; b->dw->xe = f->a.x + 28; b->dw->ya = f->a.y + 6; b->dw->ye = f->a.y + 17; b->dw->f = f; b->dw->ia = b->dw->ja = b->dw->nxfo = 0; b->dw->srcha = -1; b->dw->nf = b->dw->nyfo = b->cd->anz - 1; if(cn->mxedt > 1) e_ed_rahmen(cn->f[cn->mxedt - 1], 0); e_firstl(f, 1); /* basically it draws the window out */ WpeDrawFileManager(f); /* restore the shape of the mouse */ WpeMouseRestoreShape(); return(0); } /* drawing out the file-manager, first buttons, than the dir tree and file list */ int WpeDrawFileManager(FENSTER * f) { FLBFFR *b = (FLBFFR *)f->b; int i, j; int bx1 = 1, bx2 = 1, bx3 = 1, by = 4; for(j = f->a.y + 1; j < f->e.y; j++) for(i = f->a.x + 1; i < f->e.x; i++) e_pr_char(i, j, ' ', f->fb->nt.fb); if(NUM_LINES_ON_SCREEN <= 17) by = -1; else if(b->sw != 0 || NUM_LINES_ON_SCREEN <= 19) by = 2; if(NUM_LINES_ON_SCREEN > 17) { e_pr_str((f->a.x + 4), f->e.y - by, "Cancel", f->fb->nz.fb, -1, -1, f->fb->ns.fb, f->fb->nt.fb); e_pr_str((f->a.x + 14), f->e.y - by, "Change Dir", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); if(b->sw == 1 && NUM_COLS_ON_SCREEN >= 34) e_pr_str((f->a.x + 28), f->e.y - by, "Read", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); else if(b->sw == 2 && NUM_COLS_ON_SCREEN >= 35) e_pr_str((f->a.x + 28), f->e.y - by, "Write", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); else if(b->sw == 4) { if(NUM_COLS_ON_SCREEN >= 34) e_pr_str((f->a.x + 28), f->e.y - by, "Save", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); } else if(b->sw == 3 && NUM_COLS_ON_SCREEN >= 37) e_pr_str((f->a.x + 28), f->e.y - by, "Execute", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); else if(b->sw == 5 && NUM_COLS_ON_SCREEN >= 33) e_pr_str((f->a.x + 28), f->e.y - by, "Add", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); else if(b->sw == 0) { if(NUM_COLS_ON_SCREEN >= 35) e_pr_str((f->a.x + 28), f->e.y - by, "MKdir", f->fb->nz.fb, 1, -1, f->fb->ns.fb, f->fb->nt.fb); if(NUM_COLS_ON_SCREEN >= 49) e_pr_str((f->a.x + 37), f->e.y - by, "Attributes", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); } } if(b->sw == 0 && NUM_LINES_ON_SCREEN > 19) { e_pr_str((f->a.x + 4), f->e.y - 2, "Move", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); if(NUM_COLS_ON_SCREEN >= 21) e_pr_str((f->a.x + 13), f->e.y - 2, "Remove", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); if(NUM_COLS_ON_SCREEN >= 30) e_pr_str((f->a.x + 24), f->e.y - 2, "Link", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); if(NUM_COLS_ON_SCREEN >= 39) e_pr_str((f->a.x + 33), f->e.y - 2, "COpy", f->fb->nz.fb, 1, -1, f->fb->ns.fb, f->fb->nt.fb); if(NUM_COLS_ON_SCREEN >= 48) e_pr_str((f->a.x + 42), f->e.y - 2, "Edit", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); } if(NUM_COLS_ON_SCREEN < 45) bx3 = 0; if(NUM_COLS_ON_SCREEN < 44) bx2 = 0; if(NUM_COLS_ON_SCREEN < 43) bx1 = 0; b->xfd = (NUM_COLS_ON_SCREEN - bx1 - bx2 - bx3 - 6) / 2; b->xdd = NUM_COLS_ON_SCREEN - bx1 - bx2 - bx3 - b->xfd - 6; b->xda = 2 + bx1; b->xfa = 4 + bx1 + bx2 + b->xdd; e_pr_str((f->a.x + b->xfa), f->a.y + 2, "Name:", f->fb->nt.fb, 0, 1, f->fb->nsnt.fb, f->fb->nt.fb); /* e_schr_nchar(b->rdfile, f->a.x+b->xfa, f->a.y+3, 0, b->xfd+1, f->fb->fr.fb); */ e_schr_nchar_wsv(b->rdfile, f->a.x + b->xfa, f->a.y + 3, 0, b->xfd + 1, f->fb->fr.fb, f->fb->fz.fb); e_pr_str((f->a.x + b->xfa), f->a.y + 5, "Files:", f->fb->nt.fb, 0, 1, f->fb->nsnt.fb, f->fb->nt.fb); e_pr_str((f->a.x + b->xda), f->a.y + 2, "Directory:", f->fb->nt.fb, 0, 1, f->fb->nsnt.fb, f->fb->nt.fb); /* e_schr_nchar(f->dirct, f->a.x+b->xda, f->a.y+3, 0, b->xdd+1, f->fb->fr.fb); */ e_schr_nchar_wsv(f->dirct, f->a.x + b->xda, f->a.y + 3, 0, b->xdd + 1, f->fb->fr.fb, f->fb->fz.fb); e_pr_str((f->a.x + b->xda), f->a.y + 5, "DirTree:", f->fb->nt.fb, 3, 1, f->fb->nsnt.fb, f->fb->nt.fb); b->fw->mxa = f->a.x; b->fw->mxe = f->e.x; b->fw->mya = f->a.y; b->fw->mye = f->e.y; b->fw->xa = f->a.x + b->xfa; b->fw->xe = b->fw->xa + b->xfd; b->fw->ya = f->a.y + 6; b->fw->ye = f->e.y - 2 - by; b->dw->mxa = f->a.x; b->dw->mxe = f->e.x; b->dw->mya = f->a.y; b->dw->mye = f->e.y; b->dw->xa = f->a.x + b->xda; b->dw->xe = b->dw->xa + b->xdd; b->dw->ya = f->a.y + 6; b->dw->ye = f->e.y - 2 - by; /* slider bars for file list */ e_mouse_bar(b->fw->xe, b->fw->ya, b->fw->ye - b->fw->ya, 0, b->fw->f->fb->em.fb); e_mouse_bar(b->fw->xa, b->fw->ye, b->fw->xe - b->fw->xa, 1, b->fw->f->fb->em.fb); /* file list window */ e_pr_file_window(b->fw, 0, 1, f->fb->ft.fb, f->fb->fz.fb, f->fb->frft.fb); /* slide bars for directory window */ e_mouse_bar(b->dw->xe, b->dw->ya, b->dw->ye - b->dw->ya, 0, b->dw->f->fb->em.fb); e_mouse_bar(b->dw->xa, b->dw->ye, b->dw->xe - b->dw->xa, 1, b->dw->f->fb->em.fb); /* directory window */ e_pr_file_window(b->dw, 0, 1, f->fb->ft.fb, f->fb->fz.fb, f->fb->frft.fb); return(0); } /* tries to find the required style file manager */ int WpeCallFileManager(int sw, FENSTER * f) { int i, ret; FLBFFR *b; for(i = f->ed->mxedt; i > 0; i--) if(f->ed->f[i]->dtmd == DTMD_FILEMANAGER) /* check only file manager windows */ { b = (FLBFFR *)f->ed->f[i]->b; /* open/new file manager and it is not in save mode */ if(sw == 0 && b->sw == sw && f->ed->f[i]->save != 1) break; /* wastebasket mode required, the window is "open/new" file manager and save mode turned on */ else if(sw == 6 && b->sw == 0 && f->ed->f[i]->save == 1) break; /* not open/new or wastebasket filemanager and it is the required style */ else if(sw != 0 && sw != 6 && b->sw == sw) break; } if(i <= 0) /* we did not find the required style file-manager */ { if(sw == 6) /* wastebasket mode */ { char *tmp; if ((tmp = WpeGetWastefile(""))) { ret = WpeCreateFileManager(sw, f->ed, tmp); FREE(tmp); return(ret); } else { e_error(e_msg[ERR_NOWASTE], 0, f->ed->fb); return 0; /* Error -- no wastebasket */ } } /* create the required style file manager */ return(WpeCreateFileManager(sw, f->ed, "")); } /* switch to the found file manager */ e_switch_window(f->ed->edt[i], f); return(0); } /* It will always create a new file manager */ int WpeManagerFirst(FENSTER * f) { return(WpeCreateFileManager(0, f->ed, "")); } /* try to find an "open/new" style file manager or create one */ int WpeManager(FENSTER * f) { return(WpeCallFileManager(0, f)); } /* try to find an "execute" style file manager or create one */ int WpeExecuteManager(FENSTER * f) { return(WpeCallFileManager(3, f)); } /* try to find a "save as" style file manager or create one */ int WpeSaveAsManager(FENSTER * f) { return(WpeCreateFileManager(4, f->ed, "")); } /* File Manager Handler */ int WpeHandleFileManager(ECNT * cn) { FENSTER *f = cn->f[cn->mxedt], *fe = NULL; FLBFFR *b = (FLBFFR *) f->b; BUFFER *be = NULL; SCHIRM *se = NULL; int c = AltC, i, j, t; int winnum = 0, nco, svmode = -1, fmode, len, start; int g[4], cold = AltN; char filen[128], *ftmp, *dtp = NULL, *ftp = NULL, *svdir = NULL; char *dirtmp = NULL; PIC *outp = NULL; FILE *fp; struct stat buf; char dtmd; /* check whether we really get a file-manager window here */ if(f->dtmd != DTMD_FILEMANAGER) return(0); if(f->save == 1) { svmode = f->ed->flopt; f->ed->flopt = FM_SHOW_HIDDEN_FILES | FM_SHOW_HIDDEN_DIRS | FM_MOVE_OVERWRITE | FM_REKURSIVE_ACTIONS; } /* if it is project management or saving mode save the current directory to return to it */ if(f->save == 1 || b->sw == 5) { if((svdir = MALLOC(strlen(f->ed->dirct) + 1)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); strcpy(svdir, f->ed->dirct); } nco = b->cd->anz - 1; /* when searching among files, search hidden ones as well */ fmode = f->ed->flopt & FM_SHOW_HIDDEN_FILES ? 1 : 0; /* in execution mode show hidden dirs as well */ if(b->sw == 3) fmode |= 2; /* searching for the last edited/touched file on the desktop */ for(i = cn->mxedt; i > 0; i--) { if (DTMD_ISTEXT(cn->f[i]->dtmd)) { fe = cn->f[i]; be = fe->b; se = fe->s; winnum = cn->edt[i]; break; } } strcpy(f->fd.file, b->rdfile); /* go until quit */ while(c != WPE_ESC) { /* draw out dir tree and file list windows */ e_pr_file_window(b->fw, 0, 1, f->fb->ft.fb, f->fb->fz.fb, f->fb->frft.fb); e_pr_file_window(b->dw, 0, 1, f->fb->ft.fb, f->fb->fz.fb, f->fb->frft.fb); switch(c) { /* filename entry box activation */ case AltN: cold = c; fk_cursor(1); /* get some answer from the name entry box, result file copied into b->rdfile, max 79 char + '\0' */ c = e_schr_lst_wsv(b->rdfile, f->a.x + b->xfa, f->a.y + 3, b->xfd + 1, 79, f->fb->fr.fb, f->fb->fz.fb, &f->ed->fdf, f); /* determine the entered filename, going backward */ for(i = strlen(b->rdfile); i >= 0 && b->rdfile[i] != DIRC; i--) ; strcpy(f->fd.file, b->rdfile + 1 + i); /* there is some directory structure in the filename */ if(i >= 0) { if(i == 0) i++; b->rdfile[i] = '\0'; /* change the working directory */ FREE(f->dirct); if((f->dirct = MALLOC(strlen(b->rdfile) + 1)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); strcpy(f->dirct, b->rdfile); /* restore original filename */ strcpy(b->rdfile, f->fd.file); c = AltC; } #if MOUSE /* if mouse was used (the reason it returned) get appropriate key interpretation */ if(c == -1) c = WpeMngMouseInFileManager(f); #endif if((c >= Alt1 && c <= Alt9) || (c >= 1024 && c <= 1049)) { /* window changing, make the entry unhighlighted */ e_schr_nchar_wsv(b->rdfile, f->a.x + b->xfa, f->a.y + 3, 0, b->xfd + 1, f->fb->fr.fb, f->fb->fz.fb); break; } if(c == CLE || c == CCLE) /* goto dir name window */ c = AltD; else if(c == CDO || c == BDO || c == WPE_TAB) /* goto file list window */ c = AltF; else if(c == WPE_BTAB) /* goto dir tree window */ c = AltT; else if( ( c == WPE_CR || (b->sw == 0 && c == AltE) || (b->sw == 1 && c == AltR) || (b->sw == 2 && c == AltW) || (b->sw == 3 && c == AltE) || (b->sw == 5 && c == AltA) || (b->sw == 4 && (c == AltS || c == AltY)) ) && ( strstr(b->rdfile, "*") || strstr(b->rdfile, "?") || strstr(b->rdfile, "[") ) ) { WpeMouseChangeShape(WpeWorkingShape); /* free up existing structures */ freedf(b->df); freedf(b->fw->df); /* find files according to the new pattern */ b->df = e_find_files(b->rdfile, fmode); /* setup the drawing in the dir tree window */ b->fw->df = WpeGraphicalFileList(b->df, f->ed->flopt >> 9, cn); b->fw->ia = b->fw->nf = 0; b->fw->ja = b->fw->srcha; /* jump to file list window */ c = AltF; WpeMouseRestoreShape(); } else { strcpy(filen, b->rdfile); /* !!! alloc for filen ??? */ if(c == WPE_CR) { if(b->sw == 1) c = AltR; else if(b->sw == 2) c = AltW; else if(b->sw == 4) c = AltS; else if(b->sw == 5) c = AltA; else c = AltE; } } /* entry window is left, make the entry unhighlighted */ if(c != AltN) e_schr_nchar_wsv(b->rdfile, f->a.x + b->xfa, f->a.y + 3, 0, b->xfd + 1, f->fb->fr.fb, f->fb->fz.fb); fk_cursor(0); break; /* directory name entry box activation */ case AltD: cold = c; fk_cursor(1); /* get the directory name */ if ((dirtmp = WpeMalloc(WPE_PATHMAX)) == NULL) /* dirct mat not have enough memory */ e_error(e_msg[ERR_LOWMEM], 1, cn->fb); if (strlen(f->dirct) >= WPE_PATHMAX) { strncpy(dirtmp, f->dirct, WPE_PATHMAX - 1); dirtmp[WPE_PATHMAX - 1] = '\0'; } else strcpy(dirtmp, f->dirct); c = e_schr_lst_wsv(dirtmp, f->a.x + b->xda, f->a.y + 3, b->xdd + 1, WPE_PATHMAX, f->fb->fr.fb, f->fb->fz.fb, &f->ed->ddf, f); FREE(f->dirct); f->dirct = WpeStrdup(dirtmp); WpeFree(dirtmp); #if MOUSE if(c == -1) c = WpeMngMouseInFileManager(f); #endif if(c == CRI || c == CCRI) /* goto name entry windwow */ c = AltN; else if(c == CDO || c == BDO || c == WPE_TAB) /* goto dir tree window */ c = AltT; else if(c == WPE_BTAB) /* goto file list window */ c = AltF; else if(c == WPE_CR) /* change dir */ c = AltC; /* window left, make the entry unhighlighted */ if(c != AltD) e_schr_nchar_wsv(f->dirct, f->a.x + b->xda, f->a.y + 3, 0, b->xdd + 1, f->fb->fr.fb, f->fb->fz.fb); fk_cursor(0); break; /* directory tree list window activation */ case AltT: cold = c; c = e_file_window(1, b->dw, f->fb->ft.fb, f->fb->fz.fb); #if MOUSE if(c == MBKEY) /* handle mouse actions in the window */ c = WpeMngMouseInFileManager(f); else if(c < 0) c = WpeMouseInFileDirList(c, 1, f); #endif if(c == CCRI) c = AltF; else if(c == BUP) c = AltD; else if(c == WPE_TAB) c = AltN; else if(c == WPE_BTAB) c = AltD; else if(c == AltC || (c == WPE_CR && b->dw->nf != nco)) { if ((dirtmp = WpeAssemblePath(f->dirct, b->cd, b->dd, b->dw->nf, f))) { FREE(f->dirct); f->dirct = dirtmp; e_schr_nchar_wsv(f->dirct, f->a.x + b->xda, f->a.y + 3, 0, b->xdd + 1, f->fb->fr.fb, f->fb->fz.fb); f->ed->ddf = e_add_df(f->dirct, f->ed->ddf); c = AltC; } /* there is only one case when it cannot assemble the path, that it cannot access wastebasket, then quit the file manager */ else c = WPE_ESC; } else if(c == WPE_CR) c = AltT; break; /* file list window activation */ case AltF: if(b->df->anz < 1) { c = cold; break; } cold = c; c = e_file_window(1, b->fw, f->fb->ft.fb, f->fb->fz.fb); #if MOUSE if(c == MBKEY) c = WpeMngMouseInFileManager(f); else if(c < 0) c = WpeMouseInFileDirList(c, 0, f); #endif if(c == BUP) /* goto file name entry window */ c = AltN; else if(c == CCLE) /* goto dir tree window */ c = AltT; else if(c == WPE_TAB) /* goto dir entry window */ c = AltD; else if(c == WPE_BTAB) /* goto file name entry window */ c = AltN; else if(c == WPE_CR) /* action selected */ { if(b->sw == 1) c = AltR; else if(b->sw == 2) c = AltW; else if(b->sw == 4) c = AltS; else if(b->sw == 5) c = AltA; else c = AltE; } if( (b->sw == 1 && c == AltR) /* in case of action store the filename */ || (b->sw == 2 && c == AltW) || (b->sw == 3 && c == AltE) || (b->sw == 0 && c == AltE) || (b->sw == 4 && (c == AltS || c == AltY)) ) { strcpy(filen, *(b->df->name + b->fw->nf)); /* !!! alloc for filen ??? */ } break; /* change dir button activation */ case AltC: c = cold; /* if the current dir is equal to the "newly" entered dir, break */ if(!strcmp(f->ed->dirct, f->dirct)) break; /* in wastebasket mode, we do not allow to go out of it through a soft link */ if((b->sw == 0) && (f->save == 1)) { if(lstat(f->dirct, &buf)) { e_error(e_msg[ERR_ACCFILE], 0, f->ed->fb); break; } if(S_ISLNK(buf.st_mode)) { /* cannot go out through a softlink, restore dir name */ if((f->dirct = REALLOC(f->dirct, strlen(f->ed->dirct) + 1)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); else strcpy(f->dirct, f->ed->dirct); break; } } /* change to the desired dir with system error checking */ if(chdir(f->dirct)) { e_error(e_msg[ERR_WORKDIRACCESS], 0, f->fb); /* we cannot determine where we are, try the home */ if((dirtmp = getenv("HOME")) == NULL) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); if(chdir(dirtmp)) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); } /* get current directory */ dirtmp = WpeGetCurrentDir(f->ed); /* change the shape of the mouse */ WpeMouseChangeShape(WpeWorkingShape); FREE(f->dirct); f->dirct = dirtmp; /* free up all relevant structures */ freedf(b->df); freedf(b->fw->df); freedf(b->cd); freedf(b->dw->df); freedf(b->dd); /* reset the current dir path in the control structure */ if((f->ed->dirct = REALLOC(f->ed->dirct, strlen(f->dirct) + 1)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); else strcpy(f->ed->dirct, f->dirct); /* setup current directory structure */ b->cd = WpeCreateWorkingDirTree(f->save, cn); /* find all other directories in the current dir */ b->dd = e_find_dir(SUDIR, f->ed->flopt & FM_SHOW_HIDDEN_DIRS ? 1 : 0); /* setup the drawing in the dir tree window */ b->dw->df = WpeGraphicalDirTree(b->cd, b->dd, cn); nco = b->dw->nf = b->cd->anz - 1; b->dw->ia = b->dw->ja = 0; /* finds all files matching the pattern */ b->df = e_find_files(b->rdfile, fmode); /* setup the drawing in the file list window */ b->fw->df = WpeGraphicalFileList(b->df, f->ed->flopt >> 9, cn); b->fw->nf = b->fw->ia = 0; b->fw->ja = 12; /* change the shape of the mouse back */ WpeMouseRestoreShape(); break; /* link file activation */ case AltL: /* copy file activation */ case AltO: /* move file activation */ case AltM: /* moving/copying a file is valid only in mode 0 (open/new file) */ if(b->sw != 0) { c = cold; break; } j = c; /* we are coming from files */ if(cold == AltF) { if((ftmp = MALLOC(129)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); if(strlen(*(b->df->name + b->fw->nf)) > 128) { strncpy(ftmp, *(b->df->name + b->fw->nf), 128); ftmp[128] = '\0'; } else strcpy(ftmp, *(b->df->name + b->fw->nf)); /* make the file name editable */ c = e_schreib_leiste(ftmp, b->fw->xa, b->fw->ya + b->fw->nf - b->fw->ia, b->fw->xe - b->fw->xa, 128, f->fb->fr.fb, f->fb->fz.fb); if(c == WPE_CR) { if(j == AltM) e_rename(*(b->df->name + b->fw->nf), ftmp, f); /* move */ else if(j == AltL) WpeLinkFile(*(b->df->name + b->fw->nf), ftmp, /* link */ f->ed->flopt & FM_TRY_HARDLINK, f); else if(j == AltO) e_copy(*(b->df->name + b->fw->nf), ftmp, f); /* copy */ /* after copying/moving/linking, free up the old structures */ freedf(b->df); freedf(b->fw->df); /* generate the new file list */ b->df = e_find_files(b->rdfile, fmode); /* setup the drawing of it */ b->fw->df = WpeGraphicalFileList(b->df, f->ed->flopt >> 9, cn); b->fw->ia = b->fw->nf = 0; b->fw->ja = b->fw->srcha; } FREE(ftmp); } /* we are coming from dirs */ else if(cold == AltT && b->dw->nf >= b->cd->anz) { if((ftmp = MALLOC(129)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); /* selected dir */ t = b->dw->nf - b->cd->anz; if(strlen(*(b->dd->name + t)) > 128) { strncpy(ftmp, *(b->dd->name + t), 128); ftmp[128] = '\0'; } else strcpy(ftmp, *(b->dd->name + t)); /* separate the dir name from other drawings in the line */ for(i = 0; *(b->dw->df->name[b->dw->nf] + i) && (*(b->dw->df->name[b->dw->nf] + i) <= 32 || *(b->dw->df->name[b->dw->nf] + i) >= 127); i++) ; if(!WpeIsXwin()) i += 3; b->dw->ja = i; e_pr_file_window(b->dw, 0, 1, f->fb->ft.fb, f->fb->fz.fb, f->fb->frft.fb); /* make the name editable */ c = e_schreib_leiste(ftmp, b->dw->xa, b->dw->ya + b->dw->nf - b->dw->ia, b->dw->xe - b->dw->xa, 128, f->fb->fr.fb, f->fb->fz.fb); if(c == WPE_CR) { if(j == AltM) e_rename(*(b->dd->name + t), ftmp, f); /* move */ else if(j == AltL) e_link(*(b->dd->name + t), ftmp, f); /* link */ else if(j == AltO) e_copy(*(b->dd->name + t), ftmp, f); /* copy */ /* free up structures */ freedf(b->cd); freedf(b->dw->df); freedf(b->dd); /* determine current directory */ b->cd = WpeCreateWorkingDirTree(f->save, cn); /* find all other directories in the current */ b->dd = e_find_dir(SUDIR, f->ed->flopt & FM_SHOW_HIDDEN_DIRS ? 1 : 0); /* setup drawing */ b->dw->df = WpeGraphicalDirTree(b->cd, b->dd, cn); nco = b->dw->nf = b->cd->anz - 1; b->dw->ia = b->dw->ja = 0; } FREE(ftmp); } c = cold; cold = AltN; /* go back to name entry */ break; /* remove button activation */ case ENTF: if(b->sw != 0) { c = cold; break; } /* remove button activation */ case AltR: if(b->sw == 0) { /* coming from file list */ if(cold == AltF) { WpeRemove(*(b->df->name + b->fw->nf), f); /* remove the file */ /* free up structures */ freedf(b->df); freedf(b->fw->df); /* find files according to the pattern */ b->df = e_find_files(b->rdfile, fmode); /* setup drawing */ b->fw->df = WpeGraphicalFileList(b->df, f->ed->flopt >> 9, cn); b->fw->ia = b->fw->nf = 0; b->fw->ja = b->fw->srcha; } /* coming from the dir tree list and the selected dir is a subdir of the current directory */ else if(cold == AltT && b->dw->nf >= b->cd->anz) { t = b->dw->nf - b->cd->anz; WpeRemove(*(b->dd->name + t), f); /* remove the dir */ /* free up structures */ freedf(b->cd); freedf(b->dw->df); freedf(b->dd); /* determine current directory */ b->cd = WpeCreateWorkingDirTree(f->save, cn); /* find all other directories in the current */ b->dd = e_find_dir(SUDIR, f->ed->flopt & FM_SHOW_HIDDEN_DIRS ? 1 : 0); /* setup drawing */ b->dw->df = WpeGraphicalDirTree(b->cd, b->dd, cn); nco = b->dw->nf = b->cd->anz - 1; b->dw->ia = b->dw->ja = 0; } c = cold; cold = AltN; /* go back to name entry */ break; } /* edit/execute button activation */ case AltE: if( (c == AltE && b->sw != 0 && b->sw != 3) || (c == AltR && b->sw != 1) ) { c = cold; break; } if(b->sw == 3) /* file-manager in execution mode */ { if(cold == AltF) strcpy(filen, *(b->df->name + b->fw->nf)); /* !!! alloc filen ??? */ if(!WpeIsXwin()) { outp = e_open_view(0, 0, MAXSCOL - 1, MAXSLNS - 1, f->fb->ws, 1); fk_locate(0, 0); fk_cursor(1); #if MOUSE g[0] = 2; fk_mouse(g); #endif e_sys_ini(); printf(e_msg[ERR_EXEC], filen); fflush(stdout); } if ((*e_u_system)(filen)) { if(!WpeIsXwin()) e_sys_end(); e_error(e_msg[ERR_COMMAND], 0, f->fb); } else if(!WpeIsXwin()) { printf(e_msg[ERR_HITCR]); fflush(stderr); fflush(stdout); fk_getch(); } if(!WpeIsXwin()) { e_sys_end(); e_close_view(outp, 1); fk_cursor(0); #if MOUSE g[0] = 1; fk_mouse(g); #endif } c = cold; break; } else { /* if there is only a pattern get back to file selection */ if(strstr(filen, "*") || strstr(filen, "?")) { c = AltF; break; } /* there is no open ??? file */ if(b->sw == 0 || !fe) { /* close on open request */ if(f->ed->flopt & FM_CLOSE_WINDOW) { e_close_window(f); } /* editing the file */ e_edit(cn, filen); } else { /* try to open the file, no success return */ if((fp = fopen(filen, "rb")) == NULL) { e_error(e_msg[ERR_ACCFILE], 0, f->fb); c = cold; break; } if(access(filen, 2) != 0) f->ins = 8; e_close_window(f); e_switch_window(winnum, fe); fe = cn->f[cn->mxedt]; be = fe->b; se = fe->s; f = cn->f[cn->mxedt]; if(be->b.x != 0) { e_new_line(be->b.y + 1, be); if(*(be->bf[be->b.y].s + be->bf[be->b.y].len) != '\0') (be->bf[be->b.y].len)++; for(i = be->b.x; i <= be->bf[be->b.y].len; i++) *(be->bf[be->b.y + 1].s + i - be->b.x) = *(be->bf[be->b.y].s + i); *(be->bf[be->b.y].s + be->b.x) = '\0'; be->bf[be->b.y].len = be->b.x; be->bf[be->b.y + 1].len = e_str_len(be->bf[be->b.y + 1].s); be->bf[be->b.y + 1].nrc = e_str_nrc(be->bf[be->b.y + 1].s); } se->mark_begin.x = be->b.x; start = se->mark_begin.y = be->b.y; dtmd = fe->dtmd; se->mark_end = e_readin(be->b.x, be->b.y, fp, be, &dtmd); fclose(fp); if(se->mark_begin.x > 0) start++; len = se->mark_end.y - start; e_brk_recalc(f, start, len); e_schirm(fe, 1); } /* if there was no error */ dirtmp = WpeGetCurrentDir(cn); FREE(cn->dirct); cn->dirct = dirtmp; if (svmode >= 0) cn->flopt = svmode; if (svdir != NULL) { /* go back to the saved directory */ if (chdir(svdir)) { e_error(e_msg[ERR_WORKDIRACCESS], 0, cn->fb); /* we cannot determine where we are, try the home */ if((dirtmp = getenv("HOME")) == NULL) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); if(chdir(dirtmp)) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); } /* determine current dir */ dirtmp = WpeGetCurrentDir(cn); FREE(cn->dirct); cn->dirct = dirtmp; FREE(svdir); svdir = NULL; } return(0); } case AltW: /* write activation */ case AltS: /* save activation */ if( (c == AltW && b->sw != 2) || (c == AltS && b->sw != 4) || !fe || fe->ins == 8 ) { c = cold; break; } /* only file pattern, return */ if(strstr(filen, "*") || strstr(filen, "?")) { c = AltF; break; } /* check whether the file exist */ if(!access(filen, F_OK)) { if((ftmp = MALLOC(strlen(filen) + 42)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); sprintf(ftmp, "File %s exist\nDo you want to overwrite it ?", filen); i = e_message(1, ftmp, f); FREE(ftmp); if(i == WPE_ESC) { c = WPE_ESC; break; } else if(i == 'N') { c = AltF; break; } } if(b->sw != 4) { dtp = fe->dirct; ftp = fe->datnam; } else /* save as mode, current dir and window header will/may change */ { FREE(fe->dirct); FREE(fe->datnam); } WpeFilenameToPathFile(filen, &fe->dirct, &fe->datnam); if(b->sw == 4) /* save as mode */ e_save(fe); else { e_write(se->mark_begin.x, se->mark_begin.y, se->mark_end.x, se->mark_end.y, fe, WPE_BACKUP); FREE(fe->dirct); /* restore current dir window header */ FREE(fe->datnam); fe->dirct = dtp; fe->datnam = ftp; } if(b->sw == 4 && (f->ed->edopt & ED_SYNTAX_HIGHLIGHT)) { if(fe->c_sw) FREE(fe->c_sw); if(WpeIsProg()) e_add_synt_tl(fe->datnam, fe); if(fe->c_st) { if(fe->c_sw) FREE(fe->c_sw); fe->c_sw = e_sc_txt(NULL, fe->b); } e_rep_win_tree(f->ed); } if(svmode >= 0) f->ed->flopt = svmode; if(svdir != NULL) { /* go back to the saved directory */ if(chdir(svdir)) { e_error(e_msg[ERR_WORKDIRACCESS], 0, cn->fb); /* we cannot determine where we are, try the home */ if((dirtmp = getenv("HOME")) == NULL) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); if(chdir(dirtmp)) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); } /* determine current dir */ dirtmp = WpeGetCurrentDir(cn); FREE(cn->dirct); cn->dirct = dirtmp; FREE(svdir); svdir = NULL; } e_close_window(f); return(0); /* make dir button activation */ case EINFG: case AltK: if(b->sw != 0) { c = cold; break; } /* create new directory */ if(WpeMakeNewDir(f) != 0) { c = cold; break; } /* free up old structures */ freedf(b->dd); freedf(b->dw->df); /* create new directory structure */ b->dd = e_find_dir(SUDIR, f->ed->flopt & FM_SHOW_HIDDEN_DIRS ? 1 : 0); b->dw->df = WpeGraphicalDirTree(b->cd, b->dd, cn); /* go to the line where the new dir is */ for(i = 0; i < b->dd->anz && strcmp(b->dd->name[i], "new.dir"); i++) ; /* set the slidebar variables */ if((b->dw->nf = b->cd->anz + i) >= b->dw->df->anz) b->dw->nf = b->cd->anz - 1; if(b->dw->nf - b->dw->ia >= b->dw->ye - b->dw->ya) b->dw->ia = b->dw->nf + b->dw->ya - b->dw->ye + 1; else if(b->dw->nf - b->dw->ia < 0) b->dw->ia = b->dw->nf; cold = AltT; /* let the user modify the newly created dir */ c = AltM; break; /* attribute/add file button activation */ case AltA: /* not valid mode */ if(b->sw != 0 && b->sw != 5) { c = cold; break; } /* attribute button */ if(b->sw == 0) { if(cold == AltF) /* coming from file list */ { strcpy(filen, *(b->df->name + b->fw->nf)); /* alloc for filen ??? */ /* change the file attributes */ WpeFileDirAttributes(filen, f); /* free up old file list structures */ freedf(b->df); freedf(b->fw->df); /* create new file list */ b->df = e_find_files(b->rdfile, fmode); /* setup drawing */ b->fw->df = WpeGraphicalFileList(b->df, f->ed->flopt >> 9, cn); } else if(cold == AltT && b->dw->nf >= b->cd->anz) /* coming from dir tree */ { t = b->dw->nf - b->cd->anz; if((ftmp = MALLOC(strlen(*(b->dd->name + t)) + 1)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); strcpy(ftmp, *(b->dd->name + t)); /* change the dir attributes */ WpeFileDirAttributes(ftmp, f); FREE(ftmp); /* free up old file list structures */ freedf(b->dd); freedf(b->dw->df); /* create new dir list */ b->dd = e_find_dir(SUDIR, f->ed->flopt & FM_SHOW_HIDDEN_DIRS ? 1 : 0); /* setup drawing */ b->dw->df = WpeGraphicalDirTree(b->cd, b->dd, cn); } c = cold; } else if(b->sw == 5) /* it is in project management */ { FLWND *fw = (FLWND *)cn->f[cn->mxedt - 1]->b; if (cold != AltN) strcpy(filen, *(b->df->name + b->fw->nf)); dirtmp = cn->f[cn->mxedt - 1]->dirct; ftmp = MALLOC(strlen(f->dirct) + strlen(filen) + 2); len = strlen(dirtmp); if (strncmp(dirtmp, f->dirct, len) == 0) { /* Make path relative to project directory */ sprintf(ftmp, "%s%s", f->dirct + len, filen); } else { /* Full path */ sprintf(ftmp, "%s%s", f->dirct, filen); } fw->df->anz++; fw->df->name = REALLOC(fw->df->name, fw->df->anz * sizeof(char *)); for(i = fw->df->anz - 1; i > fw->nf; i--) fw->df->name[i] = fw->df->name[i - 1]; fw->df->name[i] = ftmp; /* Don't bother notifying the user for each file added to project sprintf(ftmp, "File added to Project:\n%s", fw->df->name[i]); e_message(0, ftmp, f); */ fw->nf++; if(fw->nf - fw->ia >= fw->ye - fw->ya) fw->ia = fw->nf + fw->ya - fw->ye + 1; c = AltN; } break; /* like save */ case F2: c = AltS; break; /* leave file manager */ case AltBl: c = WPE_ESC; default: /* not project management */ if(b->sw != 5) { if(svmode >= 0) { /* restore options */ f->ed->flopt = svmode; } if(svdir != NULL) { /* go back to the saved directory */ if(chdir(svdir)) { e_error(e_msg[ERR_WORKDIRACCESS], 0, cn->fb); /* we cannot determine where we are, try the home */ if((dirtmp = getenv("HOME")) == NULL) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); if(chdir(dirtmp)) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); } /* determine current dir */ dirtmp = WpeGetCurrentDir(f->ed); FREE(f->ed->dirct); f->ed->dirct = dirtmp; } /* the key dispatcher returns zero when something has happened and this means that the file-manager lost focus, just return */ #ifdef PROG if(!e_tst_dfkt(f, c) || (WpeIsProg() && !e_prog_switch(f, c))) #else if(!e_tst_dfkt(f, c)) #endif { if(svdir != NULL) { FREE(svdir); svdir = NULL; } return(0); } /* file manager is still active */ if(svmode >= 0) f->ed->flopt = FM_SHOW_HIDDEN_FILES | FM_SHOW_HIDDEN_DIRS | FM_MOVE_OVERWRITE | FM_REKURSIVE_ACTIONS; } else if( c == WPE_ESC || (!(f->ed->edopt & ED_CUA_STYLE) && c == AF3) || (f->ed->edopt & ED_CUA_STYLE && c == CF4)) { if(svdir != NULL) { /* go back to the saved directory */ if(chdir(svdir)) { e_error(e_msg[ERR_WORKDIRACCESS], 0, cn->fb); /* we cannot determine where we are, try the home */ if((dirtmp = getenv("HOME")) == NULL) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); if(chdir(dirtmp)) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); } /* determine current dir */ dirtmp = WpeGetCurrentDir(cn); FREE(cn->dirct); cn->dirct = dirtmp; FREE(svdir); svdir = NULL; } /* close file manager */ e_close_window(f); /* restore options */ if(svmode >= 0) cn->flopt = svmode; return(WPE_ESC); } c = cold; break; } } /* change to saved directory and lets hope it works */ if(svdir != NULL) { /* go back to the saved directory */ if(chdir(svdir)) { e_error(e_msg[ERR_WORKDIRACCESS], 0, cn->fb); /* we cannot determine where we are, try the home */ if((dirtmp = getenv("HOME")) == NULL) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); if(chdir(dirtmp)) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); } /* determine current dir */ dirtmp = WpeGetCurrentDir(cn); FREE(cn->dirct); cn->dirct = dirtmp; FREE(svdir); svdir = NULL; } /* restore options */ if(svmode >= 0) cn->flopt = svmode; /* if in save mode or project management */ if(f->save == 1 || b->sw == 5) { e_close_window(f); return(WPE_ESC); } else { e_close_window(f); return(0); } } int WpeGrepFile(char *file, char *string, int sw) { FILE *fp; char str[256]; int ret, nn; if((fp = fopen(file, "r")) == NULL) return(0); nn = strlen(string); while(fgets(str, 256, fp)) { if((sw & 32) == 0) { if((sw & 128) != 0) ret = e_strstr(0, strlen(str), str, string); else ret = e_ustrstr(0, strlen(str), str, string); } else { if((sw & 128) != 0) ret = e_rstrstr(0, strlen(str), str, string, &nn); else ret = e_urstrstr(0, strlen(str), str, string, &nn); } if( ret >= 0 && ( !(sw & 64) || ( isalnum(str[ret + nn]) == 0 && (ret == 0 || isalnum(str[ret - 1]) == 0)))) { fclose(fp); return(1); } } fclose(fp); return(0); } int WpeMakeNewDir(FENSTER *f) { char *dirct; int msk, mode, ret; struct stat buf; umask(msk = umask(077)); mode = 0777 & ~msk; if((dirct = MALLOC(strlen(f->dirct) + 9)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); if(f->dirct[strlen(f->dirct) - 1] != DIRC) sprintf(dirct, "%s/new.dir", f->dirct); else sprintf(dirct, "%snew.dir", f->dirct); /* check existence and status (whether it is directory) */ if(stat(dirct, &buf)) { if((ret = mkdir(dirct, mode)) != 0) e_error(e_msg[ERR_NONEWDIR], 0, f->ed->fb); } else { /* check whether the existing file is a directory */ if(!(buf.st_mode & S_IFDIR)) { e_error(e_msg[ERR_NEWDIREXIST], 0, f->ed->fb); ret = 1; } else ret = 0; } FREE(dirct); return(ret); } int WpeFileDirAttributes(char *filen, FENSTER * f) { struct stat buf[1]; int mode, ret; W_OPTSTR *o = e_init_opt_kst(f); /* if cannot access or error */ if(stat(filen, buf)) { e_error(e_msg[ERR_ACCFILE], 0, f->ed->fb); return 1; } mode = buf->st_mode; if(o == NULL) return(1); o->xa = 14; o->ya = 4; o->xe = 62; o->ye = 13; o->bgsw = AltO; o->name = "Attributes"; o->crsw = AltO; e_add_txtstr(3, 2, "User:", o); e_add_txtstr(33, 2, "Other:", o); e_add_txtstr(18, 2, "Group:", o); e_add_sswstr(4, 3, 0, AltR, mode & 256 ? 1 : 0, "Read ", o); e_add_sswstr(4, 4, 0, AltW, mode & 128 ? 1 : 0, "Write ", o); e_add_sswstr(4, 5, 1, AltX, mode & 64 ? 1 : 0, "EXecute", o); e_add_sswstr(19, 3, 2, AltA, mode & 32 ? 1 : 0, "ReAd ", o); e_add_sswstr(19, 4, 2, AltI, mode & 16 ? 1 : 0, "WrIte ", o); e_add_sswstr(19, 5, 0, AltE, mode & 8 ? 1 : 0, "Execute", o); e_add_sswstr(34, 3, 3, AltD, mode & 4 ? 1 : 0, "ReaD ", o); e_add_sswstr(34, 4, 3, AltT, mode & 2 ? 1 : 0, "WriTe ", o); e_add_sswstr(34, 5, 4, AltU, mode & 1, "ExecUte", o); e_add_bttstr(12, 7, 1, AltO, " Ok ", NULL, o); e_add_bttstr(29, 7, -1, WPE_ESC, "Cancel", NULL, o); ret = e_opt_kst(o); if(ret != WPE_ESC) { mode = (o->sstr[0]->num << 8) + (o->sstr[1]->num << 7) + (o->sstr[2]->num << 6) + (o->sstr[3]->num << 5) + (o->sstr[4]->num << 4) + (o->sstr[5]->num << 3) + (o->sstr[6]->num << 2) + (o->sstr[7]->num << 1) + o->sstr[8]->num; if(chmod(filen, mode)) { e_error(e_msg[ERR_CHGPERM], 0, f->ed->fb); freeostr(o); return(1); } } freeostr(o); return(0); } /* determines the current working directory, it returns the string in case of an error - if the directory cannot be accessed try to access HOME, if it is impossible, give it up and exit with "system error" - otherwise exit with "system error" */ char *WpeGetCurrentDir(ECNT *cn) { int allocate_size; char *current_dir = NULL, *check_dir, *dirtmp; short home; home = 0; allocate_size = 256; if ((current_dir = (char *)WpeMalloc(allocate_size + 1)) == NULL) { e_error(e_msg[ERR_LOWMEM], 1, cn->fb); return NULL; } do { /* allocate space for the directory name */ if ((current_dir = (char *)WpeRealloc(current_dir, allocate_size + 1)) == NULL) { e_error(e_msg[ERR_LOWMEM], 1, cn->fb); return NULL; } check_dir = getcwd(current_dir, allocate_size); if(check_dir == NULL) { switch(errno) { case EACCES: /* directory cannot be read */ if (home == 0) { e_error(e_msg[ERR_WORKDIRACCESS], 0, cn->fb); /* we cannot determine where we are, try the home */ if ((dirtmp = getenv("HOME")) == NULL) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); if (chdir(dirtmp)) e_error(e_msg[ERR_HOMEDIRACCESS], 1, cn->fb); home = 1; } else e_error(e_msg[ERR_SYSTEM], 1, cn->fb); /* will not return */ break; case EINVAL: /* size is equal to 0 */ allocate_size = 256; /* impossible !!! */ break; case ERANGE: /* not enough space for the pathname */ allocate_size <<= 1; break; default: /* System error */ e_error(e_msg[ERR_SYSTEM], 1, cn->fb); /* will not return */ break; } } } while (check_dir == NULL); if (current_dir[strlen(current_dir) - 1] != DIRC) strcat(current_dir, DIRS); return(current_dir); } /* It always returns the assembled file path, except when it is in wastebasket mode and there is an error, return NULL */ char *WpeAssemblePath(char *pth, struct dirfile *cd, struct dirfile *dd, int n, FENSTER *f) { int i = 0, k = 0, j = 0, t; char *adir= NULL; /* assembled directory */ int totall = 0; #ifdef UNIX if (!strcmp(cd->name[0], "Wastebasket")) { if ((adir = WpeGetWastefile(""))) { totall = strlen(adir) + 16; if ((adir = REALLOC(adir, totall)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); strcat(adir, DIRS); i = strlen(adir); k++; } else { /* Error failed to find wastebasket */ e_error(e_msg[ERR_NOWASTE], 0, f->ed->fb); return NULL; } } #endif for(; k <= n && k < cd->anz; i++, j++) { if(i >= totall-1) { totall += 16; if((adir = REALLOC(adir, totall)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); } *(adir + i) = *(*(cd->name + k) + j); if(*(adir + i) == '\0' || *(adir + i) == DIRC) { *(adir + i) = DIRC; k++; j = -1; } } if(n >= k) { t = n - cd->anz; j = 0; do { if(i >= totall-2) { totall += 16; if((adir = REALLOC(adir, totall)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); } *(adir + i) = *(*(dd->name + t) + j); i++; j++; } while(*(adir + i - 1) != '\0'); /* for(j = 0; (*(pth + i) = *(*(dd->name + t) + j)) != '\0'; i++, j++) ; */ } if(n == 0 || n >= k) i++; *(adir + i - 1) = '\0'; return(adir); } /* create tree structure up to working directory */ struct dirfile *WpeCreateWorkingDirTree(int sw, ECNT *cn) { struct dirfile *df; char *buf; char *tmp, *tmp2; char **dftmp; int buflen = 256; int maxd = 10; /* inital number of directory levels */ int i, j, k; buf = WpeGetCurrentDir(cn); buflen = strlen(buf); if((tmp = MALLOC(buflen+1)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); /* initialise directory list */ if( ((df = MALLOC(sizeof(struct dirfile))) == NULL) || ((df->name = MALLOC(sizeof(char *) * maxd)) == NULL) ) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); df->anz = 0; if(sw == 1) /* file-manager open to wastebasket */ { /* instead of saving the real wastebasket dir into the structure the "Wastebasket" name will appear */ if((tmp2 = WpeGetWastefile("")) == NULL) { e_error(e_msg[ERR_NOWASTE], 0, cn->fb); /* more error check ??? */ i = 0; } else { i = strlen(tmp2); /* increase the level in the dir tree */ df->anz = 1; /* save the name into first level */ if((*(df->name) = MALLOC(12 * sizeof(char))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); strcpy(*(df->name), "Wastebasket"); if(!strncmp(tmp2, buf, i) && buf[i]) { FREE(tmp2); i++; } else { FREE(tmp2); FREE(buf); FREE(tmp); return(df); } } } else { i = 0; } for(j = 0; i <= buflen; i++, j++) { tmp[j] = buf[i]; /* if directory separator or end of string */ if(tmp[j] == DIRC || tmp[j] == '\0') { if(buf[i] == '\0' && j == 0) return(df); if(df->anz == 0) /* for the very first time save the '/' sign */ j++; tmp[j] = '\0'; /* if we need more space for the directories */ if(df->anz >= maxd) { maxd += 10; dftmp = df->name; if((df->name = MALLOC(sizeof(char *) * maxd)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); for(k = 0; k < maxd - 10; k++) *(df->name + k) = *(dftmp + k); FREE(dftmp); } /* save the current directory */ if((*(df->name + df->anz) = MALLOC((strlen(tmp) + 1) * sizeof(char))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); strcpy(*(df->name + df->anz), tmp); df->anz++; j = -1; } } FREE(buf); FREE(tmp); return(df); } /* This function creates a wastebasket directory if needed, then returns a string made up of the last filename in the string pointed to by 'file' and the wastebasket path. It returns NULL if there is a memory allocation error or the pointer to 'path' otherwise. The original function did no error checking on wastebasket path creation. The modified version does -- it also returns NULL on an error in the chdir function or mkdir function. */ char *WpeGetWastefile(char *file) { static char *wastebasket = NULL; int i, lw; char *tmp; /* storage for wastebasket path */ char *tmp2; if(!wastebasket) /* setup and test access to wastebasket directory */ { if((tmp2 = getenv("HOME")) == NULL) return NULL; lw = strlen(tmp2) + 1 + strlen(WASTEBASKET) + 1; /* HOME / WASTEBASKET \0 */ if((tmp = (char *)MALLOC(lw)) == NULL) return NULL; sprintf(tmp, "%s/%s", tmp2, WASTEBASKET); /* if wastebasket dir does not exist, create it with error checking */ if(access(tmp, F_OK)) { if(mkdir(tmp, 0700)) { FREE(tmp); return NULL; } } /* check for wastebasket's permissions */ if(access(tmp, R_OK | W_OK | X_OK)) { FREE(tmp); return NULL; } wastebasket = tmp; } /* verify that wastebasket directory still exists before proceeding */ if(access(wastebasket, F_OK | R_OK | W_OK | X_OK)) { /* try to recreate it */ if(mkdir(wastebasket, 0700)) return NULL; } /* return wastebasket directory path if no filename in 'file' */ if(file[0] == '\0') { if((tmp2 = MALLOC(strlen(wastebasket)+1)) == NULL) return NULL; strcpy(tmp2, wastebasket); return(tmp2); } /* else get filename from end of 'file' string, append to wastebasket sting */ for(i = strlen(file) - 1; i >= 0 && file[i] != DIRC; i--) ; if((tmp2 = MALLOC(strlen(wastebasket) + strlen(file + 1 + i) + 2)) == NULL) return NULL; sprintf(tmp2, "%s/%s", wastebasket, file + 1 + i); return(tmp2); } struct dirfile *WpeGraphicalFileList(struct dirfile *df, int sw, ECNT *cn) { struct dirfile *edf; char **name, **ename, *stmp, str[256]; int ntmp, n, i, *num; /* allocate the same structure as the argument */ if ((edf = MALLOC(sizeof(struct dirfile))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); edf->anz = df->anz; edf->name = NULL; /* OSF and AIX fix, for malloc(0) they return NULL */ if (df->anz) { if ((edf->name = MALLOC(df->anz * sizeof(char *))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); if ((num = MALLOC(df->anz * sizeof(int))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); for (i = 0; i < df->anz; i++) { e_file_info(*(df->name + i), str, num + i, sw); if ((*(edf->name + i) = MALLOC(strlen(str) + 1)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); strcpy(*(edf->name + i), str); } /* sort by time or size mode */ if (sw & 3) { if ((ename = MALLOC(df->anz * sizeof(char *))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); if ((name = MALLOC(df->anz * sizeof(char *))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); for (i = 0; i < df->anz; i++) { for (ntmp = num[i], n = i; n > 0 && ntmp > num[n - 1]; n--) { *(ename + n) = *(ename + n - 1); *(name + n) = *(name + n - 1); num[n] = num[n - 1]; } *(ename + n) = *(edf->name + i); *(name + n) = *(df->name + i); num[n] = ntmp; } FREE(edf->name); FREE(df->name); edf->name = ename; df->name = name; } FREE(num); /* reverse order */ if (sw & 4) { for (i = 0; i < (df->anz) / 2; i++) { stmp = edf->name[i]; edf->name[i] = edf->name[edf->anz - i - 1]; edf->name[edf->anz - i - 1] = stmp; stmp = df->name[i]; df->name[i] = df->name[df->anz - i - 1]; df->name[df->anz - i - 1] = stmp; } } } return(edf); } struct dirfile *WpeGraphicalDirTree(struct dirfile *cd, struct dirfile *dd, ECNT *cn) { extern char *ctree[5]; struct dirfile *edf; char str[256]; int i = 0, j; if((edf = MALLOC(sizeof(struct dirfile))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); /* for the OSF and AIX this should never be zero, we are always somewhere */ if(cd->anz + dd->anz > 0) { if((edf->name = MALLOC((cd->anz + dd->anz) * sizeof(char *))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); for(i = 0; i < cd->anz; i++) { if(!i) #ifndef DJGPP { if(*cd->name[0] == DIRC && *(cd->name[0] + 1) == '\0') strcpy(str, "Root"); else strcpy(str, *(cd->name + i)); #else { strcpy(str, *(cd->name + i)); #endif } else { for(str[0] = '\0', j = 0; j < i - 1; j++) strcat(str, " "); if(i == cd->anz - 1 && dd->anz < 1) strcat(str, ctree[1]); else if(i == cd->anz - 1) strcat(str, ctree[2]); else strcat(str, ctree[0]); strcat(str, *(cd->name + i)); } if((*(edf->name + i) = MALLOC((strlen(str) + 1) * sizeof(char))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); strcpy(*(edf->name + i), str); } for(; i < cd->anz + dd->anz; i++) { for(str[0] = '\0', j = 0; j < cd->anz - 2; j++) strcat(str, " "); strcat(str, " "); if(i == cd->anz + dd->anz - 1) strcat(str, ctree[4]); else strcat(str, ctree[3]); { int tttt = i - cd->anz; strcat(str, *(dd->name + tttt)); } if((*(edf->name + i) = MALLOC((strlen(str) + 1) * sizeof(char))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); strcpy(*(edf->name + i), str); } } edf->anz = i; return(edf); } int WpeDelWastebasket(FENSTER *f) { char *tmp; int ret, mode = f->ed->flopt; WpeMouseChangeShape(WpeWorkingShape); f->ed->flopt = FM_SHOW_HIDDEN_FILES | FM_SHOW_HIDDEN_DIRS | FM_MOVE_OVERWRITE | FM_REKURSIVE_ACTIONS; if ((tmp = WpeGetWastefile(""))) { ret = WpeRemoveDir(tmp, "*", f, 0); FREE(tmp); /* Unfortunately there is this racing condition, so this is necessary to get back the deleted wastebasket. */ if ((tmp = WpeGetWastefile(""))) { FREE(tmp); ret = 0; } else { e_error(e_msg[ERR_NOWASTE], 0, f->ed->fb); ret = 1; } } else { /* Error failed to find wastebasket */ e_error(e_msg[ERR_NOWASTE], 0, f->ed->fb); ret = 1; } f->ed->flopt = mode; WpeMouseRestoreShape(); return(ret); } int WpeShowWastebasket(FENSTER *f) { return(WpeCallFileManager(6, f)); } int WpeQuitWastebasket(FENSTER * f) { char *tmp; int ret = 0, mode = f->ed->flopt; if(mode & FM_PROMPT_DELETE) f->ed->flopt = FM_SHOW_HIDDEN_FILES | FM_SHOW_HIDDEN_DIRS | FM_REMOVE_PROMPT | FM_MOVE_OVERWRITE | FM_REKURSIVE_ACTIONS; else if(mode & FM_DELETE_AT_EXIT) f->ed->flopt = FM_SHOW_HIDDEN_FILES | FM_SHOW_HIDDEN_DIRS | FM_MOVE_OVERWRITE | FM_REKURSIVE_ACTIONS; if((mode & FM_PROMPT_DELETE) || (mode & FM_DELETE_AT_EXIT)) { WpeMouseChangeShape(WpeWorkingShape); if ((tmp = WpeGetWastefile(""))) { ret = WpeRemoveDir(tmp, "*", f, 0); FREE(tmp); } else { /* Error failed to find wastebasket */ e_error(e_msg[ERR_NOWASTE], 0, f->ed->fb); ret = 0; } WpeMouseRestoreShape(); } f->ed->flopt = mode; return(ret); } int WpeRemoveDir(char *dirct, char *file, FENSTER * f, int rec) { PIC *pic = NULL; char *tmp; int i, ret, svmode = f->ed->flopt; struct dirfile *dd; if(rec > MAXREC) return(0); /* only copy it to the wastebasket */ if(f->ed->flopt & FM_REMOVE_INTO_WB) { if ((tmp = WpeGetWastefile(dirct))) { i = strlen(tmp); /* we should not use the fact, that the wasbasket is always something meaningful !!! */ if(strncmp(tmp, dirct, i)) { ret = WpeRenameCopyDir(dirct, file, tmp, f, 0, 0); FREE(tmp); return(ret); } FREE(tmp); } else { e_error(e_msg[ERR_NOWASTE], 0, f->ed->fb); return 1; } } if((tmp = MALLOC(strlen(dirct) + strlen(file)+2)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); /* search for files in the directory */ sprintf(tmp, "%s%c%s", dirct, DIRC, file); dd = e_find_files(tmp, f->ed->flopt & FM_SHOW_HIDDEN_FILES ? 1 : 0); /* it is called for the first time and the user should be asked about the deletion */ if(!rec && (f->ed->flopt & FM_REMOVE_PROMPT) && dd->anz > 0) { if((ret = WpeDirDelOptions(f)) < 0) { freedf(dd); FREE(tmp); return(ret == WPE_ESC ? 1 : 0); } if(ret) f->ed->flopt |= FM_REMOVE_PROMPT; else f->ed->flopt &= ~FM_REMOVE_PROMPT; rec = -1; } FREE(tmp); /* cleans up the files in the directory */ for(i = 0; i < dd->anz; i++) { if((tmp = MALLOC(strlen(dirct) + strlen(dd->name[i])+15)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(tmp, "Remove File:\n%s%c%s", dirct, DIRC, dd->name[i]); if(f->ed->flopt & FM_REMOVE_PROMPT) { ret = e_message(1, tmp, f); } else ret = 'Y'; if(ret == WPE_ESC) { freedf(dd); FREE(tmp); f->ed->flopt = svmode; return(1); } else if(ret == 'Y') { /* this should definitely fit in */ sprintf(tmp, "%s%c%s", dirct, DIRC, dd->name[i]); /* put message out */ if(e_mess_win("Remove", tmp, &pic, f)) { FREE(tmp); break; } if(pic) { e_close_view(pic, 1); pic = NULL; } /* try to remove it */ if(remove(tmp)) { e_error(e_msg[ERR_DELFILE], 0, f->ed->fb); freedf(dd); FREE(tmp); f->ed->flopt = svmode; return(1); } } FREE(tmp); } if(pic) e_close_view(pic, 1); freedf(dd); /* if recursive action is specified clean up the subdirectories as well */ if(f->ed->flopt & FM_REKURSIVE_ACTIONS) { if((tmp = MALLOC(strlen(dirct) + strlen(SUDIR)+2)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); /* search for subdirectories */ sprintf(tmp, "%s%c%s", dirct, DIRC, SUDIR); dd = e_find_dir(tmp, f->ed->flopt & FM_SHOW_HIDDEN_DIRS ? 1 : 0); /* should the user be asked about deletion ? */ if(!rec && (f->ed->flopt & FM_REMOVE_PROMPT) && dd->anz > 0) { if((ret = WpeDirDelOptions(f)) < 0) { freedf(dd); FREE(tmp); return(ret == WPE_ESC ? 1 : 0); } if(ret) f->ed->flopt |= FM_REMOVE_PROMPT; else f->ed->flopt &= ~FM_REMOVE_PROMPT; } else if(rec < 0) rec = 0; FREE(tmp); /* call recursively itself to delete the subdirectories */ for(rec++, i = 0; i < dd->anz; i++) { if((tmp = MALLOC(strlen(dirct) + strlen(dd->name[i])+2)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(tmp, "%s%c%s", dirct, DIRC, dd->name[i]); if(WpeRemoveDir(tmp, file, f, rec)) { freedf(dd); FREE(tmp); f->ed->flopt = svmode; return(1); } FREE(tmp); } freedf(dd); } f->ed->flopt = svmode; /* remove finally the directory itself */ if(rmdir(dirct)) { e_error(e_msg[ERR_DELFILE], 0, f->ed->fb); return(1); } else return(0); } int WpeRemove(char *file, FENSTER * f) { struct stat buf; struct stat lbuf; char *tmp2; int ret; if(lstat(file, &lbuf)) { e_error(e_msg[ERR_ACCFILE], 0, f->ed->fb); return 1; } WpeMouseChangeShape(WpeWorkingShape); /* this is important, first we check whether it is a file, this check works even when it is a pointer, if it is not a file, then it can be an "invalid" symbolic link, check for that */ if(((stat(file, &buf) == 0) && S_ISREG(buf.st_mode)) || S_ISLNK(lbuf.st_mode)) { if((f->ed->flopt & FM_REMOVE_INTO_WB)) { if ((tmp2 = WpeGetWastefile(file))) { ret = strlen(tmp2); if(strncmp(tmp2, file, ret)) { e_rename(file, tmp2, f); } FREE(tmp2); ret = 0; } else { e_error(e_msg[ERR_NOWASTE], 0, f->ed->fb); ret = 1; } } else { if(f->ed->flopt & FM_REMOVE_PROMPT) { if((tmp2 = MALLOC(strlen(file) + 14)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(tmp2, "Remove File:\n%s", file); ret = e_message(1, tmp2, f); FREE(tmp2); } else ret = 'Y'; if(ret == 'Y') { if(remove(file)) { e_error(e_msg[ERR_DELFILE], 0, f->ed->fb); ret = 1; } else ret = 0; } else ret = 0; } } else { ret = WpeRemoveDir(file, f->fd.file, f, 0); } WpeMouseRestoreShape(); return(ret); } /* sw = 0 -> renames the directory sw = 1 -> copies the directory sw = 2 -> links directory */ int WpeRenameCopyDir(char *dirct, char *file, char *newname, FENSTER *f, int rec, int sw) { char *tmp, *ntmp, *mtmp; int i, ret, mode; struct dirfile *dd; struct stat buf; PIC *pic = NULL; if(rec > MAXREC) return(0); /* check whether the dir already exist */ ret = access(newname, F_OK); /* rename mode and dir does not exist */ if (sw == 0 && ret && file[0] == '*' && file[1] == '\0') { if ((ret = rename(dirct, newname))) e_error(e_msg[ERR_RENFILE], 0, f->ed->fb); return(ret); } /* directory does not exist */ if (ret != 0) { /* get the permissions */ if (stat(dirct, &buf)) { e_error(e_msg[ERR_ACCFILE], 0, f->ed->fb); return(1); } /* with that permission create the new dir */ if(mkdir(newname, buf.st_mode)) { e_error(e_msg[ERR_NONEWDIR], 0, f->ed->fb); return(1); } } if(f->ed->flopt & FM_REKURSIVE_ACTIONS) { if((tmp = MALLOC(strlen(dirct) + 2 + strlen(SUDIR))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(tmp, "%s%c%s", dirct, DIRC, SUDIR); dd = e_find_dir(tmp, f->ed->flopt & FM_SHOW_HIDDEN_DIRS ? 1 : 0); FREE(tmp); for(rec++, i = 0; i < dd->anz; i++) { if((tmp = MALLOC(strlen(dirct) + 2 + strlen(dd->name[i]))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); if((ntmp = MALLOC(strlen(newname) + 2 + strlen(dd->name[i]))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(tmp, "%s%c%s", dirct, DIRC, dd->name[i]); sprintf(ntmp, "%s%c%s", newname, DIRC, dd->name[i]); if(WpeRenameCopyDir(tmp, file, ntmp, f, rec, sw)) { FREE(tmp); FREE(ntmp); freedf(dd); return(1); } FREE(tmp); FREE(ntmp); } freedf(dd); } if((tmp = MALLOC(strlen(dirct) + 2 + strlen(file))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(tmp, "%s%c%s", dirct, DIRC, file); dd = e_find_files(tmp, f->ed->flopt & FM_SHOW_HIDDEN_FILES ? 1 : 0); FREE(tmp); mode = f->ed->flopt; f->ed->flopt &= ~FM_REMOVE_PROMPT; for(i = 0; i < dd->anz; i++) { if((ntmp = MALLOC(strlen(newname) + 2 + strlen(dd->name[i]))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(ntmp, "%s%c%s", newname, DIRC, dd->name[i]); ret = 'Y'; if(access(ntmp, 0) == 0) { if(f->ed->flopt & FM_MOVE_PROMPT) { if((tmp = MALLOC(strlen(ntmp) + 31)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(tmp, "File %s exist !\nOverwrite File ?", ntmp); if(pic) { e_close_view(pic, 1); pic = NULL; } ret = e_message(1, tmp, f); FREE(tmp); if(ret == 'Y') { if(WpeRemove(ntmp, f)) { FREE(ntmp); freedf(dd); return(1); } } else if(ret == WPE_ESC) { FREE(ntmp); freedf(dd); return(1); } } else if(f->ed->flopt & FM_MOVE_OVERWRITE) { if(WpeRemove(ntmp, f)) { FREE(ntmp); freedf(dd); return(1); } } } if((tmp = MALLOC(strlen(dirct) + 2 + strlen(dd->name[i]))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(tmp, "%s%c%s", dirct, DIRC, dd->name[i]); if(ret == 'Y') { if((mtmp = MALLOC(strlen(tmp) + 2 + strlen(ntmp))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(mtmp, "%s %s", tmp, ntmp); if(e_mess_win(!sw ? "Rename" : "Copy", mtmp, &pic, f)) { FREE(tmp); FREE(ntmp); FREE(mtmp); break; } FREE(mtmp); if (sw == 0) { if ((ret = rename(tmp, ntmp))) { e_error(e_msg[ERR_RENFILE], 0, f->ed->fb); FREE(tmp); FREE(ntmp); freedf(dd); return(1); } } else if (sw == 1) { if (WpeCopyFileCont(tmp, ntmp, f)) { FREE(tmp); FREE(ntmp); freedf(dd); return(1); } } else if(sw == 2) { if(WpeLinkFile(tmp, ntmp, f->ed->flopt & FM_TRY_HARDLINK, f)) { FREE(tmp); FREE(ntmp); freedf(dd); return(1); } } } FREE(tmp); FREE(ntmp); } if(pic) e_close_view(pic, 1); f->ed->flopt = mode; if(sw == 0) { if(rmdir(dirct)) e_error(e_msg[ERR_DELFILE], 0, f->ed->fb); } freedf(dd); return(0); } int WpeRenameCopy(char *file, char *newname, FENSTER *f, int sw) { struct stat buf; struct stat lbuf; char *tmp, *tmpl; int ln = -1, ret = 'Y'; int allocate_size, retl = 0; WpeMouseChangeShape(WpeWorkingShape); /* in copy mode check whether it is a link */ if (sw == 0) { if (lstat(file, &lbuf)) { e_error(e_msg[ERR_ACCFILE], 0, f->ed->fb); return 1; } if (S_ISLNK(lbuf.st_mode)) ln = 1; } if ((stat(file, &buf) == 0) && S_ISDIR(buf.st_mode) && ln < 0) retl = WpeRenameCopyDir(file, f->fd.file, newname, f, 0, sw); else { /* check whether file exist */ if (access(newname, 0) == 0) { if (f->ed->flopt & FM_MOVE_OVERWRITE) { if (WpeRemove(newname, f)) { WpeMouseRestoreShape(); return(1); } } else if (f->ed->flopt & FM_MOVE_PROMPT) { if ((tmp = MALLOC(strlen(newname) + 26)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(tmp, "File %s exist\nRemove File ?", newname); ret = e_message(1, tmp, f); FREE(tmp); if (ret == 'Y') { if (WpeRemove(newname, f)) { WpeMouseRestoreShape(); return(1); } } } } if (ret == 'Y') { if (sw == 1) { retl = WpeCopyFileCont(file, newname, f); } else if (sw == 2) { retl = WpeLinkFile(file, newname, f->ed->flopt & FM_TRY_HARDLINK, f); } else if (sw == 0 && ln < 0) /* rename mode, no softlink */ { if ((retl = rename(file, newname)) == -1) { if (errno == EXDEV) { if ((retl = WpeCopyFileCont(file, newname, f)) == 0) { if ((retl = remove(file))) e_error(e_msg[ERR_DELFILE], 0, f->ed->fb); } } else { e_error(e_msg[ERR_RENFILE], 0, f->ed->fb); retl = 1; } } } else if (sw == 0) { allocate_size = 2; tmp = NULL; do { if (tmp) FREE(tmp); allocate_size += 4; if ((tmp = MALLOC(allocate_size)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); ln = readlink(file, tmp, allocate_size-1); } while (!(ln < allocate_size-1)); tmp[ln] = '\0'; for (; ln >= 0 && tmp[ln] != DIRC; ln--) ; if (ln < 0) { if ((tmpl = MALLOC(strlen(f->dirct) + 2 + strlen(tmp))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(tmpl, "%s%c%s", f->dirct, DIRC, tmp); retl = WpeRenameLink(file, newname, tmpl, f); FREE(tmpl); } else { retl = WpeRenameLink(file, newname, tmp, f); } } } } WpeMouseRestoreShape(); return(retl); } int WpeCopyFileCont(char *oldfile, char *newfile, FENSTER *f) { struct stat buf; int ret; char *buffer; FILE *fpo, *fpn; /* get the status of the file */ if(stat(oldfile, &buf)) { e_error(e_msg[ERR_ACCFILE], 0, f->ed->fb); return(1); } /* open files for copying */ if((fpo = fopen(oldfile, "rb")) == NULL) { e_error(e_msg[ERR_OREADFILE], 0, f->ed->fb); return(1); } if((fpn = fopen(newfile, "wb")) == NULL) { e_error(e_msg[ERR_OWRITEFILE], 0, f->ed->fb); return(1); } /* allocate buffer for copying */ if((buffer = malloc(E_C_BUFFERSIZE)) == NULL) { e_error(e_msg[ERR_ALLOC_CBUF], 0, f->ed->fb); return(1); } /* copy until end of file */ do { ret = fread(buffer, 1, E_C_BUFFERSIZE, fpo); /* we should be able to write the same amount of info */ if (fwrite(buffer, 1, ret, fpn) != ret) { fclose(fpo); fclose(fpn); free(buffer); e_error(e_msg[ERR_INCONSCOPY], 0, f->ed->fb); return(1); } } while(!feof(fpo)); fclose(fpo); fclose(fpn); free(buffer); /* Well, we just created the file, so theoretically this should succed. Of course this is a racing condition !!! */ if(chmod(newfile, buf.st_mode)) e_error(e_msg[ERR_CHGPERM], 0, f->ed->fb); return(0); } #ifndef NOSYMLINKS /* Link a file according to the required mode sw != 0 -> symbolic link sw == 0 -> hard link When hard linking does not work, it tries to do symbolic linking */ int WpeLinkFile(char *fl, char *ln, int sw, FENSTER *f) { int ret; if(sw || link(fl, ln)) { ret = symlink(fl, ln); if (ret) { e_error(e_msg[ERR_LINKFILE], 0, f->ed->fb); } return(ret); } return(0); } int WpeRenameLink(char *old, char *ln, char *fl, FENSTER *f) { int ret; ret = symlink(fl, ln); if(ret) { e_error(e_msg[ERR_LINKFILE], 0, f->ed->fb); return(1); } else { if(remove(old)) { e_error(e_msg[ERR_DELFILE], 0, f->ed->fb); return(1); } else return(0); } } #endif int e_rename(char *file, char *newname, FENSTER * f) { return(WpeRenameCopy(file, newname, f, 0)); } int e_rename_dir(char *dirct, char *file, char *newname, FENSTER * f, int rec) { return(WpeRenameCopyDir(dirct, file, newname, f, rec, 0)); } int e_link(char *file, char *newname, FENSTER *f) { return(WpeRenameCopy(file, newname, f, 2)); } int e_copy(char *file, char *newname, FENSTER * f) { return(WpeRenameCopy(file, newname, f, 1)); } int WpeFileManagerOptions(FENSTER * f) { int ret; W_OPTSTR *o = e_init_opt_kst(f); if(o == NULL) return(1); o->xa = 8; o->ya = 1; o->xe = 69; o->ye = 22; o->bgsw = AltO; o->name = "File-Manager-Options"; o->crsw = AltO; e_add_txtstr(4, 2, "Directories:", o); e_add_txtstr(35, 13, "Wastebasket:", o); e_add_txtstr(4, 7, "Move/Copy:", o); e_add_txtstr(35, 8, "Remove:", o); e_add_txtstr(35, 2, "Sort Files by:", o); e_add_txtstr(4, 12, "Links on Files:", o); e_add_txtstr(4, 16, "On Open:", o); e_add_sswstr(5, 3, 12, AltF, f->ed->flopt & FM_SHOW_HIDDEN_FILES ? 1 : 0, "Show Hidden Files ", o); e_add_sswstr(5, 4, 12, AltD, f->ed->flopt & FM_SHOW_HIDDEN_DIRS ? 1 : 0, "Show Hidden Directories", o); e_add_sswstr(5, 5, 2, AltK, f->ed->flopt & FM_REKURSIVE_ACTIONS ? 1 : 0, "ReKursive Actions ", o); e_add_sswstr(5, 17, 0, AltC, f->ed->flopt & FM_CLOSE_WINDOW ? 1 : 0, "Close File Manager ", o); e_add_sswstr(36, 6, 0, AltR, f->ed->flopt & FM_REVERSE_ORDER ? 1 : 0, "Reverse Order ", o); e_add_pswstr(0, 36, 14, 0, AltP, 0, "Prompt for Delete", o); e_add_pswstr(0, 36, 15, 10, AltE, 0, "Delete at Exit ", o); e_add_pswstr(0, 36, 16, 8, AltL, f->ed->flopt & FM_PROMPT_DELETE ? 0 : (f->ed->flopt & FM_DELETE_AT_EXIT ? 1 : 2), "Don't DeLete ", o); e_add_pswstr(1, 36, 3, 0, AltN, 0, "Name ", o); e_add_pswstr(1, 36, 4, 1, AltI, 0, "TIme ", o); e_add_pswstr(1, 36, 5, 0, AltB, f->ed->flopt & FM_SORT_NAME ? 1 : (f->ed->flopt & FM_SORT_TIME ? 2 : 0), "Bytes ", o); e_add_pswstr(2, 5, 8, 12, AltQ, 0, "Prompt for eQual Files ", o); e_add_pswstr(2, 5, 9, 1, AltV, 0, "OVerwrite equal Files ", o); e_add_pswstr(2, 5, 10, 4, AltT, f->ed->flopt & FM_MOVE_PROMPT ? 0 : (f->ed->flopt & FM_MOVE_OVERWRITE ? 1 : 2), "Don'T overwrite ", o); e_add_pswstr(3, 5, 13, 4, AltH, 0, "Try Hardlink ", o); e_add_pswstr(3, 5, 14, 7, AltS, f->ed->flopt & FM_TRY_HARDLINK ? 1 : 0, "Always Symbolic Link ", o); e_add_pswstr(4, 36, 9, 5, AltW, 0, "into Wastebasket ", o); e_add_pswstr(4, 36, 10, 0, AltA, 0, "Absolute (Prompt)", o); e_add_pswstr(4, 36, 11, 6, AltM, f->ed->flopt & FM_REMOVE_INTO_WB ? 0 : (f->ed->flopt & FM_REMOVE_PROMPT ? 1 : 2), "No ProMpt ", o); e_add_bttstr(16, 19, 1, AltO, " Ok ", NULL, o); e_add_bttstr(38, 19, -1, WPE_ESC, "Cancel", NULL, o); ret = e_opt_kst(o); if(ret != WPE_ESC) { f->ed->flopt = o->sstr[0]->num + (o->sstr[1]->num << 1) + (o->sstr[2]->num ? FM_REKURSIVE_ACTIONS : 0) + (o->sstr[3]->num ? FM_CLOSE_WINDOW : 0) + (o->sstr[4]->num ? FM_REVERSE_ORDER : 0) + (o->pstr[0]->num ? (o->pstr[0]->num == 1 ? 4 : 0) : 8) + (o->pstr[2]->num ? (o->pstr[2]->num == 1 ? 16 : 0) : 32) + (o->pstr[4]->num ? (o->pstr[4]->num == 1 ? 128 : 0) : 64) + (o->pstr[1]->num ? (o->pstr[1]->num == 1 ? 01000 : 02000) : 0) + (o->pstr[3]->num ? FM_TRY_HARDLINK : 0); } freeostr(o); return(0); } int WpeDirDelOptions(FENSTER * f) { int ret; W_OPTSTR *o = e_init_opt_kst(f); if(o == NULL) return(1); o->xa = 19; o->ya = 11; o->xe = 53; o->ye = 19; o->bgsw = AltO; o->name = "Message"; o->crsw = AltO; e_add_txtstr(4, 2, "Delete Directory:", o); e_add_pswstr(0, 5, 3, 0, AltD, 0, "Delete without Prompt", o); e_add_pswstr(0, 5, 4, 0, AltP, 1, "Prompt for Files ", o); e_add_bttstr(7, 6, 1, AltO, " Ok ", NULL, o); e_add_bttstr(22, 6, -1, WPE_ESC, "Cancel", NULL, o); ret = e_opt_kst(o); ret = (ret == WPE_ESC) ? -1 : o->pstr[0]->num; freeostr(o); return(ret); } int WpeShell(FENSTER * f) { PIC *outp = NULL; int g[4]; if (!WpeIsXwin()) { outp = e_open_view(0, 0, MAXSCOL - 1, MAXSLNS - 1, f->fb->ws, 1); fk_locate(0, 0); fk_cursor(1); #if MOUSE g[0] = 2; fk_mouse(g); #endif (*e_u_s_sys_ini) (); } (*e_u_system) (user_shell); if(!WpeIsXwin()) { (*e_u_s_sys_end) (); e_close_view(outp, 1); fk_cursor(0); #if MOUSE g[0] = 1; fk_mouse(g); #endif } return(0); } /* print file */ #ifndef NOPRINTER int WpePrintFile(FENSTER *f) { char *str, *dp; int c, sins = f->ins; for (c = f->ed->mxedt; c > 0 && !DTMD_ISTEXT(f->ed->f[c]->dtmd); c--) ; if (c <= 0) return(0); f = f->ed->f[c]; if (strcmp(f->ed->print_cmd, "") == 0) { return(e_error(e_msg[ERR_NOPRINT], 0, f->fb)); } if ((str = MALLOC(strlen(f->datnam) + 32 )) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(str, "File: %s\nDo you want to print it?", f->datnam); c = e_message(1, str, f); FREE(str); if (c != 'Y') return(0); dp = f->dirct; f->dirct = e_tmp_dir; f->ins = 0; e_save(f); f->dirct = dp; f->ins = sins; if ((str = MALLOC(strlen(e_tmp_dir) + 7 + strlen(f->ed->print_cmd) + strlen(f->datnam) )) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(str, "cd %s; %s %s", e_tmp_dir, f->ed->print_cmd, f->datnam); if (system(str)) e_error(e_msg[ERR_NOTINSTALL], 0, f->fb); sprintf(str, "%s/%s", e_tmp_dir, f->datnam); if (remove(str)) e_error(e_msg[ERR_DELFILE], 0, f->ed->fb); FREE(str); return(0); } #else int WpePrintFile(FENSTER * f) { return(e_error(e_msg[ERR_NOPRINT], 0, f->fb)); } #endif struct dirfile *WpeSearchFiles(FENSTER *f, char *dirct, char *file, char *string, struct dirfile *df, int sw) { struct dirfile *dd; char **tname, *tp, *tmp, *tmp2; int i; static int rec = 0; if(rec > MAXREC) return(df); /* if not absolute path is given */ if(*dirct != DIRC) { tmp2 = WpeGetCurrentDir(f->ed); tmp = REALLOC(tmp2, strlen(tmp2) + strlen(dirct) + 4); if(tmp == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); tmp2 = tmp; if(tmp2[strlen(tmp2) - 1] != DIRC) sprintf(tmp2 + strlen(tmp2), "%c%s%c", DIRC, dirct, DIRC); else sprintf(tmp2 + strlen(tmp2), "%s%c", dirct, DIRC); } else { if((tmp2 = MALLOC(strlen(dirct) + 2)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); if(dirct[strlen(dirct) - 1] != DIRC) sprintf(tmp2, "%s%c", dirct, DIRC); else sprintf(tmp2, "%s", dirct); } /* assemble total path, dir + filename */ if((tmp = MALLOC(strlen(tmp2) + strlen(file) + 2)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(tmp, "%s%s", tmp2, file); /* initialise structure, only once */ if(df == NULL) { if((df = MALLOC(sizeof(struct dirfile))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); df->anz = 0; if((df->name = MALLOC(sizeof(char *))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); } /* search all matching file */ dd = e_find_files(tmp, 0); /* if we found something */ if(dd && dd->anz > 0) { /* file find */ if(!(sw & 1024)) { for(i = 0; i < dd->anz; i++) { if((tp = MALLOC(strlen(tmp2) + strlen(dd->name[i]) + 2)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(tp, "%s%s", tmp2, dd->name[i]); df->anz++; if((tname = REALLOC(df->name, df->anz * sizeof(char *))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); df->name = tname; df->name[df->anz - 1] = tp; } } /* file grep */ else { for(i = 0; i < dd->anz; i++) { if((tp = MALLOC(strlen(tmp2) + strlen(dd->name[i]) + 2)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); sprintf(tp, "%s%s", tmp2, dd->name[i]); if(WpeGrepFile(tp, string, sw)) { df->anz++; if((tname = REALLOC(df->name, df->anz * sizeof(char *))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); df->name = tname; df->name[df->anz - 1] = tp; } else FREE(tp); } } } freedf(dd); FREE(tmp2); FREE(tmp); /* whether recursive action */ if(!(sw & 512)) return(df); if((tmp = MALLOC(strlen(dirct) + strlen(SUDIR) + 2)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->ed->fb); if(dirct[strlen(dirct) - 1] != DIRC) sprintf(tmp, "%s%c%s", dirct, DIRC, SUDIR); else sprintf(tmp, "%s%s", dirct, SUDIR); /* find directories */ dd = e_find_dir(tmp, 0); FREE(tmp); if(!dd) return(df); rec++; for(i = 0; i < dd->anz; i++) { if((tmp = MALLOC(strlen(dirct) + strlen(dd->name[i]) + 3)) == NULL) { e_error(e_msg[ERR_LOWMEM], 0, f->ed->fb); rec--; freedf(dd); return(df); } if(dirct[strlen(dirct) - 1] != DIRC) sprintf(tmp, "%s%c%s", dirct, DIRC, dd->name[i]); else sprintf(tmp, "%s%s", dirct, dd->name[i]); df = WpeSearchFiles(f, tmp, file, string, df, sw); FREE(tmp); } freedf(dd); rec--; return(df); } int WpeGrepWindow(FENSTER * f) { FIND *fd = &(f->ed->fd); int ret; char strTemp[80]; W_OPTSTR *o = e_init_opt_kst(f); if(!o) return(-1); if(e_blck_dup(strTemp, f)) { strcpy(fd->search, strTemp); fd->sn = strlen(fd->search); } o->xa = 7; o->ya = 3; o->xe = 63; o->ye = 19; o->bgsw = 0; o->name = "Grep"; o->crsw = AltO; e_add_txtstr(4, 4, "Options:", o); e_add_wrstr(4, 2, 18, 2, 35, 128, 0, AltT, "Text to Find:", fd->search, &f->ed->sdf, o); e_add_wrstr(4, 10, 17, 10, 36, 128, 0, AltF, "File:", fd->file, &f->ed->fdf, o); e_add_wrstr(4, 12, 17, 12, 36, WPE_PATHMAX, 0, AltD, "Directory:", fd->dirct, &f->ed->ddf, o); e_add_sswstr(5, 5, 0, AltC, fd->sw & 128 ? 1 : 0, "Case sensitive ", o); e_add_sswstr(5, 6, 0, AltW, fd->sw & 64 ? 1 : 0, "Whole words only ", o); e_add_sswstr(5, 7, 0, AltR, fd->sw & 32 ? 1 : 0, "Regular expression", o); e_add_sswstr(5, 8, 0, AltS, 0, "Search Recursive ", o); e_add_bttstr(16, 14, 1, AltO, " Ok ", NULL, o); e_add_bttstr(34, 14, -1, WPE_ESC, "Cancel", NULL, o); ret = e_opt_kst(o); if(ret != WPE_ESC) { fd->sw = 1024 + (o->sstr[0]->num << 7) + (o->sstr[1]->num << 6) + (o->sstr[2]->num << 5) + (o->sstr[3]->num << 9); strcpy(fd->search, o->wstr[0]->txt); fd->sn = strlen(fd->search); strcpy(fd->file, o->wstr[1]->txt); if (fd->dirct) { WpeFree(fd->dirct); } fd->dirct = WpeStrdup(o->wstr[2]->txt); } freeostr(o); if(ret != WPE_ESC) ret = e_data_first(2, f->ed, fd->dirct); return(ret); } int WpeFindWindow(FENSTER * f) { FIND *fd = &(f->ed->fd); int ret; W_OPTSTR *o = e_init_opt_kst(f); if(!o) return(-1); o->xa = 7; o->ya = 3; o->xe = 61; o->ye = 14; o->bgsw = 0; o->name = "Find File"; o->crsw = AltO; e_add_txtstr(4, 6, "Options:", o); e_add_wrstr(4, 2, 15, 2, 36, 128, 0, AltF, "File:", fd->file, &f->ed->fdf, o); e_add_wrstr(4, 4, 15, 4, 36, WPE_PATHMAX, 0, AltD, "Directory:", fd->dirct, &f->ed->ddf, o); e_add_sswstr(5, 7, 0, AltS, 1, "Search Recursive ", o); e_add_bttstr(13, 9, 1, AltO, " Ok ", NULL, o); e_add_bttstr(33, 9, -1, WPE_ESC, "Cancel", NULL, o); ret = e_opt_kst(o); if(ret != WPE_ESC) { fd->sw = (o->sstr[0]->num << 9); strcpy(fd->file, o->wstr[0]->txt); if (fd->dirct) { WpeFree(fd->dirct); } fd->dirct = WpeStrdup(o->wstr[1]->txt); } freeostr(o); if(ret != WPE_ESC) ret = e_data_first(3, f->ed, fd->dirct); return(ret); } int e_ed_man(char *str, FENSTER * f) { char command[256], tstr[_POSIX_PATH_MAX]; char cc, hstr[80], nstr[10]; int mdsv = f->ed->dtmd, bg, i, j = 0; BUFFER *b; if(!str) return(0); while(isspace(*str++)); if(!*--str) return(0); for(i = f->ed->mxedt; i >= 0; i--) { if(!strcmp(f->ed->f[i]->datnam, str)) { e_switch_window(f->ed->edt[i], f); return(0); } } WpeMouseChangeShape(WpeWorkingShape); sprintf(tstr, "%s/%s", e_tmp_dir, str); for(i = 0; (hstr[i] = str[i]) && str[i] != '(' && str[i] != ')'; i++); hstr[i] = '\0'; if(str[i] == '(') { for(++i; (nstr[j] = str[i]) && str[i] != ')' && str[i] != '('; i++, j++); /* Some SEE ALSO's are list as "foobar(3X)" but are in section 3 not 3X. This is a quick hack to fix the problem. -- Dennis */ if(isdigit(nstr[0])) j = 1; } nstr[j] = '\0'; while(1) { #ifdef MAN_S_OPT if(!nstr[0]) sprintf(command, " man %s > \'%s\' 2> /dev/null", hstr, tstr); else sprintf(command, " man -s %s %s > \'%s\' 2> /dev/null", nstr, hstr, tstr); #else sprintf(command, " man %s %s > \'%s\' 2> /dev/null", nstr, hstr, tstr); #endif system(command); chmod(tstr, 0400); f->ed->dtmd = DTMD_HELP; e_edit(f->ed, tstr); f->ed->dtmd = mdsv; f = f->ed->f[f->ed->mxedt]; b = f->b; if(b->mxlines > 1 || !nstr[1]) break; nstr[1] = '\0'; chmod(tstr, 0600); remove(tstr); e_close_window(f); } if(b->mxlines == 1 && b->bf[0].len == 0) { e_ins_nchar(f->b, f->s, "No manual entry for ", 0, 0, 20); e_ins_nchar(f->b, f->s, hstr, b->b.x, b->b.y, strlen(hstr)); e_ins_nchar(f->b, f->s, ".", b->b.x, b->b.y, 1); } for(i = 0; i < b->mxlines; i++) if(b->bf[i].len == 0 && (i == 0 || b->bf[i - 1].len == 0)) { e_del_line(i, b, f->s); i--; } for(bg = 0; bg < b->bf[0].len && isspace(b->bf[0].s[bg]); bg++); if(bg == b->bf[0].len) bg = 0; for(i = 0; i < b->mxlines && WpeStrnccmp(b->bf[i].s + bg, "\017SEE\005 \017ALSO\005", 12) && WpeStrnccmp(b->bf[i].s + bg, "SEE ALSO", 8); i++); if(i < b->mxlines) for(bg = 0, i++; i < b->mxlines && b->bf[i].len > 0 && bg >= 0; i++) { bg = 0; while(b->bf[i].s[bg]) { for(; isspace(b->bf[i].s[bg]); bg++); if(!b->bf[i].s[bg]) continue; for(j = bg + 1; b->bf[i].s[j] && b->bf[i].s[j] != ',' && b->bf[i].s[j] != '.' && b->bf[i].s[j] != ' ' && b->bf[i].s[j] != '('; j++); if(b->bf[i].s[j] != '(') { bg = -1; break; } if(b->bf[i].s[j - 1] == 5) e_del_nchar(b, f->s, j - 1, i, 1); for(j++; b->bf[i].s[j] && b->bf[i].s[j] != ',' && b->bf[i].s[j] != '.'; j++); if(b->bf[i].s[bg] == 15) b->bf[i].s[bg] = HFB; else { cc = HFB; e_ins_nchar(b, f->s, &cc, bg, i, 1); j++; } cc = HED; e_ins_nchar(b, f->s, &cc, j, i, 1); j++; if(b->bf[i].s[j]) j++; bg = j; } } b->b.x = b->b.y = 0; chmod(tstr, 0600); remove(tstr); WpeMouseRestoreShape(); e_schirm(f, 1); return(0); } int e_funct(FENSTER * f) { char str[80]; if (f->ed->hdf && f->ed->hdf->anz > 0) strcpy(str, f->ed->hdf->name[0]); else str[0] = '\0'; if (e_add_arguments(str, "Function", f, 0, AltF, &f->ed->hdf)) { f->ed->hdf = e_add_df(str, f->ed->hdf); e_ed_man(str, f); } return(0); } struct dirfile *e_make_funct(char *man) { struct dirfile *df = NULL, *dout = MALLOC(sizeof(struct dirfile)); char *sustr, *subpath, *manpath; int ret = 0, n, i = 0, j, k, l = 0; manpath = NULL; WpeMouseChangeShape(WpeWorkingShape); dout->anz = 0; dout->name = NULL; if (getenv("MANPATH")) { manpath = strdup(getenv("MANPATH")); } if ((!manpath) || (manpath[0] == '\0')) { manpath = strdup("/usr/man:/usr/share/man:/usr/X11R6/man:/usr/local/man"); } /* Allocate the maximum possible rather than continually realloc. */ sustr = malloc(strlen(manpath) + 10); while (manpath[i]) { subpath = manpath + i; for (n = 0; (manpath[i]) && (manpath[i] != PTHD); i++, n++); if (manpath[i] == PTHD) { manpath[i] = '\0'; i++; } sprintf(sustr, "%s/man%s/*", subpath, man); df = e_find_files(sustr, 0); if (!df->anz) { freedf(df); continue; } for (j = 0; j < df->anz; j++) { k = strlen(df->name[j]) - 1; /* If the file is gzipped strip the .gz ending. */ if ((k > 2) && (strcmp(df->name[j] + k - 2, ".gz") == 0)) { k -= 3; *(df->name[j] + k + 1) = '\0'; } else if ((k > 3) && (strcmp(df->name[j] + k - 3, ".bz2") == 0)) { k -= 4; *(df->name[j] + k + 1) = '\0'; } else if ((k > 1) && (strcmp(df->name[j] + k - 1, ".Z") == 0)) { k -= 2; *(df->name[j] + k + 1) = '\0'; } for (k = strlen(df->name[j]) - 1; k >= 0 && *(df->name[j] + k) != '.'; k--) ; if (k >= 0 /**(df->name[j]+k)*/ ) { df->name[j] = REALLOC(df->name[j], (l = strlen(df->name[j]) + 2) * sizeof(char)); *(df->name[j] + k) = '('; *(df->name[j] + l - 2) = ')'; *(df->name[j] + l - 1) = '\0'; } } if (!dout->name) dout->name = MALLOC(df->anz * sizeof(char *)); else dout->name = REALLOC(dout->name, (df->anz + dout->anz) * sizeof(char *)); for (j = 0; j < df->anz; j++) { for (k = 0; k < dout->anz; k++) { if (!(ret = strcmp(df->name[j], dout->name[k]))) { FREE(df->name[j]); break; } else if (ret < 0) break; } if (!ret && dout->anz) continue; for (l = dout->anz; l > k; l--) dout->name[l] = dout->name[l - 1]; dout->name[k] = df->name[j]; dout->anz++; } FREE(df); } free(manpath); free(sustr); WpeMouseRestoreShape(); return(dout); } #ifdef PROG extern struct dirfile **e_p_df; #endif int e_data_first(int sw, ECNT *cn, char *nstr) { extern char *e_hlp_str[]; extern WOPT *gblst, *oblst; FENSTER *f; int i, j; struct dirfile *df = NULL; FLWND *fw; if(cn->mxedt >= MAXEDT) { e_error(e_msg[ERR_MAXWINS], 0, cn->fb); return(-1); } for(j = 1; j <= MAXEDT; j++) { for(i = 1; i <= cn->mxedt && cn->edt[i] != j; i++); if(i > cn->mxedt) break; } cn->curedt = j; (cn->mxedt)++; cn->edt[cn->mxedt] = j; if((f = (FENSTER *) MALLOC(sizeof(FENSTER))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); if((fw = (FLWND *) MALLOC(sizeof(FLWND))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); f->fb = cn->fb; cn->f[cn->mxedt] = f; f->a = e_set_pnt(22, 3); f->e = e_set_pnt(f->a.x + 35, f->a.y + 18); f->winnum = cn->curedt; f->dtmd = DTMD_DATA; f->ins = sw; f->save = 0; f->zoom = 0; f->ed = cn; f->c_sw = NULL; f->c_st = NULL; f->pic = NULL; f->fd.dirct = NULL; if(!nstr) f->dirct = NULL; /* how about a free up ??? */ else { f->dirct = MALLOC(strlen(nstr) + 1); strcpy(f->dirct, nstr); } WpeMouseChangeShape(WpeWorkingShape); if(sw == 1) { f->datnam = "Function-Index"; df = e_make_funct(nstr); } else if(sw == 2) { f->datnam = "Grep"; df = WpeSearchFiles(f, nstr, cn->fd.file, cn->fd.search, NULL, cn->fd.sw); } else if(sw == 3) { f->datnam = "Find"; df = WpeSearchFiles(f, nstr, cn->fd.file, cn->fd.search, NULL, cn->fd.sw); } else if(sw == 7) { f->datnam = "Windows"; df = e_make_win_list(f); } #ifdef PROG else if(sw == 4) { f->datnam = "Project"; df = e_p_df[0]; } else if(sw == 5) { f->datnam = "Variables"; df = e_p_df[1]; } else if(sw == 6) { f->datnam = "Install"; df = e_p_df[2]; } #endif f->hlp_str = e_hlp_str[16 + sw]; if(sw < 4) { f->blst = gblst; f->nblst = 4; } else { f->blst = oblst; f->nblst = 4; } WpeMouseRestoreShape(); f->b = (BUFFER *) fw; fw->df = df; fw->mxa = f->a.x; fw->mxe = f->e.x; fw->mya = f->a.y; fw->mye = f->e.y; fw->xa = f->a.x + 3; fw->xe = f->e.x - 13; fw->ya = f->a.y + 3; fw->ye = f->e.y - 1; fw->f = f; fw->ia = fw->nf = fw->nxfo = fw->nyfo = 0; fw->srcha = fw->ja = 0; if(cn->mxedt > 1 && (f->ins < 5 || f->ins == 7)) e_ed_rahmen(cn->f[cn->mxedt - 1], 0); e_firstl(f, 1); e_data_schirm(f); return(0); } int e_data_schirm(FENSTER * f) { int i, j; FLWND *fw = (FLWND *) f->b; for(j = f->a.y + 1; j < f->e.y; j++) for(i = f->a.x + 1; i < f->e.x; i++) e_pr_char(i, j, ' ', f->fb->nt.fb); if(NUM_COLS_ON_SCREEN > 25) { if(f->ins < 4 || f->ins == 7) e_pr_str((f->e.x - 9), f->e.y - 4, "Show", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); else if(f->ins > 3) { e_pr_str((f->e.x - 9), f->e.y - 8, "Add", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); e_pr_str((f->e.x - 9), f->e.y - 6, "Edit", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); e_pr_str((f->e.x - 9), f->e.y - 4, "Delete", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); if(f->ins == 4 && f->a.y < f->e.y - 10) { e_pr_str((f->e.x - 9), f->e.y - 10, "Options", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); } } e_pr_str((f->e.x - 9), f->e.y - 2, "Cancel", f->fb->nz.fb, -1, -1, f->fb->ns.fb, f->fb->nt.fb); } if(NUM_COLS_ON_SCREEN > 25) { fw->xa = f->a.x + 3; fw->xe = f->e.x - 13; } else { fw->xa = f->a.x + 3; fw->xe = f->e.x - 2; } fw->mxa = f->a.x; fw->mxe = f->e.x; fw->mya = f->a.y; fw->mye = f->e.y; fw->xa = f->a.x + 3; fw->ya = f->a.y + 3; fw->ye = f->e.y - 1; #ifdef PROG if(f->ins == 4) fw->df = e_p_df[0]; #endif if(f->ins == 1) e_pr_str(fw->xa, f->a.y + 2, "Functions:", f->fb->nt.fb, 0, 1, f->fb->nsnt.fb, f->fb->nt.fb); else if(f->ins == 3) e_pr_str(fw->xa, f->a.y + 2, "Directories:", f->fb->nt.fb, 0, 1, f->fb->nsnt.fb, f->fb->nt.fb); e_mouse_bar(fw->xe, fw->ya, fw->ye - fw->ya, 0, fw->f->fb->em.fb); e_mouse_bar(fw->xa, fw->ye, fw->xe - fw->xa, 1, fw->f->fb->em.fb); e_pr_file_window(fw, 0, 1, f->fb->ft.fb, f->fb->fz.fb, f->fb->frft.fb); return(0); } int e_data_eingabe(ECNT * cn) { FENSTER *f = cn->f[cn->mxedt]; FLWND *fw = (FLWND *) f->b; int c = AltF; fk_cursor(0); if(f->ins == 7) { freedf(fw->df); fw->df = e_make_win_list(f); } while(c != WPE_ESC) { if(f->dtmd != DTMD_DATA) return(0); #ifdef PROG if(f->ins == 4) fw->df = e_p_df[0]; #endif if(c == AltF) c = e_file_window(0, fw, f->fb->ft.fb, f->fb->fz.fb); #if MOUSE if(c == MBKEY) c = e_data_ein_mouse(f); #endif if(((c == WPE_CR || c == AltS) && (f->ins < 4 || f->ins == 7)) || ((c == AltA || c == EINFG) && (f->ins > 3 && f->ins < 7))) { if(f->ins == 1) e_ed_man(fw->df->name[fw->nf], f); else if(f->ins == 2) { e_edit(f->ed, fw->df->name[fw->nf]); e_rep_search(f->ed->f[f->ed->mxedt]); } else if(f->ins == 3) { e_edit(f->ed, fw->df->name[fw->nf]); /* WpeCreateFileManager(0, f->ed, fw->df->name[fw->nf]); */ } else if(f->ins == 7) e_switch_window(f->ed->edt[fw->df->anz - fw->nf], f); #ifdef PROG else if(f->ins == 4) { WpeCreateFileManager(5, f->ed, NULL); while(WpeHandleFileManager(f->ed) != WPE_ESC); e_p_df[f->ins - 4] = fw->df; c = AltF; f->save = 1; } else if(f->ins > 4 && f->ins < 7) { e_p_add_df(fw, f->ins); e_p_df[f->ins - 4] = fw->df; c = AltF; } #endif if(f->ins < 4 || f->ins == 7) return(0); } #ifdef PROG else if(f->ins > 3 && f->ins < 7 && (c == AltD || c == ENTF)) { e_p_del_df(fw, f->ins); c = AltF; f->save = 1; } else if(f->ins > 4 && f->ins < 7 && (c == AltE || c == WPE_CR)) { e_p_edit_df(fw, f->ins); c = AltF; f->save = 1; } else if(f->ins == 4 && (c == AltE || c == WPE_CR)) { e_edit(f->ed, fw->df->name[fw->nf]); c = WPE_ESC; } else if(f->ins == 4 && c == AltO) { e_project_options(f); c = AltF; } #endif else if(c != AltF) { if(c == AltBl) c = WPE_ESC; else if(c == WPE_ESC) c = (f->ed->edopt & ED_CUA_STYLE) ? CF4 : AF3; if(f->ins == 7 && ((!(f->ed->edopt & ED_CUA_STYLE) && c == AF3) || ((f->ed->edopt & ED_CUA_STYLE) && c == CF4))) e_close_window(f); if(f->ins == 4 && ((!(f->ed->edopt & ED_CUA_STYLE) && c == AF3) || ((f->ed->edopt & ED_CUA_STYLE) && c == CF4))) { FLWND *fw = (FLWND *) f->ed->f[f->ed->mxedt]->b; fw->df = NULL; e_close_window(f->ed->f[f->ed->mxedt]); return(0); } if(f->ins == 4 && (!e_tst_dfkt(f, c) || !e_prog_switch(f, c))) return(0); if(f->ins > 4 && ((!(f->ed->edopt & ED_CUA_STYLE) && c == AF3) || ((f->ed->edopt & ED_CUA_STYLE) && c == CF4))) return(c); else if((f->ins < 4 || f->ins == 7) && !e_tst_dfkt(f, c)) return(0); else c = AltF; } } return((f->ed->edopt & ED_CUA_STYLE) ? CF4 : AF3); } int e_get_funct_in(char *nstr, FENSTER * f) { return(e_data_first(1, f->ed, nstr)); } int e_funct_in(FENSTER * f) { int n, xa = 37, ya = 2, num = 8; OPTK *opt = MALLOC(num * sizeof(OPTK)); char nstr[2]; opt[0].t = "User Commands"; opt[0].x = 0; opt[0].o = 'U'; opt[1].t = "System Calls"; opt[1].x = 0; opt[1].o = 'S'; opt[2].t = "C-Lib.-Functions"; opt[2].x = 0; opt[2].o = 'C'; opt[3].t = "Devices & Netw. I."; opt[3].x = 0; opt[3].o = 'D'; opt[4].t = "File Formats"; opt[4].x = 0; opt[4].o = 'F'; opt[5].t = "Games & Demos"; opt[5].x = 0; opt[5].o = 'G'; opt[6].t = "Environment, ..."; opt[6].x = 0; opt[6].o = 'E'; opt[7].t = "Maintenance Com."; opt[7].x = 0; opt[7].o = 'M'; n = e_opt_sec_box(xa, ya, num, opt, f, 1); FREE(opt); if(n < 0) return(WPE_ESC); nstr[0] = '1' + n; nstr[1] = '\0'; return(e_get_funct_in(nstr, f)); } #endif xwpe-1.5.30a/progr.h0000644000076400007640000000764610263105405013271 0ustar dulsidulsi#ifndef __PROGR_H #define __PROGR_H /* progr.h */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include #include "WeProg.h" struct e_s_prog { char *language, *compiler, *comp_str, *libraries, *exe_name, *intstr, key; char **filepostfix; /* Expandable array */ int comp_sw, x; }; struct e_prog { int num; char *arguments, *project, *exedir, *sys_include; struct e_s_prog **comp; }; extern int e__project; extern struct e_s_prog e_s_prog; extern struct e_prog e_prog; typedef struct { FILE *fp; BUFFER *b; POINT p; } E_AFILE; #ifdef DJGPP typedef long M_TIME; #else typedef time_t M_TIME; #endif /* we_prog.c */ int e_prog_switch(FENSTER *f, int c); int e_compile(FENSTER *f); int e_p_make(FENSTER *f); int e_run(FENSTER *f); int e_c_project(FENSTER *f); int e_free_arg(char **arg, int argc); int e_rel_brkwtch(FENSTER *f); struct dirfile **e_make_prj_opt(FENSTER *f); int e_comp(FENSTER *f); int e_exec_inf(FENSTER *f, char **argv, int n); int e_print_arg(FILE *fp, char *s, char **argv, int n); int e_show_error(int n, FENSTER *f); int e_make_error_list(FENSTER *f); int e_previous_error(FENSTER *f); int e_next_error(FENSTER *f); int e_line_read(int n, char *s, int max); int e_arguments(FENSTER *f); int e_check_c_file(char *name); int e_prj_ob_file(FENSTER *f); int e_check_header(char *file, M_TIME otime, ECNT *cn, int sw); char *e_cat_string(char *p, char *str); int e_make_arg(char ***arg, char *str); int e_ini_prog(ECNT *cn); int e_copy_prog(struct e_s_prog *out, struct e_s_prog *in); int e_run_options(FENSTER *f); int e_run_c_options(FENSTER *f); int e_project_options(FENSTER *f); int e_system(char *estr, ECNT *cn); int e_d_p_message(char *str, FENSTER *f, int sw); int e_install(FENSTER *f); int e_exec_make(FENSTER *f); int e_run_sh(FENSTER *f); int e_project(FENSTER *f); int e_p_mess_win(char *header, int argc, char **argv, PIC **pic, FENSTER *f); int e_p_add_df(FLWND *fw, int sw); int e_p_del_df(FLWND *fw, int sw); int e_p_edit_df(FLWND *fw, int sw); int e_d_car_ret(FENSTER *f); int e_d_car_mouse(FENSTER *f); int e_add_arg(char ***arg, char *str, int n, int argc); int e_new_message(FENSTER *f); int e_p_cmp_mess(char *srch, BUFFER *b, int *ii, int *kk, int ret); int e_project_name(FENSTER *f); int e_wrt_prj_fl(FENSTER *f); int e_p_update_prj_fl(FENSTER *f); int freedfN(struct dirfile **df, int n); int e_p_red_buffer(BUFFER *b); int e_read_var(FENSTER *f); /* we_progn.c */ int e_scfbol(int n, int mcsw, unsigned char *str, struct wpeSyntaxRule *cs); int e_sc_all(FENSTER *f, int sw); int e_program_opt(FENSTER *f); int e_sc_nw_txt(int y, BUFFER *b, int sw); int *e_sc_txt(int *c_sw, BUFFER *b); void e_pr_c_line(int y, FENSTER *f); int e_add_synt_tl(char *filename, FENSTER *f); E_AFILE *e_aopen(char *name, char *path, int mode); int e_aclose(E_AFILE *ep); char *e_agets(char *str, int n, E_AFILE *ep); char *e_sh_spl1(char *sp, char *str, E_AFILE *fp, int *n); char *e_sh_spl2(char *sp, char *str, E_AFILE *fp, int *n); char *e_sh_spl3(char *sp, char *str, E_AFILE *fp, int *n); char *e_sh_spl4(char *sp, char *str, E_AFILE *fp, int *n); char *e_sh_spl5(char *sp, char *str, E_AFILE *fp, int *n); struct dirfile *e_c_add_df(char *str, struct dirfile *df); int e_find_def(char *name, char *startfile, int mode, char *file, int *num, int *xn, int nold, char *oldfile, struct dirfile **df, int *first); int e_show_nm_f(char *name, FENSTER *f, int oldn, char **oldname); int e_sh_def(FENSTER *f); int e_sh_nxt_def(FENSTER *f); int e_nxt_brk(FENSTER *f); int e_mk_beauty(int sw, int ndif, FENSTER *f); int e_p_beautify(FENSTER *f); /* we_fl_unix.c */ int e_funct(FENSTER *f); int e_funct_in(FENSTER *f); int e_data_first(int sw, ECNT *cn, char *nstr); int e_data_schirm(FENSTER *f); int e_data_eingabe(ECNT *cn); #endif xwpe-1.5.30a/we_fl_fkt.c0000644000076400007640000010047610263105405014066 0ustar dulsidulsi/* we_fl_fkt.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "messages.h" #include "edit.h" #include "makro.h" #ifdef UNIX #include #include #endif #ifdef HAS_LIBZ #include #endif #ifdef DEFPGC #define putc(c, fp) fputc(c, fp) #endif int e_read_help(); int e_read_info(); char *info_file = NULL; char *e_tmp_dir = NULL; /* create complete file name */ char *e_mkfilename(char *dr, char *fn) { char *fl; if (!fn) return(NULL); if(!dr) { fl = MALLOC(strlen(fn) + 1); strcpy(fl, fn); return(fl); } fl = MALLOC(strlen(dr) + strlen(fn) + 2); strcpy(fl, dr); if (dr[0] != '\0' && dr[strlen(dr)-1] != DIRC) strcat(fl, DIRS); strcat(fl, fn); return(fl); } /* read file routine */ POINT e_readin(int i, int j, FILE *fp, BUFFER *b, char *type) { POINT pkt; int ii, k, n = 1, hb = 0; signed char cc, c = 0; WpeMouseChangeShape(WpeWorkingShape); if (i == 0) e_new_line(j, b); while (n == 1) { for (; i < b->mx.x; i++) { if (hb != 2) n = fread(&c, sizeof(char), 1, fp); else { c = cc; hb = 0; } if (n == 1 && c == WPE_CR) { if (DTMD_NORMAL == *type) { *type = DTMD_MSDOS; } i--; continue; } if ((DTMD_HELP == *type) && (c == CtrlH)) { if (!hb) { *(b->bf[j].s+i-1) = HBB; hb = 1; } else i--; n = fread(&c, sizeof(char), 1, fp); } else if ((DTMD_HELP == *type) && (hb == 1)) { n = fread(&cc, sizeof(char), 1, fp); if (cc != HBS) { *(b->bf[j].s+i) = HED; i++; hb = 2; } else n = fread(&c, sizeof(char), 1, fp); } if (n != 1) { *(b->bf[j].s+i) = '\0'; break; } *(b->bf[j].s+i) = c; if (c == WPE_WR) break; } if (n != 1) { if (i == 0 && j > 0) { FREE(b->bf[j].s); for (k = j; k < b->mxlines; k++) b->bf[k] = b->bf[k+1]; (b->mxlines)--; } else { *(b->bf[j].s+i) = WPE_WR; *(b->bf[j].s+i+1) = '\0'; j++; } } else if (i >= b->mx.x) { for (ii = i-1; *(b->bf[j].s+ii) != ' ' && *(b->bf[j].s+ii) != '-' && ii > 0; ii--); if (ii <= 1) ii = i - 1; e_new_line(j+1, b); for (k = ii+1; k <= i; k++) { if (*(b->bf[j].s+k) != '\0') *(b->bf[j+1].s+k-ii-1) = *(b->bf[j].s+k); else *(b->bf[j+1].s+k-ii-1) = ' '; } i = i - ii - 1; *(b->bf[j].s+ii+1) = '\0'; j++; if (i < 0) i = 0; } else if (c == WPE_WR) { *(b->bf[j].s+i) = WPE_WR; *(b->bf[j].s+i+1) = '\0'; e_new_line(++j, b); i = 0; } else { *(b->bf[j].s+i) = ' '; i++; *(b->bf[j].s+i) = '\0'; } b->bf[j-1].len = e_str_len(b->bf[j-1].s); b->bf[j-1].nrc = e_str_nrc(b->bf[j-1].s); } pkt.x = i; pkt.y = j; WpeMouseRestoreShape(); return(pkt); } /* Open new edit window */ int e_new(FENSTER *f) { e_edit(f->ed, ""); return(0); } int e_m_save(FENSTER *f) { int ret = e_save(f); if (ret == WPE_ESC) e_message(0, e_msg[ERR_MSG_SAVE], f); return(ret); } int e_save(FENSTER *f) { BUFFER *b; int ret; if (!DTMD_ISTEXT(f->dtmd)) return(0); for (ret = f->ed->mxedt; ret > 0 && f->ed->f[ret] != f; ret--) ; if (!ret) return(0); WpeMouseChangeShape(WpeWorkingShape); b = f->ed->f[ret]->b; ret = e_write(0, 0, b->mx.x, b->mxlines-1, f, WPE_BACKUP); if (ret != WPE_ESC) f->save = 0; WpeMouseRestoreShape(); return(ret); } /* save all windows */ int e_saveall(FENSTER *f) { int i, ret = 0; ECNT *cn = f->ed; for (i = cn->mxedt; i > 0; i--) { if (cn->f[i]->save != 0 && cn->f[i]->ins != 8) if (e_save(cn->f[i]) == WPE_ESC) ret = WPE_ESC; } if (ret == WPE_ESC) e_message(0, e_msg[ERR_MSG_SAVEALL], f); return(ret); } /* terminate edit session */ int e_quit(FENSTER *f) { int i; char tmp[128]; #if MOUSE int g[4]; #endif ECNT *cn = f->ed; #ifdef DEBUGGER extern int rfildes[], e_d_swtch; e_d_quit_basic(f); #endif for (i = cn->mxedt; i > 0; i--) { if (e_close_window(cn->f[cn->mxedt]) == WPE_ESC) return(WPE_ESC); } if (cn->autosv & 1) e_save_opt(cn->f[0]); #ifdef UNIX if (WpeQuitWastebasket(cn->f[0])) return(0); sprintf(tmp, "rm -rf %s&", e_tmp_dir); system(tmp); #endif #if MOUSE g[0] = 2; fk_mouse(g); #endif e_cls(cn->fb->ws, ' '); fk_locate(0, 0); fk_cursor(1); e_refresh(); WpeExit(0); return(0); } /* write file to disk */ int e_write(int xa, int ya, int xe, int ye, FENSTER *f, int backup) { BUFFER *b; int i = xa, j; char *tmp, *ptmp; FILE *fp; for (j = f->ed->mxedt; j > 0 && f->ed->f[j] != f; j--) ; b = f->ed->f[j]->b; if (f->ins == 8) return(WPE_ESC); ptmp = e_mkfilename(f->dirct, f->datnam); if ((backup == WPE_BACKUP) && (access(ptmp, 0) == 0)) { tmp = e_bakfilename(ptmp); if (access(tmp, 0) == 0) remove(tmp); WpeRenameCopy(ptmp, tmp, f, 1); WpeFree(tmp); } if ((fp = fopen(ptmp, "wb")) == NULL) { e_error(e_msg[ERR_FOPEN], 0, f->fb); FREE(ptmp); return(WPE_ESC); } if (f->filemode >= 0) chmod(ptmp, f->filemode); for (j = ya; j < ye && j < b->mxlines; j++) { if (b->bf[j].s != NULL) for (; i <= b->bf[j].len && i < b->mx.x && *(b->bf[j].s+i)!= '\0' ; i++) { if (*(b->bf[j].s+i) == WPE_WR) { if (DTMD_MSDOS == f->dtmd) { putc(WPE_CR, fp); } putc(WPE_WR, fp); break; } else putc(*(b->bf[j].s+i), fp); } i = 0; } if (b->bf[j].s != NULL) for (i = 0; i < xe && *(b->bf[j].s+i)!= '\0' && i <= b->bf[j].len && i < b->mx.x ; i++) { if (*(b->bf[j].s+i) == WPE_WR) { if (DTMD_MSDOS == f->dtmd) { putc(WPE_CR, fp); } putc(WPE_WR, fp); break; } else putc(*(b->bf[j].s+i), fp); } FREE(ptmp); fclose(fp); return(0); } /* append new qualifier (suffix) to file name */ char *e_new_qual(char *s, char *ns, char *sb) { int i, j; for (i = strlen(s); i >= 0 && s[i] != '.' && s[i] != DIRC; i--) ; if (i < 0 || s[i] == DIRC) strcpy(sb, s); #if !defined(DJGPP) else if (i == 0 || s[i-1] == DIRC) strcpy(sb, s); #endif else { for (j = 0; j < i; j++) sb[j] = s[j]; sb[j] = '\0'; } strcat(sb, "."); strcat(sb, ns); return(sb); } /* make up the bak-file name */ char *e_bakfilename(char* s) { /* "" is the special code for TurboC replace-extension style */ #ifndef SIMPLE_BACKUP_SUFFIX #define SIMPLE_BACKUP_SUFFIX "" #endif static char* bak = NULL; char *result; if (!bak) { bak = getenv("SIMPLE_BACKUP_SUFFIX"); if (!bak) bak = SIMPLE_BACKUP_SUFFIX; } result = WpeMalloc(strlen(s) + strlen(bak) + 5); if (!*bak) return e_new_qual(s, "bak", result); /* TurboC style */ else { strcpy(result, s); strcat(result, bak); return result; } } /* Clear file-/directory-structure */ int freedf(struct dirfile *df) { if (df == NULL) return(-1); if(df->name) { for (; df->anz > 0; (df->anz)--) if (*(df->name+df->anz-1)) FREE(*(df->name+df->anz-1)); FREE(df->name); } FREE(df); df = NULL; return(0); } int e_file_window(int sw, FLWND *fw, int ft, int fz) { int i, c, nsu = 0; int len = 0; char sustr[18]; if(fw->df->anz > 0) { if(fw->nf >= fw->df->anz) fw->nf = fw->df->anz-1; len = strlen(*(fw->df->name+fw->nf)); } e_mouse_bar(fw->xe, fw->ya, fw->ye-fw->ya, 0, fw->f->fb->em.fb); e_mouse_bar(fw->xa, fw->ye, fw->xe-fw->xa, 1, fw->f->fb->em.fb); while (1) { e_pr_file_window(fw, 1, 1, ft, fz, 0); #if MOUSE if((c = e_getch()) < 0) c = fl_wnd_mouse(sw, c, fw); #else c = e_getch(); #endif if(fw->df->anz <= 0) return(WPE_ESC); if (c == CUP || c == CtrlP) { if(fw->nf <= 0) return(c); else fw->nf--; if(fw->srcha < 0) nsu = 0; } else if ((c == CDO || c == CtrlN) && fw->nf < fw->df->anz-1) { fw->nf++; if(fw->srcha < 0) nsu = 0; } else if (c == CLE || c == CtrlB) { if(fw->ja <= 0) return(c); else fw->ja--; } else if (c == CRI || c == CtrlF) { if(fw->ja > len-2) return(c); else fw->ja++; } else if (c == BUP) { if(fw->nf <= 0) return(c); if((fw->nf -= (fw->ye-fw->ya-1)) < 0) fw->nf = 0; if(fw->srcha < 0) nsu = 0; } else if (c == BDO) { if((fw->nf += (fw->ye-fw->ya-1)) > fw->df->anz-1) fw->nf = fw->df->anz-1; if(fw->srcha < 0) nsu = 0; } else if (c == POS1 || c == CtrlA || c == CBUP) { fw->nf = 0; nsu = 0; fw->ja = fw->srcha > 0 ? fw->srcha : 0; } else if (c == ENDE || c == CtrlE || c == CBDO) fw->nf = fw->df->anz-1; else if (c >= 32 && c < 127) { sustr[nsu] = c; sustr[++nsu] = '\0'; if(fw->srcha < 0) { for(i = nsu > 1 ? fw->nf : fw->nf+1; i < fw->df->anz; i++) { for(c = 0; *(fw->df->name[i]+c) && ( *(fw->df->name[i]+c) <= 32 || *(fw->df->name[i]+c) >= 127); c++); #ifdef UNIX if(!WpeIsXwin() && *(fw->df->name[i]+c-1) == 32) c += 3; #endif if(strncmp(fw->df->name[i]+c, sustr, nsu) >= 0) break; } } else { for(i = 0; i < fw->df->anz && strncmp(fw->df->name[i]+fw->srcha, sustr, nsu) < 0; i++); } fw->nf = i < fw->df->anz ? i : fw->df->anz-1; } else if (c == CCLE) return(c); else if (c == CCRI) return(c); else if(c) { nsu = 0; return(c); } else if(fw->srcha < 0) nsu = 0; if(fw->nf > fw->df->anz-1) fw->nf = fw->df->anz-1; len=strlen(*(fw->df->name+fw->nf)); if(fw->ja >= len) fw->ja = !len ? len : len-1; if(fw->nf-fw->ia >= fw->ye - fw->ya) fw->ia = fw->nf+fw->ya-fw->ye+1; else if(fw->nf-fw->ia < 0) fw->ia = fw->nf; } return(0); } int e_pr_file_window(FLWND *fw, int c, int sw, int ft, int fz, int fs) { #ifdef NEWSTYLE int xrt = 0; #endif int i = fw->ia, len; if (fw->df != NULL) { for (; i < fw->df->anz && i-fw->ia < fw->ye-fw->ya; i++) { if ((len=strlen(*(fw->df->name+i))) < 0) len = 0; if (i == fw->nf && c && len >= fw->ja) { e_pr_nstr(fw->xa+1, fw->ya+i-fw->ia, fw->xe-fw->xa, *(fw->df->name+i)+fw->ja, fz, fz); #ifdef NEWSTYLE xrt = 1; #endif } else if (i == fw->nf && len >= fw->ja) e_pr_nstr(fw->xa+1, fw->ya+i-fw->ia, fw->xe-fw->xa, *(fw->df->name+i)+fw->ja, fs, fs); else if (len >= fw->ja) e_pr_nstr(fw->xa+1, fw->ya+i-fw->ia, fw->xe-fw->xa, *(fw->df->name+i)+fw->ja, ft, ft); else if (len < fw->ja) e_blk(fw->xe-fw->xa-1, fw->xa+1, fw->ya+i-fw->ia, ft); /* if ((len -= fw->ja) < 0) len = 0; e_blk(fw->xe-fw->xa-len-1, fw->xa+len+1, fw->ya+i-fw->ia, ft); */ if (sw) { fw->nyfo = e_lst_zeichen(fw->xe, fw->ya, fw->ye-fw->ya, 0, fw->f->fb->em.fb, fw->df->anz, fw->nyfo, fw->nf); fw->nxfo = e_lst_zeichen(fw->xa, fw->ye, fw->xe-fw->xa, 1, fw->f->fb->em.fb, len, fw->nxfo, fw->ja); } } } for (; i-fw->ia < fw->ye-fw->ya; i++) e_blk(fw->xe-fw->xa, fw->xa, fw->ya+i-fw->ia, ft); #ifdef NEWSTYLE e_make_xrect(fw->xa, fw->ya, fw->xe-1, fw->ye-1, 1); if (xrt) e_make_xrect_abs(fw->xa, fw->ya+fw->nf-fw->ia, fw->xe-1, fw->ya+fw->nf-fw->ia, 0); #endif return(0); } struct help_ud { struct help_ud *next; char *str, *nstr, *pstr, *file; int x, y, sw; } *ud_help; #ifdef HAS_LIBZ typedef gzFile IFILE; #define e_i_fgets(s, n, p) gzgets(p, s, n) #define e_i_fclose(p) gzclose(p) #else typedef struct { FILE *fp; int sw; } IFILE; #define e_i_fgets(s, n, p) fgets(s, n, p->fp) #endif int e_mkdir_path(char *path) { int i, len; char *tmp = MALLOC(((len=strlen(path))+1)*sizeof(char)); if (!tmp) return(-1); strcpy(tmp, path); for (i = len; i > 0 && tmp[i] != DIRC; i--) ; if (i > 0) { tmp[i] = '\0'; if (access(tmp, 0)) { e_mkdir_path(tmp); mkdir(tmp, 0700); } } FREE(tmp); return(0); } IFILE *e_i_fopen(char *path, char *stat) { char *tmp2; #ifdef HAS_LIBZ IFILE *fp; if (!path) { return(NULL); } if ((fp = gzopen(path, stat))) { return(fp); } if (!(tmp2 = MALLOC((strlen(path)+11)*sizeof(char)))) { FREE(fp); return(NULL); } strcpy(tmp2, path); strcat(tmp2, ".info"); if ((fp = gzopen(tmp2, stat))) { FREE(tmp2); return(fp); } strcpy(tmp2, path); strcat(tmp2, ".gz"); if ((fp = gzopen(tmp2, stat))) { FREE(tmp2); return(fp); } strcpy(tmp2, path); strcat(tmp2, ".Z"); if ((fp = gzopen(tmp2, stat))) { FREE(tmp2); return(fp); } strcpy(tmp2, path); strcat(tmp2, ".info.gz"); if ((fp = gzopen(tmp2, stat))) { FREE(tmp2); return(fp); } strcpy(tmp2, path); strcat(tmp2, ".info.Z"); if ((fp = gzopen(tmp2, stat))) { FREE(tmp2); return(fp); } FREE(fp); FREE(tmp2); return(NULL); #else extern char *e_tmp_dir; char *tmp, *command; int len; IFILE *fp = MALLOC(sizeof(IFILE)); if (!fp) return(NULL); if (!path) { FREE(fp); return(NULL); } if ((fp->fp = fopen(path, stat))) { fp->sw = 0; return(fp); } if (!(tmp2 = MALLOC((strlen(path)+11)*sizeof(char)))) { FREE(fp); return(NULL); } strcpy(tmp2, path); strcat(tmp2, ".info"); if ((fp->fp = fopen(tmp2, stat))) { FREE(tmp2); fp->sw = 0; return(fp); } strcpy(tmp2, path); strcat(tmp2, ".gz"); if (access(tmp2, 0)) { strcpy(tmp2, path); strcat(tmp2, ".Z"); if (access(tmp2, 0)) { strcpy(tmp2, path); strcat(tmp2, ".info.gz"); if (access(tmp2, 0)) { strcpy(tmp2, path); strcat(tmp2, ".info.Z"); if (access(tmp2, 0)) { FREE(fp); FREE(tmp2); return(NULL); } } } } if (!(tmp = MALLOC((strlen(path)+(len=strlen(e_tmp_dir))+2)*sizeof(char)))) { FREE(fp); FREE(tmp2); return(NULL); } strcpy(tmp, e_tmp_dir); if (path[0] != DIRC) { tmp[len] = DIRC; tmp[len+1] = '\0'; } strcat(tmp, path); if ((fp->fp = fopen(tmp, stat))) { fp->sw = 1; FREE(tmp); FREE(tmp2); return(fp); } command = MALLOC((strlen(tmp) + strlen(tmp2) + 14) * sizeof(char)); if (!command) { FREE(fp); FREE(tmp); FREE(tmp2); return(NULL); } e_mkdir_path(tmp); sprintf(command, "gunzip < %s > %s", tmp2, tmp); FREE(tmp2); system(command); FREE(command); fp->fp = fopen(tmp, stat); FREE(tmp); if (!fp->fp) { FREE(fp); return(NULL); } fp->sw = 1; return(fp); #endif } #ifndef HAS_LIBZ int e_i_fclose(IFILE *fp) { int ret = fclose(fp->fp); FREE(fp); return(ret); } #endif int e_read_help(char *str, FENSTER *f, int sw) { IFILE *fp; char *ptmp, tstr[256]; int i; ptmp = e_mkfilename(LIBRARY_DIR, HELP_FILE); fp = e_i_fopen(ptmp, "rb"); FREE(ptmp); if (!fp) return(1); e_close_buffer(f->b); if ((f->b = (BUFFER *) MALLOC(sizeof(BUFFER))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); if ((f->b->bf = (STRING *) MALLOC(MAXLINES*sizeof(STRING))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); f->b->f = f; f->b->b = e_set_pnt(0, 0); f->b->mx = e_set_pnt(f->ed->maxcol, MAXLINES); f->b->mxlines = 0; f->b->fb = f->fb; f->b->cn = f->ed; f->b->ud = NULL; e_new_line(0, f->b); if (str && str[0]) { while ((ptmp = e_i_fgets(tstr, 256, fp)) && !WpeStrcstr(tstr, str)) ; if (ptmp && !sw) { strcpy(f->b->bf[f->b->mxlines-1].s, tstr); f->b->bf[f->b->mxlines-1].len = e_str_len(f->b->bf[f->b->mxlines-1].s); f->b->bf[f->b->mxlines-1].nrc = e_str_nrc(f->b->bf[f->b->mxlines-1].s); } } if (sw) { char *tp = NULL, tmp[128], ts[2]; ts[0] = HHD; ts[1] = '\0'; while ((ptmp = e_i_fgets(tstr, 256, fp)) && !(tp = strstr(tstr, ts))) ; if (!str || !str[0]) while((ptmp = e_i_fgets(tstr, 256, fp)) && !(tp = strstr(tstr, ts))) ; if (!ptmp) { e_i_fclose(fp); return(e_error("No Next Page", 0, f->fb)); } else { for (i = 0; (tmp[i] = tp[i]) && tp[i] != HED; i++) ; tmp[i] = HED; tmp[i+1] = '\0'; if ((ud_help->str = MALLOC((strlen(tmp)+1)*sizeof(char))) != NULL) strcpy(ud_help->str, tmp); strcpy(f->b->bf[f->b->mxlines-1].s, tstr); f->b->bf[f->b->mxlines-1].len = e_str_len(f->b->bf[f->b->mxlines-1].s); f->b->bf[f->b->mxlines-1].nrc = e_str_nrc(f->b->bf[f->b->mxlines-1].s); } } while(e_i_fgets(tstr, 256, fp)) { for(i = 0; tstr[i]; i++) if (tstr[i] == HFE) { e_i_fclose(fp); return(0); } e_new_line(f->b->mxlines, f->b); strcpy(f->b->bf[f->b->mxlines-1].s, tstr); f->b->bf[f->b->mxlines-1].len = e_str_len(f->b->bf[f->b->mxlines-1].s); f->b->bf[f->b->mxlines-1].nrc = e_str_nrc(f->b->bf[f->b->mxlines-1].s); } e_i_fclose(fp); return(2); } int e_help_ret(FENSTER *f) { BUFFER *b = f->b; int i, j; char str[126]; struct help_ud *next; for(i = b->b.x; i >= 0 && b->bf[b->b.y].s[i] != HED; i--) { if(b->bf[b->b.y].s[i] == HBG) { str[0] = HHD; for(j = i+1; j < b->bf[b->b.y].len && (str[j-i] = b->bf[b->b.y].s[j]) != HED; j++); str[j-i+1] = '\0'; if((next = MALLOC(sizeof(struct help_ud))) != NULL) { next->str = MALLOC((strlen(str)+1) * sizeof(char)); if(next->str) strcpy(next->str, str); if(ud_help && ud_help->file) { next->file = MALLOC((strlen(ud_help->file)+1) * sizeof(char)); if(next->file) strcpy(next->file, ud_help->file); } else next->file = NULL; next->nstr = next->pstr = NULL; next->x = b->b.x; next->y = b->b.y; next->sw = ud_help ? ud_help->sw : 0; next->next = ud_help; ud_help = next; } if(ud_help->sw) e_read_info(str, f, ud_help->file); else e_read_help(str, f, 0); b = f->b; b->b.x = b->b.y = 0; e_cursor(f, 1); e_schirm(f, 1); return(0); } else if(b->bf[b->b.y].s[i] == HNF) { for(i++; i < b->bf[b->b.y].len && b->bf[b->b.y].s[i] != HED; i++); for(i++, j = 0; j+i < b->bf[b->b.y].len && (str[j] = b->bf[b->b.y].s[j+i]) != HED; j++); str[j] = '\0'; if((next = MALLOC(sizeof(struct help_ud))) != NULL) { next->str = MALLOC(4 * sizeof(char)); if(next->str) strcpy(next->str, "Top"); next->file = MALLOC((strlen(str)+1) * sizeof(char)); if(next->file) strcpy(next->file, str); next->sw = 1; next->next = ud_help; next->x = b->b.x; next->y = b->b.y; next->nstr = next->pstr = NULL; ud_help = next; } e_read_info("Top", f, ud_help->file); b = f->b; b->b.x = b->b.y = 0; e_cursor(f, 1); e_schirm(f, 1); return(0); } else if(b->bf[b->b.y].s[i] == HFB) { for(j = i+1; j < b->bf[b->b.y].len && (str[j-i-1] = b->bf[b->b.y].s[j]) != HED; j++); str[j-i-1] = '\0'; return(e_ed_man(str, f)); } else if(b->bf[b->b.y].s[i] == HHD) return(e_help_last(f)); } return(1); } int e_help_last(FENSTER *f) { struct help_ud *last = ud_help; if (!last) return(1); if (last->sw) { if (last->next == NULL) e_read_info(NULL, f, NULL); else e_read_info(last->next->str, f, last->next->file); } else { if (last->next == NULL) e_read_help(NULL, f, 0); else e_read_help(last->next->str, f, 0); } f->b->b.x = last->x; f->b->b.y = last->y; e_cursor(f, 1); e_schirm(f, 1); ud_help = last->next; FREE(last->str); FREE(last); return(0); } int e_help_next(FENSTER *f, int sw) { struct help_ud *last = ud_help; if(last && last->sw) { if(sw && last->nstr) { if(last->str) FREE(last->str); if(last->pstr) FREE(last->pstr); last->str = last->nstr; last->nstr = NULL; } else if(!sw && last->pstr) { if(last->str) FREE(last->str); if(last->nstr) FREE(last->nstr); last->str = last->pstr; last->pstr = NULL; } else return(e_error(sw ? "No Next Page" : "No Previous Page", 0, f->fb)); e_read_info(last->str, f, last->file); f->b->b.x = f->b->b.y = 0; e_cursor(f, 1); e_schirm(f, 1); return(0); } else { if(sw) { if((last = MALLOC(sizeof(struct help_ud))) != NULL) { last->str = NULL; last->file = NULL; last->x = last->y = 0; last->nstr = last->pstr = NULL; last->sw = 0; last->next = ud_help; ud_help = last; e_read_help(ud_help->next ? ud_help->next->str : NULL, f, 1); f->b->b.x = f->b->b.y = 0; e_cursor(f, 1); e_schirm(f, 1); return(0); } } else return(e_help_last(f)); } return(e_error(sw ? "No Next Page" : "No Previous Page", 0, f->fb)); } int e_help_free(FENSTER *f) { struct help_ud *next, *last = ud_help; while (last) { next = last->next; if (last->str) FREE(last->str); if (last->pstr) FREE(last->pstr); if (last->nstr) FREE(last->nstr); if (last->file) FREE(last->file); FREE(last); last = next; } ud_help = NULL; return(0); } int e_help_comp(FENSTER *f) { BUFFER *b = f->b; int i, j, k, hn = 0, sn = 0; char **swtch = MALLOC(sizeof(char *)); char **hdrs = MALLOC(sizeof(char *)); char str[256]; if (f->dtmd != DTMD_HELP) return(1); for (j = 0; j < b->mxlines; j++) { for (i = 0; i < b->bf[j].len; i++) { if (b->bf[j].s[i] == HBG) { for (k = i+1; k < b->bf[j].len && (str[k-i-1] = b->bf[j].s[k]) != HED && str[k-i-1] != HBG && str[k-i-1] != HHD && str[k-i-1] != HFE ; k++) ; if (str[k-i-1] != HED) { e_error("Error in Switch!", 0, f->fb); b->b.x = k; b->b.y = j; e_cursor(f, 1); return(2); } str[k-i-1] = '\0'; sn++; swtch = REALLOC(swtch, sn * sizeof(char *)); swtch[sn-1] = MALLOC((strlen(str) + 1) + sizeof(char)); strcpy(swtch[sn-1], str); } } } for (j = 0; j < b->mxlines; j++) { for (i = 0; i < b->bf[j].len; i++) { if (b->bf[j].s[i] == HHD) { for (k = i+1; k < b->bf[j].len && (str[k-i-1] = b->bf[j].s[k]) != HED && str[k-i-1] != HBG && str[k-i-1] != HHD && str[k-i-1] != HFE ; k++) ; if (str[k-i-1] != HED) { e_error("Error in Header!", 0, f->fb); b->b.x = k; b->b.y = j; e_cursor(f, 1); return(2); } str[k-i-1] = '\0'; hn++; hdrs = REALLOC(hdrs, hn * sizeof(char *)); hdrs[hn-1] = MALLOC((strlen(str) + 1) + sizeof(char)); strcpy(hdrs[hn-1], str); } } } for (j = 0; j < sn; j++) { for (i = 0; i < hn; i++) if(!WpeStrccmp(swtch[j], hdrs[i])) break; if (i >= hn) { sprintf(str, "Switch \'%s\' has no Header!", swtch[j]); e_error(str, 0, f->fb); goto ende; } } for (j = 0; j < hn; j++) { for (i = 0; i < sn; i++) if(!WpeStrccmp(swtch[i], hdrs[j])) break; if (i >= sn) { sprintf(str, "No Jump to Header \'%s\'!", hdrs[j]); e_error(str, 0, f->fb); goto ende; } } ende: for (i = 0; i < sn; i++) FREE(swtch[i]); for (i = 0; i < hn; i++) FREE(hdrs[i]); FREE(swtch); FREE(hdrs); return(0); } /* Help window */ int e_help(FENSTER *f) { extern char *e_hlp; e_hlp = NULL; return(e_help_loc(f, 0)); } int e_info(FENSTER *f) { extern char *e_hlp; e_hlp = NULL; return(e_help_loc(f, 1)); } #define IFE 31 int e_mk_info_button(char *str) { int i, bg, nd, len = strlen(str); if (str[0] == '\n' || str[0] == '\0') return(1); for (bg = 0; str[bg] && isspace(str[bg]); bg++) ; for (nd = bg; str[nd] && (str[nd] != ':' || (!isspace(str[nd+1]) && (str[nd+1] != '(') && (str[nd+1] != ':' || (!isspace(str[nd+2]) && str[nd+2] != '.')))); nd++) ; if (!str[nd]) return(-1); if (str[nd+1] != ':') { for (nd++; str[nd] && isspace(str[nd]); nd++); if (str[nd] == '(') { for (i = len; i >= bg; i--) str[i+1] = str[i]; str[bg] = HNF; str[nd+1] = HED; for (nd++; str[nd] && str[nd] && str[nd] != ')'; nd++); if (str[nd]) str[nd] = HED; return(0); } for (; str[nd] && (str[nd] != '.' || isalnum1(str[nd+1])); nd++); if (!str[nd]) return(-1); for (bg = nd; str[bg] != ':' || !isspace(str[bg+1]); bg--); for (bg++; isspace(str[bg]); bg++); } for (i = len; i >= nd; i--) str[i+2] = str[i]; str[nd+1] = HED; for (; i >= bg; i--) str[i+1] = str[i]; str[bg] = HBG; return(0); } int e_mk_info_mrk(char *str) { int bg, nd = -1; do { for (bg = nd+1; str[bg] && str[bg] != '`'; bg++) ; for (nd = bg; str[nd] && str[nd] != '\''; nd++) ; if (str[nd]) { str[bg] = HBB; str[nd] = HED; } } while(str[nd]); return(0); } IFILE *e_info_jump(char *str, char **path, IFILE *fp) { IFILE *fpn; int i, j, n, anz = 0; char *ptmp, *fstr, tstr[256], nfl[128]; struct FL_INFO{ char *name; int line; } **files = MALLOC(1); while (e_i_fgets(tstr, 256, fp) && tstr[0] != IFE) { for (i = 0; (nfl[i] = tstr[i]) && tstr[i] != ':'; i++) ; if (!tstr[i]) continue; nfl[i] = '\0'; anz++; files = REALLOC(files, anz * sizeof(struct FL_INFO *)); files[anz-1] = MALLOC(sizeof(struct FL_INFO)); files[anz-1]->name = MALLOC((strlen(nfl)+1)*sizeof(char)); strcpy(files[anz-1]->name, nfl); files[anz-1]->line = atoi(tstr+i+1); } i = (strlen(str) + 6); fstr = MALLOC((i+1) * sizeof(char)); strcat(strcpy(fstr, "Node: "), str); if (fstr[n = strlen(fstr)-1] == HED) { fstr[n] = '\0'; i--; } while ((ptmp = e_i_fgets(tstr, 256, fp)) && strncmp(tstr, fstr, i)) ; if (ptmp) { n = atoi(tstr+i+1); for (i = 1; i < anz && n >= files[i]->line; i++) ; if (files[i-1]->name[0] == DIRC) { ptmp = MALLOC((strlen(files[i-1]->name)+1)*sizeof(char)); strcpy(ptmp, files[i-1]->name); } else { for (n = strlen(*path)-1; n >= 0 && *(*path+n) != DIRC; n--) ; n++; ptmp = MALLOC((strlen(files[i-1]->name)+n+1)*sizeof(char)); for (j = 0; j < n; j++) ptmp[j] = *(*path+j); ptmp[j] = '\0'; strcat(ptmp, files[i-1]->name); } if ((fpn = e_i_fopen(ptmp, "rb")) != NULL) { e_i_fclose(fp); fp = fpn; FREE(*path); *path = ptmp; } else FREE(ptmp); } FREE(fstr); for (i = 0; i < anz; i++) { FREE(files[i]->name); FREE(files[i]); } FREE(files); return(fp); } char *e_mk_info_pt(char *str, char *node) { int i; char *ptmp, tmp[128]; do { if (!(ptmp = strstr(str, node))) return(NULL); while (*ptmp && *ptmp != ',' && *ptmp != ':') ptmp++; if (!*ptmp) return(NULL); } while (*ptmp == ','); for (ptmp++; isspace(*ptmp); ptmp++) ; for (i = 0; (tmp[i] = ptmp[i]) && ptmp[i] != ',' && ptmp[i] != '\n'; i++) ; tmp[i] = '\0'; if (i == 0) return(NULL); ptmp = MALLOC((strlen(tmp)+1)*sizeof(char)); strcpy(ptmp, tmp); return(ptmp); } char *e_mk_info_path(char *path, char *file) { int n; char *tp; if (!info_file || !*info_file) return(NULL); if (file[0] == DIRC) { if (path && !strcmp(path, file)) { FREE(path); return(NULL); } else if(path) FREE(path); if (!(path = MALLOC((strlen(file) + 1) * sizeof(char)))) return(NULL); return (strcpy(path, file)); } tp = info_file; if (path) { n = strlen(path) - strlen(file); if (n > 1) path[n - 1] = PTHD; else if (n == 1) path[n++] = PTHD; while (strncmp(tp, path, n) && (tp = strchr(tp, PTHD)) != NULL && *++tp); if (tp == NULL || !*tp || !*(tp += n)) return(NULL); FREE(path); } for (n = 0; tp[n] && tp[n] != PTHD; n++); if (!(path = MALLOC((strlen(file) + n + 2) * sizeof(char)))) return(NULL); strncpy(path, tp, n); if (n > 1) path[n++] = DIRC; strcpy(path + n, file); return(path); } int e_read_info(char *str, FENSTER *f, char *file) { IFILE *fp = NULL; char *path = NULL, *ptmp, tstr[256], fstr[128]; int i, len, sw = 0, bsw = 0; if(!str) str = "Top"; if(str[0] == HHD) str++; strcat(strcpy(fstr, "Node: "), str); len = strlen(fstr); if(fstr[len-1] == HED) fstr[len-1] = '\0'; if(!file || !file[0]) file = "dir"; do { path = e_mk_info_path(path, file); fp = e_i_fopen(path, "rb"); } while(!fp && path); if(!fp) return(1); e_close_buffer(f->b); if( (f->b = (BUFFER *) MALLOC(sizeof(BUFFER))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); if( (f->b->bf = (STRING *) MALLOC(MAXLINES*sizeof(STRING))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); f->b->f = f; f->b->b = e_set_pnt(0, 0); f->b->mx = e_set_pnt(f->ed->maxcol, MAXLINES); f->b->mxlines = 0; f->b->fb = f->fb; f->b->cn = f->ed; f->b->ud = NULL; e_new_line(0, f->b); while((ptmp = e_i_fgets(tstr, 256, fp)) != NULL) { if(!strncmp(tstr, "Indirect:", 9)) fp = e_info_jump(str, &path, fp); else if(!strncmp(tstr, "File:", 5) && strstr(tstr, fstr)) break; } FREE(path); if(ptmp) { ud_help->nstr = e_mk_info_pt(tstr, "Next"); ud_help->pstr = e_mk_info_pt(tstr, "Prev"); } if(!strcmp(file, "dir")) while((ptmp = e_i_fgets(tstr, 256, fp)) && WpeStrnccmp(tstr, "* Menu:", 7)); else while((ptmp = e_i_fgets(tstr, 256, fp)) && tstr[0] == '\n'); if(ptmp) { if(!sw && !WpeStrnccmp(tstr, "* Menu:", 7)) sw = 1; for(i = len = strlen(tstr); i >= 0; i--) tstr[i+1] = tstr[i]; tstr[0] = HHD; tstr[len+1] = HED; tstr[len+1] = '\0'; strcpy(f->b->bf[f->b->mxlines-1].s, tstr); f->b->bf[f->b->mxlines-1].len = e_str_len(f->b->bf[f->b->mxlines-1].s); f->b->bf[f->b->mxlines-1].nrc = e_str_nrc(f->b->bf[f->b->mxlines-1].s); } while(e_i_fgets(tstr, 256, fp)) { for(i = 0; tstr[i]; i++) if(tstr[i] == IFE) { e_i_fclose(fp); return(0); } if(bsw == 1) { bsw = e_mk_info_button(tstr); for(ptmp = tstr; (ptmp = WpeStrcstr(ptmp, "*note")); ptmp += 5) bsw = e_mk_info_button(ptmp+5); } else if(!sw && !WpeStrnccmp(tstr, "* Menu:", 7)) sw = 1; else if((ptmp = WpeStrcstr(tstr, "*note"))) { bsw = e_mk_info_button(ptmp+5); for(ptmp += 5; (ptmp = WpeStrcstr(ptmp, "*note")); ptmp += 5) bsw = e_mk_info_button(ptmp+5); } else if(sw && tstr[0] == '*') { bsw = e_mk_info_button(tstr+1); for(ptmp = tstr+1; (ptmp = WpeStrcstr(ptmp, "*note")); ptmp += 5) bsw = e_mk_info_button(ptmp+5); } e_mk_info_mrk(tstr); e_new_line(f->b->mxlines, f->b); strcpy(f->b->bf[f->b->mxlines-1].s, tstr); f->b->bf[f->b->mxlines-1].len = e_str_len(f->b->bf[f->b->mxlines-1].s); f->b->bf[f->b->mxlines-1].nrc = e_str_nrc(f->b->bf[f->b->mxlines-1].s); } e_i_fclose(fp); return(2); } int e_help_loc(FENSTER *f, int sw) { extern char *e_hlp; int i; char *tmp = NULL; struct help_ud *next; if (!sw) tmp = e_hlp; for (i = f->ed->mxedt; i >= 0; i--) { if (!strcmp(f->ed->f[i]->datnam, "Help")) { e_switch_window(f->ed->edt[i], f); if (ud_help && sw != ud_help->sw) { e_close_window(f->ed->f[f->ed->mxedt]); i = -1; } break; } } if (i < 0) e_edit(f->ed, "Help"); if ((tmp || sw) && (next = MALLOC(sizeof(struct help_ud)))) { if (tmp) { next->str = MALLOC((strlen(tmp)+1) * sizeof(char)); if (next->str) strcpy(next->str, tmp); } else next->str = NULL; next->file = NULL; next->x = next->y = 0; next->nstr = next->pstr = NULL; next->sw = sw; next->next = ud_help; ud_help = next; } if (sw) e_read_info(NULL, f->ed->f[f->ed->mxedt], NULL); else e_read_help(tmp, f->ed->f[f->ed->mxedt], 0); e_schirm(f->ed->f[f->ed->mxedt], 1); return(0); } int e_help_options(FENSTER *f) { char str[128]; if (!info_file) { info_file = MALLOC(1); info_file[0] = '\0'; } strcpy(str, info_file); if (e_add_arguments(str, "Info-Path", f, 0 , AltI, NULL)) { info_file = REALLOC(info_file, strlen(str) + 1); strcpy(info_file, str); } return(0); } int e_hp_next(FENSTER *f) { int i; for (i = f->ed->mxedt; i >= 0; i--) { if (!strcmp(f->ed->f[i]->datnam, "Help")) { e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; break; } } if (i < 0) return(e_help_loc(f, 0)); else return(e_help_next(f, 1)); } int e_hp_prev(FENSTER *f) { int i; for (i = f->ed->mxedt; i >= 0; i--) { if (!strcmp(f->ed->f[i]->datnam, "Help")) { e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; break; } } if (i < 0) return(e_help_loc(f, 0)); else return(e_help_next(f, 0)); } int e_hp_back(FENSTER *f) { int i; for (i = f->ed->mxedt; i >= 0; i--) { if (!strcmp(f->ed->f[i]->datnam, "Help")) { e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; break; } } if (i < 0) return(e_help_loc(f, 0)); else return(e_help_last(f)); } int e_hp_ret(FENSTER *f) { int i; for (i = f->ed->mxedt; i >= 0; i--) { if (!strcmp(f->ed->f[i]->datnam, "Help")) { e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; break; } } if (i < 0) return(e_help_loc(f, 0)); else return(e_help_ret(f)); } /* Give a context-sensitive help for the identifier under cursor */ int e_topic_search(FENSTER *f) { int x, y; char *s; BUFFER *b; char item[100], *ptr=item; if (!DTMD_ISTEXT(f->ed->f[f->ed->mxedt]->dtmd)) return(0); b = f->ed->f[f->ed->mxedt]->b; y=b->b.y; x=b->b.x; s=b->bf[y].s; if(!isalnum(s[x]) && s[x]!='_') return (0); for(;x>=0 && (isalnum(s[x])||s[x]=='_');x--); if(x<0 && !isalnum(s[0]) && s[0]!='_') return(0); x++; for(; x<=b->bf[y].len && (isalnum(s[x])||s[x]=='_');x++,ptr++) *ptr=s[x]; *ptr=0; e_ed_man(item, f); return(0); } xwpe-1.5.30a/edit.h0000644000076400007640000006017510263105405013061 0ustar dulsidulsi#ifndef __EDIT_H #define __EDIT_H /* edit.h */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ /* Header file for FK-editor */ #define VERSION "1.5.29a" #include "Xwpe.h" #include "WeString.h" #include "options.h" #include "model.h" #include "keys.h" #include #include #include #include #include #ifdef HAVE_LIBGPM #include #endif #ifdef UNIX #include #include "unixmakr.h" #include "unixkeys.h" #ifndef TERMCAP #include #endif extern int MAXSLNS, MAXSCOL, MENOPT; #define MAXEDT 35 #endif #define MAXLINES 10 #define MAXCOLUM 120 #define WPE_NOBACKUP 1 #define WPE_BACKUP 0 #if MOUSE struct mouse { int x; int y; int k; }; #endif #define DTMD_NORMAL 'n' /* Normal text file */ #define DTMD_MSDOS 'm' /* MS-DOS text file */ #define DTMD_HELP 'h' /* Help window */ #define DTMD_DATA 'D' /* Data/project windows */ #define DTMD_FILEMANAGER 'F' /* File manager */ /* File/directory dropdown of previous files/directories on the file manager */ #define DTMD_FILEDROPDOWN 'M' #define DTMD_ISTEXT(x) (x > 'Z') #define DTMD_ISMARKABLE(x) (x > DTMD_HELP) /* Means end marks can be shown*/ struct dirfile { int anz; /* number elements in the list */ char **name; /* the list elements */ }; typedef struct PNT { int x; int y; } POINT; typedef struct CLR { int f; int b; int fb; } COLOR; typedef struct PICSTR { char *p; POINT a; POINT e; } PIC; typedef struct FND { char search[80], replace[80]; char file[80]; /* filename or pattern to search/open */ char *dirct; int sn; int rn; unsigned int sw; } FIND; typedef struct frb { COLOR er; /* editor window border and text */ COLOR es; /* special signs (maximize/kill) on editor window border */ COLOR et; /* normal text in editor window */ COLOR ez; /* marked text in editor window */ COLOR ek; /* found/marked word in editor window */ COLOR em; /* scrollbar */ COLOR hh; /* Help header */ COLOR hb; /* button in Help */ COLOR hm; /* marked word in Help */ COLOR db; /* breakpoint set */ COLOR dy; /* stop at breakpoint */ COLOR mr; /* submenu border */ COLOR ms; /* menu shortkey text */ COLOR mt; /* menu text */ COLOR mz; /* active menu text */ COLOR df; /* desktop */ COLOR nr; /* message window border and text */ COLOR ne; /* special signs (maximize/kill) on message window border */ COLOR nt; /* normal text for widgets in message window */ COLOR nsnt; /* widget selector shortkey in message window */ COLOR fr; /* passive entry */ COLOR fa; /* active entry */ COLOR ft; /* normal data text */ COLOR fz; /* active, marked data text */ COLOR frft; /* passive, marked data text */ COLOR fs; /* passive switch */ COLOR nsft; /* switch selector shortkey */ COLOR fsm; /* active switch */ COLOR nz; /* normal/passive button text */ COLOR ns; /* button shortkey text */ COLOR nm; /* active button text */ COLOR of; COLOR ct; /* normal program text */ COLOR cr; /* reserved keywords in program */ COLOR ck; /* constants in program */ COLOR cp; /* preprocessor command */ COLOR cc; /* comments in program */ char dc; /* desktop fill character */ char ws; } FARBE; typedef struct undo { int type; POINT b, a, e; union { char c; void *pt; } u; struct undo *next; } Undo; typedef struct STR { unsigned char *s; int len; /* Length of string not counting '\n' at the end */ int nrc; /*int size;*/ /* Memory allocated for the string */ } STRING; typedef struct BFF { STRING *bf; /* bf[i] is the i-th line of the buffer */ POINT b; /* cursor coordinates in window (at least in some contexts) */ POINT mx; /* maximum column and line */ int mxlines; /* number of lines */ int cl, clsv; Undo *ud, *rd; struct CNT *cn; struct FNST *f; FARBE *fb; } BUFFER; typedef struct SCHRM { POINT mark_begin; POINT mark_end; POINT ks; POINT pt[9]; POINT fa; POINT fe; POINT a; POINT e; POINT c; FARBE *fb; #ifdef DEBUGGER POINT da, de; int *brp; #endif } SCHIRM; typedef struct OPTION { char *t; int x; int s; int as; } OPT; typedef struct WOPTION { char *t; int x, s, n, as; } WOPT; typedef struct OPTKAST { char *t; int x; char o; int (*fkt)(struct FNST *); } OPTK; typedef struct { int position; int width; int no_of_items; OPTK *menuitems; } MENU; typedef struct FNST { POINT a; /* start corner of the box */ POINT e; /* other corner of the box */ POINT sa; POINT se; char zoom; FARBE *fb; /* color scheme */ PIC *pic; /* picture save below the box ??? */ char *dirct; /* working/actual directory */ char *datnam; /* window header text */ int winnum; /* ID number in parents structure ??? */ char ins; char dtmd; /* (See DTMD_* defines) */ int save; char *hlp_str; WOPT *blst; /* status line text */ int nblst; /* no of options in the status line */ int filemode, flg; int *c_sw; struct wpeSyntaxRule *c_st; struct CNT *ed; /* parent control structure ??? */ struct BFF *b; struct SCHRM *s; FIND fd; } FENSTER; typedef struct CNT { int major, minor, patch; /* Version of option file. */ int maxcol, tabn; int maxchg, numundo; int flopt, edopt; int mxedt; /* max number of exiting windows */ int curedt; /* currently active window */ int edt[MAXEDT + 1]; /* 1 <= window IDs <= MAXEDT, arbitrary order */ int autoindent; char *print_cmd; char *dirct; /* current directory */ char *optfile, *tabs; struct dirfile *sdf, *rdf, *fdf, *ddf, *wdf, *hdf, *shdf; FIND fd; FARBE *fb; FENSTER *f[MAXEDT + 1]; char dtmd, autosv; } ECNT; /* structure for the windows in the file manager ??? */ typedef struct fl_wnd { int xa, ya; /* its own box corner ??? */ int xe, ye; int ia, ja; int nf; /* selected field in dirfile df struct */ int nxfo, nyfo; int mxa, mya; /* parent box corners ??? */ int mxe, mye; int srcha; struct dirfile *df; /* directory tree or file list */ FENSTER* f; /* the window itself */ } FLWND; typedef struct FLBFF { struct dirfile *cd; /* current directory */ struct dirfile *dd; /* list of directories in the current dir. */ struct dirfile *df; /* list of files in the current dir. */ struct fl_wnd *fw; /* window for file list */ struct fl_wnd *dw; /* window for dir tree */ char *rdfile; /* file pattern entered for searching */ char sw; int xfa, xfd, xda, xdd; } FLBFFR; typedef struct { int x, y; char *txt; } W_O_TXTSTR; typedef struct { int xt, yt, xw, yw, nw, wmx, nc, sw; char *header; char *txt; struct dirfile **df; } W_O_WRSTR; typedef struct { int xt, yt, xw, yw, nw, wmx, nc, num, sw; char *header; } W_O_NUMSTR; typedef struct { int x, y, nc, sw, num; char *header; } W_O_SSWSTR; typedef struct { int x, y, nc, sw; char *header; } W_O_SPSWSTR; typedef struct { int num, np; W_O_SPSWSTR **ps; } W_O_PSWSTR; typedef struct { int x, y, nc, sw; char *header; int (*fkt)(FENSTER *f); } W_O_BTTSTR; typedef struct { int xa, ya, xe, ye, bgsw, crsw; int frt, frs, ftt, fts, fst, fss, fsa, fbt; int fbs, fbz, fwt, fws; int tn, sn, pn, bn, wn, nn; char *name; PIC *pic; W_O_TXTSTR **tstr; W_O_SSWSTR **sstr; W_O_PSWSTR **pstr; W_O_BTTSTR **bstr; W_O_WRSTR **wstr; W_O_NUMSTR **nstr; FENSTER *f; } W_OPTSTR; typedef struct wpeOptionSection { char *section; int (*function)(ECNT *cn, char *section, char *option, char *value); } WpeOptionSection; /* we_main.c */ extern struct CNT *WpeEditor; void e_ini_desk(ECNT *cn); void FARBE_Init(FARBE *fb); FARBE *e_ini_farbe(); int e_switch_blst(ECNT *cn); void e_free_find(FIND *fd); /* we_block.c */ int e_blck_del(FENSTER *f); int e_blck_dup(char *dup, FENSTER *f); int e_show_clipboard(FENSTER *f); int e_edt_del(FENSTER *f); int e_edt_copy(FENSTER *f); int e_edt_einf(FENSTER *f); int e_blck_move(FENSTER *f); void e_move_block(int x, int y, BUFFER *bv, BUFFER *bz, FENSTER *f); int e_blck_copy(FENSTER *f); void e_copy_block(int x, int y, BUFFER *buffer_src, BUFFER *buffer_dst, FENSTER *f); int e_blck_begin(FENSTER *f); int e_blck_end(FENSTER *f); int e_blck_hide(FENSTER *f); int e_find(FENSTER *f); int e_replace(FENSTER *f); int e_goto_line(FENSTER *f); int e_changecase_dialog(FENSTER *f); int e_blck_to_left(FENSTER *f); int e_blck_to_right(FENSTER *f); int e_blck_read(FENSTER *f); int e_blck_write(FENSTER *f); int e_rep_search(FENSTER *f); /*******************************************************************************/ /* (FENSTER *)f */ /* | */ /* +->(POINT)e.(int)x,y */ /* | e.x=max_visible_cols_+1 */ /* | e.y=max_visible_lines_+1 */ /* | */ /* +->(POINT)a.(int)x,y */ /* | a.x=seems to always be 0 */ /* | a.y=seems to always be 1 */ /* | */ /* +->(SCHIRM)s */ /* | */ /* | there's lots more in this struct */ /* | */ #define NUM_LINES_OFF_SCREEN_TOP (f->s->c.y) #define NUM_LINES_ON_SCREEN (f->e.y - f->a.y) #define LINE_NUM_ON_SCREEN_BOTTOM (NUM_LINES_ON_SCREEN + NUM_LINES_OFF_SCREEN_TOP - 1) /*this seems to include the scroll bar to the right*/ /*it's values is always +1 to the actual visible columns*/ #define NUM_COLS_ON_SCREEN_SAFE (((f->e.x - f->a.x) < (f->b->mx.x+1)) ? (f->e.x - f->a.x) : (f->b->mx.x+1)) #define NUM_COLS_ON_SCREEN (f->e.x - f->a.x) #define NUM_COLS_OFF_SCREEN_LEFT (f->s->c.x) #define COL_NUM_ON_SCREEN_RIGHT (NUM_COLS_ON_SCREEN + NUM_COLS_OFF_SCREEN_LEFT - 1) /*(LINE_NUM_ON_SCREEN_BOTTOM,COL_NUM_ON_SCREEN_RIGHT)*/ /* is the coordinate for the lower right corner*/ /******************************************************************************/ /* we_edit.c */ int e_edit(ECNT *cn, char *filename); int e_eingabe(ECNT *e); int e_tst_cur(int c, ECNT *e); int e_tst_fkt(int c, ECNT *e); int e_ctrl_k(FENSTER *f); int e_ctrl_o(FENSTER *f); int e_tst_dfkt(FENSTER *f, int c); int e_blk(int anz, int xa, int ya, int col); int e_car_ret(BUFFER *b, SCHIRM *s); void e_cursor(FENSTER *f, int sw); int e_del_line(int yd, BUFFER *b, SCHIRM *s); int e_del_nchar(BUFFER *b, SCHIRM *s, int x, int y, int n); int e_ins_nchar(BUFFER *b, SCHIRM *sch, unsigned char *s, int xa, int ya, int n); int e_new_line(int yd, BUFFER *b); int e_put_char(int c, BUFFER *b, SCHIRM *s); int e_su_lblk(int xa, char *s); int e_su_rblk(int xa, char *s); void e_zlsplt(FENSTER *f); void WpeFilenameToPathFile(char *filename, char **path, char **file); int e_lst_zeichen(int x, int y, int n, int sw, int frb, int max, int iold, int new); void e_mouse_bar(int x, int y, int n, int sw, int frb); int e_chr_sp(int x, BUFFER *b, FENSTER *f); Undo *e_remove_undo(Undo *ud, int sw); int e_add_undo(int sw, BUFFER *b, int x, int y, int n); int e_make_undo(FENSTER *f); int e_make_redo(FENSTER *f); int e_make_rudo(FENSTER *f, int sw); int e_autosave(FENSTER *f); char *e_make_postf(char *out, char *name, char *pf); /* we_e_aus.c */ void e_cls(int frb, int chr); int e_puts(char *s, int xa, int ya, int frb); void e_pr_str(int x, int y, char *str, int col, int b2, int n2, int col2, int col3); int e_pr_zstring(char *s, int x, int y, int n, int fb); int e_schr_nchar(char *s, int x, int y, int n, int max, int frb); void e_pr_nstr(int x, int y, int n, char *str, int col, int col2); int e_schreib_zif(int *num, int x, int y, int max, int ft, int fs); int e_schreib_leiste(char *s, int x, int y, int n, int max, int ft, int fs); int e_schr_nzif(int num, int x, int y, int max, int col); int e_pr_str_wsd(int x, int y, char *str, int col, int b2, int n2, int col2, int bg, int nd); int e_pr_str_scan(int x, int y, char *str, int col, int b2, int n2, int col2, int bg, int nd); #ifdef UNIX /* we_fl_unix.c */ int WpeCreateFileManager(int sw, ECNT *cn, char *dirct); int WpeDrawFileManager(FENSTER *f); int WpeManagerFirst(FENSTER *f); int WpeManager(FENSTER *f); int WpeSaveAsManager(FENSTER *f); int WpeExecuteManager(FENSTER *f); int WpeHandleFileManager(ECNT *cn); int WpeGrepFile(char *file, char *string, int sw); int WpeRemove(char *file, FENSTER *f); int WpeFindWindow(FENSTER *f); int WpeGrepWindow(FENSTER *f); struct dirfile *WpeSearchFiles(FENSTER *f, char *dirct, char *file, char *string, struct dirfile *df, int sw); int WpeShell(FENSTER *f); int WpePrintFile(FENSTER *f); int e_rename(char *file, char *newname, FENSTER *f); int WpeFileManagerOptions(FENSTER *f); int WpeShowWastebasket(FENSTER *f); int WpeDelWastebasket(FENSTER *f); int WpeQuitWastebasket(FENSTER *f); int WpeRemoveDir(char *dirct, char *file, FENSTER * f, int rec); char *WpeGetWastefile(char *file); int e_copy(char *file, char *newname, FENSTER *f); int e_link(char *file, char *newname, FENSTER *f); int e_duplicate(char *file, FENSTER *f); int WpeMakeNewDir(FENSTER *f); int WpeFileDirAttributes(char *filen, FENSTER *f); int WpeRenameCopyDir(char *dirct, char *file, char *newname, FENSTER *f, int rec, int sw); int WpeRenameCopy(char *file, char *newname, FENSTER *f, int sw); int WpeCopyFileCont(char *oldfile, char *newfile, FENSTER *f); int WpeDirDelOptions(FENSTER *f); #ifndef NOSYMLINKS int WpeLinkFile(char *fl, char *ln, int sw, FENSTER *f); int WpeRenameLink(char *old, char *ln, char *fl, FENSTER *f); #endif int e_ed_man(char *str, FENSTER *f); #endif char *WpeGetCurrentDir(ECNT *cn); struct dirfile *WpeCreateWorkingDirTree(int sw, ECNT *cn); char *WpeAssemblePath(char *pth, struct dirfile *cd, struct dirfile *dd, int n, FENSTER *f); struct dirfile *WpeGraphicalFileList(struct dirfile *df, int sw, ECNT *cn); struct dirfile *WpeGraphicalDirTree(struct dirfile *cd, struct dirfile *dd, ECNT *cn); /* we_fl_fkt.c */ char *e_mkfilename(char *dr, char *fn); POINT e_readin(int i, int j, FILE *fp, BUFFER *b, char *sw); int e_new(FENSTER *f); int e_m_save(FENSTER *f); int e_save(FENSTER *f); int e_saveall(FENSTER *f); int e_quit(FENSTER *f); int e_write(int xa, int ya, int xe, int ye, FENSTER *f, int backup); char *e_new_qual(char *s, char *ns, char *sb); char *e_bakfilename(char *s); int freedf(struct dirfile *df); int e_file_window(int sw, FLWND *fw, int ft, int fz); int e_pr_file_window(FLWND *fw, int c, int sw, int ft, int fz, int fs); int e_help_last(FENSTER *f); int e_help_comp(FENSTER *f); int e_help(FENSTER *f); int e_help_loc(FENSTER *f, int sw); int e_help_free(FENSTER *f); int e_help_ret(FENSTER *f); int e_topic_search(FENSTER *f); /* we_hfkt.c */ int e_strstr(int x, int n, unsigned char *s, unsigned char *f); int e_ustrstr(int x, int n, unsigned char *s, unsigned char *f); int e_urstrstr(int x, int n, unsigned char *s, unsigned char *f, int *nn); int e_rstrstr(int x, int n, unsigned char *s, unsigned char *f, int *nn); int e_str_len(unsigned char *s); #if 0 int e_str_nrc(unsigned char *s); int e_toupper(int c); #else #define e_str_nrc(s) strlen(s) #define e_toupper(c) toupper(c) #endif int e_num_kst(char *s, int num, int max, FENSTER *f, int n, int sw); COLOR e_s_x_clr(int f, int b); COLOR e_n_x_clr(int fb); #ifdef UNIX COLOR e_s_t_clr(int f, int b); COLOR e_n_t_clr(int fb); #endif POINT e_set_pnt(int x, int y); int e_pr_uul(FARBE *fb); /* we_menue.c */ int WpeHandleMainmenu(int n, FENSTER *f); int WpeHandleSubmenu(int xa, int ya, int xe, int ye, int nm, OPTK *fopt, FENSTER *f); OPTK WpeFillSubmenuItem(char *t, int x, char o, int (*fkt)()); /* we_mouse.c */ #if MOUSE int e_mshit(void); int e_m1_mouse(void); int e_m2_mouse(int xa, int ya, int xe, int ye, OPTK *fopt); int e_m3_mouse(void); int e_er_mouse(int x, int y, int xx, int yy); int e_msg_mouse(int x, int y, int x1, int x2, int yy); int WpeMngMouseInFileManager(FENSTER *f); int WpeMouseInFileDirList(int k, int sw, FENSTER *f); int fl_wnd_mouse(int sw, int k, FLWND *fw); int e_lst_mouse(int x, int y, int n, int sw, int max, int nf); void e_eck_mouse(FENSTER *f, int sw); int e_edt_mouse(int c, FENSTER *f); int e_ccp_mouse(int c, FENSTER *f); void e_cur_mouse(FENSTER *f); int e_opt_ck_mouse(int xa, int ya, int md); int e_opt_cw_mouse(int xa, int ya, int md); int e_opt_bs_mouse(void); void e_opt_eck_mouse(W_OPTSTR *o); int e_opt_mouse(W_OPTSTR *o); int e_data_ein_mouse(FENSTER *f); int e_opt_bs_mouse_1(void); int e_opt_bs_mouse_2(void); int e_opt_bs_mouse_3(void); int e_rahmen_mouse(FENSTER *f); #endif /* we_opt.c */ char *WpeStringToValue(const char *str); char *WpeValueToString(const char *value); int e_about_WE(FENSTER *f); int e_clear_desk(FENSTER *f); int e_repaint_desk(FENSTER *f); int e_sys_info(FENSTER *f); int e_ad_colors(FENSTER *f); int e_dif_colors(int sw, int xa, int ya, FENSTER *f, int md); void e_pr_dif_colors(int sw, int xa, int ya, FENSTER *f, int sw2, int md); void e_pr_x_col_kasten(int xa, int ya, int x, int y, FENSTER *f, int sw); void e_pr_ed_beispiel(int xa, int ya, FENSTER *f, int sw, int md); int e_opt_save(FENSTER *f); int e_save_opt(FENSTER *f); int e_opt_read(ECNT *cn); int e_add_arguments(char *str, char *head, FENSTER *f, int n, int sw, struct dirfile **df); W_O_TXTSTR **e_add_txtstr(int x, int y, char *txt, W_OPTSTR *o); W_O_WRSTR **e_add_wrstr(int xt, int yt, int xw, int yw, int nw, int wmx, int nc, int sw, char *header, char *txt, struct dirfile **df, W_OPTSTR *o); W_O_NUMSTR **e_add_numstr(int xt, int yt, int xw, int yw, int nw, int wmx, int nc, int sw, char *header, int num, W_OPTSTR *o); W_O_SSWSTR **e_add_sswstr(int x, int y, int nc, int sw, int num, char *header, W_OPTSTR *o); W_O_SPSWSTR **e_add_spswstr(int n, int x, int y, int nc, int sw, char *header, W_OPTSTR *o); W_O_PSWSTR **e_add_pswstr(int n, int x, int y, int nc, int sw, int num, char *header, W_OPTSTR *o); W_O_BTTSTR **e_add_bttstr(int x, int y, int nc, int sw, char *header, int (*fkt)(FENSTER *f), W_OPTSTR *o); int freeostr(W_OPTSTR *o); W_OPTSTR *e_init_opt_kst(FENSTER *f); int e_opt_move(W_OPTSTR *o); int e_get_sw_cmp(int xin, int yin, int x, int y, int xmin, int ymin, int c); int e_get_opt_sw(int c, int x, int y, W_OPTSTR *o); int e_opt_kst(W_OPTSTR *o); int e_edt_options(FENSTER *f); int e_read_colors(FENSTER *f); int e_ad_colors_md(FENSTER *f, int md); int e_frb_x_menue(int sw, int xa, int ya, FENSTER *f, int md); void e_pr_x_col_kasten(int xa, int ya, int x, int y, FENSTER *f, int sw); /* we_wind.c */ int e_error(char *text, int sw, FARBE *f); int e_message(int sw, char *str, FENSTER *f); void e_firstl(FENSTER *f, int sw); int e_pr_filetype(FENSTER *f); PIC *e_open_view(int xa, int ya, int xe, int ye, int col, int sw); int e_close_view(PIC *pic, int sw); void e_pr_line(int y, FENSTER *f); void e_std_rahmen(int xa, int ya, int xe, int ye, char *name, int sw, int frb, int fes); void e_ed_rahmen(FENSTER *f, int sw); int e_schirm(FENSTER *f, int sw); int e_size_move(FENSTER *f); PIC *e_std_kst(int xa, int ya, int xe, int ye, char *name, int sw, int fr, int ft, int fes); PIC *e_ed_kst(FENSTER *f, PIC *pic, int sw); int e_close_window(FENSTER *f); void e_switch_window(int num, FENSTER *f); int e_ed_zoom(FENSTER *f); int e_ed_cascade(FENSTER *f); int e_ed_tile(FENSTER *f); int e_ed_next(FENSTER *f); int e_mess_win(char *header, char *str, PIC **pic, FENSTER *f); PIC *e_change_pic(int xa, int ya, int xe, int ye, PIC *pic, int sw, int frb); struct dirfile *e_add_df(char *str, struct dirfile *df); int e_schr_nchar_wsv(char *str, int x, int y, int n, int max, int col, int csw); int e_schr_lst_wsv(char *str, int xa, int ya, int n, int strlen, int ft, int fz, struct dirfile **df, FENSTER *f); int e_rep_win_tree(ECNT *cn); int e_opt_sec_box(int xa, int ya, int num, OPTK *opt, FENSTER *f, int sw); int e_close_buffer(BUFFER *b); int e_list_all_win(FENSTER *f); #ifdef UNIX /* we_unix.c */ int e_abs_refr(void); void e_refresh_area(int x, int y, int width, int height); void WpeNullFunction(void); int WpeZeroFunction(); int e_tast_sim(int c); void e_err_save(void); void e_exit(int n); char *e_mkfilepath(char *dr, char *fn, char *fl); int e_compstr(char *a, char *b); struct dirfile *e_find_files(char *sufile, int sw); struct dirfile *e_find_dir(char *sufile, int sw); char *e_file_info(char *filen, char *str, int *num, int sw); void ini_repaint(ECNT *cn); void end_repaint(void); int e_frb_t_menue(int sw, int xa, int ya, FENSTER *f, int md); void e_pr_t_col_kasten(int xa, int ya, int x, int y, FENSTER *f, int sw); int e_ini_unix(int *argc, char **argv); int e_recover(ECNT *cn); int e_ini_schirm(int argc, char **argv); extern int (*fk_u_locate)(int x, int y); extern int (*fk_u_cursor)(int x); extern int (*e_u_initscr)(int argc, char *argv[]); extern int (*fk_u_putchar)(int c); extern int (*u_bioskey)(void); extern int (*e_frb_u_menue)(int sw, int xa, int ya, FENSTER *f, int md); extern COLOR (*e_s_u_clr)(int f, int b); extern COLOR (*e_n_u_clr)(int fb); extern void (*e_pr_u_col_kasten)(int xa, int ya, int x, int y, FENSTER *f, int sw); extern int (*fk_mouse)(int g[]); extern int (*e_u_refresh)(void); extern int (*e_u_getch)(void); extern int (*e_u_sys_ini)(void); extern int (*e_u_sys_end)(void); extern void (*WpeMouseChangeShape)(WpeMouseShape new_shape); extern void (*WpeMouseRestoreShape)(void); extern int (*e_u_d_switch_out)(int sw); extern int (*e_u_switch_screen)(int sw); extern int (*e_u_deb_out)(FENSTER *f); extern int (*e_u_cp_X_to_buffer)(FENSTER *f); extern int (*e_u_copy_X_buffer)(FENSTER *f); extern int (*e_u_paste_X_buffer)(FENSTER *f); extern int (*e_u_change)(PIC *pic); extern int (*e_u_ini_size)(void); extern int (*e_u_s_sys_end)(void); extern int (*e_u_s_sys_ini)(void); extern void (*e_u_setlastpic)(PIC *pic); extern int (*e_u_system)(const char *exe); extern int (*e_u_kbhit)(void); extern void (*WpeDisplayEnd)(void); int e_put_pic_xrect(PIC *pic); int e_get_pic_xrect(int xa, int ya, int xe, int ye, PIC *pic); #if defined(NEWSTYLE) && !defined(NO_XWINDOWS) int e_make_xrect(int xa, int ya, int xe, int ye, int sw); int e_make_xrect_abs(int xa, int ya, int xe, int ye, int sw); #else #define e_make_xrect(a,b,c,d,e) #define e_make_xrect_abs(a,b,c,d,e) #endif #endif #ifdef PROG #include "progr.h" #include "WeProg.h" #endif #ifdef DEBUGGER int e_deb_inp(FENSTER *f); int e_e_line_read(int n, signed char *s, int max); int e_d_dum_read(void); int e_d_p_exec(FENSTER *f); int e_d_getchar(void); int e_d_quit_basic(FENSTER *f); int e_d_quit(FENSTER *f); int e_d_add_watch(char *str, FENSTER *f); int e_remove_all_watches(FENSTER *f); int e_make_watches(FENSTER *f); int e_edit_watches(FENSTER *f); int e_delete_watches(FENSTER *f); int e_d_p_watches(FENSTER *f, int sw); int e_deb_stack(FENSTER *f); int e_d_p_stack(FENSTER *f, int sw); int e_make_stack(FENSTER *f); int e_breakpoint(FENSTER *f); int e_remove_breakpoints(FENSTER *f); int e_make_breakpoint(FENSTER *f, int sw); int e_exec_deb(FENSTER *f, char *prog); int e_start_debug(FENSTER *f); int e_run_debug(FENSTER *f); int e_deb_run(FENSTER *f); int e_deb_trace(FENSTER *f); int e_deb_next(FENSTER *f); int e_d_goto_cursor(FENSTER *f); int e_d_finish_func(FENSTER *f); int e_deb_options(FENSTER *f); int e_d_step_next(FENSTER *f, int sw); int e_read_output(FENSTER *f); int e_d_pr_sig(char *str, FENSTER *f); int e_make_line_num(char *str, char *file); int e_make_line_num2(char *str, char *file); int e_d_goto_break(char *file, int line, FENSTER *f); int e_d_is_watch(int c, FENSTER *f); int e_debug_switch(FENSTER *f, int c); int e_d_putchar(int c); int e_g_sys_ini(void); int e_g_sys_end(void); int e_test_command(char *str); /**** functions for breakpoints resyncing, reloading etc ****/ int e_brk_schirm(FENSTER *f); int e_brk_recalc(FENSTER *f,int start,int len); int e_d_reinit_brks(FENSTER *f,char * prj); /**** for reloading watches ****/ int e_d_reinit_watches(FENSTER *f,char * prj); #endif /* we_gpm.c */ #ifdef HAVE_LIBGPM int WpeGpmInit(void); int WpeGpmMouse(int *g); #endif /* WeLinux.c */ #ifdef __linux__ int WpeLinuxBioskey(void); #endif extern char *e_msg[]; extern char e_we_sw; #endif xwpe-1.5.30a/WeSyntax.c0000644000076400007640000002265210263105405013707 0ustar dulsidulsi/*-------------------------------------------------------------------------*\ -- Xwpe routines for syntax highlighting support Date Programmer Description 05/24/97 Dennis Created based on functions from "we_progn.c". \*-------------------------------------------------------------------------*/ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ Original header of "we_progn.c" \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* we_progn.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ Includes \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #include "Xwpe.h" #include "WeExpArr.h" #include "WeProg.h" #include "WeString.h" unsigned char *WpeCReservedWord[] = { "auto", "break", "case", "char", "const", "continue", "default", "do", "double", "else", "enum", "extern", "float", "for", "goto", "if", "int", "long", "register", "return", "short", "signed", "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned", "void", "volatile", "while", NULL }; #define WpeCLongOperator NULL unsigned char *WpeCxxReservedWord[] = { "and", "and_eq", "asm", "auto", "bitand", "bitor", "bool", "break", "case", "catch", "char", "class", "compl", "const", "const_cast", "continue", "default", "delete", "do", "double", "dynamic_cast", "else", "enum", "explicit", "extern", "false", "float", "for", "friend", "goto", "if", "inline", "int", "long", "mutable", "namespace", "new", "not", "not_eq", "operator", "or", "or_eq", "private", "protected", "public", "register", "reinterpret_cast", "return", "short", "signed", "sizeof", "static", "static_cast", "struct", "switch", "template", "this", "throw", "true", "try", "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual", "void", "volatile", "wchar_t", "while", "xor", "xor_eq", NULL }; #define WpeCxxLongOperator NULL WpeSyntaxRule WpeCSyntaxRule = { WpeCReservedWord, WpeCLongOperator, "~^()[]{}<>+-/*%=|&!.?:,;", "/*", "*/", "", '\"', '\'', '#', '\\', '\\', '\0', -1, 1000, -1, "" }; WpeSyntaxRule WpeCxxSyntaxRule = { WpeCxxReservedWord, WpeCxxLongOperator, "~^()[]{}<>+-/*%=|&!.?:,;", "/*", "*/", "//", '\"', '\'', '#', '\\', '\\', '\0', -1, 1000, -1, "" }; /*WpeSyntaxExt WpeCSyntaxExt = { ".c", &WpeCSyntaxRule }; WpeSyntaxExt WpeCxxSyntaxExt = { ".C", &WpeCxxSyntaxRule }; WpeSyntaxExt WpeHSyntaxExt = { ".h", &WpeCxxSyntaxRule };*/ /* Definition of all programming language syntax (Note: This is an expandable array and must be destroyed with WpeExpArrayDestroy()) */ WpeSyntaxExt **WpeSyntaxDef = NULL; int WpeReservedWordCompare(const void *x, const void *y) { return (strcmp(*((char **)x), *((char **)y))); } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeSyntaxReadFile - Reads the programming language syntax file. Parameters: cn (In) Part of old code needed for e_error \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ void WpeSyntaxReadFile(ECNT *cn) { FILE *syntax_file; WpeSyntaxExt *new_syntax; char tmp[128]; int reserved_num, long_op_num; int i, k; WpeSyntaxDef = (WpeSyntaxExt **)WpeExpArrayCreate(0, sizeof(WpeSyntaxExt *), 4); WpeSyntaxGetPersonal(tmp); if ((syntax_file = fopen(tmp, "r")) == NULL) { WpeSyntaxGetSystem(tmp); if ((syntax_file = fopen(tmp, "r")) == NULL) { /* C Syntax (".c" extension) */ new_syntax = WpeMalloc(sizeof(WpeSyntaxExt)); new_syntax->extension = (char **)WpeExpArrayCreate(1, sizeof(char *), 1); new_syntax->extension[0] = strdup(".c"); new_syntax->syntax_rule = &WpeCSyntaxRule; WpeExpArrayAdd((void **)&WpeSyntaxDef, &new_syntax); /* C++ Syntax (".C", ".cpp", ".cxx", ".cc", ".h", and ".hpp" extensions) */ new_syntax = WpeMalloc(sizeof(WpeSyntaxExt)); new_syntax->extension = (char **)WpeExpArrayCreate(6, sizeof(char *), 1); new_syntax->extension[0] = strdup(".C"); new_syntax->extension[1] = strdup(".cpp"); new_syntax->extension[2] = strdup(".cxx"); new_syntax->extension[3] = strdup(".cc"); new_syntax->extension[4] = strdup(".h"); new_syntax->extension[5] = strdup(".hpp"); new_syntax->syntax_rule = &WpeCxxSyntaxRule; WpeExpArrayAdd((void **)&WpeSyntaxDef, &new_syntax); /*WpeSyntaxDef[2] = &WpeHSyntaxExt;*/ return ; } } while (fscanf(syntax_file, "%s", tmp) == 1) { new_syntax = WpeMalloc(sizeof(WpeSyntaxExt)); i = atoi(tmp); if (i > 0) { new_syntax->extension = (char **)WpeExpArrayCreate(i, sizeof(char *), 1); for (k = 0; k < i; k++) { if (fscanf(syntax_file, "%s", tmp) != 1) { e_error("Error reading syntax_def", 0, cn->fb); return ; } new_syntax->extension[k] = WpeStrdup(tmp); } } else { new_syntax->extension = (char **)WpeExpArrayCreate(1, sizeof(char *), 1); new_syntax->extension[0] = WpeStrdup(tmp); } new_syntax->syntax_rule = WpeMalloc(sizeof(WpeSyntaxRule)); if (fscanf(syntax_file, "%d", &reserved_num) != 1) { e_error("Error reading syntax_def", 0, cn->fb); return ; } new_syntax->syntax_rule->reserved_word = WpeMalloc((reserved_num + 1) * sizeof(char *)); for (i = 0; i < reserved_num; i++) { if (fscanf(syntax_file, "%s", tmp) != 1) { e_error("Error reading syntax_def", 0, cn->fb); return ; } new_syntax->syntax_rule->reserved_word[i] = WpeStrdup(tmp); } new_syntax->syntax_rule->reserved_word[i] = NULL; if (fscanf(syntax_file, "%d", &long_op_num) != 1) { e_error("Error reading syntax_def", 0, cn->fb); return ; } new_syntax->syntax_rule->long_operator = WpeMalloc((long_op_num + 1) * sizeof(char *)); for (i = 0; i < long_op_num; i++) { if (fscanf(syntax_file, "%s", tmp) != 1) { e_error("Error reading syntax_def", 0, cn->fb); return ; } new_syntax->syntax_rule->long_operator[i] = WpeStrdup(tmp); } new_syntax->syntax_rule->long_operator[i] = NULL; if (fscanf(syntax_file, "%s", tmp) != 1) { e_error("Error reading syntax_def", 0, cn->fb); return ; } new_syntax->syntax_rule->single_operator = WpeStrdup(strcmp(tmp, "NULL") ? tmp : ""); if (fscanf(syntax_file, "%s", tmp) != 1) { e_error("Error reading syntax_def", 0, cn->fb); return ; } new_syntax->syntax_rule->begin_comment = WpeStrdup(strcmp(tmp, "NULL") ? tmp : ""); if (fscanf(syntax_file, "%s", tmp) != 1) { e_error("Error reading syntax_def", 0, cn->fb); return ; } new_syntax->syntax_rule->end_comment = WpeStrdup(strcmp(tmp, "NULL") ? tmp : ""); if (fscanf(syntax_file, "%s", tmp) != 1) { e_error("Error reading syntax_def", 0, cn->fb); return ; } new_syntax->syntax_rule->line_comment = WpeStrdup(strcmp(tmp, "NULL") ? tmp : ""); if (fscanf(syntax_file, "%s", tmp) != 1) { e_error("Error reading syntax_def", 0, cn->fb); return ; } new_syntax->syntax_rule->special_comment = WpeStrdup(strcmp(tmp, "NULL") ? tmp : ""); if (fscanf(syntax_file, " %c%c%c%c%c%c", &new_syntax->syntax_rule->string_constant, &new_syntax->syntax_rule->char_constant, &new_syntax->syntax_rule->preproc_cmd, &new_syntax->syntax_rule->quoting_char, &new_syntax->syntax_rule->continue_char, &new_syntax->syntax_rule->insensitive) != 6) { e_error("Error reading syntax_def", 0, cn->fb); return ; } /* This is currently a mess but this format of syntax_def is unlikely to stay - Dennis */ if (new_syntax->syntax_rule->string_constant == ' ') { new_syntax->syntax_rule->string_constant = '\0'; } if (new_syntax->syntax_rule->char_constant == ' ') { new_syntax->syntax_rule->char_constant = '\0'; } if (new_syntax->syntax_rule->preproc_cmd == ' ') { new_syntax->syntax_rule->preproc_cmd = '\0'; } if (new_syntax->syntax_rule->quoting_char == ' ') { new_syntax->syntax_rule->quoting_char = '\0'; } if (new_syntax->syntax_rule->continue_char == ' ') { new_syntax->syntax_rule->continue_char = '\0'; } if (new_syntax->syntax_rule->insensitive == ' ') { new_syntax->syntax_rule->insensitive = '\0'; } else { /* Convert all reserved words to upper case for case insensitive syntax */ for (i = 0; new_syntax->syntax_rule->reserved_word[i]; i++) { WpeStringToUpper(new_syntax->syntax_rule->reserved_word[i]); } /* Convert all long operators to upper case for case insensitive syntax */ for (i = 0; new_syntax->syntax_rule->long_operator[i]; i++) { WpeStringToUpper(new_syntax->syntax_rule->long_operator[i]); } } if (fscanf(syntax_file, "%d%d%d", &new_syntax->syntax_rule->special_column, &new_syntax->syntax_rule->continue_column, &new_syntax->syntax_rule->comment_column) != 3) { e_error("Error reading syntax_def", 0, cn->fb); return ; } qsort(new_syntax->syntax_rule->reserved_word, reserved_num, sizeof(char *), WpeReservedWordCompare); qsort(new_syntax->syntax_rule->long_operator, long_op_num, sizeof(char *), WpeReservedWordCompare); WpeExpArrayAdd((void **)&WpeSyntaxDef, &new_syntax); } } xwpe-1.5.30a/keys.h0000644000076400007640000000546710263105405013112 0ustar dulsidulsi/* keys.h */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ /* Definition of Keyboard-Keys */ #define CtrlA 1 #define CtrlB 2 #define CtrlC 3 #define CtrlD 4 #define CtrlE 5 #define CtrlF 6 #define CtrlG 7 #define CtrlH 8 #define CtrlI 9 #define CtrlJ 10 #define CtrlK 11 #define CtrlL 12 #define CtrlM 13 #define CtrlN 14 #define CtrlO 15 #define CtrlP 16 #define CtrlQ 17 #define CtrlR 18 #define CtrlS 19 #define CtrlT 20 #define CtrlU 21 #define CtrlV 22 #define CtrlW 23 #define CtrlX 24 #define CtrlY 25 #define CtrlZ 26 #define AltA 285 #define AltB 303 #define AltC 301 #define AltD 287 #define AltE 273 #define AltF 288 #define AltG 289 #define AltH 290 #define AltI 278 #define AltJ 291 #define AltK 292 #define AltL 293 #define AltM 305 #define AltN 304 #define AltO 279 #define AltP 280 #define AltQ 271 #define AltR 274 #define AltS 286 #define AltT 275 #define AltU 277 #define AltV 302 #define AltW 272 #define AltX 300 #define AltY 299 #define AltZ 276 #define Alt1 375 #define Alt2 376 #define Alt3 377 #define Alt4 378 #define Alt5 379 #define Alt6 380 #define Alt7 381 #define Alt8 382 #define Alt9 383 #define Alt0 384 #define AltBS 385 #define AltBl 386 #define AltSYS 298 #define AltEin 953 #define AltDel 954 #define CUP 327 #define CDO 335 #define CLE 330 #define CRI 332 #define CCLE 370 #define CCRI 371 #define EINFG 337 #define ENTF 338 #define POS1 326 #define ENDE 334 #define BUP 328 #define BDO 336 #define CBUP 387 #define CBDO 373 #define CPS1 374 #define CEND 372 #define CtrlDel 852 #define CtrlEin 851 #define CENTF 852 #define CEINFG 851 #define ShiftDel 850 #define ShiftEin 849 #define F1 314 #define F2 315 #define F3 316 #define F4 317 #define F5 318 #define F6 319 #define F7 320 #define F8 321 #define F9 322 #define F10 323 #define AF1 359 #define AF2 360 #define AF3 361 #define AF4 362 #define AF5 363 #define AF6 364 #define AF7 365 #define AF8 366 #define AF9 367 #define AF10 368 #define SF1 826 #define SF2 827 #define SF3 828 #define SF4 829 #define SF5 830 #define SF6 831 #define SF7 832 #define SF8 833 #define SF9 834 #define SF10 835 #define SABS 897 #define CF1 349 #define CF2 350 #define CF3 351 #define CF4 352 #define CF5 353 #define CF6 354 #define CF7 355 #define CF8 357 #define CF9 358 #define CF10 951 #define HBG CtrlA /* Button start */ #define HFB CtrlG /* Button-Man-Page start */ #define HNF CtrlC /* Button with link to file */ #define HED CtrlE /* End Mark */ #define HHD CtrlB /* start headline */ #define HFE CtrlF /* end of page */ #define HBS CtrlH /* Backspace (Man-Pages) */ #define HBB CtrlO /* start highlight */ #define MBKEY -100 xwpe-1.5.30a/makro.h0000644000076400007640000000017210263105405013234 0ustar dulsidulsi/* General Makros */ #define isalnum1(x) ( isalnum(x) || (x) == '_') #define isalpha1(x) ( isalpha(x) || (x) == '_') xwpe-1.5.30a/model.h0000644000076400007640000000205010263105405013220 0ustar dulsidulsi#ifndef __MODEL_H #define __MODEL_H /* model.h */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ /* General Model Definitions */ /* System Definition */ #define UNIX #undef DJGPP /* Effects of #Defines (do not change) */ #define CHECKHEADER #ifdef DJGPP #define NODEBUGGER #undef NOPROG #define NO_XWINDOWS #define NOPRINTER #define NONEWSTYLE #define MOUSE 1 #ifndef UNIX #define UNIX #endif #endif /* XWindow Definitions */ #if defined(DJGPP) || !defined(NO_XWINDOWS) || defined (HAVE_LIBGPM) #define MOUSE 1 /* activate mouse */ #else #define MOUSE 0 /* deactivate mouse */ #endif /* Programming Environment */ #ifndef NOPROG #define PROG #ifndef NODEBUGGER #define DEBUGGER #endif #endif /* Newstyle only for XWindow */ #if !defined(NO_XWINDOWS) && !defined(NONEWSTYLE) #define NEWSTYLE #endif #endif xwpe-1.5.30a/unixkeys.h0000644000076400007640000000327610263105405014012 0ustar dulsidulsi/* unixkeys.h */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #ifndef LIBRARY_DIR #define LIBRARY_DIR "/usr/local/lib/xwpe" #endif #ifndef INFO_DIR #define INFO_DIR "/usr/share/info:/usr/local/info:/usr/info" #endif #define XWPE_HOME ".xwpe" #define WASTEBASKET ".wastebasket" #define SYNTAX_FILE "syntax_def" #define HELP_FILE "help.xwpe" #define OPTION_FILE "xwperc" #define BUFFER_NAME "Buffer" /* Clipboard in Buffer changed */ #define SUDIR "*" #define MAXREC 15 #ifndef DEF_SHELL #define DEF_SHELL "sh" #endif /* Characters */ extern char MCI, MCA, RD1, RD2, RD3, RD4, RD5, RD6; extern char RE1, RE2, RE3, RE4, RE5, RE6, WBT; #define MCU '^' #define MCD 'v' #define MCL '<' #define MCR '>' #define WZY 'z' #define WZN 'Z' #define PWR '$' #define PNL '\\' #define SCR 20 #define SCD 16 #define WSW 'v' #define DIRC '/' #define DIRS "/" #define SWSYM '+' #define PTHD ':' /* Special colors */ #define SHDCOL 8 #define STOP 421 #define AGAIN 422 #define PROPS 423 #define UNDO 424 #define FRONT 425 #define COPY 426 #define OPEN 427 #define PASTE 428 #define FID 429 #define CUT 430 #define HELP 431 #define DWR 20 /* ctrl t */ #define DWL 18 /* ctrl r */ #define DNDL 17 /* ctrl q */ #define DGZ 25 /* ctrl y */ #define WPE_CR 13 #define WPE_WR 10 #define WPE_ESC 27 #define WPE_DC 8 #define WPE_TAB 9 #define WPE_BTAB 28 /*First value which looks suitable for me*/ #define SCLE CLE+512 #define SCRI CRI+512 #define SCUP CUP+512 #define SCDO CDO+512 xwpe-1.5.30a/unixmakr.h0000644000076400007640000000710510263105405013764 0ustar dulsidulsi/* unixmakr.h */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #ifdef NOSTRSTR char *strstr(char *s1, char *s2); char *getcwd(char *dir, int n); #endif #ifdef NCURSES #define e_putp(s) 1 #else #define e_putp(s) tputs((s), 1, fk_u_putchar) #endif extern int cur_on; #ifdef DEFPGC #define getc(fp) fgetc((fp)) #endif #ifdef NCURSES #define fk_getch() getch() #else #ifdef HAVE_LIBGPM #define fk_getch() Gpm_Getc(stdin) #else #define fk_getch() fgetc(stdin) #endif #endif #define WpeExit(n) e_exit((n)) extern char *cur_rc, *cur_vs, *cur_nvs, *cur_vvs, *schirm; extern char *att_no, *att_so, *att_ul, *att_rv, *att_bl, *att_dm, *att_bo; extern int cur_x, cur_y; extern char *user_shell; extern char *ctree[5]; #ifdef NEWSTYLE #define e_pr_char(x, y, c, frb) \ ( *(schirm + 2*MAXSCOL*(y) + 2*(x)) = (c), \ *(schirm + 2*MAXSCOL*(y) + 2*(x) + 1) = (frb), \ *(extbyte + MAXSCOL*(y) + (x)) = 0 ) #else #define e_pr_char(x, y, c, frb) \ ( *(schirm + 2*MAXSCOL*(y) + 2*(x)) = (c), \ *(schirm + 2*MAXSCOL*(y) + 2*(x) + 1) = (frb) ) #endif #define e_pt_col(x, y, c) ( *(schirm + 2*MAXSCOL*(y) + 2*(x) + 1) = (c) ) #define e_gt_char(x, y) (*(schirm + 2*MAXSCOL*(y) + 2*(x))) #define e_gt_col(x, y) (*(schirm + 2*MAXSCOL*(y) + 2*(x)+1)) #define e_gt_byte(x, y) (*(schirm + 2*MAXSCOL*(y) + (x))) #define e_pt_byte(x, y, c) ( *(schirm + 2*MAXSCOL*(y) + (x)) = (c) ) /* Pointer to functions for function calls */ #define fk_locate(x, y) (*fk_u_locate)(x, y) #define fk_cursor(x) (*fk_u_cursor)(x) #define e_refresh() (*e_u_refresh)() #define e_initscr(argc, argv) (*e_u_initscr)(argc, argv) #define e_getch() (*e_u_getch)() #define fk_putchar(c) (*fk_u_putchar)(c) #define e_d_switch_out(c) (*e_u_d_switch_out)(c) #define e_switch_screen(sw) (*e_u_switch_screen)(sw) #define e_deb_out(f) (*e_u_deb_out)(f) #define e_cp_X_to_buffer(f) (*e_u_cp_X_to_buffer)(f) #define e_copy_X_buffer(f) (*e_u_copy_X_buffer)(f) #define e_paste_X_buffer(f) (*e_u_paste_X_buffer)(f) /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ bioskey - Get the status of shift, alt, and control keys. Returns: A bit field of the following info Bit Information 3 Alt key 2 Control key 1 Left shift 0 Right shift \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #define bioskey() (*u_bioskey)() #define e_sys_ini() (*e_u_sys_ini)() #define e_sys_end() (*e_u_sys_end)() #define e_frb_menue(sw, xa, ya, f, md) (*e_frb_u_menue)(sw, xa, ya, f, md) #define e_pr_col_kasten(xa, ya, x, y, f, sw) \ (*e_pr_u_col_kasten)(xa, ya, x, y, f, sw) #define e_s_clr(f, b) (*e_s_u_clr)(f, b) #define e_n_clr(fb) (*e_n_u_clr)(fb) #define REALLOC(p, n) realloc((p), (n)) #define MALLOC(n) malloc(n) #define FREE(n) free(n) #ifdef NEWSTYLE extern char *extbyte, *altextbyte; #endif #define sc_txt_1(f) { if(f->c_sw) f->c_sw = e_sc_txt(f->c_sw, f->b); } #define sc_txt_2(f) \ { if(f->c_sw) \ { if(f->s->mark_begin.y == f->s->mark_end.y) \ e_sc_nw_txt(f->s->mark_end.y, f->b, 0); \ else \ { f->c_sw = REALLOC(f->c_sw, f->b->mx.y * sizeof(int)); \ f->c_sw = e_sc_txt(f->c_sw, f->b); \ } \ } \ } #define sc_txt_3(y, b, sw) { if(b->f->c_sw) e_sc_nw_txt(y, b, sw); } #define sc_txt_4(y, b, sw) \ { if(b->f->c_sw && !e_undo_sw) e_sc_nw_txt(y, b, sw); } xwpe-1.5.30a/old/0000755000076400007640000000000010263105405012530 5ustar dulsidulsixwpe-1.5.30a/old/we.help_gr0000644000076400007640000031603110263105405014511 0ustar dulsidulsi Das XWindow Programming Environment xwpe [ optionen ] Datei ... xwe [ optionen ] Datei ... wpe [ optionen ] Datei ... we [ optionen ] Datei ... xwpe ist die XWindow-Version des XWindow Programming Environments. xwe ist der XWindow Editor ohne die Program- mierumgebung. wpe ist die UNIX-Version der Program- mierumgebung fuer zeichenorientierte Terminals. we ist der Editor ohne Programmierumgebung fuer zeichenorientierte Ter- minals. INHALT: Ueber xwpe Die Kommandozeile Die Initialisierungsdateien Das Hauptmenue Die Funktionstasten Veraenderte Funktionstasten (Common User Access) Der Editor Die Programmierumgebung Die Debug-Umgebung Der File-Manager Die Such/Textersatz-Funktion Die Projekt-Datei C-Programmierhilfen Die Hilfe-Funktion Die GNU General Public License Installations-Hinweise Danksagung  Ueber xwpe Das XWindow Programming Environment ist eine Program- mierumgebung fuer UNIX - Betriebssysteme, die weitgehend der Borland C++ bzw. Turbo- Pascal - Entwicklungsumgebung nachgebildet ist. Sie besteht aus einem Maus- unterstuetzenden, Menue-gesteuerten Editor, aus dem heraus beliebige Uebersetzungs- und Bindungsprogramme sowie der Debugger gestartet werden koennen. Beim Uebersetzen und Binden aufgetretene Fehler werden, soweit sie vom Compiler erkannt worden sind, direkt an der entsprechenden Stelle im Text angezeigt und koennen dann dort behoben werden. Es ist moeglich das erzeugte ausfuehrbare Programm zu Testzwecken direkt aus der Programmierumgebung zu starten. Programme, die aus mehr als einem Modul (Quell-Datei) bestehen, koennen ueber die soge- nannte Projekt - Option (siehe Projekt-Datei) bearbeitet werden. Fehler in uebersetzten Programmen koennen aus der Program- mierumgebung heraus mit Hilfe der Debug-Umgebung gesucht werden. Hiebei werden Breakpoints direkt im Quelltext gesetzt oder wieder geloescht. Ein Programm-Break wird an der entsprechenden Stelle im Text angezeigt. Die Werte von Variablen koennen ueber die Watch - Option (siehe Watch-Fenster) bei jedem Break ausgegeben werden. Der Stack kann ausgegeben und in ihm kann ueber Funktionstasten ge- wandert werden (siehe Stack-Fenster). Die Entwicklungsumgebung bietet eine Hilfe-Funktion, in die sowohl Hilfestellungen zu der Umgebung selber, wie auch saemtliche Dokumentationen zu Funktionen und Kommandos (man-pages) auf dem entsprechenden Rechner integriert sind. Im Editor koennen bis zu 35 Dateien gleichzeitig ediert wer- den. Er arbeitet sowohl Maus- als auch Funktionstasten unterstuetzt. Alle Funktionen koennen entweder ueber Menue oder direkt durch Funktionstasten ausgefuehrt werden. Er bietet eine ausfuehrliche Such/Textersatz-Funktion mit der Moeglichkeit nach regulaeren Ausdruecken zu suchen. Weiterhin ist ein Datei-Manager integriert mit Hilfe dessen Dateienpfade als Baumstruktur dargestellt und aus dieser heraus editiert, kopiert, Namen und Pfade geaendert oder geloescht werden koennen. Die Entwicklungsumgebung kann auf den Editor reduziert wer- den (z.B. zur Shell-Programmierung ), in dem sie mit `xwe' aufgerufen wird. Fuer nicht XWindow-Systeme ist die Program- mierumgebung auch als `wpe' bzw. der reine Editor als `we' verfuegbar. Besonderen Dank allen, die zur Weiterentwicklung von xwpe beigetragen haben (siehe Danksagung) Copyright (C) 1993 Fred Kruse xwpe ist frei kopierbar unter den Bedingungen der GNU General Public License. Es wird fuer diese Sofwar kei- nerlei Garantie oder Gewaehrleistung uebernommen. Alle Fragen, Hinweise und Fehlermeldungen bitte an: oder  Danksagung Besonderen Dank an Lothar Schuette fuer die englische Ueber- setzung des Manuals. Besonderen Dank an Axel Rohde fuer seinen Beitrag zur Be- schleunigung des Bildaufbaus unter XWindow.  Die Kommandozeile xwpe [ Parameter ] Datei ... xwe [ Parameter ] Datei ... wpe [ Parameter ] Datei ... we [ Parameter ] Datei ... Parameter sind: -so Fuer die Sitzung werden Standardoptionen gesetzt. Die Optionendatei wird nicht gelesen. -sf Es werden die Standardfarben gesetzt. Alle anderen Ein- stellungen werden der Optionendatei entnommen. -sf optionfile Statt der Standardoptionendatei ($HOME/.wpe/wperc) wird die Datei -r Bei einem Sitzungsabbruch durch ein Signal (nicht kill -9) werden alle internen Puffere in Dateien mit dem Postfix '.ESV' geschrieben. Die abgebrochene Sitzung kann dann durch Aufruf des Editors unter Angabe des Parameters -r wiederhergestellt werden. -mb Die folgenden Dateien sind binaere Dateien. -mn Die folgenden Dateien sind ASCII Dateien (Standardein- stellung) -nc N N ist eine ganze Zahl, die die maximale Anzahl der Spalten angibt. -nu N N ist eine ganze Zahl, die die Anzahl der rueckgaengig- machbaren Manipulationen angibt. -nm N N ist eine ganze Zahl, die die maximale Anzahl der Veraenderungen angibt, nach denen ein Autosave dur- chgefuehrt werden soll. -k password Die folgende Datei soll beim lesen mit 'password' entschluesselt und beim Schreiben mit 'password' ver- schluesselt werden. -pm Naechste Datei ist eine Message-Datei -pt Message-Datei soll fuer 'traditional' Compiler inter- pretiert werden (siehe Compiler-Optionen). -pe Message-Datei soll fuer 'extended' Compiler interpre- tiert werden (siehe Compiler-Optionen). XWindow-Parameter: -display Disp Ausgabe auf Display 'Disp' -fn Fontname -font Fontname Einstellung des Fonts 'Fontname' -g Geometrie -geometry Geometrie Abmessung des XWindows (z.b.: -g 80x20+4+4) -iconic XWindow als Ikone oeffnen  Die Initialisierungsdateien xwpe kennt die Initialisierungsdatei: wperc Die Datei kann systemseitig im Verzeichnispfad ../lib/wpe relativ zum Pfad der Programmierumgebung xwpe abgelegt sein. Jeder Benutzer kann aber auch seine eigene Initialisierungsdatei im eigenen Heimatverzeichnis (Stan- dard: $HOME/.wpe/wperc) anlegen. Die Reihenfolge der Beruecksichtigung ist: Als erstes wird auf eine persoenliche Initialisierungsdatei geprueft, ist eine solche nicht vorhanden, wird auf eine Systemdatei geprueft. Ist letztere nicht vorhanden, werden festvorgegebene interne Einstel- lungen benutzt. Die Binaer-Datei wperc wird aus der Programmierumgebung heraus erzeugt und speichert die aktuellen Einstellungen. (siehe das Options-Menue) X-Resourcen: In der X-Resourcen-Datei .Xdefaults koennen folgende Ein- traege fuer X-Window Standardvoreinstellungen vorgegeben werden: xwpe.font: Der zu benutzende Textfont (8x13, 9x15, 10x20, 8x13bold, 9x15bold, 10x20bold) xwpe.geometry: Die X-Window-Geometrie xwpe.iconic:yes xwpe wird als Icon geoeffnet. xwpe.color1: ... xwpe.color16: xwpe beruecksichtigt 16 Farben. Diese sind in Anlehnung an die 16 PC-Farben standardmaessig eingestellt und koennen hier veraendert werden. ACHTUNG: Die Datei .wperc, die vor der Version 1.3.1 erstellt wurde, sollten geloescht werden. Die Datei .xwperc, die vor der Version 1.2.1 erstellt wurde, wird nicht mehr beruecksichtigt und kann geloescht werden. Eventuell vorhandene Initialisierungs- und Hilfedateien im binaer Verzeichnis der xwpe sollten ab Version 1.3.1 geloescht werden.  Das Hauptmenue Das WE-Menue kann durch Eingabe von F10, Alt- (oder aus dem Editorenfenster) erreicht bzw. ueber wieder verlassen werden. Jedes einzelne Untermenue kann durch Eingabe von Alt- direkt aufgerufen werden. Die Untermenues sind: Das System-Menue Environment-Verwaltung Das File-Menue Dateien-Verwaltung Das Edit-Menue Edieren zwischen verschiedenen Fenstern Das Search-Menue Such-Anwendungen Das Block-Menue Edieren in einem Fenster Das Run-Menue Programmierumgebung (nicht bei we oder xwe) Das Debug-Menue Debug-Umgebung (wenn installiert; nicht bei we oder xwe) Das Project-Menue Programmieren von mehr Dateienprojekten (nicht bei we oder xwe) Das Options-Menue Einstellungen Das Window-Menue Fenster-Verwaltung Das Help-Menue Hilfestellungen  Das System-Menue (Alt-# oder Alt-): About WE A Zeigt Versionsnummer und Copyright an. Clear Desktop C Schliesst alle Fenster. Repaint Desktop R Initialisiert den Schirm und baut die einzelnen Fenster neu auf. System Info S Gibt einige Informationen zur aktuellen Edit-Sitzung aus. Show Wastebasket W Inhalt des Papierkorbs im File-Manager anzeigen Delete Wastebasket D Inhalt des Papierkorbs loeschen  Das File-Menue (Alt-F): File-Manager M Holt das File-Manager-Fenster in den Vordergrund, wenn nicht vorhanden, wird es erzeugt. ADd F.-Mng. D Erzeugt neues File-Manager-Fenster New N Erstellt eine neue Datei mit Namen 'Noname' Save S Sichert die aktuell bearbeitete Datei Save As A Sichern unter anderem Namen (siehe File-Manager) Save ALl L Sichert alle editierten Dateien Execute E Execution-Manager SHell H Aufruf der UNIX-Shell Find F Suchen nach Dateinamen (siehe Find) Grep G Suchen nach Zeichenketten in Dateien (siehe Grep) Print P Drucken der aktuellen Datei Quit Q Beenden der Sitzung  Das Edit-Menue (Alt-E): Cut T Loescht markierten Text in den Puffer Copy C Kopiert markierten Text in den Puffer Paste P Kopiert Puffer-Inhalt hinter den Cursor Show Clipboard S Zeigt den Puffer-Inhalt an. Delete D Loescht markierten Text Undo U Macht letzte Textaenderung rueckgaengig Redo R Macht letztes Undo wieder rueckgaengig Load XBuffer L Kopiert den XWindow-Buffer in den Paste-Buffer Write to XBuffer W Kopiert den Paste-Buffer in den XWindow-Buffer  Das Search-Menue (Alt-S): Find F Eine Zeichenkette suchen (siehe Such/Textersatz-Funktion) Replace R Eine Zeichenkette suchen und ersetzen (siehe Such/Textersatz-Funktion) Search again S Wiederholtes Suchen bzw. Ersetzen Go to Line G Sprung zu einer anzugebenden Zeilenummer  Das Block-Menue (Alt-B): Begin Mark B Beginn eines Blocks markieren End Mark E Ende eines Blocks markieren Mark Line L Eine Zeile markieren Mark Whole W Ganzen Text markieren Goto Begin G Zum Beginn eines Blockes springen Goto End N Zum Ende eines Blockes springen Copy C Kopieren eines Blocks Move M Verschieben eines Blocks Delete D Loeschen eines Blocks Hide H Loeschen der Anfangs- und Endmarke eines Blocks Read R Einfuegen einer Datei an die Cursor- Position Write W Schreiben eines Blocks in eine Datei Move to Right I Block eines halben Tabulator nach rechts verschieben Move to Left T Block eines halben Tabulator nach links verschieben Bloecke koennen markiert werden, in dem die Tastenkombina- tionen `^k b' und `^k k' verwendet werden. `^k b' setzt den Block-Anfang auf die Cursor-Position. `^k k' setzt das Block-Ende auf die Cursor-Position. Unter XWindow koennen Bloecke auf zwei weitere Arten mar- kiert werden: Bewegen des Cursors bei gedrueckter Shift- Taste makiert den vom Cursor beruehrten Text als Block. Bewgendes Maus-Cursors bei gedruecktem linken Button makiert den vom Maus-Cursor beruehrten Text als Block.  Das Run-Menue (Alt-R): Compile C Uebersetzen des Programm-Codes (siehe Programmierumgebung) Make M Erzeugen des Executables Run R Erzeugen und Ausfuehren des Executables Install I Installierungsroutine (siehe Projekt-Datei) Execute make E Fuehrt das System-Kommando 'make' aus. Next Error N Sprung zum naechsten Fehler Previous Error P Sprung zum vorherigen Fehler Show Definition S Sprung zur Definition eines Ausdrucks (siehe C-Programmierhilfen) Show Next Def. X Sprung zur naechsten Definition des gefundenen Ausdrucks (siehe C-Programmierhilfen) Matching Bracket K Sprung zur zugehoerigen Klammer (siehe C-Programmierhilfen) Beautify B gleichmaessiges einruecken von Programm- bloecken (siehe C-Programmierhilfen) Arguments A Eingabe einer Argumentenliste zur Ueber- gabe an das auszufuehrende Programm  Das Debug-Menue (Alt-D):(siehe die Debug-Umgebung) Toggel Breakpoint B Setzen/Loeschen eines Breakpoints ReMove all Breakp. M Loeschen aller Breakpoints Make Watch W Setzen einer zubeobachtenden Variablen (siehe Watch-Fenster) Edit Watch E Edieren einer zubeob. Variablen Delete Watch D Loeschen einer zubeob. Variablen Remove All Watches A Loeschen aller zubeob. Variablen Show StacK K Stack anzeigen (siehe Stack-Fenster) Step S Einen Programmschritt ausfuehren (mit Sprung in Unterfunktionen) Next N Einen Programmschritt ausfuehren (ohne Sprung in Unterfunktionen) Run/Continue R Starten/Weiterfuehren des Programms Quit Q Beenden des Debuggers OutPut Window P Anzeigen der Ausgabe (nicht unter XWindow)  Das Project-Menue (Alt-P): Open Project P Eingabe des Namen einer Projekt-Datei Es wird ein Project-Fenster geoeffnet Close Project C Schliessen eines Projekts. Das Project-Fenster wird geschlossen und der Projektname auf leer gesetzt. Add Item A Hinzufuegen von Dateien zum geoeffneten Project. Das Projekt-Fenster wird im Add-Status geoeffnet. Delete Item D Loeschen der aktuellen Datei im Projekt-Fenster aus dem geoeffneten Project. Dieser Punkt wird nur ausgefuehrt, wenn das Projekt-Fenster geoefnnet ist. Options O Projekt-Optionen  Das Options-Menue (Alt-O): Adjust Colors A Farbeinstellung Read Colors R Standard Farben oder Farben aus Initiali- sierungsdatei lesen Save Options S Sichern der eigenen Optionseinstellungen fuer spaetere Sitzungen in einer wiederverwendbaren Options-Datei. Editor E Optionen fuer den Editor (siehe Editor-Optionen) File-Manager F Optionen fuer den File-Manager (siehe File-Manager-Optionen) Programming G Optionen fuer die Programmierumgebung: ( Halt bei Fehlern/Warnungen; Syntax-Unterstuetzung) Compiler C Compiler-Optionen eingeben (siehe Compiler-Optionen) Debugger D Optionen (Es koennen sowohl die Debugger gdb, sdb oder dbx gewaehlt werden, als auch die Modi Full Screen oder Normal)  Das Window-Menue (Alt-W): Size/Move S Groesse und Ort des aktuellen Fensters veraendern Zoom Z Zoomen des aktuellen Fensters auf max. Grosse Tile T Fenster im Baukasten-Prinzip nebeneinander- legen. Cascade A Fenster wie einzelne Blaetter kaskadenfoermig uebereinanderlegen. Next X Aktuelles Fenster auf das folgende schalten. Close C Aktuelles Fenster schliessen. List All L Alle vorhandenen Fenster werden gelistet. Mit oder Alt-S (Show) wird das markierte Fenster in den Vordergrund geholt. Messages M Das Message-Fenster wird in den Vordergrund geholt. Ist es nicht geoeffnet, so wird dieses nachgeholt. Project P Das Project-Fenster wird in den Vordergrund geholt. Ist es nicht geoeffnet, so wird dieses nachgeholt. Watches W Das Watch-Fenster wird in den Vordergrund geholt. Ist es nicht geoeffnet, so wird dieses nachgeholt.  Das Help-Menue (Alt-H): Editor E Hilfestellung zum Editor (WE) FUnction Index U Index aller UNIX-Funktionen (siehe Funktions-Index) Function F Hilfestellung zu einer beliebigen UNIX-Funktion Info I Ausgabe des GNU-Infosystems (Funktionsweise wie Hilfe-Funktion) Goto G Sprung zur ausgewaehlten Hilfeseite Back B Ruecksprung zur vorherigen Seite Next N Naechste Seite des Dokuments Previous P Vorherige Seite des Dokuments  Die Funktionstasten: Konvention unter UNIX (gilt nicht fuer XWindow): Alt-X - Wird durch die Tastenkombination <ESC> X realisiert (X steht hier fuer ein beliebiges druckbares Zeichen) ESC - Wird durch die Tastenkombination <ESC> <Return> real- isiert. Fuer folgende Funktionen sind Tasten vorgesehen: Cursor-Bewegungen Edieren Loeschen Block-Kommandos Marker-Kommandos Such- und Textersatz-Kommandos Puffer-Kommandos Laden und Speichern Fenster-Kommandos Run-Kommandos Kommandos der Programmierhilfe Debug-Kommandos Help-Kommandos Sitzungbeenden  Cursor-Bewegungen: Pfeil nach oben Ctrl P bewegt Cursor nach oben Pfeil nach unten Ctrl N bewegt Cursor nach unten rechter Pfeil Ctrl F bewegt Cursor nach rechts linker Pfeil Ctrl B bewegt Cursor nach links Ctrl rechter Pfeil Alt rechter Pfeil bewegt Cursor um ein Wort nach rechts Ctrl linker Pfeil Alt linker Pfeil bewegt Cursor um ein Wort nach links Home oder Ctrl A setzt den Cursor auf den Anfang der Zeile End oder Ctrl E setzt den Cursor auf das Ende der Zeile Ctrl Pfeil nach oben Page Up bewegt den Cursor um ein Fenster nach oben Ctrl Pfeil nach unten Page Down bewegt den Cursor um ein Fenster nach unten Ctrl Page Up Alt Ctrl A bewegt den Cursor auf den Anfang der Datei Ctrl Page Down Alt Ctrl E bewegt den Cursor auf das Ende der Datei Ctrl Home Alt Ctrl P bewegt den Cursor auf den Anfang der Seite Ctrl End Alt Ctrl N bewegt den Cursor auf das Ende der Seite  Edieren: Spaltet die aktuelle Zeile an der Cursor-Position (siehe auch Automatischer Zeileneinzug) Ctrl H Loescht den Character vor der Cursor-Position (siehe auch Automatischer Zeileneinzug) Ctrl D Del Loescht den Character an der Cursor-Position Einfuegen eines Tabulators (siehe auch Automatischer Zeileneinzug) Alt-I Umschalten vom Einfuege- in den Ueberschreibe-Modus Insert und umgekehrt. Alt-J Umschalten in Sonderzeichen-Einsetz-Modus  Loeschen: Ctrl T Loescht nach rechts alle Zeichen bis zum naechsten Wortanfang Ctrl O T Loescht nach links alle Zeichen bis zum naechsten Wortanfang Ctrl Y Loescht die ganze Zeile Ctrl Z Ctrl O Y Loescht alle Zeichen vom Cursor bis zum Ende der Zeile  Block-Kommandos: Shift + Cursorbewegung markiert einen Block Ctrl K B Anfangsmarke eines Blocks setzen Ctrl K K Endmarke eines Blocks setzen Ctrl K L Die aktuelle Zeile markieren Ctrl K X Den gesamten Text markieren Ctrl K A An den Blockanfang springen Ctrl K Z Ans Blockende springen Ctrl K C Block kopieren Ctrl K V Block verschieben Ctrl K Y Block loeschen Ctrl K H Blockmarken loeschen Ctrl K R Einfuegen einer Datei an die Cursor-Position Ctrl K W Schreiben eines Blocks in ein Datei Ctrl K I Blockeinruecken Ctrl K U Blockausruecken  Marker-Kommandos: Ctrl K n Setzt n-ten Marker ( n = 1 - 9 ) Ctrl O n Setzt Cursor auf n-ten Marker  Such- und Textersatz-Kommandos: Find F4 Ctrl O F Zeichenkette suchen Alt-F4 Ctrl O A Zeichenkette durch eine andere Ersetzen Ctrl-F4 Ctrl L Wiederholt Suchen / Ersetzen Alt G Zu einer angegebenen Zeile springen  Puffer-Kommandos: Cut Shift Del Ctrl X Loescht markierten Text in den Puffer Copy Shift Insert Ctrl C Kopiert den markierten Text in den Puffer Paste Ctrl Insert Ctrl V Kopiert den Puffer-Inhalt an die Cursor-Position Ctrl W Puffer-Inhalt in eigenem Fenster anzeigen UNDO Letztes Textveraenderndes Kommando rueckgaengig Ctrl U machen REDO Ctrl R Letztes Undo-Kommando rueckgaengig machen Alt Delete Kopiert den markierten Text in den X-Puffer Alt Insert Kopiert den X-Puffer-Inhalt an die Cursor-Position  Laden und Speichern: Open F3 Aufruf des File-Managers (Laden einer Datei etc.) F2 Speichern des Inhalts einer Datei  Fenster-Kommandos: Alt-Z F5 Zoomen des Fensters (maximale Groesse) Ctrl F5 Alt-F2 Veraendern der Grosse und des Ortes des Fensters F6 Alt-N Umschalten auf naechstes Fenster Alt-F3 Schliessen des aktuellen Fensters Shift F4 Fenster nebeneinander anordnen Shift F5 Fenster versetzt uebereinander anordnen  Run-Kommandos: Alt F9 Alt C startet den Compiler (siehe Programmierumgebung) F9 Alt M erzeugt ein Executable Ctrl F9 Alt R erzeugt ein Executable und fuehrt dieses aus. Alt L fuehrt die Installations-Prozedur aus (siehe Projekt-Datei) Alt A fuehrt das System-Kommando 'make' aus. Eventuell aufgetretenen Fehler werden im Message-Fenster angezeigt und interpretiert (siehe Message-Fenster) Alt V Der Cursor wird an die stelle des vorhergehenden Fehlers gesetzt (siehe Message-Fenster) Alt T Der Cursor wird an die stelle des naechsten Fehlers gesetzt (siehe Message-Fenster)  Kommandos der Programmierhilfe: Ctrl O S Sucht die Definition eines C-Ausdrucks (siehe C-Programmierhilfen) Ctrl O N Sucht nach weiteren Definitionen eines C-Ausdrucks (siehe C-Programmierhilfen) Ctrl O K Sucht die zugehoerige Klammer (siehe C-Programmierhilfen) Ctrl O B Verschoenert den C-Quelltext (siehe C-Programmierhilfen)  Debug-Kommandos: Ctrl F10 Ctrl G R startet den Debugger (siehe Debug-Umgebung) Ctrl F2 Ctrl G Q beendet die Debug-Sitzung F7 der naechste Programmschritt wird ausgefuehrt Ctrl G S (mit Sprung in Funktionen) F8 der naechste Programmschritt wird ausgefuehrt Ctrl G N (ohne Sprung in Funktionen) Ctrl F8 Ctrl G B Setzen bzw. Loeschen eines Breakpoints Ctrl G M Loeschen aller Breakpoints Ctrl F7 Ctrl G W Eingabe einer zu beobachtenden Variablen Ctrl G E Edieren einer zu beobachtenden Variablen (Siehe Watch-Fenster) Ctrl G D Loeschen einer zu beobachtenden Variablen (Siehe Watch-Fenster) Ctrl G D Loeschen einer zu beobachtenden Variablen (Siehe Watch-Fenster) Ctrl F6 Ctrl G K Anzeigen des Stack (siehe Stack-Fenster) Ctrl G O Anzeigen des Ausgabe-Ausgabefesters (nicht fuer XWindow)  Help-Kommandos: F1 Hilfe zum Window-Programming-Environment (xwpe) Alt F1 Hilfe zu einer beliebigen UNIX-Funktions Ctrl F1 Funktions-Index  Sitzungbeenden: Alt-X Beenden der WE-Sitzung (siehe Beenden der Sitzung)  Common User Access: Um eine gewisse Kompatibilitaet zu OSF-Motif bzw. MS-Windows zu erreichen wird ein zweite Form der Funktionstasten- belegung angeboten. Hierbei gelten folgende Ersetzungen: Fenster: F6 -> Ctrl F6 Naechstes Fenster Alt F3 -> Ctrl F4 Fenster schliessen F5 -> Shift F6 Zoom Suchen: Ctrl F4 -> F3 Nochmaliges Suchen F4 -> Alt F3 Suchen Alt F4 -> Ctrl F3 Ersetzen Dateibearbeitung: F3 -> F2 Aufruf des Datei-Managers F2 -> Alt F2 Speichern Debugger: Ctrl F8 -> F5 Breakpoint setzen Ctrl F7 -> Ctrl F5 Watch Ctrl F6 -> Ctrl F3 Stack aufrufen Sitzung beenden: Alt X -> Alt F4 Beenden der Editoren-Sitzung  Beenden der Sitzung: Wird das Kommando zum Beenden der Sitzung eingegeben werden alle NICHT veraenderten Dateien kommentarlos geschlossen. Fuer alle veraenderten Dateien wird nachgefragt: Yes Eingabe von Y speichert die Datei No Eingabe von N schliesst die Datei ohne zu speichern ESC Eingabe von bricht das Kommando ab (die Sitzung wird wieder aufgenommen)  Der Editor Der Editor ist in der Lage bis zu 35 Fenster gleichzeitig zu verwalten. In jedem Editoren-Fenster kann eine Datei geladen werden. Der Editor stellt eine Reihe von Funktionen zur Verfuegung. Die Funktionen koennen ueber Maus, Funktionstasten oder Menues ausgefuehrt werden. Funktionen sind ueber das Hinzufuegen und Loeschen einzelner Zeichen hinaus in erster Linie die folgenden: Kopieren, verschieben und loeschen ganzer Textbloecke innerhalb einer Datei (siehe Block-Menue) Kopieren, verschieben und loeschen ganzer Textbloecke zwischen verschiedenen Dateien (siehe Edit-Menue) Zeichenketten suchen und/oder ersetzen (siehe Search-Menue) Die Form und Lage der einzelnen Editoren-Fenster veraendern (siehe Window-Menue) Optionen fuer den Editor werden ueber das Options-Menue eingestellt. Dateien editiert, gesichert und ganz allgemein manipuliert wird ueber das File-Menue.  Die Hilfe-Funktion In einem Hilfefenster wird eine Beschreibung zu dem entsprechenden Punkt gegeben, aus dem heraus die Hilfe- Funktion aufgerufen wurde. Wurde die Hilfe-Funktion ueber Help/Editor aufgerufen, wird ein Verzeichnis der Hauptpunkte ausgegeben, die als Hilfestellungen angeboten werden. In den meisten Dokumentationen sind hervorgehobene Schluesselworte vorhanden. Anklicken eines Schluesselwortes bzw. Eingabe von nachdem der Cursor auf das ensprechende Schluesselwort gesetzt wurde, ruft die Hilfe- Funktion fuer das angegebene Thema auf. Es kann zu vorher betrachtete Hilfe-Funktionspunkten zurueckgeblaettert werden, indem ein die -Taste gedrueckt, oder mit der Maus auf die Ueberschrift des aktuellen Punktes geklickt wird. Zur folgenden Dokumentenseite kann mit Alt-F8 geblaettert werden. Zur im Dokument vorhergehenden Seite wird mit Alt-F7 geblaettert. Weitere Hilfestellungen fuer Programmierer werden ueber die Menuepunkte des Help-Menues gegeben.  Der File-Manager (Datei-Manager): Mit Hilfe des File-Managers koennen Dateien ediert, neue Unterverzeichnisse erstellt, sowie Dateien und Verzeichnisse kopiert, verschoben/umbenannt geloescht oder ihre Attribute veraendert werden. Alt-N Sprung in Namensleiste (Die vorgegebene Zeichenkette kann bearbeitet werden). Es gibt drei Moeglichkeiten von Namen: 1. Eine existierende Datei wird durch geladen. 2. Eine nicht existierende Datei wird durch erzeugt. 3. Eine Dateienmaske gibt an, welche Dateien unter 'Files' aufgelistet werden sollen. '*' steht fuer eine beliebige Zeichenkette. '?' steht fuer ein beliebiges Zeichen. eckigen Klammern. '[ - ]' steht fuer ein Zeichen aus dem Bereich zwischen den Zeichen vor und nach '-'. steht fuer alle Zeichen ausser den in den Klammern angegebenen. Eingabe von Return bewirkt einen Sprung nach 'Files'. Alt-F Sprung nach 'Files'. Die einzelnen Dateien, die der unter aufgelistet. Durch Eingabe der Cursortasten kann jeweils eine Datei markiert werden. Mit oder Alt-E wird diese Datei in den Editor geladen. Alt-D Eingabezeile fuer Inhaltsverzeichnis. Hier kann ein Inhaltsverzeichnis eingegeben werden. Durch Eingabe von wird das Arbeitsverzeichnis direkt in das eingegebene geaendert. Alt-T Baum des Inhaltsverzeichnisses. Durch Eingabe der Cur- sortasten kann in dem Baum gewandert werden. aendert das Arbeitsverzeichnis in das markierte Ver- zeichnis. Alt-C Das Arbeitsverzeichnis wird in das eingegebene bzw. markierte Verzeichnis geaendert. Alt-E Die unter 'Name' angegebene Datei bzw. die markierte Datei wird in den Editor geladen. Alt-P Die aktuelle Datei wird durch die unter 'Name' angege- bene Datei bzw. die markierte Datei ersetzt. Alt-M Die markierte Datei umbenennen, oder durch die Angabe eines neuen Pfades verschieben. Alt-U Die markierte Datei duplizieren. Der Name der duplizierten Datei ist der alte Dateiname ergaenzt durch die Endung .dup. Alt-R Loeschen der markierten Datei. Die Datei wird je nach Einstellung (siehe File-Manager-Optionen) in den Papi- erkorb verschoben oder absolut von der Platte gloescht. Alt-L Einen Link auf die markierte Datei setzen. Es wird als erstes versucht einen Hard-Link auf die Datei zu erstellen. Ist dies nicht moeglich (bei Verzeichnissen oder unterschiedlichen Platten-Partitionen), wird ein Soft-Link erstellt. Alt-O Die markierte Datei wird kopiert. Der neue Name muss angegeben werden. Alt-K Erzeugen eines neuen Unterverzeichnisses im aktuellen Verzeichnis. Nach der Erzeugung ist die Anwendung im Umbennenungsmodus (Alt-M) und der temporaere Name ist new.dir. Alt-A Setzen der Attribute fuer die markierte Datei. Alt-S (nur fuer Save As) Die aktuelle Datei wird unter dem unter 'Name' angegebenen Namen bzw. unter dem markier- ten Namen gespeichert. Beenden des File-Managers.  Der Execution-Manager: Mit Hilfe des Execution-Managers koennen Dateien ausfuehrbare Programme und Shell-Scripts ausgefuehrt werden. Es werden nur ausfuehrbare Dateien unter 'Files' gelistet. Alt-N Sprung in Namensleiste (Die vorgegebene Zeichenkette kann bearbeitet werden). Es gibt drei Moeglichkeiten von Namen: 1. Eine existierende Datei wird durch geladen. 2. Eine nicht existierende Datei wird durch erzeugt. 3. Eine Dateienmaske gibt an, welche Dateien unter 'Files' aufgelistet werden sollen. '*' steht fuer eine beliebige Zeichenkette. '?' steht fuer ein beliebiges Zeichen. eckigen Klammern. '[ - ]' steht fuer ein Zeichen aus dem Bereich zwischen den Zeichen vor und nach '-'. angegebenen. Eingabe von Return bewirkt einen Sprung nach 'Files'. Alt-F Sprung nach 'Files'. Die einzelnen Dateien, die der unter aufgelistet. Durch Eingabe der Cursortasten kann jeweils eine Datei markiert werden. Mit oder Alt-E wird diese Datei in den Editor geladen. Alt-D Eingabezeile fuer Inhaltsverzeichnis. Hier kann ein Inhalts- verzeichnis eingegeben werden. Durch Eingabe von wird das Arbeitsverzeichnis direkt in das eingegebene geaendert. Alt-T Baum des Inhaltsverzeichnisses. Durch Eingabe der Cur- sortasten kann in dem Baum gewandert werden. aendert das Arbeitsverzeichnis in das markierte Ver- zeichnis. Alt-C Das Arbeitsverzeichnis wird in das eingegebene bzw. markierte Verzeichnis geaendert. Alt-E Die unter 'Name' eingegebene Zeichenkette bzw. die mar- kierte Datei wird vom Betriebssystem ausgefuehrt. Beenden des Execution-Managers.  Die Programmierumgebung Das Run-Menue kann Programm-Code uebersetzen, binden und ausfuehren. Ist die angegebene Projekt-Datei vorhanden, wird diese bearbeitet, ansonsten wird die aktuelle Datei bearbeitet. Der Compiler wird in Abhaengigkeit von dem Datei-Postfix ausgewaehlt. Die moeglichen Compiler und die dazu gehoerigen Optionen sind unter dem Menue-Punkt Run/Options (siehe Compiler-Optionen) einstellbar. Compiliert und gebunden werden nur Dateien, die noch nicht uebersetzt wurden oder seit der letzten Uebersetzung veraen- dert wurden. Fuer C-Programme gilt, dass auch alle Veraen- derungen in eingebundenen 'include' - Dateien beruecksich- tigt werden. Treten beim Uebersetzen oder Binden des Programm- Codes Fehler auf, werden diese aufgelistet (siehe Message-Fenster), das weitere Uebersetzen und Binden abgebrochen und der Cursor an die vermutliche Fehlerstelle in der ensprechenden Datei gesetzt.  Die Debug-Umgebung Das Debug-Menue erlaubt das Setzen von Breakpoints direkt im Programm-Text. Bei einem Programm-Stop waehrend einer Debugger- Sitzung, wird der aktuelle Standpunkt in der entsprechenden Datei angezeigt. Ist sie als Datei noch nicht im Editor geladen, wird dies nachgeholt. Der Cursor wird an die entsprechende Code-Stelle gesetzt. Stops koennen durch Breakpoints oder durch Signale von aussen erzeugt werden. Es koennen Variablen angegeben werden, deren Werte bei jedem Stop ausgegeben werden (siehe Watch-Fenster) Bei einem Stop kann die Stack-Hierarchie ausgeben und in dieser gewandert werden (siehe Stack-Fenster).  Find: Mit Hilfe der Find Option koennen Dateien in einem Ver- zeichnis (auch rekursiv) gesucht werden. Alt-L Dateiname oder Dateienmaske nach der gesucht werden soll. Die Dateienmaske hat die gleichen Eigenschaften wie die unter File-Manager beschriebenen Alt-I Verzeichnis in dem nach der Datei oder Dateienmaske gesucht werden soll. Alt-K Rekursiv. Wenn diese Option eingeschaltet ist werden auch Unterverzeichnisse rekursiv durchsucht. Alt-O Suche beginnen. Abbruch der Find-Anwendung. Die Verzeichnisse in denen entsprechende Dateien gefun- den wurden werden in einem Find-Fenster aufgelistet.  Grep: Mit Hilfe der Grep Option koennen Zeichenketten in Dateien gesucht werden. Die Dateien werden hierbei entsprechend der unter File-Manager beschriebenen Dateienmaske durchsucht. Alt-T Such-Zeichenkette eingeben. Alt-C Wenn angegeben: Gross- und Kleinschreibung wird unter- schieden. Alt-W Wenn angegeben: Nur ganze Worte werden gesucht Alt-R Wenn angegeben: Regulaerer Ausdruck. (siehe die Such/Textersatz-Funktion) Alt-L Dateiname oder Dateienmaske nach der gesucht werden soll. Die Dateienmaske hat die gleichen Eigenschaften wie die unter File-Manager beschriebenen Alt-I Verzeichnis in dem nach der Datei oder Dateienmaske gesucht werden soll. Alt-K Rekursiv. Wenn diese Option eingeschaltet ist werden auch Unterverzeichnisse rekursiv durchsucht. Alt-O Suche beginnen. Abbruch der Find-Anwendung. Die Dateien in denen die angegebene Zeichenkette gefun- den wurde, werden in einem gesonderten Grep-Fenster aufgelistet.  Die Such/Textersatz-Funktion: Alt-T Such-Zeichenkette eingeben. Alt-N Textersatz-Zeichenkette eingeben (nur bei Replace) Alt-C Wenn angegeben: Gross- und Kleinschreibung wird unter- schieden. Alt-W Wenn angegeben: Nur ganze Worte werden gesucht Alt-R Wenn angegeben: Regulaerer Ausdruck. Folgende Sonder- zeichen werden interpretiert (Syntax (e)grep aehnlich): ^ Am Anfang der Such-Zeichenkette wird als Zeilenanfang interpretiert. $ Dieses Zeichen am Ende einer Such-Zeichenkette wird als Zeilenende interpretiert. . Steht fuer ein beliebiges Zeichen [] Steht fuer jedes Zeichen innerhalb der Klammern aber kein anders [^ ] Steht fuer kein Zeichen innerhalb der Klammern aber jedes andere [ - ] Steht fuer einen Zeichenbereich innerhalb der Klammern aber kein anderes * Das vorhergehende Zeichen wird n mal wiederholt (n >= 0) + Das vorhergehende Zeichen wird n mal wiederholt (n >= 1) ? Das vorhergehende Zeichen wird 0 oder 1 mal wiederholt | Oder: Es wird sowohl nach der Zeichenkette vor als auch nach der Zeichenkette nach dem | - Zeichen gesucht. Das folgende Zeichen wird nicht als Sonderzeichen interpretiert Alt-P Wenn angegeben, wird vor jeder Ersetzung nachgefragt.(Nur bei Replace) Nachfragen koennen wie folgt beantwortet werden: Yes Y Text ersetzen No N Text nicht ersetzen Bricht mehrfache Suche ab Alt-D Wenn angegeben: Vorwaerts suchen Alt-B Wenn angegeben: Rueckwaerts suchen Alt-G Wenn angegeben: Ganzen Text durchsuchen Alt-S Wenn angegeben: Nur markierten Bereich durchsuchen Alt-F Wenn angegeben: Suche von Cursor-Position starten Alt-E Wenn angegeben: Suche von Bereichsanfang starten Einmaliges Suchen/Ersetzen beginnen Alt-A Alle Ersetzungen bis Ende des Bereichs durchfuehren (Nur fuer Replace) Suchen/Ersetzen abbrechen  Funktions-Index: Das Programming-Environment erstellt beim Aufruf dieser Funktion einen Index aller vorhandenen Manual-Pages, die im Suchpfad gefunden wurden. Der Suchpfad muss ueber die Environment-Variable MANPATH angegeben werden. Der Funktions-Index ist nach groben Sachgebieten geordnet, die als Untermenue erscheinen: User Commands Benutzer Kommandos System Calls System Routinen (C - Funktionen) C-Lib.-Functions C - Biliotheks - Funktionen Devices & Netw. I. Geraete und Netzschnittstellen File Formats Datei - Formate Games & Demos Spiele und Demonstartionen Environments, ... Umgebungen, Tabellen und TROFF Makros Maintenance Com. Administrations Kommandos Nach Auswahl eines Manuals wird ein Index aller dokumentier- ten Funktionen, Kommandos, etc. ausgegeben. Durch Auswahl eines Stichwortes ( oder Mausklick) wird die auf dem Rechner vorhandene Dokumentation zu diesem Stichwort in einem Fenster ausgegeben. Die Dokumentation zu jedem dieser Stichworte kann auch direkt ueber den Menue-Punkt Function in ein Editoren- Fenster geladen werden. Diese Dokumentationen sind, wie alle Hilfestellungen, read- only Dateien, die mit Hilfe der Cursor-Tasten und der Such- Funktion bearbeitet werden koennen.  Das Editoren-Fenster Mit Hilfe des Editoren-Fensters koennen Dateien ediert werden. Hierfuer stehen die Maus (siehe Maus im Editoren-Fenster), Funktionstasten oder die Edito- ren-Menues zur Verfuegung. Die wichtigsten Menues haben die folgenden Funktionen: Kopieren, verschieben und loeschen ganzer Textbloecke innerhalb einer Datei (siehe Block-Menue) Kopieren, verschieben und loeschen ganzer Textbloecke zwischen verschiedenen Dateien (siehe Edit-Menue) Zeichenketten suchen und/oder ersetzen (siehe Search-Menue) Die Form und Lage der einzelnen Editoren-Fenster veraendern (siehe Window-Menue) Optionen fuer den Editor werden ueber das Options-Menue eingestellt. Dateien editiert, gesichert und ganz allgemein manipuliert wird ueber das File-Menue.  Das Find-Fenster In dem Find-Fenster werden alle Verzeichnisse aufgelistet, in denen die gesuchten Dateien durch Find gefunden wurden. Durch Eingabe von Alt-S oder  wird ein File-Manager fuer das markierte Verzeichnis aufgerufen und in ihm die gefun- denen Dateien angezeigt. Durch Eingabe von  kann das 'Find' - Fenster wieder geloescht werden.  Das Grep-Fenster In dem Grep-Fenster werden alle Dateien aufgelistet, in denen die Suchzeichenkette durch Grep gefunden wurde. Durch Eingabe von Alt-S oder  wird die markierte Datei in den Editor geladen und an die erste Textstelle gesprungen, die den Suchstring enthaelt. Durch Eingabe von  kann das Grep-Fenster wieder geloescht werden.  Das Message-Fenster Treten Fehler beim Uebersetzen oder Binden eines Programm- Codes auf, werden diese im Message-Fenster dokumentiert. Das Message-Fenster ist eine read-only Datei, die mit Hilfe der Cursor-Tasten und der Such-Funktion gelesen werden kann. Ausserdem kann durch betaetigen der Return-Taste, zu dem in der aktuellen Zeile beschriebenen Fehler gesprungen werden. Das Springen zu einem Fehler erfolgt in der Weise, dass die Datei in der dieser aufgetreten ist zur aktuellen Datei geschaltet wird, (Ist sie nicht geladen wird sie in ein neues Fenster geladen) und der Cursor an die von dem Com- piler angegebene Stelle gesetzt wird. Es kann dann der Fehler direkt behoben werden und ein neuer Uebersetzungsversuch gestartet werden.  Das Project-Fenster Im Project-Fenster werden die in der Projekt-Datei eingetragenen Dateien aufgelistet. Es wird ueber das Project-Menue oder das Window-Menue aufgerufen. Ueber die Eingabe von Alt-A (Add) oder  koennen neue Dateien zu den Projekt- Dateien hinzugefuegt werden. Hierzu wird der Datei-Manager aufgerufen. Eingabe von  oder Alt-A (Add) fuegt dann die markierte Datei hinzu. Durch Eingabe von Alt-E (Edit) oder  im Project-Fenster kann der Eintrag in der Liste der Projekt-Dateien veraendert werden. Durch Eingabe von Alt-D (Delete) oder  im Project-Fenster kann die markierte Datei aus der Liste der Projekt-Dateien entfernt werden. Durch Eingabe von Alt-O werden die Projekt-Optionen aufgerufen. Die Eingabe von  schliesst das Project-Fenster.  Das Variablen-Fenster Im Variablen-Fenster werden die in der Projekt-Datei definierten Variablen aufgelistet. Es wird ueber die Projekt-Optionen aufgerufen. Ueber die Eingabe von Alt-A (Add) oder  koennen neue Variablen definiert werden. Durch Eingabe von Alt-E (Edit) oder  kann die markierten Variable veraendert werden. Durch Eingabe von Alt-D (Delete) oder  kann die markierte Variable aus der Liste der definierten Variablen geloescht werden. Die Eingabe von  schliesst das Variablen-Fenster.  Das Install-Fenster Im Install-Fenster werden die in der Projekt-Datei auf- gefuehrten Kommandos, die beim Aufruf von Install (siehe Run-Menue) abgearbeitet werden sollen aufgelistet. Es wird ueber die Projekt-Optionen aufgerufen. Ueber die Eingabe von Alt-A (Add) oder  koennen weitere Kommandos der Liste hinzugefuegt werden. Durch Eingabe von Alt-E (Edit) oder  kann das markierte Kommando veraendert werden. Durch Eingabe von Alt-D (Delete) oder  kann das markierte Kommando aus der Liste entfernt werden. Die Eingabe von  schliesst das Install-Fenster.  Das Watch-Fenster Das Watch-Fenster ist ein read-only Fenster, in dem die Werte, der ueber die Watch Funktionen (siehe Debug-Menue) angegebenen Variablen ausgegeben werden. In dem Fenster kann mit Hilfe der Cursor-Tasten und der Such-Funktion gewandert werden. Zusaetzliche Funktionen sind (in Abhaengigkeit von der Cursor-Position im Watch-Fenster): Auf eine angegebene Variable, editiert diese. Am Ende der Datei, definiert eine neue Variable. Setzt eine neue Variable an die ensprechende Stelle Loescht die angegebene Variable Ist eine Variable in der aktuellen Funktion nicht vorhanden wird dies gemeldet.  Das Stack-Fenster Das Stack-Fenster ist ein read-only Fenster, in dem die Stack- Hierarchie angegeben wird. In dem Fenster kann mit Hilfe der Cursor-Tasten und der Such-Funktion gewandert werden. Zusaetzlich kann ueber  im Stack gesprungen werden (Funktioniert nicht fuer den Debugger 'sdb'). Der Aufruf des Stack-Fensters ist unbedingt bei einem Stop ueber ein Signal zu empfehlen, da in diesem Fall in die naechstliegende sichtbare Funktion (also nicht System-Funktion) gesprungen wird.  Die Maus (nur fuer XWindow): Wenn eine Maus installiert ist, koennen alle Tasteneingaben ueber diese vorgenommen werden. Diese erfolgen durch ein- faches Anklicken der entsprechenden Zeile bzw. des entsprechenden Kommando-Wortes. Ein Fenster wird geschlos- sen ueber das Anklicken des 'Cancel' Kommandos oder durch Anklicken des 'Close-Button' am oberen linken Rand des Fen- sters. Die Maus im Editoren-Fenster und die Maus im File-Manager haben noch zusaetzliche Funktionalitaet. Das Pressen des mittleren Maus-Buttons in einer zu bear- beitenden Zeile bewirkt ein Kopieren des Pufferinhalts an die Maus-Cursor- Position (Paste).  Die Maus im Editoren-Fenster Wenn eine Maus installiert ist, koennen alle Tasteneingaben ueber diese vorgenommen werden. Diese erfolgen durch ein- faches Anklicken der entsprechenden Zeile bzw. des entsprechenden Kommando-Wortes. Das Fenster wird geschlossen ueber das Anklicken des 'Close-Button' am oberen linken Rand des Fensters. Ein Zoom auf das Fenster wird durchgefuehrt in dem der 'Zoom-Button' (-[z]-) am rechten oberen Rahmen des Fensters angeklickt wird. Das Fenster wird Verschoben durch Anklicken des oberen Rah- mens und Verschieben der Maus bei festgehaltenem Maus- Button. Die Groesse des Fensters kann durch Anklicken einer Fen- sterecke und Verschieben der Maus bei festgehaltenem Maus- Button veraendert werden. Ein Sprung zu einer speziellen Zeilennummer kann durch Ank- licken der Zeilennummer und Eintragen in das dann erscheinende Fenster erreicht werden. Cursor-Bewegungen werden durch das Anklicken der Mausleisten bewirkt. Anklicken der Pfeile am oberen bzw. unteren Ende der Mausleste bewirken eine Cursorbewegung um jeweils eine Zeile nach oben bzw. unten. Ein Anklicken der Mausleiste oberhalb bzw. unterhalb des Zeigers bewirkt ein Blaettern um jeweils eine Seite nach oben bzw. unten. Das Anklicken des Zeigers und Bewegung der Maus bei festgehaltenem Maus-Button bewrikt ein Verschieben des Cursors realtiv zum Verschieben des Zeigers. Innerhalb des Fensters: Linker Maus-Button: Das einfache Pressen des linken Maus-Buttons innerhalb des Textes bewirkt das Setzen des Cursors an die entsprechende Stelle. Wird der Maus-Button gedrueckt, waehrend der Maus-Cursor auf dem Text-Cursor steht, wird das entsprechende Wort makiert. Geschieht letzteres innerhalb eines schon markierten Wortes, wird die ganze Zeile markiert. Bewegung des Maus-Cursors bei gedruecktem linken Maus-Button bewirkt ein Markieren des ensprechenden Textbereiches. Bei gleichzeitigem Druecken der Shift-Taste wird der Bereich zwischen Maus-Cursor und schon markierten Bereich zu letzteren hinzugefuegt. Rechter Maus-Button: Das Pressen des rechten Maus-Buttons bewirkt das Kopieren des markierten Bereichs in den Puffer (Copy). Wird gleichzeitig die Alt-Taste gedrueckt, wird in den X-Puffer kopiert. Bei gleichzeitig gedrueckter Shift-Taste wird der markierte Bereich aus dem Text geloescht und in den Puffer geschoben (Cut). Mittlerer Maus-Button: Das Pressen des mittleren Maus-Buttons bewirkt ein Kopieren des Pufferinhalts an die Maus-Cursor-Position (Paste). Wird gleichzeitig die Alt-Taste gedrueckt, wird aus dem X-Puffer kopiert.  Die Maus im File-Manager Wenn eine Maus installiert ist, koennen alle Tasteneingaben ueber diese vorgenommen werden. Diese erfolgen durch ein- faches Anklicken der entsprechenden Zeile bzw. des entsprechenden Kommando-Wortes. Das Fenster wird geschlossen ueber das Anklicken des 'Close-Button' am oberen linken Rand des Fensters. Ein Zoom auf das Fenster wird durchgefuehrt in dem der 'Zoom-Button' (-[z]-) am rechten oberen Rahmen des Fensters angeklickt wird. Das Fenster wird Verschoben durch Anklicken des oberen Rahmens und Verschieben der Maus bei festgehaltenem Maus- Button. Die Groesse des Fensters kann durch Anklicken einer Fen- sterecke und Verschieben der Maus bei festgehaltenem Maus- Button veraendert werden. Markierungen in der 'Files'-Liste als auch im Verzeichnis- baum koennen durch das Anklicken der Mausleiste bewegt wer- den. Anklicken der Pfeile am oberen bzw. unteren Ende der Mausleste bewirken eine Bewegung um jeweils eine Zeile nach oben bzw. unten. Ein Anklicken der Mausleiste oberhalb bzw. unterhalb des Zeigers bewirkt ein Blaettern um jeweils eine Seite nach oben bzw. unten. Das Anklicken des Zeigers und Bewegung der Maus bei festgehaltenem Maus-Button bewrikt ein Verschieben der Markierung realtiv zum Verschieben des Zeigers. Innerhalb des Fensters: Linker Maus-Button: Das einfache Pressen des linken Maus-Buttons auf einen unmarkierten Datei- oder Verzeichnisnamen markiert diesen. Das einfache Pressen auf einen markierten Dateinamen fuehrt zum Laden der Datei in den Editor. Das einfache Pressen auf einen markierten Verzeichnisnamen fuehrt zum Aendern des aktuellen Verzeichnisses auf das markierte. Pressen des linken Maus-Button auf eine markierte Datei oder Verzeichnis und Bewegung des Maus-Cursors bei gedruecktem Maus-Button bewirkt ein Verschieben dieser in ein anderes Verzeichnis unter der Vorraussetzung, dass zum Zeitpunkt des Loesens des Maus-Buttons, sich der Maus-Cursor in einem anderen File-Manager-Fenster befindet. Die Datei oder das Verzeichnis wird dann in das aktuelleingestellte Verzeichnis des letzteren File-Manager-Fenster verschoben. Rechter Maus-Button: Das Pressen des rechten Maus-Buttons auf einen markierten Datei- oder Verzeichnisnamen fuehrt zum Aufruf der Verschieben/Umbenenen-Option des File-Managers. Pressen des rechten Maus-Button auf eine markierte Datei oder Verzeichnis und Bewegung des Maus-Cursors bei gedrueck- tem Maus-Button bewirkt das Erzeugen eines Links auf die Datei in einem anderen Verzeichnis unter der Vorraussetzung, dass zum Zeitpunkt des Loesens des Maus-Buttons, sich der Maus-Cursor in einem anderen File-Manager- Fenster befindet. Der Link auf die Datei oder das Verzeichnis wird dann in das aktuell eingestellte Verzeichnis des letzteren File- Manager-Fensters erzeugt. Mittlerer Maus-Button: Das Pressen des mittleren Maus-Buttons auf einen markierten Datei- oder Verzeichnisnamen fuehrt zur Duplizierung der Datei bzw. des Verzeichnisses. Pressen des mittleren Maus-Button auf eine markierte Datei oder Verzeichnis und Bewegung des Maus-Cursors bei gedrueck- tem Maus-Button bewirkt das Kopieren dieser in ein anderes Verzeichnis unter der Vorraussetzung, dass zum Zeitpunkt des Loesens des Maus-Buttons, sich der Maus-Cursor in einem anderen File-Manager-Fenster befindet. Die Datei oder das Verzeichnis wird dann in das aktuell eingestellte Ver- zeichnis des letzteren File-Manager-Fenster kopiert.  Editor-Optionen Data: Alt-A Wenn angegeben: Die naechsten Dateien werden als ASCII-Dateien eingelesen und behandelt. Alt-B Wenn angegeben: Die naechsten Dateien werden als binaer Dateien eingelesen und behandelt. Display: Alt-S Wenn angegeben: Es werden die Zeilenenden markiert. Ein '$' steht fuer und ein '' fuer eine NULL (naechste Zeile ist Anschlusszeile). Autosave: Alt-P Wenn angegeben: Die eingestellten Optionen werden automatisch beim Verlassen des Editors gesichert. Alt-H Wenn angegeben: Es wird nach jeweils N textveraendernden Aktionen die Datei automatisch gesi- chert. N wird unter Max. Changes (siehe Alt-X) angege- ben. Das Sichern der Datei erfolgt in eine Datei 'Dateiname'.ASV und ueberschreibt nicht die Orginal- datei. Die Sicherheitskopie wird beim normalen Speichern geloescht. Keys (Interpretation der Funktionstasten): Alt-L Wenn angegeben: Es werden die bekannten xwpe Funktionstasten- belegungen verwendet. (Version < 1.2.0; Turbo C aehnlich) Alt-C Wenn angegeben: Es werden 'Common User Access' Tasten- interpretationen verwendet. (MS-Windows aehnlich, aber manchmal nicht so handlich). Auto-Indent (Automatischer Zeileneinzug): Alt-Y Wenn angegeben: Der Automatische Zeileneinzug bezieht sich nur auf Dateien mit Namensendungen, die unter Optionen/Compiler eingestellt sind. Alt-W Wenn angegeben: Der Automatische Zeileneinzug bezieht sich auf alle Dateien. Alt-V Wenn angegeben: Der Automatische Zeileneinzug ist ausgeschaltet. Alt-M Maximale Anzahl der Spalten pro Zeile. Nach der entsprechen- den Anzahl Zeichen, wird automatisch ein Zeilenumbruch durch- gefuehrt. Alt-T Interpretazion des Tabstop-Characters: Ein Tabstop wird als die entsprechende Anzahl Spalten interpretiert. Alt-X Wenn Autosave/Changes eingestellt ist wird nach der entpre- chenden Anzahl Textveraendernder Aktionen automatische eine Sicherheitskopie des Textes angelegt (siehe Alt-H). Alt-N Anzahl der Undo-Schritte, die ueber Edit/Undo rueck- gaengig gemacht werden koennen. Alt-I Anzahl der Spalten bei automatischen Zeileneinzug  File-Manager-Optionen Directories: Alt-F Wenn angegeben: auch versteckte Dateien werden gel- istet. Alt-D Wenn angegeben: auch versteckte Verzeichnisse werden gelistet. Alt-K Wenn angegeben: Alle Aktionen (Move, Link, Copy und Remove) werden rekursiv, also auch in Unterverzeich- nissen ausgefuehrt. Sort Files By (Sortieren der Dateien nach): Alt-N Name: Dateien werden alphabetisch sortiert. Alt-I Time: Dateien werden nach ihrem Erzeugungsdatum sor- tiert. Alt-B Bytes: Dateien werden nach ihrer Groesse sortiert. Alt-R Reverse: Reihenfolge der Sortierung wird umgekehrt. Move/Copy: Alt-Q Wenn angegeben: beim Verschieben/Umbennenen wird nachgefragt, ob gleichnamige Dateien ueberschrieben werden sollen. Alt-V Wenn angegeben: beim Verschieben/Umbennenen werden gleichnamige Dateien ueberschrieben. Alt-T Wenn angegeben: beim Verschieben/Umbennenen werden gleichnamige Dateien nicht ueberschrieben. Remove: Alt-W Wenn angegeben: Dateien werden beim Loeschen in den Papierkorb geschoben. Alt-A Wenn angegeben: Dateien werden absolut geloescht. Es wird vor dem Loeschen aber nachgefragt. Alt-M Wenn angegeben: Dateien werden ohne Nachfrage absolut geloescht. Links on Files: Alt-H Wenn angegeben: Es wird bei jedem Link versucht einen Hardlink auf eine Datei zu erzeugen. Ist dies nicht moeglich, wird ein symbolischer Link erzeugt. Alt-S Wenn angegeben: Jeder Link wird als symbolischer Link erzeugt. Wastebasket (Papierkorb): Alt-P Wenn angegeben: beim Verlassen von xwpe wird nachgefragt ob der Papierkorb geloescht werden soll. Alt-E Wenn angegeben: der Papierkorb wird beim Verlassen von xwpe geloescht. Alt-L Wenn angegeben: der Papierkorb wird beim Verlassen von xwpe nicht geloescht.  Compiler-Optionen Beim Aufruf des Menuepunktes  Options/Compiler werden, die Untermenuepunkte  Add Compiler,  Remove Compiler und die bereits eingestellten Compiler aufgelistet. Ueber den Punkt Add Compiler, sowie ueber die einzelnen schon eingestellten Compiler gelangt man zu dem folgenden Optionen-Menue: Language Unter diesem Punkt wird der Name der Programmiersprache eingegeben. Compiler Hier wird der Compiler-Pfad angegeben. Compiler-Options Hier werden die vom Compiler bei der Uebersetung zu beruecksichtigen Optionen eingestellt. Loader-Options Hier werden die vom Loader beim Binden zu beruecksi- chtigen Optionen eingestellt. Executable-Name Name des auszufuehrenden Programms (Voreinstellung ist Programmname.e) File-Postfix Der File-Postfix gibt an welche Dateien mit diesem Com- piler bearbeitet werden sollen (Beispiel: .c fuer C-Compiler). Compiler-Style Gibt an wie eventuell aufgetretene Fehler interpretiert werden sollen. Es gibt die beiden Moeglichkeiten 'GNU' fuer GNU aehnliche Compiler und 'Other' fuer Compiler die andere Fehlermeldungssyntax verwenden. Wenn 'Other' ausgewaehlt wurde, wird der Message-String (siehe unten) interpretiert, um Fehlermeldungen zu erkennen. OK Veraenderungen werden uebernommen. CANCEL Verlassendes Menues ohne Veraenderungen. Mit Add Compiler wird ein neuer Compiler zu den vorhan- denen hinzu- gefuegt. Ueber den Aufruf eines vorhandenen Compilers koennen dessen Optionen veraendert werden. Remove Compiler mit dieser Option kann ein vorhandener Compiler wieder aus der Liste geloescht werden.  Projekt-Optionen Compiler Hier wird der Compiler-Pfad angegeben. Compiler-Options Hier werden die vom Compiler bei der Uebersetung zu beruecksichtigen Optionen eingestellt. Loader-Options Hier werden die vom Loader beim Binden zu beruecksi- chtigen Optionen eingestellt. Executable-Name Name des auszufuehrenden Programms (Voreinstellung ist a.out) Store Objects in Library Wird hier ein Bibliotheksname angegeben, werden die erzeugten Objektdateien in dieser abgelegt. Die Bibliothek wird beim Binden dann mit beruecksichtigt. Compiler-Style Gibt an wie eventuell aufgetretene Fehler interpretiert werden sollen. Es gibt die beiden Moeglichkeiten 'GNU' fuer GNU aehnliche Compiler und 'Other' fuer Compiler die andere Fehlermeldungssyntax verwenden. Wenn 'Other' ausgewaehlt wurde, wird der Message-String (siehe unten) interpretiert, um Fehlermeldungen zu erkennen. Variablen ... Die Variablen des Projekts werden in einem gesonderten Variablen-Fenster aufgelistet. Es koennen sowohl Varia- blen geloescht als auch neue hinzugefuegt werden. Install ... Die Anweisungen, die beim Aufruf der Install-Anwendung abgearbeitet werden sollen, werden in einem gesonderten Install-Fenster aufgelistet. Es koennen sowohl Anweisungen geloescht als auch neue hinzugefuegt wer- den. Save Veraenderungen werden in der angegebenen Projekt-Datei gespeichert. Save As Veraenderungen werden unter neuem Namen gespeichert. CANCEL Verlassendes Menues ohne Veraenderungen.  C-Programmierhilfen Nur fuer C bzw. C++ - Programmtexte werden die folgenden Programmierhilfen zur Verfuegung gestellt: Sprung zur Definition eines C-Ausdrucks (Show Definition ^O S): Die Datei, in der sich die Definition des Suchausdrucks befindet, wird in den Vordergrund geholt oder geladen. Der Cursor der Suchausdruck wird hierbei markiert und der Cursor an die entsprechende Stelle gesetzt. Es werden Struktur-, union-, class-, typedef-, Preprozessor-, externe Variablen- und Funktionsdefinitionen erkannt. Durchsucht wird die Datei im aktuellen Fenster sowie alle Projekt-Dateien, wenn ein Projekt geoeffnet wurde. Hierbei werden alle ueber #include eingefuegten Dateien rekursiv durchsucht, soweit sie ueber den in Optionen/Programming eingestellten System-Include- Path gefunden wurden. Ist ein gesuchter Name mehrmals definiert worden (z.B. als Name einer Struktur und als Name einer externen Variablen) kann die naechste Definition mit ^O N (Show next Definition) gesucht werden. Zugehoerige Klammer (Matching Bracket ^O K): Wird dieser Menue-Punkt aufgerufen, wird der Cursor, wenn er sich auf einer Klammer befindet auf die dazu gehoerige gesetzt. Befindet sich der Cursor auf keiner Klammer wird zurueck zur naechsten oeffnenden gesprungen. Es werden geschweifte {}, eckige [] und runde () Klammern beruecksichtigt. Text verschoenern (Beautify ^O B): Wird dieser Menue-Punkt aufgerufen werden die einzelnen Bloecke gleichmaessig eingerueckt. Hierbei entspricht der Grad der Einrueckung der Tiefe der Blockverschachtelung.  Projekt-Datei Mit Hilfe der Projekt-Datei koennen Programme, die aus mehreren Modulen bestehen interaktiv bearbeitet werden. Die Projekt-Datei kann ueber den Menue - Punkt Run/Options/Project-Options (siehe Projekt-Optionen) erstellt werden oder aber direkt ediert werden. Die Syntax der Projekt-Datei ist kompatibel zu der von Makefiles. (dies gilt ab der Version 1.1.0 und ist nicht kompatibel zu frueheren Versionen). Fuer die Projekt-Datei sind nur Variablen-Definitionen und die Definition des 'install' - Targets von Bedeutung. Syntax fuer Variablen-Defintionen ist: Variablenname = Zeichenkette Auf diese Weise koennen beliebige Variablen definiert wer- den. Die Variablen werden ueber $(Variablenname) in der Reihenfolge ausgewertet, dass erst nach einer Umgebungsvari- able dieses Namens gesucht wird. Ist diese nicht vorhanden, wird nach einer Definition in der Projekt- Datei gesucht. Ist diese auch nicht vorhanden, wird eine leere Zeichenkette fuer $(Variablenname) eingesetzt. Folgende Variablen haben feste Bedeutungen: FILES Eine beliebige Anzahl zu uebersetzender Programm-Code Module, die zu einem Executable zusammengebunden werden sollen. CMP Compiler-Pfad CMPFLAGS Compiler-Optionen CMPSWTCH Fehlerinterpretation (Voreinstellung ist 'GNU', es kann LDFLAGS Loader-Optionen EXENAME Name des Executables (Voreinstellung ist a.out) LIBNAME Name der Bibliothek. Wenn angegeben, werden die Objektdateien in der Bibliothek gespeichert und diese beim Binden des Programms beruecksichtigt. Aus einem Makefile kann also einfach eine Projekt-Datei gemacht werden, in dem am Ende z.B. die folgenden Zeilen eingefuegt werden (fuer C) : FILES=$(CFILES) CMP=$(CC) LDFLAGS=$(LIBFLAGS) EXENAME='Targetname' Beim Aufruf der Compile- bzw. Make-Anwendung: Die Dateien werden nach einander in der angegebenen Reihenfolge bearbeitet. Wenn eine Datei seit der letzten Uebersetzung veraendert wurde, wird diese neu uebersetzt. Tritt ein Fehler auf, wird die Bearbeitung der Projekt-Datei abgebrochen und eine Fehlerausgabe durchgefuehrt (siehe Message-Fenster). Ist kein Fehler aufgetreten, werden alle Objektdateien unter Beruecksichtigung der Loader-Optionen zu einem Executable mit dem unter name: angegebenen Namen zusam- mengebunden. In der Projekt-Datei kann ein 'install'-Target angege- ben werden. Dieses beginnt mit install: In der gleichen Zeile eventuell folgende Abhaengig- keiten wie in einem Makefile werden ignoriert. Die Abhaengigkeiten der install-Anwendung sind stattdessen durch die oben beschriebene Variable FILES gegeben. Nach diesem Targetnamen werden alle folgenden Zeilen die mit einem beginnen als UNIX-Kommandos inter- pretiert und ausgefuehrt. Hiebei wird die Auswertung eventuell auftretender Variablen berueck- sichtigt: Kommando1 Kommando2 koennen alle UNIX-Kommandos benutzt werden (das Kom- mando 'cd' bleibt ohne Wirkung). Das Install-Target wird ueber den Menuepunkt Run/Install (oder Alt-L) aus- gefuehrt (siehe Run-Menue).  Der Message-String: Der 'Message-String' wird zur Interpretation der Compiler- Ausgabe verwendet, wenn der 'Compiler-Style' 'Other' eingeschaltet ist. Der 'Message-String' muss normalerweise an den verwendeten Compiler angepasst werden. Er wird mit der Compiler-Ausgabe wie folgt verglichen: '*' steht fuer eine beliebige Zeichenkette. '?' steht fuer ein beliebiges Zeichen. '[ ]' steht fuer ein Zeichen aus der Liste zwischen den eckigen Klammern. (Es gilt die gleiche Syntax wie beim File-Manager.) ${FILE} wirkt wie '*', aber die Zeichen werden als Name der Datei, in der der Fehler aufgetreten ist gespeichert. ${LINE[+-N]} wirkt wie '*', aber die Zeichen werden als Zeilennummer interpretiert. Es kann eine Zahl N addiert oder subtrahiert werden. ${FILE} und ${LINE} muessen in dem Message-String angegeben werden. Kann eine Compiler- Ausgabezeile so interpretiert werden, dass ein gueltiger Dateiname und eine gueltige Zeilennummer erhalten werden, wird diese als Fehlerausgabe gewertet. Optional ist die Interpretation der Spaltenangabe. Hier gibt es mehrere Moeglichkeiten: ${COLUMN[+-N]} - die Zeichenkette ${COLUMN} wird als Zahl interpretiert. ${COLUMN=BEFORE[+-N]} - die Zeichenkette ${COLUMN} wird als Suchausdruck interpre- tiert und die Spalte ist die vor dem gefundenen Ausdruck. ${COLUMN=AFTER[+-N]} - die Zeichenkette ${COLUMN} wird als Suchausdruck interpretiert und die Spalte ist die hinter dem gefundenen Ausdruck. In allen drei Faellen kann eine Zahl N addiert oder subtrhiert werden. Erstrecken sich Fehlerangaben ueber mehrere Zeilen (z.B. Sun-Pascal: pc) kann dies dadurch beruecksichtigt werden, dass im Message-String CR's (^M) angegeben werden, mit Hilfe derer die Interpretation auf mehrere Zeilen aufgeteilt wer- den kann. Fuer diese Faelle gibt es die Vergleichszeichenk- ette ${CMPSTR}, mit Hilfe derer die Angabe ${COLUMN=PREVIOUS?STR[+-N]} in der folgenden Zeile ausgewer- tet werden kann. STR ist eine Suchzeichenkette, die mit ${CMPSTR} verglichen wird. Warnungen: Warnungen werden durch Vergleich mit einer Zeichenkette STR wie folgt erkannt: ${?N:STR} - N kann eine Zahl oder ein '*' sein. Ist N eine Zahl gibt sie die Spalte an, an der die Warnung beginnen soll. Ist ein '*' angegeben, kann STR irgendwo im Text auftreten. Es koennen beliebig viele Warnumgszeichenketten angegeben werden. Beispiele: gcc: ${?*:warning:}${FILE}:${LINE}:* before \ `${COLUMN=BEFORE}' cc(Sun): ${?*:warning:}"${FILE}", line ${LINE}:* \ at or near * "${COLUMN=AFTER}" cc(HP): ${?*:warning:}cc: "${FILE}", line ${LINE}:* \ at or near * "${COLUMN=AFTER}" pc(Sun): ${?0:e}${?0:w}${?0:s}*:*:* * ${FILE}:^M^M* \ ${LINE} ${CMPTXT}^M*-------${COLUMN=PREVIOUS?^}  Syntax-Unterstuetzung: xwpe bietet eine Syntax-Unterstuetzung, die darin besteht, dass die Schluesselworte und Operatoren einer Sprache unter- schieden werden von den Konstanten, den Preprozessor- Anweisungen und dem Rest des Textes. Voreingestellt ist die Unterstuetzung der Programmiersprachen C, C++, FORTRAN. Durch die Initialisierungsdatei we_synt_defs koennen aber weitere Sprachen hinzugefuegt bzw. die voreingestellten ueberschrieben werden. Die zu benutzende Sprache wird anhand der Dateiendung festgestellt. Die Datei we_synt_defs ist eine ASCII-Datei und kann im Verzeichnis ../lib/wpe relativ zum Verzeichnis der xwpe oder im persoen- lichen Heimatverzeichnis unter .wpe abgelegt werden. Sie muss fuer jede Sprache wie folgt aufgebaut sein: "Zeichenkette: Endung des Dateinamen" "Integer: Anzahl der Schluesselworte" "Zeichenketten: Schluesselworte" "Integer: Anzahl der Mehrzeichen-Operatoren" "Zeichenketten: Mehrzeichenoperatoren" "Zeichenkette: Alle Einzeichen-Operatoren" "Zeichenkette: Beginn-Kommentar" "Zeichenkette: Ende-Kommentar" "Zeichenkette: Beginn-Kommentar bis zum Ende der Zeile" "Zeichenkette: alle Zeichen fuer Spaltenabhaengigen Kommentar" "Zeichenkette: speziellen Einzelzeichen" "Integer: Spalte fuer Kommentar (-1 kein spaltenabhaengiger Kommentar)" "Integer: Spalte fuer Anschlusszeile (-1 keine spaltenabhaengige Anschlusszeile)" "Integer: Spalte Kommentar bis zum Ende (1000 kein spaltenabhaengiger Kommentar)" Die Zeichenketten und Integer muessen durch Blanks oder CR getrennt werden. Die Zeichenketten aus Einzeichenoperatoren und Zeichen fuer Spaltenabhaengige Kommentare duerfen keine Leerzeichen enthalten. Alle Zeichenketten fuer Kommentare koennen durch NULL auf 'nicht vorhanden' gesetzt werden. Die Anzahl-Integer duerfen auf 0 gesetzt werden, wenn keine Schluesselworte bzw. Mehrzeichen Operatoren existieren. Die Zeichenkette 'spezielle Zeichen' setzt sich wie folgt zusam- men: Zeichen fuer String-Konstante Zeichen fuer Character-Konstante Zeichen fuer Preprozessor-Anweisung Zeichen fuer naechstes Zeichen uninterpretiert Zeichen fuer naechste Zeile ist Anschlusszeile (wenn am Ende der Zeile) Zeichen (zur Zeit keine Bedeutung) Zeichen fuer naechste Zeile ist Anschlusszeile (an beliebiger Stelle) Zeichen (wenn nicht leer wird Gross/Kleinschreibung bei Schluesselworten nicht unterschieden.) Ein Leerzeichen innerhalb dieser Zeichenkette steht fuer das Fehlen des entsprechenden Zeichens. Beispiele: .c 33 NULL auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while 0 ()[]{}<>+-/*%=|&!.?:,; /* */ NULL NULL "'#\ -1 -1 1000 .f 64 ACCESS ASSIGN BACKSPACE BLANK BLOCKDATA CALL CHARACTER CLOSE COMMON COMPLEX CONTINUE DATA DIMENSION DIRECT DO DOUBLE PRECISION ELSE END ENDFILE ENTRY EQUIVALENCE ERR EXIST EXTERNAL FILE FMT FORM FORMAT FORMATTED FUNCTION GOTO IF IMPLICIT INQUIRE INTEGER INTRINSIC IOSTAT LOGICAL NAME NAMED NEXTREC NUMBER OPEN OPENED PARAMETER PAUSE PRINT PROGRAM READ REAL REC RECL RETURN REWIND SAVE SEQUENTIAL STATUS STOP SUBROUTINE TO UNFORMATED UNIT WRITE 13 .AND. .EQ. .EQV. .FALSE. .GE. .GT. .LE. .LT. .NE. .NEQV. .NOT. .OR. .TRUE. ()+-/*=$.:, NULL NULL ! C* ' 1 0 5 72  Automatischer Zeileneinzug Der automatische Zeileneinzug kann unter Editor-Optionen eingestellt werden. Er betieht sich auf folgende Tasten: Die neue Zeile wird bis zum Beginn der vorheri- gen Zeile eingerueckt. Vor dem ersten sichtbaren Zeichen einer Zeile eingegeben bewirkt ein Einruecken der Zeile bis zum Beginn der vorherigen. Ist die Cursor- Position hinter dieser Spalte wird um die Anzahl von Spalten gegenueber der vorherigen Zeile eingerueckt, die unter Editor-Optionen eingestellt ist. Befindet sich der Cursor auch hinter dieser Position, wird ein Tabulator- zeichen eingefuegt. Letzteres geschieht auch wenn der Cursor sich zwischen sichtbaren Zeichen befindet. Vor dem ersten sichtbaren Zeichen einer Zeile eingegeben bewirkt ein Einruecken der Zeile bis zum Beginn der naechsten vorhergehenden Zeile, deren Beginn vor der Cursor-Position liegt.  Installations-Hinweise Das XWindow Programming Environment ist als eine System V kompatible Anwendung geschrieben, die fuer den UNIX - Teil mit der Curses-Library unter Benutzung der Terminfo- Terminal-Informationen arbeitet. Sollte keine Terminfo- Informationen auf dem ensprechenden System zur Verfuegung stehen, kann ueber die Definition der Pre-Prozessor-Varia- blen TERMCAP, bei der Installation, ersatzweise die Verwen- dung von termcap-Informationen vorgegeben werden. Fuer Sys- teme wie Sunos 4, die System V Erweiterungen in zusaetzlichen Pfaden abgelegt haben, muessen diese in die ensprechenden Include- und Library-Pfade eingebunden werden. Fuer den XWindow-Teil wird die X-Library ab X11R3 voraus- gesetzt. Die ensprechenden Pfade muesssen ebenfalls eingebunden werden. Ein wichtiger Punkt ist, dass die ALT- Taste unter XWindow als mod4 interpretiert wird (wie unter Sun ueblich). gegeben falls muss diese Taste mit xmodmap -e "add mod4 = Alt_L" dem XWindow-System hinzugefuegt werden. Um die Hilfestellung 'Funktions-Index' benutzen zu koennen muss eine Umgebungsvariable MANPATH gesetzt sein, die die Pfade zu allen gewuenschten Dokumentationen enthaelt. Bei der Installation sollte entschieden werden, welche Pro- grammiersprachen unterstuetzt werden sollen, und die Datei .wpe_pr_opt fuer die Syntax-Unterstuetzung, sowie der Message-String fuer die entsprechenden Compiler angepasst werden. Bei einigen Rechnern (z.B.: S400) muessen fuer den XWindow Teil auch Netz-Bibliotheken beim Binden beruecksichtigt wer- den.  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 pro- grams; 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 cer- tain 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 prob- lems 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 redis- tributors 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 licen- see 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 con- stitute 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, pro- vided 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 pub- lish, 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 war- ranty) 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 Pro- gram 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 defini- tion 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 any- thing 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 execut- able. If distribution of executable or object code is made by offering access to copy from a designated place, then offer- ing 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 distri- bute 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 per- mission to modify or distribute the Program or its deriva- tive works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distri- buting 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 modi- fying 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 reci- pients' 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 unenforce- able 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 contribu- tions 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 wil- ling 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 res- tricted in certain countries either by patents or by copy- righted interfaces, the original copyright holder who places the Program under this License may add an explicit geograph- ical 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 Foun- dation. 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 dif- ferent, write to the author to ask for permission. For software which is copyrighted by the Free Software Founda- tion, 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 deriva- tives 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 WARRAN- TIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PUR- POSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFEC- TIVE, 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 redis- tribute 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 Foun- dation; 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 Pub- lic License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cam- bridge, 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 program- mer) or your school, if any, to sign a "copyright disclai- mer" 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. xwpe-1.5.30a/old/xwpe.1_gr0000644000076400007640000020442410263105405014273 0ustar dulsidulsi.\" t .\" @(#)xwpe.1 3/22/94 .de EX \"Begin example .ne 5 .if n .sp 1 .if t .sp .5 .nf .in +.5i .. .de EE .fi .in -.5i .if n .sp 1 .if t .sp .5 .. .ta .3i .6i .9i 1.2i 1.5i 1.8i .TH xwpe 1.3 "Mar 22, 1994" .UC .SH NAME xwpe, xwe, wpe, we \- XWindow Programming Environment .SH SYNOPSIS .EX \fBxwpe\fP [ \fIoptionen\fP ] Datei ... \fBxwe\fP [ \fIoptionen\fP ] Datei ... \fBwpe\fP [ \fIoptionen\fP ] Datei ... \fBwe\fP [ \fIoptionen\fP ] Datei ... .EE .SH DESCRIPTION \fIxwpe\fP ist die XWindow-Version des XWindow Programming Environments. \fIxwe\fP ist der XWindow Editor ohne die Programmierumgebung. \fIwpe\fP ist die UNIX-Version der Programmierumgebung fuer zeichenorientierte Terminals. \fIwe\fP ist der Editor ohne Programmierumgebung fuer zeichenorientierte Terminals. Das XWindow Programming Environment ist eine Programmierumgebung fuer UNIX - Betriebssysteme, die weitgehend der Borland C++ bzw. Turbo- Pascal - Entwicklungsumgebung nachgebildet ist. Sie besteht aus einem Maus-unterstuetzenden, Menue-gesteuerten Editor, aus dem heraus beliebige Uebersetzungs- und Bindungsprogramme sowie der Debugger gestartet werden koennen. Beim Uebersetzen und Binden aufgetretene Fehler werden, soweit sie vom Compiler erkannt worden sind, direkt an der entsprechenden Stelle im Text angezeigt und koennen dann dort behoben werden. Es ist moeglich das erzeugte ausfuehrbare Programm zu Testzwecken direkt aus der Programmierumgebung zu starten. Programme, die aus mehr als einem Modul (Quell-Datei) bestehen, koennen ueber die sogenannte Projekt- Option (siehe \fIProjekt-Datei\fP) bearbeitet werden. Fehler in uebersetzten Programmen koennen aus der Programmierumgebung heraus mit Hilfe der Debug-Umgebung gesucht werden. Hiebei werden Breakpoints direkt im Quelltext gesetzt oder wieder geloescht. Ein Programm-Break wird an der entsprechenden Stelle im Text angezeigt. Die Werte von Variablen koennen ueber die Watch-Option (siehe \fIWatch-Fenster\fP) bei jedem Break ausgegeben werden. Der Stack kann ausgegeben und in ihm kann ueber Funktionstasten gewandert werden (siehe \fIStack-Fenster\fP). Die Entwicklungsumgebung bietet eine Hilfe-Funktion, in die sowohl Hilfestellungen zu der Umgebung selber, wie auch saemtliche Dokumentationen zu Funktionen und Kommandos (man-pages) auf dem entsprechenden Rechner integriert sind. Im Editor koennen bis zu 35 Dateien gleichzeitig ediert werden. Er arbeitet sowohl Maus- als auch Funktionstasten unterstuetzt. Alle Funktionen koennen entweder ueber Menue oder direkt durch Funktionstasten ausgefuehrt werden. Er bietet eine ausfuehrliche Such/Textersatz-Funktion mit der Moeglichkeit nach regulaeren Ausdruecken zu suchen. Weiterhin ist ein Datei-Manager integriert mit Hilfe dessen Dateienpfade als Baumstruktur dargestellt und aus dieser heraus editiert, kopiert, Namen und Pfade geaendert oder geloescht werden koennen. Die Entwicklungsumgebung kann auf den Editor reduziert werden (z.B. zur Shell-Programmierung ), in dem sie mit `xwe' aufgerufen wird. Fuer nicht XWindow-Systeme ist die Programmierumgebung auch als `wpe' bzw. der reine Editor als `we' verfuegbar. .SH COPYRIGHTS Copyright (C) 1993 Fred Kruse xwpe ist frei kopierbar unter den Bedingungen der GNU General Public License. Es wird fuer diese Sofware keinerlei Garantie oder Gewaehrleistung uebernommen. .SH OPTIONS Parameter sind: .IP "\fB-so\fP" Fuer die Sitzung werden Standardoptionen gesetzt. Die Optionendatei wird nicht gelesen. .IP "\fB-sf\fP" Es werden die Standardfarben gesetzt. Alle anderen Einstellungen werden der Optionendatei entnommen. .IP "\fB-sf\fP \fIoptionfile\fP" Statt der Standardoptionendatei (\fI$HOME/.wpe/wperc\fP) wird die Datei '\fIoptionfile\fP' gelesen. .IP "\fB-r\fP" Bei einem Sitzungsabbruch durch ein Signal (nicht kill -9) werden alle internen Puffere in Dateien mit dem Postfix '.ESV' geschrieben. Die abgebrochene Sitzung kann dann durch Aufruf des Editors unter Angabe des Parameters \fB-r\fP wiederhergestellt werden. .IP "\fB-mb\fP" Die folgenden Dateien sind binaere Dateien. .IP "\fB-mn\fP" Die folgenden Dateien sind ASCII Dateien (Standardeinstellung) .IP "\fB-nc\fP \fIN\fP" \fIN\fP ist eine ganze Zahl, die die maximale Anzahl der Spalten angibt. .IP "\fB-nu\fP \fIN\fP" \fIN\fP ist eine ganze Zahl, die die Anzahl der rueckgaengigmachbaren Manipulationen angibt. .IP "\fB-nm\fP \fIN\fP" \fIN\fP ist eine ganze Zahl, die die maximale Anzahl der Veraenderungen angibt, nach denen ein Autosave durchgefuehrt werden soll. .IP "\fB-k\fP \fIpassword\fP" Die folgende Datei soll beim lesen mit 'password' entschluesselt und beim Schreiben mit '\fIpassword\fP' verschluesselt werden. .IP "\fB-pm\fP" Naechste Datei ist eine Message-Datei .IP "\fB-pt\fP" Message-Datei soll fuer 'traditional' Compiler interpretiert werden (siehe \fICompiler-Optionen\fP). .IP "\fB-pe\fP" Message-Datei soll fuer 'extended' Compiler interpretiert werden (siehe \fICompiler-Optionen\fP). XWindow-Parameter: .IP "\fB-display\fP \fIDisp\fP" Ausgabe auf Display '\fIDisp\fP' .IP "\fB-fn\fP \fIFontname\fP" .IP "\fB-font\fP \fIFontname\fP" Einstellung des Fonts '\fIFontname\fP' .IP "\fB-g\fP \fIGeometrie\fP" .IP "\fB-geometry\fP \fIGeometrie\fP" Abmessung des XWindows (z.b.: -g 80x20+4+4) .IP "\fB-iconic\fP" XWindow als Ikone oeffnen .SH INITIALISIERUNGSDATEI: xwpe kennt die Initialisierungsdatei: .EX wperc .EE Die Datei kann systemseitig im Verzeichnispfad ../lib/wpe relativ zum Pfad der Programmierumgebung xwpe abgelegt sein. Jeder Benutzer kann aber auch seine eigene Initialisierungsdatei im eigenen Heimatverzeichnis (Standard: $HOME/.wpe/wperc) anlegen. Die Reihenfolge der Beruecksichtigung ist: Als erstes wird auf eine persoenliche Initialisierungsdatei geprueft, ist eine solche nicht vorhanden, wird auf eine Systemdatei geprueft. Ist letztere nicht vorhanden, werden festvorgegebene interne Einstellungen benutzt. Die Binaer-Datei \fIwperc\fP wird aus der Programmierumgebung heraus erzeugt und speichert die aktuellen Einstellungen. (siehe das \fIOptions-Menue\fP) .SH X-Resourcen: In der X-Resourcen-Datei \fI.Xdefaults\fP koennen folgende Eintraege fuer X-Window Standardvoreinstellungen vorgegeben werden: .IP "\fBxwpe.font:\fP" Der zu benutzende Textfont (8x13, 9x15, 10x20, 8x13bold, 9x15bold, 10x20bold) .IP "\fBxwpe.geometry:\fP" Die X-Window-Geometrie .IP "\fBxwpe.iconic:yes\fP" xwpe wird als Icon geoeffnet. .IP "\fBxwpe.color1:\fP" .IP "\fB...\fP" .IP "\fBxwpe.color16:\fP" xwpe beruecksichtigt 16 Farben. Diese sind in Anlehnung an die 16 PC-Farben standardmaessig eingestellt und koennen hier veraendert werden. .SH ACHTUNG: Die Datei .wperc, die vor der Version 1.3.1 erstellt wurde, sollten geloescht werden. Die Datei .xwperc, die vor der Version 1.2.1 erstellt wurde, wird nicht mehr beruecksichtigt und kann geloescht werden. Eventuell vorhandene Initialisierungs- und Hilfedateien im binaer Verzeichnis der xwpe sollten ab Version 1.3.1 geloescht werden. .SH Das Hauptmenue: Das WE-Menue kann durch Eingabe von F10, Alt- (oder aus dem Editorenfenster) erreicht bzw. ueber wieder verlassen werden. Jedes einzelne Untermenue kann durch Eingabe von Alt- direkt aufgerufen werden. Die Untermenues sind: .EX Das \fISystem-Menue\fP Environment-Verwaltung Das \fIFile-Menue\fP Dateien-Verwaltung Das \fIEdit-Menue\fP Edieren zwischen verschiedenen Fenstern Das \fISearch-Menue\fP Such-Anwendungen Das \fIBlock-Menue\fP Edieren in einem Fenster Das \fIRun-Menue\fP Programmierumgebung (nicht bei we oder xwe) Das \fIDebug-Menue\fP Debug-Umgebung (wenn installiert; nicht bei we oder xwe) Das \fIProject-Menue\fP Mehrdateien Projecte (nicht bei we oder xwe) Das \fIOptions-Menue\fP Einstellungen Das \fIWindow-Menue\fP Fenster-Verwaltung Das \fIHelp-Menue\fP Hilfestellungen .EE .SH Das System-Menue (Alt-# oder Alt-): .EX About WE A Zeigt Versionsnummer und Copyright an. Clear Desktop C Schliesst alle Fenster. Repaint Desktop R Initialisiert den Schirm und baut die einzelnen Fenster neu auf. System Info S Gibt einige Informationen zur aktuellen Edit-Sitzung aus. Show Wastebasket W Inhalt des Papierkorbs im File-Manager anzeigen Delete Wastebasket D Inhalt des Papierkorbs loeschen .EE .SH Das File-Menue (Alt-F): .EX File-Manager M Holt das \fIFile-Manager\fP-Fenster in den Vordergrund, wenn nicht vorhanden, wird es erzeugt. ADd F.-Mng. D Erzeugt neues File-Manager-Fenster New N Erstellt eine neue Datei mit Namen 'Noname' Save S Sichert die aktuell bearbeitete Datei Save As A Sichern unter anderem Namen (siehe \fIFile-Manager\fP) Save ALl L Sichert alle editierten Dateien Execute E \fIExecution-Manager\fP SHell H Aufruf der UNIX-Shell Find F Suchen nach Dateinamen (siehe \fIFind\fP) Grep G Suchen nach Zeichenketten in Dateien (siehe \fIGrep\fP) Print P Drucken der aktuellen Datei Quit Q \fIBeenden der Sitzung\fP .EE .SH Das Edit-Menue (Alt-E): .EX Cut T Loescht markierten Text in den Puffer Copy C Kopiert markierten Text in den Puffer Paste P Kopiert Puffer-Inhalt hinter den Cursor Show Clipboard S Zeigt den Puffer-Inhalt an. Delete D Loescht markierten Text Undo U Macht letzte Textaenderung rueckgaengig Redo R Macht letztes Undo wieder rueckgaengig Load XBuffer L Kopiert den XWindow-Buffer in den Paste-Buffer Write to XBuffer W Kopiert den Paste-Buffer in den XWindow-Buffer .EE .SH Das Search-Menue (Alt-S): .EX Find F Eine Zeichenkette suchen (siehe \fISuch/Textersatz-Funktion\fP) Replace R Eine Zeichenkette suchen und ersetzen (siehe \fISuch/Textersatz-Funktion\fP) Search again S Wiederholtes Suchen bzw. Ersetzen Go to Line G Sprung zu einer anzugebenden Zeilenummer .EE .SH Das Block-Menue (Alt-B): .EX Begin Mark B Beginn eines Blocks markieren End Mark E Ende eines Blocks markieren Mark Line L Eine Zeile markieren Mark Whole W Ganzen Text markieren Goto Begin G Zum Beginn eines Blockes springen Goto End N Zum Ende eines Blockes springen Copy C Kopieren eines Blocks Move M Verschieben eines Blocks Delete D Loeschen eines Blocks Hide H Loeschen der Anfangs- und Endmarke eines Blocks Read R Einfuegen einer Datei an die Cursor- Position Write W Schreiben eines Blocks in eine Datei Move to Right I Block eines halben Tabulator nach rechts verschieben Move to Left T Block eines halben Tabulator nach links verschieben .EE Bloecke koennen markiert werden, in dem die Tastenkombinationen `^k b' und `^k k' verwendet werden. `^k b' setzt den Block-Anfang auf die Cursor-Position. `^k k' setzt das Block-Ende auf die Cursor-Position. Unter XWindow koennen Bloecke auf zwei weitere Arten markiert werden: Bewegen des Cursors bei gedrueckter Shift-Taste makiert den vom Cursor beruehrten Text als Block. Bewgendes Maus-Cursors bei gedruecktem linken Button makiert den vom Maus-Cursor beruehrten Text als Block. .SH Run-Menue (Alt-R): .EX Compile C Uebersetzen des Programm-Codes (siehe \fIProgrammierumgebung\fP) Make M Erzeugen des Executables Run R Erzeugen und Ausfuehren des Executables Install I Installierungsroutine (siehe \fIProjekt-Datei\fP) Execute make E Fuehrt das System-Kommando 'make' aus. Next Error N Sprung zum naechsten Fehler Previous Error P Sprung zum vorherigen Fehler Show Definition S Sprung zur Definition eines Ausdrucks (siehe \fIC-Programmierhilfen\fP) Show Next Def. X Sprung zur naechsten Definition des gefundenen Ausdrucks (siehe \fIC-Programmierhilfen\fP) Matching Bracket K Sprung zur zugehoerigen Klammer (siehe \fIC-Programmierhilfen\fP) Beautify B gleichmaessiges einruecken von Programm- bloecken (siehe \fIC-Programmierhilfen\fP) Arguments A Eingabe einer Argumentenliste zur Ueber- gabe an das auszufuehrende Programm .EE .SH Debug-Menue (Alt-D):(siehe die \fIDebug-Umgebung\fP) .EX Toggel Breakpoint B Setzen/Loeschen eines Breakpoints ReMove all Breakp. M Loeschen aller Breakpoints Make Watch W Setzen einer zubeobachtenden Variablen (siehe \fIWatch-Fenster\fP) Edit Watch E Edieren einer zubeob. Variablen Delete Watch D Loeschen einer zubeob. Variablen Remove All Watches A Loeschen aller zubeob. Variablen Show StacK K Stack anzeigen (siehe \fIStack-Fenster\fP) Step S Einen Programmschritt ausfuehren (mit Sprung in Unterfunktionen) Next N Einen Programmschritt ausfuehren (ohne Sprung in Unterfunktionen) Run/Continue R Starten/Weiterfuehren des Programms Quit Q Beenden des Debuggers OutPut Window P Anzeigen der Ausgabe (nicht unter XWindow) .EE .SH Project-Menue (Alt-P): .EX Open Project P Eingabe des Namen einer \fIProjekt-Datei\fP Es wird ein \fIProjekt-Fenster\fP geoeffnet Close Project C Schliessen eines Projekts. Das Project-Fenster wird geschlossen und der Projektname auf leer gesetzt. Add Item A Hinzufuegen von Dateien zum geoeffneten Project. Das Projekt-Fenster wird im Add-Status geoeffnet. Delete Item D Loeschen der aktuellen Datei im Projekt-Fenster aus dem geoeffneten Project. Dieser Punkt wird nur ausgefuehrt, wenn das Projekt-Fenster geoefnnet ist. Options O \fIProjekt-Optionen\fP .EE .SH Das Options-Menue (Alt-O): .EX Adjust Colors A Farbeinstellung Read Colors R Standard Farben oder Farben aus Initiali- sierungsdatei lesen Save Options S Sichern der eigenen Optionseinstellungen fuer spaetere Sitzungen in einer wiederverwendbaren Options-Datei. Editor E Optionen fuer den Editor (siehe \fIEditor-Optionen\fP) File-Manager F Optionen fuer den File-Manager (siehe \fIFile-Manager-Optionen\fP) Programming G Optionen fuer die Programmierumgebung: ( Halt bei Fehlern/Warnungen; siehe auch \fISyntax-Unterstuetzung\fP) Compiler C Compiler-Optionen eingeben (siehe \fICompiler-Optionen\fP) Debugger D Optionen (Es koennen sowohl die Debugger gdb, sdb oder dbx gewaehlt werden, als auch die Modi Full Screen oder Normal) .EE .SH Das Window-Menue (Alt-W): .EX Size/Move S Groesse und Ort des aktuellen Fensters veraendern Zoom Z Zoomen des aktuellen Fensters auf max. Grosse Tile T Fenster im Baukasten-Prinzip nebeneinander- legen. Cascade A Fenster wie einzelne Blaetter kaskadenfoermig uebereinanderlegen. Next X Aktuelles Fenster auf das folgende schalten. Close C Aktuelles Fenster schliessen. List All L Alle vorhandenen Fenster werden gelistet. Mit oder Alt-S (Show) wird das markierte Fenster in den Vordergrund geholt. Messages M Das Message-Fenster wird in den Vordergrund geholt. Ist es nicht geoeffnet, so wird dieses nachgeholt. Project P Das Projekt-Fenster wird in den Vordergrund geholt. Ist es nicht geoeffnet, so wird dieses nachgeholt. Watches W Das Watch-Fenster wird in den Vordergrund geholt. Ist es nicht geoeffnet, so wird dieses nachgeholt. .EE .SH Das Help-Menue (Alt-H): .EX Editor E Hilfestellung zum Editor (WE) Function Index I Index aller UNIX-Funktionen (siehe \fIFunction-Index\fP) Function F Hilfestellung zu einer beliebigen UNIX-Funktion .EE .SH Die Funktionstasten: Konvention unter UNIX (gilt nicht fuer XWindow): \fIAlt-X\fP - Wird durch die Tastenkombination \fI X\fP realisiert (X steht hier fuer ein beliebiges druckbares Zeichen) \fIESC\fP - Wird durch die Tastenkombination \fI \fP realisiert. Fuer folgende Funktionen sind Tasten vorgesehen: .EX \fICursor-Bewegungen\fP \fIEdieren\fP \fILoeschen\fP \fIBlock-Kommandos\fP \fIMarker-Kommandos\fP \fISuch- und Textersatz-Kommandos\fP \fIPuffer-Kommandos\fP \fILaden und Speichern\fP \fIFenster-Kommandos\fP \fIRun-Kommandos\fP \fIKommandos der Programmierhilfe\fP \fIDebug-Kommandos\fP \fIHelp-Kommandos\fP \fISitzungbeenden\fP .EE .SH Cursor-Bewegungen: .EX Pfeil nach oben Ctrl P bewegt Cursor nach oben Pfeil nach unten Ctrl N bewegt Cursor nach unten rechter Pfeil Ctrl F bewegt Cursor nach rechts linker Pfeil Ctrl B bewegt Cursor nach links Ctrl rechter Pfeil Alt rechter Pfeil bewegt Cursor um ein Wort nach rechts Ctrl linker Pfeil Alt linker Pfeil bewegt Cursor um ein Wort nach links Home oder Ctrl A setzt den Cursor auf den Anfang der Zeile End oder Ctrl E setzt den Cursor auf das Ende der Zeile Ctrl Pfeil nach oben Page Up bewegt den Cursor um ein Fenster nach oben Ctrl Pfeil nach unten Page Down bewegt den Cursor um ein Fenster nach unten Ctrl Page Up Alt Ctrl A bewegt den Cursor auf den Anfang der Datei Ctrl Page Down Alt Ctrl E bewegt den Cursor auf das Ende der Datei Ctrl Home Alt Ctrl P bewegt den Cursor auf den Anfang der Seite Ctrl End Alt Ctrl N bewegt den Cursor auf das Ende der Seite .EE .SH Edieren: .EX Spaltet die aktuelle Zeile an der Cursor-Position Ctrl H Loescht den Character vor der Cursor-Position Ctrl D Del Loescht den Character an der Cursor-Position Einfuegen eines Tabulators Alt-I Umschalten vom Einfuege- in den Ueberschreibe-Modus Insert und umgekehrt. Alt-J Umschalten in Sonderzeichen-Einsetz-Modus .EE .SH Loeschen: .EX Ctrl T Loescht nach rechts alle Zeichen bis zum naechsten Wortanfang Ctrl O T Loescht nach links alle Zeichen bis zum naechsten Wortanfang Ctrl Y Loescht die ganze Zeile Ctrl Z Ctrl O Y Loescht alle Zeichen vom Cursor bis zum Ende der Zeile .EE .SH Block-Kommandos: .EX Shift + Cursorbewegung markiert einen Block Ctrl K B Anfangsmarke eines Blocks setzen Ctrl K K Endmarke eines Blocks setzen Ctrl K L Die aktuelle Zeile markieren Ctrl K X Den gesamten Text markieren Ctrl K A An den Blockanfang springen Ctrl K Z Ans Blockende springen Ctrl K C Block kopieren Ctrl K V Block verschieben Ctrl K Y Block loeschen Ctrl K H Blockmarken loeschen Ctrl K R Einfuegen einer Datei an die Cursor-Position Ctrl K W Schreiben eines Blocks in ein Datei Ctrl K I Blockeinruecken Ctrl K U Blockausruecken .EE .SH Marker-Kommandos: .EX Ctrl K n Setzt n-ten Marker ( n = 1 - 9 ) Ctrl O n Setzt Cursor auf n-ten Marker .EE .SH Such- und Textersatz-Kommandos: .EX Find F4 Ctrl O F Zeichenkette suchen Alt-F4 Ctrl O A Zeichenkette durch eine andere Ersetzen Ctrl-F4 Ctrl L Wiederholt Suchen / Ersetzen Alt G Zu einer angegebenen Zeile springen .EE .SH Puffer-Kommandos: .EX Cut Shift Del Ctrl X Loescht markierten Text in den Puffer Copy Shift Insert Ctrl C Kopiert den markierten Text in den Puffer Paste Ctrl Insert Ctrl V Kopiert den Puffer-Inhalt an die Cursor-Position Ctrl W Puffer-Inhalt in eigenem Fenster anzeigen UNDO Letztes Textveraenderndes Kommando rueckgaengig Ctrl U machen REDO Ctrl R Letztes Undo-Kommando rueckgaengig machen Alt Delete Kopiert den markierten Text in den X-Puffer Alt Insert Kopiert den X-Puffer-Inhalt an die Cursor-Position .EE .SH Laden und Speichern: .EX Open F3 Aufruf des \fIFile-Managers\fP (Laden einer Datei etc.) F2 Speichern des Inhalts einer Datei .EE .SH Fenster-Kommandos: .EX Alt-Z F5 Zoomen des Fensters (maximale Groesse) Ctrl F5 Alt-F2 Veraendern der Grosse und des Ortes des Fensters F6 Alt-N Umschalten auf naechstes Fenster Alt-F3 Schliessen des aktuellen Fensters Shift F4 Fenster nebeneinander anordnen Shift F5 Fenster versetzt uebereinander anordnen .EE .SH Run-Kommandos: .EX Alt F9 Alt C startet den Compiler (siehe \fIProgrammierumgebung\fP) F9 Alt M erzeugt ein Executable Ctrl F9 Alt R erzeugt ein Executable und fuehrt dieses aus. Alt L fuehrt die Installations-Prozedur aus (siehe \fIProjekt-Datei\fP) Alt A fuehrt das System-Kommando 'make' aus. Eventuell aufgetretenen Fehler werden im Message-Fenster angezeigt und interpretiert (siehe \fIMessage-Fenster\fP) Alt V Der Cursor wird an die stelle des vorhergehenden Fehlers gesetzt (siehe \fIMessage-Fenster\fP) Alt T Der Cursor wird an die stelle des naechsten Fehlers gesetzt (siehe \fIMessage-Fenster\fP) .EE .SH Kommandos der Programmierhilfe: .EX Ctrl O S Sucht die Definition eines C-Ausdrucks (siehe \fIC-Programmierhilfen\fP) Ctrl O N Sucht nach weiteren Definitionen eines C-Ausdrucks (siehe \fIC-Programmierhilfen\fP) Ctrl O K Sucht die zugehoerige Klammer (siehe \fIC-Programmierhilfen\fP) Ctrl O B Verschoenert den C-Quelltext (siehe \fIC-Programmierhilfen\fP) .EE .SH Debug-Kommandos: .EX Ctrl F10 Ctrl G R startet den Debugger (siehe \fIDebug-Umgebung\fP) Ctrl F2 Ctrl G Q beendet die Debug-Sitzung F7 der naechste Programmschritt wird ausgefuehrt Ctrl G S (mit Sprung in Funktionen) F8 der naechste Programmschritt wird ausgefuehrt Ctrl G N (ohne Sprung in Funktionen) Ctrl F8 Ctrl G B Setzen bzw. Loeschen eines Breakpoints Ctrl G M Loeschen aller Breakpoints Ctrl F7 Ctrl G W Eingabe einer zu beobachtenden Variablen Ctrl G E Edieren einer zu beobachtenden Variablen (Siehe \fIWatch-Fenster\fP) Ctrl G D Loeschen einer zu beobachtenden Variablen (Siehe \fIWatch-Fenster\fP) Ctrl G D Loeschen einer zu beobachtenden Variablen (Siehe \fIWatch-Fenster\fP) Ctrl F6 Ctrl G K Anzeigen des Stack (siehe \fIStack-Fenster\fP) Ctrl G O Anzeigen des Ausgabe-Ausgabefesters (nicht fuer XWindow) .EE .SH Help-Kommandos: .EX F1 Hilfe zum Window-Programming-Environment (xwpe) Alt F1 Hilfe zu einer beliebigen UNIX-Funktions Ctrl F1 Funktions-Index .EE .SH Sitzungbeenden: .EX Alt-X Beenden der WE-Sitzung (siehe weiter unten) .EE .SH Die Common User Access: Um eine gewisse Kompatibilitaet zu OSF-Motif bzw. MS-Windows zu erreichen wird ein zweite Form der Funktionstastenbelegung angeboten. Hierbei gelten folgende Ersetzungen: .EX Fenster: F6 -> Ctrl F6 Naechstes Fenster Alt F3 -> Ctrl F4 Fenster schliessen F5 -> Shift F6 Zoom Suchen: Ctrl F4 -> F3 Nochmaliges Suchen F4 -> Alt F3 Suchen Alt F4 -> Ctrl F3 Ersetzen Dateibearbeitung: F3 -> F2 Aufruf des Datei-Managers F2 -> Alt F2 Speichern Debugger: Ctrl F8 -> F5 Breakpoint setzen Ctrl F7 -> Ctrl F5 Watch Ctrl F6 -> Ctrl F3 Stack aufrufen Sitzung beenden: Alt X -> Alt F4 Beenden der Editoren-Sitzung .EE .SH Beenden der Sitzung: Wird das Kommando zum Beenden der Sitzung eingegeben werden alle NICHT veraenderten Dateien kommentarlos geschlossen. Fuer alle veraenderten Dateien wird nachgefragt: .EX Yes Eingabe von Y speichert die Datei No Eingabe von N schliesst die Datei ohne zu speichern ESC Eingabe von bricht das Kommando ab (die Sitzung wird wieder aufgenommen) .EE .SH Der Editor Der Editor ist in der Lage bis zu 35 Fenster gleichzeitig zu verwalten. In jedem Editoren-Fenster kann eine Datei geladen werden. Der Editor stellt eine Reihe von Funktionen zur Verfuegung. Die Funktionen koennen ueber Maus, Funktionstasten oder Menues ausgefuehrt werden. Funktionen sind ueber das Hinzufuegen und Loeschen einzelner Zeichen hinaus in erster Linie die folgenden: Kopieren, verschieben und loeschen ganzer Textbloecke innerhalb einer Datei (siehe \fIBlock-Menue\fP) Kopieren, verschieben und loeschen ganzer Textbloecke zwischen verschiedenen Dateien (siehe \fIEdit-Menue\fP) Zeichenketten suchen und/oder ersetzen (siehe \fISearch-Menue\fP) Die Form und Lage der einzelnen Editoren-Fenster veraendern (siehe \fIWindow-Menue\fP) Optionen fuer den Editor werden ueber das Options-Menue eingestellt. Dateien editiert, gesichert und ganz allgemein manipuliert wird ueber das File-Menue .SH Die Hilfe-Funktion In einem Hilfefenster wird eine Beschreibung zu dem entsprechenden Punkt gegeben, aus dem heraus die Hilfe-Funktion aufgerufen wurde. Wurde die Hilfe-Funktion ueber Help/Editor aufgerufen, wird ein Verzeichnis der Hauptpunkte ausgegeben, die als Hilfestellungen angeboten werden. In den meisten Dokumentationen sind hervorgehobene Schluesselworte vorhanden. Anklicken eines Schluesselwortes bzw. Eingabe von nachdem der Cursor auf das ensprechende Schluesselwort gesetzt wurde, ruft die Hilfe-Funktion fuer das angegebene Thema auf. Es kann zu vorher betrachtete Hilfe-Funktionspunkten zurueckgeblaettert werden, indem ein die -Taste gedrueckt, oder mit der Maus auf die Ueberschrift des aktuellen Punktes geklickt wird. Weitere Hilfestellungen fuer Programmierer werden ueber die Menuepunkte des Help-Menues gegeben. .SH Der File-Manager (Datei-Manager): Mit Hilfe des File-Managers koennen Dateien ediert, neue Unterverzeichnisse erstellt, sowie Dateien und Verzeichnisse kopiert, verschoben/umbenannt geloescht oder ihre Attribute veraendert werden. .IP "\fBAlt-N\fP" Sprung in Namensleiste (Die vorgegebene Zeichenkette kann bearbeitet werden). Es gibt drei Moeglichkeiten von Namen: 1. Eine existierende Datei wird durch geladen. 2. Eine nicht existierende Datei wird durch erzeugt. 3. Eine Dateienmaske gibt an, welche Dateien unter 'Files' aufgelistet werden sollen. '*' steht fuer eine beliebige Zeichenkette. '?' steht fuer ein beliebiges Zeichen. '[ ]' steht fuer ein Zeichen aus der Liste zwischen den eckigen Klammern. '[ - ]' steht fuer ein Zeichen aus dem Bereich zwischen den Zeichen vor und nach '-'. steht fuer alle Zeichen ausser den in den Klammern angegebenen. Eingabe von Return bewirkt einen Sprung nach 'Files'. .IP "\fBAlt-F\fP" Sprung nach 'Files'. Die einzelnen Dateien, die der unter 'Name' angegebenen Dateienmaske entsprechen werden aufgelistet. Durch Eingabe der Cursortasten kann jeweils eine Datei markiert werden. Mit oder Alt-E wird diese Datei in den Editor geladen. .IP "\fBAlt-D\fP" Eingabezeile fuer Inhaltsverzeichnis. Hier kann ein Inhaltsverzeichnis eingegeben werden. Durch Eingabe von wird das Arbeitsverzeichnis direkt in das eingegebene geaendert. .IP "\fBAlt-T\fP" Baum des Inhaltsverzeichnisses. Durch Eingabe der Cursortasten kann in dem Baum gewandert werden. aendert das Arbeitsverzeichnis in das markierte Verzeichnis. .IP "\fBAlt-C\fP" Das Arbeitsverzeichnis wird in das eingegebene bzw. markierte Verzeichnis geaendert. .IP "\fBAlt-E\fP" Die unter 'Name' angegebene Datei bzw. die markierte Datei wird in den Editor geladen. .IP "\fBAlt-P\fP" Die aktuelle Datei wird durch die unter 'Name' angegebene Datei bzw. die markierte Datei ersetzt. .IP "\fBAlt-M\fP" Die markierte Datei umbenennen, oder durch die Angabe eines neuen Pfades verschieben. .IP "\fBAlt-U\fP" Die markierte Datei duplizieren. Der Name der duplizierten Datei ist der alte Dateiname ergaenzt durch die Endung .dup. .IP "\fBAlt-R\fP" Loeschen der markierten Datei. Die Datei wird je nach Einstellung (siehe File-Manager-Optionen) in den Papierkorb verschoben oder absolut von der Platte gloescht. .IP "\fBAlt-L\fP" Einen Link auf die markierte Datei setzen. Es wird als erstes versucht einen Hard-Link auf die Datei zu erstellen. Ist dies nicht moeglich (bei Verzeichnissen oder unterschiedlichen Platten-Partitionen), wird ein Soft-Link erstellt. .IP "\fBAlt-O\fP" Die markierte Datei wird kopiert. Der neue Name muss angegeben werden. .IP "\fBAlt-K\fP" Erzeugen eines neuen Unterverzeichnisses im aktuellen Verzeichnis. Nach der Erzeugung ist die Anwendung im Umbennenungsmodus (Alt-M) und der temporaere Name ist new.dir. .IP "\fBAlt-A\fP" Setzen der Attribute fuer die markierte Datei. .IP "\fBAlt-S\fP" (nur fuer Save As) Die aktuelle Datei wird unter dem unter 'Name' angegebenen Namen bzw. unter dem markierten Namen gespeichert. .IP "\fB\fP" Beenden des File-Managers. .SH Der Execution-Manager: Mit Hilfe des Execution-Managers koennen Dateien ausfuehrbare Programme und Shell-Scripts ausgefuehrt werden. Es werden nur ausfuehrbare Dateien unter 'Files' gelistet. .IP "\fBAlt-N\fP" Sprung in Namensleiste (Die vorgegebene Zeichenkette kann bearbeitet werden). Es gibt drei Moeglichkeiten von Namen: 1. Eine existierende Datei wird durch geladen. 2. Eine nicht existierende Datei wird durch erzeugt. 3. Eine Dateienmaske gibt an, welche Dateien unter 'Files' aufgelistet werden sollen. '*' steht fuer eine beliebige Zeichenkette. '?' steht fuer ein beliebiges Zeichen. '[ ]' steht fuer ein Zeichen aus der Liste zwischen den eckigen Klammern. '[ - ]' steht fuer ein Zeichen aus dem Bereich zwischen den Zeichen vor und nach '-'. '[! ]' steht fuer alle Zeichen ausser den in den Klammern angegebenen. Eingabe von Return bewirkt einen Sprung nach 'Files'. .IP "\fBAlt-F\fP" Sprung nach 'Files'. Die einzelnen Dateien, die der unter 'Name' angegebenen Dateienmaske entsprechen werden aufgelistet. Durch Eingabe der Cursortasten kann jeweils eine Datei markiert werden. Mit oder Alt-E wird diese Datei in den Editor geladen. .IP "\fBAlt-D\fP" Eingabezeile fuer Inhaltsverzeichnis. Hier kann ein Inhalts- verzeichnis eingegeben werden. Durch Eingabe von wird das Arbeitsverzeichnis direkt in das eingegebene geaendert. .IP "\fBAlt-T\fP" Baum des Inhaltsverzeichnisses. Durch Eingabe der Cursortasten kann in dem Baum gewandert werden. aendert das Arbeitsverzeichnis in das markierte Verzeichnis. .IP "\fBAlt-C\fP" Das Arbeitsverzeichnis wird in das eingegebene bzw. markierte Verzeichnis geaendert. .IP "\fBAlt-E\fP" Die unter 'Name' eingegebene Zeichenkette bzw. die markierte Datei wird vom Betriebssystem ausgefuehrt. .IP "\fB\fP" Beenden des Execution-Managers. .SH Die Programmierumgebung Das Run-Menue kann Programm-Code uebersetzen, binden und ausfuehren. Ist die angegebene Projekt-Datei vorhanden, wird diese bearbeitet, ansonsten wird die aktuelle Datei bearbeitet. Der Compiler wird in Abhaengigkeit von dem Datei-Postfix ausgewaehlt. Die moeglichen Compiler und die dazu gehoerigen Optionen sind unter dem Menue-Punkt Run/Options (siehe \fICompiler-Optionen\fP) einstellbar. Compiliert und gebunden werden nur Dateien, die noch nicht uebersetzt wurden oder seit der letzten Uebersetzung veraendert wurden. Fuer C-Programme gilt, dass auch alle Veraenderungen in eingebundenen 'include' - Dateien beruecksichtigt werden. Treten beim Uebersetzen oder Binden des Programm-Codes Fehler auf, werden diese aufgelistet (siehe \fIMessage-Fenster\fP), das weitere Uebersetzen und Binden abgebrochen und der Cursor an die vermutliche Fehlerstelle in der ensprechenden Datei gesetzt. .SH C-Programmierhilfen Nur fuer C bzw. C++ - Programmtexte werden die folgenden Programmierhilfen zur Verfuegung gestellt: \fISprung zur Definition eines C-Ausdrucks ( Show Definition ^O S)\fP: Die Datei, in der sich die Definition des Suchausdrucks befindet, wird in den Vordergrund geholt oder geladen. Der Cursor der Suchausdruck wird hierbei markiert und der Cursor an die entsprechende Stelle gesetzt. Es werden Struktur-, union-, class-, typedef-, Preprozessor-, externe Variablen- und Funktionsdefinitionen erkannt. Durchsucht wird die Datei im aktuellen Fenster sowie alle Projekt-Dateien, wenn ein Projekt geoeffnet wurde. Hierbei werden alle ueber #include eingefuegten Dateien rekursiv durchsucht, soweit sie ueber den in \fIOptionen/Programming\fP eingestellten \fISystem-Include-Path\fP gefunden wurden. Ist ein gesuchter Name mehrmals definiert worden (z.B. als Name einer Struktur und als Name einer externen Variablen) kann die naechste Definition mit \fI^O N (Show next Definition)\fP gesucht werden. \fIZugehoerige Klammer (Matching Bracket ^O K)\fP: Wird dieser Menue-Punkt aufgerufen, wird der Cursor, wenn er sich auf einer Klammer befindet auf die dazu gehoerige gesetzt. Befindet sich der Cursor auf keiner Klammer wird zurueck zur naechsten oeffnenden gesprungen. Es werden geschweifte {}, eckige [] und runde () Klammern beruecksichtigt. \fIText verschoenern (Beautify ^O B)\fP: Wird dieser Menue-Punkt aufgerufen werden die einzelnen Bloecke gleichmaessig eingerueckt. Hierbei entspricht der Grad der Einrueckung der Tiefe der Blockverschachtelung. .SH Die Debug-Umgebung Das Debug-Menue erlaubt das Setzen von Breakpoints direkt im Programm-Text. Bei einem Programm-Stop waehrend einer Debugger- Sitzung, wird der aktuelle Standpunkt in der entsprechenden Datei angezeigt. Ist sie als Datei noch nicht im Editor geladen, wird dies nachgeholt. Der Cursor wird an die entsprechende Code-Stelle gesetzt. Stops koennen durch Breakpoints oder durch Signale von aussen erzeugt werden. Es koennen Variablen angegeben werden, deren Werte bei jedem Stop ausgegeben werden (siehe \fIWatch-Fenster\fP) Bei einem Stop kann die Stack-Hierarchie ausgeben und in dieser gewandert werden (siehe \fIStack-Fenster\fP). .SH Find: Mit Hilfe der Find Option koennen Dateien in einem Verzeichnis (auch rekursiv) gesucht werden. .IP "\fBAlt-L\fP" Dateiname oder Dateienmaske nach der gesucht werden soll. Die Dateienmaske hat die gleichen Eigenschaften wie die unter \fIFile-Manager\fP beschriebenen .IP "\fBAlt-I\fP" Verzeichnis in dem nach der Datei oder Dateienmaske gesucht werden soll. .IP "\fBAlt-K\fP" Rekursiv. Wenn diese Option eingeschaltet ist werden auch Unterverzeichnisse rekursiv durchsucht. .IP "\fBAlt-O\fP" Suche beginnen. .IP "\fB\fP" Abbruch der Find-Anwendung. Die Verzeichnisse in denen entsprechende Dateien gefunden wurden werden in einem \fIFind-Fenster\fP aufgelistet. .SH Grep: Mit Hilfe der Grep Option koennen Zeichenketten in Dateien gesucht werden. Die Dateien werden hierbei entsprechend der unter File-Manager beschriebenen Dateienmaske durchsucht. .IP "\fBAlt-T\fP" Such-Zeichenkette eingeben. .IP "\fBAlt-C\fP" Wenn angegeben: Gross- und Kleinschreibung wird unterschieden. .IP "\fBAlt-W\fP" Wenn angegeben: Nur ganze Worte werden gesucht .IP "\fBAlt-R\fP" Wenn angegeben: Regulaerer Ausdruck. (siehe die \fISuch/Textersatz-Funktion\fP) .IP "\fBAlt-L\fP" Dateiname oder Dateienmaske nach der gesucht werden soll. Die Dateienmaske hat die gleichen Eigenschaften wie die unter \fIFile-Manager\fP beschriebenen .IP "\fBAlt-I\fP" Verzeichnis in dem nach der Datei oder Dateienmaske gesucht werden soll. .IP "\fBAlt-K\fP" Rekursiv. Wenn diese Option eingeschaltet ist werden auch Unterverzeichnisse rekursiv durchsucht. .IP "\fBAlt-O\fP" Suche beginnen. .IP "\fB\fP" Abbruch der Find-Anwendung. Die Dateien in denen die angegebene Zeichenkette gefunden wurde, werden in einem gesonderten \fIGrep-Fenster\fP aufgelistet. .SH Die Such/Textersatz-Funktion: .IP "\fBAlt-T\fP" Such-Zeichenkette eingeben. .IP "\fBAlt-N\fP" Textersatz-Zeichenkette eingeben (nur bei Replace) .IP "\fBAlt-C\fP" Wenn angegeben: Gross- und Kleinschreibung wird unterschieden. .IP "\fBAlt-W\fP" Wenn angegeben: Nur ganze Worte werden gesucht .IP "\fBAlt-R\fP" Wenn angegeben: Regulaerer Ausdruck. Folgende Sonderzeichen werden interpretiert (Syntax (e)grep aehnlich): .IP "\fB^\fP" Am Anfang der Such-Zeichenkette wird als Zeilenanfang interpretiert. .IP "\fB$\fP" Dieses Zeichen am Ende einer Such-Zeichenkette wird als Zeilenende interpretiert. .IP "\fB.\fP" Steht fuer ein beliebiges Zeichen .IP "\fB[]\fP" Steht fuer jedes Zeichen innerhalb der Klammern aber kein anders .IP "\fB[^ ]\fP" Steht fuer kein Zeichen innerhalb der Klammern aber jedes andere .IP "\fB[ - ]\fP" Steht fuer einen Zeichenbereich innerhalb der Klammern aber kein anderes .IP "\fB*\fP" Das vorhergehende Zeichen wird n mal wiederholt (n >= 0) .IP "\fB+\fP" Das vorhergehende Zeichen wird n mal wiederholt (n >= 1) .IP "\fB?\fP" Das vorhergehende Zeichen wird 0 oder 1 mal wiederholt .IP "\fB|\fP" Oder: Es wird sowohl nach der Zeichenkette vor als auch nach der Zeichenkette nach dem | - Zeichen gesucht. .IP "\fB\\\fP" Das folgende Zeichen wird nicht als Sonderzeichen interpretiert .IP "\fBAlt-P\fP" Wenn angegeben, wird vor jeder Ersetzung nachgefragt.(Nur bei Replace) Nachfragen koennen wie folgt beantwortet werden: .EX Yes Y Text ersetzen No N Text nicht ersetzen Bricht mehrfache Suche ab .EE .IP "\fBAlt-D\fP" Wenn angegeben: Vorwaerts suchen .IP "\fBAlt-B\fP" Wenn angegeben: Rueckwaerts suchen .IP "\fBAlt-G\fP" Wenn angegeben: Ganzen Text durchsuchen .IP "\fBAlt-S\fP" Wenn angegeben: Nur markierten Bereich durchsuchen .IP "\fBAlt-F\fP" Wenn angegeben: Suche von Cursor-Position starten .IP "\fBAlt-E\fP" Wenn angegeben: Suche von Bereichsanfang starten .IP "\fB\fP" Einmaliges Suchen/Ersetzen beginnen .IP "\fBAlt-A\fP" Alle Ersetzungen bis Ende des Bereichs durchfuehren (Nur fuer Replace) .IP "\fB\fP" Suchen/Ersetzen abbrechen .SH Function-Index: Das Programming-Environment erstellt beim Aufruf dieser Funktion einen Index aller vorhandenen Manual-Pages, die im Suchpfad gefunden wurden. Der Suchpfad muss ueber die Environment-Variable MANPATH angegeben werden. Der Function-Index ist nach groben Sachgebieten geordnet, die als Untermenue erscheinen: .EX User Commands Benutzer Kommandos System Calls System Routinen (C - Funktionen) C-Lib.-Functions C - Biliotheks - Funktionen Devices & Netw. I. Geraete und Netzschnittstellen File Formats Datei - Formate Games & Demos Spiele und Demonstartionen Environments, ... Umgebungen, Tabellen und TROFF Makros Maintenance Com. Administrations Kommandos .EE Nach Auswahl eines Manuals wird ein Index aller dokumentierten Funktionen, Kommandos, etc. ausgegeben. Durch Auswahl eines Stichwortes ( oder Mausklick) wird die auf dem Rechner vorhandene Dokumentation zu diesem Stichwort in einem Fenster ausgegeben. Die Dokumentation zu jedem dieser Stichworte kann auch direkt ueber den Menue-Punkt Function in ein Editoren-Fenster geladen werden. Diese Dokumentationen sind, wie alle Hilfestellungen, read-only Dateien, die mit Hilfe der Cursor-Tasten und der Such-Funktion bearbeitet werden koennen. .SH FENSTER .SH Das Editoren-Fenster Mit Hilfe des Editoren-Fensters koennen Dateien ediert werden. Hierfuer stehen die Maus (siehe \fIMaus im Editoren-Fenster\fP), Funktionstasten oder die Editoren-Menues zur Verfuegung. Die wichtigsten Menues haben die folgenden Funktionen: Kopieren, verschieben und loeschen ganzer Textbloecke innerhalb einer Datei (siehe \fIBlock-Menue\fP) Kopieren, verschieben und loeschen ganzer Textbloecke zwischen verschiedenen Dateien (siehe \fIEdit-Menue\fP) Zeichenketten suchen und/oder ersetzen (siehe \fISearch-Menue\fP) Die Form und Lage der einzelnen Editoren-Fenster veraendern (siehe \fIWindow-Menue\fP) Optionen fuer den Editor werden ueber das \fIOptions-Menue\fP eingestellt. Dateien editiert, gesichert und ganz allgemein manipuliert wird ueber das \fIFile-Menue\fP .SH Das Find-Fenster In dem Find-Fenster werden alle Verzeichnisse aufgelistet, in denen die gesuchten Dateien durch Find gefunden wurden. Durch Eingabe von Alt-S oder wird ein File-Manager fuer das markierte Verzeichnis aufgerufen und in ihm die gefundenen Dateien angezeigt. Durch Eingabe von kann das 'Find' - Fenster wieder geloescht werden. .SH Das Grep-Fenster In dem Grep-Fenster werden alle Dateien aufgelistet, in denen die Suchzeichenkette durch Grep gefunden wurde. Durch Eingabe von Alt-S oder wird die markierte Datei in den Editor geladen und an die erste Textstelle gesprungen, die den Suchstring enthaelt. Durch Eingabe von kann das Grep-Fenster wieder geloescht werden. .SH Das Message-Fenster: Treten Fehler beim Uebersetzen oder Binden eines Programm-Codes auf, werden diese im Message-Fenster dokumentiert. Das Message- Fenster ist eine read-only Datei, die mit Hilfe der Cursor-Tasten und der Such-Funktion gelesen werden kann. Ausserdem kann durch betaetigen der Return-Taste, zu dem in der aktuellen Zeile beschriebenen Fehler gesprungen werden. Das Springen zu einem Fehler erfolgt in der Weise, dass die Datei in der dieser aufgetreten ist zur aktuellen Datei geschaltet wird, (Ist sie nicht geladen wird sie in ein neues Fenster geladen) und der Cursor an die von dem Compiler angegebene Stelle gesetzt wird. Es kann dann der Fehler direkt behoben werden und ein neuer Uebersetzungsversuch gestartet werden. .SH Das Project-Fenster Im Project-Fenster werden die in der \fIProjekt-Datei\fP eingetragenen Dateien aufgelistet. Es wird ueber das \fIProjekt-Menue\fP oder das \fIWindow-Menue\fP aufgerufen. Ueber die Eingabe von Alt-A (Add) oder koennen neue Dateien zu den Projekt- Dateien hinzugefuegt werden. Hierzu wird der Datei-Manager aufgerufen. Eingabe von oder Alt-A (Add) fuegt dann die markierte Datei hinzu. Durch Eingabe von Alt-E (Edit) oder im Project-Fenster kann der Eintrag in der Liste der Projekt-Dateien veraendert werden. Durch Eingabe von Alt-D (Delete) oder im Project-Fenster kann die markierte Datei aus der Liste der Projekt-Dateien entfernt werden. Durch Eingabe von Alt-O werden die \fIProjekt-Optionen\fP aufgerufen. Die Eingabe von schliesst das Project-Fenster. .SH Das Variablen-Fenster Im Variablen-Fenster werden die in der Projekt-Datei definierten Variablen aufgelistet. Es wird ueber die Projekt-Optionen aufgerufen. Ueber die Eingabe von Alt-A (Add) oder koennen neue Variablen definiert werden. Durch Eingabe von Alt-E (Edit) oder kann die markierten Variable veraendert werden. Durch Eingabe von Alt-D (Delete) oder kann die markierte Variable aus der Liste der definierten Variablen geloescht werden. Die Eingabe von schliesst das Variablen-Fenster. .SH Das Install-Fenster Im Install-Fenster werden die in der Projekt-Datei aufgefuehrten Kommandos, die beim Aufruf von Install (siehe Run-Menue) abgearbeitet werden sollen aufgelistet. Es wird ueber die Projekt-Optionen aufgerufen. Ueber die Eingabe von Alt-A (Add) oder koennen weitere Kommandos der Liste hinzugefuegt werden. Durch Eingabe von Alt-E (Edit) oder kann das markierte Kommando veraendert werden. Durch Eingabe von Alt-D (Delete) oder kann das markierte Kommando aus der Liste entfernt werden. Die Eingabe von schliesst das Install-Fenster. .SH Das Watch-Fenster: Das Watch-Fenster ist ein read-only Fenster, in dem die Werte, der ueber die Watch Funktionen (siehe \fIDebug-Menue\fP) angegebenen Variablen ausgegeben werden. In dem Fenster kann mit Hilfe der Cursor-Tasten und der Such-Funktion gewandert werden. Zusaetzliche Funktionen sind (in Abhaengigkeit von der Cursor-Position im Watch-Fenster): .IP "\fB\fP" Auf eine angegebene Variable, editiert diese. .IP "\fB\fP" Am Ende der Datei, definiert eine neue Variable. .IP "\fB\fP" Setzt eine neue Variable an die ensprechende Stelle .IP "\fB\fP" Loescht die angegebene Variable Ist eine Variable in der aktuellen Funktion nicht vorhanden wird dies gemeldet. .SH Das Stack-Fenster: Das Stack-Fenster ist ein read-only Fenster, in dem die Stack- Hierarchie angegeben wird. In dem Fenster kann mit Hilfe der Cursor-Tasten und der Such-Funktion gewandert werden. Zusaetzlich kann ueber im Stack gesprungen werden (Funktioniert nicht fuer den Debugger 'sdb'). Der Aufruf des Stack-Fensters ist unbedingt bei einem Stop ueber ein Signal zu empfehlen, da in diesem Fall in die naechstliegende sichtbare Funktion (also nicht System-Funktion) gesprungen wird. .SH Maus (nur fuer XWindow): Wenn eine Maus installiert ist, koennen alle Tasteneingaben ueber diese vorgenommen werden. Diese erfolgen durch einfaches Anklicken der entsprechenden Zeile bzw. des entsprechenden Kommando-Wortes. Ein Fenster wird geschlossen ueber das Anklicken des 'Cancel' Kommandos oder durch Anklicken des 'Close-Button' am oberen linken Rand des Fensters. Die \fIMaus im Editoren-Fenster\fP und die \fIMaus im File-Manager\fP haben noch zusaetzliche Funktionalitaet. Das Pressen des mittleren Maus-Buttons in einer zu bearbeitenden Zeile bewirkt ein Kopieren des Pufferinhalts an die Maus-Cursor- Position (Paste). .SH Die Maus im Editoren-Fenster Wenn eine Maus installiert ist, koennen alle Tasteneingaben ueber diese vorgenommen werden. Diese erfolgen durch einfaches Anklicken der entsprechenden Zeile bzw. des entsprechenden Kommando-Wortes. Das Fenster wird geschlossen ueber das Anklicken des 'Close-Button' am oberen linken Rand des Fensters. Ein Zoom auf das Fenster wird durchgefuehrt in dem der 'Zoom-Button' (-[z]-) am rechten oberen Rahmen des Fensters angeklickt wird. Das Fenster wird Verschoben durch Anklicken des oberen Rahmens und Verschieben der Maus bei festgehaltenem Maus-Button. Die Groesse des Fensters kann durch Anklicken einer Fensterecke und Verschieben der Maus bei festgehaltenem Maus-Button veraendert werden. Ein Sprung zu einer speziellen Zeilennummer kann durch Anklicken der Zeilennummer und Eintragen in das dann erscheinende Fenster erreicht werden. Cursor-Bewegungen werden durch das Anklicken der Mausleisten bewirkt. Anklicken der Pfeile am oberen bzw. unteren Ende der Mausleste bewirken eine Cursorbewegung um jeweils eine Zeile nach oben bzw. unten. Ein Anklicken der Mausleiste oberhalb bzw. unterhalb des Zeigers bewirkt ein Blaettern um jeweils eine Seite nach oben bzw. unten. Das Anklicken des Zeigers und Bewegung der Maus bei festgehaltenem Maus-Button bewrikt ein Verschieben des Cursors realtiv zum Verschieben des Zeigers. .SH Innerhalb des Fensters: .SH Linker Maus-Button: Das einfache Pressen des linken Maus-Buttons innerhalb des Textes bewirkt das Setzen des Cursors an die entsprechende Stelle. Wird der Maus-Button gedrueckt, waehrend der Maus-Cursor auf dem Text-Cursor steht, wird das entsprechende Wort makiert. Geschieht letzteres innerhalb eines schon markierten Wortes, wird die ganze Zeile markiert. Bewegung des Maus-Cursors bei gedruecktem linken Maus-Button bewirkt ein Markieren des ensprechenden Textbereiches. Bei gleichzeitigem Druecken der Shift-Taste wird der Bereich zwischen Maus-Cursor und schon markierten Bereich zu letzteren hinzugefuegt. .SH Rechter Maus-Button: Das Pressen des rechten Maus-Buttons bewirkt das Kopieren des markierten Bereichs in den Puffer (Copy). Wird gleichzeitig die Alt-Taste gedrueckt, wird in den X-Puffer kopiert. Bei gleichzeitig gedrueckter Shift-Taste wird der markierte Bereich aus dem Text geloescht und in den Puffer geschoben (Cut). .SH Mittlerer Maus-Button: Das Pressen des mittleren Maus-Buttons bewirkt ein Kopieren des Pufferinhalts an die Maus-Cursor-Position (Paste). Wird gleichzeitig die Alt-Taste gedrueckt, wird aus dem X-Puffer kopiert. .SH Die Maus im File-Manager Wenn eine Maus installiert ist, koennen alle Tasteneingaben ueber diese vorgenommen werden. Diese erfolgen durch einfaches Anklicken der entsprechenden Zeile bzw. des entsprechenden Kommando-Wortes. Das Fenster wird geschlossen ueber das Anklicken des 'Close-Button' am oberen linken Rand des Fensters. Ein Zoom auf das Fenster wird durchgefuehrt in dem der 'Zoom-Button' (-[z]-) am rechten oberen Rahmen des Fensters angeklickt wird. Das Fenster wird Verschoben durch Anklicken des oberen Rahmens und Verschieben der Maus bei festgehaltenem Maus-Button. Die Groesse des Fensters kann durch Anklicken einer Fensterecke und Verschieben der Maus bei festgehaltenem Maus-Button veraendert werden. Markierungen in der 'Files'-Liste als auch im Verzeichnisbaum koennen durch das Anklicken der Mausleiste bewegt werden. Anklicken der Pfeile am oberen bzw. unteren Ende der Mausleste bewirken eine Bewegung um jeweils eine Zeile nach oben bzw. unten. Ein Anklicken der Mausleiste oberhalb bzw. unterhalb des Zeigers bewirkt ein Blaettern um jeweils eine Seite nach oben bzw. unten. Das Anklicken des Zeigers und Bewegung der Maus bei festgehaltenem Maus-Button bewrikt ein Verschieben der Markierung realtiv zum Verschieben des Zeigers. .SH Innerhalb des Fensters: .SH Linker Maus-Button: Das einfache Pressen des linken Maus-Buttons auf einen unmarkierten Datei- oder Verzeichnisnamen markiert diesen. Das einfache Pressen auf einen markierten Dateinamen fuehrt zum Laden der Datei in den Editor. Das einfache Pressen auf einen markierten Verzeichnisnamen fuehrt zum Aendern des aktuellen Verzeichnisses auf das markierte. Pressen des linken Maus-Button auf eine markierte Datei oder Verzeichnis und Bewegung des Maus-Cursors bei gedruecktem Maus-Button bewirkt ein Verschieben dieser in ein anderes Verzeichnis unter der Vorraussetzung, dass zum Zeitpunkt des Loesens des Maus-Buttons, sich der Maus-Cursor in einem anderen File-Manager-Fenster befindet. Die Datei oder das Verzeichnis wird dann in das aktuelleingestellte Verzeichnis des letzteren File-Manager-Fenster verschoben. .SH Rechter Maus-Button: Das Pressen des rechten Maus-Buttons auf einen markierten Datei- oder Verzeichnisnamen fuehrt zum Aufruf der Verschieben/Umbennen- Option des File-Managers. Pressen des rechten Maus-Button auf eine markierte Datei oder Verzeichnis und Bewegung des Maus-Cursors bei gedruecktem Maus-Button bewirkt das Erzeugen eines Links auf die Datei in einem anderen Verzeichnis unter der Vorraussetzung, dass zum Zeitpunkt des Loesens des Maus-Buttons, sich der Maus-Cursor in einem anderen File-Manager- Fenster befindet. Der Link auf die Datei oder das Verzeichnis wird dann in das aktuell eingestellte Verzeichnis des letzteren File- Manager-Fensters erzeugt. .SH Mittlerer Maus-Button: Das Pressen des mittleren Maus-Buttons auf einen markierten Datei- oder Verzeichnisnamen fuehrt zur Duplizierung der Datei bzw. des Verzeichnisses. Pressen des mittleren Maus-Button auf eine markierte Datei oder Verzeichnis und Bewegung des Maus-Cursors bei gedruecktem Maus-Button bewirkt das Kopieren dieser in ein anderes Verzeichnis unter der Vorraussetzung, dass zum Zeitpunkt des Loesens des Maus-Buttons, sich der Maus-Cursor in einem anderen File-Manager-Fenster befindet. Die Datei oder das Verzeichnis wird dann in das aktuell eingestellte Verzeichnis des letzteren File-Manager-Fenster kopiert. .SH Optionen: .SH Editor-Optionen: .IP "\fBData:\fP" .IP "\fBAlt-A\fP" Wenn angegeben: Die naechsten Dateien werden als ASCII-Dateien eingelesen und behandelt. .IP "\fBAlt-B\fP" Wenn angegeben: Die naechsten Dateien werden als binaer Dateien eingelesen und behandelt. .IP "\fBDisplay:\fP" .IP "\fBAlt-S\fP" Wenn angegeben: Es werden die Zeilenenden markiert. Ein '$' steht fuer und ein '\' fuer eine NULL (naechste Zeile ist Anschlusszeile). .IP "\fBAutosave:\fP" .IP "\fBAlt-P\fP" Wenn angegeben: Die eingestellten Optionen werden automatisch beim Verlassen des Editors gesichert. .IP "\fBAlt-H\fP" Wenn angegeben: Es wird nach jeweils N textveraendernden Aktionen die Datei automatisch gesichert. N wird unter Max. Changes (siehe Alt-X) angegeben. Das Sichern der Datei erfolgt in eine Datei 'Dateiname'.ASV und ueberschreibt nicht die Orginaldatei. Die Sicherheitskopie wird beim normalen Speichern geloescht. .IP "\fBKeys (interpretation der Funktionstasten):\fP" .IP "\fBAlt-L\fP" Wenn angegeben: Es werden die bekannten xwpe Funktionstasten- belegungen verwendet. (Version < 1.2.0; Turbo C aehnlich) .IP "\fBAlt-C\fP" Wenn angegeben: Es werden 'Common User Access' Tasten- interpretationen verwendet. (MS-Windows aehnlich, aber manchmal nicht so handlich). .IP "\fBAlt-M\fP" Maximale Anzahl der Spalten pro Zeile. Nach der entsprechen- den Anzahl Zeichen, wird automatisch ein Zeilenumbruch durch- gefuehrt. .IP "\fBAlt-T\fP" Interpretazion des Tabstop-Characters: Ein Tabstop wird als die entsprechende Anzahl Spalten interpretiert. .IP "\fBAlt-X\fP" Wenn Autosave/Changes eingestellt ist wird nach der entpre- chenden Anzahl Textveraendernder Aktionen automatische eine Sicherheitskopie des Textes angelegt (siehe Alt-H). .IP "\fBAlt-N\fP" Anzahl der Undo-Schritte, die ueber Edit/Undo rueckgaengig gemacht werden koennen. .SH File-Manager-Optionen: .IP "\fBDirectories:\fP" .IP "\fBAlt-F\fP" Wenn angegeben: auch versteckte Dateien werden gelistet. .IP "\fBAlt-D\fP" Wenn angegeben: auch versteckte Verzeichnisse werden gelistet. .IP "\fBAlt-K\fP" Wenn angegeben: Alle Aktionen (Move, Link, Copy und Remove) werden rekursiv, also auch in Unterverzeichnissen ausgefuehrt. .IP "\fBSort Files By (Sortieren der Dateien nach):\fP" .IP "\fBAlt-N\fP" Name: Dateien werden alphabetisch sortiert. .IP "\fBAlt-I\fP" Time: Dateien werden nach ihrem Erzeugungsdatum sortiert. .IP "\fBAlt-B\fP" Bytes: Dateien werden nach ihrer Groesse sortiert. .IP "\fBAlt-R\fP" Reverse: Reihenfolge der Sortierung wird umgekehrt. .IP "\fBMove/Copy:\fP" .IP "\fBAlt-Q\fP" Wenn angegeben: beim Verschieben/Umbennenen wird nachgefragt, ob gleichnamige Dateien ueberschrieben werden sollen. .IP "\fBAlt-V\fP" Wenn angegeben: beim Verschieben/Umbennenen werden gleichnamige Dateien ueberschrieben. .IP "\fBAlt-T\fP" Wenn angegeben: beim Verschieben/Umbennenen werden gleichnamige Dateien nicht ueberschrieben. .IP "\fBRemove:\fP" .IP "\fBAlt-W\fP" Wenn angegeben: Dateien werden beim Loeschen in den Papierkorb geschoben. .IP "\fBAlt-A\fP" Wenn angegeben: Dateien werden absolut geloescht. Es wird vor dem Loeschen aber nachgefragt. .IP "\fBAlt-M\fP" Wenn angegeben: Dateien werden ohne Nachfrage absolut geloescht. .IP "\fBLinks on Files:\fP" .IP "\fBAlt-H\fP" Wenn angegeben: Es wird bei jedem Link versucht einen Hardlink auf eine Datei zu erzeugen. Ist dies nicht moeglich, wird ein symbolischer Link erzeugt. .IP "\fBAlt-S\fP" Wenn angegeben: Jeder Link wird als symbolischer Link erzeugt. .IP "\fBWastebasket (Papierkorb):\fP" .IP "\fBAlt-P\fP" Wenn angegeben: beim Verlassen von xwpe wird nachgefragt ob der Papierkorb geloescht werden soll. .IP "\fBAlt-E\fP" Wenn angegeben: der Papierkorb wird beim Verlassen von xwpe geloescht. .IP "\fBAlt-L\fP" Wenn angegeben: der Papierkorb wird beim Verlassen von xwpe nicht geloescht. .SH Compiler-Optionen: Beim Aufruf des Menuepunktes \fIRun/Options\fP werden, die Untermenuepunkte \fIAdd Compiler\fP, \fIRemove Compiler\fP und die bereits eingestellten Compiler aufgelistet. Ueber den Punkt \fIAdd Compiler\fP, sowie ueber die einzelnen schon eingestellten Compiler gelangt man zu dem folgenden Optionen-Menue .IP "\fBLanguage\fP" Unter diesem Punkt wird der Name der Programmiersprache eingegeben. .IP "\fBCompiler\fP" Hier wird der Compiler-Pfad angegeben. .IP "\fBCompiler-Options\fP" Hier werden die vom Compiler bei der Uebersetung zu beruecksichtigen Optionen eingestellt. .IP "\fBLoader-Options\fP" Hier werden die vom Loader beim Binden zu beruecksichtigen Optionen eingestellt. .IP "\fBExecutable-Name\fP" Name des auszufuehrenden Programms (Voreinstellung ist Programmname.e) .IP "\fBFile-Postfix\fP" Der File-Postfix gibt an welche Dateien mit diesem Compiler bearbeitet werden sollen (Beispiel: .c fuer C-Compiler). .IP "\fBCompiler-Style\fP" Gibt an wie eventuell aufgetretene Fehler interpretiert werden sollen. Es gibt die beiden Moeglichkeiten '\fIGNU\fP' fuer GNU aehnliche Compiler und '\fIOther\fP' fuer Compiler die andere Fehlermeldungssyntax verwenden. Wenn '\fIOther\fP' ausgewaehlt wurde, wird der \'\fIMessage-String\fP\' (siehe unten) interpretiert, um Fehlermeldungen zu erkennen. .IP "\fBOK\fP" Veraenderungen werden uebernommen. .IP "\fBCANCEL\fP" Verlassendes Menues ohne Veraenderungen. Mit \fIAdd Compiler\fP wird ein neuer Compiler zu den vorhandenen hinzu- gefuegt. Ueber den Aufruf eines vorhandenen Compilers koennen dessen Optionen veraendert werden. \fIRemove Compiler\fP mit dieser Option kann ein vorhandener Compiler wieder aus der Liste geloescht werden. .SH Projekt-Optionen: .IP "\fBCompiler\fP" Hier wird der Compiler-Pfad angegeben. .IP "\fBCompiler-Options\fP" Hier werden die vom Compiler bei der Uebersetung zu beruecksichtigen Optionen eingestellt. .IP "\fBLoader-Options\fP" Hier werden die vom Loader beim Binden zu beruecksichtigen Optionen eingestellt. .IP "\fBExecutable-Name\fP" Name des auszufuehrenden Programms (Voreinstellung ist a.out) .IP "\fBStore Objects in Library\fP" Wird hier ein Bibliotheksname angegeben, werden die erzeugten Objektdateien in dieser abgelegt. Die Bibliothek wird beim Binden dann mit beruecksichtigt. .IP "\fBCompiler-Style\fP" Gibt an wie eventuell aufgetretene Fehler interpretiert werden sollen. Es gibt die beiden Moeglichkeiten '\fIGNU\fP' fuer GNU aehnliche Compiler und '\fIOther\fP' fuer Compiler die andere Fehlermeldingssyntax verwenden. Wenn '\fIOther\fP' ausgewaehlt wurde, wird der \'\fIMessage-String\fP\' (siehe unten) interpretiert, um Fehlermeldungen zu erkennen. .IP "\fBVariablen ...\fP" Die Variablen des Projekts werden in einem gesonderten \fIVariablen-Fenster\fP aufgelistet. Es koennen sowohl Variablen geloescht als auch neue hinzugefuegt werden. .IP "\fBInstall ...\fP" Die Anweisungen, die beim Aufruf der Install-Anwendung abgearbeitet werden sollen, werden in einem gesonderten \fIInstall-Fenster\fP aufgelistet. Es koennen sowohl Anweisungen geloescht als auch neue hinzugefuegt werden. .IP "\fBSave\fP" Veraenderungen werden in der angegebenen \fIProjekt-Datei\fP gespeichert. .IP "\fBSave As\fP" Veraenderungen werden unter neuem Namen gespeichert. .IP "\fBCANCEL\fP" Verlassendes Menues ohne Veraenderungen. .SH Der Message-String: Der '\fIMessage-String\fP' wird zur Interpretation der Compiler-Ausgabe verwendet, wenn der '\fICompiler-Style\fP' '\fIOther\fP' eingeschaltet ist. Der 'Message-String' muss normalerweise an den verwendeten Compiler angepasst werden. Er wird mit der Compiler-Ausgabe wie folgt verglichen: \'*\' steht fuer eine beliebige Zeichenkette. \'\?\' steht fuer ein beliebiges Zeichen. '[ ]' steht fuer ein Zeichen aus der Liste zwischen den eckigen Klammern. (Es gilt die gleiche Syntax wie beim File-Manager.) ${FILE} wirkt wie '*', aber die Zeichen werden als Name der Datei, in der der Fehler aufgetreten ist gespeichert. ${LINE[+-N]} wirkt wie '*', aber die Zeichen werden als Zeilennummer interpretiert. Es kann eine Zahl N addiert oder subtrahiert werden. ${FILE} und ${LINE} muessen in dem Message-String angegeben werden. Kann eine Compiler-Ausgabezeile so interpretiert werden, dass ein gueltiger Dateiname und eine gueltige Zeilennummer erhalten werden, wird diese als Fehlerausgabe gewertet. Optional ist die Interpretation der Spaltenangabe. Hier gibt es mehrere Moeglichkeiten: ${COLUMN[+-N]} - die Zeichenkette ${COLUMN} wird als Zahl interpretiert. ${COLUMN=BEFORE[+-N]} - die Zeichenkette ${COLUMN} wird als Suchausdruck interpretiert und die Spalte ist die vor dem gefundenen Ausdruck. ${COLUMN=AFTER[+-N]} - die Zeichenkette ${COLUMN} wird als Suchausdruck interpretiert und die Spalte ist die hinter dem gefundenen Ausdruck. In allen drei Faellen kann eine Zahl N addiert oder subtrhiert werden. Erstrecken sich Fehlerangaben ueber mehrere Zeilen (z.B. Sun-Pascal: pc) kann dies dadurch beruecksichtigt werden, dass im Message-String CR's (^M) angegeben werden, mit Hilfe derer die Interpretation auf mehrere Zeilen aufgeteilt werden kann. Fuer diese Faelle gibt es die Vergleichszeichenkette ${CMPSTR}, mit Hilfe derer die Angabe ${COLUMN=PREVIOUS?STR[+-N]} in der folgenden Zeile ausgewertet werden kann. STR ist eine Suchzeichenkette, die mit ${CMPSTR} verglichen wird. Warnungen: Warnungen werden durch Vergleich mit einer Zeichenkette STR wie folgt erkannt: ${?N:STR} - N kann eine Zahl oder ein '*' sein. Ist N eine Zahl gibt sie die Spalte an, an der die Warnung beginnen soll. Ist ein '*' angegeben, kann STR irgendwo im Text auftreten. Es koennen beliebig viele Warnumgszeichenketten angegeben werden. .EX Beispiele: gcc: ${?*:warning:}${FILE}:${LINE}:* before `${COLUMN=BEFORE}' cc(Sun): ${?*:warning:}"${FILE}", line ${LINE}:* at or \\ near * "${COLUMN=AFTER}" cc(HP): ${?*:warning:}cc: "${FILE}", line ${LINE}:* at or \\ near * "${COLUMN=AFTER}" pc(Sun): ${?0:e}${?0:w}${?0:s}*:*:* * ${FILE}:^M^M* ${LINE} \\ ${CMPTXT}^M*-------${COLUMN=PREVIOUS?^} .EE .SH Projekt-Datei: Mit Hilfe der Projekt-Datei koennen Programme, die aus mehreren Modulen bestehen interaktiv bearbeitet werden. Die Projekt-Datei kann ueber den Menue-Punkt Run/Options/Project-Options (siehe Projekt-Optionen) erstellt werden oder aber direkt ediert werden. Die Syntax der Projekt-Datei ist kompatibel zu der von Makefiles. (dies gilt ab der Version 1.1.0 und ist nicht kompatibel zu frueheren Versionen). F uer die Projekt-Datei sind nur Variablen-Definitionen und die Definition des 'install' - Targets von Bedeutung. Syntax fuer Variablen-Defintionen ist: .EX Variablenname = Zeichenkette .EE Auf diese Weise koennen beliebige Variablen definiert werden. Die Variablen werden ueber $(Variablenname) in der Reihenfolge ausgewertet, dass erst nach einer Umgebungsvariable dieses Namens gesucht wird. Ist diese nicht vorhanden, wird nach einer Definition in der Projekt- Datei gesucht. Ist diese auch nicht vorhanden, wird eine leere Zeichenkette fuer $(Variablenname) eingesetzt. Folgende Variablen haben feste Bedeutungen: .IP "\fBFILES\fP" Eine beliebige Anzahl zu uebersetzender Programm-Code Module, die zu einem Executable zusammengebunden werden sollen. .IP "\fBCMP\fP" Compiler-Pfad .IP "\fBCMPFLAGS\fP" Compiler-Optionen .IP "\fBCMPSWTCH\fP" Fehlerinterpretation (Voreinstellung ist '\fIGNU\fP', es kann '\fItraditional\fP' oder '\fIextended\fP' angegeben werden.) .IP "\fBLDFLAGS\fP" Loader-Optionen .IP "\fBEXENAME\fP" Name des Executables (Voreinstellung ist a.out) .IP "\fBLIBNAME\fP" Name der Bibliothek. Wenn angegeben, werden die Objektdateien in der Bibliothek gespeichert und diese beim Binden des Programms beruecksichtigt. Aus einem Makefile kann also einfach eine Projekt-Datei gemacht werden, in dem am Ende z.B. die folgenden Zeilen eingefuegt werden (fuer C) : .EX FILES=$(CFILES) CMP=$(CC) LDFLAGS=$(LIBFLAGS) EXENAME='Targetname' .EE Beim Aufruf der Compile- bzw. Make-Anwendung: Die Dateien werden nach einander in der angegebenen Reihenfolge bearbeitet. Wenn eine Datei seit der letzten Uebersetzung veraendert wurde, wird diese neu uebersetzt. Tritt ein Fehler auf, wird die Bearbeitung der Projekt-Datei abgebrochen und eine Fehlerausgabe durchgefuehrt (siehe \fIMessage-Fenster\fP). Ist kein Fehler aufgetreten, werden alle Objektdateien unter Beruecksichtigung der Loader-Optionen zu einem Executable mit dem unter name: angegebenen Namen zusammengebunden. In der Projekt-Datei kann ein 'install'-Target angegeben werden. Dieses beginnt mit .EX install: .EE In der gleichen Zeile eventuell folgende Abhaengigkeiten wie in einem Makefile werden ignoriert. Die Abhaengigkeiten der install-Anwendung sind stattdessen durch die oben beschriebene Variable FILES gegeben. Nach diesem Targetnamen werden alle folgenden Zeilen die mit einem beginnen als UNIX-Kommandos interpretiert und ausgefuehrt. Hiebei wird die Auswertung eventuell auftretender Variablen berueck- sichtigt: .EX Kommando1 Kommando2 .EE koennen alle UNIX-Kommandos benutzt werden (das Kommando 'cd' bleibt ohne Wirkung). Das Install-Target wird ueber den Menuepunkt Run/Install (oder Alt-L) ausgefuehrt (siehe \fIRun-Menue\fP). .SH Syntax-Unterstuetzung: xwpe bietet eine Syntax-Unterstuetzung, die darin besteht, dass die Schluesselworte und Operatoren einer Sprache unterschieden werden von den Konstanten, den Preprozessor-Anweisungen und dem Rest des Textes. Voreingestellt ist die Unterstuetzung der Programmiersprachen C, C++, FORTRAN. Durch die Initialisierungsdatei .EX we_synt_defs .EE koennen aber weitere Sprachen hinzugefuegt bzw. die voreingestellten ueberschrieben werden. Die zu benutzende Sprache wird anhand der Dateiendung festgestellt. Die Datei we_synt_defs ist eine ASCII-Datei und kann im Verzeichnis ../lib/wpe relativ zum Verzeichnis der xwpe oder im persoenlichen Heimatverzeichnis unter .wpe abgelegt werden. Sie muss fuer jede Sprache wie folgt aufgebaut sein: .EX "Zeichenkette: Endung des Dateinamen" "Integer: Anzahl der Schluesselworte" "Zeichenketten: Schluesselworte" "Integer: Anzahl der Mehrzeichen-Operatoren" "Zeichenketten: Mehrzeichenoperatoren" "Zeichenkette: Alle Einzeichen-Operatoren" "Zeichenkette: Beginn-Kommentar" "Zeichenkette: Ende-Kommentar" "Zeichenkette: Beginn-Kommentar bis zum Ende der Zeile" "Zeichenkette: alle Zeichen fuer Spaltenabhaengigen Kommentar" "Zeichenkette: speziellen Einzelzeichen" "Integer: Spalte fuer Kommentar (-1 kein spaltenabhaengiger Kommentar)" "Integer: Spalte fuer Anschlusszeile (-1 keine spaltenabhaengige Anschlusszeile)" "Integer: Spalte Kommentar bis zum Ende (1000 kein spaltenabhaengiger Kommentar)" .EE Die Zeichenketten und Integer muessen durch Blanks oder CR getrennt werden. Die Zeichenketten aus Einzeichenoperatoren und Zeichen fuer Spaltenabhaengige Kommentare duerfen keine Leerzeichen enthalten. Alle Zeichenketten fuer Kommentare koennen durch NULL auf 'nicht vorhanden' gesetzt werden. Die Anzahl-Integer duerfen auf 0 gesetzt werden, wenn keine Schluesselworte bzw. Mehrzeichen Operatoren existieren. Die Zeichenkette 'spezielle Zeichen' setzt sich wie folgt zusammen: .EX Zeichen fuer String-Konstante Zeichen fuer Character-Konstante Zeichen fuer Preprozessor-Anweisung Zeichen fuer naechstes Zeichen uninterpretiert Zeichen fuer naechste Zeile ist Anschlusszeile (wenn am Ende der Zeile) Zeichen (zur Zeit keine Bedeutung) Zeichen fuer naechste Zeile ist Anschlusszeile (an beliebiger Stelle) Zeichen (wenn nicht leer wird Gross/Kleinschreibung bei Schluesselworten nicht unterschieden.) .EE Ein Leerzeichen innerhalb dieser Zeichenkette steht fuer das Fehlen des entsprechenden Zeichens. Beispiele: .EX .c 33 NULL auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while 0 ()[]{}<>+-/*%=|&!.?:,; /* */ NULL NULL "'#\\ -1 -1 1000 .f 64 ACCESS ASSIGN BACKSPACE BLANK BLOCKDATA CALL CHARACTER CLOSE COMMON COMPLEX CONTINUE DATA DIMENSION DIRECT DO DOUBLE PRECISION ELSE END ENDFILE ENTRY EQUIVALENCE ERR EXIST EXTERNAL FILE FMT FORM FORMAT FORMATTED FUNCTION GOTO IF IMPLICIT INQUIRE INTEGER INTRINSIC IOSTAT LOGICAL NAME NAMED NEXTREC NUMBER OPEN OPENED PARAMETER PAUSE PRINT PROGRAM READ REAL REC RECL RETURN REWIND SAVE SEQUENTIAL STATUS STOP SUBROUTINE TO UNFORMATED UNIT WRITE 13 .AND. .EQ. .EQV. .FALSE. .GE. .GT. .LE. .LT. .NE. .NEQV. .NOT. .OR. .TRUE. ()+-/*=$.:, NULL NULL ! C* ' 1 0 5 72 .EE .SH Installations-Hinweise: Das XWindow Programming Environment ist als eine System V kompatible Anwendung geschrieben, die fuer den UNIX - Teil mit der Curses-Library unter Benutzung der Terminfo-Terminal-Informationen arbeitet. Sollte keine Terminfo-Informationen auf dem ensprechenden System zur Verfuegung stehen, kann ueber die Definition der Pre-Prozessor- Variablen TERMCAP, bei der Installation, ersatzweise die Verwendung von termcap-Informationen vorgegeben werden. Fuer Systeme wie Sunos 4, die System V Erweiterungen in zusaetzlichen Pfaden abgelegt haben, muessen diese in die ensprechenden Include- und Library-Pfade eingebunden werden. Fuer den XWindow-Teil wird die X-Library ab X11R3 vorausgesetzt. Die ensprechenden Pfade muesssen ebenfalls eingebunden werden. Ein wichtiger Punkt ist, dass die ALT-Taste unter XWindow als mod4 interpretiert wird (wie unter Sun ueblich). gegeben falls muss diese Taste mit xmodmap -e "add mod4 = Alt_L" dem XWindow-System hinzugefuegt werden. Um die Hilfestellung 'Function-Index' benutzen zu koennen muss eine Umgebungsvariable MANPATH gesetzt sein, die die Pfade zu allen gewuenschten Dokumentationen enthaelt. Bei einigen Rechnern (z.B.: S400) muessen fuer den XWindow Teil auch Netz-Bibliotheken beim Binden beruecksichtigt werden. xwpe-1.5.30a/old/we_djgpp.c0000644000076400007640000003434310263105405014502 0ustar dulsidulsi/* we_term.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "messages.h" #include "edit.h" #ifdef DJGPP #include #include #include #include #include #include #include #include #include #include #include "makro.h" int MAXSLNS = 25; int MAXSCOL = 80; u_short e_h_di = 0, e_h_ax = 0; #ifdef PROG extern int wfildes[2], efildes[2]; extern char *e_p_msg[]; #endif int cur_x = -1, cur_y = -1, cur_a = 0, cur_e = 0, c_flag = 0; int e_t_initscr() { int i, ret; union REGS cpu; /* cpu.h.ah = 3; cpu.h.bh = 0; int86(0x10, &cpu, &cpu); */ cpu.h.ah = 15; int86(0x10, &cpu, &cpu); if(cpu.h.al == 2 || cpu.h.al == 7) { cur_a = 11; cur_e = 12; } else { cur_a = 6; cur_e = 7; } e_begscr(); schirm = (char *) ScreenPrimary; e_abs_refr(); return(0); } int svflgs, kbdflgs; int e_begscr() { int cols, lns; if((lns = ScreenRows()) > 0) MAXSLNS = lns; if((cols = ScreenCols()) > 0) MAXSCOL = cols; signal(SIGSEGV, e_exit); return(0); } int e_endwin() { return(0); } /* Cursor Ein- und Ausschalten */ int fk_t_cursor(int sw) { union REGS cpu; cpu.h.ah = 1; if(sw == 0) { cpu.h.ch = 1; cpu.h.cl = 0; } else if(sw == 2) { cpu.h.ch = 1; cpu.h.cl = cur_e; } else { cpu.h.ch = cur_a; cpu.h.cl = cur_e; } int86(0x10, &cpu, &cpu); return(0); } char *tmpschirm, *svschirm; void ini_repaint(ECNT *cn) { svschirm = schirm; if((tmpschirm = (char *)MALLOC(4000*sizeof(char))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); else { schirm = tmpschirm; e_cls(cn->fb->df.fb, cn->fb->dc); e_ini_desk(cn); } } void end_repaint() { int n; if(tmpschirm != NULL) { schirm = svschirm; for(n = 0; n < 160*MAXSLNS; n++) *(schirm + n) = *(tmpschirm + n); FREE((char *)tmpschirm); } } void ini_repaint_1(FENSTER *f) { svschirm = schirm; if((tmpschirm = (char *)MALLOC(4000*sizeof(char))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); else schirm = tmpschirm; } void end_repaint_1(FENSTER *f) { int i, j; if(tmpschirm != NULL) { schirm = svschirm; for(j = f->a.y+1; j < f->e.y; j++) for(i = f->a.x+1; i < f->e.x; i++) { *(schirm+2*MAXSCOL*j+2*i) = *(tmpschirm+2*MAXSCOL*j+2*i); *(schirm+2*MAXSCOL*j+2*i+1) = *(tmpschirm+2*MAXSCOL*j+2*i+1); } FREE((char *)tmpschirm); } } int x_bioskey() { union REGS cpu; cpu.h.ah = 2; int86(0x16,&cpu,&cpu); return(cpu.h.al); } int e_kbhit() { if(kbhit()) return(getch()); return(e_mshit()); } int e_t_getch(void) { #if MOUSE extern struct mouse e_mouse; int g[4] = { 1, 0, 0, 0, }; #endif int c = 0, b = 0; #if MOUSE e_refresh(); fk_mouse(g); while (c == 0) { if (kbhit() == 0) { g[0] = 3; fk_mouse(g); if(g[1] != 0) { if(g[1] == 2) c = -4; else if(g[1] == 3) c = -2; else c = - g[1]; e_mouse.x = g[2]/8; e_mouse.y = g[3]/8; } } else { #endif if( (c = getxkey()) > 512 ) c -= 256; if( c > 255 ) { c--; if(((b = bioskey()) & 3) != 0) c = 512 + c ; else if(c == CF9 - 1) c++; else if(c == 401 || c == 402) c+= 450; else if((c == 337 || c == 338) && (b & 4)) c+= 514; } else if( c == 255 ) c = 0; else if( c == ' ' && (bioskey() & 8)) c = AltBl; #if MOUSE } } g[0] = 2; fk_mouse(g); #endif return(c); } int fk_t_locate(int x, int y) { cur_x = x; cur_y = y; ScreenSetCursor(y, x); return(0); } int fk_t_putchar(char c) { return(fputc(c, stdout)); } #if MOUSE int fk_t_mouse(int g[]) { extern int fk__mouse_stat; union REGS cpu; if (fk__mouse_stat==0) return(0); if (fk__mouse_stat==1) { cpu.x.ax=0; int86(0x33,&cpu,&cpu); if (cpu.x.ax==0) { fk__mouse_stat=0; return(-1); } fk__mouse_stat=2; } cpu.x.ax=g[0]; cpu.x.bx=g[1]; cpu.x.cx=g[2]; cpu.x.dx=g[3]; int86(0x33,&cpu,&cpu); g[0]=cpu.x.ax; g[1]=cpu.x.bx; g[2]=cpu.x.cx; g[3]=cpu.x.dx; return(1); } #else int fk_t_mouse(int g[]) { return(0); } #endif int setdisk(int x) { union REGS cpu; cpu.h.ah = 0x0e; cpu.h.dl = x; intdos(&cpu, &cpu); return(cpu.x.cflag); } int getdisk() { union REGS cpu; cpu.h.ah = 0x19; intdos(&cpu, &cpu); return(cpu.h.al); } int getcurdir(int n, char *str) { union REGS cpu; cpu.h.ah = 0x47; cpu.h.dl = n; cpu.x.si = (unsigned long) str; intdos(&cpu, &cpu); return(-cpu.x.cflag); } int fk_setdisk(int n) { extern struct EXT h_error; char s[256]; union REGS cpu; h_error.sw = 0; cpu.h.ah = 0x44; cpu.h.al = 0x0f; cpu.h.bl = n+1; intdos(&cpu, &cpu); /* if(n < 2) e_dsk_test(n + 1); */ if(h_error.sw) return(e_h_error()); if(getcurdir(n+1, s) != 0) { if(h_error.sw) return(e_h_error()); return(-1); } if(h_error.sw) return(e_h_error()); setdisk(n); return(0); } #undef getcwd(); #undef chdir(); #ifdef DJ_OLD char *e_getcwd(char *buf, int n) { char *p = buf+2; union REGS cpu; cpu.h.ah = 0x19; intdos(&cpu, &cpu); buf[0] = cpu.h.al + 'A'; buf[1] = ':'; if(!getcwd(p, n-2)) return(NULL); for(; *p; p++) if(*p == '/') *p = '\\'; return(buf); } #else char *e_getcwd(char *buf, int n) { char *p = buf; if(!getcwd(p, n)) return(NULL); for(; *p; p++) if(*p == '/') *p = '\\'; return(buf); } #endif int e_chdir(char *buf) { char *p = buf; if(buf[1] == ':') { union REGS cpu; cpu.h.ah = 0x0e; cpu.h.dl = toupper(buf[0]) - 'A'; intdos(&cpu, &cpu); p += 2; } return(chdir(p)); } int fk_lfw_test( int disk) { int ret, save; union REGS cpu; cpu.h.ah = 0x19; intdos(&cpu, &cpu); save = cpu.h.al; cpu.h.ah = 0x44; cpu.h.al = 0x0e; cpu.h.bl = 1+disk; intdos(&cpu, &cpu); if(!cpu.x.cflag || cpu.x.ax == 1) return(cpu.h.al); cpu.h.ah = 0x0e; cpu.h.dl = disk; intdos(&cpu, &cpu); cpu.h.ah = 0x19; intdos(&cpu, &cpu); if(cpu.h.al == disk) ret = disk; else ret = -1; cpu.h.ah = 0x0e; cpu.h.dl = save; intdos(&cpu, &cpu); return(ret); } #ifdef PROG #ifdef GCC_MAIN #include jmp_buf e_j_buf; #endif int e_p_stdout = -1, e_p_stderr = -1, e_p_out_file, e_p_err_file; int e_exec_inf(FENSTER *f, char **argv, int n) { char *sp, *s_tmp = NULL, w_tmp[128], e_tmp[128]; int i; #ifdef DEBUGGER if(e_d_swtch > 0) e_d_quit(f); #endif sprintf(w_tmp, "%s/we_%d.111", getenv("GO32TMP"), getpid()); if(e_p_stdout < 0) e_p_stdout = dup(1); remove(w_tmp); e_p_out_file = open(w_tmp, O_CREAT); if(e_p_out_file < 0) return(0); dup2(e_p_out_file, 1); sprintf(e_tmp, "%s/we_%d.112", getenv("GO32TMP"), getpid()); if(e_p_stderr < 0) e_p_stderr = dup(2); remove(e_tmp); e_p_err_file = open(e_tmp, O_CREAT); if(e_p_err_file < 0) return(0); dup2(e_p_err_file, 2); #ifdef GCC_MAIN i = setjmp(e_j_buf); if(!i) gcc_main(n, argv); #else for(i = 0; i < n && argv[i] != NULL; i++) { write(e_p_err_file, argv[i], strlen(argv[i])); write(e_p_err_file, " ", 1); } write(e_p_err_file, "\n", 1); s_tmp = MALLOC((strlen(argv[0])+1)*sizeof(char)); strcpy(s_tmp, argv[0]); sp = argv[0]; argv[0] = s_tmp; if(spawnvp(P_WAIT, s_tmp, argv)) e_print_arg(stderr, e_p_msg[ERR_IN_COMMAND], argv, n); FREE(s_tmp); argv[0] = sp; /* if(system(s_tmp)) e_print_arg(stderr, e_p_msg[ERR_IN_COMMAND], argv, n); if(s_tmp) free(s_tmp); */ #endif dup2(e_p_stdout, 1); dup2(e_p_stderr, 2); close(e_p_out_file); close(e_p_err_file); if((wfildes[0] = open(w_tmp, O_RDONLY)) < 0 ) { e_error(e_p_msg[ERR_PIPEOPEN], 0, f->fb); return(1); } if((efildes[0] = open(e_tmp, O_RDONLY)) < 0 ) { e_error(e_p_msg[ERR_PIPEOPEN], 0, f->fb); return(1); } return(1); } #endif /* catch/handle hardware exceptions */ static char *err_msg[] = { "Disk is Write-Protected", "Unknown Unit", "Drive not ready", "Unknown Command", "Data-Error (CRC)", "rong Length (Request-Struktur)", "Search-Error", "Unknown Medium-Typ", "Sektor not found", "Printer got no Paper", "Write-Error", "Read-Error", "General Error", "Unknown Error", "Unknown Error", "Invallid Disk-Change" }; int e_h_error() { static char msg[200]; extern struct EXT h_error; int drive; int errorno; drive = e_h_ax & 0x00FF; errorno = e_h_di & 0x00FF; sprintf(msg, "Error at Drive %c: %s", 'A'+drive, err_msg[errorno]); e_error(msg, 0, h_error.cn->fb); return(-1); } _go32_dpmi_registers regs; _go32_dpmi_seginfo info_24, old_vec_24, info_23, old_vec_23; int e_d_handler(_go32_dpmi_registers *r) { extern struct EXT h_error; e_h_ax = r->x.ax; e_h_di = r->x.di; h_error.sw = 1; regs.x.flags = r->x.flags= 0xffff; regs.h.dl = r->h.dl = 0x3; return 1; } int harderr(int (*hnd)(_go32_dpmi_registers *r)) { _go32_dpmi_get_real_mode_interrupt_vector(0x24, &old_vec_24); info_24.pm_offset = (u_long) hnd; _go32_dpmi_allocate_real_mode_callback_iret(&info_24, ®s); _go32_dpmi_set_real_mode_interrupt_vector(0x24, &info_24); return(0); } int reset_harderr(void) { _go32_dpmi_set_real_mode_interrupt_vector(0x24, &old_vec_24); _go32_dpmi_free_real_mode_callback(&info_24); return(0); } int e_t_sys_ini() { /* _go32_want_ctrl_break(0); */ reset_harderr(); e_refresh(); return(0); } int e_t_sys_end() { extern struct EXT h_error; /* _go32_want_ctrl_break(1); */ harderr(e_d_handler); e_chdir(h_error.cn->dirct); e_abs_refr(); fk_locate(0, 0); } int e_switch_screen(int sw) { extern struct EXT h_error; int i, j, x, y, g[4]; static int out_cur_x, out_cur_y, save_sw = 32000; static PIC *outp = NULL; PIC *tpic; if(save_sw == sw) return(0); save_sw = sw; if(!sw) { g[0] = 2; fk_mouse(g); } tpic = e_open_view(0,0,MAXSCOL-1,MAXSLNS-1, 7, 2); ScreenGetCursor(&y, &x); /* ???? */ if(outp) { e_close_view(outp, 1); fk_t_locate(out_cur_x, out_cur_y); } if(sw) { g[0] = 1; fk_mouse(g); } outp = tpic; out_cur_x = x; out_cur_y = y; return(sw); } int e_deb_out(FENSTER *f) { e_switch_screen(0); getch(); e_switch_screen(1); return(0); } int e_ctrl_break() { setcbrk(0); _go32_want_ctrl_break(1); return(0); } #undef getenv struct dj_env { char *var, *string; } **e_djenv = NULL; int e_djenv_n = 0; void e_free_djenv() { int i; if(e_djenv) { for(i = 0; i < e_djenv_n; i++) { if(e_djenv[i]) { if(e_djenv[i]->var) FREE(e_djenv[i]->var); if(e_djenv[i]->string) FREE(e_djenv[i]->string); FREE(e_djenv[i]->var); } } FREE(e_djenv); } e_djenv = NULL; e_djenv_n = 0; } void e_add_djvar(char *var, char *string) { if(!e_djenv) e_djenv = MALLOC(sizeof(struct dj_env *)); else e_djenv = REALLOC(e_djenv, (e_djenv_n+1) * sizeof(struct dj_env *)); if(!e_djenv) return; e_djenv[e_djenv_n] = MALLOC(sizeof(struct dj_env)); if(!e_djenv[e_djenv_n]) return; e_djenv[e_djenv_n]->var = MALLOC((strlen(var)+1) * sizeof(char)); e_djenv[e_djenv_n]->string = MALLOC((strlen(string)+1) * sizeof(char)); if(!e_djenv[e_djenv_n]->var || !e_djenv[e_djenv_n]->var) return; strcpy(e_djenv[e_djenv_n]->var, var); strcpy(e_djenv[e_djenv_n]->string, string); e_djenv_n++; } char *e_getdjenv(char *var) { int i; for(i = 0; i < e_djenv_n; i++) if(!strcmp(e_djenv[i]->var, var)) return(e_djenv[i]->string); return(NULL); } char *e_getdj_var(char *var, char *str, int n) { char *tp; int i, j, k, len; for(i = 0; var[i] && !isalnum1(var[i]); i++); if(!(tp = e_getdjenv(var+i))) tp = getenv(var+i); if(!tp) return(NULL); for(j = 0; j < n && (str[j] = tp[j]); j++); if(j == n) str[--j] = '\0'; len = j; for(k = 0; k < i; k++) { if(var[k] == ':') { for(j = len; j >= 0 && str[j] != '/' && str[j] != '\\'; j--); if(j <= 0 || str[j-1] == ':') j++; str[j] = '\0'; } else if(var[k] == ';' && len < n-1) { str[len] = ';'; str[++len] = '\0'; } else if(var[k] == '/') { for(j = 0; str[j]; j++) if(str[j] == '\\') str[j] = '/'; } else if(var[k] == '\\') { for(j = 0; str[j]; j++) if(str[j] == '/') str[j] = '\\'; } else if(var[k] == '<') { for(j = 0; (str[j] = toupper(str[j])); j++); } else if(var[k] == '>') { for(j = 0; (str[j] = tolower(str[j])); j++); } } return(str); } void e_read_djenv() { char *tp, var[128], string[256], str[256], tmp[128]; FILE *fp; int i, j, k; if(!(tp = getenv("DJGPP"))) return; if(!(fp = fopen(tp, "r"))) return; if(e_djenv) e_free_djenv(); while(fgets(str, 256, fp)) { for(i = 0; str[i] && !isalnum1(str[i]); i++); for(j = 0; isalnum1(str[i+j]) && (var[j] = str[i+j]); j++); if(str[i+j] != '=') continue; var[j] = '\0'; if(i > 0 && str[i-1] == '+' && (tp = getenv(var))) continue; for(i += j + 1, j = 0; str[i] && str[i] != '\n'; i++, j++) { if(str[i] == '%') { for(k = 0; (tmp[k] = str[i+1+k]) != '%' && tmp[k]; k++); tmp[k] = '\0'; if(e_getdj_var(tmp, string+j, 256-j)) j = strlen(string) - 1; else j--; i = i + k + 1; } else string[j] = str[i]; } string[j] = '\0'; e_add_djvar(var, string); } } char *e_getenv(char *var) { char *tp; if(!e_djenv) e_read_djenv(); tp = e_getdjenv(var); if(!tp) tp = getenv(var); return(tp); } /* find attached drives */ struct dirfile *e_mk_drives(void) { struct dirfile *df = MALLOC(sizeof(struct dirfile)); int drvs, i; df->name = MALLOC(sizeof(char *) * 26); df->anz = 0; for ( i = 0; i < 26; i++) { if(fk_lfw_test(i) >= 0) { *(df->name + df->anz) = MALLOC(2 * sizeof(char)); *(*(df->name + df->anz)) = 'A'+i; *(*(df->name + df->anz)+1) = '\0'; (df->anz)++; } } return(df); } #endif /* is DJGPP */ xwpe-1.5.30a/we.10000644000076400007640000000004510263105405012446 0ustar dulsidulsi.so man1/xwpe.1 .\" @(#)we.1 3/22/94 xwpe-1.5.30a/WeExpArr.c0000644000076400007640000000427710263105405013625 0ustar dulsidulsi/*-------------------------------------------------------------------------*\ -- Xwpe routines for Expanding Arrays Date Programmer Description 05/25/97 Dennis Created for xwpe reorganization. \*-------------------------------------------------------------------------*/ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ Includes \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #include "Xwpe.h" #include "WeExpArr.h" /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ Expandable Arrays Expandable arrays store four integers before the first element of the array. The first integer is the current size of the array including unsed elements. The second integer is the size of each element. This is followed by the growth factor. Finally the number of currently used elements is listed. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ void *WpeExpArrayCreate(int initial_num, int elem_size, int growth_num) { int *exp_array; exp_array = (int *)WpeMalloc(initial_num * elem_size + sizeof(int) * 4); *(exp_array) = initial_num; *(exp_array + 1) = elem_size; *(exp_array + 2) = growth_num; *(exp_array + 3) = initial_num; return ((void *)(exp_array + 4)); } void WpeExpArrayAdd(void **exp_array, void *new_elem) { int *real_array; real_array = ((int *)*exp_array) - 4; if (*real_array == *(real_array + 3)) { *(real_array) += *(real_array + 2); real_array = WpeRealloc(real_array, (*real_array) * (*(real_array + 1)) + sizeof(int) * 4); if (real_array == NULL) { /* Some error handling should be done here */ return ; } *exp_array = (void *)(real_array + 4); } memcpy(((char *)*exp_array) + (*(real_array + 3)) * (*(real_array + 1)), new_elem, (*(real_array + 1))); *(real_array + 3) += 1; } int WpeExpArrayGetSize(void *exp_array) { int *real_array; real_array = ((int *)exp_array) - 4; return (*(real_array + 3)); } void WpeExpArrayDestroy(void *exp_array) { int *real_array; real_array = ((int *)exp_array) - 4; WpeFree(real_array); } xwpe-1.5.30a/we_block.c0000644000076400007640000007116510263105405013715 0ustar dulsidulsi/* we_block.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "messages.h" #include "edit.h" #include extern int e_undo_sw; /* delete block */ int e_blck_del(FENSTER *f) { BUFFER *b; SCHIRM *s; int i,y,len; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; s = f->s; if ((s->mark_end.y < s->mark_begin.y) || ((s->mark_begin.y == s->mark_end.y) && (s->mark_end.x <= s->mark_begin.x))) { return(0); } if (f->ins == 8) return(WPE_ESC); if (s->mark_begin.y == s->mark_end.y) { e_del_nchar(b, s, s->mark_begin.x, s->mark_begin.y, s->mark_end.x - s->mark_begin.x); b->b.x = s->mark_end.x = s->mark_begin.x; } else { /***********************/ y=s->mark_begin.y; if(s->mark_begin.x>0) y++; len=y-s->mark_end.y+1; /***********************/ e_add_undo('d', b, s->mark_begin.x, s->mark_begin.y, 0); f->save = b->cn->maxchg + 1; /***********************/ e_brk_recalc(f,y,len); /***********************/ } sc_txt_1(f); e_cursor(f, 1); e_schirm(f, 1); return(0); } /* dup selected block BD*/ int e_blck_dup(char *dup, FENSTER *f) { BUFFER *b; SCHIRM *s; int i; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; if (f->ins == 8) return(0); b = f->b; s = f->s; i=s->mark_end.x - s->mark_begin.x; /* Brian thinks that 80 characters is enough. For the time being return nothing if longer than that. */ if ((s->mark_end.y != s->mark_begin.y) || (i <= 0) || (i >= 80)) { return(0); } strncpy(dup, &b->bf[s->mark_begin.y].s[s->mark_begin.x], i); dup[i]=0; return(i); } int e_blck_clear(BUFFER *b, SCHIRM *s) { int i; int len = (s->mark_end.y-s->mark_begin.y-1); if (s->mark_end.y == s->mark_begin.y) { e_del_nchar(b, s, s->mark_begin.x, s->mark_end.y, s->mark_end.x - s->mark_begin.x); b->b.x = s->mark_end.x = s->mark_begin.x; b->b.y = s->mark_end.y = s->mark_begin.y; return(0); } for (i = s->mark_begin.y + 1; i < s->mark_end.y; i++) FREE(b->bf[i].s); for (i = s->mark_begin.y + 1; i <= b->mxlines-len; i++) b->bf[i] = b->bf[i+len]; (b->mxlines) -= len; (s->mark_end.y) -= len; e_del_nchar(b, s, 0, s->mark_end.y, s->mark_end.x); if (*(b->bf[s->mark_begin.y].s+(len = b->bf[s->mark_begin.y].len)) != '\0') len++; e_del_nchar(b, s, s->mark_begin.x, s->mark_begin.y, len - s->mark_begin.x); b->b.x = s->mark_end.x = s->mark_begin.x; b->b.y = s->mark_end.y = s->mark_begin.y; return(0); } /* write buffer to screen */ int e_show_clipboard(FENSTER *f) { ECNT *cn = f->ed; FENSTER *fo; int i, j; for (j = 1; j <= cn->mxedt; j++) if (cn->f[j] == cn->f[0]) { e_switch_window(cn->edt[j], f); return(0); } if (cn->mxedt > MAXEDT) { e_error(e_msg[ERR_MAXWINS], 0, cn->fb); return(0); } for (j = 1; j <= MAXEDT; j++) { for (i = 1; i <= cn->mxedt && cn->edt[i] != j; i++) ; if ( i > cn->mxedt) break; } cn->curedt=j; (cn->mxedt)++; cn->edt[cn->mxedt]=j; f = cn->f[cn->mxedt] = cn->f[0]; #ifdef PROG if (WpeIsProg()) { for (i = cn->mxedt-1; i > 0; i--) ; if (i < 1) { f->a = e_set_pnt(0, 1); f->e = e_set_pnt(MAXSCOL-1, 2*MAXSLNS/3); } else { f->a = e_set_pnt(cn->f[i]->a.x+1, cn->f[i]->a.y+1); f->e = e_set_pnt(cn->f[i]->e.x, cn->f[i]->e.y); } } else #endif { if (cn->mxedt < 2) { f->a = e_set_pnt(0, 1); f->e = e_set_pnt(MAXSCOL-1, MAXSLNS-2); } else { f->a = e_set_pnt(cn->f[cn->mxedt-1]->a.x+1, cn->f[cn->mxedt-1]->a.y+1); f->e = e_set_pnt(cn->f[cn->mxedt-1]->e.x, cn->f[cn->mxedt-1]->e.y); } } f->winnum = cn->curedt; if (cn->mxedt > 1) { fo = cn->f[cn->mxedt-1]; e_ed_rahmen(fo, 0); } e_firstl(f, 1); e_zlsplt(f); e_schirm(f, 1); e_cursor(f, 1); return(0); } /* move block to buffer */ int e_edt_del(FENSTER *f) { e_edt_copy(f); e_blck_del(f); return(0); } /* copy block to buffer */ int e_edt_copy(FENSTER *f) { BUFFER *b; BUFFER *b0 = f->ed->f[0]->b; int i, save; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; save = f->save; if ((f->s->mark_end.y < f->s->mark_begin.y) || ((f->s->mark_begin.y == f->s->mark_end.y) && (f->s->mark_end.x <= f->s->mark_begin.x))) { return(0); } for (i = 1; i < b0->mxlines; i++) FREE(b0->bf[i].s); b0->mxlines = 1; *(b0->bf[0].s) = WPE_WR; *(b0->bf[0].s+1) = '\0'; b0->bf[0].len = 0; e_copy_block(0, 0, b, b0, f); f->save = save; return(0); } /* Copy block buffer into window */ int e_edt_einf(FENSTER *f) { BUFFER *b; BUFFER *b0 = f->ed->f[0]->b; int i,y,len; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; if (f->ins == 8) return(0); e_undo_sw = 1; /**********************/ y=b->b.y; if(b->b.x>0) y++; /**********************/ e_copy_block(b->b.x, b->b.y, b0, b, f); /**********************/ len=b0->f->s->mark_end.y-b0->f->s->mark_begin.y; e_brk_recalc(f,y,len); /**********************/ e_undo_sw = 0; e_add_undo('c', b, b->b.x, b->b.y, 0); sc_txt_2(f); f->save = b->cn->maxchg + 1; return(0); } /* move block within window */ int e_blck_move(FENSTER *f) { BUFFER *b; int i; POINT ka; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; ka.x = f->ed->f[f->ed->mxedt]->s->mark_begin.x; if (b->b.y > f->ed->f[f->ed->mxedt]->s->mark_begin.y) ka.y = f->ed->f[f->ed->mxedt]->s->mark_begin.y; else { ka.y = f->ed->f[f->ed->mxedt]->s->mark_end.y; if (b->b.y == f->ed->f[f->ed->mxedt]->s->mark_begin.y && b->b.x < f->ed->f[f->ed->mxedt]->s->mark_begin.x) ka.x = f->ed->f[f->ed->mxedt]->s->mark_end.x + f->ed->f[f->ed->mxedt]->s->mark_begin.x - b->b.x; } e_undo_sw = 1; e_move_block(b->b.x, b->b.y, b, b, f); e_undo_sw = 0; e_add_undo('v', b, ka.x, ka.y, 0); f->save = b->cn->maxchg + 1; return(0); } /* move Block */ void e_move_block(int x, int y, BUFFER *bv, BUFFER *bz, FENSTER *f) { SCHIRM *s = f->ed->f[f->ed->mxedt]->s; SCHIRM *sv = bv->f->s; SCHIRM *sz = bz->f->s; int sw = (y < s->mark_begin.y) ? 0 : 1, i, n = s->mark_end.y - s->mark_begin.y - 1; int kax = s->mark_begin.x, kay = s->mark_begin.y, kex = s->mark_end.x, key = s->mark_end.y; STRING *str, *tmp; unsigned char *cstr; if (key < kay || (kay == key && kex <= kax)) return; if (f->ins == 8) { return; } if (bv == bz && y >= kay && y <= key && x >= kax && x <= kex) { return; } if (kay == key) { n = kex - kax; bz->b.x = x; bz->b.y = y; if ((cstr = MALLOC(f->ed->maxcol * sizeof(char))) == NULL) { e_error(e_msg[ERR_LOWMEM], 0, bz->fb); return; } for (i = 0; i < n; i++) cstr[i] = bv->bf[key].s[kax+i]; e_ins_nchar(bz, sz, cstr, x, y, n); bv->b.x = kax; bv->b.y = kay+bz->b.y-y; e_del_nchar(bv, sv, sv->mark_begin.x, sv->mark_begin.y, n); if (bv == bz && kay == y && x > kex) x -= n; sz->mark_begin.x = x; sz->mark_end.x = bz->b.x = x + n; sz->mark_begin.y = sz->mark_end.y = bz->b.y = y; e_cursor(f, 1); e_schirm(f, 1); FREE(cstr); return; } if (bv == bz && y == kay && x < kax ) { n = kax - x; bv->b.x = x; bv->b.y = y; if ((cstr = MALLOC(f->ed->maxcol * sizeof(char))) == NULL) { e_error(e_msg[ERR_LOWMEM], 0, bz->fb); return; } for (i = 0; i < n; i++) cstr[i] = bv->bf[y].s[x+i]; e_del_nchar(bv, sv, x, y, n); bz->b.x = kex; bz->b.y = key; e_ins_nchar(bz, sz, cstr, kex, key, n); bv->b.x = sv->mark_begin.x = x; bv->b.y = sv->mark_begin.y = y; sv->mark_end.x = kex; sv->mark_end.y = key; e_cursor(f, 1); e_schirm(f, 1); FREE(cstr); return; } if (bv == bz && y == key && x > kex ) { n = x - kex; bv->b.x = kex; bv->b.y = y; if ((cstr = MALLOC(f->ed->maxcol * sizeof(char))) == NULL) { e_error(e_msg[ERR_LOWMEM], 0, bz->fb); return; } for (i = 0; i < n; i++) cstr[i] = bv->bf[y].s[kex+i]; e_del_nchar(bv, sv, kex, y, n); bz->b.x = kex; bz->b.y = key; e_ins_nchar(bz, sz, cstr, kax, kay, n); bv->b.x = sv->mark_end.x; bv->b.y = sv->mark_end.y; e_cursor(f, 1); e_schirm(f, 1); FREE(cstr); return; } while (bz->mxlines+n > bz->mx.y-2) { bz->mx.y += MAXLINES; if ((tmp = REALLOC(bz->bf, bz->mx.y * sizeof(STRING))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, bz->fb); else bz->bf = tmp; if (bz->f->c_sw) bz->f->c_sw = REALLOC(bz->f->c_sw, bz->mx.y * sizeof(int)); } if ((str = MALLOC((n+2) * sizeof(STRING))) == NULL) { e_error(e_msg[ERR_LOWMEM], 0, bz->fb); return; } for (i = kay; i <= key; i++) str[i-kay] = bv->bf[i]; e_new_line(y+1, bz); if (*(bz->bf[y].s+bz->bf[y].len) != '\0') (bz->bf[y].len)++; for (i = x; i <= bz->bf[y].len; i++) *(bz->bf[y+1].s+i-x) = *(bz->bf[y].s+i); *(bz->bf[y].s+x) = '\0'; bz->bf[y].len = bz->bf[y].nrc = x; bz->bf[y+1].len = e_str_len(bz->bf[y+1].s); bz->bf[y+1].nrc = e_str_nrc(bz->bf[y+1].s); for (i = bz->mxlines; i > y; i--) bz->bf[i+n] = bz->bf[i]; (bz->mxlines) += n; for (i = 1; i <= n; i++) bz->bf[y+i] = str[i]; if (bz == bv) { if (y < kay) { kay += (n+1); key +=(n+1); } else if (y > kay) y -= n; } for (i = kay + 1; i <= bv->mxlines-n; i++) bv->bf[i] = bv->bf[i+n]; (bv->mxlines) -= n; if (*(str[0].s+(n = str[0].len)) != '\0') n++; e_ins_nchar(bz, sz, (str[key-kay].s), 0, y+key-kay, kex); e_ins_nchar(bz, sz, (str[0].s+kax), x, y, n-kax); e_del_nchar(bv, sv, 0, kay+1, kex); e_del_nchar(bv, sv, kax, kay, n - kax); if (bz == bv && sw != 0) y--; sv->mark_begin.x = sv->mark_end.x = bv->b.x = kax; sv->mark_begin.y = sv->mark_end.y = bv->b.y = kay; sz->mark_begin.x = x; sz->mark_begin.y = y; bz->b.x = sz->mark_end.x = kex; bz->b.y = sz->mark_end.y = key-kay+y; f->save = f->ed->maxchg + 1; sc_txt_1(bv->f); sc_txt_1(bz->f); e_cursor(f, 1); e_schirm(f, 1); FREE(str); } /* copy block within window */ int e_blck_copy(FENSTER *f) { BUFFER *b; int i; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; if (f->ins == 8) return(0); f->save = 1; e_undo_sw = 1; e_copy_block(b->b.x, b->b.y, b, b, f); e_undo_sw = 0; e_add_undo('c', b, b->b.x, b->b.y, 0); sc_txt_2(f); f->save = b->cn->maxchg + 1; return(0); } /* copy block */ void e_copy_block(int x, int y, BUFFER *buffer_src, BUFFER *buffer_dst, FENSTER *f) { BUFFER *b = f->ed->f[f->ed->mxedt]->b; SCHIRM *s_src = buffer_src->f->s; SCHIRM *s_dst = buffer_dst->f->s; int i, j, n = s_src->mark_end.y - s_src->mark_begin.y - 1; int kax = s_src->mark_begin.x, kay = s_src->mark_begin.y, kex = s_src->mark_end.x, key = s_src->mark_end.y; int kse = key, ksa = kay; STRING **str, *tmp; unsigned char *cstr; if (key < kay || (kay == key && kex <= kax)) return; if ((cstr = MALLOC(buffer_src->mx.x + 1)) == NULL) { e_error(e_msg[ERR_LOWMEM], 0, buffer_dst->fb); return; } if (kay == key) { if (buffer_src == buffer_dst && y == kay && x >= kax && x < kex) { FREE(cstr); return; } n = kex - kax; buffer_dst->b.x = x; buffer_dst->b.y = y; for (i = 0; i < n; i++) cstr[i] = buffer_src->bf[key].s[kax+i]; e_ins_nchar(buffer_dst, s_dst, cstr, x, y, n); s_dst->mark_begin.x = x; s_dst->mark_end.x = buffer_dst->b.x = x + n; s_dst->mark_begin.y = s_dst->mark_end.y = buffer_dst->b.y = y; FREE(cstr); e_cursor(f, 1); e_schirm(f, 1); return; } if (buffer_src == buffer_dst && ( (y > kay && y < key) || ( y == kay && x >= kax ) || ( y == key && x < kex) )) { FREE(cstr); return; } while (buffer_dst->mxlines+n > buffer_dst->mx.y-2) { buffer_dst->mx.y += MAXLINES; if ((tmp = REALLOC(buffer_dst->bf, buffer_dst->mx.y * sizeof(STRING))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, buffer_dst->fb); else buffer_dst->bf = tmp; if (buffer_dst->f->c_sw) buffer_dst->f->c_sw = REALLOC(buffer_dst->f->c_sw , buffer_dst->mx.y * sizeof(int)); } if ((str = MALLOC((n+2) * sizeof(STRING *))) == NULL) { e_error(e_msg[ERR_LOWMEM], 0, buffer_dst->fb); FREE(cstr); return; } e_new_line(y+1, buffer_dst); if (buffer_dst == buffer_src && y < ksa) { kse += (n+1); ksa += (n+1); } if (*(buffer_dst->bf[y].s+buffer_dst->bf[y].len) != '\0') (buffer_dst->bf[y].len)++; for (i = x; i <= buffer_dst->bf[y].len; i++) *(buffer_dst->bf[y+1].s+i-x) = *(buffer_dst->bf[y].s+i); *(buffer_dst->bf[y].s+x) = '\0'; buffer_dst->bf[y].len = buffer_dst->bf[y].nrc = x; buffer_dst->bf[y+1].len = e_str_len(buffer_dst->bf[y+1].s); buffer_dst->bf[y+1].nrc = e_str_nrc(buffer_dst->bf[y+1].s); for (i = buffer_dst->mxlines; i > y; i--) buffer_dst->bf[i+n] = buffer_dst->bf[i]; (buffer_dst->mxlines) += n; for (i = ksa; i <= kse; i++) str[i-ksa] = &(buffer_src->bf[i]); for (i = 1; i <= n; i++) buffer_dst->bf[i+y].s = NULL; for (i = 1; i <= n; i++) { if ((buffer_dst->bf[i+y].s = MALLOC(buffer_dst->mx.x+1)) == NULL) e_error(e_msg[ERR_LOWMEM], 1, b->fb); for (j = 0; j <= str[i]->len; j++) *(buffer_dst->bf[i+y].s+j) = *(str[i]->s+j); if (*(str[i]->s+str[i]->len) != '\0') *(buffer_dst->bf[i+y].s+j) = '\0'; buffer_dst->bf[i+y].len = str[i]->len; buffer_dst->bf[i+y].nrc = str[i]->nrc; } for (i = 0; i < kex; i++) cstr[i] = str[key-kay]->s[i]; e_ins_nchar(buffer_dst, s_dst, cstr, 0, y+key-kay, kex); if (*(str[0]->s+(n = str[0]->len)) != '\0') n++; for (i = 0; i < n - kax; i++) cstr[i] = str[0]->s[i+kax]; cstr[n-kax] = '\0'; e_ins_nchar(buffer_dst, s_dst, cstr, x, y, n-kax); s_dst->mark_begin.x = x; s_dst->mark_begin.y = y; buffer_dst->b.x = s_dst->mark_end.x = kex; buffer_dst->b.y = s_dst->mark_end.y = key-kay+y; e_cursor(f, 1); e_schirm(f, 1); FREE(cstr); FREE(str); } /* delete block marks */ int e_blck_hide(FENSTER *f) { BUFFER *b; SCHIRM *s; int i; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; s = f->s; s->mark_begin = e_set_pnt(0, 0); s->mark_end = e_set_pnt(0, 0); e_schirm(f, 1); return(0); } /* mark begin of block */ int e_blck_begin(FENSTER *f) { int i; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; f->s->mark_begin = f->b->b; e_schirm(f, 1); return(0); } /* Set end of block */ int e_blck_end(FENSTER *f) { int i; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; f->s->mark_end = f->b->b; e_schirm(f, 1); return(0); } /* goto begin of block */ int e_blck_gt_beg(FENSTER *f) { int i; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; f->b->b = f->s->mark_begin; e_schirm(f, 1); return(0); } /* goto end of block */ int e_blck_gt_end(FENSTER *f) { int i; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; f->b->b = f->s->mark_end; e_schirm(f, 1); return(0); } /* mark text line in block */ int e_blck_mrk_all(FENSTER *f) { int i; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; f->s->mark_begin.x = 0; f->s->mark_begin.y = 0; f->s->mark_end.y = f->b->mxlines-1; f->s->mark_end.x = f->b->bf[f->b->mxlines-1].len; e_schirm(f, 1); return(0); } /* mark text line in block */ int e_blck_mrk_line(FENSTER *f) { int i; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; f->s->mark_begin.x = 0; f->s->mark_begin.y = f->b->b.y; if(f->b->b.y < f->b->mxlines-1) { f->s->mark_end.x = 0; f->s->mark_end.y = f->b->b.y+1; } else { f->s->mark_end.x = f->b->bf[f->b->b.y].len; f->s->mark_end.y = f->b->b.y; } e_schirm(f, 1); return(0); } /* block: up- or downcase mode=0 every character downcase mode=1 every character upcase mode=2 first character in each word upcase mode=3 first character in each line upcase */ int e_blck_changecase(FENSTER *f, int mode) { BUFFER *b; SCHIRM *screen; int i,x,y,x_begin,x_end; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; screen = f->s; for (y = screen->mark_begin.y; y <= screen->mark_end.y; y++) { if (y == screen->mark_begin.y) x_begin = screen->mark_begin.x; else x_begin = 0; if (y == screen->mark_end.y) x_end = screen->mark_end.x; else x_end = b->bf[y].len; for (x = x_begin; x < x_end; x++) if (mode == 0) b->bf[y].s[x]=tolower(b->bf[y].s[x]); else if (mode == 1) b->bf[y].s[x]=toupper(b->bf[y].s[x]); else if ((mode == 2) && ((x == 0) || (b->bf[y].s[x-1] == ' ') || (b->bf[y].s[x-1] == '\t'))) b->bf[y].s[x]=toupper(b->bf[y].s[x]); else if ((mode == 3) && (x == 0)) b->bf[y].s[x]=toupper(b->bf[y].s[x]); } f->save++; e_schirm(f, 1); return 0; } int e_changecase_dialog(FENSTER *f) { static int b_sw = 0; int ret; W_OPTSTR *o = e_init_opt_kst(f); if (!o) return(-1); o->xa = 21; o->xe = 52; o->ya = 4; o->ye = 15; o->bgsw = AltO; o->name = "Change Case"; o->crsw = AltO; e_add_txtstr(4, 2, "Which mode:", o); e_add_pswstr(1, 5, 3, 0, AltD, 0, "Downcase ", o); e_add_pswstr(0, 5, 4, 0, AltU, b_sw & 1, "Upcase ", o); e_add_pswstr(0, 5, 5, 0, AltH, b_sw & 2, "Headline ", o); e_add_pswstr(0, 5, 6, 0, AltE, b_sw & 3, "First character ", o); e_add_bttstr(7, 9, 1, AltO, " Ok ", NULL, o); e_add_bttstr(18, 9, -1, WPE_ESC, "Cancel", NULL, o); ret = e_opt_kst(o); if (ret != WPE_ESC) e_blck_changecase(f,o->pstr[0]->num); freeostr(o); return 0; } /* unindent block */ int e_blck_to_left(FENSTER *f) { BUFFER *b; SCHIRM *s; int n = f->ed->tabn/2, i, j, k, l, m, nn; char *tstr = MALLOC((n+2)*sizeof(char)); for(i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--); if(i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; s = f->s; for(i = 0; i <= n; i++) tstr[i] = ' '; tstr[n] = '\0'; for (i = (!s->mark_begin.x) ? s->mark_begin.y : s->mark_begin.y + 1; i < s->mark_end.y || (i == s->mark_end.y && s->mark_end.x > 0); i++) { for(j = 0; j < b->bf[i].len && isspace(b->bf[i].s[j]); j++); for(l = j - 1, k = 0; l >= 0 && k < n; l--) { if(b->bf[i].s[l] == ' ') k++; else if(b->bf[i].s[l] == '\t') { for(nn = m = 0; m < l; m++) { if(b->bf[i].s[m] == ' ') nn++; else if(b->bf[i].s[m] == '\t') nn += f->ed->tabn - (nn % f->ed->tabn); } k += f->ed->tabn - (nn % f->ed->tabn); } } l = j - l - 1; if(l > 0) { nn = s->mark_begin.x; e_del_nchar(b, s, j - l, i, l); if (k > n) e_ins_nchar(b, s, tstr, j-l, i, k-n); s->mark_begin.x = nn; } } FREE(tstr); e_schirm(f, 1); return(0); } /* indent block */ int e_blck_to_right(FENSTER *f) { BUFFER *b; SCHIRM *s; int n = f->ed->tabn/2, i, j; char *tstr = MALLOC((n+1)*sizeof(char)); for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; s = f->s; for (i = 0; i < n; i++) tstr[i] = ' '; tstr[n] = '\0'; for (i = (!s->mark_begin.x) ? s->mark_begin.y : s->mark_begin.y + 1; i < s->mark_end.y || (i == s->mark_end.y && s->mark_end.x > 0); i++) { for (j = 0; b->bf[i].len && isspace(b->bf[i].s[j]); j++) ; e_ins_nchar(b, s, tstr, j, i, n); if (i == s->mark_begin.y) s->mark_begin.x = 0; } FREE(tstr); e_schirm(f, 1); return(0); } /* Read block from file */ int e_blck_read(FENSTER *f) { if (f->ins == 8) return(WPE_ESC); WpeCreateFileManager(1, f->ed, ""); f->save = f->ed->maxchg + 1; return(0); } /* write block to file */ int e_blck_write(FENSTER *f) { WpeCreateFileManager(2, f->ed, ""); return(0); } /* find again */ int e_rep_search(FENSTER *f) { SCHIRM *s; BUFFER *b; FIND *fd = &(f->ed->fd); int i, ret, j, iend, jend, end; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; s = f->s; ret = b->b.x; j = b->b.y; if ((fd->sw & 8) == 0) { jend = (fd->sw & 4) ? 0 : b->mxlines-1; iend = (fd->sw & 4) ? 0 : b->bf[b->mxlines-1].len; } else { jend = (fd->sw & 4) ? s->mark_begin.y : s->mark_end.y; iend = (fd->sw & 4) ? s->mark_begin.x : s->mark_end.x; } for (; ; ret = -1) { if ((fd->sw & 4) == 0 && j > jend) break; else if ((fd->sw & 4) != 0 && j < jend) break; do { if (j == jend) end = iend; else if (!(fd->sw & 4)) end = b->bf[j].len; else end = 0; if (fd->sw & 4 && ret == -1) ret = b->bf[j].len; if ((fd->sw & 32) == 0) { if ((fd->sw & 128) != 0) ret = e_strstr(ret, end, b->bf[j].s, fd->search); else ret = e_ustrstr(ret, end, b->bf[j].s, fd->search); } else { if ((fd->sw & 128) != 0) ret = e_rstrstr(ret, end, b->bf[j].s, fd->search, &(fd->sn)); else ret = e_urstrstr(ret, end, b->bf[j].s, fd->search, &(fd->sn)); } if ((fd->sw & 4) == 0 && j == jend && ret > iend) break; else if ((fd->sw & 4) != 0 && j == jend && ret < iend) break; if (ret >= 0 && ((fd->sw & 64) == 0 || (isalnum(*(b->bf[j].s+ret+fd->sn)) == 0 && (ret == 0 || isalnum(*(b->bf[j].s+ret-1)) == 0)))) { s->fa.x = ret; b->b.y = s->fa.y = s->fe.y = j; s->fe.x = ret + fd->sn; b->b.x = ret = !(fd->sw & 4) ? s->fe.x : ret; if (!(fd->sw & 1)) { e_cursor(f, 1); s->fa.y = j; e_schirm(f, 1); } return(1); } else if (ret >= 0 && (fd->sw & 64) != 0) ret++; } while(ret >= 0); if ((fd->sw & 4) == 0 && j > jend) break; else if ((fd->sw & 4) != 0 && j < jend) break; j = ((fd->sw & 4) == 0) ? j+1 : j-1; } if (!(fd->sw & 1)) e_message(0, e_msg[ERR_GETSTRING], f); return(0); } /* goto line */ int e_goto_line(FENSTER *f) { int i, num; SCHIRM *s; BUFFER *b; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; s = f->s; if ((num = e_num_kst("Goto Line Number", b->b.y+1, b->mxlines, f, 0, AltG)) > 0) b->b.y = num - 1; else if (num == 0) b->b.y = num; e_cursor(f, 1); return(0); } int e_find(FENSTER *f) { SCHIRM *s; BUFFER *b; FIND *fd = &(f->ed->fd); int i, ret; char strTemp[80]; W_OPTSTR *o = e_init_opt_kst(f); if (!o) return(-1); for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; s = f->s; if (e_blck_dup(strTemp, f)) { strcpy(fd->search, strTemp); fd->sn = strlen(fd->search); } o->xa = 7; o->ya = 3; o->xe = 63; o->ye = 18; o->bgsw = 0; o->crsw = AltO; o->name = "Find"; e_add_txtstr(32, 4, "Direction:", o); e_add_txtstr(4, 4, "Options:", o); e_add_txtstr(4, 9, "Scope:", o); e_add_txtstr(32, 9, "Begin:", o); e_add_wrstr(4, 2, 18, 2, 35, 128, 0, AltT, "Text to Find:", fd->search, &f->ed->sdf, o); e_add_sswstr(5, 5, 0, AltC, fd->sw & 128 ? 1 : 0, "Case sensitive ", o); e_add_sswstr(5, 6, 0, AltW, fd->sw & 64 ? 1 : 0, "Whole words only ", o); e_add_sswstr(5, 7, 0, AltR, fd->sw & 32 ? 1 : 0, "Regular expression", o); e_add_pswstr(0, 33, 5, 6, AltD, 0, "ForwarD ", o); e_add_pswstr(0, 33, 6, 0, AltB, fd->sw & 4 ? 1 : 0, "Backward ", o); e_add_pswstr(1, 5, 10, 0, AltG, 0, "Global ", o); e_add_pswstr(1, 5, 11, 0, AltS, fd->sw & 8 ? 1 : 0, "Selected Text ", o); e_add_pswstr(2, 33, 10, 0, AltF, 0, "From Cursor ", o); e_add_pswstr(2, 33, 11, 0, AltE, fd->sw & 2 ? 1 : 0, "Entire Scope ", o); e_add_bttstr(16, 13, 1, AltO, " Ok ", NULL, o); e_add_bttstr(34, 13, -1, WPE_ESC, "Cancel", NULL, o); ret = e_opt_kst(o); if (ret != WPE_ESC) { fd->sw = (o->pstr[0]->num << 2) + (o->pstr[1]->num << 3) + (o->pstr[2]->num << 1) + (o->sstr[0]->num << 7) + (o->sstr[1]->num << 6) + (o->sstr[2]->num << 5); strcpy(fd->search, o->wstr[0]->txt); fd->sn = strlen(fd->search); if ((fd->sw & 2) != 0) { if ((fd->sw & 4) == 0) { b->b.x = (fd->sw & 8) == 0 ? 0 : s->mark_begin.x; b->b.y = (fd->sw & 8) == 0 ? 0 : s->mark_begin.y; } else { b->b.x = (fd->sw & 8) == 0 ? b->bf[b->mxlines-1].len : s->mark_end.x; b->b.y = (fd->sw & 8) == 0 ? b->mxlines-1 : s->mark_end.y; } } } freeostr(o); if (ret != WPE_ESC) e_rep_search(f); return(0); } /* The menu and menuhandling have been rewritten to support only 4 choices rather than 3 sets of 2 alternatives. 1 Forward from Cursor 2 Back from Cursor 3 Global replace (forward from start of text) 4 Selected Text (from start of selection, and only shown if a block _is_ marked) The result window is either 'String NOT Found' or the number of occurrences found and the number actually replaced. */ int e_replace(FENSTER *f) { SCHIRM *s; BUFFER *b; FIND *fd = &(f->ed->fd); int i, ret, c, ym, rep=0, found=0; char strTemp[80]; W_OPTSTR *o = e_init_opt_kst(f); if (!o) return(-1); for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; s = f->s; if (e_blck_dup(strTemp, f)) { strcpy(fd->search, strTemp); fd->sn = strlen(fd->search); } o->xa = 7; o->ya = 3; o->xe = 67; o->ye = 17; o->bgsw = 0; o->name = "Replace"; o->crsw = AltO; e_add_txtstr(4, 6, "Options:", o); e_add_txtstr(32, 6, "Scope:", o); e_add_wrstr(4, 2, 18, 2, 35, 128, 0, AltT, "Text to Find:", fd->search, &f->ed->sdf, o); e_add_wrstr(4, 4, 18, 4, 35, 128, 0, AltN, "New Text:", fd->replace, &f->ed->rdf, o); e_add_sswstr(5, 7, 0, AltC, fd->sw & 128 ? 1 : 0, "Case sensitive ", o); e_add_sswstr(5, 8, 0, AltW, fd->sw & 64 ? 1 : 0, "Whole words only ", o); e_add_sswstr(5, 9, 0, AltR, fd->sw & 32 ? 1 : 0, "Regular expression", o); e_add_sswstr(5, 10, 0, AltP, 1, "Prompt on Replace ", o); e_add_pswstr(0, 33, 7, 0, AltF, 0, "Forward from Cursor", o); e_add_pswstr(0, 33, 8, 0, AltB, fd->sw & 4 ? 1 : 0, "Back from Cursor ", o); e_add_pswstr(0, 33, 9, 0, AltG, fd->sw & 2 ? 1 : 0, "Global Replace ", o); if (s->mark_end.y) e_add_pswstr(0, 33, 10, 0, AltS, fd->sw & 10 ? 1 : 0, "Selected Text ", o); e_add_bttstr(10, 12, 1, AltO, " Ok ", NULL, o); e_add_bttstr(41, 12, -1, WPE_ESC, "Cancel", NULL, o); e_add_bttstr(22, 12, 7, AltA, "Change All", NULL, o); ret = e_opt_kst(o); if (ret != WPE_ESC) { strcpy(fd->search, o->wstr[0]->txt); fd->sn = strlen(fd->search); strcpy(fd->replace, o->wstr[1]->txt); fd->rn = strlen(fd->replace); fd->sw = 1 + (o->sstr[0]->num << 7)+ (o->sstr[1]->num << 6) + (o->sstr[2]->num << 5) + (o->sstr[3]->num << 4); switch (o->pstr[0]->num) { case 2: fd->sw |= 2; b->b.x = b->b.y = 0; break; case 1: fd->sw |= 4; b->b.x = b->bf[b->mxlines-1].len; b->b.y = b->mxlines-1; break; case 3: fd->sw |= 10; b->b.x = s->mark_begin.x; b->b.y = s->mark_begin.y; default: break; } } freeostr(o); if (ret != WPE_ESC) { while (e_rep_search(f) && ((ret == AltA) || (!found))) { found++; if (f->a.y < 11) { s->c.y = b->b.y - 1; ym = 15; } else { ym = 1; } e_schirm(f, 1); c = 'Y'; if (fd->sw & 16) c = e_message(1, "String found:\nReplace this occurrence ?",f); if (c == WPE_ESC) break; if (c == 'Y') { rep++; e_add_undo('s', b, s->fa.x, b->b.y, fd->sn); e_undo_sw = 1; e_del_nchar(b, s, s->fa.x, b->b.y, fd->sn); e_ins_nchar(b, s, (unsigned char *)fd->replace, s->fa.x, b->b.y, fd->rn); e_undo_sw = 0; s->fe.x = s->fa.x + fd->rn; b->b.x = !(fd->sw & 4) ? s->fe.x : s->fa.x; e_schirm(f, 1); } } if (found) { sprintf(strTemp, "Found %d\nReplaced %d", found, rep); e_message(0, strTemp, f); } else e_message(0, e_msg[ERR_GETSTRING], f); } return(0); } xwpe-1.5.30a/we_debug.c0000644000076400007640000016455410263105405013716 0ustar dulsidulsi/* we_debug.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "messages.h" #include "edit.h" #ifndef NO_XWINDOWS #include "WeXterm.h" #endif #ifdef DEBUGGER #include #include #include #include #include #include #ifndef TERMCAP /* Because term.h defines "buttons" it messes up we_gpm.c if in edit.h */ #include #endif #define D_CBREAK -2 #define CTRLC CtrlC #define SVLINES 12 int e_d_delbreak(FENSTER *f); int e_d_error(char *s); #define MAXOUT 2 * MAXSCOL * MAXSLNS char *e_debugger, *e_deb_swtch = NULL, *e_d_save_schirm; int e_d_swtch = 0, rfildes[2], ofildes, e_d_pid = 0; int e_d_nbrpts = 0, e_d_zwtchs = 0, *e_d_ybrpts, *e_d_nrbrpts; /* number of watch expressions in Watches window */ int e_d_nwtchs = 0; /* e_d_nrwtchs[i] is the y coordinate (count starts at 0) of the first line of the i-th watch in the Watches window */ int *e_d_nrwtchs; char **e_d_swtchs; /* e_d_swtchs[i] is the i-th watch expression (a char*) */ int e_d_nstack; char e_d_file[128], **e_d_sbrpts; char *e_d_out = NULL; int e_deb_type = 0, e_deb_mode = 0; char e_d_out_str[SVLINES][256]; char *e_d_sp[SVLINES]; char e_d_tty[80]; extern int wfildes[2], efildes[2]; extern struct termios otermio, ntermio, ttermio; extern struct e_s_prog e_sv_prog; extern BUFFER *e_p_w_buffer; extern char *att_no; extern char *e_tmp_dir; #ifdef NOTPARM char *tparm(); char *tgoto(); #endif #ifdef DEFTPUTS int tputs(); #endif char *npipe[5] = { NULL, NULL, NULL, NULL, NULL }; char *e_d_msg[] = { "Ctrl C pressed\nQuit Debugger ?", "Quit Debugger ?", "End of Debugging", "Program is not running", "No symbol in current context\n", "No Source-Code", /* Number 5 */ "Start Debugger", "Can\'t start Debugger", "Starting program:", "Can\'t start Program", "Program exited", /* Number 10 */ "Program terminated", "Program received signal", "Unknown Break\nQuit Debugger ?", "Can\'t find file %s", "Can\'t create named pipe", /* Number 15 */ "Breakpoint", "(sig ", "program exited", "signal", "interrupt", /* Number 20 */ "stopped in", "BREAKPOINT", "Child process terminated normally", "software termination", "Continuing.\n", /* Number 25 */ "No stack.", "no process" }; extern char *e_p_msg[]; int e_deb_inp(FENSTER *f) { ECNT *cn = f->ed; int c = 0; f = cn->f[cn->mxedt]; c = e_getch(); switch(c) { case 'p': case ('p' - 'a' + 1): e_deb_out(f); break; case 'o': case ('o' - 'a' + 1): e_deb_options(f); break; case 'b': case ('b' - 'a' + 1): e_breakpoint(f); break; case 'm': case ('m' - 'a' + 1): e_remove_breakpoints(f); break; case 'a': case 1: e_remove_all_watches(f); break; case 'd': case ('d' - 'a' + 1): e_delete_watches(f); break; case 'w': case ('w' - 'a' + 1): e_make_watches(f); break; case 'e': case ('e' - 'a' + 1): e_edit_watches(f); break; case 'k': case ('k' - 'a' + 1): e_deb_stack(f); break; case 't': case ('t' - 'a' + 1): e_deb_trace(f); break; case 's': case ('s' - 'a' + 1): e_deb_next(f); break; case 'r': case 'c': case ('r' - 'a' + 1): case ('c' - 'a' + 1): e_deb_run(f); break; case 'q': case ('q' - 'a' + 1): e_d_quit(f); break; case 'u': case ('u'-'a'+1): e_d_goto_cursor(f); break; case 'f': case ('f'-'a'+1): e_d_finish_func(f); break; default: return(c); } return(0); } int e_d_q_quit(FENSTER *f) { int ret = e_message(1, e_d_msg[ERR_QUITDEBUG], f); if (ret == 'Y') e_d_quit(f); return(0); } int e_debug_switch(FENSTER *f, int c) { switch (c) { case F7: e_deb_trace(f); break; case F8: e_deb_next(f); break; case CF10: e_deb_run(f); break; case CF2: e_d_q_quit(f); break; default: if (f->ed->edopt & ED_CUA_STYLE) { switch (c) { case F5: e_breakpoint(f); break; case CF5: e_make_watches(f); break; case CF3: e_deb_stack(f); break; default: return(c); } } else { switch (c) { case CF8: e_breakpoint(f); break; case CF7: e_make_watches(f); break; case CF6: e_deb_stack(f); break; default: return(c); } } } return(0); } /* Input Routines */ int e_e_line_read(int n, signed char *s, int max) { int i, ret = 0; for (i = 0; i < max - 1; i++) { ret = read(n, s + i, 1); if (ret != 1 || s[i] == EOF || s[i] == '\n'|| s[i] == '\0') break; } if (ret != 1 && i == 0) return(-1); s[i+1] = '\0'; if (e_deb_type == 1 && s[i] == '*') return(1); if (e_deb_type == 3 && s[i] == '>') return(1); else if (e_deb_type == 2 && i > 4 && s[i] == ' ' && !strncmp(s+i-5, "(dbx)", 5)) return(1); else if (e_deb_type == 0 && i > 4 && s[i] == ' ' && !strncmp(s+i-5, "(gdb)", 5)) return(1); return(2); } int e_d_line_read(int n, signed char *s, int max, int sw, int esw) { static char wt = 0, esc_sv = 0, str[12]; int i, j, ret = 0, kbdflgs; if (esw) { if((ret = e_e_line_read(efildes[0], s, max)) >= 0) return(ret); } else { while(e_e_line_read(efildes[0], s, max) >= 0); } for(i = 0; i < max - 1; i++) { if (esc_sv) { s[i] = WPE_ESC; esc_sv = 0; continue; } kbdflgs = fcntl(n, F_GETFL, 0 ); fcntl( n, F_SETFL, kbdflgs | O_NONBLOCK); while ((ret = read(n, s + i, 1)) <= 0 && i == 0 && wt >= sw) if(e_d_getchar() == D_CBREAK) return(-1); /* Read until no chars are left anymore Return if buffer not empty return(-1) if CBREAK */ fcntl( n, F_SETFL, kbdflgs & ~O_NONBLOCK); if (ret == -1) break; else if (ret != 1 || s[i] == EOF || s[i] == '\0') break; else if(s[i] == '\n' || s[i] == WPE_CR) break; else if(s[i] == WPE_ESC) { s[i] = '\0'; esc_sv = 1; break; } } if (ret != 1) { s[i] = '\0'; if(e_deb_type == 1 && i > 0 && s[i-1] == '*') { str[0] = 0; wt = 0; return(1); } else if(e_deb_type == 3 && i > 0 && s[i-1] == '>') { str[0] = 0; wt = 0; return(1); } else if(e_deb_type == 0) { if(i > 5 && !strncmp(s+i-6, "(gdb) ", 6)) { str[0] = 0; wt = 0; return(1); } else if(i < 6) { for (j = 0; j <= i; j++) str[6+j] = s[j]; if (!strncmp(str+i-6, "(gdb) ", 6)) { str[0] = '\0'; wt = 0; return(1); } } } else if (e_deb_type == 2) { if(i > 5 && !strncmp(s+i-6, "(dbx) ", 6)) { str[0] = 0; wt = 0; return(1); } else if(i < 6) { for(j = 0; j <= i; j++) str[6+j] = s[j]; if(!strncmp(str+i-6, "(dbx) ", 6)) { str[0] = '\0'; wt = 0; return(1); } } } } else { s[i+1] = '\0'; } if (i != 0) wt = 0; else wt++; if(i > 4) for(j = 0; j < 6; j++) str[j] = s[j+i-5]; return(0); } int e_d_dum_read() { char str[256]; int ret; while ((ret = e_d_line_read(wfildes[0], str, 128, 0, 0)) == 0 || ret == 2) if (ret == 2) e_d_error(str); return(ret); } /* Output Routines */ int e_d_p_exec(FENSTER *f) { ECNT *cn = f->ed; BUFFER *b; SCHIRM *s; int ret, i, is, j; char str[512]; for (i = cn->mxedt; i > 0 && strcmp(cn->f[i]->datnam, "Messages"); i--) ; if (i <= 0) { e_edit(cn, "Messages"); i = cn->mxedt; } f = cn->f[i]; b = cn->f[i]->b; s = cn->f[i]->s; if (b->bf[b->mxlines-1].len != 0) e_new_line(b->mxlines, b); for (j = 0, i = is = b->mxlines-1; (ret = e_d_line_read(wfildes[0], str, 512, 0, 0)) == 0; ) { if (ret == -1) return(ret); print_to_end_of_buffer(b, str, b->mx.x); } if (ret == 1) { e_new_line(i, b); for (j = 0; j < NUM_COLS_ON_SCREEN_SAFE - 2 && str[j] != '\n' && str[j] != '\0'; j++) *(b->bf[i].s+j) = str[j]; b->b.y = i; b->b.x = b->bf[i].len = j; b->bf[i].nrc = j; } b->b.y = b->mxlines-1; b->b.x = 0; e_rep_win_tree(cn); return(ret); } /* Help Routines */ int e_d_getchar() { int i = 1, fd; char c = 0, kbdflgs = 0; if (WpeIsXwin()) fd = rfildes[0]; else fd = 0; /* if(WpeIsXwin() || e_deb_mode) */ { kbdflgs = fcntl(fd, F_GETFL, 0 ); fcntl( fd, F_SETFL, kbdflgs | O_NONBLOCK); } #ifndef NO_XWINDOWS if (WpeIsXwin()) c = (*e_u_change)(NULL); #endif if (c || (i = read(fd, &c, 1)) == 1) { if (c == CTRLC) { /* if (WpeIsXwin() || e_deb_mode) */ fcntl(fd, F_SETFL, kbdflgs & ~O_NONBLOCK); e_d_switch_out(0); i = e_message(1, e_d_msg[ERR_CTRLCPRESS], WpeEditor->f[WpeEditor->mxedt]); if (i == 'Y') { e_d_quit(WpeEditor->f[WpeEditor->mxedt]); return(D_CBREAK); } else return(c); } else write(rfildes[1], &c, 1); } /* if (WpeIsXwin() || e_deb_mode) */ fcntl(fd, F_SETFL, kbdflgs & ~O_NONBLOCK); return(i == 1 ? c : 0); } int e_d_is_watch(int c, FENSTER *f) { if (strcmp(f->datnam, "Watches")) return(0); if(c == EINFG) return(e_make_watches(f)); else if (c == ENTF) return(e_delete_watches(f)); else return(0); } int e_d_quit_basic(FENSTER *f) { int i, kbdflgs; if (!e_d_swtch) return 0; if (rfildes[1] >= 0) { if (e_deb_type == 0 || e_deb_type == 3) write(rfildes[1], "q\ny\n", 4); else if (e_deb_type == 1) write(rfildes[1], "q\n", 2); else if (e_deb_type == 2) write(rfildes[1], "quit\n", 5); } kbdflgs = fcntl(0, F_GETFL, 0 ); fcntl(0, F_SETFL, kbdflgs & ~O_NONBLOCK); e_d_swtch = 0; if (e_d_pid) { kill(e_d_pid, 9); e_d_pid = 0; } if (!WpeIsXwin()) { if (e_d_out) FREE(e_d_out); e_d_out = NULL; } if (rfildes[1] >= 0) close(rfildes[1]); if (wfildes[0] >= 0) close(wfildes[0]); if (efildes[0] >= 0) close(efildes[0]); if (rfildes[0] >= 0) close(rfildes[0]); if (wfildes[1] >= 0) close(wfildes[1]); if (WpeIsXwin()) { remove(npipe[0]); remove(npipe[1]); remove(npipe[2]); remove(npipe[3]); remove(npipe[4]); } else { if (efildes[1] >= 0) close(efildes[1]); if (!e_deb_mode) e_g_sys_end(); else { e_d_switch_out(1); fk_locate(MAXSCOL, MAXSLNS); e_putp("\r\n"); e_putp(att_no); e_d_switch_out(0); } } } int e_d_quit(FENSTER *f) { ECNT *cn = f->ed; int i; e_d_quit_basic(f); e_d_p_message(e_d_msg[ERR_ENDDEBUG], f, 1); WpeMouseChangeShape(WpeEditingShape); e_d_delbreak(f); for (i = cn->mxedt; i > 0; i--) if (!strcmp(cn->f[i]->datnam, "Messages")) { e_switch_window(cn->edt[i], cn->f[cn->mxedt]); break; } if (i <= 0) e_edit(cn, "Messages"); return(0); } /* Watches */ int e_d_add_watch(char *str, FENSTER *f) { int ret; ret = e_add_arguments(str, "Add Watch", f, 0, AltA, &f->ed->wdf); if (ret != WPE_ESC) { f->ed->wdf = e_add_df(str, f->ed->wdf); } fk_cursor(1); return(ret); } int e_remove_all_watches(FENSTER *f) { ECNT *cn = f->ed; int i, n; if (e_d_nwtchs < 1) return(0); for (n = 0; n < e_d_nwtchs;n++) FREE(e_d_swtchs[n]); FREE(e_d_swtchs); FREE(e_d_nrwtchs); e_d_nwtchs = 0; for (i = cn->mxedt; i > 0; i--) { if (!strcmp(cn->f[i]->datnam, "Watches")) { e_switch_window(cn->edt[i], cn->f[cn->mxedt]); e_close_window(cn->f[cn->mxedt]); break; } } e_close_buffer(e_p_w_buffer); e_p_w_buffer = NULL; return(0); } int e_delete_watches(FENSTER *f) { ECNT *cn = f->ed; BUFFER *b = cn->f[cn->mxedt]->b; int n; f = cn->f[cn->mxedt]; if (e_d_nwtchs < 1 || strcmp(f->datnam, "Watches")) return(0); for (n = 0; n < e_d_nwtchs && e_d_nrwtchs[n] <= b->b.y; n++) ; FREE(e_d_swtchs[n - 1]); for (; n < e_d_nwtchs; n++) e_d_swtchs[n - 1] = e_d_swtchs[n]; e_d_nwtchs--; e_d_swtchs = REALLOC(e_d_swtchs, e_d_nwtchs * sizeof(char *)); e_d_nrwtchs = REALLOC(e_d_nrwtchs, e_d_nwtchs * sizeof(int)); e_d_p_watches(f, 0); return(0); } int e_make_watches(FENSTER *f) { char str[128]; int i, y; if ((f->ed->mxedt > 0) && (strcmp(f->datnam, "Watches") == 0)) { /* sets y=number of watch we're inserting */ for(y = 0; y < e_d_nwtchs && e_d_nrwtchs[y] < f->b->b.y; y++) ; } else y = e_d_nwtchs; if (f->ed->wdf && f->ed->wdf->anz > 0) strcpy(str, f->ed->wdf->name[0]); else str[0] = '\0'; if (e_d_add_watch(str, f)) { e_d_nwtchs++; if (e_d_nwtchs == 1) { e_d_swtchs = MALLOC(sizeof(char *)); e_d_nrwtchs = MALLOC(sizeof(int)); } else { e_d_swtchs = REALLOC(e_d_swtchs, e_d_nwtchs * sizeof(char *)); e_d_nrwtchs = REALLOC(e_d_nrwtchs, e_d_nwtchs * sizeof(int)); } /* move watch number y and following up one position so that we can insert at position y */ for (i = e_d_nwtchs - 1; i > y; i--) { e_d_swtchs[i] = e_d_swtchs[i-1]; /* The following instruction is pointless as e_d_nrwtchs[i] is invalidated by inserting the new watch and has to be recomputed by e_d_p_watches() */ e_d_nrwtchs[i] = e_d_nrwtchs[i-1]; } e_d_swtchs[y] = MALLOC(strlen(str) + 1); /* insert... */ strcpy(e_d_swtchs[y], str); /* ... new watch at pos y */ e_d_p_watches(f, 1); return(0); } return(-1); } int e_edit_watches(FENSTER *f) { BUFFER *b = f->ed->f[f->ed->mxedt]->b; char str[128]; int l; if (strcmp(f->datnam, "Watches")) return(0); for (l = 0; l < e_d_nwtchs && e_d_nrwtchs[l] <= b->b.y; l++) ; if (l == e_d_nwtchs && b->bf[b->b.y].len == 0) return(e_make_watches(f)); strcpy(str, e_d_swtchs[l - 1]); if (e_d_add_watch(str, f)) { e_d_swtchs[l - 1] = REALLOC(e_d_swtchs[l - 1], strlen(str) + 1); strcpy(e_d_swtchs[l - 1], str); e_d_p_watches(f, 0); return(0); } return(-1); } /* Among other things, e_d_p_watches() must recompute e_d_nrwtchs when called from e_edit_watches(), but has code paths that don't do this ==> possible BUG */ int e_d_p_watches(FENSTER *f, int sw) { ECNT *cn = f->ed; BUFFER *b; SCHIRM *s; int iw, i, k = 0, l, ret; char str1[256], *str; /* is 256 always large enough? */ char *str2; e_d_switch_out(0); if ((e_d_swtch > 2) && (e_d_p_stack(f, 0) == -1)) return(-1); /* Find the watch window */ for (iw = cn->mxedt; iw > 0 && strcmp(cn->f[iw]->datnam, "Watches"); iw--); if (iw == 0 && !e_d_nwtchs) { /* if no watches and the mysterious iw!=0 then just repaint window tree */ e_rep_win_tree(cn); return(0); } else if (iw == 0) { if(e_edit(cn, "Watches")) { return(-1); } else { iw = cn->mxedt; } } f = cn->f[iw]; b = cn->f[iw]->b; s = cn->f[iw]->s; /* free all lines of BUFFER b */ e_p_red_buffer(b); FREE(b->bf[0].s); b->mxlines=0; for (i = 0, l = 0; l < e_d_nwtchs; l++) { str = str1; /* Create appropriate command for the debugger */ if (e_deb_type == 0 || e_deb_type == 3) { sprintf(str1, "p %s\n", e_d_swtchs[l]); } else if (e_deb_type == 1) { sprintf(str1, "%s/\n", e_d_swtchs[l]); } else if (e_deb_type == 2) { sprintf(str1, "print %s\n", e_d_swtchs[l]); } /* Send command to debugger */ if(e_d_swtch) { write(rfildes[1], str1, strlen(str1)); } /* If no debugger or no response, give message of no symbol in context */ if (!e_d_swtch || (ret = e_d_line_read(wfildes[0], str1, 256, 0, 0)) == 1) { strcpy(str1, e_d_msg[ERR_NOSYMBOL]); k = 0; } else /* Debugger successfully returned a value */ { if (ret == -1) { return(ret); /* BUG? e_d_nrwtchs not initialized if this return is taken */ } str = MALLOC(strlen(str1) + 1); strcpy(str, str1); while ((ret = e_d_line_read(wfildes[0], str1, 256, 0, 0)) == 0 || ret == 2) { if (ret == -1) return(ret); /* BUG? e_d_nrwtchs not initialized if this return is taken */ if (ret == 2) e_d_error(str1); str = REALLOC(str, (k = strlen(str)) + strlen(str1) + 1); if (str[k-1] == '\n') str[k-1] = ' '; strcat(str, str1); } /* Find the beginning of the information (depends on debugger output format) */ if (e_deb_type == 0 || e_deb_type == 2 || e_deb_type == 3) { if (e_deb_type == 3 && str[0] == '0') { for(k = 1; str[k] != '\0' && !isspace(str[k]); k++); } else for(k = 0; str[k] != '\0' && str[k] != '='; k++); if (str[k] == '\0') { if (str != str1) FREE(str); str = str1; strcpy(str, e_d_msg[ERR_NOSYMBOL]); k = 0; } for(k++; str[k] != '\0' && isspace(str[k]); k++); } else if(e_deb_type == 1) { for (k = 0; str[k] != '\0' && str[k] != ':'; k++); if (str[k] == '\0') k = 0; else k++; } } /* Print variable name */ for ( ; str[k] != '\0' && isspace(str[k]); k++); str2 = WpeMalloc(strlen(e_d_swtchs[l]) + strlen(str + k) + 4); sprintf(str2, "%s: %s", e_d_swtchs[l], str + k); e_d_nrwtchs[l] = b->mxlines; print_to_end_of_buffer(b, str2, b->mx.x); /* Free any allocated string */ WpeFree(str2); if(str != str1) { FREE(str); } } e_new_line(b->mxlines, b); fk_cursor(1); /* if (b->b.y > i || sw) b->b.y = i;*/ if (sw && iw != cn->mxedt) e_switch_window(cn->edt[iw], cn->f[cn->mxedt]); else e_rep_win_tree(cn); /* e_d_switch_out(0); */ return(0); } int e_p_show_watches(FENSTER *f) { int i; for (i = f->ed->mxedt; i > 0; i--) if (!strcmp(f->ed->f[i]->datnam, "Watches")) { e_switch_window(f->ed->edt[i], f->ed->f[f->ed->mxedt]); break; } if (i <= 0 && e_edit(f->ed, "Watches")) { return(-1); } return(0); } /***************************************/ /*** reinitialize watches from prj ***/ int e_d_reinit_watches(FENSTER * f,char * prj) { int i,e,g,q,y,r; char * prj2; for(i = f->ed->mxedt; i > 0; i--) { if (!strcmp(f->ed->f[i]->datnam, "Watches")) { e_remove_all_watches(f->ed->f[f->ed->edt[i]]); break; } } g=strlen(prj); prj2=MALLOC(sizeof(char)*(g+1)); strcpy(prj2,prj); q=0; y=0; r=0; while(qed; BUFFER *b; SCHIRM *s; int is, i, j, k, l, ret; char str[256]; if (e_d_swtch < 3) return(e_error(e_d_msg[ERR_NOTRUNNING], 0, f->fb)); for (i = 0; i < SVLINES; i++) e_d_out_str[i][0] = '\0'; for (is = cn->mxedt; is > 0 && strcmp(cn->f[is]->datnam, "Stack"); is--) ; if (!sw && is == 0) return(0); if(is == 0) { if (e_edit(cn, "Stack")) return(-1); else is = cn->mxedt; } f = cn->f[is]; b = cn->f[is]->b; s = cn->f[is]->s; if (!e_d_swtch) return(0); if (e_deb_type == 0) write(rfildes[1], "bt\n", 3); else if (e_deb_type == 1 || e_deb_type == 3) write(rfildes[1], "t\n", 2); else if (e_deb_type == 2) write(rfildes[1], "where\n", 6); while ((ret = e_d_line_read(wfildes[0], str, 256, 0, 0)) == 2) e_d_error(str); if (ret == -1) return(-1); i = j = 0; if (ret == 1) { e_d_error(e_d_msg[ERR_PROGEXIT]); return(e_d_quit(f)); } while(ret != 1) { k = 0; do { if (i >= b->mxlines) e_new_line(i, b); if ((i > 0 && j == 0 && *(b->bf[i-1].s+b->bf[i-1].len-1) == '\\') || (!e_deb_type && j == 0 && (k > 0 || str[k] != '#'))) { for(j = 0; j < 3; j++) b->bf[i].s[j] = ' '; } for(; isspace(str[k]); k++) ; for(; j < NUM_COLS_ON_SCREEN_SAFE - 2 && str[k] != '\n' && str[k] != '\0'; j++, k++) *(b->bf[i].s+j) = str[k]; if (str[k] != '\0') { if (str[k] != '\n') { for(l = j-1; l > 2 && !isspace(b->bf[i].s[l]) && b->bf[i].s[l] != '='; l--) ; if (l > 2) { k -= (j - l - 1); for (l++; l < j; l++) b->bf[i].s[l] = ' '; } *(b->bf[i].s+j) = '\\'; *(b->bf[i].s+j+1) = '\n'; *(b->bf[i].s+j+2) = '\0'; j++; } else { *(b->bf[i].s+j) = '\n'; *(b->bf[i].s+j+1) = '\0'; } } b->bf[i].len = j; b->bf[i].nrc = j + 1; if (j != 0 && str[k] != '\0') { i++; j = 0; } else j--; } while (str[k] != '\n' && str[k] != '\0'); while ((ret = e_d_line_read(wfildes[0], str, 256, 0, 0)) == 2) e_d_error(str); if (ret == -1) return(-1); } for (; i < b->mxlines; i++) e_del_line(i, b, s); if (sw && is != cn->mxedt) e_switch_window(cn->edt[is], cn->f[cn->mxedt]); e_rep_win_tree(cn); return(0); } int e_make_stack(FENSTER *f) { char file[128], str[128], *tmpstr = MALLOC(1); int i, ret, line = 0, dif; BUFFER *b = f->ed->f[f->ed->mxedt]->b; e_d_switch_out(0); if(e_deb_type != 1) { tmpstr[0] = '\0'; if(e_deb_type == 0) { for(i = dif = 0; i <= b->b.y; i++) if(b->bf[i].s[0] == '#') dif = atoi((char *) (b->bf[i].s + 1)); for(i = b->b.y; i >= 0 && b->bf[i].s[0] != '#'; i--); if(i < 0) return(1); for(; i < b->mxlines; i++) { if(!(tmpstr = REALLOC(tmpstr, strlen(tmpstr) + b->bf[i].len + 2))) { e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(-1); } strcat(tmpstr, (char *) b->bf[i].s); if(i == b->mxlines-1 || b->bf[i+1].s[0] == '#') break; else if(tmpstr[strlen(tmpstr)-2] == '\\') tmpstr[strlen(tmpstr)-2] = '\0'; else if(tmpstr[strlen(tmpstr)-1] == '\n') tmpstr[strlen(tmpstr)-1] = '\0'; } } else { for(i = 1, dif = 0; i <= b->b.y; i++) if(b->bf[i-1].s[b->bf[i-1].len - 1] != '\\') dif++; for(i = b->b.y; i > 0 && b->bf[i-1].s[b->bf[i-1].len - 1] == '\\'; i--); if(i == 0 && b->bf[i].len == 0) return(1); for(; i < b->mxlines; i++) { if(!(tmpstr = REALLOC(tmpstr, strlen(tmpstr) + b->bf[i].len + 2))) { e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(-1); } strcat(tmpstr, (char *) b->bf[i].s); if(i == b->mxlines-1 || b->bf[i].s[b->bf[i].len - 1] != '\\') break; else if(tmpstr[strlen(tmpstr)-2] == '\\') tmpstr[strlen(tmpstr)-2] = '\0'; else if(tmpstr[strlen(tmpstr)-1] == '\n') tmpstr[strlen(tmpstr)-1] = '\0'; } } if(e_deb_type == 3 && (line = e_make_line_num2(tmpstr, file)) < 0) return(e_error(e_d_msg[ERR_NOSOURCE], 0, f->fb)); else if(e_deb_type != 3 && (line = e_make_line_num(tmpstr, file)) < 0) return(e_error(e_d_msg[ERR_NOSOURCE], 0, f->fb)); if(dif > e_d_nstack) sprintf(str, "%s %d\n", e_deb_type != 3 ? "up" : "down", dif - e_d_nstack); else if(dif < e_d_nstack) sprintf(str, "%s %d\n", e_deb_type != 3 ? "down" : "up", e_d_nstack - dif); if(dif != e_d_nstack) { write(rfildes[1], str, strlen(str)); while((ret = e_d_line_read(wfildes[0], str, 128, 0, 0)) == 0 || ret == 2) if( ret == 2) e_d_error(str); if(ret == -1) return(ret); e_d_nstack = dif; } } else if(e_deb_type == 1) { for(i = b->b.y; i >= 0 && (line = e_make_line_num2((char *)b->bf[i].s, file)) < 0; i--); } if(e_d_p_watches(f, 0) == -1) return(-1); e_d_goto_break(file, line, f); return(0); } /*******************************************************/ /** resyncing schirm - screen output with breakpoints **/ int e_brk_schirm(FENSTER *f) { int i; int n; SCHIRM *s = f->s; s->brp= REALLOC(s->brp, sizeof(int)); s->brp[0]=0; for(i=0;idatnam,e_d_sbrpts[i])) { for(n=1;n<= (s->brp[0]);n++) if(e_d_ybrpts[i]==(s->brp[n])) break; if(n>s->brp[0]) { /**** New break, not in schirm ****/ (s->brp[0])++; s->brp = REALLOC(s->brp, (s->brp[0]+1) * sizeof(int)); s->brp[s->brp[0]] = e_d_ybrpts[i]-1; } } } return 0; } /*****************************************/ /*******************************************/ /*** reinitialize breakpoints from prj ***/ int e_d_reinit_brks(FENSTER * f,char * prj) { int line,e,g,q,r; char * p,*name,*prj2; /*** remove breakpoints, schirms will be synced later ***/ e_remove_breakpoints(f); g=strlen(prj); prj2=MALLOC(sizeof(char)*(g+1)); strcpy(prj2,prj); q=0; r=0; while(q0) { /**** hopefully we have filename and line number ****/ e_d_ybrpts[e_d_nbrpts]=line; e_d_sbrpts[e_d_nbrpts]=MALLOC(sizeof(char)*(strlen(name)+1)); strcpy(e_d_sbrpts[e_d_nbrpts],name); e_d_nbrpts++; /**** needed to keep schirm in sync ****/ for(g = f->ed->mxedt; g > 0; g--) if(!strcmp(f->ed->f[g]->datnam, name)) { e_brk_schirm(f->ed->f[g]); } } } } name+=e+1; } FREE(prj2); return 0; } /**** Recalculate breakpoints , because of line/block deleting/adding ****/ int e_brk_recalc(FENSTER *f, int start, int len) { ECNT *cn = f->ed; BUFFER *b; int n, rend, count, yline; int *br_lines; if ((len == 0) || (cn == NULL)) return 1; b = cn->f[cn->mxedt]->b; rend = start - 1 + abs(len); yline = b->b.y; /**** deleting removed breakpoints ****/ if (len < 0) { for (n = 0; n < e_d_nbrpts; n++) if ((!strcmp(f->datnam, e_d_sbrpts[n])) && (e_d_ybrpts[n] <= (rend + 1)) && (e_d_ybrpts[n] >= (start + 1))) { b->b.y = e_d_ybrpts[n] - 1; e_make_breakpoint(f, 0); } } /**** scanning for breakpoints to move ****/ for (count = 0, n = 0; n < e_d_nbrpts; n++) if ((!strcmp(f->datnam, e_d_sbrpts[n])) && (e_d_ybrpts[n] >= (start + 1))) count++; if (count == 0) return 1; br_lines = (int*)malloc(sizeof(int) * count); for (n = 0, count = 0; n < e_d_nbrpts; n++) if ((!strcmp(f->datnam, e_d_sbrpts[n])) && (e_d_ybrpts[n] >= (start + 1))) { br_lines[count++] = e_d_ybrpts[n]; } /**** moving breakpoints ****/ for(n = 0; n < count; n++) { b->b.y = br_lines[n] - 1; e_make_breakpoint(f, 0); } for(n = 0; n < count; n++) { b->b.y = br_lines[n] + len - 1; e_make_breakpoint(f, 0); } b->b.y = yline; free(br_lines); return 0; } /*****************************************/ /* Breakpoints */ int e_breakpoint(FENSTER *f) { return(e_make_breakpoint(f, 0)); } int e_remove_breakpoints(FENSTER *f) { ECNT *cn = f->ed; int i; if (e_d_swtch) { if (!e_deb_type) write(rfildes[1], "d\ny\n", 4); else if (e_deb_type == 1) write(rfildes[1], "D\n", 2); else if (e_deb_type == 2) write(rfildes[1], "delete all\n", 11); else if (e_deb_type == 3) write(rfildes[1], "db *\n", 2); } for (i = 0; i < e_d_nbrpts; i++) FREE(e_d_sbrpts[i]); for (i = cn->mxedt; i >= 0; i--) if (DTMD_ISTEXT(cn->f[i]->dtmd)) cn->f[i]->s->brp[0] = 0; e_d_nbrpts = 0; if (e_d_sbrpts) { FREE(e_d_sbrpts); e_d_sbrpts = NULL; } if (e_d_ybrpts) { FREE(e_d_ybrpts); e_d_ybrpts = NULL; } if (e_d_nrbrpts) { FREE(e_d_nrbrpts); e_d_nrbrpts = NULL; } e_rep_win_tree(cn); return(0); } int e_mk_brk_main(FENSTER *f, int sw) { int i, ret; char eing[128], str[256]; if (sw) { if (e_d_swtch) { if (e_deb_type == 0) sprintf(eing, "d %d\n", e_d_nrbrpts[sw-1]); else if (e_deb_type == 2) sprintf(eing, "delete %d\n", e_d_nrbrpts[sw-1]); else if (e_deb_type == 3) sprintf(eing, "db %d\n", e_d_nrbrpts[sw-1]); else if (e_deb_type == 1) { sprintf(eing, "e main\n"); write(rfildes[1], eing, strlen(eing)); if (e_d_dum_read() == -1) return(-1); sprintf(eing, "%d d\n", e_d_ybrpts[sw-1]); } write(rfildes[1], eing, strlen(eing)); if (e_d_dum_read() == -1) return(-1); } FREE(e_d_sbrpts[sw-1]); for (i = sw-1; i < e_d_nbrpts - 1; i++) { e_d_sbrpts[i] = e_d_sbrpts[i+1]; e_d_ybrpts[i] = e_d_ybrpts[i+1]; e_d_nrbrpts[i] = e_d_nrbrpts[i+1]; } e_d_nbrpts--; if (e_d_nbrpts == 0) { FREE(e_d_sbrpts); e_d_sbrpts = NULL; FREE(e_d_ybrpts); e_d_ybrpts = NULL; FREE(e_d_nrbrpts); e_d_nrbrpts = NULL; } } else { e_d_nbrpts++; if (e_d_nbrpts == 1) { e_d_sbrpts = MALLOC(sizeof(char *)); e_d_ybrpts = MALLOC(sizeof(int)); e_d_nrbrpts = MALLOC(sizeof(int)); } else { e_d_sbrpts = REALLOC(e_d_sbrpts, e_d_nbrpts * sizeof(char *)); e_d_ybrpts = REALLOC(e_d_ybrpts, e_d_nbrpts * sizeof(int)); e_d_nrbrpts = REALLOC(e_d_nrbrpts, e_d_nbrpts * sizeof(int)); } e_d_sbrpts[e_d_nbrpts - 1] = MALLOC(1); if (e_d_swtch) { if (e_deb_type == 0) { sprintf(eing, "b main\n"); write(rfildes[1], eing, strlen(eing)); while ((ret = e_d_line_read(wfildes[0], str, 256, 0, 0)) == 0 && strncmp(str, "Breakpoint", 10)) ; if (ret == -1) return(ret); if (ret == 2) e_d_error(str); e_d_nrbrpts[e_d_nbrpts - 1] = atoi(str+11); if (ret != 1 && e_d_dum_read() == -1) return(-1); } else if (e_deb_type == 2) { sprintf(eing, "stop in main\n"); write(rfildes[1], eing, strlen(eing)); while ((ret = e_d_line_read(wfildes[0], str, 256, 0, 0)) == 0 && str[0] != '(') ; if (ret == -1) return(ret); if (ret == 2) e_d_error(str); e_d_nrbrpts[e_d_nbrpts - 1] = atoi(str+1); if (ret != 1 && e_d_dum_read() == -1) return(-1); } else if (e_deb_type == 3) { sprintf(eing, "b main\n"); write(rfildes[1], eing, strlen(eing)); while ((ret = e_d_line_read(wfildes[0], str, 256, 0, 0)) == 0 && strncmp(str, "Added:", 6)) ; ret = e_d_line_read(wfildes[0], str, 256, 0, 0); if (ret == -1) return(ret); if (ret == 2) e_d_error(str); e_d_nrbrpts[e_d_nbrpts - 1] = atoi(str+1); if (ret != 1 && e_d_dum_read() == -1) return(-1); } else if (e_deb_type == 1) { sprintf(eing, "e main\n"); write(rfildes[1], eing, strlen(eing)); if (e_d_dum_read() == -1) return(-1); sprintf(eing, "b\n"); write(rfildes[1], eing, strlen(eing)); if ((ret = e_d_line_read(wfildes[0], str, 256, 0, 0)) == -1) return(ret); if (ret == 2) e_d_error(str); if (ret != 1) { for (i = 0; str[i] && str[i] != ':'; i++) ; if (str[i]) e_d_ybrpts[e_d_nbrpts - 1] = atoi(str+i+1); if (e_d_dum_read() == -1) return(-1); } } } } return(sw ? 0 : e_d_nbrpts); } int e_make_breakpoint(FENSTER *f, int sw) { ECNT *cn = f->ed; SCHIRM *s = cn->f[cn->mxedt]->s; BUFFER *b = cn->f[cn->mxedt]->b; int ret, i; char eing[128], str[256]; if (!sw) { if (!e_check_c_file(f->datnam)) return(e_error(e_p_msg[ERR_NO_CFILE], 0, f->fb)); for(i = 0; i < s->brp[0] && s->brp[i+1] != b->b.y; i++) ; if (i < s->brp[0]) { for (i++; i < s->brp[0]; i++) s->brp[i] = s->brp[i+1]; (s->brp[0])--; for (i = 0; i < e_d_nbrpts && (strcmp(e_d_sbrpts[i], f->datnam) || e_d_ybrpts[i] != b->b.y+1); i++) ; if (e_d_swtch) { if (e_deb_type == 0) sprintf(eing, "d %d\n", e_d_nrbrpts[i]); else if (e_deb_type == 2) sprintf(eing, "delete %d\n", e_d_nrbrpts[i]); else if (e_deb_type == 3) sprintf(eing, "db %d\n", e_d_nrbrpts[i]); else if (e_deb_type == 1) { sprintf(eing, "e %s\n", e_d_sbrpts[i]); write(rfildes[1], eing, strlen(eing)); if (e_d_dum_read() == -1) return(-1); sprintf(eing, "%d d\n", e_d_ybrpts[i]); } write(rfildes[1], eing, strlen(eing)); if (e_d_dum_read() == -1) return(-1); } FREE(e_d_sbrpts[i]); for (; i < e_d_nbrpts - 1; i++) { e_d_sbrpts[i] = e_d_sbrpts[i+1]; e_d_ybrpts[i] = e_d_ybrpts[i+1]; e_d_nrbrpts[i] = e_d_nrbrpts[i+1]; } e_d_nbrpts--; if (e_d_nbrpts == 0) { FREE(e_d_sbrpts); e_d_sbrpts = NULL; FREE(e_d_ybrpts); e_d_ybrpts = NULL; FREE(e_d_nrbrpts); e_d_nrbrpts = NULL; } } else { e_d_nbrpts++; if (e_d_nbrpts == 1) { e_d_sbrpts = MALLOC(sizeof(char *)); e_d_ybrpts = MALLOC(sizeof(int)); e_d_nrbrpts = MALLOC(sizeof(int)); } else { e_d_sbrpts = REALLOC(e_d_sbrpts, e_d_nbrpts * sizeof(char *)); e_d_ybrpts = REALLOC(e_d_ybrpts, e_d_nbrpts * sizeof(int)); e_d_nrbrpts = REALLOC(e_d_nrbrpts, e_d_nbrpts * sizeof(int)); } e_d_sbrpts[e_d_nbrpts - 1] = MALLOC(strlen(f->datnam) + 1); strcpy(e_d_sbrpts[e_d_nbrpts - 1], f->datnam); e_d_ybrpts[e_d_nbrpts - 1] = b->b.y + 1; if (e_d_swtch) { if (e_deb_type == 0) { sprintf(eing, "b %s:%d\n", f->datnam, b->b.y + 1); write(rfildes[1], eing, strlen(eing)); while ((ret = e_d_line_read(wfildes[0], str, 256, 0, 0)) == 0 && strncmp(str, "Breakpoint", 10)) ; if (ret == -1) return(ret); if (ret == 2) e_d_error(str); e_d_nrbrpts[e_d_nbrpts - 1] = atoi(str+11); if (ret != 1 && e_d_dum_read() == -1) return(-1); } else if (e_deb_type == 2) { sprintf(eing, "stop at \"%s\":%d\n", f->datnam, b->b.y + 1); write(rfildes[1], eing, strlen(eing)); while ((ret = e_d_line_read(wfildes[0], str, 256, 0, 0)) == 0 && str[0] != '(') ; if (ret == -1) return(ret); if (ret == 2) e_d_error(str); e_d_nrbrpts[e_d_nbrpts - 1] = atoi(str+1); if (ret != 1 && e_d_dum_read() == -1) return(-1); } else if (e_deb_type == 3) { sprintf(eing, "b %s:%d\n", f->datnam, b->b.y + 1); write(rfildes[1], eing, strlen(eing)); while ((ret = e_d_line_read(wfildes[0], str, 256, 0, 0)) == 0 && strncmp(str, "Added:", 6)) ; ret = e_d_line_read(wfildes[0], str, 256, 0, 0); if (ret == -1) return(ret); if (ret == 2) e_d_error(str); e_d_nrbrpts[e_d_nbrpts - 1] = atoi(str+1); if (ret != 1 && e_d_dum_read() == -1) return(-1); } else if (e_deb_type == 1) { sprintf(eing, "e %s\n", f->datnam); write(rfildes[1], eing, strlen(eing)); if (e_d_dum_read() == -1) return(-1); sprintf(eing, "%d b\n", b->b.y + 1); write(rfildes[1], eing, strlen(eing)); if (e_d_dum_read() == -1) return(-1); } } (s->brp[0])++; s->brp = REALLOC(s->brp, (s->brp[0]+1) * sizeof(int)); s->brp[s->brp[0]] = b->b.y; } } else { if(e_deb_type == 0) { for (i = 0; i < e_d_nbrpts; i++) { sprintf(eing, "b %s:%d\n", e_d_sbrpts[i], e_d_ybrpts[i]); write(rfildes[1], eing, strlen(eing)); while ((ret = e_d_line_read(wfildes[0], str, 256, 0, 0)) == 0 && strncmp(str, "Breakpoint", 10)) ; if (ret == -1) return(ret); if (ret == 2) e_d_error(str); e_d_nrbrpts[e_d_nbrpts - 1] = atoi(str+11); if (ret != 1 && e_d_dum_read() == -1) return(-1); } } else if (e_deb_type == 2) { for (i = 0; i < e_d_nbrpts; i++) { sprintf(eing, "stop at \"%s\":%d\n", e_d_sbrpts[i], e_d_ybrpts[i]); write(rfildes[1], eing, strlen(eing)); while ((ret = e_d_line_read(wfildes[0], str, 256, 0, 0)) == 0 && str[0] != '(') ; if (ret == -1) return(ret); if (ret == 2) e_d_error(str); e_d_nrbrpts[e_d_nbrpts - 1] = atoi(str+1); if (ret != 1 && e_d_dum_read() == -1) return(-1); } } else if (e_deb_type == 3) { for (i = 0; i < e_d_nbrpts; i++) { sprintf(eing, "b %s:%d\n", f->datnam, b->b.y + 1); write(rfildes[1], eing, strlen(eing)); while ((ret = e_d_line_read(wfildes[0], str, 256, 0, 0)) == 0 && strncmp(str, "Added:", 6)) ; ret = e_d_line_read(wfildes[0], str, 256, 0, 0); if (ret == -1) return(ret); if (ret == 2) e_d_error(str); e_d_nrbrpts[e_d_nbrpts - 1] = atoi(str+1); if (ret != 1 && e_d_dum_read() == -1) return(-1); } } else { for (i = 0; i < e_d_nbrpts; i++) { sprintf(eing, "e %s\n", e_d_sbrpts[i]); write(rfildes[1], eing, strlen(eing)); if (e_d_dum_read() == -1) return(-1); sprintf(eing, "%d b\n", e_d_ybrpts[i]); write(rfildes[1], eing, strlen(eing)); if (e_d_dum_read() == -1) return(-1); } } } e_schirm(f, 1); return(1); } /* start Debugger */ int e_exec_deb(FENSTER *f, char *prog) { int i; if (e_d_swtch) return(1); e_d_swtch = 1; fflush(stdout); if (WpeIsXwin()) { for (i = 0; i < 5; i++) { if (npipe[i]) FREE(npipe[i]); npipe[i] = MALLOC(128); sprintf(npipe[i], "%s/we_pipe%d", e_tmp_dir, i); remove(npipe[i]); } if (mkfifo(npipe[0], S_IRUSR | S_IWUSR) < 0 || mkfifo(npipe[1], S_IRUSR | S_IWUSR) < 0 || mkfifo(npipe[2], S_IRUSR | S_IWUSR) < 0 || mkfifo(npipe[3], S_IRUSR | S_IWUSR) < 0 || mkfifo(npipe[4], S_IRUSR | S_IWUSR) < 0) { e_error(e_d_msg[ERR_CANTPIPE], 0, f->fb); return(0); } } else { if (pipe(rfildes)) { e_error(e_p_msg[ERR_PIPEOPEN], 0, f->fb); return(0); } if (pipe(wfildes)) { e_error(e_p_msg[ERR_PIPEOPEN], 0, f->fb); return(0); } if (pipe(efildes)) { e_error(e_p_msg[ERR_PIPEOPEN], 0, f->fb); return(0); } } if ((e_d_pid = fork()) > 0) { if (WpeIsXwin()) { if ((wfildes[0] = open(npipe[1], O_RDONLY)) < 0) { e_error(e_p_msg[ERR_PIPEOPEN], 0, f->fb); return(0); } for (i = 0; i < 80 && read(wfildes[0], &e_d_tty[i], 1) == 1 && e_d_tty[i] != '\0' && e_d_tty[i] != '\n'; i++) ; if (e_d_tty[i] == '\n') e_d_tty[i] = '\0'; if ((rfildes[0] = open(e_d_tty, O_RDONLY)) < 0 || (wfildes[1] = open(e_d_tty, O_WRONLY)) < 0) { e_error(e_p_msg[ERR_PIPEOPEN], 0, f->fb); return(0); } if ((rfildes[1] = open(npipe[0], O_WRONLY)) < 0 || (wfildes[0] = open(npipe[1], O_RDONLY)) < 0 || (efildes[0] = open(npipe[2], O_RDONLY)) < 0) { e_error(e_p_msg[ERR_PIPEOPEN], 0, f->fb); return(0); } if (e_deb_mode) { tcgetattr(rfildes[0], &ntermio); /* ioctl(rfildes[0], TCGETA, &ntermio);*/ ntermio.c_iflag = 0; ntermio.c_oflag = 0; ntermio.c_lflag = 0; ntermio.c_cc[VMIN] = 1; ntermio.c_cc[VTIME] = 0; #ifdef VSWTCH ntermio.c_cc[VSWTCH] = 0; #endif /* ioctl(rfildes[0], TCSETA, &ntermio);*/ tcsetattr(rfildes[0], TCSADRAIN, &ntermio); } } else { FILE *fpp; if (!(fpp = popen("tty", "r"))) { e_error(e_p_msg[ERR_PIPEOPEN], 0, f->fb); return(0); } fgets(e_d_tty, 80, fpp); pclose(fpp); } return(wfildes[1]); } else if (e_d_pid < 0) { e_error(e_p_msg[ERR_PROCESS], 0, f->fb); return(0); } #ifndef NO_XWINDOWS if (WpeIsXwin()) { FILE *fp; char file[128]; sprintf(file, "%s/we_sys", e_tmp_dir); fp = fopen(file, "w+"); fprintf(fp, "#!/bin/sh\n"); fprintf(fp, "tty > %s\n", npipe[1]); if (!e_deb_swtch) fprintf(fp, "%s %s < %s > %s 2> %s\necho type \\ to continue\nread i\n", e_debugger, prog, npipe[0], npipe[1], npipe[2]); else fprintf(fp, "%s %s %s < %s > %s 2> %s\necho type \\ to continue\nread i\n", e_debugger, e_deb_swtch, prog, npipe[0], npipe[1], npipe[2]); fprintf(fp, "rm -f %s\n", file); fclose(fp); chmod(file, 0755); execlp(XTERM_CMD, XTERM_CMD, "+sb", "-geometry", "80x25-0-0", "-e", user_shell, "-c", file, NULL); remove(file); } else #endif { int kbdflgs; close(0); if (fcntl(rfildes[0], F_DUPFD, 0) != 0) { fprintf(stderr, e_p_msg[ERR_PIPEEXEC], rfildes[0]); exit(1); } close(1); if (fcntl(wfildes[1], F_DUPFD, 1) != 1) { fprintf(stderr, e_p_msg[ERR_PIPEEXEC], wfildes[1]); exit(1); } close(2); if (fcntl(efildes[1], F_DUPFD, 2) != 2) { fprintf(stderr, e_p_msg[ERR_PIPEEXEC], efildes[1]); exit(1); } kbdflgs = fcntl(1, F_GETFL, 0 ); fcntl(1, F_SETFL, kbdflgs | O_NONBLOCK); kbdflgs = fcntl(2, F_GETFL, 0 ); fcntl( 2, F_SETFL, kbdflgs | O_NONBLOCK); if (!e_deb_swtch) execlp(e_debugger, e_debugger, prog, NULL); else execlp(e_debugger, e_debugger, e_deb_swtch, prog, NULL); } fprintf(stderr,"%s %s %s\n", e_p_msg[ERR_IN_COMMAND], e_debugger, prog); exit(1); } int e_start_debug(FENSTER *f) { ECNT *cn = f->ed; int i, file; char estr[128]; efildes[0] = efildes[1] = -1; wfildes[0] = wfildes[1] = -1; rfildes[0] = rfildes[1] = -1; if (e_d_swtch) return(0); /* e_copy_prog(&e_sv_prog, &e_prog); */ if (e_p_make(f)) return(-1); if (!e__project) { for (i = cn->mxedt; i > 0; i--) if (e_check_c_file(cn->f[i]->datnam)) break; if (i > 0) strcpy(e_d_file, cn->f[i]->datnam); } else strcpy(e_d_file, cn->f[cn->mxedt-1]->datnam); f = cn->f[cn->mxedt-1]; for (i = 0; i < SVLINES; i++) { e_d_sp[i] = e_d_out_str[i]; e_d_out_str[i][0] = '\0'; } if (e_deb_type == 1) { e_debugger = "sdb"; e_deb_swtch = NULL; } else if (e_deb_type == 2) { e_debugger = "dbx"; e_deb_swtch = "-i"; } else if (e_deb_type == 3) { e_debugger = "xdb"; e_deb_swtch = "-L"; } else { e_debugger = "gdb"; e_deb_swtch = NULL; } e_d_pid = 0; if (e_test_command(e_debugger)) { sprintf(estr, "Debugger \'%s\' not in Path", e_debugger); e_error(estr, 0, f->fb); return(-1); } e_sys_ini(); if (e__project && (file = e_exec_deb(f, e_s_prog.exe_name )) == 0) { e_sys_end(); return(-2); } else if (!e__project) { if (e_s_prog.exe_name && e_s_prog.exe_name[0]) { strcpy(estr, e_s_prog.exe_name); } else { strcpy(estr, f->datnam); WpeStringCutChar(estr, '.'); strcat(estr, ".e"); } if ((file = e_exec_deb(f, estr)) == 0) { e_sys_end(); return(-2); } } e_sys_end(); e_d_p_message(e_d_msg[ERR_STARTDEBUG], f, 1); WpeMouseChangeShape(WpeDebuggingShape); if (cn->mxedt > 1) e_switch_window(cn->edt[cn->mxedt - 1], cn->f[cn->mxedt]); return(0); } int e_run_debug(FENSTER *f) { ECNT *cn = f->ed; int kbdflgs, ret; if (e_d_swtch < 1 && (ret = e_start_debug(f)) < 0) return(ret); if (e_d_swtch < 2) { kbdflgs = fcntl(efildes[0], F_GETFL, 0); fcntl( efildes[0], F_SETFL, kbdflgs | O_NONBLOCK); kbdflgs = fcntl(wfildes[0], F_GETFL, 0); fcntl( wfildes[0], F_SETFL, kbdflgs | O_NONBLOCK); if (e_d_dum_read() == -1) return(-1); if (e_deb_type == 3) { write(rfildes[1], "sm\n", 3); if (e_d_dum_read() == -1) return(-1); } if (e_make_breakpoint(cn->f[cn->mxedt], 1) == -1) return(-1); e_d_swtch = 2; } return(0); } /* Run */ int e_deb_run(FENSTER *f) { ECNT *cn = f->ed; char eing[256]; int ret, len, prsw = 0; if (e_d_swtch < 2 && (ret = e_run_debug(f)) < 0) { e_d_quit(f); if (ret == -1) { e_show_error(0, f); return(ret); } return(e_error(e_d_msg[ERR_CANTDEBUG], 0, f->fb)); } for (ret = 0; isspace(e_d_tty[ret]); ret++) ; if (e_d_tty[ret] != DIRC) { e_d_quit(f); sprintf(eing, "tty error: %s", e_d_tty); return(e_d_error(eing)); } if (e_deb_type == 2) { if (e_d_swtch < 3) { if (e_prog.arguments) sprintf(eing, "run %s > %s\n", e_prog.arguments, e_d_tty); else sprintf(eing, "run > %s\n", e_d_tty); } else { strcpy(eing, "cont\n"); prsw = 1; } } else { if (e_d_swtch < 3) { if (e_prog.arguments) sprintf(eing, "r %s > %s\n", e_prog.arguments, e_d_tty); else sprintf(eing, "r > %s\n", e_d_tty); } else { strcpy(eing, "c\n"); prsw = 1; } } f = cn->f[cn->mxedt]; e_d_nstack = 0; e_d_delbreak(f); e_d_switch_out(1); write(rfildes[1], eing, strlen(eing)); if (e_deb_type == 0 || ((e_deb_type == 2 || e_deb_type == 3) && !prsw)) { while((ret = e_d_line_read(wfildes[0], eing, 256, 0, 0)) == 2 || !eing[0] || (!e_deb_type && prsw && ((len = (strlen(eing)-12)) < 0 || strcmp(eing + len, e_d_msg[ERR_CONTINUE]))) || (e_d_swtch < 3 && ((!e_deb_type && strncmp(e_d_msg[ERR_STARTPROG],eing, 17)) || (e_deb_type == 2 && strncmp("Running:",eing, 8))))) { if (ret == 2) e_d_error(eing); else if (ret < 0) return(e_d_quit(f)); } } if (!prsw) e_d_p_message(eing, f, 0); if (e_d_swtch < 3 && ((!e_deb_type && strncmp(e_d_msg[ERR_STARTPROG],eing, 17)) || (e_deb_type == 2 && strncmp("Running:",eing, 8)))) { e_d_quit(f); return(e_error(e_d_msg[ERR_CANTPROG], 0, f->fb)); } e_d_swtch = 3; return(e_read_output(f)); } int e_deb_trace(FENSTER *f) { return(e_d_step_next(f, 0)); } int e_deb_next(FENSTER *f) { return(e_d_step_next(f, 1)); } int e_d_step_next(FENSTER *f, int sw) { int ret, main_brk = 0; if (e_d_swtch < 2 && (ret = e_run_debug(f)) < 0) { e_d_quit(f); if (ret == -1) { e_show_error(0, f); return(ret); } return(e_error(e_d_msg[ERR_CANTDEBUG], 0, f->fb)); } if (e_d_swtch < 3) { if ((main_brk = e_mk_brk_main(f, 0)) < -1) return(main_brk); ret = e_deb_run(f); e_mk_brk_main(f, main_brk); return(ret); } e_d_delbreak(f); e_d_switch_out(1); if (sw && e_deb_type == 0) write(rfildes[1], "n\n", 2); else if (sw && (e_deb_type == 1 || e_deb_type == 3)) write(rfildes[1], "S\n", 2); else if (sw && e_deb_type == 2) write(rfildes[1], "next\n", 5); else if (e_deb_type == 2) write(rfildes[1], "step\n", 5); else write(rfildes[1], "s\n", 2); e_d_nstack = 0; return(e_read_output(f)); } int e_d_goto_func(FENSTER *f, int flag) { ECNT *cn = f->ed; BUFFER *b = cn->f[cn->mxedt]->b; int ret = 0, main_brk = 0; char str[128]; if (e_deb_type!=0)/* if gdb */ return 0; if (e_d_swtch < 2 && (ret = e_run_debug(f)) < 0) { e_d_quit(f); if (ret == -1) { e_show_error(0, f); return(ret); } return(e_error(e_d_msg[ERR_CANTDEBUG], 0, f->fb)); } if (e_d_swtch < 3) { if ((main_brk = e_mk_brk_main(f, 0)) < -1) return(main_brk); ret = e_deb_run(f); e_mk_brk_main(f, main_brk); return(ret); } e_d_delbreak(f); e_d_switch_out(1); switch(flag) { case 'U': sprintf(str,"until %d\n",b->b.y+1); break; case 'F': sprintf(str,"finish\n"); break; default: *str=0; break; } e_d_nstack = 0; if (*str) { write(rfildes[1], str, strlen(str)); ret=e_read_output(f); /* Executing Finish twice may not work properly. */ } return ret; } int e_d_goto_cursor(FENSTER *f) { return e_d_goto_func(f,'U'); } int e_d_finish_func(FENSTER *f) { return e_d_goto_func(f,'F'); } int e_d_fst_check(FENSTER *f) { int i, j, k = 0, l, ret = 0; e_d_switch_out(0); for (i = 0; i < SVLINES - 1; i++) { if ((e_deb_type != 2 && !strncmp(e_d_sp[i], e_d_msg[ERR_PROGEXIT], 14)) || ((e_deb_type == 2 && !strncmp(e_d_sp[i], e_d_msg[ERR_PROGEXIT2], 14)) || (e_deb_type == 3 && !strncmp(e_d_sp[i], e_d_msg[ERR_NORMALTERM], strlen(e_d_msg[ERR_NORMALTERM]))))) { e_d_error(e_d_sp[i]); /* Program exited */ e_d_quit(f); return(i); } else if ((e_deb_type == 0 || e_deb_type == 1) && !strncmp(e_d_sp[i], e_d_msg[ERR_PROGTERM], 18)) { e_error(e_d_msg[ERR_PROGTERM], 0, f->fb); e_d_quit(f); return(i); } else if (e_deb_type == 0 && !strncmp(e_d_sp[i], e_d_msg[ERR_PROGSIGNAL], 23)) { e_d_pr_sig(e_d_sp[i], f); return(i); } else if (e_deb_type == 3 && !strncmp(e_d_sp[i], e_d_msg[ERR_SOFTTERM], strlen(e_d_msg[ERR_SOFTTERM]))) { e_d_pr_sig(e_d_sp[i], f); return(i); } else if (e_deb_type == 2 && (!strncmp(e_d_sp[i], e_d_msg[ERR_SIGNAL], 6) || !strncmp(e_d_sp[i], e_d_msg[ERR_INTERRUPT], 9))) { e_d_pr_sig(e_d_sp[i], f); return(i); } else if (e_deb_type == 1 && strstr(e_d_sp[i], e_d_msg[ERR_SIGNAL])) { e_d_pr_sig(e_d_sp[i], f); return(i); } else if (e_deb_type == 3 && i == SVLINES-2 && strstr(e_d_sp[i], ": ")) { e_d_pr_sig(e_d_sp[i-1], f); return(i-1); } else if (!strncmp(e_d_sp[i], e_d_msg[ERR_BREAKPOINT], 10) || (e_deb_type == 1 && !strncmp(e_d_sp[i], e_d_msg[ERR_BREAKPOINT2], 10))) { if (!e_deb_type) { for (j = SVLINES - 2; j > i; j--) /* Breakpoint */ { if ((ret = atoi(e_d_sp[j])) > 0) for(k = 0; e_d_sp[j][k] && isdigit(e_d_sp[j][k]); k++) ; if (e_d_sp[j][k] == '\t') break; } if (j > i) { for (k = strlen(e_d_sp[j-1]); k >= 0 && e_d_sp[j-1][k] != ':'; k--) ; if (k >= 0 && atoi(e_d_sp[j-1]+k+1) == ret) { if (e_make_line_num(e_d_sp[j-1], e_d_sp[SVLINES-1]) >= 0) strcpy(e_d_file, e_d_sp[SVLINES-1]); } if (e_d_p_watches(f, 0) == -1) return(-1); e_d_goto_break(e_d_file, ret, f); return(i > 0 ? i-1 : 0); } } else if (e_deb_type == 1) /* Breakpoint */ { if(!strncmp(e_d_sp[i]+10, " at", 3) && (ret = e_make_line_num(e_d_sp[i+1], e_d_sp[SVLINES-1])) >= 0) { strcpy(e_d_file, e_d_sp[SVLINES-1]); if (e_d_p_watches(f, 0) == -1) return(-1); e_d_goto_break(e_d_file, ret, f); return(i); } } } else if (e_deb_type == 2 && !strncmp(e_d_sp[i], e_d_msg[ERR_STOPPEDIN], 10)) { for (j = i + 1; j < SVLINES - 1; j++) /* Breakpoint */ { for (k = 0; e_d_sp[j][k] == ' ' && e_d_sp[j][k] != '\0'; k++) ; if ((ret = atoi(e_d_sp[j]+k)) > 0) { if (!strstr(e_d_sp[j-1], " line ")) break; for (k = strlen(e_d_sp[j-1]); k >= 0 && e_d_sp[j-1][k] != '\"'; k--) ; for(k--; k >= 0 && e_d_sp[j-1][k] != '\"'; k--) ; if (k >= 0) { for(k++, l = 0; e_d_sp[j-1][k] != '\0' && e_d_sp[j-1][k] != '\"'; k++, l++) e_d_file[l] = e_d_sp[j-1][k]; e_d_file[l] = '\0'; } if (e_d_p_watches(f, 0) == -1) return(-1); e_d_goto_break(e_d_file, ret, f); return(i); } } } } return(-2); } int e_d_snd_check(FENSTER *f) { int i, j, k, ret; e_d_switch_out(0); for (i = SVLINES - 2; i >= 0; i--) { if (!e_deb_type && (ret = atoi(e_d_sp[i])) > 0) { for (k = 0; e_d_sp[i][k] && isdigit(e_d_sp[i][k]); k++) ; if (e_d_sp[i][k] != '\t') continue; if (i > 0) { for (k = strlen(e_d_sp[i-1]); k >= 0 && e_d_sp[i-1][k] != ':'; k--) ; if (k >= 0 && atoi(e_d_sp[i-1]+k+1) == ret) { i--; if (e_make_line_num(e_d_sp[i], e_d_sp[SVLINES-1]) >= 0) strcpy(e_d_file, e_d_sp[SVLINES-1]); do { for (; k >= 0 && e_d_sp[i][k] != ')'; k--) ; if (k < 0) { i--; k = strlen(e_d_sp[i]); } else break; } while (i >= 0); do { for (j = 1, k--; k >= 0 && j > 0; k--) { if (e_d_sp[i][k] == ')') j++; else if (e_d_sp[i][k] == '(') j--; } if (k < 0) { i--; k = strlen(e_d_sp[i]); } } while (i >= 0 && j > 0); if (k == 0 && i > 0) { i--; k = strlen(e_d_sp[i]); } for (k--; k >= 0 && isspace(e_d_sp[i][k]); k--) ; if (k < 0 && i > 0) i--; } } if (e_d_p_watches(f, 0) == -1) return(-1); e_d_goto_break(e_d_file, ret, f); return(i); } else if (e_deb_type == 1 && (ret = atoi(e_d_sp[i])) > 0) { for (; i > 0; i--) { for (j = strlen(e_d_sp[i-1])-1; j >= 0 && isspace(e_d_sp[i-1][j]); j--) ; if (j < 0) { i--; continue; } for (j--; j >= 0 && !isspace(e_d_sp[i-1][j]); j--) ; if (j < 0) i--; for (j--; j >= 0 && isspace(e_d_sp[i-1][j]); j--) ; if (j < 0) i--; for (j--; j >= 0 && !isspace(e_d_sp[i-1][j]); j--) ; if (!strncmp(e_d_sp[i-1]+j+1, "in ", 3)) { strcpy(e_d_file, e_d_sp[i-1]+j+4); for (k = i+2; !e_d_file[0]; k++) strcpy(e_d_file, e_d_sp[i-1]+j+4); for (k = strlen(e_d_file)-1; k >= 0 && isspace(e_d_file[k]); k--) ; e_d_file[k+1] = '\0'; if (e_d_p_watches(f, 0) == -1) return(-1); e_d_goto_break(e_d_file, ret, f); return(i); } } return(-2); } else if (e_deb_type == 3 && i == SVLINES-2 && (ret = e_make_line_num(e_d_sp[i], e_d_sp[SVLINES-1])) >= 0) { strcpy(e_d_file, e_d_sp[SVLINES-1]); if (e_d_p_watches(f, 0) == -1) return(-1); e_d_goto_break(e_d_file, ret, f); return(i); } } return(-2); } int e_d_trd_check(FENSTER *f) { int ret; char str[256]; str[0] = '\0'; e_d_switch_out(0); if ((ret = e_d_pr_sig(str, f)) == -1) return(-1); else if (ret == -2) e_d_error(e_d_msg[ERR_NOSOURCE]); return(0); } int e_read_output(FENSTER *f) { char *spt; int i, ret; for (i = 0; i < SVLINES; i++) { e_d_sp[i] = e_d_out_str[i]; e_d_out_str[i][0] = '\0'; } while ((ret = e_d_line_read(wfildes[0], e_d_sp[SVLINES-1], 256, 0, 0)) == 2) e_d_error(e_d_sp[SVLINES-1]); if (ret < 0) return(-1); e_d_switch_out(0); while(ret != 1) { spt = e_d_sp[0]; for (i = 1; i < SVLINES; i++) e_d_sp[i-1] = e_d_sp[i]; e_d_sp[SVLINES-1] = spt; do { while((ret = e_d_line_read(wfildes[0], e_d_sp[SVLINES-1], 256, 0, 0)) == 2) e_d_error(e_d_sp[SVLINES-1]); if (ret < 0) return(-1); } while(!ret && !*e_d_sp[SVLINES-1]); } if ((i = e_d_fst_check(f)) == -1) return(-1); if (i < 0 && (i = e_d_snd_check(f)) == -1) return(-1); if (i < 0 && (i = e_d_trd_check(f)) == -1) return(-1); if (i < 0) { e_d_switch_out(0); i = e_message(1, e_d_msg[ERR_UNKNOWNBRK], f); if (i == 'Y') return(e_d_quit(f)); } return(0); } int e_d_pr_sig(char *str, FENSTER *f) { int i, line = -1, ret = 0; char file[128], str2[256]; if (str && str[0]) e_d_error(str); for (i = 0; i < SVLINES; i++) e_d_out_str[i][0] = '\0'; if (e_deb_type != 1 && e_deb_type != 3) { write(rfildes[1], "where\n", 6); for (i = 0; ((ret = e_d_line_read(wfildes[0], str, 256, 0, 1)) == 0 && (line = e_make_line_num(str, file)) < 0) || ret == 2; i++) { if (!strncmp(str, e_d_msg[ERR_NOSTACK], 9)) { e_error(e_d_msg[ERR_PROGEXIT], 0, f->fb); while (ret == 0 || ret == 2) if ((ret = e_d_line_read(wfildes[0], str2, 256, 0, 0)) == 2) e_d_error(str2); e_d_quit(f); return(0); } else if (ret == 2) e_d_error(str); } } else { write(rfildes[1], "t\n", 2); for (i = 0; ((ret = e_d_line_read(wfildes[0], str, 256, 0, 1)) == 0 && (line = e_make_line_num2(str, file)) < 0) || ret == 2; i++) { if (!strncmp(str, e_d_msg[ERR_NOPROCESS], 10)) { e_error(e_d_msg[ERR_PROGEXIT], 0, f->fb); while (ret == 0 || ret == 2) if ((ret = e_d_line_read(wfildes[0], str2, 256, 0, 0)) == 2) e_d_error(str2); e_d_quit(f); return(0); } else if (ret == 2) e_d_error(str); } } if (ret == 1 && i == 0) { e_d_error(e_d_msg[ERR_PROGEXIT]); return(e_d_quit(f)); } while (ret == 0 || ret == 2) if ((ret = e_d_line_read(wfildes[0], str2, 256, 0, 0)) == 2) e_d_error(str2); if (ret == -1) return(ret); if (line >= 0) { strcpy(e_d_file, file); e_d_goto_break(file, line, f); return(0); } else return(-2); } int e_make_line_num(char *str, char *file) { char *sp; int i, n, num; if (e_deb_type == 0) { for (n = strlen(str); n >= 0 && str[n] != ':'; n--) ; if (n < 0) return(-1); for (i = n-1; i >= 0 && !isspace(str[i]); i--) ; for (n = i+1; str[n] != ':'; n++) file[n-i-1] = str[n]; file[n-i-1] = '\0'; return(atoi(str+n+1)); } else if (e_deb_type == 2) { if (!(sp = strstr(str, " line "))) return(-1); if (!(num = atoi(sp+6))) return(-1); for (i = 6; sp[i] != '\"'; i++) ; sp += (i+1); for (i = 0; (file[i] = sp[i]) != '\"' && file[i] != '\0'; i++) ; if (file[i] == '\0') return(-1); file[i] = '\0'; return(num); } else if (e_deb_type == 3) { for (sp = str, i = 0; (file[i] = sp[i]) && sp[i] != ':'; i++) ; if (!sp[i]) return(-1); file[i] = '\0'; for (i++; sp[i] && sp[i] != ':'; i++) ; if (!sp[i]) return(-1); for (i++; sp[i] && isspace(sp[i]); i++) ; if (!isdigit(sp[i])) return(-1); sp += i; return(atoi(sp)); } else { for (i = 0; str[i] != '\0' && str[i] != ':'; i++) ; if ((!str[i]) || (num = atoi(str+i+1)) < 0) return(-1); write(rfildes[1], "e\n", 2); while ((i = e_d_line_read(wfildes[0], str, 256, 0, 0)) == 2) e_d_error(str); if (i < 0) return(-1); for (i = 0; str[i] != '\0' && str[i] != '\"'; i++) ; for (sp = str + i + 1, i = 0; (file[i] = sp[i]) && file[i] != '\"'; i++) ; file[i] = '\0'; if (e_d_dum_read() == -1) return(-1); return(num); } } int e_make_line_num2(char *str, char *file) { char *sp; int i; for (i = 0; str[i] != '[' && str[i] != '\0'; i++) ; if (!str[i]) return(-1); for (sp = str+i+1, i = 0; (file[i] = sp[i]) != ':' && file[i] != '\0'; i++) ; if (file[i] == '\0') return(-1); file[i] = '\0'; for (i++; isspace(sp[i]); i++) ; return(atoi(sp+i)); } int e_d_goto_break(char *file, int line, FENSTER *f) { ECNT *cn = f->ed; BUFFER *b; SCHIRM *s; FENSTER ftmp; int i; char str[120]; /* if(schirm != e_d_save_schirm) e_d_switch_out(0); */ e_d_switch_out(0); ftmp.ed = cn; ftmp.fb = f->fb; WpeFilenameToPathFile(file, &ftmp.dirct, &ftmp.datnam); for (i = 0; i < SVLINES; i++) e_d_out_str[i][0] = '\0'; for (i = cn->mxedt; i > 0; i--) if (!strcmp(cn->f[i]->datnam, ftmp.datnam) && !strcmp(cn->f[i]->dirct, ftmp.dirct)) { /* for(j = 0; j <= cn->mxedt; j++) if(!strcmp(cn->f[j]->datnam, "Stack")) { if(cn->f[i]->e.x > 2*MAXSCOL/3-1) cn->f[i]->e.x = 2*MAXSCOL/3-1; break; } */ e_switch_window(cn->edt[i], cn->f[cn->mxedt]); break; } f = cn->f[cn->mxedt]; FREE(ftmp.dirct); FREE(ftmp.datnam); if (i <= 0) { if (access(file, 0)) { sprintf(str, e_d_msg[ERR_CANTFILE], file); return(e_error(str, 0, f->fb)); } if (e_edit(cn, file)) return(WPE_ESC); b = cn->f[cn->mxedt]->b; s = cn->f[cn->mxedt]->s; } f = cn->f[cn->mxedt]; b = cn->f[cn->mxedt]->b; s = cn->f[cn->mxedt]->s; s->da.y = b->b.y = line - 1; s->da.x = b->b.x = 0; s->de.x = MAXSCOL; e_schirm(f, 1); e_cursor(f, 1); return(0); } int e_d_delbreak(FENSTER *f) { ECNT *cn = f->ed; int i; for (i = cn->mxedt; i >= 0; i--) if (DTMD_ISTEXT(cn->f[i]->dtmd)) cn->f[i]->s->da.y = -1; e_rep_win_tree(cn); e_refresh(); return(0); } int e_d_error(char *s) { int len; e_d_switch_out(0); if (s[(len = strlen(s) - 1)] == '\n') s[len] = '\0'; return(e_error(s, 0, WpeEditor->fb)); } int e_d_putchar(int c) { if (!WpeIsXwin()) c = fk_putchar(c); else { char cc = c; c = write(wfildes[1], &cc, 1); } return(c); } int e_deb_options(FENSTER *f) { int ret; W_OPTSTR *o = e_init_opt_kst(f); if (!o) return(-1); o->xa = 20; o->ya = 4; o->xe = 60; o->ye = 13; o->bgsw = 0; o->name = "Debug-Options"; o->crsw = AltO; e_add_txtstr(4, 2, "Debugger:", o); e_add_txtstr(20, 2, "Mode:", o); e_add_pswstr(0, 5, 3, 0, AltG, 0, "Gdb ", o); e_add_pswstr(0, 5, 4, 0, AltS, 0, "Sdb ", o); #ifdef XDB e_add_pswstr(0, 5, 5, 0, AltX, e_deb_type == 3 ? 2 : e_deb_type, "Xdb ", o); #else e_add_pswstr(0, 5, 5, 0, AltD, e_deb_type, "Dbx ", o); #endif e_add_pswstr(1, 21, 3, 0, AltN, 0, "Normal ", o); e_add_pswstr(1, 21, 4, 0, AltF, e_deb_mode, "Full Screen", o); e_add_bttstr(10, 7, 1, AltO, " Ok ", NULL, o); e_add_bttstr(25, 7, -1, WPE_ESC, "Cancel", NULL, o); ret = e_opt_kst(o); if (ret != WPE_ESC) { #ifdef XDB e_deb_type = o->pstr[0]->num == 2 ? 3 : o->pstr[0]->num; #else e_deb_type = o->pstr[0]->num; #endif e_deb_mode = o->pstr[1]->num; } freeostr(o); return(0); } int e_g_sys_ini() { if (!e_d_swtch || e_deb_mode) return(0); tcgetattr(0, &ttermio); return(tcsetattr(0, TCSADRAIN, &otermio)); } int e_g_sys_end() { if (!e_d_swtch || e_deb_mode) return(0); return(tcsetattr(0, TCSADRAIN, &ttermio)); } int e_test_command(char *str) { int i = -1, k; char tmp[256], *path = getenv("PATH"); if (!path) return(-2); do { for(i++, k = 0; (tmp[k] = path[i]) && path[i] != ':'; k++, i++) ; if (k == 0) { tmp[0] = '.'; k++; } tmp[k] = '/'; tmp[k+1] = '\0'; strcat(tmp, str); if (!access(tmp, X_OK)) return(0); } while(path[i]); return(-1); } #endif xwpe-1.5.30a/xwpe.spec0000644000076400007640000000377110413525655013633 0ustar dulsidulsiSummary: X Windows Programming Environment Name: xwpe %define version 1.5.30a Version: %{version} Release: 1 License: GPL Url: http://www.identicalsoftware.com/xwpe Group: Development/Tools #Source: ftp://ftp.rrzn.uni-hannover.de/pub/systems/unix/xwpe/xwpe-1.4.2.tar.Z Source: http://www.identicalsoftware.com/xwpe/xwpe-%{version}.tar.gz Prefix: /usr BuildRoot: %{_tmppath}/%{name}-root %description XWPE is actually a package of four programs: we, wpe, xwe, and xwpe. They are different versions of the same basic programmers editor and development environment. If you have used some of the Microsoft Windows programming IDE's and longed for an X Windows equivalent, this is what you have been looking for! Also included are the text-mode equivalents of the X programs, enabling you to use xwpe no matter what your development environment may be. This package includes the basic xwpe libraries and the text-mode programs; the X Windows programs are contained in the 'xwpe-X11' package. %package X11 Summary: X Windows Programming Environment - X11 programs Group: X11/Applications/Development Requires: xwpe %description X11 Includes the 'xwpe' and 'xwe' programs from the xwpe package that are specific to X Windows. %prep %setup -q %build patch -p1 #include #include int WpeReadGeneral(ECNT *cn, char *section, char *option, char *value); int WpeWriteGeneral(ECNT *cn, char *section, FILE *opt_file); int WpeReadColor(ECNT *cn, char *section, char *option, char *value); int WpeWriteColor(ECNT *cn, char *section, FILE *opt_file); int WpeReadProgramming(ECNT *cn, char *section, char *option, char *value); int WpeWriteProgramming(ECNT *cn, char *section, FILE *opt_file); int WpeReadLanguage(ECNT *cn, char *section, char *option, char *value); int WpeWriteLanguage(ECNT *cn, char *section, FILE *opt_file); #define E_HLP_NUM 26 char *e_hlp_str[E_HLP_NUM]; extern char *info_file; #ifdef DEBUGGER extern int e_deb_type; #endif extern FARBE *u_fb, *x_fb; #define OPTION_SECTIONS 4 #define OPT_SECTION_GENERAL "General" #define OPT_SECTION_COLOR "Color" #define OPT_SECTION_PROGRAMMING "Programming" #define OPT_SECTION_LANGUAGE "Language" WpeOptionSection WpeSectionRead[] = { {OPT_SECTION_GENERAL, WpeReadGeneral}, {OPT_SECTION_COLOR, WpeReadColor}, {OPT_SECTION_PROGRAMMING, WpeReadProgramming}, {OPT_SECTION_LANGUAGE, WpeReadLanguage} }; /* About WE */ int e_about_WE(FENSTER *f) { PIC *pic = NULL; int xa = 10, ya = 4, xe = xa + 50, ye = ya + 13; char tmp[40]; fk_cursor(0); pic = e_std_kst(xa, ya, xe, ye, NULL, 1, f->fb->nr.fb, f->fb->nt.fb, f->fb->ne.fb); if (pic == NULL) { e_error(e_msg[ERR_LOWMEM], 1, f->fb); return(WPE_ESC); } sprintf(tmp, " Version %s ", VERSION); #ifdef UNIX if (WpeIsXwin() && WpeIsProg()) { e_pr_str(xa+7, ya+3, " XWindow Programming Environment ", f->fb->et.fb, 0, 0, 0, 0); e_pr_str(xa+7, ya+4, " ( XWPE ) ", f->fb->et.fb, 0, 0, 0, 0); } else if (WpeIsProg()) { e_pr_str(xa+7, ya+3, " Window Programming Environment ", f->fb->et.fb, 0, 0, 0, 0); e_pr_str(xa+7, ya+4, " ( WPE ) ", f->fb->et.fb, 0, 0, 0, 0); } else if (WpeIsXwin()) { e_pr_str(xa+7, ya+3, " XWindow Editor ", f->fb->et.fb, 0, 0, 0, 0); e_pr_str(xa+7, ya+4, " ( XWE ) ", f->fb->et.fb, 0, 0, 0, 0); } else #endif { e_pr_str(xa+7, ya+3, " Window Editor ", f->fb->et.fb, 0, 0, 0, 0); e_pr_str(xa+7, ya+4, " ( WE ) ", f->fb->et.fb, 0, 0, 0, 0); } e_pr_str(xa+7, ya+5, tmp, f->fb->et.fb, 0, 0, 0, 0); e_pr_str(xa+2, ya+8, "Copyright (C) 1993 Fred Kruse", f->fb->nt.fb, 0, 0, 0, 0); e_pr_str(xa+2, ya+9, "This Sofware comes with ABSOLUTELY NO WARRANTY;", f->fb->nt.fb, 0, 0, 0, 0); e_pr_str(xa+2, ya+10, "This is free software, and you are welcome to", f->fb->nt.fb, 0, 0, 0, 0); e_pr_str(xa+2, ya+11, "redistribute it under certain conditions;", f->fb->nt.fb, 0, 0, 0, 0); e_pr_str(xa+2, ya+12, "See \'Help\\Editor\\GNU Pub...\' for details.", f->fb->nt.fb, 0, 0, 0, 0); #if MOUSE while (e_mshit() != 0) ; e_getch(); while (e_mshit() != 0) ; #else e_getch(); #endif e_close_view(pic, 1); return(0); } /* delete everything */ int e_clear_desk(FENSTER *f) { int i; ECNT *cn = f->ed; #if MOUSE int g[4]; /* = { 2, 0, 0, 0, }; */ g[0] = 2; #endif fk_cursor(0); for (i = cn->mxedt; i > 0; i--) { f = cn->f[cn->mxedt]; if( e_close_window(f) == WPE_ESC ) return(WPE_ESC); } cn->mxedt = 0; #if MOUSE fk_mouse(g); #endif e_ini_desk(cn); #if MOUSE g[0] = 1; fk_mouse(g); #endif return(0); } /* redraw everything */ int e_repaint_desk(FENSTER *f) { /* int j; */ ECNT *cn = f->ed; int i, g[4]; #ifndef NO_XWINDOWS extern PIC *e_X_l_pic; PIC *sv_pic = NULL, *nw_pic = NULL; if (WpeIsXwin()) { if (e_X_l_pic && e_X_l_pic != cn->f[cn->mxedt]->pic) { sv_pic = e_X_l_pic; nw_pic = e_open_view(e_X_l_pic->a.x, e_X_l_pic->a.y, e_X_l_pic->e.x, e_X_l_pic->e.y, 0, 2); } (*e_u_ini_size)(); } #endif if (cn->mxedt < 1) { e_cls(f->fb->df.fb, f->fb->dc); e_ini_desk(f->ed); #ifndef NO_XWINDOWS if ((WpeIsXwin()) && nw_pic) { e_close_view(nw_pic, 1); e_X_l_pic = sv_pic; } #endif return(0); } cn->curedt = cn->mxedt; ini_repaint(cn); e_abs_refr(); for (i = 1; i < cn->mxedt; i++) { e_firstl(cn->f[i], 0); e_schirm(cn->f[i], 0); } e_firstl(cn->f[i], 1); e_schirm(cn->f[i], 1); #ifndef NO_XWINDOWS if (WpeIsXwin() && nw_pic) { e_close_view(nw_pic, 1); e_X_l_pic = sv_pic; } #endif #if MOUSE g[0] = 2; fk_mouse(g); #endif end_repaint(); e_cursor(cn->f[i], 1); #if MOUSE g[0] = 0; fk_mouse(g); g[0] = 1; fk_mouse(g); #endif return(0); } /* write system information */ int e_sys_info(FENSTER *f) { PIC *pic = NULL; char tmp[80]; int xa = 10, ya = 5, xe = xa + 60, ye = ya + 8; fk_cursor(0); pic = e_std_kst(xa, ya, xe, ye, " Information ", 1, f->fb->nr.fb, f->fb->nt.fb, f->fb->ne.fb); if (pic == NULL) { e_error(e_msg[ERR_LOWMEM], 1, f->fb); return(WPE_ESC); } e_pr_str(xa+3, ya+2, " Current File: ", f->fb->nt.fb, 0, 0, 0, 0); e_pr_str(xa+3, ya+4, " Current Directory: ", f->fb->nt.fb, 0, 0, 0, 0); e_pr_str(xa+3, ya+6, " Number of Files: ", f->fb->nt.fb, 0, 0, 0, 0); if(strcmp(f->datnam, "Clipboard") != 0) if(strcmp(f->dirct, f->ed->dirct) == 0) e_pr_str(xa+23, ya+2, f->datnam, f->fb->nt.fb, 0, 0, 0, 0); else { strcpy(tmp, f->dirct); strcat(tmp, DIRS); strcat(tmp, f->datnam); e_pr_str(xa+23, ya+2, tmp, f->fb->nt.fb, 0, 0, 0, 0); } e_pr_str(xa+23, ya+4, f->ed->dirct, f->fb->nt.fb, 0, 0, 0, 0); e_pr_str(xa+23, ya+6, WpeNumberToString(f->ed->mxedt, WpeNumberOfPlaces(f->ed->mxedt), tmp), f->fb->nt.fb, 0, 0, 0, 0); #if MOUSE while(e_mshit() != 0); e_getch(); while(e_mshit() != 0); #else e_getch(); #endif e_close_view(pic, 1); return(0); } /* color adjustments */ int e_ad_colors(FENSTER *f) { int n, xa = 48, ya = 2, num = 4; OPTK *opt = MALLOC(num * sizeof(OPTK)); opt[0].t = "Editor Colors"; opt[0].x = 0; opt[0].o = 'E'; opt[1].t = "Desk Colors"; opt[1].x = 0; opt[1].o = 'D'; opt[2].t = "Option Colors"; opt[2].x = 0; opt[2].o = 'O'; opt[3].t = "Progr. Colors"; opt[3].x = 0; opt[3].o = 'P'; n = e_opt_sec_box(xa, ya, num, opt, f, 1); FREE(opt); if (n < 0) return(WPE_ESC); return(e_ad_colors_md(f, n)); } int e_ad_colors_md(FENSTER *f, int md) { int sw = 0, xa = 0, ya = 1, xe = xa + 79, ye = ya + 22; PIC *pic; pic = e_std_kst(xa, ya, xe, ye, "Adjust Colors", 1, f->fb->er.fb, f->fb->et.fb, f->fb->es.fb); if (pic == NULL) { e_error(e_msg[ERR_LOWMEM], 1, f->fb); return(WPE_ESC); } sw = e_dif_colors(sw, xe-13, ya+1, f, md); e_close_view(pic, 1); e_repaint_desk(f); return(sw); } /* install/execute color adjustments */ int e_dif_colors(int sw, int xa, int ya, FENSTER *f, int md) { COLOR *frb = &(f->fb->er); int c = 0, bg, num; if (md == 1) { bg = 11; num = 5; } else if (md == 2) { bg = 16; num = 15; } else if (md == 3) { bg = 32; num = 5; } else { bg = 0; num = 11; } while (c != WPE_ESC && c > -2) { e_pr_dif_colors(sw, xa, ya, f, 1, md); e_pr_col_kasten(xa-28, ya+1, frb[sw+bg].f, frb[sw+bg].b , f, 0); e_pr_ed_beispiel(1, 2, f, sw, md); #if MOUSE if ((c = e_getch()) == -1) c = e_opt_cw_mouse(xa, ya, md); #else c = e_getch(); #endif if (c >= 375 && c <= 393) sw = c-375; else if (c == 326) sw = 0; else if (c == 334) sw = num-1; else if (c == 327) sw = (sw == 0) ? num-1 : sw-1; else if (c == 335) sw = (sw == num-1) ? 0 : sw+1; else if (c == WPE_CR || c == 285 || c == 330) { e_pr_dif_colors(sw, xa, ya, f, 0, md); *(frb+sw+bg) = e_n_clr(e_frb_menue(sw, xa-28, ya+1, f, md)); } } return(c); } char *text[] = { "Border", "Bord. Bt.", "Text", "Txt Mrk.1", "Txt Mrk.2", "Scrollbar", "Help Hdr.", "Help Btt.", "Help Mrk.", "Breakpnt.", "Stop Brk.", "Border", "Bord. Bt.", "Text", "Txt Mrk.", "Backgrnd.", "Border", "Bord. Bt.", "Text", "Text Sw.", "Write", "Wrt. Mrk.", "Data", "Data M.A", "Data M.P", "Switch", "Swtch. S.", "Swtch. A.", "Button", "Bttn. Sw.", "Bttn. Ak.", "Text", "Res. Wrd.", "Constants", "Pre-Proc.", "Comments" }; /* draw color box */ void e_pr_dif_colors(int sw, int xa, int ya, FENSTER *f, int sw2, int md) { int i, rfrb, cfrb, xe = xa + 12, ye, bg; char *header; if (md == 1) { ye = ya + 6; bg = 11; header = "Desk"; } else if (md == 2) { ye = ya + 16; bg = 16; header = "Options"; } else if (md == 3) { ye = ya + 6; bg = 31; header = "C-Prog."; } else { ye = ya + 12; bg = 0; header = "Editor"; } rfrb = sw2 == 0 ? f->fb->nt.fb : f->fb->fs.fb; e_std_rahmen(xa, ya, xe, ye, header, 0, rfrb, 0); for (i = 0; i < ye-ya-1; i++) { cfrb = i == sw ? f->fb->fz.fb : f->fb->ft.fb; e_pr_str_wsd(xa+2, ya+1+i, text[i+bg], cfrb, 0, 0, 0, xa+1, xe-1); } } /* color menu */ int e_frb_x_menue(int sw, int xa, int ya, FENSTER *f, int md) { COLOR *frb = &(f->fb->er); int c = 1, fsv = frb[sw].fb, x, y; if (md == 1) sw += 11; else if (md == 2) sw += 16; else if (md == 3) sw += 32; y = frb[sw].b; x = frb[sw].f; do { if (c == CRI && y < 7) y++; else if (c == CLE && y > 0) y--; else if (c == CUP && x > 0) x--; else if (c == CDO && x < 15) x++; else if (c >= 1000 && c < 1256) { x = (c-1000)/16; y = (c-1000)%16; } e_pr_x_col_kasten(xa, ya, x, y, f, 1); frb[sw] = e_s_clr(x, y); e_pr_ed_beispiel(1, 2, f, sw, md); #if MOUSE if ((c=e_getch()) == -1) c = e_opt_ck_mouse(xa, ya, md); #else c = e_getch(); #endif } while (c != WPE_ESC && c != WPE_CR && c > -2); if (c == WPE_ESC || c < -1) frb[sw] = e_n_clr(fsv); return(frb[sw].fb); } /* draw color box */ void e_pr_x_col_kasten(int xa, int ya, int x, int y, FENSTER *f, int sw) { int i, j, rfrb, ffrb, xe = xa + 25, ye = ya + 18; rfrb = sw == 0 ? f->fb->nt.fb : f->fb->fs.fb; ffrb = rfrb % 16; e_std_rahmen(xa-2, ya-1, xe, ye, "Colors", 0, rfrb, 0); /* e_pr_str((xa+xe-8)/2, ya-1, "Colors", rfrb, 0, 1, f->fb->ms.f+16*(rfrb/16), 0); */ for (j = 0; j < 8; j++) for (i = 0; i < 16; i++) { e_pr_char(3*j+xa, i+ya+1, ' ', 16*j+i); e_pr_char(3*j+xa+1, i+ya+1, 'x', 16*j+i); e_pr_char(3*j+xa+2, i+ya+1, ' ', 16*j+i); } for (i = 0; i < 18; i++) { e_pr_char(xa-1, i+ya, ' ', rfrb); e_pr_char(xe-1, i+ya, ' ', rfrb); } for (j = 0; j < 25; j++) { e_pr_char(j+xa-1, ya, ' ', rfrb); e_pr_char(j+xa-1, ye-1, ' ', rfrb); } #ifdef NEWSTYLE if (!WpeIsXwin()) { #endif for (i = 0; i < 3; i++) { e_pr_char(3*y+xa+i, x+ya, RE5, x>0 ? 16*y+ffrb : rfrb ); e_pr_char(3*y+xa+i, x+ya+2, RE5, x<15 ? 16*y+ffrb : rfrb ); } e_pr_char(3*y+xa-1, x+ya+1, RE6, y<1 ? rfrb : 16*(y-1)+ffrb); e_pr_char(3*y+xa+3, x+ya+1, RE6, y>6 ? rfrb : 16*(y+1)+ffrb); e_pr_char(3*y+xa-1, x+ya, RE1, (y<1 || x<1) ? rfrb : 16*(y-1)+ffrb); e_pr_char(3*y+xa+3, x+ya, RE2, (y>6 || x<1) ? rfrb : 16*(y+1)+ffrb); e_pr_char(3*y+xa-1, x+ya+2, RE3, (y<1 || x>14) ? rfrb : 16*(y-1)+ffrb); e_pr_char(3*y+xa+3, x+ya+2, RE4, (y>6 || x>14) ? rfrb : 16*(y+1)+ffrb); #ifdef NEWSTYLE } else e_make_xrect(3*y+xa, x+ya+1, 3*y+xa+2, x+ya+1, 1); #endif } /* draw color example */ void e_pr_ed_beispiel(int xa, int ya, FENSTER *f, int sw, int md) { COLOR *frb = &(f->fb->er); FARBE *fb = f->fb; int i, j, xe = xa+31, ye = ya+19; frb[sw] = e_s_clr(frb[sw].f, frb[sw].b); if (md == 1) { e_blk(xe-xa+1, xa+1, ya, fb->mt.fb); e_pr_str_wsd(xa+5, ya, "Edit", fb->mt.fb, 0, 1, f->fb->ms.fb, xa+3, xa+11); e_pr_str_wsd(xa+18, ya, "Options", fb->mz.fb, 0, 0, f->fb->ms.fb, xa+16, xa+27); for (i = ya+1; i < ye; i++) for (j = xa+1; j <= xe+1; j++) { e_pr_char(j, i, fb->dc, fb->df.fb); e_pr_char(j, i, fb->dc, fb->df.fb); } e_std_rahmen(xa+17, ya+1, xa+26, ya+3, NULL, 0, fb->mr.fb, 0); e_pr_str(xa+19, ya+2, "Colors", fb->mt.fb, 0, 1, fb->ms.fb, 0); e_blk(xe-xa+1, xa+1, ye, fb->mt.fb); e_pr_str_wsd(xa+4, ye, "Alt-F3 Close Window", fb->mt.fb, 0, 6, fb->ms.fb, xa+2, xa+25); } else if (md == 2) { e_std_rahmen(xa, ya, xe, ye, "Message", 1, fb->nr.fb, f->fb->ne.fb); for(i = ya+1; i < ye; i++) e_blk(xe-xa-1, xa+1, i, fb->nt.fb) ; e_pr_str(xa+4, ya+2, "Name:", f->fb->nt.fb, 0, 1, f->fb->nsnt.fb, f->fb->nt.fb); e_pr_str(xa+5, ya+3, "Active Write-Line ", fb->fa.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+5, "Name:", f->fb->nt.fb, 0, 1, f->fb->nsnt.fb, f->fb->nt.fb); e_pr_str(xa+5, ya+6, "Passive Write-Line", fb->fr.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+8, "Data:", f->fb->nt.fb, 0, 1, f->fb->nsnt.fb, f->fb->nt.fb); e_pr_str(xa+5, ya+9, "Active Marked ", f->fb->fz.fb, 0, 0, 0, 0); e_pr_str(xa+5, ya+10, "Passive Marked", f->fb->frft.fb, 0, 0, 0, 0); e_pr_str(xa+5, ya+11, "Data Text ", f->fb->ft.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+13, "Switches:", f->fb->nt.fb, 0, 1, f->fb->nsnt.fb, f->fb->nt.fb); e_pr_str(xa+5, ya+14, "[X] Active Switch ", f->fb->fsm.fb, 0, 0, 0, 0); e_pr_str(xa+5, ya+15, "[ ] Passive Switch", f->fb->fs.fb, 4, 1, f->fb->nsft.fb, f->fb->fs.fb); e_pr_str(xa+6 , ye-2, "Button", f->fb->nz.fb, 0, -1, f->fb->ns.fb, f->fb->nt.fb); e_pr_str(xe-12 , ye-2, "Active", f->fb->nm.fb, 0, -1, f->fb->nm.fb, f->fb->nt.fb); #ifdef NEWSTYLE if (WpeIsXwin()) { e_make_xrect(xa+4, ya+3, xa+23, ya+3, 1); e_make_xrect(xa+4, ya+6, xa+23, ya+6, 1); e_make_xrect(xa+4, ya+9, xa+19, ya+11, 1); e_make_xrect_abs(xa+4, ya+9, xa+19, ya+9, 0); e_make_xrect(xa+4, ya+14, xa+23, ya+15, 1); e_make_xrect_abs(xa+4, ya+14, xa+23, ya+14, 0); } #endif } else { e_std_rahmen(xa, ya, xe, ye, "Filename", 1, fb->er.fb, fb->es.fb); e_mouse_bar(xe, ya+1, ye-ya-1, 0, fb->em.fb); e_mouse_bar(xa+20, ye, 11, 1, fb->em.fb); e_pr_char(xe-3, ya, WZN, fb->es.fb); #ifdef NEWSTYLE if (!WpeIsXwin()) { #endif e_pr_char(xe-4, ya, '[', fb->er.fb); e_pr_char(xe-2, ya, ']', fb->er.fb); #ifdef NEWSTYLE } else e_make_xrect(xe-4, ya, xe-2, ya, 0); #endif for (i = ya+1; i < ye; i++) e_blk(xe-xa-1, xa+1, i, fb->et.fb); if (md == 3) { e_pr_str(xa+4, ya+3, "#Preprozessor Comands", fb->cp.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+5, "This are C-Text Colors", fb->ct.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+7, "int char {} [] ; ,", fb->cr.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+9, "\"Constants\" 12 0x13", fb->ck.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+11, "/* Comments */", fb->cc.fb, 0, 0, 0, 0); } else { e_pr_str(xa+4, ya+3, "This are the Editor Colors", fb->et.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+4, "And this is a marked Line", fb->ez.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+5, "This is a found word", fb->et.fb, 0, 0, 0, 0); e_pr_str(xa+14, ya+5, "found", fb->ek.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+8, "Help Header", fb->hh.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+9, "This is a marked Word", fb->et.fb, 0, 0, 0, 0); e_pr_str(xa+14, ya+9, "marked", fb->hm.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+10, "in the Help File", fb->et.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+11, "Help Button", fb->hb.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+14, "This is a Breakpoint", fb->db.fb, 0, 0, 0, 0); e_pr_str(xa+4, ya+15, "Stop at Breakpoint", fb->dy.fb, 0, 0, 0, 0); } } frb[sw] = e_s_clr(frb[sw].f, frb[sw].b); } /* Save - Options - Menu */ int e_opt_save(FENSTER *f) { int ret; char tmp[256]; strcpy(tmp, f->ed->optfile); ret = e_add_arguments(tmp, "Save Option File", f, 0, AltS, NULL); if (ret) { f->ed->optfile = REALLOC(f->ed->optfile, (strlen(tmp)+1)*sizeof(char)); strcpy(f->ed->optfile, tmp); e_save_opt(f); } return(ret); } char *WpeStringToValue(const char *str) { char *answer, *cur_ans; const char *cur_str; int i, len; len = strlen(str); answer = WpeMalloc((len * 2) * sizeof(char)); for (i = strlen(str), cur_ans = answer, cur_str = str; i; i--, cur_str++) { if ((*cur_str == '\n') || (*cur_str == '\\')) { len++; cur_ans[0] = '\\'; cur_ans[1] = ((*cur_str == '\n') ? 'n' : '\\'); cur_ans++; } else *cur_ans = *cur_str; cur_ans++; } *cur_ans = 0; return answer; } char *WpeValueToString(const char *value) { char *answer, *cur_ans; const char *cur_val; int i; answer = WpeMalloc((strlen(value) + 1) * sizeof(char)); for (i = strlen(value), cur_ans = answer, cur_val = value; i; i--, cur_ans++) { if (*cur_val == '\\') { cur_val++; *cur_ans = ((*cur_val == 'n') ? '\n' : '\\'); } else *cur_ans = *cur_val; cur_val++; } *cur_ans = 0; return answer; } int WpeReadGeneral(ECNT *cn, char *section, char *option, char *value) { if (WpeStrccmp("Data", option) == 0) cn->dtmd = atoi(value); else if (WpeStrccmp("Autosave", option) == 0) cn->autosv = atoi(value); else if (WpeStrccmp("MaxColumn", option) == 0) cn->maxcol = atoi(value); else if (WpeStrccmp("Tab", option) == 0) cn->tabn = atoi(value); else if (WpeStrccmp("MaxChanges", option) == 0) cn->maxchg = atoi(value); else if (WpeStrccmp("NumUndo", option) == 0) cn->numundo = atoi(value); else if (WpeStrccmp("Options1", option) == 0) cn->flopt = atoi(value); else if (WpeStrccmp("Options2", option) == 0) cn->edopt = atoi(value); else if (WpeStrccmp("InfoDir", option) == 0) info_file = WpeStrdup(value); else if (WpeStrccmp("AutoIndent", option) == 0) cn->autoindent = atoi(value); else if (WpeStrccmp("PrintCmd", option) == 0) cn->print_cmd = WpeStrdup(value); else if (WpeStrccmp("Version", option) == 0) { sscanf(value, "%d.%d.%d", &cn->major, &cn->minor, &cn->patch); } return 0; } int WpeWriteGeneral(ECNT *cn, char *section, FILE *opt_file) { fprintf(opt_file, "Version : %s\n", VERSION); fprintf(opt_file, "Data : %d\n", cn->dtmd); fprintf(opt_file, "Autosave : %d\n", cn->autosv); fprintf(opt_file, "MaxColumn : %d\n", cn->maxcol); fprintf(opt_file, "Tab : %d\n", cn->tabn); fprintf(opt_file, "MaxChanges : %d\n", cn->maxchg); fprintf(opt_file, "NumUndo : %d\n", cn->numundo); fprintf(opt_file, "Options1 : %d\n", cn->flopt); fprintf(opt_file, "Options2 : %d\n", cn->edopt); fprintf(opt_file, "InfoDir : %s\n", info_file); fprintf(opt_file, "AutoIndent : %d\n", cn->autoindent); fprintf(opt_file, "PrintCmd : %s\n", cn->print_cmd); return 0; } int WpeReadColor(ECNT *cn, char *section, char *option, char *value) { FARBE *fb = NULL; COLOR *c = NULL; int convert = 0; /* Convert old X11 colors to new colors */ if (WpeStrccmp("Term", section + strlen(OPT_SECTION_COLOR) + 1) == 0) { if (!u_fb) { u_fb = WpeMalloc(sizeof(FARBE)); FARBE_Init(u_fb); } fb = u_fb; } if (WpeStrccmp("X11", section + strlen(OPT_SECTION_COLOR) + 1) == 0) { if (!x_fb) { x_fb = WpeMalloc(sizeof(FARBE)); FARBE_Init(x_fb); } fb = x_fb; if ((cn->major <= 1) && (cn->minor <= 5) && (cn->patch <= 27)) convert = 1; } if (WpeStrccmp("er", option) == 0) c = &fb->er; else if (WpeStrccmp("es", option) == 0) c = &fb->es; else if (WpeStrccmp("et", option) == 0) c = &fb->et; else if (WpeStrccmp("ez", option) == 0) c = &fb->ez; else if (WpeStrccmp("ek", option) == 0) c = &fb->ek; else if (WpeStrccmp("em", option) == 0) c = &fb->em; else if (WpeStrccmp("hh", option) == 0) c = &fb->hh; else if (WpeStrccmp("hb", option) == 0) c = &fb->hb; else if (WpeStrccmp("hm", option) == 0) c = &fb->hm; else if (WpeStrccmp("db", option) == 0) c = &fb->db; else if (WpeStrccmp("dy", option) == 0) c = &fb->dy; else if (WpeStrccmp("mr", option) == 0) c = &fb->mr; else if (WpeStrccmp("ms", option) == 0) c = &fb->ms; else if (WpeStrccmp("mt", option) == 0) c = &fb->mt; else if (WpeStrccmp("mz", option) == 0) c = &fb->mz; else if (WpeStrccmp("df", option) == 0) c = &fb->df; else if (WpeStrccmp("nr", option) == 0) c = &fb->nr; else if (WpeStrccmp("ne", option) == 0) c = &fb->ne; else if (WpeStrccmp("nt", option) == 0) c = &fb->nt; else if (WpeStrccmp("nsnt", option) == 0) c = &fb->nsnt; else if (WpeStrccmp("fr", option) == 0) c = &fb->fr; else if (WpeStrccmp("fa", option) == 0) c = &fb->fa; else if (WpeStrccmp("ft", option) == 0) c = &fb->ft; else if (WpeStrccmp("fz", option) == 0) c = &fb->fz; else if (WpeStrccmp("frft", option) == 0) c = &fb->frft; else if (WpeStrccmp("fs", option) == 0) c = &fb->fs; else if (WpeStrccmp("nsft", option) == 0) c = &fb->nsft; else if (WpeStrccmp("fsm", option) == 0) c = &fb->fsm; else if (WpeStrccmp("nz", option) == 0) c = &fb->nz; else if (WpeStrccmp("ns", option) == 0) c = &fb->ns; else if (WpeStrccmp("nm", option) == 0) c = &fb->nm; else if (WpeStrccmp("of", option) == 0) c = &fb->of; else if (WpeStrccmp("ct", option) == 0) c = &fb->ct; else if (WpeStrccmp("cr", option) == 0) c = &fb->cr; else if (WpeStrccmp("ck", option) == 0) c = &fb->ck; else if (WpeStrccmp("cp", option) == 0) c = &fb->cp; else if (WpeStrccmp("cc", option) == 0) c = &fb->cc; else if (WpeStrccmp("dc", option) == 0) fb->dc = atoi(value); else if (WpeStrccmp("ws", option) == 0) fb->ws = atoi(value); if (c != NULL) { sscanf(value, "%d%d", &c->f, &c->b); if (convert) { switch (c->f) { case 1: c->f = 4; break; case 3: c->f = 6; break; case 4: c->f = 1; break; case 6: c->f = 3; break; case 9: c->f = 12; break; case 11: c->f = 14; break; case 12: c->f = 9; break; case 14: c->f = 11; break; default: break; } switch (c->b) { case 1: c->b = 4; break; case 3: c->b = 6; break; case 4: c->b = 1; break; case 6: c->b = 3; break; case 9: c->b = 12; break; case 11: c->b = 14; break; case 12: c->b = 9; break; case 14: c->b = 11; break; default: break; } } *c = e_s_clr(c->f, c->b); } return 0; } int WpeWriteColor(ECNT *cn, char *section, FILE *opt_file) { FARBE *fb; if (WpeStrccmp("Term", section + strlen(OPT_SECTION_COLOR) + 1) == 0) fb = u_fb; if (WpeStrccmp("X11", section + strlen(OPT_SECTION_COLOR) + 1) == 0) fb = x_fb; fprintf(opt_file, "er : %d %d\n", fb->er.f, fb->er.b); fprintf(opt_file, "es : %d %d\n", fb->es.f, fb->es.b); fprintf(opt_file, "et : %d %d\n", fb->et.f, fb->et.b); fprintf(opt_file, "ez : %d %d\n", fb->ez.f, fb->ez.b); fprintf(opt_file, "ek : %d %d\n", fb->ek.f, fb->ek.b); fprintf(opt_file, "em : %d %d\n", fb->em.f, fb->em.b); fprintf(opt_file, "hh : %d %d\n", fb->hh.f, fb->hh.b); fprintf(opt_file, "hb : %d %d\n", fb->hb.f, fb->hb.b); fprintf(opt_file, "hm : %d %d\n", fb->hm.f, fb->hm.b); fprintf(opt_file, "db : %d %d\n", fb->db.f, fb->db.b); fprintf(opt_file, "dy : %d %d\n", fb->dy.f, fb->dy.b); fprintf(opt_file, "mr : %d %d\n", fb->mr.f, fb->mr.b); fprintf(opt_file, "ms : %d %d\n", fb->ms.f, fb->ms.b); fprintf(opt_file, "mt : %d %d\n", fb->mt.f, fb->mt.b); fprintf(opt_file, "mz : %d %d\n", fb->mz.f, fb->mz.b); fprintf(opt_file, "df : %d %d\n", fb->df.f, fb->df.b); fprintf(opt_file, "nr : %d %d\n", fb->nr.f, fb->nr.b); fprintf(opt_file, "ne : %d %d\n", fb->ne.f, fb->ne.b); fprintf(opt_file, "nt : %d %d\n", fb->nt.f, fb->nt.b); fprintf(opt_file, "nsnt : %d %d\n", fb->nsnt.f, fb->nsnt.b); fprintf(opt_file, "fr : %d %d\n", fb->fr.f, fb->fr.b); fprintf(opt_file, "fa : %d %d\n", fb->fa.f, fb->fa.b); fprintf(opt_file, "ft : %d %d\n", fb->ft.f, fb->ft.b); fprintf(opt_file, "fz : %d %d\n", fb->fz.f, fb->fz.b); fprintf(opt_file, "frft : %d %d\n", fb->frft.f, fb->frft.b); fprintf(opt_file, "fs : %d %d\n", fb->fs.f, fb->fs.b); fprintf(opt_file, "nsft : %d %d\n", fb->nsft.f, fb->nsft.b); fprintf(opt_file, "fsm : %d %d\n", fb->fsm.f, fb->fsm.b); fprintf(opt_file, "nz : %d %d\n", fb->nz.f, fb->nz.b); fprintf(opt_file, "ns : %d %d\n", fb->ns.f, fb->ns.b); fprintf(opt_file, "nm : %d %d\n", fb->nm.f, fb->nm.b); fprintf(opt_file, "of : %d %d\n", fb->of.f, fb->of.b); fprintf(opt_file, "ct : %d %d\n", fb->ct.f, fb->ct.b); fprintf(opt_file, "cr : %d %d\n", fb->cr.f, fb->cr.b); fprintf(opt_file, "ck : %d %d\n", fb->ck.f, fb->ck.b); fprintf(opt_file, "cp : %d %d\n", fb->cp.f, fb->cp.b); fprintf(opt_file, "cc : %d %d\n", fb->cc.f, fb->cc.b); fprintf(opt_file, "dc : %d\n", fb->dc); fprintf(opt_file, "ws : %d\n", fb->ws); return 0; } int WpeReadProgramming(ECNT *cn, char *section, char *option, char *value) { if (WpeStrccmp("Arguments", option) == 0) e_prog.arguments = WpeStrdup(value); else if (WpeStrccmp("Project", option) == 0) e_prog.project = WpeStrdup(value); else if (WpeStrccmp("Exedir", option) == 0) e_prog.exedir = WpeStrdup(value); else if (WpeStrccmp("IncludePath", option) == 0) e_prog.sys_include = WpeStrdup(value); else if (WpeStrccmp("Debugger", option) == 0) e_deb_type = atoi(value); return 0; } int WpeWriteProgramming(ECNT *cn, char *section, FILE *opt_file) { fprintf(opt_file, "Arguments : %s\n", e_prog.arguments); fprintf(opt_file, "Project : %s\n", e_prog.project); fprintf(opt_file, "Exedir : %s\n", e_prog.exedir); fprintf(opt_file, "IncludePath : %s\n", e_prog.sys_include); fprintf(opt_file, "Debugger : %d\n", e_deb_type); return 0; } int WpeReadLanguage(ECNT *cn, char *section, char *option, char *value) { int i, j; char *strtmp; for (i = 0; (i < e_prog.num) && (WpeStrccmp(e_prog.comp[i]->language, section + strlen(OPT_SECTION_LANGUAGE) + 1) != 0); i++) ; if (i == e_prog.num) { e_prog.num++; e_prog.comp = REALLOC(e_prog.comp, e_prog.num * sizeof(struct e_s_prog *)); e_prog.comp[i] = MALLOC(sizeof(struct e_s_prog)); e_prog.comp[i]->language = WpeStrdup(section + strlen(OPT_SECTION_LANGUAGE) + 1); e_prog.comp[i]->compiler = WpeStrdup(""); e_prog.comp[i]->comp_str = WpeStrdup(""); e_prog.comp[i]->libraries = WpeStrdup(""); e_prog.comp[i]->exe_name = WpeStrdup(""); e_prog.comp[i]->filepostfix = (char **)WpeExpArrayCreate(0, sizeof(char *), 1); e_prog.comp[i]->intstr = WpeStrdup(""); e_prog.comp[i]->key = '\0'; e_prog.comp[i]->comp_sw = 0; e_prog.comp[i]->x = 0; } if (WpeStrccmp("Compiler", option) == 0) { if (e_prog.comp[i]->compiler) FREE(e_prog.comp[i]->compiler); e_prog.comp[i]->compiler = WpeStrdup(value); } else if (WpeStrccmp("CompilerOptions", option) == 0) { if (e_prog.comp[i]->comp_str) FREE(e_prog.comp[i]->comp_str); e_prog.comp[i]->comp_str = WpeStrdup(value); } else if (WpeStrccmp("Libraries", option) == 0) { if (e_prog.comp[i]->libraries) FREE(e_prog.comp[i]->libraries); e_prog.comp[i]->libraries = WpeStrdup(value); } else if (WpeStrccmp("Executable", option) == 0) { if (e_prog.comp[i]->exe_name) FREE(e_prog.comp[i]->exe_name); e_prog.comp[i]->exe_name = WpeStrdup(value); } else if (WpeStrccmp("FileExtension", option) == 0) { for (j = WpeExpArrayGetSize(e_prog.comp[i]->filepostfix); j; j--) if (strcmp(e_prog.comp[i]->filepostfix[j - 1], value) == 0) break; if (j == 0) { strtmp = WpeStrdup(value); WpeExpArrayAdd((void **)&e_prog.comp[i]->filepostfix, &strtmp); } } else if (WpeStrccmp("MessageString", option) == 0) { if (e_prog.comp[i]->intstr) FREE(e_prog.comp[i]->intstr); e_prog.comp[i]->intstr = WpeValueToString(value); } else if (WpeStrccmp("Key", option) == 0) e_prog.comp[i]->key = value[0]; else if (WpeStrccmp("CompilerSwitch", option) == 0) e_prog.comp[i]->comp_sw = atoi(value); else if (WpeStrccmp("X", option) == 0) e_prog.comp[i]->x = atoi(value); return 0; } int WpeWriteLanguage(ECNT *cn, char *section, FILE *opt_file) { int i, j; char *str_tmp; for (i = 0; (i < e_prog.num) && (WpeStrccmp(e_prog.comp[i]->language, section + strlen(OPT_SECTION_LANGUAGE) + 1) != 0); i++) ; if (i < e_prog.num) { fprintf(opt_file, "Compiler : %s\n", e_prog.comp[i]->compiler); fprintf(opt_file, "CompilerOptions : %s\n", e_prog.comp[i]->comp_str); fprintf(opt_file, "Libraries : %s\n", e_prog.comp[i]->libraries); fprintf(opt_file, "Executable : %s\n", e_prog.comp[i]->exe_name); for (j = WpeExpArrayGetSize(e_prog.comp[i]->filepostfix); j; j--) fprintf(opt_file, "FileExtension : %s\n", e_prog.comp[i]->filepostfix[j - 1]); str_tmp = WpeStringToValue(e_prog.comp[i]->intstr); fprintf(opt_file, "MessageString : %s\n", str_tmp); WpeFree(str_tmp); fprintf(opt_file, "CompilerSwitch : %d\n", e_prog.comp[i]->comp_sw); fprintf(opt_file, "Key : %c\n", e_prog.comp[i]->key); fprintf(opt_file, "X : %d\n", e_prog.comp[i]->x); } return 0; } /* save options */ int e_save_opt(FENSTER *f) { ECNT *cn = f->ed; FILE *fp; int i; char *str_line; str_line = MALLOC((strlen(cn->optfile)+1)*sizeof(char)); strcpy(str_line, cn->optfile); for (i = strlen(str_line); i > 0 && str_line[i] != DIRC; i--); str_line[i] = '\0'; if (access(str_line, 0)) mkdir(str_line, 0700); FREE(str_line); fp = fopen(cn->optfile, "w"); if (fp == NULL) { e_error(e_msg[ERR_OPEN_OPF], 0, f->fb); return(-1); } str_line = OPT_SECTION_GENERAL; fprintf(fp, "[%s]\n", str_line); WpeWriteGeneral(cn, str_line, fp); str_line = MALLOC(strlen(OPT_SECTION_COLOR) + 10); strcpy(str_line, OPT_SECTION_COLOR); if (u_fb) { strcat(str_line, "/Term"); fprintf(fp, "[%s]\n", str_line); WpeWriteColor(cn, str_line, fp); } if (x_fb) { strcpy(str_line + strlen(OPT_SECTION_COLOR), "/X11"); fprintf(fp, "[%s]\n", str_line); WpeWriteColor(cn, str_line, fp); } FREE(str_line); str_line = OPT_SECTION_PROGRAMMING; fprintf(fp, "[%s]\n", str_line); WpeWriteProgramming(cn, str_line, fp); str_line = MALLOC(strlen(OPT_SECTION_LANGUAGE) + 2); strcpy(str_line, OPT_SECTION_LANGUAGE); strcat(str_line, "/"); for (i = 0; i < e_prog.num; i++) { str_line = REALLOC(str_line, strlen(OPT_SECTION_LANGUAGE) + strlen(e_prog.comp[i]->language) + 2); strcpy(str_line + strlen(OPT_SECTION_LANGUAGE) + 1, e_prog.comp[i]->language); fprintf(fp, "[%s]\n", str_line); WpeWriteLanguage(cn, str_line, fp); } FREE(str_line); fclose(fp); return 0; } int e_opt_read(ECNT *cn) { FILE *fp; char *str_line; char *section; char *option; char *value; char *str_tmp; int sz; int i; fp = fopen(cn->optfile, "r"); if (fp == NULL) { char *file = e_mkfilename(LIBRARY_DIR, OPTION_FILE); fp = fopen(file, "r"); FREE(file); } if (fp == NULL) return(0); sz = 256; str_line = (char *)WpeMalloc(256 * sizeof(char)); section = NULL; while (!feof(fp)) { if (sz != 256) { sz = 256; str_line = (char *)WpeRealloc(str_line, sz * sizeof(char)); } str_line[0] = 0; fgets(str_line, sz, fp); while ((!feof(fp)) && ((str_line[0] == 0) || (str_line[strlen(str_line) - 1] != '\n'))) { sz += 255; str_line = (char *)WpeRealloc(str_line, sz * sizeof(char)); fgets(str_line + sz - 256, 256, fp); } i = strlen(str_line); if (i && (str_line[i - 1] == '\n')) str_line[i - 1] = 0; for (option = str_line; isspace(*option); option++) ; if ((*option) && (*option != '#')) { if (*option == '[') { if (section) WpeFree(section); for (value = option + 1; (*value) && (*value != ']'); value++) ; if (*value != ']') { WpeFree(str_line); return ERR_READ_OPF; } *value = 0; section = WpeStrdup(option + 1); } else { value = strchr(option, ':'); if ((value == NULL) || (value == option)) { WpeFree(str_line); return ERR_READ_OPF; } for (str_tmp = value - 1; isspace(*str_tmp); str_tmp--) ; for (value++; isspace(*value); value++) ; str_tmp++; *str_tmp = 0; for (i = 0; (i < OPTION_SECTIONS) && (strncmp(WpeSectionRead[i].section, section, strlen(WpeSectionRead[i].section)) != 0); i++) ; if (i < OPTION_SECTIONS) (*WpeSectionRead[i].function)(cn, section, option, value); else return ERR_READ_OPF; } } } fclose(fp); return 0; } /* window for entering a text line */ int e_add_arguments(char *str, char *head, FENSTER *f, int n, int sw, struct dirfile **df) { int ret; char *tmp = MALLOC((strlen(head)+2) * sizeof(char)); W_OPTSTR *o = e_init_opt_kst(f); if (!o || !tmp) return(-1); o->xa = 20; o->ya = 4; o->xe = 57; o->ye = 11; o->bgsw = 0; o->name = head; o->crsw = AltO; sprintf(tmp, "%s:", head); e_add_wrstr(4, 2, 4, 3, 30, 128, n, sw, tmp, str, df, o); e_add_bttstr(7, 5, 1, AltO, " Ok ", NULL, o); e_add_bttstr(24, 5, -1, WPE_ESC, "Cancel", NULL, o); FREE(tmp); ret = e_opt_kst(o); if (ret != WPE_ESC) strcpy(str, o->wstr[0]->txt); freeostr(o); return(ret == WPE_ESC ? 0 : 1); } W_O_TXTSTR **e_add_txtstr(int x, int y, char *txt, W_OPTSTR *o) { if (o->tn == 0) o->tstr = MALLOC(1); (o->tn)++; if (!(o->tstr = REALLOC(o->tstr, o->tn * sizeof(W_O_TXTSTR *)))) return(NULL); if (!(o->tstr[o->tn-1] = MALLOC(sizeof(W_O_TXTSTR)))) return(NULL); if (!(o->tstr[o->tn-1]->txt = MALLOC((strlen(txt)+1) * sizeof(char)))) return(NULL); o->tstr[o->tn-1]->x = x; o->tstr[o->tn-1]->y = y; strcpy(o->tstr[o->tn-1]->txt, txt); return(o->tstr); } W_O_WRSTR **e_add_wrstr(int xt, int yt, int xw, int yw, int nw, int wmx, int nc, int sw, char *header, char *txt, struct dirfile **df, W_OPTSTR *o) { if (o->wn == 0) o->wstr = MALLOC(1); (o->wn)++; if (!(o->wstr = REALLOC(o->wstr, o->wn * sizeof(W_O_WRSTR *)))) return(NULL); if (!(o->wstr[o->wn-1] = MALLOC(sizeof(W_O_WRSTR)))) return(NULL); if (!(o->wstr[o->wn-1]->txt = MALLOC((wmx+1) * sizeof(char)))) return(NULL); if (!(o->wstr[o->wn-1]->header = MALLOC((strlen(header)+1) * sizeof(char)))) return(NULL); o->wstr[o->wn-1]->xt = xt; o->wstr[o->wn-1]->yt = yt; o->wstr[o->wn-1]->xw = xw; o->wstr[o->wn-1]->yw = yw; o->wstr[o->wn-1]->nw = nw; o->wstr[o->wn-1]->wmx = wmx; o->wstr[o->wn-1]->nc = nc; o->wstr[o->wn-1]->sw = sw; o->wstr[o->wn-1]->df = df; strcpy(o->wstr[o->wn-1]->header, header); strcpy(o->wstr[o->wn-1]->txt, txt); return(o->wstr); } W_O_NUMSTR **e_add_numstr(int xt, int yt, int xw, int yw, int nw, int wmx, int nc, int sw, char *header, int num, W_OPTSTR *o) { if (o->nn == 0) o->nstr = MALLOC(1); (o->nn)++; if (!(o->nstr = REALLOC(o->nstr, o->nn * sizeof(W_O_NUMSTR *)))) return(NULL); if (!(o->nstr[o->nn-1] = MALLOC(sizeof(W_O_NUMSTR)))) return(NULL); if (!(o->nstr[o->nn-1]->header = MALLOC((strlen(header)+1) * sizeof(char)))) return(NULL); o->nstr[o->nn-1]->xt = xt; o->nstr[o->nn-1]->yt = yt; o->nstr[o->nn-1]->xw = xw; o->nstr[o->nn-1]->yw = yw; o->nstr[o->nn-1]->nw = nw; o->nstr[o->nn-1]->wmx = wmx; o->nstr[o->nn-1]->nc = nc; o->nstr[o->nn-1]->sw = sw; o->nstr[o->nn-1]->num = num; strcpy(o->nstr[o->nn-1]->header, header); return(o->nstr); } W_O_SSWSTR **e_add_sswstr(int x, int y, int nc, int sw, int num, char *header, W_OPTSTR *o) { if (o->sn == 0) o->sstr = MALLOC(1); (o->sn)++; if (!(o->sstr = REALLOC(o->sstr, o->sn * sizeof(W_O_SSWSTR *)))) return(NULL); if (!(o->sstr[o->sn-1] = MALLOC(sizeof(W_O_SSWSTR)))) return(NULL); if (!(o->sstr[o->sn-1]->header = MALLOC((strlen(header)+1) * sizeof(char)))) return(NULL); o->sstr[o->sn-1]->x = x; o->sstr[o->sn-1]->y = y; o->sstr[o->sn-1]->nc = nc; o->sstr[o->sn-1]->sw = sw; o->sstr[o->sn-1]->num = num; strcpy(o->sstr[o->sn-1]->header, header); return(o->sstr); } W_O_SPSWSTR **e_add_spswstr(int n, int x, int y, int nc, int sw, char *header, W_OPTSTR *o) { if (n >= o->pn) return(NULL); if (n < 0) n = 0; if (o->pstr[n]->np == 0) o->pstr[n]->ps = MALLOC(1); (o->pstr[n]->np)++; if (!(o->pstr[n]->ps = REALLOC(o->pstr[n]->ps, o->pstr[n]->np * sizeof(W_O_SPSWSTR *)))) return(NULL); if (!(o->pstr[n]->ps[o->pstr[n]->np-1] = MALLOC(sizeof(W_O_SPSWSTR)))) return(NULL); if (!(o->pstr[n]->ps[o->pstr[n]->np-1]->header = MALLOC((strlen(header)+1) * sizeof(char)))) return(NULL); o->pstr[n]->ps[o->pstr[n]->np-1]->x = x; o->pstr[n]->ps[o->pstr[n]->np-1]->y = y; o->pstr[n]->ps[o->pstr[n]->np-1]->nc = nc; o->pstr[n]->ps[o->pstr[n]->np-1]->sw = sw; strcpy(o->pstr[n]->ps[o->pstr[n]->np-1]->header, header); return(o->pstr[n]->ps); } W_O_PSWSTR **e_add_pswstr(int n, int x, int y, int nc, int sw, int num, char *header, W_OPTSTR *o) { if (o->pn == 0) o->pstr = MALLOC(1); if (n >= o->pn) { n = o->pn; (o->pn)++; if (!(o->pstr = REALLOC(o->pstr, o->pn * sizeof(W_O_PSWSTR *)))) return(NULL); if (!(o->pstr[o->pn-1] = MALLOC(sizeof(W_O_PSWSTR)))) return(NULL); o->pstr[o->pn-1]->np = 0; } if (!e_add_spswstr(n, x, y, nc, sw, header, o)) return(NULL); o->pstr[o->pn-1]->num = num; return(o->pstr); } W_O_BTTSTR **e_add_bttstr(int x, int y, int nc, int sw, char *header, int (*fkt)(FENSTER *f), W_OPTSTR *o) { if (o->bn == 0) o->bstr = MALLOC(1); (o->bn)++; if (!(o->bstr = REALLOC(o->bstr, o->bn * sizeof(W_O_BTTSTR *)))) return(NULL); if (!(o->bstr[o->bn-1] = MALLOC(sizeof(W_O_BTTSTR)))) return(NULL); if (!(o->bstr[o->bn-1]->header = MALLOC((strlen(header)+1) * sizeof(char)))) return(NULL); o->bstr[o->bn-1]->x = x; o->bstr[o->bn-1]->y = y; o->bstr[o->bn-1]->nc = nc; o->bstr[o->bn-1]->sw = sw; o->bstr[o->bn-1]->fkt = fkt; strcpy(o->bstr[o->bn-1]->header, header); return(o->bstr); } int freeostr(W_OPTSTR *o) { int i, j; if (!o) return(0); for (i = 0; i < o->tn; i++) { FREE(o->tstr[i]->txt); FREE(o->tstr[i]); } if (o->tn) FREE(o->tstr); for (i = 0; i < o->wn; i++) { FREE(o->wstr[i]->txt); FREE(o->wstr[i]->header); FREE(o->wstr[i]); } if (o->wn) FREE(o->wstr); for (i = 0; i < o->nn; i++) { FREE(o->nstr[i]->header); FREE(o->nstr[i]); } if (o->nn) FREE(o->nstr); for (i = 0; i < o->pn; i++) { for (j = 0; j < o->pstr[i]->np; j++) { FREE(o->pstr[i]->ps[j]->header); FREE(o->pstr[i]->ps[j]); } if (o->pstr[i]->np) FREE(o->pstr[i]->ps); FREE(o->pstr[i]); } if (o->pn) FREE(o->pstr); for (i = 0; i < o->bn; i++) { FREE(o->bstr[i]->header); FREE(o->bstr[i]); } if (o->bn) FREE(o->bstr); FREE(o); return(0); } W_OPTSTR *e_init_opt_kst(FENSTER *f) { W_OPTSTR *o = MALLOC(sizeof(W_OPTSTR)); if (!o) return(NULL); o->frt = f->fb->nr.fb; o->frs = f->fb->ne.fb; o->ftt = f->fb->nt.fb; o->fts = f->fb->nsnt.fb; o->fst = f->fb->fs.fb; o->fss = f->fb->nsft.fb; o->fsa = f->fb->fsm.fb; o->fwt = f->fb->fr.fb; o->fws = f->fb->fa.fb; o->fbt = f->fb->nz.fb; o->fbs = f->fb->ns.fb; o->fbz = f->fb->nm.fb; o->tn = o->sn = o->pn = o->bn = o->wn = o->nn = 0; o->f = f; o->pic = NULL; return(o); } int e_opt_move(W_OPTSTR *o) { int xa = o->xa, ya = o->ya, xe = o->xe, ye = o->ye; int c = 0; PIC *pic; e_std_rahmen(o->xa, o->ya, o->xe, o->ye, o->name, 0, o->frt, o->frs); #ifndef NEWSTYLE if (!WpeIsXwin()) pic = e_open_view(o->xa, o->ya, o->xe, o->ye, 0, 2); else { pic = e_open_view(o->xa, o->ya, o->xe-2, o->ye-1, 0, 2); e_close_view(pic, 2); } #else pic = e_open_view(o->xa, o->ya, o->xe, o->ye, 0, 2); #endif while ((c = e_getch()) != WPE_ESC && c != WPE_CR) { switch(c) { case CLE: if (xa > 0) { xa--; xe--; } break; case CRI: if (xe < MAXSCOL-1) { xa++; xe++; } break; case CUP: if (ya > 1) { ya--; ye--; } break; case CDO: if (ye < MAXSLNS-2) { ya++; ye++; } break; } if ( xa != o->xa || ya != o->ya || xe != o->xe || ye != o->ye) { o->xa = xa; o->ya = ya; o->xe = xe; o->ye = ye; o->pic = e_change_pic(o->xa, o->ya, o->xe, o->ye, o->pic, 1, o->frt); if (o->pic == NULL) e_error(e_msg[ERR_LOWMEM], 1, o->f->fb); pic->a.x = o->xa; pic->a.y = o->ya; pic->e.x = o->xe; pic->e.y = o->ye; e_close_view(pic, 2); } } pic->a.x = o->xa; pic->a.y = o->ya; pic->e.x = o->xe; pic->e.y = o->ye; e_close_view(pic, 1); e_std_rahmen(o->xa, o->ya, o->xe, o->ye, o->name, 1, o->frt, o->frs); return(c); } int e_get_sw_cmp(int xin, int yin, int x, int y, int xmin, int ymin, int c) { return ( ( c == 0 && yin == y && (xin-1 <= x && xin+xmin >= x)) || ((c == CDO || c == BDO || c == WPE_TAB) && yin > y && (yin < ymin || (yin == ymin && xin <= x && xin > xmin)) ) || ((c == CUP || c == BUP || c == WPE_BTAB) && yin < y && (yin > ymin || (yin == ymin && xin <=x && xin > xmin)) ) || ((c == CLE || c == CCLE) && yin == y && xin < x && xin > xmin) || ((c == CRI || c == CCRI) && yin == y && xin > x && xin < xmin) ); } int e_get_opt_sw(int c, int x, int y, W_OPTSTR *o) { int i, j, xmin, ymin, ret = 0; if( c != 0 && c != CUP && c != CDO && c != CLE && c != CRI && c != BUP && c != BDO && c != CCLE && c != CCRI && c != WPE_TAB && c != WPE_BTAB ) return(c); xmin = (c == CRI || c == CCRI) ? o->xe : o->xa; ymin = (c == CUP || c == BUP || c == WPE_BTAB) ? o->ya : o->ye; x -= o->xa; xmin -= o->xa; y -= o->ya; ymin -= o->ya; for(i = 0; i < o->wn; i++) { if(e_get_sw_cmp(o->wstr[i]->xw, o->wstr[i]->yw, x, y, c ? xmin : o->wstr[i]->nw, ymin, c)) { xmin = o->wstr[i]->xw; ymin = o->wstr[i]->yw; ret = o->wstr[i]->sw; } } for(i = 0; i < o->nn; i++) { if(e_get_sw_cmp(o->nstr[i]->xw, o->nstr[i]->yw, x, y, c ? xmin : o->nstr[i]->nw, ymin, c)) { xmin = o->nstr[i]->xw; ymin = o->nstr[i]->yw; ret = o->nstr[i]->sw; } } for(i = 0; i < o->sn; i++) { if(e_get_sw_cmp(o->sstr[i]->x, o->sstr[i]->y, x, y, c ? xmin : 2, ymin, c)) { xmin = o->sstr[i]->x; ymin = o->sstr[i]->y; ret = o->sstr[i]->sw; } } for(i = 0; i < o->pn; i++) for(j = 0; j < o->pstr[i]->np; j++) { if(e_get_sw_cmp(o->pstr[i]->ps[j]->x, o->pstr[i]->ps[j]->y, x, y, c ? xmin : 2, ymin, c)) { xmin = o->pstr[i]->ps[j]->x; ymin = o->pstr[i]->ps[j]->y; ret = o->pstr[i]->ps[j]->sw; } } for(i = 0; i < o->bn; i++) { if(e_get_sw_cmp(o->bstr[i]->x, o->bstr[i]->y, x, y, c ? xmin : strlen(o->bstr[i]->header), ymin, c)) { xmin = o->bstr[i]->x; ymin = o->bstr[i]->y; ret = o->bstr[i]->sw; } } return(!ret ? c : ret); } int e_opt_kst(W_OPTSTR *o) { int ret = 0, csv, sw = 1, i, j, num, cold, c = o->bgsw; char *tmp; fk_cursor(0); o->pic = e_std_kst(o->xa, o->ya, o->xe, o->ye, o->name, 1, o->frt, o->ftt, o->frs); if(o->pic == NULL) { e_error(e_msg[ERR_LOWMEM], 0, o->f->fb); return(-1); } if(!c) c = e_get_opt_sw(CDO, 0, 0, o); for(i = 0; i < o->tn; i++) e_pr_str(o->xa+o->tstr[i]->x, o->ya+o->tstr[i]->y, o->tstr[i]->txt, o->ftt, -1, 0, 0, 0); for(i = 0; i < o->wn; i++) { e_pr_str(o->xa+o->wstr[i]->xt, o->ya+o->wstr[i]->yt, o->wstr[i]->header, o->ftt, o->wstr[i]->nc, 1, o->fts, 0); if(!o->wstr[i]->df) e_schr_nchar(o->wstr[i]->txt, o->xa+o->wstr[i]->xw, o->ya+o->wstr[i]->yw, 0, o->wstr[i]->nw, o->fwt); else e_schr_nchar_wsv(o->wstr[i]->txt, o->xa+o->wstr[i]->xw, o->ya+o->wstr[i]->yw, 0, o->wstr[i]->nw, o->fwt, o->fws); } for(i = 0; i < o->nn; i++) { e_pr_str(o->xa+o->nstr[i]->xt, o->ya+o->nstr[i]->yt, o->nstr[i]->header, o->ftt, o->nstr[i]->nc, 1, o->fts, 0); e_schr_nzif(o->nstr[i]->num, o->xa+o->nstr[i]->xw, o->ya+o->nstr[i]->yw, o->nstr[i]->nw, o->fwt); } for(i = 0; i < o->sn; i++) { e_pr_str(o->xa+o->sstr[i]->x+4, o->ya+o->sstr[i]->y, o->sstr[i]->header, o->fst, o->sstr[i]->nc, 1, o->fss, 0); #ifdef NEWSTYLE if (WpeIsXwin()) e_pr_str(o->xa+o->sstr[i]->x, o->ya+o->sstr[i]->y, " ", o->fst, -1, 1, 0, 0); else #endif e_pr_str(o->xa+o->sstr[i]->x, o->ya+o->sstr[i]->y, "[ ]", o->fst, -1, 1, 0, 0); } for(i = 0; i < o->pn; i++) { for(j = 0; j < o->pstr[i]->np; j++) { e_pr_str(o->xa+o->pstr[i]->ps[j]->x, o->ya+o->pstr[i]->ps[j]->y, "[ ] ", o->fst, -1, 1, 0, 0); e_pr_str(o->xa+o->pstr[i]->ps[j]->x+4, o->ya+o->pstr[i]->ps[j]->y, o->pstr[i]->ps[j]->header, o->fst, o->pstr[i]->ps[j]->nc, 1, o->fss, 0); #ifdef NEWSTYLE if (WpeIsXwin()) e_pr_str(o->xa+o->pstr[i]->ps[j]->x, o->ya+o->pstr[i]->ps[j]->y, " ", o->fst, -1, 1, 0, 0); else #endif e_pr_str(o->xa+o->pstr[i]->ps[j]->x, o->ya+o->pstr[i]->ps[j]->y, "[ ]", o->fst, -1, 1, 0, 0); } } for(i = 0; i < o->bn; i++) { e_pr_str(o->xa+o->bstr[i]->x, o->ya+o->bstr[i]->y, o->bstr[i]->header, o->fbt, o->bstr[i]->nc, -1, o->fbs, o->ftt); } cold = c; while (c != WPE_ESC || sw) { #ifdef NEWSTYLE if (WpeIsXwin()) { for(i = 0; i < o->sn; i++) { if(o->sstr[i]->num) e_make_xrect_abs(o->xa+o->sstr[i]->x, o->ya+o->sstr[i]->y, o->xa+o->sstr[i]->x + 2, o->ya+o->sstr[i]->y, 1); else e_make_xrect_abs(o->xa+o->sstr[i]->x, o->ya+o->sstr[i]->y, o->xa+o->sstr[i]->x + 2, o->ya+o->sstr[i]->y, 0); } for(i = 0; i < o->pn; i++) for(j = 0; j < o->pstr[i]->np; j++) { if(o->pstr[i]->num == j) e_make_xrect_abs(o->xa+o->pstr[i]->ps[j]->x, o->ya+o->pstr[i]->ps[j]->y, o->xa+o->pstr[i]->ps[j]->x + 2, o->ya+o->pstr[i]->ps[j]->y, 1); else e_make_xrect_abs(o->xa+o->pstr[i]->ps[j]->x, o->ya+o->pstr[i]->ps[j]->y, o->xa+o->pstr[i]->ps[j]->x+2, o->ya+o->pstr[i]->ps[j]->y, 0); } } else #endif { for(i = 0; i < o->sn; i++) { if(o->sstr[i]->num) e_pr_char(o->xa+o->sstr[i]->x+1, o->ya+o->sstr[i]->y, 'X', o->fst); else e_pr_char(o->xa+o->sstr[i]->x+1, o->ya+o->sstr[i]->y, ' ', o->fst); } for(i = 0; i < o->pn; i++) for(j = 0; j < o->pstr[i]->np; j++) { if(o->pstr[i]->num == j) e_pr_char(o->xa+o->pstr[i]->ps[j]->x+1, o->ya+o->pstr[i]->ps[j]->y, SWSYM, o->fst); else e_pr_char(o->xa+o->pstr[i]->ps[j]->x+1, o->ya+o->pstr[i]->ps[j]->y, ' ', o->fst); } } if((c == AF2 && !(o->f->ed->edopt & ED_CUA_STYLE)) || (o->f->ed->edopt & ED_CUA_STYLE && c == CtrlL)) { e_opt_move(o); c = cold; continue; } for(i = 0; i < o->wn; i++) if(o->wstr[i]->sw == c || (o->wstr[i]->nc >= 0 && toupper(c) == o->wstr[i]->header[o->wstr[i]->nc])) { cold = c; tmp = MALLOC((o->wstr[i]->wmx + 1) * sizeof(char)); strcpy(tmp, o->wstr[i]->txt); #if MOUSE if(!o->wstr[i]->df && (c = e_schreib_leiste(tmp, o->xa+o->wstr[i]->xw, o->ya+o->wstr[i]->yw, o->wstr[i]->nw, o->wstr[i]->wmx, o->fwt, o->fws)) < 0) c = e_opt_mouse(o); else if(o->wstr[i]->df && (c = e_schr_lst_wsv(tmp, o->xa+o->wstr[i]->xw, o->ya+o->wstr[i]->yw, o->wstr[i]->nw, o->wstr[i]->wmx, o->fwt, o->fws, o->wstr[i]->df, o->f)) < 0) c = e_opt_mouse(o); #else if(!o->wstr[i]->df) c = e_schreib_leiste(tmp, o->xa+o->wstr[i]->xw, o->ya+o->wstr[i]->yw, o->wstr[i]->nw, o->wstr[i]->wmx, o->fwt, o->fws); else if(o->wstr[i]->df) c = e_schr_lst_wsv(tmp, o->xa+o->wstr[i]->xw, o->ya+o->wstr[i]->yw, o->wstr[i]->nw, o->wstr[i]->wmx, o->fwt, o->fws, o->wstr[i]->df, o->f); #endif if(c != WPE_ESC) strcpy(o->wstr[i]->txt, tmp); csv = c; if(!o->wstr[i]->df) e_schr_nchar(o->wstr[i]->txt, o->xa+o->wstr[i]->xw, o->ya+o->wstr[i]->yw, 0, o->wstr[i]->nw, o->fwt); else e_schr_nchar_wsv(o->wstr[i]->txt, o->xa+o->wstr[i]->xw, o->ya+o->wstr[i]->yw, 0, o->wstr[i]->nw, o->fwt, o->fws); if((c = e_get_opt_sw(c, o->xa+o->wstr[i]->xw, o->ya+o->wstr[i]->yw, o)) != csv) sw = 1; else sw = 0; if(c == WPE_CR) c = o->crsw; else if(c == WPE_ESC) ret = WPE_ESC; free(tmp); fk_cursor(0); break; } if(i < o->wn) continue; for(i = 0; i < o->nn; i++) if(o->nstr[i]->sw == c || (o->nstr[i]->nc >= 0 && toupper(c) == o->nstr[i]->header[o->nstr[i]->nc])) { cold = c; num = o->nstr[i]->num; #if MOUSE if((c = e_schreib_zif(&num, o->xa+o->nstr[i]->xw, o->ya+o->nstr[i]->yw, o->nstr[i]->nw, o->fwt, o->fws)) < 0) c = e_opt_mouse(o); #else c = e_schreib_zif(&num, o->xa+o->nstr[i]->xw, o->ya+o->nstr[i]->yw, o->nstr[i]->nw, o->fwt, o->fws); #endif if(c != WPE_ESC) o->nstr[i]->num = num; csv = c; if((c = e_get_opt_sw(c, o->xa+o->nstr[i]->xw, o->ya+o->nstr[i]->yw, o)) != csv) sw = 1; else sw = 0; if(c != cold) e_schr_nzif(o->nstr[i]->num, o->xa+o->nstr[i]->xw, o->ya+o->nstr[i]->yw, o->nstr[i]->nw, o->fwt); if(c == WPE_CR) c = o->crsw; else if(c == WPE_ESC) ret = WPE_ESC; fk_cursor(0); break; } if(i < o->nn) continue; for(i = 0; i < o->sn; i++) if(o->sstr[i]->sw == c || (o->sstr[i]->nc >= 0 && toupper(c) == o->sstr[i]->header[o->sstr[i]->nc])) { if(!sw) { o->sstr[i]->num = !o->sstr[i]->num; sw = 1; c = cold; break; } cold = c; e_pr_str(o->xa+o->sstr[i]->x+4, o->ya+o->sstr[i]->y, o->sstr[i]->header, o->fsa, o->sstr[i]->nc, 1, o->fsa, 0); #if MOUSE if((c = e_getch()) < 0) c = e_opt_mouse(o); #else c = e_getch(); #endif if(c == WPE_CR) { sw = 0; c = cold; break; } else if(c == WPE_ESC) sw = 1; else { csv = c; if((c = e_get_opt_sw(c, o->xa+o->sstr[i]->x, o->ya+o->sstr[i]->y, o)) != csv) sw = 1; else sw = 0; } if(c != cold) e_pr_str(o->xa+o->sstr[i]->x+4, o->ya+o->sstr[i]->y, o->sstr[i]->header, o->fst, o->sstr[i]->nc, 1, o->fss, 0); break; } if(i < o->sn) continue; for(i = 0; i < o->pn; i++) { for(j = 0; j < o->pstr[i]->np; j++) if(o->pstr[i]->ps[j]->sw == c || (o->pstr[i]->ps[j]->nc >= 0 && toupper(c) == o->pstr[i]->ps[j]->header[o->pstr[i]->ps[j]->nc])) { if(!sw) { o->pstr[i]->num = j; sw = 1; c = cold; break; } cold = c; e_pr_str(o->xa+o->pstr[i]->ps[j]->x+4, o->ya+o->pstr[i]->ps[j]->y, o->pstr[i]->ps[j]->header, o->fsa, o->pstr[i]->ps[j]->nc, 1, o->fsa, 0); #if MOUSE if((c = e_getch()) < 0) c = e_opt_mouse(o); #else c = e_getch(); #endif if(c == WPE_CR) { sw = 0; c = cold; break; } else if(c == WPE_ESC) sw = 1; { csv = c; if((c = e_get_opt_sw(c, o->xa+o->pstr[i]->ps[j]->x, o->ya+o->pstr[i]->ps[j]->y, o)) != csv) sw = 1; else sw = 0; } if(c != cold) e_pr_str(o->xa+o->pstr[i]->ps[j]->x+4, o->ya+o->pstr[i]->ps[j]->y, o->pstr[i]->ps[j]->header, o->fst, o->pstr[i]->ps[j]->nc, 1, o->fss, 0); break; } if(j < o->pstr[i]->np) break; } if(i < o->pn) continue; for(i = 0; i < o->bn; i++) if(o->bstr[i]->sw == c || (o->bstr[i]->nc >= 0 && toupper(c) == o->bstr[i]->header[o->bstr[i]->nc])) { e_pr_str(o->xa+o->bstr[i]->x, o->ya+o->bstr[i]->y, o->bstr[i]->header, o->fbz, o->bstr[i]->nc, -1, o->fbz, o->ftt); if(!sw) { if(o->bstr[i]->fkt != NULL) { if((ret = o->bstr[i]->fkt(o->f)) > 0) c = WPE_ESC; else { c = cold; e_pr_str(o->xa+o->bstr[i]->x, o->ya+o->bstr[i]->y, o->bstr[i]->header, o->fbt, o->bstr[i]->nc, -1, o->fbs, o->ftt); } } else { ret = o->bstr[i]->sw; c = WPE_ESC; } break; } cold = c; #if MOUSE if((c = e_getch()) < 0) c = e_opt_mouse(o); #else c = e_getch(); #endif if(c == WPE_CR) { ret = c = o->bstr[i]->sw; sw = 0; break; } else if(c == WPE_ESC) { sw = 0; ret = WPE_ESC; break; } csv = c; if((c = e_get_opt_sw(c, o->xa+o->bstr[i]->x, o->ya+o->bstr[i]->y, o)) != csv) sw = 1; else sw = 0; if(c != cold) e_pr_str(o->xa+o->bstr[i]->x, o->ya+o->bstr[i]->y, o->bstr[i]->header, o->fbt, o->bstr[i]->nc, -1, o->fbs, o->ftt); break; } if(i < o->bn) continue; c = cold; sw = 1; } e_close_view(o->pic, 1); return(ret); } int e_edt_options(FENSTER *f) { int i, ret, edopt = f->ed->edopt; W_OPTSTR *o = e_init_opt_kst(f); if (!o) return(-1); o->xa = 15; o->ya = 3; o->xe = 64; o->ye = 22; o->bgsw = AltO; o->name = "Editor-Options"; o->crsw = AltO; e_add_txtstr(3, 2, "Display:", o); e_add_txtstr(25, 2, "Autosave:", o); e_add_txtstr(25, 6, "Keys:", o); e_add_txtstr(25, 10, "Auto-Indent:", o); e_add_txtstr(3, 5, "Tile:", o); e_add_numstr(3, 8, 19, 8, 3, 100, 0, AltM, "Max. Columns:", f->ed->maxcol, o); e_add_numstr(3, 9, 20, 9, 2, 100, 0, AltT, "Tabstops:", f->ed->tabn, o); e_add_numstr(3, 10, 19, 10, 3, 1000, 2, AltX, "MaX. Changes:", f->ed->maxchg, o); e_add_numstr(3, 11, 20, 11, 2, 100, 0, AltN, "Num. Undo:", f->ed->numundo, o); e_add_numstr(3, 12, 20, 12, 2, 100, 5, AltI, "Auto Ind. Col.:", f->ed->autoindent, o); e_add_sswstr(4, 3, 0, AltS, f->ed->edopt & ED_SHOW_ENDMARKS ? 1 : 0, "Show Endmark ", o); e_add_sswstr(26, 3, 1, AltP, f->ed->autosv & 1, "OPtions ", o); e_add_sswstr(26, 4, 1, AltH, f->ed->autosv & 2 ? 1 : 0, "CHanges ", o); e_add_sswstr(4, 6, 2, AltD, f->ed->edopt & ED_OLD_TILE_METHOD ? 1 : 0, "OlD Style ", o); e_add_pswstr(0, 26, 7, 1, AltL, 0, "OLd-Style ", o); e_add_pswstr(0, 26, 8, 0, AltC, f->ed->edopt & ED_CUA_STYLE, "CUA-Style ", o); e_add_pswstr(1, 26, 11, 3, AltY, 0, "OnlY Source-Text", o); e_add_pswstr(1, 26, 12, 2, AltW, 0, "AlWays ", o); e_add_pswstr(1, 26, 13, 2, AltV, (f->ed->edopt & ED_ALWAYS_AUTO_INDENT ? 1 : f->ed->edopt & ED_SOURCE_AUTO_INDENT ? 0 : 2), "NeVer ", o); e_add_wrstr(3, 14, 3, 15, 44, 128, 1, AltR, "PRint Command:", f->ed->print_cmd, NULL, o); e_add_bttstr(12, 17, 1, AltO, " Ok ", NULL, o); e_add_bttstr(31, 17, -1, WPE_ESC, "Cancel", NULL, o); ret = e_opt_kst(o); if (ret != WPE_ESC) { f->ed->autosv = o->sstr[1]->num + (o->sstr[2]->num << 1); f->ed->maxcol = o->nstr[0]->num; f->ed->tabn = o->nstr[1]->num; f->ed->maxchg = o->nstr[2]->num; f->ed->numundo = o->nstr[3]->num; f->ed->autoindent = o->nstr[4]->num; f->ed->edopt = ((f->ed->edopt & ~ED_EDITOR_OPTIONS) + o->pstr[0]->num) + (o->pstr[1]->num == 0 ? ED_SOURCE_AUTO_INDENT : 0) + (o->pstr[1]->num == 1 ? ED_ALWAYS_AUTO_INDENT : 0) + (o->sstr[3]->num ? ED_OLD_TILE_METHOD : 0) + (o->sstr[0]->num ? ED_SHOW_ENDMARKS : 0); if (f->ed->print_cmd) WpeFree(f->ed->print_cmd); f->ed->print_cmd = WpeStrdup(o->wstr[0]->txt); if (edopt != f->ed->edopt) { e_switch_blst(f->ed); for (i = 0; i <= f->ed->mxedt; i++) if ((f->ed->edopt & ED_ALWAYS_AUTO_INDENT) || ((f->ed->edopt & ED_SOURCE_AUTO_INDENT) && f->ed->f[i]->c_st)) f->ed->f[i]->flg = 1; else f->ed->f[i]->flg = 0; e_repaint_desk(f); } } freeostr(o); return(0); } int e_read_help_str() { FILE *fp; char str[128]; int i, len; sprintf(str, "%s/help.key", LIBRARY_DIR); for (i = 0; i < E_HLP_NUM; i++) { e_hlp_str[i] = MALLOC(sizeof(char)); *e_hlp_str[i] = '\0'; } if (!(fp = fopen(str, "rb"))) return(-1); for (i = 0; i < E_HLP_NUM && fgets(str, 128, fp); i++) { len = strlen(str); if (str[len-1] == '\n') str[--len] = '\0'; e_hlp_str[i] = REALLOC(e_hlp_str[i], (len+1)*sizeof(char)); strcpy(e_hlp_str[i], str); } fclose(fp); return(i == E_HLP_NUM ? 0 : -2); } xwpe-1.5.30a/we_e_aus.c0000644000076400007640000002324010263105405013706 0ustar dulsidulsi/* we_e_aus.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "edit.h" /* draw entire screen with uniform chars and color */ void e_cls(int frb, int chr) { int i, j; for (j = 0; j < MAXSLNS; j++) for (i = 0; i < MAXSCOL; i++) e_pr_char(i, j, chr, frb); } /* write text string */ int e_puts(char *s, int xa, int ya, int frb) { int i; if (xa >= MAXSCOL || ya > MAXSLNS) return(-1); for (i = 0; s[i] != '\0' && i < 2000; i++) e_pr_char(i + xa, ya, s[i], frb); return(0); } /* write text string (sic!, R.H.) - characters between b2 and n2 will be drawn with color 'col2' other characters in the string with color 'col' - one character before the text is space with color 'col' - one character after the text is space with color 'col' - color 'col3' is used in old style */ void e_pr_str(int x, int y, char *str, int col, int b2, int n2, int col2, int col3) { int i, sw = 0; if (n2 < 0) { sw = 1; n2 = -n2; } e_pr_char(x-1, y, 32, col); for (i=0; *(str+i) != '\0'; i++) { if (i>=b2 && i= 0; i--) e_pr_char(x+i+MAXSCOL, y, SCD, col3); } #endif } /* - characters between b2 and n2 will be drawn with color 'col2', other characters in the string with color 'col' - spaces between bg and x are drawn with 'col' - spaces after text and before nd are drawnd with 'col' */ int e_pr_str_wsd(int x, int y, char *str, int col, int b2, int n2, int col2, int bg, int nd) { int i; for (i = bg; i < x; i++) e_pr_char(i, y, ' ', col); for (i = 0; str[i] && i <= nd-x; i++) { if (i>=b2 && i= x && e_mouse.x < x+max) { jc = e_mouse.x-x > max-nnum ? e_mouse.x-x : max-nnum; } else { if (c > -2) *num = WpeStringToNumber(s); FREE(s); return(c); } } #endif if (c == 332) { if(jc < max-1) jc++; } else if (c == 330) { if(jc > max-nnum) jc--; } else if (c == 326) jc = max-nnum; else if (c == 334) jc = max-1; else if (c == WPE_DC) { if (jc > max-nnum) { for (i = jc-1; i > 0; i--) s[i] = s[i-1]; s[0] = 32; nnum--; } } else if (c == ENTF) { if (nnum == 1) { s[jc] = '0'; } else if (jc < max) { for (i = jc; i > 0; i--) s[i] = s[i-1]; s[0] = 32; nnum--; } } else if (first == 1 && c >='0' && c <= '9') { for (i = 0; i < max - 1; i++) s[i] = 32; s[i] = c; s[max] = '\0'; nnum = 1; } else if (c >='0' && c <= '9') { for (i = 0; i < jc; i++) s[i] = s[i+1]; s[jc] = c; if (nnum < max) nnum++; } else if (c > 0 && (c < 32 || c > 255)) { if (c != WPE_ESC) *num = WpeStringToNumber(s); FREE(s); return(c); } if (jc > max -1) jc = max-1; else if (jc < max - nnum) jc = max-nnum; e_pr_zstring(s, x, y, max, ft); fk_locate(x+jc, y); first = 0; } return(c); } /* write chars in text line */ int e_schreib_leiste(char *s, int x, int y, int n, int max, int ft, int fs) { #if MOUSE extern struct mouse e_mouse; #endif int c, i, ja = 0, jc, l = strlen(s); int jd; int sond = 0, first = 1; unsigned char *tmp = MALLOC(max+1); fk_cursor(1); strcpy(tmp, s); jc = l; for (jd = 0, i = ja; tmp[i] && i <= n-3 + jd; i++) if (tmp[i] < ' ') jd++; if (jc + jd > n-2) jc = n-3-jd; e_schr_nchar(tmp, x, y, 0, n, fs); e_pr_char(x, y, ' ', ft); e_pr_char(x+n-1, y, ' ', ft); fk_locate(x+jc+jd+1, y); #ifdef NEWSTYLE e_make_xrect(x, y, x+n-1, y, 1); #endif while ((c = e_getch()) != WPE_ESC) { #if MOUSE if (c < 0) { if (e_mouse.y == y && e_mouse.x > x && e_mouse.x < x+n) { jc = e_mouse.x-x-1 < l ? e_mouse.x-x-1 : l; if (c == -2) { int len = WpeEditor->f[0]->b->bf[0].len; #ifndef NO_XWINDOWS if (bioskey() & 8) e_cp_X_to_buffer(WpeEditor->f[WpeEditor->mxedt]); #endif while (e_mshit()) ; if (first == 1) { tmp[0] = '\0'; l = 0; jc = 0; } if (len + l > max) len = max - l; for (i = l; i >= jc; i--) tmp[i+len] = tmp[i]; for (i = jc; i < jc + len; i++) tmp[i] = WpeEditor->f[0]->b->bf[0].s[i-jc]; jc += len; l += len; } } else { if (c > -4) strcpy(s, tmp); FREE(tmp); fk_cursor(0); return(c); } } #endif if (c == CRI || (!sond && c == CtrlF)) { if(jc < l) jc++; } else if (c == CLE || (!sond && c == CtrlB)) { if(jc > 0) jc--; } else if (c == CCLE && jc > 0) jc = e_su_rblk(jc, tmp); else if (c == CCRI && jc < l) jc = e_su_lblk(jc, tmp); else if (c == POS1 || (!sond && c == CtrlA)) jc = 0; else if (c == ENDE || (!sond && c == CtrlE)) jc = l; else if (c == AltJ || c == F9) sond = !sond; else if (c == PASTE || c == ShiftEin || c == CtrlV || c == AltEin) { int len = WpeEditor->f[0]->b->bf[0].len; #ifndef NO_XWINDOWS if (WpeIsXwin() && c == AltEin) e_cp_X_to_buffer(WpeEditor->f[WpeEditor->mxedt]); #endif if (first == 1) { tmp[0] = '\0'; l = 0; jc = 0; } if (len + l > max) len = max - l; for (i = l; i >= jc; i--) tmp[i+len] = tmp[i]; for (i = jc; i < jc + len; i++) tmp[i] = WpeEditor->f[0]->b->bf[0].s[i-jc]; jc += len; l += len; } else if (c == WPE_DC && !sond) { if (jc > 0) { for (i = jc-1; i < l; i++) tmp[i] = tmp[i+1]; jc--; l--; } } else if (c == ENTF || (!sond && c == CtrlD)) { if (jc < l) { for (i = jc; i < l; i++) tmp[i] = tmp[i+1]; l--; } } else if (!sond && c == CtrlT) { c = e_su_lblk(jc, tmp) - jc; { for (i = jc; i <= l-c; i++) tmp[i] = tmp[i+c]; l -= c; } } else if (!sond && c == CtrlO) { if ((c = e_getch()) != CtrlT && toupper(c) != 'T') continue; c = jc - e_su_rblk(jc, tmp); { for( i = jc-c; i <= l-c; i++) tmp[i] = tmp[i+c]; jc -= c; l -= c; } } else if (first == 1 && ((c != WPE_CR && c != CtrlP && c != CtrlN && c != WPE_TAB && c != WPE_BTAB) || sond) && c > 0 && c < 0x7f) { tmp[0] = c; tmp[1] = '\0'; l = 1; jc = 1; } else if (((c != WPE_CR && c != WPE_TAB && c != WPE_BTAB && c != CtrlP && c != CtrlN ) || sond) && c > 0 && c < 0xff) { if (l < max) { for (i = l; i >= jc; i--) tmp[i+1] = tmp[i];tmp[jc] = c; l++; jc++; } } else if (c > 0) { if (c != WPE_ESC) strcpy(s, tmp); FREE(tmp);fk_cursor(0); if (c == CtrlP) c = CUP; else if (c == CtrlN) c = CDO; return(c); } for (jd = 0, i = ja; i < jc; i++) if(tmp[i] < ' ') jd++; if (jc+jd-ja > n-3) ja=jc+jd-n+3 ; else if (jc-ja < 0) ja = jc; e_schr_nchar(tmp, x, y, ja, n, ft); e_pr_char(x, y, ja > 0 ? MCL : ' ', ft); e_pr_char(x+n-1, y, l-ja > n-2 ? MCR : ' ', ft); fk_locate(x+jc+jd-ja+1, y); first = 0; #ifdef NEWSTYLE e_make_xrect(x, y, x+n-1, y, 1); #endif } fk_cursor(0); return(c); } int e_schr_nzif(int num, int x, int y, int max, int col) { char *str = MALLOC((max+1)*sizeof(char)); int i, nt; for (i = 0, nt = 1; i < max; i++) nt *= 10; if (num >= nt) num = nt - 1; e_pr_zstring(WpeNumberToString(num, max, str), x, y, max, col); FREE(str); return(0); } xwpe-1.5.30a/we_edit.c0000644000076400007640000014277210263105405013553 0ustar dulsidulsi/* we_edit.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "messages.h" #include "edit.h" #include "makro.h" #include /* included for digital station */ #include int e_undo_sw = 0, e_redo_sw = 0; char *e_make_postf(); int e_del_a_ind(); int e_tab_a_ind(); int e_help_next(); #ifdef PROG BUFFER *e_p_m_buffer = NULL; #ifdef DEBUGGER BUFFER *e_p_w_buffer = NULL; #endif #endif /* open edit window */ int e_edit(ECNT *cn, char *filename) { extern char *e_hlp_str[]; extern WOPT *eblst, *hblst, *mblst, *dblst; FILE *fp = NULL; FENSTER *f, *fo; char *complete_fname, *path, *file; int ftype = 0, i, j, st = 0; struct stat buf[1]; /* Allows project files to be open automatically */ j = strlen(filename); if ((WpeIsProg()) && (j > 4) && (!strcmp(&filename[j - 4], ".prj"))) { if (!e_prog.project) { e_prog.project = MALLOC(1); e_prog.project[0] = '\0'; } else { for (i = cn->mxedt; i > 0 && (cn->f[i]->dtmd != DTMD_DATA || cn->f[i]->ins != 4); i--) ; if (i > 0) { e_switch_window(cn->edt[i], cn->f[cn->mxedt]); e_close_window(cn->f[cn->mxedt]); } } e_prog.project = REALLOC(e_prog.project, j + 1); strcpy(e_prog.project, filename); e_make_prj_opt(cn->f[cn->mxedt]); /************************************/ e_rel_brkwtch(cn->f[cn->mxedt]); /************************************/ e_prj_ob_file(cn->f[cn->mxedt]); return 0; } /* Check to see if the file is already opened BD */ WpeFilenameToPathFile(filename, &path, &file); /* Should check for error here */ for (i = cn->mxedt; i >= 0; i--) { if ((strcmp(cn->f[i]->datnam, file) == 0) && (strcmp(cn->f[i]->dirct, path) == 0)) { e_switch_window(cn->edt[i], cn->f[cn->mxedt]); WpeFree(path); WpeFree(file); return(0); } } if (cn->mxedt >= MAXEDT) { e_error(e_msg[ERR_MAXWINS], 0, cn->fb); return(-1); } if (stat(filename, buf) == 0) { if (!S_ISREG(buf->st_mode)) { /* error message should go here */ return(-1); } } for (j = 1; j <= MAXEDT; j++) { for (i = 1; i <= cn->mxedt && cn->edt[i] != j; i++); if( i > cn->mxedt) break; } cn->curedt=j; (cn->mxedt)++; cn->edt[cn->mxedt]=j; if ((f = (FENSTER *)MALLOC(sizeof(FENSTER))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); f->fb = cn->fb; cn->f[cn->mxedt] = f; if ((f->b = (BUFFER *)MALLOC(sizeof(BUFFER))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); if ((f->s = (SCHIRM*)MALLOC(sizeof(SCHIRM))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); if ((f->b->bf = (STRING *) MALLOC(MAXLINES*sizeof(STRING))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); #ifdef PROG for (i = cn->mxedt-1; i > 0 && (!strcmp(cn->f[i]->datnam, "Messages") || !DTMD_ISTEXT(cn->f[i]->dtmd) || !strcmp(cn->f[i]->datnam, "Watches") || !strcmp(cn->f[i]->datnam, "Stack")); i--) ; for (j = cn->mxedt-1; j > 0 && !st; j--) if (!strcmp(cn->f[j]->datnam, "Stack")) st = 1; #else for(i = cn->mxedt-1; i > 0 && !DTMD_ISTEXT(cn->f[i]->dtmd); i--) ; #endif #ifdef PROG if (WpeIsProg()) { if ((e_we_sw & 8) || !strcmp(filename, "Messages") || !strcmp(filename, "Watches")) { f->a = e_set_pnt(0, 2*MAXSLNS/3 + 1); f->e = e_set_pnt(MAXSCOL-1, MAXSLNS-2); } else if (!strcmp(filename, "Stack")) { f->a = e_set_pnt(2*MAXSCOL/3, 1); f->e = e_set_pnt(MAXSCOL-1, 2*MAXSLNS/3); } else { if (i < 1) { f->a = e_set_pnt(0, 1); f->e = e_set_pnt(st ? 2*MAXSCOL/3-1 : MAXSCOL-1, 2*MAXSLNS/3); } else { f->a = e_set_pnt(cn->f[i]->a.x+1, cn->f[i]->a.y+1); f->e = e_set_pnt(st ? 2*MAXSCOL/3-1 : cn->f[i]->e.x, cn->f[i]->e.y); } } } else #endif { if (i < 1) { f->a = e_set_pnt(0, 1); f->e = e_set_pnt(MAXSCOL-1, MAXSLNS-2); } else { f->a = e_set_pnt(cn->f[i]->a.x + 1, cn->f[i]->a.y + 1); f->e = e_set_pnt(cn->f[i]->e.x, cn->f[i]->e.y); } } if (NUM_COLS_ON_SCREEN < 26) f->a.x = f->e.x - 26; if(NUM_LINES_ON_SCREEN < 3) f->a.y = f->e.y - 3; f->winnum = cn->curedt; f->dtmd = cn->dtmd; f->ins = 1; f->save = 0; f->zoom = 0; f->ed = cn; f->pic = NULL; f->hlp_str = e_hlp_str[0]; f->blst = eblst; f->nblst = 7; f->b->f = f; f->b->b = e_set_pnt(0, 0); f->b->cl = f->b->clsv = 0; f->b->mx = e_set_pnt(cn->maxcol, MAXLINES); f->b->mxlines = 0; f->b->fb = f->fb; f->b->cn = cn; f->b->ud = NULL; f->b->rd = NULL; f->fd.dirct = NULL; if (WpeIsProg()) e_add_synt_tl(filename, f); else { f->c_st = NULL; f->c_sw = NULL; } if ((f->ed->edopt & ED_ALWAYS_AUTO_INDENT) || ((f->ed->edopt & ED_SOURCE_AUTO_INDENT) && f->c_st)) { f->flg = 1; } else { f->flg = 0; } f->s->c = e_set_pnt(0, 0); f->s->ks = e_set_pnt(0, 0); f->s->mark_begin = e_set_pnt(0, 0); f->s->mark_end = e_set_pnt(0, 0); f->s->fa = e_set_pnt(0, 0); f->s->fe = e_set_pnt(0, 0); f->s->fb = f->fb; #ifdef DEBUGGER f->s->brp = MALLOC(sizeof(int)); f->s->brp[0] = 0; f->s->da.y = -1; #endif f->dirct = path; for (i = 0; i < 9; i++) f->s->pt[i] = e_set_pnt(-1, -1); if (cn->mxedt == 0) /* Clipboard */ { cn->curedt=0; cn->edt[cn->mxedt]=0; WpeFree(file); file = f->datnam = WpeStrdup(BUFFER_NAME); #ifdef UNIX f->filemode = 0600; #endif e_new_line(0,f->b); *(f->b->bf[0].s) = WPE_WR; *(f->b->bf[0].s+1) = '\0'; f->b->bf[0].len = 0; f->b->bf[0].nrc = 1; return(0); } if (strcmp(file,"") == 0) { WpeFree(file); file = f->datnam = WpeStrdup("Noname"); } else { f->datnam = file; } if (strcmp(filename, "Help") == 0) { complete_fname = e_mkfilename(LIBRARY_DIR, HELP_FILE); f->dtmd = DTMD_HELP; f->ins = 8; f->hlp_str = e_hlp_str[25]; f->nblst = 7; f->blst = hblst; ftype = 1; } else complete_fname = e_mkfilename(f->dirct, f->datnam); #ifdef PROG if (WpeIsProg()) { if (!strcmp(filename, "Messages")) { f->ins = 8; f->hlp_str = e_hlp_str[3]; f->nblst = 8; f->blst = mblst; ftype = 2; } else if (!strcmp(filename, "Watches")) { f->ins = 8; f->hlp_str = e_hlp_str[1]; f->blst = dblst; ftype = 3; } else if (!strcmp(filename, "Stack")) { f->ins = 8; f->hlp_str = e_hlp_str[2]; f->blst = dblst; ftype = 4; } } #endif if (ftype != 1) fp = fopen(complete_fname, "rb"); if (fp != NULL && access(complete_fname, 2) != 0) f->ins = 8; #ifdef UNIX if (fp != NULL) { stat(complete_fname, buf); f->filemode = buf->st_mode; } else { umask(i = umask(077)); f->filemode = 0666 & ~i; } #endif FREE(complete_fname); if (fp != NULL && ftype != 1) { e_readin(0, 0, fp, f->b, &f->dtmd); if (fclose(fp) != 0) e_error(e_msg[ERR_FCLOSE], 0, cn->fb); if (cn->dtmd == DTMD_HELP) cn->dtmd = DTMD_NORMAL; #ifdef PROG if (WpeIsProg()) { if (e_we_sw & 8) { strcpy(f->datnam, "Messages"); e_we_sw &= ~8; } if (!strcmp(f->datnam, "Messages")) { e_make_error_list(f); f->ins = 8; } } #endif } else { e_new_line(0,f->b); *(f->b->bf[0].s) = WPE_WR; *(f->b->bf[0].s+1) = '\0'; f->b->bf[0].len = 0; f->b->bf[0].nrc = 1; } #ifdef PROG if (ftype == 2) { if(e_p_m_buffer != NULL) { e_close_buffer(f->b); f->b = e_p_m_buffer; f->b->f = f; } else { e_p_m_buffer = f->b; FREE(f->b->bf[0].s); f->b->mxlines = 0; } } #ifdef DEBUGGER if (ftype == 3) { if (e_p_w_buffer != NULL) { e_close_buffer(f->b); f->b = e_p_w_buffer; f->b->f = f; } else { e_p_w_buffer = f->b; /* e_ins_nchar(f->b, f->s, "No Watches", 0, 0, 10);*/ } } #endif #endif sc_txt_1(f); if (cn->mxedt > 1) { fo = cn->f[cn->mxedt-1]; e_ed_rahmen(fo, 0); } e_firstl(f, 1); e_zlsplt(f); e_brk_schirm(f); e_schirm(f, 1); e_cursor(f, 1); return(0); } /* keyboard output routine */ int e_eingabe(ECNT *e) { BUFFER *b = e->f[e->mxedt]->b; SCHIRM *s = e->f[e->mxedt]->s; FENSTER *f = e->f[e->mxedt]; int ret, c = 0; unsigned char cc; fk_cursor(1); while (c != WPE_ESC) { if (e->mxedt < 1) c = WpeHandleMainmenu(-1, f); else if (!DTMD_ISTEXT(f->dtmd)) return(0); else { if (f->save > f->ed->maxchg) e_autosave(f); #if MOUSE if ((c = e_getch()) < 0) cc = c = e_edt_mouse(c, f); else cc = c; #else cc = c = e_getch(); #endif } if ((c > 31 || (c == WPE_TAB && !(f->flg & 1)) || (f->ins > 1 && f->ins != 8)) && c < 255) { if (f->ins == 8) continue; if (f->ins == 0 || f->ins == 2) e_put_char(c, b, s); else e_ins_nchar(b, s, &cc, b->b.x, b->b.y, 1); e_schirm(f, 1); } else if (c == WPE_DC) { if (f->ins == 8) { if (f->dtmd == DTMD_HELP) e_help_last(f); continue; } if (b->b.y > 0 || b->b.x > 0) { if (b->bf[b->b.y].len == 0) { e_del_line(b->b.y, b, s); b->b.y--; b->b.x = b->bf[b->b.y].len; if (*(b->bf[b->b.y].s+b->b.x) == '\0') b->b.x--; } else { if (b->b.x > 0) b->b.x--; else { b->b.y--; b->b.x = b->bf[b->b.y].len; if (*(b->bf[b->b.y].s+b->b.x) == '\0') b->b.x--; } if (f->flg & 1) e_del_a_ind(b, s); else e_del_nchar(b, s, b->b.x, b->b.y, 1); } e_schirm(f, 1); } } else if (c == ENTF || c == 4) { if (f->ins == 8) { #ifdef DEBUGGER if (WpeIsProg()) e_d_is_watch(c, f); #endif continue; } if (*(b->bf[b->b.y].s + b->b.x) != '\0' && (b->b.y < b->mxlines-1 || *(b->bf[b->b.y].s + b->b.x) != WPE_WR)) { e_del_nchar(b, s, b->b.x, b->b.y, 1); e_schirm(f, 1); } } else if (c == WPE_CR) { #ifdef PROG if (f->ins == 8) { if (f->dtmd == DTMD_HELP) { e_help_ret(f); goto weiter; } if (WpeIsProg()) { e_d_car_ret(f); goto weiter; } else continue; } #else if (f->ins == 8) continue; #endif e_car_ret(b, s); e_schirm(f, 1); } else if (c == WPE_TAB) { e_tab_a_ind(b, s); e_schirm(f, 1); } /* else if(c == WPE_TAB) { if(f->ins == 8) continue; if (f->ins == 0 || f->ins == 2) for(c = f->ed->tabn - b->b.x % f->ed->tabn; c > 0 && b->b.x < b->mx.x; c--) { e_put_char(' ', b, s); b->b.x++; } else e_ins_nchar(b, s, f->ed->tabs, b->b.x, b->b.y, f->ed->tabn - b->b.x % f->ed->tabn); e_schirm(b, s, f, 1); } */ else { ret = e_tst_cur(c, e); /*up/down arrows go this way*/ if (ret != 0) ret = e_tst_fkt(c, e); } weiter: f = e->f[e->mxedt]; if (e->mxedt > 0 && DTMD_ISTEXT(f->dtmd)) { b = f->b; s = f->s; s->ks.x = b->b.x; s->ks.y = b->b.y; e_cursor(f, 1); if ((c & 511) != CUP && (c & 511) != CDO) b->clsv = b->cl; e_zlsplt(f); } } return(c); } /* Interpretation of cursor keys ( Primitive editor ) */ int e_tst_cur(int c, ECNT *e) { FENSTER *f = e->f[e->mxedt]; BUFFER *b = f->b; SCHIRM *s = f->s; switch (c) { case CtrlP: case CUP: case CUP+512: if(b->b.y > 0) (b->b.y)--; b->b.x = e_chr_sp(b->clsv, b, f); break; case CtrlN: case CDO: case CDO+512: if(b->b.y < b->mxlines - 1) (b->b.y)++; b->b.x = e_chr_sp(b->clsv, b, f); break; case CtrlB: case CLE: case CLE+512: (b->b.x)--; if(b->b.x < 0) { if(b->b.y > 0) { (b->b.y)--; b->b.x = b->bf[b->b.y].len; } else { b->b.x = 0; } } break; case CtrlF: case CRI: case CRI+512: (b->b.x)++; if(b->b.x > b->bf[b->b.y].len) { if(b->b.y < b->mxlines - 1) { (b->b.y)++; b->b.x = 0; } else { b->b.x = b->bf[b->b.y].len; } } break; case CCLE: case CCLE+512: if(b->b.x <= 0 && b->b.y > 0) { b->b.y--; b->b.x = b->bf[b->b.y].len; } else if( b->b.x > 0 ) b->b.x = e_su_rblk(b->b.x - 1, b->bf[b->b.y].s); break; case CCRI: case CCRI+512: if(b->b.x >= b->bf[b->b.y].len && b->b.y < b->mxlines) { b->b.x = 0; b->b.y++; } else if( b->b.x < b->bf[b->b.y].len ) b->b.x = e_su_lblk(b->b.x, b->bf[b->b.y].s); break; case BDO: case BDO+512: b->b.y = b->b.y + NUM_LINES_ON_SCREEN - 2; if(b->b.y > b->mxlines - 1) b->b.y = b->mxlines - 1; e_schirm(f, 1); e_cursor(f, 1); break; case BUP: case BUP+512: b->b.y = b->b.y - f->e.y + f->a.y + 2; if(b->b.y < 0) b->b.y = 0; e_schirm(f, 1); e_cursor(f, 1); break; case CBDO: case CBDO+512: b->b.y = b->mxlines - 1; b->b.x = b->bf[b->mxlines - 1].len; e_schirm(f, 1); break; case CBUP: case CBUP+512: if(b->b.y != 0) { b->b.x = 0; b->b.y = 0; e_schirm(f, 1); } break; case CEND: case CEND+512: if(LINE_NUM_ON_SCREEN_BOTTOM < b->mxlines) b->b.y = LINE_NUM_ON_SCREEN_BOTTOM - 1; else b->b.y = b->mxlines - 1; b->b.x = b->bf[b->b.y].len; break; case CPS1: case CPS1+512: b->b.x = 0; b->b.y = s->c.y; break; case AltI: case EINFG: if (f->ins == 8) { #ifdef DEBUGGER if (WpeIsProg()) e_d_is_watch(c, f); #endif break; } if(f->ins & 1) f->ins &= ~1; else f->ins |= 1; #ifdef NEWSTYLE e_ed_rahmen(f, 1); #else e_pr_filetype(f); #endif break; case AltJ: if (f->ins == 8) break; if(f->ins & 2) f->ins &= ~2; else f->ins |= 2; #ifdef NEWSTYLE e_ed_rahmen(f, 1); #else e_pr_filetype(f); #endif break; case CtrlA: case POS1: case POS1+512: b->b.x = 0; break; case CtrlE: case ENDE: case ENDE+512: b->b.x = b->bf[b->b.y].len; break; case CtrlT: if(f->ins == 8) break; if( b->b.x < b->bf[b->b.y].len ) { c = e_su_lblk(b->b.x, b->bf[b->b.y].s); e_del_nchar(b, s, b->b.x, b->b.y, c-b->b.x); } else if(*(b->bf[b->b.y].s+b->b.x) == WPE_WR) e_del_nchar(b, s, b->b.x, b->b.y, 1); else if(b->b.x >= b->bf[b->b.y].len && b->b.y < b->mxlines) { b->b.x = 0; (b->b.y)++; } e_schirm(f, 1); break; case CtrlZ: if(f->ins == 8) break; e_del_nchar(b, s, b->b.x, b->b.y, b->bf[b->b.y].len-b->b.x); e_schirm(f, 1); break; case DGZ: if(f->ins == 8) break; e_del_line(b->b.y, b, s); if(b->b.y > b->mxlines - 1) (b->b.y)--; e_schirm(f, 1); break; case AF7: case AltV: if(f->dtmd != DTMD_HELP || f->ins != 8) return(c); e_help_next(f, 0); break; case AF8: case AltT: if(f->dtmd != DTMD_HELP || f->ins != 8) return(c); e_help_next(f, 1); break; default: return(c); } if(c >= 512 ) { if(s->ks.y == s->mark_begin.y && s->ks.x == s->mark_begin.x && (s->mark_begin.y != s->mark_end.y || s->mark_begin.x != s->mark_end.x)) { s->mark_begin.x = b->b.x; s->mark_begin.y = b->b.y; } else if(s->ks.y == s->mark_end.y && s->ks.x == s->mark_end.x && (s->mark_begin.y != s->mark_end.y || s->mark_begin.x != s->mark_end.x)) { s->mark_end.x = b->b.x; s->mark_end.y = b->b.y; } else if(s->ks.y < b->b.y || ( s->ks.y == b->b.y && s->ks.x < b->b.x)) { s->mark_begin.x = s->ks.x; s->mark_begin.y = s->ks.y; s->mark_end.x = b->b.x; s->mark_end.y = b->b.y; } else { s->mark_end.x = s->ks.x; s->mark_end.y = s->ks.y; s->mark_begin.x = b->b.x; s->mark_begin.y = b->b.y; } e_schirm(f, 1); } return(0); } /* function key (F1-F12) evaluation, editor only */ int e_tst_fkt(int c, ECNT *e) { extern OPT opt[]; int i; FENSTER *f = e->f[e->mxedt]; #ifdef PROG if (e_tst_dfkt(f, c) == 0 || ((WpeIsProg()) && e_prog_switch(f, c) == 0)) #else if (e_tst_dfkt(f, c) == 0) #endif { f = e->f[e->mxedt]; fk_cursor(1); if (e->mxedt > 0) e_cursor(f, 1); return(0); } for (i = 0; i < MENOPT; i++) if (c == opt[i].as) WpeHandleMainmenu(i, f); switch (c) { case CtrlK: e_ctrl_k(f); /* ctrl k */ break; case CtrlO: /* ctrl o */ e_ctrl_o(f); break; case AltG: e_goto_line(f); break; case CF10: case CtrlW: e_show_clipboard(f); break; case CtrlDel: e_blck_del(f); break; case UNDO: case AltBS: case CtrlU: e_make_undo(f); break; case AGAIN: case SABS: case CtrlR: e_make_redo(f); break; case CUT: case ShiftDel: /* shift Del : Delete to Clipboard */ /* case 402: */ case CtrlX: e_edt_del(f); break; case PASTE: case ShiftEin: /* shift Einf */ case CtrlV: e_edt_einf(f); break; #if !defined(NO_XWINDOWS) case AltEin: e_copy_X_buffer(f); break; case AltDel: e_paste_X_buffer(f); break; #endif case COPY: case CtrlEin: /* ctrl Einf */ /* case 401: */ case CtrlC: e_edt_copy(f); break; default: if (f->ed->edopt & ED_CUA_STYLE) { switch (c) { case AF2: e_m_save(f); break; case FID: case AF3: e_find(f); break; case SF3: e_replace(f); break; case F3: e_rep_search(f); break; default: return(c); } } else { switch(c) { case F2: e_m_save(f); break; case FID: case F4: e_find(f); break; case AF4: e_replace(f); break; case CtrlL: case CF4: e_rep_search(f); break; default: return(c); } } break; } fk_cursor(1); return(0); } int e_ctrl_k(FENSTER *f) { BUFFER *b = f->ed->f[f->ed->mxedt]->b; SCHIRM *s = f->ed->f[f->ed->mxedt]->s; int c; c = e_toupper(e_getch()); if (c < 32) c = c + 'A' - 1; switch (c) { case 'A': b->b = s->mark_begin; e_schirm(f, 1); break; case 'B': s->mark_begin = e_set_pnt(b->b.x, b->b.y); e_schirm(f, 1); break; case 'C': e_blck_copy(f); break; case 'D': e_changecase_dialog(f); break; case 'F': e_mk_beauty(1, 3, f); break; case 'H': e_blck_hide(f); break; case 'I': e_blck_to_right(f); break; case 'K': s->mark_end = e_set_pnt(b->b.x, b->b.y); e_schirm(f, 1); break; case 'L': f->s->mark_begin.x = 0; f->s->mark_begin.y = f->b->b.y; if (f->b->b.y < f->b->mxlines-1) { f->s->mark_end.x = 0; f->s->mark_end.y = f->b->b.y+1; } else { f->s->mark_end.x = f->b->bf[f->b->b.y].len; f->s->mark_end.y = f->b->b.y; } e_schirm(f, 1); break; case 'R': e_blck_read(f); break; case 'U': e_blck_to_left(f); break; case 'V': e_blck_move(f); break; case 'W': e_blck_write(f); break; case 'X': s->mark_begin.x = 0; s->mark_begin.y = 0; s->mark_end.y = b->mxlines-1; s->mark_end.x = b->bf[b->mxlines-1].len; e_schirm(f, 1); break; case 'Y': e_blck_del(f); break; case 'Z': b->b = s->mark_end; e_schirm(f, 1); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': s->pt[c-'0'] = e_set_pnt(b->b.x, b->b.y); s->fa.y = b->b.y; s->fa.x = b->b.x; s->fe.x = b->b.x+1; e_schirm(f, 1); break; } return 0; } /* Ctrl - O - Dispatcher */ int e_ctrl_o(FENSTER *f) { BUFFER *b = f->ed->f[f->ed->mxedt]->b; SCHIRM *s = f->ed->f[f->ed->mxedt]->s; int i, c; unsigned char cc; c = e_toupper(e_getch()); if (c < 32) c = c + 'A' - 1; switch(c) { case 'Y': /* delete end of line */ if (f->ins == 8) break; e_del_nchar(b, s, b->b.x, b->b.y, b->bf[b->b.y].len-b->b.x); e_schirm(f, 1); e_cursor(f, 1); break; case 'T': /* delete up to beginning of next word */ if (f->ins == 8) break; if (b->b.x <= 0 && b->b.y > 0) { b->b.y--; b->b.x = b->bf[b->b.y].len; } else if (b->b.x > 0) { c = b->b.x; b->b.x = e_su_rblk(b->b.x - 1, b->bf[b->b.y].s); e_del_nchar(b, s, b->b.x, b->b.y, c-b->b.x); } e_schirm(f, 1); break; case 'F': /* find string */ e_find(f); break; case 'A': /* replace string */ e_replace(f); break; #ifdef PROG case 'S': /* find declaration */ e_sh_def(f); break; case 'N': /* ...next... */ e_sh_nxt_def(f); break; case 'K': /* next bracket */ e_nxt_brk(f); break; case 'B': /* beautify text */ e_p_beautify(f); break; #endif case 'U': /* for help file: create button */ if (s->mark_begin.y == s->mark_end.y && s->mark_begin.y >= 0 && s->mark_begin.x < s->mark_end.x) { cc = HED; e_ins_nchar(b, s, &cc, s->mark_end.x, s->mark_end.y, 1); cc = HBG; e_ins_nchar(b, s, &cc, s->mark_begin.x, s->mark_end.y, 1); e_schirm(f, 1); } break; case 'M': /* for help file: Mark-Line */ if (s->mark_begin.y == s->mark_end.y && s->mark_begin.y >= 0 && s->mark_begin.x < s->mark_end.x) { cc = HED; e_ins_nchar(b, s, &cc, s->mark_end.x, s->mark_end.y, 1); cc = HBB; e_ins_nchar(b, s, &cc, s->mark_begin.x, s->mark_end.y, 1); e_schirm(f, 1); } break; case 'H': /* for help file: create Header */ if (s->mark_begin.y == s->mark_end.y && s->mark_begin.y >= 0 && s->mark_begin.x < s->mark_end.x) { cc = HED; e_ins_nchar(b, s, &cc, s->mark_end.x, s->mark_end.y, 1); cc = HHD; e_ins_nchar(b, s, &cc, s->mark_begin.x, s->mark_end.y, 1); e_schirm(f, 1); } break; case 'E': /* for help file: create end mark */ e_new_line(b->b.y, b); cc = HFE; e_ins_nchar(b, s, &cc, 0, b->b.y, 1); e_schirm(f, 1); break; case 'L': /* for help file: delete "help" special chars */ for (i = 0; i < b->bf[b->b.y].len; i++) if (b->bf[b->b.y].s[i] == HBG || b->bf[b->b.y].s[i] == HED || b->bf[b->b.y].s[i] == HHD || b->bf[b->b.y].s[i] == HBB || b->bf[b->b.y].s[i] == HFE || b->bf[b->b.y].s[i] == HFB || b->bf[b->b.y].s[i] == HFE) { e_del_nchar(b, s, i, b->b.y, 1); i--; } e_schirm(f, 1); break; case 'C': /* for help file: check help file */ e_help_comp(f); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': b->b.x = s->pt[c-'0'].x; b->b.y = s->pt[c-'0'].y; s->fa.y = b->b.y; s->fa.x = b->b.x; s->fe.x = b->b.x+1; e_cursor(f, 1); break; } return(0); } /* general function key dispatcher basically, every time when it returns with zero something has happened */ int e_tst_dfkt(FENSTER *f, int c) { if (c >= Alt1 && c <= Alt9) { e_switch_window(c - Alt1 + 1, f); return(0); } if (c >= 1024 && c <= 1049) { e_switch_window(c - 1014, f); return(0); } switch (c) { case F1: case HELP: e_help_loc(f, 0); break; #if defined(PROG) case CF1: if (WpeIsProg()) e_topic_search(f); break; case AF1: if (WpeIsProg()) e_funct_in(f); break; #endif case WPE_ESC: case F10: case AltBl: WpeHandleMainmenu(-1, f); break; case Alt0: e_list_all_win(f); break; case AF5: e_deb_out(f); break; default: if (f->ed->edopt & ED_CUA_STYLE) { switch (c) { case CtrlL: e_size_move(f); break; case OPEN: case F2: WpeManager(f); break; case SF2: WpeManagerFirst(f); break; case CF4: case AltX: e_close_window(f); break; case FRONT: case AltZ: case SF4: e_ed_cascade(f); break; case SF5: e_ed_tile(f); break; case SF6: e_ed_zoom(f); break; case CF6: case AltN: e_ed_next(f); break; case STOP: case AF4: e_quit(f); break; default: return(c); } } else { switch(c) { case CF5: case AF2: e_size_move(f); break; case OPEN: case F3: WpeManager(f); break; case CF3: WpeManagerFirst(f); break; case AF3: e_close_window(f); break; case FRONT: case AltZ: case F5: e_ed_zoom(f); break; case F6: case AltN: e_ed_next(f); break; case STOP: case AltX: e_quit(f); break; default: return(c); } } } return(0); } int e_chr_sp(int x, BUFFER *b, FENSTER *f) { int i, j; for (i = j = 0; i + j < x && i < b->bf[b->b.y].len; i++) { if (*(b->bf[b->b.y].s + i) == WPE_TAB) j += (f->ed->tabn - ((j + i) % f->ed->tabn) - 1); #ifdef UNIX else if (!WpeIsXwin() && ((unsigned char) *(b->bf[b->b.y].s + i)) > 126) { j++; if (((unsigned char) *(b->bf[b->b.y].s + i)) < 128 + ' ') j++; } else if (*(b->bf[b->b.y].s + i) < ' ') j++; if (f->dtmd == DTMD_HELP) { if (b->bf[b->b.y].s[i] == HBG || b->bf[b->b.y].s[i] == HFB || b->bf[b->b.y].s[i] == HED || b->bf[b->b.y].s[i] == HHD || b->bf[b->b.y].s[i] == HFE || b->bf[b->b.y].s[i] == HBB || b->bf[b->b.y].s[i] == HNF) j -= 2; } #endif } return(i); } /****************************************/ int FindFirstNospaceChar(BUFFER *b, int line) /* returns char number in the line, -1 otherwise */ { int k; /* advance x while char[k] == space() */ for(k = 0; k < b->bf[line].len; k++) { if(!isspace(b->bf[line].s[k])) { return k; } } return -1; } /****************************************/ int GetXOfCharNum(BUFFER *b, int line, int char_num) { int x, k; for(x = 0, k = 0; k < b->bf[line].len; k++) { if(k == char_num) { return x; } x = ((b->bf[line].s[k] == '\t') ? (x / b->cn->tabn + 1) * b->cn->tabn : x + 1); } /* return 0 to secure result interpretation */ return 0; } /****************************************/ int GetCharNumOfX(BUFFER *b, int line, int char_x) { int x, k, next_x; for(x = 0, k = 0; k < b->bf[line].len; k++) { next_x = ((b->bf[line].s[k] == '\t') ? (x / b->cn->tabn + 1) * b->cn->tabn : x + 1); if(next_x > char_x) { return x; } x = next_x; } /* return 0 to secure result interpretation */ return 0; } /****************************************/ /* New version of auto-indent */ int e_tab_a_ind(BUFFER *b, SCHIRM *s) { int a_indent = b->cn->autoindent; int line, x, k, char_to_ins; char *str; int do_auto_indent = 0; int first_nospace_k; /* If at the right of current pos there are only space chars, tab up to first nospace position (auto-indent pos) of previous lines. Tail spaces of current line are erased. If left current pos there are only spaces and even if there are nospaces at the right, tab up to auto-indent pos. Otherwise, insert TAB char. */ line = b->b.y; /* current line */ first_nospace_k = FindFirstNospaceChar(b, line); if (first_nospace_k > -1) { /* there is a nospace char in the line */ /* get its x */ if(b->b.x > GetXOfCharNum(b, line, first_nospace_k)) { /* nospace char before curr pos */ /* are there nospace chars under and after cursor pos */ do_auto_indent = 1; for (k = GetCharNumOfX(b, line, b->b.x); k < b->bf[line].len; k++) { if (!isspace(b->bf[line].s[k])) { /* yes, there are */ do_auto_indent = 0; break; } } if (do_auto_indent) { /* erase all tail spaces */ e_del_nchar(b, s, b->b.x, line, b->bf[line].len - b->b.x); } } else { /* nospace char only at or after curr pos */ do_auto_indent = 1; } } else { /* there are only space chars in the line */ do_auto_indent = 1; if (b->bf[line].len > 0) { /* erase all tail spaces */ e_del_nchar(b, s, b->b.x, line, b->bf[line].len - b->b.x); } } if (!do_auto_indent) { /* insert TAB char */ str = MALLOC(sizeof(char)); str[0] = '\t'; char_to_ins = 1; } else { /* auto-indent */ /* find x of the first nospace char of lines from above */ x = 0; for (line = b->b.y - 1; (line > 0); line--) { k = FindFirstNospaceChar(b, line); if (k > -1) { x = GetXOfCharNum(b, line, k); break; } } if (b->b.x < x) { /* indent to x with spaces */ /* insert chars */ k = x - b->b.x; str = MALLOC(k * sizeof(char)); for (x = 0; x < k; x++) str[x] = ' '; char_to_ins = k; } else if (b->b.x < (x + a_indent)) { /* indent to x + a_indent with spaces */ /* insert chars */ k = x + a_indent - b->b.x; str = MALLOC(k * sizeof(char)); for (x = 0; x < k; x++) str[x] = ' '; char_to_ins = k; } else { /* insert TAB char */ str = MALLOC(sizeof(char)); str[0] = '\t'; char_to_ins = 1; } } e_ins_nchar(b, s, str, b->b.x, b->b.y, char_to_ins); FREE(str); return(b->b.x); } int e_del_a_ind(BUFFER *b, SCHIRM *s) { int i = 1, j = -1, k; if (b->b.y > 0) { for (i = 0; i < b->bf[b->b.y].len && i < b->b.x && isspace(b->bf[b->b.y].s[i]); i++) ; if (i == b->b.x) { for (j = 0, i = 0; j <= b->b.x; j++) { i = b->bf[b->b.y].s[j] == '\t' ? (i / b->cn->tabn + 1) * b->cn->tabn : i + 1; } if (i != j) { char *str = MALLOC(i * sizeof(char)); e_del_nchar(b, s, 0, b->b.y, j); for (j = 0; j < i; j++) str[j] = ' '; e_ins_nchar(b, s, str, 0, b->b.y, i); b->b.x = i - 1; FREE(str); } for (j = b->b.y-1; j >= 0; j--) { for (i = 0, k = 0; k < b->bf[j].len && isspace(b->bf[j].s[k]); k++) i = b->bf[j].s[k] == '\t' ? (i / b->cn->tabn + 1) * b->cn->tabn : i + 1; if (k < b->bf[j].len && b->bf[j].s[k] != '#' && i <= b->b.x) { i = b->b.x - i + 1; b->b.x -= i - 1; break; } } if (j < 0) { i = b->b.x; b->b.x = 0; } } } if (j < 0) i = 1; e_del_nchar(b, s, b->b.x, b->b.y, i); return(i); } int e_car_a_ind(BUFFER *b, SCHIRM *s) { int i, j, k; unsigned char *str; if (b->b.y == 0) return(0); j = b->b.y; do { j--; for (i = 0, k = 0; k < b->bf[j].len && (isspace(b->bf[j].s[k]) || b->bf[j].s[i] == '{'); k++) i = b->bf[j].s[k] == '\t' ? (i / b->cn->tabn + 1) * b->cn->tabn : i + 1; } while (j > 0 && b->bf[j].s[k] == '#'); if (k == b->bf[j].len && k > 0 && b->bf[j].s[k-1] == '{') i--; if (i > 0) { str = MALLOC(i * sizeof(char)); for (j = 0; j < i; j++) str[j] = ' '; e_ins_nchar(b, s, str, 0, b->b.y, i); b->b.x = i; FREE(str); } return(i); } /* write n blanks */ int e_blk(int anz, int xa, int ya, int col) { for (anz--; anz >= 0 ; anz--) e_pr_char(xa+anz, ya, ' ', col); return(anz); } /* insert Carriage Return */ int e_car_ret(BUFFER *b, SCHIRM *s) { int len, i; len = b->bf[b->b.y].len; e_add_undo('a', b, b->b.x, b->b.y, 1); (b->f->save)++; if(b->b.x != len || *(b->bf[b->b.y].s+len) != '\0') { e_new_line(b->b.y+1, b); for(i=0; i <= len - b->b.x; i++) *(b->bf[b->b.y+1].s + i) = *(b->bf[b->b.y].s+b->b.x+i); *(b->bf[b->b.y+1].s+i)='\0'; b->bf[b->b.y+1].len = e_str_len(b->bf[b->b.y+1].s); b->bf[b->b.y+1].nrc = e_str_nrc(b->bf[b->b.y+1].s); if(s->mark_begin.y > b->b.y) (s->mark_begin.y)++; else if(s->mark_begin.y == b->b.y && s->mark_begin.x > b->b.x) { (s->mark_begin.y)++; (s->mark_begin.x) -= (b->b.x); } if(s->mark_end.y > b->b.y) (s->mark_end.y)++; else if(s->mark_end.y == b->b.y && s->mark_end.x > b->b.x) { (s->mark_end.y)++; (s->mark_end.x) -= (b->b.x); } } *(b->bf[b->b.y].s+b->b.x) = WPE_WR; *(b->bf[b->b.y].s+b->b.x+1) = '\0'; b->bf[b->b.y].len = e_str_len(b->bf[b->b.y].s); b->bf[b->b.y].nrc = e_str_nrc(b->bf[b->b.y].s); sc_txt_3(b->b.y, b, 1); /***************************/ if(b->b.x>0) e_brk_recalc(b->f,b->b.y+1,1); else e_brk_recalc(b->f,b->b.y,1); /***************************/ if (b->b.y < b->mxlines - 1) { (b->b.y)++; b->b.x = 0; } if(b->f->flg & 1) e_car_a_ind(b, s); return(b->b.y); } /* cursor placement */ void e_cursor(FENSTER *f, int sw) { BUFFER *b = f->b; SCHIRM *s = f->s; static int iold = 0, jold = 0; int i, j; if (!DTMD_ISTEXT(f->dtmd)) return; if (b->b.y > b->mxlines-1) b->b.y = b->mxlines-1; if (b->b.y < 0) b->b.y = 0; if (b->b.x < 0) b->b.x = 0; if (b->mxlines==0) b->b.x=0; /* the else branch needs b->b.y < b->mxlines, which is not true for b->mxlines==0 */ else if (b->b.x > b->bf[b->b.y].len) b->b.x = b->bf[b->b.y].len; for (i = j = 0; i < b->b.x; i++) { if (*(b->bf[b->b.y].s + i) == WPE_TAB) j += (f->ed->tabn - ((j + i) % f->ed->tabn) - 1); else if (!WpeIsXwin() && ((unsigned char) *(b->bf[b->b.y].s + i)) > 126) { j++; if (((unsigned char) *(b->bf[b->b.y].s + i)) < 128 + ' ') j++; } else if (*(b->bf[b->b.y].s + i) < ' ') j++; if (f->dtmd == DTMD_HELP) { if (b->bf[b->b.y].s[i] == HBG || b->bf[b->b.y].s[i] == HED || b->bf[b->b.y].s[i] == HHD || b->bf[b->b.y].s[i] == HFE || b->bf[b->b.y].s[i] == HFB || b->bf[b->b.y].s[i] == HBB || b->bf[b->b.y].s[i] == HNF) j -= 2; } } if (b->b.y - s->c.y < 0 || b->b.y - s->c.y >= NUM_LINES_ON_SCREEN - 1 || s->c.y < 0 || s->c.y >= b->mxlines || b->b.x + j - s->c.x < 0 || b->b.x + j- s->c.x >= NUM_COLS_ON_SCREEN - 1 ) { #if defined(UNIX) /*if(b->b.y - s->c.y < 0) s->c.y = b->b.y - (f->e.y - f->a.y)/2; else if(b->b.y - s->c.y >= f->e.y - f->a.y -1) s->c.y = b->b.y - (f->e.y - f->a.y)/2;*/ if (b->b.y - s->c.y < -1) { s->c.y = b->b.y - (NUM_LINES_ON_SCREEN)/2; } else if (b->b.y - s->c.y == -1) { s->c.y -= 1; } else if (b->b.y - s->c.y > NUM_LINES_ON_SCREEN -1) { s->c.y = b->b.y - (NUM_LINES_ON_SCREEN)/2; } else if (b->b.y - s->c.y == NUM_LINES_ON_SCREEN -1) { s->c.y += 1; } #else if (b->b.y - s->c.y < 0) s->c.y = b->b.y; else if (b->b.y - s->c.y >= NUM_LINES_ON_SCREEN -1) (s->c.y) = b->b.y - f->e.y + f->a.y + 2; #endif if (s->c.y >= b->mxlines - 1) s->c.y = b->mxlines - 2 ; if (s->c.y < 0) s->c.y = 0 ; if (b->b.x + j - s->c.x < 0) (s->c.x) = b->b.x + j - (NUM_COLS_ON_SCREEN)/2 ; else if (b->b.x + j - s->c.x >= NUM_COLS_ON_SCREEN - 1) (s->c.x) = b->b.x + j - (NUM_COLS_ON_SCREEN)/2 ; if (s->c.x < 0) s->c.x = 0 ; else if (s->c.x >= b->bf[b->b.y].len + j) s->c.x = b->bf[b->b.y].len + j; e_schirm(f, sw); } if (s->fa.y == -1) { e_schirm(f, sw); s->fa.y--; } else if (s->fa.y > -1) s->fa.y = -1; if (sw != 0) { iold = e_lst_zeichen(f->e.x, f->a.y+1, f->e.y-f->a.y-1, 0, f->fb->em.fb, b->mxlines, iold, b->b.y); jold = e_lst_zeichen(f->a.x+19, f->e.y, f->e.x-f->a.x-20, 1, f->fb->em.fb, b->mx.x, jold, b->b.x); } b->cl = b->b.x+j; fk_locate(f->a.x+b->b.x-s->c.x+j+1, f->a.y+b->b.y-s->c.y+1); } /* delete one line */ int e_del_line(int yd, BUFFER *b, SCHIRM *s) { int i; if (b->mxlines == 1) { *(b->bf[0].s) = '\0'; b->bf[0].nrc = b->bf[0].len = 0; } else { e_add_undo('l', b, 0, yd, 1); (b->mxlines)--; for (i = yd; i < b->mxlines; i++) b->bf[i] = b->bf[i+1]; if (s->mark_begin.y > yd) (s->mark_begin.y)--; else if (s->mark_begin.y == yd) (s->mark_begin.x) = 0; if (s->mark_end.y > yd) (s->mark_end.y)--; else if (s->mark_end.y == yd) { (s->mark_end.y)--; s->mark_end.x = b->bf[yd-1].len; } } sc_txt_3(yd, b, -1); if (b->f) (b->f->save) += 10; /*******************************/ e_brk_recalc(b->f,yd,-1); /*******************************/ return(b->mxlines); } /* delete N chars from buffer */ int e_del_nchar(BUFFER *b, SCHIRM *s, int x, int y, int n) { FENSTER *f = WpeEditor->f[WpeEditor->mxedt]; int len, i, j; (f->save) += n; e_add_undo('r', b, x, y, n); e_undo_sw++; len = b->bf[y].len; if (*(b->bf[y].s+len) == WPE_WR) len++; for (j = x; j <= len - n; ++j) *(b->bf[y].s+j) = *(b->bf[y].s+j+n) ; if (s->mark_begin.y == y && s->mark_begin.x > x) s->mark_begin.x = (s->mark_begin.x-n > x) ? s->mark_begin.x-n : x; if (s->mark_end.y == y && s->mark_end.x > x) s->mark_end.x = (s->mark_end.x-n > x) ? s->mark_end.x-n : x; if (len <= n) e_del_line(y, b, s); else if (y < b->mxlines - 1 && *(b->bf[y].s+len-n-1) != WPE_WR ) { if (b->mx.x+n-len > b->bf[y+1].len) i = b->bf[y+1].len; else i = e_su_rblk(b->mx.x+n-len, b->bf[y+1].s); if (b->bf[y+1].s[i] == WPE_WR) i++; if (i > 0) { for (j = 0; j < i; ++j) *(b->bf[y].s+len-n+j) = *(b->bf[y+1].s+j); *(b->bf[y].s+len-n+i) = '\0'; if (s->mark_begin.y == y+1 && s->mark_begin.x <= i) { s->mark_begin.y--; s->mark_begin.x += (len-n); } if (s->mark_end.y == y+1 && s->mark_end.x <= i) { s->mark_end.y--; s->mark_end.x += (len-n); } e_del_nchar(b, s, 0, y+1, i); } } if (y < b->mxlines) { b->bf[y].len = e_str_len(b->bf[y].s); b->bf[y].nrc = e_str_nrc(b->bf[y].s); } e_undo_sw--; sc_txt_4(y, b, 0); return(x+n); } /* insert N chars in buffer */ int e_ins_nchar(BUFFER *b, SCHIRM *sch, unsigned char *s, int xa, int ya, int n) { FENSTER *f = WpeEditor->f[WpeEditor->mxedt]; int i, j; (f->save) += n; e_add_undo('a', b, xa, ya, n); e_undo_sw++; if (b->bf[ya].len+n >= b->mx.x-1) { if (xa < b->bf[ya].len) { i = b->mx.x-n-1; if (i >= b->bf[ya].len-1) i = b->bf[ya].len-1; } else { for (; xa < b->mx.x-1; xa++, s++, n--) { *(b->bf[ya].s + xa + 1) = *(b->bf[ya].s + xa); *(b->bf[ya].s + xa) = *s; } *(b->bf[ya].s + xa + 1) = '\0'; i = b->mx.x; b->bf[ya].len = e_str_len(b->bf[ya].s); b->bf[ya].nrc = e_str_nrc(b->bf[ya].s); } for (; i > 0 && *(b->bf[ya].s+i) != ' ' && *(b->bf[ya].s+i) != '-'; i--); if (i == 0) { if (s[n-1] != ' ' && s[n-1] != '-') i = b->bf[ya].len - 2; else i--; } if (*(b->bf[ya].s+b->bf[ya].len) == WPE_WR || ya == b->mxlines) { e_new_line(ya+1, b); if (sch->mark_begin.y > ya) (sch->mark_begin.y)++; else if(sch->mark_begin.y == ya) { if (sch->mark_begin.x > i) { (sch->mark_begin.y)++; (sch->mark_begin.x) -= (i+1); } else if (sch->mark_begin.x >= xa) sch->mark_begin.x += n; } if (sch->mark_end.y > ya) (sch->mark_end.y)++; else if(sch->mark_end.y == ya) { if(sch->mark_end.x > i) { (sch->mark_end.y)++; (sch->mark_end.x) -= (i+1); } else if(sch->mark_end.x >= xa) sch->mark_end.x += n; } for (j = i+1; *(b->bf[ya].s+j) != WPE_WR && *(b->bf[ya].s+j) != '\0'; j++) *(b->bf[ya+1].s+j-i-1) = *(b->bf[ya].s+j); *(b->bf[ya+1].s+j-i-1) = WPE_WR; b->bf[ya+1].len = e_str_len(b->bf[ya+1].s); b->bf[ya+1].nrc = e_str_nrc(b->bf[ya+1].s); sc_txt_4(ya, b, 1); } else { e_ins_nchar(b, sch, b->bf[ya].s+i+1, 0, ya+1, b->bf[ya].len-i-1); if (sch->mark_begin.y == ya) { if (sch->mark_begin.x > i) { (sch->mark_begin.y)++; (sch->mark_begin.x) -= (i+1); } else if (sch->mark_begin.x >= xa) sch->mark_begin.x += n; } if (sch->mark_end.y == ya) { if (sch->mark_end.x > i) { (sch->mark_end.y)++; (sch->mark_end.x) -= (i+1); } else if (sch->mark_end.x >= xa) sch->mark_end.x += n; } } /* if(*(b->bf[ya].s+i) == ' ') *(b->bf[ya].s+i) = '\0'; else */ *(b->bf[ya].s+i+1) = '\0'; b->bf[ya].len = e_str_len(b->bf[ya].s); b->bf[ya].nrc = e_str_nrc(b->bf[ya].s); if (xa > b->bf[ya].len) { xa -= (b->bf[ya].len); ya++; b->bf[ya].len = e_str_len(b->bf[ya].s); b->bf[ya].nrc = e_str_nrc(b->bf[ya].s); if (sch->mark_begin.y == ya && sch->mark_begin.x >= xa) sch->mark_begin.x += n; if (sch->mark_end.y == ya && sch->mark_end.x >= xa) sch->mark_end.x += n; } } else { if (sch->mark_begin.y == ya && sch->mark_begin.x >= xa) sch->mark_begin.x += n; if(sch->mark_end.y == ya && sch->mark_end.x >= xa) sch->mark_end.x += n; } for (j = b->bf[ya].len; j >= xa; --j) *(b->bf[ya].s+j+n) = *(b->bf[ya].s+j); for (j = 0; j < n; ++j) *(b->bf[ya].s+xa+j) = *(s+j); if (b->bf[ya].s[b->bf[ya].len] == WPE_WR) b->bf[ya].s[b->bf[ya].len+1] = '\0'; b->b.x = xa + n; b->b.y = ya; b->bf[ya].len = e_str_len(b->bf[ya].s); b->bf[ya].nrc = e_str_nrc(b->bf[ya].s); e_undo_sw--; sc_txt_4(ya, b, 0); return(xa+n); } /* insert new line */ int e_new_line(int yd, BUFFER *b) { int i; if (b->mxlines > b->mx.y-2) { b->mx.y += MAXLINES; if ((b->bf = REALLOC(b->bf, b->mx.y * sizeof(STRING))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, b->fb); if (b->f->c_sw) b->f->c_sw = REALLOC(b->f->c_sw , b->mx.y * sizeof(int)); } for (i = b->mxlines-1; i >= yd; i--) { b->bf[i+1] = b->bf[i]; } (b->mxlines)++; b->bf[yd].s = MALLOC(b->mx.x+1); if (b->bf[yd].s == NULL) e_error(e_msg[ERR_LOWMEM], 1, b->fb); *(b->bf[yd].s) = '\0'; b->bf[yd].len = 0; b->bf[yd].nrc = 0; return(b->mxlines); } /* Overwriting of a character */ int e_put_char(int c, BUFFER *b, SCHIRM *s) { unsigned char cc = c; if (b->b.x == b->bf[b->b.y].len) e_ins_nchar(b, s, &cc, b->b.x, b->b.y, 1); else { e_add_undo('p', b, b->b.x, b->b.y, 1); (b->f->save)++; *(b->bf[b->b.y].s+b->b.x) = c; } (b->b.x)++; return(b->b.x); } /* search right (left end of word) */ int e_su_lblk(int xa, char *s) { int len = strlen(s); if (xa >= len) xa = len - 1; for (; xa < len && isalnum1(s[xa]); xa++) ; for (; xa < len && !isalnum1(s[xa]); xa++) ; return(xa); } /* Search left (left end of word) */ int e_su_rblk(int xa, char *s) { int len = strlen(s); if (xa <= 0) return(xa); if (xa > len) xa = len; for (xa--; xa > 0 && !isalnum1(s[xa]); xa--) ; if (!xa) return(xa); for (; xa > 0 && isalnum1(s[xa]); xa--) ; return(!xa ? xa : xa + 1); } /* Prints out the line number and column of cursor */ void e_zlsplt(FENSTER *f) { char str[20]; if (!DTMD_ISTEXT(f->dtmd)) return; sprintf(str,"%5d:%-4d", f->b->b.y + 1, f->b->cl + 1); e_puts(str,f->a.x+5,f->e.y,f->fb->er.fb); if (f->save) e_pr_char(f->a.x+3, f->e.y, '*', f->fb->er.fb); else e_pr_char(f->a.x+3, f->e.y, ' ', f->fb->er.fb); #ifdef NEWSTYLE if (WpeIsXwin()) { e_make_xrect(f->a.x + 1, f->e.y, f->e.x - 1, f->e.y, 0); e_make_xrect(f->a.x + 5, f->e.y, f->a.x + 14, f->e.y, 0); } #endif } void WpeFilenameToPathFile(char *filename, char **path, char **file) { char *tmp; char *cur_dir; int len; *path = NULL; tmp = strrchr(filename, DIRC); if (tmp) { *file = WpeStrdup(tmp + 1); } else { *file = WpeStrdup(filename); } if ((!tmp) || ((filename + 1 == tmp) && (*filename == '.'))) { *path = WpeGetCurrentDir(WpeEditor); } else { if (*filename != DIRC) { if ((cur_dir = WpeGetCurrentDir(WpeEditor)) == NULL) { WpeFree(*file); *file = NULL; return ; } /* Delete the slash at the end. */ len = strlen(cur_dir); cur_dir[len - 1] = 0; len = tmp - filename + 1; while (strncmp(filename, "../", 3) == 0) { tmp = strrchr(cur_dir, DIRC); if (tmp == cur_dir) { cur_dir[1] = 0; } else { *tmp = 0; } len -= 3; filename += 3; } *path = WpeMalloc((strlen(cur_dir) + len + 2) * sizeof(char)); strcpy(*path, cur_dir); strcat(*path, DIRS); strncat(*path, filename, len); if ((*path)[strlen(cur_dir) + len] != DIRC) { (*path)[strlen(cur_dir) + len + 1] = 0; } else { (*path)[strlen(cur_dir) + len] = DIRC; (*path)[strlen(cur_dir) + len + 1] = 0; } WpeFree(cur_dir); } else { len = tmp - filename + 1; *path = WpeMalloc(len + 1 * sizeof(char)); strncpy(*path, filename, len); (*path)[len] = 0; } } } /* draw mouse slider cursor */ int e_lst_zeichen(int x, int y, int n, int sw, int frb, int max, int iold, int new) { int inew; double d = max ? 1./(float)max : 0; if (n < 3) return(1); if ((inew = (int) (new*(n-2)*d + 1.5)) > n-2) inew = n-2; if (iold < 1) iold = 1; if (inew < 1) inew = 1; if (sw == 0) { if (iold < n-1) e_pr_char(x, y+iold, MCI, frb); e_pr_char(x, y+inew, MCA, frb); e_make_xrect(x, y+1, x, y+n-2, 0); e_make_xrect(x, y+inew, x, y+inew, 0); } else { if (iold < n-1) e_pr_char(x+iold, y, MCI, frb); e_pr_char(x+inew, y, MCA, frb); e_make_xrect(x+1, y, x+n-2, y, 0); e_make_xrect(x+inew, y, x+inew, y, 0); } return(inew); } /* draw mouse slider bar */ void e_mouse_bar(int x, int y, int n, int sw, int frb) { int sv = n; if (sw == 0) { e_pr_char(x, y, MCU, frb); e_pr_char(x, y+n-1, MCD, frb); for (; n > 2; n--) e_pr_char(x, y+n-2, MCI, frb); e_make_xrect(x, y+1, x, y+sv-2, 0); e_make_xrect(x, y, x, y, 0); e_make_xrect(x, y+sv-1, x, y+sv-1, 0); } else { e_pr_char(x, y, MCL, frb); e_pr_char(x+n-1, y, MCR, frb); for (; n > 2; n--) e_pr_char(x+n-2, y, MCI, frb); e_make_xrect(x+1, y, x+sv-2, y, 0); e_make_xrect(x, y, x, y, 0); e_make_xrect(x+sv-1, y, x+sv-1, y, 0); } } int e_autosave(FENSTER *f) { char *tmp, *str; long maxname; f->save = 1; if (!(f->ed->autosv & 2)) return(0); /* Check if file system could have an autosave or emergency save file >12 check is to eliminate dos file systems */ if (((maxname = pathconf(f->dirct, _PC_NAME_MAX)) >= strlen(f->datnam) + 4) && (maxname > 12)) { str = MALLOC(strlen(f->datnam) + 5); str = e_make_postf(str, f->datnam, ".ASV"); tmp = f->datnam; f->datnam = str; /*e_save(f);*/ WpeMouseChangeShape(WpeWorkingShape); e_write(0, 0, f->b->mx.x, f->b->mxlines-1, f, WPE_NOBACKUP); WpeMouseRestoreShape(); f->datnam = tmp; f->save = 1; FREE(str); } return(0); } Undo *e_remove_undo(Undo *ud, int sw) { if (ud == NULL) return(ud); ud->next = e_remove_undo(ud->next, sw + 1); if (sw > WpeEditor->numundo) { if(ud->type == 'l') FREE(ud->u.pt); else if (ud->type == 'd') { BUFFER *b = (BUFFER*) ud->u.pt; int i; FREE(b->f->s); FREE(b->f); if (b->bf != NULL) { for (i = 0; i < b->mxlines; i++) { if (b->bf[i].s != NULL) FREE( b->bf[i].s ); b->bf[i].s = NULL; } FREE(b->bf); } FREE(b); } FREE(ud); ud = NULL; } return(ud); } int e_add_undo(int sw, BUFFER *b, int x, int y, int n) { Undo *next; if (e_undo_sw) return(0); if (!e_redo_sw && b->rd) b->rd = e_remove_undo(b->rd, WpeEditor->numundo+1); if ((next = MALLOC(sizeof(Undo))) == NULL) { e_error(e_msg[ERR_LOWMEM], 0, b->fb); return(-1); } next->type = sw; next->b.x = x; next->b.y = y; next->a.x = n; if (e_redo_sw == 1) next->next = b->rd; else next->next = b->ud; if (sw == 'a') ; else if (sw == 'p') next->u.c = b->bf[y].s[x]; else if (sw == 'r' || sw == 's') { char *str = MALLOC(n); int i; if (str == NULL) { e_error(e_msg[ERR_LOWMEM], 0, b->fb); FREE(next); return(-1); } for (i = 0; i < n; i++) str[i] = b->bf[y].s[x+i]; next->u.pt = str; /* !!! obsolete !!! next->a.y = b->cn->fd.rn; */ next->a.y = b->f->fd.rn; } else if (sw == 'l') next->u.pt = b->bf[y].s; else if (sw == 'c' || sw == 'v') { SCHIRM *s = b->cn->f[b->cn->mxedt]->s; next->a = s->mark_begin; next->e = s->mark_end; } else if (sw == 'd') { BUFFER *bn = MALLOC(sizeof(BUFFER)); SCHIRM *sn = MALLOC(sizeof(SCHIRM)); FENSTER *fn = MALLOC(sizeof(FENSTER)); FENSTER *f = b->cn->f[b->cn->mxedt]; bn->bf = (STRING *) MALLOC(MAXLINES*sizeof(STRING)); if (bn == NULL || sn == 0 || bn->bf == NULL) return(e_error(e_msg[ERR_LOWMEM], 0, b->fb)); fn->b = bn; fn->c_sw = NULL; fn->c_st = NULL; fn->ed = NULL; /* Quick fix so that breakpoints aren't recalculated */ fn->fd.dirct = NULL; bn->f = fn; bn->f->s = sn; bn->b = e_set_pnt(0, 0); bn->mx = e_set_pnt(b->cn->maxcol, MAXLINES); bn->mxlines = 0; sn->fb = bn->fb = b->fb; bn->cn = b->cn; bn->ud = NULL; bn->rd = NULL; sn->c = sn->ks = sn->mark_begin = sn->mark_end = sn->fa = sn->fe = e_set_pnt(0, 0); e_new_line(0 ,bn); *(bn->bf[0].s) = WPE_WR; *(bn->bf[0].s+1) = '\0'; bn->bf[0].len = 0; bn->bf[0].nrc = 1; next->u.pt = bn; e_undo_sw = 1; e_move_block(0, 0, b, bn, f); e_undo_sw = 0; } if (e_redo_sw == 1) b->rd = next; else { next->next = e_remove_undo(b->ud, 1); b->ud = next; } return(0); } int e_make_undo(FENSTER *f) { return(e_make_rudo(f, 0)); } int e_make_redo(FENSTER *f) { return(e_make_rudo(f, 1)); } int e_make_rudo(FENSTER *f, int sw) { BUFFER *b; SCHIRM *s; Undo *ud; int i; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--); if (i <= 0) return(0); e_switch_window(f->ed->edt[i], f); f = f->ed->f[f->ed->mxedt]; b = f->b; s = f->s; if (!sw) ud = b->ud; else ud = b->rd; if (ud == NULL) { e_error((!sw ? e_msg[ERR_UNDO] : e_msg[ERR_REDO]), 0, b->fb); return(-1); } f = f->ed->f[f->ed->mxedt]; if (!sw) e_redo_sw = 1; else e_redo_sw = 2; b->b = ud->b; if (ud->type == 'r' || ud->type == 's') { if (ud->type == 's') { e_add_undo('s', b, ud->b.x, ud->b.y, ud->a.y); e_undo_sw = 1; e_del_nchar(b, s, ud->b.x, ud->b.y, ud->a.y); } if (*((char*)ud->u.pt) == '\n' && ud->a.x == 1) e_car_ret(b, s); else if (*((char*)ud->u.pt + ud->a.x - 1) == '\n') { e_ins_nchar(b, s, ((char *)ud->u.pt), ud->b.x, ud->b.y, ud->a.x-1); e_car_ret(b, s); } else e_ins_nchar(b, s, ((char *)ud->u.pt), ud->b.x, ud->b.y, ud->a.x); e_undo_sw = 0; s->mark_begin = ud->b; s->mark_end.y = ud->b.y; s->mark_end.x = ud->b.x + ud->a.x; FREE(ud->u.pt); } else if (ud->type == 'l') { for(i = b->mxlines; i > ud->b.y; i--) b->bf[i] = b->bf[i-1]; (b->mxlines)++; b->bf[b->b.y].s = ud->u.pt; b->bf[b->b.y].len = e_str_len(b->bf[b->b.y].s); b->bf[b->b.y].nrc = e_str_nrc(b->bf[b->b.y].s); s->mark_begin = ud->b; s->mark_end.y = ud->b.y + 1; s->mark_end.x = 0; e_add_undo('y', b, 0, b->b.y, 0); } else if (ud->type == 'y') e_del_line(b->b.y, b, s); else if (ud->type == 'a') e_del_nchar(b, s, ud->b.x, ud->b.y, ud->a.x); else if (ud->type == 'p') b->bf[ud->b.y].s[ud->b.x] = ud->u.c; else if (ud->type == 'c') { b->b = s->mark_begin = ud->a; s->mark_end = ud->e; /* e_blck_clear(b, s); */ e_blck_del(f); } else if (ud->type == 'v') { b->b = ud->b; s->mark_begin = ud->a; s->mark_end = ud->e; e_blck_move(f); } else if (ud->type == 'd') { BUFFER *bn = (BUFFER*)ud->u.pt; e_undo_sw = 1; s->mark_begin = bn->f->s->mark_begin; s->mark_end = bn->f->s->mark_end; e_move_block(ud->b.x, ud->b.y, bn, b, f); e_undo_sw = 0; FREE(bn->f->s); FREE(bn->f); FREE(bn->bf[0].s); FREE(bn->bf); FREE(ud->u.pt); e_add_undo('c', b, ud->b.x, ud->b.y, 0); } if (!sw) b->ud = ud->next; else b->rd = ud->next; e_redo_sw = 0; FREE(ud); e_schirm(f, 1); e_cursor(f, 1); return(0); } char *e_make_postf(char *out, char *name, char *pf) { strcpy(out, name); strcat(out, pf); return(out); } xwpe-1.5.30a/syntax_def0000644000076400007640000000377610263105405014056 0ustar dulsidulsi.c 32 auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while 0 ~^()[]{}<>+-/*%=|&!.?:,; /* */ NULL NULL "'#\\ -1 -1 1000 6 .C .cc .cpp .cxx .h .hpp 73 and and_eq asm auto bitand bitor bool break case catch char class compl const const_cast continue default delete do double dynamic_cast else enum explicit extern false float for friend goto if inline int long mutable namespace new not not_eq operator or or_eq private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while xor xor_eq 0 ~^()[]{}<>+-/*%=|&!.?:,; /* */ // NULL "'#\\ -1 -1 1000 .f 64 ACCESS ASSIGN BACKSPACE BLANK BLOCKDATA CALL CHARACTER CLOSE COMMON COMPLEX CONTINUE DATA DIMENSION DIRECT DO DOUBLE ELSE END ENDFILE ENTRY EQUIVALENCE ERR EXIST EXTERNAL FILE FMT FORM FORMAT FORMATTED FUNCTION GOTO IF IMPLICIT INQUIRE INTEGER INTRINSIC IOSTAT LOGICAL NAME NAMED NEXTREC NUMBER OPEN OPENED PARAMETER PAUSE PRECISION PRINT PROGRAM READ REAL REC RECL RETURN REWIND SAVE SEQUENTIAL STATUS STOP SUBROUTINE TO UNFORMATED UNIT WRITE 13 .AND. .EQ. .EQV. .FALSE. .GE. .GT. .LE. .LT. .NE. .NEQV. .NOT. .OR. .TRUE. ()+-/*=$.:, NULL NULL ! C* ' 1 0 5 72 .p 35 and array begin case const div do downto else end file for function goto if in label mod nil not of or packed procedure program record repeat set then to type until var while with 0 +-*/=<>[]().,;:@^ { } NULL NULL ' 1 -1 -1 1000 .java 47 abstract boolean break byte case catch char class const continue default do double else extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static super switch synchronized this throw throws transient try void volatile while 0 ~^()[]{}<>+-/*%=|&!.?:,; /* */ // NULL "'#\\ -1 -1 1000 xwpe-1.5.30a/we_hfkt.c0000644000076400007640000001177310263105405013556 0ustar dulsidulsi/* we_hfkt.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "edit.h" #include /* find string in text line */ int e_strstr(int x, int n, unsigned char *s, unsigned char *f) { int i, j, nf = strlen(f); if (x > n) { for (i = x - nf; i >= n; i--) { for (j = 0; j < nf; j++) if (s[i+j] != f[j]) break; if (j == nf) return(i); } } else { for (i = x >= 0 ? x : 0; i <= n - nf /* && s[i] != '\0' && s[i] != WR */; i++) { for (j = 0; j < nf; j++) if (s[i+j] != f[j]) break; if (j == nf) return(i); } } return(-1); } /* Find string in line (ignoring case) */ int e_ustrstr(int x, int n, unsigned char *s, unsigned char *f) { int i, j, nf = strlen(f); if(x > n) { for (i = x-nf; i >= n; i--) { for (j = 0; j < nf; j++) if (e_toupper(s[i+j]) != e_toupper(f[j])) break; if (j == nf) return(i); } } else { for (i = x < 0 ? 0 : x; i <= n - nf; i++) { for (j = 0; j < nf; j++) if (e_toupper(s[i+j]) != e_toupper(f[j])) break; if (j == nf) return(i); } } return(-1); } /* find string in text line (including control chars), case insensitive */ int e_urstrstr(int x, int n, unsigned char *s, unsigned char *f, int *nn) { int i; unsigned char *str; unsigned char *ft = MALLOC((strlen(f)+1)*sizeof(unsigned char)); if (x <= n) { str = MALLOC((n+1)*sizeof(unsigned char)); for (i = 0; i < n; i++) str[i] = e_toupper(s[i]); str[n] = '\0'; } else { str = MALLOC((x+1)*sizeof(unsigned char)); for (i = 0; i < x; i++) str[i] = e_toupper(s[i]); str[x] = '\0'; } for (i = 0; (ft[i] = e_toupper(f[i])) != '\0'; i++) ; i = e_rstrstr(x, n, str, ft, nn); FREE(str); FREE(ft); return(i); } /* find string in text line (including control chars) */ int e_rstrstr(int x, int n, unsigned char *s, unsigned char *f, int *nn) { regex_t *regz; regmatch_t *matches = NULL; int start, end, i, len; int res; unsigned char old; regz = MALLOC(sizeof(regex_t)); if (regcomp(regz,f,REG_EXTENDED)) { free(regz); return (-1); } len = regz->re_nsub; if (len) matches = MALLOC(len*sizeof(regmatch_t)); start = (x < n) ? x : n; end = (n > x) ? n : x; if (start < 0) start = 0; old = s[end];/* Save char */ s[end] = '\0'; res=regexec(regz,&s[start],len,matches,REG_NOTBOL|REG_NOTEOL); s[end] = old;/* Restore char */ regfree(regz); free(regz); if (res != 0) { free(matches); return (-1); /* Can't find any occurences */ } start=strlen(s); end=0; for (i=0;iend) ? matches[i].rm_eo : end; } if (start > end)/* Whole line matches regex */ { end = start; start = 0; } if (matches) free(matches); *nn=end; return start; } /* numbers box (numbers input/edit) */ int e_num_kst(char *s, int num, int max, FENSTER *f, int n, int sw) { int ret, nz = WpeNumberOfPlaces(max); char *tmp = MALLOC((strlen(s)+2) * sizeof(char)); W_OPTSTR *o = e_init_opt_kst(f); if (!o || !tmp) return(-1); o->xa = 20; o->ya = 4; o->xe = 52; o->ye = 10; o->bgsw = 0; o->name = s; o->crsw = AltO; sprintf(tmp, "%s:", s); e_add_numstr(3, 2, 29-nz, 2, nz, max, n, sw, tmp, num, o); FREE(tmp); e_add_bttstr(6, 4, 1, AltO, " Ok ", NULL, o); e_add_bttstr(21, 4, -1, WPE_ESC, "Cancel", NULL, o); ret = e_opt_kst(o); if (ret != WPE_ESC) num = o->nstr[0]->num; freeostr(o); return(num); } /* determine string length */ int e_str_len(unsigned char *s) { int i; for (i = 0; *(s+i) != '\0' && *(s+i) != WPE_WR; i++) ; return (i); } #if 0 /* determine number of chars in a string */ int e_str_nrc(unsigned char *s) { int i; for (i = 0; *(s+i) != '\0'; i++) ; return (i); } /* capitalize letters (German) */ int e_toupper(int c) { if (c >= 'a' && c <= 'z') c = c - 'a' + 'A'; else if (c >= 0xe0 && c <= 0xfe) c = c - 0x20; return (c); } #endif /* COLOR - fill struct with constants */ COLOR e_s_x_clr(int f, int b) { COLOR c; c.f = f; c.b = b; c.fb = 16*b + f; return(c); } COLOR e_n_x_clr(int fb) { COLOR f; f.fb = fb; f.b = fb / 16; f.f = fb % 16; return(f); } COLOR e_s_t_clr(int f, int b) { COLOR c; c.f = f; c.b = b; c.fb = f; return(c); } COLOR e_n_t_clr(int fb) { COLOR f; f.fb = fb; f.b = fb; f.f = fb; return(f); } /* POINT - fill struct with constants */ POINT e_set_pnt(int x, int y) { POINT p; p.x = x; p.y = y; return(p); } int e_pr_uul(FARBE *fb) { extern WOPT *blst; extern int nblst; int i; e_blk(MAXSCOL, 0, MAXSLNS-1, fb->mt.fb); for (i = 0; i < nblst && blst[i].x < MAXSCOL; ++i) e_pr_str_scan(blst[i].x+1, MAXSLNS-1, blst[i].t, fb->mt.fb, blst[i].s, blst[i].n, fb->ms.fb, blst[i].x, i == nblst-1 ? MAXSCOL-1 : blst[i+1].x-1); return(i); } xwpe-1.5.30a/we_main.c0000644000076400007640000004352010263105405013541 0ustar dulsidulsi/* we_main.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ /* Window - Editor (WE) Version 1.0 Copyright by F.Kruse */ /* includes */ #include #include "messages.h" #include "edit.h" #ifdef UNIX #include #include #include "attrb.h" #endif #ifdef DJGPP #include #endif /* externals */ extern char *info_file; extern char *e_tmp_dir; extern char *e_hlp_str[]; extern int col_num; extern FARBE *u_fb, *x_fb; /* globals */ struct CNT *WpeEditor; int fk__cursor = 0; WOPT *eblst, *fblst, *mblst, *dblst, *xblst, *wblst, *rblst; WOPT *ablst, *sblst, *hblst, *gblst, *oblst; char *e_hlp, *user_shell; WOPT *blst; int nblst = 7; #if MOUSE int fk__mouse_stat = 1; struct mouse e_mouse = { 0, 0, 0 }; #endif /* prototypes */ int e_read_help_str(void); /* preinitialized arrays */ char *e_msg[] = { "Not Enough Memory", "Option-File got the Wrong Version", "Can\'t read Option-File", "More Than 35 Windows", "String NOT found", "Can\'t open File %s", /* Number 5 */ "Can\'t close File", "No more Undo", "Execute Command: %s\n", "Command not found", "\nStrike to continue\n", /* Number 10 */ "Not Installed", "Can\'t open Option-File", "Can\'t write to Option-File", "File failed to save", "Not all files saved", /* Number 15 */ "Can\'t Print File", "No more Redo", "Can\'t open directory", "Can\'t open HOME directory", "System error", /* Number 20 */ "Wastebasket is not available", "Can\'t create directory", "Can\'t access file or directory", "Can\'t remove file or directory", "Can\'t link file or directory", /* Number 25 */ "File already exist with \"new.dir\" name", "Cannot change permissions", "Can\'t rename file or directory", "Can\'t open file for reading", "Can\'t open file for writing", /* Number 30 */ "Can\'t allocate buffer for copying", "Inconsistent copying" }; OPT opt[] = { {"#", 3, '#', AltSYS}, {"File", 10, 'F', AltF}, {"Edit", 19, 'E', AltE}, {"Search", 28, 'S', AltS}, {"Block", 39, 'B', AltB}, {"Options", 49, 'O', AltO}, {"Window", 61, 'W', AltW}, {"Help", 72, 'H', AltH} #ifdef PROG , {NULL, 0, 0, 0} , {NULL, 0, 0, 0} #endif #ifdef DEBUGGER , {NULL, 0, 0, 0} #endif }; WOPT eblst_o[] = { {"F1 Help", 0, 0, 2, F1}, {"F2 Save", 9, 0, 2, F2}, {"F3 Files", 18, 0, 2, F3}, {"Alt-F3 Close W.", 28, 0, 6, AF3}, {"F4 Search", 45, 0, 2, F4}, {"^L S.Again", 56, 0, 2, CF4}, {"Alt-X Quit", 68, 0, 5, AltX} }; WOPT eblst_u[] = { {"F1 Help", 0, 0, 2, F1}, {"Alt-F2 Save", 9, 0, 6, AF2}, {"F2 Files", 22, 0, 2, F2}, {"^F4 Close ", 32, 0, 3, CF4}, {"Alt-F3 Srch", 44, 0, 6, AF3}, {"F3 S.Ag.", 57, 0, 2, F3}, {"Alt-F4 Quit", 67, 0, 6, AF4} }; WOPT fblst_o[] = { {"F1 Help", 0, 0, 2, F1}, {"Edit", 10, 0, 1, AltE}, {"Attributes", 17, 0, 1, AltA}, {"Move", 29, 0, 1, AltM}, {"COpy", 35, 1, 1, AltO}, {"Remove", 41, 0, 1, AltR}, {"Alt-F3 Close W.", 49, 0, 6, AF3}, {"Alt-X Quit", 66, 0, 5, AltX} }; WOPT fblst_u[] = { {"F1 Help", 0, 0, 2, F1}, {"Edit", 9, 0, 1, AltE}, {"RePlace", 15, 2, 1, AltP}, {"Move", 24, 0, 1, AltM}, {"DUplicate", 30, 1, 1, AltU}, {"Remove", 41, 0, 1, AltR}, {"^F4 Close W.", 49, 0, 3, CF4}, {"Alt-F4 Quit", 63, 0, 6, AF4} }; WOPT mblst_o[] = { {"F1 Help", 0, 0, 2, F1}, {"PreV. Err.", 9, 3, 1, AltV}, {"NexT Err.", 21, 3, 1, AltT}, {"Compile", 32, 0, 1, AltC}, {"Make", 41, 0, 1, AltM}, {"RUn", 47, 1, 1, AltU}, {"Alt-F3 Close", 52, 0, 6, AF3}, {"Alt-X Quit", 66, 0, 5, AltX} }; WOPT mblst_u[] = { {"F1 Help", 0, 0, 2, F1}, {"PreV. Err.", 9, 3, 1, AltV}, {"NexT Err.", 21, 3, 1, AltT}, {"Compile", 32, 0, 1, AltC}, {"Make", 41, 0, 1, AltM}, {"RUn", 47, 1, 1, AltU}, {"^F4 Close", 52, 0, 3, CF4}, {"Alt-F4 Quit", 63, 0, 6, AF4} }; WOPT dblst_o[] = { {"F1 Help", 0, 0, 2, F1}, {"^F7 Make Watch", 9, 0, 3, CF7}, {"F7 Trace", 25, 0, 2, F7}, {"F8 Step", 34, 0, 2, F8}, {"^F10 Run", 43, 0, 4, F10}, {"Alt-F3 Close", 53, 0, 6, AF3}, {"Alt-X Quit", 67, 0, 5, AltX} }; WOPT dblst_u[] = { {"F1 Help", 0, 0, 2, F1}, {"^F5 Make Watch", 9, 0, 3, CF7}, {"F7 Trace", 25, 0, 2, F7}, {"F8 Step", 34, 0, 2, F8}, {"^F10 Run", 43, 0, 4, F10}, {"^F4 Close", 53, 0, 3, CF4}, {"Alt-F4 Quit", 64, 0, 6, AF4} }; WOPT xblst_o[] = { {"F1 Help", 0, 0, 2, F1}, {"Execute", 19, 0, 1, AltE}, {"Alt-F3 Close W.", 38, 0, 6, AF3}, {"Alt-X Quit", 66, 0, 5, AltX} }; WOPT xblst_u[] = { {"F1 Help", 0, 0, 2, F1}, {"Execute", 19, 0, 1, AltE}, {"^F4 Close W.", 38, 0, 3, CF4}, {"Alt-F4 Quit", 63, 0, 6, AF4} }; WOPT wblst_o[] = { {"F1 Help", 0, 0, 2, F1}, {"Write", 19, 0, 1, AltW}, {"Alt-F3 Close W.", 38, 0, 6, AF3}, {"Alt-X Quit", 66, 0, 5, AltX} }; WOPT wblst_u[] = { {"F1 Help", 0, 0, 2, F1}, {"Write", 19, 0, 1, AltW}, {"^F4 Close W.", 38, 0, 3, CF4}, {"Alt-F4 Quit", 63, 0, 6, AF4} }; WOPT rblst_o[] = { {"F1 Help", 0, 0, 2, F1}, {"Read", 19, 0, 1, AltR}, {"Alt-F3 Close W.", 38, 0, 6, AF3}, {"Alt-X Quit", 66, 0, 5, AltX} }; WOPT rblst_u[] = { {"F1 Help", 0, 0, 2, F1}, {"Read", 19, 0, 1, AltR}, {"^F4 Close W.", 38, 0, 3, CF4}, {"Alt-F4 Quit", 63, 0, 6, AF4} }; WOPT ablst_o[] = { {"F1 Help", 0, 0, 2, F1}, {"Add", 19, 0, 1, AltA}, {"Alt-F3 Close W.", 38, 0, 6, AF3}, {"Alt-X Quit", 66, 0, 5, AltX} }; WOPT ablst_u[] = { {"F1 Help", 0, 0, 2, F1}, {"Add", 19, 0, 1, AltA}, {"^F4 Close W.", 38, 0, 3, CF4}, {"Alt-F4 Quit", 63, 0, 6, AF4} }; WOPT sblst_o[] = { {"F1 Help", 0, 0, 2, F1}, {"Save", 14, 0, 1, AltS}, {"Change Dir", 25, 0, 1, AltC}, {"Alt-F3 Close W.", 42, 0, 6, AF3}, {"Alt-X Quit", 66, 0, 5, AltX} }; WOPT sblst_u[] = { {"F1 Help", 0, 0, 2, F1}, {"Save", 14, 0, 1, AltS}, {"Change Dir", 25, 0, 1, AltC}, {"^F4 Close W.", 42, 0, 3, CF4}, {"Alt-F4 Quit", 66, 0, 6, AF4} }; WOPT hblst_o[] = { {"F1 Help", 0, 0, 2, F1}, {" Back", 9, 0, 5, WPE_DC}, {" Goto", 21, 0, 4, WPE_CR}, {" PreVious", 32, 4, 1, AltV}, {" NexT", 45, 4, 1, AltT}, {"Alt-F3 Close", 54, 0, 6, AF3}, {"Alt-X Quit", 68, 0, 5, AltX} }; WOPT hblst_u[] = { {"F1 Help", 0, 0, 2, F1}, {" Back", 9, 0, 5, WPE_DC}, {" Goto", 21, 0, 4, WPE_CR}, {" PreVious", 32, 4, 1, AltV}, {" NexT", 45, 4, 1, AltT}, {"^F4 Close", 54, 0, 3, CF4}, {"Alt-F4 Quit", 65, 0, 6, AF4} }; WOPT gblst_o[] = { {"F1 Help", 0, 0, 2, F1}, {"Show", 19, 0, 1, AltS}, {"Alt-F3 Close W.", 38, 0, 6, AF3}, {"Alt-X Quit", 66, 0, 5, AltX} }; WOPT gblst_u[] = { {"F1 Help", 0, 0, 2, F1}, {"Show", 19, 0, 1, AltS}, {"^F4 Close W.", 38, 0, 3, CF4}, {"Alt-F4 Quit", 63, 0, 6, AF4} }; WOPT oblst_o[] = { {"F1 Help", 0, 0, 2, F1}, {"Add", 14, 0, 1, AltA}, {"Delete", 25, 0, 1, AltD}, {"Alt-F3 Close W.", 42, 0, 6, AF3}, {"Alt-X Quit", 66, 0, 5, AltX} }; WOPT oblst_u[] = { {"F1 Help", 0, 0, 2, F1}, {"Add", 14, 0, 1, AltA}, {"Delete", 25, 0, 1, AltD}, {"^F4 Close W.", 42, 0, 3, CF4}, {"Alt-F4 Quit", 63, 0, 6, AF4} }; void ECNT_Init(ECNT *cn) { cn->mxedt = -1; cn->curedt = 0; cn->edt[0] = 0; cn->fb = NULL; cn->print_cmd = WpeStrdup(PRNTCMD); cn->dirct = WpeGetCurrentDir(cn); strcpy(cn->fd.search, ""); strcpy(cn->fd.replace, ""); strcpy(cn->fd.file, SUDIR); cn->fd.dirct = WpeStrdup(cn->dirct); cn->fd.sw = 16; cn->fd.sn = 0; cn->fd.rn = 0; cn->sdf = cn->rdf = cn->fdf = cn->ddf = cn->wdf = cn->hdf = cn->shdf = NULL; /* standard adjustments */ cn->dtmd = DTMD_NORMAL; cn->autosv = 0; cn->maxchg = 999; cn->numundo = 10; cn->maxcol = MAXCOLUM; cn->tabn = 8; cn->autoindent = 3; cn->tabs = MALLOC((cn->tabn+1)*sizeof(char)); WpeStringBlank(cn->tabs, cn->tabn); cn->flopt = FM_REKURSIVE_ACTIONS | FM_REMOVE_INTO_WB | FM_MOVE_PROMPT | FM_MOVE_PROMPT | FM_PROMPT_DELETE; cn->edopt = ED_SOURCE_AUTO_INDENT | ED_ERRORS_STOP_AT | ED_SYNTAX_HIGHLIGHT; } int main(int argc, char **argv) { FARBE *fb; ECNT *cn; int i, err = 0, g[4]; int so = 0, sd = 1; char *tp; if ((cn = (ECNT *)MALLOC(sizeof(ECNT))) == NULL) e_error(e_msg[ERR_LOWMEM], 2, fb); ECNT_Init(cn); e_ini_unix(&argc, argv); e_switch_screen(1); fb = e_ini_farbe(); WpeEditor = cn; cn->fb = fb; info_file = MALLOC((strlen(INFO_DIR)+1)*sizeof(char)); strcpy(info_file, INFO_DIR); e_read_help_str(); e_hlp = e_hlp_str[0]; if (!(user_shell = getenv("SHELL"))) user_shell = DEF_SHELL; #ifdef HAVE_MKDTEMP e_tmp_dir = strdup("/tmp/xwpe_XXXXXX"); if (mkdtemp(e_tmp_dir) == NULL) #else #if defined(HAVE_TEMPNAM) e_tmp_dir = tempnam(NULL, "xwpe_"); #else e_tmp_dir = MALLOC(128); sprintf(e_tmp_dir, "/tmp/we_%u", (unsigned) getpid()); e_tmp_dir = REALLOC(e_tmp_dir, (strlen(e_tmp_dir)+1)*sizeof(char)); #endif if ((e_tmp_dir == NULL) || (mkdir(e_tmp_dir, 0700) != 0)) #endif { perror("Xwpe: "); return 1; } for (i = 1; i < argc; i++) { if (*argv[i] == '-') { if (*(argv[i]+1) == 's' && *(argv[i]+2) == 'o') so = 1; else if (*(argv[i]+1) == 's' && *(argv[i]+2) == 'f') { sd = 0; cn->optfile = MALLOC((strlen(argv[i+1])+1)*sizeof(char)); strcpy(cn->optfile, argv[i+1]); } } } #ifdef PROG e_ini_prog(cn); #endif if (sd != 0) { FILE *f = fopen(OPTION_FILE, "r"); if (f) { fclose(f); cn->optfile = e_mkfilename(cn->dirct, OPTION_FILE); } else { cn->optfile = e_mkfilename(getenv("HOME"), XWPE_HOME); cn->optfile = REALLOC(cn->optfile, strlen(cn->optfile) + strlen(OPTION_FILE) + 2); strcat(cn->optfile, DIRS); strcat(cn->optfile, OPTION_FILE); } } if (so == 0) err = e_opt_read(cn); e_edit(cn, ""); /* Clipboard (must first read option file) */ if ((tp = getenv("INFOPATH")) != NULL) { if (info_file) FREE(info_file); info_file = WpeStrdup(tp); } if (cn->edopt & ED_CUA_STYLE) blst = eblst_u; else blst = eblst_o; e_ini_desk(cn); cn->f[0]->blst = eblst; #if MOUSE g[0] = 4; g[2] = 0; g[3] = 0; fk_mouse(g); g[0] = 1; fk_mouse(g); #endif /* this error comes from reading the options file */ if (err > 0) e_error(e_msg[err], 0, cn->fb); if (WpeIsProg()) WpeSyntaxReadFile(cn); #ifdef UNIX for (i = 1; i < argc; i++) if (!strcmp(argv[i], "-r")) e_recover(cn); #endif for (i = 1; i < argc; i++) { if (*argv[i] == '-') { if (*(argv[i]+1) == 's' && *(argv[i]+2) == 'f') i++; #if defined(UNIX) && defined(PROG) else if (*(argv[i]+1) == 'p' && *(argv[i]+2) == 'm') e_we_sw |= 8; #endif continue; } else e_edit(cn, argv[i]); } if (cn->mxedt == 0) WpeManager(cn->f[cn->mxedt]); do { if (cn->f[cn->mxedt]->dtmd == DTMD_FILEMANAGER) i = WpeHandleFileManager(cn); else if (cn->f[cn->mxedt]->dtmd == DTMD_DATA) i = e_data_eingabe(cn); else i = e_eingabe(cn); if (i == AltX) i = e_quit(cn->f[cn->mxedt]); } while (i != AltX); WpeExit(0); return 0; } int e_switch_blst(ECNT *cn) { int i; FENSTER *f; if (cn->edopt & ED_CUA_STYLE) { for (i = 0; i <= cn->mxedt; i++) { f = cn->f[i]; if (f->blst == eblst_o) f->blst = eblst_u; else if (f->blst == fblst_o) f->blst= fblst_u; else if (f->blst == mblst_o) f->blst= mblst_u; else if (f->blst == dblst_o) f->blst= dblst_u; else if (f->blst == xblst_o) f->blst= xblst_u; else if (f->blst == wblst_o) f->blst= wblst_u; else if (f->blst == rblst_o) f->blst= rblst_u; else if (f->blst == ablst_o) f->blst= ablst_u; else if (f->blst == sblst_o) f->blst= sblst_u; else if (f->blst == hblst_o) f->blst= hblst_u; else if (f->blst == gblst_o) f->blst= gblst_u; else if (f->blst == oblst_o) f->blst= oblst_u; } } else { for(i = 0; i <= cn->mxedt; i++) { f = cn->f[i]; if (f->blst == eblst_u) f->blst= eblst_o; else if (f->blst == fblst_u) f->blst= fblst_o; else if (f->blst == mblst_u) f->blst= mblst_o; else if (f->blst == dblst_u) f->blst= dblst_o; else if (f->blst == xblst_u) f->blst= xblst_o; else if (f->blst == wblst_u) f->blst= wblst_o; else if (f->blst == rblst_u) f->blst= rblst_o; else if (f->blst == ablst_u) f->blst= ablst_o; else if (f->blst == sblst_u) f->blst= sblst_o; else if (f->blst == hblst_u) f->blst= hblst_o; else if (f->blst == gblst_u) f->blst= gblst_o; else if (f->blst == oblst_u) f->blst= oblst_o; } } return(0); } void e_ini_desk(ECNT *cn) { extern int e_mn_men; int i; if (cn->edopt & ED_CUA_STYLE) { eblst = eblst_u; fblst = fblst_u; mblst = mblst_u; dblst = dblst_u; xblst = xblst_u; wblst = wblst_u; rblst = rblst_u; ablst = ablst_u; sblst = sblst_u; hblst = hblst_u; gblst = gblst_u; oblst = oblst_u; } else { eblst = eblst_o; fblst = fblst_o; mblst = mblst_o; dblst = dblst_o; xblst = xblst_o; wblst = wblst_o; rblst = rblst_o; ablst = ablst_o; sblst = sblst_o; hblst = hblst_o; gblst = gblst_o; oblst = oblst_o; } e_cls(cn->fb->df.fb, cn->fb->dc); e_blk(MAXSCOL, 0, 0, cn->fb->mt.fb); /* put out the main menu */ for (i = 0; i < MENOPT; ++i) { e_pr_str_wsd(opt[i].x, 0, opt[i].t, cn->fb->mt.fb, 0, 1, cn->fb->ms.fb, ( i == 0 ? 0 : opt[i].x-e_mn_men), (i == MENOPT-1) ? MAXSCOL-1 : opt[i+1].x-e_mn_men-1); } e_pr_uul(cn->fb); } void FARBE_Init(FARBE *fb) { fb->er = e_s_x_clr(15,4); /* Editor Frames */ fb->et = e_s_x_clr(11,4); /* Editor Text */ fb->ez = e_s_x_clr(4,7); /* Editors Text highlighted */ fb->es = e_s_x_clr(10,4); /* Editors Window-Button */ fb->ek = e_s_x_clr(11,6); /* Editors highlighted (find) */ fb->em = e_s_x_clr(4,6); /* Mouse slider bar */ fb->mr = e_s_x_clr(0,7); /* Menu Frame */ fb->mt = e_s_x_clr(0,7); /* Menu Text */ fb->mz = e_s_x_clr(0,2); /* Menu Text highlighted */ fb->ms = e_s_x_clr(1,7); /* Menu-Switch */ fb->nr = e_s_x_clr(15,7); /* Options Frame */ fb->nt = e_s_x_clr(0,7); /* Options Text */ fb->nsnt = e_s_x_clr(11,7);/* Options Text-Switch */ fb->ne = e_s_x_clr(1, 7); /* Options Window-Button */ fb->fr = e_s_x_clr(15,4); /* Editor Control Bar (?) (Schreibleiste) passive */ fb->fa = e_s_x_clr(15,2); /* Editor Control Bar (?) (Schreibleiste) active */ fb->ft = e_s_x_clr(0,6); /* Data Text */ fb->fz = e_s_x_clr(15,2); /* Data active highlighted */ fb->frft = e_s_x_clr(15,6);/* Data passive highlighted */ fb->fs = e_s_x_clr(0,6); /* Switch Text */ fb->nsft = e_s_x_clr(14,6);/* Switch Switch */ fb->fsm = e_s_x_clr(14,6); /* Switch active */ fb->nz = e_s_x_clr(15,2); /* Button Text */ fb->ns = e_s_x_clr(11,2); /* Button Switch */ fb->nm = e_s_x_clr(11,2); /* Button Text highlighted */ fb->hh = e_s_x_clr(12,6); /* Help Header */ fb->hb = e_s_x_clr(11,2); /* Help Button */ fb->hm = e_s_x_clr(10,4); /* Help highlighted */ fb->df = e_s_x_clr(7,0); /* Background */ fb->of = e_s_x_clr(8,0); /* void (unused) */ fb->db = e_s_x_clr(0,1); /* Breakpoint */ fb->dy = e_s_x_clr(12,6); /* Debugger Stop */ fb->ct = e_s_x_clr(11, 4); /* C-Prog. Text */ fb->cr = e_s_x_clr(15, 4); /* C-Prog. res. Words */ fb->ck = e_s_x_clr(14, 4); /* C-Prog. Constants */ fb->cp = e_s_x_clr(10, 4); /* C-Prog. Pre-processor */ fb->cc = e_s_x_clr( 7, 4); /* C-Prog. Comments */ fb->dc = ' '; fb->ws = 7; } FARBE *e_ini_farbe() { if (WpeIsXwin()) { if (!x_fb) x_fb = WpeMalloc(sizeof(FARBE)); FARBE_Init(x_fb); return x_fb; } else { if (!u_fb) u_fb = WpeMalloc(sizeof(FARBE)); if (col_num) { FARBE_Init(u_fb); } else { u_fb->er = e_n_t_clr(0); u_fb->et = e_n_t_clr(0); u_fb->ez = e_n_t_clr(A_REVERSE); u_fb->es = e_n_t_clr(0); u_fb->ek = e_n_t_clr(A_UNDERLINE); u_fb->em = e_n_t_clr(A_STANDOUT); u_fb->mr = e_n_t_clr(A_STANDOUT); u_fb->mt = e_n_t_clr(A_STANDOUT); u_fb->mz = e_n_t_clr(0); u_fb->ms = e_n_t_clr(0); u_fb->nr = e_n_t_clr(A_STANDOUT); u_fb->nt = e_n_t_clr(A_REVERSE); u_fb->nsnt = e_n_t_clr(A_BOLD); u_fb->ne = e_n_t_clr(0); u_fb->fr = e_n_t_clr(0); u_fb->fa = e_n_t_clr(A_REVERSE); u_fb->ft = e_n_t_clr(0); u_fb->fz = e_n_t_clr(A_STANDOUT); u_fb->frft = e_n_t_clr(0); u_fb->fs = e_n_t_clr(0); u_fb->nsft = e_n_t_clr(A_BOLD); u_fb->fsm = e_n_t_clr(A_BOLD); u_fb->nz = e_n_t_clr(0); u_fb->ns = e_n_t_clr(A_BOLD); u_fb->nm = e_n_t_clr(A_BOLD); u_fb->hh = e_n_t_clr(A_REVERSE); u_fb->hb = e_n_t_clr(A_REVERSE); u_fb->hm = e_n_t_clr(A_BOLD); u_fb->of = e_n_t_clr(A_STANDOUT); u_fb->df = e_n_t_clr(0); u_fb->db = e_n_t_clr(A_STANDOUT); u_fb->dy = e_n_t_clr(A_STANDOUT); u_fb->ct = e_n_t_clr(0); u_fb->cr = e_n_t_clr(0); u_fb->ck = e_n_t_clr(0); u_fb->cp = e_n_t_clr(0); u_fb->cc = e_n_t_clr(0); u_fb->dc = 0x20; u_fb->ws = 0; } return u_fb; } } void e_free_find(FIND *fd) { if (fd->dirct) { free(fd->dirct); fd->dirct = NULL; } } xwpe-1.5.30a/we_menue.c0000644000076400007640000006427410263105405013737 0ustar dulsidulsi/* we_menue.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "messages.h" #include "edit.h" int e_p_show_messages(FENSTER *f); int e_p_show_watches(FENSTER *f); int e_blck_gt_beg(FENSTER *f); int e_blck_gt_end(FENSTER *f); int e_blck_mrk_line(FENSTER *f); int e_blck_mrk_all(FENSTER *f); int e_blck_to_left(FENSTER *f); int e_blck_to_right(FENSTER *f); int e_cl_project(FENSTER *f); int e_p_add_item(FENSTER *f); int e_p_del_item(FENSTER *f); int e_show_project(FENSTER *f); int e_info(FENSTER *f); int e_help_options(FENSTER *f); int e_hp_ret(FENSTER *f); int e_hp_back(FENSTER *f); int e_hp_prev(FENSTER *f); int e_hp_next(FENSTER *f); /* main menu control bar */ int WpeHandleMainmenu(int n, FENSTER *f) { extern int e_mn_men; int i, c = 255, nold = n <= 0 ? 1 : n - 1; extern OPT opt[]; extern char *e_hlp, *e_hlp_str[]; ECNT *cn = f->ed; MENU *mainmenu = MALLOC(MENOPT * sizeof(MENU)); for(i = 0; i < MENOPT; i++) mainmenu[i].width = 0; fk_cursor(0); if(n < 0) n = 0; else c = WPE_CR; #ifdef UNIX #ifdef NEWSTYLE if(WpeIsXwin()) mainmenu[0].position = -3; else #endif mainmenu[0].position = -2; mainmenu[0].no_of_items = 6; mainmenu[0].width = 23; #else mainmenu[0].position = -3; mainmenu[0].no_of_items = 4; mainmenu[0].width = 20; #endif if((mainmenu[0].menuitems = MALLOC(mainmenu[0].no_of_items * sizeof(OPTK))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); mainmenu[0].menuitems[0] = WpeFillSubmenuItem("About WE", 0, 'A', e_about_WE); mainmenu[0].menuitems[1] = WpeFillSubmenuItem("Clear Desktop", 0, 'C', e_clear_desk); mainmenu[0].menuitems[2] = WpeFillSubmenuItem("Repaint Desktop", 0, 'R', e_repaint_desk); mainmenu[0].menuitems[3] = WpeFillSubmenuItem("System Info", 0, 'S', e_sys_info); #ifdef UNIX mainmenu[0].menuitems[4] = WpeFillSubmenuItem("Show Wastebasket", 5, 'W', WpeShowWastebasket); mainmenu[0].menuitems[5] = WpeFillSubmenuItem("Delete Wastebasket", 0, 'D', WpeDelWastebasket); #endif mainmenu[1].position = -3; #ifdef UNIX mainmenu[1].width = 24; mainmenu[1].no_of_items = 11; if((mainmenu[1].menuitems = MALLOC(mainmenu[1].no_of_items * sizeof(OPTK))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); if(f->ed->edopt & ED_CUA_STYLE) { mainmenu[1].menuitems[0] = WpeFillSubmenuItem("File-Manager F2", 0, 'M', WpeManager); mainmenu[1].menuitems[2] = WpeFillSubmenuItem("Save Alt F2", 0, 'S', e_m_save); mainmenu[1].menuitems[10] = WpeFillSubmenuItem("Quit Alt F4", 0, 'Q', e_quit); } else { mainmenu[1].menuitems[0] = WpeFillSubmenuItem("File-Manager F3", 0, 'M', WpeManager); mainmenu[1].menuitems[2] = WpeFillSubmenuItem("Save F2", 0, 'S', e_m_save); mainmenu[1].menuitems[10] = WpeFillSubmenuItem("Quit Alt X", 0, 'Q', e_quit); } mainmenu[1].menuitems[1] = WpeFillSubmenuItem("New", 0, 'N', e_new); mainmenu[1].menuitems[3] = WpeFillSubmenuItem("Save As", 5, 'A', WpeSaveAsManager); mainmenu[1].menuitems[4] = WpeFillSubmenuItem("Save aLl", 6, 'L', e_saveall); mainmenu[1].menuitems[5] = WpeFillSubmenuItem("Execute", 0, 'E', WpeExecuteManager); mainmenu[1].menuitems[6] = WpeFillSubmenuItem("SHell", 1, 'H', WpeShell); mainmenu[1].menuitems[7] = WpeFillSubmenuItem("Find", 0, 'F', WpeFindWindow); mainmenu[1].menuitems[8] = WpeFillSubmenuItem("Grep", 0, 'G', WpeGrepWindow); mainmenu[1].menuitems[9] = WpeFillSubmenuItem("Print File", 0, 'P', WpePrintFile); #endif mainmenu[2].position = -3; mainmenu[2].width = 27; #if !defined(NO_XWINDOWS) && !defined(DJGPP) if(WpeIsXwin()) mainmenu[2].no_of_items = 9; else #endif mainmenu[2].no_of_items = 7; if((mainmenu[2].menuitems = MALLOC(mainmenu[2].no_of_items * sizeof(OPTK))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); mainmenu[2].menuitems[0] = WpeFillSubmenuItem("Cut Shift Del / ^X", 2, 'T', e_edt_del); mainmenu[2].menuitems[1] = WpeFillSubmenuItem("Copy ^Ins / ^C", 0, 'C', e_edt_copy); mainmenu[2].menuitems[2] = WpeFillSubmenuItem("Paste Shift Ins / ^V", 0, 'P', e_edt_einf); mainmenu[2].menuitems[3] = WpeFillSubmenuItem("Show Buffer ^W", 0, 'S', e_show_clipboard); mainmenu[2].menuitems[4] = WpeFillSubmenuItem("Delete ^Del", 0, 'D', e_blck_del); mainmenu[2].menuitems[5] = WpeFillSubmenuItem("Undo ^U", 0, 'U', e_make_undo); mainmenu[2].menuitems[6] = WpeFillSubmenuItem("Redo ^R", 0, 'R', e_make_redo); #ifndef NO_XWINDOWS if(WpeIsXwin()) { mainmenu[2].menuitems[7] = WpeFillSubmenuItem("PAste(XBuffer) Alt Ins", 0, 'A', e_u_copy_X_buffer); mainmenu[2].menuitems[8] = WpeFillSubmenuItem("COpy(XBuffer) Alt Del", 0, 'O', e_u_paste_X_buffer); } #endif mainmenu[3].position = -3; mainmenu[3].width = 28; mainmenu[3].no_of_items = 4; if((mainmenu[3].menuitems = MALLOC(mainmenu[3].no_of_items * sizeof(OPTK))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); if(f->ed->edopt & ED_CUA_STYLE) { mainmenu[3].menuitems[0] = WpeFillSubmenuItem("Find Alt F3 / ^O F", 0, 'F', e_find); mainmenu[3].menuitems[1] = WpeFillSubmenuItem("Replace Shift F3 / ^O A", 0, 'R', e_replace); mainmenu[3].menuitems[2] = WpeFillSubmenuItem("Search again F3", 0, 'S', e_rep_search); } else { mainmenu[3].menuitems[0] = WpeFillSubmenuItem("Find F4 / ^O F", 0, 'F', e_find); mainmenu[3].menuitems[1] = WpeFillSubmenuItem("Replace Alt F4 / ^O A", 0, 'R', e_replace); mainmenu[3].menuitems[2] = WpeFillSubmenuItem("Search again ^L", 0, 'S', e_rep_search); } mainmenu[3].menuitems[3] = WpeFillSubmenuItem("Go to Line Alt G", 0, 'G', e_goto_line); mainmenu[4].position = -3; mainmenu[4].width = 25; mainmenu[4].no_of_items = 15; if((mainmenu[4].menuitems = MALLOC(mainmenu[4].no_of_items * sizeof(OPTK))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); mainmenu[4].menuitems[0] = WpeFillSubmenuItem("Begin Mark ^K B", 0, 'B', e_blck_begin); mainmenu[4].menuitems[1] = WpeFillSubmenuItem("End Mark ^K K", 0, 'E', e_blck_end); mainmenu[4].menuitems[2] = WpeFillSubmenuItem("Mark WhOle ^K X", 7, 'O', e_blck_mrk_all); mainmenu[4].menuitems[3] = WpeFillSubmenuItem("Mark Line ^K L", 5, 'L', e_blck_mrk_line); mainmenu[4].menuitems[4] = WpeFillSubmenuItem("Goto Begin ^K A", 0, 'G', e_blck_gt_beg); mainmenu[4].menuitems[5] = WpeFillSubmenuItem("Goto ENd ^K Z", 6, 'N', e_blck_gt_end); mainmenu[4].menuitems[6] = WpeFillSubmenuItem("Copy ^K C", 0, 'C', e_blck_copy); mainmenu[4].menuitems[7] = WpeFillSubmenuItem("Move ^K V", 0, 'M', e_blck_move); mainmenu[4].menuitems[8] = WpeFillSubmenuItem("Delete ^K Y", 0, 'D', e_blck_del); mainmenu[4].menuitems[9] = WpeFillSubmenuItem("Hide ^K H", 0, 'H', e_blck_hide); mainmenu[4].menuitems[10] = WpeFillSubmenuItem("Read ^K R", 0, 'R', e_blck_read); mainmenu[4].menuitems[11] = WpeFillSubmenuItem("Write ^K W", 0, 'W', e_blck_write); mainmenu[4].menuitems[12] = WpeFillSubmenuItem("Move to RIght ^K I", 9, 'I', e_blck_to_right); mainmenu[4].menuitems[13] = WpeFillSubmenuItem("Move to LefT ^K U", 11, 'T', e_blck_to_left); mainmenu[4].menuitems[14] = WpeFillSubmenuItem("ChAnge Case ^K D", 2, 'A', e_changecase_dialog); #ifdef PROG if(WpeIsProg()) { mainmenu[5].position = -3; mainmenu[5].width = 35; mainmenu[5].no_of_items = 12; if((mainmenu[5].menuitems = MALLOC(mainmenu[5].no_of_items * sizeof(OPTK))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); mainmenu[5].menuitems[0] = WpeFillSubmenuItem("Compile Alt F9 / Alt C", 0, 'C', e_compile); mainmenu[5].menuitems[1] = WpeFillSubmenuItem("Make F9 / Alt M", 0, 'M', e_p_make); mainmenu[5].menuitems[2] = WpeFillSubmenuItem("Run ^F9 / Alt U", 0, 'R', e_run); mainmenu[5].menuitems[3] = WpeFillSubmenuItem("Install Alt L", 0, 'I', e_install); mainmenu[5].menuitems[4] = WpeFillSubmenuItem("Execute Make Alt A", 0, 'E', e_exec_make); mainmenu[5].menuitems[5] = WpeFillSubmenuItem("Next Error Alt F8 / Alt T", 0, 'N', e_next_error); mainmenu[5].menuitems[6] = WpeFillSubmenuItem("Previous Error Alt F7 / Alt V", 0, 'P', e_previous_error); mainmenu[5].menuitems[7] = WpeFillSubmenuItem("Show Definition ^O S", 0, 'S', e_sh_def); mainmenu[5].menuitems[8] = WpeFillSubmenuItem("Show NeXt Definition ^O N", 7, 'X', e_sh_nxt_def); mainmenu[5].menuitems[9] = WpeFillSubmenuItem("Matching BracKet ^O K", 13, 'K', e_nxt_brk); mainmenu[5].menuitems[10] = WpeFillSubmenuItem("Beautify ^O B", 0, 'B', e_p_beautify); mainmenu[5].menuitems[11] = WpeFillSubmenuItem("Arguments ", 0, 'A', e_arguments); mainmenu[MENOPT - 4].position = -3; mainmenu[MENOPT - 4].width = 23; mainmenu[MENOPT - 4].no_of_items = 5; if((mainmenu[MENOPT - 4].menuitems = MALLOC(mainmenu[MENOPT - 4].no_of_items * sizeof(OPTK))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); mainmenu[MENOPT - 4].menuitems[0] = WpeFillSubmenuItem("Open Project", 5, 'P', e_project); mainmenu[MENOPT - 4].menuitems[1] = WpeFillSubmenuItem("Close Project", 0, 'C', e_cl_project); mainmenu[MENOPT - 4].menuitems[2] = WpeFillSubmenuItem("Add Item", 0, 'A', e_p_add_item); mainmenu[MENOPT - 4].menuitems[3] = WpeFillSubmenuItem("Delete Item", 0, 'D', e_p_del_item); mainmenu[MENOPT - 4].menuitems[4] = WpeFillSubmenuItem("Options", 0, 'O', e_project_options); } #endif #ifdef DEBUGGER if(WpeIsProg()) { mainmenu[MENOPT - 5].position = -3; mainmenu[MENOPT - 5].width = 33; mainmenu[MENOPT - 5].no_of_items = 13; if((mainmenu[MENOPT - 5].menuitems = MALLOC(mainmenu[MENOPT - 5].no_of_items * sizeof(OPTK))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); if(f->ed->edopt & ED_CUA_STYLE) { mainmenu[MENOPT - 5].menuitems[0] = WpeFillSubmenuItem("Toggle Breakpoint F5 / ^G B", 7, 'B', e_breakpoint); mainmenu[MENOPT - 5].menuitems[2] = WpeFillSubmenuItem("Make Watch ^F5 / ^G W", 5, 'W', e_make_watches); mainmenu[MENOPT - 5].menuitems[6] = WpeFillSubmenuItem("Show stacK ^F3 / ^G K", 9, 'K', e_deb_stack); } else { mainmenu[MENOPT - 5].menuitems[0] = WpeFillSubmenuItem("Toggle Breakpoint ^F8 / ^G B", 7, 'B', e_breakpoint); mainmenu[MENOPT - 5].menuitems[2] = WpeFillSubmenuItem("Make Watch ^F7 / ^G W", 5, 'W', e_make_watches); mainmenu[MENOPT - 5].menuitems[6] = WpeFillSubmenuItem("Show stacK ^F6 / ^G K", 9, 'K', e_deb_stack); } mainmenu[MENOPT - 5].menuitems[1] = WpeFillSubmenuItem("ReMove all Breakp. ^G M", 2, 'M', e_remove_breakpoints); mainmenu[MENOPT - 5].menuitems[3] = WpeFillSubmenuItem("Edit watch ^G E", 0, 'E', e_edit_watches); mainmenu[MENOPT - 5].menuitems[4] = WpeFillSubmenuItem("Delete watch ^G D", 0, 'D', e_delete_watches); mainmenu[MENOPT - 5].menuitems[5] = WpeFillSubmenuItem("Remove All watches ^G A", 7, 'A', e_remove_all_watches); mainmenu[MENOPT - 5].menuitems[7] = WpeFillSubmenuItem("Goto cursor ^G U", 0, 'U', e_d_goto_cursor); mainmenu[MENOPT - 5].menuitems[8] = WpeFillSubmenuItem("Finish function ^G F", 0, 'F', e_d_finish_func); mainmenu[MENOPT - 5].menuitems[9] = WpeFillSubmenuItem("Trace F7 / ^G T", 0, 'T', e_deb_trace); mainmenu[MENOPT - 5].menuitems[10] = WpeFillSubmenuItem("Step F8 / ^G S", 0, 'S', e_deb_next); mainmenu[MENOPT - 5].menuitems[11] = WpeFillSubmenuItem("Run/Continue ^F10 / ^G R", 0, 'R', e_deb_run); mainmenu[MENOPT - 5].menuitems[12] = WpeFillSubmenuItem("Quit ^F2 / ^G Q", 0, 'Q', e_d_quit); } #endif mainmenu[MENOPT - 3].position = -4; mainmenu[MENOPT - 3].width = 22; #ifdef PROG if(WpeIsProg()) #ifdef DEBUGGER mainmenu[MENOPT - 3].no_of_items = 8; #else mainmenu[MENOPT - 3].no_of_items = 7; #endif else #endif mainmenu[MENOPT - 3].no_of_items = 5; if((mainmenu[MENOPT - 3].menuitems = MALLOC(mainmenu[MENOPT - 3].no_of_items * sizeof(OPTK))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); mainmenu[MENOPT - 3].menuitems[0] = WpeFillSubmenuItem("Adjust Colors", 0, 'A', e_ad_colors); mainmenu[MENOPT - 3].menuitems[1] = WpeFillSubmenuItem("Save Options", 0, 'S', e_opt_save); mainmenu[MENOPT - 3].menuitems[2] = WpeFillSubmenuItem("Editor", 0, 'E', e_edt_options); mainmenu[MENOPT - 3].menuitems[3] = WpeFillSubmenuItem("File-Manager", 0, 'F', WpeFileManagerOptions); mainmenu[MENOPT - 3].menuitems[4] = WpeFillSubmenuItem("Help", 0, 'H', e_help_options); #ifdef PROG if(WpeIsProg()) { mainmenu[MENOPT - 3].menuitems[5] = WpeFillSubmenuItem("ProGramming", 3, 'G', e_program_opt); mainmenu[MENOPT - 3].menuitems[6] = WpeFillSubmenuItem("Compiler", 0, 'C', e_run_options); #ifdef DEBUGGER mainmenu[MENOPT - 3].menuitems[7] = WpeFillSubmenuItem("Debugger", 0, 'D', e_deb_options); #endif } #endif #ifdef NEWSTYLE if(WpeIsXwin()) mainmenu[MENOPT - 2].position = -13; else #endif mainmenu[MENOPT - 2].position = -14; mainmenu[MENOPT - 2].width = 28; #ifdef DJGPP #ifdef PROG mainmenu[MENOPT - 2].no_of_items = 10; #else mainmenu[MENOPT - 2].no_of_items = 8; #endif #else #ifdef UNIX #ifdef PROG if(WpeIsProg()) #ifdef DEBUGGER mainmenu[MENOPT - 2].no_of_items = !WpeIsXwin()? 11 : 10; #else mainmenu[MENOPT - 2].no_of_items = !WpeIsXwin()? 10 : 9; #endif else #endif mainmenu[MENOPT - 2].no_of_items = !WpeIsXwin()? 8 : 7; #else mainmenu[MENOPT - 2].no_of_items = !WpeIsXwin()? 7 : 6; #endif #endif if((mainmenu[MENOPT - 2].menuitems = MALLOC(mainmenu[MENOPT - 2].no_of_items * sizeof(OPTK))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); if(f->ed->edopt & ED_CUA_STYLE) { mainmenu[MENOPT - 2].menuitems[0] = WpeFillSubmenuItem("Size/Move ^L", 0, 'S', e_size_move); mainmenu[MENOPT - 2].menuitems[1] = WpeFillSubmenuItem("Zoom Shift F6 / Alt Z", 0, 'Z', e_ed_zoom); mainmenu[MENOPT - 2].menuitems[4] = WpeFillSubmenuItem("Next ^F6 / Alt N", 2, 'X', e_ed_next); mainmenu[MENOPT - 2].menuitems[5] = WpeFillSubmenuItem("Close ^F4 / Alt X", 0, 'C', e_close_window); } else { mainmenu[MENOPT - 2].menuitems[0] = WpeFillSubmenuItem("Size/Move Alt F2", 0, 'S', e_size_move); mainmenu[MENOPT - 2].menuitems[1] = WpeFillSubmenuItem("Zoom F5 / Alt Z", 0, 'Z', e_ed_zoom); mainmenu[MENOPT - 2].menuitems[4] = WpeFillSubmenuItem("Next F6 / Alt N", 2, 'X', e_ed_next); mainmenu[MENOPT - 2].menuitems[5] = WpeFillSubmenuItem("Close Alt F3", 0, 'C', e_close_window); } mainmenu[MENOPT - 2].menuitems[2] = WpeFillSubmenuItem("Tile Shift F4", 0, 'T', e_ed_tile); mainmenu[MENOPT - 2].menuitems[3] = WpeFillSubmenuItem("Cascade Shift F5", 1, 'A', e_ed_cascade); mainmenu[MENOPT - 2].menuitems[6] = WpeFillSubmenuItem("List All Alt 0", 0, 'L', e_list_all_win); #ifndef DJGPP if(!WpeIsXwin()) #endif mainmenu[MENOPT - 2].menuitems[7] = WpeFillSubmenuItem("Output Alt F5 / ^G P", 0, 'O', e_u_deb_out); #ifdef PROG if(WpeIsProg()) { mainmenu[MENOPT - 2].menuitems[mainmenu[MENOPT - 2].no_of_items - 2] = WpeFillSubmenuItem("Messages", 0, 'M', e_p_show_messages); mainmenu[MENOPT - 2].menuitems[mainmenu[MENOPT - 2].no_of_items - 1] = WpeFillSubmenuItem("Project", 0, 'P', e_show_project); #ifdef DEBUGGER mainmenu[MENOPT - 2].menuitems[mainmenu[MENOPT - 2].no_of_items - 3] = WpeFillSubmenuItem("Watches", 0, 'W', e_p_show_watches); #endif } #endif #ifdef NEWSTYLE if(WpeIsXwin()) mainmenu[MENOPT - 1].position = -21; else #endif mainmenu[MENOPT - 1].position = -22; mainmenu[MENOPT - 1].width = 27; #if defined(PROG) && !defined(DJGPP) mainmenu[MENOPT - 1].no_of_items = 8; #else mainmenu[MENOPT - 1].no_of_items = 6; #endif if((mainmenu[MENOPT - 1].menuitems = MALLOC(mainmenu[MENOPT - 1].no_of_items * sizeof(OPTK))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); mainmenu[MENOPT - 1].menuitems[0] = WpeFillSubmenuItem("Editor F1", 0, 'E', e_help); #if defined(PROG) && !defined(DJGPP) mainmenu[MENOPT - 1].menuitems[1] = WpeFillSubmenuItem("Topic Search ^F1", 0, 'T', e_topic_search); mainmenu[MENOPT - 1].menuitems[2] = WpeFillSubmenuItem("FUnction Index Alt F1", 1, 'U', e_funct_in); /* mainmenu[MENOPT-1].menuitems[2] = WpeFillSubmenuItem("Functions Alt F1", 0, 'F', e_funct); */ #endif mainmenu[MENOPT - 1].menuitems[mainmenu[MENOPT - 1].no_of_items - 5] = WpeFillSubmenuItem("Info ", 0, 'I', e_info); mainmenu[MENOPT - 1].menuitems[mainmenu[MENOPT - 1].no_of_items - 4] = WpeFillSubmenuItem("Goto ", 0, 'G', e_hp_ret); mainmenu[MENOPT - 1].menuitems[mainmenu[MENOPT - 1].no_of_items - 3] = WpeFillSubmenuItem("Back ", 0, 'B', e_hp_back); mainmenu[MENOPT - 1].menuitems[mainmenu[MENOPT - 1].no_of_items - 2] = WpeFillSubmenuItem("Next Alt F8 / Alt T", 0, 'G', e_hp_next); mainmenu[MENOPT - 1].menuitems[mainmenu[MENOPT - 1].no_of_items - 1] = WpeFillSubmenuItem("Prev. Alt F7 / Alt V", 0, 'P', e_hp_prev); /* check for valid n */ if(n < 0 || n > MENOPT - 1) n = 0; /* go until the user leaves the main control bar */ while(c != WPE_ESC) { f = cn->f[cn->mxedt]; if(e_tst_dfkt(f, c) == 0) { c = 0; break; } /* check for a menu shortcut */ for(i = 0; i < MENOPT; i++) if(c == opt[i].s || c == opt[i].as) { n = i; c = WPE_CR; } /* if the selection is not the same as before do some drawing */ if(nold != n) { /* paint unselected the option */ e_pr_str_wsd(opt[nold].x, 0, opt[nold].t, f->fb->mt.fb, 0, 1, f->fb->ms.fb, (nold == 0 ? 0 : opt[nold].x - e_mn_men), (nold == MENOPT - 1) ? MAXSCOL - 1 : opt[nold + 1].x - e_mn_men - 1); /* paint selected the option */ e_pr_str_wsd(opt[n].x, 0, opt[n].t, f->fb->mz.fb, 0, 1, f->fb->mz.fb, (n == 0 ? 0 : opt[n].x - e_mn_men), (n == MENOPT - 1) ? MAXSCOL - 1 : opt[n + 1].x - e_mn_men - 1); /* store the selected menu option for later use */ nold = n; } if(c == WPE_CR) #ifdef PROG #ifdef DEBUGGER { if(!WpeIsProg() && n > 4) e_hlp = e_hlp_str[9 + n]; else e_hlp = e_hlp_str[6 + n]; #else { if(!WpeIsProg() && n > 4) e_hlp = e_hlp_str[8 + n]; else e_hlp = e_hlp_str[6 + n]; #endif #else { e_hlp = e_hlp_str[6 + n]; #endif /* Handle user interaction with the submenu. If the user moved to another main option, the function returns. */ if(mainmenu[n].width != 0) c = WpeHandleSubmenu(opt[n].x + mainmenu[n].position, 1, opt[n].x + mainmenu[n].width + mainmenu[n].position, mainmenu[n].no_of_items + 2, n, mainmenu[n].menuitems, f); if(c < MENOPT) { n = c; c = WPE_CR; } else if(c != WPE_ESC) c = 0; } else { e_hlp = e_hlp_str[24]; #if MOUSE if((c = e_getch()) == -1) c = e_m1_mouse(); #else c = e_getch(); #endif c = e_toupper(c); } if(c == CDO || c == CtrlN) /* down -> submenu open */ c = WPE_CR; else if(c == CLE || c == CtrlB) /* going left in the main menu */ n--; else if(c == CRI || c == CtrlF) /* going right in the main menu */ n++; else if(c == POS1 || c == CtrlA) /* most left in the main menu */ n = 0; else if(c == ENDE || c == CtrlE) /* most right in the main menu */ n = MENOPT - 1; else if(c == AltX) /* quit the whole business */ c = e_quit(f); /* adjust the selected main menu */ if(n < 0) n = MENOPT - 1; else if(n >= MENOPT) n = 0; } /* paint unselected the last selected main menu option */ f = cn->f[cn->mxedt]; e_pr_str_wsd(opt[nold].x, 0, opt[nold].t, f->fb->mt.fb, 0, 1, f->fb->ms.fb, (nold == 0 ? 0 : opt[nold].x - e_mn_men), (nold == MENOPT - 1) ? MAXSCOL - 1 : opt[nold + 1].x - e_mn_men - 1); /* free up the submenu structure */ for(i = 0; i < MENOPT; i++) if(mainmenu[i].width != 0) FREE(mainmenu[i].menuitems); FREE(mainmenu); fk_cursor(1); return(c); } /* sub menu box */ int WpeHandleSubmenu(int xa, int ya, int xe, int ye, int nm, OPTK * fopt, FENSTER * f) { #if MOUSE extern struct mouse e_mouse; extern int e_mn_men; #endif PIC *pic; int i, n = 0, nold = 1, c = 0; extern OPT opt[]; /* save whatever will be behind the submenu */ #ifdef NEWSTYLE if(WpeIsXwin()) pic = e_open_view(xa + 1, ya, xe - 1, ye, f->fb->mt.fb, 1); else #endif pic = e_open_view(xa, ya, xe, ye, f->fb->mt.fb, 1); if(pic == NULL) { e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(WPE_ESC); } /* draw the frame and the background of the submenu */ e_std_rahmen(xa + 1, ya, xe - 1, ye, NULL, 0, f->fb->mr.fb, 0); /* draw the submenu items (colors are default, none selected) */ for(i = ya + 1; i < ye; i++) e_pr_str_scan(xa + 3, i, fopt[i - ya - 1].t, f->fb->mt.fb, fopt[i - ya - 1].x, 1, f->fb->ms.fb, xa + 2, xe - 2); #if MOUSE /* show the actual changes */ e_refresh(); /* until mouse button released */ while(e_mshit() != 0) { c = -1; /* mouse is in the range of the submenu */ if(e_mouse.y > ya && e_mouse.y < ye) { n = e_mouse.y - ya - 1; /* if a new item is selected */ if(nold != n) { /* check whether nold is in the range of the available items and unselect it */ if(nold < ye - ya - 1 && nold >= 0) e_pr_str_scan(xa + 3, nold + ya + 1, fopt[nold].t, f->fb->mt.fb, fopt[nold].x, 1, f->fb->ms.fb, xa + 2, xe - 2); /* draw the newly selected item */ e_pr_str_scan(xa + 3, n + ya + 1, fopt[n].t, f->fb->mz.fb, fopt[n].x, 1, f->fb->mz.fb, xa + 2, xe - 2); /* save the selection */ nold = n; e_refresh(); } } /* mouse is in the main menu area */ else if(e_mouse.y == 0) { /* search for the selected main menu option */ for(i = 1; i < MENOPT; i++) if(e_mouse.x < opt[i].x - e_mn_men) break; /* check whether a new menu option has been selected */ if(i != nm + 1) { /* if yes, restore what was behind */ e_close_view(pic, 1); return(i - 1); } } } /* there was a selection and mouse is within the submenu !!! */ if(c < 0 && e_mouse.y > ya && e_mouse.y < ye && e_mouse.x > xa && e_mouse.x < xe) c = MBKEY; #endif while(c != WPE_ESC) { if(nold != n) { /* check whether nold is in the range of the available items and unselect it */ if(nold < ye - ya - 1 && nold >= 0) e_pr_str_scan(xa + 3, nold + ya + 1, fopt[nold].t, f->fb->mt.fb, fopt[nold].x, 1, f->fb->ms.fb, xa + 2, xe - 2); /* draw the newly selected item */ e_pr_str_scan(xa + 3, n + ya + 1, fopt[n].t, f->fb->mz.fb, fopt[n].x, 1, f->fb->mz.fb, xa + 2, xe - 2); /* save the selection */ nold = n; } #if MOUSE if(c != MBKEY) { if((c = e_toupper(e_getch())) == -1) c = e_m2_mouse(xa, ya, xe, ye, fopt); } else c = WPE_CR; /* mouse released at a proper place, submenu item accepted */ #else c = e_toupper(e_getch()); #endif /* check main menu shortcut keys */ for(i = 0; i < MENOPT; i++) if(c == opt[i].as) { e_close_view(pic, 1); return(i); } /* check submenu items' shortcut keys */ for(i = 0; i < ye - ya - 1; i++) if(c == fopt[i].o) { e_close_view(pic, 1); fopt[i].fkt(f); return(WPE_ESC); } if(c == Alt0) c = WPE_ESC; if(i > ye - ya) c = WPE_ESC; else if(c == WPE_CR) /* submenu item accepted */ { e_close_view(pic, 1); fopt[n].fkt(f); return(WPE_ESC); } else if(c == CUP || c == CtrlP) /* going up in the submenu */ n = n > 0 ? n - 1 : ye - ya - 2; else if(c == CDO || c == CtrlN) /* going down in the submenu */ n = n < ye - ya - 2 ? n + 1 : 0; else if(c == CLE || c == CtrlB) /* going left in the main menu */ { c = nm > 0 ? nm - 1 : MENOPT - 1; break; } else if(c == CRI || c == CtrlF) /* going right in the main menu */ { c = nm < MENOPT - 1 ? nm + 1 : 0; break; } else if(c == POS1 || c == CtrlA) /* to the top in the submenu */ n = 0; else if(c == ENDE || c == CtrlE) /* to the bottom in the submenu */ n = ye - ya - 2; else { /* this is the anything else case, ESC, keys which are not listed in the submenu */ e_close_view(pic, 1); if(c != WPE_ESC && e_tst_dfkt(f, c) == 0) return(WPE_ESC); #ifdef NEWSTYLE pic = e_open_view(xa + 1, ya, xe - 1, ye, f->fb->mt.fb, 1); #else pic = e_open_view(xa, ya, xe, ye, f->fb->mt.fb, 1); #endif /* draw the frame for the submenu */ e_std_rahmen(xa + 1, ya, xe - 1, ye, NULL, 0, f->fb->mr.fb, 0); /* draw every item in the submenu, unselected */ for(i = ya + 1; i < ye; i++) e_pr_str_scan(xa + 3, i, fopt[i - ya - 1].t, f->fb->mt.fb, fopt[i - ya - 1].x, 1, f->fb->ms.fb, xa + 2, xe - 2); /* draw the selected item */ e_pr_str_scan(xa + 3, n + ya + 1, fopt[n].t, f->fb->mz.fb, fopt[n].x, 1, f->fb->mz.fb, xa + 2, xe - 2); } } e_close_view(pic, 1); return(c == WPE_ESC ? 255 : c); } /* fill "options" struct */ OPTK WpeFillSubmenuItem(char *t, int x, char o, int(*fkt) ()) { OPTK opt; opt.t = t; opt.x = x; opt.o = o; opt.fkt = fkt; return(opt); } xwpe-1.5.30a/we_mouse.c0000644000076400007640000010261610263105405013747 0ustar dulsidulsi/* we_mouse.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "messages.h" #include "edit.h" #if MOUSE #include "makro.h" int e_mouse_cursor(); /* mouse button pressed (?) */ int e_mshit() { extern struct mouse e_mouse; int g[4]; /* = { 3, 0, 0, 0 }; */ g[0] = 3; g[1] = 0; fk_mouse(g); e_mouse.x = g[2]/8; e_mouse.y = g[3]/8; return(g[1]); } /* mouse main menu control */ int e_m1_mouse() { extern struct mouse e_mouse; extern OPT opt[]; extern int e_mn_men; int c, n; if (e_mouse.y == MAXSLNS-1) c = e_m3_mouse(); else if (e_mouse.y != 0) c = WPE_ESC; else { for (n = 1; n < MENOPT; n++) if (e_mouse.x < opt[n].x-e_mn_men) break; c = opt[n-1].as; } return(c); } /* mouse options box control */ int e_m2_mouse(int xa, int ya, int xe, int ye, OPTK *fopt) { extern struct mouse e_mouse; int c; if (e_mouse.y == MAXSLNS) c = e_m3_mouse(); else if (e_mouse.y == 0) return(e_m1_mouse()); else if (e_mouse.x <= xa || e_mouse.x >= xe || e_mouse.y <= ya || e_mouse.y >= ye) c = WPE_ESC; else c = fopt[e_mouse.y-ya-1].o; while (e_mshit()) ; return(c); } /* Mouse assistant bar control */ int e_m3_mouse() { extern WOPT *blst; extern struct mouse e_mouse; extern int nblst; int i; if (e_mouse.y != MAXSLNS-1) return(WPE_ESC); while (e_mshit()) ; for(i = 1; i < nblst; i++) if(e_mouse.x < blst[i].x) return(blst[i-1].as); return(blst[nblst-1].as); } /* mouse errors box control */ int e_er_mouse(int x, int y, int xx, int yy) { extern struct mouse e_mouse; while (e_mshit() != 0) ; if (y == e_mouse.y && x == e_mouse.x) return (WPE_CR); if (yy == e_mouse.y && xx-1 <= e_mouse.x && xx+4 >= e_mouse.x) return (WPE_CR); return(0); } /* mouse messages box control */ int e_msg_mouse(int x, int y, int x1, int x2, int yy) { extern struct mouse e_mouse; while (e_mshit() != 0) ; if (y == e_mouse.y && x == e_mouse.x) return (WPE_CR); if (yy == e_mouse.y) { if (x1-1 <= e_mouse.x && x1+5 >= e_mouse.x) return ('Y'); if (x2-1 <= e_mouse.x && x2+5 >= e_mouse.x) return (WPE_ESC); if ((x1=(x1+x2)/2 - 1) <= e_mouse.x && x1+5 >= e_mouse.x) return ('N'); } return(0); } int e_rahmen_mouse(FENSTER *f) { extern struct mouse e_mouse; int c = 1; if (e_mouse.x == f->a.x+3 && e_mouse.y == f->a.y) c = WPE_ESC; else if (e_mouse.x == f->e.x-3 && e_mouse.y == f->a.y) e_ed_zoom(f); else if (e_mouse.x == f->a.x && e_mouse.y == f->a.y) e_eck_mouse(f, 1); else if (e_mouse.x == f->e.x && e_mouse.y == f->a.y) e_eck_mouse(f, 2); else if (e_mouse.x == f->e.x && e_mouse.y == f->e.y) e_eck_mouse(f, 3); else if (e_mouse.x == f->a.x && e_mouse.y == f->e.y) e_eck_mouse(f, 4); else if (e_mouse.y == f->a.y && e_mouse.x > f->a.x && e_mouse.x < f->e.x) e_eck_mouse(f, 0); else c = 0; while (e_mshit() != 0) ; return(c); } int WpeMngMouseInFileManager(FENSTER * f) { extern struct mouse e_mouse; ECNT *cn = f->ed; FLBFFR *b = (FLBFFR *) f->b; int i, c = 0, by = 4; if(e_mouse.y == 0) return(AltBl); else if(e_mouse.y == MAXSLNS - 1) return(e_m3_mouse()); else if(e_mouse.x < f->a.x || e_mouse.x > f->e.x || e_mouse.y < f->a.y || e_mouse.y > f->e.y) { for(i = cn->mxedt; i > 0; i--) { if(e_mouse.x >= cn->f[i]->a.x && e_mouse.x <= cn->f[i]->e.x && e_mouse.y >= cn->f[i]->a.y && e_mouse.y <= cn->f[i]->e.y) { while(e_mshit() != 0); return(cn->edt[i] < 10 ? Alt1 - 1 + cn->edt[i] : 1014 + cn->edt[i]); } } } else if(e_mouse.x == f->a.x + 3 && e_mouse.y == f->a.y) c = WPE_ESC; else if(e_mouse.x == f->e.x - 3 && e_mouse.y == f->a.y) e_ed_zoom(f); else if(e_mouse.x == f->a.x && e_mouse.y == f->a.y) e_eck_mouse(f, 1); else if(e_mouse.x == f->e.x && e_mouse.y == f->a.y) e_eck_mouse(f, 2); else if(e_mouse.x == f->e.x && e_mouse.y == f->e.y) e_eck_mouse(f, 3); else if(e_mouse.x == f->a.x && e_mouse.y == f->e.y) e_eck_mouse(f, 4); else if(e_mouse.y == f->a.y && e_mouse.x > f->a.x && e_mouse.x < f->e.x) e_eck_mouse(f, 0); else { if(NUM_LINES_ON_SCREEN <= 17) by = -1; else if(b->sw != 0 || NUM_LINES_ON_SCREEN <= 19) by = 2; if(NUM_LINES_ON_SCREEN > 17) { if(e_mouse.y == f->e.y - by && e_mouse.x >= f->a.x + 3 && e_mouse.x <= f->a.x + 10) c = WPE_ESC; else if(e_mouse.y == f->e.y - by && e_mouse.x >= f->a.x + 13 && e_mouse.x <= f->a.x + 24) c = AltC; else if(b->sw == 1 && NUM_COLS_ON_SCREEN >= 34 && e_mouse.y == f->e.y - by && e_mouse.x >= f->a.x + 27 && e_mouse.x <= f->a.x + 32) c = AltR; else if(b->sw == 2 && NUM_COLS_ON_SCREEN >= 35 && e_mouse.y == f->e.y - by && e_mouse.x >= f->a.x + 27 && e_mouse.x <= f->a.x + 33) c = AltW; else if(b->sw == 4 && NUM_COLS_ON_SCREEN >= 34 && e_mouse.y == f->e.y - by && e_mouse.x >= f->a.x + 27 && e_mouse.x <= f->a.x + 32) c = AltS; else if(b->sw == 4 && NUM_COLS_ON_SCREEN >= 48 && e_mouse.y == f->e.y - by && e_mouse.x >= f->a.x + 35 && e_mouse.x <= f->a.x + 46) c = AltY; else if(b->sw == 3 && NUM_COLS_ON_SCREEN >= 37 && e_mouse.y == f->e.y - by && e_mouse.x >= f->a.x + 27 && e_mouse.x <= f->a.x + 35) c = AltE; else if(b->sw == 5 && NUM_COLS_ON_SCREEN >= 33 && e_mouse.y == f->e.y - by && e_mouse.x >= f->a.x + 27 && e_mouse.x <= f->a.x + 31) c = AltA; else if(b->sw == 0 && NUM_COLS_ON_SCREEN >= 35 && e_mouse.y == f->e.y - by && e_mouse.x >= f->a.x + 27 && e_mouse.x <= f->a.x + 33) c = AltK; else if(b->sw == 0 && NUM_COLS_ON_SCREEN >= 49 && e_mouse.y == f->e.y - by && e_mouse.x >= f->a.x + 36 && e_mouse.x <= f->a.x + 47) c = AltA; } if(b->sw == 0 && NUM_LINES_ON_SCREEN > 19) { if(e_mouse.y == f->e.y - 2 && e_mouse.x >= f->a.x + 3 && e_mouse.x <= f->a.x + 8) c = AltM; else if(e_mouse.y == f->e.y - 2 && NUM_COLS_ON_SCREEN >= 21 && e_mouse.x >= f->a.x + 12 && e_mouse.x <= f->a.x + 19) c = AltR; else if(e_mouse.y == f->e.y - 2 && NUM_COLS_ON_SCREEN >= 30 && e_mouse.x >= f->a.x + 23 && e_mouse.x <= f->a.x + 28) c = AltL; else if(e_mouse.y == f->e.y - 2 && NUM_COLS_ON_SCREEN >= 39 && e_mouse.x >= f->a.x + 32 && e_mouse.x <= f->a.x + 37) c = AltO; else if(e_mouse.y == f->e.y - 2 && NUM_COLS_ON_SCREEN >= 48 && e_mouse.x >= f->a.x + 41 && e_mouse.x <= f->a.x + 46) c = AltE; } if(e_mouse.y == f->a.y + 3 && e_mouse.x >= f->a.x + b->xfa && e_mouse.x <= f->a.x + b->xfa + b->xfd) c = AltN; else if(e_mouse.y == f->a.y + 3 && e_mouse.x >= f->a.x + b->xda && e_mouse.x <= f->a.x + b->xda + b->xdd) c = AltD; else if(e_mouse.y >= b->fw->ya && e_mouse.y <= b->fw->ye && e_mouse.x >= b->fw->xa && e_mouse.x <= b->fw->xe) c = AltF; else if(e_mouse.y >= b->dw->ya && e_mouse.y <= b->dw->ye && e_mouse.x >= b->dw->xa && e_mouse.x <= b->dw->xe) c = AltT; } while(e_mshit() != 0); return(c); } int WpeMouseInFileDirList(int k, int sw, FENSTER * f) { extern struct mouse e_mouse; ECNT *cn = f->ed; FLBFFR *b = (FLBFFR *) f->b; int i; char tmp[256]; if(e_mouse.x >= f->a.x && e_mouse.x <= f->e.x && e_mouse.y >= f->a.y && e_mouse.y <= f->e.y) return(0); for(i = cn->mxedt - 1; i > 0; i--) { if(e_mouse.x >= cn->f[i]->a.x && e_mouse.x <= cn->f[i]->e.x && e_mouse.y >= cn->f[i]->a.y && e_mouse.y <= cn->f[i]->e.y) break; } if(i <= 0) return(0); if(sw) { if(cn->f[i]->dirct[strlen(cn->f[i]->dirct) - 1] == DIRC) sprintf(tmp, "%s%s", cn->f[i]->dirct, b->dd->name[b->dw->nf - b->cd->anz]); else sprintf(tmp, "%s/%s", cn->f[i]->dirct, b->dd->name[b->dw->nf - b->cd->anz]); #ifndef DJGPP if(k == -2) e_copy(b->dd->name[b->dw->nf - b->cd->anz], tmp, f); else if(k == -4) e_link(b->dd->name[b->dw->nf - b->cd->anz], tmp, f); #else if(k == -4) e_copy(b->dd->name[b->dw->nf - b->cd->anz], tmp, f); #endif else e_rename(b->dd->name[b->dw->nf - b->cd->anz], tmp, f); freedf(b->cd); freedf(b->dw->df); freedf(b->dd); b->dd = e_find_dir(SUDIR, f->ed->flopt & FM_SHOW_HIDDEN_DIRS ? 1 : 0); b->cd = WpeCreateWorkingDirTree(f->save, cn); /* ??? cn */ b->dw->df = WpeGraphicalDirTree(b->cd, b->dd, cn); b->dw->nf = b->cd->anz - 1; b->dw->ia = b->dw->ja = 0; e_pr_file_window(b->dw, 0, 1, f->fb->ft.fb, f->fb->fz.fb, f->fb->frft.fb); } else { if(cn->f[i]->dirct[strlen(cn->f[i]->dirct) - 1] == DIRC) sprintf(tmp, "%s%s", cn->f[i]->dirct, b->df->name[b->fw->nf]); else sprintf(tmp, "%s/%s", cn->f[i]->dirct, b->df->name[b->fw->nf]); #ifndef DJGPP if(k == -2) e_copy(b->df->name[b->fw->nf], tmp, f); else if(k == -4) e_link(b->df->name[b->fw->nf], tmp, f); #else if(k == -4) e_copy(b->df->name[b->fw->nf], tmp, f); #endif else e_rename(b->df->name[b->fw->nf], tmp, f); freedf(b->df); freedf(b->fw->df); b->df = e_find_files(b->rdfile, f->ed->flopt & FM_SHOW_HIDDEN_DIRS ? 1 : 0); b->fw->df = WpeGraphicalFileList(b->df, f->ed->flopt >> 9, cn); b->fw->ia = b->fw->nf = 0; b->fw->ja = b->fw->srcha; e_pr_file_window(b->fw, 0, 1, f->fb->ft.fb, f->fb->fz.fb, f->fb->frft.fb); } return(cn->edt[i] < 10 ? Alt1 - 1 + cn->edt[i] : 1014 + cn->edt[i]); } /* File Window */ char *e_gt_btstr(int x, int y, int n, char *buffer) { int i; for (i = 0; i < n; i++) buffer[i] = e_gt_byte(2*x + i, y) ; return(buffer); } char *e_pt_btstr(int x, int y, int n, char *buffer) { int i; for(i = 0; i < n; i++) e_pt_byte(2*x + i, y, buffer[i]) ; return(buffer); } int fl_wnd_mouse(sw, k, fw) int sw; int k; FLWND *fw; { extern struct mouse e_mouse; int MLEN, i, c, xa, ya, xn, yn, xdif; char *file, *bgrd; if(e_mouse.x == fw->xe && e_mouse.y >= fw->ya && e_mouse.y < fw->ye) { fw->nf = e_lst_mouse(fw->xe, fw->ya, fw->ye-fw->ya, 0, fw->df->anz, fw->nf); return(0); } else if(e_mouse.y == fw->ye && e_mouse.x >= fw->xa && e_mouse.x < fw->xe) { fw->ja = e_lst_mouse(fw->xa, fw->ye, fw->xe-fw->xa, 1, strlen(*(fw->df->name+fw->nf)), fw->ja); return(0); } else if(e_mouse.y >= fw->ya && e_mouse.y < fw->ye && e_mouse.x >= fw->xa && e_mouse.x < fw->xe) { if(fw->nf == e_mouse.y - fw->ya + fw->ia && e_mouse.y - fw->ya + fw->ia < fw->df->anz) { /* if(k == -2) { while (e_mshit() != 0); return(AltU); } else if(k == -4) { while (e_mshit() != 0); return(AltM); } else */ { xa = e_mouse.x; ya = e_mouse.y; xdif = e_mouse.x - fw->xa; if(fw->srcha >= 0) c = fw->srcha; else { for(c = 0; *(fw->df->name[fw->nf]+c) && ( *(fw->df->name[fw->nf]+c) <= 32 || *(fw->df->name[fw->nf]+c) >= 127); c++); if(!WpeIsXwin()) c += 3; } for(MLEN = 1; *(fw->df->name[fw->nf]+c+MLEN) && *(fw->df->name[fw->nf]+c+MLEN) != ' '; MLEN++); MLEN *= 2; file = MALLOC(MLEN * sizeof(char)); bgrd = MALLOC(MLEN * sizeof(char)); while (e_mshit() != 0) if(sw && (e_mouse.x != xa || e_mouse.y != ya)) { xn = e_mouse.x; yn = e_mouse.y; if(fw->srcha < 0) { FLBFFR *b = (FLBFFR *)fw->f->b; if(b->cd->anz > fw->nf) { while (e_mshit() != 0); FREE (file); FREE (bgrd); return(WPE_CR); } for(c = 0; *(fw->df->name[fw->nf]+c) && ( *(fw->df->name[fw->nf]+c) <= 32 || *(fw->df->name[fw->nf]+c) >= 127); c++); if(!WpeIsXwin()) c += 3; xdif -= (c + 1); } for (i = 0; i < MLEN/2; i++) { file[2*i] = *(fw->df->name[fw->nf]+c+i); file[2*i+1] = fw->f->fb->fz.fb; } e_gt_btstr(e_mouse.x-xdif, e_mouse.y, MLEN, bgrd); while (e_mshit() != 0) { e_pt_btstr(xn-xdif, yn, MLEN, bgrd); xn = e_mouse.x; yn = e_mouse.y; e_gt_btstr(e_mouse.x-xdif, e_mouse.y, MLEN, bgrd); e_pt_btstr(e_mouse.x-xdif, e_mouse.y, MLEN, file); e_refresh(); } e_pt_btstr(xn-xdif, yn, MLEN, bgrd); FREE (file); FREE (bgrd); return(k); } FREE (file); FREE (bgrd); if(sw && k == -2) return(AltU); else if(sw && k == -4) return(AltM); else return(WPE_CR); } } else { while (e_mshit() != 0); fw->nf = e_mouse.y - fw->ya + fw->ia; return(0); } } else return(MBKEY); } /* mouse slider bar control */ int e_lst_mouse(x, y, n, sw, max, nf) int x; int y; int n; int sw; int max; int nf; { extern struct mouse e_mouse; int g[4]; /* = { 1, 0, 0, 0 }; */ int inew, iold, nret, frb = e_gt_col(x, y); double d; if(n < 2) return(nf); d = ((double)max)/((double)(n-2)); g[0] = 1; if(sw == 0) { if(e_mouse.x != x) return(nf); if(e_mouse.y < y || e_mouse.y >= y+n) return(nf); if(e_mouse.y == y) nret= (nf < 1) ? nf : nf-1; else if(e_mouse.y == y+n-1) nret= (nf >= max-1) ? nf : nf+1; else { nret = (int) ((e_mouse.y-y-1)*d); if(e_gt_char(e_mouse.x, e_mouse.y) == MCA ) { iold = e_mouse.y; #ifdef NEWSTYLE e_make_xrect_abs(x, iold, x, iold, 1); e_refresh(); #endif fk_mouse(g); for(g[1]=1; g[1] != 0; fk_mouse(g), g[0]=3) { if((inew = g[3]/8) < y+1) inew = y+1; if(inew > y+n-2) inew = y+n-2; if(iold != inew) { g[0] = 2; fk_mouse(g); e_pr_char(x, iold, MCI, frb); e_pr_char(x, inew, MCA, frb); #ifdef NEWSTYLE e_make_xrect(x, y+1, x, y+n-2, 0); e_make_xrect_abs(x, inew, x, inew, 1); #endif e_refresh(); iold = inew; g[0] = 1; fk_mouse(g); }; } g[0] = 2; fk_mouse(g); e_pr_char(x, inew, MCI, frb); if(inew-y < 2) nret = 0; else if(inew-y > n - 3) nret = max - 1; else nret = (int) ((inew-y-0.5)*d); } else if(nf < nret) { nret = (nf+n > max) ? max : nf+n-1; while (e_mshit() != 0); } else { nret = (nf-n < 0) ? 0 : nf-n+1; while (e_mshit() != 0); } } } else { if(e_mouse.y != y) return(nf); if(e_mouse.x < x || e_mouse.x >= x+n) return(nf); if(e_mouse.x == x) nret= (nf < 1) ? nf : nf-1; else if(e_mouse.x == x+n-1) nret= (nf >= max-1) ? nf : nf+1; else { nret = (int) ((e_mouse.x-x-1)*d); if( e_gt_char(e_mouse.x, e_mouse.y) == MCA ) { iold = e_mouse.x; #ifdef NEWSTYLE e_make_xrect_abs(iold, y, iold, y, 1); e_refresh(); #endif fk_mouse(g); for(g[1]=1; g[1] != 0; fk_mouse(g), g[0]=3) { if((inew = g[2]/8) < x+1) inew = x+1; if(inew > x+n-2) inew = x+n-2; if(iold != inew) { g[0] = 2; fk_mouse(g); e_pr_char(iold, y, MCI, frb); e_pr_char(inew, y, MCA, frb); #ifdef NEWSTYLE e_make_xrect(x+1, y, x+n-2, y, 0); e_make_xrect_abs(inew, y, inew, y, 1); #endif e_refresh(); iold = inew; g[0] = 1; fk_mouse(g); }; } g[0] = 2; fk_mouse(g); e_pr_char(inew, y, MCI, frb); if(inew-y < 2) nret = 0; else if(inew-y > n - 3) nret = max - 1; else nret = (int) ((inew-y-0.5)*d); } else if(nf < nret) { nret = (nf+n > max) ? max : nf+n-1; while (e_mshit() != 0); } else { nret = (nf-n < 0) ? 0 : nf-n+1; while (e_mshit() != 0); } } } return(nret); } /* mouse window resizer control */ void e_eck_mouse(FENSTER *f, int sw) { int g[4]; /* = { 3, 1, 0, 0 }; */ int xold, yold, x, y, xa, xmin = 26, ymin = 3; POINT fa, fe; e_ed_rahmen(f, 0); memcpy(&fa, &f->a, sizeof(POINT)); memcpy(&fe, &f->e, sizeof(POINT)); g[0] = 3; g[1] = 1; fk_mouse(g); xold = g[2]/8; yold = g[3]/8; xa = xold - f->a.x; if (f->dtmd == DTMD_FILEDROPDOWN) xmin = 15; else if (!DTMD_ISTEXT(f->dtmd)) ymin = 9; while(g[1] != 0) { x = g[2]/8; y = g[3]/8; if (y < 1) y = 1; else if (y > MAXSLNS-2) y = MAXSLNS-2; if (x < 0) x = 0; else if (x > MAXSCOL-1) x = MAXSCOL-1; if (xold != x || yold != y) { xold = x; yold = y; if (sw == 0) { x -= xa; if (x < 0) x = 0; else if (x + NUM_COLS_ON_SCREEN > MAXSCOL-1) x = MAXSCOL - f->e.x + f->a.x - 1; if (f->e.y + y - f->a.y > MAXSLNS-2) y = MAXSLNS - f->e.y + f->a.y - 2; f->e.x = NUM_COLS_ON_SCREEN + x; f->a.x = x; f->e.y = f->e.y + y - f->a.y; f->a.y = y; } else if (sw == 1) { if (x > f->e.x - xmin) x = f->e.x - xmin; if (y > f->e.y - ymin) y = f->e.y - ymin; f->a.x = x; f->a.y = y; } else if (sw == 2) { if (x < f->a.x + xmin) x = f->a.x + xmin; if (y > f->e.y - ymin) y = f->e.y - ymin; f->e.x = x; f->a.y = y; } else if (sw == 3) { if (x < f->a.x + xmin) x = f->a.x + xmin; if (y < f->a.y + ymin) y = f->a.y + ymin; f->e.x = x; f->e.y = y; } else if (sw == 4) { if (x > f->e.x - xmin) x = f->e.x - xmin; if (y < f->a.y + ymin) y = f->a.y + ymin; f->a.x = x; f->e.y = y; } g[0] = 2; fk_mouse(g); f->pic = e_ed_kst(f, f->pic, 0); if (f->pic == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); if (f->dtmd == DTMD_FILEDROPDOWN) { FLWND *fw = (FLWND*) f->b; fw->xa = f->a.x+1; fw->xe = f->e.x; fw->ya = f->a.y+1; fw->ye = f->e.y; } g[0] = 1; fk_mouse(g); e_cursor(f, 0); e_schirm(f, 0); e_refresh(); } g[0] = 3; fk_mouse(g); } if ((memcmp(&fa, &f->a, sizeof(POINT))) || (memcmp(&fe, &f->e, sizeof(POINT)))) f->zoom = 0; e_ed_rahmen(f, 1); } /* Mouse edit window control */ int e_edt_mouse(int c, FENSTER *f) { int i, ret = 0; extern struct mouse e_mouse; ECNT *cn = f->ed; if (e_mouse.y == 0) return(e_m1_mouse()); else if (e_mouse.y == MAXSLNS-1) return(e_m3_mouse()); else if (e_mouse.x >= f->a.x && e_mouse.x <= f->e.x && e_mouse.y >= f->a.y && e_mouse.y <= f->e.y) { if (e_mouse.x == f->a.x+3 && e_mouse.y == f->a.y) ret = f->ed->edopt & ED_CUA_STYLE ? CF4 : AF3; else if (e_mouse.x == f->e.x-3 && e_mouse.y == f->a.y) e_ed_zoom(f); else if (e_mouse.x == f->a.x && e_mouse.y == f->a.y) e_eck_mouse(f, 1); else if (e_mouse.x == f->e.x && e_mouse.y == f->a.y) e_eck_mouse(f, 2); else if (e_mouse.x == f->e.x && e_mouse.y == f->e.y) e_eck_mouse(f, 3); else if (e_mouse.x == f->a.x && e_mouse.y == f->e.y) e_eck_mouse(f, 4); else if (e_mouse.y == f->a.y) e_eck_mouse(f, 0); else if (e_mouse.x == f->a.x && e_mouse.y == f->a.y+2) ret = f->ed->edopt & ED_CUA_STYLE ? AF3 : F4; else if (e_mouse.x == f->a.x && e_mouse.y == f->a.y+4) ret = f->ed->edopt & ED_CUA_STYLE ? CF3 : AF4; else if (e_mouse.x == f->a.x && e_mouse.y == f->a.y+6) ret = f->ed->edopt & ED_CUA_STYLE ? F3 : CF4; else if (f->ins != 8 && e_mouse.x == f->a.x && e_mouse.y == f->a.y+8) ret = f->ed->edopt & ED_CUA_STYLE ? AF2 : F2; else if (e_mouse.y == f->e.y && e_mouse.x > f->a.x + 4 && e_mouse.x < f->a.x + 14) ret = AltG; else if (e_mouse.y == f->e.y && e_mouse.x == f->a.x + 15 && f->ins != 8) { if (f->ins & 1) f->ins &= ~1; else f->ins |= 1; e_pr_filetype(f); } else if (e_mouse.y == f->e.y && e_mouse.x == f->a.x + 16 && f->ins != 8) { if (f->ins & 2) f->ins &= ~2; else f->ins |= 2; e_pr_filetype(f); } else if (e_mouse.x > f->a.x && e_mouse.x < f->e.x && e_mouse.y > f->a.y && e_mouse.y < f->e.y) { if (c < -1) ret = e_ccp_mouse(c, f); else if (f->dtmd == DTMD_HELP && f->ins == 8 && f->b->b.y == e_mouse.y-f->a.y+NUM_LINES_OFF_SCREEN_TOP-1 && ((i = f->b->b.x) == e_mouse_cursor(f->b, f->s, f))) ret = WPE_CR; else #ifdef PROG #ifdef DEBUGGER { if (WpeIsProg() && (!strcmp(f->datnam, "Watches") || !strcmp(f->datnam, "Messages") || !strcmp(f->datnam, "Stack"))) ret = e_d_car_mouse(f); else e_cur_mouse(f); } #else { if (WpeIsProg() && !strcmp(f->datnam, "Messages")) ret = e_d_car_mouse(f); else e_cur_mouse(f); } #endif #else e_cur_mouse(f); #endif } else if (e_mouse.x == f->e.x && e_mouse.y == f->a.y+1) { /*changed the while()... to a do...while(); :Mark L*/ do { f->b->b.y = f->b->b.y > 0 ? f->b->b.y - 1 : 0; f->b->b.x = e_chr_sp(f->b->clsv, f->b, f); e_cursor(f, 1); e_refresh(); } while(e_mshit()); } else if (e_mouse.x == f->e.x && e_mouse.y == f->e.y-1) { /*changed the while()... to a do...while(); :Mark L*/ do { f->b->b.y = f->b->b.y < f->b->mxlines - 1 ? f->b->b.y + 1 : f->b->mxlines - 1; f->b->b.x = e_chr_sp(f->b->clsv, f->b, f); e_cursor(f, 1); e_refresh(); } while(e_mshit()); } else if (e_mouse.x == f->e.x && e_mouse.y > f->a.y+1 && e_mouse.y < f->e.y-1) { f->b->b.y = e_lst_mouse(f->e.x, f->a.y+1, f->e.y-f->a.y-1, 0, f->b->mxlines, f->b->b.y); e_cursor(f, 1); e_refresh(); } else if (e_mouse.y == f->e.y && e_mouse.x == f->a.x+19) { while (e_mshit()) { f->b->b.x = f->b->b.x > 0 ? f->b->b.x - 1 : 0; e_cursor(f, 1); e_refresh(); } } else if (e_mouse.y == f->e.y && e_mouse.x == f->e.x-2) { while (e_mshit()) { f->b->b.x = f->b->b.x < f->b->bf[f->b->b.y].len ? f->b->b.x + 1 : f->b->bf[f->b->b.y].len; e_cursor(f, 1); e_refresh(); } } else if (e_mouse.y == f->e.y && e_mouse.x > f->a.x+19 && e_mouse.x < f->e.x-2) { f->b->b.x = e_lst_mouse(f->a.x+19, f->e.y, f->e.x-f->a.x-20, 1, f->b->mx.x, NUM_COLS_OFF_SCREEN_LEFT); e_cursor(f, 1); e_refresh(); } } else { for (i = cn->mxedt; i > 0; i--) { if (e_mouse.x >= cn->f[i]->a.x && e_mouse.x <= cn->f[i]->e.x && e_mouse.y >= cn->f[i]->a.y && e_mouse.y <= cn->f[i]->e.y) { ret = cn->edt[i] < 10 ? Alt1-1+cn->edt[i] : 1014+cn->edt[i]; break; } } } while (e_mshit()!= 0) ; return(ret); } int e_mouse_cursor(BUFFER *b, SCHIRM *s, FENSTER *f) { extern struct mouse e_mouse; b->b.x = e_mouse.x-f->a.x+s->c.x-1; b->b.y = e_mouse.y-f->a.y+s->c.y-1; if (b->b.y < 0) b->b.y = 0; else if (b->b.y >= b->mxlines) b->b.y = b->mxlines - 1; return(b->b.x = e_chr_sp(b->b.x, b, f)); } /* Copy, Cut and Paste functions */ int e_ccp_mouse(int c, FENSTER *f) { BUFFER *b = f->ed->f[f->ed->mxedt]->b; SCHIRM *s = f->ed->f[f->ed->mxedt]->s; while (e_mshit() != 0) ; if (c == -2) { e_mouse_cursor(b, s, f); return((bioskey() & 8) ? AltEin : ShiftEin); } else if (c == -4) { return((bioskey() & 3) ? ShiftDel : ((bioskey() & 8) ? AltDel : CEINFG)); } else return(0); } /* Mouse cursor in edit window control */ void e_cur_mouse(f) FENSTER *f; { BUFFER *b = f->ed->f[f->ed->mxedt]->b; SCHIRM *s = f->ed->f[f->ed->mxedt]->s; POINT bs; bs.x = b->b.x; bs.y = b->b.y; e_mouse_cursor(b, s, f); if((bioskey() & 3) == 0) { if(b->b.x == bs.x && b->b.y == bs.y && f->dtmd != DTMD_HELP) { if(s->mark_begin.y == b->b.y && s->mark_end.y == b->b.y && s->mark_begin.x <= b->b.x && s->mark_end.x > b->b.x) { s->mark_begin.x = 0; s->mark_end.x = b->bf[b->b.y].len; } else { s->mark_begin.y = s->mark_end.y = b->b.y; for(s->mark_begin.x = b->b.x; s->mark_begin.x > 0 && isalnum1(b->bf[b->b.y].s[s->mark_begin.x-1]); s->mark_begin.x--); for(s->mark_end.x = b->b.x; s->mark_end.x < b->bf[b->b.y].len && isalnum1(b->bf[b->b.y].s[s->mark_end.x]); s->mark_end.x++); } e_schirm(f, 1); } s->ks.x = b->b.x; s->ks.y = b->b.y; } else { if(s->mark_end.y < b->b.y || ( s->mark_end.y == b->b.y && s->mark_end.x <= b->b.x)) { s->mark_end.x = b->b.x; s->mark_end.y = b->b.y; s->ks.x = s->mark_begin.x; s->ks.y = s->mark_begin.y; } else if(s->mark_begin.y > b->b.y || ( s->mark_begin.y == b->b.y && s->mark_begin.x >= b->b.x)) { s->mark_begin.x = b->b.x; s->mark_begin.y = b->b.y; s->ks.x = s->mark_end.x; s->ks.y = s->mark_end.y; } else if(s->mark_end.y < bs.y || ( s->mark_end.y == bs.y && s->mark_end.x <= bs.x)) { s->mark_begin.x = b->b.x; s->mark_begin.y = b->b.y; s->ks.x = s->mark_end.x; s->ks.y = s->mark_end.y; } else { s->mark_end.x = b->b.x; s->mark_end.y = b->b.y; s->ks.x = s->mark_begin.x; s->ks.y = s->mark_begin.y; } } WpeMouseChangeShape(WpeSelectionShape); while(e_mshit() != 0) { bs.x = b->b.x; bs.y = b->b.y; e_mouse_cursor(b, s, f); if(b->b.x < 0) b->b.x = 0; else if(b->b.x > b->bf[b->b.y].len) b->b.x = b->bf[b->b.y].len; if(b->b.x != bs.x || b->b.y != bs.y) { if(s->ks.y < b->b.y || ( s->ks.y == b->b.y && s->ks.x <= b->b.x)) { s->mark_end.x = b->b.x; s->mark_end.y = b->b.y; s->mark_begin.x = s->ks.x; s->mark_begin.y = s->ks.y; } else { s->mark_begin.x = b->b.x; s->mark_begin.y = b->b.y; s->mark_end.x = s->ks.x; s->mark_end.y = s->ks.y; } } e_cursor(f, 1); e_schirm(f, 1); e_refresh(); } s->ks.x = b->b.x; s->ks.y = b->b.y; WpeMouseRestoreShape(); e_cursor(f, 1); } int e_opt_ck_mouse(xa, ya, md) int xa; int ya; int md; { extern struct mouse e_mouse; if(e_mouse.x < xa-2 || e_mouse.x > xa+25 || e_mouse.y < ya-1 || e_mouse.y > ya+18) return(WPE_CR); if(e_mouse.x >= xa && e_mouse.x < xa+24 && e_mouse.y > ya && e_mouse.y < ya+17) return(1000+(e_mouse.y-ya-1)*16 + (e_mouse.x - xa)/3); else return(0); } int e_opt_cw_mouse(xa, ya, md) int xa; int ya; int md; { extern struct mouse e_mouse; if(e_mouse.y == 0 || e_mouse.y == MAXSLNS-1) return(WPE_ESC); if(e_mouse.y == 1 && e_mouse.x == 3) return(WPE_ESC); if(e_mouse.x >= xa-30 && e_mouse.x <= xa-3 && e_mouse.y >= ya && e_mouse.y <= ya+19) return(WPE_CR); if(e_mouse.x >= 1 && e_mouse.x <= 33 && e_mouse.y >= 2 && e_mouse.y <= 21) { if(md == 1) return(e_opt_bs_mouse_1()); else if(md == 2) return(e_opt_bs_mouse_2()); else if(md == 3) return(e_opt_bs_mouse_3()); else return(e_opt_bs_mouse()); } if(e_mouse.x > xa && e_mouse.x < xa+12 && e_mouse.y > ya && e_mouse.y < ya+20) return(374+e_mouse.y-ya); else return(0); } int e_opt_bs_mouse_1() { extern struct mouse e_mouse; /* return = sw + 375; */ int sw = 0; if(e_mouse.y < 2 || e_mouse.y > 21 || e_mouse.x < 2 || e_mouse.x > 33) return(0); else if(e_mouse.y == 2 && e_mouse.x == 6) sw = 1; else if(e_mouse.y == 2 && e_mouse.x >= 17 && e_mouse.x <= 28) sw = 3; else if(e_mouse.y == 21 && e_mouse.x >= 5 && e_mouse.x <= 10) sw = 1; else if(e_mouse.y == 2 || e_mouse.y == 21) sw = 2; else if((e_mouse.y == 3 || e_mouse.y == 5) && e_mouse.x >= 18 && e_mouse.x <= 27) sw = 0; else if(e_mouse.y == 4 && (e_mouse.x == 18 || e_mouse.x == 27)) sw = 0; else if(e_mouse.y == 4 && e_mouse.x == 20) sw = 1; else if(e_mouse.y == 4 && e_mouse.x > 18 && e_mouse.x < 27) sw = 2; else sw = 4; return(sw + 375); } int e_opt_bs_mouse_2() { extern struct mouse e_mouse; /* return = sw + 375; */ int sw = 0; if(e_mouse.y < 2 || e_mouse.y > 21 || e_mouse.x < 1 || e_mouse.x > 32) return(0); else if(e_mouse.y == 2 && e_mouse.x == 4) sw = 1; else if(e_mouse.y == 2 || e_mouse.y == 21 || e_mouse.x == 1 || e_mouse.x == 32) sw = 0; else if(e_mouse.y == 4 && e_mouse.x == 5) sw = 3; else if(e_mouse.y == 5 && e_mouse.x >= 5 && e_mouse.x <= 24 ) sw = 5; else if(e_mouse.y == 7 && e_mouse.x == 5) sw = 3; else if(e_mouse.y == 8 && e_mouse.x >= 5 && e_mouse.x <= 24 ) sw = 4; else if(e_mouse.y == 10 && e_mouse.x == 5) sw = 3; else if(e_mouse.y == 11 && e_mouse.x >= 5 && e_mouse.x <= 20 ) sw = 7; else if(e_mouse.y == 12 && e_mouse.x >= 5 && e_mouse.x <= 20 ) sw = 8; else if(e_mouse.y == 13 && e_mouse.x >= 5 && e_mouse.x <= 20 ) sw = 6; else if(e_mouse.y == 15 && e_mouse.x == 5) sw = 3; else if(e_mouse.y == 16 && e_mouse.x >= 5 && e_mouse.x <= 24 ) sw = 11; else if(e_mouse.y == 17 && e_mouse.x == 10) sw = 10; else if(e_mouse.y == 17 && e_mouse.x >= 5 && e_mouse.x <= 24 ) sw = 9; else if(e_mouse.y == 19 && e_mouse.x == 7) sw = 13; else if(e_mouse.y == 19 && e_mouse.x >= 6 && e_mouse.x <= 13 ) sw = 12; else if(e_mouse.y == 19 && e_mouse.x >= 19 && e_mouse.x <= 26 ) sw = 14; else sw = 2; return(sw + 375); } int e_opt_bs_mouse_3() { extern struct mouse e_mouse; /* return = sw + 375; */ int sw = 0; if(e_mouse.y < 2 || e_mouse.y > 21 || e_mouse.x < 1 || e_mouse.x > 32) return(0); else if(e_mouse.y == 5) sw = 3; else if(e_mouse.y == 9) sw = 1; else if(e_mouse.y == 11) sw = 2; else if(e_mouse.y == 13) sw = 4; return(sw+375); } int e_opt_bs_mouse() { extern struct mouse e_mouse; int sw = 0; if(e_mouse.y < 2 || e_mouse.y > 21 || e_mouse.x < 1 || e_mouse.x > 32) return(0); else if(e_mouse.y == 2 && (e_mouse.x == 4 || e_mouse.x == 29 )) sw = 1; else if(e_mouse.x == 32 && e_mouse.y > 2 && e_mouse.y < 21 ) sw = 5; else if(e_mouse.y == 21 && e_mouse.x > 20 && e_mouse.y < 32 ) sw = 5; else if(e_mouse.y == 2 || e_mouse.y == 21 || e_mouse.x == 1 || e_mouse.x == 32) sw = 0; else if(e_mouse.y == 6 && e_mouse.x >= 4 && e_mouse.x <= 30 ) sw = 3; else if(e_mouse.y == 7 && e_mouse.x >= 14 && e_mouse.x <= 21 ) sw = 4; else if(e_mouse.y == 10 && e_mouse.x >= 4 && e_mouse.x <= 16 ) sw = 6; else if(e_mouse.y == 11 && e_mouse.x >= 15 && e_mouse.x <= 20 ) sw = 8; else if(e_mouse.y == 13 && e_mouse.x >= 4 && e_mouse.x <= 17 ) sw = 7; else if(e_mouse.y == 16 && e_mouse.x >= 4 && e_mouse.x <= 25 ) sw = 9; else if(e_mouse.y == 17 && e_mouse.x >= 4 && e_mouse.x <= 23 ) sw = 10; else sw = 2; return(sw+375); } int e_data_ein_mouse(f) FENSTER *f; { extern struct mouse e_mouse; FLWND *fw = (FLWND *)f->b; ECNT *cn = f->ed; int i, c = 0; if(e_mouse.y == 0) return(AltBl); else if(e_mouse.y == MAXSLNS-1) return(e_m3_mouse()); else if(e_mouse.x < f->a.x || e_mouse.x > f->e.x || e_mouse.y < f->a.y || e_mouse.y > f->e.y) { for(i = cn->mxedt; i > 0; i--) { if(e_mouse.x >= cn->f[i]->a.x && e_mouse.x <= cn->f[i]->e.x && e_mouse.y >= cn->f[i]->a.y && e_mouse.y <= cn->f[i]->e.y) return(cn->edt[i] < 10 ? Alt1-1+cn->edt[i] : 1014+cn->edt[i]); } } else if(e_mouse.x == f->a.x+3 && e_mouse.y == f->a.y) c = WPE_ESC; else if(e_mouse.x == f->e.x-3 && e_mouse.y == f->a.y) e_ed_zoom(f); else if(e_mouse.x == f->a.x && e_mouse.y == f->a.y) e_eck_mouse(f, 1); else if(e_mouse.x == f->e.x && e_mouse.y == f->a.y) e_eck_mouse(f, 2); else if(e_mouse.x == f->e.x && e_mouse.y == f->e.y) e_eck_mouse(f, 3); else if(e_mouse.x == f->a.x && e_mouse.y == f->e.y) e_eck_mouse(f, 4); else if(e_mouse.y == f->a.y && e_mouse.x > f->a.x && e_mouse.x < f->e.x) e_eck_mouse(f, 0); else if(e_mouse.y >= fw->ya && e_mouse.y <= fw->ye && e_mouse.x >= fw->xa && e_mouse.x <= fw->xe) c = AltF; else if(e_mouse.y == f->e.y-2 && e_mouse.x >= f->e.x-9 && e_mouse.x <= f->e.x-3) c = WPE_ESC; else if((f->ins < 4 || f->ins == 7) && e_mouse.y == f->e.y-4 && e_mouse.x >= f->e.x-9 && e_mouse.x <= f->e.x-3) c = AltS; else if(f->ins > 3 && e_mouse.y == f->e.y-8 && e_mouse.x >= f->e.x-9 && e_mouse.x <= f->e.x-3) c = AltA; else if(f->ins > 3 && e_mouse.y == f->e.y-6 && e_mouse.x >= f->e.x-9 && e_mouse.x <= f->e.x-3) c = AltE; else if(f->ins > 3 && e_mouse.y == f->e.y-4 && e_mouse.x >= f->e.x-9 && e_mouse.x <= f->e.x-3) c = AltD; else if(f->ins == 4 && e_mouse.y == f->e.y-10 && e_mouse.x >= f->e.x-9 && e_mouse.x <= f->e.x-3) c = AltO; else c = AltF; while (e_mshit() != 0); return(c); } void e_opt_eck_mouse(o) W_OPTSTR *o; { int g[4]; int xold, yold, x, y, xa; PIC *pic; e_std_rahmen(o->xa, o->ya, o->xe, o->ye, o->name, 0, o->frt, o->frs); #ifndef NEWSTYLE #if !defined(DJGPP) if(!WpeIsXwin()) pic = e_open_view(o->xa, o->ya, o->xe, o->ye, 0, 2); else #endif pic = e_open_view(o->xa, o->ya, o->xe-2, o->ye-1, 0, 2); #else pic = e_open_view(o->xa, o->ya, o->xe, o->ye, 0, 2); #endif g[0] = 3; g[1] = 1; fk_mouse(g); xold = g[2]/8; yold = g[3]/8; xa = xold - o->xa; while(g[1] != 0) { x = g[2]/8; y = g[3]/8; if(y < 1) y = 1; else if(y > MAXSLNS-2) y = MAXSLNS-2; if(x < 0) x = 0; else if(x > MAXSCOL-1) x = MAXSCOL-1; if(xold != x || yold != y) { xold = x; yold = y; x -= xa; if(x < 0) x = 0; else if(x + o->xe - o->xa > MAXSCOL-1) x = MAXSCOL - o->xe + o->xa - 1; if(o->ye + y - o->ya > MAXSLNS-2) y = MAXSLNS - o->ye + o->ya - 2; o->xe = o->xe - o->xa + x; o->xa = x; o->ye = o->ye + y - o->ya; o->ya = y; g[0] = 2; fk_mouse(g); o->pic = e_change_pic(o->xa, o->ya, o->xe, o->ye, o->pic, 1, o->frt); if(o->pic == NULL) e_error(e_msg[ERR_LOWMEM], 1, o->f->fb); g[0] = 1; fk_mouse(g); pic->a.x = o->xa; pic->a.y = o->ya; pic->e.x = o->xe; pic->e.y = o->ye; e_close_view(pic, 2); } g[0] = 3; fk_mouse(g); } pic->a.x = o->xa; pic->a.y = o->ya; pic->e.x = o->xe; pic->e.y = o->ye; e_close_view(pic, 1); e_std_rahmen(o->xa, o->ya, o->xe, o->ye, o->name, 1, o->frt, o->frs); } int e_opt_mouse(W_OPTSTR *o) { extern struct mouse e_mouse; int c; if (e_mouse.y < o->ya || e_mouse.y >= o->ye || e_mouse.x <= o->xa || e_mouse.x >= o->xe) return(-1); else if (e_mouse.y == o->ya) { if (e_mouse.x == o->xa+3) { while(e_mshit()); return(WPE_ESC); } else { e_opt_eck_mouse(o); return(-1); } } while (e_mshit()) ; if ((c = e_get_opt_sw(0, e_mouse.x, e_mouse.y, o))) return(c); else return(-1); } #endif xwpe-1.5.30a/we_prog.c0000644000076400007640000022531610263105405013571 0ustar dulsidulsi/* we_prog.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "messages.h" #include "edit.h" #include "WeExpArr.h" #ifdef PROG #include #include #include #include #include #include int e_run_sh(FENSTER *f); int e_make_library(char *library, char *ofile, FENSTER *f); int e_p_exec(int file, FENSTER *f, PIC *pic); struct dirfile **e_make_prj_opt(FENSTER *f); int wfildes[2], efildes[2]; char *wfile = NULL, *efile = NULL; struct e_s_prog e_s_prog = { NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0}; struct e_prog e_prog = { 0, NULL, NULL, NULL, NULL, NULL }; struct ERR_LI { char *file, *text, *srch; int x, y, line; } *err_li = NULL; int err_no, err_num; int e__project = 0, e_argc, e_p_l_comp; char **e_arg = NULL; char *e__arguments = NULL; M_TIME last_time; char library[80]; int e_save_pid; struct dirfile **e_p_df; extern BUFFER *e_p_m_buffer; extern char *e_tmp_dir; #ifdef DEBUGGER extern int e_d_swtch; #endif /********************************************************/ /**** defs for breakpoints and watches manipulations ****/ /*** breakpoints ***/ extern int e_d_nbrpts; extern char ** e_d_sbrpts; extern int * e_d_ybrpts; /*** watches ***/ extern int e_d_nwtchs; extern char ** e_d_swtchs; extern int * e_d_nrwtchs; /********************************************************/ char *gnu_intstr = "${?*:warning:}${FILE}:${LINE}:* before `${COLUMN=BEFORE}\'*"; char *cc_intstr = "${?*:warning:}\"${FILE}\", line ${LINE}:* at or near * \"${COLUMN=AFTER}\""; char *pc_intstr = "${?0:e}${?0:w}${?0:s}*:*:* * ${FILE}:\n\n* ${LINE} ${CMPTEXT}\n*-------\ ${COLUMN=PREVIOUS?^+14}\n[EWew] * line*"; char *e_p_msg[] = { "Not a C - File", "Can\'t open Pipe", "Error in Process", "Error in Pipe\n Pipe Nr.: %d\n", "Error at Command: ", "Return-Code: %d", /* Number 5 */ "%s is not a C - File", "No Compiler specified", "No Files to compile", "No Project-Window", }; int e_prog_switch(FENSTER *f, int c) { switch(c) { case AltU: case CF9: e_run(f); break; case AltM: /* Alt M Make */ case F9: e_p_make(f); break; case AltC: /* Alt C Compile */ case AF9: e_compile(f); break; case AltL: /* Alt L InstaLl */ e_install(f); break; case AltA: /* Alt A Execute MAke */ e_exec_make(f); break; case AltT: /* Alt T NexT Error */ case AF8: e_next_error(f); break; case AltV: /* Alt V PreVious Error */ case AF7: e_previous_error(f); break; #ifdef DEBUGGER case CtrlG: /* Ctrl G DebuG - Modus */ e_deb_inp(f); break; default: return(e_debug_switch(f, c)); #else default: return(c); #endif } return(0); } int e_compile(FENSTER *f) { int ret; WpeMouseChangeShape(WpeWorkingShape); efildes[0] = efildes[1] = -1; wfildes[0] = wfildes[1] = -1; ret = e_comp(f); WpeMouseRestoreShape(); return(ret); } int e_p_make(FENSTER *f) { ECNT *cn = f->ed; char ostr[128], estr[128], mstr[80]; int len, i, file = -1; struct stat cbuf[1], obuf[1]; PIC *pic = NULL; int linkRequest = 1; /* assume linking has to be done */ WpeMouseChangeShape(WpeWorkingShape); efildes[0] = efildes[1] = -1; wfildes[0] = wfildes[1] = -1; if (e_comp(f)) { WpeMouseRestoreShape(); return(-1); } f = cn->f[cn->mxedt-1]; if (!e__project) { e_arg = MALLOC(6 * sizeof(char *)); e_argc = e_make_arg(&e_arg, e_s_prog.libraries); e_arg[1] = MALLOC(3); strcpy(e_arg[1], "-o"); strcpy(mstr, f->datnam); WpeStringCutChar(mstr, '.'); len = strlen(e_prog.exedir) - 1; if (e_s_prog.exe_name && e_s_prog.exe_name[0]) { if (e_prog.exedir[len] == DIRC) sprintf(estr, "%s%s", e_prog.exedir, e_s_prog.exe_name); else sprintf(estr, "%s%c%s", e_prog.exedir, DIRC, e_s_prog.exe_name); } else { if (e_prog.exedir[len] == DIRC) sprintf(estr, "%s%s.e", e_prog.exedir, mstr); else sprintf(estr, "%s%c%s.e", e_prog.exedir, DIRC, mstr); } if (e_prog.exedir[len] == DIRC) sprintf(ostr, "%s%s.o", e_prog.exedir, mstr); else sprintf(ostr, "%s%c%s.o", e_prog.exedir, DIRC, mstr); e_argc = e_add_arg(&e_arg, estr, 2, e_argc); e_argc = e_add_arg(&e_arg, ostr, 3, e_argc); stat(ostr, cbuf); if (!stat(estr, obuf) && obuf->st_mtime >= cbuf->st_mtime) linkRequest = 0; } else { if (!stat(e_s_prog.exe_name, obuf) && !e_p_l_comp && obuf->st_mtime >= last_time) linkRequest = 0; } if (linkRequest) { #ifdef DEBUGGER if (e_d_swtch > 0) e_d_quit(f); #endif if (!e_p_mess_win("Linking", e_argc, e_arg, &pic, f)) { e_sys_ini(); file = e_exec_inf(f, e_arg, e_argc); e_sys_end(); } else file = 0; } if (!e__project) { e_free_arg(e_arg, e_argc); } if (file != 0) i = e_p_exec(file, f, pic); else { i = WPE_ESC; if (pic) e_close_view(pic, 1); } WpeMouseRestoreShape(); return(i); } int e_run(FENSTER *f) { ECNT *cn = f->ed; BUFFER *b; SCHIRM *s; char estr[256]; int len, ret; efildes[0] = efildes[1] = -1; wfildes[0] = wfildes[1] = -1; if (!e_run_sh(f)) return(0); if (e_p_make(f)) return(-1); WpeMouseChangeShape(WpeWorkingShape); f = cn->f[cn->mxedt-1]; #ifdef DEBUGGER if (e_d_swtch > 0) e_d_quit(f); #endif estr[0] = '\0'; if ((!e_s_prog.exe_name) || (e_s_prog.exe_name[0]!=DIRC)) { strcat(estr, e_prog.exedir); len = strlen(estr) - 1; if (estr[len] != DIRC) { estr[++len] = DIRC; estr[++len] = '\0'; } } if (e_s_prog.exe_name && e_s_prog.exe_name[0]) { strcat(estr, e_s_prog.exe_name); } else if (!e__project) { /* Default executable name of the source file - extension + ".e" */ strcat(estr, f->datnam); WpeStringCutChar(estr, '.'); strcat(estr, ".e"); } else /* Default project executable name of "a.out" */ strcat(estr, "a.out"); strcat(estr, " "); if (e_prog.arguments) strcat(estr, e_prog.arguments); #ifndef NO_XWINDOWS if (WpeIsXwin()) ret = (*e_u_system)(estr); else #endif ret = e_system(estr, cn); f = cn->f[cn->mxedt]; b = cn->f[cn->mxedt]->b; s = cn->f[cn->mxedt]->s; sprintf(estr, e_p_msg[ERR_RETCODE], ret); print_to_end_of_buffer(b, estr, b->mx.x); b->b.y = b->mxlines-1; e_cursor(f, 1); e_schirm(f, 1); e_refresh(); WpeMouseRestoreShape(); return(0); } int e_comp(FENSTER *f) { ECNT *cn = f->ed; PIC *pic = NULL; char **arg = NULL, fstr[128], ostr[128]; int i, file = -1, len, argc; #ifdef CHECKHEADER struct stat obuf[1]; #else struct stat cbuf[1], obuf[1]; #endif #ifdef DEBUGGER if (e_d_swtch > 0) { i = e_message(1, "The Debugger is Running\nDo You want to Quit Debugging ?",f); if (i == 'Y') e_d_quit(f); else return(-1); WpeMouseChangeShape(WpeWorkingShape); } #endif if (e_prog.project[0] && !access(e_prog.project, 0)) e__project = 1; else e__project = 0; if (e__project) return(e_c_project(f)); for (i = cn->mxedt; i > 0; i--) { if (e_check_c_file(cn->f[i]->datnam)) break; } if (i == 0) { sprintf(ostr, e_p_msg[ERR_S_NO_CFILE], f->datnam); e_error(ostr, 0, f->fb); return(WPE_ESC); } else if (cn->f[i]->save) e_save(cn->f[i]); f = cn->f[i]; e_switch_window(cn->edt[i], cn->f[cn->mxedt]); if (e_new_message(f)) return(WPE_ESC); argc = e_make_arg(&arg, e_s_prog.comp_str); arg[1] = MALLOC(3); strcpy(arg[1], "-c"); len = strlen(f->dirct) - 1; if (!strcmp(f->ed->dirct, f->dirct)) strcpy(fstr, f->datnam); if (f->dirct[len] == DIRC) sprintf(fstr, "%s%s", f->dirct, f->datnam); else sprintf(fstr, "%s%c%s", f->dirct, DIRC, f->datnam); argc = e_add_arg(&arg, fstr, argc, argc); if (e_prog.exedir[strlen(e_prog.exedir)-1] == DIRC) sprintf(ostr, "%s%s", e_prog.exedir, f->datnam); else sprintf(ostr, "%s%c%s", e_prog.exedir, DIRC, f->datnam); WpeStringCutChar(ostr, '.'); strcat(ostr, ".o"); #ifndef NO_MINUS_C_MINUS_O argc = e_add_arg(&arg, "-o", argc, argc); argc = e_add_arg(&arg, ostr, argc, argc); #endif e_sys_ini(); #ifdef CHECKHEADER if ((stat(ostr, obuf) || e_check_header(fstr, obuf->st_mtime, cn, 0))) #else stat(f->datnam, cbuf); if ((stat(ostr, obuf) || obuf->st_mtime < cbuf->st_mtime)) #endif { remove(ostr); if (!e_p_mess_win("Compiling", argc, arg, &pic, f) && (file = e_exec_inf(f, arg, argc)) == 0) { e_sys_end(); e_free_arg(arg, argc); if (pic) e_close_view(pic, 1); return(WPE_ESC); } } e_sys_end(); e_free_arg(arg, argc); i = e_p_exec(file, f, pic); return(i); } int e_exec_inf(FENSTER *f, char **argv, int n) { int pid; char tstr[128]; #ifdef DEBUGGER if (e_d_swtch > 0) e_d_quit(f); #endif fflush(stdout); sprintf(tstr, "%s/we_111", e_tmp_dir); if((efildes[1] = creat(tstr, 0777)) < 0) { e_error(e_p_msg[ERR_PIPEOPEN], 0, f->fb); return(0); } if((efildes[0] = open(tstr, O_RDONLY)) < 0 ) { e_error(e_p_msg[ERR_PIPEOPEN], 0, f->fb); return(0); } efile = MALLOC((strlen(tstr)+1)*sizeof(char)); strcpy(efile, tstr); sprintf(tstr, "%s/we_112", e_tmp_dir); if((wfildes[1] = creat(tstr, 0777)) < 0) { e_error(e_p_msg[ERR_PIPEOPEN], 0, f->fb); return(0); } if((wfildes[0] = open(tstr, O_RDONLY)) < 0 ) { e_error(e_p_msg[ERR_PIPEOPEN], 0, f->fb); return(0); } wfile = MALLOC((strlen(tstr)+1)*sizeof(char)); strcpy(wfile, tstr); if((e_save_pid = pid = fork()) > 0) return(efildes[1]); else if(pid < 0) { e_error(e_p_msg[ERR_PROCESS], 0, f->fb); return(0); } close(2); /* new process */ if(fcntl(efildes[1], F_DUPFD, 2) != 2) { fprintf(stderr, e_p_msg[ERR_PIPEEXEC], efildes[1]); exit(1); } close(1); if(fcntl(wfildes[1], F_DUPFD, 1) != 1) { fprintf(stderr, e_p_msg[ERR_PIPEEXEC], wfildes[1]); exit(1); } e_print_arg(stderr, "", argv, n); execvp(argv[0], argv); e_print_arg(stderr, e_p_msg[ERR_IN_COMMAND], argv, n); exit(1); /* Can never get here */ return 0; } int e_print_arg(FILE *fp, char *s, char **argv, int n) { int i; if ((s) && (s[0])) fprintf(fp,"%s ", s); for (i = 0; i < n && argv[i] != NULL; i++) fprintf(fp,"%s ", argv[i]); fprintf(fp,"\n"); return(n); } int e_p_exec(int file, FENSTER *f, PIC *pic) { ECNT *cn = f->ed; BUFFER *b = cn->f[cn->mxedt]->b; int ret = 0, i = 0, is, fd, stat_loc; char str[128]; char *buff; f = cn->f[cn->mxedt]; while ((ret = wait(&stat_loc)) >= 0 && ret != e_save_pid) ; ret = 0; for (is = b->mxlines-1, fd = efildes[0]; fd > 0; fd = wfildes[0]) { buff=MALLOC(1); buff[0]='\0'; while( e_line_read(fd, str, 128) == 0 ) { buff=REALLOC(buff, strlen(buff) + strlen(str) + 1); strcat(buff, str); fflush(stdout); } print_to_end_of_buffer(b, buff, b->mx.x); FREE(buff); if( fd == wfildes[0] ) break; } b->b.y = b->mxlines-1; if (efildes[0] >= 0) close(efildes[0]); if (wfildes[0] >= 0) close(wfildes[0]); if (efildes[1] >= 0) close(efildes[0]); if (wfildes[1] >= 0) close(wfildes[0]); if (wfile) { remove(wfile); FREE(wfile); wfile = NULL; } if (efile) { remove(efile); FREE(efile); efile = NULL; } efildes[0] = efildes[1] = -1; wfildes[0] = wfildes[1] = -1; if (pic) e_close_view(pic, 1); if (ret || (b->mxlines - is > 2 && (i = e_make_error_list(f)))) { if (i != -2 && !ret) e_show_error(err_no = 0, f); return(-1); } print_to_end_of_buffer(b, "Success", b->mx.x); e_cursor(f, 1); e_schirm(f, 1); e_refresh(); return(0); } /* show source-position of error number "n" from actual errorlist */ int e_show_error(int n, FENSTER *f) { ECNT *cn = f->ed; BUFFER *b = cn->f[cn->mxedt]->b; int i, j, bg = 0; char *filename; unsigned char *cp; if (!err_li || n >= err_num || n < 0) return(1); f = cn->f[cn->mxedt]; if (err_li[n].file[0] == '.' && err_li[n].file[1] == DIRC) bg = 2; if (err_li[n].file[0] == DIRC) { filename = e_mkfilename(f->dirct, f->datnam); } else filename = f->datnam; if (strcmp(err_li[n].file+bg, filename)) { for (i = cn->mxedt - 1; i > 0; i--) { if (filename != cn->f[i+1]->datnam) { FREE(filename); filename = e_mkfilename(cn->f[i]->dirct, cn->f[i]->datnam); } else filename = cn->f[i]->datnam; if (!strcmp(err_li[n].file+bg, filename)) { if (filename != cn->f[i]->datnam) FREE(filename); e_switch_window(cn->edt[i], cn->f[cn->mxedt]); break; } } if (i <= 0) { if (filename != cn->f[i+1]->datnam) FREE(filename); if (e_edit(cn, err_li[n].file)) return(WPE_ESC); } } else if (filename != f->datnam) FREE(filename); e_pr_str_wsd(1, MAXSLNS - 1, err_li[n].text, f->fb->mt.fb, -1, 0, f->fb->mt.fb, 1, MAXSCOL-2); /* e_pr_nstr(2, MAXSLNS - 1, MAXSCOL-2, err_li[n].text, f->fb->mt.fb, f->fb->mt.fb); */ b = cn->f[cn->mxedt]->b; b->b.y = err_li[n].line > b->mxlines ? b->mxlines - 1 : err_li[n].line - 1; if (!err_li[n].srch) { for(i = j = 0; i + j < err_li[n].x && i < b->bf[b->b.y].len; i++) { if (*(b->bf[b->b.y].s + i) == WPE_TAB) j += (f->ed->tabn - ((j + i) % f->ed->tabn) - 1); #ifdef UNIX else if (((unsigned char) *(b->bf[b->b.y].s + i)) > 126) { j++; if (((unsigned char) *(b->bf[b->b.y].s + i)) < 128 + ' ') j++; } else if (*(b->bf[b->b.y].s + i) < ' ') j++; #endif } b->b.x = i; } else { cp = strstr(b->bf[b->b.y].s, err_li[n].srch+1); for (i = 0; b->bf[b->b.y].s + i < cp; i++); if (err_li[n].srch[0] == 'B') { for (i--; i >= 0 && isspace(b->bf[b->b.y].s[i]); i--); if (i < 0 && b->b.y > 0) { (b->b.y)--; i = b->bf[b->b.y].len+1; } else i++; } /* else if(err_li[n].x < -1) i++; */ b->b.x = i + err_li[n].x; } e_cursor(cn->f[cn->mxedt],1); return(0); } int e_pure_bin(char *str, int ch) { int i; for (i = 0; isspace(str[i]); i++) ; for (; str[i] && str[i] != ch; i++) ; for(; i >= 0 && str[i] != DIRC; i--) ; return(i+1); } int e_make_error_list(FENSTER *f) { char file[256]; ECNT *cn = f->ed; BUFFER *b = cn->f[cn->mxedt]->b; int i, j, k = 0, ret = 0; char *spt; if (err_li) { for (i = 0; i < err_num; i++) { if(err_li[i].file) FREE(err_li[i].file); if(err_li[i].text) FREE(err_li[i].text); if(err_li[i].srch) FREE(err_li[i].srch); } FREE(err_li); } err_li = MALLOC(sizeof(struct ERR_LI) * b->mxlines); err_num = 0; for (i = 0; i < b->mxlines; i++) { if (!strncmp((char *)b->bf[i].s, "Error at Command:", 17)) return(!ret ? -2 : ret); if ((!strncmp((char *)b->bf[i].s, "ld", 2) && (b->bf[i].s[2] == ' ' || b->bf[i].s[2] == ':')) || !strncmp((char *)b->bf[i].s, "collect:", 8)) ret = -2; else if (!strncmp((char *)b->bf[i].s, "makefile:", 9) || !strncmp((char *)b->bf[i].s, "Makefile:", 9)) { err_li[k].file = MALLOC(9); for (j = 0; j < 8; j++) err_li[k].file[j] = b->bf[i].s[j]; err_li[k].file[8] = '\0'; err_li[k].line = atoi((char *)b->bf[i].s+9); err_li[k].y = i; err_li[k].x = 0; err_li[k].srch = NULL; err_li[k].text = MALLOC(strlen((char *)b->bf[i].s) + 1); strcpy(err_li[k].text, (char *)b->bf[i].s); err_li[k].text[b->bf[i].len] = '\0'; k++; err_num++; ret = -1; continue; } else if (!strncmp((char *)b->bf[i].s, "make:", 5) && ((spt = strstr((char *)b->bf[i].s, "makefile")) || (spt = strstr((char *)b->bf[i].s, "Makefile")) ) && (err_li[k].line = atoi(spt+14)) > 0 ) { err_li[k].file = MALLOC(9); for (j = 0; j < 8; j++) err_li[k].file[j] = spt[j]; err_li[k].file[8] = '\0'; err_li[k].y = i; err_li[k].x = 0; err_li[k].srch = NULL; err_li[k].text = MALLOC(strlen((char *)b->bf[i].s) + 1); strcpy(err_li[k].text, (char *)b->bf[i].s); err_li[k].text[b->bf[i].len] = '\0'; k++; err_num++; continue; } else { char *tststr = e_s_prog.comp_sw ? e_s_prog.intstr : gnu_intstr; if (!(ret = e_p_cmp_mess(tststr, b, &i, &k, ret))) { int ip, in; ip = e_pure_bin(e_s_prog.compiler, ' '); in = e_pure_bin(b->bf[i].s, ':'); sprintf(file, "%s:", e_s_prog.compiler+ip); if (!strncmp(file, b->bf[i].s+in, strlen(file))) ret = -2; else if (!strncmp("ld:", b->bf[i].s+in, 3)) ret = -2; else if (!strncmp("as:", b->bf[i].s+in, 3)) ret = -2; } } } if (!(f->ed->edopt & (ED_ERRORS_STOP_AT | ED_MESSAGES_STOP_AT)) && ret == -1) ret = 0; return(ret); } int e_previous_error(FENSTER *f) { if (err_no > 0) return(e_show_error(--err_no, f)); e_pr_uul(f->fb); return(0); } int e_next_error(FENSTER *f) { if (err_no < err_num - 1) return(e_show_error(++err_no, f)); e_pr_uul(f->fb); return(0); } int e_cur_error(int y, FENSTER *f) { int i; if(err_num) { for(i = 1; i < err_num && err_li[i].y <= y; i++); return(e_show_error(err_no = i - 1, f)); } e_pr_uul(f->fb); return(0); } int e_d_car_ret(FENSTER *f) { if (!strcmp(f->datnam, "Messages")) return(e_cur_error(f->ed->f[f->ed->mxedt]->b->b.y, f)); #ifdef DEBUGGER if (!strcmp(f->datnam, "Watches")) return(e_edit_watches(f)); if(!strcmp(f->datnam, "Stack")) return(e_make_stack(f)); #endif return(0); } int e_line_read(int n, char *s, int max) { int i, ret = 0; for (i = 0; i < max - 1; i++) if ((ret = read(n, s + i, 1)) != 1 || s[i] == '\n'|| s[i] == '\0') break; if (ret != 1 && i == 0) return(-1); if (i == max - 1) i--; s[i+1] = '\0'; return(0); } int e_arguments(FENSTER *f) { char str[80]; if (!e_prog.arguments) { e_prog.arguments = MALLOC(1); e_prog.arguments[0] = '\0'; } strcpy(str, e_prog.arguments); if (e_add_arguments(str, "Arguments", f, 0 , AltA, NULL)) { e_prog.arguments = REALLOC(e_prog.arguments, strlen(str) + 1); strcpy(e_prog.arguments, str); } return(0); } int e_check_c_file(char *name) { int i, j; char *postfix; postfix = strrchr(name, '.'); if (postfix) { for (i = 0; i < e_prog.num; i++) for (j = WpeExpArrayGetSize(e_prog.comp[i]->filepostfix); j; j--) if(!strcmp(e_prog.comp[i]->filepostfix[j - 1], postfix)) { e_copy_prog(&e_s_prog, e_prog.comp[i]); return(i+1); } } return(0); } #ifdef CHECKHEADER int e_check_header(char *file, M_TIME otime, ECNT *cn, int sw) { struct stat cbuf[1]; FILE *fp; char *p, str[120], str2[120]; int i; for (i = cn->mxedt; i > 0; i--) { if (file[0] == DIRC) p = e_mkfilename(cn->f[i]->dirct, cn->f[i]->datnam); else p = cn->f[i]->datnam; if (!strcmp(p, file) && cn->f[i]->save) { e_save(cn->f[i]); if(p != cn->f[i]->datnam) FREE(p); break; } if (p != cn->f[i]->datnam) FREE(p); } if ((fp = fopen(file, "r")) == NULL) return(sw); stat(file, cbuf); if (otime < cbuf->st_mtime) sw++; while (fgets(str, 120, fp)) { for (p = str; isspace(*p); p++); if (*p == '/' && *(p+1) == '*') { p++; do { for (p++; *p && *p != '*'; p++) ; if (!*p && !fgets((p = str), 120, fp)) break; } while (p != NULL && (*p != '*' || *(p+1) != '/')); if (!p) break; for (p += 2; isspace(*p); p++) ; } if (*p == '#') { for (p++; isspace(*p); p++) ; if (!strncmp(p, "include", 7)) { for (p += 8; isspace(*p); p++) ; if (*p == '\"') { for (p++, i = 0; p[i] != '\"' && p[i] != '\0' && p[i] != '\n'; i++) str2[i] = p[i]; str2[i] = '\0'; sw = e_check_header(str2, otime, cn, sw); } } } } fclose(fp); return(sw); } #endif char *e_cat_string(char *p, char *str) { if(str == NULL) return(p = NULL); if(p == NULL) { if((p = MALLOC(strlen(str)+2)) == NULL) return(NULL); p[0] = '\0'; } else if ((p = REALLOC(p, strlen(p) + strlen(str)+2)) == NULL) return(NULL); strcat(p, " "); strcat(p, str); return(p); } int e_make_arg(char ***arg, char *str) { int i, j; char tmp[128], *p = tmp; if (!(*arg)) *arg = (char **) MALLOC(4*sizeof(char *)); else *arg = (char **) REALLOC(*arg, 4*sizeof(char *)); (*arg)[0] = MALLOC(strlen(e_s_prog.compiler) + 1); strcpy((*arg)[0], e_s_prog.compiler); if (!str) { (*arg)[1] = NULL; (*arg)[2] = NULL; return(2); } strcpy(tmp, str); for (j = 2, i = 0; p[i] != '\0'; j++) { for (; p[i] != '\0' && p[i] != ' '; i++) ; (*arg)[j] = MALLOC(i + 1); strncpy((*arg)[j], p, i); (*arg)[j][i] = '\0'; *arg = (char **) REALLOC(*arg, (j + 3)*sizeof(char *)); if (p[i] != '\0') { p += (i + 1); i = 0; } } (*arg)[j] = NULL; return(j); } int e_add_arg(char ***arg, char *str, int n, int argc) { int i; argc++; *arg = (char **) REALLOC(*arg, (argc+1)*sizeof(char *)); for(i = argc; i > n; i--) (*arg)[i] = (*arg)[i-1]; (*arg)[n] = MALLOC(strlen(str) + 1); strcpy((*arg)[n], str); return(argc); } int e_ini_prog(ECNT *cn) { int i; e_prog.num = 4; if (e_prog.arguments) FREE(e_prog.arguments); e_prog.arguments = WpeStrdup(""); if (e_prog.project) FREE(e_prog.project); e_prog.project = WpeStrdup("project.prj"); if (e_prog.exedir) FREE(e_prog.exedir); e_prog.exedir = WpeStrdup("."); if (e_prog.sys_include) FREE(e_prog.sys_include); e_prog.sys_include = WpeStrdup("/usr/include:/usr/local/include:/usr/include/X11"); if (e_prog.comp == NULL) e_prog.comp = MALLOC(e_prog.num * sizeof(struct e_s_prog *)); else e_prog.comp = REALLOC(e_prog.comp, e_prog.num * sizeof(struct e_s_prog *)); for (i = 0; i < e_prog.num; i++) e_prog.comp[i] = MALLOC(sizeof(struct e_s_prog)); e_prog.comp[0]->compiler = WpeStrdup("gcc"); e_prog.comp[0]->language = WpeStrdup("C"); e_prog.comp[0]->filepostfix = (char **)WpeExpArrayCreate(1, sizeof(char *), 1); e_prog.comp[0]->filepostfix[0] = WpeStrdup(".c"); e_prog.comp[0]->key = 'C'; e_prog.comp[0]->x = 0; e_prog.comp[0]->intstr = WpeStrdup(cc_intstr); e_prog.comp[2]->compiler = WpeStrdup("f77"); e_prog.comp[1]->compiler = WpeStrdup("g++"); e_prog.comp[1]->language = WpeStrdup("C++"); e_prog.comp[1]->filepostfix = (char **)WpeExpArrayCreate(4, sizeof(char *), 1); e_prog.comp[1]->filepostfix[0] = WpeStrdup(".C"); e_prog.comp[1]->filepostfix[1] = WpeStrdup(".cc"); e_prog.comp[1]->filepostfix[2] = WpeStrdup(".cpp"); e_prog.comp[1]->filepostfix[3] = WpeStrdup(".cxx"); e_prog.comp[1]->key = '+'; e_prog.comp[1]->x = 1; e_prog.comp[1]->intstr = WpeStrdup(cc_intstr); e_prog.comp[2]->language = WpeStrdup("Fortran"); e_prog.comp[2]->filepostfix = (char **)WpeExpArrayCreate(1, sizeof(char *), 1); e_prog.comp[2]->filepostfix[0] = WpeStrdup(".f"); e_prog.comp[2]->key = 'F'; e_prog.comp[2]->x = 0; e_prog.comp[2]->intstr = WpeStrdup(cc_intstr); e_prog.comp[3]->compiler = WpeStrdup("pc"); e_prog.comp[3]->language = WpeStrdup("Pascal"); e_prog.comp[3]->filepostfix = (char **)WpeExpArrayCreate(1, sizeof(char *), 1); e_prog.comp[3]->filepostfix[0] = WpeStrdup(".p"); e_prog.comp[3]->key = 'P'; e_prog.comp[3]->x = 0; e_prog.comp[3]->intstr = WpeStrdup(pc_intstr); for (i = 0; i < e_prog.num; i++) { e_prog.comp[i]->comp_str = WpeStrdup("-g"); e_prog.comp[i]->libraries = WpeStrdup(""); e_prog.comp[i]->exe_name = WpeStrdup(""); e_prog.comp[i]->comp_sw = i < 2 ? 0 : 1; } e_copy_prog(&e_s_prog, e_prog.comp[0]); return(0); } int e_copy_prog(struct e_s_prog *out, struct e_s_prog *in) { int i; if (out->language) FREE(out->language); out->language = WpeStrdup(in->language); if (out->filepostfix) { for (i = WpeExpArrayGetSize(out->filepostfix); i; i--) WpeFree(out->filepostfix[i - 1]); WpeExpArrayDestroy(out->filepostfix); } out->filepostfix = (char **)WpeExpArrayCreate(WpeExpArrayGetSize(in->filepostfix), sizeof(char *), 1); for (i = WpeExpArrayGetSize(out->filepostfix); i; i--) out->filepostfix[i - 1] = WpeStrdup(in->filepostfix[i - 1]); if (out->compiler) FREE(out->compiler); out->compiler = WpeStrdup(in->compiler); if (out->comp_str) FREE(out->comp_str); out->comp_str = WpeStrdup(in->comp_str); if (out->libraries) FREE(out->libraries); out->libraries = WpeStrdup(in->libraries); if (out->exe_name) FREE(out->exe_name); out->exe_name = WpeStrdup(in->exe_name); if (out->intstr) FREE(out->intstr); out->intstr = WpeStrdup(in->intstr); out->key = in->key; out->comp_sw = in->comp_sw; return(0); } int e_prj_ob_btt(FENSTER *f, int sw) { FLWND *fw; e_data_first(sw+4, f->ed, f->ed->dirct); if (sw > 0) { if (!(f->ed->edopt & ED_CUA_STYLE)) while (e_data_eingabe(f->ed) != AF3) ; else while (e_data_eingabe(f->ed) != CF4) ; fw = (FLWND *)f->ed->f[f->ed->mxedt]->b; fw->df = NULL; e_close_window(f->ed->f[f->ed->mxedt]); } return(0); } int e_prj_ob_file(FENSTER *f) { return(e_prj_ob_btt(f, 0)); } int e_prj_ob_varb(FENSTER *f) { return(e_prj_ob_btt(f, 1)); } int e_prj_ob_inst(FENSTER *f) { return(e_prj_ob_btt(f, 2)); } int e_prj_ob_svas(FENSTER *f) { return(e_project_name(f) ? 0 : AltS); } int e_project_options(FENSTER *f) { int ret; W_OPTSTR *o = e_init_opt_kst(f); char *messagestring; if (!o) return(-1); if (!(e_make_prj_opt(f))) { freeostr(o); return(-1); } o->xa = 8; o->ya = 2; o->xe = 68; o->ye = 22; o->bgsw = 0; o->name = "Project-Options"; o->crsw = AltS; e_add_txtstr(4, 12, "Compiler-Style:", o); e_add_wrstr(4, 2, 22, 2, 36, 128, 0, AltC, "Compiler:", e_s_prog.compiler, NULL, o); e_add_wrstr(4, 4, 22, 4, 36, 256, 3, AltP, "ComPiler-Options:", e_s_prog.comp_str, NULL, o); e_add_wrstr(4, 6, 22, 6, 36, 256, 0, AltL, "Loader-Options:", e_s_prog.libraries, NULL, o); e_add_wrstr(4, 8, 22, 8, 36, 128, 0, AltE, "Executable:", e_s_prog.exe_name, NULL, o); e_add_wrstr(4, 10, 22, 10, 36, 128, 2, AltB, "LiBrary:", library, NULL, o); messagestring = WpeStringToValue(e_s_prog.intstr); e_add_wrstr(22, 12, 22, 13, 36, 256, 0, AltM, "Message-String:", messagestring, NULL, o); WpeFree(messagestring); e_add_pswstr(0, 5, 13, 0, AltG, 0, "GNU ", o); e_add_pswstr(0, 5, 14, 1, AltT, e_s_prog.comp_sw, "OTher ", o); e_add_bttstr(9, 18, 0, AltS, "Save", NULL, o); e_add_bttstr(44, 18, -1, WPE_ESC, "Cancel", NULL, o); e_add_bttstr(26, 18, 5, AltA, "Save As", e_prj_ob_svas, o); /* e_add_bttstr(7, 16, 0, AltF, "Files ...", e_prj_ob_file, o); */ e_add_bttstr(12, 16, 0, AltV, "Variables ...", e_prj_ob_varb, o); e_add_bttstr(35, 16, 0, AltI, "Install ...", e_prj_ob_inst, o); ret = e_opt_kst(o); if (ret != WPE_ESC) { if (e_s_prog.compiler) FREE(e_s_prog.compiler); e_s_prog.compiler = WpeStrdup(o->wstr[0]->txt); if (e_s_prog.comp_str) FREE(e_s_prog.comp_str); e_s_prog.comp_str = WpeStrdup(o->wstr[1]->txt); if (e_s_prog.libraries) FREE(e_s_prog.libraries); e_s_prog.libraries = WpeStrdup(o->wstr[2]->txt); if (e_s_prog.exe_name) FREE(e_s_prog.exe_name); e_s_prog.exe_name = WpeStrdup(o->wstr[3]->txt); if (e_s_prog.intstr) FREE(e_s_prog.intstr); e_s_prog.intstr = WpeValueToString(o->wstr[5]->txt); strcpy(library, o->wstr[4]->txt); e_s_prog.comp_sw = o->pstr[0]->num; e_wrt_prj_fl(f); } freeostr(o); if (f->ed->mxedt > 0) e_ed_rahmen(f, 1); return(0); } int e_run_c_options(FENSTER *f) { int i, j, ret; W_OPTSTR *o = e_init_opt_kst(f); char filepostfix[128]; char *newpostfix; char *messagestring; if (!o) return(-1); o->xa = 8; o->ya = 2; o->xe = 68; o->ye = 22; o->bgsw = 0; o->name = "Compiler-Options"; o->crsw = AltO; e_add_txtstr(4, 14, "Compiler-Style:", o); e_add_wrstr(4, 2, 22, 2, 36, 128, 1, AltA, "LAnguage:", e_s_prog.language, NULL, o); e_add_wrstr(4, 4, 22, 4, 36, 128, 0, AltC, "Compiler:", e_s_prog.compiler, NULL, o); e_add_wrstr(4, 6, 22, 6, 36, 128, 3, AltP, "ComPiler-Options:", e_s_prog.comp_str, NULL, o); e_add_wrstr(4, 8, 22, 8, 36, 128, 0, AltL, "Loader-Options:", e_s_prog.libraries, NULL, o); e_add_wrstr(4, 10, 22, 10, 36, 128, 0, AltE, "Executable:", e_s_prog.exe_name, NULL, o); filepostfix[0] = 0; if ((j = WpeExpArrayGetSize(e_s_prog.filepostfix))) { strcpy(filepostfix, e_s_prog.filepostfix[0]); for (i = 1; i < j; i++) { strcat(filepostfix, " "); strcat(filepostfix, e_s_prog.filepostfix[i]); } } e_add_wrstr(4, 12, 22, 12, 36, 128, 0, AltF, "File-Postfix:", filepostfix, NULL, o); messagestring = WpeStringToValue(e_s_prog.intstr); e_add_wrstr(22, 14, 22, 15, 36, 128, 0, AltM, "Message-String:", messagestring, NULL, o); WpeFree(messagestring); e_add_pswstr(0, 5, 15, 0, AltG, 0, "GNU ", o); e_add_pswstr(0, 5, 16, 1, AltT, e_s_prog.comp_sw, "OTher ", o); e_add_bttstr(16, 18, 1, AltO, " Ok ", NULL, o); e_add_bttstr(37, 18, -1, WPE_ESC, "Cancel", NULL, o); ret = e_opt_kst(o); if (ret != WPE_ESC) { if (e_s_prog.language) FREE(e_s_prog.language); e_s_prog.language = WpeStrdup(o->wstr[0]->txt); if (e_s_prog.compiler) FREE(e_s_prog.compiler); e_s_prog.compiler = WpeStrdup(o->wstr[1]->txt); if (e_s_prog.comp_str) FREE(e_s_prog.comp_str); e_s_prog.comp_str = WpeStrdup(o->wstr[2]->txt); if (e_s_prog.libraries) FREE(e_s_prog.libraries); e_s_prog.libraries = WpeStrdup(o->wstr[3]->txt); if (e_s_prog.exe_name) FREE(e_s_prog.exe_name); e_s_prog.exe_name = WpeStrdup(o->wstr[4]->txt); for (i = 0; i < j; i++) WpeFree(e_s_prog.filepostfix[i]); WpeExpArrayDestroy(e_s_prog.filepostfix); e_s_prog.filepostfix = (char **)WpeExpArrayCreate(0, sizeof(char *), 1); for (i = 0; o->wstr[5]->txt[i]; i++) { if (isspace(o->wstr[5]->txt[i])) continue; for (j = i; (o->wstr[5]->txt[j]) && (!isspace(o->wstr[5]->txt[j])); j++) ; newpostfix = (char *)WpeMalloc(sizeof(char) * j - i + 1); strncpy(newpostfix, o->wstr[5]->txt + i, j - i); newpostfix[j - i] = 0; WpeExpArrayAdd((void **)&e_s_prog.filepostfix, &newpostfix); i = j - 1; } if (e_s_prog.intstr) FREE(e_s_prog.intstr); e_s_prog.intstr = WpeValueToString(o->wstr[6]->txt); e_s_prog.comp_sw = o->pstr[0]->num; } freeostr(o); return(0); } int e_run_options(FENSTER *f) { int i, n, xa = 48, ya = 2, num = 2 + e_prog.num; OPTK *opt = MALLOC(num * sizeof(OPTK)); char tmp[80]; tmp[0] = '\0'; opt[0].t = "Add Compiler "; opt[0].x = 0; opt[0].o = 'A'; opt[1].t = "Remove Compiler"; opt[1].x = 0; opt[1].o = 'R'; for (i = 0; i < e_prog.num; i++) { opt[i+2].t = e_prog.comp[i]->language; opt[i+2].x = e_prog.comp[i]->x; opt[i+2].o = e_prog.comp[i]->key; } n = e_opt_sec_box(xa, ya, num, opt, f, 1); if (n == 0) { if (!e_run_c_options(f)) { e_prog.num++; e_prog.comp = REALLOC(e_prog.comp, e_prog.num * sizeof(struct e_s_prog *)); e_prog.comp[e_prog.num - 1] = MALLOC(sizeof(struct e_s_prog)); e_prog.comp[e_prog.num - 1]->language = (char *)WpeMalloc(1); e_prog.comp[e_prog.num - 1]->language[0] = 0; e_prog.comp[e_prog.num - 1]->compiler = (char *)WpeMalloc(1); e_prog.comp[e_prog.num - 1]->compiler[0] = 0; e_prog.comp[e_prog.num - 1]->comp_str = (char *)WpeMalloc(1); e_prog.comp[e_prog.num - 1]->comp_str[0] = 0; e_prog.comp[e_prog.num - 1]->libraries = (char *)WpeMalloc(1); e_prog.comp[e_prog.num - 1]->libraries[0] = 0; e_prog.comp[e_prog.num - 1]->exe_name = (char *)WpeMalloc(1); e_prog.comp[e_prog.num - 1]->exe_name[0] = 0; e_prog.comp[e_prog.num - 1]->intstr = (char *)WpeMalloc(1); e_prog.comp[e_prog.num - 1]->intstr[0] = 0; e_prog.comp[e_prog.num - 1]->filepostfix = (char **)WpeExpArrayCreate(0, sizeof(char *), 1); e_copy_prog(e_prog.comp[e_prog.num-1], &e_s_prog); for (n = 0; e_prog.comp[e_prog.num-1]->language[n]; n++) { for (i = 0; i <= e_prog.num && toupper(e_prog.comp[e_prog.num-1]->language[n]) != opt[i].o; i++) ; if (i > e_prog.num) break; } e_prog.comp[e_prog.num-1]->key = toupper(e_prog.comp[e_prog.num-1]->language[n]); e_prog.comp[e_prog.num-1]->x = n; } } else if (n == 1) { if(e_add_arguments(tmp, "Remove Compiler", f, 0, AltR, NULL)) { for (i = 0; i < e_prog.num && strcmp(e_prog.comp[i]->language, tmp); i++) ; if (i >= e_prog.num) { e_error(e_p_msg[ERR_NO_COMPILER], 0, f->fb); FREE(opt); return(0); } FREE(e_prog.comp[i]); for(; i < e_prog.num-1; i++) e_prog.comp[i] = e_prog.comp[i+1]; e_prog.num--; } } else if (n > 1) { e_copy_prog(&e_s_prog, e_prog.comp[n-2]); e_run_c_options(f); e_copy_prog(e_prog.comp[n-2], &e_s_prog); } FREE(opt); return(n < 0 ? WPE_ESC : 0); } int e_project_name(FENSTER *f) { char str[80]; if (!e_prog.project) { e_prog.project = MALLOC(1); e_prog.project[0] = '\0'; } strcpy(str, e_prog.project); if (e_add_arguments(str, "Project", f, 0, AltP, NULL)) { e_prog.project = REALLOC(e_prog.project, strlen(str) + 1); strcpy(e_prog.project, str); return(0); } return(WPE_ESC); } int e_project(FENSTER *f) { ECNT *cn = f->ed; int i; if (!e_project_name(f)) { for (i = cn->mxedt; i > 0 && (cn->f[i]->dtmd != DTMD_DATA || cn->f[i]->ins != 4); i--) ; if (i > 0) { e_switch_window(cn->edt[i], cn->f[cn->mxedt]); e_close_window(cn->f[cn->mxedt]); } f = cn->f[cn->mxedt]; e_make_prj_opt(f); e_rel_brkwtch(f); e_prj_ob_file(f); return(0); } return(WPE_ESC); } int e_show_project(FENSTER *f) { ECNT *cn = f->ed; int i; for (i = cn->mxedt; i > 0 && (cn->f[i]->dtmd != DTMD_DATA || cn->f[i]->ins != 4); i--) ; if (i > 0) e_switch_window(cn->edt[i], cn->f[cn->mxedt]); else { e_make_prj_opt(f); e_prj_ob_file(f); } return(0); } int e_cl_project(FENSTER *f) { ECNT *cn = f->ed; int i; if (!e_prog.project) e_prog.project = MALLOC(sizeof(char)); else e_prog.project = REALLOC(e_prog.project, sizeof(char)); e_prog.project[0] = '\0'; for (i = cn->mxedt; i > 0 && (cn->f[i]->dtmd != DTMD_DATA || cn->f[i]->ins != 4); i--) ; if (i > 0) { e_switch_window(cn->edt[i], cn->f[cn->mxedt]); e_close_window(cn->f[cn->mxedt]); } return(0); } int e_p_add_item(FENSTER *f) { ECNT *cn = f->ed; int i; for (i = cn->mxedt; i > 0 && (cn->f[i]->dtmd != DTMD_DATA || cn->f[i]->ins != 4); i--) ; if (i > 0) e_switch_window(cn->edt[i], cn->f[cn->mxedt]); else { FLWND *fw; e_make_prj_opt(f); e_prj_ob_file(f); fw = (FLWND *) cn->f[cn->mxedt]->b; fw->nf = fw->df->anz - 1; } cn->f[cn->mxedt]->save = 1; WpeCreateFileManager(5, cn, NULL); WpeHandleFileManager(cn); return(0); } int e_p_del_item(FENSTER *f) { ECNT *cn = f->ed; int i; for (i = cn->mxedt; i > 0 && (cn->f[i]->dtmd != DTMD_DATA || cn->f[i]->ins != 4); i--) ; if (i > 0) e_switch_window(cn->edt[i], cn->f[cn->mxedt]); else return(e_error(e_p_msg[ERR_NOPROJECT], 0, f->fb)); f = cn->f[cn->mxedt]; f->save = 1; e_p_del_df((FLWND *) f->b, f->ins); return 0; } int e_make_library(char *library, char *ofile, FENSTER *f) { char *ar_arg[5] = { NULL, NULL, NULL, NULL, NULL }; int ret = 0, file = -1; PIC *pic = NULL; ar_arg[0] = "ar"; if (access(library, 0)) ar_arg[1] = "-cr"; else ar_arg[1] = "-r"; ar_arg[2] = library; ar_arg[3] = ofile; if ((ret = e_p_mess_win("Insert into Archive", 4, ar_arg, &pic, f)) == 0) { e_sys_ini(); file = e_exec_inf(f, ar_arg, 4); e_sys_end(); if ((file) && ((ret = e_p_exec(file, f, pic)) == 0)) { pic = NULL; /* #ifdef RANLIB ar_arg[0] = "ranlib"; ar_arg[1] = library; ar_arg[2] = NULL; if(ret = e_p_mess_win("Convert Archive", 2, ar_arg, &pic, f)) goto m_l_ende; e_sys_ini(); file = e_exec_inf(f, ar_arg, 2); e_sys_end(); if(file) ret = e_p_exec(file, f, pic); #endif */ } } return((!ret && file) ? 0 : -1); } int e_system(char *estr, ECNT *cn) { #if MOUSE int g[4]; #endif int ret; PIC *outp; FENSTER *f; #if MOUSE g[0] = 2; fk_mouse(g); #endif f = cn->f[cn->mxedt-1]; outp = e_open_view(0,0,MAXSCOL-1,MAXSLNS-1,cn->fb->ws,1); fk_locate(0,0); fk_cursor(1); (*e_u_s_sys_ini)(); ret = system(estr); if (!WpeIsXwin()) { printf(e_msg[ERR_HITCR]); fflush(stdout); fk_getch(); } (*e_u_s_sys_end)(); e_close_view(outp, 1); fk_cursor(0); #if MOUSE g[0] = 1; fk_mouse(g); #endif return(ret); } /* arranges string str into buffer b and eventually wrappes string around wrap_limit columns */ int print_to_end_of_buffer(BUFFER * b,char * str,int wrap_limit) { int i,k,j; k = 0; do { if (wrap_limit != 0) for (j = 0; ((j < wrap_limit) && (!((str[j + k] == '\n') || (str[j + k] == '\0')))); j++) ; else for (j = 0; (!((str[j + k] == '\n') || (str[j + k] == '\0'))); j++) ; /* Don't add blank lines */ if (j == k) break; /* b->mxlines - count of lines in b so add one more line at the end of buffer */ e_new_line(b->mxlines, b); i = b->mxlines-1; /* copy char from string (str) to buffer */ if (str[j + k]!='\0') b->bf[i].s = REALLOC(b->bf[i].s, j + 2); else b->bf[i].s = REALLOC(b->bf[i].s, j + 1); strncpy(b->bf[i].s,str + k,j); /* if this is not end of string, then we created substring if *(b->bf[i].s+j) is not '\0' then it is soft break is not written to file */ if (str[j + k]!='\0') { *(b->bf[i].s + j) = '\n'; *(b->bf[i].s + j + 1) = '\0'; } else { *(b->bf[i].s + j) = '\0'; } /* update len of line in buffer */ b->bf[i].len = j; b->bf[i].nrc = j + 1; if (str[j + k]=='\n') { j++; } k += j; /* loop until end of string } while (str[k] != '\n' && str[k] != '\0');*/ } while (str[k] != '\0'); return 0; } /* print to message window */ int e_d_p_message(char *str, FENSTER *f, int sw) { ECNT *cn = f->ed; BUFFER *b; SCHIRM *s; int i; if (str[0] == '\0' || str[0] == '\n') return(0); for (i = cn->mxedt; i > 0 && strcmp(cn->f[i]->datnam, "Messages"); i--) ; if (i == 0) { if (e_edit(cn, "Messages")) return(-1); else i = cn->mxedt; } /* f - window */ f = cn->f[i]; /* b - buffer */ b = cn->f[i]->b; /* s - content of window */ s = cn->f[i]->s; print_to_end_of_buffer(b, str, b->mx.x); /* place cursor on the last line */ b->b.y = b->mxlines-1; if (sw) e_rep_win_tree(cn); else if (WpeIsXwin()) { e_schirm(f, 0); e_cursor(f, 0); e_refresh(); } return(0); } #if MOUSE int e_d_car_mouse(FENSTER *f) { extern struct mouse e_mouse; BUFFER *b = f->ed->f[f->ed->mxedt]->b; SCHIRM *s = f->ed->f[f->ed->mxedt]->s; if (e_mouse.y-f->a.y+s->c.y-1 == b->b.y) return(WPE_CR); else { b->b.y = e_mouse.y-f->a.y+s->c.y-1; b->b.x = e_mouse.x-f->a.x+s->c.x-1; } return(0); } #endif int e_exec_make(FENSTER *f) { ECNT *cn = f->ed; char **arg = NULL; int i, file, argc; WpeMouseChangeShape(WpeWorkingShape); efildes[0] = efildes[1] = -1; wfildes[0] = wfildes[1] = -1; for (i = cn->mxedt; i > 0; i--) if (!strcmp(cn->f[i]->datnam, "Makefile") || !strcmp(cn->f[i]->datnam, "makefile")) { e_switch_window(cn->edt[i], cn->f[cn->mxedt]); e_save(cn->f[cn->mxedt]); } if (e_new_message(f)) return(WPE_ESC); f = cn->f[cn->mxedt]; e_sys_ini(); if (e_s_prog.compiler) FREE(e_s_prog.compiler); e_s_prog.compiler = MALLOC(5*sizeof(char)); strcpy(e_s_prog.compiler, "make"); argc = e_make_arg(&arg, e_prog.arguments); if (argc == 0) { arg[1] = NULL; argc = 2; } else { for (i = 1; i < argc; i++) arg[i] = arg[i+1]; } if ((file = e_exec_inf(f, arg, argc)) == 0) { e_sys_end(); WpeMouseRestoreShape(); return(WPE_ESC); } e_sys_end(); e_free_arg(arg, argc - 1); i = e_p_exec(file, f, NULL); WpeMouseRestoreShape(); return(i); } int e_run_sh(FENSTER *f) { int ret, len = strlen(f->datnam); char estr[128]; if (strcmp(f->datnam+len-3, ".sh")) return(1); WpeMouseChangeShape(WpeWorkingShape); f->filemode |= 0100; if (f->save) e_save(f); strcpy(estr, f->datnam); strcat(estr, " "); if (e_prog.arguments) strcat(estr, e_prog.arguments); #ifndef NO_XWINDOWS if (WpeIsXwin()) { ret = (*e_u_system)(estr); } else #endif ret = e_system(estr, f->ed); WpeMouseRestoreShape(); return(0); } /* new project */ struct proj_var { char *var, *string; } **p_v = NULL; int p_v_n = 0; char *e_interpr_var(char *string) { int i, j; for (i = 0; string[i]; i++) { if (string[i] == '\\') for (j = i; (string[j] = string[j+1]) != '\0'; j++) ; else if (string[i] == '\'' || string[i] == '\"') { for(j = i; (string[j] = string[j+1]) != '\0'; j++) ; i--; } } return(string); } char *e_expand_var(char *string, FENSTER *f) { int i, j = 0, k, len, kl = 0; char *var = NULL, *v_string, *tmp; for (i = 0; string[i]; i++) { if (string[i] == '\'') { kl = kl ? 0 : 1; for (j = i; (string[j] = string[j+1]) != '\0'; j++); i--; continue; } if (string[i] == '\\' && (string[i+1] == 'n' || string[i+1] == 'r')) { string[i] = string[i+1] == 'n' ? '\n' : '\r'; for (j = i+1; (string[j] = string[j+1]) != '\0'; j++); continue; } if (string[i] == '$' && !kl && (!i || string[i-1] != '\\')) { if (string[i+1] == '(') { for (j = i+2; string[j] && string[j] != ')'; j++); if (!string[j]) continue; } else if (string[i+1] == '{') { for (j = i+2; string[j] && string[j] != '}'; j++); if (!string[j]) continue; } if (string[i+1] == '(' || string[i+1] == '{') { if (!(var = MALLOC((j-i-1) * sizeof(char)))) { e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(string); } for (k = i+2; k < j; k++) var[k-i-2] = string[k]; var[k-i-2] = '\0'; } else { if (!(var = MALLOC(2 * sizeof(char)))) { e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(string); } var[0] = string[i+1]; var[1] = '\0'; } if (!(v_string = getenv(var))) { for (k = 0; k < p_v_n - 1; k++) { if (!strcmp(p_v[k]->var, var)) { v_string = p_v[k]->string; break; } } } if (string[i+1] == '(' || string[i+1] == '{') len = (j-i+1); else len = 2; if (!v_string) { for(k = i; (string[k] = string[k+len]) != '\0'; k++); if (!(string = REALLOC(tmp = string, (strlen(string) + 1) * sizeof(char)))) { FREE(var); e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(tmp); } } else { len = strlen(v_string) - len; if (len >= 0) { if (!(string = REALLOC(tmp = string, (k = strlen(string) + len + 1) * sizeof(char)))) { FREE(var); e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(tmp); } for (k--; k > j + len; k--) string[k] = string[k-len]; for (k = i; v_string[k-i]; k++) string[k] = v_string[k-i]; } else { for (k = i; (string[k] = string[k-len]) != '\0'; k++); for (k = i; v_string[k-i]; k++) string[k] = v_string[k-i]; if (!(string = REALLOC(tmp = string, (strlen(string) + 1) * sizeof(char)))) { FREE(var); e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(tmp); } } } FREE(var); } } return(string); } int e_read_var(FENSTER *f) { struct proj_var **tmp; FILE *fp; char str[256], *sp1, *sp2, *stmp; int i; if ((fp = fopen(e_prog.project, "r")) == NULL) return(-1); if (p_v) { for (i = 0; i < p_v_n; i++) { if (p_v[i]) { if (p_v[i]->var) FREE(p_v[i]->var); if (p_v[i]->string) FREE(p_v[i]->string); FREE(p_v[i]); } } FREE(p_v); } p_v_n = 0; if (!(p_v = MALLOC(sizeof(struct proj_var *)))) { fclose(fp); e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(-1); } while (fgets(str, 256, fp)) { for (i = 0; isspace(str[i]); i++); if (!str[i]) continue; else if (str[i] == '#') { while (str[strlen(str)-1] != '\n') { fgets(str, 256, fp); } continue; } sp1 = str + i; sp2 = strchr(sp1, '='); if (sp2 == NULL) continue; for (stmp = sp1; !((isspace(*stmp)) || (*stmp == '=')) && *stmp; stmp++) ; *stmp = 0; for (sp2++; isspace(*sp2) && *sp2 != '\n'; sp2++); p_v_n++; if (!(p_v = REALLOC(tmp = p_v, sizeof(struct proj_var *) * p_v_n))) { p_v = tmp; fclose(fp); e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(-1); } if (!(p_v[p_v_n-1] = MALLOC(sizeof(struct proj_var)))) { fclose(fp); e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(-1); } if (!(p_v[p_v_n-1]->var = MALLOC((strlen(sp1)+1) * sizeof(char)))) { fclose(fp); e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(-1); } strcpy(p_v[p_v_n-1]->var, sp1); if (!(p_v[p_v_n-1]->string = MALLOC((strlen(sp2)+1) * sizeof(char)))) { fclose(fp); e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(-1); } strcpy(p_v[p_v_n-1]->string, sp2); while (p_v[p_v_n-1]->string[i = strlen(p_v[p_v_n-1]->string) - 1] != '\n' || (i && p_v[p_v_n-1]->string[i-1] == '\\')) { if (p_v[p_v_n-1]->string[i-1] == '\\') p_v[p_v_n-1]->string[i-1] = '\0'; if (!fgets(str, 256, fp)) break; if (!(p_v[p_v_n-1]->string = REALLOC(stmp = p_v[p_v_n-1]->string, (strlen(p_v[p_v_n-1]->string)+strlen(str)+1) * sizeof(char)))) { p_v[p_v_n-1]->string = stmp; fclose(fp); e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(-1); } strcat(p_v[p_v_n-1]->string, str); } p_v[p_v_n-1]->string[strlen(p_v[p_v_n-1]->string) - 1] = '\0'; for (i = 0; p_v[p_v_n-1]->string[i]; i++) if (p_v[p_v_n-1]->string[i] == '\t') p_v[p_v_n-1]->string[i] = ' '; p_v[p_v_n-1]->string = e_expand_var(p_v[p_v_n-1]->string, f); } fclose(fp); return(0); } int e_install(FENSTER *f) { char *tp, *sp, *string, *tmp, text[256]; FILE *fp; int i, j; if (e_p_make(f)) return(-1); if (!e__project) return(0); if ((fp = fopen(e_prog.project, "r")) == NULL) { sprintf(text, e_msg[ERR_FOPEN], e_prog.project); e_error(text, 0, f->fb); return(WPE_ESC); } while ((tp = fgets(text, 256, fp))) { if (text[0] == '\t') continue; for (i = 0; isspace(text[i]); i++) ; if (!strncmp(text+i, "install:", 8)) { while (tp && (text[j = strlen(text)-1] != '\n' || text[j-1] == '\\')) tp = fgets(text, 256, fp); break; } } if (!tp) { fclose(fp); return(1); } while (tp && (tp = fgets(text, 256, fp))) { for (i = 0; isspace(text[i]); i++) ; sp = text+i; if (sp[0] == '#') { while (tp && (text[j = strlen(text)-1] != '\n' || text[j-1] == '\\')) tp = fgets(text, 256, fp); continue; } if (text[0] != '\t') break; if (!(string = MALLOC(strlen(sp) + 1))) { fclose(fp); e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(-1); } strcpy(string, sp); while (tp && (text[j = strlen(text)-1] != '\n' || text[j-1] == '\\')) { tp = fgets(text, 256, fp); if (tp) { if (!(string = REALLOC(tmp = string, strlen(string) + strlen(text) + 1))) { fclose(fp); FREE(tmp); e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(-1); } strcat(string, text); } } if (p_v_n) p_v_n++; string = e_expand_var(string, f); if (p_v_n) p_v_n--; e_d_p_message(string, f, 1); system(string); FREE(string); } fclose(fp); return(0); } struct dirfile *e_p_get_args(char *string) { struct dirfile *df = MALLOC(sizeof(struct dirfile)); char **tmp; int i, j, k; if (!df) return(NULL); if (!(df->name = MALLOC(sizeof(char *)))) { FREE(df); return(NULL); } df->anz = 0; for (i = 0; string[i]; ) { for (; isspace(string[i]); i++) ; for (j = i; string[j] && !isspace(string[j]); j++) ; if (j == i) break; df->anz++; if (!(df->name = REALLOC(tmp = df->name, df->anz * sizeof(char *)))) { df->anz--; df->name = tmp; return(df); } if (!(df->name[df->anz-1] = MALLOC((j-i+1)*sizeof(char)))) { df->anz--; return(df); } for (k = i; k < j; k++) *(df->name[df->anz-1] + k - i) = string[k]; *(df->name[df->anz-1] + k - i) = '\0'; e_interpr_var(df->name[df->anz-1]); i = j; } return(df); } struct dirfile *e_p_get_var(char *string) { int i; for (i = 0; i < p_v_n; i++) { if(!strcmp(p_v[i]->var, string)) return(e_p_get_args(p_v[i]->string)); } return(NULL); } int e_c_project(FENSTER *f) { ECNT *cn = f->ed; struct dirfile *df = NULL; char **arg; int i, j, k, file= -1, len, elen, argc, libsw = 0, exlib = 0, sccs = 0; char ofile[128]; #ifdef CHECKHEADER struct stat lbuf[1], obuf[1]; #else struct stat lbuf[1], cbuf[1], obuf[1]; #endif PIC *pic = NULL; last_time = (M_TIME) 0; e_p_l_comp = 0; if (e_new_message(f)) return(WPE_ESC); f = cn->f[cn->mxedt]; if (e_s_prog.comp_str) { FREE(e_s_prog.comp_str); e_s_prog.comp_str = NULL; } e_s_prog.comp_sw &= ~1; e_argc = 1; argc = 1; for(i = f->ed->mxedt; i > 0 && (f->ed->f[i]->dtmd != DTMD_DATA || f->ed->f[i]->ins != 4 || !f->ed->f[i]->save); i--) ; if (i > 0) e_p_update_prj_fl(f); if (e_read_var(f)) { sprintf(ofile, e_msg[ERR_FOPEN], e_prog.project); e_error(ofile, 0, f->fb); return(-1); } e_arg = (char **) MALLOC(e_argc*sizeof(char *)); arg = (char **) MALLOC(argc*sizeof(char *)); df = e_p_get_var("CMP"); if (!df) { e_error(e_p_msg[ERR_NOTHING], 0, f->fb); e_free_arg(arg, argc); e_free_arg(e_arg, e_argc); return(-1); } for (k = 0; k < df->anz; k++, e_argc++, argc++) { j = e_argc == 1 ? 1 : 0; e_arg = REALLOC(e_arg, (e_argc+2)*sizeof(char *)); e_arg[e_argc-j] = MALLOC(strlen(df->name[k]) + 1); strcpy(e_arg[e_argc-j], df->name[k]); arg = REALLOC(arg, (argc+2)*sizeof(char *)); arg[argc-j] = MALLOC(strlen(df->name[k]) + 1); strcpy(arg[argc-j], df->name[k]); if (e_argc > 1) e_s_prog.comp_str = e_cat_string(e_s_prog.comp_str, e_arg[e_argc-j]); } freedf(df); arg[1] = MALLOC(3); strcpy(arg[1], "-c"); e_arg[1] = MALLOC(3); strcpy(e_arg[1], "-o"); df = e_p_get_var("CMPFLAGS"); if (df) { for (k = 0; k < df->anz; k++, e_argc++, argc++) { j = e_argc == 1 ? 1 : 0; e_arg = REALLOC(e_arg, (e_argc+2)*sizeof(char *)); e_arg[e_argc-j] = MALLOC(strlen(df->name[k]) + 1); strcpy(e_arg[e_argc-j], df->name[k]); arg = REALLOC(arg, (argc+2)*sizeof(char *)); arg[argc-j] = MALLOC(strlen(df->name[k]) + 1); strcpy(arg[argc-j], df->name[k]); if (e_argc > 1) e_s_prog.comp_str = e_cat_string(e_s_prog.comp_str, e_arg[e_argc-j]); } freedf(df); } df = e_p_get_var("EXENAME"); elen = strlen(e_prog.exedir)-1; if (e_prog.exedir[elen] == '/') sprintf(ofile, "%s%s", e_prog.exedir, (df && df->anz > 0 && df->name[0][0]) ? df->name[0] : "a.out"); else sprintf(ofile, "%s/%s", e_prog.exedir, (df && df->anz > 0 && df->name[0][0]) ? df->name[0] : "a.out"); if (df) freedf(df); if (e_s_prog.exe_name) FREE(e_s_prog.exe_name); e_s_prog.exe_name = WpeStrdup(ofile); e_argc = e_add_arg(&e_arg, e_s_prog.exe_name, 2, e_argc); df = e_p_get_var("LIBNAME"); if (df) { strcpy(library, df->name[0]); if (access(library, 0)) exlib = 1; else stat(library, lbuf); freedf(df); } else library[0] = '\0'; df = e_p_get_var("CMPSWTCH"); if (df) { if (!strcmp(df->name[0], "other")) e_s_prog.comp_sw = 1; freedf(df); } df = e_p_get_var("CMPMESSAGE"); if (df) { char *tmpstr = MALLOC(1); tmpstr[0] = '\0'; for (k = 0; k < df->anz; k++) { tmpstr = REALLOC(tmpstr, (strlen(tmpstr)+strlen(df->name[k])+2)*sizeof(char)); if (k) strcat(tmpstr, " "); strcat(tmpstr, df->name[k]); } if (e_s_prog.intstr) FREE(e_s_prog.intstr); e_s_prog.intstr = WpeStrdup(tmpstr); FREE(tmpstr); freedf(df); } else { if (e_s_prog.intstr) FREE(e_s_prog.intstr); e_s_prog.intstr = WpeStrdup(cc_intstr); } df = e_p_get_var("FILES"); if (!df) { e_error(e_p_msg[ERR_NOTHING], 0, cn->fb); e_free_arg(arg, argc); e_free_arg(e_arg, e_argc); return(-1); } arg[argc] = NULL; elen = strlen(e_prog.exedir)-1; for (k = 0; k < df->anz; k++) { for (j = cn->mxedt; j > 0; j--) if (!strcmp(cn->f[j]->datnam, df->name[k]) && cn->f[j]->save) e_save(cn->f[j]); for (j = strlen(df->name[k])-1; j >= 0 && df->name[k][j] != DIRC; j--) ; if (e_prog.exedir[elen] == '/') sprintf(ofile, "%s%s ", e_prog.exedir, df->name[k]+j+1); else sprintf(ofile, "%s/%s ", e_prog.exedir, df->name[k]+j+1); for (j = strlen(ofile); j > 0 && ofile[j] != '.'; j--) ; ofile[j+1] = 'o'; ofile[j+2] = '\0'; if (!stat(ofile, obuf)) { if (obuf->st_mtime > last_time) last_time = obuf->st_mtime; #ifdef CHECKHEADER if (!e_check_header(df->name[k], obuf->st_mtime, cn, 0)) goto gt_library; #else stat(df->name[k], cbuf); if (obuf->st_mtime >= cbuf->st_mtime) goto gt_library; #endif } argc = e_add_arg(&arg, df->name[k], argc, argc); #ifndef NO_MINUS_C_MINUS_O argc = e_add_arg(&arg, "-o", argc, argc); argc = e_add_arg(&arg, ofile, argc, argc); #endif arg[argc] = NULL; remove(ofile); sccs = 1; j = e_p_mess_win("Compiling", argc, arg, &pic, f); e_sys_ini(); if (j != 0 || (file = e_exec_inf(f, arg, argc)) == 0) { e_sys_end(); e_free_arg(arg, argc); freedf(df); e_free_arg(e_arg, e_argc); if (pic) e_close_view(pic, 1); return(WPE_ESC); } e_sys_end(); e_p_l_comp = 1; if (e_p_exec(file, f, pic)) { e_free_arg(arg, argc); e_free_arg(e_arg, e_argc); freedf(df); return(-1); } pic = NULL; for (j = strlen(ofile); j >= 0 && ofile[j] != '/'; j--) ; if (!exlib && library[0] != '\0' && strcmp(ofile+j+1, "main.o") && (strncmp(e_s_prog.exe_name, ofile+j+1,(len = strlen(e_s_prog.exe_name))) || ofile[len] == '.')) { if(e_make_library(library, ofile, f)) { e_free_arg(arg, argc); e_free_arg(e_arg, e_argc); freedf(df); return(-1); } else libsw = 1; } for (j = 0; j < 3; j++) FREE(arg[argc-j-1]) ; argc -= 3; gt_library: for (j = strlen(ofile); j >= 0 && ofile[j] != '/'; j--) ; if (library[0] == '\0' || !strcmp(ofile+j+1, "main.o") || (!strncmp(e_s_prog.exe_name, ofile+j+1,(len = strlen(e_s_prog.exe_name))) && ofile[len] == '.')) e_argc = e_add_arg(&e_arg, ofile, e_argc, e_argc); else if (exlib || obuf->st_mtime >= lbuf->st_mtime) { if (e_make_library(library, ofile, f)) { e_free_arg(arg, argc); e_free_arg(e_arg, e_argc); freedf(df); return(-1); } else libsw = 1; } } #ifdef RANLIB if (libsw && library[0] != '\0') { char *ar_arg[3]; ar_arg[0] = "ranlib"; ar_arg[1] = library; ar_arg[2] = NULL; if (!(j = e_p_mess_win("Convert Archive", 2, ar_arg, &pic, f))) { e_sys_ini(); file = e_exec_inf(f, ar_arg, 2); e_sys_end(); if (file) j = e_p_exec(file, f, pic); } if (j || !file) { e_free_arg(arg, argc); e_free_arg(e_arg, e_argc); freedf(df); return(-1); } } #endif if (library[0] != '\0') e_argc = e_add_arg(&e_arg, library, e_argc, e_argc); freedf(df); df = e_p_get_var("LDFLAGS"); if (df) { FREE(e_s_prog.libraries); e_s_prog.libraries = NULL; for (k = 0; k < df->anz; k++, e_argc++) { e_arg = REALLOC(e_arg, (e_argc+2)*sizeof(char *)); e_arg[e_argc] = MALLOC(strlen(df->name[k]) + 1); strcpy(e_arg[e_argc], df->name[k]); e_s_prog.libraries = e_cat_string(e_s_prog.libraries, e_arg[e_argc]); } freedf(df); } e_arg[e_argc] = NULL; e_free_arg(arg, argc); if (!sccs) e_p_exec(file, f, pic); return(0); } int e_free_arg(char **arg, int argc) { int i; for(i = 0; i < argc; i++) if(arg[i]) FREE(arg[i]); FREE(arg); return(i); } char *e_find_var(char *var) { int i; for(i = 0; i < p_v_n && strcmp(p_v[i]->var, var); i++); if(i >= p_v_n) return(NULL); else return(p_v[i]->string); } /****************************************************/ /**** reloading watches and breakpoints from prj ****/ /**** based on p_v variable ****/ /**** this function is called only on project opening. It is used for additional parsing variables from project file, ie for loading BREAKPOINTS and WATCHES. ****/ int e_rel_brkwtch(FENSTER *f) { int i; for (i = 0; i < p_v_n; i++) { if (!strcmp(p_v[i]->var, "BREAKPOINTS")) { e_d_reinit_brks(f,p_v[i]->string); } else if (!strcmp(p_v[i]->var, "WATCHES")) { e_d_reinit_watches(f,p_v[i]->string); } } return 0; } /****************************************************/ /**** this function is called each time options window is opened. But unfortunately also reloads variables from project file, which is not good for WATCHES and BREAKPOINTS. ****/ struct dirfile **e_make_prj_opt(FENSTER *f) { int i, j, ret; char **tmp, *sp, *tp, text[256]; FILE *fp; struct dirfile *save_df = NULL; for (i = f->ed->mxedt; i > 0 && (f->ed->f[i]->dtmd != DTMD_DATA || f->ed->f[i]->ins != 4 || !f->ed->f[i]->save); i--); if (i > 0) { save_df = e_p_df[0]; e_p_df[0] = NULL; } if (e_p_df) freedfN(e_p_df, 3); e_p_df = MALLOC(3 * sizeof(struct dirfile *)); if (!e_p_df) return(e_p_df); for (i = 0; i < 3; i++) e_p_df[i] = NULL; e_s_prog.comp_sw = 0; ret = e_read_var(f); if (ret) { if (e_s_prog.compiler) FREE(e_s_prog.compiler); e_s_prog.compiler = WpeStrdup("gcc"); if (e_s_prog.comp_str) FREE(e_s_prog.comp_str); e_s_prog.comp_str = WpeStrdup("-g"); if (e_s_prog.libraries) FREE(e_s_prog.libraries); e_s_prog.libraries = WpeStrdup(""); if (e_s_prog.exe_name) FREE(e_s_prog.exe_name); /* Project my_prog.prj defaults to an executable of my_prog BD */ strcpy(text, e_prog.project); e_s_prog.exe_name = WpeStrdup(WpeStringCutChar(text, '.')); /*e_s_prog.exe_name = WpeStrdup("a.out");*/ if (e_s_prog.intstr) FREE(e_s_prog.intstr); e_s_prog.intstr = WpeStrdup(cc_intstr); strcpy(library, ""); for (i = !save_df ? 0 : 1; i < 3; i++) { e_p_df[i] = MALLOC(sizeof(struct dirfile)); e_p_df[i]->name = MALLOC(sizeof(char *)); e_p_df[i]->name[0] = MALLOC(2 * sizeof(char)); *e_p_df[i]->name[0] = ' '; *(e_p_df[i]->name[0] + 1) = '\0'; e_p_df[i]->anz = 1; } if (save_df) e_p_df[0] = save_df; return(e_p_df); } if (!(e_p_df[1] = MALLOC(sizeof(struct dirfile)))) return(e_p_df); if (!(e_p_df[1]->name = MALLOC(sizeof(char *)))) return(e_p_df); e_p_df[1]->anz = 0; if (!(e_p_df[2] = MALLOC(sizeof(struct dirfile)))) return(e_p_df); if (!(e_p_df[2]->name = MALLOC(sizeof(char *)))) return(e_p_df); e_p_df[2]->anz = 0; for (i = 0; i < p_v_n; i++) { if (!strcmp(p_v[i]->var, "CMP")) { if (e_s_prog.compiler) FREE(e_s_prog.compiler); e_s_prog.compiler = WpeStrdup(p_v[i]->string); } else if (!strcmp(p_v[i]->var, "CMPFLAGS")) { if (e_s_prog.comp_str) FREE(e_s_prog.comp_str); e_s_prog.comp_str = WpeStrdup(p_v[i]->string); } else if (!strcmp(p_v[i]->var, "LDFLAGS")) { if (e_s_prog.libraries) FREE(e_s_prog.libraries); e_s_prog.libraries = WpeStrdup(p_v[i]->string); } else if (!strcmp(p_v[i]->var, "EXENAME")) { if (e_s_prog.exe_name) FREE(e_s_prog.exe_name); e_s_prog.exe_name = WpeStrdup(p_v[i]->string); } else if (!strcmp(p_v[i]->var, "CMPMESSAGE")) { if (e_s_prog.intstr) FREE(e_s_prog.intstr); e_s_prog.intstr = WpeStrdup(e_interpr_var(p_v[i]->string)); } /**************************/ /**** this is needed, because this function needs to understand that BREAKPOINTS and WATCHES are project variables. These variables will be processed later on in e_rel_brkwtch function. ****/ else if (!strcmp(p_v[i]->var, "BREAKPOINTS")) { } else if (!strcmp(p_v[i]->var, "WATCHES")) { } /**************************/ else if (!strcmp(p_v[i]->var, "LIBNAME")) strcpy(library, p_v[i]->string); else if (!strcmp(p_v[i]->var, "CMPSWTCH")) { if (!strcmp(p_v[i]->string, "other")) e_s_prog.comp_sw = 1; } else if (!strcmp(p_v[i]->var, "FILES")) e_p_df[0] = e_p_get_args(p_v[i]->string); else { e_p_df[1]->anz++; if (!(e_p_df[1]->name = REALLOC(tmp = e_p_df[1]->name, e_p_df[1]->anz * sizeof(char *)))) { e_p_df[1]->anz--; e_p_df[1]->name = tmp; return(e_p_df); } if (!(e_p_df[1]->name[e_p_df[1]->anz-1] = MALLOC((strlen(p_v[i]->var) + strlen(p_v[i]->string) + 2)*sizeof(char)))) { e_p_df[1]->anz--; return(e_p_df); } sprintf(e_p_df[1]->name[e_p_df[1]->anz-1], "%s=%s", p_v[i]->var, p_v[i]->string); } } if (!e_s_prog.compiler) e_s_prog.compiler = WpeStrdup("gcc"); if (!e_s_prog.comp_str) e_s_prog.comp_str = WpeStrdup("-g"); if (!e_s_prog.libraries) e_s_prog.libraries = WpeStrdup(""); if (!e_s_prog.exe_name) { /* Project my_prog.prj defaults to an executable of my_prog BD */ strcpy(text, e_prog.project); e_s_prog.exe_name = WpeStrdup(WpeStringCutChar(text, '.')); /*e_s_prog.exe_name = WpeStrdup("a.out");*/ } if (!e_s_prog.intstr) e_s_prog.intstr = WpeStrdup(cc_intstr); if (!e_p_df[0]) { e_p_df[0] = MALLOC(sizeof(struct dirfile)); e_p_df[0]->anz = 0; } if ((fp = fopen(e_prog.project, "r")) == NULL) { sprintf(text, e_msg[ERR_FOPEN], e_prog.project); e_error(text, 0, f->fb); return(e_p_df); } while ((tp = fgets(text, 256, fp))) { if (text[0] == '\t') continue; for (i = 0; isspace(text[i]); i++); if (!strncmp(text+i, "install:", 8)) { while(tp && (text[j = strlen(text)-1] != '\n' || text[j-1] == '\\')) tp = fgets(text, 256, fp); break; } } if (!tp) { fclose(fp); return(e_p_df); } while(tp && (tp = fgets(text, 256, fp))) { for (i = 0; isspace(text[i]); i++); sp = text+i; if (sp[0] == '#') { while(tp && (text[j = strlen(text)-1] != '\n' || text[j-1] == '\\')) tp = fgets(text, 256, fp); continue; } if (text[0] != '\t') break; if (sp[0] == '\0') continue; e_p_df[2]->anz++; if (!(e_p_df[2]->name = REALLOC(tmp = e_p_df[2]->name, e_p_df[2]->anz * sizeof(char *)))) { e_p_df[2]->anz--; e_p_df[2]->name = tmp; fclose(fp); return(e_p_df); } if (!(e_p_df[2]->name[e_p_df[2]->anz-1] = MALLOC((strlen(sp) + 1)))) { e_p_df[2]->anz--; fclose(fp); return(e_p_df); } strcpy(e_p_df[2]->name[e_p_df[2]->anz-1], sp); while(tp && (text[j = strlen(text)-1] != '\n' || text[j-1] == '\\')) { tp = fgets(text, 256, fp); if (tp) { j = strlen(e_p_df[2]->name[e_p_df[2]->anz-1]); *(e_p_df[2]->name[e_p_df[2]->anz-1]+j-2) = '\0'; if (!(e_p_df[2]->name[e_p_df[2]->anz-1] = REALLOC(sp = e_p_df[2]->name[e_p_df[2]->anz-1], strlen(e_p_df[2]->name[e_p_df[2]->anz-1]) + strlen(text) + 1))) { fclose(fp); FREE(sp); e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(e_p_df); } strcat(e_p_df[2]->name[e_p_df[2]->anz-1], text); } } j = strlen(e_p_df[2]->name[e_p_df[2]->anz-1]); if (*(e_p_df[2]->name[e_p_df[2]->anz-1]+j-1) == '\n') *(e_p_df[2]->name[e_p_df[2]->anz-1]+j-1) = '\0'; } fclose(fp); for (i = 0; i < 3; i++) { if (!e_p_df[i]) { e_p_df[i] = MALLOC(sizeof(struct dirfile)); e_p_df[i]->name = MALLOC(sizeof(char *)); e_p_df[i]->anz = 0; } e_p_df[i]->name = REALLOC(e_p_df[i]->name, (e_p_df[i]->anz + 1) * sizeof(char *)); e_p_df[i]->name[e_p_df[i]->anz] = MALLOC(2*sizeof(char)); *e_p_df[i]->name[e_p_df[i]->anz] = ' '; *(e_p_df[i]->name[e_p_df[i]->anz] + 1) = '\0'; e_p_df[i]->anz++; } if (save_df) { freedf(e_p_df[0]); e_p_df[0] = save_df; } return(e_p_df); } int freedfN(struct dirfile **df, int n) { int i; for(i = 0; i < n; i++) if(df[i]) freedf(df[i]); FREE(df); return(0); } int e_wrt_prj_fl(FENSTER *f) { int i, len; FILE *fp; char text[256]; for (i = f->ed->mxedt; i > 0 && (f->ed->f[i]->dtmd != DTMD_DATA || f->ed->f[i]->ins != 4); i--) ; if (i == 0 || e_prog.project[0] == DIRC) strcpy(text, e_prog.project); else sprintf(text, "%s/%s", f->ed->f[i]->dirct, e_prog.project); if ((fp = fopen(text, "w")) == NULL) { sprintf(text, e_msg[ERR_FOPEN], e_prog.project); e_error(text, 0, f->fb); return(-1); } fprintf(fp, "#\n# xwpe - project-file: %s\n", e_prog.project); fprintf(fp, "# created by xwpe version %s\n#\n", VERSION); for (i = 0; i < e_p_df[1]->anz; i++) fprintf(fp, "%s\n", e_p_df[1]->name[i]); fprintf(fp, "\nCMP=\t%s\n", e_s_prog.compiler); fprintf(fp, "CMPFLAGS=\t%s\n", e_s_prog.comp_str); fprintf(fp, "LDFLAGS=\t%s\n", e_s_prog.libraries); fprintf(fp, "EXENAME=\t%s\n", e_s_prog.exe_name); if (library[0]) fprintf(fp, "LIBNAME=\t%s\n", library); fprintf(fp, "CMPSWTCH=\t%s\n", e_s_prog.comp_sw ? "other" : "gnu"); fprintf(fp, "CMPMESSAGE=\t\'"); for (i = 0; e_s_prog.intstr[i]; i++) { if (e_s_prog.intstr[i] == '\n') fprintf(fp, "\\n"); else if (e_s_prog.intstr[i] == '\r') fprintf(fp, "\\r"); else if (e_s_prog.intstr[i] == '\\' || e_s_prog.intstr[i] == '\'' || e_s_prog.intstr[i] == '\"' ) { fputc('\\', fp); fputc(e_s_prog.intstr[i], fp); } else fputc(e_s_prog.intstr[i], fp); } fprintf(fp, "\'\n"); fprintf(fp, "\nFILES=\t"); for (i = 0, len = 8; i < e_p_df[0]->anz; i++) { len += strlen(e_p_df[0]->name[i]); if (len > 80) { fprintf(fp, " \\\n\t"); len = 1; } fprintf(fp, "%s ", e_p_df[0]->name[i]); } fprintf(fp, "\n"); /*****************************************/ /**** save WATCHES and BREAKPOINTS ****/ if (e_d_nbrpts > 0) { fprintf(fp, "\nBREAKPOINTS=\t"); for (i = 0; i < (e_d_nbrpts-1); i++) { fprintf(fp, "%s:%d;",e_d_sbrpts[i],e_d_ybrpts[i]); } fprintf(fp, "%s:%d",e_d_sbrpts[e_d_nbrpts-1],e_d_ybrpts[e_d_nbrpts-1]); } if (e_d_nwtchs > 0) { fprintf(fp, "\nWATCHES=\t"); for (i = 0; i < (e_d_nwtchs-1); i++) { fprintf(fp, "%s;",e_d_swtchs[i]); } fprintf(fp, "%s",e_d_swtchs[e_d_nwtchs-1]); } fprintf(fp, "\n"); /*****************************************/ if (e_p_df[2]->anz > 0) fprintf(fp, "\ninstall:\n"); for (i = 0; i < e_p_df[2]->anz; i++) fprintf(fp, "\t%s\n", e_p_df[2]->name[i]); fclose(fp); return(0); } int e_p_update_prj_fl(FENSTER *f) { if(!e_make_prj_opt(f)) return(-1); if(e_wrt_prj_fl(f)) return(-1); return(0); } int e_p_add_df(FLWND *fw, int sw) { char *title = NULL, str[256]; int i; if (sw == 4) title = "Add File"; else if (sw == 5) title = "Add Variable"; else if (sw == 6) title = "Add Command"; str[0] = '\0'; /* terminate new string to prevent garbage in display */ if (e_add_arguments(str, title, fw->f, 0, AltA, NULL)) { fw->df->anz++; fw->df->name = REALLOC(fw->df->name, fw->df->anz * sizeof(char *)); for (i = fw->df->anz - 1; i > fw->nf; i--) fw->df->name[i] = fw->df->name[i-1]; fw->df->name[i] = MALLOC(strlen(str)+1); strcpy(fw->df->name[i], str); } return(0); } int e_p_edit_df(FLWND *fw, int sw) { char *title = NULL, str[256]; int new = 0; if (sw == 4) title = "Change Filename"; else if (sw == 5) title = "Change Variable"; else if (sw == 6) title = "Change Command"; if (fw->nf < fw->df->anz-1 && fw->df->name[fw->nf]) strcpy(str, fw->df->name[fw->nf]); else { new = 1; str[0] = '\0'; } if (e_add_arguments(str, title, fw->f, 0, AltA, NULL)) { if (fw->nf > fw->df->anz-2) { fw->nf = fw->df->anz-1; fw->df->anz++; fw->df->name = REALLOC(fw->df->name, fw->df->anz * sizeof(char *)); fw->df->name[fw->df->anz-1] = fw->df->name[fw->df->anz-2]; } if (!new) FREE(fw->df->name[fw->nf]); fw->df->name[fw->nf] = MALLOC(strlen(str)+1); if (fw->df->name[fw->nf]) strcpy(fw->df->name[fw->nf], str); } return(0); } int e_p_del_df(FLWND *fw, int sw) { int i; if (fw->nf > fw->df->anz-2) return(0); fw->df->anz--; for (i = fw->nf; i < fw->df->anz; i++) fw->df->name[i] = fw->df->name[i+1]; return(0); } int e_p_mess_win(char *header, int argc, char **argv, PIC **pic, FENSTER *f) { char *tmp = MALLOC(sizeof(char)); int i, ret; fk_cursor(0); tmp[0] = '\0'; for (i = 0; i < argc && argv[i] != NULL; i++) { if(!(tmp = REALLOC(tmp, (strlen(tmp)+strlen(argv[i])+2)*sizeof(char)))) return(-2); strcat(tmp, argv[i]); strcat(tmp, " "); } ret = e_mess_win(header, tmp, pic, f); FREE(tmp); fk_cursor(1); return(ret); } /* After this function b has exactly 1 line allocated (b->mxlines==1). This line is initialized to the string WPE_WR,0 */ int e_p_red_buffer(BUFFER *b) { int i; for (i = 1; i < b->mxlines; i++) if (b->bf[i].s != NULL) FREE( b->bf[i].s ); if (b->mxlines==0) e_new_line(0,b); b->bf[0].s[0] = WPE_WR; b->bf[0].s[1] = '\0'; b->bf[0].len = 0; b->bf[0].nrc = 1; b->mxlines = 1; return(0); } int e_new_message(FENSTER *f) { int i; if (e_p_m_buffer) e_p_red_buffer(e_p_m_buffer); for (i = f->ed->mxedt; i > 0; i--) if (!strcmp(f->ed->f[i]->datnam, "Messages")) { e_switch_window(f->ed->edt[i], f->ed->f[f->ed->mxedt]); e_close_window(f->ed->f[f->ed->mxedt]); } if (access("Messages", 0) == 0) remove("Messages"); if (e_edit(f->ed, "Messages")) return(WPE_ESC); return(0); } int e_p_show_messages(FENSTER *f) { int i; for (i = f->ed->mxedt; i > 0; i--) if (!strcmp(f->ed->f[i]->datnam, "Messages")) { e_switch_window(f->ed->edt[i], f->ed->f[f->ed->mxedt]); break; } if (i <= 0 && e_edit(f->ed, "Messages")) { return(-1); } f = f->ed->f[f->ed->mxedt]; if (f->b->mxlines == 0) { e_new_line(0, f->b); e_ins_nchar(f->b, f->s, "No Messages", 0, 0, 11); e_schirm(f, 1); } return(0); } int e_p_konv_mess(char *var, char *str, char *txt, char *file, char *cmp, int *y, int *x) { int i; char *cp; if (!strncmp(var, "FILE", 4) && !isalnum(var[4])) { for (i = strlen(str) - 1; i >= 0 && !isspace(str[i]); i--) ; strcpy(file, str+i+1); } else if (!strncmp(var, "CMPTEXT", 7) && !isalnum(var[7])) strcpy(cmp, str); else if (!strncmp(var, "LINE", 4) && !isalnum(var[4])) { if (!isdigit(str[0])) return(1); *y = atoi(str); if (var[4] == '+') *y += atoi(var+5); else if (var[4] == '-') *y -= atoi(var+5); } else if (!strncmp(var, "COLUMN", 6) && !isalnum(var[6])) { if (!strncmp(var+6, "=BEFORE", 7)) { txt[0] = 'B'; strcpy(txt+1, str); *x = 0; var += 13; } else if (!strncmp(var+6, "=AFTER", 6)) { txt[0] = 'A'; strcpy(txt+1, str); *x = strlen(str); var += 12; } else if (!strncmp(var+6, "=PREVIOUS?", 10)) { if (!str[0]) return(1); for (i = 0; (txt[i] = var[16+i]) && txt[i] != '+' && txt[i] != '-'; i++) ; txt[i] = '\0'; var += (16+i); cp = strstr(str, txt); for (i = 0; str+i < cp; i++) ; *x = i; txt[0] = 'P'; txt[1] = '\0'; } else if (!isdigit(str[0])) return(1); else { *x = atoi(str); txt[0] = '\0'; var += 6; } if (var[0] == '+') *x += atoi(var+1); else if (var[0] == '-') *x -= atoi(var+1); } return(0); } int e_p_comp_mess(char *a, char *b, char *c, char *txt, char *file, char *cmp, int *y, int *x) { int i, n, k = 0, bsl = 0; char *ctmp, *cp, *var = NULL, *str = NULL; if (c > b) return(0); if (a[0] == '*' && !a[1]) return(2); if (!a[0] && !b[0]) return(2); if (!a[0] || !b[0]) return(0); if (a[0] == '*' && (a[1] == '*' || a[1] == '$')) return(e_p_comp_mess(++a, b, c, txt, file, cmp, y, x)); if (a[0] == '$' && a[1] == '{') { for (k = 2; a[k] && a[k] != '}'; k++); var = MALLOC((k-1) * sizeof(char)); for (i = 2; i < k; i++) var[i-2] = a[i]; var[k-2] = '\0'; if (a[k]) k++; if (!a[k]) return(!e_p_konv_mess(var, b, txt, file, cmp, y, x)); n = a[k] == '\\' ? k : k+1; } else if (a[0] == '*'&& a[1] != '\\') { k = 1; n = 2; } else n = 1; for(; bsl || (a[n] && a[n] != '*' && a[n] != '?' && a[n] != '[' && (a[n] != '$' || a[n+1] != '{' )); n++) bsl = a[n] == '\\' ? !bsl : 0; if (a[0] == '*' || a[0] == '$') { if (a[k] == '?') { cp = MALLOC((strlen(a)+1)*sizeof(char)); for (i = 0; i < k && (cp[i] = a[i]); i++); for (i++; (cp[i-1] = a[i]) != '\0'; i++); FREE(var); n = e_p_comp_mess(cp, ++b, ++c, txt, file, cmp, y, x); FREE(cp); return(n); } if (a[k] == '[') { for (i = 0; b[i] && !(n = e_p_comp_mess(a+k, b+i, c+i, txt, file, cmp, y, x)); i++) ; if (!b[i]) return(0); if (a[0] == '$') { str = MALLOC((i+1)*sizeof(char)); for (k = 0; k < i; k++) str[k] = b[k]; str[i] = '\0'; e_p_konv_mess(var, str, txt, file, cmp, y, x); FREE(var); FREE(str); } return(n); } n -= k; ctmp = MALLOC(n+1); for (i = 0; i < n; i++) ctmp[i] = a[i+k]; ctmp[n] = '\0'; cp = strstr(b, ctmp); FREE(ctmp); if (cp == NULL) return(0); if (a[0] == '$') { for (i = 0; c + i < cp; i++); str = MALLOC((i+1)*sizeof(char)); for (i = 0; c + i < cp; i++) str[i] = c[i]; str[i] = '\0'; i = e_p_konv_mess(var, str, txt, file, cmp, y, x); FREE(var); FREE(str); if (i) return(0); } if (!a[k+n] && !cp[n]) return(2); if (!a[k+n]) return(e_p_comp_mess(a, cp+1, cp+1, txt, file, cmp, y, x)); if ((i = e_p_comp_mess(a+k+n, cp+n, cp+n, txt, file, cmp, y, x))) return(i); if (file[0] && *y > -1) return(0); return(e_p_comp_mess(a, cp+1, a[0] == '$' ? c : cp+1, txt, file, cmp, y, x)); } else if (a[0] == '?') { n--; a++; b++; } else if (a[0] == '[') { if (a[1] == '!') { for (k = 2; a[k] && (a[k] != ']' || k == 2) && a[k] != b[0]; k++) if (a[k+1] == '-' && b[0] >= a[k] && b[0] <= a[k+2]) return(-b[0]); if (a[k] != ']') return(-b[0]); n-=(k+1); a+=(k+1); b++; } else { for (k = 1; a[k] && (a[k] != ']' || k == 1) && a[k] != b[0]; k++) if (a[k+1] == '-' && b[0] >= a[k] && b[0] <= a[k+2]) break; if (a[k] == ']' || a[k] == '\0') return(0); for(; a[k] && (a[k] != ']'); k++); n-=(k+1); a+=(k+1); b++; } } if (n <= 0) return(e_p_comp_mess(a, b, c, txt, file, cmp, y, x)); if ((k = strncmp(a, b, n)) != 0) return(0); return(e_p_comp_mess(a+n, b+n, c+n, txt, file, cmp, y, x)); } int e_p_cmp_mess(char *srch, BUFFER *b, int *ii, int *kk, int ret) { char *cp, cmp[128], file[128], search[80], tmp[4][128], **wtxt = NULL; int j, l, m, n, iy, iorig, i = *ii, k = *kk, x = 0, y = -1, wnum = 0; int *wn = NULL; cmp[0] = search[0] = file[0] = '\0'; wtxt = MALLOC(1); wn = MALLOC(1); for (j = 0, n = 0; n < 4 && srch[j]; n++) { for (l = 0; (tmp[n][l] = srch[j]); j++, l++) { if (j > 1 && srch[j] == '?' && srch[j-1] == '{' && srch[j-2] == '$') { wnum++; wn = REALLOC(wn, wnum * sizeof(int)); wtxt = REALLOC(wtxt, wnum * sizeof(char *)); if (srch[j+1] == '*') wn[wnum-1] = -1; else wn[wnum-1] = atoi(srch+j+1); for (j++; srch[j] && srch[j] != ':'; j++); if (!srch[j]) { wnum--; break; } for (m = 0; srch[j+m] && srch[j+m] != '}'; m++); wtxt[wnum-1] = MALLOC((m+1) * sizeof(char)); for (m = 0, j++; (wtxt[wnum-1][m] = srch[j]) && srch[j] != '}'; j++, m++); wtxt[wnum-1][m] = '\0'; l -= 3; } else if (srch[j] == '\r' || srch[j] == '\n') { if (srch[j+1] == '\r' || srch[j+1] == '\n') { tmp[n][l] = '\n'; tmp[n][l+1] = '\0'; j++; } else tmp[n][l] = '\0'; j++; break; } } } e_p_comp_mess(tmp[0], b->bf[i].s, b->bf[i].s, search, file, cmp, &y, &x); iy = i; iorig = i; do { if (n > 1 && file[0] && i < b->mxlines-1) { y = -1; while (b->bf[i].s[b->bf[i].len-1] == '\\') i++; i++; e_p_comp_mess(tmp[1], b->bf[i].s, b->bf[i].s, search, file, cmp, &y, &x); iy = i; } do { if (n > 2 && file[0] && y >= 0 && i < b->mxlines-1) { while (b->bf[i].s[b->bf[i].len-1] == '\\') i++; i++; l = e_p_comp_mess(tmp[2], b->bf[i].s, b->bf[i].s, search, file, cmp, &y, &x); if (!l && n > 3) l = e_p_comp_mess(tmp[3], b->bf[i].s, b->bf[i].s, search, file, cmp, &y, &x); } else l = 1; if (file[0] && y >= 0 && l != 0) { err_li[k].file = MALLOC((strlen(file)+1)*sizeof(char)); strcpy(err_li[k].file, file); err_li[k].line = y; if (search[0] == 'P') { cp = strstr(b->bf[iy].s, cmp); if (!cp) x = 0; else { for (m = 0; b->bf[iy].s + m < (unsigned char *)cp; m++); x -= m; } err_li[k].srch = MALLOC((strlen(cmp)+2)*sizeof(char)); err_li[k].srch[0] = 'P'; strcpy(err_li[k].srch+1, cmp); } else if (search[0]) { err_li[k].srch = MALLOC((strlen(search)+1)*sizeof(char)); strcpy(err_li[k].srch, search); } else err_li[k].srch = NULL; err_li[k].x = x; err_li[k].y = iorig; err_li[k].text = MALLOC(strlen((char *)b->bf[i].s) + 1); strcpy(err_li[k].text, (char *)b->bf[i].s); err_li[k].text[b->bf[i].len] = '\0'; k++; err_num++; if (!ret) { for (ret = -1, m = 0; ret && m < wnum; m++) { if (wn[m] == -1 && !(b->cn->edopt & ED_MESSAGES_STOP_AT) && strstr(b->bf[i].s, wtxt[m])) ret = 0; else if (wn[m] > -1 && !(b->cn->edopt & ED_MESSAGES_STOP_AT) && !strncmp(b->bf[i].s+wn[m], wtxt[m], strlen(wtxt[m]))) ret = 0; } } if (!ret && wnum <= 0) ret = -1; while (b->bf[i].s[b->bf[i].len-1] == '\\') i++; } } while (n > 2 && file[0] && y >= 0 && l != 0 && i < b->mxlines-1); if (n > 2 && file[0] && y >= 0 && l == 0) i--; } while (n > 1 && file[0] && y >= 0 && i < b->mxlines-1); if (n > 1 && file[0] && y < 0) i--; *ii = i; *kk = k; for (m = 0; m < wnum; m++) FREE(wtxt[m]); FREE(wn); FREE(wtxt); return(ret); } #endif xwpe-1.5.30a/we_progn.c0000644000076400007640000014456510263105405013755 0ustar dulsidulsi/* we_progn.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "messages.h" #include "edit.h" #include "WeExpArr.h" #undef TESTSDEF #ifdef PROG #include "makro.h" extern struct dirfile *e_p_get_var(char *string); extern char *e_p_msg[]; #define FRB1 s->fb->cr.fb /* key words etc */ #define FRB2 s->fb->ck.fb /* constants */ #define FRB3 s->fb->cp.fb /* pre-processor A. */ #define FRB4 s->fb->cc.fb /* comments */ #define FRB5 s->fb->ct.fb /* text */ #define iscase(s) ( (!strncmp(s, "case", 4) && !isalnum1(*(s+4))) \ || (!strncmp(s, "default", 7) && !isalnum1(*(s+7))) ) #define isstatus(s) ( !strncmp(s, "private:", 8) || !strncmp(s, "public:", 7) \ || !strncmp(s, "protected:", 10) ) #define ispif(s) ( !strncmp(s, "#if", 3) || !strncmp(s, "#ifdef", 6) \ || !strncmp(s, "#ifndef", 7) ) #define ispelse(s) ( !strncmp(s, "#else", 5) || !strncmp(s, "#elif", 5) ) #define ispendif(s) ( !strncmp(s, "#endif", 6) ) #define iscop(c) ( c == '<' || c == '>' || c == '+' || c == '-' || \ c == '/' || c == '*' || c == '%' || c == '=' || \ c == '|' || c == '&' || c == '!' || c == ':' || \ c == '?' || c == '.' ) #define e_mk_col(str, l, n, frb, cs, n_nd, n_bg) \ { \ if (n < l) \ { \ if (n == cs->special_column) \ { \ int ii; \ for (ii = 0; cs->special_comment[ii] && \ cs->special_comment[ii] != toupper(str[n]); ii++) \ ; \ if (cs->special_comment[ii]) \ mcsw = 7; \ } \ if (mcsw == 6 && (isalnum(str[n]) || str[n] == '_')) \ frb = FRB1; \ else if(mcsw == 7) frb = FRB4; \ else if(mcsw == 3 && (isalnum(str[n]) || str[n] == '.')) frb = FRB2; \ else if(mcsw == 5) \ { \ if (str[n] == cs->begin_comment[0]) \ { \ int jj; \ for (jj = 1; cs->begin_comment[jj] && \ str[n+jj] == cs->begin_comment[jj]; jj++) \ ; \ if (!cs->begin_comment[jj]) \ { mcsw = 4; n_bg = n+jj-1; frb = FRB4; } \ } \ if (mcsw == 5 && str[n] == cs->line_comment[0]) \ { \ int jj; \ for (jj = 1; cs->line_comment[jj] && \ str[n+jj] == cs->line_comment[jj]; jj++); \ if (!cs->line_comment[jj]) { mcsw = 7; frb = FRB4; } \ } \ if (mcsw == 5) frb = FRB3; \ } \ else if (mcsw == 1) \ { \ if (str[n] == cs->string_constant && !bssw) mcsw = 0; \ frb = FRB2; \ } \ else if (mcsw == 2) \ { \ if (str[n] == cs->char_constant && !bssw) mcsw = 0; \ frb = FRB2; \ } \ else if (mcsw == 4) \ { \ if (n_nd < n-n_bg && str[n] == cs->end_comment[n_nd]) \ { \ int jj; \ for (jj = 1; jj <= n_nd && n-jj >= 0 && \ str[n-jj] == cs->end_comment[n_nd-jj]; jj++); \ if (jj > n_nd) mcsw = svmsw; \ } \ frb = FRB4; \ } \ else \ { \ if (n >= cs->comment_column) { mcsw = 7; frb = FRB4; } \ else if (isdigit(str[n])) \ { \ if (n == 0 || (!isalnum(str[n-1]) && str[n-1] != '_')) \ { mcsw = 3; frb = FRB2; } \ else frb = FRB5; \ } \ else if (isalpha(str[n])) \ { \ if(cs->insensitive && (n == 0 || (!isalnum(str[n-1]) && \ str[n-1] != '_'))) \ { \ int ii, jj; \ int kk = strlen(cs->line_comment); \ if ((WpeStrnccmp(cs->line_comment, str + n, kk) == 0) && \ (!isalnum(str[n +kk])) && (str[n + kk] != '_')) \ { \ mcsw = 7; \ frb = FRB4; \ } \ else \ { \ for (ii = 0; cs->reserved_word[ii] && \ cs->reserved_word[ii][0] < toupper(str[n]); \ ii++); \ for ( ; cs->reserved_word[ii] && \ cs->reserved_word[ii][0] == toupper(str[n]); \ ii++) \ { \ for (jj = 0; cs->reserved_word[ii][jj] && \ cs->reserved_word[ii][jj] == toupper(str[n+jj]); \ jj++); \ if (!cs->reserved_word[ii][jj] && !isalnum(str[n+jj]) && \ str[n+jj] != '_') \ { mcsw = 6; frb = FRB1; break; } \ } \ } \ } \ else if (!cs->insensitive && (n == 0 || (!isalnum(str[n-1]) && \ str[n-1] != '_'))) \ { \ int ii, jj; \ int kk = strlen(cs->line_comment); \ if ((strncmp(cs->line_comment, str + n, kk) == 0) && \ (!isalnum(str[n +kk])) && (str[n + kk] != '_')) \ { \ mcsw = 7; \ frb = FRB4; \ } \ else \ { \ for (ii = 0; cs->reserved_word[ii] && \ cs->reserved_word[ii][0] < str[n]; ii++); \ for( ; cs->reserved_word[ii] && \ cs->reserved_word[ii][0] == str[n]; ii++) \ { \ for (jj = 0; cs->reserved_word[ii][jj] && \ cs->reserved_word[ii][jj] == str[n+jj]; jj++); \ if (!cs->reserved_word[ii][jj] && !isalnum(str[n+jj]) && \ str[n+jj] != '_') \ { mcsw = 6; frb = FRB1; break; } \ } \ } \ } \ if (!mcsw) frb = FRB5; \ } \ else if (isspace(str[n])) \ { mcsw = 0; frb = FRB5; } \ else \ { \ if (str[n] == cs->string_constant) \ { mcsw = 1; frb = FRB2; } \ else if (str[n] == cs->char_constant) \ { mcsw = 2; frb = FRB2; } \ else if (str[n] == cs->preproc_cmd) \ { svmsw = mcsw = 5; frb = FRB3; } \ else \ { \ mcsw = 0; \ if (str[n] == cs->begin_comment[0]) \ { \ int jj; \ for(jj = 1; cs->begin_comment[jj] && \ str[n+jj] == cs->begin_comment[jj]; jj++); \ if (!cs->begin_comment[jj]) \ { mcsw = 4; n_bg = n+jj-1; frb = FRB4; } \ } \ if (!mcsw && str[n] == cs->line_comment[0]) \ { \ int jj; \ for (jj = 1; cs->line_comment[jj] && \ str[n+jj] == cs->line_comment[jj]; jj++); \ if (!cs->line_comment[jj]) { mcsw = 7; frb = FRB4; } \ } \ if (cs->long_operator && !mcsw) \ { \ if(cs->insensitive) \ { \ int ii, jj; \ for (ii = 0; cs->long_operator[ii] && \ cs->long_operator[ii][0] < str[n]; ii++); \ for ( ; cs->long_operator[ii] && \ cs->long_operator[ii][0] == str[n]; ii++) \ { \ for (jj = 0; cs->long_operator[ii][jj] && \ cs->long_operator[ii][jj] == toupper(str[n+jj]); jj++); \ if (!cs->long_operator[ii][jj]) \ { mcsw = 6; frb = FRB1; break; } \ } \ } \ else \ { \ int ii, jj; \ for (ii = 0; cs->long_operator[ii] && \ cs->long_operator[ii][0] < str[n]; ii++); \ for ( ; cs->long_operator[ii] && \ cs->long_operator[ii][0] == str[n]; ii++) \ { \ for (jj = 0; cs->long_operator[ii][jj] && \ cs->long_operator[ii][jj] == str[n+jj]; jj++); \ if (!cs->long_operator[ii][jj]) \ { mcsw = 6; frb = FRB1; break; } \ } \ } \ } \ if (!mcsw) \ { \ int jj; \ for (jj = 0; cs->single_operator[jj] && \ str[n] != cs->single_operator[jj]; jj++); \ if (!cs->single_operator[jj]) frb = FRB5; \ else frb = FRB1; \ } \ } \ } \ } \ if (str[n] == cs->quoting_char) bssw = !bssw; \ else bssw = 0; \ } \ else \ { \ if ((mcsw == 7) || (mcsw == 4)) frb = FRB4; \ else if ((mcsw == 1) || (mcsw == 2)) frb = FRB2; \ else if (mcsw == 5) frb = FRB3; \ else \ frb = FRB5; \ } \ } int e_scfbol(int n, int mcsw, unsigned char *str, WpeSyntaxRule *cs) { int bssw = 0, svmsw = 0, nla = 0, i, j; for (i = 0; i < n && isspace(str[i]); i++) ; if (mcsw == 5) svmsw = 5; else if (mcsw == 0 && str[i] == cs->preproc_cmd) { svmsw = mcsw = 5; i++; } for (; i < n; i++) { if (i == cs->special_column) return(0); else if (mcsw == 4) { if (str[i] == cs->end_comment[0]) { for (j = 1; cs->end_comment[j] && str[i+j] == cs->end_comment[j]; j++) ; if (!cs->end_comment[j]) { i += (j-1); mcsw = svmsw; } } } else if (mcsw == 1) { if (str[i] == cs->string_constant && !bssw) mcsw = svmsw; } else if (str[i] == cs->string_constant && !bssw) mcsw = 1; else { if (str[i] == cs->line_comment[0]) { for (j = 1; cs->line_comment[j] && str[i+j] == cs->line_comment[j]; j++) ; if (!cs->line_comment[j]) return(0); } if (str[i] == cs->begin_comment[0]) { for (j = 1; cs->begin_comment[j] && str[i+j] == cs->begin_comment[j]; j++) ; if (!cs->begin_comment[j]) mcsw = 4; i += (j-1); } } if (str[i] == cs->quoting_char) bssw = !bssw; else bssw = 0; } return ((mcsw == 4 || (bssw && n > 0 && str[n-1] == cs->continue_char) || nla || cs->continue_column >= 0 ) ? mcsw : 0); } int e_sc_all(FENSTER *f, int sw) { int i; if (!WpeIsProg() || !WpeIsXwin()) return(0); if (!sw) { for (i = 0; i <= f->ed->mxedt; i++) if (f->ed->f[i]->c_sw) { FREE(f->ed->f[i]->c_sw); f->ed->f[i]->c_sw = NULL; } } else { for (i = 0; i <= f->ed->mxedt; i++) { if (f->ed->f[i]->c_sw) FREE(f->ed->f[i]->c_sw); e_add_synt_tl(f->ed->f[i]->datnam, f->ed->f[i]); if (f->ed->f[i]->c_st) { if (f->ed->f[i]->c_sw) FREE(f->ed->f[i]->c_sw); f->ed->f[i]->c_sw = e_sc_txt(NULL, f->ed->f[i]->b); } } } e_rep_win_tree(f->ed); return(0); } int e_program_opt(FENSTER *f) { int ret, sw = f->ed->edopt & ED_SYNTAX_HIGHLIGHT ? 1 : 0; W_OPTSTR *o = e_init_opt_kst(f); if (!o) return(-1); o->xa = 17; o->ya = 4; o->xe = 59; o->ye = 18; o->bgsw = AltO; o->name = "Programming-Options"; o->crsw = AltO; e_add_txtstr(21, 2, "Screen:", o); e_add_txtstr(4, 2, "Stop at", o); e_add_sswstr(5, 3, 0, AltE, f->ed->edopt & ED_ERRORS_STOP_AT ? 1 : 0, "Errors ", o); e_add_sswstr(5, 4, 0, AltM, f->ed->edopt & ED_MESSAGES_STOP_AT ? 1 : 0, "Messages", o); e_add_sswstr(22, 3, 0, AltD, f->ed->edopt & ED_SYNTAX_HIGHLIGHT ? 1 : 0, "Diff. Colors", o); e_add_wrstr(4, 6, 4, 7, 35, 128, 1, AltX, "EXecution-Directory:", e_prog.exedir, NULL, o); e_add_wrstr(4, 9, 4, 10, 35, 128, 0, AltS, "System-Include-Path:", e_prog.sys_include, NULL, o); e_add_bttstr(10, 12, 1, AltO, " Ok ", NULL, o); e_add_bttstr(26, 12, -1, WPE_ESC, "Cancel", NULL, o); ret = e_opt_kst(o); if (ret != WPE_ESC) { if (e_prog.exedir) FREE(e_prog.exedir); e_prog.exedir = WpeStrdup(o->wstr[0]->txt); if (e_prog.sys_include) FREE(e_prog.sys_include); e_prog.sys_include = WpeStrdup(o->wstr[1]->txt); f->ed->edopt = (f->ed->edopt & ~ED_PROGRAMMING_OPTIONS) + (o->sstr[0]->num ? ED_ERRORS_STOP_AT : 0) + (o->sstr[1]->num ? ED_MESSAGES_STOP_AT : 0) + (o->sstr[2]->num ? ED_SYNTAX_HIGHLIGHT : 0); if (sw != o->sstr[2]->num) e_sc_all(f, o->sstr[2]->num); } freeostr(o); return(0); } int e_sc_nw_txt(int y, BUFFER *b, int sw) { int i, out; if (sw < 0) { out = b->f->c_sw[y+1]; for (i = y+1; i < b->mxlines; i++) b->f->c_sw[i] = b->f->c_sw[i+1]; if (out == b->f->c_sw[y]) return(0); } else if (sw > 0) for (i = b->mxlines-1; i > y; i--) b->f->c_sw[i] = b->f->c_sw[i-1]; if (b->f->c_st->continue_column < 0) { for (i = y; i < b->mxlines-1; i++) { if ((out = e_scfbol(b->bf[i].len, b->f->c_sw[i], b->bf[i].s, b->f->c_st)) == b->f->c_sw[i+1]) break; else b->f->c_sw[i+1] = out; } } else { if (y != 0) /* Quick fix to continue line check - Dennis */ { b->f->c_sw[y] = isspace(b->bf[y].s[b->f->c_st->continue_column]) ? 0 : e_scfbol(b->bf[y-1].len, b->f->c_sw[y-1], b->bf[y-1].s, b->f->c_st); for (i = y; i < b->mxlines-1; i++) { out = isspace(b->bf[i+1].s[b->f->c_st->continue_column]) ? 0 : e_scfbol(b->bf[i].len, b->f->c_sw[i], b->bf[i].s, b->f->c_st); if (out == b->f->c_sw[i+1]) break; else b->f->c_sw[i+1] = out; } } } return(0); } int *e_sc_txt(int *c_sw, BUFFER *b) { int i; if (!c_sw) c_sw = MALLOC(b->mx.y * sizeof(int)); c_sw[0] = 0; if (b->f->c_st->continue_column < 0) { for (i = 0; i < b->mxlines-1; i++) c_sw[i+1] = e_scfbol(b->bf[i].len, c_sw[i], b->bf[i].s, b->f->c_st); } else { for (i = 0; i < b->mxlines-1; i++) { c_sw[i+1] = isspace(b->bf[i+1].s[b->f->c_st->continue_column]) ? 0 : e_scfbol(b->bf[i].len, c_sw[i], b->bf[i].s, b->f->c_st); } } return(c_sw); } /* Writing of a line (content of a screen) */ void e_pr_c_line(int y, FENSTER *f) { BUFFER *b = f->b; SCHIRM *s = f->s; int i, j, k, frb = 0; int mcsw = f->c_sw[y], svmsw = f->c_sw[y] == 5 ? 5 : 0, bssw = 0; int n_bg = -1, n_nd = strlen(f->c_st->end_comment)-1; #ifdef DEBUGGER int fsw = 0; #endif for (i = j = 0; j < s->c.x; j++, i++) { if (*(b->bf[y].s + i) == WPE_TAB) j += (f->ed->tabn - j % f->ed->tabn - 1); #ifdef UNIX else if (((unsigned char) *(b->bf[y].s + i)) > 126) { j++; if (((unsigned char) *(b->bf[y].s + i)) < 128 + ' ') j++; } else if (*(b->bf[y].s + i) < ' ') j++; #endif } if (j > s->c.x) i--; for (k = 0; k < i; k++) e_mk_col(b->bf[y].s, b->bf[y].len, k, frb, f->c_st, n_nd, n_bg); #ifdef DEBUGGER for (j = 1; j <= s->brp[0]; j++) if (s->brp[j] == y) { fsw = 1; break; } for (j = s->c.x; i < b->bf[y].len && j < NUM_COLS_ON_SCREEN_SAFE + s->c.x - 1; i++, j++) { e_mk_col(b->bf[y].s, b->bf[y].len, i, frb, f->c_st, n_nd, n_bg); if ( y == s->da.y && i >= s->da.x && i < s->de.x ) frb = s->fb->dy.fb; else if (fsw) frb = s->fb->db.fb; else if ( y == s->fa.y && i >= s->fa.x && i < s->fe.x ) frb = s->fb->ek.fb; #else for (j = s->c.x; i < b->bf[y].len && j < NUM_COLS_ON_SCREEN_SAFE + s->c.x - 1; i++, j++) { e_mk_col(b->bf[y].s, b->bf[y].len, i, frb, f->c_st, n_nd, n_bg); if ( y == s->fa.y && i >= s->fa.x && i < s->fe.x ) frb = s->fb->ek.fb; #endif else if ((y < s->mark_end.y && ( y > s->mark_begin.y || (y == s->mark_begin.y && i >= s->mark_begin.x))) || (y == s->mark_end.y && i < s->mark_end.x && ( y > s->mark_begin.y || (y == s->mark_begin.y && i >= s->mark_begin.x)))) frb = s->fb->ez.fb; if (*(b->bf[y].s + i) == WPE_TAB) for (k = f->ed->tabn - j % f->ed->tabn; k > 1 && j < NUM_COLS_ON_SCREEN + s->c.x - 2; k--, j++) e_pr_char(f->a.x - s->c.x + j + 1, y - s->c.y + f->a.y + 1, ' ', frb); #ifdef UNIX else if (!WpeIsXwin() && ((unsigned char)*(b->bf[y].s + i)) > 126) { e_pr_char(f->a.x - s->c.x + j +1, y - s->c.y + f->a.y + 1, '@', frb); if (++j >= NUM_COLS_ON_SCREEN + s->c.x - 1) return; if (((unsigned char)*(b->bf[y].s + i)) < 128 + ' ' && j < NUM_COLS_ON_SCREEN + s->c.x - 1) { e_pr_char(f->a.x - s->c.x + j +1, y - s->c.y + f->a.y + 1, '^', frb); if (++j >= NUM_COLS_ON_SCREEN + s->c.x - 1) return; } } else if (*(b->bf[y].s + i) < ' ') { e_pr_char(f->a.x - s->c.x + j +1, y - s->c.y + f->a.y + 1, '^', frb); if (++j >= NUM_COLS_ON_SCREEN + s->c.x - 1) return; } #endif if (*(b->bf[y].s + i) == WPE_TAB) e_pr_char(f->a.x - s->c.x + j + 1, y - s->c.y + f->a.y + 1, ' ', frb); #ifdef UNIX else if(!WpeIsXwin() && ((unsigned char)*(b->bf[y].s + i)) > 126 && j < NUM_COLS_ON_SCREEN + s->c.x - 1) { if (((unsigned char)*(b->bf[y].s + i)) < 128 + ' ') e_pr_char(f->a.x - s->c.x + j + 1, y - s->c.y + f->a.y + 1, ((unsigned char) *(b->bf[y].s + i)) + 'A' - 129, frb); else e_pr_char(f->a.x - s->c.x + j + 1, y - s->c.y + f->a.y + 1, ((unsigned char) *(b->bf[y].s + i)) - 128, frb); } else if (*(b->bf[y].s + i) < ' ' && j < NUM_COLS_ON_SCREEN + s->c.x - 1) e_pr_char(f->a.x - s->c.x + j + 1, y - s->c.y + f->a.y + 1, *(b->bf[y].s + i) + 'A' - 1, frb); #endif else e_pr_char(f->a.x - s->c.x + j + 1, y - s->c.y + f->a.y + 1, *(b->bf[y].s + i), frb); } e_mk_col(b->bf[y].s, b->bf[y].len, i, frb, f->c_st, n_nd, n_bg); if ((i == b->bf[y].len) && (f->ed->edopt & ED_SHOW_ENDMARKS) && (DTMD_ISMARKABLE(f->dtmd)) && (j < NUM_COLS_ON_SCREEN_SAFE + s->c.x - 1)) { if ((y < s->mark_end.y && ( y > s->mark_begin.y || (y == s->mark_begin.y && i >= s->mark_begin.x) ) ) || (y == s->mark_end.y && i < s->mark_end.x && ( y > s->mark_begin.y || (y == s->mark_begin.y && i >= s->mark_begin.x) ) ) ) { if (*(b->bf[y].s + i) == WPE_WR) e_pr_char(f->a.x - s->c.x + j + 1, y - s->c.y + f->a.y + 1, PWR, s->fb->ez.fb); else e_pr_char(f->a.x - s->c.x + j + 1, y - s->c.y + f->a.y + 1, PNL, s->fb->ez.fb); } else { if (*(b->bf[y].s + i) == WPE_WR) e_pr_char(f->a.x - s->c.x + j + 1, y - s->c.y + f->a.y + 1, PWR, frb); else e_pr_char(f->a.x - s->c.x + j + 1, y - s->c.y + f->a.y + 1, PNL, frb); } j++; } for (; j < NUM_COLS_ON_SCREEN + s->c.x - 1; j++) e_pr_char(f->a.x - s->c.x + j + 1, y - s->c.y + f->a.y + 1, ' ', frb); } int e_add_synt_tl(char *filename, FENSTER *f) { int i, k; f->c_st = NULL; f->c_sw = NULL; if (!WpeSyntaxDef || !filename) return 0; filename = strrchr(filename, '.'); if (!filename) return 0; for(i = 0; i < WpeExpArrayGetSize(WpeSyntaxDef); i++) { for (k = 0; k < WpeExpArrayGetSize(WpeSyntaxDef[i]->extension); k++) { if (!strcmp(filename, WpeSyntaxDef[i]->extension[k])) { f->c_st = WpeSyntaxDef[i]->syntax_rule; if (f->ed->edopt & ED_SYNTAX_HIGHLIGHT) f->c_sw = MALLOC(f->b->mx.y*sizeof(int)); } } } return(0); } /* Browser */ E_AFILE *e_aopen(char *name, char *path, int mode) { ECNT *cn = WpeEditor; E_AFILE *ep = MALLOC(sizeof(E_AFILE)); char str[256]; int i, j; ep->b = NULL; ep->fp = NULL; if (mode & 1) { for (i = 1; i <= cn->mxedt && strcmp(cn->f[i]->datnam, name); i++) ; if (i <= cn->mxedt) { ep->b = cn->f[i]->b; ep->p.x = ep->p.y = 0; } } if ((mode & 2) && !ep->b && !access(name, R_OK)) ep->fp = fopen(name, "r"); if ((mode & 4) && !ep->b && !ep->fp) { for (i = 0; path[i] && !ep->fp; i++) { for (j = 0; (str[j] = path[i]) && path[i] != ':'; j++, i++) ; if (!path[i]) i--; str[j] = '/'; str[j+1] = '\0'; strcat(str, name); if (!access(str, R_OK)) ep->fp = fopen(str, "r"); if (ep->fp) strcpy(name, str); } } if (!ep->b && !ep->fp) { FREE(ep); return NULL; } return(ep); } int e_aclose(E_AFILE *ep) { int ret = 0; if (ep->fp) ret = fclose(ep->fp); FREE(ep); return(ret); } char *e_agets(char *str, int n, E_AFILE *ep) { int i, j; if (ep->fp) return(fgets(str, n, ep->fp)); if (ep->p.y >= ep->b->mxlines || (ep->p.y == ep->b->mxlines-1 && ep->p.x > ep->b->bf[ep->p.y].len)) return(NULL); for (i = 0; ep->p.y < ep->b->mxlines; (ep->p.y)++) { for (j = ep->p.x; i < n-1 && j <= ep->b->bf[ep->p.y].len; i++, j++) str[i] = ep->b->bf[ep->p.y].s[j]; if (str[i-1] == '\n') { ep->p.x = 0; (ep->p.y)++; break; } else if (i == n-1) { ep->p.x = j; break; } else { ep->p.x = 0; (ep->p.y)++; } } str[i] = '\0'; return(str); } char *e_sh_spl1(char *sp, char *str, E_AFILE *fp, int *n) { while (1) { while (isspace(*++sp)) ; if (sp[0] == '\\') { (*n)++; if (!e_agets((sp = str), 256, fp)) return(NULL); --sp; } else if (sp[0] == '/' && sp[1] == '*') { while (!(sp = strstr(sp, "*/"))) { (*n)++; if (!e_agets((sp = str), 256, fp)) return(NULL); } sp++; } else break; } return(sp); } char *e_sh_spl2(char *sp, char *str, E_AFILE *fp, int *n) { while (1) { while (isspace(*++sp)) ; if (!sp[0] || sp[0] == '\n' || sp[0] == '\\') { (*n)++; if (!e_agets((sp = str), 256, fp)) return(NULL); --sp; } else if (sp[0] == '/' && sp[1] == '*') { while (!(sp = strstr(sp, "*/"))) { (*n)++; if (!e_agets((sp = str), 256, fp)) return(NULL); } sp++; } else break; } return(sp); } char *e_sh_spl3(sp, str, fp, n) char *sp; char *str; E_AFILE *fp; int *n; { int brk = 1; while(*++sp != '}' || brk > 1) { if(!sp[0] || sp[0] == '\n') { (*n)++; if(!e_agets((sp = str), 256, fp)) return(NULL); if(isspace(*sp)) while(isspace(*++sp)); if(sp[0] == '#' && ispelse(sp)) { do { (*n)++; if(!e_agets((sp = str), 256, fp)) return(NULL); if(isspace(*sp)) while(isspace(*++sp)); } while(sp[0] != '#' || !ispendif(sp)); } sp--; } else if(sp[0] == '/' && sp[1] == '*') { while(!(sp = strstr(sp, "*/"))) { (*n)++; if(!e_agets((sp = str), 256, fp)) return(NULL); } sp++; } else if(sp[0] == '{') brk++; else if(sp[0] == '}') brk--; else if(sp[0] == '\'') { int bsl = 0; while(*++sp && (sp[0] != '\'' || bsl)) { bsl = *sp == '\\' ? !bsl : 0; } if(!*sp) sp--; } else if(sp[0] == '\"') { int bsl = 0; while(*++sp && ( *sp != '\"' || bsl)) { bsl = *sp == '\\' ? !bsl : 0; } if(!*sp) sp--; } } return(sp); } char *e_sh_spl5(sp, str, fp, n) char *sp; char *str; E_AFILE *fp; int *n; { int brk = 1; while(*++sp != ')' || brk > 1) { if(!sp[0] || sp[0] == '\n') { (*n)++; if(!e_agets((sp = str), 256, fp)) return(NULL); if(isspace(*sp)) while(isspace(*++sp)); if(sp[0] == '#' && ispelse(sp)) { do { (*n)++; if(!e_agets((sp = str), 256, fp)) return(NULL); if(isspace(*sp)) while(isspace(*++sp)); } while(sp[0] != '#' || !ispendif(sp)); } sp--; } else if(sp[0] == '/' && sp[1] == '*') { while(!(sp = strstr(sp, "*/"))) { (*n)++; if(!e_agets((sp = str), 256, fp)) return(NULL); } sp++; } else if(sp[0] == '(') brk++; else if(sp[0] == ')') brk--; else if(sp[0] == '\'') { int bsl = 0; while(*++sp && (sp[0] != '\'' || bsl)) { bsl = *sp == '\\' ? !bsl : 0; } if(!*sp) sp--; } else if(sp[0] == '\"') { int bsl = 0; while(*++sp && (*sp != '\"' || bsl)) { bsl = *sp == '\\' ? !bsl : 0; } if(!*sp) sp--; } } return(sp); } char *e_sh_spl4(sp, str, fp, n) char *sp; char *str; E_AFILE *fp; int *n; { int brk = 0; while((*++sp != ',' && *sp != ';' && *sp != '(') || brk) { if(!sp[0] || sp[0] == '\n') { (*n)++; if(!e_agets((sp = str), 256, fp)) return(NULL); --sp; } else if(sp[0] == '/' && sp[1] == '*') { while(!(sp = strstr(sp, "*/"))) { (*n)++; if(!e_agets((sp = str), 256, fp)) return(NULL); } sp++; } else if(sp[0] == '\"') { int bsl = 0; while(*++sp && (sp[0] != '\"' || bsl)) { bsl = *sp == '\\' ? !bsl : 0; } if(!*sp) sp--; } else if(sp[0] == '\'') { int bsl = 0; while(*++sp && (sp[0] != '\'' || bsl)) { bsl = *sp == '\\' ? !bsl : 0; } if(!*sp) sp--; } else if(sp[0] == '{') brk++; else if(sp[0] == '}') brk--; } return(sp); } struct dirfile *e_c_add_df(char *str, struct dirfile *df) { if (df == NULL) { df = MALLOC(sizeof(struct dirfile)); df->anz = 0; df->name = MALLOC(sizeof(char*)); } df->anz++; df->name = REALLOC(df->name, df->anz * sizeof(char*)); df->name[df->anz-1] = MALLOC((strlen(str)+1) * sizeof(char)); strcpy(df->name[df->anz-1], str); return(df); } int e_find_def(name, startfile, mode, file, num, xn, nold, oldfile, df, first) char *name; char *startfile; int mode; char *file; int *num; int *xn; int nold; char *oldfile; struct dirfile **df; int *first; { E_AFILE *fp = NULL; char *sp = NULL, str[256], *w, word[256]; int i, n, com = 0, ret = 1; int len = strlen(name); if(*df) { for(i = 0; i < (*df)->anz; i++) if(!strcmp((*df)->name[i], startfile)) return(-2); } *df = e_c_add_df(startfile, *df); if(!fp) fp = e_aopen(startfile, e_prog.sys_include, mode); if(!fp) return(-1); for(n = 0; com == 2 || e_agets((sp = str), 256, fp); n++) { if(com) { if(com == 1 && !(sp = strstr(sp, "*/"))) continue; else com = 0; } if(isspace(*sp) && !(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(sp[0] == '/' && sp[1] == '*') { if(!(sp = strstr(sp, "*/"))) com = 1; else { n--; com = 2; sp += 2; } continue; } else if(*sp == '#') { if(!(sp = e_sh_spl1(sp, str, fp, &n))) goto b_end; if(!strncmp(sp, "define", 6)) { while(isalpha(*++sp)); if(isspace(*sp) && !(sp = e_sh_spl1(sp, str, fp, &n))) goto b_end; if(!strncmp(sp, name, len) && !isalnum1(sp[len])) { if(*first) { e_aclose(fp); strcpy(file, startfile); *num = n; *xn = ((int)(sp - str)) + len; return(0); } else if(n == nold && !strcmp(startfile, oldfile)) *first = 1; } } #ifndef TESTSDEF else if(!strncmp(sp, "include", 7)) { while(isalpha(*++sp)); if(isspace(*sp) && !(sp = e_sh_spl1(sp, str, fp, &n))) goto b_end; for(i = 1; (word[i-1] = sp[i]) && sp[i] != '\"' && sp[i] != '>'; i++); word[i-1] = '\0'; if(!e_find_def(name, word, sp[i] == '>' ? 4 : 7, file, num, xn, nold, oldfile, df, first)) { e_aclose(fp); return(0); } } #endif while(sp[i = (strlen(sp) - 1)] != '\n' || sp[i-1] == '\\') { n++; if(!e_agets((sp = str), 256, fp)) goto b_end; } } else if(*sp == '{') { if(!(sp = e_sh_spl3(sp, str, fp, &n))) goto b_end; sp++; com = 2; n--; } else if(!strncmp(sp, "extern", 6)) continue; else if(!strncmp(sp, "typedef", 7)) { while(!isspace(*++sp)); if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(!strncmp(sp, "struct", 6) || !strncmp(sp, "class", 5) || !strncmp(sp, "union", 5)) { while(!isspace(*++sp)); if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(*sp == ';') { sp++; com = 2; n--; continue; } if(!strncmp(sp, name, len) && !isalnum1(sp[len])) { while(!isspace(*++sp)); if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(*sp == '{') { if(*first) { e_aclose(fp); strcpy(file, startfile); *num = n; *xn = (int)(sp - str); return(0); } else if(n == nold && !strcmp(startfile, oldfile)) *first = 1; } } } while(1) { if(isalpha1(*sp)) { for(w = word; isalnum1(*w = *sp); w++, sp++); *w = '\0'; if(isspace(*sp) && !(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(*sp == ';') { if(!strncmp(word, name, len)) { if(*first) { e_aclose(fp); strcpy(file, startfile); *num = n; *xn = (int)(sp - str); return(0); } else if(n == nold && !strcmp(startfile, oldfile)) *first = 1; } sp++; com = 2; n--; break; } } else if(*sp == '{') { if(!(sp = e_sh_spl3(sp, str, fp, &n))) goto b_end; if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(*sp == ';') { sp++; com = 2; n--; break; } } else if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; } } else if(!strncmp(sp, "struct", 6) || !strncmp(sp, "class", 5) || !strncmp(sp, "union", 5)) { while(!isspace(*++sp)); if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(*sp == ';') { sp++; com = 2; n--; continue; } if(!strncmp(sp, name, len) && !isalnum1(sp[len])) { while(!isspace(*++sp)); if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(*sp == '{') { if(*first) { e_aclose(fp); strcpy(file, startfile); *num = n; *xn = (int)(sp - str); return(0); } else if(n == nold && !strcmp(startfile, oldfile)) *first = 1; } } else if(*sp != '{') { while(!isspace(*++sp)); if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; } if(*sp == ';') { sp++; com = 2; n--; continue; } if(*sp == '{') { if(!(sp = e_sh_spl3(sp, str, fp, &n))) goto b_end; if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(*sp == ';') { sp++; com = 2; n--; continue; } } while(1) { while (*sp == '*') sp++; if(isspace(*sp) && !(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(!strncmp(sp, name, len) && !isalnum1(sp[len])) { while(isalnum1(*sp)) sp++; if(isspace(*sp) && !(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if((*sp == ';' || *sp == ',' || *sp == '=' || *sp == '[' || *sp == ')')) { if(*first) { e_aclose(fp); strcpy(file, startfile); *num = n; *xn = (int)(sp - str); return(0); } else if(n == nold && !strcmp(startfile, oldfile)) { *first = 1; if(*sp == ';') { sp++; com = 2; n--; break; } } } else if(*sp == '(') { if(!(sp = e_sh_spl5(sp, str, fp, &n))) goto b_end; if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(*sp == '{') { if(*first) { e_aclose(fp); strcpy(file, startfile); *num = n; *xn = (int)(sp - str); return(0); } else if(n == nold && !strcmp(startfile, oldfile)) { *first = 1; break; } } else break; } } else if(*sp == '(') sp++; else if(*sp == '*') { while (*sp == '*') sp++; continue; } else if(*sp == ';') { sp++; com = 2; n--; break; } else if(*sp == '{') { if(!(sp = e_sh_spl3(sp, str, fp, &n))) goto b_end; sp++; com = 2; n--; break; } else { if(!(sp = e_sh_spl4(sp, str, fp, &n))) goto b_end; if(*sp == '(') break; else if(*sp == ';') { sp++; com = 2; n--; break; } if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; } if(*sp == ';') { sp++; com = 2; n--; break; } } } else if(isalnum1(*sp)) { while(isalnum1(*sp)) sp++; while(1) { while (*sp == '*') sp++; if(isspace(*sp) && !(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(!strncmp(sp, name, len) && !isalnum1(sp[len])) { while(isalnum1(*sp)) sp++; if(isspace(*sp) && !(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(*sp == ';' || *sp == ',' || *sp == '=' || *sp == '[' || *sp == ')') { if(*first) { e_aclose(fp); strcpy(file, startfile); *num = n; *xn = (int)(sp - str); return(0); } else if(n == nold && !strcmp(startfile, oldfile)) { *first = 1; break; } } else if(*sp == '(') { if(!(sp = e_sh_spl5(sp, str, fp, &n))) goto b_end; if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(*sp == '{') { if(*first) { e_aclose(fp); strcpy(file, startfile); *num = n; *xn = (int)(sp - str); return(0); } else if(n == nold && !strcmp(startfile, oldfile)) { *first = 1; break; } } else break; } } else if(*sp == '(') sp++; else if(*sp == '*') { while (*sp == '*') sp++; continue; } else if(*sp == ';') { sp++; com = 2; n--; break; } else if(*sp == '{') { if(!(sp = e_sh_spl3(sp, str, fp, &n))) goto b_end; sp++; com = 2; n--; break; } else { if(!(sp = e_sh_spl4(sp, str, fp, &n))) goto b_end; if(*sp == '(') { if(!(sp = e_sh_spl5(sp, str, fp, &n))) goto b_end; if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; if(*sp == '{' && !(sp = e_sh_spl3(sp, str, fp, &n))) goto b_end; sp++; com = 2; n--; break; } else if(*sp == ';') { sp++; com = 2; n--; break; } if(!(sp = e_sh_spl2(sp, str, fp, &n))) goto b_end; } if(*sp == ';') { sp++; com = 2; n--; break; } } } } b_end: e_aclose(fp); return(ret); } int e_show_nm_f(char *name, FENSTER *f, int oldn, char **oldname) { int i, j, len, ret, num, x, first = oldn < 0 ? 1 : 0; char str[128], file[128], *filename; struct dirfile *df, *fdf = NULL; #ifndef TESTSDEF if (!access(e_prog.project, 0)) { WpeMouseChangeShape(WpeWorkingShape); if (e_read_var(f)) ret = -1; else { df = e_p_get_var("FILES"); if (!df) { e_error(e_p_msg[ERR_NOTHING], 0, f->fb); WpeMouseRestoreShape(); return(-1); } for (i = 0, ret = 1; i < df->anz && ret; i++) { strcpy(str, df->name[i]); ret = e_find_def(name, str, 7, file, &num, &x, oldn, *oldname, &fdf, &first); } freedf(df); } } else #endif { if (!DTMD_ISTEXT(f->dtmd)) return(-1); WpeMouseChangeShape(WpeWorkingShape); strcpy(str, f->datnam); ret = e_find_def(name, str, 7, file, &num, &x, oldn, *oldname, &fdf, &first); } freedf(fdf); if (ret) { sprintf(str, "%s not found!", name); e_error(str, 0, f->fb); WpeMouseRestoreShape(); return(-1); } if (*oldname) FREE(*oldname); *oldname = MALLOC((strlen(file)+1) * sizeof(char)); strcpy(*oldname, file); for (i = strlen(file)-1; i >= 0 && file[i] != '/'; i--) ; for (j = f->ed->mxedt; j > 0; j--) { if (i < 0) filename = f->ed->f[j]->datnam; else filename = e_mkfilename(f->ed->f[j]->dirct, f->ed->f[j]->datnam); if (!strcmp(filename, file)) break; } if (j > 0) e_switch_window(f->ed->edt[j], f->ed->f[f->ed->mxedt]); else e_edit(f->ed, file); f = f->ed->f[f->ed->mxedt]; for (i = num, j = x+1-(len = strlen(name)); i >= 0; ) { for (len = strlen(name); j >= 0 && strncmp(name, f->b->bf[i].s+j, len); j--) ; if (j < 0 && i >= 0) { i--; j = f->b->bf[i].len-len+1; } else break; } if (i >= 0) { num = i; x = j; } else len = 0; f->s->fa.y = f->s->fe.y = f->b->b.y = num; f->s->fe.x = f->b->b.x = x + len; f->s->fa.x = x; e_cursor(f, 1); f->s->fa.y = num; e_schirm(f, 1); WpeMouseRestoreShape(); return(num); } struct { int num; char *str, *file; } sh_df = { -1, NULL }; int e_sh_def(FENSTER *f) { char str[80]; if (f->ed->shdf && f->ed->shdf->anz > 0) strcpy(str, f->ed->shdf->name[0]); else str[0] = '\0'; if (e_add_arguments(str, "Show Definition", f, 0 , AltB, &f->ed->shdf)) { if (sh_df.str) FREE(sh_df.str); sh_df.str = MALLOC((strlen(str)+1)*sizeof(char)); strcpy(sh_df.str, str); if (sh_df.file) { FREE(sh_df.file); sh_df.file = NULL; } f->ed->shdf = e_add_df(str, f->ed->shdf); sh_df.num = e_show_nm_f(str, f, -1, &sh_df.file); } return(0); } int e_sh_nxt_def(FENSTER *f) { if (sh_df.num >= 0 && sh_df.str && sh_df.file) { sh_df.num = e_show_nm_f(sh_df.str, f, sh_df.num, &sh_df.file); } return(0); } int e_nxt_brk(FENSTER *f) { int c = f->b->bf[f->b->b.y].s[f->b->b.x]; int i, j, ob, cb, bsp, brk, nif; if (c == '{' || c == '(' || c == '[') { if (c == '{') { ob = '{'; cb = '}'; } else if (c == '(') { ob = '('; cb = ')'; } else { ob = '['; cb = ']'; } for (brk = 1, i = f->b->b.y; i < f->b->mxlines; i++) for (j = i == f->b->b.y ? f->b->b.x+1 : 0; j < f->b->bf[i].len; j++) { if (f->b->bf[i].s[j] == '\"') { for (bsp = 0, j++; j < f->b->bf[i].len && (f->b->bf[i].s[j] != '\"' || bsp); j++) { if (f->b->bf[i].s[j] == '\\') bsp = !bsp; else bsp = 0; if (j == f->b->bf[i].len - 1 && bsp && i < f->b->mxlines-1) { i++; j = -1; bsp = 0; } } } else if (f->b->bf[i].s[j] == '\'') { for (bsp = 0, j++; j < f->b->bf[i].len && (f->b->bf[i].s[j] != '\'' || bsp); j++) { if (f->b->bf[i].s[j] == '\\') bsp = !bsp; else bsp = 0; if (j == f->b->bf[i].len - 1 && bsp && i < f->b->mxlines-1) { i++; j = -1; bsp = 0; } } } else if (f->b->bf[i].s[j] == '/' && f->b->bf[i].s[j+1] == '*') { for (j += 2; f->b->bf[i].s[j] != '*' || f->b->bf[i].s[j+1] != '/'; j++) { if (j >= f->b->bf[i].len - 1) { if (i < f->b->mxlines-1) { i++; j = -1; } else break; } } } else if (f->b->bf[i].s[j] == '/' && f->b->bf[i].s[j+1] == '/') break; else if (f->b->bf[i].s[j] == '#' && ispelse(f->b->bf[i].s)) { for (nif = 1, i++; i < f->b->mxlines-1; i++) { for (j = 0; isspace(f->b->bf[i].s[j]); j++) ; if (ispendif(f->b->bf[i].s+j)) nif--; else if(ispif(f->b->bf[i].s+j)) nif++; if (!nif) break; } continue; } else if (f->b->bf[i].s[j] == ob) brk++; else if (f->b->bf[i].s[j] == cb) { brk--; if (!brk) { f->b->b.y = i; f->b->b.x = j; return(0); } } } } else { if (c == '}') { ob = '{'; cb = '}'; } else if (c == ')') { ob = '('; cb = ')'; } else if (c == ']') { ob = '['; cb = ']'; } else { ob = 0; cb = 0; } for (brk = -1, i = f->b->b.y; i >= 0; i--) { if (i == f->b->b.y) for (j = 0; j < f->b->b.x && (f->b->bf[i].s[j] != '/' || f->b->bf[i].s[j+1] != '/'); j++) ; else for (j = 0; j < f->b->bf[i].len && (f->b->bf[i].s[j] != '/' || f->b->bf[i].s[j+1] != '/'); j++) ; for (j--; j >= 0; j--) { if (f->b->bf[i].s[j] == '\"') { for (j--; j >= 0; j--) { if (f->b->bf[i].s[j] == '\"') { for (bsp = 0, j--; j >= 0 && f->b->bf[i].s[j] == '\\'; j--) bsp = !bsp; j++; if (!bsp) break; } if (j == 0 && i > 0 && f->b->bf[i-1].s[f->b->bf[i-1].len] == '\\') { i--; j = f->b->bf[i].len; } } } else if (f->b->bf[i].s[j] == '\'') { for (j--; j >= 0; j--) { if (f->b->bf[i].s[j] == '\'') { for (bsp = 0, j--; j >= 0 && f->b->bf[i].s[j] == '\\'; j--) bsp = !bsp; j++; if (!bsp) break; } if (j == 0 && i > 0 && f->b->bf[i-1].s[f->b->bf[i-1].len] == '\\') { i--; j = f->b->bf[i].len; } } } else if (f->b->bf[i].s[j] == '/' && f->b->bf[i].s[j-1] == '*') { for (j -= 2; f->b->bf[i].s[j] != '*' || f->b->bf[i].s[j-1] != '/'; j--) { if (j <= 0) { if (i > 0) { i--; j = f->b->bf[i].len; } else break; } } } else if (f->b->bf[i].s[j] == '#' && ispelse(f->b->bf[i].s)) { for (nif = 1, i--; i > 0; i--) { for (j = 0; isspace(f->b->bf[i].s[j]); j++) ; if (ispendif(f->b->bf[i].s+j)) nif++; else if (ispif(f->b->bf[i].s+j)) nif--; if (!nif) break; } continue; } else if (!ob) { if (f->b->bf[i].s[j] == '{' || f->b->bf[i].s[j] == '(' || f->b->bf[i].s[j] == '[') { brk++; if (!brk) { f->b->b.y = i; f->b->b.x = j; return(0); } } else if (f->b->bf[i].s[j] == '}' || f->b->bf[i].s[j] == ')' || f->b->bf[i].s[j] == ']') brk--; else if (i == 0 && j == 0) { f->b->b.y = i; f->b->b.x = j; return(0); } } else { if (f->b->bf[i].s[j] == ob) { brk++; if (!brk) { f->b->b.y = i; f->b->b.x = j; return(0); } } else if (f->b->bf[i].s[j] == cb) brk--; } } } } return(e_error("No Matching Bracket!", 0, f->ed->fb)); } char *e_mbt_mk_sp(char *str, int n, int sw, int *m) { int k; if (!sw) *m = n; else *m = n / sw + n % sw; str = REALLOC(str, (*m+1)*sizeof(char)); if (!sw) k = 0; else for (k = 0; k < n / sw; k++) str[k] = '\t'; for (; k < *m; k++) str[k] = ' '; str[*m] = '\0'; return(str); } int e_mbt_str(BUFFER *b, int *ii, int *jj, unsigned char c, int n, int sw, int *cmnd) { int i = *ii, j = *jj + 1, bsp; if (*cmnd != 2) *cmnd = 0; for (bsp = 0; j < b->bf[i].len && (b->bf[i].s[j] != c || bsp); j++) { if (b->bf[i].s[j] == '\\') bsp = !bsp; else bsp = 0; if (j == b->bf[i].len - 1 && bsp && i < b->mxlines-1) { char *str = MALLOC(1); int m; i++; bsp = 0; for (j = 0, m = b->bf[i].len; j < m && isspace(b->bf[i].s[j]); j++) ; if (j > 0) e_del_nchar(b, b->f->s, 0, i, j); if (j < m) { str = e_mbt_mk_sp(str, n+b->cn->autoindent, sw, &m); e_ins_nchar(b, b->f->s, str, 0, i, m); } j = -1; FREE(str); } } *ii = i; *jj = j; return(0); } int e_mbt_cnd(BUFFER *b, int *ii, int *jj, int n, int sw, int *cmnd) { int i = *ii, j = *jj + 2; for (; b->bf[i].s[j] != '*' || b->bf[i].s[j+1] != '/'; j++) { if (j >= b->bf[i].len - 1) { if (i < b->mxlines-1) { char *str = MALLOC(1); int m; i++; for (j = 0, m = b->bf[i].len; j < m && isspace(b->bf[i].s[j]); j++) ; if (j > 0) e_del_nchar(b, b->f->s, 0, i, j); if (j < m && (b->bf[i].s[0] != '*' || b->bf[i].s[1] != '/')) { str = e_mbt_mk_sp(str, n+b->cn->autoindent, sw, &m); e_ins_nchar(b, b->f->s, str, 0, i, m); } j = -1; FREE(str); if (*cmnd == 2) *cmnd = 1; } else break; } } *ii = i; *jj = j+1; return(0); } int e_mk_beauty(int sw, int ndif, FENSTER *f) { BUFFER *b; SCHIRM *s; int bg, nd, m, n, i, j, k, brk, cbrk = 0, nif = 0, nic = 0; int nstrct = 0, cmnd, cm_sv; char *tstr = MALLOC(sizeof(char)); char *bstr = MALLOC((ndif+1)*sizeof(char)); int *nvek = MALLOC(sizeof(int)); int *ifvekb = MALLOC(sizeof(int)); int *ifvekr = MALLOC(sizeof(int)); int *vkcs = MALLOC(sizeof(int)); int *vkcb = MALLOC(sizeof(int)); POINT sa, se, sb; for (i = f->ed->mxedt; i > 0 && !DTMD_ISTEXT(f->ed->f[i]->dtmd); i--) ; if (i <= 0) { FREE(tstr); FREE(bstr); FREE(nvek); FREE(ifvekb); FREE(ifvekr); FREE(vkcs); FREE(vkcb); return(0); } *ifvekb = 0; *ifvekr = 0; *vkcs = 0; *vkcb = 0; e_switch_window(f->ed->edt[i], f); WpeMouseChangeShape(WpeWorkingShape); f = f->ed->f[f->ed->mxedt]; b = f->b; s = f->s; sa = s->mark_begin; se = s->mark_end; sb = b->b; if (sw & 1) { if (sw & 2) bg = i = b->b.x == 0 ? b->b.y : b->b.y + 1; else bg = i = s->mark_begin.x == 0 ? s->mark_begin.y : s->mark_begin.y + 1; nd = s->mark_end.x == 0 ? s->mark_end.y : s->mark_end.y + 1; if (nd > b->mxlines) nd = b->mxlines; } else { if (sw & 2) bg = i = b->b.x == 0 ? b->b.y : b->b.y + 1; else bg = i = 0; nd = b->mxlines; } if (s->mark_begin.y < 0 || (s->mark_begin.y == 0 && s->mark_begin.x <= 0)) n = 0; else { for (n = j = 0; j < b->bf[i].len && isspace(b->bf[i].s[j]); j++) { if (b->bf[i].s[j] == ' ') n++; else if (b->bf[i].s[j] == '\t') n += f->ed->tabn - (n % f->ed->tabn); } } tstr = e_mbt_mk_sp(tstr, n, (sw & 4) ? 0 : f->ed->tabn, &m); for (k = 0; k < ndif; k++) bstr[k] = ' '; bstr[ndif] = '\0'; nvek[0] = n; for (cm_sv = 1, cmnd = 1, brk = 0; i < nd; i++) { for (j = 0; j < b->bf[i].len && isspace(b->bf[i].s[j]); j++) ; if (i > bg) { for (k = b->bf[i-1].len-1; k >= 0 && isspace(b->bf[i-1].s[k]); k--); if (k >= 0) e_del_nchar(b, s, k + 1, i-1, b->bf[i-1].len-1-k); e_del_nchar(b, s, 0, i, j); if (b->bf[i].len > 0 && b->bf[i].s[0] != '#' && (b->bf[i].s[0] != '/' || b->bf[i].s[1] != '*')) { if ((cmnd == 0 && (!cm_sv || b->bf[i].s[0] != '{')) || (cmnd == 2 && b->bf[i-1].s[k] == '\\')) { tstr = e_mbt_mk_sp(tstr, !cmnd ? n+b->cn->autoindent : b->cn->autoindent, (sw & 4) ? 0 : f->ed->tabn, &m); e_ins_nchar(b, s, tstr, 0, i, m); j = m; tstr = e_mbt_mk_sp(tstr, n, (sw & 4) ? 0 : f->ed->tabn, &m); } else { e_ins_nchar(b, s, tstr, 0, i, m); j = m; if (cmnd == 0) cmnd = 1; } } } if (cmnd == 0) cm_sv = cbrk ? 1 : 0; else cm_sv = cmnd; for (cmnd = 1; j < b->bf[i].len; j++) { if (b->bf[i].s[j] == '\"') e_mbt_str(b, &i, &j, '\"', n, (sw & 4) ? 0 : f->ed->tabn, &cmnd); else if (f->b->bf[i].s[j] == '\'') e_mbt_str(b, &i, &j, '\'', n, (sw & 4) ? 0 : f->ed->tabn, &cmnd); else if (b->bf[i].s[j] == '/' && b->bf[i].s[j+1] == '*') e_mbt_cnd(b, &i, &j, n, (sw & 4) ? 0 : f->ed->tabn, &cmnd); else if (b->bf[i].s[j] == '/' && b->bf[i].s[j+1] == '/') break; else if (b->bf[i].s[j] == ';') { cmnd = cbrk ? 0 : 1; nstrct = 0; } else if (b->bf[i].s[j] == '#' && ispif(b->bf[i].s)) { nif++; ifvekb = REALLOC(ifvekb, (nif+1)*sizeof(int)); ifvekr = REALLOC(ifvekr, (nif+1)*sizeof(int)); ifvekb[nif] = brk; ifvekr[nif] = cbrk; cmnd = 2; } else if (b->bf[i].s[j] == '#' && nif > 0 && ispelse(b->bf[i].s)) { brk = ifvekb[nif]; cbrk = ifvekr[nif]; n = nvek[brk]; tstr = e_mbt_mk_sp(tstr, n, (sw & 4) ? 0 : f->ed->tabn, &m); cmnd = 2; } else if (b->bf[i].s[j] == '#' && ispendif(b->bf[i].s)) { nif--; cmnd = 2; } else if (b->bf[i].s[j] == '#') { cmnd = 2; for (j++; j < b->bf[i].len; j++) { if (j == b->bf[i].len - 1 && i < b->mxlines-1 && b->bf[i].s[j] == '\\') { i++; j = 0; } else if (b->bf[i].s[j] == '\"') e_mbt_str(b, &i, &j, '\"', n, (sw & 4) ? 0 : f->ed->tabn, &cmnd); else if (f->b->bf[i].s[j] == '\'') e_mbt_str(b, &i, &j, '\'', n, (sw & 4) ? 0 : f->ed->tabn, &cmnd); else if (b->bf[i].s[j] == '/' && b->bf[i].s[j+1] == '*') e_mbt_cnd(b, &i, &j, n, (sw & 4) ? 0 : f->ed->tabn, &cmnd); else if (b->bf[i].s[j] == '/' && b->bf[i].s[j+1] == '/') break; } if (b->bf[i].s[j] == '/' && b->bf[i].s[j+1] == '/') break; } else if (b->bf[i].s[j] == '(') { nstrct = 0; cmnd = 0; cbrk++; } else if (b->bf[i].s[j] == ')') { nstrct = 0; cmnd = 0; cbrk--; } else if (b->bf[i].s[j] == '{') { brk++; cmnd = 1; for (k = j + 1; k < b->bf[i].len && isspace(b->bf[i].s[k]); k++); if (k < b->bf[i].len && (b->bf[i].s[k] != '/' || (b->bf[i].s[k+1] != '*' && b->bf[i].s[k+1] != '/'))) { e_del_nchar(b, s, j+1, i, k-j-1); e_ins_nchar(b, s, bstr, j+1, i, ndif-1); } if (nstrct == 1) { if (k >= b->bf[i].len) n = nvek[brk-1]; else { for (k = j - 1; k >= 0 && isspace(b->bf[i].s[k]); k--); if (k >= 0) nstrct++; } nstrct++; nic++; vkcb = REALLOC(vkcb, (nic+1)*sizeof(int)); vkcs = REALLOC(vkcs, (nic+1)*sizeof(int)); vkcs[nic] = 0; vkcb[nic] = brk-1; } else { for(n = k = 0; k < j; k++) { if (b->bf[i].s[k] == '\t') n += f->ed->tabn - (n % f->ed->tabn); else n++; } } n += ndif; tstr = e_mbt_mk_sp(tstr, n, (sw & 4) ? 0 : f->ed->tabn, &m); nvek = REALLOC(nvek, (brk+1)*sizeof(int)); nvek[brk] = n; } else if (f->b->bf[i].s[j] == '}') { brk--; cmnd = 1; nstrct = 0; if (nic > 0 && vkcb[nic] == brk - 1) { n = nvek[brk]; nic--; brk--; } if (brk < 0) { FREE(tstr); FREE(bstr); FREE(nvek); FREE(ifvekb); FREE(ifvekr); FREE(vkcs); FREE(vkcb); b->b = sb; s->mark_begin = sa; s->mark_end = se; e_schirm(f, 1); WpeMouseRestoreShape(); return(0); } n -= ndif; tstr = e_mbt_mk_sp(tstr, n, (sw & 4) ? 0 : f->ed->tabn, &m); for (k = j - 1; k >= 0 && isspace(b->bf[i].s[k]); k--); e_del_nchar(b, s, k+1, i, j-1-k); if (k > 0) { e_ins_nchar(b, s, bstr, k+1, i, ndif-1); j = k+ndif+1; } else { e_ins_nchar(b, s, tstr, k+1, i, m); j = k+m+2; } n = nvek[brk]; tstr = e_mbt_mk_sp(tstr, n, (sw & 4) ? 0 : f->ed->tabn, &m); } else if (((j == 0 || !isalnum1(b->bf[i].s[j-1])) && (iscase(b->bf[i].s+j) || isstatus(b->bf[i].s+j))) || (nstrct > 1 && isalnum1(b->bf[i].s[j]))) { if (vkcs[nic]) { n = nvek[vkcb[nic]+1]; tstr = e_mbt_mk_sp(tstr, n, (sw & 4) ? 0 : f->ed->tabn, &m); for (k = j - 1; k >= 0 && isspace(b->bf[i].s[k]); k--); e_del_nchar(b, s, k+1, i, j-1-k); if (k > 0) { e_ins_nchar(b, s, bstr, k+1, i, ndif-1); j = k+ndif+1; } else { e_ins_nchar(b, s, tstr, k+1, i, m); j = k+m+2; } } else { brk++; vkcs[nic] = 1; } if (nstrct < 2 || isstatus(b->bf[i].s+j)) { for (j++; j < b->bf[i].len && b->bf[i].s[j] != ':'; j++); for (k = j + 1; k < b->bf[i].len && isspace(b->bf[i].s[k]); k++); if (k < b->bf[i].len && (b->bf[i].s[k] != '/' || (b->bf[i].s[k+1] != '*' && b->bf[i].s[k+1] != '/'))) { e_del_nchar(b, s, j+1, i, k-j-1); e_ins_nchar(b, s, bstr, j+1, i, ndif-1); for (n = k = 0; k < j; k++) { if (b->bf[i].s[k] == '\t') n += f->ed->tabn - (n % f->ed->tabn); else n++; } } } else if (nstrct == 2) e_ins_nchar(b, s, bstr, j, i, ndif); else j--; n += ndif; tstr = e_mbt_mk_sp(tstr, n, (sw & 4) ? 0 : f->ed->tabn, &m); nvek = REALLOC(nvek, (brk+1)*sizeof(int)); nvek[brk] = n; cmnd = 3; nstrct = 0; } else if ((j == 0 || !isalnum1(b->bf[i].s[j-1])) && (!strncmp(b->bf[i].s+j, "switch", 6) && !isalnum1(b->bf[i].s[j+6]))) { nic++; vkcb = REALLOC(vkcb, (nic+1)*sizeof(int)); vkcs = REALLOC(vkcs, (nic+1)*sizeof(int)); vkcs[nic] = 0; vkcb[nic] = brk; } else if ((j == 0 || !isalnum1(b->bf[i].s[j-1])) && ((!strncmp(b->bf[i].s+j, "class", 5) && !isalnum1(b->bf[i].s[j+5])) || (!strncmp(b->bf[i].s+j, "struct", 6) && !isalnum1(b->bf[i].s[j+6])))) nstrct = 1; else if (cmnd == 1 && !isspace(f->b->bf[i].s[j])) cmnd = 0; else if (cmnd == 3 && f->b->bf[i].s[j] == ':') cmnd = 1; } } FREE(nvek); FREE(tstr); FREE(bstr); FREE(ifvekb); FREE(ifvekr); FREE(vkcs); FREE(vkcb); s->mark_begin = sa; s->mark_end = se; b->b = sb; e_schirm(f, 1); WpeMouseRestoreShape(); return(0); } int e_p_beautify(FENSTER *f) { static int b_sw = 0; int ret; W_OPTSTR *o = e_init_opt_kst(f); if (!o) return(-1); o->xa = 21; o->ya = 3; o->xe = 52; o->ye = 19; o->bgsw = AltO; o->name = "Beautify"; o->crsw = AltO; e_add_txtstr(4, 2, "Begin:", o); e_add_txtstr(4, 6, "Scope:", o); e_add_numstr(4, 12, 26, 12, 2, 100, 0, AltN, "Number of Columns:", f->ed->autoindent, o); e_add_sswstr(5, 10, 3, AltT, (b_sw & 4) ? 1 : 0, "No Tabulators ", o); e_add_pswstr(0, 5, 3, 0, AltG, 0, "Global ", o); e_add_pswstr(0, 5, 4, 0, AltS, b_sw & 1, "Selected Text ", o); e_add_pswstr(1, 5, 7, 0, AltE, 0, "Entire Scope ", o); e_add_pswstr(1, 5, 8, 0, AltF, (b_sw & 2) ? 1 : 0, "From Cursor ", o); e_add_bttstr(7, 14, 1, AltO, " Ok ", NULL, o); e_add_bttstr(18, 14, -1, WPE_ESC, "Cancel", NULL, o); ret = e_opt_kst(o); if (ret != WPE_ESC) { b_sw = o->pstr[0]->num + (o->pstr[1]->num << 1) + (o->sstr[0]->num << 2); f->ed->autoindent = o->nstr[0]->num; e_mk_beauty(b_sw, f->ed->autoindent, f); } freeostr(o); return(0); } #endif xwpe-1.5.30a/we_term.c0000644000076400007640000006107610263105405013572 0ustar dulsidulsi/* we_term.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "edit.h" #ifdef UNIX #include #include #include #include #define KEYFN 42 #define NSPCHR 13 #ifndef XWPE_DLL #define WpeDllInit WpeTermInit #endif /* we_term.c */ char *init_key(char *key); char *init_kkey(char *key); int init_cursor(void); int e_begscr(void); void e_endwin(void); int fk_t_cursor(int x); int fk_t_putchar(int c); int fk_attrset(int a); int e_t_refresh(void); int e_t_sys_ini(void); int e_t_sys_end(void); int e_t_getch(void); int e_find_key(int c, int j, int sw); void e_exitm(char *s, int n); int fk_t_locate(int x, int y); int fk_t_mouse(int *g); int e_t_initscr(void); int e_t_kbhit(void); int e_t_d_switch_out(int sw); int e_t_switch_screen(int sw); int e_t_deb_out(FENSTER *f); int e_s_sys_end(); int e_s_sys_ini(); extern int MAXSLNS; extern int MAXSCOL; #ifndef NCURSES char *key_f[KEYFN], *key_key; #endif char *cur_rc, *cur_vs, *cur_nvs, *cur_vvs, cur_attr; char *att_so, *att_ul, *att_rv, *att_bl, *att_dm, *att_bo; char *ratt_no, *ratt_so, *ratt_ul, *ratt_rv, *ratt_bl, *ratt_dm, *ratt_bo; char *beg_scr, *swt_scr, *sav_cur, *res_cur; extern char *altschirm; extern char *att_no; char *col_fg, *col_bg, *spc_st, *spc_in, *spc_bg, *spc_nd; extern int col_num; #ifdef NCURSES chtype sp_chr[NSPCHR]; #else char *sp_chr[NSPCHR]; #endif extern int cur_x, cur_y; extern struct termios otermio, ntermio, ttermio; #ifdef TERMCAP char area[315]; char *ap = area; char tcbuf[1024]; char *tc_screen; char *tgetstr(); int tgetnum(); char *tgoto(); #define tigetstr(k) tgetstr(k, &ap) #define term_move(x,y) e_putp(tgoto(cur_rc, x, y)) #define term_refresh() fflush(stdout) #else /* Because term.h defines "buttons" it messes up we_gpm.c if in edit.h */ #include /* AIX requires that tparm has 10 arguments. */ #define tparm1(a,b) tparm((a), (b), 0, 0, 0, 0, 0, 0, 0, 0) #define tparm2(a,b,c) tparm((a), (b), (c), 0, 0, 0, 0, 0, 0, 0) #ifdef NCURSES #define term_move(x,y) move(y, x) #define term_refresh() refresh() #else #define term_move(x,y) e_putp(tparm2(cur_rc, y, x)) #define term_refresh() fflush(stdout) #endif #endif int WpeDllInit(int *argc, char **argv) { fk_u_cursor = fk_t_cursor; fk_u_locate = fk_t_locate; e_u_d_switch_out = e_t_d_switch_out; e_u_switch_screen = e_t_switch_screen; e_u_deb_out = e_t_deb_out; e_u_kbhit = e_t_kbhit; e_u_s_sys_end = e_s_sys_end; e_u_s_sys_ini = e_s_sys_ini; e_u_refresh = e_t_refresh; e_u_getch = e_t_getch; e_u_sys_ini = e_t_sys_ini; e_u_sys_end = e_t_sys_end; e_u_system = system; fk_u_putchar = fk_t_putchar; #ifdef HAVE_LIBGPM if (WpeGpmMouseInit() == 0) { fk_mouse = WpeGpmMouse; } else #endif fk_mouse = fk_t_mouse; WpeMouseChangeShape = (void (*)(WpeMouseShape))WpeNullFunction; WpeMouseRestoreShape = WpeNullFunction; WpeDisplayEnd = e_endwin; #ifdef __linux__ u_bioskey = WpeLinuxBioskey; #else u_bioskey = WpeZeroFunction; #endif e_t_initscr(); if (col_num > 0) { e_pr_u_col_kasten = e_pr_x_col_kasten; e_frb_u_menue = e_frb_x_menue; e_s_u_clr = e_s_x_clr; e_n_u_clr = e_n_x_clr; } else { e_pr_u_col_kasten = e_pr_t_col_kasten; e_frb_u_menue = e_frb_t_menue; e_s_u_clr = e_s_t_clr; e_n_u_clr = e_n_t_clr; } MCI = '+'; MCA = '0'; RD1 = '\01'; RD2 = '\02'; RD3 = '\03'; RD4 = '\04'; RD5 = '\05'; RD6 = '\06'; RE1 = '\01'; RE2 = '\02'; RE3 = '\03'; RE4 = '\04'; RE5 = '\05'; RE6 = '\06'; WBT = '\13'; ctree[0] = "\11\12\07"; /* 07 -> 30 */ ctree[1] = "\11\12\12"; /* 11 -> 16 */ ctree[2] = "\11\07\12"; /* 12 -> 22 */ ctree[3] = "\10\12\12"; /* 10 -> 25 */ ctree[4] = "\11\12\12"; /* RD1 = '+'; RD2 = '+'; RD3 = '+'; RD4 = '+'; RD5 = '-'; RD6 = '|'; *//* RE1 = '.'; RE2 = '.'; RE3 = '.'; RE4 = '.'; RE5 = '.'; RE6 = ':'; WBT = '#'; ctree[0] = "|__"; ctree[1] = "|__"; ctree[2] = "|__"; ctree[3] = "|__"; ctree[4] = "|__"; */ return 0; } char *init_key(char *key) { char *tmp, *keystr; tmp = (char *) tigetstr(key); if (tmp == NULL || tmp == ((char *) -1)) return(NULL); else { keystr = MALLOC(strlen(tmp)+1); strcpy(keystr, tmp); } return(keystr); } #ifndef NCURSES char *init_kkey(char *key) { char *tmp; int i; tmp = init_key(key); if (tmp == NULL) return(NULL); if (!key_key) { key_key = MALLOC(2); key_key[0] = tmp[1]; key_key[1] = '\0'; return(tmp); } else { for (i = 0; key_key[i] != '\0'; i++) if (key_key[i] == tmp[1]) return(tmp); key_key = REALLOC(key_key, i + 2); key_key[i] = tmp[1]; key_key[i + 1] = '\0'; } return(tmp); } #endif char *init_spchr(char c) { int i; char *pt = NULL; if (!spc_st || !spc_bg || !spc_nd) return(NULL); for (i = 0; spc_st[i] && spc_st[i+1] && spc_st[i] != c; i+=2) ; if (spc_st[i] && spc_st[i+1]) { pt = MALLOC((strlen(spc_bg)+strlen(spc_nd)+2)*sizeof(char)); if(pt) sprintf(pt, "%s%c%s", spc_bg, spc_st[i+1], spc_nd); } return(pt); } int init_cursor() { #ifndef TERMCAP if (!(cur_rc = init_key("cup"))) return(-1); if ((col_fg = init_key("setaf")) && (col_bg = init_key("setab"))) { /* terminfo 10.2.x color code */ if ((col_num = tigetnum("colors")) < 0) col_num = 8; } else if ((col_fg = init_key("setf")) && (col_bg = init_key("setb"))) { /* Older terminfo color code */ if((col_num = tigetnum("colors")) < 0) col_num = 8; } else { /* No colors */ if(col_fg) { free(col_fg); col_fg = NULL; } if(col_bg) { free(col_bg); col_bg = NULL; } } spc_st = init_key("acsc"); spc_in = init_key("enacs"); spc_bg = init_key("smacs"); spc_nd = init_key("rmacs"); att_no = init_key("sgr0"); att_so = init_key("smso"); att_ul = init_key("smul"); att_rv = init_key("rev"); att_bl = init_key("blink"); att_dm = init_key("dim"); att_bo = init_key("bold"); ratt_no = init_key("sgr0"); ratt_so = init_key("rmso"); ratt_ul = init_key("rmul"); ratt_rv = init_key("sgr0"); ratt_bl = init_key("sgr0"); ratt_dm = init_key("sgr0"); ratt_bo = init_key("sgr0"); beg_scr = init_key("smcup"); swt_scr = init_key("rmcup"); sav_cur = init_key("sc"); res_cur = init_key("rc"); #ifndef NCURSES key_f[0] = init_kkey("kf1"); key_f[1] = init_kkey("kf2"); key_f[2] = init_kkey("kf3"); key_f[3] = init_kkey("kf4"); key_f[4] = init_kkey("kf5"); key_f[5] = init_kkey("kf6"); key_f[6] = init_kkey("kf7"); key_f[7] = init_kkey("kf8"); key_f[8] = init_kkey("kf9"); key_f[9] = init_kkey("kf10"); key_f[10] = init_kkey("kcuu1"); key_f[11] = init_kkey("kcud1"); key_f[12] = init_kkey("kcub1"); key_f[13] = init_kkey("kcuf1"); key_f[14] = init_kkey("kich1"); key_f[15] = init_kkey("khome"); key_f[16] = init_kkey("kpp"); if(!(key_f[17] = init_kkey("kdch1"))) key_f[17] = "\177"; key_f[18] = init_kkey("kend"); key_f[19] = init_kkey("knp"); key_f[20] = init_kkey("kbs"); key_f[21] = init_kkey("khlp"); key_f[22] = init_kkey("kll"); key_f[23] = init_kkey("kf17"); key_f[24] = init_kkey("kf18"); key_f[25] = init_kkey("kf19"); key_f[26] = init_kkey("kf20"); key_f[27] = init_kkey("kf21"); key_f[28] = init_kkey("kf22"); key_f[29] = init_kkey("kf23"); key_f[30] = init_kkey("kf24"); key_f[31] = init_kkey("kf25"); key_f[32] = init_kkey("kf26"); key_f[33] = init_kkey("kPRV"); key_f[34] = init_kkey("kNXT"); key_f[35] = init_kkey("kLFT"); key_f[36] = init_kkey("kRIT"); key_f[37] = init_kkey("kHOM"); key_f[38] = init_kkey("kri"); key_f[39] = init_kkey("kEND"); key_f[40] = init_kkey("kind"); key_f[41] = init_kkey("kext"); #endif #else if(!(cur_rc = init_key("cm"))) return(-1); if((col_fg = init_key("Sf")) && (col_bg = init_key("Sb"))) { if((col_num = tgetnum("Co")) < 0) col_num = 8; } else { if(col_fg) { free(col_fg); col_fg = NULL; } if(col_bg) { free(col_bg); col_bg = NULL; } } spc_st = init_key("ac"); spc_in = init_key("eA"); spc_bg = init_key("as"); spc_nd = init_key("ae"); att_no = init_key("me"); att_so = init_key("so"); att_ul = init_key("us"); att_rv = init_key("mr"); att_bl = init_key("mb"); att_dm = init_key("mh"); att_bo = init_key("md"); ratt_no = init_key("me"); ratt_so = init_key("se"); ratt_ul = init_key("ue"); ratt_rv = init_key("me"); ratt_bl = init_key("me"); ratt_dm = init_key("me"); ratt_bo = init_key("me"); beg_scr = init_key("ti"); swt_scr = init_key("te"); sav_cur = init_key("sc"); res_cur = init_key("rc"); key_f[0] = init_kkey("k1"); key_f[1] = init_kkey("k2"); key_f[2] = init_kkey("k3"); key_f[3] = init_kkey("k4"); key_f[4] = init_kkey("k5"); key_f[5] = init_kkey("k6"); key_f[6] = init_kkey("k7"); key_f[7] = init_kkey("k8"); key_f[8] = init_kkey("k9"); key_f[9] = init_kkey("k;"); key_f[10] = init_kkey("ku"); key_f[11] = init_kkey("kd"); key_f[12] = init_kkey("kl"); key_f[13] = init_kkey("kr"); key_f[14] = init_kkey("kI"); key_f[15] = init_kkey("kh"); key_f[16] = init_kkey("kP"); key_f[17] = init_kkey("kD"); key_f[18] = init_kkey("@7"); key_f[19] = init_kkey("kN"); key_f[20] = init_kkey("kb"); key_f[21] = init_kkey("%1"); key_f[22] = init_kkey("kH"); key_f[23] = init_kkey("F7"); key_f[24] = init_kkey("F8"); key_f[25] = init_kkey("F9"); key_f[26] = init_kkey("FA"); key_f[27] = init_kkey("FB"); key_f[28] = init_kkey("FC"); key_f[29] = init_kkey("FD"); key_f[30] = init_kkey("FE"); key_f[31] = init_kkey("FF"); key_f[32] = init_kkey("FG"); key_f[33] = init_kkey("%e"); key_f[34] = init_kkey("%c"); key_f[35] = init_kkey("#4"); key_f[36] = init_kkey("%i"); key_f[37] = init_kkey("#2"); key_f[38] = init_kkey("kR"); key_f[39] = init_kkey("*7"); key_f[40] = init_kkey("kF"); key_f[41] = init_kkey("@1"); #endif #ifdef NCURSES sp_chr[0] = 0; sp_chr[1] = ACS_ULCORNER; sp_chr[2] = ACS_URCORNER; sp_chr[3] = ACS_LLCORNER; sp_chr[4] = ACS_LRCORNER; sp_chr[5] = ACS_HLINE; sp_chr[6] = ACS_VLINE; sp_chr[7] = ACS_S9; sp_chr[8] = ACS_VLINE; sp_chr[9] = ACS_VLINE; sp_chr[10] = ACS_S9; sp_chr[11] = ACS_DIAMOND; sp_chr[12] = ' '; #else sp_chr[0] = ""; if(!(sp_chr[1] = init_spchr('l'))) sp_chr[1] = "+"; if(!(sp_chr[2] = init_spchr('k'))) sp_chr[2] = "+"; if(!(sp_chr[3] = init_spchr('m'))) sp_chr[3] = "+"; if(!(sp_chr[4] = init_spchr('j'))) sp_chr[4] = "+"; if(!(sp_chr[5] = init_spchr('q'))) sp_chr[5] = "-"; if(!(sp_chr[6] = init_spchr('x'))) sp_chr[6] = "|"; if(!(sp_chr[7] = init_spchr('w'))) sp_chr[7] = "_"; if(!(sp_chr[8] = init_spchr('t'))) sp_chr[8] = "|"; if(!(sp_chr[9] = init_spchr('m'))) sp_chr[9] = "|"; if(!(sp_chr[10] = init_spchr('q'))) sp_chr[10] = "_"; if(!(sp_chr[11] = init_spchr('`'))) sp_chr[11] = "#"; if(!(sp_chr[12] = init_spchr('a'))) sp_chr[12] = " "; #endif return(0); } int e_t_initscr() { int ret, i, k; #ifndef TERMCAP WINDOW * stdscr; #endif ret = tcgetattr(1, &otermio); /* save old settings */ /* if(ret) { printf("Error in Terminal Initialisation Code: %d\n", ret); printf("c_iflag = %o, c_oflag = %o, c_cflag = %o,\n", otermio.c_iflag, otermio.c_oflag, otermio.c_cflag); printf("c_lflag = %o, c_line = %o, c_cc = {\"\\%o\\%o\\%o\\%o\\%o\\%o\\%o\\%o\"}\n", otermio.c_lflag, otermio.c_line, otermio.c_cc[0], otermio.c_cc[1], otermio.c_cc[2], otermio.c_cc[3], otermio.c_cc[4], otermio.c_cc[5], otermio.c_cc[6], otermio.c_cc[7]); WpeExit(1); } */ #ifndef TERMCAP if ((stdscr=initscr())==(WINDOW *)ERR) exit(27); #ifdef NCURSES cbreak(); noecho(); nonl(); intrflush(stdscr,FALSE); keypad(stdscr,TRUE); #endif if (has_colors()) { start_color(); for (i = 0; i < COLORS; i++) { for (k = 0; k < COLORS; k++) { if (i != 0 || k != 0) { init_pair(i * 8 + k, k, i); } } } } #endif e_begscr(); schirm = MALLOC(2 * MAXSCOL * MAXSLNS); altschirm = MALLOC(2 * MAXSCOL * MAXSLNS); #if !defined(NO_XWINDOWS) && defined(NEWSTYLE) extbyte = MALLOC(MAXSCOL * MAXSLNS); #endif e_abs_refr(); if(init_cursor()) { printf("Terminal Not in the right mode\n"); e_exit(1); } tcgetattr(0, &ntermio); ntermio.c_iflag = 0; /* setup new settings */ ntermio.c_oflag = 0; ntermio.c_lflag = 0; ntermio.c_cc[VMIN] = 1; ntermio.c_cc[VTIME] = 0; #ifdef VSWTCH ntermio.c_cc[VSWTCH] = 0; #endif tcsetattr(0, TCSADRAIN, &ntermio); if (spc_in) e_putp(spc_in); return(0); } int svflgs, kbdflgs; int e_begscr() { int cols, lns; kbdflgs = fcntl( 0, F_GETFL, 0 ); #ifndef TERMCAP #ifndef NCURSES setupterm((char *)0, 1, (int *)0); #endif if ((lns = tigetnum("lines")) > 0) MAXSLNS = lns; if ((cols = tigetnum("cols")) > 0) MAXSCOL = cols; #else if ((tc_screen = getenv("TERM")) == NULL) e_exitm("Environment variable TERM not defined!", 1); if ((tgetent(tcbuf, tc_screen)) != 1) e_exitm("Unknown terminal type!", 1); if ((lns = tgetnum("li")) > 0) MAXSLNS = lns; if ((cols = tgetnum("co")) > 0) MAXSCOL = cols; #endif return(0); } #define fk_putp(p) ( p ? e_putp(p) : e_putp(att_no) ) void e_endwin() { #ifdef NCURSES endwin(); #else fk_putp(ratt_bo); #endif tcsetattr(0, TCSADRAIN, &otermio); } int fk_t_cursor(int x) { return(x); } int fk_t_putchar(int c) { #ifdef NCURSES addch(c); return c; #else return(fputc(c, stdout)); #endif } int fk_attrset(int a) { if(cur_attr == a) return(0); #ifdef NCURSES switch(a) { case 0: attrset(A_NORMAL); break; case 1: attrset(A_STANDOUT); break; case 2: attrset(A_UNDERLINE); break; case 4: attrset(A_REVERSE); break; case 8: attrset(A_BLINK); break; case 16: attrset(A_DIM); break; case 32: attrset(A_BOLD); break; } #else switch(cur_attr) { case 0: fk_putp(ratt_no); break; case 1: fk_putp(ratt_so); break; case 2: fk_putp(ratt_ul); break; case 4: fk_putp(ratt_rv); break; case 8: fk_putp(ratt_bl); break; case 16: fk_putp(ratt_dm); break; case 32: fk_putp(ratt_bo); break; } switch(a) { case 0: fk_putp(att_no); break; case 1: fk_putp(att_so); break; case 2: fk_putp(att_ul); break; case 4: fk_putp(att_rv); break; case 8: fk_putp(att_bl); break; case 16: fk_putp(att_dm); break; case 32: fk_putp(att_bo); break; } #endif return(cur_attr = a); } void fk_colset(int c) { int bg; if (cur_attr == c) return; cur_attr = c; bg = c / 16; #ifdef TERMCAP if ((c %= 16) >= col_num) { fk_putp(att_bo); e_putp(tgoto(col_fg, 0, c % col_num)); e_putp(tgoto(col_bg, 0, bg)); } else { fk_putp(ratt_bo); e_putp(tgoto(col_fg, 0, c)); e_putp(tgoto(col_bg, 0, bg)); } #else #ifdef NCURSES if (c & 8) attrset(A_BOLD); else attrset(A_NORMAL); color_set((bg * 8) + c % 8, NULL); #else if ((c %= 16) >= col_num) { fk_putp(att_bo); e_putp(tparm1(col_fg, c % col_num)); e_putp(tparm1(col_bg, bg)); } else { fk_putp(ratt_bo); e_putp(tparm1(col_fg, c)); e_putp(tparm1(col_bg, bg)); } #endif #endif } int e_t_refresh() { int x = cur_x, y = cur_y, i, j, c; fk_cursor(0); for(i = 0; i < MAXSLNS; i++) for(j = 0; j < MAXSCOL; j++) { if (i == MAXSLNS-1 && j == MAXSCOL-1) break; if (*(schirm + 2*MAXSCOL * i + 2 * j) != *(altschirm + 2*MAXSCOL * i + 2 * j) || *(schirm + 2*MAXSCOL * i + 2 * j + 1) != *(altschirm + 2*MAXSCOL * i + 2 * j + 1) ) { if (cur_x != j || cur_y != i) term_move(j, i); if (cur_x < MAXSCOL) { cur_x = j + 1; cur_y = i; } else { cur_x = 0; cur_y = i+1; } if (col_num <= 0) fk_attrset(e_gt_col(j, i)); else fk_colset(e_gt_col(j, i)); c = e_gt_char(j, i); #ifdef NCURSES if (c < NSPCHR) addch(sp_chr[c]); else addch(c); #else if (c < NSPCHR) e_putp(sp_chr[c]); else fputc(c, stdout); #endif *(altschirm + 2*MAXSCOL * i + 2 * j) = *(schirm + 2*MAXSCOL * i + 2 * j); *(altschirm + 2*MAXSCOL * i + 2 * j + 1) = *(schirm + 2*MAXSCOL * i + 2 * j + 1); } } fk_cursor(1); fk_locate(x, y); term_refresh(); return(0); } int e_t_sys_ini() { e_refresh(); tcgetattr(0, &ttermio); svflgs = fcntl( 0, F_GETFL, 0 ); e_endwin(); return(0); } int e_t_sys_end() { tcsetattr(0, TCSADRAIN, &ttermio); fcntl( 0, F_SETFL, svflgs ); e_abs_refr(); fk_locate(0, 0); return(0); } int e_t_kbhit() { int ret; char kbdflgs, c; e_refresh(); kbdflgs = fcntl(0, F_GETFL, 0 ); fcntl(0, F_SETFL, kbdflgs | O_NONBLOCK); ret = read(0, &c, 1); fcntl(0, F_SETFL, kbdflgs & ~O_NONBLOCK); return (ret == 1 ? c : 0); } #ifdef NCURSES int e_t_getch() { int c, bk; e_refresh(); c = fk_getch(); if (c > KEY_CODE_YES) { switch (c) { case KEY_F(1): c = F1; break; case KEY_F(2): c = F2; break; case KEY_F(3): c = F3; break; case KEY_F(4): c = F4; break; case KEY_F(5): c = F5; break; case KEY_F(6): c = F6; break; case KEY_F(7): c = F7; break; case KEY_F(8): c = F8; break; case KEY_F(9): c = F9; break; case KEY_F(10): c = F10; break; case KEY_UP: c = CUP; break; case KEY_DOWN: c = CDO; break; case KEY_LEFT: c = CLE; break; case KEY_RIGHT: c = CRI; break; case KEY_SFIND: c = EINFG; break; case KEY_IC: c = POS1; break; case KEY_DC: c = BUP; break; case KEY_PPAGE: c = ENDE; break; case KEY_NPAGE: c = BDO; break; case KEY_BACKSPACE: c = WPE_DC; break; case KEY_HELP: c = HELP; break; case KEY_LL: c = ENDE; break; case KEY_F(17): c = SF1; break; case KEY_F(18): c = SF2; break; case KEY_F(19): c = SF3; break; case KEY_F(20): c = SF4; break; case KEY_F(21): c = SF5; break; case KEY_F(22): c = SF6; break; case KEY_F(23): c = SF7; break; case KEY_F(24): c = SF8; break; case KEY_F(25): c = SF9; break; case KEY_F(26): c = SF10; break; case KEY_PREVIOUS: c = CUP+512; break; case KEY_NEXT: c = CDO+512; break; case KEY_HOME: c = POS1+512; break; case KEY_END: c = ENDE+512; break; default: c = 0; break; } bk = bioskey(); if (bk & 3) c += 512; else if (bk & 4) c += 514; } else if ( c == WPE_TAB ) { bk = bioskey(); if ( bk & 3) c = WPE_BTAB; else c = WPE_TAB; } else if (c == WPE_ESC) { c = fk_getch(); if (c > KEY_CODE_YES) { switch (c) { case KEY_F(1): c = AF1; break; case KEY_F(2): c = AF2; break; case KEY_F(3): c = AF3; break; case KEY_F(4): c = AF4; break; case KEY_F(5): c = AF5; break; case KEY_F(6): c = AF6; break; case KEY_F(7): c = AF7; break; case KEY_F(8): c = AF8; break; case KEY_F(9): c = AF9; break; case KEY_F(10): c = AF10; break; case KEY_UP: c = BUP; break; case KEY_DOWN: c = BDO; break; case KEY_LEFT: c = CCLE; break; case KEY_RIGHT: c = CCRI; break; case KEY_SFIND: c = EINFG; break; case KEY_IC: c = CPS1; break; case KEY_DC: c = CBUP; break; case KEY_PPAGE: c = CEND; break; case KEY_NPAGE: c = CBDO; break; case KEY_BACKSPACE: c = AltBS; break; case KEY_HELP: c = AF1; break; case KEY_LL: c = CEND; break; case KEY_PREVIOUS: c = BUP+512; break; case KEY_NEXT: c = BDO+512; break; case KEY_HOME: c = CPS1+512; break; case KEY_END: c = CEND+512; break; default: c = 0; break; } bk = bioskey(); if (bk & 3) c += 512; else if (bk & 4) c += 514; } else if (c != WPE_ESC) c = e_tast_sim(c); } return(c); } #else int e_t_getch() { int c, c2, pshift, bk; pshift = 0; e_refresh(); if ((c = fk_getch()) != WPE_ESC) { if (key_f[20] && c == *key_f[20]) return(WPE_DC); else if (key_f[17] && c == *key_f[17]) return(ENTF); else if ( c == WPE_TAB ) { bk = bioskey(); if (bk & 3) return (WPE_BTAB); else return (WPE_TAB); } else return(c); } else if ((c = fk_getch()) == WPE_CR) return(WPE_ESC); bk = bioskey(); if (bk & 3) pshift = 512; else if (bk & 4) pshift = 514; if (c == WPE_ESC) { if ((c = fk_getch()) == WPE_ESC) return(WPE_ESC); if ((c2 = e_find_key(c, 1, 1))) return(c2 + pshift); } if ((c2 = e_find_key((char)c, 1, 0))) return(c2 + pshift); return(e_tast_sim(c + pshift)); } char e_key_save[10]; int e_find_key(int c, int j, int sw) { int i, k; e_key_save[j] = c; e_key_save[j+1] = '\0'; for(i = 0; i < KEYFN; i++) { if(key_f[i] == NULL) continue; for(k = 1; k <= j && e_key_save[k] == *(key_f[i] + k); k++); if(k > j) { if(*(key_f[i] + k) != '\0') return(e_find_key(fk_getch(), j+1, sw)); else if(sw) { switch(i) { case 0: return(AF1); case 1: return(AF2); case 2: return(AF3); case 3: return(AF4); case 4: return(AF5); case 5: return(AF6); case 6: return(AF7); case 7: return(AF8); case 8: return(AF9); case 9: return(AF10); case 10: return(BUP); case 11: return(BDO); case 12: return(CCLE); case 13: return(CCRI); case 14: return(EINFG); case 15: return(CPS1); case 16: return(CBUP); case 17: return(ENTF); case 18: return(CEND); case 19: return(CBDO); case 20: return(AltBS); case 21: return(AF1); case 22: return(CEND); case 33: return(BUP+512); case 34: return(BDO+512); case 35: return(CCLE+512); case 36: return(CCRI+512); case 37: return(CPS1+512); case 38: return(CBUP+512); case 39: return(CEND+512); case 40: return(CBDO+512); case 41: return(CEND); default: return(0); } } else { switch(i) { case 0: return(F1); case 1: return(F2); case 2: return(F3); case 3: return(F4); case 4: return(F5); case 5: return(F6); case 6: return(F7); case 7: return(F8); case 8: return(F9); case 9: return(F10); case 10: return(CUP); case 11: return(CDO); case 12: return(CLE); case 13: return(CRI); case 14: return(EINFG); case 15: return(POS1); case 16: return(BUP); case 17: return(ENTF); case 18: return(ENDE); case 19: return(BDO); case 20: return(WPE_DC); case 21: return(HELP); case 22: return(ENDE); case 23: return(SF1); case 24: return(SF2); case 25: return(SF3); case 26: return(SF4); case 27: return(SF5); case 28: return(SF6); case 29: return(SF7); case 30: return(SF8); case 31: return(SF9); case 32: return(SF10); case 33: return(CUP+512); case 34: return(CDO+512); case 35: return(CLE+512); case 36: return(CRI+512); case 37: return(POS1+512); case 38: return(BUP+512); case 39: return(ENDE+512); case 40: return(BDO+512); case 41: return(ENDE); default: return(0); } } } } return(0); } #endif int fk_t_locate(int x, int y) { if (col_num > 0) { fk_colset(e_gt_col(cur_x, cur_y)); #ifdef NCURSES /* Causes problems. Reason unknown. - Dennis */ /*mvaddch(cur_y,cur_x,e_gt_char(cur_x, cur_y));*/ #else fputc(e_gt_char(cur_x, cur_y), stdout); #endif } cur_x = x; cur_y = y; term_move(x, y); return(y); } int fk_t_mouse(int *g) { return(0); } int e_t_switch_screen(int sw) { static int sav_sw = -1; if (sw == sav_sw) return(0); sav_sw = sw; if (sw && beg_scr) { term_refresh(); if (sav_cur) e_putp(sav_cur); e_putp(beg_scr); } else if (!sw && swt_scr) { e_putp(swt_scr); if (res_cur) e_putp(res_cur); term_refresh(); } else return(-1); return(0); } int e_t_deb_out(FENSTER *f) { #ifndef NCURSES if (!swt_scr || !beg_scr) #endif return(e_error("Your terminal don\'t use begin/end cup", 0, f->fb)); e_d_switch_out(1); getchar(); e_d_switch_out(0); return(0); } int e_d_switch_screen(int sw) { #ifdef DEBUGGER if (!sw) e_g_sys_ini(); else e_g_sys_end(); #endif return(e_switch_screen(sw)); } int e_t_d_switch_out(int sw) { int i, j; static int save_sw = 32000; if (save_sw == sw) return(0); save_sw = sw; if (sw && e_d_switch_screen(0)) { term_move(0, 0); e_putp(att_no); for(i = 0; i < MAXSLNS; i++) for (j = 0; j < MAXSCOL; j++) e_d_putchar(' '); term_move(0, 0); term_refresh(); } else if (!sw) { e_d_switch_screen(1); e_abs_refr(); e_refresh(); } return(sw); } void e_exitm(char *s, int n) { e_endwin(); if (n != 0) printf("\n%s\n", s); exit(n); } int e_s_sys_ini() { e_sys_ini(); return(e_switch_screen(0)); } int e_s_sys_end() { e_switch_screen(1); return(e_sys_end()); } #endif /* Is UNIX */ xwpe-1.5.30a/we_xterm.c0000644000076400007640000007102410263105405013754 0ustar dulsidulsi/* we_xterm.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #ifndef NO_XWINDOWS #include "edit.h" /* partial conversion in place */ #include "WeXterm.h" #ifndef XWPE_DLL #define WpeDllInit WpeXtermInit #endif int e_X_sw_color(void); int fk_show_cursor(void); int e_ini_size(void); int e_x_getch(void); int fk_x_mouse(int *g); int e_x_refresh(void); int fk_x_locate(int x, int y); int fk_x_cursor(int x); int e_x_sys_ini(void); int e_x_sys_end(void); int fk_x_putchar(int c); int x_bioskey(void); int e_x_system(const char *exe); int e_x_cp_X_to_buffer(FENSTER *f); int e_x_copy_X_buffer(FENSTER *f); int e_x_paste_X_buffer(FENSTER *f); int e_x_change(PIC *pic); int e_x_repaint_desk(FENSTER *f); void e_setlastpic(PIC *pic); int e_make_xr_rahmen(int xa, int ya, int xe, int ye, int sw); int e_x_kbhit(void); #include #include #include #include #include #include #include #include #include #ifndef NEWSTYLE #define NOXCACHE #endif #define BUFSIZE 80 extern char *e_tmp_dir; /* global constants */ /* for TextSchirm (text screen) */ extern char *altschirm; #ifdef NEWSTYLE extern char *extbyte, *altextbyte; #endif int old_cursor_x = 0, old_cursor_y = 0, cur_on = 1; extern PIC *e_X_l_pic; extern struct mouse e_mouse; int WpeDllInit(int *argc, char **argv) { e_s_u_clr = e_s_x_clr; e_n_u_clr = e_n_x_clr; e_frb_u_menue = e_frb_x_menue; e_pr_u_col_kasten = e_pr_x_col_kasten; fk_u_cursor = fk_x_cursor; fk_u_locate = fk_x_locate; e_u_refresh = e_x_refresh; e_u_getch = e_x_getch; u_bioskey = x_bioskey; e_u_sys_ini = e_x_sys_ini; e_u_sys_end = e_x_sys_end; e_u_system = e_x_system; fk_u_putchar = fk_x_putchar; fk_mouse = fk_x_mouse; e_u_cp_X_to_buffer = e_x_cp_X_to_buffer; e_u_copy_X_buffer = e_x_copy_X_buffer; e_u_paste_X_buffer = e_x_paste_X_buffer; e_u_kbhit = e_x_kbhit; e_u_change = e_x_change; e_u_ini_size = e_ini_size; e_u_setlastpic = e_setlastpic; WpeMouseChangeShape = (void (*)(WpeMouseShape))WpeNullFunction; WpeMouseRestoreShape = (void (*)(WpeMouseShape))WpeNullFunction; /* WpeMouseChangeShape = WpeXMouseChangeShape; WpeMouseRestoreShape = WpeXMouseRestoreShape;*/ WpeDisplayEnd = WpeNullFunction; e_u_switch_screen = WpeZeroFunction; e_u_d_switch_out = (int (*)(int sw))WpeZeroFunction; MCI = 2; MCA = 1; #ifdef NEWSTYLE RD1 = ' '; RD2 = ' '; RD3 = ' '; RD4 = ' '; RD5 = ' '; RD6 = ' '; RE1 = ' '; RE2 = ' '; RE3 = ' '; RE4 = ' '; RE5 = ' '; RE6 = ' '; #else RD1 = 13; RD2 = 12; RD3 = 14; RD4 = 11; RD5 = 18; RD6 = 25; RE1 = '.'; RE2 = '.'; RE3 = '.'; RE4 = '.'; RE5 = '.'; RE6 = ':'; #endif WBT = 1; ctree[0] = "\016\022\030"; ctree[1] = "\016\022\022"; ctree[2] = "\016\030\022"; ctree[3] = "\025\022\022"; ctree[4] = "\016\022\022"; WpeXInit(argc, argv); return 0; } #ifdef NEWSTYLE #ifdef NOXCACHE #define e_print_xrect(x, y, n) \ if(extbyte[n]) \ { \ XSetForeground(WpeXInfo.display, WpeXInfo.gc, \ !(extbyte[n] & 16) ? WpeXInfo.colors[0] : WpeXInfo.colors[15]);\ if(extbyte[n] & 2) \ XDrawLine(WpeXInfo.display, WpeXInfo.window, WpeXInfo.gc, WpeXInfo.font_width*((x)+1)-1, \ WpeXinfo.font_height*(y), WpeXInfo.font_width*((x)+1)-1, \ WpeXInfo.font_height*((y)+1)-1); \ if(extbyte[n] & 4) \ XDrawLine(WpeXInfo.display, WpeXInfo.window, WpeXInfo.gc, WpeXInfo.font_width*(x), \ WpeXInfo.font_height*((y)+1)-1, \ WpeXInfo.font_width*((x)+1)-1, WpeXInfo.font_height*((y)+1)-1); \ \ XSetForeground(WpeXInfo.display, WpeXInfo.gc, \ !(extbyte[n] & 16) ? WpeXInfo.colors[15] : WpeXInfo.colors[0]); \ if(extbyte[n] & 8) \ XDrawLine(WpeXInfo.display, WpeXInfo.window, WpeXInfo.gc, WpeXInfo.font_width*(x), \ WpeXInfo.font_height*(y), WpeXInfo.font_width*(x), \ WpeXInfo.font_height*((y)+1)-1); \ if(extbyte[n] & 1) \ XDrawLine(WpeXInfo.display, WpeXInfo.window, WpeXInfo.gc, WpeXInfo.font_width*(x), \ WpeXInfo.font_height*(y), WpeXInfo.font_width*((x)+1)-1, \ WpeXInfo.font_height*(y)); \ } #else /* cached a.r. */ #define WPE_MAXSEG 1000 int nseg[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; XSegment seg[8][WPE_MAXSEG]; int scol[8] = { 0, 0, 15, 15, 15, 15, 0, 0 }; int e_XLookupString(XKeyEvent *event, char *buffer_return, int buffer_size, KeySym *keysym_return, XComposeStatus *status) { static int first = 1; static XIC xic; static XIM xim; if (first) { if (!XSetLocaleModifiers("")) XSetLocaleModifiers("@im=none"); xim = XOpenIM(event->display, NULL, NULL, NULL); xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, WpeXInfo.window, NULL); first = 0; } if (xic) { if (XFilterEvent((XEvent*)event, WpeXInfo.window)) return (0); return (XmbLookupString(xic, event, buffer_return, buffer_size, keysym_return, NULL)); } return (XLookupString(event, buffer_return, buffer_size, keysym_return, status)); } void e_flush_xrect() { int i; for (i = 0; i < 8; i++) if (nseg[i]) { XSetForeground(WpeXInfo.display, WpeXInfo.gc, WpeXInfo.colors[scol[i]]); XDrawSegments(WpeXInfo.display, WpeXInfo.window, WpeXInfo.gc, seg[i], nseg[i]); nseg[i] = 0; } } void e_print_xrect(int x, int y, int n) { int c = extbyte[n] & 16 ? 4 : 0; if (extbyte[n]) { if ((nseg[0] > WPE_MAXSEG) || (nseg[1] > WPE_MAXSEG) || (nseg[2] > WPE_MAXSEG) || (nseg[3] > WPE_MAXSEG) || (nseg[4] > WPE_MAXSEG) || (nseg[5] > WPE_MAXSEG) || (nseg[6] > WPE_MAXSEG) || (nseg[7] > WPE_MAXSEG)) e_flush_xrect(); if (extbyte[n] & 2) { seg[c][nseg[c]].x1 = WpeXInfo.font_width*((x)+1)-1; seg[c][nseg[c]].y1 = WpeXInfo.font_height*(y); seg[c][nseg[c]].x2 = WpeXInfo.font_width*((x)+1)-1; seg[c][nseg[c]].y2 = WpeXInfo.font_height*((y)+1)-1; nseg[c]++; } if (extbyte[n] & 4) { seg[c+1][nseg[c+1]].x1 = WpeXInfo.font_width*(x); seg[c+1][nseg[c+1]].y1 = WpeXInfo.font_height*((y)+1)-1; seg[c+1][nseg[c+1]].x2 = WpeXInfo.font_width*((x)+1)-1; seg[c+1][nseg[c+1]].y2 = WpeXInfo.font_height*((y)+1)-1; nseg[c+1]++; } if (extbyte[n] & 8) { seg[c+2][nseg[c+2]].x1 = WpeXInfo.font_width*(x); seg[c+2][nseg[c+2]].y1 = WpeXInfo.font_height*(y); seg[c+2][nseg[c+2]].x2 = WpeXInfo.font_width*(x); seg[c+2][nseg[c+2]].y2 = WpeXInfo.font_height*((y)+1)-1; nseg[c+2]++; } if (extbyte[n] & 1) { seg[c+3][nseg[c+3]].x1 = WpeXInfo.font_width*(x); seg[c+3][nseg[c+3]].y1 = WpeXInfo.font_height*(y); seg[c+3][nseg[c+3]].x2 = WpeXInfo.font_width*((x)+1)-1; seg[c+3][nseg[c+3]].y2 = WpeXInfo.font_height*(y); nseg[c+3]++; } } } #endif #endif int fk_show_cursor() { int x; if (!cur_on) return(0); x = 2 * old_cursor_x + 2 * MAXSCOL * old_cursor_y; if (x > 0) { XSetForeground(WpeXInfo.display, WpeXInfo.gc, WpeXInfo.colors[schirm[x + 1] % 16]); XSetBackground(WpeXInfo.display, WpeXInfo.gc, WpeXInfo.colors[schirm[x + 1] / 16]); XDrawImageString(WpeXInfo.display, WpeXInfo.window, WpeXInfo.gc, WpeXInfo.font_width*old_cursor_x, WpeXInfo.font_height*(old_cursor_y+1) - WpeXInfo.font->max_bounds.descent, schirm + x, 1); #ifdef NEWSTYLE e_print_xrect(old_cursor_x, old_cursor_y, x/2); #ifndef NOXCACHE e_flush_xrect(); #endif #endif } x = 2 * cur_x + 2 * MAXSCOL * cur_y; XSetForeground(WpeXInfo.display, WpeXInfo.gc, WpeXInfo.colors[schirm[x + 1] / 16]); XSetBackground(WpeXInfo.display, WpeXInfo.gc, WpeXInfo.colors[schirm[x + 1] % 16]); XDrawImageString(WpeXInfo.display, WpeXInfo.window, WpeXInfo.gc, WpeXInfo.font_width * cur_x, WpeXInfo.font_height * (cur_y + 1) - WpeXInfo.font->max_bounds.descent, schirm + x, 1); old_cursor_x = cur_x; old_cursor_y = cur_y; return(cur_on); } int e_ini_size() { old_cursor_x = cur_x; old_cursor_y = cur_y; if (schirm) FREE(schirm); if(altschirm) FREE(altschirm); schirm = MALLOC(2 * MAXSCOL * MAXSLNS); altschirm = MALLOC(2 * MAXSCOL * MAXSLNS); #ifdef NEWSTYLE if (extbyte) FREE(extbyte); if (altextbyte) FREE(altextbyte); extbyte = MALLOC(MAXSCOL * MAXSLNS); altextbyte = MALLOC(MAXSCOL * MAXSLNS); if (!schirm || !altschirm || !extbyte || !altextbyte) return(-1); #else if(!schirm || !altschirm) return(-1); #endif return(0); } #define A_Normal 16 #define A_Reverse 1 #define A_Standout 1 #define A_Underline 1 #define A_Bold 16 int e_X_sw_color() { FARBE *fb = WpeEditor->fb; fb->er = e_n_clr(A_Normal); fb->et = e_n_clr(A_Normal); fb->ez = e_n_clr(A_Reverse); fb->es = e_n_clr(A_Normal); fb->em = e_n_clr(A_Standout); fb->ek = e_n_clr(A_Underline); fb->nr = e_n_clr(A_Standout); fb->nt = e_n_clr(A_Reverse); fb->nz = e_n_clr(A_Normal); fb->ns = e_n_clr(A_Bold); fb->mr = e_n_clr(A_Standout); fb->mt = e_n_clr(A_Standout); fb->mz = e_n_clr(A_Normal); fb->ms = e_n_clr(A_Normal); fb->fr = e_n_clr(A_Normal); fb->ft = e_n_clr(A_Normal); fb->fz = e_n_clr(A_Standout); fb->fs = e_n_clr(A_Standout); fb->of = e_n_clr(A_Standout); fb->df = e_n_clr(A_Normal); fb->dc = 0x02; #ifdef DEBUGGER fb->db = e_n_clr(A_Standout); fb->dy = e_n_clr(A_Standout); #endif return(0); } int e_x_refresh() { #ifndef NOXCACHE /* a.r. */ #define STRBUFSIZE 1024 unsigned long oldback = 0, oldfore = 0; static char stringbuf[STRBUFSIZE]; int stringcount = 0, oldI = 0, oldX = 0, oldY = 0, oldJ = 0; #endif int i, j, x, y, cur_tmp = cur_on; fk_cursor(0); for(i = 0; i < MAXSLNS; i++) for(j = 0; j < MAXSCOL; j++) { y = j + MAXSCOL*i; x = 2*y; #ifdef NEWSTYLE if(schirm[x] != altschirm[x] || schirm[x+1] != altschirm[x+1] || extbyte[y] != altextbyte[y]) #else if(schirm[x] != altschirm[x] || schirm[x+1] != altschirm[x+1]) #endif { #ifdef NOXCACHE XSetForeground(WpeXInfo.display, WpeXInfo.gc, WpeXInfo.colors[schirm[x+1] % 16]); XSetBackground(WpeXInfo.display, WpeXInfo.gc, WpeXInfo.colors[schirm[x+1] / 16]); XDrawImageString(WpeXInfo.display, WpeXInfo.window, WpeXInfo.gc, WpeXInfo.font_width*j, WpeXInfo.font_height*(i+1) - WpeXInfo.font->max_bounds.descent, schirm + x, 1); #else if ( oldback != WpeXInfo.colors[schirm[x+1] / 16] /* a.r. */ || oldfore != WpeXInfo.colors[schirm[x+1] % 16] || i != oldI || j > oldJ+1 /* is there a more elegant solution? */ || stringcount >= STRBUFSIZE ) { XDrawImageString(WpeXInfo.display, WpeXInfo.window, WpeXInfo.gc, oldX, oldY, stringbuf, stringcount); oldback = WpeXInfo.colors[schirm[x+1] / 16]; oldfore = WpeXInfo.colors[schirm[x+1] % 16]; XSetForeground(WpeXInfo.display, WpeXInfo.gc, oldfore ); XSetBackground(WpeXInfo.display, WpeXInfo.gc, oldback ); oldX = WpeXInfo.font_width*j; oldY = WpeXInfo.font_height*(i+1) - WpeXInfo.font->max_bounds.descent; oldI = i; stringcount = 0; stringbuf[stringcount++] = schirm[x]; } else stringbuf[stringcount++] = schirm[x]; #endif #ifndef NEWSTYLE if(schirm[x] == 16) { XFillRectangle(WpeXInfo.display, WpeXInfo.window, WpeXInfo.gc, WpeXInfo.font_width*j, WpeXInfo.font_height*(i), WpeXInfo.font_width, (WpeXInfo.font_height + WpeXInfo.font->max_bounds.descent)/2); } else if(schirm[x] == 20) { XFillRectangle(WpeXInfo.display, WpeXInfo.window, WpeXInfo.gc, WpeXInfo.font_width*j, (int)(WpeXInfo.font_height*(i+1./2)), WpeXInfo.font_width, (WpeXInfo.font_height + WpeXInfo.font->max_bounds.descent)/2); } #endif altschirm[x] = schirm[x]; altschirm[x+1] = schirm[x+1]; #ifdef NEWSTYLE e_print_xrect(j, i, y); altextbyte[y] = extbyte[y]; #endif #ifndef NOXCACHE oldJ = j; #endif } } #ifndef NOXCACHE XDrawImageString(WpeXInfo.display, WpeXInfo.window, WpeXInfo.gc, oldX, oldY, stringbuf, stringcount); #ifdef NEWSTYLE e_flush_xrect(); #endif #endif fk_cursor(cur_tmp); fk_show_cursor(); XFlush(WpeXInfo.display); return(0); } int e_x_change(PIC *pic) { XEvent report; XExposeEvent *expose_report; KeySym keysym; unsigned char buffer[BUFSIZE]; int charcount; unsigned int key_b; XSizeHints size_hints; expose_report = (XExposeEvent *)&report; while (XCheckMaskEvent(WpeXInfo.display, KeyPressMask | ButtonPressMask | ExposureMask | StructureNotifyMask, &report) == True) { switch(report.type) { case Expose: /* Reason for +2 : Assumes extra character on either side. */ e_refresh_area(expose_report->x/WpeXInfo.font_width, expose_report->y/WpeXInfo.font_height, expose_report->width/WpeXInfo.font_width+2, expose_report->height/WpeXInfo.font_height+2); /* e_abs_refr();*/ e_refresh(); break; case ConfigureNotify: size_hints.width = (report.xconfigure.width / WpeXInfo.font_width) * WpeXInfo.font_width; size_hints.height = (report.xconfigure.height / WpeXInfo.font_height) * WpeXInfo.font_height; if (size_hints.width != MAXSCOL * WpeXInfo.font_width || size_hints.height != MAXSLNS * WpeXInfo.font_height) { MAXSCOL = size_hints.width / WpeXInfo.font_width; MAXSLNS = size_hints.height / WpeXInfo.font_height; e_x_repaint_desk(WpeEditor->f[WpeEditor->mxedt]); } break; case KeyPress: charcount = e_XLookupString(&report.xkey, buffer, BUFSIZE, &keysym, NULL); if (charcount == 1 && *buffer == CtrlC) return(CtrlC); break; case ButtonPress: if (!pic) break; key_b = report.xbutton.state; if (report.xbutton.button == 1) { e_mouse.k = (key_b & ShiftMask) ? 3 : 0 + (key_b & ControlMask) ? 4 : 0 + (key_b & WpeXInfo.altmask) ? 8 : 0; e_mouse.x = report.xbutton.x/WpeXInfo.font_width; e_mouse.y = report.xbutton.y/WpeXInfo.font_height; if (e_mouse.x > (pic->e.x + pic->a.x - 10)/2 && e_mouse.x < (pic->e.x + pic->a.x + 6)/2 ) return(CtrlC); } break; } } return(0); } int e_x_getch() { Window tmp_win, tmp_root; XEvent report; XSelectionEvent se; KeySym keysym; int charcount; unsigned char buffer[BUFSIZE]; int c, root_x, root_y, x, y; unsigned int key_b; XSizeHints size_hints; e_refresh(); XQueryPointer(WpeXInfo.display, WpeXInfo.window, &tmp_root, &tmp_win, &root_x, &root_y, &x, &y, &key_b); if (key_b & (Button1Mask | Button2Mask | Button3Mask)) { e_mouse.x = x / WpeXInfo.font_width; e_mouse.y = y / WpeXInfo.font_height; c = 0; if (key_b & Button1Mask) c |= 1; if (key_b & Button2Mask) c |= 4; if (key_b & Button3Mask) c |= 2; return(-c); } while (1) { XNextEvent(WpeXInfo.display, &report); switch (report.type) { case Expose: do { /* Reason for +2 : Assumes extra character on either side. */ e_refresh_area(report.xexpose.x / WpeXInfo.font_width, report.xexpose.y / WpeXInfo.font_height, report.xexpose.width / WpeXInfo.font_width + 2, report.xexpose.height / WpeXInfo.font_height + 2); } while (XCheckMaskEvent(WpeXInfo.display, ExposureMask, &report) == True); e_refresh(); break; case ConfigureNotify: size_hints.width = (report.xconfigure.width / WpeXInfo.font_width) * WpeXInfo.font_width; size_hints.height = (report.xconfigure.height / WpeXInfo.font_height) * WpeXInfo.font_height; if (size_hints.width != MAXSCOL * WpeXInfo.font_width || size_hints.height != MAXSLNS * WpeXInfo.font_height) { MAXSCOL = size_hints.width / WpeXInfo.font_width; MAXSLNS = size_hints.height / WpeXInfo.font_height; e_x_repaint_desk(WpeEditor->f[WpeEditor->mxedt]); } break; case ClientMessage: if (report.xclient.message_type == WpeXInfo.protocol_atom && ((report.xclient.format == 8 && report.xclient.data.b[0] == WpeXInfo.delete_atom) || (report.xclient.format == 16 && report.xclient.data.s[0] == WpeXInfo.delete_atom) || (report.xclient.format == 32 && report.xclient.data.l[0] == WpeXInfo.delete_atom))) { e_quit(WpeEditor->f[WpeEditor->mxedt]); } break; case KeyPress: charcount = e_XLookupString(&report.xkey, buffer, BUFSIZE, &keysym, NULL); key_b = report.xkey.state; if (charcount == 1) { if (*buffer == 127) { if (key_b & ControlMask) return(CENTF); else if (key_b & ShiftMask) return(ShiftDel); else if (key_b & WpeXInfo.altmask) return(AltDel); else return(ENTF); } if ((key_b & ShiftMask) && (*buffer == '\t')) return(WPE_BTAB); if (key_b & WpeXInfo.altmask) c = e_tast_sim(key_b & ShiftMask ? toupper(*buffer) : *buffer); else return(*buffer); } else { c = 0; if (key_b & ControlMask) { if (keysym == XK_Left) c = CCLE; else if (keysym == XK_Right) c = CCRI; else if (keysym == XK_Home) c = CPS1; else if (keysym == XK_End) c = CEND; else if (keysym == XK_Insert) c = CEINFG; else if (keysym == XK_Delete) c = CENTF; else if (keysym == XK_Prior) c = CBUP; else if (keysym == XK_Next) c = CBDO; else if (keysym == XK_F1) c = CF1; else if (keysym == XK_F2) c = CF2; else if (keysym == XK_F3) c = CF3; else if (keysym == XK_F4) c = CF4; else if (keysym == XK_F5) c = CF5; else if (keysym == XK_F6) c = CF6; else if (keysym == XK_F7) c = CF7; else if (keysym == XK_F8) c = CF8; else if (keysym == XK_F9) c = CF9; else if (keysym == XK_F10) c = CF10; } else if (key_b & WpeXInfo.altmask) { if (keysym == XK_F1) c = AF1; else if (keysym == XK_F2) c = AF2; else if (keysym == XK_F3) c = AF3; else if (keysym == XK_F4) c = AF4; else if (keysym == XK_F5) c = AF5; else if (keysym == XK_F6) c = AF6; else if (keysym == XK_F7) c = AF7; else if (keysym == XK_F8) c = AF8; else if (keysym == XK_F9) c = AF9; else if (keysym == XK_F10) c = AF10; else if (keysym == XK_Insert) c = AltEin; else if (keysym == XK_Delete) c = AltDel; } else { if (keysym == XK_Left) c = CLE; else if (keysym == XK_Right) c = CRI; else if (keysym == XK_Up) c = CUP; else if (keysym == XK_Down) c = CDO; else if (keysym == XK_Home) c = POS1; else if (keysym == XK_End) c = ENDE; else if (keysym == XK_Insert) c = EINFG; else if (keysym == XK_Delete) c = ENTF; else if (keysym == XK_BackSpace) c = CtrlH; else if (keysym == XK_Prior) c = BUP; else if (keysym == XK_Next) c = BDO; else if (keysym == XK_F1) c = F1; else if (keysym == XK_F2) c = F2; else if (keysym == XK_F3) c = F3; else if (keysym == XK_F4) c = F4; else if (keysym == XK_F5) c = F5; else if (keysym == XK_F6) c = F6; else if (keysym == XK_F7) c = F7; else if (keysym == XK_F8) c = F8; else if (keysym == XK_F9) c = F9; else if (keysym == XK_F10) c = F10; else if (keysym == XK_L1) c = STOP; else if (keysym == XK_L2) c = AGAIN; else if (keysym == XK_L3) c = PROPS; else if (keysym == XK_L4) c = UNDO; else if (keysym == XK_L5) c = FRONT; else if (keysym == XK_L6) c = COPY; else if (keysym == XK_L7) c = OPEN; else if (keysym == XK_L8) c = PASTE; else if (keysym == XK_L9) c = FID; else if (keysym == XK_L10) c = CUT; else if (keysym == XK_Help) c = HELP; } } if (c != 0) { if (key_b & ShiftMask) c = c + 512; return(c); } break; case ButtonPress: key_b = report.xbutton.state; e_mouse.k = (key_b & ShiftMask) ? 3 : 0 + (key_b & ControlMask) ? 4 : 0 + (key_b & WpeXInfo.altmask) ? 8 : 0; e_mouse.x = report.xbutton.x/WpeXInfo.font_width; e_mouse.y = report.xbutton.y/WpeXInfo.font_height; c = 0; if (report.xbutton.button == 1) c |= 1; if (report.xbutton.button == 2) c |= 2; if (report.xbutton.button == 3) c |= 4; return(-c); case SelectionRequest: if (WpeXInfo.selection) { se.type = SelectionNotify; se.display = report.xselectionrequest.display; se.requestor = report.xselectionrequest.requestor; se.selection = report.xselectionrequest.selection; se.time = report.xselectionrequest.time; se.target = report.xselectionrequest.target; if (report.xselectionrequest.property == None) report.xselectionrequest.property = report.xselectionrequest.target; /* Xt asks for TARGETS. Should probably support that. */ if (report.xselectionrequest.target == WpeXInfo.text_atom) { se.property = report.xselectionrequest.property; XChangeProperty(se.display, se.requestor, se.property, se.target, 8, PropModeReplace, WpeXInfo.selection, strlen(WpeXInfo.selection)); } else se.property = None; XSendEvent(WpeXInfo.display, se.requestor, False, 0, (XEvent *)&se); } break; case SelectionClear: if (WpeXInfo.selection) { WpeFree(WpeXInfo.selection); WpeXInfo.selection = NULL; } break; default: break; } } return(0); } int e_x_kbhit() { XEvent report; KeySym keysym; int charcount; unsigned char buffer[BUFSIZE]; int c; unsigned int key_b; e_refresh(); if (XCheckMaskEvent(WpeXInfo.display, ButtonPressMask | KeyPressMask, &report) == False) return(0); if (report.type == ButtonPress) { key_b = report.xbutton.state; e_mouse.k = (key_b & ShiftMask) ? 3 : 0; e_mouse.x = report.xbutton.x/WpeXInfo.font_width; e_mouse.y = report.xbutton.y/WpeXInfo.font_height; c = 0; if(report.xbutton.button == 1) c |= 1; if(report.xbutton.button == 2) c |= 2; if(report.xbutton.button == 3) c |= 4; return(-c); } else { charcount = e_XLookupString(&report.xkey, buffer, BUFSIZE, &keysym, NULL); if(charcount == 1) return(*buffer); else return(0); } } void e_setlastpic(PIC *pic) { extern PIC *e_X_l_pic; e_X_l_pic = pic; } int fk_x_locate(int x, int y) { cur_x = x; return(cur_y = y); } int fk_x_cursor(int x) { return(cur_on = x); } int e_x_sys_ini() { return(0); } int e_x_sys_end() { return(0); } int fk_x_putchar(int c) { return(fputc(c, stdout)); } int x_bioskey() { return(e_mouse.k); } int e_x_system(const char *exe) { FILE *fp; int ret; char file[80]; char *string; sprintf(file, "%s/we_sys_tmp", e_tmp_dir); string = MALLOC(strlen(XTERM_CMD) + strlen(exe) + strlen(file) + strlen(user_shell) + 40); if (!(fp = fopen(file, "w+"))) { FREE(string); return(-1); } fputs("$*\necho type \\ to continue\nread i\n", fp); fclose(fp); chmod(file, 0700); if (exe[0] == '/') sprintf(string, "%s -geometry 80x25-0-0 +sb -e %s %s %s", XTERM_CMD, user_shell, file, exe); else sprintf(string, "%s -geometry 80x25-0-0 +sb -e %s %s ./%s", XTERM_CMD, user_shell, file, exe); ret = system(string); remove(file); FREE(string); return(ret); } int e_x_repaint_desk(FENSTER *f) { ECNT *cn = f->ed; int i, g[4]; extern PIC *e_X_l_pic; PIC *sv_pic = NULL, *nw_pic = NULL; if (e_X_l_pic && e_X_l_pic != cn->f[cn->mxedt]->pic) { sv_pic = e_X_l_pic; nw_pic = e_open_view(e_X_l_pic->a.x, e_X_l_pic->a.y, e_X_l_pic->e.x, e_X_l_pic->e.y, 0, 2); } e_ini_size(); if (cn->mxedt < 1) { e_cls(f->fb->df.fb, f->fb->dc); e_ini_desk(f->ed); if (nw_pic) { e_close_view(nw_pic, 1); e_X_l_pic = sv_pic; } return(0); } ini_repaint(cn); e_abs_refr(); for (i = cn->mxedt; i >= 1; i--) { FREE(cn->f[i]->pic->p); FREE(cn->f[i]->pic); } for (i = 0; i <= cn->mxedt; i++) { if (cn->f[i]->e.x >= MAXSCOL) cn->f[i]->e.x = MAXSCOL-1; if (cn->f[i]->e.y >= MAXSLNS-1) cn->f[i]->e.y = MAXSLNS-2; if (cn->f[i]->e.x - cn->f[i]->a.x < 26) cn->f[i]->a.x = cn->f[i]->e.x - 26; if (!DTMD_ISTEXT(cn->f[i]->dtmd) && cn->f[i]->e.y - cn->f[i]->a.y < 9) cn->f[i]->a.y = cn->f[i]->e.y - 9; else if (DTMD_ISTEXT(cn->f[i]->dtmd) && cn->f[i]->e.y - cn->f[i]->a.y < 3) cn->f[i]->a.y = cn->f[i]->e.y - 3; } for (i = 1; i < cn->mxedt; i++) { e_firstl(cn->f[i], 0); e_schirm(cn->f[i], 0); } e_firstl(cn->f[i], 1); e_schirm(cn->f[i], 1); if (nw_pic) { e_close_view(nw_pic, 1); e_X_l_pic = sv_pic; } g[0] = 2; fk_mouse(g); end_repaint(); e_cursor(cn->f[i], 1); g[0] = 0; fk_mouse(g); g[0] = 1; fk_mouse(g); return(0); } int fk_x_mouse(int *g) { Window tmp_win, tmp_root; int root_x, root_y, x, y; unsigned int key_b; if (!XQueryPointer(WpeXInfo.display, WpeXInfo.window, &tmp_root, &tmp_win, &root_x, &root_y, &x, &y, &key_b)) { g[2] = e_mouse.x * 8; g[3] = e_mouse.y * 8; g[0] = g[1] = 0; return(0); } g[0] = 0; if (key_b & Button1Mask) g[0] |= 1; if(key_b & Button2Mask) g[0] |= 4; if(key_b & Button3Mask) g[0] |= 2; g[1] = g[0]; g[2] = x/WpeXInfo.font_width * 8; g[3] = y/WpeXInfo.font_height * 8; return(g[1]); } int e_x_cp_X_to_buffer(FENSTER *f) { BUFFER *b0 = f->ed->f[0]->b; SCHIRM *s0 = f->ed->f[0]->s; int i, j, k, n; unsigned char *str; XEvent report; Atom type; int format; long nitems, bytes_left; for (i = 1; i < b0->mxlines; i++) FREE(b0->bf[i].s); b0->mxlines = 1; *(b0->bf[0].s) = WPE_WR; *(b0->bf[0].s+1) = '\0'; b0->bf[0].len = 0; #if SELECTION if (WpeXInfo.selection) { str = WpeStrdup(WpeXInfo.selection); n = strlen(str); } else { /* Should check for errors especially failure to send SelectionNotify */ XConvertSelection(WpeXInfo.display, WpeXInfo.selection_atom, WpeXInfo.text_atom, WpeXInfo.property_atom, WpeXInfo.window, CurrentTime); n = 0; while (!XCheckTypedEvent(WpeXInfo.display, SelectionNotify, &report)) { /* Should probably have a better timeout period than this. */ sleep(0); n++; if (n > 1000) return 0; } if (WpeXInfo.property_atom == None) return 0; XGetWindowProperty(WpeXInfo.display, WpeXInfo.window, WpeXInfo.property_atom, 0, 1000000, FALSE, WpeXInfo.text_atom, &type, &format, &nitems, &bytes_left, &str); if (type == None) { /* Specified property does not exit*/ return 0; } n = strlen(str); } #else str = XFetchBytes(WpeXInfo.display, &n); #endif for (i = k = 0; i < n; i++, k++) { for (j = 0; i < n && str[i] != '\n' && j < b0->mx.x-1; j++, i++) b0->bf[k].s[j] = str[i]; if (i < n) { e_new_line(k+1, b0); if (str[i] == '\n') { b0->bf[k].s[j] = WPE_WR; b0->bf[k].nrc = j+1; } else b0->bf[k].nrc = j; b0->bf[k].s[j+1] = '\0'; b0->bf[k].len = j; } else { b0->bf[k].s[j] = '\0'; b0->bf[k].nrc = b0->bf[k].len = j; } } s0->mark_begin.x = s0->mark_begin.y = 0; s0->mark_end.y = b0->mxlines-1; s0->mark_end.x = b0->bf[b0->mxlines-1].len; #if SELECTION if (WpeXInfo.selection) WpeFree(str); else #endif XFree(str); return 0; } int e_x_copy_X_buffer(FENSTER *f) { e_cp_X_to_buffer(f); e_edt_einf(f); return(0); } int e_x_paste_X_buffer(FENSTER *f) { BUFFER *b0 = f->ed->f[0]->b; SCHIRM *s0 = f->ed->f[0]->s; int i, j, n; e_edt_copy(f); #if SELECTION if (WpeXInfo.selection) { WpeFree(WpeXInfo.selection); WpeXInfo.selection = NULL; } #endif if ((s0->mark_end.y == 0 && s0->mark_end.x == 0) || s0->mark_end.y < s0->mark_begin.y) return(0); if (s0->mark_end.y == s0->mark_begin.y) { if (s0->mark_end.x < s0->mark_begin.x) return(0); n = s0->mark_end.x - s0->mark_begin.x; #if SELECTION WpeXInfo.selection = WpeMalloc(n + 1); strncpy(WpeXInfo.selection, b0->bf[s0->mark_begin.y].s+s0->mark_begin.x, n); WpeXInfo.selection[n] = 0; XSetSelectionOwner(WpeXInfo.display, WpeXInfo.selection_atom, WpeXInfo.window, CurrentTime); #else XStoreBytes(WpeXInfo.display, b0->bf[s0->mark_begin.y].s+s0->mark_begin.x, n); #endif return(0); } WpeXInfo.selection = WpeMalloc(b0->bf[s0->mark_begin.y].nrc * sizeof(char)); for (n = 0, j = s0->mark_begin.x; j < b0->bf[s0->mark_begin.y].nrc; j++, n++) WpeXInfo.selection[n] = b0->bf[s0->mark_begin.y].s[j]; for (i = s0->mark_begin.y+1; i < s0->mark_end.y; i++) { WpeXInfo.selection = WpeRealloc(WpeXInfo.selection, (n + b0->bf[i].nrc)*sizeof(char)); for (j = 0; j < b0->bf[i].nrc; j++, n++) WpeXInfo.selection[n] = b0->bf[i].s[j]; } WpeXInfo.selection = WpeRealloc(WpeXInfo.selection, (n + s0->mark_end.x + 1)*sizeof(char)); for (j = 0; j < s0->mark_end.x; j++, n++) WpeXInfo.selection[n] = b0->bf[i].s[j]; WpeXInfo.selection[n] = 0; #if SELECTION XSetSelectionOwner(WpeXInfo.display, WpeXInfo.selection_atom, WpeXInfo.window, CurrentTime); #else XStoreBytes(WpeXInfo.display, WpeXInfo.selection, n); WpeFree(WpeXInfo.selection); WpeXInfo.selection = NULL; #endif return(0); } #endif xwpe-1.5.30a/we_unix.c0000644000076400007640000004331010263105405013575 0ustar dulsidulsi/* we_unix.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "model.h" /* exchange for D.S. */ #ifdef XWPE_DLL #include #else int WpeXtermInit(int *argc, char **argv); int WpeTermInit(int *argc, char **argv); #endif #include #include #include #include #include #include #include #ifndef TERMCAP #ifndef DJGPP #include #endif #endif #include "edit.h" /* exchange for D.S. */ #include "attrb.h" #ifdef NOSYMLINKS #define lstat(x,y) stat(x,y) #undef S_ISLNK #define S_ISLNK(x) 0 #endif char *schirm = NULL; char e_we_sw = 0; void WpeSignalUnknown(int sig); void WpeSignalChild(int sig); void (*WpeMouseChangeShape)(WpeMouseShape new_shape); void (*WpeMouseRestoreShape)(void); void (*WpeDisplayEnd)(void); int (*fk_u_locate)(int x, int y); int (*fk_u_cursor)(int x); int (*e_u_initscr)(int argc, char *argv[]); int (*fk_u_putchar)(int c); int (*u_bioskey)(void); int (*e_frb_u_menue)(int sw, int xa, int ya, FENSTER *f, int md); COLOR (*e_s_u_clr)(int f, int b); COLOR (*e_n_u_clr)(int fb); void (*e_pr_u_col_kasten)(int xa, int ya, int x, int y, FENSTER *f, int sw); int (*fk_mouse)(int g[]); int (*e_u_refresh)(void); int (*e_u_getch)(void); int (*e_u_sys_ini)(void); int (*e_u_sys_end)(void); int (*e_u_system)(const char *exe); int (*e_make_urect)(int xa, int ya, int xe, int ye, int sw); int (*e_make_urect_abs)(int xa, int ya, int xe, int ye, int sw); int (*e_u_d_switch_out)(int sw); int (*e_u_switch_screen)(int sw); int (*e_u_deb_out)(struct FNST *f); int (*e_u_cp_X_to_buffer)(struct FNST *f); int (*e_u_copy_X_buffer)(struct FNST *f); int (*e_u_paste_X_buffer)(struct FNST *f); int (*e_u_kbhit)(void); int (*e_u_change)(PIC *pic); int (*e_u_ini_size)(void); int (*e_get_pic_urect)(int xa, int ya, int xe, int ye, struct PICSTR *pic); int (*e_u_s_sys_end)(void); int (*e_u_s_sys_ini)(void); void (*e_u_setlastpic)(PIC *pic); FARBE *u_fb, *x_fb; char MCI, MCA, RD1, RD2, RD3, RD4, RD5, RD6, WBT; char RE1, RE2, RE3, RE4, RE5, RE6; char *ctree[5]; int MENOPT = 8; int e_mn_men = 3; int MAXSLNS = 24; int MAXSCOL = 80; int col_num = 0; char *att_no; struct termios otermio, ntermio, ttermio; int cur_x = -1, cur_y = -1; void *libxwpe; #ifdef NEWSTYLE char *extbyte = NULL, *altextbyte = NULL; #endif char *altschirm = NULL; PIC *e_X_l_pic = NULL; void WpeNullFunction(void) { } int WpeZeroFunction(void) { return(0); } int e_ini_unix(int *argc, char **argv) { extern OPT opt[]; int i, debug; struct sigaction act; int (*initfunc)(int *argc, char **argv); setlocale(LC_ALL, ""); u_fb = NULL; x_fb = NULL; debug = 0; for (i = 1; i < *argc; i++) { if (strcmp("--debug", argv[i]) == 0) { debug = 1; } } for (i = strlen(argv[0])-1; i >= 0 && *(argv[0] + i) != DIRC; i--) ; #ifndef NO_XWINDOWS if (*(argv[0]+i+1) == 'x') e_we_sw = 1; else e_we_sw = 0; #endif #ifdef PROG if (!strncmp("wpe", (argv[0] + i + e_we_sw + 1), 3)) e_we_sw |= 2; #endif #ifdef XWPE_DLL if (WpeIsXwin()) { libxwpe = dlopen(LIBRARY_DIR"/libxwpe-x11.so", RTLD_NOW); } else { libxwpe = dlopen(LIBRARY_DIR"/libxwpe-term.so",RTLD_NOW); } if (!libxwpe) { printf("%s\n", dlerror()); exit(0); } initfunc = dlsym(libxwpe, "WpeDllInit"); if (initfunc) { (*initfunc)(argc, argv); } else { printf("%s\n", dlerror()); exit(0); } #else #ifndef NO_XWINDOWS if (WpeIsXwin()) { WpeXtermInit(argc, argv); } else #endif { WpeTermInit(argc, argv); } #endif if (WpeIsProg()) { #ifndef DEBUGGER opt[0].x = 2, opt[1].x = 7, opt[2].x = 14; opt[3].x = 21; opt[4].x = 30; opt[9].t = opt[7].t; opt[9].x = 74; opt[9].s = opt[7].s; opt[9].as = opt[7].as; opt[8].t = opt[6].t; opt[8].x = 65; opt[8].s = opt[6].s; opt[8].as = opt[6].as; opt[7].t = opt[5].t; opt[7].x = 55; opt[7].s = opt[5].s; opt[7].as = opt[5].as; opt[6].t = "Project"; opt[6].x = 45; opt[6].s = 'P'; opt[6].as = AltP; opt[5].t = "Run"; opt[5].x = 38; opt[5].s = 'R'; opt[5].as = AltR; MENOPT = 10; e_mn_men = 2; #else opt[0].x = 2, opt[1].x = 6, opt[2].x = 12; opt[3].x = 18; opt[4].x = 26; opt[10].t = opt[7].t; opt[10].x = 74; opt[10].s = opt[7].s; opt[10].as = opt[7].as; opt[9].t = opt[6].t; opt[9].x = 65; opt[9].s = opt[6].s; opt[9].as = opt[6].as; opt[8].t = opt[5].t; opt[8].x = 56; opt[8].s = opt[5].s; opt[8].as = opt[5].as; opt[7].t = "Project"; opt[7].x = 47; opt[7].s = 'P'; opt[7].as = AltP; opt[6].t = "Debug"; opt[6].x = 40; opt[6].s = 'D'; opt[6].as = AltD; opt[5].t = "Run"; opt[5].x = 34; opt[5].s = 'R'; opt[5].as = AltR; MENOPT = 11; e_mn_men = 1; #endif } /* Unknown error signal handling */ act.sa_handler = WpeSignalUnknown; sigfillset(&act.sa_mask); /* Mask all signals while running */ act.sa_flags = 0; if (!debug) { sigaction(SIGQUIT, &act, NULL); sigaction(SIGILL, &act, NULL); sigaction(SIGABRT, &act, NULL); sigaction(SIGFPE, &act, NULL); sigaction(SIGSEGV, &act, NULL); #ifdef SIGTRAP sigaction(SIGTRAP, &act, NULL); #endif #ifdef SIGIOT sigaction(SIGIOT, &act, NULL); #endif #ifdef SIGBUS sigaction(SIGBUS, &act, NULL); #endif } /* Ignore SIGINT */ act.sa_handler = SIG_IGN; sigaction(SIGINT, &act, NULL); /* Catch SIGCHLD */ act.sa_handler = WpeSignalChild; act.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &act, NULL); return(*argc); } int e_abs_refr() { extern char *altschirm; int i; for(i = 0; i < 2 * MAXSCOL * MAXSLNS; i++) altschirm[i] = 0; return(0); } void e_refresh_area(int x, int y, int width, int height) { extern char *altschirm; char *curloc; int i,j; if (width + x > MAXSCOL) { width = MAXSCOL - x; } if (height + y > MAXSLNS) { height = MAXSLNS - y; } curloc = altschirm + ((x + (y * MAXSCOL)) * 2); for (j = 0; j < height; j++, curloc += MAXSCOL * 2) { for (i = 0; i < width; i ++) { curloc[i * 2] = 0; curloc[i * 2 + 1] = 0; } } } int e_tast_sim(int c) { if (c >= 'A' && c <= 'Z') return(c + 1024 - 'A'); switch(c) { case 'a': return(AltA); case 'b': return(AltB); case 'c': return(AltC); case 'd': return(AltD); case 'e': return(AltE); case 'f': return(AltF); case 'g': return(AltG); case 'h': return(AltH); case 'i': return(AltI); case 'j': return(AltJ); case 'k': return(AltK); case 'l': return(AltL); case 'm': return(AltM); case 'n': return(AltN); case 'o': return(AltO); case 'p': return(AltP); case 'q': return(AltQ); case 'r': return(AltR); case 's': return(AltS); case 't': return(AltT); case 'u': return(AltU); case 'v': return(AltV); case 'w': return(AltW); case 'x': return(AltX); case 'y': return(AltY); case 'z': return(AltZ); case '1': return(Alt1); case '2': return(Alt2); case '3': return(Alt3); case '4': return(Alt4); case '5': return(Alt5); case '6': return(Alt6); case '7': return(Alt7); case '8': return(Alt8); case '9': return(Alt9); case '0': return(Alt0); case ' ': return(AltBl); case '#': return(AltSYS); case CtrlA: return(CBUP); case CtrlE: return(CBDO); case CtrlB: return(CCLE); case CtrlF: return(CCRI); case CtrlP: return(CPS1); case CtrlN: return(CEND); case CtrlH: return(AltBS); default: return(0); } } void WpeSignalUnknown(int sig) { /* psignal(sig, "Xwpe"); */ printf("Xwpe: unexpected signal %d, exiting ...\n", sig); e_exit(1); } void WpeSignalChild(int sig) { int statloc; wait(&statloc); } static int e_bool_exit = 0; void e_err_save() { ECNT *cn = WpeEditor; int i; long maxname; FENSTER *f; BUFFER *b; /* Quick fix to multiple emergency save problems */ if (e_bool_exit) return ; e_bool_exit = 1; for (i = 0; i <= cn->mxedt; i++) { if (DTMD_ISTEXT(cn->f[i]->dtmd)) { f = cn->f[i]; b = cn->f[i]->b; if (b->mxlines > 1 || b->bf[0].len > 0) { /* Check if file system could have an autosave or emergency save file >12 check is to eliminate dos file systems */ if ((maxname = pathconf(f->dirct, _PC_NAME_MAX) >= strlen(f->datnam) + 4) && (maxname > 12)) { strcat(f->datnam, ".ESV"); printf("Try to save %s!\n", f->datnam); if (!e_save(f)) printf("File %s saved!\n", f->datnam); } } } } } void e_exit(int n) { #ifdef DEBUGGER extern int e_d_pid; if (e_d_pid) kill(e_d_pid, 7); #endif (*WpeDisplayEnd)(); e_switch_screen(0); if (n != 0) { printf("\nError-Exit! Code: %d!\n", n); e_err_save(); } exit(n); } char *e_mkfilepath(char *dr, char *fn, char *fl) { strcpy(fl, dr); if (dr[strlen(dr)-1] != DIRC) { strcat(fl, DIRS); } strcat(fl, fn); return(fl); } int e_compstr(char *a, char *b) { int n, k; char *ctmp, *cp; if (a[0] == '*' && !a[1]) return(0); if (!a[0] || !b[0]) return(a[0] - b[0]); if (a[0] == '*' && a[1] == '*') return(e_compstr(++a, b)); for (n = a[0] == '*' ? 2 : 1; a[n] != '*' && a[n] != '?' && a[n] != '[' && a[n]; n++) ; if (a[0] == '*') { n--; a++; if (a[0] == '?') { cp = MALLOC((strlen(a)+1)*sizeof(char)); strcpy(cp, a); cp[0] = '*'; n = e_compstr(cp, ++b); FREE(cp); return(n); } else if (a[0] == '[') { while (*b && (n = e_compstr(a, b))) b++; return(n); } ctmp = MALLOC(n+1); for (k = 0; k < n; k++) ctmp[k] = a[k]; ctmp[n] = '\0'; cp = strstr(b, ctmp); FREE(ctmp); if (cp == NULL) return((a[0] - b[0]) ? a[0] - b[0] : -1); if (!a[n] && !cp[n]) return(0); if (!a[n]) return(e_compstr(a-1, cp+1)); if (!(k = e_compstr(a+n, cp+n))) return(0); return(e_compstr(a-1, cp+1)); } else if (a[0] == '?') { n--; a++; b++; } else if (a[0] == '[') { if (a[1] == '!') { for (k = 2; a[k] && (a[k] != ']' || k == 2) && a[k] != b[0]; k++) if (a[k+1] == '-' && b[0] >= a[k] && b[0] <= a[k+2]) return(-b[0]); if (a[k] != ']') return(-b[0]); n-=(k+1); a+=(k+1); b++; } else { for (k = 1; a[k] && (a[k] != ']' || k == 1) && a[k] != b[0]; k++) if (a[k+1] == '-' && b[0] >= a[k] && b[0] <= a[k+2]) break; if (a[k] == ']' || a[k] == '\0') return(-b[0]); for (; a[k] && (a[k] != ']'); k++) ; n-=(k+1); a+=(k+1); b++; } } if (n <= 0) return(e_compstr(a, b)); if ((k = strncmp(a, b, n)) != 0) return(k); return(e_compstr(a+n, b+n)); } struct dirfile *e_find_files(char *sufile, int sw) { char *stmp, *tmpst, *sfile, *sdir; struct dirfile *df = MALLOC(sizeof(struct dirfile)); DIR *dirp; struct dirent *dp; struct stat buf; struct stat lbuf; int i, n, cexist, sizeStmp, sizeSdir; df->name = NULL; df->anz = 0; for (n = strlen(sufile); n >= 0 && sufile[n] != DIRC; n--); sfile = sufile + 1 + n; if (n <= 0) { sizeSdir = 2; sdir = (char *)WpeMalloc(2 * sizeof(char)); sdir[0] = n ? '.' : DIRC; sdir[1] = '\0'; } else { sizeSdir = n + 1; sdir = (char *)WpeMalloc((n + 1) * sizeof(char)); for (i = 0; i < n; i++) sdir[i] = sufile[i]; sdir[n] = '\0'; } if (!(dirp = opendir(sdir))) { FREE(sdir); return(df); } sizeStmp = 256; stmp = (char *)WpeMalloc(sizeStmp); while((dp = readdir(dirp)) != NULL) { if (!(sw & 1) && dp->d_name[0] == '.' && sfile[0] != '.') continue; if (!e_compstr(sfile, dp->d_name)) { if (sizeSdir + strlen(dp->d_name) + 10 > sizeStmp) { while (sizeSdir + strlen(dp->d_name) + 10 > sizeStmp) sizeStmp <<= 1; stmp = (char *)WpeRealloc(stmp, sizeStmp); } e_mkfilepath(sdir, dp->d_name, stmp); lstat(stmp, &lbuf); stat(stmp, &buf); /* check existence of the file */ cexist = access(stmp, F_OK); /* we accept it as a file if - a regular file - link and it does not point to anything - link and it points to a non-directory */ if ((S_ISREG(buf.st_mode) || (S_ISLNK(lbuf.st_mode) && (cexist || (cexist == 0 && !S_ISDIR(buf.st_mode))))) && (!(sw & 2) || (buf.st_mode & 0111)) ) { if (df->anz == 0) df->name = MALLOC((df->anz + 1) * sizeof(char *)); else df->name = REALLOC(df->name, (df->anz + 1) * sizeof(char *)); if (df->name == NULL || !(tmpst = MALLOC(strlen(dp->d_name) + 1))) { df->anz = 0; closedir(dirp); WpeFree(stmp); WpeFree(sdir); return(df); } strcpy(tmpst, dp->d_name); for (n = df->anz; n > 0 && strcmp(*(df->name + n - 1), tmpst) > 0; n--) *(df->name + n) = *(df->name + n - 1); *(df->name + n) = tmpst; (df->anz)++; } } } closedir(dirp); WpeFree(stmp); WpeFree(sdir); return(df); } struct dirfile *e_find_dir(char *sufile, int sw) { char *stmp, *tmpst, *sfile, *sdir; struct dirfile *df = MALLOC(sizeof(struct dirfile)); DIR *dirp; struct dirent *dp; struct stat buf; int i, n, sizeStmp, sizeSdir; df->name = NULL; df->anz = 0; for (n = strlen(sufile); n >= 0 && sufile[n] != DIRC; n--); sfile = sufile + 1; sfile = sfile + n; if (n <= 0) { sizeSdir = 2; sdir = MALLOC(2 * sizeof(char)); sdir[0] = n ? '.' : DIRC; sdir[1] = '\0'; } else { sizeSdir = n + 1; sdir = MALLOC((n + 1) * sizeof(char)); for (i = 0; i < n; i++) sdir[i] = sufile[i]; sdir[n] = '\0'; } if (!(dirp = opendir(sdir))) { FREE(sdir); return(df); } sizeStmp = 256; stmp = (char *)WpeMalloc(sizeStmp); while ((dp = readdir(dirp)) != NULL) { if (!sw && dp->d_name[0] == '.' && sfile[0] != '.') continue; if (!e_compstr(sfile, dp->d_name) && strcmp(dp->d_name, ".") && strcmp(dp->d_name, "..")) { if (sizeSdir + strlen(dp->d_name) + 10 > sizeStmp) { while (sizeSdir + strlen(dp->d_name) + 10 > sizeStmp) sizeStmp <<= 1; stmp = (char *)WpeRealloc(stmp, sizeStmp); } stat(e_mkfilepath(sdir, dp->d_name, stmp), &buf); /* we accept _only_ real, existing directories */ if (S_ISDIR(buf.st_mode)) { if (df->anz == 0) df->name = MALLOC((df->anz + 1) * sizeof(char *)); else df->name = REALLOC(df->name, (df->anz + 1) * sizeof(char *)); if (df->name == NULL || !(tmpst = MALLOC(strlen(dp->d_name) + 1))) { df->anz = 0; closedir(dirp); FREE(sdir); WpeFree(stmp); return(df); } strcpy(tmpst, dp->d_name); for (n = df->anz; n > 0 && strcmp(*(df->name + n - 1), tmpst) > 0; n--) *(df->name + n) = *(df->name + n - 1); *(df->name + n) = tmpst; (df->anz)++; } } } closedir(dirp); FREE(sdir); WpeFree(stmp); return(df); } #include char *e_file_info(char *filen, char *str, int *num, int sw) { struct tm *ttm; struct stat buf[1]; stat(filen, buf); ttm = localtime(&(buf->st_mtime)); sprintf(str, "%c%c%c%c%c%c%c%c%c%c %-13s %6ld %2.2u.%2.2u.%4.4u %2.2u.%2.2u", buf->st_mode & 040000 ? 'd' : '-', buf->st_mode & 0400 ? 'r' : '-', buf->st_mode & 0200 ? 'w' : '-', buf->st_mode & 0100 ? 'x' : '-', buf->st_mode & 040 ? 'r' : '-', buf->st_mode & 020 ? 'w' : '-', buf->st_mode & 010 ? 'x' : '-', buf->st_mode & 04 ? 'r' : '-', buf->st_mode & 02 ? 'w' : '-', buf->st_mode & 01 ? 'x' : '-', filen, buf->st_size, ttm->tm_mday, ttm->tm_mon + 1, ttm->tm_year + 1900, ttm->tm_hour, ttm->tm_min); if (sw & 1) *num = buf->st_mtime; else if (sw & 2) *num = buf->st_size; return(str); } void ini_repaint(ECNT *cn) { e_cls(cn->fb->df.fb, cn->fb->dc); e_ini_desk(cn); } void end_repaint() { e_refresh(); } int e_recover(ECNT *cn) { struct dirfile *files; FENSTER *f = NULL; BUFFER *b; SCHIRM *s; int i; files = e_find_files("*.ESV", 1); for (i = 0; i < files->anz; i++) { e_edit(cn, files->name[i]); f = cn->f[cn->mxedt]; f->datnam[strlen(f->datnam)-4] = '\0'; if (!strcmp(f->datnam, BUFFER_NAME)) { s = cn->f[cn->mxedt]->s; b = cn->f[cn->mxedt]->b; s->mark_end.y = b->mxlines - 1; s->mark_end.x = b->bf[b->mxlines-1].len; e_edt_copy(f); e_close_window(f); } else f->save = 1; #ifdef PROG if (WpeIsProg()) e_add_synt_tl(f->datnam, f); #endif if ((f->ed->edopt & ED_ALWAYS_AUTO_INDENT) || ((f->ed->edopt & ED_SOURCE_AUTO_INDENT) && f->c_st)) f->flg = 1; } freedf(files); return(0); } int e_frb_t_menue(int sw, int xa, int ya, FENSTER *f, int md) { COLOR *frb = &(f->fb->er); int i, j, y, c=1, fb, fsv; if (md == 1) sw += 11; else if (md == 2) sw += 16; else if (md == 3) sw += 32; fsv = fb = frb[sw].fb; if (fb == 0) y = 0; else for (y = 1, j = fb; j > 1; y++) j /= 2; do { if (c == CDO) y = y < 6 ? y + 1 : 0; else if (c == CUP) y = y > 0 ? y - 1 : 6; if (y == 0) fb = 0; else for (i = 1, fb = 1; i < y; i++) fb *= 2; frb[sw] = e_n_clr(fb); e_pr_t_col_kasten(xa, ya, fb, fb, f, 1); e_pr_ed_beispiel(1, 2, f, sw, md); #if MOUSE if ((c=e_getch()) == -1) c = e_opt_ck_mouse(xa, ya, md); #else c = e_getch(); #endif } while (c != WPE_ESC && c != WPE_CR && c > -2); if (c == WPE_ESC || c < -1) frb[sw] = e_n_clr(fsv); return(frb[sw].fb); } /* draw colors box */ void e_pr_t_col_kasten(int xa, int ya, int x, int y, FENSTER * f, int sw) { int rfrb, xe = xa + 14, ye = ya + 8; if (x == 0) y = 0; else for (rfrb = x, y = 1; rfrb > 1; y++) rfrb /= 2; rfrb = sw == 0 ? f->fb->nt.fb : f->fb->fs.fb; e_std_rahmen(xa, ya, xe, ye, "Colors", 0, rfrb, 0); /* e_pr_str((xa+xe-8)/2, ya, "Colors", rfrb, 0, 1, f->fb->ms.f+16*(rfrb/16), 0); */ e_pr_nstr(xa+2, ya+1, xe-xa-1, "A_NORMAL ", 0, 0); e_pr_nstr(xa+2, ya+2, xe-xa-1, "A_STANDOUT ", A_STANDOUT, A_STANDOUT); e_pr_nstr(xa+2, ya+3, xe-xa-1, "A_UNDERLINE", A_UNDERLINE, A_UNDERLINE); e_pr_nstr(xa+2, ya+4, xe-xa-1, "A_REVERSE ", A_REVERSE, A_REVERSE); e_pr_nstr(xa+2, ya+5, xe-xa-1, "A_BLINK ", A_BLINK, A_BLINK); e_pr_nstr(xa+2, ya+6, xe-xa-1, "A_DIM ", A_DIM, A_DIM); e_pr_nstr(xa+2, ya+7, xe-xa-1, "A_BOLD ", A_BOLD, A_BOLD); fk_locate(xa+4, ya + y + 1); } xwpe-1.5.30a/we_wind.c0000644000076400007640000012565310263105405013566 0ustar dulsidulsi/* we_wind.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #include "messages.h" #include "edit.h" #define MAXSVSTR 20 int e_make_xr_rahmen(int xa, int ya, int xe, int ye, int sw); /* break string into multiple line to fit into windows REM: Caller has to free returned vector!!! */ char **StringToStringArray(char *str, int *maxLen, int minWidth, int *anzahl) { int i, j, k, anz = 0, mxlen = 0, max = 0.8 * MAXSCOL; char **s = MALLOC(sizeof(char*)); for (k = 0, i = 0; str[i]; i++) { if((i-k) == max || str[i] == '\n') { j = i-1; if (str[i] != '\n') for (; j > 0 && !isspace(str[j]); j--) ; if(j > k) i = j; anz++; s = REALLOC(s, anz * sizeof(char *)); s[anz-1] = MALLOC((i - k + 2) * sizeof(char)); for (j = k; j <= i; j++) s[anz-1][j-k] = str[j]; if (isspace(str[j-1])) j--; if (mxlen < (j-k)) mxlen = j - k; s[anz-1][j-k] = '\0'; k = i+1; } } anz++; s = REALLOC(s, anz * sizeof(char *)); s[anz-1] = MALLOC((i - k + 2) * sizeof(char)); for (j = k; j <= i; j++) s[anz-1][j-k] = str[j]; if (mxlen < (j-k)) mxlen = j - k; if (mxlen < minWidth) mxlen = minWidth; *maxLen = mxlen; *anzahl = anz; return (s); } /* Print error message */ int e_error(char *text, int sw, FARBE *f) { PIC *pic = NULL; int len, i, xa, xe, ya = 8, ye = 14; char *header = NULL; fk_cursor(0); WpeMouseChangeShape(WpeErrorShape); if ((len = strlen((char *)text)) < 20 ) len = 20; xa = (80-len)/2 - 2; xe = 82 - (80-len)/2; if (sw == -1) header = "Message"; else if (sw == 0) header = "Error"; else if (sw == 1) header = "Serious Error"; else if (sw == 2) header = "Fatal Error"; if (sw < 2) pic = e_std_kst(xa, ya, xe, ye, header, 1, f->nr.fb, f->nt.fb, f->ne.fb); if (sw == 2 || pic == NULL) { pic = e_open_view(xa, ya, xe, ye, 0, 0); e_std_rahmen(xa, ya, xe, ye, header, 1, 0, 0); } if (sw < 2) { e_pr_str((xe + xa - e_str_len((unsigned char *)text))/2, ya + 2, text, f->nt.fb, 0, 0, 0, 0); e_pr_str((xe + xa - 4)/2, ya + 4, " OK ", f->nz.fb, 1, -1, f->ns.fb, f->nt.fb); } else { e_pr_str((xe + xa - e_str_len((unsigned char *)text))/2, ya + 2, text, 112, 0, 0, 0, 0); e_pr_str((xe + xa - 4)/2, ya + 4, " OK ", 32, 1, -1, 46, 112); } do { #if MOUSE if ((i = e_toupper(e_getch())) == -1) i = e_er_mouse(xa+3, ya,(xe+xa-4)/2, ya+4); #else i = e_toupper(e_getch()); #endif } while (i != WPE_ESC && i != WPE_CR && i != 'O'); WpeMouseRestoreShape(); if (pic != NULL) e_close_view(pic, 1); else e_cls(0, ' '); fk_cursor(1); if (sw == 1) e_quit(WpeEditor->f[WpeEditor->mxedt]); if (sw > 0) WpeExit(sw); return(sw); } /* message with selection */ int e_message(int sw, char *str, FENSTER *f) { int i, ret, mxlen = 0, anz = 0; char **s; W_OPTSTR *o = e_init_opt_kst(f); if (!o) return(-1); s = StringToStringArray(str, &mxlen, 22, &anz); o->ye = MAXSLNS - 6; o->ya = o->ye - anz - 5; o->xa = (MAXSCOL - mxlen - 6)/2; o->xe = o->xa + mxlen + 6; o->bgsw = 0; o->name = "Message"; for (i = 0; i < anz; i++) { e_add_txtstr((o->xe-o->xa-strlen(s[i]))/2, 2+i, s[i], o); FREE(s[i]); } FREE(s); if (!sw) { o->crsw = AltO; e_add_bttstr((o->xe-o->xa-4)/2, o->ye-o->ya-2, 0, AltO, "Ok", NULL, o); } else { o->crsw = AltY; e_add_bttstr(4, o->ye-o->ya-2, 0, AltY, "Yes", NULL, o); e_add_bttstr((o->xe-o->xa-2)/2, o->ye-o->ya-2, 0, AltN, "No", NULL, o); e_add_bttstr(o->xe-o->xa-9, o->ye-o->ya-2, -1, WPE_ESC, "Cancel", NULL, o); } ret = e_opt_kst(o); freeostr(o); return(ret == WPE_ESC ? WPE_ESC : (ret == AltN ? 'N' : 'Y')); } /* First opening of a window */ void e_firstl(FENSTER *f, int sw) { f->pic = NULL; f->pic = e_ed_kst(f, f->pic, sw); if (f->pic == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); } /* Writing of the file type */ int e_pr_filetype(FENSTER *f) { int frb = f->fb->es.fb; e_pr_char(f->a.x+2, f->e.y, 'A', frb); if (f->ins == 0 || f->ins == 2) e_pr_char(f->a.x+16, f->e.y, 'O', frb); else if (f->ins == 8) e_pr_char(f->a.x+16, f->e.y, 'R', frb); else e_pr_char(f->a.x+16, f->e.y, 'I', frb); if (f->ins > 1) e_pr_char(f->a.x+17, f->e.y, 'S', frb); else e_pr_char(f->a.x+17, f->e.y, 'L', frb); return(0); } /* open section of screen and save background */ PIC *e_open_view(int xa, int ya, int xe, int ye, int col, int sw) { PIC *pic = MALLOC(sizeof(PIC)); int i, j; if (pic == NULL) return(NULL); pic->a.x = xa; pic->a.y = ya; #ifndef NEWSTYLE if(!WpeIsXwin()) { pic->e.x = xe; pic->e.y = ye; } else { pic->e.x = xe < MAXSCOL-2 ? xe + 2 : xe < MAXSCOL-1 ? xe + 1 : xe; pic->e.y = ye < MAXSLNS-2 ? ye + 1 : ye; } #else pic->e.x = xe; pic->e.y = ye; #endif if (sw!=0) { #if defined(NEWSTYLE) && !defined(NO_XWINDOWS) pic->p = MALLOC((pic->e.x - pic->a.x + 1) * 3 * (pic->e.y - pic->a.y + 1)); #else pic->p = MALLOC((pic->e.x - pic->a.x + 1) * 2 * (pic->e.y - pic->a.y + 1)); #endif if (pic->p == NULL) { FREE(pic); return(NULL); } for (j = pic->a.y; j <= pic->e.y; ++j) for (i = 2*pic->a.x; i <= 2*pic->e.x+1; ++i) *( pic->p + (j-pic->a.y)*2*(pic->e.x-pic->a.x+1) + (i-2*pic->a.x) ) = e_gt_byte(i, j); #if defined(NEWSTYLE) && !defined(NO_XWINDOWS) e_get_pic_xrect(xa, ya, xe, ye, pic); #endif } else pic->p = (char *)0; if (sw < 2) { for (j = ya; j <= ye; ++j) for (i = xa; i <= xe; ++i) e_pr_char(i, j, ' ', col); } #ifndef NO_XWINDOWS if (WpeIsXwin()) (*e_u_setlastpic)(pic); #endif #ifndef NEWSTYLE if (WpeIsXwin()) { if (sw != 0) { if (xe < MAXSCOL-1) for(i = ya+1; i <= ye+1 && i < MAXSLNS-1; i++) e_pt_col(xe+1, i, SHDCOL); if (xe < MAXSCOL-2) for(i = ya+1; i <= ye+1 && i < MAXSLNS-1; i++) e_pt_col(xe+2, i, SHDCOL); if (ye < MAXSLNS-2) for(i = xa+2; i <= xe; i++) e_pt_col(i, ye+1, SHDCOL); } } #endif return(pic); } /* close screen section - refresh background */ int e_close_view(PIC *pic, int sw) { int i, j; #ifndef NO_XWINDOWS if (WpeIsXwin()) (*e_u_setlastpic)(NULL); #endif if (pic == NULL) return(-1); if (sw != 0 && pic->p != NULL) { for (j = pic->a.y; j <= pic->e.y; ++j) for (i = 2*pic->a.x; i <= 2*pic->e.x+1; ++i) e_pt_byte(i, j, *(pic->p + (j-pic->a.y)*2*(pic->e.x-pic->a.x+1) + (i-2*pic->a.x))); #if defined(NEWSTYLE) && !defined(NO_XWINDOWS) e_put_pic_xrect(pic); #endif } else if (sw != 0) { for (j = pic->a.y; j <= pic->e.y; ++j) for (i = pic->a.x; i <= pic->e.x; ++i) e_pr_char(i, j, ' ', 0); } if (sw < 2) { if (pic->p != NULL) FREE(pic->p); FREE(pic); } e_refresh(); return(sw); } /* Frame for edit window */ void e_ed_rahmen(FENSTER *f, int sw) { extern char *e_hlp; extern int nblst; extern WOPT *blst; char *header = NULL; if (!DTMD_ISTEXT(f->dtmd)) { if (f->datnam[0]) header = f->datnam; if (f->dtmd == DTMD_FILEDROPDOWN) e_std_rahmen(f->a.x, f->a.y, f->e.x, f->e.y, header, sw, f->fb->er.fb, f->fb->es.fb); else e_std_rahmen(f->a.x, f->a.y, f->e.x, f->e.y, header, sw, f->fb->nr.fb, f->fb->ne.fb); if (f->winnum < 10 && f->winnum >= 0) e_pr_char(f->e.x-6, f->a.y, '0' + f->winnum, f->fb->nr.fb); else if (f->winnum >= 0) e_pr_char(f->e.x-6, f->a.y, 'A' - 10 + f->winnum, f->fb->nr.fb); if (sw > 0 && (f->dtmd == DTMD_FILEMANAGER || f->dtmd == DTMD_DATA)) { if (f->zoom == 0) e_pr_char(f->e.x-3, f->a.y, WZN, f->fb->ne.fb); else e_pr_char(f->e.x-3, f->a.y, WZY, f->fb->ne.fb); #ifdef NEWSTYLE if (!WpeIsXwin()) { #endif e_pr_char(f->e.x-4, f->a.y, '[', f->fb->nr.fb); e_pr_char(f->e.x-2, f->a.y, ']', f->fb->nr.fb); #ifdef NEWSTYLE } else e_make_xrect(f->e.x-4, f->a.y, f->e.x-2, f->a.y, 0); #endif blst = f->blst; nblst = f->nblst; e_hlp = f->hlp_str; e_pr_uul(f->fb); } #ifdef NEWSTYLE if (WpeIsXwin()) e_make_xr_rahmen(f->a.x, f->a.y, f->e.x, f->e.y, sw); #endif return; } if (f->datnam[0]) { if (strcmp(f->dirct, f->ed->dirct) == 0 || f->dtmd == DTMD_HELP || strcmp(f->datnam, BUFFER_NAME) == 0 || NUM_COLS_ON_SCREEN < 40) { header = (char *)WpeMalloc(strlen(f->datnam) + 1); strcpy(header, f->datnam); } else { header = (char *)WpeMalloc(strlen(f->dirct) + strlen(f->datnam) + 1); strcpy(header, f->dirct); strcat(header, f->datnam); } } e_std_rahmen(f->a.x, f->a.y, f->e.x, f->e.y, header, sw, f->fb->er.fb, f->fb->es.fb); if (header) WpeFree(header); if (sw > 0) { e_mouse_bar(f->e.x, f->a.y+1, NUM_LINES_ON_SCREEN - 1, 0, f->fb->em.fb); e_mouse_bar(f->a.x+19, f->e.y, NUM_COLS_ON_SCREEN - 20, 1, f->fb->em.fb); if (f->zoom == 0) e_pr_char(f->e.x-3, f->a.y, WZN, f->fb->es.fb); else e_pr_char(f->e.x-3, f->a.y, WZY, f->fb->es.fb); #ifdef NEWSTYLE if (!WpeIsXwin()) { #endif e_pr_char(f->e.x-4, f->a.y, '[', f->fb->er.fb); e_pr_char(f->e.x-2, f->a.y, ']', f->fb->er.fb); #ifdef NEWSTYLE } else e_make_xrect(f->e.x-4, f->a.y, f->e.x-2, f->a.y, 0); #endif e_pr_filetype(f); if (WpeIsXwin() && NUM_LINES_ON_SCREEN > 8) { #if !defined(NO_XWINDOWS) && defined(NEWSTYLE) e_pr_char(f->a.x, f->a.y + 2, 'F', f->fb->em.fb); e_make_xrect(f->a.x, f->a.y+2, f->a.x, f->a.y+2, 0); e_pr_char(f->a.x, f->a.y + 4, 'R', f->fb->em.fb); e_make_xrect(f->a.x, f->a.y+4, f->a.x, f->a.y+4, 0); e_pr_char(f->a.x, f->a.y + 6, 'A', f->fb->em.fb); e_make_xrect(f->a.x, f->a.y+6, f->a.x, f->a.y+6, 0); if (f->ins != 8) { e_pr_char(f->a.x, f->a.y + 8, 'S', f->fb->em.fb); e_make_xrect(f->a.x, f->a.y+8, f->a.x, f->a.y+8, 0); } #else e_pr_char(f->a.x, f->a.y + 2, 'F', f->fb->em.fb); e_pr_char(f->a.x, f->a.y + 3, MCI, f->fb->em.fb); e_pr_char(f->a.x, f->a.y + 4, 'R', f->fb->em.fb); e_pr_char(f->a.x, f->a.y + 5, MCI, f->fb->em.fb); e_pr_char(f->a.x, f->a.y + 6, 'A', f->fb->em.fb); if (f->ins != 8) { e_pr_char(f->a.x, f->a.y + 7, MCI, f->fb->em.fb); e_pr_char(f->a.x, f->a.y + 8, 'S', f->fb->em.fb); } #endif } e_zlsplt(f); blst = f->blst; nblst = f->nblst; e_hlp = f->hlp_str; e_pr_uul(f->fb); } if (f->winnum < 10 && f->winnum >= 0) e_pr_char(f->e.x-6, f->a.y, '0' + f->winnum, f->fb->er.fb); else if (f->winnum >= 0) e_pr_char(f->e.x-6, f->a.y, 'A' - 10 + f->winnum, f->fb->er.fb); #ifdef NEWSTYLE if (WpeIsXwin()) e_make_xr_rahmen(f->a.x, f->a.y, f->e.x, f->e.y, sw); #endif } /* Output - screen content */ int e_schirm(FENSTER *f, int sw) { int j; if (f->dtmd == DTMD_FILEMANAGER) return(WpeDrawFileManager(f)); else if (f->dtmd == DTMD_DATA) return(e_data_schirm(f)); else if (f->dtmd == DTMD_FILEDROPDOWN) return(e_pr_file_window((FLWND*)f->b, 1, sw, f->fb->er.fb, f->fb->ez.fb, f->fb->frft.fb)); if (NUM_LINES_OFF_SCREEN_TOP < 0) NUM_LINES_OFF_SCREEN_TOP = 0; #ifdef PROG if (f->c_sw) for (j = NUM_LINES_OFF_SCREEN_TOP; j < f->b->mxlines && j < LINE_NUM_ON_SCREEN_BOTTOM ; j++ ) e_pr_c_line(j, f); else #endif for (j = NUM_LINES_OFF_SCREEN_TOP; j < f->b->mxlines && j < LINE_NUM_ON_SCREEN_BOTTOM ; j++ ) e_pr_line(j, f); for (; j < LINE_NUM_ON_SCREEN_BOTTOM ; j++ ) e_blk((NUM_COLS_ON_SCREEN - 1), f->a.x + 1, j - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, f->fb->et.fb); return(j); } /* Move and modify window */ int e_size_move(FENSTER *f) { int xa = f->a.x, ya = f->a.y, xe = f->e.x, ye = f->e.y; int c = 0, xmin = 26, ymin = 3; e_ed_rahmen(f, 0); if (f->dtmd == DTMD_FILEDROPDOWN) xmin = 15; else if (!DTMD_ISTEXT(f->dtmd)) ymin = 9; while ((c = e_getch()) != WPE_ESC && c != WPE_CR) { switch (c) { case CLE: if (xa > 0) { xa--; xe--; } break; case CRI: if (xe < MAXSCOL-1) { xa++; xe++; } break; case CUP: if (ya > 1) { ya--; ye--; } break; case CDO: if (ye < MAXSLNS-2) { ya++; ye++; } break; case SCLE: case CCLE: if ((xe - xa) > xmin) xe--; break; case SCRI: case CCRI: if (xe < MAXSCOL-1) xe++; break; case SCUP: case BUP: if ((ye - ya) > ymin) ye--; break; case SCDO: case BDO: if (ye < MAXSLNS-2) ye++; break; } if (xa != f->a.x || ya != f->a.y || xe != f->e.x || ye != f->e.y) { f->a.x = xa; f->a.y = ya; f->e.x = xe; f->e.y = ye; f->pic = e_ed_kst(f, f->pic, 0); if (f->pic == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); if (f->dtmd == DTMD_FILEDROPDOWN) { FLWND *fw = (FLWND*) f->b; fw->xa = f->a.x+1; fw->xe = f->e.x; fw->ya = f->a.y+1; fw->ye = f->e.y; } e_cursor(f, 0); e_schirm(f, 0); } } e_ed_rahmen(f, 1); return(c); } /* Standard Box */ PIC *e_std_kst(int xa, int ya, int xe, int ye, char *name, int sw, int fr, int ft, int fes) { PIC *pic = e_open_view(xa, ya, xe, ye, ft, 1); if (pic == NULL) return (NULL); e_std_rahmen(xa, ya, xe, ye, name, sw, fr, fes); return(pic); } PIC *e_change_pic(int xa, int ya, int xe, int ye, PIC *pic, int sw, int frb) { int i, j; int box = 2, ax, ay, ex, ey; PIC *newpic; if(sw<0) { sw = -sw; box = 1; } if (pic == NULL) { newpic = e_open_view(xa, ya, xe, ye, frb, box); if (newpic == NULL) return (NULL); } else if (xa > pic->e.x || xe < pic->a.x || ya > pic->e.y || ye < pic->a.y) { e_close_view(pic, box); newpic = e_open_view(xa, ya, xe, ye, frb, box); if (newpic == NULL) return (NULL); } else { newpic = MALLOC(sizeof(PIC)); if(newpic == NULL) return(NULL); newpic->a.x = xa; newpic->a.y = ya; #ifndef NEWSTYLE if(!WpeIsXwin()) { newpic->e.x = xe; newpic->e.y = ye; } else { newpic->e.x = xe < MAXSCOL-2 ? xe + 2 : xe < MAXSCOL-1 ? xe + 1 : xe; newpic->e.y = ye < MAXSLNS-2 ? ye + 1 : ye; } #else newpic->e.x = xe; newpic->e.y = ye; #endif #if !defined(NO_XWINDOWS) && defined(NEWSTYLE) newpic->p = MALLOC( (newpic->e.x - newpic->a.x + 1) * 3 * (newpic->e.y - newpic->a.y + 1) ); #else newpic->p = MALLOC( (newpic->e.x - newpic->a.x + 1) * 2 * (newpic->e.y - newpic->a.y + 1) ); #endif if (newpic->p == NULL) { FREE(newpic); return(NULL); } ax = pic->a.x > newpic->a.x ? pic->a.x : newpic->a.x; ay = pic->a.y > newpic->a.y ? pic->a.y : newpic->a.y; ex = pic->e.x < newpic->e.x ? pic->e.x : newpic->e.x; ey = pic->e.y < newpic->e.y ? pic->e.y : newpic->e.y; for (j = ay; j <= ey; ++j) for (i = 2*ax; i <= 2*ex+1; ++i) { *(newpic->p + 2*(newpic->e.x-newpic->a.x+1)*(j-newpic->a.y) + (i-2*newpic->a.x)) = *(pic->p + 2*(pic->e.x-pic->a.x+1)*(j-pic->a.y) + (i - 2*pic->a.x) ); } for (j = newpic->a.y; j < ay; ++j) for (i = 2*newpic->a.x; i <= 2*newpic->e.x+1; ++i) { *(newpic->p + 2*(newpic->e.x-newpic->a.x+1)*(j-newpic->a.y) + (i-2*newpic->a.x)) = e_gt_byte(i, j); } for (j = newpic->e.y; j > ey; --j) for (i = 2*newpic->a.x; i <= 2*newpic->e.x+1; ++i) { *(newpic->p + 2*(newpic->e.x-newpic->a.x+1)*(j-newpic->a.y) + (i-2*newpic->a.x)) = e_gt_byte(i, j); } for (j = newpic->a.y; j <= newpic->e.y; ++j) for (i = 2*newpic->a.x; i < 2*ax; ++i) { *(newpic->p + 2*(newpic->e.x-newpic->a.x+1)*(j-newpic->a.y) + (i-2*newpic->a.x)) = e_gt_byte(i, j); } for (j = newpic->a.y; j <= newpic->e.y; ++j) for (i = 2*(ex+1); i <= 2*newpic->e.x + 1; ++i) { *(newpic->p + 2*(newpic->e.x-newpic->a.x+1)*(j-newpic->a.y) + (i-2*newpic->a.x)) = e_gt_byte(i, j); } for (j = pic->a.y; j < ya; ++j) for (i = 2*pic->a.x; i <= 2*pic->e.x+1; ++i) e_pt_byte(i, j, *( pic->p + (j-pic->a.y)*2 *(pic->e.x-pic->a.x+1) + (i-2*pic->a.x) ) ); for (j = pic->a.y; j <= pic->e.y; ++j) for (i = 2*pic->a.x; i < 2*xa; i=i+1) e_pt_byte(i, j, *( pic->p + (j-pic->a.y)*2 *(pic->e.x-pic->a.x+1) + (i - 2*pic->a.x) ) ); for (j = pic->e.y; j > ye; --j) for (i = 2*pic->a.x; i <= 2*pic->e.x+1; ++i) e_pt_byte(i, j, *( pic->p + (j-pic->a.y)*2 *(pic->e.x-pic->a.x+1) + (i-2*pic->a.x) ) ); for (j = pic->e.y; j >= pic->a.y; --j) for (i = 2*pic->e.x + 1; i > 2*xe; --i) e_pt_byte(i, j, *( pic->p + (j-pic->a.y)*2 *(pic->e.x-pic->a.x+1) + (i-2*pic->a.x) ) ); #if !defined(NO_XWINDOWS) && defined(NEWSTYLE) e_put_pic_xrect(pic); e_get_pic_xrect(xa, ya, xe, ye, newpic); #endif #ifndef NEWSTYLE if (WpeIsXwin()) { if(xe < MAXSCOL-1) for(i = ya+1; i <= ye+1 && i < MAXSLNS-1; i++) e_pt_col(xe+1, i, SHDCOL); if(xe < MAXSCOL-2) for(i = ya+1; i <= ye+1 && i < MAXSLNS-1; i++) e_pt_col(xe+2, i, SHDCOL); if(ye < MAXSLNS-2) for(i = xa+2; i <= xe; i++) e_pt_col(i, ye+1, SHDCOL); } #endif FREE(pic->p); FREE(pic); } #ifndef NO_XWINDOWS if (WpeIsXwin()) (*e_u_setlastpic)(newpic); #endif return(newpic); } PIC *e_ed_kst(FENSTER *f, PIC *pic, int sw) { PIC *newpic = e_change_pic(f->a.x, f->a.y, f->e.x, f->e.y, pic, sw, f->fb->er.fb); e_ed_rahmen(f, sw); return(newpic); } /* delete buffer */ int e_close_buffer(BUFFER *b) { int i; if (b != NULL) { e_remove_undo(b->ud, b->cn->numundo + 1); if (b->bf != NULL) { for (i = 0; i < b->mxlines; i++) { if (b->bf[i].s != NULL) FREE( b->bf[i].s ); b->bf[i].s = NULL; } FREE(b->bf); } FREE(b); } return(0); } /* close window */ int e_close_window(FENSTER *f) { ECNT *cn = f->ed; FENSTER *f0 = f->ed->f[0]; int c = 0; long maxname; char text[256]; f = cn->f[cn->mxedt]; if (f->dtmd == DTMD_FILEMANAGER) { FLBFFR *b = (FLBFFR *)f->b; FREE(f->dirct); FREE(b->rdfile); freedf(b->df); freedf(b->fw->df); freedf(b->dd); freedf(b->cd); freedf(b->dw->df); FREE(b->fw); FREE(b->dw); FREE(b); (cn->mxedt)--; cn->curedt = cn->edt[cn->mxedt]; e_close_view(f->pic, 1); if (f != f0 && f != NULL) { e_free_find(&f->fd); FREE(f); } if (cn->mxedt > 0) { f = cn->f[cn->mxedt]; e_ed_rahmen(f, 1); } return(0); } if (f->dtmd == DTMD_DATA) { FLWND *fw = (FLWND *)f->b; int swt = f->ins; #ifdef PROG if (swt == 4 && f->save) e_p_update_prj_fl(f); #endif if (f->dirct) FREE(f->dirct); if (swt == 7) freedf(fw->df); FREE(fw); (cn->mxedt)--; cn->curedt = cn->edt[cn->mxedt]; e_close_view(f->pic, 1); if (f != f0 && f != NULL) { e_free_find(&f->fd); FREE(f); } if (cn->mxedt > 0 && (swt < 5 || swt == 7)) { f = cn->f[cn->mxedt]; e_ed_rahmen(f, 1); } return(0); } if (f == NULL || f->ed->mxedt <= 0) return(0); if (f != f0) { if (f->save != 0 && f->ins != 8) { sprintf(text, "File %s NOT saved!\nDo you want to save File ?", f->datnam); c = e_message(1, text, f); if (c == WPE_ESC) return(c); else if (c == 'Y') e_save(f); } /* Check if file system could have an autosave or emergency save file >12 check is to eliminate dos file systems */ if ((maxname = pathconf(f->dirct, _PC_NAME_MAX) >= strlen(f->datnam) + 4) && (maxname > 12)) { remove(e_make_postf(text, f->datnam, ".ASV")); remove(e_make_postf(text, f->datnam, ".ESV")); } if (strcmp(f->datnam, "Messages") && strcmp(f->datnam, "Watches")) e_close_buffer(f->b); if (f->dtmd == DTMD_HELP && f->ins == 8) e_help_free(f); if (f->datnam != NULL) FREE(f->datnam); if (f->dirct != NULL) FREE(f->dirct); if (f && f->s != NULL) FREE(f->s); } (cn->mxedt)--; cn->curedt = cn->edt[cn->mxedt]; e_close_view(f->pic, 1); if (f != f0 && f != NULL) { e_free_find(&f->fd); FREE(f); } if (cn->mxedt > 0) { f = cn->f[cn->mxedt]; e_ed_rahmen(f, 1); } return(c); } /* Toggle among windows */ int e_rep_win_tree(ECNT *cn) { int i; if (cn->mxedt <= 0) return(0); ini_repaint(cn); for ( i = 1; i < cn->mxedt; i++) { e_firstl(cn->f[i], 0); e_schirm(cn->f[i], 0); } e_firstl(cn->f[i], 1); e_schirm(cn->f[i], 1); e_cursor(cn->f[i], 1); end_repaint(); return(0); } void e_switch_window(int num, FENSTER *f) { ECNT *cn = f->ed; FENSTER *ft; int n, i, te; for (n = 1; cn->edt[n] != num && n < cn->mxedt; n++) ; if (n >= cn->mxedt) return; for (i = cn->mxedt; i >= 1; i--) { FREE(cn->f[i]->pic->p); FREE(cn->f[i]->pic); } ft = cn->f[n]; te = cn->edt[n]; for ( i = n; i < cn->mxedt; i++) { cn->edt[i] = cn->edt[i+1]; cn->f[i] = cn->f[i+1]; } cn->f[i] = ft; cn->edt[i] = te; cn->curedt = num; e_rep_win_tree(cn); } /* zoom windows */ int e_ed_zoom(FENSTER *f) { if (f->ed->mxedt > 0) { if(f->zoom == 0) { f->sa = e_set_pnt(f->a.x, f->a.y); f->se = e_set_pnt(f->e.x, f->e.y); f->a = e_set_pnt(0, 1); f->e = e_set_pnt(MAXSCOL-1, MAXSLNS-2); f->zoom = 1; } else { f->a = e_set_pnt(f->sa.x, f->sa.y); f->e = e_set_pnt(f->se.x, f->se.y); f->zoom = 0; } f->pic = e_ed_kst(f, f->pic, 1); if(f->pic == NULL) e_error(e_msg[ERR_LOWMEM], 1, f->fb); e_cursor(f, 1); e_schirm(f, 1); } return(WPE_ESC); } /* cascade windows */ int e_ed_cascade(FENSTER *f) { ECNT *cn = f->ed; int i; if (cn->mxedt < 1) return 0; /* no windows open */ for (i = cn->mxedt; i >= 1; i--) { FREE(cn->f[i]->pic->p); FREE(cn->f[i]->pic); cn->f[i]->a = e_set_pnt(i-1, i); cn->f[i]->e = e_set_pnt(MAXSCOL-1-cn->mxedt+i, MAXSLNS-2-cn->mxedt+i); } ini_repaint(cn); for ( i = 1; i < cn->mxedt; i++) { e_firstl(cn->f[i], 0); e_schirm(cn->f[i], 0); } e_firstl(cn->f[i], 1); e_schirm(cn->f[i], 1); e_cursor(cn->f[i], 1); end_repaint(); return(0); } /* Tile windows */ int e_ed_tile(FENSTER *f) { ECNT *cn = f->ed; POINT atmp[MAXEDT+1]; POINT etmp[MAXEDT+1]; int i, j, ni, nj; int editwin = 0; /* number of editor windows */ int editorwin[MAXEDT + 1]; int maxlines = MAXSLNS; for (i = cn->mxedt; i >= 1; i--) { if ((!(cn->edopt & ED_OLD_TILE_METHOD)) && (!DTMD_ISTEXT(cn->f[i]->dtmd) || ((WpeIsProg()) && ((strcmp(cn->f[i]->datnam, "Messages") == 0) || (strcmp(cn->f[i]->datnam, "Watches") == 0))))) { editorwin[i] = 0; } else { editwin++; editorwin[i] = 1; } } if (editwin < 1) return(0); if ((!(cn->edopt & ED_OLD_TILE_METHOD)) && (WpeIsProg())) { maxlines -= MAXSLNS / 3 - 1; } for (i = cn->mxedt; i >= 1; i--) { FREE(cn->f[i]->pic->p); FREE(cn->f[i]->pic); } for (ni = editwin, nj = 1; ni > 1; ni--) { nj = editwin / ni; if (editwin % ni) nj++; if (nj >= ni) break; } if (nj*ni < editwin) nj++; for (j = 0; j < nj; j++) { for (i = 0; i < ni; i++) { if (j == 0) { if (i == 0) { atmp[j*ni+i].x = i * MAXSCOL / ni; etmp[j*ni+i].x = (i + 1) * MAXSCOL / ni - 1; if (etmp[j*ni+i].x - atmp[j*ni+i].x < 26) etmp[j*ni+i].x = atmp[j*ni+i].x + 26; } else { etmp[j*ni+i].x = (i + 1) * MAXSCOL / ni - 1; atmp[j*ni+i].x = etmp[j*ni+i-1].x + 1; if (etmp[j*ni+i].x - atmp[j*ni+i].x < 26) etmp[j*ni+i].x = atmp[j*ni+i].x + 26; if (etmp[j*ni+i].x >= MAXSCOL) { etmp[j*ni+i].x = MAXSCOL - 1; atmp[j*ni+i].x = etmp[j*ni+i].x - 26; } } } else { atmp[j*ni+i].x = atmp[(j-1)*ni+i].x; etmp[j*ni+i].x = etmp[(j-1)*ni+i].x; /* make the last window full width */ if ((j * ni + i) == (editwin - 1)) etmp[j * ni + i].x = MAXSCOL - 1; } } } for (i = 0; i < ni; i++) { for (j = 0; j < nj; j++) { if (i == 0) { if (j == 0) { atmp[j*ni+i].y = j * (maxlines-2) / nj + 1; etmp[j*ni+i].y = (j + 1) * (maxlines-2) / nj; if (etmp[j*ni+i].y - atmp[j*ni+i].y < 3) etmp[j*ni+i].y = atmp[j*ni+i].y + 3; } else { etmp[j*ni+i].y = (j + 1) * (maxlines-2) / nj; atmp[j*ni+i].y = etmp[(j-1)*ni+i].y + 1; if (etmp[j*ni+i].y - atmp[j*ni+i].y < 3) etmp[j*ni+i].y = atmp[j*ni+i].y + 3; if (etmp[j*ni+i].y > maxlines - 2) { etmp[j*ni+i].y = maxlines - 2; atmp[j*ni+i].y = etmp[j*ni+i].y - 3; } } } else { atmp[j*ni+i].y = atmp[j*ni+i-1].y; etmp[j*ni+i].y = etmp[j*ni+i-1].y; } } } for (i = 0, j = 1; i < editwin; i++, j++) { while (!editorwin[j]) j++; cn->f[j]->a = e_set_pnt(atmp[i].x, atmp[i].y); cn->f[j]->e = e_set_pnt(etmp[i].x, etmp[i].y); cn->f[j]->zoom = 0; /* Make sure zoom is off */ } ini_repaint(cn); for ( i = 1; i < cn->mxedt; i++) { e_firstl(cn->f[i], 0); e_schirm(cn->f[i], 0); } e_firstl(cn->f[i], 1); e_schirm(cn->f[i], 1); e_cursor(cn->f[i], 1); end_repaint(); return(0); } /* call next window */ int e_ed_next(FENSTER *f) { if (f->ed->mxedt > 0) e_switch_window(f->ed->edt[1], f); return(0); } /* write a line (screen content) */ void e_pr_line(int y, FENSTER *f) { BUFFER *b = f->b; SCHIRM *s = f->s; int i, j, k, frb; #ifdef DEBUGGER int fsw = 0; #endif for (i = j = 0; j < NUM_COLS_OFF_SCREEN_LEFT; j++, i++) { if (*(b->bf[y].s + i) == WPE_TAB) j += (f->ed->tabn - j % f->ed->tabn - 1); else if(((unsigned char) *(b->bf[y].s + i)) > 126) { j++; if (((unsigned char) *(b->bf[y].s + i)) < 128 + ' ') j++; } else if (*(b->bf[y].s + i) < ' ') j++; } if (j > NUM_COLS_OFF_SCREEN_LEFT) i--; #ifdef DEBUGGER for (j = 1; j <= s->brp[0]; j++) if (s->brp[j] == y) { fsw = 1; break; } for (j = NUM_COLS_OFF_SCREEN_LEFT; i < b->bf[y].len && j < COL_NUM_ON_SCREEN_RIGHT; i++, j++) { if (y == s->da.y && i >= s->da.x && i < s->de.x ) frb = s->fb->dy.fb; else if (fsw) frb = s->fb->db.fb; /* else if( (i == s->pt[0].x && y == s->pt[0].y) || (i == s->pt[1].x && y == s->pt[1].y) */ else if (y == s->fa.y && i >= s->fa.x && i < s->fe.x ) frb = s->fb->ek.fb; #else for (j = NUM_COLS_OFF_SCREEN_LEFT; i < b->bf[y].len && j < COL_NUM_ON_SCREEN_RIGHT; i++, j++) { if (y == s->fa.y && i >= s->fa.x && i < s->fe.x ) frb = s->fb->ek.fb; #endif /* if( (i == s->pt[0].x && y == s->pt[0].y) || (i == s->pt[1].x && y == s->pt[1].y) || (i == s->pt[2].x && y == s->pt[2].y) || (i == s->pt[3].x && y == s->pt[3].y) || (i == s->pt[4].x && y == s->pt[4].y) || (i == s->pt[5].x && y == s->pt[5].y) || (i == s->pt[6].x && y == s->pt[6].y) || (i == s->pt[7].x && y == s->pt[7].y) || (i == s->pt[8].x && y == s->pt[8].y) || (i == s->pt[9].x && y == s->pt[9].y)) frb = s->fb->ek.fb; */ else if ((y < s->mark_end.y && ( y > s->mark_begin.y || (y == s->mark_begin.y && i >= s->mark_begin.x) ) ) || (y == s->mark_end.y && i < s->mark_end.x && ( y > s->mark_begin.y || (y == s->mark_begin.y && i >= s->mark_begin.x) ) ) ) frb = s->fb->ez.fb; else frb = s->fb->et.fb; if (f->dtmd == DTMD_HELP) { if (*(b->bf[y].s + i) == HBG || *(b->bf[y].s + i) == HFB || *(b->bf[y].s + i) == HHD || *(b->bf[y].s + i) == HBB) { if (*(b->bf[y].s + i) == HHD) frb = s->fb->hh.fb; else if(*(b->bf[y].s + i) == HBB) frb = s->fb->hm.fb; else frb = s->fb->hb.fb; #ifdef NEWSTYLE if (*(b->bf[y].s + i) != HBB) k = j; else k = -1; #endif for (i++; b->bf[y].s[i] != HED && i < b->bf[y].len && j < COL_NUM_ON_SCREEN_RIGHT; i++, j++) e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, *(b->bf[y].s + i), frb); j--; #ifdef NEWSTYLE if (WpeIsXwin() && k >= 0) e_make_xrect(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + k + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, 0); #endif continue; } else if (*(b->bf[y].s + i) == HFE) { for (; j < COL_NUM_ON_SCREEN_RIGHT; j++) e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, ' ', s->fb->hh.fb); return; } else if (*(b->bf[y].s + i) == HNF) { for (k = j, i++; b->bf[y].s[i] != ':' && i < b->bf[y].len && j < COL_NUM_ON_SCREEN_RIGHT; i++, j++) e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, *(b->bf[y].s + i), s->fb->hb.fb); #ifdef NEWSTYLE if (WpeIsXwin()) e_make_xrect(f->a.x-NUM_COLS_OFF_SCREEN_LEFT+k+1, y-NUM_LINES_OFF_SCREEN_TOP+f->a.y+1, f->a.x-NUM_COLS_OFF_SCREEN_LEFT+j, y-NUM_LINES_OFF_SCREEN_TOP+f->a.y+1, 0); #endif for (; b->bf[y].s[i] != HED && i < b->bf[y].len && j < COL_NUM_ON_SCREEN_RIGHT; i++, j++) e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, *(b->bf[y].s + i), frb); for (i++; b->bf[y].s[i] != HED && i < b->bf[y].len && j < COL_NUM_ON_SCREEN_RIGHT; i++, j++) e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, ' ', frb); for (; b->bf[y].s[i] != '.' && i < b->bf[y].len && j < COL_NUM_ON_SCREEN_RIGHT; i++, j++) e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, ' ', frb); j--; continue; } else if (*(b->bf[y].s + i) == HED) { j--; continue; } } if (*(b->bf[y].s + i) == WPE_TAB) for (k = f->ed->tabn - j % f->ed->tabn; k > 1 && j < NUM_COLS_ON_SCREEN + NUM_COLS_OFF_SCREEN_LEFT - 2; k--, j++) e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, ' ', frb); else if (!WpeIsXwin() && ((unsigned char)*(b->bf[y].s + i)) > 126) { e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j +1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, '@', frb); if (++j >= COL_NUM_ON_SCREEN_RIGHT) return; if (((unsigned char)*(b->bf[y].s + i)) < 128 + ' ' && j < COL_NUM_ON_SCREEN_RIGHT) { e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j +1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, '^', frb); if (++j >= COL_NUM_ON_SCREEN_RIGHT) return; } } else if (*(b->bf[y].s + i) < ' ') { e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j +1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, '^', frb); if (++j >= COL_NUM_ON_SCREEN_RIGHT) return; } if (*(b->bf[y].s + i) == WPE_TAB) e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, ' ', frb); else if (!WpeIsXwin() && ((unsigned char)*(b->bf[y].s + i)) > 126 && j < COL_NUM_ON_SCREEN_RIGHT) { if (((unsigned char)*(b->bf[y].s + i)) < 128 + ' ') e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, ((unsigned char) *(b->bf[y].s + i)) + 'A' - 129, frb); else e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, ((unsigned char) *(b->bf[y].s + i)) - 128, frb); } else if (*(b->bf[y].s + i) < ' ' && j < COL_NUM_ON_SCREEN_RIGHT) e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, *(b->bf[y].s + i) + 'A' - 1, frb); else e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, *(b->bf[y].s + i), frb); } if ((i == b->bf[y].len) && (f->ed->edopt & ED_SHOW_ENDMARKS) && (DTMD_ISMARKABLE(f->dtmd)) && (j < COL_NUM_ON_SCREEN_RIGHT)) { if ((y < s->mark_end.y && ( y > s->mark_begin.y || (y == s->mark_begin.y && i >= s->mark_begin.x) ) ) || (y == s->mark_end.y && i < s->mark_end.x && ( y > s->mark_begin.y || (y == s->mark_begin.y && i >= s->mark_begin.x) ) ) ) { if (*(b->bf[y].s + i) == WPE_WR) e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, PWR, s->fb->ez.fb); else e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, PNL, s->fb->ez.fb); } else { if (*(b->bf[y].s + i) == WPE_WR) e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, PWR, s->fb->et.fb); else e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, PNL, s->fb->et.fb); } j++; } for (; j < COL_NUM_ON_SCREEN_RIGHT; j++) e_pr_char(f->a.x - NUM_COLS_OFF_SCREEN_LEFT + j + 1, y - NUM_LINES_OFF_SCREEN_TOP + f->a.y + 1, ' ', s->fb->et.fb); } /* draw standard-box frame */ void e_std_rahmen(int xa, int ya, int xe, int ye, char *name, int sw, int frb, int fes) { int i; char rhm[2][6]; char *short_name; rhm[0][0] = RE1; rhm[0][1] = RE2; rhm[0][2] = RE3; rhm[0][3] = RE4; rhm[0][4] = RE5; rhm[0][5] = RE6; rhm[1][0] = RD1; rhm[1][1] = RD2; rhm[1][2] = RD3; rhm[1][3] = RD4; rhm[1][4] = RD5; rhm[1][5] = RD6; for (i = xa + 1; i < xe; i++) { e_pr_char(i, ya, rhm[sw][4], frb); e_pr_char(i, ye, rhm[sw][4], frb); } for (i = ya + 1; i < ye; i++) { e_pr_char(xa, i, rhm[sw][5], frb); e_pr_char(xe, i, rhm[sw][5], frb); } e_pr_char(xa, ya, rhm[sw][0], frb); e_pr_char(xa, ye, rhm[sw][2], frb); e_pr_char(xe, ya, rhm[sw][1], frb); e_pr_char(xe, ye, rhm[sw][3], frb); if (name) { if (strlen(name) < xe - xa - 14) e_pr_str((xa+xe-strlen(name))/2, ya, name, frb, 0, 0, 0, 0); else { short_name = strdup(name); strcpy(short_name + xe - xa - 17, "..."); e_pr_str(xa + 7, ya, short_name, frb, 0, 0, 0, 0); free(short_name); } } if (sw != 0) { e_pr_char(xa+3, ya, WBT, fes); #ifdef NEWSTYLE if (!WpeIsXwin()) #endif { e_pr_char(xa+2, ya, '[', frb); e_pr_char(xa+4, ya, ']', frb); } #ifdef NEWSTYLE else e_make_xrect(xa+2, ya, xa+4, ya, 0); } if (WpeIsXwin()) e_make_xr_rahmen(xa, ya, xe, ye, sw); #else } /* if(xe < MAXSCOL-1) for(i = ya+1; i <= ye; i++) e_pt_col(xe+1, i, SHDCOL); if(ye < MAXSLNS-2) for(i = xa+1; i <= xe+1 && i < MAXSCOL; i++) e_pt_col(i, ye+1, SHDCOL); */ #endif } struct dirfile *e_add_df(char *str, struct dirfile *df) { int i, n; char *tmp; if (df == NULL) { df = MALLOC(sizeof(struct dirfile)); df->anz = 0; df->name = MALLOC(sizeof(char*)); } for(n = 0; n < df->anz && *df->name[n] && strcmp(df->name[n], str); n++); if(n == df->anz) { if(df->anz == MAXSVSTR - 1) FREE(df->name[df->anz-1]); else { df->anz++; df->name = REALLOC(df->name, df->anz * sizeof(char*)); } for(i = df->anz-1; i > 0; i--) df->name[i] = df->name[i-1]; df->name[0] = MALLOC((strlen(str)+1) * sizeof(char)); strcpy(df->name[0], str); } else { tmp = df->name[n]; for(i = n; i > 0; i--) df->name[i] = df->name[i-1]; if(!tmp[0]) { FREE(tmp); df->name[0] = MALLOC((strlen(str) + 1) * sizeof(char)); strcpy(df->name[0], str); } else df->name[0] = tmp; } return(df); } int e_sv_window(int xa, int ya, int *n, struct dirfile *df, FENSTER *f) { ECNT *cn = f->ed; int ret, ye = ya + 6; int xe = xa +21; FLWND *fw = MALLOC(sizeof(FLWND)); if ((f = (FENSTER *) MALLOC(sizeof(FENSTER))) == NULL) e_error(e_msg[ERR_LOWMEM], 1, cn->fb); if (xe > MAXSCOL-3) { xe = MAXSCOL - 3; xa = xe - 21; } if (ye > MAXSLNS-3) { ye = MAXSLNS - 3; ya = ye - 6; } f->fb = cn->fb; f->a = e_set_pnt(xa, ya); f->e = e_set_pnt(xe, ye); f->dtmd = DTMD_FILEDROPDOWN; f->zoom = 0; f->ed = cn; f->c_sw = NULL; f->c_st = NULL; f->fd.dirct = NULL; f->winnum = -1; f->datnam = ""; if (!(f->pic = e_ed_kst(f, NULL, 1))) { e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(0); } f->b = (BUFFER *)fw; fw->mxa = xa; fw->mxe = xe; fw->mya = ya; fw->mye = ye; fw->xa = xa+1; fw->xe = xe; fw->ya = ya+1; fw->ye = ye; fw->df = df; fw->srcha = 0; fw->f = f; fw->nf = fw->ia = fw->ja = 0; do { ret = e_file_window(0, fw, f->fb->er.fb, f->fb->ez.fb); #if MOUSE if (ret < 0) ret = e_rahmen_mouse(f); #endif if ((ret == AF2 && !(f->ed->edopt & ED_CUA_STYLE)) || (f->ed->edopt & ED_CUA_STYLE && ret == CtrlL)) e_size_move(f); } while(ret != WPE_CR && ret != WPE_ESC); *n = fw->nf; e_close_view(f->pic, 1); FREE(fw); FREE(f); return(ret); } int e_schr_lst_wsv(char *str, int xa, int ya, int n, int len, int ft, int fz, struct dirfile **df, FENSTER *f) { #if MOUSE extern struct mouse e_mouse; #endif int ret, num; do { *df = e_add_df(str, *df); #ifndef NEWSTYLE ret = e_schreib_leiste(str, xa, ya, n-4, len, ft, fz); #else ret = e_schreib_leiste(str, xa, ya, n-3, len, ft, fz); #endif #if MOUSE if(ret < 0 && e_mouse.y == ya && e_mouse.x >= xa+n-3 && e_mouse.x <= xa+n-1) ret = CDO; #endif if (ret == CDO && e_sv_window(xa+n, ya, &num, *df, f) == WPE_CR) strcpy(str, (*df)->name[num]); } while(ret == CDO); return(ret); } int e_schr_nchar_wsv(char *str, int x, int y, int n, int max, int col, int csw) #ifdef NEWSTYLE { e_pr_char(x+max-3, y, ' ', csw); e_pr_char(x+max-2, y, WSW, csw); e_pr_char(x+max-1, y, ' ', csw); e_make_xrect(x+max-3, y, x+max-1, y, 0); return(e_schr_nchar(str, x, y, n, max-3, col)); } #else { #if !defined(NO_XWINDOWS) int swcol = (e_gt_col(x+max, y) / 16) * 16; if (WpeIsXwin()) { e_pr_char(x+max, y, SCR, swcol); e_pr_char(x+max, y+1, SCD, swcol); e_pr_char(x+max-1, y+1, SCD, swcol); e_pr_char(x+max-2, y+1, SCD, swcol); } #endif e_pr_char(x+max-3, y, ' ', csw); e_pr_char(x+max-2, y, WSW, csw); e_pr_char(x+max-1, y, ' ', csw); return(e_schr_nchar(str, x, y, n, max-4, col)); } #endif int e_mess_win(char *header, char *str, PIC **pic, FENSTER *f) { ECNT *cn = f->ed; extern int (*e_u_kbhit)(void); #if MOUSE extern struct mouse e_mouse; #endif int xa, ya, xe, ye, num, anz = 0, mxlen = 0, i, j; char **s; s = StringToStringArray(str, &mxlen, strlen(header) + 8, &anz); ya = (MAXSLNS - anz - 6)/2; ye = ya + anz + 5; xa = (MAXSCOL - mxlen - 6)/2; xe = xa + mxlen + 6; if (ya < 2) ya = 2; if (ye > MAXSLNS-3) ye = MAXSLNS - 3; num = anz; if (num > ye - ya - 5) { num = ye - ya - 5; strcpy(s[num-1], "..."); } if (!(*pic) || (*pic)->e.x != xe || (*pic)->a.x != xa || (*pic)->e.x < xe) { *pic = e_change_pic(xa, ya, xe, ye, *pic, 1, cn->fb->nt.fb); for (i = xa + 1; i < xe; i++) { e_pr_char(i, ye-2, ' ', f->fb->nt.fb); e_pr_char(i, ye-1, ' ', f->fb->nt.fb); } e_pr_str((xe + xa - 6)/2, ye-2, "Ctrl C", cn->fb->nz.fb, -1, -1, cn->fb->ns.fb, cn->fb->nt.fb); } e_std_rahmen(xa, ya, xe, ye, header, 1, cn->fb->nr.fb, cn->fb->ne.fb); for (i = xa + 1; i < xe; i++) e_pr_char(i, ya+1, ' ', cn->fb->nr.fb); for (j = 0; j < num; j++) { e_pr_char(xa+1, ya+2+j, ' ', cn->fb->nt.fb); e_pr_char(xa+2, ya+2+j, ' ', cn->fb->nt.fb); e_pr_str(xa+3, ya+2+j, s[j], cn->fb->nt.fb, 0, 0, 0, 0); for (i = xa+strlen(s[j])+3; i < xe; i++) e_pr_char(i, ya+2+j, ' ', cn->fb->nt.fb); } for (j += ya+2; j < ye-2; j++) for (i = xa + 1; i < xe; i++) e_pr_char(i, j, ' ', cn->fb->nt.fb); for (i = 0; i < anz; i++) FREE(s[i]); FREE(s); #ifndef NO_XWINDOWS if (WpeIsXwin()) { while ((i = (*e_u_kbhit)())) { if (i == -1 && e_mouse.y == ye-2 && e_mouse.x > (xe + xa - 10)/2 && e_mouse.x < (xe + xa + 6)/2 ) i = CtrlC; if (i == CtrlC) break; } } else #endif while ((i = (*e_u_kbhit)()) && i != CtrlC) ; return(i == CtrlC ? 1 : 0); } int e_opt_sec_box(int xa, int ya, int num, OPTK *opt, FENSTER *f, int sw) { PIC *pic; int n, nold, max = 0, i, c = 0, xe, ye = ya + num + 1; for(i = 0; i < num; i++) if((n = strlen(opt[i].t)) > max) max = n; xe = xa + max + 3; pic = e_std_kst(xa, ya, xe, ye, NULL, sw, f->fb->nr.fb, f->fb->nt.fb, f->fb->ne.fb); if(pic == NULL) { e_error(e_msg[ERR_LOWMEM], 0, f->fb); return(-2); } for (i = 0; i < num; i++) e_pr_str_wsd(xa+2, ya+i+1, opt[i].t, f->fb->mt.fb, opt[i].x, 1, f->fb->ms.fb, xa+1, xe-1); #if MOUSE while (e_mshit() != 0); #endif n = 0; nold = 1; while (c != WPE_ESC && c != WPE_CR) { if (nold != n) { e_pr_str_wsd(xa+2, nold+ya+1, opt[nold].t, f->fb->mt.fb, opt[nold].x, 1, f->fb->ms.fb, xa+1, xe-1); e_pr_str_wsd(xa+2, n+ya+1, opt[n].t, f->fb->mz.fb, opt[n].x, 1, f->fb->mz.fb, xa+1, xe-1); nold = n; } #if MOUSE if( (c = e_toupper(e_getch())) == -1) c = e_m2_mouse(xa, ya, xe, ye, opt); #else c = e_toupper(e_getch()); #endif for (i = 0; i < ye - ya - 1; i++) if( c == opt[i].o) { c = WPE_CR; n = i; break; } if (i > ye - ya) c = WPE_ESC; else if ( c == CUP || c == CtrlP ) n = n > 0 ? n-1 : ye - ya - 2 ; else if ( c == CDO || c == CtrlN ) n = n < ye-ya-2 ? n+1 : 0 ; else if ( c == POS1 || c == CtrlA ) n = 0; else if ( c == ENDE || c == CtrlE ) n = ye-ya-2; } if(sw == 1) e_close_view(pic, 1); return(c == WPE_ESC ? -1 : n); } struct dirfile *e_make_win_list(FENSTER *f) { int i; struct dirfile *df; if (!(df = MALLOC(sizeof(struct dirfile)))) return(NULL); df->anz = f->ed->mxedt; if (!(df->name = MALLOC(df->anz * sizeof(char *)))) { FREE(df); return(NULL); } for (i = 0; i < df->anz; i++) { if (f->ed->f[df->anz-i]->datnam) { if (!(df->name[i] = MALLOC((strlen(f->ed->f[df->anz-i]->datnam)+1) * sizeof(char)))) { df->anz = i; freedf(df); return(NULL); } else strcpy(df->name[i], f->ed->f[df->anz-i]->datnam); } else { if (!(df->name[i] = MALLOC(sizeof(char)))) { df->anz = i; freedf(df); return(NULL); } else *df->name[i] = '\0'; } } return(df); } int e_list_all_win(FENSTER *f) { int i; for (i = f->ed->mxedt; i > 0; i--) if (f->ed->f[i]->dtmd == DTMD_DATA && f->ed->f[i]->ins == 7) { e_switch_window(f->ed->edt[i], f); return(0); } return(e_data_first(7, f->ed, NULL)); } #ifdef NEWSTYLE int e_get_pic_xrect(int xa, int ya, int xe, int ye, PIC *pic) { int i = xa, j, ebbg; ebbg = (xe - xa + 1) * 2 * (ye - ya + 1); for (j = ya; j <= ye; ++j) for (i = xa; i <= xe; ++i) *( pic->p + ebbg + (j-ya)*(xe-xa+1) + (i-xa) ) = extbyte[j*MAXSCOL + i]; return(i); } int e_put_pic_xrect(PIC *pic) { int i = 0, j; int ebbg = (pic->e.x - pic->a.x + 1) * 2 * (pic->e.y - pic->a.y + 1); for (j = pic->a.y; j <= pic->e.y; ++j) for (i = pic->a.x; i <= pic->e.x; ++i) extbyte[j*MAXSCOL+i] = *(pic->p + ebbg + (j-pic->a.y)*(pic->e.x-pic->a.x+1) + (i-pic->a.x)); return(i); } int e_make_xrect_abs(int xa, int ya, int xe, int ye, int sw) { int j; for (j = xa; j <= xe; j++) *(extbyte+ya*MAXSCOL+j) = *(extbyte+ye*MAXSCOL+j) = 0; for (j = ya; j <= ye; j++) *(extbyte+j*MAXSCOL+xa) = *(extbyte+j*MAXSCOL+xe) = 0; return(e_make_xrect(xa, ya, xe, ye, sw)); } int e_make_xrect(int xa, int ya, int xe, int ye, int sw) { int j; if (sw & 2) { sw = (sw & 1) ? 16 : 0; for (j = xa+1; j < xe; j++) { *(extbyte+ya*MAXSCOL+j) |= (sw | 4); *(extbyte+ye*MAXSCOL+j) |= (sw | 1); } for (j = ya+1; j < ye; j++) { *(extbyte+j*MAXSCOL+xa) |= (sw | 2); *(extbyte+j*MAXSCOL+xe) |= (sw | 8); } } else { sw = (sw & 1) ? 16 : 0; for (j = xa; j <= xe; j++) { *(extbyte+ya*MAXSCOL+j) |= (sw | 1); *(extbyte+ye*MAXSCOL+j) |= (sw | 4); } for (j = ya; j <= ye; j++) { *(extbyte+j*MAXSCOL+xa) |= (sw | 8); *(extbyte+j*MAXSCOL+xe) |= (sw | 2); } } return(j); } int e_make_xr_rahmen(int xa, int ya, int xe, int ye, int sw) { if (!sw) { e_make_xrect(xa, ya, xe, ye, 0); e_make_xrect(xa, ya, xe, ye, 2); } else { e_make_xrect(xa+1, ya, xe-1, ya, 0); e_make_xrect(xa+1, ye, xe-1, ye, 0); e_make_xrect(xa, ya+1, xa, ye-1, 0); e_make_xrect(xe, ya+1, xe, ye-1, 0); e_make_xrect(xa, ya, xa, ya, 0); e_make_xrect(xe, ya, xe, ya, 0); e_make_xrect(xe, ye, xe, ye, 0); e_make_xrect(xa, ye, xa, ye, 0); } return(sw); } #endif xwpe-1.5.30a/wpe.10000644000076400007640000000004610263105405012627 0ustar dulsidulsi.so man1/xwpe.1 .\" @(#)wpe.1 3/22/94 xwpe-1.5.30a/xwe.10000644000076400007640000000004610263105405012637 0ustar dulsidulsi.so man1/xwpe.1 .\" @(#)xwe.1 3/22/94 xwpe-1.5.30a/xwpe.1_eng0000644000076400007640000002250010263105405013647 0ustar dulsidulsi.\" t .\" @(#)xwpe.1 5/3/99 .de EX \"Begin example .ne 5 .if n .sp 1 .if t .sp .5 .nf .in +.5i .. .de EE .fi .in -.5i .if n .sp 1 .if t .sp .5 .. .ta .3i .6i .9i 1.2i 1.5i 1.8i .TH xwpe alpha "May 3, 1999" .UC .SH NAME xwpe, xwe, wpe, we \- X-Window Programming Environment .SH SYNOPSIS .EX \fBxwpe\fP [ \fIoptions\fP ] file ... \fBxwe\fP [ \fIoptions\fP ] file ... \fBwpe\fP [ \fIoptions\fP ] file ... \fBwe\fP [ \fIoptions\fP ] file ... .EE .SH DESCRIPTION Xwpe can be used with or without the programming interface. It has its own X interface but can be used also on a character terminal. \fIxwpe\fP fires up the X interface together with the programming interface. \fIxwe\fP is the X version but without the special features of the programming interface. In connection with a simple character terminal you can use \fIwpe\fP to program and \fIwe\fP as editor. Xwpe is a X-window programming environment designed for use on UNIX-systems. It is similar to the 'Borland C++ or Turbo Pascal' environments. The differences between the programming environments from Borland and xwpe is that many compilers, linkers, and debuggers can be used in xwpe. Menus and commands are accessible via both the keyboard and mouse. Errors that occur while compiling and linking a program can be examined in the sources. The cursor will jump to the corresponding line in the source-file. Programs using more than one source-file can be managed with the so called "project-option" (see also \fIproject-file\fP). The program can be started from within the \fIProgramming-Environment\fP and errors may be found using a debugger. The \fIdebugging-environment\fP allows the user to set and unset breakpoints directly in the source code. The contents of variables may be displayed in a special window, the \fIWatch-Window\fP. This window is updated while reaching a breakpoint. The \fIStack-Window\fP displays the program stack. Help is available for xwpe and the man-pages installed on the system may be displayed. All this can be reached via the \fIhelp-functions\fP. The \fIeditor\fP may be used to edit up to 35 files at the same time. They are all displayed in a window of their own. A \fImouse\fP is used to select special editor functions from the top menu. These functions can also be selected by hitting a \fIspecial key\fP or combinations of keys. Some of these features are a complete search and replace function (yes, it can search for regular expressions) and a \fIfile-manager\fP. The file-manager is used to open, copy, rename and move or delete files. The X-window programming environment can be used without the special programming features. If it is invoked as `\fIxwe\fP' (`\fIwe\fP' if used with a character terminal) it can be used as an editor e.g. for shell-programming. .SH OPTIONS .IP "\fB-pm\fP" The next file is a message-file. .IP "\fB-r\fP" Start \fIxwpe\fP in the \fIrecover mode\fP. The internal buffers are saved in files with the postfix `.ESV' in the name if a signal is caught by \fIxwpe\fP (except for SIGKILL). If the editor is invoked with the `-r' option is specified in the command line, the old session will be recovered. .IP "\fB-sf \fIfile\fP" \fIfile\fP will be used instead of the personal option file, \fI$HOME/.xwpe/xwperc\fP. .IP "\fB-so\fP" The default options are used. The option file will not be read. .PP The following standard X command line options are available for the X-Window versions. .IP "\fB-display \fIdisplay\fP" This option specifies the X server to contact; see \fIX(1)\fP. .IP "\fB-font \fIfont, \fB-fn \fIfont\fP" The font to used for the text can be specified with this option. The default is \fI8x13\fP. .IP "\fB-geometry \fIgeometry, \fB-g \fIgeometry\fP" This option specifies the preferred size and and position of the editor; see \fIX(1)\fP. .IP "\fB-iconic\fP" This indicates that \fIxwpe\fP should ask the window manager to start as icon rather than a normal window. .IP "\fB-pcmap\fP" This starts \fIxwpe\fP with a private colormap. .SH INVOCATION On startup (subject to the \fB-sf\fP and \fB-so\fP options), xwpe reads the personal initialization file \fI$HOME/.xwpe/xwperc\fP. If no such file exists, the system wide initialization file, \fI/usr/local/lib/xwpe/xwperc\fP, is read. If neither file exists, the default options will be used. \fIxwperc\fP is a text file written by the programming environment. Although modification by hand is possible comments will be erased if the options are latter saved from within xwpe. .SH RESOURCES The following resources are available. The application name is either "xwe" or "xwpe". Both belong to the "Xwpe" class. .IP "\fBfont (\fPclass \fBFont)\fP" Specifies the name of the font to use. The default is ``8x13.'' .IP "\fBgeometry (\fPclass \fBGeometry)\fP" Specifies the preferred size and position of the editor. Sizes of less than 80 x 25 are ignored. .IP "\fBcolor1 (\fPclass \fBColor1)\fP" .IP "\fB...\fP" .IP "\fBcolor16 (\fPclass \fBColor16)\fP" \fIxwpe\fP uses 16 colors. The default setting is similar to the PC-color set. .SH SYNTAX-SUPPORT: Xwpe supports the syntax of a language by using different colors to display \fIkeywords\fP, \fIconstants\fP, \fIpreprocessor\fP, \fIcomments\fP, \fIoperators\fP and everything else. This support is defined already for the programming languages C, C++, and FORTRAN. More languages can be added to the user's syntax definition file, \fI$HOME/.xwpe/syntax_def\fP. The syntax of any predefined language can also be overridden. If no personal syntax definition file exists, the system definition file, \fI/usr/local/lib/xwpe/syntax_def\fP, will be used. Each syntax highlighting is distinguished by the file extension. The \fIsyntax_def\fP uses the following format for language definition. .\" Everything after this point needs fixing. .EX "string: The postfix for the filename." "integer: The number of keywords." "strings: The keywords." "integer: Number of operators with more than one character length." "strings: Operators with more than one character length." "string: Operators containing one character." "string: Beginning of comment" "string: End of comment" "string: Beginning of comment reaching until the end of the line." "string: Characters used for comments depending on the column." "string: Special single characters." "integer: Column for comments (-1 for none)." "integer: Column for continuing line (-1 for none)" "Integer: Column for comment till the end of line (1000 for none)" .EE Strings and integers are separated by blanks or carriage returns. The strings used for single character operators and for column depending comments must not contain blanks. All strings used for comments can contain NULL to indicate that there is no such comment. An integer can be zero if there is no keyword or multiple character operators. The string for special single characters contains the following fields: .EX Character for string-constants Character for character-constants Character for preprocessor-commands Character for quoting the next character Character for next line is continuing line (if it is the last character in the line) Character (if not empty: the language is not case sensitive) .EE If one character is not defined (e.g. missing) a blank is inserted at the corresponding position. An example: .EX .c 32 auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while 0 ~^()[]{}<>+-/*%=|&!.?:,; /* */ NULL NULL "'#\\ -1 -1 1000 .f 64 ACCESS ASSIGN BACKSPACE BLANK BLOCKDATA CALL CHARACTER CLOSE COMMON COMPLEX CONTINUE DATA DIMENSION DIRECT DO DOUBLE PRECISION ELSE END ENDFILE ENTRY EQUIVALENCE ERR EXIST EXTERNAL FILE FMT FORM FORMAT FORMATTED FUNCTION GOTO IF IMPLICIT INQUIRE INTEGER INTRINSIC IOSTAT LOGICAL NAME NAMED NEXTREC NUMBER OPEN OPENED PARAMETER PAUSE PRINT PROGRAM READ REAL REC RECL RETURN REWIND SAVE SEQUENTIAL STATUS STOP SUBROUTINE TO UNFORMATED UNIT WRITE 13 .AND. .EQ. .EQV. .FALSE. .GE. .GT. .LE. .LT. .NE. .NEQV. .NOT. .OR. .TRUE. ()+-/*=$.:, NULL NULL ! C* ' 1 0 5 72 .EE .SH COPYRIGHTS Copyright (C) 1993 Fred Kruse Xwpe is free. Anyone may redistribute copies of xwpe to anyone under the terms stated in the \fIGNU General Public License\fP. The author assumes no responsibility for errors or omissions or damages resulting from the use of xwpe or this manual. .SH MAINTAINER Send questions or problems to Dennis Payne, dulsi@identicalsoftware.com. .SH BUGS Debugging leaks memory. The exact cause is still unknown. Unsure if the column for continuing previous line is working. Information on how to test this and what the result should be would be greatly appreciated. Documentation hasn't been updated. Compilers are assumed to have a -c and -o option. This causes problems for those who wish to use java, perl, or other languages. \fBmake install\fP installs x versions even if not compiled in. Adding items when no project is open has odd behavior. Changing the maximum column and using cut & paste can crash xwpe. Clicking "edit" in the project menu when not on a file it loads a file with a name of " ". Esc key requires 3 presses to do the regular escape function under Linux console (and perhaps other terminal types). No error for disk full. Check headers doesn't correctly handle comments and "ifndef" protection. xwpe-1.5.30a/messages.h0000644000076400007640000000433610263105405013740 0ustar dulsidulsi/* messages.h */ /* Copyright (C) 1997 Stefan Hille */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #ifndef MESSAGES_H #define MESSAGES_H /* errors defined in e_msg */ #define ERR_LOWMEM 0 #define ERR_VER_OPF 1 #define ERR_READ_OPF 2 #define ERR_MAXWINS 3 #define ERR_GETSTRING 4 #define ERR_FOPEN 5 #define ERR_FCLOSE 6 #define ERR_UNDO 7 #define ERR_EXEC 8 #define ERR_COMMAND 9 #define ERR_HITCR 10 #define ERR_NOTINSTALL 11 #define ERR_OPEN_OPF 12 #define ERR_WRITE_OPF 13 #define ERR_MSG_SAVE 14 #define ERR_MSG_SAVEALL 15 #define ERR_NOPRINT 16 #define ERR_REDO 17 #define ERR_WORKDIRACCESS 18 #define ERR_HOMEDIRACCESS 19 #define ERR_SYSTEM 20 #define ERR_NOWASTE 21 #define ERR_NONEWDIR 22 #define ERR_ACCFILE 23 #define ERR_DELFILE 24 #define ERR_LINKFILE 25 #define ERR_NEWDIREXIST 26 #define ERR_CHGPERM 27 #define ERR_RENFILE 28 #define ERR_OREADFILE 29 #define ERR_OWRITEFILE 30 #define ERR_ALLOC_CBUF 31 #define ERR_INCONSCOPY 32 /* errors defined in e_p_msg */ #define ERR_NO_CFILE 0 #define ERR_PIPEOPEN 1 #define ERR_PROCESS 2 #define ERR_PIPEEXEC 3 #define ERR_IN_COMMAND 4 #define ERR_RETCODE 5 #define ERR_S_NO_CFILE 6 #define ERR_NO_COMPILER 7 #define ERR_NOTHING 8 #define ERR_NOPROJECT 9 /* errors defined in e_d_msg */ #define ERR_CTRLCPRESS 0 #define ERR_QUITDEBUG 1 #define ERR_ENDDEBUG 2 #define ERR_NOTRUNNING 3 #define ERR_NOSYMBOL 4 #define ERR_NOSOURCE 5 #define ERR_STARTDEBUG 6 #define ERR_CANTDEBUG 7 #define ERR_STARTPROG 8 #define ERR_CANTPROG 9 #define ERR_PROGEXIT 10 #define ERR_PROGTERM 11 #define ERR_PROGSIGNAL 12 #define ERR_UNKNOWNBRK 13 #define ERR_CANTFILE 14 #define ERR_CANTPIPE 15 #define ERR_BREAKPOINT 16 #define ERR_SIGNAL 17 #define ERR_PROGEXIT2 18 #define ERR_SIGNAL2 19 #define ERR_INTERRUPT 20 #define ERR_STOPPEDIN 21 #define ERR_BREAKPOINT2 22 #define ERR_NORMALTERM 23 #define ERR_SOFTTERM 24 #define ERR_CONTINUE 25 #define ERR_NOSTACK 26 #define ERR_NOPROCESS 27 #endif xwpe-1.5.30a/WeXterm.c0000644000076400007640000004110210263105405013507 0ustar dulsidulsi/*-------------------------------------------------------------------------*\ -- Xwpe routines for X window support Date Programmer Description 05/04/97 Dennis Created based on functions from "we_xterm.c". \*-------------------------------------------------------------------------*/ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ Original header of "we_xterm.c" \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* we_xterm.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ #ifndef NO_XWINDOWS /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ Includes \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #include #include "Xwpe.h" #include "WeXterm.h" /* needed for the time being to call old routines */ #include "model.h" #include "edit.h" #ifndef DEFAULT_ALTMASK #if defined(__linux__) || defined(__osf__) /* a.r. */ #define DEFAULT_ALTMASK Mod1Mask #else #define DEFAULT_ALTMASK Mod4Mask #endif #endif /* Information from X that is needed throughout execution */ WpeXStruct WpeXInfo; /* Standard colors (after initialization pointers may not be valid) */ static char *WpeXColorNames[16] = { "Black", "Red3", "Forest Green", "Brown", "Dark Slate Blue", "Violet Red", "Turquoise3", "Light Gray", "Dark Slate Grey", "Red1", "Green", "Yellow", "Blue", "Violet", "Turquoise1", "White" }; #define OPTION_TABLE_SIZE 7 /* Translation table for command line option to X resources */ static XrmOptionDescRec WpeXOptionTable[OPTION_TABLE_SIZE] = { {"-display", ".display", XrmoptionSepArg, (XPointer) NULL}, {"-fn", ".font", XrmoptionSepArg, (XPointer) NULL}, {"-font", ".font", XrmoptionSepArg, (XPointer) NULL}, {"-g", ".geometry", XrmoptionSepArg, (XPointer) NULL}, {"-geometry", ".geometry", XrmoptionSepArg, (XPointer) NULL}, {"-iconic", ".iconic", XrmoptionNoArg, (XPointer) "on"}, {"-pcmap", ".pcmap", XrmoptionNoArg, (XPointer) "on"} }; /* Shape for mouse in X */ static int WpeXMouseDefault[WpeLastShape] = {132, 142, 150, 88, 124}; static Cursor WpeXMouseCursor[WpeLastShape]; /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeXFontGet - Get font settings from the X resources. Parameters: xresdb (In) X resource database name_list (In) Name quark list (second element unset) class_list (In) Class quark list (second element unset) \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ void WpeXFontGet(XrmDatabase xresdb, XrmQuark *name_list, XrmQuark *class_list) { char *font_name = "8x13"; XrmRepresentation return_value; XrmValue xval; name_list[1] = XrmStringToQuark("font"); class_list[1] = XrmStringToQuark("Font"); if (XrmQGetResource(xresdb, name_list, class_list, &return_value, &xval)) { font_name = (char *)xval.addr; } if((WpeXInfo.font = XLoadQueryFont(WpeXInfo.display, font_name)) == NULL) { fprintf(stderr, "Xwpe: unable to open font \"%s\", exiting ...\n", font_name); exit(-1); } if (WpeXInfo.font->max_bounds.width != WpeXInfo.font->min_bounds.width) { fprintf(stderr, "Xwpe: Font \"%s\" not fixed width using default\n", font_name); font_name = "8x13"; if((WpeXInfo.font = XLoadQueryFont(WpeXInfo.display, font_name)) == NULL) { fprintf(stderr, "Xwpe: unable to open font \"%s\", exiting ...\n", font_name); exit(-1); } } WpeXInfo.font_height = WpeXInfo.font->max_bounds.ascent + WpeXInfo.font->max_bounds.descent; WpeXInfo.font_width = WpeXInfo.font->max_bounds.width; return ; } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeXColorGet - Get color settings from the X resources. Parameters: xresdb (In) X resource database name_list (In) Name quark list (second element unset) class_list (In) Class quark list (second element unset) \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ void WpeXColorGet(XrmDatabase xresdb, XrmQuark *name_list, XrmQuark *class_list) { XrmRepresentation return_value; XrmValue xval; Colormap cmap; XColor exact_def; Visual *visual; int loop, depth; char color_name[8]; char color_class[8]; Screen *xscreen; memset(color_name, 0, 8); memset(color_class, 0, 8); strcpy(color_name, "color"); strcpy(color_class, "Color"); for (loop = 0; loop < 16; loop++) { /* color names start at 1 not 0 */ color_name[5] = color_class[5] = (loop < 9)? loop + '1': '1'; if (loop > 8) { color_name[6] = color_class[6] = loop - 9 + '0'; } name_list[1] = XrmStringToQuark(color_name); class_list[1] = XrmStringToQuark(color_name); if (XrmQGetResource(xresdb, name_list, class_list, &return_value, &xval)) { WpeXColorNames[loop] = (char *)xval.addr; } } cmap = DefaultColormap(WpeXInfo.display, WpeXInfo.screen); depth = DisplayPlanes(WpeXInfo.display, WpeXInfo.screen); visual = DefaultVisual(WpeXInfo.display, WpeXInfo.screen); if (depth == 1) { /* Old code */ /* Error message for depth of one removed */ e_X_sw_color(); WpeXInfo.colors[0] = BlackPixel(WpeXInfo.display, WpeXInfo.screen); WpeXInfo.colors[1] = WhitePixel(WpeXInfo.display, WpeXInfo.screen); return ; } /* Check for private colormap option */ name_list[1] = XrmStringToQuark("pcmap"); class_list[1] = XrmStringToQuark("Pcmap"); if (XrmQGetResource(xresdb, name_list, class_list, &return_value, &xval)) { if (WpeStrccmp((char *)xval.addr, "on") == 0) { xscreen = DefaultScreenOfDisplay(WpeXInfo.display); cmap = XCreateColormap(WpeXInfo.display, RootWindowOfScreen(xscreen), visual, AllocNone); XSetWindowColormap(WpeXInfo.display, WpeXInfo.window, cmap); } } for(loop = 0; loop < 16; loop++) { if (!XParseColor(WpeXInfo.display, cmap, WpeXColorNames[loop], &exact_def)) { /* Should try a default color then bail if need be */ fprintf(stderr, "xwpe: unable to find color \"%s\", exiting ...\n", WpeXColorNames[loop]); exit(1); } if (!XAllocColor(WpeXInfo.display, cmap, &exact_def)) { /* Should try to find closest color */ fprintf(stderr, "Xwpe: all colorcells allocated, exiting ...\n"); exit(1); } WpeXInfo.colors[loop] = exact_def.pixel; } return ; } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeXGeometryGet - Get geometry setting from the X resources. Parameters: xresdb (In) X resource database name_list (In) Name quark list (second element unset) class_list (In) Class quark list (second element unset) size_hints (Out) Initial geometry of window \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ void WpeXGeometryGet(XrmDatabase xresdb, XrmQuark *name_list, XrmQuark *class_list, XSizeHints *size_hints) { XrmRepresentation return_value; XrmValue xval; char geom_str[20]; int grav; size_hints->flags = PResizeInc | PMinSize | PBaseSize; size_hints->height_inc = WpeXInfo.font_height; size_hints->width_inc = WpeXInfo.font_width; size_hints->min_width = size_hints->width_inc * 80; size_hints->min_height = size_hints->height_inc * 24; size_hints->base_width = size_hints->base_height = 0; name_list[1] = XrmStringToQuark("geometry"); class_list[1] = XrmStringToQuark("Geometry"); if (!XrmQGetResource(xresdb, name_list, class_list, &return_value, &xval)) { xval.addr = NULL; } size_hints->x = size_hints->y = 0; /* Default to 80 columns and a number of lines to fill 3/4th of the screen */ sprintf(geom_str, "80x%d", (3 * DisplayHeight(WpeXInfo.display, WpeXInfo.screen) / 4) / WpeXInfo.font_height); /* This doesn't correctly account for the title bar. If someone could point me in the right direction for correcting this I'd be grateful. */ if (XWMGeometry(WpeXInfo.display, WpeXInfo.screen, (char *)xval.addr, geom_str, 4, size_hints, &size_hints->x, &size_hints->y, &size_hints->width, &size_hints->height, &grav) & (XValue | YValue)) { size_hints->flags |= PPosition; } /* Old variables used since not converted yet */ MAXSCOL = size_hints->width / WpeXInfo.font_width; MAXSLNS = size_hints->height / WpeXInfo.font_height; return ; } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeXOptionsGet - Get miscellaneous options from the X resources. Parameters: xresdb (In) X resource database name_list (In) Name quark list (second element unset) class_list (In) Class quark list (second element unset) iconic (Out) Initial mode to start program in \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ void WpeXOptionsGet(XrmDatabase xresdb, XrmQuark *name_list, XrmQuark *class_list, int *iconic) { XrmRepresentation return_value; XrmValue xval; WpeXInfo.altmask = DEFAULT_ALTMASK; name_list[1] = XrmStringToQuark("altMask"); class_list[1] = XrmStringToQuark("AltMask"); if (XrmQGetResource(xresdb, name_list, class_list, &return_value, &xval)) { if (WpeStrnccmp((char *)xval.addr, "mod", 3) == 0) { switch (xval.addr[4] - '0') { case 1: WpeXInfo.altmask = Mod1Mask; break; case 2: WpeXInfo.altmask = Mod2Mask; break; case 3: WpeXInfo.altmask = Mod3Mask; break; case 4: WpeXInfo.altmask = Mod4Mask; break; case 5: WpeXInfo.altmask = Mod5Mask; break; default: break; } } } *iconic = NormalState; name_list[1] = XrmStringToQuark("iconic"); class_list[1] = XrmStringToQuark("Iconic"); if (XrmQGetResource(xresdb, name_list, class_list, &return_value, &xval)) { if (WpeStrccmp((char *)xval.addr, "on") == 0) { *iconic = IconicState; } } } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeXDefaults - Gets the X default resources. Returns: X resource database \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ XrmDatabase WpeXDefaults() { char *s, *home_env; s = XResourceManagerString(WpeXInfo.display); if (s) { return XrmGetStringDatabase(s); } /* The password file should be checked if HOME isn't set but not done yet. */ home_env = getenv("HOME"); if (home_env) { XrmDatabase tmpdb; s = malloc(strlen(home_env) + 12); sprintf(s, "%s/.Xdefaults", home_env); tmpdb = XrmGetFileDatabase(s); free(s); return (tmpdb); } return NULL; } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeXGCSetup - Sets up the graphic context with appropriate font, line, etc. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ void WpeXGCSetup() { XGCValues values; static char dash_list[2] = { 12, 24 }; WpeXInfo.gc = XCreateGC(WpeXInfo.display, WpeXInfo.window, 0, &values); XSetFont(WpeXInfo.display, WpeXInfo.gc, WpeXInfo.font->fid); XSetForeground(WpeXInfo.display, WpeXInfo.gc, BlackPixel(WpeXInfo.display, WpeXInfo.screen)); XSetLineAttributes(WpeXInfo.display, WpeXInfo.gc, /*line width*/ 1, /*line style*/ LineSolid, /*cap style*/ CapRound, /*join style*/ JoinRound); XSetDashes(WpeXInfo.display, WpeXInfo.gc, /*dash offset*/ 0, dash_list, /*dash list length*/ 2); return ; } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeXInit - Initializes the X display. Parameters: argc (In & Out) Argument count argv (In & Out) Argument values \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ void WpeXInit(int *argc, char **argv) { XrmDatabase xres = 0; XrmQuark class_list[3]; XrmQuark name_list[3]; XrmRepresentation return_value; XrmValue xval; XWMHints wm_hints; XClassHint class_hint; XSizeHints size_hints; Atom *atom_list, *new_atom_list; int atom_num, cursor_num; char *window_name; char *display_name; XrmInitialize(); if (WpeIsProg()) { window_name = "Window Programming Environment"; class_hint.res_name = "xwpe"; } else { window_name = "Window Editor"; class_hint.res_name = "xwe"; } class_hint.res_class = "Xwpe"; XrmParseCommand(&xres, WpeXOptionTable, OPTION_TABLE_SIZE, class_hint.res_name, argc, argv); class_list[0] = XrmStringToQuark(class_hint.res_class); name_list[0] = XrmStringToQuark(class_hint.res_name); /* The second class quark is set to "display" since it doesn't matter */ name_list[1] = class_list[1] = XrmStringToQuark("display"); name_list[2] = class_list[2] = NULLQUARK; if (XrmQGetResource(xres, name_list, class_list, &return_value, &xval)) { display_name = (char *)xval.addr; } else { display_name = NULL; } if ((WpeXInfo.display = XOpenDisplay(display_name)) == NULL) { fprintf(stderr, "Xwpe: unable to open display \"%s\", exiting ...\n", XDisplayName(display_name)); exit(-1); } WpeXInfo.screen = DefaultScreen(WpeXInfo.display); XrmCombineDatabase(WpeXDefaults(), &xres, False); WpeXFontGet(xres, name_list, class_list); WpeXGeometryGet(xres, name_list, class_list, &size_hints); WpeXOptionsGet(xres, name_list, class_list, &wm_hints.initial_state); WpeXInfo.window = XCreateSimpleWindow(WpeXInfo.display, RootWindow(WpeXInfo.display, WpeXInfo.screen), size_hints.x, size_hints.y, size_hints.width, size_hints.height, 4, BlackPixel(WpeXInfo.display, WpeXInfo.screen), WhitePixel(WpeXInfo.display, WpeXInfo.screen)); WpeXColorGet(xres, name_list, class_list); XrmDestroyDatabase(xres); wm_hints.flags = InputHint | StateHint | WindowGroupHint; /* make it serve the window */ wm_hints.input = True; /* right from start */ wm_hints.window_group = WpeXInfo.window; XmbSetWMProperties(WpeXInfo.display, WpeXInfo.window, window_name, class_hint.res_name, argv, *argc, &size_hints, &wm_hints, &class_hint); XSelectInput(WpeXInfo.display, WpeXInfo.window, ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask); if(!XGetWMProtocols(WpeXInfo.display, WpeXInfo.window, &atom_list, &atom_num)) { atom_num = 0; } new_atom_list = WpeMalloc((atom_num + 1) * sizeof(Atom)); if (atom_list != NULL) { memcpy(new_atom_list, atom_list, atom_num * sizeof(Atom)); } if (atom_num) XFree(atom_list); new_atom_list[atom_num] = WpeXInfo.delete_atom = XInternAtom(WpeXInfo.display, "WM_DELETE_WINDOW", False); WpeXInfo.protocol_atom = XInternAtom(WpeXInfo.display, "WM_PROTOCOLS", False); XSetWMProtocols(WpeXInfo.display, WpeXInfo.window, new_atom_list, atom_num + 1); WpeFree(new_atom_list); WpeXInfo.selection_atom = XInternAtom(WpeXInfo.display, "PRIMARY", False); WpeXInfo.text_atom = XInternAtom(WpeXInfo.display, "STRING", False); WpeXInfo.property_atom = XInternAtom(WpeXInfo.display, "GTK_SELECTION", False); WpeXInfo.selection = NULL; WpeXGCSetup(); XMapWindow(WpeXInfo.display, WpeXInfo.window); for (cursor_num = WpeEditingShape; cursor_num < WpeLastShape; cursor_num++) { WpeXMouseCursor[cursor_num] = XCreateFontCursor(WpeXInfo.display, WpeXMouseDefault[cursor_num]); } XDefineCursor(WpeXInfo.display, WpeXInfo.window, WpeXMouseCursor[WpeEditingShape]); WpeXInfo.shape_list[0] = WpeXInfo.shape_list[1] = WpeEditingShape; /* Copied with little change since I haven't had the time to look into what it does */ if((*e_u_ini_size)()) { *argc = -1; return ; } e_abs_refr(); /* end of untouched section */ return; } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeXMouseChangeShape - Changes the mouse pointer to a different shape. Parameters: new_shape (In) new shape of the mouse pointer \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ void WpeXMouseChangeShape(WpeMouseShape new_shape) { WpeXInfo.shape_list[1] = WpeXInfo.shape_list[0]; WpeXInfo.shape_list[0] = new_shape; XDefineCursor(WpeXInfo.display, WpeXInfo.window, WpeXMouseCursor[new_shape]); XFlush(WpeXInfo.display); } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeXMouseRestoreShape - Restores the mouse pointer to the previous shape. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ void WpeXMouseRestoreShape() { WpeXInfo.shape_list[0] = WpeXInfo.shape_list[1]; WpeXInfo.shape_list[1] = WpeEditingShape; XDefineCursor(WpeXInfo.display, WpeXInfo.window, WpeXMouseCursor[WpeXInfo.shape_list[0]]); } #endif xwpe-1.5.30a/WeXterm.h0000644000076400007640000000317410263105405013523 0ustar dulsidulsi#ifndef __WEXTERM_H #define __WEXTERM_H /*-------------------------------------------------------------------------*\ -- Header file of Xwpe routines for X window support Date Programmer Description 05/04/97 Dennis Created for xwpe reorganization. \*-------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" { #endif /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ Includes \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include "Xwpe.h" /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ Defines \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #ifndef XTERM_CMD #define XTERM_CMD "xterm" #endif /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ New Types \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ typedef struct wpeXStruct { Display *display; int screen; Window window; GC gc; XFontStruct *font; Atom delete_atom, protocol_atom, selection_atom, text_atom, property_atom; int font_height, font_width; int altmask; int colors[16]; WpeMouseShape shape_list[2]; char *selection; } WpeXStruct; /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ Global Variables \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ extern WpeXStruct WpeXInfo; void WpeXInit(int *argc, char **argv); void WpeXMouseChangeShape(WpeMouseShape new_shape); void WpeXMouseRestoreShape(); #ifdef __cplusplus } #endif #endif xwpe-1.5.30a/WeProg.h0000644000076400007640000000564110263105405013334 0ustar dulsidulsi#ifndef __WEPROG_H #define __WEPROG_H /*-------------------------------------------------------------------------*\ -- Header file of Xwpe routines for programming support Date Programmer Description 05/24/97 Dennis Created for xwpe reorganization. \*-------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" { #endif /* needed for the time being to call old routines and data types */ #include "model.h" #include "edit.h" /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ New Types \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ typedef struct wpeSyntaxRule { unsigned char **reserved_word; /* Reserved words */ unsigned char **long_operator; /* Operators longer than a single character*/ unsigned char *single_operator; /* Single character operators */ unsigned char *begin_comment; /* Comments begin with this string */ unsigned char *end_comment; /* Comments end with this string */ unsigned char *line_comment; /* Comments 'til end of line with this */ unsigned char string_constant; /* Character denoting string constant */ unsigned char char_constant; /* Character denoting character constant */ unsigned char preproc_cmd; /* Character denoting preprocessor commnand*/ unsigned char quoting_char; /* Quote the next character */ unsigned char continue_char; /* Line continues if this is last character*/ unsigned char insensitive; /* Set when language is not case sensitive */ int continue_column; /* Continues previous line if anything in the column (works?) */ int comment_column; /* Comments from this column on */ /* If any character from the special comment string is found in the special column the rest of the line is a comment */ int special_column; unsigned char *special_comment; } WpeSyntaxRule; typedef struct wpeSyntaxExt { char **extension; WpeSyntaxRule *syntax_rule; } WpeSyntaxExt; /* Necessary for the time being */ extern WpeSyntaxExt **WpeSyntaxDef; /* WeSyntax.h *\ void WpeSyntaxGetPersonal(char *filename); void WpeSyntaxGetSystem(char *filename,); */ void WpeSyntaxReadFile(ECNT *cn); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ Macros and Machine specific information \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #ifdef DJGPP #define WpeSyntaxGetPersonal(filename) \ sprintf(filename, "./%s", SYNTAX_FILE) #else #define WpeSyntaxGetPersonal(filename) \ sprintf(filename, "%s/%s/%s", getenv("HOME"), XWPE_HOME, SYNTAX_FILE) #endif #define WpeSyntaxGetSystem(filename) \ sprintf(filename, "%s/%s", LIBRARY_DIR, SYNTAX_FILE) #ifdef __cplusplus } #endif #endif xwpe-1.5.30a/Xwpe.h0000644000076400007640000000144310263105405013050 0ustar dulsidulsi#ifndef __XWPE_H #define __XWPE_H /*-------------------------------------------------------------------------*\ -- Header file for core Xwpe functions Date Programmer Description 04/27/97 Dennis Created for xwpe reorganization. \*-------------------------------------------------------------------------*/ typedef enum wpeMouseShape { WpeEditingShape, WpeDebuggingShape, WpeWorkingShape, WpeErrorShape, WpeSelectionShape, WpeLastShape } WpeMouseShape; /* Checks if programming editor is running (old variable currently used) */ #define WpeIsProg() (e_we_sw & 2) /* Checks if x windows is running (old variable currently used) */ #define WpeIsXwin() (e_we_sw & 1) #define WpeMalloc(x) malloc(x) #define WpeRealloc(x, y) realloc(x, y) #define WpeFree(x) free(x) #endif xwpe-1.5.30a/WeString.c0000644000076400007640000000530410263105405013662 0ustar dulsidulsi/*-------------------------------------------------------------------------*\ -- Some string routines for xwpe Date Programmer Description 04/27/97 Dennis Created based on functions from "we_hfkt.c". \*-------------------------------------------------------------------------*/ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ Original header of "we_hfkt.c" \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* we_hfkt.c */ /* Copyright (C) 1993 Fred Kruse */ /* This is free software; you can redistribute it and/or */ /* modify it under the terms of the */ /* GNU General Public License, see the file COPYING. */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ Includes \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "Xwpe.h" #include "WeString.h" #include #include #include int WpeStrnccmp(const char *s1, const char *s2, int n) { /* Added a check for end of string. */ for (; (n > 0) && (*s1) && (toupper(*s1) == toupper(*s2)); n--, s1++, s2++) ; return(n > 0 ? toupper(*s1) - toupper(*s2) : 0); } int WpeStrccmp(const char *s1, const char *s2) { for (; (*s1) && (toupper(*s1) == toupper(*s2)); s1++, s2++) ; return(toupper(*s1) - toupper(*s2)); } char *WpeStrcstr(char *str, const char *substr) { const int len = strlen(substr); for (; *str; str++) { if (WpeStrnccmp(str, substr, len) == 0) { return(str); } } return(NULL); } char *WpeStrdup(const char *str) { char *newstr; newstr = WpeMalloc((strlen(str)+1)*sizeof(char)); if (newstr != NULL) { strcpy(newstr, str); } return(newstr); } int WpeNumberOfPlaces(int n) { int i; if (n == 0) { return(1); } else if (n < 0) { n = -n; } for (i = 0; n > 0; n /= 10, i++) ; return(i); } char *WpeNumberToString(int n, int len, char *s) { int nlen; nlen = WpeNumberOfPlaces(n); if (nlen > len) { nlen = len; } else { memset(s, ' ', len - nlen); } s[len] = '\0'; for (; nlen > 0 ; n /= 10, nlen--) { len--; s[len] = (n % 10) + '0'; } return(s); } int WpeStringToNumber(const char *s) { /* This checking of blanks is probably not needed. */ while ((*s) == ' ') { s++; } return(atoi(s)); } char *WpeStringToUpper(char *s) { char *s2; for (s2 = s; *s2; s2++) { *s2 = toupper(*s2); } return (s); } char *WpeStringBlank(char *s, int len) { memset(s, ' ', len); s[len] = '\0'; return(s); } char *WpeStringCutChar(char *s, char c) { char *tmp; tmp = strrchr(s, c); if (tmp != NULL) { *tmp = '\0'; } return(s); } xwpe-1.5.30a/WeString.h0000644000076400007640000001100610263105405013663 0ustar dulsidulsi#ifndef __WESTRING_H #define __WESTRING_H /*-------------------------------------------------------------------------*\ -- Header file for some string routines for xwpe Date Programmer Description 04/27/97 Dennis Created for xwpe reorganization. \*-------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" { #endif /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeStrnccmp - Case-insensitive compare of two strings for a number of characters. Parameters: s1 (In) First string s2 (In) Second string n (In) Maximum number of characters to compare Returns: Zero if equal. Anything else means not equal. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ int WpeStrnccmp(const char *s1, const char *s2, int n); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeStrccmp - Case-insensitive compare of two strings. Parameters: s1 (In) First string s2 (In) Second string Returns: Zero if equal. Anything else means not equal. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ int WpeStrccmp(const char *s1, const char *s2); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeStrcstr - Case-insensitive substring search. Parameters: str (In) Main string substr (In) Substring to search for Returns: Pointer to the beginning of the substring in the main string. NULL if the substring is not found. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ char *WpeStrcstr(char *str, const char *substr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeStrdup - Duplicate a string. Parameters: str (In) String to copy Returns: Pointer to new string created with WpeMalloc(). NULL if insufficient memory free to create the string. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ char *WpeStrdup(const char *str); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeNumberOfPlaces - Number of places in a number excluding the sign. Parameters: n (In) Number Returns: The number of places. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ int WpeNumberOfPlaces(int n); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeNumberToString - Converts a number to a string. Parameters: n (In) Number len (In) Length of the string (excluding '\0') s (In & Out) Converted number Returns: Pointer to the converted number string \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ char *WpeNumberToString(int n, int len, char *s); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeStringToNumber - Converts a string to a number. Parameters: s (In) String to be converted to a number Returns: The string's number value \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ int WpeStringToNumber(const char *s); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeStringToUpper - Converts a string to all uppercase. Parameters: s (In & Out) String to be converted to uppercase Returns: Pointer to the uppercase string \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ char *WpeStringToUpper(char *s); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeStringBlank - Fills a string with blank spaces. Parameters: s (In & Out) String to be blanked len (In) Length of the string (excluding '\0') Returns: The blanked string. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ char *WpeStringBlank(char *s, int len); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeStringCutChar - Cuts a string at the last occurance of a character. Parameters: s (In & Out) String to be cut c (In) Character to cut off Returns: The cut string. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ char *WpeStringCutChar(char *s, char c); #ifdef __cplusplus } #endif #endif xwpe-1.5.30a/WeExpArr.h0000644000076400007640000000400510263105405013617 0ustar dulsidulsi#ifndef __WEEXPARR_H #define __WEEXPARR_H /*-------------------------------------------------------------------------*\ -- Header file of Xwpe routines for Expanding Arrays Date Programmer Description 05/25/97 Dennis Created for xwpe reorganization. \*-------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" { #endif /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeExpArrayCreate - Creates an expandable array. Parameters: initial_num (In) Initial number of elements for the array elem_size (In) Size of each element growth_num (In) Number by which it increases when necessary Returns: The new expandable array \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ void *WpeExpArrayCreate(int initial_num, int elem_size, int growth_num); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeExpArrayAdd - Adds another element to an expandable array. Parameters: exp_array (In & Out) The expandable array new_elem (In) The new element to add \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ void WpeExpArrayAdd(void **exp_array, void *new_elem); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeExpArrayGetSize - Get the number of used elements of an expandable array. Parameters: exp_array (In) The expandable array Returns: Number of used elements \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ int WpeExpArrayGetSize(void *exp_array); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ WpeExpArrayDestroy - Destroys an expandable array. Parameters: exp_array (In) Expandable array to be destroyed \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ void WpeExpArrayDestroy(void *exp_array); #ifdef __cplusplus } #endif #endif xwpe-1.5.30a/help.xwpe_eng0000644000076400007640000025007310263105405014447 0ustar dulsidulsi XWindow Programming Environment (XWPE) xwpe [ options ] file ... xwe [ options ] file ... wpe [ options ] file ... we [ options ] file ... XWPE can be used with or without the programming interface. It has its own X interface but can be used also on a charac- ter terminal. xwpe fires up the X interface together with the programming interface. xwe is the X version but without the special features of the programming interface. In con- nection with a simple character terminal you can use wpe to programme and we as editor. Table of Contents: What is xwpe ? The Command-line The initialization files The main-menu Control-character sequences used by xwpe Changing the Control-character sequences (Common User Access) The editor The Programming-Environment The debugging-environment The file-manager Search and replace functions The project-file Commands used for Programming C Using the help-functions The GNU General Public License Credits  What is xwpe ? xwpe is a X-window programming environment designed for use on UNIX-systems. It is similar to 'Borland C++ or Turbo Pas- cal' environments. The differences between the programming environments from Borland and xwpe is that many compilers and linkers may be started. From a menu three different debuggers can be chosen. And of course not only key strokes can select these options you can also use a mouse. Errors that occur while compiling and linking a program can be examined in the sources: The cursor will jump to the corresponding line in the source-file. Programs using more than one source-file can be managed with the so called project-option (see also project-file). The programme can be started from within the Programming-Environment and errors may be found using a debugger. The debugging-environment allows the user to set and unset breakpoints directly in the source code. The contents of variables may be displayed in a special window, the  Watch-Window. This window is updated while reaching a breakpoint. The Stack-Window displays the programme stack. Help is available for xwpe and the man-pages installed on the system may be displayed. All this can be reached via the help-functions. The editor may be used to edit up to 35 files at the same time. They are all displayed in a window of their own. A mouse is used to select special editor function from the top menu. These function can also be selected by hitting a special key or combinations of keys. Some of these features are a complete search and replace function (yes, it can search for regular expressions) and a file-manager. The file-manager is used to open, copy, rename and move or delete files. The X-window programming environment can be used without the special programming features. If it is invoked as `xwe' (`we' if used with a character terminal) it can be used as a editor e.g. for shell-programming. Special thanks to all who contribute to this program (see Credits) Send questions or problems to Dennis Payne, . Copyright (C) 1993 Fred Kruse xwpe is free. Anyone may redistribute copies of xwpe to anyone under the terms stated in the GNU General Public License. The author assumes no responsibility for errors or omissions or damages resulting from the use of xwpe or this manual.  Credits The original xwpe was developed by Fred Kruze. The manual was translated to English by Lothar Schuette. Faster screen displaying was provided by Axel Rohde. The xwpe alpha project was started by Dennis Payne . Additional contributers include: Anthony Barbachan Harry Berman Alex Buell Guido Draheim Kenn Flynn German Gomez Garcia Stefan Hille Roman Levenstein Mark Loftis Brian O'Donnell Alexander Neundorf Alexei Pavlov Pedro Duane Penzien Paulo César Pereira de Andrade Yarick Rastrigin Sebastiano Suraci Mark Spieth Arjan van Dijk Matej Vela Brian White Martin Zampach Special thanks to: Jussi Hamalainen Ronald Holzloehner James M. Andrei Malyshev Tony Stout Oliver Wilson and all other testers.  The command-line xwpe [ options ] file ... xwe [ options ] file ... wpe [ options ] file ... we [ options ] file ... The possible options are: -pm The next file is a message-file. -r Start xwpe in the recover mode. The internal buffers are saved in files with the postfix `.ESV' in the name if a signal is caught by xwpe (except for SIGKILL). If the editor is invoked with the `-r' option is specified in the command line, the old session will be recovered. -sf file file will be used instead of the personal option file, $HOME/.xwpe/xwperc. -so The default options are used. The option file will not be read. The following standard X command line options are available for the X-Window versions. -display display This option specifies the X server to contact; see X(1). -font font, -fn font The font to used for the text can be specified with this option. The default is 8x13. -geometry geometry, -g geometry This option specifies the preferred size and and position of the editor; see X(1). -iconic This indicates that xwpe should ask the window man- ager to start as icon rather than a normal window. -pcmap This starts xwpe with a private colormap.  The initialization files On startup (subject to the -sf and -so options), xwpe reads the personal initialization file $HOME/.xwpe/xwperc. If no such file exists, the system wide initialization file, /usr/local/lib/xwpe/xwperc, is read. If neither file exists, the default options will be used. xwperc is a text file written by the programming environ- ment. Although modification by hand is possible comments will be erased if the options are latter saved from within xwpe. X-Resources: The following resources are available. The application name is either "xwe" or "xwpe". Both belong to the "Xwpe" class. font (class Font) Specifies the name of the font to use. The default is ``8x13.'' geometry (class Geometry) Specifies the preferred size and position of the editor. Sizes of less than 80 x 25 are ignored. color1 (class Color1) ... color16 (class Color16) xwpe uses 16 colors. The default setting is similar to the PC-color set.  The main-menu The WE-menu system is entered by pressing F10, ALT- (or ) from within the editor window. It can be left by pressing . A sub menu can be called directly by press- ing ALT-<highlighted letter>. Here is a list of those sub menus: System-Menu Environment-management File-Menu file managing Edit-Menu all functions used for editing Search-Menu search and replace Block-Menu block-commands used in the editing windows. Run-Menu Programming-Environment (only available for wpe and xwpe) Debug-Menu Debugging-Environment (not available for we and xwe) Project-Menu programming with more than one source file (only wpe and xwpe) Options-Menu toggle options Window-Menu window management Help-Menu yes, this is the help system  The System-Menu (Alt-#): About WE A Display version number and copyright. Clear Desktop C Close all windows. Repaint Desktop R Initialize the desktop and reopens all windows. System Info S Displays the current filename, directory, ... Show Wastebasket W Display the files saved in the wastebasket (file-manager). Delete Wastebasket D Empty wastebasket.  The File-Menu (Alt-F): File-Manager M Puts the file-manager-window on top. If it is not found a new one is opened. New N Open a new file 'Noname'. Save S Save this file using the `old' name. Save As A Use a new name to save this file (see also file-manager) Save ALl L Save all files that were changed. Execute E Execution-Manager SHell H Start a UNIX-Shell. Find F Search for a file name (see Find). Grep G Search for a regular expression in files (see also Grep) Print P Print this file. Quit Q Quitting XWPE  The Edit-Menu (Alt-E): Cut T Delete the marked text and copy it into the clipboard. Copy C Copy the marked text into the clipboard. Paste P Insert the buffer behind the cursor. Show Clipboard S Delete D Delete the marked text. Undo U Undo the last change in the text. Redo R Do the last change one time more. Load XBuffer L Copy the XWindow-buffer into xwpe's paste-buffer. Write to XBuffer W Just the other way round.  The Search-Menu (Alt-S): Find F Search for a regular expression. (see also Search and Replace Functions) Replace R Search and replace a regular expression. (see also Search and Replace Functions) Search again S Repeat the last Find/Replace. Go to Line G  The Block-Menu (Alt-B): Begin Mark B Mark the beginning of a block. End Mark E Set the end-mark. Mark Line L Mark this line. Mark Whole W Mark the entire scope. Goto Begin G Jump to the beginning of this block. Goto End N Jump to the end of this block. Copy C Copy this block. Move M Move this block. Delete D Delete this block. Hide H Delete the set block-marks. Read R Insert a file at the cursor position. Write W Write a block to a file. Move to Right I Move a block to the right. Move to Left T Move a block to the left. A block can also be marked by pressing `^k b' at the entire beginning and `^k k' at the end of the desired block. xwpe (and xwe) allows marking a block with the mouse: Holding down the left button and moving over the text marks it as block. Holding down Shift and moving with the text cursor around also marks a block.  The Run-Menu (Alt-R): Compile C Compile a programme. (see Programming-Environment) Make M Create an executable. Run R Create an executable and start it. Install I Install a project. (see also project-file) Execute make E Start make(1). Next Error N Jump to the next Error. Previous Error P Jump to the previous Error. Show Definition S Find the definition of an expression. (see also Commands used for Programming C Show Next Def. X Find next definition of an expression. (see also Commands used for Programming C Matching Bracket K Find the matching bracket. (see also Commands used for Programming C Beautify B Beautify a programme. (see also Commands used for Programming C Arguments A Enter the arguments used to start a programme.  The Debug-Menu (Alt-D):(see also Debugging-Environment) Toggle Breakpoint B Set/remove a breakpoint. ReMove all Breakp. M Remove all Breakpoints. Make Watch W Select a variable to watch. (see also Watch-Window) Edit Watch E Edit a watched variable. Delete Watch D Delete a watched variable. Remove All Watches A Delete all watched variables. Show StacK K Show the stack. (see also Stack-Window) Goto cursor G Execute to the cursor. Finish Function F Finish the current function. Trace T Execute next programme line (step into any function). Step S Execute next programme line (step over any function). Run/Continue R Start/continue debugging. Quit Q Exit the debugger.  The Project-Menu (Alt-P): Open Project P Input a project-file. The Project-Window is opened. Close Project C Stop using a project. Add Item A Add a file to this project. Delete Item D Delete this file from the project. Options O Project-Options  The Options-Menu (Alt-O): Adjust Colors A Change the colors. Save Options S Save all changes to the options. Editor E Options used by the editor. (see also Editor-Options) File-Manager F Options used by the file-manager (see also File-Manager-Options) Programming G Options used by the programming- environment (Stop at error/warning) (see also Syntax-Support) Compiler C Change the options for compilers (see also Compiler-Options) Debugger D Select the debugger (gdb, sdb, dbx) and full-screen/normal mode.  The Window-Menu (Alt-W): Size/Move S Resize and move this window. Zoom Z Maximize this window. Tile T Put all windows one beside the other. Cascade A Put all windows like a cascade one over another. Next X Choose the next window in the list. Close C Close this window. List All L Display a list of all windows. A window can be selected by pressing or Alt-. Output Window O Display the output (not X11). Messages M The Message-Window will be opened. Project P The Project-Window will be opened. Watches W The Watch-Window will be opened.  The Help-Menu (Alt-H): Editor E Help to the editor (WE) Topic Search T UNIX man-pages. FUnction Index U Index to all UNIX-functions (see also Function-Index) Info I The GNU-infosystem. Goto G Goto help page Back B Goto the page you see before Next N Goto the next page Previous P Goto the previous page  Control-character sequences (special keys) used by xwpe How to enter the special keys Alt and ESC on a UNIX system (without XWindow): Alt-X - is realized by pressing <ESC> X. (X is a printable character.) ESC - is realized by the sequence <ESC> <Return>. The following functions can be reached by control-character sequences: Cursor-Movement Editing Deleting Block-Commands Marker-Commands Search- and Replace-Commands Buffer-Commands Read and Save Window-Commands Run-Commands Commands used for Programming C Debug-Commands Help-Commands Help Editing-Commands Quit XWPE  Cursor-Movement: up arrow Ctrl P move the cursor one line up down arrow Ctrl N move the cursor one line down right arrow Ctrl F move the cursor one character right left arrow Ctrl B move the cursor one character left Ctrl right arrow Alt right arrow move the cursor one word right Ctrl left arrow Alt left arrow move the cursor one word left Home Ctrl A move the cursor to column 1 End Ctrl E move the cursor to the last column Ctrl up arrow Page Up move the cursor one window up Ctrl down arrow Page Down move the cursor one window down Ctrl Page Up Alt Ctrl A goto first row Ctrl Page Down Alt Ctrl E goto last row Ctrl Home Alt Ctrl P goto first row of this window Ctrl End Alt Ctrl N goto last row of this window  Editing: Insert a line-break. (see also Automatic Indentation) Ctrl H Delete a character backwards. (see also Automatic Indentation) Ctrl D Del Delete the character the cursor is on. Indent the text. (see also Automatic Indentation) Alt-I Switch insert to overwrite mode and Insert vice versa. Alt-J Switch to special-character-insert-mode.  Deleting: Ctrl T Kill the next word after the cursor. Ctrl O T Kill the word immediately before the cursor. Ctrl Y Delete a whole line Ctrl Z Ctrl O Y Kill from the cursor position to the end of line.  Block-Commands: Shift + Cursor-movement mark a block Ctrl K B Set the beginning mark Ctrl K K Set the end mark Ctrl K L Mark this line Ctrl K X Mark the whole document Ctrl K A Jump to the beginning mark Ctrl K Z Jump to the end mark Ctrl K C Copy block Ctrl K V Move block Ctrl K Y Kill block Ctrl K H Hide block Ctrl K R Insert a file at the cursor position Ctrl K W Write a block to a file Ctrl K I Shift a block to the right Ctrl K U Shift a block to the left  Marker-Commands: Ctrl K n Set the marker no. n ( n = 1 - 9 ) Ctrl O n Jump to the marker no. n  Search- and Replace-Commands: Find F4 Ctrl O F Search for a string Alt-F4 Ctrl O A Replace a string with another string Ctrl-F4 Ctrl L Repeat the last search or replace Alt G Goto line  Buffer-Commands: Cut Shift Del Ctrl X Kill the marked text to the kill-buffer Copy Shift Insert Ctrl C Copy the marked text to the kill-buffer Paste Ctrl Insert Ctrl V Copy the kill-buffer to the cursor Ctrl W Display the kill-buffer UNDO Ctrl U Undo an unwanted change REDO Ctrl R Undo the last undo Alt Delete Copy the marked text to the X-buffer Alt Insert Copy the X-buffer to the cursor  Read and Save: Open F3 Start the file-manager (Open a file etc.) F2 Save the file  Window-Commands: Alt-Z F5 Zoom the window (maximum size) Ctrl F5 Alt-F2 Resize and move the window F6 Alt-N Switch to the next window Alt-F3 Close this window Shift F4 Put all windows one beside the other Shift F5 Put all windows like a cascade one over another.  Run-Commands: Alt F9 Alt C Compile (see also Programming-Environment) F9 Alt M Create an executable Ctrl F9 Alt R Create an executable and start it Alt L Install a project (see also project-file) Alt A Start make(1) Alt V Jump to the previous error (see also Message-Window) Alt T Jump to the next error (see Message-Window)  Commands used for Programming C: Ctrl O S Search the definition of an expression (see Programming C) Ctrl O N Search for the next definition of an expression (see Programming C) Ctrl O K Search for a corresponding bracket (see Programming C) Ctrl O B Beautify C-source code (see Programming C)  Debug-Commands: Ctrl F10 Ctrl G R Start the debugger (see Debugging-Environment) Ctrl F2 Ctrl G Q Quit the debugger F7 Ctrl G S Execute next programme line (step into any function) F8 Ctrl G N Execute next programme line (step over any function) Ctrl F8 Ctrl G B Set/remove a breakpoint Ctrl G M Remove all Breakpoints Ctrl F7 Ctrl G W Select a variable to watch (see also Watch-Window) Ctrl G E Edit a watched variable (see also Watch-Window) Ctrl G D Delete a watched variable (see also Watch-Window) Ctrl F6 Ctrl G K Show the stack. (see also Stack-Window) Ctrl G O Display the output (not X11)  Help-Commands: F1 Help to the editor (WE) Ctrl F1 UNIX man-pages Alt F1 Index to all UNIX-functions (see also Function-Index)  Help Editing-Commands: Ctrl O E Insert end of section marker Ctrl O H Insert header around text block Ctrl O M Insert highlight marker around text block Ctrl O U Insert button around text block  Quit XWPE Alt-X Quit from XWPE  Changing the Control-character sequences (Common User Access): Some function-keys may be used in a second form which is compatible to OSF-Motif and MS-Windows. These are the changes: Window management: F6 -> Ctrl F6 Select next window Alt F3 -> Ctrl F4 Close window F5 -> Shift F6 Zoom Search and Replace: Ctrl F4 -> F3 Search again F4 -> Alt F3 Search Alt F4 -> Ctrl F3 Replace File operations: F3 -> F2 Start the file-manager F2 -> Alt F2 Save Debugger: Ctrl F8 -> F5 Set a breakpoint Ctrl F7 -> Ctrl F5 Watch Ctrl F6 -> Ctrl F3 Call stack Quit from XWPE: Alt X -> Alt F4  Quitting XWPE: Files that are NOT changed will be closed without any warning after the Quit-command is send. If any changes have not been saved, xwpe displays a warning message and allows the user to save these files: Yes Save the file No Close without save ESC Cancel from quit (no more files are closed)  The editor The editor may be used to edit up to 35 files at the same time. They are all displayed in a window of their own (Editor-Window). The functions of this editor may be selected by pressing a special key, using the mouse or selecting it from the menu. These functions are, besides killing or inserting single characters from/into the text: Copy, move and delete a block in one file (see also Block-Menu). Copy, move and delete a block between different files (see also Edit-Menu). Search and replace strings (see also Search-Menu). Resize and move the windows used to edit files (see also (Window-Menu). Change the behavior of the editor (see also Options-Menu). Edit, save and manipulate files (see also File-Menu).  Using the help-functions If the help is selected, a separate window is opened which displays a case-sensitive help. If Help/Editor is selected the contents of the editor-functions-help will be displayed. Most documents include links to other help-pages. They are highlighted and may be selected by clicking on them with the mouse or pressing after the cursor is moved over them. By pressing the last visited help-page is re- displayed. This can be done also by clicking on the highlighted title. Programmer also want to take a look at Help-Menu.  The file-manager The purpose of the file-manager is to select files, create new directories, copy files and directories, move and rename files and directories, delete and change the access permis- sions of files and directories. Alt-N Select the 'Name'-line where the default entry may be changed. If the entry is 1. a existing file, pressing will open this file for editing 2. a new (non-existing) file, pressing will be created 3. a mask (regular expression) selecting the files for the 'Files'-menu. '*' matches all characters, one char- ter in the range of "a..z". Pressing will select all matching files and the Alt-F Select the 'Files'-menu which shows all files in the selected directory. The marked file can be opened by pressing or Alt-E. Alt-D Select the 'Directory'-line. The working directory may be entered here. selects the w.d. Alt-T Select the tree of directories. Pressing the cursor keys walks through the tree, selects the work- ing directory. Alt-C Change the working directory to the one entered in the 'Directory'-line. Alt-E The file selected in the 'Name'-line will be opened for editing. Alt-M Rename or move into another directory. Alt-R Delete the marked file. The file will be moved into the wastebasket or removed from the disk, this can be selected from File-Manager-Options. Alt-L Create a link for the marked file. If possible, a hard link will be created. Only if a directory or files that are saved on different disk-partitions are selected a soft link will be used. Alt-O The file will be copied. The new name must be entered. Alt-K Make a new directory named "new.dir". This name may be changed. Alt-A Change the file attributes. Alt-S (only avail-able in function Save As) The file will be saved using the name displayed in the line 'Name'. Quit the file-manager.  The Execution-Manager: The purpose of the execution-manager is to start executable files and shell-scripts. Only files with execute-attribute will be selected in the 'Files'-menu. Alt-N Select the 'Name'-line where the default entry may be changed. If the entry is 1. a existing file, pressing will be exe- cuted. 2. a mask (regular expression) selecting the files for the 'Files'-menu. '*' matches all characters, one char- acter in the range of "a..z". Pressing will select all matching files and the Alt-F Select the 'Files'-menu which shows all files in the selected directory. The marked file can be opened by pressing or Alt-E. Alt-D Select the 'Directory'-line. The working directory may be entered here. selects the w.d. Alt-T Select the tree of directories. Pressing the cursor keys walks through the tree, selects the work- ing directory. Alt-C Change the working directory to the one entered in the Alt-E The file selected in the 'Name'-line will be opened for execution by the OS. Quit the execution-manager.  The Programming-Environment If a Project-File is selected this project will be compiled, linked and executed from the Run-Menu. If there is no pro- ject the file in the current window will be taken as target. The compiler / linker is selected automatically by xwpe and is distinguished by the file-name postfix. The compiler and its options may be selected in the menu Run/Options (see also Compiler-Options). Only those files which were never compiled or which have been changed since the last time they were compiled are com- piled (and linked). Changes in 'include'd files are only considered for C-programs. Error in compilation and linking are listed in the Message-Window. These errors stop the creating process and the file that contains the error will be opened and the cur- sor will be set in the corresponding line.  The debugging-environment The Debug-Menu is used to set breakpoints in the source code and to start debugging. If the debugger stops the corresponding line in the source is marked. Files will be opened if necessary. Stops are caused by breakpoints or signals. In the Watch-Window the contents of selected variables and constants are displayed after each stop. The stack is displayed in the Stack-Window after a stop.  Find: Find starts a search for files in a specified directory. This search may be recursive. Alt-L Enter the filename or a file-mask as described in File-Manager. Alt-I Enter the starting directory for the search. Alt-K Enable a recursive search. Alt-O Start. Break find. All those directories containing matching files are listed in the Find-Window.  Grep: Search for files containing a substring. The files selected for the grep must match an expression also used for the File-Manager. Alt-T Enter the string to search. Alt-C Distinguish between small and capital letters. Alt-W Only search for whole words. Alt-R Search for regular expressions. (See Search and Replace Functions) Alt-L Enter a file-name or a file-mask, as described in File-Manager, to search in. Alt-I The directory to search in. Alt-K Also search in sub-directories. Alt-O Start the search. Don't search any further. All those files containing matching strings are listed in the Grep-Window.  Search and replace functions Alt-T Enter the string to searched. Alt-N New string that replaces the old one. (Only used for Replace) Alt-C Distinguish between small and capital letters. Alt-W Only search for whole words. Alt-R Search for regular expressions. The following regular expressions (like (e)grep(1)) may be used: ^ Matches the empty string at the beginning of a line. $ Matches the empty string at the end of a line. . The period matches any single character. [] A list of characters enclosed by [ and ] matches any single character in that list. [^ ] Matches any single character not in the list of charac- ters enclosed by [ and ]. [ - ] A range of ASCII characters is represented by giving the first and the last character separated by a hyphen. * The character in front of the asterix is repeated zero or more times. + The character in front of the plus is repeated one or more times. ? The character in front of the question mark is repeated zero or once. | OR: OR separates two strings of which one will match. The character after the \ will not be interpreted as special character. Alt-P (Replace only) Ask before each replacement. Possible answers are: Yes Y Replace text No N Don't replace text Stop search Alt-D Search forward. Alt-B Search backward. Alt-G Search in the whole text. Alt-S Only search in the marked block. Alt-F Start search from cursor-position. Alt-E Search from the text or block beginning. Search/Replace only one time than stop. Alt-A Execute all replacements till the end of the entire scope. (Replace only) Don't search any further.  Function-Index: XWPE creates a list of all manual-pages that can be found in the search-path given by the environment variable MANPATH. The index is distinguished in the following sections: User Commands System Calls : C - functions C-Lib.-Functions : C - functions from the C -library Devices & Network Interface File Formats Games & Demos Environments, Tables and TROFF Macros Maintenance Com. : Administrations commands After the section is selected a list of all manual pages belonging to that section will be displayed. One of these pages may be selected by pressing or clicking on the name. A new window appears containing the manual page. A manual page can also be selected by giving its name in the Menu Help/Functions. Manual pages are read-only documents (like all other help files too). But they can be used as source for editing com- mands.  The Editor-Window If a file has to be edited the Editor-Window is used. The mouse (see also The Mouse in the Editor-Window), function keys or the editor-menu can be used to edit a text. The most important menus are: Copy, move and delete a block in a file (see Block-Menu). Copy, move and delete a block between different files (see also Edit-Menu). Search and/or replace strings (see also Search-Menu). Resize and move the windows (see also Window-Menu). Change the options used by the editor in the Options-Menu. Files may be selected, saved and changed in the File-Menu.  The Find-Window The Find-Window is used to list all directories in which the searched file was found.  Alt-S and   open a File-Manager for the selected directory which displays all found files.  closes this window.  The Grep-Window The Grep-Window is used to list all files in which the searched string was found. Alt-S and <Return> open the marked file for editing. The cursor jumps to the first occurrence of the searched string. <ESC> closes this win- dow.  The Message-Window Errors in compilation and linking are listed in the Message-Window which is a read-only file. An error can be selected by moving around using the cursor-keys and pressing or by using the mouse. If an error is selected, the file causing this error will be opened and the cursor jumps to the found line. This file is (normally) read-write and can be edit immediately so that the next trial can be started.  The Project-Window All those files that are listed in the project-file will be displayed in the project-window which is started from the Project-Menu or from the Window-Menu. New files may be entered by pressing Alt-A (Add) or <Ins> directly form the file-manager. An already existing entry may be changed after it is selected by Alt-E (Edit) or <CR> or be deleted by pressing Alt-D (Delete) or <Del>. Alt-O enters the Project-Options and <ESC> closes the project-window.  The Variable-Window In the Project-File variables may be selected, they are displayed in the variable-window which can be started from the Project-Options. Alt-A (Add) and  are used to enter a new variable, Alt-E (Edit) and  change an existing entry and Alt-D (Delete) and  are used to delete an entry.  will close this window.  The Install-Window This window is selected from the Project-Options and used to display and change those commands which will be executed to install a file/project. Alt-A (Add) and  are used to enter a new command, Alt-E (Edit) and  change an existing entry and Alt-D (Delete) and  are used to delete an entry.  will close this window.  The Watch-Window This window displays read-only values from variables selected in the watch-function (see also Debug-Menu). To search for an entry the cursor keys may be used to walk around and the search-function finds a variable. Other pos- sible functions are: Edit a selected variable. Enters a new variable if the last line of this file is selected. Insert a new variable at this position in the file. Delete this entry. If a variable is not found in the current context a warning is displayed.  The Stack-Window The stack history is displayed in this window, but it can't be edited. The cursor keys are used to walk around in this list and the search-function will find an entry. <Return> will jump within the stack (this is not possible together with the The stack may be examined if a signal is caught by the pro- gramme. If this happens within a system-function than the calling visible function is shown.  Usage of the mouse with XWindow: All those keystrokes used to select from within a menu or mark a block can be replaced by using the mouse. A command will be selected by one click on the word or the correspond- ing line. A click on the 'Cancel'-command or the upper left 'Close-Button' will close a window. The mouse can be used within the editor-window (see the Mouse in the Editor-Window) and within the file-manager (see Mouse in the File-Manager).  The Mouse in the Editor-Window All those keystrokes used to select from within a menu or mark a block can be replaced by using the mouse. A command will be selected by one click on the word or the correspond- ing line. A click on the 'Cancel'-command or the upper left 'Close-Button' will close a window. The upper right button labeled with [z] is the Zoom-Button used to zoom a window. A click on the upper frame and moving the mouse while holding the left button down will move the window. Resizing a window is done be clicking on an edge and moving the mouse around while holding the button down. A line is selected by clicking on the line-number on the lower frame. A new window is opened to enter a new number. The right and the lower border move the cursor around in the window. The cursor moves one line/character if the arrows at both ends of the borders are selected. A whole page is the size of the movement if a click is set on the border itself. Moving the marker will move the displayed entry around. Function within the window: The left mouse-button: One click will move the cursor to the corresponding posi- tion. If the button is pressed while the mouse-cursor is over the text-cursor a word is marked. A marked word being marked again selects the whole line. Holding the button down and moving the mouse around is used to mark an array. If is pressed, too, the new text will be added to the previous selected one. The right mouse-button: Clicking the right button will copy the marked text into the buffer. The Alt-key selects the X-buffer. Shift selects the cut-option: The text is copied into the selected buffer and is cut from the file. The middle mouse-button: Clicking the middle button will copy the contents of the buffer at the mouse-position (Paste). The Alt-key selects the X-buffer.  The Mouse in the File-Manager: All those keystrokes used to select from within a menu or mark a block can be replaced by using the mouse. A command will be selected by one click on the word or the correspond- ing line. A click on the Cancel-command or the upper left Close-Button will close the file-manager. The upper right button labeled with [z] is the Zoom-Button used to zoom a window. A click on the upper frame and moving the mouse while hold- ing the left button down will move the window. Resizing a window is done be clicking on an edge and moving the mouse around while holding the button down. The right and the lower border move the mark around in the files-list and in the tree. The cursor moves one line if the arrows at both ends of the borders are selected. A whole page is the size of the movement if a click is set on the border itself. Moving the marker will move the displayed entry around. Function within the window: The left mouse-button: One click will mark a not selected file or directory. A marked file is selected for loading into the editor on a second click. A marked directory becomes the current working directory after clicking again on it's name. A marked file may be moved into another directory if the left button is held down while moving the mouse-pointer into the directory displayed in another file-manager window. The right mouse-button: Clicking the right button on an already marked file or directory will call the Move/Rename-function. A link is created by "moving" a file or directory into another file-manager-window. The link will be created in the current selected working directory in the other window. The middle mouse-button: To duplicate a file or directory in the current directory just click with the middle mouse-button on its marked name. A copy into another directory is performed by holding down the middle button while moving the mouse-pointer into another file-manager window.  Editor-Options Display: Alt-S The end-of-line will be displayed as '$' if a was entered and as '' as NULL (the next line the connecting line). Auto-save: Alt-P All options will be saved after the quitting the edi- tor. Alt-H After N changes a file will be saved automatically. The number N can be entered/changed in the Max. Changes -field (Alt-X). For the saved file 'file-name'.ASV will be used as new file-name, the original file is not changed. After a normal quit from xwpe the .ASV-files are deleted. Keys (Setting up the function keys): Alt-L The function keys are bind like introduced in xwpe ver- sion < 1.2.0 (Turbo C alike). Alt-C The 'Common User Access' function key binding will be used (MS-Windows alike). Auto-Indent (Automatic Indentation): Alt-Y Auto-Indent is used only for files that can be used for compilation (that are defined in the Option/Compiler -menu). Alt-W Auto-Indent is used for all files. Alt-V Don't use Auto-Indent. Alt-M The maximum number of columns per row. After this number or columns a word wrap is performed. Alt-T The number of characters a TabStop counts. Alt-X The number of changes that force an auto-save (if enabled). Alt-N The number of steps that are saved for an undo (Edit/Undo). Alt-I The number of columns used for auto-indent.  File-Manager-Options Directories: Alt-F Hidden files are displayed. Alt-D Hidden directories are displayed. Alt-K All actions (Move, Link, Copy and Remove) are recursive (sub directories will be used as source too). Sort Files By Alt-N Name Alt-I Time (time of creation time) Alt-B Bytes (Size) Alt-R Reverse order. Move/Copy: Alt-Q If the source of a Move/Copy-operation already exists it is only overwritten after a confirmation. Alt-V An existing files is overwritten. Alt-T Existing files are not overwritten. Remove: Alt-W Deleted files are moved into the wastebasket. Alt-A Files are really deleted. A confirmation is necessary. Alt-M Files are really deleted. No confirmation. Links on Files: Alt-H First try a hard-link. If this does not succeed a soft-link is used. Alt-S Use a soft-link. Wastebasket: Alt-P After exit of xwpe a confirmation for deleting the files in the wastebasket is necessary. Alt-E The contents of the wastebasket is removed. Alt-L The contents of the wastebasket is not removed. On Open: Alt-C Closes the file manager after opening a file.  Compiler-Options If the Menu  Options/Compiler is selected the entries Add Compiler and Remove Compiler and all compilers that are defined are displayed. If Add Compiler or a defined compiler is selected the fol- lowing options menu is enabled: Language The name of the programming language. Compiler The path to the compiler. Compiler-Options Options used by the compiler. Loader-Options Options used to link the files. Executable-Name The name of the resulting executable (default: [programme-name].e). File-Postfix The postfix that forces this compiler to be used (e.g. .c implies to use the C-compiler). Compiler-Style Select whether error-messages are created like a GNU or similar compiler would create it or whether the defini- tion for messages entered in the Message-String should be used. OK Accept the changes made. CANCEL Reject the changes. A new compiler/programming language can be entered in Add Compiler. If the new one is selected its options may be changed. A compiler selected from the list is removed by Remove Com- piler.  Project-Options Compiler The path to the compiler. Compiler-Options Options used by the compiler. Loader-Options Options used to link the files. Executable-Name The name of the resulting executable (default: a.out). Store Objects in Library If a filename is entered this file is used as library to all object-files. This library is used automatically for linking. Compiler-Style Select whether error-messages are created like a GNU or similar compiler would create it or whether the defini- tion for messages entered in the Message-String should be used. Variables ... Variables used by the project can be entered and removed from a separate Variable-Window. Install ... The commands used to install a program are edited in the Install-Window. Save The new project-file will be saved. Save As The new project-file will be saved with a new file- name. CANCEL Quit from the menu without any changes.  Programming C For all C- and C++-programs there are some utilities installed to aid the programmer: Show Definition (^O S): Jump to the definition of a C-expression: The file contain- ing the definition of the entered expression will be put in the foreground and the cursor jumps to the definition which will be highlighted. Structs, unions, classes, typedefs, preprocessor definitions, extern variables and functions can be searched. If a project is defined all files belonging to it will be scanned for the definition. Also all #include'd files are scanned recursively as long as they can be found in the System-Include-Path defined in Options/Programming. If the name is used more than one time in definitions (e.g. as name of a struct and as name of an external variable) the next definition may be found with ^O N (Show next Defini- tion). Matching Bracket (^O K): If the cursor is above a bracket the corresponding closing / opening bracket is searched and the cursor is moved to it. Otherwise the cursor is moved to the next opening bracket. The following pairs of brackets are recognized: {}, [] and (). Beautify (^O B): As C is a block-oriented language all blocks are indented equal. The depth of the intention depends on the degree of the blocking-depth.  The project-file The project-file allows to compile and create programmes containing more than on module. It is created from the menu Project/Options (see also Project-Options) or directly with an editor. The syntax corresponds to that of a Makefile (for version 1.1.0 and above only). In a project-file only definitions of variables and install-targets are recognized. The definition of variables is used like this: name = string The number of variables is not limited. They are accessed by writing $(name). If a variable is named like an environment variable than this environment variable is used. If a vari- able is not defined an empty string is inserted. The following variables are predefined: FILES The names of modules being compiled and linked together to create the executable file. CMP Compiler-Path CMPFLAGS Compiler-Options CMPSWTCH How are mistakes interpreted? ('GNU'(Default)/'other') LDFLAGS Loader-Options EXENAME The name of the Executables (Default: a.out) LIBNAME The filename used for a library. This library will hold all object-files belonging to the project. This library is used automatically for linking. A makefile can be transformed to a project-file very simple by adding the following lines to it (C-code): FILES=$(CFILES) CMP=$(CC) LDFLAGS=$(LIBFLAGS) EXENAME='Targetname' How Compile and Make work: The files are translated in the order given in the FILES- variable. If a source has changed after the last translation then it is translated again else the next source is taken. An error occurring while making stops the work and is displayed in the Message-Window. If no error occurs then all object-files are linked together to an executable named $(EXENAME). The project-file can contain an 'install'-target. The first line of this target is install: dependencies The dependencies are ignored because they have to be entered into the FILES-variable. All following lines starting with are interpreted as UNIX-commands and are executed. These line may contain variables defined above: Command1 Command2 Command can be every UNIX-command (only 'cd' is not exe- cuted). The 'install'-target is started from the menu Run/Install or Alt-L (see Run-Menu).  The Message-String: The Message-String defines how warnings and error-messages produced by a compilation should be interpreted if the Compiler-Style 'Other' was selected. It has to be changed for each compiler and work like this. character, '[a-z]' matches one character in the range of "a..z". (This was described in the section File-Manager.) ${FILE} is like '*' but the characters are stored as name of the file containing the error. ${LINE[+-N]} is like '*' but the characters are stored as line- number containing the error. An integer N can be added/subtracted to the line-number. The message-string has to contain both ${FILE} and ${LINE}. If a line of output can be interpreted so that it contains a valid filename and a valid line number it is used as error- output. Also the column number can be used to interpret an error- containing line. ${COLUMN[+-N]} With ${COLUMN} being used as number. ${COLUMN=BEFORE[+-N]} The string ${COLUMN} is the expression to search for and the column is Before the string found. ${COLUMN=AFTER[+-N]} The string ${COLUMN} is the expression to search for and the column is after the string found. An integer N can be added/subtracted to the column-number. If a message is written in more than one row (e.g. Sun- Pas- cal: pc) the message-string must use "\n" to divide the string into different rows. ${COLUMN=PREVIOUS?STR[+-N]} is compared against the ${CMPSTR}-string containing a string to compare with. Warnings: A warning is detected by comparison with a string STR like this: ${?N:STR} - N can be a number or a '*'- character. If N is a number then N is then number of the column where the warning begins. Otherwise if N is '*' then STR can begin at every position in the text. More than one warning-message can be defined. Some examples: gcc: ${?*:warning:}${FILE}:${LINE}:* before \ `${COLUMN=BEFORE}' cc(Sun): ${?*:warning:}"${FILE}", line ${LINE}:* \ at or near * "${COLUMN=AFTER}" cc(HP): ${?*:warning:}cc: "${FILE}", line ${LINE}:* \ at or near * "${COLUMN=AFTER}" pc(Sun): ${?0:e}${?0:w}${?0:s}*:*:* * ${FILE}:\n\n* \ ${LINE} ${CMPTXT}^M*-------${COLUMN=PREVIOUS?^}  Syntax-Support: Xwpe supports the syntax of a language by using different colors to display keywords, constants, preprocessor, com- ments, operators and everything else. This support is defined already for the programming languages C, C++, and FORTRAN. More languages can be added to the user's syntax definition file, $HOME/.xwpe/syntax_def. The syntax of any predefined language can also be overiden. If no per- sonal syntax definition file exists, the system definition file, /usr/local/lib/xwpe/syntax_def, will be used. Each syntax highlighting is distinguished by the file extension. The syntax_def uses the following format for language definition. "string: The postfix for the filename." "integer: The number of keywords." "strings: The keywords." "integer: Number of operators with more than one character length." "strings: Operators with more than one character length." "string: Operators containing one character." "string: Beginning of comment" "string: End of comment" "string: Beginning of comment reaching until the end of the line." "string: Characters used for comments depending on the column." "string: Special single characters." "integer: Column for comments (-1 for none)." "integer: Column for continuing line (-1 for none)" "Integer: Column for comment till the end of line (1000 for none)" Strings and integers are separated by blanks or carriage returns. The strings used for single character operators and for column depending comments must not contain blanks. All strings used for comments can contain NULL to indicate that there is no such comment. An integer can be zero if there is no keyword or multiple character operator. The string for special single characters contains the follow- ing fields: Character for string-constants Character for character-constants Character for preprocessor-commands Character for quoting the next character Character for next line is continuing line (if it is the last character in the line) Character (if not empty: the language is not case sensitive) If one character is not defined (e.g. missing) a blank is inserted at the corresponding position. An example: .c 32 auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while 0 ~^()[]{}<>+-/*%=|&!.?:,; /* */ NULL NULL "'#\ -1 -1 1000 .f 64 ACCESS ASSIGN BACKSPACE BLANK BLOCKDATA CALL CHARACTER CLOSE COMMON COMPLEX CONTINUE DATA DIMENSION DIRECT DO DOUBLE PRECISION ELSE END ENDFILE ENTRY EQUIVALENCE ERR EXIST EXTERNAL FILE FMT FORM FORMAT FORMATTED FUNCTION GOTO IF IMPLICIT INQUIRE INTEGER INTRINSIC IOSTAT LOGICAL NAME NAMED NEXTREC NUMBER OPEN OPENED PARAMETER PAUSE PRINT PROGRAM READ REAL REC RECL RETURN REWIND SAVE SEQUENTIAL STATUS STOP SUBROUTINE TO UNFORMATED UNIT WRITE 13 .AND. .EQ. .EQV. .FALSE. .GE. .GT. .LE. .LT. .NE. .NEQV. .NOT. .OR. .TRUE. ()+-/*=$.:, NULL NULL ! C* ' 1 0 5 72  Automatic Indentation The behavior of the auto-intention can be selected in the Editor-Options-menu. The following keys are defined: The next (new) line is indented to the beginning of the previous line. If is entered in front of the first visible char- acter the whole line is indented like the previous one. If the cursor is placed behind this column then the line is indented N characters more than the previous. N is the number entered for the Tabstops in the menu editor-options. If the cursor is placed behind this position or between visible characters a is inserted. If entered in front of the first visible character of a line the line is indented like the last line that started in front of this cursor- position.  The 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 pro- grams; 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 cer- tain 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 prob- lems 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 redis- tributors 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 licen- see 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 con- stitute 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, pro- vided 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 pub- lish, 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 war- ranty) 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 Pro- gram 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 defini- tion 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 any- thing 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 execut- able. If distribution of executable or object code is made by offering access to copy from a designated place, then offer- ing 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 distri- bute 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 per- mission to modify or distribute the Program or its deriva- tive works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distri- buting 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 modi- fying 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 reci- pients' 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 unenforce- able 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 contribu- tions 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 wil- ling 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 res- tricted in certain countries either by patents or by copy- righted interfaces, the original copyright holder who places the Program under this License may add an explicit geograph- ical 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 Foun- dation. 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 dif- ferent, write to the author to ask for permission. For software which is copyrighted by the Free Software Founda- tion, 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 deriva- tives 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 WARRAN- TIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PUR- POSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFEC- TIVE, 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 redis- tribute 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 Foun- dation; 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 Pub- lic License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cam- bridge, 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 program- mer) or your school, if any, to sign a "copyright disclai- mer" 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. xwpe-1.5.30a/we_gpm.c0000644000076400007640000000205310263105405013374 0ustar dulsidulsi#ifdef HAVE_LIBGPM /* we_gpm.c -- GPM routines for xwpe. Based on we_linux.c -- Created by Sebastiano Suraci */ #include "edit.h" #include int WpeGpmHandler(Gpm_Event *ep, void *data); int WpeGpmMouseInit(void) { Gpm_Connect c; int ret; Gpm_GetServerVersion(NULL); gpm_zerobased = 1; c.eventMask = ~0; c.defaultMask = ~GPM_HARD; c.minMod = 0; c.maxMod = ~0; ret = Gpm_Open(&c, 0); if (ret == -2) { /* Xterms returns mouse information through stdin which xwpe currently doesn't support */ Gpm_Close(); return(-1); } if (ret == -1) { return(-1); } gpm_handler = WpeGpmHandler; return(0); } int WpeGpmHandler(Gpm_Event *ep, void *data) { extern struct mouse e_mouse; GPM_DRAWPOINTER(ep); if (ep->buttons & 7) { e_mouse.x = ep->x; e_mouse.y = ep->y; e_mouse.k = ep->buttons; return(-(ep->buttons ^ 5)); } e_mouse.k = 0; return(0); } int WpeGpmMouse(int *g) { Gpm_Event e; while (Gpm_GetSnapshot(&e) == 0) Gpm_GetEvent(&e); g[1] = g[0] = e.buttons; g[2] = e.x * 8; g[3] = e.y * 8; return(1); } #endif xwpe-1.5.30a/CHANGELOG0000644000076400007640000002746310263105405013200 0ustar dulsidulsiNotes for Hackers Conditional compilation can quickly destroy the readability of source code. Non-ANSI C conditional compilation have been removed for the sake of clarity. We are sorry if this causes problems for anyone. In the future xwpe alpha may begin to use POSIX functions in preference to others as well. All support for dos has been removed. It has not worked in the last official release and there is not really a need for it. No one is actively working on the djgpp port which also didn't work in the last Fred Kruse release. The djgpp defines are slowly being removed since no support is likely in the near future. German Documentation All German documentation has been moved to the old directory as no one has updated it since 1.4.2. Known Bugs * Debugging leaks memory (actually location of the leak unknown). * Documentation hasn't been updated. * Compilers are assumed to have a -c and -o option. * 'make install' installs x versions even if not compiled in. * Adding items when no project is open has odd behavior. * Changing the maximum column and using cut & paste can crash xwpe. * Clicking "edit" in the project menu when not on a file it loads a file with a name of " ". * Esc key requires 3 presses to do the regular escape function under Linux console (and perhaps other terminal types). * No error for disk full. * Check headers doesn't correctly handle comments and "ifndef" protection. * Debugger assumes the program starts in "main". * Certain file names like 'Messages' aren't handled properly. * Cursor keys don't work in xterms or telnet sessions. Changes 1.5.30a * Some additional comments * Fedora core 4 compile fix 1.5.29a * Fixed regression of XLookupString. 1.5.28a * Corrected e_quit to properly quit the debugger. * Corrected function help bug. * Changed X11 colors to correspond to curses order. * Disabled different pointers under X11 and add file manager menu item. * Added Paulo César Pereira de Andrade's partial i18n patch. 1.5.27a * More modifications from Roman Levenstein. Not enabled by default; use -DNCURSES. * Fixed bzipped man pages. * Added Arjan van Dijk's XLookupString bug fix. * Fixed some syntax coloring problems. * Use mkdtemp if available. * Changed compiler message strings to use "\n" instead of putting in a return character directly. * Added Harry Berman's minor memory bug fixes. 1.5.26a * Spent more time fixing path limits. * Fixed blank project executable bug. * Fixed "../" bug introduced in 1.5.25a. * Autosaves no longer create backup files. * Apply Martin's translations. No more german comments. 1.5.25a * Fixed copy and paste bug. * Removed some of the path and file name limits. * Fixed seg fault when no X paste information. 1.5.24a * Fix for using gdb with ncurses 5. * Changed to use _POSIX_PATH_MAX instead of 80 in some case. Needs work. * Fixed options saving so that it doesn't save colors incorrectly. * Cleanup use of dtmd variable. * Fixed the loading and saving of MSDOS text files (no conversion to Unix format yet). 1.5.23a * Added another zoom fix by Mark Spieth * XSelection was added to 1.5.22a but forgot to get mentioned in the CHANGELOG. * Added Fritz's Y2K patch. * Converted info reader to use zlib. Zlib may be required in the future. * Allow tempnam() to create the temporary directory name if available. This function may also be required in future releases. 1.5.22a * Made the makefile once again check for existence of directories because SCO's mkdir -p spits out an error. * Changed keyboard commands back to Turbo C bindings. (Previous information was wrong.) * Added Guido Draheim's patch to optionally use ~ for backup files. * Did away with the NEWSTYLE colors. (Still need to make the colors more pleasant for NEWSTYLE. Ideally I like to be able to choose new or original style at the command line.) * Added Martin's patch for max column problems. 1.5.21a * Added Mark Spieth's patch to fix some zoom stuff and remove the file handle leak. * Added Matej Vela's patches to the makefile and fix for e_mk_info_path. * Fixed the bug in running the debugger and executable. * Heavily modified Brian's path to make projects store relative paths. * Modified compile, make, and run keyboard commands to Turbo C bindings. * Added part of Brian White's SCO man page fix. 1.5.20a * Fixed until end of line comment to allow for characters beginning with alphanumeric characters. * Fixed bugs in search and replace. * Fixed stop on error bug when compiling. * Heavily modified German Garcia's patch for multiple extensions for a compiler. * Fixed delete redo bug. 1.5.19a * Fix for mouse resize window/zoom bug based on Pedro's patch. * Made the print command an editor option. * Fixed gpm bug with a modification of Sebastiano's patch. * Modified Mark Spieth's patch for new titling method. (Editor option to use the old style.) * Added Mark's patch to read xwperc from local directory if it exists. 1.5.18a * Pedro's fix for Option->Editor bug * Checks file system for the ability to do autosave/emergency save files. * Supports multiple extensions per language syntax. * More of Pedro's file-manager massage. * Added Alexander's change case dialog. * Hopefully fixed all AIX and OSF compile problems. 1.5.17a * Fixed X windows argument bug. * Now defaults to 8x13 font when non-fixed width used. * Incorporated Pedro's memory bug fixes and menue code cleanup. * Also incorporated Pedro's file-manager cleanup. 1.5.16a * Fixed configure script bug. 1.5.15a * Changed xwpe to compile X11 and term code into shared libraries. However the configure script has yet to be changed to build it. * Fixed a leaky file descriptor and memory bug in we_debug.c code. * Added Brian's patch for inserting selected text into search and replace dialogs. * Incorporated Roman's goto cursor and finish function debugger features. (Only gdb support.) 1.5.14a * Changed local variable reg to regz because some systems defined this to register. * Added private colormap option. * Fixed slackware compile problem. * Partially fixed the maximum column and cut & paste problem. 1.5.13a * Added Alex Buell's patch for the new glibc. * Removed support for editing binary files. * Added Brian's patch to Search and Replace. * Added Martin Zampach's patch to adjust breakpoints when new lines added and to load/save the breakpoints/watches with the project. * Started incorporating Roman Levenstein's changes. POSIX regular expressions for matching and replacing. Ctrl-F1 now looks up the current function. 1.5.12a * Added Brian's patch to only allow a file to be loaded once in an earlier version but forgot to record it. This version includes some fixes to that since it wasn't working. * Added Yarick Rastrigin's tab patch. Doesn't allow tabbing through buttons but a welcome improvement (particularly for the replace dialog). * Incorporated some of James M.'s man page update. 1.5.11a * Added Brian O'Donnell's changes to projects. Includes loading projects from file manager and the "edit" now loads the file for editing. * Chaged xwperc into a text file. Removed ability to load only color info. * Some DJGPP ifdefs have been removed since it seems unlikely xwpe will support DJGPP in the near future. 1.5.10a * Fixed long filenames from crashing xwpe when the window is shrunk. * Added Duane Penzien's wastebasket delete bug fix. Should probably display some message when this occurs. It currently does nothing. * Added Anthony Barbachan's patch for newer terminfo. * Repaint the desktop no longer resizes all windows. 1.5.9a * Fixed compilation problem on older curses systems. * Added Brian O'Donnell's save patch. When a file is modified an asterisk now appears near the bottom left. The asterisk disappears when the file is saved instead of poping up a message box. 1.5.8a * Fixed gzipped man page bug. * Directory can no longer be loaded as files but it doesn't display an error message. * Incorporated Sebastiano Suraci's Linux and gpm patch. (Mostly) * Xterm define and uninitialized strings fixed by Mark Loftis. * Some spelling fixes. * Lots of formating changes. * German comments converted to English thanks to Ronald Holzloehner. 1.5.7a * Fixed watch window segmentation fault problem. * Fixed NO_XWINDOWS compilation. * Fixed autosave bug. * Fixed configure script. * Incorporated Stefan Hille's remaining changes. 1.5.6a * New configure script. aclocal.m4 is taken from lynx 2.8.1 dev 4. * Fixed remove bug (working mouse cursor stayed after removing file). * Fixed some cut and paste bugs. * Fixed no windows zoom bug. * Fixed up prototypes in edit.h and progr.h. * Incorporated some of Alexander Neundorf's changes. * Incorporated Kenn Flynn's file manager patch. * Incorporated Alexei Pavlov's changes to autoindenting. 1.5.5a * Added Mark Loftis's changes to scrolling functionality. * Incorporated more changes from Stefan Hille. * Removed some warnings. 1.5.4a * Changed naming from ALPHA-x to 1.5.xa. The change from 1.4 to 1.5a does not represent a great change in functionality instead marks the change of maintainers * Removed all remenents of dos support. * Added some changes from Stefan Hille such as messages.h. * Changed handling of expose event under X Window so that it only redraws part of the screen. * Added Java syntax to the syntax definition file. * Deciphered purpose of the help.key (formally we_help_str) file. This file gives the section of help that should be loaded while xwpe is in different states. Each line corresponds to a mode. The modes are as follows: 1 - Standard file 14 - Project menu 2 - Watch window 15 - Option menu 3 - Stack window 16 - Window menu 4 - Message window 17 - Help menu 5 - Most file-manager windows 18 - Function-Index window 6 - Execute file-manager window 19 - Grep window 7 - System (#) menu 20 - Find window 8 - File menu 21 - Project window 9 - Edit menu 22 - Variables window 10 - Search menu 23 - Install window 11 - Block menu 24 - Windows window 12 - Run menu 25 - Top menu bar 13 - Debug menu 26 - Help window ALPHA-3 * Fixed bug in WeExpArr.c * Fixed debugging problem found by Oliver Wilson. * Several other minor cleanups throughout the code. * Some documentation fixes as well. * Removed support for encrypted files (if enough people request it, the encrypted file support could be added again but for the time being we feel this is not needed in a development environment). ALPHA-2 * Fixed bug in syntax highlighting for FORTRAN. * Lots of old code that had been commented out were removed. * Some functions from we_progn.c have been renamed and moved to WeSyntax.c * Renamed all configuration files. * Changed format of syntax_def (formerly we_synt_def). This will almost certainly change again since the current format is difficult to use. * Documentation plan: 1) INSTALL - all compiling instructions and installation needs (not started) 2) README - simply states what the program does (not started) 3) xwpe.1 - describes configuration files and command line options (mostly done) 4) help.xwpe - on-line documentation describing all use (command line options updated but not configuration files and anything else) ALPHA-1 * All patches were applied except the gpm patch. * SWAP and NOWEUNDO have been removed since they don't work. * Some other defines have been removed as well. * Some functions from we_hfkt.c have been renamed and moved to WeString.c * Some functions from we_xterm.c have been renamed and moved to WeXterm.c * Modified X resources a lot making the documentation incorrect. xwpe-1.5.30a/help.key_eng0000644000076400007640000000052410263105405014246 0ustar dulsidulsi Watch-Window Stack-Window Message-Window file-manager Execution-Manager System-Menu File-Menu Edit-Menu Search-Menu Block-Menu Run-Menu Debug-Menu Project-Menu Options-Menu Window-Menu Help-Menu Function-Index Grep-Window Find-Window Project-Window Variable-Window Install-Window main-menu xwpe-1.5.30a/configure.in0000644000076400007640000000275110263105405014270 0ustar dulsidulsiAC_INIT(Xwpe.h) dnl Checks for programs. AC_PROG_CC AC_PROG_GCC_TRADITIONAL AC_PROG_CC_C_O AC_PREFIX_DEFAULT(/usr/local) CF_ANSI_CC_CHECK dnl CF_GCC_WARNINGS AC_C_CONST AC_CHECK_LIB(ncurses, main, LIBS="${LIBS} -lncurses" CURSES="yes" AC_CHECK_LIB(mytinfo, main, LIBS="${LIBS} -lmytinfo"), AC_CHECK_LIB(curses, main, LIBS="${LIBS} -lcurses" CURSES="yes", AC_DEFINE(TERMCAP) AC_CHECK_LIB(termlib, main) AC_CHECK_LIB(termcap, main) ) ) AC_CHECK_LIB(gpm, main) AC_CHECK_LIB(z, main) AC_PROG_LN_S AC_CHECK_FUNC(symlink, , AC_DEFINE(NOSYMLINKS)) AC_CHECK_FUNC(tparm, , AC_DEFINE(NOTPARM)) AC_CHECK_FUNCS(mkdtemp) if test -n "${HAVE_MKDTEMP}"; then AC_CHECK_FUNCS(tempnam) fi AC_PROG_RANLIB if test "${RANLIB}" = 'ranlib'; then AC_DEFINE(RANDLIB) fi AC_CHECK_PROG(XDB, xdb, xdb) if test "${XDB}" = 'xdb'; then AC_DEFINE(XDB) fi AC_CHECK_FUNC(strstr, , AC_DEFINE(NOSTRSTR)) AC_CHECK_PROG(PRNTCMD, lpr, lpr) if test -z "${PRNTCMD}"; then AC_CHECK_PROG(PRNTCMD, lp, lp) fi if test -n "${PRNTCMD}"; then AC_DEFINE_UNQUOTED(PRNTCMD, "$PRNTCMD") else AC_DEFINE(PRNTCMD, "") fi AC_PATH_XTRA if test -n "${no_x}"; then AC_DEFINE(NO_XWINDOWS) else X_EXTRA_LIBS="${X_EXTRA_LIBS} -lX11" fi if man -s 1 ls > /dev/null 2> /dev/null; then AC_DEFINE(MAN_S_OPT) fi if eval 'grep -s "[[ ]]putc[[ (]]" /usr/include/*.h > /dev/null'; then :; else AC_DEFINE(DEFPGC) fi if eval 'grep -s "[[ ]]tputs[[ (]]" /usr/include/*.h > /dev/null'; then :; else AC_DEFINE(DEFTPUTS) fi AC_OUTPUT(Makefile) xwpe-1.5.30a/options.h0000644000076400007640000000320310263105405013614 0ustar dulsidulsi#ifndef __OPTIONS_H #define __OPTIONS_H /*-------------------------------------------------------------------------*\ -- Header file for option variables defines, etc. Date Programmer Description 3/27/98 Kenn F. Created to handle f->ed-> stuff. \*-------------------------------------------------------------------------*/ /* FENSTER f -> CNT ed -> flopt */ #define FM_SHOW_HIDDEN_FILES 0x0001 #define FM_SHOW_HIDDEN_DIRS 0x0002 #define FM_DELETE_AT_EXIT 0x0004 #define FM_PROMPT_DELETE 0x0008 /* FM_DONT_DELETE */ #define FM_MOVE_OVERWRITE 0x0010 #define FM_MOVE_PROMPT 0x0020 /* FM_DONT_OVERWRITE */ #define FM_REMOVE_INTO_WB 0x0040 #define FM_REMOVE_PROMPT 0x0080 /* FM_REMOVE_NO_PROMPT */ #define FM_TRY_HARDLINK 0x0100 /* FM_ALWAYS_SYMBOLIC_LINK */ #define FM_SORT_NAME 0x0200 #define FM_SORT_TIME 0x0400 /* FM_SORT_BYTES */ #define FM_REVERSE_ORDER 0x0800 #define FM_REKURSIVE_ACTIONS 0x1000 #define FM_CLOSE_WINDOW 0x2000 /* FENSTER f -> CNT ed -> edopt */ #define ED_CUA_STYLE 0x0001 /* ED_OLD_STYLE */ #define ED_OLD_TILE_METHOD 0x0040 #define ED_SOURCE_AUTO_INDENT 0x0080 #define ED_ALWAYS_AUTO_INDENT 0x0100 /* ED_NEVER_AUTO_INDENT */ #define ED_ERRORS_STOP_AT 0x0010 #define ED_MESSAGES_STOP_AT 0x0020 #define ED_SYNTAX_HIGHLIGHT 0x0008 #define ED_SHOW_ENDMARKS 0x0002 #define ED_EDITOR_OPTIONS \ (ED_CUA_STYLE | ED_OLD_TILE_METHOD | ED_SOURCE_AUTO_INDENT | \ ED_ALWAYS_AUTO_INDENT | ED_SHOW_ENDMARKS) #define ED_PROGRAMMING_OPTIONS \ (ED_ERRORS_STOP_AT | ED_MESSAGES_STOP_AT | ED_SYNTAX_HIGHLIGHT) #endif xwpe-1.5.30a/WeLinux.c0000644000076400007640000000140710263105405013513 0ustar dulsidulsi#ifdef __linux__ /*-------------------------------------------------------------------------*\ -- Linux specific routines for Xwpe Date Programmer Description 04/11/98 Dennis Created based on functions from "we_linux.c". \*-------------------------------------------------------------------------*/ /* we_linux.c -- Created by Sebastiano Suraci */ #include int WpeLinuxBioskey(void) { char c; int status; c = 6; status = 0; if (ioctl(0, TIOCLINUX, &c) == 0) { if (c & 0x01) { /* Right or left shift is pressed */ status |= 0x03; } if (c & 0x04) { /* Control key is pressed */ status |= 0x04; } if (c & 0x0A) { /* Alt key is pressed */ status |= 0x08; } } return(status); } #endif xwpe-1.5.30a/aclocal.m40000644000076400007640000013100410263105405013611 0ustar dulsidulsidnl Macros for auto-configure script. dnl by T.E.Dickey dnl and Jim Spath dnl and Philippe De Muyter dnl dnl Created: 1997/1/28 dnl Updated: 1997/12/23 dnl dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's dnl redundant. We don't normally need to add -I/usr/local/include for gcc, dnl but old versions (and some misinstalled ones) need that. AC_DEFUN([CF_ADD_INCDIR], [ for cf_add_incdir in $1 do while true do case $cf_add_incdir in /usr/include) # (vi ;; *) # (vi CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" ;; esac cf_top_incdir=`echo $cf_add_incdir | sed -e 's:/include/.*$:/include:'` test "$cf_top_incdir" = "$cf_add_incdir" && break cf_add_incdir="$cf_top_incdir" done done ])dnl dnl --------------------------------------------------------------------------- dnl Check for existence of alternate-character-set support in curses, so we dnl can decide to use it for box characters. dnl AC_DEFUN([CF_ALT_CHAR_SET], [ AC_MSG_CHECKING([if curses supports alternate-character set]) AC_CACHE_VAL(cf_cv_alt_char_set,[ AC_TRY_LINK([ #include <${cf_cv_ncurses_header-curses.h}> ],[chtype x = acs_map['l']; acs_map['m'] = 0], [cf_cv_alt_char_set=yes], [cf_cv_alt_char_set=no])]) AC_MSG_RESULT($cf_cv_alt_char_set) test $cf_cv_alt_char_set = yes && AC_DEFINE(ALT_CHAR_SET) ])dnl dnl --------------------------------------------------------------------------- dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' dnl in the sharutils 4.2 distribution. AC_DEFUN([CF_ANSI_CC_CHECK], [ AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) AC_CACHE_VAL(cf_cv_ansi_cc,[ cf_cv_ansi_cc=no cf_save_CFLAGS="$CFLAGS" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) for cf_arg in "-DCC_HAS_PROTOS" "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc do CFLAGS="$cf_save_CFLAGS $cf_arg" AC_TRY_COMPILE( [ #ifndef CC_HAS_PROTOS #if !defined(__STDC__) || __STDC__ != 1 choke me #endif #endif ],[ int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);};], [cf_cv_ansi_cc="$cf_arg"; break]) done CFLAGS="$cf_save_CFLAGS" ]) AC_MSG_RESULT($cf_cv_ansi_cc) if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then CFLAGS="$CFLAGS $cf_cv_ansi_cc" else AC_DEFINE(CC_HAS_PROTOS) fi fi ])dnl dnl --------------------------------------------------------------------------- dnl Allow user to disable a normally-on option. AC_DEFUN([CF_ARG_DISABLE], [CF_ARG_OPTION($1,[$2 (default: on)],[$3],[$4],yes)])dnl dnl --------------------------------------------------------------------------- dnl Allow user to enable a normally-off option. AC_DEFUN([CF_ARG_ENABLE], [CF_ARG_OPTION($1,[$2 (default: off)],[$3],[$4],no)])dnl dnl --------------------------------------------------------------------------- dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus dnl values. dnl dnl Parameters: dnl $1 = option name dnl $2 = help-string dnl $3 = action to perform if option is not default dnl $4 = action if perform if option is default dnl $5 = default option value (either 'yes' or 'no') AC_DEFUN([CF_ARG_OPTION], [AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes) if test "$enableval" != "$5" ; then ifelse($3,,[ :]dnl ,[ $3]) ifelse($4,,,[ else $4]) fi],[enableval=$5 ifelse($4,,,[ $4 ])dnl ])])dnl dnl --------------------------------------------------------------------------- dnl Check if curses.h defines TRUE/FALSE (it does under SVr4). AC_DEFUN([CF_BOOL_DEFS], [ AC_MSG_CHECKING(if TRUE/FALSE are defined) AC_CACHE_VAL(cf_cv_bool_defs,[ AC_TRY_COMPILE([ #include <${cf_cv_ncurses_header-curses.h}> #include ],[int x = TRUE, y = FALSE], [cf_cv_bool_defs=yes], [cf_cv_bool_defs=no])]) AC_MSG_RESULT($cf_cv_bool_defs) if test "$cf_cv_bool_defs" = no ; then AC_DEFINE(TRUE,(1)) AC_DEFINE(FALSE,(0)) fi ])dnl dnl --------------------------------------------------------------------------- dnl Check for data that is usually declared in or dnl $1 = the name to check AC_DEFUN([CF_CHECK_ERRNO], [ AC_MSG_CHECKING([declaration of $1]) AC_CACHE_VAL(cf_cv_dcl_$1,[ AC_TRY_COMPILE([ #if HAVE_STDLIB_H #include #endif #include #include #include ], [long x = (long) $1], [eval 'cf_cv_dcl_'$1'=yes'], [eval 'cf_cv_dcl_'$1'=no]')]) eval 'cf_result=$cf_cv_dcl_'$1 AC_MSG_RESULT($cf_result) # It's possible (for near-UNIX clones) that the data doesn't exist AC_CACHE_VAL(cf_cv_have_$1,[ if test $cf_result = no ; then eval 'cf_result=DECL_'$1 CF_UPPER(cf_result,$cf_result) AC_DEFINE_UNQUOTED($cf_result) AC_MSG_CHECKING([existence of $1]) AC_TRY_LINK([ #undef $1 extern long $1; ], [$1 = 2], [eval 'cf_cv_have_'$1'=yes'], [eval 'cf_cv_have_'$1'=no']) eval 'cf_result=$cf_cv_have_'$1 AC_MSG_RESULT($cf_result) else eval 'cf_cv_have_'$1'=yes' fi ]) eval 'cf_result=HAVE_'$1 CF_UPPER(cf_result,$cf_result) eval 'test $cf_cv_have_'$1' = yes && AC_DEFINE_UNQUOTED($cf_result)' ])dnl dnl --------------------------------------------------------------------------- dnl Check if a function is declared by including a set of include files. dnl Invoke the corresponding actions according to whether it is found or not. dnl dnl Gcc (unlike other compilers) will only warn about the miscast assignment dnl in the first test, but most compilers will oblige with an error in the dnl second test. dnl dnl CF_CHECK_FUNCDECL(INCLUDES, FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) AC_DEFUN(CF_CHECK_FUNCDECL, [ AC_MSG_CHECKING([for $2 declaration]) AC_CACHE_VAL(ac_cv_func_decl_$2, [AC_TRY_COMPILE([$1], [#ifndef ${ac_func} extern int ${ac_func}(); #endif],[ AC_TRY_COMPILE([$1], [#ifndef ${ac_func} int (*p)() = ${ac_func}; #endif],[ eval "ac_cv_func_decl_$2=yes"],[ eval "ac_cv_func_decl_$2=no"])],[ eval "ac_cv_func_decl_$2=yes"])]) if eval "test \"`echo '$ac_cv_func_'decl_$2`\" = yes"; then AC_MSG_RESULT(yes) ifelse([$3], , :, [$3]) else AC_MSG_RESULT(no) ifelse([$4], , , [$4 ])dnl fi ])dnl dnl --------------------------------------------------------------------------- dnl Check if functions are declared by including a set of include files. dnl and define DECL_XXX if not. dnl dnl CF_CHECK_FUNCDECLS(INCLUDES, FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) AC_DEFUN(CF_CHECK_FUNCDECLS, [for ac_func in $2 do CF_CHECK_FUNCDECL([$1], $ac_func, [$3], [ CF_UPPER(ac_tr_func,DECL_$ac_func) AC_DEFINE_UNQUOTED($ac_tr_func) $4])dnl done ])dnl dnl --------------------------------------------------------------------------- dnl Check if curses supports color. (Note that while SVr3 curses supports dnl color, it does this differently from SVr4 curses; more work would be needed dnl to accommodate SVr3). dnl AC_DEFUN([CF_COLOR_CURSES], [ AC_MSG_CHECKING(if curses supports color attributes) AC_CACHE_VAL(cf_cv_color_curses,[ AC_TRY_LINK([ #include <${cf_cv_ncurses_header-curses.h}> ], [chtype x = COLOR_BLUE; has_colors(); start_color(); #ifndef NCURSES_BROKEN wbkgd(curscr, getbkgd(stdscr)); /* X/Open XPG4 aka SVr4 Curses */ #endif ], [cf_cv_color_curses=yes], [cf_cv_color_curses=no]) ]) AC_MSG_RESULT($cf_cv_color_curses) if test $cf_cv_color_curses = yes ; then AC_DEFINE(COLOR_CURSES) test ".$cf_cv_ncurses_broken" != .yes && AC_DEFINE(HAVE_GETBKGD) fi ]) dnl --------------------------------------------------------------------------- dnl Look for the curses libraries. Older curses implementations may require dnl termcap/termlib to be linked as well. AC_DEFUN([CF_CURSES_LIBS],[ AC_CHECK_FUNC(initscr,,[ case $host_os in #(vi freebsd*) #(vi AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"]) ;; hpux10.*) AC_CHECK_LIB(cur_colr,initscr,[ LIBS="-lcur_colr $LIBS" CFLAGS="-I/usr/include/curses_colr $CFLAGS" ac_cv_func_initscr=yes ],[ AC_CHECK_LIB(Hcurses,initscr,[ # HP's header uses __HP_CURSES, but user claims _HP_CURSES. LIBS="-lHcurses $LIBS" CFLAGS="-D__HP_CURSES -D_HP_CURSES $CFLAGS" ac_cv_func_initscr=yes ])]) ;; esac if test ".$With5lib" != ".no" ; then if test -d /usr/5lib ; then # SunOS 3.x or 4.x CPPFLAGS="$CPPFLAGS -I/usr/5include" LIBS="$LIBS -L/usr/5lib" fi fi if test ".$ac_cv_func_initscr" != .yes ; then cf_save_LIBS="$LIBS" cf_term_lib="" cf_curs_lib="" # Check for library containing tgoto. Do this before curses library # because it may be needed to link the test-case for initscr. AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ for cf_term_lib in termcap termlib unknown do AC_CHECK_LIB($cf_term_lib,tgoto,[break]) done ]) # Check for library containing initscr test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" for cf_curs_lib in curses ncurses xcurses cursesX jcurses unknown do AC_CHECK_LIB($cf_curs_lib,initscr,[break]) done test $cf_curs_lib = unknown && AC_ERROR(no curses library found) LIBS="-l$cf_curs_lib $cf_save_LIBS" if test "$cf_term_lib" = unknown ; then AC_MSG_CHECKING(if we can link with $cf_curs_lib library) AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr()], [cf_result=yes], [cf_result=no]) AC_MSG_RESULT($cf_result) test $cf_result = no && AC_ERROR(Cannot link curses library) elif test "$cf_term_lib" != predefined ; then AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr(); tgoto((char *)0, 0, 0);], [cf_result=no], [ LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr()], [cf_result=yes], [cf_result=error]) ]) AC_MSG_RESULT($cf_result) fi fi ])]) dnl --------------------------------------------------------------------------- dnl Solaris 2.x curses provides a "performance" tradeoff according to whether dnl CURS_PERFORMANCE is defined. If defined, the implementation defines macros dnl that access the WINDOW structure. Otherwise, function calls are used. AC_DEFUN([CF_CURS_PERFORMANCE], [ AC_MSG_CHECKING([for curses performance tradeoff]) AC_CACHE_VAL(cf_cv_curs_performance,[ cf_cv_curs_performance=no AC_TRY_COMPILE([ #include <${cf_cv_ncurses_header-curses.h}>],[ #if defined(wbkgdset) && defined(clearok) && defined(getbkgd) int x = ERR; #else int x = ; /* force an error */ #endif ],[ AC_TRY_COMPILE([ #define CURS_PERFORMANCE #include <${cf_cv_ncurses_header-curses.h}>],[ #if defined(wbkgdset) && defined(clearok) && defined(getbkgd) int x = ; /* force an error */ #else int x = ERR; #endif ],[cf_cv_curs_performance=yes])])]) AC_MSG_RESULT($cf_cv_curs_performance) test $cf_cv_curs_performance = yes && AC_DEFINE(CURS_PERFORMANCE) ])dnl dnl --------------------------------------------------------------------------- dnl Check for a program in the given list $3, defining the corresponding dnl program variable $2. dnl AC_DEFUN([CF_DEFINE_PROG],[ AC_MSG_CHECKING(for $1) AC_CACHE_VAL(cf_cv_$2,[ cf_cv_$2=unknown for cv_path in $3 do if test -f $cv_path ; then cf_cv_$2=$cv_path break fi done ]) AC_MSG_RESULT($cf_cv_$2) AC_DEFINE_UNQUOTED($2,"$cf_cv_$2") ]) dnl --------------------------------------------------------------------------- dnl You can always use "make -n" to see the actual options, but it's hard to dnl pick out/analyze warning messages when the compile-line is long. dnl dnl Sets: dnl ECHO_LD - symbol to prefix "cc -o" lines dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) dnl SHOW_CC - symbol to put before explicit "cc -c" lines dnl ECHO_CC - symbol to put before any "cc" line dnl AC_DEFUN([CF_DISABLE_ECHO],[ AC_MSG_CHECKING(if you want to see long compiling messages) CF_ARG_DISABLE(echo, [ --disable-echo test: display "compiling" commands], [ ECHO_LD='@echo linking [$]@;' RULE_CC=' @echo compiling [$]<' SHOW_CC=' @echo compiling [$]@' ECHO_CC='@' ],[ ECHO_LD='' RULE_CC='# compiling' SHOW_CC='# compiling' ECHO_CC='' ]) AC_MSG_RESULT($enableval) AC_SUBST(ECHO_LD) AC_SUBST(RULE_CC) AC_SUBST(SHOW_CC) AC_SUBST(ECHO_CC) ])dnl dnl --------------------------------------------------------------------------- dnl Check if 'errno' is declared in AC_DEFUN([CF_ERRNO], [ CF_CHECK_ERRNO(errno) ])dnl dnl --------------------------------------------------------------------------- AC_DEFUN([CF_FANCY_CURSES], [ AC_MSG_CHECKING(if curses supports fancy attributes) AC_CACHE_VAL(cf_cv_fancy_curses,[ AC_TRY_LINK([ #include <${cf_cv_ncurses_header-curses.h}> ], [attrset(A_UNDERLINE|A_BOLD|A_REVERSE); wattrset(stdscr, A_BLINK|A_DIM); attroff(A_BOLD); keypad(stdscr,TRUE); ], [cf_cv_fancy_curses=yes], [cf_cv_fancy_curses=no]) ]) AC_MSG_RESULT($cf_cv_fancy_curses) test $cf_cv_fancy_curses = yes && AC_DEFINE(FANCY_CURSES) ]) dnl --------------------------------------------------------------------------- dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We dnl prefer a standard location, and use -L options only if we do not find the dnl library in the standard library location(s). dnl $1 = library name dnl $2 = includes dnl $3 = code fragment to compile/link dnl $4 = corresponding function-name dnl dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had dnl to use a -L option. AC_DEFUN([CF_FIND_LIBRARY], [ cf_cv_have_lib_$1=no cf_libdir="" AC_CHECK_FUNC($4,cf_cv_have_lib_$1=yes,[ cf_save_LIBS="$LIBS" AC_MSG_CHECKING(for $4 in -l$1) LIBS="-l$1 $LIBS" AC_TRY_LINK([$2],[$3], [AC_MSG_RESULT(yes) cf_cv_have_lib_$1=yes ], [AC_MSG_RESULT(no) CF_LIBRARY_PATH(cf_search,$1) for cf_libdir in $cf_search do AC_MSG_CHECKING(for -l$1 in $cf_libdir) LIBS="-L$cf_libdir -l$1 $cf_save_LIBS" AC_TRY_LINK([$2],[$3], [AC_MSG_RESULT(yes) cf_cv_have_lib_$1=yes break], [AC_MSG_RESULT(no) LIBS="$cf_save_LIBS"]) done ]) ]) if test $cf_cv_have_lib_$1 = no ; then AC_ERROR(Cannot link $1 library) fi case $host_os in #(vi linux*) # Suse Linux does not follow /usr/lib convention $1="[$]$1 /lib" ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl Check for availability of fcntl versus ioctl(,FIONBIO,). Lynx uses this dnl for Sequent (ptx), and it is needed for OS/2 EMX. AC_DEFUN([CF_FIONBIO], [ AC_CACHE_CHECK(if we should use fcntl or ioctl,cf_cv_fionbio,[ AC_TRY_LINK([ #include #include ],[ int ret = ioctl(0, FIONBIO, (char *)0); ],[cf_cv_fionbio=ioctl],[ AC_TRY_LINK([ #include #if HAVE_FCNTL_H #include #else #if HAVE_SYS_FCNTL_H #include #endif #endif],[ int ret = fcntl(0, F_SETFL, O_NONBLOCK); ], [cf_cv_fionbio=fcntl], [cf_cv_fionbio=unknown])]) ]) test "$cf_cv_fionbio" = "fcntl" && AC_DEFINE(USE_FCNTL) ])dnl dnl --------------------------------------------------------------------------- dnl A conventional existence-check for 'lstat' won't work with the Linux dnl version of gcc 2.7.0, since the symbol is defined only within dnl as an inline function. dnl dnl So much for portability. AC_DEFUN([CF_FUNC_LSTAT], [ AC_MSG_CHECKING(for lstat) AC_CACHE_VAL(ac_cv_func_lstat,[ AC_TRY_LINK([ #include #include ], [lstat(".", (struct stat *)0)], [ac_cv_func_lstat=yes], [ac_cv_func_lstat=no]) ]) AC_MSG_RESULT($ac_cv_func_lstat ) if test $ac_cv_func_lstat = yes; then AC_DEFINE(HAVE_LSTAT) fi ])dnl dnl --------------------------------------------------------------------------- dnl Test for the presence of , 'union wait', arg-type of 'wait()' dnl and/or 'waitpid()'. dnl dnl Note that we cannot simply grep for 'union wait' in the wait.h file, dnl because some Posix systems turn this on only when a BSD variable is dnl defined. dnl dnl I don't use AC_HEADER_SYS_WAIT, because it defines HAVE_SYS_WAIT_H, which dnl would conflict with an attempt to test that header directly. dnl AC_DEFUN([CF_FUNC_WAIT], [ AC_REQUIRE([CF_UNION_WAIT]) if test $cf_cv_type_unionwait = yes; then AC_MSG_CHECKING(if union wait can be used as wait-arg) AC_CACHE_VAL(cf_cv_arg_union_wait,[ AC_TRY_COMPILE($cf_wait_headers, [union wait x; wait(&x)], [cf_cv_arg_union_wait=yes], [cf_cv_arg_union_wait=no]) ]) AC_MSG_RESULT($cf_cv_arg_union_wait) test $cf_cv_arg_union_wait = yes && AC_DEFINE(WAIT_USES_UNION) AC_MSG_CHECKING(if union wait can be used as waitpid-arg) AC_CACHE_VAL(cf_cv_arg_union_waitpid,[ AC_TRY_COMPILE($cf_wait_headers, [union wait x; waitpid(0, &x, 0)], [cf_cv_arg_union_waitpid=yes], [cf_cv_arg_union_waitpid=no]) ]) AC_MSG_RESULT($cf_cv_arg_union_waitpid) test $cf_cv_arg_union_waitpid = yes && AC_DEFINE(WAITPID_USES_UNION) fi ])dnl dnl --------------------------------------------------------------------------- dnl Test for availability of useful gcc __attribute__ directives to quiet dnl compiler warnings. Though useful, not all are supported -- and contrary dnl to documentation, unrecognized directives cause older compilers to barf. AC_DEFUN([CF_GCC_ATTRIBUTES], [ if test -n "$GCC" then cat > conftest.i < conftest.$ac_ext <&AC_FD_CC case $cf_attribute in scanf|printf) cat >conftest.h <conftest.h <>confdefs.h # else # sed -e 's/__attr.*/\/*nothing*\//' conftest.h >>confdefs.h fi done else fgrep define conftest.i >>confdefs.h fi rm -rf conftest* fi ])dnl dnl --------------------------------------------------------------------------- dnl Check if the compiler supports useful warning options. There's a few that dnl we don't use, simply because they're too noisy: dnl dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) dnl -Wredundant-decls (system headers make this too noisy) dnl -Wtraditional (combines too many unrelated messages, only a few useful) dnl -Wwrite-strings (too noisy, but should review occasionally) dnl -pedantic dnl AC_DEFUN([CF_GCC_WARNINGS], [ if test -n "$GCC" then changequote(,)dnl cat > conftest.$ac_ext < AC_DEFUN([CF_LOCALE], [ AC_MSG_CHECKING(for setlocale()) AC_CACHE_VAL(cf_cv_locale,[ AC_TRY_LINK([#include ], [setlocale(LC_ALL, "")], [cf_cv_locale=yes], [cf_cv_locale=no]) ]) AC_MSG_RESULT($cf_cv_locale) test $cf_cv_locale = yes && AC_DEFINE(LOCALE) ]) dnl --------------------------------------------------------------------------- dnl Check for the use of 'include' in 'make' (BSDI is a special case) dnl The symbol $ac_make is set in AC_MAKE_SET, as a side-effect. AC_DEFUN([CF_MAKE_INCLUDE], [ AC_MSG_CHECKING(for style of include in makefiles) make_include_left="" make_include_right="" make_include_quote="unknown" cf_inc=head$$ cf_dir=subd$$ echo 'RESULT=OK' >$cf_inc mkdir $cf_dir for cf_include in "include" ".include" "!include" do for cf_quote in '' '"' do cat >$cf_dir/makefile <&AC_FD_CC | grep cf_make_include=OK` if test -n "$cf_make_include"; then make_include_left="$cf_include" make_include_quote="$cf_quote" break else echo Tried 1>&AC_FD_CC cat $cf_dir/makefile 1>&AC_FD_CC fi done test -n "$cf_make_include" && break done rm -rf $cf_inc $cf_dir if test -z "$make_include_left" ; then AC_ERROR(Your $ac_make program does not support includes) fi if test ".$make_include_quote" != .unknown ; then make_include_left="$make_include_left $make_include_quote" make_include_right="$make_include_quote" fi AC_MSG_RESULT(${make_include_left}file${make_include_right}) AC_SUBST(make_include_left) AC_SUBST(make_include_right) ])dnl dnl --------------------------------------------------------------------------- dnl Check for pre-1.9.9g ncurses (among other problems, the most obvious is dnl that color combinations don't work). AC_DEFUN([CF_NCURSES_BROKEN], [ AC_REQUIRE([CF_NCURSES_VERSION]) if test "$cf_cv_ncurses_version" != no ; then AC_MSG_CHECKING(for obsolete/broken version of ncurses) AC_CACHE_VAL(cf_cv_ncurses_broken,[ AC_TRY_COMPILE([ #include <${cf_cv_ncurses_header-curses.h}>],[ #if defined(NCURSES_VERSION) && defined(wgetbkgd) make an error #else int x = 1 #endif ], [cf_cv_ncurses_broken=no], [cf_cv_ncurses_broken=yes]) ]) AC_MSG_RESULT($cf_cv_ncurses_broken) if test "$cf_cv_ncurses_broken" = yes ; then AC_MSG_WARN(hmm... you should get an up-to-date version of ncurses) AC_DEFINE(NCURSES_BROKEN) fi fi ])dnl dnl --------------------------------------------------------------------------- dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting dnl the CPPFLAGS variable. dnl dnl The header files may be installed as either curses.h, or ncurses.h dnl (obsolete). If not installed for overwrite, the curses.h file would be dnl in an ncurses subdirectory (e.g., /usr/include/ncurses), but someone may dnl have installed overwriting the vendor's curses. Only very old versions dnl (pre-1.9.2d, the first autoconf'd version) of ncurses don't define dnl either __NCURSES_H or NCURSES_VERSION in the header. dnl dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header dnl is already in the include-path, don't even bother with this, since we cannot dnl easily determine which file it is. In this case, it has to be . dnl AC_DEFUN([CF_NCURSES_CPPFLAGS], [ AC_MSG_CHECKING(for ncurses header file) AC_CACHE_VAL(cf_cv_ncurses_header,[ AC_TRY_COMPILE([#include ],[ #ifdef NCURSES_VERSION printf("%s\n", NCURSES_VERSION); #else #ifdef __NCURSES_H printf("old\n"); #else make an error #endif #endif ], [cf_cv_ncurses_header=predefined],[ CF_HEADER_PATH(cf_search,ncurses) test -n "$verbose" && echo for cf_incdir in $cf_search do for cf_header in \ curses.h \ ncurses.h do changequote(,)dnl if egrep "NCURSES_[VH]" $cf_incdir/$cf_header 1>&AC_FD_CC 2>&1; then changequote([,])dnl cf_cv_ncurses_header=$cf_incdir/$cf_header test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG break fi test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG done test -n "$cf_cv_ncurses_header" && break done test -z "$cf_cv_ncurses_header" && AC_ERROR(not found) ])]) AC_MSG_RESULT($cf_cv_ncurses_header) AC_DEFINE(NCURSES) changequote(,)dnl cf_incdir=`echo $cf_cv_ncurses_header | sed -e 's:/[^/]*$::'` changequote([,])dnl case $cf_cv_ncurses_header in # (vi */ncurses.h) AC_DEFINE(HAVE_NCURSES_H) ;; esac case $cf_cv_ncurses_header in # (vi predefined) # (vi cf_cv_ncurses_header=curses.h ;; *) CF_ADD_INCDIR($cf_incdir) ;; esac CF_NCURSES_VERSION ])dnl dnl --------------------------------------------------------------------------- dnl Look for the ncurses library. This is a little complicated on Linux, dnl because it may be linked with the gpm (general purpose mouse) library. dnl Some distributions have gpm linked with (bsd) curses, which makes it dnl unusable with ncurses. However, we don't want to link with gpm unless dnl ncurses has a dependency, since gpm is normally set up as a shared library, dnl and the linker will record a dependency. AC_DEFUN([CF_NCURSES_LIBS], [AC_REQUIRE([CF_NCURSES_CPPFLAGS]) # This works, except for the special case where we find gpm, but # ncurses is in a nonstandard location via $LIBS, and we really want # to link gpm. cf_ncurses_LIBS="" cf_ncurses_SAVE="$LIBS" AC_CHECK_LIB(gpm,Gpm_Open, [AC_CHECK_LIB(gpm,initscr, [LIBS="$cf_ncurses_SAVE"], [cf_ncurses_LIBS="-lgpm"])]) case $host_os in #(vi freebsd*) # This is only necessary if you are linking against an obsolete # version of ncurses (but it should do no harm, since it's static). AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"]) ;; esac LIBS="$cf_ncurses_LIBS $LIBS" CF_FIND_LIBRARY(ncurses, [#include <${cf_cv_ncurses_header-curses.h}>], [initscr()], initscr) if test -n "$cf_ncurses_LIBS" ; then AC_MSG_CHECKING(if we can link ncurses without $cf_ncurses_LIBS) cf_ncurses_SAVE="$LIBS" for p in $cf_ncurses_LIBS ; do q=`echo $LIBS | sed -e 's/'$p' //' -e 's/'$p'$//'` if test "$q" != "$LIBS" ; then LIBS="$q" fi done AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) LIBS="$cf_ncurses_SAVE"]) fi ])dnl dnl --------------------------------------------------------------------------- dnl Check for the version of ncurses, to aid in reporting bugs, etc. AC_DEFUN([CF_NCURSES_VERSION], [AC_MSG_CHECKING(for ncurses version) AC_CACHE_VAL(cf_cv_ncurses_version,[ cf_cv_ncurses_version=no cf_tempfile=out$$ AC_TRY_RUN([ #include <${cf_cv_ncurses_header-curses.h}> int main() { FILE *fp = fopen("$cf_tempfile", "w"); #ifdef NCURSES_VERSION # ifdef NCURSES_VERSION_PATCH fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); # else fprintf(fp, "%s\n", NCURSES_VERSION); # endif #else # ifdef __NCURSES_H fprintf(fp, "old\n"); # else make an error # endif #endif exit(0); }],[ cf_cv_ncurses_version=`cat $cf_tempfile` rm -f $cf_tempfile],,[ # This will not work if the preprocessor splits the line after the # Autoconf token. The 'unproto' program does that. cat > conftest.$ac_ext < #undef Autoconf #ifdef NCURSES_VERSION Autoconf NCURSES_VERSION #else #ifdef __NCURSES_H Autoconf "old" #endif ; #endif EOF cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out" AC_TRY_EVAL(cf_try) if test -f conftest.out ; then changequote(,)dnl cf_out=`cat conftest.out | sed -e 's@^Autoconf @@' -e 's@^[^"]*"@@' -e 's@".*@@'` changequote([,])dnl test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" rm -f conftest.out fi ])]) AC_MSG_RESULT($cf_cv_ncurses_version) ]) dnl --------------------------------------------------------------------------- dnl After checking for functions in the default $LIBS, make a further check dnl for the functions that are netlib-related (these aren't always in the dnl libc, etc., and have to be handled specially because there are conflicting dnl and broken implementations. dnl Common library requirements (in order): dnl -lresolv -lsocket -lnsl dnl -lnsl -lsocket dnl -lsocket dnl -lbsd AC_DEFUN([CF_NETLIBS],[ cf_test_netlibs=no AC_MSG_CHECKING(for network libraries) AC_CACHE_VAL(cf_cv_netlibs,[ AC_MSG_RESULT(working...) cf_cv_netlibs="" cf_test_netlibs=yes AC_CHECK_FUNCS(gethostname,,[ CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[ CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])]) # # FIXME: sequent needs this library (i.e., -lsocket -linet -lnsl), but # I don't know the entrypoints - 97/7/22 TD AC_HAVE_LIBRARY(inet,cf_cv_netlibs="-linet $cf_cv_netlibs") # if test "$ac_cv_func_lsocket" != no ; then AC_CHECK_FUNCS(socket,,[ CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[ CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])]) fi # AC_CHECK_FUNCS(gethostbyname,,[ CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)]) # AC_CHECK_FUNCS(strcasecmp,,[ CF_RECHECK_FUNC(strcasecmp,resolv,cf_cv_netlibs)]) ]) LIBS="$LIBS $cf_cv_netlibs" test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG ])dnl dnl --------------------------------------------------------------------------- dnl Check for the symbol NGROUPS AC_DEFUN([CF_NGROUPS], [ AC_MSG_CHECKING(if NGROUPS is defined) AC_CACHE_VAL(cf_cv_ngroups,[ AC_TRY_COMPILE([ #if HAVE_SYS_PARAM_H #include #endif #if HAVE_LIMITS_H #include #endif ],[int x = NGROUPS], [cf_cv_ngroups=yes], [AC_TRY_COMPILE([ #if HAVE_SYS_PARAM_H #include #endif #if HAVE_LIMITS_H #include #endif ],[int x = NGROUPS_MAX], [cf_cv_ngroups=NGROUPS_MAX], [cf_cv_ngroups=no]) ]) AC_MSG_RESULT($cf_cv_ngroups) if test "$cf_cv_ngroups" = no ; then AC_DEFINE(NGROUPS,16) elif test "$cf_cv_ngroups" = NGROUPS_MAX ; then AC_DEFINE(NGROUPS,NGROUPS_MAX) fi ]) ])dnl dnl --------------------------------------------------------------------------- dnl Check for a given program, defining corresponding symbol. dnl $1 = environment variable, which is suffixed by "_PATH" in the #define. dnl $2 = program name to find. dnl dnl If there is more than one token in the result, #define the remaining tokens dnl to $1_ARGS. We need this for 'install' in particular. dnl dnl FIXME: we should allow this to be overridden by environment variables dnl AC_DEFUN([CF_PATH_PROG],[ test -z "[$]$1" && $1=$2 if test "$with_full_paths" = yes ; then AC_PATH_PROG($1,$2,[$]$1) else AC_MSG_CHECKING(for $2) AC_MSG_RESULT([$]$1) fi cf_path_prog="" cf_path_args="" IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_$1 do if test -z "$cf_path_prog" ; then cf_path_prog="$cf_temp" elif test -z "$cf_path_args" ; then cf_path_args="$cf_temp" else cf_path_args="$cf_path_args $cf_temp" fi done IFS="$cf_save_ifs" AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog") test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args") ])dnl dnl --------------------------------------------------------------------------- dnl Re-check on a function to see if we can pick it up by adding a library. dnl $1 = function to check dnl $2 = library to check in dnl $3 = environment to update (e.g., $LIBS) dnl $4 = what to do if this fails dnl dnl This uses 'unset' if the shell happens to support it, but leaves the dnl configuration variable set to 'unknown' if not. This is a little better dnl than the normal autoconf test, which gives misleading results if a test dnl for the function is made (e.g., with AC_CHECK_FUNC) after this macro is dnl used (autoconf does not distinguish between a null token and one that is dnl set to 'no'). AC_DEFUN([CF_RECHECK_FUNC],[ AC_CHECK_LIB($2,$1,[ CF_UPPER(cf_tr_func,$1) AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func) ac_cv_func_$1=yes $3="-l$2 [$]$3"],[ ac_cv_func_$1=unknown unset ac_cv_func_$1 2>/dev/null $4], [[$]$3]) ])dnl dnl --------------------------------------------------------------------------- dnl Check for broken definition of 'remove()'. This is (in particular) broken dnl on the older version of SCO (I'd cite version if I knew where to look) by dnl having #define remove to __unlink, which appears in no library. dnl dnl Fortuitously, we can combine this with a more general test: do we have dnl 'unlink()' but no 'remove()'. Note, however, that we cannot simply #define dnl remove to unlink, but have to make a fallback function. dnl AC_DEFUN([CF_REMOVE_BROKEN], [ AC_MSG_CHECKING(for broken/missing definition of remove) AC_CACHE_VAL(cf_cv_baddef_remove,[ AC_TRY_LINK( [#include ], [remove("dummy")], [cf_cv_baddef_remove=no], [AC_TRY_LINK( [#include int __unlink(name) { return unlink(name); } ], [remove("dummy")], [cf_cv_baddef_remove=yes], [cf_cv_baddef_remove=unknown]) ]) ]) AC_MSG_RESULT($cf_cv_baddef_remove) test "$cf_cv_baddef_remove" != no && AC_DEFINE(NEED_REMOVE) ])dnl dnl --------------------------------------------------------------------------- dnl Check for definitions & structures needed for window size-changing dnl FIXME: check that this works with "snake" (HP-UX 10.x) AC_DEFUN([CF_SIZECHANGE], [ AC_MSG_CHECKING([declaration of size-change]) AC_CACHE_VAL(cf_cv_sizechange,[ cf_cv_sizechange=unknown cf_save_CFLAGS="$CFLAGS" for cf_opts in "" "NEED_PTEM_H" do CFLAGS="$cf_save_CFLAGS" test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts" AC_TRY_COMPILE([#include #if HAVE_TERMIOS_H #include #else #if HAVE_TERMIO_H #include #endif #endif #if NEED_PTEM_H /* This is a workaround for SCO: they neglected to define struct winsize in * termios.h -- it's only in termio.h and ptem.h */ #include #include #endif #if !defined(sun) || !defined(HAVE_TERMIOS_H) #include #endif ],[ #ifdef TIOCGSIZE struct ttysize win; /* FIXME: what system is this? */ int y = win.ts_lines; int x = win.ts_cols; #else #ifdef TIOCGWINSZ struct winsize win; int y = win.ws_row; int x = win.ws_col; #else no TIOCGSIZE or TIOCGWINSZ #endif /* TIOCGWINSZ */ #endif /* TIOCGSIZE */ ], [cf_cv_sizechange=yes], [cf_cv_sizechange=no]) CFLAGS="$cf_save_CFLAGS" if test "$cf_cv_sizechange" = yes ; then echo "size-change succeeded ($cf_opts)" >&AC_FD_CC test -n "$cf_opts" && AC_DEFINE_UNQUOTED($cf_opts) break fi done ]) AC_MSG_RESULT($cf_cv_sizechange) test $cf_cv_sizechange != no && AC_DEFINE(HAVE_SIZECHANGE) ])dnl dnl --------------------------------------------------------------------------- dnl Look for the slang header files in the standard places, adjusting the dnl CPPFLAGS variable. dnl AC_DEFUN([CF_SLANG_CPPFLAGS], [ AC_MSG_CHECKING(for slang header file) AC_CACHE_VAL(cf_cv_slang_header,[ AC_TRY_COMPILE([#include ], [printf("%s\n", SLANG_VERSION)], [cf_cv_slang_header=predefined],[ CF_HEADER_PATH(cf_search,slang) for cf_incdir in $cf_search do for cf_header in \ slang.h do echo trying $cf_incdir/$cf_header 1>&AC_FD_CC if egrep "SLANG_VERSION" $cf_incdir/$cf_header 1>&AC_FD_CC 2>&1; then cf_cv_slang_header=$cf_incdir/$cf_header break fi done test -n "$cf_cv_slang_header" && break done test -z "$cf_cv_slang_header" && AC_ERROR(not found) ])]) AC_MSG_RESULT($cf_cv_slang_header) AC_DEFINE(USE_SLANG) changequote(,)dnl cf_incdir=`echo $cf_cv_slang_header | sed -e 's:/[^/]*$::'` changequote([,])dnl case $cf_cv_slang_header in # (vi predefined) # (vi ;; *) CF_ADD_INCDIR($cf_incdir) ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl Look for the slang library. AC_DEFUN([CF_SLANG_LIBS], [ cf_slang_LIBS1="$LIBS" CF_TERMCAP_LIBS cf_slang_LIBS2="$LIBS" AC_CHECK_FUNC(acos,,[CF_RECHECK_FUNC(acos,m,LIBS)]) CF_FIND_LIBRARY(slang, [#include ], [SLtt_get_screen_size()], SLtt_get_screen_size) cf_slang_LIBS3="$LIBS" AC_MSG_CHECKING(if we can link slang without termcap) if test -n "`echo $cf_slang_LIBS1 | sed -e 's/ //g'`" ; then cf_exclude=`echo ".$cf_slang_LIBS2" | sed -e "s@$cf_slang_LIBS1@@" -e 's@^.@@'` else cf_exclude="$cf_slang_LIBS2" fi LIBS=`echo ".$cf_slang_LIBS3" | sed -e "s@$cf_exclude@@" -e 's@^.@@'` AC_TRY_LINK([#include ], [SLtt_get_screen_size()], [cf_result=yes], [cf_result=no]) AC_MSG_RESULT($cf_result) test $cf_result = no && LIBS="$cf_slang_LIBS3" ])dnl dnl --------------------------------------------------------------------------- dnl Remove "-g" option from the compiler options AC_DEFUN([CF_STRIP_G_OPT], [$1=`echo ${$1} | sed -e 's/-g //' -e 's/-g$//'`])dnl dnl --------------------------------------------------------------------------- dnl Remove "-O" option from the compiler options AC_DEFUN([CF_STRIP_O_OPT],[ changequote(,)dnl $1=`echo ${$1} | sed -e 's/-O[1-9]\? //' -e 's/-O[1-9]\?$//'` changequote([,])dnl ])dnl dnl --------------------------------------------------------------------------- AC_DEFUN([CF_SYSTEM_MAIL_FLAGS], [ AC_MSG_CHECKING([system mail flags]) AC_CACHE_VAL(cf_cv_system_mail_flags,[ case $cf_cv_SYSTEM_MAIL in */mmdf/*) [cf_cv_system_mail_flags="-mlruxto,cc\\\\*"] ;; *) [cf_cv_system_mail_flags="-t -oi"] esac ]) AC_MSG_RESULT($cf_cv_system_mail_flags) AC_DEFINE_UNQUOTED(SYSTEM_MAIL_FLAGS, "$cf_cv_system_mail_flags") ])dnl dnl --------------------------------------------------------------------------- dnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and dnl errno.h. Declaration of sys_errlist on BSD4.4 interferes with our dnl declaration. Reported by Keith Bostic. AC_DEFUN([CF_SYS_ERRLIST], [ for cf_name in sys_nerr sys_errlist do CF_CHECK_ERRNO($cf_name) done ])dnl dnl --------------------------------------------------------------------------- dnl Look for termcap libraries, needed by some versions of slang. AC_DEFUN([CF_TERMCAP_LIBS], [ AC_CACHE_VAL(cf_cv_lib_termcap,[ cf_cv_lib_termcap=none # HP-UX 9.x terminfo has setupterm, but no tigetstr. if test "$termlib" = none; then AC_CHECK_LIB(termlib, tigetstr, [LIBS="$LIBS -ltermlib" cf_cv_lib_termcap=terminfo]) fi if test "$cf_cv_lib_termcap" = none; then AC_CHECK_LIB(termlib, tgoto, [LIBS="$LIBS -ltermlib" cf_cv_lib_termcap=termcap]) fi if test "$cf_cv_lib_termcap" = none; then # allow curses library for broken AIX system. AC_CHECK_LIB(curses, initscr, [LIBS="$LIBS -lcurses" cf_cv_lib_termcap=termcap]) AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap" cf_cv_lib_termcap=termcap]) fi if test "$cf_cv_lib_termcap" = none; then AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap" cf_cv_lib_termcap=termcap]) fi if test "$cf_cv_lib_termcap" = none; then AC_CHECK_LIB(ncurses, tgoto, [LIBS="$LIBS -lncurses" cf_cv_lib_termcap=ncurses]) fi ]) if test "$cf_cv_lib_termcap" = none; then AC_ERROR([Can't find -ltermlib, -lcurses, or -ltermcap]) fi ])dnl dnl --------------------------------------------------------------------------- dnl Check if including both termio.h and termios.h die like on DG.UX AC_DEFUN([CF_TERMIO_AND_TERMIOS], [ AC_MSG_CHECKING([termio.h and termios.h]) AC_CACHE_VAL(cf_cv_termio_and_termios,[ AC_TRY_COMPILE([ #if HAVE_TERMIO_H #include #endif #if HAVE_TERMIOS_H #include #endif ], [putchar (0x0a)], [cf_cv_termio_and_termios=yes], [cf_cv_termio_and_termios=no])]) AC_MSG_RESULT($cf_cv_termio_and_termios) test $cf_cv_termio_and_termios = no && AC_DEFINE(TERMIO_AND_TERMIOS) ])dnl dnl --------------------------------------------------------------------------- AC_DEFUN([CF_TTYTYPE], [ AC_MSG_CHECKING(if ttytype is declared in curses library) AC_CACHE_VAL(cf_cv_have_ttytype,[ AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [char *x = &ttytype[1]; *x = 1], [cf_cv_have_ttytype=yes], [cf_cv_have_ttytype=no]) ]) AC_MSG_RESULT($cf_cv_have_ttytype) test $cf_cv_have_ttytype = yes && AC_DEFINE(HAVE_TTYTYPE) ]) dnl --------------------------------------------------------------------------- dnl Check to see if the BSD-style union wait is declared. Some platforms may dnl use this, though it is deprecated in favor of the 'int' type in Posix. dnl Some vendors provide a bogus implementation that declares union wait, but dnl uses the 'int' type instead; we try to spot these by checking for the dnl associated macros. dnl dnl Ahem. Some implementers cast the status value to an int*, as an attempt to dnl use the macros for either union wait or int. So we do a check compile to dnl see if the macros are defined and apply to an int. dnl dnl Sets: $cf_cv_type_unionwait dnl Defines: HAVE_TYPE_UNIONWAIT AC_DEFUN([CF_UNION_WAIT], [ AC_REQUIRE([CF_WAIT_HEADERS]) AC_MSG_CHECKING([for union wait]) AC_CACHE_VAL(cf_cv_type_unionwait,[ AC_TRY_LINK($cf_wait_headers, [int x; int y = WEXITSTATUS(x); int z = WTERMSIG(x); wait(&x); ], [cf_cv_type_unionwait=no echo compiles ok w/o union wait 1>&AC_FD_CC ],[ AC_TRY_LINK($cf_wait_headers, [union wait x; #ifdef WEXITSTATUS int y = WEXITSTATUS(x); #endif #ifdef WTERMSIG int z = WTERMSIG(x); #endif wait(&x); ], [cf_cv_type_unionwait=yes echo compiles ok with union wait and possibly macros too 1>&AC_FD_CC ], [cf_cv_type_unionwait=no])])]) AC_MSG_RESULT($cf_cv_type_unionwait) test $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT) ])dnl dnl --------------------------------------------------------------------------- dnl Make an uppercase version of a variable dnl $1=uppercase($2) AC_DEFUN([CF_UPPER], [ changequote(,)dnl $1=`echo $2 | tr '[a-z]' '[A-Z]'` changequote([,])dnl ])dnl dnl --------------------------------------------------------------------------- AC_DEFUN([CF_UTMP], [ AC_MSG_CHECKING(if struct utmp is declared) AC_CACHE_VAL(cf_cv_have_utmp,[ AC_TRY_COMPILE([ #include #include ], [struct utmp x; char *y = &x.ut_host[0]], [cf_cv_have_utmp=yes], [AC_TRY_COMPILE([#include ], [struct utmpx x; char *y = &x.ut_host[0]], [cf_cv_have_utmp=utmpx], [cf_cv_have_utmp=no]) ]) ]) AC_MSG_RESULT($cf_cv_have_utmp) test $cf_cv_have_utmp != no && AC_DEFINE(HAVE_UTMP) test $cf_cv_have_utmp = utmpx && AC_DEFINE(UTMPX_FOR_UTMP) ]) dnl --------------------------------------------------------------------------- dnl Build up an expression $cf_wait_headers with the header files needed to dnl compile against the prototypes for 'wait()', 'waitpid()', etc. Assume it's dnl Posix, which uses and , but allow SVr4 variation dnl with . AC_DEFUN([CF_WAIT_HEADERS], [ AC_HAVE_HEADERS(sys/wait.h) cf_wait_headers="#include " if test $ac_cv_header_sys_wait_h = yes; then cf_wait_headers="$cf_wait_headers #include " else AC_HAVE_HEADERS(wait.h) AC_HAVE_HEADERS(waitstatus.h) if test $ac_cv_header_wait_h = yes; then cf_wait_headers="$cf_wait_headers #include " fi if test $ac_cv_header_waitstatus_h = yes; then cf_wait_headers="$cf_wait_headers #include " fi fi ])dnl xwpe-1.5.30a/Makefile.in0000644000076400007640000001330710263105405014023 0ustar dulsidulsi#C-Compiler (gcc if exist): CC= @CC@ CFLAGS= @CFLAGS@ @X_CFLAGS@ #CFLAGS= @CFLAGS@ @EXTRA_CFLAGS@ @X_CFLAGS@ #Source Directory: srcdir= @srcdir@ #Destination Directory prefix=@prefix@ exec_prefix=@exec_prefix@ DESTDIR=@bindir@ LIBDIR=@libdir@ XWPELIBDIR= $(LIBDIR)/xwpe MANDIR=@mandir@ LIBS=@LIBS@ XLIBS=@X_LIBS@ @X_PRE_LIBS@ @X_EXTRA_LIBS@ DEFS=@DEFS@ -DLIBRARY_DIR=\"$(XWPELIBDIR)\" -DSELECTION INSTALL= cp LN_S= @LN_S@ # In case configure fails a description of many of the compilation options # are provided below so that administrators can determine the proper flags. # Please email any problems to Dennis Payne (dulsi@identicalsoftware.com) # Recognized defines: # -DNONEWSTYLE :Use xwpe-style of version < 1.2.0 # -DNO_XWINDOWS :Don't create the X windows versions # -DNOPROG :Don't create the programming environment (Broken) # -DNODEBUGGER :Don't include debugging features (Broken) # -DNOPRINTER :No printing from within xwpe # -DPRNTCMD=\"lpr\" :Command to print is \"lpr\" # -DMAN_S_OPT :Man accepts "-s" to select section # -DNO_MINUS_C_MINUS_O :Compiler doesn't accept -o and -c on same command # -DDEFPGC :No macros for putc and getc # -DDEFTPUTS :No prototype for tputs # -DNOSTRSTR :No prototype for strstr and getcwd # -DRANLIB :Have to run ranlib after building a library # -DNOSYMLINKS :No symbolic links # -DXDB :System has xdb not dbx # -DTERMCAP :Use termcap instead of curses # -DSIMPLE_BACKUP_SUFFIX=\"\" # : The bak-file suffix, default is TurboC-like # -DDEFAULT_ALTMASK=Mod3Mask # :Mask to determined if alt is pressed in X # -DINFO_DIR=\"/usr/local/info\" # :Location of info directory # -DLIBRARY_DIR=\"/usr/local/lib/xwpe\" # :Location of xwpe library directory # -DDEF_SHELL=\"/bin/ksh\" # :Default shell to run # -DXTERM_CMD=\"/usr/X11R6/bin/color_xterm\" # :Define the command to execute an xterm # -DXWPE_DLL :Builds x and terminal support into libraries # -DSELECTION :Use X Selection events instead of XStoreBytes # Possible include paths needed: # -I/usr/X11R5/include :X include path # -I/usr/5include :System V include path # Possible library paths needed: # -L/usr/X11R5/lib :X library path # -L/usr/5lib :System V library path # Possible libraries needed: # -lX11 :X library # -lcurses :Curses library # -lncurses :Ncurses library (replaces curses on newer systems) # -ltermlib :Termcap library # -lcposix :Posix Library # -linet :Network library OFILES= we_main.o we_block.o we_unix.o we_e_aus.o \ we_edit.o we_fl_fkt.o we_fl_unix.o we_hfkt.o \ we_menue.o we_mouse.o we_opt.o we_wind.o \ we_prog.o we_progn.o we_debug.o WeString.o \ WeSyntax.o WeExpArr.o WeLinux.o we_gpm.o X_OFILES= we_xterm.o WeXterm.o T_OFILES= we_term.o CFILES= we_main.c we_block.c we_unix.c we_e_aus.c \ we_edit.c we_fl_fkt.c we_fl_unix.c we_hfkt.c \ we_menue.c we_mouse.c we_opt.c we_wind.c we_term.c \ we_prog.c we_progn.c we_debug.c we_xterm.c WeString.c \ WeXterm.c WeSyntax.c WeExpArr.c WeLinux.c we_gpm.c HFILES= attrb.h edit.h keys.h \ model.h progr.h unixkeys.h unixmakr.h \ Xwpe.h WeString.h WeXterm.h WeProg.h WeExpArr.h xwpe: $(OFILES) $(X_OFILES) $(T_OFILES) $(CC) $(CFLAGS) $(DEFS) $(OFILES) $(X_OFILES) $(T_OFILES) \ $(LIBS) $(XLIBS) -o xwpe # $(CC) -Wl,-E $(CFLAGS) $(DEFS) $(OFILES) $(LIBS) -o xwpe libxwpe-x11.so: $(X_OFILES) $(CC) -shared $(X_OFILES) $(XLIBS) -o libxwpe-x11.so libxwpe-term.so: $(T_OFILES) $(CC) -shared $(T_OFILES) -o libxwpe-term.so #$(X_OFILES) $(T_OFILES): $(HFILES) # $(CC) -fPIC $(CFLAGS) $(DEFS) -c $(subst .o,.c,$@) .c.o: $(HFILES) $(CC) $(CFLAGS) $(DEFS) -c $< clean: rm -f *.o xwpe wpe we xwe libxwpe-x11.so libxwpe-term.so core *.ESV distclean: rm -f config.status config.cache config.log Makefile # Bug Note: Currently xwpe and xwe are installed even if X windows versions # are not compiled. (They will function as wpe and we respectively.) install_fst: xwpe if test ! -d $(DESTDIR); then mkdir -p $(DESTDIR); fi if test ! -d $(XWPELIBDIR); then mkdir -p $(XWPELIBDIR); fi rm -f $(DESTDIR)/wpe $(DESTDIR)/xwpe $(DESTDIR)/we $(DESTDIR)/xwe $(INSTALL) xwpe $(DESTDIR)/we chmod ugo+x $(DESTDIR)/we (cd $(DESTDIR) && $(LN_S) we xwe) (cd $(DESTDIR) && $(LN_S) we xwpe) (cd $(DESTDIR) && $(LN_S) we wpe) rm -f $(XWPELIBDIR)/help.xwpe if test ! -f $(XWPELIBDIR)/syntax_def; then \ $(INSTALL) syntax_def $(XWPELIBDIR)/syntax_def; \ chmod ugo=r $(XWPELIBDIR)/syntax_def; fi if test ! -d $(MANDIR)/man1; then mkdir -p $(MANDIR)/man1; fi rm -f $(MANDIR)/man1/xwpe.1 $(MANDIR)/man1/xwe.1 rm -f $(MANDIR)/man1/wpe.1 $(MANDIR)/man1/we.1 $(INSTALL) xwe.1 wpe.1 we.1 $(MANDIR)/man1 chmod ugo=r $(MANDIR)/man1/xwe.1 chmod ugo=r $(MANDIR)/man1/wpe.1 $(MANDIR)/man1/we.1 if test -f libxwpe-x11.so; then \ $(INSTALL) libxwpe-x11.so $(XWPELIBDIR)/libxwpe-x11.so; fi if test -f libxwpe-term.so; then \ $(INSTALL) libxwpe-term.so $(XWPELIBDIR)/libxwpe-term.so; fi install: install_fst $(INSTALL) help.xwpe_eng $(XWPELIBDIR)/help.xwpe chmod ugo=r $(XWPELIBDIR)/help.xwpe $(INSTALL) help.key_eng $(XWPELIBDIR)/help.key chmod ugo=r $(XWPELIBDIR)/help.key $(INSTALL) xwpe.1_eng $(MANDIR)/man1/xwpe.1 chmod ugo=r $(MANDIR)/man1/xwpe.1 # German install uses old documention as no updated version is available install_german: install_fst $(INSTALL) old/we.help_gr $(XWPELIBDIR)/help.xwpe chmod ugo=r $(XWPELIBDIR)/help.xwpe $(INSTALL) old/xwpe.1_gr $(MANDIR)/man1/xwpe.1 chmod ugo=r $(MANDIR)/man1/xwpe.1 xwpe-1.5.30a/xwpe-conf.patch0000644000076400007640000000323510263105405014704 0ustar dulsidulsi--- xwpe-1.5.30a/configure.in.orig Sat Apr 25 14:17:27 1998 +++ xwpe-1.5.30a/configure.in Sat Apr 25 14:16:50 1998 @@ -8,6 +8,7 @@ AC_PREFIX_DEFAULT(/usr/local) CF_ANSI_CC_CHECK +CF_STRIP_G_OPT(CFLAGS) dnl CF_GCC_WARNINGS AC_C_CONST --- xwpe-1.5.30a/Makefile.in.orig Thu Nov 18 21:46:01 1999 +++ xwpe-1.5.30a/Makefile.in Thu Nov 18 21:47:58 1999 @@ -1,6 +1,6 @@ #C-Compiler (gcc if exist): CC= @CC@ -CFLAGS= @CFLAGS@ @X_CFLAGS@ +CFLAGS= -DXWPE_DLL @CFLAGS@ @X_CFLAGS@ #CFLAGS= @CFLAGS@ @EXTRA_CFLAGS@ @X_CFLAGS@ #Source Directory: @@ -14,7 +14,7 @@ XWPELIBDIR= $(LIBDIR)/xwpe MANDIR=@mandir@ -LIBS=@LIBS@ +LIBS=@LIBS@ -ldl XLIBS=@X_LIBS@ @X_PRE_LIBS@ @X_EXTRA_LIBS@ DEFS=@DEFS@ -DLIBRARY_DIR=\"$(XWPELIBDIR)\" INSTALL= cp @@ -86,10 +86,10 @@ model.h progr.h unixkeys.h unixmakr.h \ Xwpe.h WeString.h WeXterm.h WeProg.h WeExpArr.h -xwpe: $(OFILES) $(X_OFILES) $(T_OFILES) - $(CC) $(CFLAGS) $(DEFS) $(OFILES) $(X_OFILES) $(T_OFILES) \ - $(LIBS) $(XLIBS) -o xwpe -# $(CC) -Wl,-E $(CFLAGS) $(DEFS) $(OFILES) $(LIBS) -o xwpe +xwpe: $(OFILES) $(X_OFILES) $(T_OFILES) libxwpe-x11.so libxwpe-term.so +# $(CC) $(CFLAGS) $(DEFS) $(OFILES) $(X_OFILES) $(T_OFILES) \ +# $(LIBS) $(XLIBS) -o xwpe + $(CC) -Wl,-E $(CFLAGS) $(DEFS) $(OFILES) $(LIBS) -o xwpe libxwpe-x11.so: $(X_OFILES) $(CC) -shared $(X_OFILES) $(XLIBS) -o libxwpe-x11.so @@ -97,8 +97,8 @@ libxwpe-term.so: $(T_OFILES) $(CC) -shared $(T_OFILES) -o libxwpe-term.so -#$(X_OFILES) $(T_OFILES): $(HFILES) -# $(CC) -fPIC $(CFLAGS) $(DEFS) -c $(subst .o,.c,$@) +$(X_OFILES) $(T_OFILES): $(HFILES) + $(CC) -fPIC $(CFLAGS) $(DEFS) -c $(subst .o,.c,$@) .c.o: $(HFILES) $(CC) $(CFLAGS) $(DEFS) -c $< xwpe-1.5.30a/xwpe-1.5.30a.lsm0000644000076400007640000000114310263105405014334 0ustar dulsidulsiBegin4 Title: xwpe Version: 1.5.30a Entered-date: 2002-06-04 Description: A programming and debugging environment similar to Borland's Turbo C environment. Works in both X and console modes. Keywords: IDE programming editor debugger development Author: kruse@rrzn.uni-hannover.de (Fred Kruse) Maintained-by: dulsi@identicalsoftware.com (Dennis Payne) Primary-site: metalab.unc.edu /pub/Linux/apps/editors/X 308k xwpe-1.5.30a.tar.gz Alternate-site: shannon.mee.tcd.ie /pub/Brian Platforms: Unix Copying-policy: GPL End xwpe-1.5.30a/tools/0000775000076400007640000000000010263105405013114 5ustar dulsidulsixwpe-1.5.30a/tools/compiletest.c0000664000076400007640000000056610263105405015617 0ustar dulsidulsi#include int main(int argc, char *argv[]) { char line[1024]; int i; for (i = 1; i < argc; ++i) { if (argv[i][0] == '-') { if (argv[i][1] == 'o') ++i; } else { FILE *f = fopen(argv[i], "r"); int k = 0; while (fgets(line, 1024, f)) { ++k; printf("%s:\n %d error 615\n", argv[i], k); } fclose(f); } } return 1; } xwpe-1.5.30a/Makefile0000664000076400007640000001362610263105405013424 0ustar dulsidulsi# Generated automatically from Makefile.in by configure. #C-Compiler (gcc if exist): CC= gcc CFLAGS= -g -O2 -I/usr/X11R6/include #CFLAGS= -g -O2 @EXTRA_CFLAGS@ -I/usr/X11R6/include #Source Directory: srcdir= . #Destination Directory prefix=/usr/local exec_prefix=${prefix} DESTDIR=${exec_prefix}/bin LIBDIR=${exec_prefix}/lib XWPELIBDIR= $(LIBDIR)/xwpe MANDIR=${prefix}/man LIBS=-lz -lgpm -lncurses XLIBS= -L/usr/X11R6/lib -lSM -lICE -lX11 DEFS= -DCC_HAS_PROTOS=1 -DHAVE_LIBGPM=1 -DHAVE_LIBZ=1 -DHAVE_MKDTEMP=1 -DRANDLIB=1 -DPRNTCMD=\"lpr\" -DMAN_S_OPT=1 -DLIBRARY_DIR=\"$(XWPELIBDIR)\" -DSELECTION INSTALL= cp LN_S= ln -s # In case configure fails a description of many of the compilation options # are provided below so that administrators can determine the proper flags. # Please email any problems to Dennis Payne (dulsi@identicalsoftware.com) # Recognized defines: # -DNONEWSTYLE :Use xwpe-style of version < 1.2.0 # -DNO_XWINDOWS :Don't create the X windows versions # -DNOPROG :Don't create the programming environment (Broken) # -DNODEBUGGER :Don't include debugging features (Broken) # -DNOPRINTER :No printing from within xwpe # -DPRNTCMD=\"lpr\" :Command to print is \"lpr\" # -DMAN_S_OPT :Man accepts "-s" to select section # -DNO_MINUS_C_MINUS_O :Compiler doesn't accept -o and -c on same command # -DDEFPGC :No macros for putc and getc # -DDEFTPUTS :No prototype for tputs # -DNOSTRSTR :No prototype for strstr and getcwd # -DRANLIB :Have to run ranlib after building a library # -DNOSYMLINKS :No symbolic links # -DXDB :System has xdb not dbx # -DTERMCAP :Use termcap instead of curses # -DSIMPLE_BACKUP_SUFFIX=\"\" # : The bak-file suffix, default is TurboC-like # -DDEFAULT_ALTMASK=Mod3Mask # :Mask to determined if alt is pressed in X # -DINFO_DIR=\"/usr/local/info\" # :Location of info directory # -DLIBRARY_DIR=\"/usr/local/lib/xwpe\" # :Location of xwpe library directory # -DDEF_SHELL=\"/bin/ksh\" # :Default shell to run # -DXTERM_CMD=\"/usr/X11R6/bin/color_xterm\" # :Define the command to execute an xterm # -DXWPE_DLL :Builds x and terminal support into libraries # -DSELECTION :Use X Selection events instead of XStoreBytes # Possible include paths needed: # -I/usr/X11R5/include :X include path # -I/usr/5include :System V include path # Possible library paths needed: # -L/usr/X11R5/lib :X library path # -L/usr/5lib :System V library path # Possible libraries needed: # -lX11 :X library # -lcurses :Curses library # -lncurses :Ncurses library (replaces curses on newer systems) # -ltermlib :Termcap library # -lcposix :Posix Library # -linet :Network library OFILES= we_main.o we_block.o we_unix.o we_e_aus.o \ we_edit.o we_fl_fkt.o we_fl_unix.o we_hfkt.o \ we_menue.o we_mouse.o we_opt.o we_wind.o \ we_prog.o we_progn.o we_debug.o WeString.o \ WeSyntax.o WeExpArr.o WeLinux.o we_gpm.o X_OFILES= we_xterm.o WeXterm.o T_OFILES= we_term.o CFILES= we_main.c we_block.c we_unix.c we_e_aus.c \ we_edit.c we_fl_fkt.c we_fl_unix.c we_hfkt.c \ we_menue.c we_mouse.c we_opt.c we_wind.c we_term.c \ we_prog.c we_progn.c we_debug.c we_xterm.c WeString.c \ WeXterm.c WeSyntax.c WeExpArr.c WeLinux.c we_gpm.c HFILES= attrb.h edit.h keys.h \ model.h progr.h unixkeys.h unixmakr.h \ Xwpe.h WeString.h WeXterm.h WeProg.h WeExpArr.h xwpe: $(OFILES) $(X_OFILES) $(T_OFILES) $(CC) $(CFLAGS) $(DEFS) $(OFILES) $(X_OFILES) $(T_OFILES) \ $(LIBS) $(XLIBS) -o xwpe # $(CC) -Wl,-E $(CFLAGS) $(DEFS) $(OFILES) $(LIBS) -o xwpe libxwpe-x11.so: $(X_OFILES) $(CC) -shared $(X_OFILES) $(XLIBS) -o libxwpe-x11.so libxwpe-term.so: $(T_OFILES) $(CC) -shared $(T_OFILES) -o libxwpe-term.so #$(X_OFILES) $(T_OFILES): $(HFILES) # $(CC) -fPIC $(CFLAGS) $(DEFS) -c $(subst .o,.c,$@) .c.o: $(HFILES) $(CC) $(CFLAGS) $(DEFS) -c $< clean: rm -f *.o xwpe wpe we xwe libxwpe-x11.so libxwpe-term.so core *.ESV distclean: rm -f config.status config.cache config.log Makefile # Bug Note: Currently xwpe and xwe are installed even if X windows versions # are not compiled. (They will function as wpe and we respectively.) install_fst: xwpe if test ! -d $(DESTDIR); then mkdir -p $(DESTDIR); fi if test ! -d $(XWPELIBDIR); then mkdir -p $(XWPELIBDIR); fi rm -f $(DESTDIR)/wpe $(DESTDIR)/xwpe $(DESTDIR)/we $(DESTDIR)/xwe $(INSTALL) xwpe $(DESTDIR)/we chmod ugo+x $(DESTDIR)/we (cd $(DESTDIR) && $(LN_S) we xwe) (cd $(DESTDIR) && $(LN_S) we xwpe) (cd $(DESTDIR) && $(LN_S) we wpe) rm -f $(XWPELIBDIR)/help.xwpe if test ! -f $(XWPELIBDIR)/syntax_def; then \ $(INSTALL) syntax_def $(XWPELIBDIR)/syntax_def; \ chmod ugo=r $(XWPELIBDIR)/syntax_def; fi if test ! -d $(MANDIR)/man1; then mkdir -p $(MANDIR)/man1; fi rm -f $(MANDIR)/man1/xwpe.1 $(MANDIR)/man1/xwe.1 rm -f $(MANDIR)/man1/wpe.1 $(MANDIR)/man1/we.1 $(INSTALL) xwe.1 wpe.1 we.1 $(MANDIR)/man1 chmod ugo=r $(MANDIR)/man1/xwe.1 chmod ugo=r $(MANDIR)/man1/wpe.1 $(MANDIR)/man1/we.1 if test -f libxwpe-x11.so; then \ $(INSTALL) libxwpe-x11.so $(XWPELIBDIR)/libxwpe-x11.so; fi if test -f libxwpe-term.so; then \ $(INSTALL) libxwpe-term.so $(XWPELIBDIR)/libxwpe-term.so; fi install: install_fst $(INSTALL) help.xwpe_eng $(XWPELIBDIR)/help.xwpe chmod ugo=r $(XWPELIBDIR)/help.xwpe $(INSTALL) help.key_eng $(XWPELIBDIR)/help.key chmod ugo=r $(XWPELIBDIR)/help.key $(INSTALL) xwpe.1_eng $(MANDIR)/man1/xwpe.1 chmod ugo=r $(MANDIR)/man1/xwpe.1 # German install uses old documention as no updated version is available install_german: install_fst $(INSTALL) old/we.help_gr $(XWPELIBDIR)/help.xwpe chmod ugo=r $(XWPELIBDIR)/help.xwpe $(INSTALL) old/xwpe.1_gr $(MANDIR)/man1/xwpe.1 chmod ugo=r $(MANDIR)/man1/xwpe.1 xwpe-1.5.30a/xwpe.desktop0000644000076400007640000000025310413523433014332 0ustar dulsidulsi[Desktop Entry] Name=Xwpe Comment=Xwpe Integrated Development Environment Exec=xwpe Terminal=false Type=Application Encoding=UTF-8 Categories=Application;IDE;Development;