xiterm+thai-1.10/0000755000175000017500000000000011701207360012343 5ustar thepthepxiterm+thai-1.10/configure0000755000175000017500000047360211701207344014270 0ustar thepthep#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= 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 IFS=$as_save_IFS ;; 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 $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; 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 if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # 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 as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_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 sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # 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'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="src/feature.h" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS X_LIBS X_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG EGREP GREP CP RM INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM CPP OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC MAINT VERNAME VERSION LSMDATE DATE target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='MCOMMON' ac_user_opts=' enable_option_checking ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR X_CFLAGS X_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= 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 case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -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) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$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 ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) 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 ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$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_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=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 ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_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'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" 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 $as_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 ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # 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 the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | 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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # 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 \`..'] 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] --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] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF 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 LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path X_CFLAGS C compiler flags for X, overriding pkg-config X_LIBS linker flags for X, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested 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 else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.68 Copyright (C) 2010 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 fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* 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_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func cat >config.log <<_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.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { 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` /usr/bin/hostinfo = `(/usr/bin/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=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&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_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=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append 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 as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset 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: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > 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 cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } 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. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_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 $ac_precious_vars; 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,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_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 # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_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. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## 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 DATE="5 January 2012" LSMDATE=05JAN12 VERSION=1.10 VERNAME=xiterm+thai-${VERSION} MAINT="Theppitak Karoonboonyanan " if test -z "${CFLAGS}"; then if test -z "${CCOPTS}"; then CCOPTS='-Wall -O3 -fno-strength-reduce' if test "x$GCC" = xyes; then if test x$system = xLinux; then CCOPTS='-Wall -O3 -fno-strength-reduce' fi fi fi CFLAGS="$CCOPTS" 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 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; 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 | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 -std 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 -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 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 for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } 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_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_RM+:} false; then : $as_echo_n "(cached) " >&6 else case $RM in [\\/]* | ?:[\\/]*) ac_cv_path_RM="$RM" # Let the user override the test with a path. ;; *) 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_RM" && ac_cv_path_RM="rm" ;; esac fi RM=$ac_cv_path_RM if test -n "$RM"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RM" >&5 $as_echo "$RM" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_CP+:} false; then : $as_echo_n "(cached) " >&6 else case $CP in [\\/]* | ?:[\\/]*) ac_cv_path_CP="$CP" # Let the user override the test with a path. ;; *) 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_CP" && ac_cv_path_CP="cp" ;; esac fi CP=$ac_cv_path_CP if test -n "$CP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CP" >&5 $as_echo "$CP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 $as_echo_n "checking for library containing strerror... " >&6; } if ${ac_cv_search_strerror+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strerror (); int main () { return strerror (); ; return 0; } _ACEOF for ac_lib in '' cposix; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_strerror=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_strerror+:} false; then : break fi done if ${ac_cv_search_strerror+:} false; then : else ac_cv_search_strerror=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 $as_echo "$ac_cv_search_strerror" >&6; } ac_res=$ac_cv_search_strerror if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* 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"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 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; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 $as_echo_n "checking for X... " >&6; } if test -n "$X_CFLAGS"; then pkg_cv_X_CFLAGS="$X_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11\""; } >&5 ($PKG_CONFIG --exists --print-errors "x11") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_X_CFLAGS=`$PKG_CONFIG --cflags "x11" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$X_LIBS"; then pkg_cv_X_LIBS="$X_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11\""; } >&5 ($PKG_CONFIG --exists --print-errors "x11") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_X_LIBS=`$PKG_CONFIG --libs "x11" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then X_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "x11" 2>&1` else X_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "x11" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$X_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (x11) were not met: $X_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables X_CFLAGS and X_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables X_CFLAGS and X_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else X_CFLAGS=$pkg_cv_X_CFLAGS X_LIBS=$pkg_cv_X_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpmReadFileToPixmap in -lXpm" >&5 $as_echo_n "checking for XpmReadFileToPixmap in -lXpm... " >&6; } if ${ac_cv_lib_Xpm_XpmReadFileToPixmap+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXpm -lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char XpmReadFileToPixmap (); int main () { return XpmReadFileToPixmap (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xpm_XpmReadFileToPixmap=yes else ac_cv_lib_Xpm_XpmReadFileToPixmap=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xpm_XpmReadFileToPixmap" >&5 $as_echo "$ac_cv_lib_Xpm_XpmReadFileToPixmap" >&6; } if test "x$ac_cv_lib_Xpm_XpmReadFileToPixmap" = xyes; then : $as_echo "#define HAVE_LIBXPM 1" >>confdefs.h X_LIBS="-lXpm $X_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi for ac_header in fcntl.h termios.h \ sys/ioctl.h sys/select.h sys/time.h \ sys/sockio.h sys/byteorder.h \ utmpx.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define mode_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } if ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then : ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 $as_echo "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then $as_echo "#define uid_t int" >>confdefs.h $as_echo "#define gid_t int" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in atexit unsetenv setutent seteuid do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done CFLAGS=${CFLAGS--O} LDFLAGS=${LDFLAGS--O} CPPFLAGS="$CPPFLAGS" MCOMMON=./Make.common ac_config_headers="$ac_config_headers config.h" ac_config_files="$ac_config_files Make.common Makefile src/Makefile data/Makefile doc/Makefile doc/LSM doc/xiterm+thai.1" 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, we kill variables containing newlines. # 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. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} 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}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $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} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= 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 IFS=$as_save_IFS ;; 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 $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; 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 if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # 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 ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # 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'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent 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 --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. 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=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; 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 || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Make.common") CONFIG_FILES="$CONFIG_FILES Make.common" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "doc/LSM") CONFIG_FILES="$CONFIG_FILES doc/LSM" ;; "doc/xiterm+thai.1") CONFIG_FILES="$CONFIG_FILES doc/xiterm+thai.1" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; 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 test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then if $AWK 'BEGIN { getline <"/dev/null" }' /dev/null; then ac_cs_awk_getline=: ac_cs_awk_pipe_init= ac_cs_awk_read_file=' while ((getline aline < (F[key])) > 0) print(aline) close(F[key])' ac_cs_awk_pipe_fini= else ac_cs_awk_getline=false ac_cs_awk_pipe_init="print \"cat <<'|#_!!_#|' &&\"" ac_cs_awk_read_file=' print "|#_!!_#|" print "cat " F[key] " &&" '$ac_cs_awk_pipe_init # The final `:' finishes the AND list. ac_cs_awk_pipe_fini='END { print "|#_!!_#|"; print ":" }' fi ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF # Create commands to substitute file output variables. { echo "cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1" && echo 'cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&' && echo "$ac_subst_files" | sed 's/.*/F["&"]="$&"/' && echo "_ACAWK" && echo "_ACEOF" } >conf$$files.sh && . ./conf$$files.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 rm -f conf$$files.sh { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" \$ac_cs_awk_pipe_init } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } if (nfields == 3 && !substed) { key = field[2] if (F[key] != "" && line ~ /^[ ]*@.*@[ ]*$/) { \$ac_cs_awk_read_file next } } print line } \$ac_cs_awk_pipe_fini _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # 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. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;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&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | if $ac_cs_awk_getline; then $AWK -f "$ac_tmp/subs.awk" else $AWK -f "$ac_tmp/subs.awk" | $SHELL fi \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # 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 || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi echo " Configuration: Source code location: ${srcdir} Compiler: ${CC} Compiler flags: ${CFLAGS} Install path: ${prefix}/bin" echo "" xiterm+thai-1.10/data/0000755000175000017500000000000011701207360013254 5ustar thepthepxiterm+thai-1.10/data/Makefile.in0000644000175000017500000000051511375434151015331 0ustar thepthep# src/Makefile.in -*- Makefile -*- @MCOMMON@ basedir = $(srcdir)/.. thisdir = src first_rule: all dummy: all: clean: realclean: clean mrproper: (cd $(srcdir) && $(RMF) Makefile) install: $(INSTALL_DATA) xiterm+thai.png $(DESTDIR)$(datadir)/pixmaps/xiterm+thai.png uninstall: -cd $(datadir)/pixmaps; $(RMF) xiterm+thai.png xiterm+thai-1.10/data/icon.xpm0000644000175000017500000000676511375434151014757 0ustar thepthep/* XPM */ /*****************************************************************************/ /** This pixmap was made by Torsten Poulin - 1996 - torsten@diku.dk **/ /** It was made by combining xterm-blank.xpm with **/ /** the wonderfully cute Linux penguin mascot by Larry Ewing. **/ /** I had to change Larry's penguin a little to make it fit. **/ /** xterm-blank.xpm contained the following comment: **/ /** This pixmap is kindly offered by Ion Cionca - 1992 - **/ /** Swiss Federal Institute of Technology **/ /** Central Computing Service **/ /*****************************************************************************/ static char * image_name [] = { /**/ "64 38 8 1", /**/ " s mask c none", ". c gray70", "X c gray85", "o c gray50", "O c yellow", "+ c darkolivegreen", "@ c white", "# c black", " ###### ", " ######## ", " ########## ........................... ", " ########### .XXXXXXXXXXXXXXXXXXXXXXXXXXX. ", " ########### .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXoo ", " #@@@#@@@### .XX+++++++++++++++++++++++XXXXoo ", " #@#@#@#@### .XX++++++++++++++++++++++++XXXooo ", " #@#####@### .XX++@@+@++@+@@@@++@+++++++XXXooo ", " ###OOO######.XX++++++++++++++++++++++++XXXoooo ", " ##OOOOOO####.XX++@@@@+@@+@@@+++++++++++XXXoooo ", " #O#OOO#O####.XX++++++++++++++++++++++++XXXooooo ", " ##O###OO####.XX++@@@@@@@@@@+@@@@@++++++XXXooooo ", " ###OOOO@#####XX++++++++++++++++++++++++XXXooooo ", " ##@###@@@@####XX++@@@+@@@@+@@++@@@++++++XXXooooo ", " #@@@@@@@@@@####X++++++++++++++++++++++++XXXooooo ", " ##@@@@@@@@@@#####++@+++++++++++++++++++++XXXooooo ", " ###@@@@@@@@@@######+++++++++++++++++++++++XXXooooo ", " ####@@@@@@@@@@@#####+@@@@+@+@@@+@++++++++++XXXooooo ", " ###@@@@@@@@@@@@######++++++++++++++++++++++XXXooooo ", " ##@@@@@@@@@@@@@@#####@+@@@@++++++++++++++++XXXooooo ", " ###@@@@@@@@@@@@@@######++++++++++++++++++++XXXXoooo ", " ###@@@@@@@@@@@@@@######XXXXXXXXXXXXXXXXXXXXXXXXooo ", " ###@@@@@@@@@@@@@@@######XXXXXXXXXXXXXXXXXXXXXXXooo ", " ###@@@@@@@@@@@@@@@@#####ooooooooooooooooooooooo...oo ", " ###@@@@@@@@@@@@@@@######.........................ooo ", " #OO##@@@@@@@@@@@@@#######oooooooooooooooooooooooooooo ", " #OOO##@@@@@@@@@@@#OO####O#XXXXXXXXXXXXXXXXXXXXXXXoooo.. .. ", " ###OOOOO##@@@@@@@@@@#OOO#OOO#XXXXXXXXXXXXXX#######XXoooo . .", " #OOOOOOOO###@@@@@@@@@#OOOOOOO#ooooooooooooooooooooXXXooo . ", " #OOOOOOOOO###@@@@@@@@@#OOOOOOO##XXXXXXXXXXXXXXXXXooooo . ", " #OOOOOOOOO#@@@@@@@@###OOOOOOOOO#XXXXXXXXXXXXXXXoo oooooo ", " #OOOOOOOOO#@@@@@@@####OOOOOOOO#@@@@@@@@@@@XXXXXoo ooooo...o ", " #OOOOOOOOOOO###########OOOOOO##XXXXXXXXXXXXXXXXoo ooXXXoo..o ", " ##OOOOOOOOO###########OOOO##@@@@@@@@@@@@@XXXXoo oXXXXX..o ", " ###OOOO### oXX##OOO#XXXXXXXXXXXXXXXXXXoo o.....oo ", " #### oooo####oooooooooooooooooooo ooooooo ", " ", " "}; xiterm+thai-1.10/data/xiterm+thai.png0000644000175000017500000000703211375434151016224 0ustar thepthepPNG  IHDR00WsRGBbKGD pHYs  ~tIME 0I" IDAThݚ}lg^?3޵DZv:u8IsӴ.}/@'CH'P%t'{ӕJ.^h;vZunk{]{gvf?vv=;^i`G^gG|}-׈q5m31qtd(Q*M5׍p.;?iMQbM5%LF["6e1ý}ukFaAL:iQ/\;iQK %"Ɉ MAy%ُ20'M“@*rm2!6e:yAQ 7pߋk"΀3$:;1qjrڀo*؉7">{zi>9i4Zj>./ , ڌALjjZי +4]dj\@/ja30IhN~}45w͞tgS;C|C&jZH5?>NPஃw111;8Uqțy4NաT)E4[uHiΌ%u<8v{ LN[RhQ;T6c$c@޽{5Re ۶-R*PJ"̩:p6&7 _#D= 7cqHv2覈J CL`vv۶, 3g,֋g) siJK%Qahhq8q5Ź"#Zk.n HI&7,g[+5Q)m/m8olÇ#/YP \F,›&@|avrBoB@ū0cQư,cᏌۻk/4fY޽I|A !dD$oDy@m`BTjfۍr8ޚONNn7F<歵$];0am@zC>'Kc7aWmJ-HJs- vV#FbybV(eLxwK]BϓeM&NXa)R`Wu0v; lZ`z/4TtD\x+g]9xuwM'o}Hlʸ X 4\|&myatx|( ( 3gj@ԙS;ɓ'AnRa"DꈶTBwH{88NώP3 6:0ۚ/ӫ2w{=˧*Gm9ʁT$jhť0#(i@¤=Ic<.X,6U(a|ZsiEw]4F$cnt h]9B[,ۃ-oc#\{e2Uz{貗=7Ks2L-K (ո9⼬7A@^՟J{Z O }ՉyD܍F囁 ha:mn[ΞQ> @ 0HSv?L{HM*oѓ"R{l_)O:~y_꿏u = ݯ$#R-*E|~RO>Ij>>y 30۶7Mnr}?yo% aa-0l?mp跎7MZ"*jSHȑ仩#1fWd*E*@&xL4(Ӡ{>Eɚ&r&T/~e'kZV.xIErmCbF"Ws?uQ]=|/6.2°,@F/cCBiɷhB#$(d9)μ 0y2I_^݅BJ7t7 ydK>{/ 4?tt5QlFf"SS =/ԁ$B-@UNС=abyTi{-n׏ah̐CԺִF.~A^9 /rGpq9 à.JP#![!BHE@|[B4gP#տL[us _|Nٶ@1ȅ˗FofԴZJos\ck Z+槯! HC a 0|w~ql:tT@O|&'p-jμSuZkUC)ԅYdT¡I`H|6R(! fȱF `rEG*{/V_, \|Z9P47DȗR]cw`[4UK >*!i2.5H $Jhk2) M&jܳ_{9肿, {߃#r9FwZK>DEW6HBH!Og#|WC K`3@hd ;u]r6@ : [yK@E&[la^R0m_wkan1H.ׅ|uU'ܺ'i./5MJ۸…%R᝙ Z(oD5j/g[v$);Lj_z_znb&d$Je?N#/_ԩla`]v%JK?~ 6k81r鞞l:*gH E2m -HNL 藏@u)4n[$ri Tf㡇"ɐL$@ϒ ߥ1H ˜Q{p0p H/l{aɟƤ F&hCbz\XE*Q›RHLi~;\톑- ,\ChyR{(kB_S)OJẇ-趂D'õ1iU)ԬR~^cjdz]D*sلY[{ }@AV~o qƯpnDGLW\쐓IjA&3\J\}PmeYbIENDB`xiterm+thai-1.10/Make.common.in0000644000175000017500000000211311375434151015043 0ustar thepthep# ./Make.common.in -*- Makefile -*- DATE=@DATE@ LSMDATE=@LSMDATE@ VERSION=@VERSION@ VERNAME=@VERNAME@ MAINT=@MAINT@ srcdir = @srcdir@ VPATH = @srcdir@ SHELL = /bin/sh # This variable makes it possible to move the installation root to another # directory. This is useful when you're creating a binary distribution # If empty, normal root will be used. # You can run eg. 'make install DESTDIR=/usr/copain/xiterm' to accomplish # that. # Installation target directories & other installation stuff prefix = @prefix@ exec_prefix = @exec_prefix@ # DESTDIR = /usr/local/$(VERNAME) binprefix = manprefix = bindir = @bindir@ mandir = @mandir@/man1 manext = 1 datadir = @datadir@ # Tools & program stuff CC = @CC@ CPP = @CPP@ RM = @RM@ RMF = @RM@ -f RMRF = @RM@ -rf CP = @CP@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL@ -D -m 755 INSTALL_DATA = @INSTALL@ -D -m 644 # add -DBINDIR=\""$(bindir)/"\" to CPPFLAGS, if we need to spawn a program CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ #-DHAVE_LIBXPM LDFLAGS = @LDFLAGS@ DEFS = @DEFS@ LIBS = @LIBS@ XINC = @X_CFLAGS@ XLIB = @X_LIBS@ # End of Make.common xiterm+thai-1.10/src/0000755000175000017500000000000011701207360013132 5ustar thepthepxiterm+thai-1.10/src/screen.c0000644000175000017500000023426211375434150014574 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: screen.c */ /*{{{ notes: */ /*----------------------------------------------------------------------* * This module is all new by Robert Nation * * * Extensive modifications by mj olesen * No additional restrictions are applied. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. * * Design of this module was heavily influenced by the original xvt * design of this module. See info relating to the original xvt elsewhere * in this package. *----------------------------------------------------------------------*/ /*}}} */ /*{{{ includes */ #include "main.h" #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_IOCTL_H #include #endif #include #include /* CARD32 */ #include "command.h" #include "debug.h" #include "graphics.h" #include "screen.h" #ifdef THAI #include "thai.h" #endif /*}}} */ /*{{{ defines */ #define PROP_SIZE 4096 #define TABSIZE 8 /* default tab size */ /* Memory copy methods -- rgg 20/11/95 */ #define MEMCOPY memcpy /* no overlap -- rgg 04/11/95 */ /* #define MEMCOPY memmove *//* allows overlap -- rgg 04/11/95 */ /*}}} */ /*{{{ extern functions referenced */ /*}}} */ /*{{{ extern variables referenced */ /*}}} */ /*{{{ extern variables declared here */ #ifndef NO_BRIGHTCOLOR unsigned int colorfgbg = DEFAULT_RSTYLE; #endif /*}}} */ /* #define DEBUG_SCREEN */ /* to do self-check for internal screen corruption */ /* #define DEBUG_COLORS */ /* to print out current color/renditions as they change */ /*{{{ local variables */ #ifdef THAI extern int thai_keyboard; extern int thai_spcount; void thai_clearline(int from, int to, int ypixel); void thai_complexclear(int *from, int ypixel); #endif /*----------------------------------------------------------------------* */ static rend_t rstyle = DEFAULT_RSTYLE; #define SPACE_CHAR ' ' #ifdef OLD_COLOR_MODEL #define FILL_STYLE DEFAULT_RSTYLE #else #define FILL_STYLE (rstyle) #endif /* macro prototypes */ void ZERO_LINES (text_t *, rend_t *, int /* nlines */ ); void BLANK_FILL (text_t *, rend_t *, int /* nchars */ ); /* zero both text and rendition */ #define ZERO_LINES(ptext,prend,nlines) do {\ int n = (nlines) * (TermWin.ncol+1);\ if (n > 0) {\ memset ((ptext), 0, (n * sizeof(text_t)));\ memset ((prend), 0, (n * sizeof(rend_t)));\ }} while (0) /* fill text with spaces and fill rendition */ #define BLANK_FILL(ptext,prend,nchars) do {\ int n = (nchars);\ if (n > 0) {\ rend_t * p = prend;\ memset ((ptext), SPACE_CHAR, (n * sizeof(text_t)));\ while (n-- > 0) *p++ = FILL_STYLE;\ }} while (0) /*}}} */ /*{{{ screen_t */ /* * how the screen accounting works * * `text' contains text including the scrollback buffer. Each line is a * fixed length [TermWin.ncol+1] with the final character of each: * '\n': for wrapped lines * `\0': for non-wrapped lines * * `rend' contains rendition information (font, bold, color, etc) * * the layout: * Rows [0 .. (TermWin.saveLines-1)] == scrollback region * Rows [TermWin.saveLines .. TermWin.saveLines + (TermWin.nrow-1)] == * screen region [0 .. (TermWin.nrow-1)] * * `row', `tscroll', `bscroll' are bounded by (0, TermWin.nrow) * * `col' is bounded by (0, TermWin.ncol) * * `TermWin.saveLines' * is the maximum number of lines to save in the scrollback buffer. * This is a fixed number for any particular xiterm instance and is set * by the option `-sl' or resource `saveLines' * * `TermWin.nscrolled' * how many lines have been scrolled (saved) * 0 <= TermWin.nscrolled <= TermWin.saveLines * * `TermWin.view_start' * the offset back into the scrollback buffer for our current view * -(TermWin.nscrolled) <= TermWin.view_start <= 0 * * The selection region is defined for [0 .. (TermWin.nrow-1)], which * corresponds to the regular screen and for [-1 .. -(TermWin.nscrolled)] * which corresponds to the scrolled region. */ typedef struct { text_t *text; /* all the text, including scrollback */ rend_t *rend; /* rendition, using the `RS_' flags */ short row, col; /* cursor position */ short tscroll, bscroll; /* top/bottom of scroll region */ short charset; /* character set number [0..3] */ unsigned int flags; } screen_t; #define Screen_Relative (1<<0) /* relative origin mode flag */ #define Screen_VisibleCursor (1<<1) /* cursor visible? */ #define Screen_Autowrap (1<<2) /* auto-wrap flag */ #define Screen_Insert (1<<3) /* insert mode (vs. overstrike) */ #define Screen_WrapNext (1<<4) /* need to wrap for next char? */ #define Screen_DefaultFlags (Screen_VisibleCursor|Screen_Autowrap) static screen_t screen = {NULL, NULL, 0, 0, 0, 0, 0, Screen_DefaultFlags}; #ifdef NO_SECONDARY_SCREEN #define NSCREENS 0 #else #define NSCREENS 1 static screen_t swap_screen = {NULL, NULL, 0, 0, 0, 0, 0, Screen_DefaultFlags}; #endif /*}}} */ /*{{{ local variables */ static short current_screen = PRIMARY; static short rvideo = 0; /* reverse video */ static char *tabs = NULL; /* a 1 for a location with a tab-stop */ static text_t *linebuf = NULL; #ifdef KANJI static short multiByte = 0; #endif /* Data for save-screen */ static struct { short row, col; short charset; char charset_char; rend_t rstyle; } save = { 0, 0, 0, 'B', DEFAULT_RSTYLE }; /* This tells what's actually on the screen */ text_t *drawn_text = NULL; static rend_t *drawn_rend = NULL; static char charsets[4] = {'B', 'B', 'B', 'B'}; /* all ascii */ /*}}} */ /*{{{ selection */ /* save selection text with '\n' line endings, but translate * '\n' to '\r' for pasting */ static struct { unsigned char *text; /* selected text */ int len; /* length of selected text */ short op; /* current operation */ #define SELECTION_CLEAR 0 #define SELECTION_BEGIN 1 #define SELECTION_INIT 2 #define SELECTION_CONT 3 #define SELECTION_DONE 4 short screen; /* which screen is being used */ struct { short row, col; } beg, end, mark; } selection = { NULL, 0, SELECTION_CLEAR, PRIMARY, { 0, 0 } , { 0, 0 } , { 0, 0 } }; /* also could add in these: * int firstr, lastr; -- firstr <= row < lastr * if trying to implement X11 mouse highlighting */ /*}}} */ /*{{{ local functions referenced */ static int scroll_text (int row1, int row2, int count); static inline void selection_check (void); /*----------------------------------------------------------------------*/ /*}}} */ /*----------------------------------------------------------------------*/ /*{{{ check_text() - check integrity of screen data structures */ #ifdef DEBUG_SCREEN static void check_text (const char *str) { int r, x; static const char *prev = "?"; fprintf (stderr, "%s\n", str); for (r = 0, x = TermWin.ncol; r < (TermWin.nrow + TermWin.saveLines); r++, x += (TermWin.ncol + 1)) { text_t final = screen.text[x]; if (final != '\0' && final != '\n') { fprintf (stderr, "%s: %s Violation on row %d\n", str, prev, x); exit (EXIT_FAILURE); } } MEM_CHECK ("check_text", str); prev = str; } #else #define check_text(a) ((void)0) #endif /* DEBUG_SCREEN */ /*}}} */ /*{{{ Kanji translation units */ #ifdef KANJI static void eucj2jis (unsigned char *str, int len) { register int i; for (i = 0; i < len; i++) str[i] &= 0x7F; } static void sjis2jis (unsigned char *str, int len) { register int i; for (i = 0; i < len; i += 2, str += 2) { unsigned char *high = str; unsigned char *low = str + 1; (*high) -= (*high > 0x9F ? 0xB1 : 0x71); *high = (*high) * 2 + 1; if (*low > 0x9E) { *low -= 0x7E; (*high)++; } else { if (*low > 0x7E) (*low)--; *low -= 0x1F; } } } static void (*kanji_decode) (unsigned char *str, int len) = eucj2jis; void set_kanji_encoding (const char *str) { if (str && *str) { if (!strcmp (str, "sjis")) kanji_decode = sjis2jis; else if (!strcmp (str, "eucj")) kanji_decode = eucj2jis; } } #endif /* KANJI */ /*}}} */ /*{{{ blank_lines() - add COUNT blank lines in the fill rendition style */ static inline void blank_lines (text_t * text, rend_t * rend, int count) { int r; if (count <= 0) return; /* fill with blank lines */ BLANK_FILL (text, rend, (count * (TermWin.ncol + 1))); /* terminate each line */ text += (TermWin.ncol); for (r = 0; r < count; r++, text += (TermWin.ncol + 1)) *text = '\0'; } /*}}} */ /*{{{ Reset the screen */ /* * called whenever the screen needs to be repaired due * to re-sizing or initialization */ void scr_reset (void) { static short prev_nrow = -1, prev_ncol = -1; int i, ncol = 0; TermWin.view_start = 0; if (prev_ncol == TermWin.ncol && prev_nrow == TermWin.nrow) return; #ifdef DEBUG_SCREEN fprintf (stderr, "reset\n"); #endif /* In case rows/columns are invalid */ if (TermWin.ncol <= 0) TermWin.ncol = 80; if (TermWin.nrow <= 0) TermWin.nrow = 24; #ifndef min #define min(a,b) (((a)<(b)) ? (a) : (b)) #define max(a,b) (((a)>(b)) ? (a) : (b)) #endif ncol = min (prev_ncol, TermWin.ncol); if (prev_nrow < 0) TermWin.nscrolled = 0; for (i = 0; i <= NSCREENS; i++) { text_t *old_text; rend_t *old_rend; int r, oldr, oldr_max; int histsize = TermWin.saveLines; screen_t *scr = &screen; /* allocate space for scrollback (primary screen) + screen */ #if NSCREENS if (i) { histsize = 0; scr = &swap_screen; } #endif /* copy from old buffer to new buffer, as appropriate. */ oldr = oldr_max = prev_nrow; if (prev_nrow > 0) { int n = (TermWin.nrow - prev_nrow); if (n > 0) /* window made taller */ { oldr = (TermWin.nrow); if (histsize) { if (n <= TermWin.nscrolled) /* enough */ { scr->row += (n); oldr = oldr_max; } else { scr->row += (TermWin.nscrolled); oldr -= (TermWin.nscrolled); } TermWin.nscrolled -= (n); } } else if (n < 0) /* window made shorter */ { if (scr->row < TermWin.nrow) { oldr_max = TermWin.nrow; } else /* put extra into scrolled */ { oldr_max = (scr->row + 1); if (histsize) TermWin.nscrolled += (oldr_max - TermWin.nrow); } oldr = oldr_max; } oldr_max += histsize; oldr += histsize; oldr--; } if (scr->row < 0) scr->row = 0; else if (scr->row >= TermWin.nrow) scr->row = (TermWin.nrow - 1); if (scr->col < 0) scr->col = 0; else if (scr->col >= TermWin.ncol) scr->col = (TermWin.ncol - 1); /* reset scroll regions */ scr->tscroll = 0; scr->bscroll = (TermWin.nrow - 1); old_text = scr->text; old_rend = scr->rend; scr->text = MALLOC (((histsize + TermWin.nrow) * (TermWin.ncol + 1)) * sizeof (text_t), "text"); scr->rend = MALLOC (((histsize + TermWin.nrow) * (TermWin.ncol + 1)) * sizeof (rend_t), "rend"); blank_lines (scr->text, scr->rend, (histsize + TermWin.nrow)); if (ncol > 0) { for (r = (TermWin.nrow + histsize - 1); r >= 0 && oldr >= 0; r--, oldr--) { if (oldr < oldr_max) { int roffset = r * (TermWin.ncol + 1); int oroffset = oldr * (prev_ncol + 1); memcpy (&scr->text[roffset], &old_text[oroffset], ncol * sizeof (text_t)); memcpy (&scr->rend[roffset], &old_rend[oroffset], ncol * sizeof (rend_t)); } } } FREE (old_text, "scr_reset", "scr_reset"); FREE (old_rend, "scr_reset", "scr_reset"); } /* Make sure the cursor is on the screen */ if (TermWin.nscrolled < 0) TermWin.nscrolled = 0; else if (TermWin.nscrolled > TermWin.saveLines) TermWin.nscrolled = TermWin.saveLines; prev_ncol = TermWin.ncol; prev_nrow = TermWin.nrow; drawn_text = REALLOC (drawn_text, (TermWin.nrow * (TermWin.ncol + 1)) * sizeof (text_t), "drawn_text"); drawn_rend = REALLOC (drawn_rend, (TermWin.nrow * (TermWin.ncol + 1)) * sizeof (rend_t), "drawn_rend"); ZERO_LINES (drawn_text, drawn_rend, TermWin.nrow); /* ensure the cursor is on the screen */ if (save.row >= TermWin.nrow) save.row = (TermWin.nrow - 1); if (save.col >= TermWin.ncol) save.col = (TermWin.ncol - 1); tabs = REALLOC (tabs, TermWin.ncol * sizeof (char), "tabs"); linebuf = REALLOC (linebuf, (TermWin.ncol + 1) * sizeof (text_t), "linebuf"); memset (tabs, 0, TermWin.ncol * sizeof (char)); #if TABSIZE for (i = 0; i < TermWin.ncol; i += TABSIZE) tabs[i] = 1; #endif tt_resize (); } /*}}} */ /*{{{ Restore power-on configuration */ /* * Clears screen, restores default fonts, etc * * also reset the scrollback buffer */ void scr_poweron (void) { screen_t *scr = &screen; int i; TermWin.view_start = 0; TermWin.nscrolled = 0; /* xterm doesn't do this */ memset (charsets, 'B', sizeof (charsets)); rvideo = 0; scr_rendition (0, ~RS_None); #if NSCREENS scr_change_screen (SECONDARY); scr_erase_screen (2); #endif scr_change_screen (PRIMARY); scr_erase_screen (2); for (i = 0; i <= NSCREENS; i++) { scr->tscroll = 0; scr->bscroll = (TermWin.nrow - 1); scr->row = scr->col = 0; scr->charset = 0; scr->flags = Screen_DefaultFlags; #if NSCREENS scr = &swap_screen; #endif } scr_cursor (SAVE); ZERO_LINES (drawn_text, drawn_rend, TermWin.nrow); scr_reset (); XClearWindow (Xdisplay, TermWin.vt); scr_refresh (SLOW_REFRESH); Gr_reset (); } /*}}} */ /*{{{ Set the rstyle parameter to reflect the selected font */ static inline void set_font_style (void) { rstyle &= ~RS_fontMask; switch (charsets[screen.charset]) { /* DEC Special Character and Line Drawing Set */ case '0': rstyle |= RS_acsFont; break; /* United Kingdom (UK) */ case 'A': rstyle |= RS_ukFont; break; /* United States (USASCII) */ /* case 'B': break; *//* ascii */ /* <: Multinational character set */ /* 5: Finnish character set */ /* C: Finnish character set */ /* K: German character set */ } } /*}}} */ /*{{{ Save/restore the cursor position and rendition style */ void scr_cursor (int mode) { #ifdef DEBUG_COLORS debug_colors (); #endif switch (mode) { case SAVE: save.row = screen.row; save.col = screen.col; save.rstyle = rstyle; save.charset = screen.charset; save.charset_char = charsets[save.charset]; break; case RESTORE: screen.row = save.row; screen.col = save.col; rstyle = save.rstyle; screen.charset = save.charset; charsets[screen.charset] = save.charset_char; set_font_style (); break; } #ifdef DEBUG_COLORS debug_colors (); #endif } /*}}} */ /*{{{ Change between the main and alternate screen */ int scr_change_screen (int scrn) { register int x; TermWin.view_start = 0; if (current_screen == scrn) return current_screen; else { int tmp; tmp = current_screen; current_screen = scrn; scrn = tmp; } #if NSCREENS check_text ("change screen"); /* swap screens, but leave scrollback untouched */ { const int count = (TermWin.nrow) * (TermWin.ncol + 1); const int roffset = (TermWin.saveLines) * (TermWin.ncol + 1); text_t *text = &screen.text[roffset]; rend_t *rend = &screen.rend[roffset]; for (x = 0; x < count; x++) { register text_t t; register rend_t r; t = text[x]; text[x] = swap_screen.text[x]; swap_screen.text[x] = t; r = rend[x]; rend[x] = swap_screen.rend[x]; swap_screen.rend[x] = r; } } x = screen.row; screen.row = swap_screen.row; swap_screen.row = x; x = screen.col; screen.col = swap_screen.col; swap_screen.col = x; x = screen.charset; screen.charset = swap_screen.charset; swap_screen.charset = x; x = screen.flags; screen.flags = swap_screen.flags; swap_screen.flags = x; screen.flags |= Screen_VisibleCursor; swap_screen.flags |= Screen_VisibleCursor; if (Gr_Displayed ()) { Gr_scroll (0); Gr_ChangeScreen (); } #else /* put contents of secondary screen into the scrollback */ if (Gr_Displayed ()) Gr_ClearScreen (); else if (current_screen == PRIMARY) scroll_text (0, (TermWin.nrow - 1), TermWin.nrow); #endif return scrn; } /*}}} */ /*{{{ debug_colors() */ #ifdef DEBUG_COLORS static void debug_colors (void) { int color; char *name[] = {"fg", "bg", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white"}; fprintf (stderr, "Color ( "); if (rstyle & RS_RVid) fprintf (stderr, "rvid "); if (rstyle & RS_Bold) fprintf (stderr, "bold "); if (rstyle & RS_Blink) fprintf (stderr, "blink "); if (rstyle & RS_Uline) fprintf (stderr, "uline "); fprintf (stderr, "): "); color = GET_FGCOLOR (rstyle); #ifndef NO_BRIGHTCOLOR if (color >= minBright && color <= maxBright) { color -= (minBright - minColor); fprintf (stderr, "bright "); } #endif fprintf (stderr, "%s on ", name[color]); color = GET_BGCOLOR (rstyle); #ifndef NO_BRIGHTCOLOR if (color >= minBright && color <= maxBright) { color -= (minBright - minColor); fprintf (stderr, "bright "); } #endif fprintf (stderr, "%s\n", name[color]); } #else #define debug_colors() ((void)0) #endif /* DEBUG_COLORS */ /*}}} */ /*{{{ Set foreground/background text color */ /* * Intensity: * RS_Bold = foreground * RS_Blink = background */ void scr_color (unsigned int color, unsigned int Intensity) { switch (color) { case restoreFG: color = fgColor; assert (Intensity == RS_Bold); break; case restoreBG: color = bgColor; assert (Intensity == RS_Blink); break; default: if (Xdepth <= 2) /* Monochrome - ignore color changes */ { switch (Intensity) { case RS_Bold: color = fgColor; break; case RS_Blink: color = bgColor; break; } } #ifndef NO_BRIGHTCOLOR else { if ((rstyle & Intensity) && color >= minColor && color <= maxColor) color += (minBright - minColor); else if (color >= minBright && color <= maxBright) { if (rstyle & Intensity) return; /* already bold enough! */ color -= (minBright - minColor); } } #endif /* NO_BRIGHTCOLOR */ break; } switch (Intensity) { case RS_Bold: rstyle = SET_FGCOLOR (rstyle, color); break; case RS_Blink: rstyle = SET_BGCOLOR (rstyle, color); break; } debug_colors (); } /*{{{ Change the rendition style */ void scr_rendition (int set, int style) { unsigned int color; debug_colors (); if (set) { rstyle |= style; /* set rendition */ switch (style) { #ifndef NO_BRIGHTCOLOR case RS_Bold: color = GET_FGCOLOR (rstyle); scr_color ((color == fgColor ? GET_FGCOLOR (colorfgbg) : color), RS_Bold); break; case RS_Blink: color = GET_BGCOLOR (rstyle); scr_color ((color == bgColor ? GET_BGCOLOR (colorfgbg) : color), RS_Blink); break; #endif /* NO_BRIGHTCOLOR */ case RS_RVid: if (rvideo) rstyle &= ~(RS_RVid); /* reverse video mode */ break; } } else { rstyle &= ~(style); /* unset rendition */ switch (style) { case ~RS_None: /* default fg/bg colors */ rstyle = DEFAULT_RSTYLE; if (rvideo) rstyle |= RS_RVid; /* reverse video mode */ break; #ifndef NO_BRIGHTCOLOR case RS_Bold: color = GET_FGCOLOR (rstyle); if (color >= minBright && color <= maxBright) { scr_color (color, RS_Bold); /* scr_color (color - (minBright - minColor), RS_Bold); */ if ((rstyle & RS_fgMask) == (colorfgbg & RS_fgMask)) scr_color (restoreFG, RS_Bold); } break; case RS_Blink: color = GET_BGCOLOR (rstyle); if (color >= minBright && color <= maxBright) { scr_color (color, RS_Blink); /* scr_color (color - (minBright - minColor), RS_Blink); */ if ((rstyle & RS_bgMask) == (colorfgbg & RS_bgMask)) scr_color (restoreBG, RS_Blink); } break; #endif /* NO_BRIGHTCOLOR */ case RS_RVid: if (rvideo) rstyle |= RS_RVid; /* reverse video mode */ break; } } debug_colors (); } /*}}} */ /*{{{ Add lines */ void scr_add_lines (const unsigned char *str, int nlines, int cnt) { int i, roffset; /* row offset */ #ifdef KANJI enum { SBYTE, WBYTE1, WBYTE2 } chstat = SBYTE; #endif TermWin.view_start = 0; check_text ("add lines"); if (selection.op) selection_check (); /* do scrolling up front, most of the time */ if (nlines > 0) { nlines += (screen.row - screen.bscroll); if ((nlines > 0) && (screen.tscroll == 0) && (screen.bscroll == (TermWin.nrow - 1))) { scroll_text (screen.tscroll, screen.bscroll, nlines); /* add text into the scrollback buffer */ screen.row -= nlines; if (screen.row < -TermWin.saveLines) screen.row = -TermWin.saveLines; } } if (screen.col >= TermWin.ncol) screen.col = (TermWin.ncol - 1); roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); for (i = 0; i < cnt; i++) { /* * Adds a single character at the current cursor location * new lines in the string */ if (Gr_Displayed ()) Gr_scroll (0); #ifdef KANJI switch (chstat) #endif { #ifdef KANJI case WBYTE1: break; /* never happens? */ case WBYTE2: rstyle |= RS_kanjiMask; chstat = SBYTE; break; case SBYTE: if (multiByte || (str[i] & 0x80)) { rstyle &= ~RS_kanjiMask; rstyle |= RS_kanji1; chstat = WBYTE2; } else #endif /* KANJI */ switch (str[i]) { case 127: continue; break; case '\t': scr_tab (1); continue; break; case '\n': screen.flags &= ~Screen_WrapNext; screen.text[roffset + (TermWin.ncol)] = '\0'; if (screen.row == screen.bscroll) scroll_text (screen.tscroll, screen.bscroll, 1); else if (screen.row < (TermWin.nrow - 1)) { screen.row++; roffset = ((screen.row + TermWin.saveLines) * (TermWin.ncol + 1)); } continue; break; case '\r': screen.col = 0; screen.flags &= ~Screen_WrapNext; screen.text[roffset + (TermWin.ncol)] = '\0'; continue; break; default: #ifdef KANJI rstyle &= ~(RS_kanjiMask); #endif break; } } if (screen.flags & Screen_WrapNext) { screen.text[roffset + (TermWin.ncol)] = '\n'; /* wrap line */ if (screen.row == screen.bscroll) scroll_text (screen.tscroll, screen.bscroll, 1); else if (screen.row < (TermWin.nrow - 1)) { screen.row++; roffset = ((screen.row + TermWin.saveLines) * (TermWin.ncol + 1)); } screen.col = 0; screen.flags &= ~Screen_WrapNext; } if (screen.flags & Screen_Insert) scr_insdel_chars (1, INSERT); screen.text[roffset + (screen.col)] = str[i]; screen.rend[roffset + (screen.col)] = rstyle; screen.col++; if (screen.col == TermWin.ncol) { screen.col--; if (screen.flags & Screen_Autowrap) screen.flags |= Screen_WrapNext; else screen.flags &= ~Screen_WrapNext; } } } /*}}} */ /*{{{ Scroll text on the screen */ /* * Scroll COUNT lines from ROW1 to ROW2 inclusive (ROW1 <= ROW2) * scrolling is up for a +ve COUNT and down for a -ve COUNT */ static int scroll_text (int row1, int row2, int count) { int r; text_t *t_dst, *t_src; rend_t *r_dst, *r_src; if (selection.op) /* move selected region too */ { selection.beg.row -= count; selection.end.row -= count; selection.mark.row -= count; /* * could check ranges here and make sure selection is okay * don't scroll into scrollback depending on the region etc, * but leave for now */ } if (count > 0) /* scroll up */ { int n, x; /* if the line scrolls off the top of the screen, * shift the entire scrollback buffer too */ if ((row1 == 0) && (current_screen == PRIMARY)) { row1 = -TermWin.saveLines; TermWin.nscrolled += count; if (TermWin.nscrolled > TermWin.saveLines) TermWin.nscrolled = TermWin.saveLines; } x = ((row1 + TermWin.saveLines) * (TermWin.ncol + 1)); t_dst = &screen.text[x]; r_dst = &screen.rend[x]; n = (row2 - row1 + 1); if (count > n) { count = n; n = 0; } else { n -= count; } x += count * (TermWin.ncol + 1); t_src = &screen.text[x]; r_src = &screen.rend[x]; /* Forward overlapping memcpy's -- probably OK */ if (n > 0) { n *= (TermWin.ncol + 1); MEMCOPY (t_dst, t_src, n * sizeof (text_t)); MEMCOPY (r_dst, r_src, n * sizeof (rend_t)); t_dst += n; r_dst += n; } #if 0 /* this destroys the '\n' mark for the autowrapped lines */ *(t_dst - 1) = '\0'; /* terminate previous line */ #endif /* copy blank lines in at the bottom */ blank_lines (t_dst, r_dst, count); } else if (count < 0) /* scroll down */ { int x; /* do one line at a time to avoid backward overlapping memcpy's */ x = (row2 + TermWin.saveLines) * (TermWin.ncol + 1); t_dst = &screen.text[x]; r_dst = &screen.rend[x]; x += (count) * (TermWin.ncol + 1); t_src = &screen.text[x]; r_src = &screen.rend[x]; for (r = row2; r >= (row1 - count); r--) { MEMCOPY (t_dst, t_src, (TermWin.ncol + 1) * sizeof (text_t)); t_dst -= (TermWin.ncol + 1); t_src -= (TermWin.ncol + 1); MEMCOPY (r_dst, r_src, (TermWin.ncol + 1) * sizeof (rend_t)); r_dst -= (TermWin.ncol + 1); r_src -= (TermWin.ncol + 1); } /* copy blank lines in at the top */ for (; r >= row1; r--) { BLANK_FILL (t_dst, r_dst, TermWin.ncol); t_dst[TermWin.ncol] = '\0'; t_dst -= (TermWin.ncol + 1); r_dst -= (TermWin.ncol + 1); } } if (Gr_Displayed ()) Gr_scroll (count); return count; } /*}}} */ /*{{{ Handle a backspace */ void scr_backspace (void) { check_text ("backspace"); if (selection.op) selection_check (); if (screen.col == 0 && screen.row > 0) { screen.row--; screen.col = (TermWin.ncol - 1); } else if (screen.flags & Screen_WrapNext) { int roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); screen.text[roffset + (TermWin.ncol)] = '\0'; screen.flags &= ~Screen_WrapNext; } else scr_gotorc (0, -1, RELATIVE); } /*}}} */ /*{{{ Move the cursor to a new tab position */ /* * COUNT is +ve, move forward. COUNT is -ve, move backward */ void scr_tab (int count) { int x = screen.col; if (count > 0) /* tab forward */ { int i; for (i = x + 1; i < TermWin.ncol; i++) { if (tabs[i]) { x = i; count--; if (!count) break; } } } else if (count < 0) /* tab backward */ { int i; count = -count; for (i = x - 1; i >= 0; i--) { if (tabs[i]) { x = i; count--; if (!count) break; } } } else return; if (x != screen.col) scr_gotorc (0, x, R_RELATIVE); } /*}}} */ /*{{{ Move the cursor to a new position */ /* * The relative argument is a pair of flags that specify relative * rather than absolute motion. */ void scr_gotorc (int row, int col, int relative) { TermWin.view_start = 0; if (Gr_Displayed ()) Gr_scroll (0); screen.col = (relative & C_RELATIVE ? (screen.col + col) : col); if (screen.col < 0) screen.col = 0; else if (screen.col >= TermWin.ncol) screen.col = (TermWin.ncol - 1); if (screen.flags & Screen_WrapNext) { int roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); screen.text[roffset + (TermWin.ncol)] = '\0'; screen.flags &= ~Screen_WrapNext; } if (relative & R_RELATIVE) { if (row > 0) { if ((screen.row <= screen.bscroll) && (screen.row + row > screen.bscroll)) screen.row = screen.bscroll; else screen.row += row; } else if (row < 0) { if ((screen.row >= screen.tscroll) && (screen.row + row < screen.tscroll)) screen.row = screen.tscroll; else screen.row += row; } } else { if (screen.flags & Screen_Relative) /* relative origin mode */ { screen.row = row + screen.tscroll; if (screen.row > screen.bscroll) screen.row = screen.bscroll; } else screen.row = row; } if (screen.row < 0) screen.row = 0; else if (screen.row >= TermWin.nrow) screen.row = (TermWin.nrow - 1); } /*}}} */ /*{{{ Move the cursor down one line and scroll if necessary */ void scr_index (int dirn) { TermWin.view_start = 0; if (Gr_Displayed ()) Gr_scroll (0); check_text ("index"); if (screen.flags & Screen_WrapNext) { int roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); screen.text[roffset + (TermWin.ncol)] = '\0'; screen.flags &= ~Screen_WrapNext; } if ((screen.row == screen.bscroll && dirn == UP) || (screen.row == screen.tscroll && dirn == DN)) scroll_text (screen.tscroll, screen.bscroll, dirn); else screen.row += dirn; if (selection.op) selection_check (); } /*}}} */ /*{{{ Erase part or the whole of a line */ void scr_erase_line (int mode) { int count, roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); TermWin.view_start = 0; if (Gr_Displayed ()) Gr_scroll (0); if (screen.flags & Screen_WrapNext) { screen.text[roffset + (TermWin.ncol)] = '\0'; screen.flags &= ~Screen_WrapNext; } switch (mode) { case 0: /* erase to end */ check_text ("erase line End"); roffset += (screen.col); count = (TermWin.ncol - screen.col); break; case 1: /* erase to beginning */ check_text ("erase line Start"); count = (screen.col + 1); break; case 2: /* erase entire */ check_text ("erase line Entire"); count = (TermWin.ncol); break; default: check_text ("erase line None"); return; } BLANK_FILL (&screen.text[roffset], &screen.rend[roffset], count); check_text ("erase line Done"); if (selection.op) selection_check (); } /*}}} */ /*{{{ Erase part or the whole of the screen */ void scr_erase_screen (int mode) { int count, roffset = (TermWin.saveLines) * (TermWin.ncol + 1); TermWin.view_start = 0; switch (mode) { case 0: /* erase to end */ check_text ("erase screen End"); scr_erase_line (0); count = (TermWin.nrow - (screen.row + 1)); roffset += ((screen.row + 1) * (TermWin.ncol + 1)); break; case 1: /* erase to beginning */ check_text ("erase screen Start"); scr_erase_line (1); count = screen.row; break; case 2: /* erase entire */ check_text ("erase screen Entire"); Gr_ClearScreen (); count = TermWin.nrow; break; default: check_text ("erase screen None"); return; break; } blank_lines (&screen.text[roffset], &screen.rend[roffset], count); check_text ("erase screen Done"); } /*}}} */ /*{{{ Fill screen with E's */ void scr_E (void) { int r, roffset = (TermWin.saveLines) * (TermWin.ncol + 1); check_text ("E"); TermWin.view_start = 0; memset (&screen.text[roffset], 'E', ((TermWin.nrow) * (TermWin.ncol + 1)) * sizeof (text_t)); for (r = 0; r < (TermWin.nrow); r++, roffset += (TermWin.ncol + 1)) screen.text[roffset + TermWin.ncol] = '\0'; } /*}}} */ /*{{{ Insert or Delete COUNT lines and scroll */ /* * insdel == +1 * delete lines, scroll up the bottom of the screen to fill the gap * insdel == -1 * insert lines, scroll down the lower lines * other values of insdel are undefined */ void scr_insdel_lines (int count, int insdel) { check_text ("insdel lines"); if (screen.row > screen.bscroll) return; if (count > (screen.bscroll - screen.row + 1)) { if (insdel == DELETE) return; else if (insdel == INSERT) count = (screen.bscroll - screen.row + 1); } TermWin.view_start = 0; if (Gr_Displayed ()) Gr_scroll (0); if (screen.flags & Screen_WrapNext) { int roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); screen.text[roffset + (TermWin.ncol)] = '\0'; screen.flags &= ~Screen_WrapNext; } scroll_text (screen.row, screen.bscroll, insdel * count); } /*}}} */ /*{{{ Insert or Delete COUNT characters from the current position */ /* * insdel == +2, erase chars * insdel == +1, delete chars * insdel == -1, insert chars */ void scr_insdel_chars (int count, int insdel) { int roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); text_t *text, *textend; rend_t *rend, *rendend; check_text ("insdel chars"); if (insdel == ERASE) { if (count > screen.col) count = screen.col; if (count <= 0) return; screen.col -= count; /* move backwards */ insdel = DELETE; /* delete chars */ } else if (count > (TermWin.ncol - screen.col)) { count = (TermWin.ncol - screen.col); } if (count <= 0) return; TermWin.view_start = 0; if (Gr_Displayed ()) Gr_scroll (0); if (selection.op) selection_check (); screen.text[roffset + (TermWin.ncol)] = '\0'; screen.flags &= ~Screen_WrapNext; text = &screen.text[roffset + (screen.col)]; rend = &screen.rend[roffset + (screen.col)]; if (insdel == DELETE) { /* overlapping copy */ for ( /*nil */ ; (*text && text[count]); text++, rend++) { *text = text[count]; *rend = rend[count]; } /* fill in the end of the line */ for ( /*nil */ ; *text; text++, rend++) { *text = SPACE_CHAR; *rend = FILL_STYLE; } } else { /* INSERT count characters */ textend = &screen.text[roffset + (TermWin.ncol - 1)]; rendend = &screen.rend[roffset + (TermWin.ncol - 1)]; for ( /*nil */ ; (textend - count >= text); textend--, rendend--) { *textend = *(textend - count); *rendend = *(rendend - count); } /* fill in the gap */ for ( /*nil */ ; (textend >= text); textend--, rendend--) { *textend = SPACE_CHAR; *rendend = FILL_STYLE; } } } /*}}} */ /*{{{ Set the scroll region */ void scr_scroll_region (int top, int bot) { if (top < 0) top = 0; if (bot >= TermWin.nrow) bot = (TermWin.nrow - 1); if (top > bot) return; screen.tscroll = top; screen.bscroll = bot; scr_gotorc (0, 0, 0); } /*}}} */ /*{{{ set visible/invisible cursor */ void scr_cursor_visible (int mode) { if (mode) screen.flags |= Screen_VisibleCursor; else screen.flags &= ~Screen_VisibleCursor; } /*}}} */ /*{{{ Set/Unset automatic wrapping */ void scr_autowrap (int mode) { if (mode) screen.flags |= Screen_Autowrap; else screen.flags &= ~Screen_Autowrap; } /*}}} */ /*{{{ Set/Unset margin origin mode */ /* * In absolute origin mode, line numbers are counted relative to top margin * of screen, the cursor can be moved outside the scrolling region. In * relative mode line numbers are relative to top margin of scrolling * region and the cursor cannot be moved outside */ void scr_relative_origin (int mode) { if (mode) screen.flags |= Screen_Relative; else screen.flags &= ~Screen_Relative; scr_gotorc (0, 0, 0); } /*}}} */ /*{{{ Set/Unset automatic insert mode */ void scr_insert_mode (int mode) { if (mode) screen.flags |= Screen_Insert; else screen.flags &= ~Screen_Insert; } /*}}} */ /*{{{ Move the display to line represented by scrollbar */ /* * Move the display so that line represented by scrollbar value Y is at * the top of the screen */ int scr_move_to (int y, int len) { int start = TermWin.view_start; TermWin.view_start = ((len - y) * ((TermWin.nrow - 1) + TermWin.nscrolled) / (len)) - (TermWin.nrow - 1); if (TermWin.view_start < 0) TermWin.view_start = 0; else if (TermWin.view_start > TermWin.nscrolled) TermWin.view_start = TermWin.nscrolled; if (Gr_Displayed ()) Gr_scroll (0); return (TermWin.view_start - start); } /*}}} */ /*{{{ page the screen up/down NLINES */ int scr_page (int dirn, int nlines) { int start = TermWin.view_start; if (!dirn || !nlines) return 0; if (nlines <= 0) nlines = 1; else if (nlines > TermWin.nrow) nlines = TermWin.nrow; TermWin.view_start += nlines * dirn; if (TermWin.view_start < 0) TermWin.view_start = 0; else if (TermWin.view_start > TermWin.nscrolled) TermWin.view_start = TermWin.nscrolled; if (Gr_Displayed ()) Gr_scroll (0); return (TermWin.view_start - start); } /*}}} */ /*{{{ selection service functions */ /* * If (row,col) is within a selected region of text, remove the selection */ static inline void selection_check (void) { int c1, c2, r1, r2; check_text ("check selection"); if (current_screen != selection.screen) return; if ((selection.mark.row < -TermWin.nscrolled) || (selection.mark.row >= TermWin.nrow) || (selection.beg.row < -TermWin.nscrolled) || (selection.beg.row >= TermWin.nrow) || (selection.end.row < -TermWin.nscrolled) || (selection.end.row >= TermWin.nrow)) { selection_reset (); return; } r1 = (screen.row - TermWin.view_start); c1 = ((r1 - selection.mark.row) * (r1 - selection.end.row)); /* selection.mark.row > screen.row - TermWin.view_start * or * selection.end.row > screen.row - TermWin.view_start */ if (c1 < 0) selection_reset (); /* selection.mark.row == screen.row || selection.end.row == screen.row */ else if (c1 == 0) { /* We're on the same row as the start or end of selection */ if ((selection.mark.row < selection.end.row) || ((selection.mark.row == selection.end.row) && (selection.mark.col < selection.end.col))) { r1 = selection.mark.row; c1 = selection.mark.col; r2 = selection.end.row; c2 = selection.end.col; } else { r1 = selection.end.row; c1 = selection.end.col; r2 = selection.mark.row; c2 = selection.mark.col; } if ((screen.row == r1) && (screen.row == r2)) { if ((screen.col >= c1) && (screen.col <= c2)) selection_reset (); } else if (((screen.row == r1) && (screen.col >= c1)) || ((screen.row == r2) && (screen.col <= c2))) selection_reset (); } } #if 0 static inline void selection_range (int firstr, int lastr) { if (firstr >= lastr || firstr < 0 || firstr >= TermWin.nrow || lastr <= 0 || lastr > TermWin.nrow) return; selection.firstr = firstr; selection.lastr = lastr; } #endif /*}}} */ /*{{{ make selection */ /* * make the selection currently delimited by the selection end markers */ void selection_make (Time tm) { unsigned char *str; int r, startr, startc, endr, endc; int roffset; /* row offset */ switch (selection.op) { case SELECTION_CONT: break; case SELECTION_INIT: selection_reset (); selection.end.row = selection.mark.row = selection.beg.row; selection.end.col = selection.mark.col = selection.beg.col; /*drop */ case SELECTION_BEGIN: selection.op = SELECTION_DONE; /*drop */ default: return; break; } selection.op = SELECTION_DONE; FREE (selection.text, "sel_make", "sel_make"); selection.text = NULL; selection.len = 0; selection.screen = current_screen; /* Set start/end row/col to point to the selection endpoints */ if (selection.end.row < selection.mark.row || (selection.end.row == selection.mark.row && selection.end.col <= selection.mark.col)) { startr = selection.end.row; endr = selection.mark.row; startc = selection.end.col; endc = selection.mark.col; } else { startr = selection.mark.row; endr = selection.end.row; startc = selection.mark.col; endc = selection.end.col; } if ((startr < -TermWin.nscrolled || endr >= TermWin.nrow)) { selection_reset (); return; } str = MALLOC (((endr - startr + 1) * (TermWin.ncol + 1) + 1) * sizeof (char), "sel_text"); selection.text = str; *str = '\0'; /* save all points between start and end with selection flag */ roffset = ((startr + TermWin.saveLines) * (TermWin.ncol + 1)); for (r = startr; r <= endr; r++, roffset += (TermWin.ncol + 1)) { int c; int c1 = (r == startr ? startc : 0); int c2 = (r == endr ? endc : (TermWin.ncol - 1)); #ifdef KANJI if ((screen.rend[roffset + c1] & RS_kanjiMask) == RS_kanjiMask) c1--; if ((screen.rend[roffset + c2] & RS_kanjiMask) == RS_kanji1) c2++; #endif /* KANJI */ for (c = c1; c <= c2; c++) *str++ = screen.text[roffset + c]; /* * end-of-line and not autowrap * remove trailing space, but don't remove an entire line! */ if (c2 == (TermWin.ncol - 1) && !screen.text[roffset + (TermWin.ncol)]) { str--; for (c = c2; c >= c1 && isspace (*str); c--) str--; str++; *str++ = '\n'; } } *str = '\0'; selection.len = strlen ((char*)selection.text); if (selection.len <= 0) return; XSetSelectionOwner (Xdisplay, XA_PRIMARY, TermWin.vt, tm); if (XGetSelectionOwner (Xdisplay, XA_PRIMARY) != TermWin.vt) print_error ("can't get primary selection"); /* Place in CUT_BUFFER0 for backup */ XChangeProperty (Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, selection.text, selection.len); } /*}}} */ /*{{{ respond to a request for our current selection */ void selection_send (XSelectionRequestEvent * rq) { XEvent ev; static Atom xa_targets = None; if (xa_targets == None) xa_targets = XInternAtom (Xdisplay, "TARGETS", False); ev.xselection.type = SelectionNotify; ev.xselection.property = None; ev.xselection.display = rq->display; ev.xselection.requestor = rq->requestor; ev.xselection.selection = rq->selection; ev.xselection.target = rq->target; ev.xselection.time = rq->time; if (rq->target == xa_targets) { /* * On some systems, the Atom typedef is 64 bits wide. * We need to have a typedef that is exactly 32 bits wide, * because a format of 64 is not allowed by the X11 protocol. */ typedef CARD32 Atom32; Atom32 target_list[2]; target_list[0] = (Atom32) xa_targets; target_list[1] = (Atom32) XA_STRING; XChangeProperty (Xdisplay, rq->requestor, rq->property, xa_targets, 8 * sizeof (target_list[0]), PropModeReplace, (unsigned char *) target_list, sizeof (target_list) / sizeof (target_list[0])); ev.xselection.property = rq->property; } else if (rq->target == XA_STRING) { XChangeProperty (Xdisplay, rq->requestor, rq->property, XA_STRING, 8, PropModeReplace, selection.text, selection.len); ev.xselection.property = rq->property; } XSendEvent (Xdisplay, rq->requestor, False, 0, &ev); } /*}}} */ /*{{{ paste selection */ static void PasteIt (const unsigned char *data, unsigned int nitems) { const unsigned char *p = data, *pmax = data + nitems; for (nitems = 0; p < pmax; p++) { /* do newline -> carriage-return mapping */ if (*p == '\n') { unsigned char cr = '\r'; tt_write (data, nitems); tt_write (&cr, 1); data += (nitems + 1); nitems = 0; } else nitems++; } if (nitems) tt_write (data, nitems); } /* * Respond to a notification that a primary selection has been sent */ void selection_paste (Window win, unsigned prop, int Delete) { unsigned long nread, bytes_after; if (prop == None) return; nread = 0; do { unsigned char *data; Atom actual_type; int actual_fmt; unsigned long nitems; if ((XGetWindowProperty (Xdisplay, win, prop, nread / 4, PROP_SIZE, Delete, AnyPropertyType, &actual_type, &actual_fmt, &nitems, &bytes_after, &data) != Success) || (actual_type != XA_STRING)) { XFree (data); return; } nread += nitems; PasteIt (data, nitems); XFree (data); } while (bytes_after > 0); } /*}}} */ /*{{{ Request the current primary selection */ void selection_request (Time tm, int x, int y) { /* is release within the window? */ if (x < 0 || y < 0 || x >= TermWin.width || y >= TermWin.height) return; if (selection.text != NULL) { /* internal selection */ PasteIt (selection.text, selection.len); } else if (XGetSelectionOwner (Xdisplay, XA_PRIMARY) == None) { /* no primary selection - use CUT_BUFFER0 */ selection_paste (Xroot, XA_CUT_BUFFER0, False); } else { Atom prop = XInternAtom (Xdisplay, "VT_SELECTION", False); XConvertSelection (Xdisplay, XA_PRIMARY, XA_STRING, prop, TermWin.vt, tm); } } /*}}} */ /*{{{ Clear the current selection */ void selection_reset (void) { int x, nrow = TermWin.nrow; selection.op = SELECTION_CLEAR; selection.end.row = selection.mark.row = 0; selection.end.col = selection.mark.col = 0; if (current_screen == PRIMARY) nrow += TermWin.saveLines; for (x = 0; x < nrow * (TermWin.ncol + 1); x++) screen.rend[x] &= ~(RS_Select); } void selection_clear (void) { FREE (selection.text, "sel_clear", "sel_clear"); selection.text = NULL; selection.len = 0; selection.op = SELECTION_CLEAR; selection_reset (); } /*}}} */ /*{{{ mark selected points (used by selection_extend) */ static void selection_setclr (int set, int startr, int startc, int endr, int endc) { int r, roffset = ((startr + TermWin.saveLines) * (TermWin.ncol + 1)); /* startr <= endr */ if ((startr < -TermWin.nscrolled) || (endr >= TermWin.nrow)) { selection_reset (); return; } for (r = startr; r <= endr; r++) { int c1 = (r == startr ? startc : 0); int c2 = (r == endr ? endc : (TermWin.ncol - 1)); #ifdef KANJI if ((screen.rend[roffset + c1] & RS_kanjiMask) == RS_kanjiMask) c1--; if ((screen.rend[roffset + c2] & RS_kanjiMask) == RS_kanji1) c2++; #endif /* KANJI */ for ( /*nil */ ; c1 <= c2; c1++) { if (set) screen.rend[roffset + c1] |= RS_Select; else screen.rend[roffset + c1] &= ~(RS_Select); } roffset += (TermWin.ncol + 1); } } /*}}} */ /*{{{ start a selection at the specified col/row */ static void selection_start_colrow (int col, int row) { if (selection.op) { /* startr <= endr */ if ((selection.end.row < -TermWin.nscrolled) || (selection.mark.row < -TermWin.nscrolled)) { selection_reset (); } else /* direction of new selection */ { if (selection.end.row < selection.mark.row || (selection.end.row == selection.mark.row && selection.end.col <= selection.mark.col)) selection_setclr (0, /* up */ selection.end.row, selection.end.col, selection.mark.row, selection.mark.col); else selection_setclr (0, /* down */ selection.mark.row, selection.mark.col, selection.end.row, selection.end.col); } } selection.op = SELECTION_INIT; selection.beg.col = col; selection.beg.row = row; selection.beg.row -= TermWin.view_start; } /* * start a selection at the specified x/y pixel location */ void selection_start (int x, int y) { #ifdef THAI selection_start_colrow (ThaiPixel2Col (x,y), Pixel2Row (y)); #else selection_start_colrow (Pixel2Col (x), Pixel2Row (y)); #endif } /*}}} */ /*{{{ extend the selection to the specified col/row */ static void selection_extend_colrow (int col, int row) { int old_row, old_col, old_dirn, dirn; switch (selection.op) { case SELECTION_INIT: selection_reset (); selection.end.col = selection.mark.col = selection.beg.col; selection.end.row = selection.mark.row = selection.beg.row; /*drop */ case SELECTION_BEGIN: selection.op = SELECTION_BEGIN; break; case SELECTION_DONE: case SELECTION_CONT: selection.op = SELECTION_CONT; break; case SELECTION_CLEAR: selection_start_colrow (col, row); /*drop */ default: return; break; } /* Remember old selection for virtual removal */ old_row = selection.end.row; old_col = selection.end.col; if ((old_row < -TermWin.nscrolled) || (selection.mark.row < -TermWin.nscrolled)) { selection_reset (); return; } /* Figure out where new selection is */ selection.end.col = col; selection.end.row = row; if (selection.end.col < 0) selection.end.col = 0; else if (selection.end.col >= TermWin.ncol) selection.end.col = (TermWin.ncol - 1); selection.end.row -= TermWin.view_start; if (selection.end.row < -TermWin.nscrolled) { selection_reset (); return; } else if (selection.end.row >= TermWin.nrow) selection.end.row = (TermWin.nrow - 1); if ((selection.op == SELECTION_BEGIN) && ((selection.end.col != selection.mark.col) || (selection.end.row != selection.mark.row))) selection.op = SELECTION_CONT; /* If new selection is same as old selection just return * or if no highlighting was requested */ if (selection.end.row == old_row && selection.end.col == old_col) return; /* virtual removal -- delete old highlighting and replace with new */ /* determine direction of old selection */ old_dirn = ((old_row < selection.mark.row || (old_row == selection.mark.row && old_col <= selection.mark.col)) ? UP : DN); /* determine direction of new selection */ dirn = ((selection.end.row < selection.mark.row || (selection.end.row == selection.mark.row && selection.end.col <= selection.mark.col)) ? UP : DN); /* If old and new direction are different, clear old, set new */ if (dirn != old_dirn) { if (old_dirn == UP) { selection_setclr (0, old_row, old_col, selection.mark.row, selection.mark.col); selection_setclr (1, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col); } else { selection_setclr (0, selection.mark.row, selection.mark.col, old_row, old_col); selection_setclr (1, selection.end.row, selection.end.col, selection.mark.row, selection.mark.col); } } else { if (old_dirn == UP) { if (old_row < selection.end.row || (old_row == selection.end.row && old_col < selection.end.col)) { selection_setclr (0, old_row, old_col, selection.end.row, selection.end.col); selection_setclr (1, selection.end.row, selection.end.col, selection.end.row, selection.end.col); } else { selection_setclr (1, selection.end.row, selection.end.col, old_row, old_col); } } else { if (selection.end.row < old_row || (selection.end.row == old_row && selection.end.col < old_col)) { selection_setclr (0, selection.end.row, selection.end.col, old_row, old_col); selection_setclr (1, selection.end.row, selection.end.col, selection.end.row, selection.end.col); } else { selection_setclr (1, old_row, old_col, selection.end.row, selection.end.col); } } } } /* * extend the selection to the specified x/y pixel location */ void selection_extend (int x, int y) { #ifdef THAI selection_extend_colrow (ThaiPixel2Col2 (x,y), Pixel2Row (y)); #else selection_extend_colrow (Pixel2Col (x), Pixel2Row (y)); #endif } /*}}} */ /*{{{ double/triple click selection */ /* * by Edward. Der-Hua Liu, Taiwan * cut char support added by A. Haritsis */ void selection_click (int clicks, int x, int y) { if (clicks <= 1) { selection_start (x, y); /* single click */ } else { int beg_c, end_c, beg_r, end_r; text_t *text; /* ensure rows/columns are on the screen */ #ifdef THAI x = ThaiPixel2Col (x,y); #else x = Pixel2Col (x); #endif x = (x <= 0 ? 0 : (x >= TermWin.ncol ? (TermWin.ncol - 1) : x)); beg_c = end_c = x; y = Pixel2Row (y); y = (y <= 0 ? 0 : (y >= TermWin.nrow ? (TermWin.nrow - 1) : y)); beg_r = end_r = y; switch (clicks) { case 3: /* * triple click */ beg_c = 0; end_c = (TermWin.ncol - 1); break; case 2: /* * double click: handle autowrapped lines */ for (text = (screen.text + (beg_r + TermWin.saveLines - TermWin.view_start) * (TermWin.ncol + 1)); /*forever */ ; beg_r--, text -= (TermWin.ncol + 1)) { while (beg_c > 0 && !strchr (rs_cutchars, text[beg_c - 1])) beg_c--; if (beg_c == 0 && beg_r > (TermWin.view_start - TermWin.nscrolled) && *(text - 1) == '\n' && !strchr (rs_cutchars, *(text - 2))) beg_c = (TermWin.ncol - 1); else break; } for (text = (screen.text + (end_r + TermWin.saveLines - TermWin.view_start) * (TermWin.ncol + 1)); /*forever */ ; end_r++, text += (TermWin.ncol + 1)) { while (end_c < (TermWin.ncol - 1) && !strchr (rs_cutchars, text[end_c + 1])) end_c++; if (end_c == (TermWin.ncol - 1) && end_r < (TermWin.view_start + TermWin.nrow - 1) && text[TermWin.ncol] == '\n' && !strchr (rs_cutchars, text[TermWin.ncol + 1])) end_c = 0; else break; } break; default: return; break; } selection_start_colrow (beg_c, beg_r); selection_extend_colrow (end_c, end_r); } } /*}}} */ /*{{{ Report the current cursor position */ void scr_report_position (void) { tt_printf ("\033[%d;%dR", screen.row + 1, screen.col + 1); } /*}}} */ /* 2001-02-21 Thep : add functions for screen buffer accessing */ void scr_get_position (int *prow, int *pcol) { *prow = screen.row; *pcol = screen.col; } unsigned char scr_get_char_rc(int row, int col) { return (0 <= row && row < TermWin.nrow && 0 <= col && col < TermWin.ncol) ? screen.text[(row+TermWin.saveLines)*(TermWin.ncol+1)+col] : '\0'; } /* 2001-02-21 Thep : end of scrren buffer accessing functions */ /*{{{ Charset/Font functions */ /* * choose a font */ void scr_charset_choose (int set) { screen.charset = set; set_font_style (); } /* * Set a font */ void scr_charset_set (int set, unsigned int ch) { #ifdef KANJI multiByte = (set < 0); set = abs (set); #endif charsets[set] = (unsigned char) ch; set_font_style (); } /*}}} */ /*{{{ scr_expose / scr_touch */ /* * for the box starting at x, y with size width, height * touch the displayed values */ /* 1999-08-11 Theppitak : fix screen refreshing bug for THAI */ #ifndef THAI void scr_expose (int x, int y, int width, int height) { int row, col, end_row, end_col; if (drawn_text == NULL) return; check_text ("touch"); #ifdef THAI col = ThaiPixel2Col (x,y); #else col = Pixel2Col (x); #endif row = Pixel2Row (y); if (col < 0) col = 0; else if (col >= TermWin.ncol) col = (TermWin.ncol - 1); if (row < 0) row = 0; else if (row >= TermWin.nrow) row = (TermWin.nrow - 1); end_col = col + 1 + Pixel2Width (width); end_row = row + 1 + Pixel2Height (height); if (end_row >= TermWin.nrow) end_row = (TermWin.nrow - 1); if (end_col >= TermWin.ncol) end_col = (TermWin.ncol - 1); width = (end_col - col + 1); for ( /*nil */ ; row <= end_row; row++) { int roffset = (col + row * (TermWin.ncol + 1)); memset (&drawn_text[roffset], 0, width * sizeof (text_t)); memset (&drawn_rend[roffset], 0, width * sizeof (rend_t)); } } #else /* THAI */ void scr_expose (int x, int y, int width, int height) { int row, end_row; if (drawn_text == NULL) return; check_text ("touch"); row = Pixel2Row (y); if (row < 0) row = 0; else if (row >= TermWin.nrow) row = (TermWin.nrow - 1); end_row = row + 1 + Pixel2Height (height); if (end_row >= TermWin.nrow) end_row = (TermWin.nrow - 1); for ( /*nil */ ; row <= end_row; row++) { int row_y, col, end_col, roffset, rwidth; row_y = Row2Pixel(row); col = ThaiPixel2Col(x, row_y); if (col < 0) col = 0; else if (col >= TermWin.ncol) col = (TermWin.ncol - 1); end_col = ThaiPixel2Col(x+width, row_y); if (end_col < 0) col = 0; else if (end_col >= TermWin.ncol) end_col = (TermWin.ncol - 1); rwidth = (end_col - col + 1); roffset = (col + row * (TermWin.ncol + 1)); memset (&drawn_text[roffset], 0, rwidth * sizeof (text_t)); memset (&drawn_rend[roffset], 0, rwidth * sizeof (rend_t)); } } #endif /* THAI */ /* touch the entire screen */ void scr_touch (void) { scr_expose (0, 0, TermWin.width, TermWin.height); } /*}}} */ /*{{{ Refresh screen */ /* * refresh the region defined by rows STARTR and ENDR, inclusively. * * Actually draws to the X window * For X related speed-ups, this is a good place to fiddle. * The arrays drawn_text and drawn_rend contain what I * believe is currently shown on the screen. The arrays in screen contain * what should be displayed. This routine can decide how to refresh the * screen. Calls in command.c decide when to refresh. */ void scr_refresh (int type) { #ifdef XPM_BACKGROUND #undef USE_XCOPYAREA #ifndef NO_BOLDOVERSTRIKE #define NO_BOLDOVERSTRIKE #endif #ifdef XPM_BUFFERING int update = 0; #define drawBuffer (TermWin.buf_pixmap) #endif /* XPM_BUFFERING */ #endif /* XPM_BACKGROUND */ #ifndef drawBuffer #define drawBuffer (TermWin.vt) #endif static int last_xcursor = 0; int r, roffset, doffset, xcursor; #ifdef KANJI static int wbyte = 0; #endif if (type == NO_REFRESH) /* Window not visible, don't update */ return; check_text ("refresh region"); if (last_xcursor < (TermWin.nrow * (TermWin.ncol + 1))) { /* make sure to update it */ drawn_rend[last_xcursor] = RS_attrMask; } xcursor = ((screen.row + TermWin.saveLines) * (TermWin.ncol + 1) + screen.col); last_xcursor = (screen.row + TermWin.view_start); if (last_xcursor >= TermWin.nrow) { last_xcursor = 0; } else { last_xcursor *= (TermWin.ncol + 1); if (screen.flags & Screen_VisibleCursor) { screen.rend[xcursor] |= RS_Cursor; #ifdef KANJI if ((screen.rend[xcursor] & RS_kanjiMask) == RS_kanji1) screen.rend[xcursor + 1] |= RS_Cursor; #endif } } last_xcursor += screen.col; #ifdef USE_XCOPYAREA /* * scroll using bitblt wherever possible * a dirty approximation will ignore the rendition field here * and fix it up later */ if (type == FAST_REFRESH && !Gr_Displayed ()) for (r = 0; r < TermWin.nrow; r++) { int k; int doffset = r * (TermWin.ncol + 1); int roffset = doffset + ((TermWin.saveLines - TermWin.view_start) * (TermWin.ncol + 1)); if (!memcmp (&drawn_text[doffset], &screen.text[roffset], (TermWin.ncol) * sizeof (text_t))) continue; /* * look for a similar line */ for (doffset = 0, k = 0; k < TermWin.nrow; k++, doffset += (TermWin.ncol + 1)) { if (!memcmp (&drawn_text[doffset], &screen.text[roffset], TermWin.ncol * sizeof (text_t))) break; } /* found it */ if (k < TermWin.nrow) { int count; int j = r; roffset += (TermWin.ncol + 1); doffset += (TermWin.ncol + 1); r++; for (count = 1; ((r < TermWin.nrow) && !memcmp (&drawn_text[doffset], &screen.text[roffset], TermWin.ncol * sizeof (text_t)) ); count++, r++) { roffset += (TermWin.ncol + 1); doffset += (TermWin.ncol + 1); } r--; XCopyArea (Xdisplay, TermWin.vt, TermWin.vt, TermWin.gc, TermWin_internalBorder, Row2Pixel (k), Width2Pixel (1), Height2Pixel (count), TermWin_internalBorder, Row2Pixel (j)); /* * Forward overlapping memcpy's are probably OK, * but backwards doesn't work on SunOS 4.1.3 */ k *= (TermWin.ncol + 1); j *= (TermWin.ncol + 1); if (k > j) { while (count-- > 0) { MEMCOPY (&drawn_text[j], &drawn_text[k], count * (TermWin.ncol + 1) * sizeof (text_t)); MEMCOPY (&drawn_rend[j], &drawn_rend[k], count * (TermWin.ncol + 1) * sizeof (rend_t)); k += (TermWin.ncol + 1); j += (TermWin.ncol + 1); } } else { k += (count - 1) * (TermWin.ncol + 1); j += (count - 1) * (TermWin.ncol + 1); while (count-- > 0) { MEMCOPY (&drawn_text[j], &drawn_text[k], (TermWin.ncol + 1) * sizeof (text_t)); MEMCOPY (&drawn_rend[j], &drawn_rend[k], (TermWin.ncol + 1) * sizeof (rend_t)); k -= (TermWin.ncol + 1); j -= (TermWin.ncol + 1); } } } } #endif /* USE_XCOPYAREA */ doffset = 0 * (TermWin.ncol + 1); roffset = doffset + ((TermWin.saveLines - TermWin.view_start) * (TermWin.ncol + 1)); /* For a first cut, do it one character at a time */ for (r = 0; r < TermWin.nrow; roffset += (TermWin.ncol + 1), doffset += (TermWin.ncol + 1), r++) { int c; int ypixel = TermWin.font->ascent + Row2Pixel (r); #ifdef THAI int thai_check[(TermWin.ncol + 1)]; int thai_mcol[(TermWin.ncol + 1)]; int thai_mcolcount; int thai_len; #endif #ifndef KANJI /* fast way to avoid the next loop (most of the time) ? */ if (!memcmp (&drawn_text[doffset], &screen.text[roffset], (TermWin.ncol) * sizeof (text_t)) && !memcmp (&drawn_rend[doffset], &screen.rend[roffset], (TermWin.ncol) * sizeof (rend_t))) continue; #endif #ifdef THAI thai_len = thai_compare(&drawn_text[doffset], &screen.text[roffset], &drawn_rend[doffset], &screen.rend[roffset], thai_check, thai_mcol, &thai_mcolcount); if(thai_mcolcount) { /* printf("%d\n",thai_mcolcount); */ thai_complexclear(thai_mcol, ypixel); } else { if(thai_len < TermWin.ncol) thai_clearline(thai_len, TermWin.ncol, ypixel); } #endif /* THAI */ for (c = 0; c < TermWin.ncol; c++) { int count; int x = roffset + c; int x1 = doffset + c; #ifndef THAI if ((drawn_text[x1] != screen.text[x]) || (drawn_rend[x1] != screen.rend[x]) #ifdef KANJI || (((screen.rend[x] & RS_kanjiMask) == RS_kanji1) && (drawn_text[x1 + 1] != screen.text[x + 1])) #endif /* KANJI */ ) #else /* THAI */ if (thai_check[c] || (drawn_rend[x1] != screen.rend[x])) #endif /* THAI*/ { int fore, back, rend; XGCValues gcvalue; /* GC values */ unsigned long gcmask = 0; /* GC mask */ int outlineCursor = False; /* block cursor */ #ifdef THAI int xpixel = ThaiCol2Pixel(c, &screen.text[roffset]); unsigned char *start_text = &screen.text[roffset+c]; #else int xpixel = Col2Pixel (c); #endif drawn_text[x1] = screen.text[x]; drawn_rend[x1] = screen.rend[x]; linebuf[0] = screen.text[x]; rend = screen.rend[x]; x++; c++; for (count = 1; (c < TermWin.ncol && #ifdef KANJI ((rend & ~RS_kanji0) == (screen.rend[x] & ~RS_kanji0)) && #else /* KANJI */ (rend == screen.rend[x]) && #endif /* KANJI */ (drawn_text[doffset + c] != screen.text[x] || drawn_rend[doffset + c] != screen.rend[x] || #ifdef KANJI (x > 0 && (screen.rend[x - 1] & ~RS_kanji1)) || #endif /* KANJI */ (c + 1 < TermWin.ncol && drawn_text[doffset + c + 1] != screen.text[x + 1]))); count++, x++, c++) { drawn_text[doffset + c] = screen.text[x]; drawn_rend[doffset + c] = screen.rend[x]; linebuf[count] = screen.text[x]; #ifdef THAI if(thai_spcount && linebuf[count] != ' ' && linebuf[count-1] == ' ') { break; } #endif } c--; linebuf[count] = '\0'; /* zero-terminate */ #ifdef KANJI /* ensure the correct font is used */ if (rend & RS_kanji1) { if (!wbyte) { wbyte = 1; XSetFont (Xdisplay, TermWin.gc, TermWin.kanji->fid); } if (linebuf[0] & 0x80) kanji_decode (linebuf, count); } else { if (wbyte) { wbyte = 0; XSetFont (Xdisplay, TermWin.gc, TermWin.font->fid); } } #endif /* KANJI */ fore = GET_FGCOLOR (rend); back = GET_BGCOLOR (rend); rend = GET_ATTR (rend); if (rend) { int rvid = 0; if ((rend & (RS_RVid | RS_Select)) == (RS_RVid | RS_Select)) rend &= ~(RS_RVid | RS_Select); else if (rend & (RS_RVid | RS_Select)) rvid = 1; if (rend & RS_Cursor) { #ifdef THAI if (!TermWin.focus || thai_isupper(linebuf[0])) #else if (!TermWin.focus) #endif { outlineCursor = True; rend &= ~(RS_Cursor); } else rvid = (!rvid #ifndef NO_CURSORCOLOR || (PixColors[cursorColor] != PixColors[bgColor]) #endif ); } /* swap foreground/background colors */ if (rvid) { int tmp = back; back = fore; fore = tmp; } /* * do some font character switching */ switch (rend & RS_fontMask) { case RS_acsFont: for (x = 0; x < count; x++) if (linebuf[x] >= 0x5F && linebuf[x] < 0x7F) linebuf[x] = (linebuf[x] == 0x5F ? 0x7F : linebuf[x] - 0x5F); break; case RS_ukFont: for (x = 0; x < count; x++) if (linebuf[x] == '#') linebuf[x] = '\036'; break; } } /* bold characters - order of preference: * 1 - change the foreground color to colorBD * 2 - change the foreground color to bright * 3 - use boldFont * 4 - simulate with overstrike */ #ifdef NO_BRIGHTCOLOR #define MonoBold(x) ((x) & (RS_Bold|RS_Blink)) #else /* NO_BRIGHTCOLOR */ #define MonoBold(x) (((x) & RS_Bold) && fore == fgColor) #endif /* NO_BRIGHTCOLOR */ /* # define MonoBold(x) ((((x) & RS_Bold) && fore == fgColor) || (((x) & RS_Blink) && back == bgColor)) */ /* * blink simulated by simulated bold (overstrike) seems a bit farfetched * comment this out (v2.17 - 04APR96) and see how many people complain */ if (fore != fgColor) { gcvalue.foreground = PixColors[fore]; gcmask |= GCForeground; } #ifndef NO_BOLDUNDERLINE else { if (rend & RS_Bold) /* do bold first */ { gcvalue.foreground = PixColors[colorBD]; if (gcvalue.foreground != PixColors[fgColor]) { gcmask |= GCForeground; rend &= ~RS_Bold; } } else if (rend & RS_Uline) { gcvalue.foreground = PixColors[colorUL]; if (gcvalue.foreground != PixColors[fgColor]) { gcmask |= GCForeground; rend &= ~RS_Uline; } } } #endif /* NO_BOLDUNDERLINE */ if (back != bgColor) { gcvalue.background = PixColors[back]; gcmask |= GCBackground; } #ifndef NO_CURSORCOLOR if ((rend & RS_Cursor) && (PixColors[cursorColor] != PixColors[bgColor])) { #ifdef THAI gcvalue.background = thai_keyboard ? PixColors[cursorColorThai]:PixColors[cursorColor]; #else gcvalue.background = PixColors[cursorColor]; #endif gcmask |= GCBackground; if (PixColors[cursorColor2] != PixColors[fgColor]) { gcvalue.foreground = PixColors[cursorColor2]; gcmask |= GCForeground; } } #endif /* NO_CURSORCOLOR */ if (gcmask) XChangeGC (Xdisplay, TermWin.gc, gcmask, &gcvalue); #ifdef XPM_BACKGROUND #ifdef XPM_BUFFERING update = 1; #endif /* XPM_BUFFERING */ #endif /* XPM_BACKGROUND */ /*----------------------------------------------------------------------*/ /* * how to write the strings */ #undef drawStringPrep #undef drawString #ifdef THAI #ifdef XPM_BACKGROUND #ifdef XPM_BUFFERING #define drawStringPrep()\ XCopyArea (Xdisplay, TermWin.pixmap, drawBuffer, TermWin.gc,\ xpixel, (ypixel - TermWin.font->ascent),\ ThaiWidth2Pixel (count,start_text), Height2Pixel (1), \ xpixel, (ypixel - TermWin.font->ascent)) #else /* XPM_BUFFERING */ #define drawStringPrep()\ XClearArea (Xdisplay, drawBuffer, xpixel, \ (ypixel + 2 - Height2Pixel (1)),\ ThaiWidth2Pixel (count,start_text), Height2Pixel (1), 0) #endif /* XPM_BUFFERING */ #endif /* XPM_BACKGROUND */ #else /* not THAI */ #ifdef XPM_BACKGROUND #ifdef XPM_BUFFERING #define drawStringPrep()\ XCopyArea (Xdisplay, TermWin.pixmap, drawBuffer, TermWin.gc,\ xpixel, (ypixel - TermWin.font->ascent),\ Width2Pixel (count), Height2Pixel (1), \ xpixel, (ypixel - TermWin.font->ascent)) #else /* XPM_BUFFERING */ #define drawStringPrep()\ XClearArea (Xdisplay, drawBuffer, xpixel, \ (ypixel + 2 - Height2Pixel (1)),\ Width2Pixel (count), Height2Pixel (1), 0) #endif /* XPM_BUFFERING */ #endif /* XPM_BACKGROUND */ #endif /* THAI */ #define drawString(strFunc)\ strFunc (Xdisplay, drawBuffer, TermWin.gc, xpixel, ypixel, (char *)linebuf, \ count) /*----------------------------------------------------------------------*/ #ifdef KANJI if (wbyte) { count /= 2; #ifdef XPM_BACKGROUND if (back == bgColor) { drawStringPrep (); drawString (XDrawString16); } else #endif /* XPM_BACKGROUND */ drawString (XDrawImageString16); #ifndef NO_BOLDOVERSTRIKE if (MonoBold (rend)) { xpixel++; drawString (XDrawString16); xpixel--; } #endif /* NO_BOLDOVERSTRIKE */ } else #endif /* KANJI */ #ifndef NO_BOLDFONT if (MonoBold (rend) && TermWin.boldFont != NULL) { XSetFont (Xdisplay, TermWin.gc, TermWin.boldFont->fid); #ifdef XPM_BACKGROUND if (back == bgColor) { drawStringPrep (); drawString (XDrawString); } else #endif /* XPM_BACKGROUND */ drawString (XDrawImageString); XSetFont (Xdisplay, TermWin.gc, TermWin.font->fid); } else #endif /* NO_BOLDFONT */ { #ifdef XPM_BACKGROUND if (back == bgColor) { drawStringPrep (); drawString (XDrawString); } else #endif /* XPM_BACKGROUND */ drawString (XDrawImageString); #ifndef NO_BOLDOVERSTRIKE if (MonoBold (rend)) { xpixel++; drawString (XDrawString); xpixel--; } #endif /* NO_BOLDOVERSTRIKE */ } #undef MonoBold /* * On the smallest font, underline overwrites next row */ if ((rend & RS_Uline) && (TermWin.font->descent > 1)) { XDrawLine (Xdisplay, drawBuffer, TermWin.gc, xpixel, ypixel + 1, xpixel + Width2Pixel (count) - 1, ypixel + 1); } if (outlineCursor) { #ifndef NO_CURSORCOLOR if (PixColors[cursorColor] != PixColors[bgColor]) { #ifdef THAI gcvalue.foreground = thai_keyboard ? PixColors[cursorColorThai]:PixColors[cursorColor]; #else gcvalue.foreground = PixColors[cursorColor]; #endif gcmask |= GCForeground; XChangeGC (Xdisplay, TermWin.gc, gcmask, &gcvalue); } #endif /* NO_CURSORCOLOR */ #ifdef THAI { int height, top; if(thai_isupper(linebuf[0])) { height = (Height2Pixel (1) - 1)/4; switch (thai_level(linebuf[0])) { case 1: top = (ypixel - TermWin.font->ascent) + (Height2Pixel (1) - 1) - height; break; case 2: top = (ypixel - TermWin.font->ascent)+height; break; case 3: default: /* to make gcc quiet */ top = (ypixel - TermWin.font->ascent); break; } XDrawRectangle (Xdisplay, drawBuffer, TermWin.gc, xpixel-Width2Pixel(1), top, Width2Pixel (1) - 1, height); } else XDrawRectangle (Xdisplay, drawBuffer, TermWin.gc, xpixel, (ypixel - TermWin.font->ascent), Width2Pixel (1) - 1, Height2Pixel (1) - 1); } #else XDrawRectangle (Xdisplay, drawBuffer, TermWin.gc, xpixel, (ypixel - TermWin.font->ascent), Width2Pixel (1) - 1, Height2Pixel (1) - 1); #endif } if (gcmask) { /* restore normal colors */ gcvalue.foreground = PixColors[fgColor]; gcvalue.background = PixColors[bgColor]; XChangeGC (Xdisplay, TermWin.gc, gcmask, &gcvalue); } } } } if (screen.flags & Screen_VisibleCursor) { screen.rend[xcursor] &= ~(RS_Cursor); #ifdef KANJI screen.rend[xcursor + 1] &= ~(RS_Cursor); #endif /* KANJI */ } #ifdef XPM_BUFFERING if (update) { XClearArea (Xdisplay, TermWin.vt, 0, Row2Pixel (0), TermWin_TotalWidth (), TermWin_TotalHeight (), 0); XFlush (Xdisplay); } #endif /* XPM_BUFFERING */ #undef drawStringPrep #undef drawString #ifndef THAI #undef drawBuffer #endif } /*}}} */ /*{{{ Tabs: set/clear */ /* * -1 = clear all tabs * +0 = clear tab stop at current column * +1 = set tab stop at current column */ void scr_set_tab (int mode) { if (mode < 0) memset (tabs, 0, TermWin.ncol * sizeof (char)); else if (screen.col < TermWin.ncol) tabs[screen.col] = (mode != 0); } /*}}} */ /*{{{ toggle reverse video settings */ void scr_rvideo_mode (int mode) { if (rvideo != mode) { register int x, count; rvideo = mode; rstyle ^= RS_RVid; count = (TermWin.nrow + TermWin.saveLines) * (TermWin.ncol + 1); for (x = 0; x < count; x++) screen.rend[x] ^= RS_RVid; scr_refresh (SLOW_REFRESH); #ifdef DEBUG_COLORS debug_colors (); #endif } } /*}}} */ /*{{{ Handle receipt of a bell character */ void scr_bell (void) { #ifndef NO_MAPALERT #ifdef MAPALERT_OPTION if (Options & Opt_mapAlert) #endif XMapWindow (Xdisplay, TermWin.parent); #endif if (Options & Opt_visualBell) { scr_rvideo_mode (!rvideo); scr_rvideo_mode (!rvideo); } else XBell (Xdisplay, 0); } /*}}} */ /*{{{ Print-Pipe */ #ifdef PRINTPIPE void scr_printscreen (int fullhist) { text_t *text; int r, nrows; FILE *fd; if ((fd = popen_printer ()) == NULL) return; nrows = TermWin.nrow; if (fullhist) nrows += TermWin.view_start; text = &screen.text[((TermWin.saveLines - TermWin.view_start) * (TermWin.ncol + 1))]; for (r = 0; r < nrows; r++, text += (TermWin.ncol + 1)) { int i; for (i = (TermWin.ncol - 1); i >= 0 && isspace (text[i]); i--) /*nil */ ; i++; fprintf (fd, "%.*s\n", i, text); } pclose_printer (fd); } #endif /*}}} */ /*{{{ Debugging for selection */ /* * hidden debugging dump */ #ifdef DEBUG_SELECTION static void debug_PasteIt (unsigned char *data, int nitems) { unsigned char *p, *pmax = data + nitems; int i; printf ("\n\""); for (nitems = 0, p = data; p < pmax; p++) { if (*p == '\n') { printf ("[%d chars]\n%.*s\\n\n", nitems, nitems, data); data += (nitems + 1); nitems = 0; } else if (*p == '\r') { printf ("[%d chars]\n%.*s\\r\n", nitems, nitems, data); data += (nitems + 1); nitems = 0; } else nitems++; } if (nitems) printf ("%*s", (nitems), data); printf ("\"\n"); } int debug_selection (void) { printf ("\n%dx%d [chars] %dx%d [pixels] (font: %ux%u), scroll = %d/%d\n", TermWin.ncol, TermWin.nrow, TermWin.width, TermWin.height, Width2Pixel (1), Height2Pixel (1), screen.tscroll, screen.bscroll); printf ("%d lines scrollback, %d lines scrolled, start = %d\n", TermWin.saveLines, TermWin.nscrolled, TermWin.view_start); printf ("selection = screen %d, op = ", selection.screen); switch (selection.op) { case SELECTION_CLEAR: printf ("CLEAR"); break; case SELECTION_BEGIN: printf ("BEGIN"); break; case SELECTION_INIT: printf ("INIT"); break; case SELECTION_CONT: printf ("CONT"); break; case SELECTION_DONE: printf ("DONE"); break; default: printf ("Unknown"); break; } printf ("\n\trow/col\n" "beg\t%d %d\nend\t%d %d\nanchor\t%d %d\ncursor\t%d %d\n" "selection [%d chars]\n", selection.beg.row, selection.beg.col, selection.end.row, selection.end.col, selection.mark.row, selection.mark.col, screen.row, screen.col, selection.len); if (selection.text != NULL) debug_PasteIt (selection.text, selection.len); return 0; } #endif /*}}} */ /*{{{ Mouse Reporting */ /* add the bits: * @ 1 - shift * @ 2 - meta * @ 4 - ctrl */ #define ButtonNumber(x) ((x) == AnyButton ? 3 : ((x) - Button1)) #define KeyState(x) ((((x)&(ShiftMask|ControlMask))+(((x)&Mod1Mask)?2:0))<<2) void mouse_report (XButtonEvent * ev) { tt_printf ("\033[M%c%c%c", (040 + ButtonNumber (ev->button) + KeyState (ev->state)), #ifdef THAI (041 + ThaiPixel2Col (ev->x,ev->y)), #else (041 + Pixel2Col (ev->x)), #endif (041 + Pixel2Row (ev->y))); } #if 0 /* X11 mouse tracking: not yet - maybe never! */ void mouse_tracking (int report, int x, int y, int firstrow, int lastrow) { static int top, bot; if (report) { /* If either coordinate is past the end of the line: * "ESC [ T CxCyCxCyCxCy" * The parameters are begx, begy, endx, endy, * mousex, and mousey */ if ((selection.beg.row < selection.end.row) || ((selection.beg.row == selection.end.row) && (selection.beg.col < selection.end.col))) { if (selection.beg.row >= top && selection.end.row <= bot) tt_printf ("\033[t"); /* start/end are valid locations */ else tt_printf ("\033[T%c%c%c%c", selection.beg.col + 1, selection.beg.row + 1, selection.end.col + 1, selection.end.row + 1); } else { if (selection.end.row >= top && selection.beg.row <= bot) tt_printf ("\033[t"); /* start/end are valid locations */ else tt_printf ("\033[T%c%c%c%c", selection.end.col + 1, selection.end.row + 1, selection.beg.col + 1, selection.beg.row + 1) } tt_printf ("%c%c", Pixel2Col (x) + 1, Pixel2Row (y) + 1); } else { selection_start_colrow (x - 1, y - 1); top = firstrow; bot = lastrow; } } #endif /*}}} */ #ifdef THAI void thai_complexclear(int *list, int ypixel) { int from = 0, to, in, i; in = 0; for(i=1;i<=TermWin.ncol;i++) { if(list[i] && in==0) { in = 1; from = i-1; } if(in==1 && !(list[i])) { to = i-1; thai_clearline(from,to,ypixel); in = 0; } } if(in) { thai_clearline(from,i-1,ypixel); } } void thai_clearline(int from, int to, int ypixel) { /* printf("clear %d - %d\n", from, to); */ /* Clear Line */ #ifdef XPM_BACKGROUND #ifdef XPM_BUFFERING XCopyArea (Xdisplay, TermWin.pixmap, drawBuffer, TermWin.gc, Col2Pixel(from), (ypixel - TermWin.font->ascent), Width2Pixel (to-from), Height2Pixel (1), Col2Pixel(from), (ypixel - TermWin.font->ascent)); #else /* XPM_BUFFERING */ XClearArea (Xdisplay, drawBuffer, Col2Pixel(from), (ypixel + 2 - Height2Pixel (1)), Width2Pixel(to-from), Height2Pixel (1), 0); #endif /* XPM_BUFFERING */ #else XClearArea (Xdisplay, drawBuffer, Col2Pixel(from), ypixel - TermWin.font->ascent, Width2Pixel(to-from), Height2Pixel (1), 0); #endif /* XPM_BACKGROUND */ } #endif /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/Makefile.huiIRIX0000644000175000017500000000767111375434150016073 0ustar thepthep# Generated automatically from Makefile.in by configure. # src/Makefile.in -*- Makefile -*- # ./Make.common.in -*- Makefile -*- DATE="10 July 1997"# LSMDATE=10JUL97# VERSION=1.0# VERNAME=xiterm-$(VERSION)# MAINT="Guylhem Aznar srcdir = . SHELL = /bin/sh # This variable makes it possible to move the installation root to another # directory. This is useful when you're creating a binary distribution # If empty, normal root will be used. # You can run eg. 'make install DESTDIR=/usr/copain/xiterm' to accomplish # that. # Installation target directories & other installation stuff prefix = /usr/local exec_prefix = ${prefix} # DESTDIR = /usr/local/$(VERNAME) binprefix = manprefix = bindir = ${exec_prefix}/bin mandir = ${prefix}/man/man1 manext = 1 # Tools & program stuff CC = gcc CPP = gcc -E RM = /usr/local/bin/rm RMF = /usr/local/bin/rm -f CP = /usr/local/bin/cp INSTALL = /usr/local/bin/install -c INSTALL_PROGRAM = /usr/local/bin/install -c -s -m 755 INSTALL_DATA = /usr/local/bin/install -c -m 644 # add -DBINDIR=\""$(bindir)/"\" to CPPFLAGS, if we need to spawn a program CFLAGS = -O2 -fno-strength-reduce CPPFLAGS = #-DHAVE_LIBXPM LDFLAGS = DEFS = -DHAVE_CONFIG_H LIBS = XINC = XLIB = -lX11 #-L/usr/local/lib -lXpm # End of Make.common basedir = $(srcdir)/.. thisdir = src first_rule: all dummy: SRCS = command.c debug.c graphics.c grkelot.c main.c misc.c\ netdisp.c screen.c scrollbar.c utmp.c xdefaults.c\ thai.c OBJS = command.o debug.o graphics.o grkelot.o main.o misc.o\ netdisp.o screen.o scrollbar.o utmp.o xdefaults.o\ thai.o HDRS = command.h debug.h defaults.h feature.h graphics.h grkelot.h\ main.h misc.h screen.h scrollbar.h xdefaults.h # # Distribution variables # DIST = $(HDRS) $(SRCS) Makefile.in gcc-Wall # inference rules .c.o: $(CC) -c $(CPPFLAGS) $(XINC) -I$(basedir) $(CFLAGS) $< #------------------------------------------------------------------------- all: xiterm xiterm: VERSION.h $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(XLIB) VERSION.h: echo "#define VERSION \""$(VERSION)"\"" > $@; tags: $(SRCS) ctags $(SRCS) allbin: xiterm clean: $(RMF) xiterm core a.out *.o *.bak *~ realclean: clean $(RMF) VERSION.h tags mrproper: (cd $(srcdir); $(RMF) xiterm *~ *.o core a.out) if test $(srcdir) = .; then $(MAKE) realclean; fi (cd $(srcdir); $(RMF) Makefile) install: allbin alldoc $(INSTALL_PROGRAM) xiterm $(DESTDIR)$(bindir)/$(binprefix)xiterm uninstall: (cd $(bindir); $(RMF) $(binprefix)xiterm) # Semi-automatic generation of dependencies: # Use gcc -MM because X11 `makedepend' doesn't work on all systems # and it also includes system headers. # `semi'-automatic since dependencies are generated at distribution time. distdepend: mv Makefile.in Makefile.in~ sed "/^# DO NOT DELETE:/,$$ d" Makefile.in~ > Makefile.in echo "# DO NOT DELETE: ugly dependency list follows" >> Makefile.in gcc -MM $(CPPFLAGS) $(XINC) -I$(basedir) $(SRCS) >> Makefile.in # ----------------------------------------------------------------------- command.o: command.c main.h VERSION.h ./../config.h feature.h misc.h \ xdefaults.h command.h debug.h graphics.h grkelot.h \ scrollbar.h screen.h defaults.h debug.o: debug.c ./../config.h feature.h debug.h graphics.o: graphics.c main.h VERSION.h ./../config.h feature.h misc.h \ command.h debug.h graphics.h screen.h grkelot.o: grkelot.c ./../config.h feature.h grkelot.h main.o: main.c main.h VERSION.h ./../config.h feature.h misc.h \ command.h debug.h graphics.h scrollbar.h screen.h \ xdefaults.h defaults.h misc.o: misc.c main.h VERSION.h ./../config.h feature.h misc.h netdisp.o: netdisp.c ./../config.h feature.h screen.o: screen.c main.h VERSION.h ./../config.h feature.h misc.h \ command.h debug.h graphics.h screen.h scrollbar.o: scrollbar.c main.h VERSION.h ./../config.h feature.h \ misc.h scrollbar.h utmp.o: utmp.c ./../config.h feature.h xdefaults.o: xdefaults.c main.h VERSION.h ./../config.h feature.h \ misc.h debug.h defaults.h grkelot.h xdefaults.h xiterm+thai-1.10/src/thai.c0000644000175000017500000001206711375434150014237 0ustar thepthep#include "main.h" #include "thai.h" static const unsigned char movetab[] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, /* 00..0F */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, /* 10..1F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20..2F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 30..3F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40..4F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 50..5F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60..6F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70..7F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80..8F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90..9F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* A0..AF */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* B0..BF */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* C0..CF */ 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, /* D0..DF */ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, /* E0..EF */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* F0..FF */ }; extern text_t *drawn_text; int thai_spcount = 2; static int thai_colinc(unsigned char c, int *udcount, int *spcount) { int ret=0; if(c==0) /* Initialize */ *udcount=*spcount=0; else { if(!movetab[c]) { ret = 1; if(c == ' ') { (*spcount)++; if(*spcount == thai_spcount) { *spcount = 0; ret += *udcount; *udcount = 0; } } else { *spcount = 0; } } else { (*udcount)++; *spcount = 0; ret = 0; } } return ret; } static int thai_colinc1(unsigned char c) { static int ud1,sp1; return thai_colinc(c,&ud1,&sp1); } static int thai_colinc2(unsigned char c) { static int ud2,sp2; return thai_colinc(c,&ud2,&sp2); } static int thaistrlen(unsigned char *from, unsigned char *to) { int j; j=0; if(thai_spcount) { thai_colinc1(0); while(from!=to) { j+= thai_colinc1(*from); from++; } } else { while(from!=to) { if(!movetab[*from]) j++; from++; } } return j; } int thai_compare(text_t *d, text_t *s, rend_t *dr, rend_t *sr, int *result, int *mcol, int *mcolcount) { int i, j, len; int col[TermWin.ncol+1]; unsigned int col_d [2*TermWin.ncol+4]; unsigned int col_s [2*TermWin.ncol+4]; int ptr_d, ptr_s, ptr; int s1, s2; /* Column starts from 1 ... 80 (not 0 ... 79) */ /* Use 2 bytes/column */ *mcolcount = 0; i=2*TermWin.ncol+4; while(i>0) { i--; col_d[i]=col_s[i]=0; } /* Convert string into Thai columns */ len = ptr_d = ptr_s = 0; thai_colinc1(0); thai_colinc2(0); mcol [ TermWin.ncol ] = 0; for(i=0;i0xD0)?levtable[c-0xd0]:0; } /* int ThaiCol2Pixel(c, &screen.text[roffset]); */ int ThaiCol2Pixel(int c, unsigned char *start) { return thaistrlen(start, start+c)*TermWin.fwidth + TermWin_internalBorder; } /* ThaiWidth2Pixel (count,start_text), Height2Pixel (1), 0) */ int ThaiWidth2Pixel (int c, unsigned char *start) { return thaistrlen(start, start+c)*TermWin.fwidth; } int ThaiPixel2Col(int x, int y) { int doffset = Pixel2Row(y) * (TermWin.ncol + 1); unsigned char *start = &drawn_text[doffset]; int col=0, cx=0; x -= TermWin_internalBorder; if(thai_spcount) { thai_colinc1(0); while(cx<=x) { cx += TermWin.fwidth * thai_colinc1(start[col]); col++; } } else { while(cx<=x) { if(!movetab[start[col]]) cx += TermWin.fwidth; col++; } } return col-1; } int ThaiPixel2Col2(int x, int y) { int doffset = Pixel2Row(y) * (TermWin.ncol + 1); unsigned char *start = &drawn_text[doffset]; int col=0, cx=0; x -= TermWin_internalBorder; if(thai_spcount) { thai_colinc1(0); while(cx<=x) { cx += TermWin.fwidth * thai_colinc1(start[col]); col++; } } else { while(cx<=x) { if(!movetab[start[col]]) cx += TermWin.fwidth; col++; } } while(movetab[start[col]] && col < TermWin.ncol) col++; return col-1; } xiterm+thai-1.10/src/main.c0000644000175000017500000012432311676761227014251 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: main.c * * Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as * you don't try to make money out of it and you include an * unaltered copy of this message (including the copyright). * * This module has been heavily modified by R. Nation * * No additional restrictions are applied * * Additional modifications by Garrett D'Amore * No additional restrictions are applied. * * Extensive modifications by mj olesen * No additional restrictions are applied. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ /*{{{ includes */ #include "main.h" #include #ifdef HAVE_UNISTD_H #include #endif #include #include #ifdef XPM_BACKGROUND #include #endif #include #include "command.h" #include "debug.h" #include "graphics.h" #include "scrollbar.h" #include "screen.h" #include "xdefaults.h" #include "defaults.h" /*}}} */ /*{{{ extern functions referenced */ #ifdef DISPLAY_IS_IP extern char *network_display (const char *display); #endif /*}}} */ /* extern variables referenced */ /*{{{ extern variables declared here */ TermWin_t TermWin; Display *Xdisplay; /* display */ const char *rs_color[NRS_COLORS]; Pixel PixColors[NRS_COLORS + NSHADOWCOLORS]; unsigned long Options = (Opt_scrollBar); const char *display_name = NULL; const char *rs_name = NULL; /* client instance (resource name) */ #ifndef NO_BOLDFONT const char *rs_boldFont = NULL; #endif const char *rs_font[NFONTS]; #ifdef KANJI const char *rs_kfont[NFONTS]; #endif #ifdef PRINTPIPE const char *rs_print_pipe = NULL; #endif const char *rs_cutchars = NULL; /*}}} */ /*{{{ local variables */ static Cursor TermWin_cursor; /* cursor for vt window */ static XSizeHints szHint = { PMinSize | PResizeInc | PBaseSize | PWinGravity, 0, 0, 80, 24, /* x, y, width, height */ 1, 1, /* Min width, height */ 0, 0, /* Max width, height - unused */ 1, 1, /* increments: width, height */ {1, 1}, /* increments: x, y */ {0, 0}, /* Aspect ratio - unused */ 0, 0, /* base size: width, height */ NorthWestGravity /* gravity */ }; static const char *def_colorName[] = { "White", "Black", /* fg/bg */ "Black", /* 0: black (#000000) */ #ifndef NO_BRIGHTCOLOR /* low-intensity colors */ "Red3", /* 1: red (#CD0000) */ "Green3", /* 2: green (#00CD00) */ "Yellow3", /* 3: yellow (#CDCD00) */ "Blue3", /* 4: blue (#0000CD) */ "Magenta3", /* 5: magenta (#CD00CD) */ "Cyan3", /* 6: cyan (#00CDCD) */ "AntiqueWhite", /* 7: white (#FAEBD7) */ /* high-intensity colors */ "Grey25", /* 8: bright black (#404040) */ #endif /* NO_BRIGHTCOLOR */ "Red", /* 1/9: bright red (#FF0000) */ "Green", /* 2/10: bright green (#00FF00) */ "Yellow", /* 3/11: bright yellow (#FFFF00) */ "Blue", /* 4/12: bright blue (#0000FF) */ "Magenta", /* 5/13: bright magenta (#FF00FF) */ "Cyan", /* 6/14: bright cyan (#00FFFF) */ "White", /* 7/15: bright white (#FFFFFF) */ #ifndef NO_CURSORCOLOR NULL, NULL, #endif /* NO_CURSORCOLOR */ #ifdef THAI NULL, /* cursorColorThai -Theppitak 1999-07-22 */ #endif #ifndef NO_BOLDUNDERLINE NULL, NULL, #endif /* NO_BOLDUNDERLINE */ "#B2B2B2" /* scrollColor: match Netscape color */ }; #ifdef KANJI /* Kanji font names, roman fonts sized to match */ static const char *def_kfontName[] = { KFONT0, KFONT1, KFONT2, KFONT3, KFONT4 }; #endif /* KANJI */ static const char *def_fontName[] = { FONT0, FONT1, FONT2, FONT3, FONT4 }; /*}}} */ /*{{{ local functions referenced */ #ifdef XPM_BACKGROUND static Pixmap set_bgPixmap (const char * /* file */ ); static struct { short w, h, x, y; Pixmap pixmap; } bgPixmap = { 100, 100, 50, 50, None }; /* the originally loaded pixmap and its scaling */ static XpmAttributes xpmAttr; #endif /* XPM_BACKGROUND */ static void resize (void); /*}}} */ /*----------------------------------------------------------------------*/ static XErrorHandler xerror_handler (Display * display, XErrorEvent * event) { exit (EXIT_FAILURE); return 0; } /*{{{ color aliases, fg/bg bright-bold */ static inline void color_aliases (int idx) { if (rs_color[idx] && isdigit (*rs_color[idx])) { int i = atoi (rs_color[idx]); if (i >= 8 && i <= 15) /* bright colors */ { i -= 8; #ifndef NO_BRIGHTCOLOR rs_color[idx] = rs_color[minBright + i]; return; #endif } if (i >= 0 && i <= 7) /* normal colors */ rs_color[idx] = rs_color[minColor + i]; } } /* * find if fg/bg matches any of the normal (low-intensity) colors */ #ifndef NO_BRIGHTCOLOR static inline void set_colorfgbg (void) { unsigned int i; static char colorfgbg_env[] = "COLORFGBG=default;default;bg"; char *p; int fg = -1, bg = -1; for (i = blackColor; i <= whiteColor; i++) { if (PixColors[fgColor] == PixColors[i]) { fg = (i - blackColor); break; } } for (i = blackColor; i <= whiteColor; i++) { if (PixColors[bgColor] == PixColors[i]) { bg = (i - blackColor); break; } } p = strchr (colorfgbg_env, '='); p++; if (fg >= 0) sprintf (p, "%d;", fg); else strcpy (p, "default;"); p = strchr (p, '\0'); if (bg >= 0) sprintf (p, #ifdef XPM_BACKGROUND "default;" #endif "%d", bg); else strcpy (p, "default"); putenv (colorfgbg_env); colorfgbg = DEFAULT_RSTYLE; for (i = minColor; i <= maxColor; i++) { if (PixColors[fgColor] == PixColors[i] #ifndef NO_BOLDUNDERLINE && PixColors[fgColor] == PixColors[colorBD] #endif /* NO_BOLDUNDERLINE */ /* if we wanted boldFont to have precedence */ #if 0 /* ifndef NO_BOLDFONT */ && TermWin.boldFont == NULL #endif /* NO_BOLDFONT */ ) colorfgbg = SET_FGCOLOR (colorfgbg, i); if (PixColors[bgColor] == PixColors[i]) colorfgbg = SET_BGCOLOR (colorfgbg, i); } } #else /* NO_BRIGHTCOLOR */ #define set_colorfgbg() ((void)0) #endif /* NO_BRIGHTCOLOR */ /*}}} */ #ifdef XPM_BACKGROUND /* * These GEOM strings indicate absolute size/position: * @ `WxH+X+Y' * @ `WxH+X' -> Y = X * @ `WxH' -> Y = X = 50 * @ `W+X+Y' -> H = W * @ `W+X' -> H = W, Y = X * @ `W' -> H = W, X = Y = 50 * @ `0xH' -> H *= H/100, X = Y = 50 (W unchanged) * @ `Wx0' -> W *= W/100, X = Y = 50 (H unchanged) * @ `=+X+Y' -> (H, W unchanged) * @ `=+X' -> Y = X (H, W unchanged) * * These GEOM strings adjust position relative to current position: * @ `+X+Y' * @ `+X' -> Y = X * * And this GEOM string is for querying current scale/position: * @ `?' */ static int scale_pixmap (const char *geom) { static char str[] = "[1000x1000+100+100]"; /* should be big enough */ int x = 0, y = 0; unsigned int w = 0, h = 0; int flags; int changed = 0; if (geom == NULL) return 0; if (!strcmp (geom, "?")) { sprintf (str, "[%dx%d+%d+%d]", bgPixmap.w, bgPixmap.h, bgPixmap.x, bgPixmap.y); xterm_seq (XTerm_title, str); return 0; } { char *p; int n; if ((p = strchr (geom, ';')) == NULL) p = strchr (geom, '\0'); n = (p - geom); if (n >= sizeof (str) - 1) return 0; strncpy (str, geom, n); str[n] = '\0'; } flags = XParseGeometry (str, &x, &y, &w, &h); if (!flags) { flags |= WidthValue; w = 100; } if (flags & WidthValue) { if (!(flags & XValue)) { x = 50; } if (!(flags & HeightValue)) h = w; if (w && !h) { w = bgPixmap.w * ((float) w / 100); h = bgPixmap.h; } else if (h && !w) { w = bgPixmap.w; h = bgPixmap.h * ((float) h / 100); } if (w > 1000) w = 1000; if (h > 1000) h = 1000; if (bgPixmap.w != w) { bgPixmap.w = w; changed++; } if (bgPixmap.h != h) { bgPixmap.h = h; changed++; } } if (!(flags & YValue)) { if (flags & XNegative) flags |= YNegative; y = x; } if (!(flags & WidthValue) && geom[0] != '=') { x += bgPixmap.x; y += bgPixmap.y; } else { if (flags & XNegative) x += 100; if (flags & YNegative) y += 100; } x = (x <= 0 ? 0 : (x >= 100 ? 100 : x)); y = (y <= 0 ? 0 : (y >= 100 ? 100 : y));; if (bgPixmap.x != x) { bgPixmap.x = x; changed++; } if (bgPixmap.y != y) { bgPixmap.y = y; changed++; } return changed; } static void resize_pixmap (void) { XGCValues gcvalue; GC gc; unsigned int width = TermWin_TotalWidth (); unsigned int height = TermWin_TotalHeight (); if (TermWin.pixmap) XFreePixmap (Xdisplay, TermWin.pixmap); TermWin.pixmap = XCreatePixmap (Xdisplay, TermWin.vt, width, height, Xdepth); gcvalue.foreground = PixColors[bgColor]; gc = XCreateGC (Xdisplay, TermWin.vt, GCForeground, &gcvalue); if (bgPixmap.pixmap) { int w = bgPixmap.w; int h = bgPixmap.h; int x = bgPixmap.x; int y = bgPixmap.y; /* * don't zoom pixmap too much nor expand really small pixmaps */ if (w > 1000 || h > 1000) w = 1; else if (width > (10 * xpmAttr.width) || height > (10 * xpmAttr.height)) w = 0; /* tile */ if (w) { float p, incr; Pixmap tmp; tmp = XCreatePixmap (Xdisplay, TermWin.vt, width, xpmAttr.height, Xdepth); XFillRectangle (Xdisplay, tmp, gc, 0, 0, width, xpmAttr.height); /* * horizontal scaling */ incr = (float) xpmAttr.width; p = 0; if (w == 1) { /* display image directly - no scaling at all */ incr = width; if (xpmAttr.width <= width) { w = xpmAttr.width; x = (width - w) / 2; w += x; } else { x = 0; w = width; } } else if (w < 10) { incr *= w; /* fit W images across screen */ x = 0; w = width; } else { incr *= 100.0 / w; if (w < 100) /* contract */ { w = (w * width) / 100; if (x >= 0) /* position */ { float pos; pos = (float) x / 100 * width - (w / 2); x = (width - w); if (pos <= 0) x = 0; else if (pos < x) x = pos; } else { x = (width - w) / 2; } w += x; } else if (w >= 100) /* expand */ { if (x > 0) /* position */ { float pos; pos = (float) x / 100 * xpmAttr.width - (incr / 2); p = xpmAttr.width - (incr); if (pos <= 0) p = 0; else if (pos < p) p = pos; } x = 0; w = width; } } incr /= width; for ( /*nil */ ; x < w; x++, p += incr) { if (p >= xpmAttr.width) p = 0; XCopyArea (Xdisplay, bgPixmap.pixmap, tmp, gc, (int) p, 0, 1, xpmAttr.height, x, 0); } /* * vertical scaling */ incr = (float) xpmAttr.height; p = 0; if (h == 1) { /* display image directly - no scaling at all */ incr = height; if (xpmAttr.height <= height) { h = xpmAttr.height; y = (height - h) / 2; h += y; } else { y = 0; h = height; } } else if (h < 10) { incr *= h; /* fit H images across screen */ y = 0; h = height; } else { incr *= 100.0 / h; if (h < 100) /* contract */ { h = (h * height) / 100; if (y >= 0) /* position */ { float pos; pos = (float) y / 100 * height - (h / 2); y = (height - h); if (pos < 0.0f) y = 0; else if (pos < y) y = pos; } else { y = (height - h) / 2; } h += y; } else if (h >= 100) /* expand */ { if (y > 0) /* position */ { float pos; pos = (float) y / 100 * xpmAttr.height - (incr / 2); p = xpmAttr.height - (incr); if (pos < 0) p = 0; else if (pos < p) p = pos; } y = 0; h = height; } } incr /= height; for ( /*nil */ ; y < h; y++, p += incr) { if (p >= xpmAttr.height) p = 0; XCopyArea (Xdisplay, tmp, TermWin.pixmap, gc, 0, (int) p, width, 1, 0, y); } XFreePixmap (Xdisplay, tmp); } else { /* tiled */ for (y = 0; y < height; y += xpmAttr.height) { unsigned int h = (height - y); if (h > xpmAttr.height) h = xpmAttr.height; for (x = 0; x < width; x += xpmAttr.width) { unsigned int w = (width - x); if (w > xpmAttr.width) w = xpmAttr.width; XCopyArea (Xdisplay, bgPixmap.pixmap, TermWin.pixmap, gc, 0, 0, w, h, x, y); } } } } else XFillRectangle (Xdisplay, TermWin.pixmap, gc, 0, 0, width, height); #ifdef XPM_BUFFERING if (TermWin.buf_pixmap) XFreePixmap (Xdisplay, TermWin.buf_pixmap); TermWin.buf_pixmap = XCreatePixmap (Xdisplay, TermWin.vt, width, height, Xdepth); XCopyArea (Xdisplay, TermWin.pixmap, TermWin.buf_pixmap, gc, 0, 0, width, height, 0, 0); XSetWindowBackgroundPixmap (Xdisplay, TermWin.vt, TermWin.buf_pixmap); #else /* XPM_BUFFERING */ XSetWindowBackgroundPixmap (Xdisplay, TermWin.vt, TermWin.pixmap); #endif /* XPM_BUFFERING */ XFreeGC (Xdisplay, gc); XClearWindow (Xdisplay, TermWin.vt); XFlush (Xdisplay); XSync (Xdisplay, 0); } #else /* XPM_BACKGROUND */ #define scale_pixmap(str) ((void)0) #define resize_pixmap() ((void)0) #endif /* XPM_BACKGROUND */ /*{{{ Create_Windows() - Open and map the window */ static void Create_Windows (int argc, char *argv[]) { Cursor cursor; XClassHint classHint; XWMHints wmHint; int i, x, y, flags; unsigned int width, height; /* * grab colors before netscape does */ for (i = 0; i < (Xdepth <= 2 ? 2 : NRS_COLORS); i++) { const char *const msg = "can't load color \"%s\""; XColor xcol; if (!rs_color[i]) continue; if (!XParseColor (Xdisplay, Xcmap, rs_color[i], &xcol) || !XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error (msg, rs_color[i]); rs_color[i] = def_colorName[i]; if (!rs_color[i]) continue; if (!XParseColor (Xdisplay, Xcmap, rs_color[i], &xcol) || !XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error (msg, rs_color[i]); switch (i) { case fgColor: case bgColor: /* fatal: need bg/fg color */ print_error ("aborting"); exit (EXIT_FAILURE); break; #ifndef NO_CURSORCOLOR case cursorColor: xcol.pixel = PixColors[bgColor]; break; case cursorColor2: xcol.pixel = PixColors[fgColor]; break; #ifdef THAI case cursorColorThai: xcol.pixel = PixColors[bgColor]; break; #endif #endif /* NO_CURSORCOLOR */ default: xcol.pixel = PixColors[bgColor]; /* None */ break; } } } PixColors[i] = xcol.pixel; } #ifndef NO_CURSORCOLOR if (Xdepth <= 2 || !rs_color[cursorColor]) PixColors[cursorColor] = PixColors[bgColor]; if (Xdepth <= 2 || !rs_color[cursorColor2]) PixColors[cursorColor2] = PixColors[fgColor]; #ifdef THAI if (Xdepth <= 2 || !rs_color[cursorColorThai]) PixColors[cursorColorThai] = PixColors[bgColor]; #endif #endif /* NO_CURSORCOLOR */ #ifndef NO_BOLDUNDERLINE if (Xdepth <= 2 || !rs_color[colorBD]) PixColors[colorBD] = PixColors[fgColor]; if (Xdepth <= 2 || !rs_color[colorUL]) PixColors[colorUL] = PixColors[fgColor]; #endif /* NO_BOLDUNDERLINE */ /* * get scrollBar shadow colors * * The calculations of topShadow/bottomShadow values are adapted * from the fvwm window manager. */ #ifndef XTERM_SCROLLBAR if (Xdepth <= 2) /* Monochrome */ { PixColors[scrollColor] = PixColors[bgColor]; PixColors[topShadowColor] = PixColors[fgColor]; PixColors[bottomShadowColor] = PixColors[fgColor]; } else { XColor xcol, white; /* bottomShadowColor */ xcol.pixel = PixColors[scrollColor]; XQueryColor (Xdisplay, Xcmap, &xcol); xcol.red = ((xcol.red) / 2); xcol.green = ((xcol.green) / 2); xcol.blue = ((xcol.blue) / 2); if (!XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error ("can't allocate %s", "bottomShadowColor"); xcol.pixel = PixColors[minColor]; } PixColors[bottomShadowColor] = xcol.pixel; /* scrollBGColor - Theppitak 1999-08-11 */ { XColor xscroll; xscroll.pixel = PixColors[scrollColor]; XQueryColor (Xdisplay, Xcmap, &xscroll); /* (scrollColor + bottomShadowColor) / 2 */ xcol.red = ((xcol.red + xscroll.red) / 2); xcol.green = ((xcol.green + xscroll.green) / 2); xcol.blue = ((xcol.blue + xscroll.blue) / 2); if (!XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error ("can't allocate %s", "scrollBGColor"); xcol.pixel = PixColors[minColor]; } PixColors[scrollBGColor] = xcol.pixel; } /* topShadowColor */ white.pixel = WhitePixel (Xdisplay, Xscreen); XQueryColor (Xdisplay, Xcmap, &white); xcol.pixel = PixColors[scrollColor]; XQueryColor (Xdisplay, Xcmap, &xcol); #ifndef min #define min(a,b) (((a)<(b)) ? (a) : (b)) #define max(a,b) (((a)>(b)) ? (a) : (b)) #endif xcol.red = max ((white.red / 5), xcol.red); xcol.green = max ((white.green / 5), xcol.green); xcol.blue = max ((white.blue / 5), xcol.blue); xcol.red = min (white.red, (xcol.red * 7) / 5); xcol.green = min (white.green, (xcol.green * 7) / 5); xcol.blue = min (white.blue, (xcol.blue * 7) / 5); if (!XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error ("can't allocate %s", "topShadowColor"); xcol.pixel = PixColors[whiteColor]; } PixColors[topShadowColor] = xcol.pixel; } #endif /* XTERM_SCROLLBAR */ szHint.base_width = (2 * TermWin_internalBorder + (Options & Opt_scrollBar ? SB_WIDTH : 0)); szHint.base_height = (2 * TermWin_internalBorder); flags = (rs_geometry ? XParseGeometry (rs_geometry, &x, &y, &width, &height) : 0); if (flags & WidthValue) { szHint.width = width; szHint.flags |= USSize; } if (flags & HeightValue) { szHint.height = height; szHint.flags |= USSize; } TermWin.ncol = szHint.width; TermWin.nrow = szHint.height; change_font (1, NULL); if (flags & XValue) { if (flags & XNegative) { x += (DisplayWidth (Xdisplay, Xscreen) - (szHint.width + TermWin_internalBorder)); szHint.win_gravity = NorthEastGravity; } szHint.x = x; szHint.flags |= USPosition; } if (flags & YValue) { if (flags & YNegative) { y += (DisplayHeight (Xdisplay, Xscreen) - (szHint.height + TermWin_internalBorder)); szHint.win_gravity = (szHint.win_gravity == NorthEastGravity ? SouthEastGravity : SouthWestGravity); } szHint.y = y; szHint.flags |= USPosition; } /* parent window - reverse video so we can see placement errors * sub-window placement & size in resize_subwindows() */ TermWin.parent = XCreateSimpleWindow (Xdisplay, Xroot, szHint.x, szHint.y, szHint.width, szHint.height, BORDERWIDTH, PixColors[bgColor], PixColors[fgColor]); xterm_seq (XTerm_title, (char*) rs_title); xterm_seq (XTerm_iconName, (char*) rs_iconName); /* ignore warning about discarded `const' */ classHint.res_name = (char*) rs_name; classHint.res_class = APL_CLASS; wmHint.input = True; wmHint.initial_state = (Options & Opt_iconic ? IconicState : NormalState); wmHint.flags = (InputHint | StateHint); XSetWMProperties (Xdisplay, TermWin.parent, NULL, NULL, argv, argc, &szHint, &wmHint, &classHint); XSelectInput (Xdisplay, TermWin.parent, (KeyPressMask | FocusChangeMask | StructureNotifyMask | VisibilityChangeMask) ); /* vt cursor: Black-on-White is standard, but this is more popular */ TermWin_cursor = XCreateFontCursor (Xdisplay, XC_xterm); { XColor fg, bg; fg.pixel = PixColors[fgColor]; XQueryColor (Xdisplay, Xcmap, &fg); bg.pixel = PixColors[bgColor]; XQueryColor (Xdisplay, Xcmap, &bg); XRecolorCursor (Xdisplay, TermWin_cursor, &fg, &bg); } /* cursor (scrollBar): Black-on-White */ cursor = XCreateFontCursor (Xdisplay, XC_left_ptr); /* the vt window */ TermWin.vt = XCreateSimpleWindow (Xdisplay, TermWin.parent, 0, 0, szHint.width, szHint.height, 0, PixColors[fgColor], PixColors[bgColor]); XDefineCursor (Xdisplay, TermWin.vt, TermWin_cursor); XSelectInput (Xdisplay, TermWin.vt, (ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button3MotionMask)); XMapWindow (Xdisplay, TermWin.vt); XMapWindow (Xdisplay, TermWin.parent); /* scrollBar: size doesn't matter */ scrollBar.win = XCreateSimpleWindow (Xdisplay, TermWin.parent, 0, 0, 1, 1, 0, PixColors[fgColor], PixColors[scrollBGColor]); /* PixColors[bottomShadowColor]); */ /* 1999-07-10 Theppitak Karoonboonyanan -> to use different scrollbar background color PixColors[bgColor]); */ XDefineCursor (Xdisplay, scrollBar.win, cursor); XSelectInput (Xdisplay, scrollBar.win, (ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask) ); #ifdef XPM_BACKGROUND if (rs_backgroundPixmap != NULL) { const char *p = rs_backgroundPixmap; if ((p = strchr (p, ';')) != NULL) { p++; scale_pixmap (p); } set_bgPixmap (rs_backgroundPixmap); } #endif /* XPM_BACKGROUND */ /* graphics context for the vt window */ { XGCValues gcvalue; gcvalue.font = TermWin.font->fid; gcvalue.foreground = PixColors[fgColor]; gcvalue.background = PixColors[bgColor]; TermWin.gc = XCreateGC (Xdisplay, TermWin.vt, GCForeground | GCBackground | GCFont, &gcvalue); } } /*}}} */ /*{{{ window resizing - assuming the parent window is the correct size */ static void resize_subwindows (int width, int height) { int x = 0, y = 0; int old_width = TermWin.width; #ifdef __GNUC__ /* It's unused due to empty Gr_Resize() implementation, but may not be the * case if Xtensions/ are used. */ int old_height __attribute__ ((unused)) = TermWin.height; #else int old_height = TermWin.height; #endif TermWin.width = TermWin.ncol * TermWin.fwidth; TermWin.height = TermWin.nrow * TermWin.fheight; /* size and placement */ if (scrollbar_visible ()) { scrollBar.beg = 0; scrollBar.end = height; #ifndef XTERM_SCROLLBAR /* arrows are as high as wide - leave 1 pixel gap */ scrollBar.beg += (SB_WIDTH + 1); scrollBar.end -= (SB_WIDTH + 1); #endif width -= SB_WIDTH; XMoveResizeWindow (Xdisplay, scrollBar.win, #ifdef SCROLLBAR_RIGHT width, 0, #else x, 0, #endif SB_WIDTH, height); #ifndef SCROLLBAR_RIGHT x = SB_WIDTH; /* placement of vt window */ #endif } XMoveResizeWindow (Xdisplay, TermWin.vt, x, y, width, height + 1); if (old_width) Gr_Resize (old_width, old_height); XClearWindow (Xdisplay, TermWin.vt); resize_pixmap (); XSync (Xdisplay, 0); } static void resize (void) { szHint.base_width = (2 * TermWin_internalBorder); szHint.base_height = (2 * TermWin_internalBorder); szHint.base_width += (scrollbar_visible ()? SB_WIDTH : 0); szHint.min_width = szHint.base_width + szHint.width_inc; szHint.min_height = szHint.base_height + szHint.height_inc; szHint.width = szHint.base_width + TermWin.width; szHint.height = szHint.base_height + TermWin.height; szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; XSetWMNormalHints (Xdisplay, TermWin.parent, &szHint); XResizeWindow (Xdisplay, TermWin.parent, szHint.width, szHint.height); resize_subwindows (szHint.width, szHint.height); } void map_scrollBar (int map) { if (scrollbar_mapping (map)) { scr_touch (); resize (); } } /* * Redraw window after exposure or size change */ static void resize_window1 (unsigned int width, unsigned int height) { static short first_time = 1; int new_ncol = (width - szHint.base_width) / TermWin.fwidth; int new_nrow = (height - szHint.base_height) / TermWin.fheight; if (first_time || (new_ncol != TermWin.ncol) || (new_nrow != TermWin.nrow)) { int curr_screen = -1; /* scr_reset only works on the primary screen */ if (!first_time) /* this is not the first time thru */ { selection_clear (); curr_screen = scr_change_screen (PRIMARY); } TermWin.ncol = new_ncol; TermWin.nrow = new_nrow; resize_subwindows (width, height); scr_reset (); if (curr_screen >= 0) /* this is not the first time thru */ scr_change_screen (curr_screen); first_time = 0; } } /* * good for toggling 80/132 columns */ void set_width (unsigned short width) { unsigned short height = TermWin.nrow; if (width != TermWin.ncol) { width = szHint.base_width + width * TermWin.fwidth; height = szHint.base_height + height * TermWin.fheight; XResizeWindow (Xdisplay, TermWin.parent, width, height); resize_window1 (width, height); } } /* * Redraw window after exposure or size change */ void resize_window (void) { Window root; XEvent dummy; int x, y; unsigned int border, depth, width, height; while (XCheckTypedWindowEvent (Xdisplay, TermWin.parent, ConfigureNotify, &dummy)); XGetGeometry (Xdisplay, TermWin.parent, &root, &x, &y, &width, &height, &border, &depth); /* parent already resized */ resize_window1 (width, height); } /*}}} */ /*{{{ xterm sequences - title, iconName, color (exptl) */ #ifdef SMART_WINDOW_TITLE static void set_title (const char *str) { char *name; if (XFetchName (Xdisplay, TermWin.parent, &name)) name = NULL; if (name == NULL || strcmp (name, str)) XStoreName (Xdisplay, TermWin.parent, str); if (name) XFree (name); } #else #define set_title(str) XStoreName (Xdisplay, TermWin.parent, str) #endif #ifdef SMART_WINDOW_TITLE static void set_iconName (const char *str) { char *name; if (XGetIconName (Xdisplay, TermWin.parent, &name)) name = NULL; if (name == NULL || strcmp (name, str)) XSetIconName (Xdisplay, TermWin.parent, str); if (name) XFree (name); } #else #define set_iconName(str) XSetIconName (Xdisplay, TermWin.parent, str) #endif #ifdef XTERM_COLOR_CHANGE static void set_window_color (int idx, const char *color) { const char *const msg = "can't load color \"%s\""; XColor xcol; int i; if (color == NULL || *color == '\0') return; /* handle color aliases */ if (isdigit (*color)) { i = atoi (color); if (i >= 8 && i <= 15) /* bright colors */ { i -= 8; #ifndef NO_BRIGHTCOLOR PixColors[idx] = PixColors[minBright + i]; goto Done; #endif } if (i >= 0 && i <= 7) /* normal colors */ { PixColors[idx] = PixColors[minColor + i]; goto Done; } } if (!XParseColor (Xdisplay, Xcmap, color, &xcol) || !XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error (msg, color); return; } /* XStoreColor (Xdisplay, Xcmap, XColor*); */ /* * FIXME: should free colors here, but no idea how to do it so instead, * so just keep gobbling up the colormap */ #if 0 for (i = blackColor; i <= whiteColor; i++) if (PixColors[idx] == PixColors[i]) break; if (i > whiteColor) { /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ XFreeColors (Xdisplay, Xcmap, (PixColors + idx), 1, DisplayPlanes (Xdisplay, Xscreen)); } #endif PixColors[idx] = xcol.pixel; /* XSetWindowAttributes attr; */ /* Cursor cursor; */ Done: if (idx == bgColor) XSetWindowBackground (Xdisplay, TermWin.vt, PixColors[bgColor]); /* handle colorBD, scrollbar background, etc. */ set_colorfgbg (); { XColor fg, bg; fg.pixel = PixColors[fgColor]; XQueryColor (Xdisplay, Xcmap, &fg); bg.pixel = PixColors[bgColor]; XQueryColor (Xdisplay, Xcmap, &bg); XRecolorCursor (Xdisplay, TermWin_cursor, &fg, &bg); } /* the only reasonable way to enforce a clean update */ scr_poweron (); } #else #define set_window_color(idx,color) ((void)0) #endif /* XTERM_COLOR_CHANGE */ #ifdef XPM_BACKGROUND /* * search for FILE in the current working directory, and within the * colon-delimited PATHLIST, adding the file extension EXT if required. * * FILE is either semi-colon or zero terminated */ static const char * search_path (const char *pathlist, const char *file, const char *ext) { static char name[256]; const char *p, *path; int maxpath, len; if (!access (file, R_OK)) return file; /* semi-colon delimited */ if ((p = strchr (file, ';')) == NULL) p = strchr (file, '\0'); len = (p - file); /* check about adding a trailing extension */ if (ext != NULL) { char *dot; dot = strrchr (p, '.'); path = strrchr (p, '/'); if (dot != NULL || (path != NULL && dot <= path)) ext = NULL; } /* leave room for an extra '/' and trailing '\0' */ maxpath = sizeof (name) - (len + (ext ? strlen (ext) : 0) + 2); if (maxpath <= 0) return NULL; for (path = pathlist; path != NULL && *path != '\0'; path = p) { int n; /* colon delimited */ if ((p = strchr (path, ':')) == NULL) p = strchr (path, '\0'); n = (p - path); if (*p != '\0') p++; if (n > 0 && n <= maxpath) { strncpy (name, path, n); if (name[n - 1] != '/') name[n++] = '/'; name[n] = '\0'; strncat (name, file, len); if (!access (name, R_OK)) return name; if (ext) { strcat (name, ext); if (!access (name, R_OK)) return name; } } } return NULL; } #endif /* XPM_BACKGROUND */ #ifdef XPM_BACKGROUND #define XPM_EXT ".xpm" Pixmap set_bgPixmap (const char *file) { const char *f; assert (file != NULL); if (bgPixmap.pixmap != None) { XFreePixmap (Xdisplay, bgPixmap.pixmap); bgPixmap.pixmap = None; } XSetWindowBackground (Xdisplay, TermWin.vt, PixColors[bgColor]); if (*file != '\0') { XWindowAttributes attr; XGetWindowAttributes (Xdisplay, Xroot, &attr); xpmAttr.closeness = 30000; xpmAttr.colormap = attr.colormap; xpmAttr.valuemask = (XpmCloseness | XpmColormap | XpmSize | XpmReturnPixels); /* search environment variables here too */ if ((f = search_path (rs_path, file, XPM_EXT)) == NULL) #ifdef PATH_ENV if ((f = search_path (getenv (PATH_ENV), file, XPM_EXT)) == NULL) #endif f = search_path (getenv ("PATH"), file, XPM_EXT); if (f == NULL || XpmReadFileToPixmap (Xdisplay, Xroot, (char *)f, &bgPixmap.pixmap, NULL, &xpmAttr)) { char *p; /* semi-colon delimited */ if ((p = strchr (file, ';')) == NULL) p = strchr (file, '\0'); print_error ("couldn't load XPM file \"%.*s\"", (p - file), file); resize_pixmap (); } else if (bgPixmap.pixmap != None) resize_pixmap (); } XClearWindow (Xdisplay, TermWin.vt); scr_touch (); XFlush (Xdisplay); return bgPixmap.pixmap; } #undef XPM_EXT #endif /* XPM_BACKGROUND */ /* * XTerm escape sequences: ESC ] Ps;Pt BEL * 0 = change iconName/title * 1 = change iconName * 2 = change title * 46 = change logfile (not implemented) * 50 = change font * * xiterm extensions: * 20 = bg pixmap * 39 = change default fg color * 49 = change default bg color */ void xterm_seq (int op, char *str) { int changed = 0; assert (str != NULL); switch (op) { case XTerm_name: set_title (str); /* drop */ case XTerm_iconName: set_iconName (str); break; case XTerm_title: #ifdef STATIC_TITLE #ifdef THAI set_title ("X Terminal International (THAI) " VERSION); #else set_title ("X Terminal International "); #endif #else set_title (str); #endif break; case XTerm_Pixmap: #ifdef XPM_BACKGROUND if (*str != ';') set_bgPixmap (str); while ((str = strchr (str, ';')) != NULL) { str++; changed += scale_pixmap (str); } if (changed) { resize_pixmap (); scr_touch (); } #endif /* XPM_BACKGROUND */ break; case XTerm_restoreFG: set_window_color (fgColor, str); break; case XTerm_restoreBG: set_window_color (bgColor, str); break; case XTerm_logfile: break; case XTerm_font: change_font (0, str); break; } } /*}}} */ /*{{{ change_font() - Switch to a new font */ /* * init = 1 - initialize * * fontname == FONT_UP - switch to bigger font * fontname == FONT_DN - switch to smaller font */ void change_font (int init, const char *fontname) { const char *const msg = "can't load font \"%s\""; XFontStruct *xfont; static char *newfont[NFONTS]; #ifndef NO_BOLDFONT static XFontStruct *boldFont = NULL; #endif static int fnum = FONT0_IDX; /* logical font number */ int idx = 0; /* index into rs_font[] */ #if (FONT0_IDX == 0) #define IDX2FNUM(i) (i) #define FNUM2IDX(f) (f) #else #define IDX2FNUM(i) (i == 0? FONT0_IDX : (i <= FONT0_IDX? (i-1) : i)) #define FNUM2IDX(f) (f == FONT0_IDX ? 0 : (f < FONT0_IDX ? (f+1) : f)) #endif #define FNUM_RANGE(i) (i <= 0 ? 0 : (i >= NFONTS ? (NFONTS-1) : i)) if (!init) { switch (fontname[0]) { case '\0': fnum = FONT0_IDX; fontname = NULL; break; /* special (internal) prefix for font commands */ case FONT_CMD: idx = atoi (fontname + 1); switch (fontname[1]) { case '+': /* corresponds to FONT_UP */ fnum += (idx ? idx : 1); fnum = FNUM_RANGE (fnum); break; case '-': /* corresponds to FONT_DN */ fnum += (idx ? idx : -1); fnum = FNUM_RANGE (fnum); break; default: if (fontname[1] != '\0' && !isdigit (fontname[1])) return; if (idx < 0 || idx >= (NFONTS)) return; fnum = IDX2FNUM (idx); break; } fontname = NULL; break; default: if (fontname != NULL) { /* search for existing fontname */ for (idx = 0; idx < NFONTS; idx++) { if (!strcmp (rs_font[idx], fontname)) { fnum = IDX2FNUM (idx); fontname = NULL; break; } } } else return; break; } /* re-position around the normal font */ idx = FNUM2IDX (fnum); if (fontname != NULL) { char *name; xfont = XLoadQueryFont (Xdisplay, fontname); if (!xfont) return; name = MALLOC (strlen (fontname + 1) * sizeof (char), "font"); if (name == NULL) { XFreeFont (Xdisplay, xfont); return; } strcpy (name, fontname); if (newfont[idx] != NULL) FREE (newfont[idx], "id", "fn"); newfont[idx] = name; rs_font[idx] = newfont[idx]; } } if (TermWin.font) XFreeFont (Xdisplay, TermWin.font); /* load font or substitute */ xfont = XLoadQueryFont (Xdisplay, rs_font[idx]); if (!xfont) { print_error (msg, rs_font[idx]); rs_font[idx] = "fixed"; xfont = XLoadQueryFont (Xdisplay, rs_font[idx]); if (!xfont) { print_error (msg, rs_font[idx]); goto Abort; } } TermWin.font = xfont; #ifndef NO_BOLDFONT /* fail silently */ if (init && rs_boldFont != NULL) boldFont = XLoadQueryFont (Xdisplay, rs_boldFont); #endif #ifdef KANJI if (TermWin.kanji) XFreeFont (Xdisplay, TermWin.kanji); /* load font or substitute */ xfont = XLoadQueryFont (Xdisplay, rs_kfont[idx]); if (!xfont) { print_error (msg, rs_kfont[idx]); rs_kfont[idx] = "k14"; xfont = XLoadQueryFont (Xdisplay, rs_kfont[idx]); if (!xfont) { print_error (msg, rs_kfont[idx]); goto Abort; } } TermWin.kanji = xfont; #endif /* KANJI */ /* alter existing GC */ if (!init) { XSetFont (Xdisplay, TermWin.gc, TermWin.font->fid); } /* set the sizes */ { int fw = XTextWidth (TermWin.font, "MMMMMMMMMM", 10) / 10; int fh = TermWin.font->ascent + TermWin.font->descent; /* not the first time thru and sizes haven't changed */ if (fw == TermWin.fwidth && fh == TermWin.fheight) return; TermWin.fwidth = fw; TermWin.fheight = fh; } /* check that size of boldFont is okay */ #ifndef NO_BOLDFONT if (boldFont != NULL && TermWin.fwidth == (XTextWidth (boldFont, "MMMMMMMMMM", 10) / 10) && TermWin.fheight == (boldFont->ascent + boldFont->descent)) TermWin.boldFont = boldFont; else TermWin.boldFont = NULL; #endif /* NO_BOLDFONT */ set_colorfgbg (); TermWin.width = TermWin.ncol * TermWin.fwidth; TermWin.height = TermWin.nrow * TermWin.fheight; szHint.width_inc = TermWin.fwidth; szHint.height_inc = TermWin.fheight; szHint.min_width = szHint.base_width + szHint.width_inc; szHint.min_height = szHint.base_height + szHint.height_inc; szHint.width = szHint.base_width + TermWin.width; szHint.height = szHint.base_height + TermWin.height; szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; if (!init) resize (); return; Abort: print_error ("aborting"); /* fatal problem */ exit (EXIT_FAILURE); #undef IDX2FNUM #undef FNUM2IDX #undef FNUM_RANGE } /*}}} */ /*{{{ main() */ int main (int argc, char *argv[]) { int i; char *val, **cmd_argv = NULL; /* "WINDOWID=\0" = 10 chars, UINT_MAX = 10 chars */ static char windowid_string[20], *display_string; for (i = 0; i < argc; i++) { if (!strcmp (argv[i], "-e")) { argc = i; argv[argc] = NULL; if (argv[argc + 1] != NULL) { cmd_argv = (argv + argc + 1); if (cmd_argv[0] != NULL) rs_iconName = rs_title = my_basename (cmd_argv[0]); } break; } } rs_name = my_basename (argv[0]); /* * Open display, get options/resources and create the window */ get_options (argc, argv); if (!display_name && (display_name = getenv ("DISPLAY")) == NULL) { print_error ("can't open display, DISPLAY is not set?\n"); exit (EXIT_FAILURE); } Xdisplay = XOpenDisplay (display_name); if (!Xdisplay) { print_error ("can't open display %s", display_name); exit (EXIT_FAILURE); } extract_resources (Xdisplay, rs_name); /* * set any defaults not already set */ if (!rs_title) rs_title = rs_name; if (!rs_iconName) rs_iconName = rs_name; if (!rs_saveLines || (TermWin.saveLines = atoi (rs_saveLines)) < 0) TermWin.saveLines = SAVELINES; /* no point having a scrollbar without having any scrollback! */ if (!TermWin.saveLines) Options &= ~Opt_scrollBar; #ifdef PRINTPIPE if (!rs_print_pipe) rs_print_pipe = PRINTPIPE; #endif if (!rs_cutchars) rs_cutchars = CUTCHARS; #ifndef NO_BOLDFONT if (rs_font[0] == NULL && rs_boldFont != NULL) { rs_font[0] = rs_boldFont; rs_boldFont = NULL; } #endif for (i = 0; i < NFONTS; i++) { if (!rs_font[i]) rs_font[i] = def_fontName[i]; #ifdef KANJI if (!rs_kfont[i]) rs_kfont[i] = def_kfontName[i]; #endif } #ifdef XTERM_REVERSE_VIDEO /* this is how xterm implements reverseVideo */ if (Options & Opt_reverseVideo) { if (!rs_color[fgColor]) rs_color[fgColor] = def_colorName[bgColor]; if (!rs_color[bgColor]) rs_color[bgColor] = def_colorName[fgColor]; } #endif for (i = 0; i < NRS_COLORS; i++) if (!rs_color[i]) rs_color[i] = def_colorName[i]; #ifndef XTERM_REVERSE_VIDEO /* this is how we implement reverseVideo */ if (Options & Opt_reverseVideo) { const char *name; /* swap foreground/background colors */ name = rs_color[fgColor]; rs_color[fgColor] = rs_color[bgColor]; rs_color[bgColor] = name; name = def_colorName[fgColor]; def_colorName[fgColor] = def_colorName[bgColor]; def_colorName[bgColor] = name; } #endif /* convenient aliases for setting fg/bg to colors */ color_aliases (fgColor); color_aliases (bgColor); #ifndef NO_CURSORCOLOR color_aliases (cursorColor); color_aliases (cursorColor2); #endif /* NO_CURSORCOLOR */ #ifndef NO_BOLDUNDERLINE color_aliases (colorBD); color_aliases (colorUL); #endif /* NO_BOLDUNDERLINE */ Create_Windows (argc, argv); scr_reset (); /* initialize screen */ Gr_reset (); /* reset graphics */ /* add scrollBar, do it directly to avoid resize() */ scrollbar_mapping (Options & Opt_scrollBar); #ifdef DEBUG_X XSynchronize (Xdisplay, True); XSetErrorHandler ((XErrorHandler) abort); #else XSetErrorHandler ((XErrorHandler) xerror_handler); #endif #ifdef DISPLAY_IS_IP /* Fixup display_name for export over pty to any interested terminal * clients via "ESC[7n" (e.g. shells). Note we use the pure IP number * (for the first non-loopback interface) that we get from * network_display(). This is more "name-resolution-portable", if you * will, and probably allows for faster x-client startup if your name * server is beyond a slow link or overloaded at client startup. Of * course that only helps the shell's child processes, not us. * * Giving out the display_name also affords a potential security hole */ val = display_name = network_display (display_name); if (val == NULL) #endif /* DISPLAY_IS_IP */ val = XDisplayString (Xdisplay); if (display_name == NULL) display_name = val; /* use broken `:0' value */ i = strlen (val); display_string = MALLOC ((i + 9) * sizeof (char), "display_string"); sprintf (display_string, "DISPLAY=%s", val); sprintf (windowid_string, "WINDOWID=%u", (unsigned int) TermWin.parent); /* add entries to the environment: * @ DISPLAY: in case we started with -display * @ WINDOWID: X window id number of the window * @ COLORTERM: terminal sub-name and also indicates its color * @ TERM: terminal name */ putenv (display_string); putenv (windowid_string); if (Xdepth <= 2) { putenv ("COLORTERM=" COLORTERMENV "-mono"); putenv ("TERM=" TERMENV); } else { #ifdef XPM_BACKGROUND putenv ("COLORTERM=" COLORTERMENV "-xpm"); #else putenv ("COLORTERM=" COLORTERMENV); #endif #ifdef DEFINE_XTERM_COLOR putenv ("TERM=" TERMENV "-color"); #else putenv ("TERM=" TERMENV); #endif } if (!setlocale(LC_CTYPE, "")) print_error("Cannot set locale"); init_command (cmd_argv); main_loop (); /* main processing loop */ return EXIT_SUCCESS; } /*}}} */ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/netdisp.c0000644000175000017500000000742111375434150014756 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: netdisp.c */ /*{{{ notes: */ /*----------------------------------------------------------------------* * support for resolving the actual IP number of the host for remote * DISPLAYs. When the display is local (i.e. :0), we add support for * sending the first non-loopback interface IP number as the DISPLAY * instead of just sending the incorrect ":0". This way telnet/rlogin * shells can actually get the correct information into DISPLAY for * xclients. * * Copyright 1996 Chuck Blake * * You can do what you like with this source code as long as you don't try * to make money out of it and you include an unaltered copy of this * message (including the copyright). * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ /*}}} */ #include "config.h" #include "feature.h" /* compile an empty file if this option is disabled. */ #ifndef DISPLAY_IS_IP /* char * network_display (const char * display) { return display; } */ #endif #ifdef DISPLAY_IS_IP /*{{{ includes */ #include #include #include #include #include #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_UNISTD_H #include #endif /* On Solaris link with -lsocket and -lnsl */ #include #include /* these next two are probably only on Sun (not Solaris) */ #ifdef HAVE_SYS_SOCKIO_H #include #endif #ifdef HAVE_SYS_BYTEORDER_H #include #endif #ifdef TIME_WITH_SYS_TIME #include #include #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif #ifdef HAVE_SYS_IOCTL_H #include #endif #include #include #include #include /*}}} */ /* extern functions referenced */ /* extern variables referenced */ /* extern variables declared here */ /* local variables */ /* local functions referenced */ /*----------------------------------------------------------------------*/ /* return a pointer to a static buffer */ char * network_display (const char *display) { static char ipaddress[32] = ""; char buffer[1024], *rval = NULL; struct ifconf ifc; struct ifreq *ifr; int i, skfd; if (display[0] != ':' && strncmp (display, "unix:", 5)) return display; /* nothing to do */ ifc.ifc_len = sizeof (buffer); /* Get names of all ifaces */ ifc.ifc_buf = buffer; if ((skfd = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { perror ("socket"); return NULL; } if (ioctl (skfd, SIOCGIFCONF, &ifc) < 0) { perror ("SIOCGIFCONF"); close (skfd); return NULL; } for (i = 0, ifr = ifc.ifc_req; i < (ifc.ifc_len / sizeof (struct ifreq)); i++, ifr++) { struct ifreq ifr2; strcpy (ifr2.ifr_name, ifr->ifr_name); if (ioctl (skfd, SIOCGIFADDR, &ifr2) >= 0) { unsigned long addr; struct sockaddr_in *p_addr; p_addr = (struct sockaddr_in *) &(ifr2.ifr_addr); addr = htonl ((unsigned long) p_addr->sin_addr.s_addr); /* * not "0.0.0.0" or "127.0.0.1" - so format the address */ if (addr && addr != 0x7F000001) { char *colon = strchr (display, ':'); if (colon == NULL) colon = ":0.0"; sprintf (ipaddress, "%d.%d.%d.%d%s", (int) ((addr >> 030) & 0xFF), (int) ((addr >> 020) & 0xFF), (int) ((addr >> 010) & 0xFF), (int) (addr & 0xFF), colon); rval = ipaddress; break; } } } close (skfd); return rval; } #endif /* DISPLAY_IS_IP */ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/screen.h0000644000175000017500000001345611375434150014601 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: screen.h * * This module is all new by Robert Nation * * * Additional modifications by mj olesen * No additional restrictions are applied. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ #ifndef _SCREEN_H #define _SCREEN_H /*{{{ includes */ #include #include "main.h" /*}}} */ /*{{{ defines */ /* Screen refresh methods */ #define NO_REFRESH 2 /* Window not visible at all! */ #define SLOW_REFRESH 1 /* No Bitblt */ #define FAST_REFRESH 0 #define IGNORE 0 #define SAVE 's' #define RESTORE 'r' /* flags for scr_gotorc() */ #define C_RELATIVE 1 /* col movement is relative */ #define R_RELATIVE 2 /* row movement is relative */ #define RELATIVE (R_RELATIVE|C_RELATIVE) /* move row/col relative */ /* modes for scr_insdel_chars(), scr_insdel_lines() */ #define INSERT -1 /* don't change these values */ #define DELETE +1 #define ERASE +2 /* modes for scr_page() */ #define UP +1 /* don't change these values */ #define DN -1 /* arguments for scr_change_screen() */ #define PRIMARY 0 #define SECONDARY 1 /* rendition style flags */ #define RS_None 0 /* Normal */ #define RS_Cursor 0x01000000u /* cursor location */ #define RS_Select 0x02000000u /* selected text */ #define RS_RVid 0x04000000u /* reverse video */ #define RS_Uline 0x08000000u /* underline */ #define RS_acsFont 0x10000000u /* ACS - graphics character set */ #define RS_ukFont 0x20000000u /* UK character set */ #define RS_fontMask (RS_acsFont|RS_ukFont) #ifdef KANJI #define RS_kanji0 0x40000000u /* only kanji */ #define RS_kanji1 0x80000000u /* kanji 1st byte */ #define RS_kanjiMask (RS_kanji0|RS_kanji1) /* kanji 2nd byte */ #endif #define RS_fgMask 0x00001F00u /* 32 colors */ #define RS_Bold 0x00008000u /* bold */ #define RS_bgMask 0x001F0000u /* 32 colors */ #define RS_Blink 0x00800000u /* blink */ #define RS_attrMask (0xFF000000u|RS_Bold|RS_Blink) /*}}} */ /*{{{ macros */ /* how to build & extract colors and attributes */ #define GET_FGCOLOR(r) (((r) & RS_fgMask)>>8) #define GET_BGCOLOR(r) (((r) & RS_bgMask)>>16) #define GET_ATTR(r) (((r) & RS_attrMask)) #define SET_FGCOLOR(r,fg) (((r) & ~RS_fgMask) | ((fg)<<8)) #define SET_BGCOLOR(r,bg) (((r) & ~RS_bgMask) | ((bg)<<16)) #define SET_ATTR(r,a) (((r) & ~RS_attrMask)| (a)) #define DEFAULT_RSTYLE (RS_None | (fgColor<<8) | (bgColor<<16)) /*}}} */ /*{{{ extern variables */ #ifndef NO_BRIGHTCOLOR extern unsigned int colorfgbg; #endif /*}}} */ /*{{{ prototypes: */ _XFUNCPROTOBEGIN extern void scr_reset (void); extern void scr_poweron (void); extern void scr_backspace (void); extern void scr_bell (void); extern void scr_rendition (int /* set */ , int /* style */ ); extern void scr_add_lines (const unsigned char * /* str */ , int /* nlines */ , int /* cnt */ ); extern void scr_tab (int /* count */ ); extern void scr_gotorc (int /* row */ , int /* col */ , int /* relative */ ); extern void scr_index (int /* direction */ ); extern void scr_cursor (int /* mode */ ); extern void scr_cursor_visible (int /* mode */ ); extern void scr_erase_line (int /* mode */ ); extern void scr_erase_screen (int /* mode */ ); extern void scr_insdel_lines (int /* count */ , int /* insdel */ ); extern void scr_insdel_chars (int /* count */ , int /* insdel */ ); extern void scr_scroll_region (int /* top */ , int /* bot */ ); extern void scr_report_position (void); /* 2001-02-21 Thep : add functions for screen buffer accessing */ extern void scr_get_position (int * /* prow */, int * /* pcol */); extern unsigned char scr_get_char_rc (int /* row */, int /* col */); /* 2001-02-21 Thep : end of scrren buffer accessing functions */ extern void scr_expose (int /* x */ , int /* y */ , int /* width */ , int /* height */ ); extern void scr_touch (void); extern void scr_charset_choose (int /* set */ ); extern void scr_charset_set (int /* set */ , unsigned int /* ch */ ); extern void scr_refresh (int /* type */ ); extern void scr_set_tab (int /* mode */ ); extern void scr_E (void); extern void scr_color (unsigned int /* color */ , unsigned int /* Intensity */ ); extern int scr_move_to (int /* y */ , int /* len */ ); extern int scr_page (int /* dirn */ , int /* n */ ); extern int scr_change_screen (int /* scrn */ ); extern int scr_get_fgcolor (void); extern int scr_get_bgcolor (void); extern void mouse_report (XButtonEvent * /* ev */ ); /* mode selections */ extern void scr_autowrap (int /* mode */ ); extern void scr_relative_origin (int /* mode */ ); extern void scr_insert_mode (int /* mode */ ); extern void scr_rvideo_mode (int /* mode */ ); #ifdef PRINTPIPE extern void scr_printscreen (int /* fullhist */ ); #endif extern void selection_make (Time /* tm */ ); extern void selection_send (XSelectionRequestEvent * /* rq */ ); extern void selection_paste (Window /* win */ , unsigned /* prop */ , int /* Delete */ ); extern void selection_request (Time /* tm */ , int /* x */ , int /* y */ ); extern void selection_reset (void); extern void selection_clear (void); extern void selection_extend (int /* x */ , int /* y */ ); extern void selection_start (int /* x */ , int /* y */ ); extern void selection_click (int /* clicks */ , int /* x */ , int /* y */ ); #ifdef KANJI extern void set_kanji_encoding (const char * /* str */ ); #endif _XFUNCPROTOEND /*}}} */ #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/debug.c0000644000175000017500000001374311375434150014402 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: debug.c * * This module is all original work by Robert Nation * * * Copyright 1994, Robert Nation, no rights reserved. * The author guarantees absolutely nothing about anything, anywhere, anytime * Use this code at your own risk for anything at all. * * Additional modifications by mj olesen * No additional restrictions. * * Modifications by Raul Garcia Garcia *----------------------------------------------------------------------*/ #include "config.h" #include "feature.h" #include #include #include "debug.h" #ifndef DEBUG_MALLOC /* * malloc and check for NULL return */ void * my_malloc (size_t size) { void *ptr; if ((ptr = malloc (size)) == NULL) { printf ("malloc error: size 0x%X\n", (int) size); abort (); } return ptr; } /* * calloc and check for NULL return */ void * my_calloc (size_t count, size_t size) { void *ptr; if ((ptr = calloc (count, size)) == NULL) { printf ("calloc error: count * size 0x%X\n", (int) (count * size)); abort (); } return ptr; } /* * realloc and check for NULL return */ void * my_realloc (void *mem, size_t size) { void *ptr; /* * do this since some implementations (Sun for one) gags on realloc with * a NULL pointer */ if ((ptr = (mem ? realloc (mem, size) : malloc (size))) == NULL) { printf ("realloc error: size 0x%X\n", (int) size); abort (); } return ptr; } void my_free (void *mem) { if (mem != NULL) /* in case free() is non-compilant */ free (mem); } #else /* DEBUG_MALLOC */ #define MAX_MALLOCS 32 /* Number of pad characters to use when checking for out-of-bounds */ #define NPAD 4 #define PADCHAR1 0x3E #define PADCHAR2 0x3F static short num_alloc = 0; static struct { void *base; const char *name; } Pointer[MAX_MALLOCS]; /* * realloc that checks for NULL return, and adds out-of-bounds checking if * DEBUG_MALLOC is set */ void * safe_malloc (size_t size, const char *id) { void *ptr; #ifdef DEBUG_MALLOC char *tmp; int i; if ((ptr = malloc (size + 2 * NPAD * sizeof (int))) == NULL) { abort (); } tmp = ptr; for (i = 0; i < NPAD * sizeof (int); i++) tmp[i] = PADCHAR1; tmp += size + NPAD * sizeof (int); for (i = 0; i < NPAD * sizeof (int); i++) tmp[i] = PADCHAR2; *((int *) ptr + NPAD - 1) = size; /* save the size */ fprintf (stderr, "malloc: 0x%08X [%u bytes]: \"%s\"\n", (unsigned int) ptr, (unsigned int) size, id); for (i = 0; i < MAX_MALLOCS; i++) { if (Pointer[i].base == NULL) { num_alloc++; Pointer[i].base = ptr; Pointer[i].name = id; safe_mem_check ("malloc", id); break; } } if (i >= MAX_MALLOCS) fprintf (stderr, "MAX_MALLOCS (%d) exceeded\n", MAX_MALLOCS); return ((void *) ((int *) ptr + NPAD)); #else /* * do this since some implementations (Sun for one) gags on realloc with * a NULL pointer */ if ((ptr = malloc (size)) == NULL) { printf ("malloc error: [%u bytes]\n", (unsigned int) size); abort (); } return ptr; #endif } /* * Calloc that checks for NULL return, and adds out-of-bounds * checking if DEBUG_MALLOC is set. */ void * safe_calloc (size_t count, size_t size, const char *id) { void *ptr; ptr = safe_malloc (count * size, id); memset (ptr, 0, size); return ptr; } /* * Realloc that checks for NULL return, and adds out-of-bounds * checking if DEBUG_MALLOC is set. */ void * safe_realloc (void *mem, size_t size, const char *id) { void *ptr; ptr = safe_malloc (size, id); if (mem != NULL) { int oldsz = *((int *) mem - 1); if (oldsz > size) oldsz = size; memcpy (ptr, mem, oldsz); safe_free (mem, "realloc", id); } return ptr; } /* * Free command good for use with above malloc, checks for out-of-bounds * before freeing. */ void safe_free (void *ptr, const char *id1, const char *id2) { if (ptr != NULL) { #ifdef DEBUG_MALLOC /* Check each memory region */ unsigned int i; ptr = (void *) ((int *) ptr - NPAD); i = *((unsigned int *) ptr + NPAD - 1); fprintf (stderr, "free: 0x%08X [%u bytes]", (unsigned int) ptr, i); for (i = 0; i < MAX_MALLOCS; i++) { if (Pointer[i].base == ptr) { fprintf (stderr, ": \"%s\"\n", Pointer[i].name); safe_mem_check (id1, id2); Pointer[i].base = NULL; num_alloc--; break; } } #endif free (ptr); } } /* * Check all allocated memory for out-of-bounds memory usage */ void safe_mem_check (const char *id1, const char *id2) { #ifdef DEBUG_MALLOC int i, fail = 0; static const char *prev_id1 = NULL, *prev_id2 = NULL; char *msg_fmt = "Ouch%d: at 0x%08X (size %d) [idx %d]: \"%s\" (%s/%s)\n"; char *last_chk = "Last successful check (%s/%s)\n"; if (num_alloc <= 0) return; for (i = 0; i < MAX_MALLOCS; i++) { /* Check each memory region */ char *ptr = Pointer[i].base; int j, size; if (ptr == NULL) continue; size = *((int *) ptr + NPAD - 1); for (j = 0; j < ((NPAD - 1) * sizeof (int)); j++) { if (ptr[j] == PADCHAR1) continue; fail = 1; fprintf (stderr, msg_fmt, fail, (unsigned int) Pointer[i].base, size, j, Pointer[i].name, id1, id2); if (prev_id1 != NULL) fprintf (stderr, last_chk, prev_id1, prev_id2); } ptr += size + NPAD * sizeof (int); for (j = 0; j < NPAD * sizeof (int); j++) { if (ptr[j] == PADCHAR2) continue; fail = 2; fprintf (stderr, msg_fmt, fail, (unsigned int) Pointer[i].base, size, j, Pointer[i].name, id1, id2); if (prev_id1 != NULL) fprintf (stderr, last_chk, prev_id1, prev_id2); } } if (!fail) { prev_id1 = id1; prev_id2 = id2; } #endif } #endif /* DEBUG_MALLOC */ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/graphics.h0000644000175000017500000000260011375434150015107 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: graphics.h * * function declarations for graphics.c, not to do nice drawings but * reset, clear screen ... *----------------------------------------------------------------------*/ #ifndef _GRAPHICS_H #define _GRAPHICS_H #include /* * number of graphics points * divisible by 2 (num lines) * divisible by 4 (num rect) */ #define NGRX_PTS 1000 _XFUNCPROTOBEGIN extern void Gr_ButtonReport (int /* but */ , int /* x */ , int /* y */ ); extern void Gr_do_graphics (int /* cmd */ , int /* nargs */ , int /* args */ [], unsigned char * /* text */ ); extern void Gr_scroll (int /* count */ ); extern void Gr_ClearScreen (void); extern void Gr_ChangeScreen (void); extern void Gr_expose (Window /* win */ ); extern void Gr_Resize (int /* w */ , int /* h */ ); extern void Gr_reset (void); extern int Gr_Displayed (void); _XFUNCPROTOEND #define Gr_ButtonPress(x,y) ((void)0) #define Gr_ButtonRelease(x,y) ((void)0) #define Gr_scroll(count) ((void)0) #define Gr_ClearScreen() ((void)0) #define Gr_ChangeScreen() ((void)0) #define Gr_expose(win) ((void)0) #define Gr_Resize(w,h) ((void)0) #define Gr_reset() ((void)0) #define Gr_Displayed() (0) /* return zero */ #endif /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/xdefaults.h0000644000175000017500000000230511375434150015310 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: xdefaults.h *----------------------------------------------------------------------*/ #ifndef _XDEFAULTS_H #define _XDEFAULTS_H /*{{{ includes */ #include #include #include "feature.h" /*}}} */ /*{{{ extern variables */ extern const char *rs_title; /* title name for window */ extern const char *rs_iconName; /* icon name for window */ extern const char *rs_geometry; /* window geometry */ extern const char *rs_saveLines; /* scrollback buffer [lines] */ #ifdef KEYSYM_RESOURCE extern const unsigned char *KeySym_map[256]; #endif #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) extern KeySym ks_bigfont; extern KeySym ks_smallfont; #endif #ifdef XPM_BACKGROUND extern const char *rs_path; extern const char *rs_backgroundPixmap; #endif /* XPM_BACKGROUND */ /*}}} */ /*{{{ prototypes */ _XFUNCPROTOBEGIN extern void extract_resources (Display * /* display */ , const char * /* name */ ); extern void get_options (int /* argc */ , char * /* argv */ []); _XFUNCPROTOEND /*}}} */ #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/thaikb.c0000644000175000017500000000505411375434150014552 0ustar thepthep/* * thaikb.c - Thai keyboard maps * Created: 22 Jul 1999 (split from command.c) * Author: Theppitak Karoonboonyanan */ #include "thaikb.h" /* TIS 820-2538 Keyboard Layout */ static const char tis_qwerty_map[] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x008, 0x009, 0x00A, 0x00B, 0x00C, 0x00D, 0x00E, 0x00F, 0x010, 0x011, 0x012, 0x013, 0x014, 0x015, 0x016, 0x017, 0x018, 0x019, 0x01A, 0x01B, 0x01C, 0x01D, 0x01E, 0x01F, 0x020, 0x0E5, 0x02E, 0x0F2, 0x0F3, 0x0F4, 0x0EE, 0x0A7, 0x0F6, 0x0F7, 0x0F5, 0x0F9, 0x0C1, 0x0A2, 0x0E3, 0x0BD, 0x0A8, 0x0DF, 0x02F, 0x02D, 0x0C0, 0x0B6, 0x0D8, 0x0D6, 0x0A4, 0x0B5, 0x0AB, 0x0C7, 0x0B2, 0x0AA, 0x0CC, 0x0C6, 0x0F1, 0x0C4, 0x0DA, 0x0A9, 0x0AF, 0x0AE, 0x0E2, 0x0AC, 0x0E7, 0x0B3, 0x0EB, 0x0C9, 0x0C8, 0x03F, 0x0EC, 0x0CF, 0x0AD, 0x0F0, 0x0B1, 0x0A6, 0x0B8, 0x0EA, 0x0CE, 0x022, 0x029, 0x0ED, 0x028, 0x0BA, 0x0A3, 0x0C5, 0x0D9, 0x0F8, 0x0EF, 0x0BF, 0x0D4, 0x0E1, 0x0A1, 0x0D3, 0x0B4, 0x0E0, 0x0E9, 0x0C3, 0x0E8, 0x0D2, 0x0CA, 0x0B7, 0x0D7, 0x0B9, 0x0C2, 0x0E6, 0x0BE, 0x0CB, 0x0D0, 0x0D5, 0x0CD, 0x0E4, 0x0BB, 0x0D1, 0x0BC, 0x0B0, 0x0A5, 0x02C, 0x0FB, 0x07F }; /* Ketmanee Layout (default) */ static const char ketmanee_qwerty_map[] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x008, 0x009, 0x00A, 0x00B, 0x00C, 0x00D, 0x00E, 0x00F, 0x010, 0x011, 0x012, 0x013, 0x014, 0x015, 0x016, 0x017, 0x018, 0x019, 0x01A, 0x01B, 0x01C, 0x01D, 0x01E, 0x01F, 0x020, 0x02B, 0x02E, 0x0F2, 0x0F3, 0x0F4, 0x0DF, 0x0A7, 0x0F6, 0x0F7, 0x0F5, 0x0F9, 0x0C1, 0x0A2, 0x0E3, 0x0BD, 0x0A8, 0x0E5, 0x02F, 0x02D, 0x0C0, 0x0B6, 0x0D8, 0x0D6, 0x0A4, 0x0B5, 0x0AB, 0x0C7, 0x0B2, 0x0AA, 0x0CC, 0x0C6, 0x0F1, 0x0C4, 0x0DA, 0x0A9, 0x0AF, 0x0AE, 0x0E2, 0x0AC, 0x0E7, 0x0B3, 0x0EB, 0x0C9, 0x0C8, 0x03F, 0x0EC, 0x0CF, 0x0AD, 0x0F0, 0x0B1, 0x0A6, 0x0B8, 0x0EA, 0x0CE, 0x022, 0x029, 0x0ED, 0x028, 0x0BA, 0x0A3, 0x0C5, 0x0D9, 0x0F8, 0x05F, 0x0BF, 0x0D4, 0x0E1, 0x0A1, 0x0D3, 0x0B4, 0x0E0, 0x0E9, 0x0C3, 0x0E8, 0x0D2, 0x0CA, 0x0B7, 0x0D7, 0x0B9, 0x0C2, 0x0E6, 0x0BE, 0x0CB, 0x0D0, 0x0D5, 0x0CD, 0x0E4, 0x0BB, 0x0D1, 0x0BC, 0x0B0, 0x0A5, 0x02C, 0x025, 0x07F }; static const char *thai_qwerty_map = ketmanee_qwerty_map; void thai_set_keyboard(int thai_kbmode) { switch (thai_kbmode) { case THAI_KB_TIS820_2538: thai_qwerty_map = tis_qwerty_map; break; case THAI_KB_KETMANEE: default: thai_qwerty_map = ketmanee_qwerty_map; break; } } char thai_map_qwerty(unsigned char c) { return thai_qwerty_map[c]; } xiterm+thai-1.10/src/Xtensions/0000755000175000017500000000000011375434150015132 5ustar thepthepxiterm+thai-1.10/src/Xtensions/menubar+graphics/0000755000175000017500000000000011375434150020357 5ustar thepthepxiterm+thai-1.10/src/Xtensions/menubar+graphics/main.c0000644000175000017500000012301711375434150021453 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: main.c * * Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as * you don't try to make money out of it and you include an * unaltered copy of this message (including the copyright). * * This module has been heavily modified by R. Nation * * No additional restrictions are applied * * Additional modifications by Garrett D'Amore * No additional restrictions are applied. * * Extensive modifications by mj olesen * No additional restrictions are applied. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ /*{{{ includes */ #include "main.h" #ifdef HAVE_UNISTD_H #include #endif #include #include #ifdef XPM_BACKGROUND #include #endif #include "command.h" #include "debug.h" #include "graphics.h" #include "scrollbar.h" #include "menubar.h" #include "screen.h" #include "xdefaults.h" #include "defaults.h" /*}}} */ /*{{{ extern functions referenced */ #ifdef DISPLAY_IS_IP extern char *network_display (const char *display); #endif /*}}} */ /* extern variables referenced */ /*{{{ extern variables declared here */ TermWin_t TermWin; Display *Xdisplay; /* display */ const char *rs_color[NRS_COLORS]; Pixel PixColors[NRS_COLORS + NSHADOWCOLORS]; unsigned long Options = (Opt_scrollBar); const char *display_name = NULL; const char *rs_name = NULL; /* client instance (resource name) */ #ifndef NO_BOLDFONT const char *rs_boldFont = NULL; #endif const char *rs_font[NFONTS]; #ifdef KANJI const char *rs_kfont[NFONTS]; #endif #ifdef PRINTPIPE const char *rs_print_pipe = NULL; #endif const char *rs_cutchars = NULL; /*}}} */ /*{{{ local variables */ static Cursor TermWin_cursor; /* cursor for vt window */ static XSizeHints szHint = { PMinSize | PResizeInc | PBaseSize | PWinGravity, 0, 0, 80, 24, /* x, y, width, height */ 1, 1, /* Min width, height */ 0, 0, /* Max width, height - unused */ 1, 1, /* increments: width, height */ {1, 1}, /* increments: x, y */ {0, 0}, /* Aspect ratio - unused */ 0, 0, /* base size: width, height */ NorthWestGravity /* gravity */ }; static const char *def_colorName[] = { "Black", "White", /* fg/bg */ "Black", /* 0: black (#000000) */ #ifndef NO_BRIGHTCOLOR /* low-intensity colors */ "Red3", /* 1: red (#CD0000) */ "Green3", /* 2: green (#00CD00) */ "Yellow3", /* 3: yellow (#CDCD00) */ "Blue3", /* 4: blue (#0000CD) */ "Magenta3", /* 5: magenta (#CD00CD) */ "Cyan3", /* 6: cyan (#00CDCD) */ "AntiqueWhite", /* 7: white (#FAEBD7) */ /* high-intensity colors */ "Grey25", /* 8: bright black (#404040) */ #endif /* NO_BRIGHTCOLOR */ "Red", /* 1/9: bright red (#FF0000) */ "Green", /* 2/10: bright green (#00FF00) */ "Yellow", /* 3/11: bright yellow (#FFFF00) */ "Blue", /* 4/12: bright blue (#0000FF) */ "Magenta", /* 5/13: bright magenta (#FF00FF) */ "Cyan", /* 6/14: bright cyan (#00FFFF) */ "White", /* 7/15: bright white (#FFFFFF) */ #ifndef NO_CURSORCOLOR NULL, NULL, #endif /* NO_CURSORCOLOR */ #ifndef NO_BOLDUNDERLINE NULL, NULL, #endif /* NO_BOLDUNDERLINE */ "#B2B2B2" /* scrollColor: match Netscape color */ }; #ifdef KANJI /* Kanji font names, roman fonts sized to match */ static const char *def_kfontName[] = { KFONT0, KFONT1, KFONT2, KFONT3, KFONT4 }; #endif /* KANJI */ static const char *def_fontName[] = { FONT0, FONT1, FONT2, FONT3, FONT4 }; /*}}} */ /*{{{ local functions referenced */ #ifdef XPM_BACKGROUND static Pixmap set_bgPixmap (const char * /* file */ ); static struct { short w, h, x, y; Pixmap pixmap; } bgPixmap = { 100, 100, 50, 50, None }; /* the originally loaded pixmap and its scaling */ static XpmAttributes xpmAttr; #endif /* XPM_BACKGROUND */ static void resize (void); /*}}} */ /*----------------------------------------------------------------------*/ static XErrorHandler xerror_handler (Display * display, XErrorEvent * event) { exit (EXIT_FAILURE); return 0; } /*{{{ color aliases, fg/bg bright-bold */ static inline void color_aliases (int idx) { if (rs_color[idx] && isdigit (*rs_color[idx])) { int i = atoi (rs_color[idx]); if (i >= 8 && i <= 15) /* bright colors */ { i -= 8; #ifndef NO_BRIGHTCOLOR rs_color[idx] = rs_color[minBright + i]; return; #endif } if (i >= 0 && i <= 7) /* normal colors */ rs_color[idx] = rs_color[minColor + i]; } } /* * find if fg/bg matches any of the normal (low-intensity) colors */ #ifndef NO_BRIGHTCOLOR static inline void set_colorfgbg (void) { unsigned int i; static char colorfgbg_env[] = "COLORFGBG=default;default;bg"; char *p; int fg = -1, bg = -1; for (i = blackColor; i <= whiteColor; i++) { if (PixColors[fgColor] == PixColors[i]) { fg = (i - blackColor); break; } } for (i = blackColor; i <= whiteColor; i++) { if (PixColors[bgColor] == PixColors[i]) { bg = (i - blackColor); break; } } p = strchr (colorfgbg_env, '='); p++; if (fg >= 0) sprintf (p, "%d;", fg); else strcpy (p, "default;"); p = strchr (p, '\0'); if (bg >= 0) sprintf (p, #ifdef XPM_BACKGROUND "default;" #endif "%d", bg); else strcpy (p, "default"); putenv (colorfgbg_env); colorfgbg = DEFAULT_RSTYLE; for (i = minColor; i <= maxColor; i++) { if (PixColors[fgColor] == PixColors[i] #ifndef NO_BOLDUNDERLINE && PixColors[fgColor] == PixColors[colorBD] #endif /* NO_BOLDUNDERLINE */ /* if we wanted boldFont to have precedence */ #if 0 /* ifndef NO_BOLDFONT */ && TermWin.boldFont == NULL #endif /* NO_BOLDFONT */ ) colorfgbg = SET_FGCOLOR (colorfgbg, i); if (PixColors[bgColor] == PixColors[i]) colorfgbg = SET_BGCOLOR (colorfgbg, i); } } #else /* NO_BRIGHTCOLOR */ #define set_colorfgbg() ((void)0) #endif /* NO_BRIGHTCOLOR */ /*}}} */ #ifdef XPM_BACKGROUND /* * These GEOM strings indicate absolute size/position: * @ `WxH+X+Y' * @ `WxH+X' -> Y = X * @ `WxH' -> Y = X = 50 * @ `W+X+Y' -> H = W * @ `W+X' -> H = W, Y = X * @ `W' -> H = W, X = Y = 50 * @ `0xH' -> H *= H/100, X = Y = 50 (W unchanged) * @ `Wx0' -> W *= W/100, X = Y = 50 (H unchanged) * @ `=+X+Y' -> (H, W unchanged) * @ `=+X' -> Y = X (H, W unchanged) * * These GEOM strings adjust position relative to current position: * @ `+X+Y' * @ `+X' -> Y = X * * And this GEOM string is for querying current scale/position: * @ `?' */ static int scale_pixmap (const char *geom) { static char str[] = "[1000x1000+100+100]"; /* should be big enough */ int w = 0, h = 0, x = 0, y = 0; int flags; int changed = 0; if (geom == NULL) return 0; if (!strcmp (geom, "?")) { sprintf (str, "[%dx%d+%d+%d]", bgPixmap.w, bgPixmap.h, bgPixmap.x, bgPixmap.y); xterm_seq (XTerm_title, str); return 0; } { char *p; int n; if ((p = strchr (geom, ';')) == NULL) p = strchr (geom, '\0'); n = (p - geom); if (n >= sizeof (str) - 1) return 0; strncpy (str, geom, n); str[n] = '\0'; } flags = XParseGeometry (str, &x, &y, &w, &h); if (!flags) { flags |= WidthValue; w = 100; } if (flags & WidthValue) { if (!(flags & XValue)) { x = 50; } if (!(flags & HeightValue)) h = w; if (w && !h) { w = bgPixmap.w * ((float) w / 100); h = bgPixmap.h; } else if (h && !w) { w = bgPixmap.w; h = bgPixmap.h * ((float) h / 100); } if (w > 1000) w = 1000; if (h > 1000) h = 1000; if (bgPixmap.w != w) { bgPixmap.w = w; changed++; } if (bgPixmap.h != h) { bgPixmap.h = h; changed++; } } if (!(flags & YValue)) { if (flags & XNegative) flags |= YNegative; y = x; } if (!(flags & WidthValue) && geom[0] != '=') { x += bgPixmap.x; y += bgPixmap.y; } else { if (flags & XNegative) x += 100; if (flags & YNegative) y += 100; } x = (x <= 0 ? 0 : (x >= 100 ? 100 : x)); y = (y <= 0 ? 0 : (y >= 100 ? 100 : y));; if (bgPixmap.x != x) { bgPixmap.x = x; changed++; } if (bgPixmap.y != y) { bgPixmap.y = y; changed++; } return changed; } static void resize_pixmap (void) { XGCValues gcvalue; GC gc; unsigned int width = TermWin_TotalWidth (); unsigned int height = TermWin_TotalHeight (); if (TermWin.pixmap) XFreePixmap (Xdisplay, TermWin.pixmap); TermWin.pixmap = XCreatePixmap (Xdisplay, TermWin.vt, width, height, Xdepth); gcvalue.foreground = PixColors[bgColor]; gc = XCreateGC (Xdisplay, TermWin.vt, GCForeground, &gcvalue); if (bgPixmap.pixmap) { int w = bgPixmap.w; int h = bgPixmap.h; int x = bgPixmap.x; int y = bgPixmap.y; /* * don't zoom pixmap too much nor expand really small pixmaps */ if (w > 1000 || h > 1000) w = 1; else if (width > (10 * xpmAttr.width) || height > (10 * xpmAttr.height)) w = 0; /* tile */ if (w) { float p, incr; Pixmap tmp; tmp = XCreatePixmap (Xdisplay, TermWin.vt, width, xpmAttr.height, Xdepth); XFillRectangle (Xdisplay, tmp, gc, 0, 0, width, xpmAttr.height); /* * horizontal scaling */ incr = (float) xpmAttr.width; p = 0; if (w == 1) { /* display image directly - no scaling at all */ incr = width; if (xpmAttr.width <= width) { w = xpmAttr.width; x = (width - w) / 2; w += x; } else { x = 0; w = width; } } else if (w < 10) { incr *= w; /* fit W images across screen */ x = 0; w = width; } else { incr *= 100.0 / w; if (w < 100) /* contract */ { w = (w * width) / 100; if (x >= 0) /* position */ { float pos; pos = (float) x / 100 * width - (w / 2); x = (width - w); if (pos <= 0) x = 0; else if (pos < x) x = pos; } else { x = (width - w) / 2; } w += x; } else if (w >= 100) /* expand */ { if (x > 0) /* position */ { float pos; pos = (float) x / 100 * xpmAttr.width - (incr / 2); p = xpmAttr.width - (incr); if (pos <= 0) p = 0; else if (pos < p) p = pos; } x = 0; w = width; } } incr /= width; for ( /*nil */ ; x < w; x++, p += incr) { if (p >= xpmAttr.width) p = 0; XCopyArea (Xdisplay, bgPixmap.pixmap, tmp, gc, (int) p, 0, 1, xpmAttr.height, x, 0); } /* * vertical scaling */ incr = (float) xpmAttr.height; p = 0; if (h == 1) { /* display image directly - no scaling at all */ incr = height; if (xpmAttr.height <= height) { h = xpmAttr.height; y = (height - h) / 2; h += y; } else { y = 0; h = height; } } else if (h < 10) { incr *= h; /* fit H images across screen */ y = 0; h = height; } else { incr *= 100.0 / h; if (h < 100) /* contract */ { h = (h * height) / 100; if (y >= 0) /* position */ { float pos; pos = (float) y / 100 * height - (h / 2); y = (height - h); if (pos < 0.0f) y = 0; else if (pos < y) y = pos; } else { y = (height - h) / 2; } h += y; } else if (h >= 100) /* expand */ { if (y > 0) /* position */ { float pos; pos = (float) y / 100 * xpmAttr.height - (incr / 2); p = xpmAttr.height - (incr); if (pos < 0) p = 0; else if (pos < p) p = pos; } y = 0; h = height; } } incr /= height; for ( /*nil */ ; y < h; y++, p += incr) { if (p >= xpmAttr.height) p = 0; XCopyArea (Xdisplay, tmp, TermWin.pixmap, gc, 0, (int) p, width, 1, 0, y); } XFreePixmap (Xdisplay, tmp); } else { /* tiled */ for (y = 0; y < height; y += xpmAttr.height) { unsigned int h = (height - y); if (h > xpmAttr.height) h = xpmAttr.height; for (x = 0; x < width; x += xpmAttr.width) { unsigned int w = (width - x); if (w > xpmAttr.width) w = xpmAttr.width; XCopyArea (Xdisplay, bgPixmap.pixmap, TermWin.pixmap, gc, 0, 0, w, h, x, y); } } } } else XFillRectangle (Xdisplay, TermWin.pixmap, gc, 0, 0, width, height); #ifdef XPM_BUFFERING if (TermWin.buf_pixmap) XFreePixmap (Xdisplay, TermWin.buf_pixmap); TermWin.buf_pixmap = XCreatePixmap (Xdisplay, TermWin.vt, width, height, Xdepth); XCopyArea (Xdisplay, TermWin.pixmap, TermWin.buf_pixmap, gc, 0, 0, width, height, 0, 0); XSetWindowBackgroundPixmap (Xdisplay, TermWin.vt, TermWin.buf_pixmap); #else /* XPM_BUFFERING */ XSetWindowBackgroundPixmap (Xdisplay, TermWin.vt, TermWin.pixmap); #endif /* XPM_BUFFERING */ XFreeGC (Xdisplay, gc); XClearWindow (Xdisplay, TermWin.vt); XFlush (Xdisplay); XSync (Xdisplay, 0); } #else /* XPM_BACKGROUND */ #define scale_pixmap(str) ((void)0) #define resize_pixmap() ((void)0) #endif /* XPM_BACKGROUND */ /*{{{ Create_Windows() - Open and map the window */ static void Create_Windows (int argc, char *argv[]) { Cursor cursor; XClassHint classHint; XWMHints wmHint; int i, x, y, flags; unsigned int width, height; /* * grab colors before netscape does */ for (i = 0; i < (Xdepth <= 2 ? 2 : NRS_COLORS); i++) { const char *const msg = "can't load color \"%s\""; XColor xcol; if (!rs_color[i]) continue; if (!XParseColor (Xdisplay, Xcmap, rs_color[i], &xcol) || !XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error (msg, rs_color[i]); rs_color[i] = def_colorName[i]; if (!rs_color[i]) continue; if (!XParseColor (Xdisplay, Xcmap, rs_color[i], &xcol) || !XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error (msg, rs_color[i]); switch (i) { case fgColor: case bgColor: /* fatal: need bg/fg color */ print_error ("aborting"); exit (EXIT_FAILURE); break; #ifndef NO_CURSORCOLOR case cursorColor: xcol.pixel = PixColors[bgColor]; break; case cursorColor2: xcol.pixel = PixColors[fgColor]; break; #endif /* NO_CURSORCOLOR */ default: xcol.pixel = PixColors[bgColor]; /* None */ break; } } } PixColors[i] = xcol.pixel; } #ifndef NO_CURSORCOLOR if (Xdepth <= 2 || !rs_color[cursorColor]) PixColors[cursorColor] = PixColors[bgColor]; if (Xdepth <= 2 || !rs_color[cursorColor2]) PixColors[cursorColor2] = PixColors[fgColor]; #endif /* NO_CURSORCOLOR */ #ifndef NO_BOLDUNDERLINE if (Xdepth <= 2 || !rs_color[colorBD]) PixColors[colorBD] = PixColors[fgColor]; if (Xdepth <= 2 || !rs_color[colorUL]) PixColors[colorUL] = PixColors[fgColor]; #endif /* NO_BOLDUNDERLINE */ /* * get scrollBar/menuBar shadow colors * * The calculations of topShadow/bottomShadow values are adapted * from the fvwm window manager. */ #ifndef XTERM_SCROLLBAR if (Xdepth <= 2) /* Monochrome */ { PixColors[scrollColor] = PixColors[bgColor]; PixColors[topShadowColor] = PixColors[fgColor]; PixColors[bottomShadowColor] = PixColors[fgColor]; } else { XColor xcol, white; /* bottomShadowColor */ xcol.pixel = PixColors[scrollColor]; XQueryColor (Xdisplay, Xcmap, &xcol); xcol.red = ((xcol.red) / 2); xcol.green = ((xcol.green) / 2); xcol.blue = ((xcol.blue) / 2); if (!XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error ("can't allocate %s", "bottomShadowColor"); xcol.pixel = PixColors[minColor]; } PixColors[bottomShadowColor] = xcol.pixel; /* topShadowColor */ white.pixel = WhitePixel (Xdisplay, Xscreen); XQueryColor (Xdisplay, Xcmap, &white); xcol.pixel = PixColors[scrollColor]; XQueryColor (Xdisplay, Xcmap, &xcol); #ifndef min #define min(a,b) (((a)<(b)) ? (a) : (b)) #define max(a,b) (((a)>(b)) ? (a) : (b)) #endif xcol.red = max ((white.red / 5), xcol.red); xcol.green = max ((white.green / 5), xcol.green); xcol.blue = max ((white.blue / 5), xcol.blue); xcol.red = min (white.red, (xcol.red * 7) / 5); xcol.green = min (white.green, (xcol.green * 7) / 5); xcol.blue = min (white.blue, (xcol.blue * 7) / 5); if (!XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error ("can't allocate %s", "topShadowColor"); xcol.pixel = PixColors[whiteColor]; } PixColors[topShadowColor] = xcol.pixel; } #endif /* XTERM_SCROLLBAR */ szHint.base_width = (2 * TermWin_internalBorder + (Options & Opt_scrollBar ? SB_WIDTH : 0)); szHint.base_height = (2 * TermWin_internalBorder); flags = (rs_geometry ? XParseGeometry (rs_geometry, &x, &y, &width, &height) : 0); if (flags & WidthValue) { szHint.width = width; szHint.flags |= USSize; } if (flags & HeightValue) { szHint.height = height; szHint.flags |= USSize; } TermWin.ncol = szHint.width; TermWin.nrow = szHint.height; change_font (1, NULL); if (flags & XValue) { if (flags & XNegative) { x += (DisplayWidth (Xdisplay, Xscreen) - (szHint.width + TermWin_internalBorder)); szHint.win_gravity = NorthEastGravity; } szHint.x = x; szHint.flags |= USPosition; } if (flags & YValue) { if (flags & YNegative) { y += (DisplayHeight (Xdisplay, Xscreen) - (szHint.height + TermWin_internalBorder)); szHint.win_gravity = (szHint.win_gravity == NorthEastGravity ? SouthEastGravity : SouthWestGravity); } szHint.y = y; szHint.flags |= USPosition; } /* parent window - reverse video so we can see placement errors * sub-window placement & size in resize_subwindows() */ TermWin.parent = XCreateSimpleWindow (Xdisplay, Xroot, szHint.x, szHint.y, szHint.width, szHint.height, BORDERWIDTH, PixColors[bgColor], PixColors[fgColor]); xterm_seq (XTerm_title, rs_title); xterm_seq (XTerm_iconName, rs_iconName); /* ignore warning about discarded `const' */ classHint.res_name = rs_name; classHint.res_class = APL_CLASS; wmHint.input = True; wmHint.initial_state = (Options & Opt_iconic ? IconicState : NormalState); wmHint.flags = (InputHint | StateHint); XSetWMProperties (Xdisplay, TermWin.parent, NULL, NULL, argv, argc, &szHint, &wmHint, &classHint); XSelectInput (Xdisplay, TermWin.parent, (KeyPressMask | FocusChangeMask | StructureNotifyMask | VisibilityChangeMask) ); /* vt cursor: Black-on-White is standard, but this is more popular */ TermWin_cursor = XCreateFontCursor (Xdisplay, XC_xterm); { XColor fg, bg; fg.pixel = PixColors[fgColor]; XQueryColor (Xdisplay, Xcmap, &fg); bg.pixel = PixColors[bgColor]; XQueryColor (Xdisplay, Xcmap, &bg); XRecolorCursor (Xdisplay, TermWin_cursor, &fg, &bg); } /* cursor (menuBar/scrollBar): Black-on-White */ cursor = XCreateFontCursor (Xdisplay, XC_left_ptr); /* the vt window */ TermWin.vt = XCreateSimpleWindow (Xdisplay, TermWin.parent, 0, 0, szHint.width, szHint.height, 0, PixColors[fgColor], PixColors[bgColor]); XDefineCursor (Xdisplay, TermWin.vt, TermWin_cursor); XSelectInput (Xdisplay, TermWin.vt, (ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button3MotionMask)); XMapWindow (Xdisplay, TermWin.vt); XMapWindow (Xdisplay, TermWin.parent); /* scrollBar: size doesn't matter */ scrollBar.win = XCreateSimpleWindow (Xdisplay, TermWin.parent, 0, 0, 1, 1, 0, PixColors[fgColor], PixColors[bgColor]); XDefineCursor (Xdisplay, scrollBar.win, cursor); XSelectInput (Xdisplay, scrollBar.win, (ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask) ); #ifndef NO_MENUBAR /* menuBar: size doesn't matter */ menuBar.win = XCreateSimpleWindow (Xdisplay, TermWin.parent, 0, 0, 1, 1, 0, PixColors[fgColor], PixColors[scrollColor]); XDefineCursor (Xdisplay, menuBar.win, cursor); XSelectInput (Xdisplay, menuBar.win, (ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask) ); #endif /* NO_MENUBAR */ #ifdef XPM_BACKGROUND if (rs_backgroundPixmap != NULL) { char *p = rs_backgroundPixmap; if ((p = strchr (p, ';')) != NULL) { p++; scale_pixmap (p); } set_bgPixmap (rs_backgroundPixmap); } #endif /* XPM_BACKGROUND */ /* graphics context for the vt window */ { XGCValues gcvalue; gcvalue.font = TermWin.font->fid; gcvalue.foreground = PixColors[fgColor]; gcvalue.background = PixColors[bgColor]; TermWin.gc = XCreateGC (Xdisplay, TermWin.vt, GCForeground | GCBackground | GCFont, &gcvalue); } } /*}}} */ /*{{{ window resizing - assuming the parent window is the correct size */ static void resize_subwindows (int width, int height) { int x = 0, y = 0; int old_width = TermWin.width; int old_height = TermWin.height; TermWin.width = TermWin.ncol * TermWin.fwidth; TermWin.height = TermWin.nrow * TermWin.fheight; /* size and placement */ if (scrollbar_visible ()) { scrollBar.beg = 0; scrollBar.end = height; #ifndef XTERM_SCROLLBAR /* arrows are as high as wide - leave 1 pixel gap */ scrollBar.beg += (SB_WIDTH + 1); scrollBar.end -= (SB_WIDTH + 1); #endif width -= SB_WIDTH; XMoveResizeWindow (Xdisplay, scrollBar.win, #ifdef SCROLLBAR_RIGHT width, 0, #else x, 0, #endif SB_WIDTH, height); #ifndef SCROLLBAR_RIGHT x = SB_WIDTH; /* placement of vt window */ #endif } #ifndef NO_MENUBAR if (menubar_visible ()) { y = menuBar_TotalHeight (); /* for placement of vt window */ XMoveResizeWindow (Xdisplay, menuBar.win, x, 0, width, y); } #endif /* NO_MENUBAR */ XMoveResizeWindow (Xdisplay, TermWin.vt, x, y, width, height + 1); if (old_width) Gr_Resize (old_width, old_height); XClearWindow (Xdisplay, TermWin.vt); resize_pixmap (); XSync (Xdisplay, 0); } static void resize (void) { szHint.base_width = (2 * TermWin_internalBorder); szHint.base_height = (2 * TermWin_internalBorder); szHint.base_width += (scrollbar_visible ()? SB_WIDTH : 0); #ifndef NO_MENUBAR szHint.base_height += (menubar_visible ()? menuBar_TotalHeight () : 0); #endif szHint.min_width = szHint.base_width + szHint.width_inc; szHint.min_height = szHint.base_height + szHint.height_inc; szHint.width = szHint.base_width + TermWin.width; szHint.height = szHint.base_height + TermWin.height; szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; XSetWMNormalHints (Xdisplay, TermWin.parent, &szHint); XResizeWindow (Xdisplay, TermWin.parent, szHint.width, szHint.height); resize_subwindows (szHint.width, szHint.height); } #ifndef NO_MENUBAR void map_menuBar (int map) { if (menubar_mapping (map)) resize (); } #endif /* NO_MENUBAR */ void map_scrollBar (int map) { if (scrollbar_mapping (map)) { scr_touch (); resize (); } } /* * Redraw window after exposure or size change */ static void resize_window1 (unsigned int width, unsigned int height) { static short first_time = 1; int new_ncol = (width - szHint.base_width) / TermWin.fwidth; int new_nrow = (height - szHint.base_height) / TermWin.fheight; if (first_time || (new_ncol != TermWin.ncol) || (new_nrow != TermWin.nrow)) { int curr_screen = -1; /* scr_reset only works on the primary screen */ if (!first_time) /* this is not the first time thru */ { selection_clear (); curr_screen = scr_change_screen (PRIMARY); } TermWin.ncol = new_ncol; TermWin.nrow = new_nrow; resize_subwindows (width, height); scr_reset (); if (curr_screen >= 0) /* this is not the first time thru */ scr_change_screen (curr_screen); first_time = 0; } } /* * good for toggling 80/132 columns */ void set_width (unsigned short width) { unsigned short height = TermWin.nrow; if (width != TermWin.ncol) { width = szHint.base_width + width * TermWin.fwidth; height = szHint.base_height + height * TermWin.fheight; XResizeWindow (Xdisplay, TermWin.parent, width, height); resize_window1 (width, height); } } /* * Redraw window after exposure or size change */ void resize_window (void) { Window root; XEvent dummy; int x, y; unsigned int border, depth, width, height; while (XCheckTypedWindowEvent (Xdisplay, TermWin.parent, ConfigureNotify, &dummy)); XGetGeometry (Xdisplay, TermWin.parent, &root, &x, &y, &width, &height, &border, &depth); /* parent already resized */ resize_window1 (width, height); } /*}}} */ /*{{{ xterm sequences - title, iconName, color (exptl) */ #ifdef SMART_WINDOW_TITLE static void set_title (const char *str) { char *name; if (XFetchName (Xdisplay, TermWin.parent, &name)) name = NULL; if (name == NULL || strcmp (name, str)) XStoreName (Xdisplay, TermWin.parent, str); if (name) XFree (name); } #else #define set_title(str) XStoreName (Xdisplay, TermWin.parent, str) #endif #ifdef SMART_WINDOW_TITLE static void set_iconName (const char *str) { char *name; if (XGetIconName (Xdisplay, TermWin.parent, &name)) name = NULL; if (name == NULL || strcmp (name, str)) XSetIconName (Xdisplay, TermWin.parent, str); if (name) XFree (name); } #else #define set_iconName(str) XSetIconName (Xdisplay, TermWin.parent, str) #endif #ifdef XTERM_COLOR_CHANGE static void set_window_color (int idx, const char *color) { const char *const msg = "can't load color \"%s\""; XColor xcol; int i; if (color == NULL || *color == '\0') return; /* handle color aliases */ if (isdigit (*color)) { i = atoi (color); if (i >= 8 && i <= 15) /* bright colors */ { i -= 8; #ifndef NO_BRIGHTCOLOR PixColors[idx] = PixColors[minBright + i]; goto Done; #endif } if (i >= 0 && i <= 7) /* normal colors */ { PixColors[idx] = PixColors[minColor + i]; goto Done; } } if (!XParseColor (Xdisplay, Xcmap, color, &xcol) || !XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error (msg, color); return; } /* XStoreColor (Xdisplay, Xcmap, XColor*); */ /* * FIXME: should free colors here, but no idea how to do it so instead, * so just keep gobbling up the colormap */ #if 0 for (i = blackColor; i <= whiteColor; i++) if (PixColors[idx] == PixColors[i]) break; if (i > whiteColor) { /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ XFreeColors (Xdisplay, Xcmap, (PixColors + idx), 1, DisplayPlanes (Xdisplay, Xscreen)); } #endif PixColors[idx] = xcol.pixel; /* XSetWindowAttributes attr; */ /* Cursor cursor; */ Done: if (idx == bgColor) XSetWindowBackground (Xdisplay, TermWin.vt, PixColors[bgColor]); /* handle colorBD, scrollbar background, etc. */ set_colorfgbg (); { XColor fg, bg; fg.pixel = PixColors[fgColor]; XQueryColor (Xdisplay, Xcmap, &fg); bg.pixel = PixColors[bgColor]; XQueryColor (Xdisplay, Xcmap, &bg); XRecolorCursor (Xdisplay, TermWin_cursor, &fg, &bg); } /* the only reasonable way to enforce a clean update */ scr_poweron (); } #else #define set_window_color(idx,color) ((void)0) #endif /* XTERM_COLOR_CHANGE */ #ifdef XPM_BACKGROUND /* * search for FILE in the current working directory, and within the * colon-delimited PATHLIST, adding the file extension EXT if required. * * FILE is either semi-colon or zero terminated */ static const char * search_path (const char *pathlist, const char *file, const char *ext) { static char name[256]; char *p, *path; int maxpath, len; if (!access (file, R_OK)) return file; /* semi-colon delimited */ if ((p = strchr (file, ';')) == NULL) p = strchr (file, '\0'); len = (p - file); /* check about adding a trailing extension */ if (ext != NULL) { char *dot; dot = strrchr (p, '.'); path = strrchr (p, '/'); if (dot != NULL || (path != NULL && dot <= path)) ext = NULL; } /* leave room for an extra '/' and trailing '\0' */ maxpath = sizeof (name) - (len + (ext ? strlen (ext) : 0) + 2); if (maxpath <= 0) return NULL; for (path = pathlist; path != NULL && *path != '\0'; path = p) { int n; /* colon delimited */ if ((p = strchr (path, ':')) == NULL) p = strchr (path, '\0'); n = (p - path); if (*p != '\0') p++; if (n > 0 && n <= maxpath) { strncpy (name, path, n); if (name[n - 1] != '/') name[n++] = '/'; name[n] = '\0'; strncat (name, file, len); if (!access (name, R_OK)) return name; if (ext) { strcat (name, ext); if (!access (name, R_OK)) return name; } } } return NULL; } #endif /* XPM_BACKGROUND */ #ifdef XPM_BACKGROUND #define XPM_EXT ".xpm" Pixmap set_bgPixmap (const char *file) { char *f; assert (file != NULL); if (bgPixmap.pixmap != None) { XFreePixmap (Xdisplay, bgPixmap.pixmap); bgPixmap.pixmap = None; } XSetWindowBackground (Xdisplay, TermWin.vt, PixColors[bgColor]); if (*file != '\0') { XWindowAttributes attr; XGetWindowAttributes (Xdisplay, Xroot, &attr); xpmAttr.closeness = 30000; xpmAttr.colormap = attr.colormap; xpmAttr.valuemask = (XpmCloseness | XpmColormap | XpmSize | XpmReturnPixels); /* search environment variables here too */ if ((f = search_path (rs_path, file, XPM_EXT)) == NULL) #ifdef PATH_ENV if ((f = search_path (getenv (PATH_ENV), file, XPM_EXT)) == NULL) #endif f = search_path (getenv ("PATH"), file, XPM_EXT); if (f == NULL || XpmReadFileToPixmap (Xdisplay, Xroot, f, &bgPixmap.pixmap, NULL, &xpmAttr)) { char *p; /* semi-colon delimited */ if ((p = strchr (file, ';')) == NULL) p = strchr (file, '\0'); print_error ("couldn't load XPM file \"%.*s\"", (p - file), file); resize_pixmap (); } else if (bgPixmap.pixmap != None) resize_pixmap (); } XClearWindow (Xdisplay, TermWin.vt); scr_touch (); XFlush (Xdisplay); return bgPixmap.pixmap; } #undef XPM_EXT #endif /* XPM_BACKGROUND */ /* * XTerm escape sequences: ESC ] Ps;Pt BEL * 0 = change iconName/title * 1 = change iconName * 2 = change title * 46 = change logfile (not implemented) * 50 = change font * * rxvt extensions: * 10 = menu * 20 = bg pixmap * 39 = change default fg color * 49 = change default bg color */ void xterm_seq (int op, char *str) { int changed = 0; assert (str != NULL); switch (op) { case XTerm_name: set_title (str); /* drop */ case XTerm_iconName: set_iconName (str); break; case XTerm_title: set_title (str); break; case XTerm_Menu: menubar_dispatch (str); break; case XTerm_Pixmap: #ifdef XPM_BACKGROUND if (*str != ';') set_bgPixmap (str); while ((str = strchr (str, ';')) != NULL) { str++; changed += scale_pixmap (str); } if (changed) { resize_pixmap (); scr_touch (); } #endif /* XPM_BACKGROUND */ break; case XTerm_restoreFG: set_window_color (fgColor, str); break; case XTerm_restoreBG: set_window_color (bgColor, str); break; case XTerm_logfile: break; case XTerm_font: change_font (0, str); break; } } /*}}} */ /*{{{ change_font() - Switch to a new font */ /* * init = 1 - initialize * * fontname == FONT_UP - switch to bigger font * fontname == FONT_DN - switch to smaller font */ void change_font (int init, const char *fontname) { const char *const msg = "can't load font \"%s\""; XFontStruct *xfont; static char *newfont[NFONTS]; #ifndef NO_BOLDFONT static XFontStruct *boldFont = NULL; #endif static int fnum = FONT0_IDX; /* logical font number */ int idx = 0; /* index into rs_font[] */ #if (FONT0_IDX == 0) #define IDX2FNUM(i) (i) #define FNUM2IDX(f) (f) #else #define IDX2FNUM(i) (i == 0? FONT0_IDX : (i <= FONT0_IDX? (i-1) : i)) #define FNUM2IDX(f) (f == FONT0_IDX ? 0 : (f < FONT0_IDX ? (f+1) : f)) #endif #define FNUM_RANGE(i) (i <= 0 ? 0 : (i >= NFONTS ? (NFONTS-1) : i)) if (!init) { switch (fontname[0]) { case '\0': fnum = FONT0_IDX; fontname = NULL; break; /* special (internal) prefix for font commands */ case FONT_CMD: idx = atoi (fontname + 1); switch (fontname[1]) { case '+': /* corresponds to FONT_UP */ fnum += (idx ? idx : 1); fnum = FNUM_RANGE (fnum); break; case '-': /* corresponds to FONT_DN */ fnum += (idx ? idx : -1); fnum = FNUM_RANGE (fnum); break; default: if (fontname[1] != '\0' && !isdigit (fontname[1])) return; if (idx < 0 || idx >= (NFONTS)) return; fnum = IDX2FNUM (idx); break; } fontname = NULL; break; default: if (fontname != NULL) { /* search for existing fontname */ for (idx = 0; idx < NFONTS; idx++) { if (!strcmp (rs_font[idx], fontname)) { fnum = IDX2FNUM (idx); fontname = NULL; break; } } } else return; break; } /* re-position around the normal font */ idx = FNUM2IDX (fnum); if (fontname != NULL) { char *name; xfont = XLoadQueryFont (Xdisplay, fontname); if (!xfont) return; name = MALLOC (strlen (fontname + 1) * sizeof (char), "font"); if (name == NULL) { XFreeFont (Xdisplay, xfont); return; } strcpy (name, fontname); if (newfont[idx] != NULL) FREE (newfont[idx], "id", "fn"); newfont[idx] = name; rs_font[idx] = newfont[idx]; } } if (TermWin.font) XFreeFont (Xdisplay, TermWin.font); /* load font or substitute */ xfont = XLoadQueryFont (Xdisplay, rs_font[idx]); if (!xfont) { print_error (msg, rs_font[idx]); rs_font[idx] = "fixed"; xfont = XLoadQueryFont (Xdisplay, rs_font[idx]); if (!xfont) { print_error (msg, rs_font[idx]); goto Abort; } } TermWin.font = xfont; #ifndef NO_BOLDFONT /* fail silently */ if (init && rs_boldFont != NULL) boldFont = XLoadQueryFont (Xdisplay, rs_boldFont); #endif #ifdef KANJI if (TermWin.kanji) XFreeFont (Xdisplay, TermWin.kanji); /* load font or substitute */ xfont = XLoadQueryFont (Xdisplay, rs_kfont[idx]); if (!xfont) { print_error (msg, rs_kfont[idx]); rs_kfont[idx] = "k14"; xfont = XLoadQueryFont (Xdisplay, rs_kfont[idx]); if (!xfont) { print_error (msg, rs_kfont[idx]); goto Abort; } } TermWin.kanji = xfont; #endif /* KANJI */ /* alter existing GC */ if (!init) { XSetFont (Xdisplay, TermWin.gc, TermWin.font->fid); #ifndef NO_MENUBAR menubar_expose (); #endif /* NO_MENUBAR */ } /* set the sizes */ { int fw = XTextWidth (TermWin.font, "MMMMMMMMMM", 10) / 10; int fh = TermWin.font->ascent + TermWin.font->descent; /* not the first time thru and sizes haven't changed */ if (fw == TermWin.fwidth && fh == TermWin.fheight) return; TermWin.fwidth = fw; TermWin.fheight = fh; } /* check that size of boldFont is okay */ #ifndef NO_BOLDFONT if (boldFont != NULL && TermWin.fwidth == (XTextWidth (boldFont, "MMMMMMMMMM", 10) / 10) && TermWin.fheight == (boldFont->ascent + boldFont->descent)) TermWin.boldFont = boldFont; else TermWin.boldFont = NULL; #endif /* NO_BOLDFONT */ set_colorfgbg (); TermWin.width = TermWin.ncol * TermWin.fwidth; TermWin.height = TermWin.nrow * TermWin.fheight; szHint.width_inc = TermWin.fwidth; szHint.height_inc = TermWin.fheight; szHint.min_width = szHint.base_width + szHint.width_inc; szHint.min_height = szHint.base_height + szHint.height_inc; szHint.width = szHint.base_width + TermWin.width; szHint.height = szHint.base_height + TermWin.height; szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; if (!init) resize (); return; Abort: print_error ("aborting"); /* fatal problem */ exit (EXIT_FAILURE); #undef IDX2FNUM #undef FNUM2IDX #undef FNUM_RANGE } /*}}} */ /*{{{ main() */ int main (int argc, char *argv[]) { int i; char *val, **cmd_argv = NULL; /* "WINDOWID=\0" = 10 chars, UINT_MAX = 10 chars */ static char windowid_string[20], *display_string; for (i = 0; i < argc; i++) { if (!strcmp (argv[i], "-e")) { argc = i; argv[argc] = NULL; if (argv[argc + 1] != NULL) { cmd_argv = (argv + argc + 1); if (cmd_argv[0] != NULL) rs_iconName = rs_title = my_basename (cmd_argv[0]); } break; } } rs_name = my_basename (argv[0]); /* * Open display, get options/resources and create the window */ if ((display_name = getenv ("DISPLAY")) == NULL) display_name = ":0"; get_options (argc, argv); Xdisplay = XOpenDisplay (display_name); if (!Xdisplay) { print_error ("can't open display %s", display_name); exit (EXIT_FAILURE); } extract_resources (Xdisplay, rs_name); /* * set any defaults not already set */ if (!rs_title) rs_title = rs_name; if (!rs_iconName) rs_iconName = rs_name; if (!rs_saveLines || (TermWin.saveLines = atoi (rs_saveLines)) < 0) TermWin.saveLines = SAVELINES; /* no point having a scrollbar without having any scrollback! */ if (!TermWin.saveLines) Options &= ~Opt_scrollBar; #ifdef PRINTPIPE if (!rs_print_pipe) rs_print_pipe = PRINTPIPE; #endif if (!rs_cutchars) rs_cutchars = CUTCHARS; #ifndef NO_BOLDFONT if (rs_font[0] == NULL && rs_boldFont != NULL) { rs_font[0] = rs_boldFont; rs_boldFont = NULL; } #endif for (i = 0; i < NFONTS; i++) { if (!rs_font[i]) rs_font[i] = def_fontName[i]; #ifdef KANJI if (!rs_kfont[i]) rs_kfont[i] = def_kfontName[i]; #endif } #ifdef XTERM_REVERSE_VIDEO /* this is how xterm implements reverseVideo */ if (Options & Opt_reverseVideo) { if (!rs_color[fgColor]) rs_color[fgColor] = def_colorName[bgColor]; if (!rs_color[bgColor]) rs_color[bgColor] = def_colorName[fgColor]; } #endif for (i = 0; i < NRS_COLORS; i++) if (!rs_color[i]) rs_color[i] = def_colorName[i]; #ifndef XTERM_REVERSE_VIDEO /* this is how we implement reverseVideo */ if (Options & Opt_reverseVideo) { const char *name; /* swap foreground/background colors */ name = rs_color[fgColor]; rs_color[fgColor] = rs_color[bgColor]; rs_color[bgColor] = name; name = def_colorName[fgColor]; def_colorName[fgColor] = def_colorName[bgColor]; def_colorName[bgColor] = name; } #endif /* convenient aliases for setting fg/bg to colors */ color_aliases (fgColor); color_aliases (bgColor); #ifndef NO_CURSORCOLOR color_aliases (cursorColor); color_aliases (cursorColor2); #endif /* NO_CURSORCOLOR */ #ifndef NO_BOLDUNDERLINE color_aliases (colorBD); color_aliases (colorUL); #endif /* NO_BOLDUNDERLINE */ Create_Windows (argc, argv); scr_reset (); /* initialize screen */ Gr_reset (); /* reset graphics */ /* add scrollBar, do it directly to avoid resize() */ scrollbar_mapping (Options & Opt_scrollBar); #ifdef DEBUG_X XSynchronize (Xdisplay, True); XSetErrorHandler ((XErrorHandler) abort); #else XSetErrorHandler ((XErrorHandler) xerror_handler); #endif #ifdef DISPLAY_IS_IP /* Fixup display_name for export over pty to any interested terminal * clients via "ESC[7n" (e.g. shells). Note we use the pure IP number * (for the first non-loopback interface) that we get from * network_display(). This is more "name-resolution-portable", if you * will, and probably allows for faster x-client startup if your name * server is beyond a slow link or overloaded at client startup. Of * course that only helps the shell's child processes, not us. * * Giving out the display_name also affords a potential security hole */ val = display_name = network_display (display_name); if (val == NULL) #endif /* DISPLAY_IS_IP */ val = XDisplayString (Xdisplay); if (display_name == NULL) display_name = val; /* use broken `:0' value */ i = strlen (val); display_string = MALLOC ((i + 9) * sizeof (char), "display_string"); sprintf (display_string, "DISPLAY=%s", val); sprintf (windowid_string, "WINDOWID=%u", (unsigned int) TermWin.parent); /* add entries to the environment: * @ DISPLAY: in case we started with -display * @ WINDOWID: X window id number of the window * @ COLORTERM: terminal sub-name and also indicates its color * @ TERM: terminal name */ putenv (display_string); putenv (windowid_string); if (Xdepth <= 2) { putenv ("COLORTERM=" COLORTERMENV "-mono"); putenv ("TERM=" TERMENV); } else { #ifdef XPM_BACKGROUND putenv ("COLORTERM=" COLORTERMENV "-xpm"); #else putenv ("COLORTERM=" COLORTERMENV); #endif #ifdef DEFINE_XTERM_COLOR putenv ("TERM=" TERMENV "-color"); #else putenv ("TERM=" TERMENV); #endif } init_command (cmd_argv); main_loop (); /* main processing loop */ return EXIT_SUCCESS; } /*}}} */ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/Xtensions/menubar+graphics/graphics.h0000644000175000017500000000322411375434150022331 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: graphics.h * * function declarations for graphics.c, only to be included by the rxvt * source itself. * * To use graphics in external programs only include "rxvtgrx.h" *----------------------------------------------------------------------*/ #ifndef _GRAPHICS_H #define _GRAPHICS_H #include #include "rxvtgrx.h" /* text alignment */ /* * number of graphics points * divisible by 2 (num lines) * divisible by 4 (num rect) */ #define NGRX_PTS 1000 _XFUNCPROTOBEGIN extern void Gr_ButtonReport (int /* but */ , int /* x */ , int /* y */ ); extern void Gr_do_graphics (int /* cmd */ , int /* nargs */ , int /* args */ [], unsigned char * /* text */ ); extern void Gr_scroll (int /* count */ ); extern void Gr_ClearScreen (void); extern void Gr_ChangeScreen (void); extern void Gr_expose (Window /* win */ ); extern void Gr_Resize (int /* w */ , int /* h */ ); extern void Gr_reset (void); extern int Gr_Displayed (void); _XFUNCPROTOEND #ifdef RXVT_GRAPHICS #define Gr_ButtonPress(x,y) Gr_ButtonReport ('P',(x),(y)) #define Gr_ButtonRelease(x,y) Gr_ButtonReport ('R',(x),(y)) #else #define Gr_ButtonPress(x,y) ((void)0) #define Gr_ButtonRelease(x,y) ((void)0) #define Gr_scroll(count) ((void)0) #define Gr_ClearScreen() ((void)0) #define Gr_ChangeScreen() ((void)0) #define Gr_expose(win) ((void)0) #define Gr_Resize(w,h) ((void)0) #define Gr_reset() ((void)0) #define Gr_Displayed() (0) /* return zero */ #endif #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/Xtensions/menubar+graphics/feature.h0000644000175000017500000003322211375434150022165 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: feature.h * * Compile-time configuration. * Additional compile-time configuration in "defaults.h" * ---------------------------------------------------------------------- * Copyright 1995,1996 * mj olesen Queen's Univ at Kingston * * You can do what you like with this source code provided you don't make * money from it and you include an unaltered copy of this message * (including the copyright). As usual, the author accepts no * responsibility for anything, nor does he guarantee anything whatsoever. *----------------------------------------------------------------------*/ #ifndef _FEATURE_H #define _FEATURE_H /*{{{ system hacks: */ /*----------------------------------------------------------------------*/ /* Consistent defines - please report on the necessity * @ Unixware: defines (__svr4__) */ #if defined (SVR4) && !defined (__svr4__) #define __svr4__ #endif #if defined (sun) && !defined (__sun__) #define __sun__ #endif /* * sun isn't properly protected? * anyway, it causes problems when is also included */ #if defined (__sun__) #undef HAVE_SYS_IOCTL_H #endif /*}}} */ /*{{{ debugging: */ /*----------------------------------------------------------------------* * #define NDEBUG * to disable whichever assert() macros are used in the code * * #define DEBUG_SCREEN * to do self-check for internal screen corruption * * #define DEBUG_MALLOC * to do self-check on out-of-bound memory usage * * #define DEBUG_CMD * to output some data structures of command.c * (key-buffer contents, command line, tty permissions) * * #define DEBUG_TTY * to output tty settings * * #define DEBUG_COLORS * to print out current color/renditions as they change * * #define DEBUG_SELECTION * to use XK_Print to dump information about the current selection * * #define DEBUG_DEPTH 1 * to set the X color depth, for debugging lower depth modes *----------------------------------------------------------------------*/ /* #define NDEBUG */ #ifndef NDEBUG /* # define DEBUG_MENU */ /* # define DEBUG_MENUARROWS */ /* # define DEBUG_SCREEN */ /* # define DEBUG_MALLOC */ /* # define DEBUG_CMD */ /* # define DEBUG_TTY */ /* # define DEBUG_COLORS */ /* # define DEBUG_SELECTION */ /* # define DEBUG_DEPTH 1 */ #endif /*}}} */ /*{{{ screen/colors: */ /*----------------------------------------------------------------------* * #define XPM_BACKGROUND * to add sexy-looking background pixmaps. Needs libxpm * * #define XPM_SCALING * to allow pixmaps to be dynamically scaled * * #define PATH_ENV "RXVTPATH" * to define the name of the environment variable to be used in * addition to the "PATH" environment and the `path' resource * * #define XPM_BUFFERING * to use xpm buffers for the screen update * (bigger & faster? ... but does it work correctly?) * * #define NO_CURSORCOLOR * to avoid enabling a color cursor (-cr, cursorColor, cursorColor2) * * #define NO_BRIGHTCOLOR * to suppress use of BOLD and BLINK attributes for setting * bright foreground and background, respectively. * Simulate BOLD using colorBD, boldFont or overstrike characters. * * #define NO_BOLDUNDERLINE * to disable separate colors for bold/underline * * #define NO_BOLDOVERSTRIKE * to disable using simulated bold using overstrike * * #define NO_BOLDFONT * to compile without support for real bold fonts * * #define NO_SECONDARY_SCREEN * to disable the secondary screen ("\E[?47h" / "\E[?47l") * * #define REFRESH_PERIOD * to limit the number of screenfulls between screen refreshes * during hard & fast scrolling [default: 1] * * #define USE_XCOPYAREA * to use XCopyArea (in place of re-draws) to speed up rxvt. * - I've been told this helps with some graphics adapters like the * PC's et4000. OK, it's good on monochrome Sun-3's that I've tried * too. /RN * - sometimes looks worse and slower /mjo * * #define RXVT_GRAPHICS * to use Rob Nation's own graphics mode * * #define PRINTPIPE "lpr" * to define a printer pipe which will be used for emulation of an * attached vt100 printer * * #define OLD_COLOR_MODEL * to use the old color model whereby erasing is done with the * default rendition rather than the current rendition * NB: this make break some applications and should used with caution *----------------------------------------------------------------------*/ #define XPM_BACKGROUND #define XPM_SCALING #define PATH_ENV "PATH" #define XPM_BUFFERING /* #define NO_CURSORCOLOR */ /* #define NO_BRIGHTCOLOR */ /* #define NO_BOLDUNDERLINE */ #define NO_BOLDOVERSTRIKE #define NO_BOLDFONT /* #define NO_SECONDARY_SCREEN */ /* #define REFRESH_PERIOD 1 */ /* #define USE_XCOPYAREA */ /* #define RXVT_GRAPHICS */ /* #define PRINTPIPE "lpr" */ /* #define OLD_COLOR_MODEL */ /*}}} */ /*{{{ resources: */ /*----------------------------------------------------------------------* * #define NO_RESOURCES * to blow off the Xdefaults altogether * * #define USE_XGETDEFAULT * to use XGetDefault() instead of the default, which is to use a * substitute for using XGetDefaults() that saves 60-150kB memory * * The default is best if all you want to do is put rxvt defaults * in ~/.Xdefaults file, * * #define XAPPLOADDIR "/usr/lib/X11/app-defaults" * to define where to find installed application defaults for rxvt * Only if USE_XGETDEFAULT is not defined. * * #define OFFIX_DND * to add support for the Offix DND (Drag 'n' Drop) protocol *----------------------------------------------------------------------*/ /* #define NO_RESOURCES */ #define USE_XGETDEFAULT #ifndef XAPPLOADDIR #define XAPPLOADDIR "/usr/lib/X11/app-defaults" #endif /* #define OFFIX_DND */ /*}}} */ /*{{{ keys: */ /*----------------------------------------------------------------------* * #define NO_DELETE_KEY * to use the unadulterated X server value for the Delete key * * #define DONT_GUESS_BACKSPACE * to use ^H for the Backspace key and avoid using the current stty * setting of erase to guess a Backspace value of either ^H or ^? * * #define HOTKEY_CTRL * #define HOTKEY_META * choose one of these values to be the `hotkey' for changing font. * -- obsolete * * #define LINUX_KEYS * to use * Home = "\E[1~", End = "\E[4~" * instead of * Home = "\E[7~", End = "\E[8~" [default] * * #define KEYSYM_RESOURCE * to enable the keysym resource which allows you to define * strings associated with various KeySyms (0xFF00 - 0xFFFF). * Only works with the default hand-rolled resources. * * #define NO_XLOCALE * to disable X11R6 support for European languages * - possibly still beta *----------------------------------------------------------------------*/ #if defined (__sun__) || defined (__svr4__) #define NO_DELETE_KEY /* favoured settings for these systems */ #endif /* #define NO_DELETE_KEY */ /* #define DONT_GUESS_BACKSPACE */ /* #define HOTKEY_CTRL */ /* #define HOTKEY_META */ /* #define LINUX_KEYS */ #define KEYSYM_RESOURCE /* #define NO_XLOCALE */ /*}}} */ /*{{{ mouse/selection: */ /*----------------------------------------------------------------------* * #define NO_SCROLLBAR_REPORT * to disable sending escape sequences (up, down, page up/down) * from the scrollbar when XTerm mouse reporting is enabled * * #define CUTCHAR_RESOURCE * to add run-time support for changing the default cutchars * for double click selection * * #define MOUSE_REPORT_DOUBLECLICK * to have mouse reporting include double-click info for button1 * * #define MULTICLICK_TIME * to set delay between multiple click events [default: 500] *----------------------------------------------------------------------*/ /* #define NO_SCROLLBAR_REPORT */ /* #define CUTCHAR_RESOURCE */ /* #define MOUSE_REPORT_DOUBLECLICK */ /* #define MULTICLICK_TIME 500 */ /*}}} */ /*{{{ bell: */ /*----------------------------------------------------------------------* * #define NO_MAPALERT * to disable automatic de-iconify when a bell is received * * #define MAPALERT_OPTION * to have mapAlert behaviour selectable with mapAlert resource *----------------------------------------------------------------------*/ /* #define NO_MAPALERT */ /* #define MAPALERT_OPTION */ /*}}} */ /*{{{ scrollbar: */ /*----------------------------------------------------------------------* * #define XTERM_SCROLLBAR * to only use the XTerm-style scrollbar - no arrows, bitmapped * instead of the regular scrollbar (with arrows) * * ---------------------------------------------------------------------* * #define SCROLLBAR_RIGHT * to have the scrollbar on the right-hand side * * #define SB_WIDTH * to choose the scrollbar width - should be an even number [default: 10] * for XTERM_SCROLLBAR it is *always* 14. *----------------------------------------------------------------------*/ /* #define XTERM_SCROLLBAR */ /* #define SCROLLBAR_RIGHT */ #define SB_WIDTH 16 /*}}} */ /*{{{ menuBar: */ /*----------------------------------------------------------------------* * #define NO_MENUBAR * to supress use of the (experimental) menuBar * * #define MENUBAR_SHADOW_IN * to change the default shadow style * * #define MENU_SHADOW_IN * to change the default shadow style *----------------------------------------------------------------------*/ #define NO_MENUBAR /* #define MENUBAR_SHADOW_IN */ /* #define MENU_SHADOW_IN */ /*}}} */ /*{{{ multi-lingual: */ /*----------------------------------------------------------------------* * #define META8_OPTION * to allow run-time selection of Meta (Alt) to set the 8th bit on * * #define GREEK_SUPPORT * to include support for the Greek Elot-928 & IBM-437 keyboard * see doc/README.greek * * #define KANJI * to compile with Kanji support * after compilation, rename executable as `kxvt' *----------------------------------------------------------------------*/ /* #define META8_OPTION */ /* #define GREEK_SUPPORT */ /* #define KANJI */ /*}}} */ /*{{{ misc: */ /*----------------------------------------------------------------------* * #define DISPLAY_IS_IP * to have DISPLAY environment variable and "\E[7n" transmit * display with an IP number * * #define ENABLE_DISPLAY_ANSWER * to have "\E[7n" transmit the display name. * This has been cited as a potential security hole. * * #define ESCZ_ANSWER "\033[?1;2C" * to change what ESC Z transmits instead of the default "\E[?1;2c" * * #define SMART_WINDOW_TITLE * to check the current value of the window-time/icon-name and * avoid re-setting it to the same value -- avoids unnecessary window * refreshes * * #define XTERM_COLOR_CHANGE * to allow foreground/background color to be changed with an * xterm escape sequence "\E]39;color^G" -- still experimental * * #define DEFINE_XTERM_COLOR * to define TERM="xterm-color" instead of just TERM="xterm", which * is a useful addition to COLORTERM for distinguishing color * characteristics since it will be exported across rlogin/rsh *----------------------------------------------------------------------*/ /* #define DISPLAY_IS_IP */ /* #define ENABLE_DISPLAY_ANSWER */ /* #define ESCZ_ANSWER "\033[?1;2C" */ #define SMART_WINDOW_TITLE #define XTERM_COLOR_CHANGE #define DEFINE_XTERM_COLOR /*}}} */ /*{{{ utmp: */ /*----------------------------------------------------------------------* * #define UTMP_SUPPORT * for utmp support to update `/etc/utmp' to show rxvt logins * * For this to work, * - make Rxvt setuid root, a potential security hole but is * reportedly okay - do at your own risk * su * chown root.root rxvt * chmod a+s rxvt * - make Rxvt setuid/setgid to match user/group that owns `/etc/utmp' * * #define UTMP_FILENAME "/var/adm/utmp" (Irix, dec alpha) * #define UTMP_FILENAME "/var/run/utmp" (FreeBSD, NetBSD 0.9) * to define where the utmp file is located if it isn't /etc/utmp * and isn't defined by one of the myriad names in utmp.c * * #define TTYTAB_FILENAME "/etc/ttys" (FreeBSD, NetBSD 0.9) * for BSD-type systems, to define where the tty table is located * if it isn't /etc/ttytab *----------------------------------------------------------------------*/ /* #define UTMP_SUPPORT */ #ifdef UTMP_SUPPORT #ifndef UTMP_FILENAME /* # define UTMP_FILENAME "/var/adm/utmp" */ /* # define UTMP_FILENAME "/var/adm/utmp" */ #endif #ifndef TTYTAB_FILENAME /* # define TTYTAB_FILENAME "/etc/ttys" */ #endif #endif /*}}} */ /*{{{ sort out conflicts */ /*----------------------------------------------------------------------* * end of user configuration section *----------------------------------------------------------------------*/ #ifdef KANJI #undef GREEK_SUPPORT /* Kanji/Greek together is too weird */ #undef XTERM_FONT_CHANGE /* can't ensure font sizes will match */ #endif #ifdef XPM_BUFFERING #ifndef XPM_SCALING #define XPM_SCALING #endif #endif /* Define if you have the Xpm library (-lXpm). */ #ifndef HAVE_LIBXPM #undef XPM_BACKGROUND #endif /* disable what can't be used */ #ifndef XPM_BACKGROUND #undef XPM_BUFFERING #undef XPM_SCALING #undef XTERM_PIXMAP_CHANGE #endif /* no point having a fancy menubar with a simple XTerm scrollBar */ #ifdef XTERM_SCROLLBAR #ifndef NO_MENUBAR #define NO_MENUBAR #endif #endif #define APL_CLASS "XTerm" /* class name */ #define APL_SUBCLASS "Rxvt" /* also check resources under this name */ #define APL_NAME "rxvt" /* normal name */ /* COLORTERM, TERM environment variables */ #define COLORTERMENV "rxvt" #ifdef KANJI #define TERMENV "kterm" #else #define TERMENV "xterm" #endif #ifdef NO_MOUSE_REPORT #ifndef NO_MOUSE_REPORT_SCROLLBAR #define NO_MOUSE_REPORT_SCROLLBAR #endif #endif #if defined (NO_RESOURCES) || defined (USE_XGETDEFAULT) #undef KEYSYM_RESOURCE #endif #ifdef NO_RESOURCES #undef USE_XGETDEFAULT #endif /*}}} */ #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/Xtensions/menubar+graphics/Makefile.in0000644000175000017500000000616111375434150022430 0ustar thepthep# src/Makefile.in -*- Makefile -*- @MCOMMON@ basedir = $(srcdir)/.. thisdir = src first_rule: all dummy: SRCS = command.c debug.c graphics.c grkelot.c main.c menubar.c misc.c\ netdisp.c screen.c scrollbar.c utmp.c xdefaults.c OBJS = command.o debug.o graphics.o grkelot.o main.o menubar.o misc.o\ netdisp.o screen.o scrollbar.o utmp.o xdefaults.o HDRS = command.h debug.h defaults.h feature.h graphics.h grkelot.h\ main.h menubar.h misc.h rxvtgrx.h screen.h scrollbar.h xdefaults.h # # Distribution variables # DIST = $(HDRS) $(SRCS) Makefile.in gcc-Wall # inference rules .c.o: $(CC) -c $(CPPFLAGS) $(XINC) -I$(basedir) $(CFLAGS) $< #------------------------------------------------------------------------- all: rxvt rxvt: VERSION.h $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(XLIB) VERSION.h: echo "#define VERSION \""$(VERSION)"\"" > $@; tags: $(SRCS) ctags $(SRCS) allbin: rxvt alldoc: clean: $(RMF) rxvt core a.out *.o *.bak *~ realclean: clean $(RMF) VERSION.h tags distclean: (cd $(srcdir); $(RMF) rxvt *~ *.o core a.out) if test $(srcdir) = .; then $(MAKE) realclean; fi (cd $(srcdir); $(RMF) Makefile) install: allbin alldoc $(INSTALL_PROGRAM) rxvt $(DESTDIR)$(bindir)/$(binprefix)rxvt uninstall: (cd $(bindir); $(RMF) $(binprefix)rxvt) distdirs: mkdir $(basedir)/../$(VERNAME)/$(thisdir) distcopy: $(CP) $(DIST) $(basedir)/../$(VERNAME)/$(thisdir) (cd $(basedir)/../$(VERNAME)/$(thisdir) && ln -s ../install.sh ./) # Semi-automatic generation of dependencies: # Use gcc -MM because X11 `makedepend' doesn't work on all systems # and it also includes system headers. # `semi'-automatic since dependencies are generated at distribution time. distdepend: mv Makefile.in Makefile.in~ sed "/^# DO NOT DELETE:/,$$ d" Makefile.in~ > Makefile.in echo "# DO NOT DELETE: ugly dependency list follows" >> Makefile.in gcc -MM $(CPPFLAGS) $(XINC) -I$(basedir) $(SRCS) >> Makefile.in # ----------------------------------------------------------------------- # DO NOT DELETE: ugly dependency list follows command.o: command.c main.h VERSION.h ./../config.h feature.h misc.h \ xdefaults.h command.h debug.h graphics.h rxvtgrx.h grkelot.h \ menubar.h scrollbar.h screen.h defaults.h debug.o: debug.c ./../config.h feature.h debug.h graphics.o: graphics.c main.h VERSION.h ./../config.h feature.h misc.h \ command.h debug.h graphics.h rxvtgrx.h screen.h grkelot.o: grkelot.c ./../config.h feature.h grkelot.h main.o: main.c main.h VERSION.h ./../config.h feature.h misc.h \ command.h debug.h graphics.h rxvtgrx.h scrollbar.h menubar.h screen.h \ xdefaults.h defaults.h menubar.o: menubar.c main.h VERSION.h ./../config.h feature.h misc.h \ menubar.h command.h debug.h misc.o: misc.c main.h VERSION.h ./../config.h feature.h misc.h netdisp.o: netdisp.c ./../config.h feature.h screen.o: screen.c main.h VERSION.h ./../config.h feature.h misc.h \ command.h debug.h graphics.h rxvtgrx.h screen.h scrollbar.o: scrollbar.c main.h VERSION.h ./../config.h feature.h \ misc.h scrollbar.h utmp.o: utmp.c ./../config.h feature.h xdefaults.o: xdefaults.c main.h VERSION.h ./../config.h feature.h \ misc.h debug.h defaults.h grkelot.h xdefaults.h xiterm+thai-1.10/src/Xtensions/menubar+graphics/menubar.c0000644000175000017500000011114211375434150022154 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: menubar.c * * Copyright 1996 * mj olesen Queen's Univ at Kingston * * You can do what you like with this source code provided you don't make * money from it and you include an unaltered copy of this message * (including the copyright). As usual, the author accepts no * responsibility for anything, nor does he guarantee anything whatsoever. * * menuBar syntax: * * = title set menuBar title * +/ access menuBar top level * -/ remove menuBar top level * NUL remove menuBar top level * * + [/menu/path/]submenu add/access menu * - [/menu/path/]submenu remove menu * * + [/menu/path/]{item}[{rtext}] [action] add/alter item * - [/menu/path/][item} remove item * * + [/menu/path/]{-} add separator * - [/menu/path/]{-} remove separator * * + ../ access parent menu (1 level) * + ../../ access parent menu (multiple levels) * * BeginRightLeftUpDownEnd *----------------------------------------------------------------------*/ /*{{{ includes */ #include "main.h" #include #ifdef HAVE_SYS_SELECT_H #include #endif #include "menubar.h" #include "command.h" #include "debug.h" #include "misc.h" /*}}} */ #ifndef NO_MENUBAR #define HSPACE 1 /* one space */ #define MENU_MARGIN 2 #define menu_height() (TermWin.fheight + 2 * MENU_MARGIN) #define MENU_DELAY_USEC 250000 /* 1/4 sec */ #define SEPARATOR_HALFHEIGHT (SHADOW + 1) #define SEPARATOR_HEIGHT (2 * SEPARATOR_HALFHEIGHT) #define isSeparator(name) ((name)[0] == '\0') #define SEPARATOR_NAME "-" #define MENUITEM_BEG '{' #define MENUITEM_END '}' #define DOTS ".." #define Menu_PixelWidth(menu) (2 * SHADOW + \ Width2Pixel ((menu)->width + 3 * HSPACE)) menuBar_t menuBar; static GC topShadowGC, botShadowGC, neutralGC, menubarGC; struct menu_t; /*{{{ typedefs, local variables */ typedef struct menuitem_t { struct menuitem_t *prev; /* prev menu-item */ struct menuitem_t *next; /* next menu-item */ char *name; /* character string displayed */ char *name2; /* character string displayed (right) */ short len; /* strlen (name) */ short len2; /* strlen (name) */ union { short type; /* must not be changed; first element */ struct { short type; short len; /* strlen (str) */ unsigned char *str; /* action to take */ } action; struct { short type; struct menu_t *menu; /* sub-menu */ } submenu; #define MenuLabel 0 #define MenuAction 1 #define MenuTerminalAction 2 #define MenuSubMenu 3 } entry; } menuitem_t; typedef struct menu_t { struct menu_t *parent; /* parent menu */ struct menu_t *prev; /* prev menu */ struct menu_t *next; /* next menu */ menuitem_t *head; /* double-linked list */ menuitem_t *tail; /* double-linked list */ menuitem_t *item; /* current item */ char *name; /* menu name */ short len; /* strlen (name) */ short width; /* maximum menu width [chars] */ Window win; /* window of the menu */ short x; /* x location [pixels] (chars if parent == NULL) */ short y; /* y location [pixels] */ short w, h; /* window width, height [pixels] */ } menu_t; static struct { menu_t *head, *tail; /* double-linked list of menus */ char *title; /* title to put in the empty menuBar */ } RootBar = { NULL, NULL, NULL }; static menu_t *ActiveMenu = NULL; /* currently active menu */ static int menuarrows_x = 0; typedef struct { char name; char key; short type; short len; /* strlen (str) */ unsigned char *str; /* action to take */ } menuarrow_t; static menuarrow_t menuarrows[] = { {'l', 'D', 0, 0, NULL}, {'u', 'A', 0, 0, NULL}, /* {'c', 0, 0, 0, NULL}, */ {'d', 'B', 0, 0, NULL}, {'r', 'C', 0, 0, NULL} }; #define NARROWS (sizeof(menuarrows)/sizeof(menuarrows [0])) /*}}} */ /*{{{ prototypes: */ static menu_t * menu_delete (menu_t * menu); /*}}} */ /* * find an item called NAME in MENU */ static menuitem_t * menuitem_find (menu_t * menu, char *name) { menuitem_t *item; assert (name != NULL); assert (menu != NULL); /* find the last item in the menu, this is good for separators */ for (item = menu->tail; item != NULL; item = item->prev) { if (item->entry.type == MenuSubMenu) { if (!strcmp (name, (item->entry.submenu.menu)->name)) break; } else if ((isSeparator (name) && isSeparator (item->name)) || !strcmp (name, item->name)) break; } return item; } /* * unlink ITEM from its MENU and free its memory */ static void menuitem_free (menu_t * menu, menuitem_t * item) { /* disconnect */ menuitem_t *prev, *next; assert (menu != NULL); prev = item->prev; next = item->next; if (prev != NULL) prev->next = next; if (next != NULL) next->prev = prev; /* new head, tail */ if (menu->tail == item) menu->tail = prev; if (menu->head == item) menu->head = next; switch (item->entry.type) { case MenuAction: case MenuTerminalAction: FREE (item->entry.action.str, "free", "free"); break; case MenuSubMenu: (void) menu_delete (item->entry.submenu.menu); break; } if (item->name != NULL) FREE (item->name, "free", "free"); if (item->name2 != NULL) FREE (item->name2, "free", "free"); FREE (item, "free", "free"); } static menuarrow_t * menuarrow_find (int name) { int i; for (i = 0; i < NARROWS; i++) if (name == menuarrows[i].name) return (menuarrows + i); return NULL; } static void menuarrow_free (int name) { menuarrow_t *arr; if (!name) { int i; for (i = 0; i < NARROWS; i++) menuarrow_free (menuarrows[i].name); } else if ((arr = menuarrow_find (name)) != NULL) { switch (arr->type) { case MenuAction: case MenuTerminalAction: FREE (arr->str, "free", "free"); arr->str = NULL; break; } arr->type = MenuLabel; } } static void menuarrow_add (char *string) { int i; unsigned xtra_len; char *p; struct { char *str; int len; } beg = { NULL, 0 } ,end = { NULL, 0 } ,*cur, parse[NARROWS]; memset (parse, 0, sizeof (parse)); /* printf ("add arrows = `%s'\n", string); */ for (p = string; p != NULL && *p; string = p) { p = (string + 3); /* printf ("parsing at %s\n", string); */ switch (string[1]) { case 'b': cur = &beg; break; case 'e': cur = &end; break; default: for (i = 0; i < NARROWS; i++) { if (string[1] == menuarrows[i].name) { cur = &(parse[i]); break; } } if (i >= NARROWS) continue; /* not found */ break; } string = p; cur->str = string; cur->len = 0; if (cur == &end) { p = strchr (string, '\0'); } else { char *next = string; do { p = strchr (next, '<'); if (p != NULL) { if (p[1] && p[2] == '>') break; /* parsed */ } else { if (beg.str == NULL) /* no end needed */ p = strchr (next, '\0'); break; } next = (p + 1); } while (1); } if (p == NULL) return; cur->len = (p - string); } #ifdef DEBUG_MENUARROWS cur = &beg; printf ("(len %d) = %.*s\n", cur->len, cur->len, (cur->str ? cur->str : "")); for (i = 0; i < NARROWS; i++) { cur = &(parse[i]); printf ("<%c>(len %d) = %.*s\n", menuarrows[i].name, cur->len, cur->len, (cur->str ? cur->str : "")); } cur = &end; printf ("(len %d) = %.*s\n", cur->len, cur->len, (cur->str ? cur->str : "")); #endif xtra_len = (beg.len + end.len); for (i = 0; i < NARROWS; i++) { if (xtra_len || parse[i].len) menuarrow_free (menuarrows[i].name); } for (i = 0; i < NARROWS; i++) { menuarrow_t *arr = (menuarrows + i); unsigned char *str; unsigned int len; if (!parse[i].len) continue; str = MALLOC ((parse[i].len + xtra_len + 1), "add"); if (str == NULL) continue; len = 0; if (beg.len) { strncpy (str + len, beg.str, beg.len); len += beg.len; } strncpy (str + len, parse[i].str, parse[i].len); len += parse[i].len; if (end.len) { strncpy (str + len, end.str, end.len); len += end.len; } str[len] = '\0'; #ifdef DEBUG_MENUARROWS printf ("<%c>(len %d) = %s\n", menuarrows[i].name, len, str); #else len = escaped_string (str); #endif if (len) { arr->type = MenuAction; /* sort command vs. terminal actions */ if (str[0] == '\0') { if (len > 1) memmove (str, str + 1, len--); if (str[0] != '\0') arr->type = MenuTerminalAction; } arr->str = str; arr->len = len; } else { FREE (str, "add", "add"); } } } static menuitem_t * menuitem_add (menu_t * menu, char *name, char *name2, char *action) { menuitem_t *item; unsigned int len; assert (name != NULL); assert (action != NULL); if (menu == NULL) return NULL; if (isSeparator (name)) { /* add separator, no action */ name = ""; action = ""; } else { /* * add/replace existing menu item */ item = menuitem_find (menu, name); if (item != NULL) { if (item->name2 != NULL && name2 != NULL) { FREE (item->name2, "add", "add"); item->len2 = 0; item->name2 = NULL; } switch (item->entry.type) { case MenuAction: case MenuTerminalAction: FREE (item->entry.action.str, "add", "add"); item->entry.action.str = NULL; break; } goto Item_Found; } } /* allocate a new itemect */ if ((item = MALLOC (sizeof (menuitem_t), "add")) == NULL) return NULL; item->len2 = 0; item->name2 = NULL; len = strlen (name); item->name = MALLOC ((len + 1), "add"); if (item->name != NULL) { strcpy (item->name, name); if (name[0] == '.' && name[1] != '.') len = 0; /* hidden menu name */ } else { FREE (item, "add", "add"); return NULL; } item->len = len; /* add to tail of list */ item->prev = menu->tail; item->next = NULL; if (menu->tail != NULL) (menu->tail)->next = item; menu->tail = item; /* fix head */ if (menu->head == NULL) menu->head = item; /* * add action */ Item_Found: if (name2 != NULL && item->name2 == NULL) { len = strlen (name2); if (len == 0 || (item->name2 = MALLOC ((len + 1), "add")) == NULL) { len = 0; item->name2 = NULL; } else { strcpy (item->name2, name2); } item->len2 = len; } item->entry.type = MenuLabel; len = strlen (action); if (len == 0 && item->name2 != NULL) { action = item->name2; len = item->len2; } if (len) { unsigned char *str = MALLOC ((len + 1), "add"); if (str == NULL) { menuitem_free (menu, item); return NULL; } strcpy (str, action); #ifndef DEBUG_MENU len = escaped_string (str); #endif if (len) { item->entry.type = MenuAction; /* sort command vs. terminal actions */ if (str[0] == '\0') { if (len > 1) memmove (str, str + 1, len--); if (str[0] != '\0') item->entry.type = MenuTerminalAction; } item->entry.action.str = str; item->entry.action.len = len; } else { FREE (str, "add", "add"); } } /* new item and a possible increase in width */ if (menu->width < (item->len + item->len2)) menu->width = (item->len + item->len2); return item; } /* * search for the base starting menu for NAME. * return a pointer to the portion of NAME that remains */ static char * menu_find_base (menu_t ** menu, char *path) { menu_t *m = NULL; menuitem_t *item; assert (menu != NULL); if (path[0] == '\0') return path; if (strchr (path, '/') != NULL) { register char *p = path; while ((p = strchr (p, '/')) != NULL) { p++; if (*p == '/') path = p; } if (path[0] == '/') { path++; *menu = NULL; } while ((p = strchr (path, '/')) != NULL) { p[0] = '\0'; if (path[0] == '\0') return NULL; if (!strcmp (path, DOTS)) { if (*menu != NULL) *menu = (*menu)->parent; } else { path = menu_find_base (menu, path); if (path[0] != '\0') /* not found */ { p[0] = '/'; /* fix-up name again */ return path; } } path = (p + 1); } } if (!strcmp (path, DOTS)) { path += strlen (DOTS); if (*menu != NULL) *menu = (*menu)->parent; return path; } /* find this menu */ if (*menu == NULL) { for (m = RootBar.tail; m != NULL; m = m->prev) { if (!strcmp (path, m->name)) break; } } else { /* find this menu */ for (item = (*menu)->tail; item != NULL; item = item->prev) { if (item->entry.type == MenuSubMenu && !strcmp (path, (item->entry.submenu.menu)->name)) { m = (item->entry.submenu.menu); break; } } } if (m != NULL) { *menu = m; path += strlen (path); } return path; } /* * delete this entire menu */ static menu_t * menu_delete (menu_t * menu) { menu_t *parent = NULL, *prev, *next; menuitem_t *item; /* delete the entire menu */ if (menu == NULL) return NULL; parent = menu->parent; /* unlink MENU */ prev = menu->prev; next = menu->next; if (prev != NULL) prev->next = next; if (next != NULL) next->prev = prev; /* fix the index */ if (parent == NULL) { const int len = (menu->len + HSPACE); if (RootBar.tail == menu) RootBar.tail = prev; if (RootBar.head == menu) RootBar.head = next; for (next = menu->next; next != NULL; next = next->next) next->x -= len; } else { for (item = parent->tail; item != NULL; item = item->prev) { if (item->entry.type == MenuSubMenu && item->entry.submenu.menu == menu) { item->entry.submenu.menu = NULL; menuitem_free (menu->parent, item); break; } } } item = menu->tail; while (item != NULL) { menuitem_t *p = item->prev; menuitem_free (menu, item); item = p; } if (menu->name != NULL) FREE (menu->name, "free", "free"); FREE (menu, "free", "free"); return parent; } static menu_t * menu_add (menu_t * parent, char *path) { menu_t *menu; if (strchr (path, '/') != NULL) { register char *p; if (path[0] == '/') { /* shouldn't happen */ path++; parent = NULL; } while ((p = strchr (path, '/')) != NULL) { p[0] = '\0'; if (path[0] == '\0') return NULL; parent = menu_add (parent, path); path = (p + 1); } } if (!strcmp (path, DOTS)) return (parent != NULL ? parent->parent : parent); if (path[0] == '\0') return parent; /* allocate a new menu */ if ((menu = MALLOC (sizeof (menu_t), "add")) == NULL) return parent; menu->width = 0; menu->parent = parent; menu->len = strlen (path); menu->name = MALLOC ((menu->len + 1), "add"); if (menu->name == NULL) { FREE (menu, "add", "add"); return parent; } strcpy (menu->name, path); /* initialize head/tail */ menu->head = menu->tail = NULL; menu->prev = menu->next = NULL; menu->win = None; menu->x = menu->y = menu->w = menu->h = 0; menu->item = NULL; /* add to tail of list */ if (parent == NULL) { menu->prev = RootBar.tail; if (RootBar.tail != NULL) RootBar.tail->next = menu; RootBar.tail = menu; if (RootBar.head == NULL) RootBar.head = menu; /* fix head */ if (menu->prev) menu->x = (menu->prev->x + menu->prev->len + HSPACE); } else { menuitem_t *item; item = menuitem_add (parent, path, "", ""); if (item == NULL) { FREE (menu, "add", "add"); return parent; } assert (item->entry.type == MenuLabel); item->entry.type = MenuSubMenu; item->entry.submenu.menu = menu; } return menu; } static void drawbox_menubar (int x, int len, int state) { GC top, bot; x = Width2Pixel (x); len = Width2Pixel (len + HSPACE); if (x >= TermWin.width) return; else if (x + len >= TermWin.width) len = (TermWin_TotalWidth () - x); #ifdef MENUBAR_SHADOW_IN state = -state; #endif switch (state) { case +1: top = topShadowGC; bot = botShadowGC; break; /* SHADOW_OUT */ case -1: top = botShadowGC; bot = topShadowGC; break; /* SHADOW_IN */ case 0: top = bot = neutralGC; break; /* neutral */ } Draw_Shadow (menuBar.win, top, bot, x, 0, len, menuBar_TotalHeight ()); } static void drawtriangle (int x, int y, int state) { GC top, bot; int w; #ifdef MENU_SHADOW_IN state = -state; #endif switch (state) { case +1: top = topShadowGC; bot = botShadowGC; break; /* SHADOW_OUT */ case -1: top = botShadowGC; bot = topShadowGC; break; /* SHADOW_IN */ case 0: top = bot = neutralGC; break; /* neutral */ } w = menu_height () / 2; x -= (SHADOW + MENU_MARGIN) + (3 * w / 2); y += (SHADOW + MENU_MARGIN) + (w / 2); Draw_Triangle (ActiveMenu->win, top, bot, x, y, w, 'r'); } static void drawbox_menuitem (int y, int state) { GC top, bot; #ifdef MENU_SHADOW_IN state = -state; #endif switch (state) { case +1: top = topShadowGC; bot = botShadowGC; break; /* SHADOW_OUT */ case -1: top = botShadowGC; bot = topShadowGC; break; /* SHADOW_IN */ case 0: top = bot = neutralGC; break; /* neutral */ } Draw_Shadow (ActiveMenu->win, top, bot, SHADOW + 0, SHADOW + y, ActiveMenu->w - 2 * (SHADOW), menu_height () + 2 * MENU_MARGIN); XFlush (Xdisplay); } #ifdef DEBUG_MENU static void print_menu_ancestors (menu_t * menu) { if (menu == NULL) { printf ("Top Level menu\n"); return; } printf ("menu %s ", menu->name); if (menu->parent != NULL) { menuitem_t *item; for (item = menu->parent->head; item != NULL; item = item->next) { if (item->entry.type == MenuSubMenu && item->entry.submenu.menu == menu) { break; } } if (item == NULL) { printf ("is an orphan!\n"); return; } } printf ("\n"); print_menu_ancestors (menu->parent); } static void print_menu_descendants (menu_t * menu) { menuitem_t *item; menu_t *parent; int i, level = 0; parent = menu; do { level++; parent = parent->parent; } while (parent != NULL); for (i = 0; i < level; i++) printf (">"); printf ("%s\n", menu->name); for (item = menu->head; item != NULL; item = item->next) { if (item->entry.type == MenuSubMenu) { if (item->entry.submenu.menu == NULL) printf ("> %s == NULL\n", item->name); else print_menu_descendants (item->entry.submenu.menu); } else { for (i = 0; i < level; i++) printf ("+"); if (item->entry.type == MenuLabel) printf ("label: "); printf ("%s\n", item->name); } } for (i = 0; i < level; i++) printf ("<"); printf ("\n"); } #endif /* pop up/down the current menu and redraw the menuBar button */ static void menu_show (void) { int x, y, xright; menuitem_t *item; if (ActiveMenu == NULL) return; x = ActiveMenu->x; if (ActiveMenu->parent == NULL) { register int h; drawbox_menubar (x, ActiveMenu->len, -1); x = Width2Pixel (x); ActiveMenu->y = 1; ActiveMenu->w = Menu_PixelWidth (ActiveMenu); if ((x + ActiveMenu->w) >= TermWin.width) x = (TermWin_TotalWidth () - ActiveMenu->w); /* find the height */ for (h = 0, item = ActiveMenu->head; item != NULL; item = item->next) { if (isSeparator (item->name)) h += SEPARATOR_HEIGHT; else h += menu_height (); } ActiveMenu->h = h + 2 * (SHADOW + MENU_MARGIN); } if (ActiveMenu->win == None) { ActiveMenu->win = XCreateSimpleWindow (Xdisplay, TermWin.vt, x, ActiveMenu->y, ActiveMenu->w, ActiveMenu->h, 0, PixColors[fgColor], PixColors[scrollColor]); XMapWindow (Xdisplay, ActiveMenu->win); } Draw_Shadow (ActiveMenu->win, topShadowGC, botShadowGC, 0, 0, ActiveMenu->w, ActiveMenu->h); /* determine the correct right-alignment */ for (xright = 0, item = ActiveMenu->head; item != NULL; item = item->next) if (item->len2 > xright) xright = item->len2; for (y = 0, item = ActiveMenu->head; item != NULL; item = item->next) { const int xoff = (SHADOW + Width2Pixel (HSPACE) / 2); const int yoff = (SHADOW + MENU_MARGIN); register int h; GC gc = menubarGC; if (isSeparator (item->name)) { Draw_Shadow (ActiveMenu->win, topShadowGC, botShadowGC, xoff, yoff + y + SEPARATOR_HALFHEIGHT, ActiveMenu->w - (2 * xoff), 0); h = SEPARATOR_HEIGHT; } else { char *name = item->name; int len = item->len; if (item->entry.type == MenuLabel) { gc = botShadowGC; } else if (item->entry.type == MenuSubMenu) { int x1, y1; menuitem_t *it; menu_t *menu = item->entry.submenu.menu; drawtriangle (ActiveMenu->w, y, +1); name = menu->name; len = menu->len; y1 = ActiveMenu->y + y; /* place sub-menu at midpoint of parent menu */ menu->w = Menu_PixelWidth (menu); x1 = ActiveMenu->w / 2; /* right-flush menu if it's too small */ if (x1 > menu->w) x1 += (x1 - menu->w); x1 += x; /* find the height of this submenu */ for (h = 0, it = menu->head; it != NULL; it = it->next) { if (isSeparator (it->name)) h += SEPARATOR_HEIGHT; else h += menu_height (); } menu->h = h + 2 * (SHADOW + MENU_MARGIN); /* ensure menu is in window limits */ if ((x1 + menu->w) >= TermWin.width) x1 = (TermWin_TotalWidth () - menu->w); if ((y1 + menu->h) >= TermWin.height) y1 = (TermWin_TotalHeight () - menu->h); menu->x = (x1 < 0 ? 0 : x1); menu->y = (y1 < 0 ? 0 : y1); } else if (item->name2 && !strcmp (name, item->name2)) name = NULL; if (len && name) XDrawString (Xdisplay, ActiveMenu->win, gc, xoff, yoff + y + menu_height () - (2 * MENU_MARGIN), name, len); len = item->len2; name = item->name2; if (len && name) XDrawString (Xdisplay, ActiveMenu->win, gc, ActiveMenu->w - (xoff + Width2Pixel (xright)), yoff + y + menu_height () - (2 * MENU_MARGIN), name, len); h = menu_height (); } y += h; } } static void menu_display (void (*update) (void)) { if (ActiveMenu == NULL) return; if (ActiveMenu->win != None) XDestroyWindow (Xdisplay, ActiveMenu->win); ActiveMenu->win = None; ActiveMenu->item = NULL; if (ActiveMenu->parent == NULL) drawbox_menubar (ActiveMenu->x, ActiveMenu->len, +1); ActiveMenu = ActiveMenu->parent; update (); } static void menu_hide_all (void) { menu_display (menu_hide_all); } static void menu_hide (void) { menu_display (menu_show); } static void delete_entire_menu (void) { menu_t *menu; menu = RootBar.tail; while (menu != NULL) { menu_t *prev = menu->prev; menu_delete (menu); menu = prev; } RootBar.head = RootBar.tail = ActiveMenu = NULL; menuarrow_free (0); /* remove all arrow functions */ } /* * user interface for building/deleting and otherwise managing menus */ void menubar_dispatch (char *str) { static menu_t *menu = NULL; /* the menu currently being built */ const char *const id = "dispatch"; int cmd; char *path, *name, *name2; if (menubar_visible () && ActiveMenu != NULL) menubar_expose (); else ActiveMenu = NULL; /* skip leading spaces */ while (isspace (*str)) str++; cmd = *str++; switch (cmd) { case '\0': /* delete entire menu */ delete_entire_menu (); menu = NULL; return; break; case '=': /* add/change the menuBar title */ while (isspace (*str)) str++; name = REALLOC (RootBar.title, (strlen (str) + 1), id); if (name != NULL) { strcpy (name, str); RootBar.title = name; } menubar_expose (); return; break; case '<': str--; if (str[1] && str[2] == '>') menuarrow_add (str); return; break; case '+': case '-': while (isspace (*str)) str++; path = name = str; name2 = NULL; /* parse STR, allow spaces inside (name) */ if (path[0] != '\0') { name = strchr (path, MENUITEM_BEG); str = strchr (path, MENUITEM_END); if (name != NULL || str != NULL) { if (name == NULL || str == NULL || str <= (name + 1) || (name > path && name[-1] != '/')) { print_error ("menu error <%s>\n", path); return; } if (str[1] == MENUITEM_BEG) { name2 = (str + 2); str = strchr (name2, MENUITEM_END); if (str == NULL) { print_error ("menu error <%s>\n", path); return; } name2[-2] = '\0'; /* remove prev MENUITEM_END */ } if (name > path && name[-1] == '/') name[-1] = '\0'; *name++ = '\0'; /* delimit */ *str++ = '\0'; /* delimit */ while (isspace (*str)) str++; /* skip space */ } #if 0 printf ("path = <%s>, name = <%s>, name2 = <%s>, action = <%s>\n", path, (name ? name : ""), (name2 ? name2 : ""), (str ? str : "") ); #endif } break; default: /* unknown command */ return; break; } /* process the different commands */ switch (cmd) { case '+': /* add/replace existing menu or menuitem */ if (path[0] != '\0') { path = menu_find_base (&menu, path); if (path[0] != '\0') menu = menu_add (menu, path); } if (name[0] != '\0') { if (!strcmp (name, SEPARATOR_NAME)) name = ""; menuitem_add (menu, name, name2, str); } break; case '-': /* delete menu entry */ if (!strcmp (path, "/") && name[0] == '\0') { delete_entire_menu (); menu = NULL; menubar_expose (); } else if (path[0] != '\0') { path = menu_find_base (&menu, path); if (path[0] != '\0') menu = NULL; } if (menu != NULL) { if (name[0] == '\0') { menu = menu_delete (menu); } else { menuitem_t *item; if (!strcmp (name, SEPARATOR_NAME)) name = ""; item = menuitem_find (menu, name); if (item != NULL && item->entry.type != MenuSubMenu) { menuitem_free (menu, item); /* fix up the width */ menu->width = 0; for (item = menu->head; item != NULL; item = item->next) { if (menu->width < (item->len + item->len2)) menu->width = (item->len + item->len2); } } } menubar_expose (); } break; } } static void draw_menuarrows (int name, int state) { GC top, bot; int i; #ifdef MENU_SHADOW_IN state = -state; #endif switch (state) { case +1: top = topShadowGC; bot = botShadowGC; break; /* SHADOW_OUT */ case -1: top = botShadowGC; bot = topShadowGC; break; /* SHADOW_IN */ case 0: top = bot = neutralGC; break; /* neutral */ } if (!menuarrows_x) return; for (i = 0; i < NARROWS; i++) { const int w = Width2Pixel (1); const int y = (menuBar_TotalHeight () - w) / 2; int x = menuarrows_x + (5 * Width2Pixel (i)) / 4; if (!name || name == menuarrows[i].name) Draw_Triangle (menuBar.win, top, bot, x, y, w, menuarrows[i].name); } XFlush (Xdisplay); } void menubar_expose (void) { menu_t *menu; int x; if (!menubar_visible ()) return; if (menubarGC == None) { /* Create the graphics context */ XGCValues gcvalue; gcvalue.font = TermWin.font->fid; gcvalue.foreground = (Xdepth <= 2 ? PixColors[fgColor] : PixColors[blackColor]); menubarGC = XCreateGC (Xdisplay, menuBar.win, GCForeground | GCFont, &gcvalue); gcvalue.foreground = PixColors[scrollColor]; neutralGC = XCreateGC (Xdisplay, menuBar.win, GCForeground, &gcvalue); gcvalue.foreground = PixColors[bottomShadowColor]; botShadowGC = XCreateGC (Xdisplay, menuBar.win, GCForeground | GCFont, &gcvalue); gcvalue.foreground = PixColors[topShadowColor]; topShadowGC = XCreateGC (Xdisplay, menuBar.win, GCForeground, &gcvalue); } /* make sure the font is correct */ XSetFont (Xdisplay, menubarGC, TermWin.font->fid); XSetFont (Xdisplay, botShadowGC, TermWin.font->fid); XClearWindow (Xdisplay, menuBar.win); menu_hide_all (); x = 0; for (menu = RootBar.head; menu != NULL; menu = menu->next) { int len = menu->len; x = (menu->x + menu->len + HSPACE); #ifdef DEBUG_MENU print_menu_descendants (menu); #endif if (x >= TermWin.ncol) len = (TermWin.ncol - (menu->x + HSPACE)); drawbox_menubar (menu->x, len, +1); XDrawString (Xdisplay, menuBar.win, menubarGC, (Width2Pixel (menu->x) + Width2Pixel (HSPACE) / 2), menuBar_height (), menu->name, len); if (x >= TermWin.ncol) break; } drawbox_menubar (x, TermWin.ncol, (x ? +1 : -1)); /* add the menuBar title, if it exists and there's plenty of room */ menuarrows_x = 0; if (x < TermWin.ncol) { char *str, title[256]; int len, ncol = TermWin.ncol; if (x < (ncol - (NARROWS + 1))) { ncol -= (NARROWS + 1); menuarrows_x = Width2Pixel (ncol); } draw_menuarrows (0, +1); str = (RootBar.title ? RootBar.title : APL_NAME "-%v"); for (len = 0; *str && len < sizeof (title) - 1; str++) { char *s; switch (*str) { case '%': str++; switch (str[0]) { case 'v': s = VERSION; break; case '%': s = "%"; break; default: s = NULL; } if (s != NULL) while (*s && len < sizeof (title) - 1) title[len++] = *s++; break; default: title[len++] = str[0]; break; } } title[len] = '\0'; ncol -= (x + len + HSPACE); if (len > 0 && ncol >= 0) XDrawString (Xdisplay, menuBar.win, menubarGC, Width2Pixel (x) + Width2Pixel (ncol + HSPACE) / 2, menuBar_height (), title, len); } } int menubar_mapping (int map) { int change = 0; if (map && !menubar_visible ()) { menuBar.state = 1; XMapWindow (Xdisplay, menuBar.win); change = 1; } else if (!map && menubar_visible ()) { menubar_expose (); menuBar.state = 0; XUnmapWindow (Xdisplay, menuBar.win); change = 1; } else menubar_expose (); return change; } static int menu_select (XButtonEvent * ev) { menuitem_t *thisitem, *item = NULL; int this_y, y; Window unused_root, unused_child; int unused_root_x, unused_root_y; unsigned int unused_mask; if (ActiveMenu == NULL) return 0; XQueryPointer (Xdisplay, ActiveMenu->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->x), &(ev->y), &unused_mask); if (ActiveMenu->parent != NULL && (ev->x < 0 || ev->y < 0)) { menu_hide (); return 1; } /* determine the menu item corresponding to the Y index */ if (ev->x >= 0 && ev->x <= (ActiveMenu->w - SHADOW)) { for (y = 0, item = ActiveMenu->head; item != NULL; item = item->next) { int h = menu_height (); if (isSeparator (item->name)) { h = SEPARATOR_HEIGHT; } else if (ev->y >= y && ev->y < (y + h)) { break; } y += h; } } if (item == NULL && ev->type == ButtonRelease) { menu_hide_all (); return 0; } thisitem = item; this_y = y; /* erase the last item */ if (ActiveMenu->item != NULL) { if (ActiveMenu->item != thisitem) { for (y = 0, item = ActiveMenu->head; item != NULL; item = item->next) { int h = menu_height (); if (isSeparator (item->name)) { h = SEPARATOR_HEIGHT; } else if (item == ActiveMenu->item) { /* erase old menuitem */ drawbox_menuitem (y, 0); /* No Shadow */ if (item->entry.type == MenuSubMenu) drawtriangle (ActiveMenu->w, y, +1); break; } y += h; } } else { switch (ev->type) { case ButtonRelease: switch (item->entry.type) { case MenuLabel: case MenuSubMenu: menu_hide_all (); break; case MenuAction: case MenuTerminalAction: drawbox_menuitem (this_y, -1); /* * use select for timing * remove menu before sending keys to the application */ { struct itimerval tv; tv.it_value.tv_sec = 0; tv.it_value.tv_usec = MENU_DELAY_USEC; select (0, NULL, NULL, NULL, &tv.it_value); } menu_hide_all (); #ifndef DEBUG_MENU switch (item->entry.type) { case MenuTerminalAction: cmd_write (item->entry.action.str, item->entry.action.len); break; default: tt_write (item->entry.action.str, item->entry.action.len); break; } #else /* DEBUG_MENU */ printf ("%s: %s\n", item->name, item->entry.action.str); #endif /* DEBUG_MENU */ break; } break; default: if (item->entry.type == MenuSubMenu) goto DoMenu; break; } return 0; } } DoMenu: ActiveMenu->item = thisitem; y = this_y; if (thisitem != NULL) { item = ActiveMenu->item; if (item->entry.type != MenuLabel) drawbox_menuitem (y, +1); if (item->entry.type == MenuSubMenu) { int x; drawtriangle (ActiveMenu->w, y, -1); x = ev->x + (ActiveMenu->parent ? ActiveMenu->x : Width2Pixel (ActiveMenu->x)); if (x >= item->entry.submenu.menu->x) { ActiveMenu = item->entry.submenu.menu; menu_show (); return 1; } } } return 0; } static void menubar_select (XButtonEvent * ev) { menu_t *menu = NULL; /* determine the menu corresponding to the X index */ if (ev->y >= 0 && ev->y <= menuBar_height ()) { for (menu = RootBar.head; menu != NULL; menu = menu->next) { int x = Width2Pixel (menu->x); int w = Width2Pixel (menu->len + HSPACE); if ((ev->x >= x && ev->x < x + w)) break; } } switch (ev->type) { case ButtonRelease: menu_hide_all (); break; case ButtonPress: if (menu == NULL && menuarrows_x && ev->x >= menuarrows_x) { int i; for (i = 0; i < NARROWS; i++) { if (ev->x >= (menuarrows_x + (Width2Pixel (4 * i + i)) / 4) && ev->x < (menuarrows_x + (Width2Pixel (4 * i + i + 4)) / 4)) { menuarrow_t *arr = (menuarrows + i); char def[] = "\033[?"; draw_menuarrows (menuarrows[i].name, -1); /* * use select for timing */ { struct itimerval tv; tv.it_value.tv_sec = 0; tv.it_value.tv_usec = MENU_DELAY_USEC; select (0, NULL, NULL, NULL, &tv.it_value); } draw_menuarrows (menuarrows[i].name, +1); #ifndef DEBUG_MENUARROWS switch (arr->type) { case MenuAction: tt_write (arr->str, arr->len); break; case MenuTerminalAction: cmd_write (arr->str, arr->len); break; default: if ((def[2] = menuarrows[i].key) != 0) tt_write (def, 3); break; } #else /* DEBUG_MENUARROWS */ printf ("'%c': ", menuarrows[i].name); switch (arr->type) { case MenuAction: case MenuTerminalAction: printf ("%s\n", arr->str); break; default: printf ("\\033[%c (default)\n", menuarrows[i].key); break; } #endif /* DEBUG_MENUARROWS */ return; } } } /*drop */ default: /* * press menubar or move to a new entry */ if (menu != NULL && menu != ActiveMenu) { menu_hide_all (); /* pop down old menu */ ActiveMenu = menu; menu_show (); /* pop up new menu */ } break; } } void menubar_control (XButtonEvent * ev) { switch (ev->type) { case ButtonPress: if (ev->button == Button1) menubar_select (ev); break; case ButtonRelease: if (ev->button == Button1) menu_select (ev); break; case MotionNotify: while (XCheckTypedWindowEvent (Xdisplay, TermWin.parent, MotionNotify, ev)); if (ActiveMenu) while (menu_select (ev)); else ev->y = -1; if (ev->y < 0) { Window unused_root, unused_child; int unused_root_x, unused_root_y; unsigned int unused_mask; XQueryPointer (Xdisplay, menuBar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->x), &(ev->y), &unused_mask); menubar_select (ev); } break; } } #endif /* NO_MENUBAR */ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/Xtensions/menubar+graphics/command.h0000644000175000017500000000276011375434150022153 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: command.h * * Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as you don't try * to make money out of it and you include an unaltered copy of this * message (including the copyright). * * This module has been heavily modified by R. Nation * * No additional restrictions are applied. * * Additional modifications by mj olesen * No additional restrictions are applied. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ #ifndef _COMMAND_H #define _COMMAND_H #include #include #define menuBar_esc 10 #define scrollBar_esc 30 _XFUNCPROTOBEGIN extern void init_command (char * /* argv */ []); extern void tt_resize (void); extern void tt_write (const unsigned char * /* str */ , unsigned int /* count */ ); extern void tt_printf (const unsigned char * /* fmt */ ,...); extern unsigned int cmd_write (const unsigned char * /* str */ , unsigned int /* count */ ); extern void main_loop (void); extern FILE * popen_printer (void); extern int pclose_printer (FILE * /* stream */ ); _XFUNCPROTOEND #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/Xtensions/menubar+graphics/README0000644000175000017500000000005011375434150021232 0ustar thepthepTo include this, copy all files in src/ xiterm+thai-1.10/src/Xtensions/menubar+graphics/command.c0000644000175000017500000021205511375434150022146 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: command.c */ /*{{{ notes: */ /*----------------------------------------------------------------------* * Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as * you don't try to make money out of it and you include an * unaltered copy of this message (including the copyright). * * This module has been very heavily modified by R. Nation * * No additional restrictions are applied * * Additional modification by Garrett D'Amore to * allow vt100 printing. No additional restrictions are applied. * * Integrated modifications by Steven Hirsch to * properly support X11 mouse report mode and support for DEC * "private mode" save/restore functions. * * Integrated key-related changes by Jakub Jelinek * to handle Shift+function keys properly. * Should be used with enclosed termcap / terminfo database. * * Extensive modifications by mj olesen * No additional restrictions. * * Further modification and cleanups for Solaris 2.x and Linux 1.2.x * by Raul Garcia Garcia . No additional restrictions. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ /*}}} */ /*{{{ includes: */ #include "main.h" #include "xdefaults.h" #ifdef OFFIX_DND #include #define DndFile 2 #define DndDir 5 #define DndLink 7 #endif #include #ifndef NO_XLOCALE #if (XtSpecificationRelease < 6) #define NO_XLOCALE #else #define X_LOCALE #include #endif #endif /* NO_XLOCALE */ #include #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_SYS_IOCTL_H #include #endif #include /* #define USE_GETGRNAME */ /* * this seems like a bad way to go, since there's no guarantee that * /dev/tty belongs to the group "tty" and not "system" or "wheel" */ #ifdef USE_GETGRNAME #include #endif #ifdef TIME_WITH_SYS_TIME #include #include #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif #if defined (__svr4__) #include /* for struct rlimit */ #include /* for I_PUSH */ #define _NEW_TTY_CTRL /* to get proper defines in */ #endif #ifdef HAVE_SYS_SELECT_H #include #endif #ifdef HAVE_TERMIOS_H #include #else #include #endif #include #include #include "command.h" #include "debug.h" #include "graphics.h" #include "grkelot.h" #include "menubar.h" #include "scrollbar.h" #include "screen.h" #include "defaults.h" /*}}} */ /* #define DEBUG_TTYMODE */ /* #define DEBUG_CMD */ /*{{{ terminal mode defines: */ /* use the fastest baud-rate */ #ifdef B38400 #define BAUDRATE B38400 #else #ifdef B19200 #define BAUDRATE B19200 #else #define BAUDRATE B9600 #endif #endif /* Disable special character functions */ #ifdef _POSIX_VDISABLE #define VDISABLE _POSIX_VDISABLE #else #define VDISABLE 255 #endif /*----------------------------------------------------------------------* * system default characters if defined and reasonable */ #ifndef CINTR #define CINTR '\003' /* ^C */ #endif #ifndef CQUIT #define CQUIT '\034' /* ^\ */ #endif #ifndef CERASE #define CERASE '\010' /* ^H */ #endif #ifndef CKILL #define CKILL '\025' /* ^U */ #endif #ifndef CEOF #define CEOF '\004' /* ^D */ #endif #ifndef CSTART #define CSTART '\021' /* ^Q */ #endif #ifndef CSTOP #define CSTOP '\023' /* ^S */ #endif #ifndef CSUSP #define CSUSP '\032' /* ^Z */ #endif #ifndef CDSUSP #define CDSUSP '\031' /* ^Y */ #endif #ifndef CRPRNT #define CRPRNT '\022' /* ^R */ #endif #ifndef CFLUSH #define CFLUSH '\017' /* ^O */ #endif #ifndef CWERASE #define CWERASE '\027' /* ^W */ #endif #ifndef CLNEXT #define CLNEXT '\026' /* ^V */ #endif #ifndef VDISCRD #ifdef VDISCARD #define VDISCRD VDISCARD #endif #endif #ifndef VWERSE #ifdef VWERASE #define VWERSE VWERASE #endif #endif /*}}} */ /*{{{ defines: */ #define KBUFSZ 8 /* size of keyboard mapping buffer */ #define STRING_MAX 512 /* max string size for process_xterm_seq() */ #define ESC_ARGS 32 /* max # of args for esc sequences */ /* a large REFRESH_PERIOD causes problems with `cat' */ #define REFRESH_PERIOD 1 #ifndef REFRESH_PERIOD #define REFRESH_PERIOD 10 #endif #ifndef MULTICLICK_TIME #define MULTICLICK_TIME 500 #endif /* time factor to slow down a `jumpy' mouse */ #define MOUSE_THRESHOLD 50 #define CONSOLE "/dev/console" /* console device */ /* * key-strings: if only these keys were standardized */ #ifdef LINUX_KEYS #define KS_HOME "\033[1~" /* Home == Find */ #define KS_END "\033[4~" /* End == Select */ #else #define KS_HOME "\033[7~" /* Home */ #define KS_END "\033[8~" /* End */ #endif /* and this one too! */ #ifdef NO_DELETE_KEY #undef KS_DELETE /* use X server definition */ #else #ifndef KS_DELETE #define KS_DELETE "\033[3~" /* Delete = Execute */ #endif #endif /* * ESC-Z processing: * * By stealing a sequence to which other xterms respond, and sending the * same number of characters, but having a distinguishable sequence, * we can avoid having a timeout (when not under an rxvt) for every login * shell to auto-set its DISPLAY. * * This particular sequence is even explicitly stated as obsolete since * about 1985, so only very old software is likely to be confused, a * confusion which can likely be remedied through termcap or TERM. Frankly, * I doubt anyone will even notice. We provide a #ifdef just in case they * don't care about auto-display setting. Just in case the ancient * software in question is broken enough to be case insensitive to the 'c' * character in the answerback string, we make the distinguishing * characteristic be capitalization of that character. The length of the * two strings should be the same so that identical read(2) calls may be * used. */ #define VT100_ANS "\033[?1;2c" /* vt100 answerback */ #ifndef ESCZ_ANSWER #define ESCZ_ANSWER VT100_ANS /* obsolete ANSI ESC[c */ #endif /*}}} */ /*{{{ extern functions referenced */ extern void cleanutent (void); extern void makeutent (const char *pty, const char *hostname); /*}}} */ /* extern variables referenced */ /* extern variables declared here */ /*{{{ local variables */ static char *ptydev = NULL, *ttydev = NULL; /* pty/tty name */ static int cmd_fd = -1; /* file descriptor connected to the command */ static pid_t cmd_pid = -1; /* process id if child */ static int Xfd = -1; /* file descriptor of X server connection */ static unsigned int num_fds = 0; /* number of file descriptors being used */ static struct stat ttyfd_stat; /* original status of the tty we will use */ #ifdef META8_OPTION static unsigned char meta_char = 033; /* Alt-key prefix */ #endif /* DEC private modes */ #define PrivMode_132 (1LU<<0) #define PrivMode_132OK (1LU<<1) #define PrivMode_rVideo (1LU<<2) #define PrivMode_relOrigin (1LU<<3) #define PrivMode_Screen (1LU<<4) #define PrivMode_Autowrap (1LU<<5) #define PrivMode_aplCUR (1LU<<6) #define PrivMode_aplKP (1LU<<7) #define PrivMode_BackSpace (1LU<<8) #define PrivMode_ShiftKeys (1LU<<9) #define PrivMode_VisibleCursor (1LU<<10) #define PrivMode_MouseX10 (1LU<<11) #define PrivMode_MouseX11 (1LU<<12) /* too annoying to implement X11 highlight tracking */ /* #define PrivMode_MouseX11Track (1LU<<13) */ #define PrivMode_scrollBar (1LU<<14) #define PrivMode_menuBar (1LU<<15) #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11) #define PrivMode(test,bit) do {\ if (test) PrivateModes |= (bit); else PrivateModes &= ~(bit);} while (0) #define PrivMode_Default \ (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) static unsigned long PrivateModes = PrivMode_Default; static unsigned long SavedModes = PrivMode_Default; #undef PrivMode_Default static int refresh_count = 0, refresh_limit = 1, refresh_type = SLOW_REFRESH; static Atom wmDeleteWindow; /* OffiX Dnd (drag 'n' drop) support */ #ifdef OFFIX_DND static Atom DndProtocol, DndSelection; #endif /* OFFIX_DND */ #ifndef NO_XLOCALE static char *rs_inputMethod = ""; /* XtNinputMethod */ static char *rs_preeditType = NULL; /* XtNpreeditType */ static XIC Input_Context; /* input context */ #endif /* NO_XLOCALE */ /* command input buffering */ #ifndef BUFSIZ #define BUFSIZ 4096 #endif static unsigned char cmdbuf_base[BUFSIZ], *cmdbuf_ptr, *cmdbuf_endp; /*}}} */ /*{{{ local functions referenced */ static void privileges (int mode); static RETSIGTYPE Child_signal (int); static RETSIGTYPE Exit_signal (int); static int get_pty (void); static int get_tty (void); static int run_command (char * /* argv */ []); static unsigned char cmd_getc (void); static void lookup_key (XEvent * /* ev */ ); static void process_x_event (XEvent * /* ev */ ); /*static void process_string (int); */ #ifdef PRINTPIPE static void process_print_pipe (void); #endif static void process_escape_seq (void); static void process_csi_seq (void); static void process_xterm_seq (void); static void process_terminal_mode (int /* mode */ , int /* priv */ , unsigned int /* nargs */ , int /* arg */ []); static void process_sgr_mode (unsigned int /* nargs */ , int /* arg */ []); static void process_graphics (void); static void tt_winsize (int /* fd */ ); #ifndef NO_XLOCALE static void init_xlocale (void); #else #define init_xlocale() ((void)0) #endif /*----------------------------------------------------------------------*/ /*}}} */ /*{{{ substitute system functions */ #ifndef _POSIX_VERSION #if defined (__svr4__) static int getdtablesize (void) { struct rlimit rlim; getrlimit (RLIMIT_NOFILE, &rlim); return rlim.rlim_cur; } #endif #endif /*}}} */ /*{{{ take care of suid/sgid super-user (root) privileges */ static void privileges (int mode) { #ifdef HAVE_SETEUID static uid_t euid; static gid_t egid; switch (mode) { case IGNORE: /* * change effective uid/gid - not real uid/gid - so we can switch * back to root later, as required */ seteuid (getuid ()); setegid (getgid ()); break; case SAVE: euid = geteuid (); egid = getegid (); break; case RESTORE: seteuid (euid); setegid (egid); break; } #else switch (mode) { case IGNORE: setuid (getuid ()); setgid (getgid ()); break; case SAVE: break; case RESTORE: break; } #endif } /*}}} */ /*{{{ signal handling, exit handler */ /* * Catch a SIGCHLD signal and exit if the direct child has died */ static RETSIGTYPE Child_signal (int unused) { int pid, save_errno = errno; do { errno = 0; } while ((-1 == (pid = waitpid (cmd_pid, NULL, WNOHANG))) && (errno == EINTR)); if (pid == cmd_pid) exit (EXIT_SUCCESS); errno = save_errno; signal (SIGCHLD, Child_signal); } /* * Catch a fatal signal and tidy up before quitting */ static RETSIGTYPE Exit_signal (int sig) { #ifdef DEBUG_CMD print_error ("signal %d", sig); #endif signal (sig, SIG_DFL); privileges (RESTORE); cleanutent (); privileges (IGNORE); kill (getpid (), sig); } /* * Exit gracefully, clearing the utmp entry and restoring tty attributes */ static void clean_exit (void) { #ifdef DEBUG_CMD fprintf (stderr, "Restoring \"%s\" to mode %03o, uid %d, gid %d\n", ttydev, ttyfd_stat.st_mode, ttyfd_stat.st_uid, ttyfd_stat.st_gid); #endif privileges (RESTORE); chmod (ttydev, ttyfd_stat.st_mode); chown (ttydev, ttyfd_stat.st_uid, ttyfd_stat.st_gid); cleanutent (); privileges (IGNORE); } /*}}} */ /*{{{ Acquire a pseudo-teletype from the system. */ /* * On failure, returns -1. * On success, returns the file descriptor. * * If successful, ttydev and ptydev point to the names of the * master and slave parts */ static int get_pty (void) { int fd = -1; #if defined (__sgi) ptydev = ttydev = _getpty (&fd, O_RDWR | O_NDELAY, 0622, 0); if (ptydev == NULL) goto Failed; #elif defined (__svr4__) { extern char *ptsname (); /* open the STREAMS, clone device /dev/ptmx (master pty) */ if ((fd = open ("/dev/ptmx", O_RDWR)) < 0) { goto Failed; } else { grantpt (fd); /* change slave permissions */ unlockpt (fd); /* unlock slave */ ptydev = ttydev = ptsname (fd); /* get slave's name */ } } #elif defined (_AIX) if ((fd = open ("/dev/ptc", O_RDWR)) < 0) goto Failed; else ptydev = ttydev = ttyname (fd); #else static char pty_name[] = "/dev/pty??"; static char tty_name[] = "/dev/tty??"; int len = strlen (tty_name); char *c1, *c2; ptydev = pty_name; ttydev = tty_name; #define PTYCHAR1 "pqrstuvwxyz" #define PTYCHAR2 "0123456789abcdef" for (c1 = PTYCHAR1; *c1; c1++) { ptydev[len - 2] = ttydev[len - 2] = *c1; for (c2 = PTYCHAR2; *c2; c2++) { ptydev[len - 1] = ttydev[len - 1] = *c2; if ((fd = open (ptydev, O_RDWR)) >= 0) { if (access (ttydev, R_OK | W_OK) == 0) goto Found; close (fd); } } } goto Failed; #endif Found: fcntl (fd, F_SETFL, O_NDELAY); return fd; Failed: print_error ("can't open pseudo-tty"); return -1; } /*}}} */ /*{{{ establish a controlling teletype for new session */ /* * On some systems this can be done with ioctl() but on others we * need to re-open the slave tty. */ static int get_tty (void) { int fd; pid_t pid; /* * setsid() [or setpgrp] must be before open of the terminal, * otherwise there is no controlling terminal (Solaris 2.4, HP-UX 9) */ #ifndef ultrix #ifdef NO_SETSID pid = setpgrp (0, 0); #else pid = setsid (); #endif if (pid < 0) perror (rs_name); #ifdef DEBUG_TTYMODE print_error ("(%s: line %d): PID = %d\n", __FILE__, __LINE__, pid); #endif #endif /* ultrix */ if ((fd = open (ttydev, O_RDWR)) < 0) { print_error ("can't open slave tty %s", ttydev); exit (EXIT_FAILURE); } #if defined (__svr4__) /* * Push STREAMS modules: * ptem: pseudo-terminal hardware emulation module. * ldterm: standard terminal line discipline. * ttcompat: V7, 4BSD and XENIX STREAMS compatibility module. */ ioctl (fd, I_PUSH, "ptem"); ioctl (fd, I_PUSH, "ldterm"); ioctl (fd, I_PUSH, "ttcompat"); #else /* __svr4__ */ { /* change ownership of tty to real uid and real group */ unsigned int mode = 0622; gid_t gid = getgid (); #ifdef USE_GETGRNAME { struct group *gr = getgrnam ("tty"); if (gr) { /* change ownership of tty to real uid, "tty" gid */ gid = gr->gr_gid; mode = 0620; } } #endif /* USE_GETGRNAME */ privileges (RESTORE); fchown (fd, getuid (), gid); /* fail silently */ fchmod (fd, mode); privileges (IGNORE); } #endif /* __svr4__ */ /* * Close all file descriptors. If only stdin/out/err are closed, * child processes remain alive upon deletion of the window. */ { int i; for (i = 0; i < num_fds; i++) if (i != fd) close (i); } /* Reopen stdin, stdout and stderr over the tty file descriptor */ dup (fd); /* 0: stdin */ dup (fd); /* 1: stdout */ dup (fd); /* 2: stderr */ if (fd > 2) close (fd); #ifdef ultrix if ((fd = open ("/dev/tty", O_RDONLY)) >= 0) { ioctl (fd, TIOCNOTTY, 0); close (fd); } else { pid = setpgrp (0, 0); if (pid < 0) perror (rs_name); } /* no error, we could run with no tty to begin with */ #else /* ultrix */ #ifdef TIOCSCTTY ioctl (0, TIOCSCTTY, 0); #endif /* set process group */ #if defined (_POSIX_VERSION) || defined (__svr4__) tcsetpgrp (0, pid); #elif defined (TIOCSPGRP) ioctl (0, TIOCSPGRP, &pid); #endif /* svr4 problems: reports no tty, no job control */ /* # if !defined (__svr4__) && defined (TIOCSPGRP) */ close (open (ttydev, O_RDWR, 0)); /* # endif */ #endif /* ultrix */ privileges (IGNORE); return fd; } /*}}} */ /*{{{ ways to deal with getting/setting termios structure */ #ifdef HAVE_TERMIOS_H typedef struct termios ttymode_t; #ifdef TCSANOW /* POSIX */ #define GET_TERMIOS(fd,tios) tcgetattr (fd, tios) #define SET_TERMIOS(fd,tios) do {\ cfsetospeed (tios, BAUDRATE);\ cfsetispeed (tios, BAUDRATE);\ tcsetattr (fd, TCSANOW, tios);\ } while (0) #else #ifdef TIOCSETA #define GET_TERMIOS(fd,tios) ioctl (fd, TIOCGETA, tios) #define SET_TERMIOS(fd,tios) do {\ tios->c_cflag |= BAUDRATE;\ ioctl (fd, TIOCSETA, tios);\ } while (0) #else #define GET_TERMIOS(fd,tios) ioctl (fd, TCGETS, tios) #define SET_TERMIOS(fd,tios) do {\ tios->c_cflag |= BAUDRATE;\ ioctl (fd, TCSETS, tios);\ } while (0) #endif #endif #define SET_TTYMODE(fd,tios) SET_TERMIOS (fd, tios) #else /* sgtty interface */ typedef struct { struct sgttyb sg; struct tchars tc; struct ltchars lc; int line; int local; } ttymode_t; #define SET_TTYMODE(fd,tt) do { \ tt->sg.sg_ispeed = tt->sg.sg_ospeed = BAUDRATE;\ ioctl (fd, TIOCSETP, &(tt->sg));\ ioctl (fd, TIOCSETC, &(tt->tc));\ ioctl (fd, TIOCSLTC, &(tt->lc));\ ioctl (fd, TIOCSETD, &(tt->line));\ ioctl (fd, TIOCLSET, &(tt->local));\ } while (0) #endif /* HAVE_TERMIOS_H */ /*}}} */ /*{{{ debug_ttymode() */ #ifdef DEBUG_TTYMODE static void debug_ttymode (ttymode_t * ttymode) { #ifdef HAVE_TERMIOS_H /* c_iflag bits */ fprintf (stderr, "Input flags\n"); /* cpp token stringize doesn't work on all machines */ #define FOO(flag,name) \ if ((ttymode->c_iflag) & flag) fprintf (stderr, "%s ", name) /* c_iflag bits */ FOO (IGNBRK, "IGNBRK"); FOO (BRKINT, "BRKINT"); FOO (IGNPAR, "IGNPAR"); FOO (PARMRK, "PARMRK"); FOO (INPCK, "INPCK"); FOO (ISTRIP, "ISTRIP"); FOO (INLCR, "INLCR"); FOO (IGNCR, "IGNCR"); FOO (ICRNL, "ICRNL"); FOO (IXON, "IXON"); FOO (IXOFF, "IXOFF"); #ifdef IUCLC FOO (IUCLC, "IUCLC"); #endif #ifdef IXANY FOO (IXANY, "IXANY"); #endif #ifdef IMAXBEL FOO (IMAXBEL, "IMAXBEL"); #endif fprintf (stderr, "\n\n"); #undef FOO #define FOO(entry, name) \ fprintf (stderr, "%s = %#3o\n", name, ttymode->c_cc [entry]) FOO (VINTR, "VINTR"); FOO (VQUIT, "VQUIT"); FOO (VERASE, "VERASE"); FOO (VKILL, "VKILL"); FOO (VEOF, "VEOF"); FOO (VEOL, "VEOL"); #ifdef VEOL2 FOO (VEOL2, "VEOL2"); #endif #ifdef VSWTC FOO (VSWTC, "VSWTC"); #endif #ifdef VSWTCH FOO (VSWTCH, "VSWTCH"); #endif FOO (VSTART, "VSTART"); FOO (VSTOP, "VSTOP"); FOO (VSUSP, "VSUSP"); #ifdef VDSUSP FOO (VDSUSP, "VDSUSP"); #endif #ifdef VREPRINT FOO (VREPRINT, "VREPRINT"); #endif #ifdef VDISCRD FOO (VDISCRD, "VDISCRD"); #endif #ifdef VWERSE FOO (VWERSE, "VWERSE"); #endif #ifdef VLNEXT FOO (VLNEXT, "VLNEXT"); #endif fprintf (stderr, "\n\n"); #undef FOO #endif /* HAVE_TERMIOS_H */ } #endif /* DEBUG_TTYMODE */ /*}}} */ /*{{{ get_ttymode() */ static void get_ttymode (ttymode_t * tio) { #ifdef HAVE_TERMIOS_H /* * standard System V termios interface */ if (GET_TERMIOS (0, tio) < 0) { /* return error - use system defaults */ tio->c_cc[VINTR] = CINTR; tio->c_cc[VQUIT] = CQUIT; tio->c_cc[VERASE] = CERASE; tio->c_cc[VKILL] = CKILL; tio->c_cc[VSTART] = CSTART; tio->c_cc[VSTOP] = CSTOP; tio->c_cc[VSUSP] = CSUSP; #ifdef VDSUSP tio->c_cc[VDSUSP] = CDSUSP; #endif #ifdef VREPRINT tio->c_cc[VREPRINT] = CRPRNT; #endif #ifdef VDISCRD tio->c_cc[VDISCRD] = CFLUSH; #endif #ifdef VWERSE tio->c_cc[VWERSE] = CWERASE; #endif #ifdef VLNEXT tio->c_cc[VLNEXT] = CLNEXT; #endif } tio->c_cc[VEOF] = CEOF; tio->c_cc[VEOL] = VDISABLE; #ifdef VEOL2 tio->c_cc[VEOL2] = VDISABLE; #endif #ifdef VSWTC tio->c_cc[VSWTC] = VDISABLE; #endif #ifdef VSWTCH tio->c_cc[VSWTCH] = VDISABLE; #endif #if VMIN != VEOF tio->c_cc[VMIN] = 1; #endif #if VTIME != VEOL tio->c_cc[VTIME] = 0; #endif /* input modes */ tio->c_iflag = (BRKINT | IGNPAR | ICRNL | IXON #ifdef IMAXBEL | IMAXBEL #endif ); /* output modes */ tio->c_oflag = (OPOST | ONLCR); /* control modes */ tio->c_cflag = (CS8 | CREAD); /* line discipline modes */ tio->c_lflag = (ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK #if defined (ECHOCTL) && defined (ECHOKE) | ECHOCTL | ECHOKE #endif ); /* * guess an appropriate value for Backspace */ #ifdef DONT_GUESS_BACKSPACE PrivMode (1, PrivMode_BackSpace); /* always ^H */ #else PrivMode ((tio->c_cc[VERASE] == '\b'), PrivMode_BackSpace); #endif /* DONT_GUESS_BACKSPACE */ #else /* HAVE_TERMIOS_H */ /* * sgtty interface */ /* get parameters -- gtty */ if (ioctl (0, TIOCGETP, &(tio->sg)) < 0) { tio->sg.sg_erase = CERASE; /* ^H */ tio->sg.sg_kill = CKILL; /* ^U */ } tio->sg.sg_flags = (CRMOD | ECHO | EVENP | ODDP); /* get special characters */ if (ioctl (0, TIOCGETC, &(tio->tc)) < 0) { tio->tc.t_intrc = CINTR; /* ^C */ tio->tc.t_quitc = CQUIT; /* ^\ */ tio->tc.t_startc = CSTART; /* ^Q */ tio->tc.t_stopc = CSTOP; /* ^S */ tio->tc.t_eofc = CEOF; /* ^D */ tio->tc.t_brkc = -1; } /* get local special chars */ if (ioctl (0, TIOCGLTC, &(tio->lc)) < 0) { tio->lc.t_suspc = CSUSP; /* ^Z */ tio->lc.t_dsuspc = CDSUSP; /* ^Y */ tio->lc.t_rprntc = CRPRNT; /* ^R */ tio->lc.t_flushc = CFLUSH; /* ^O */ tio->lc.t_werasc = CWERASE; /* ^W */ tio->lc.t_lnextc = CLNEXT; /* ^V */ } /* get line discipline */ ioctl (0, TIOCGETD, &(tio->line)); #ifdef NTTYDISC tio->line = NTTYDISC; #endif /* NTTYDISC */ tio->local = (LCRTBS | LCRTERA | LCTLECH | LPASS8 | LCRTKIL); /* * guess an appropriate value for Backspace */ #ifdef DONT_GUESS_BACKSPACE PrivMode (1, PrivMode_BackSpace); /* always ^H */ #else PrivMode ((tio->sg.sg_erase == '\b'), PrivMode_BackSpace); #endif /* DONT_GUESS_BACKSPACE */ #endif /* HAVE_TERMIOS_H */ } /*}}} */ /*{{{ run_command() */ /* * Run the command in a subprocess and return a file descriptor for the * master end of the pseudo-teletype pair with the command talking to * the slave. */ static int run_command (char *argv[]) { ttymode_t tio; int ptyfd; /* Save and then give up any super-user privileges */ privileges (SAVE); privileges (IGNORE); ptyfd = get_pty (); if (ptyfd < 0) return -1; /* store original tty status for restoration clean_exit() -- rgg 04/12/95 */ lstat (ttydev, &ttyfd_stat); #ifdef DEBUG_CMD fprintf (stderr, "Original settings of %s are mode %o, uid %d, gid %d\n", ttydev, ttyfd_stat.st_mode, ttyfd_stat.st_uid, ttyfd_stat.st_gid); #endif /* install exit handler for cleanup */ #ifdef HAVE_ATEXIT atexit (clean_exit); #else #if defined (__sun__) on_exit (clean_exit, NULL); /* non-ANSI exit handler */ #else print_error ("no atexit(), UTMP entries can't be cleaned"); #endif #endif /* * get tty settings before fork() * and make a reasonable guess at the value for BackSpace */ get_ttymode (&tio); /* add Backspace value */ SavedModes |= (PrivateModes & PrivMode_BackSpace); /* add value for scrollBar */ if (scrollbar_visible ()) { PrivateModes |= PrivMode_scrollBar; SavedModes |= PrivMode_scrollBar; } #ifdef DEBUG_TTYMODE debug_ttymode (&tio); #endif /* spin off the command interpreter */ signal (SIGHUP, Exit_signal); #ifndef __svr4__ signal (SIGINT, Exit_signal); #endif signal (SIGQUIT, Exit_signal); signal (SIGTERM, Exit_signal); signal (SIGCHLD, Child_signal); /* need to trap SIGURG for SVR4 (Unixware) rlogin */ /* signal (SIGURG, SIG_DFL); */ cmd_pid = fork (); if (cmd_pid < 0) { print_error ("can't fork"); return -1; } if (cmd_pid == 0) /* child */ { /* signal (SIGHUP, Exit_signal); */ /* signal (SIGINT, Exit_signal); */ #ifdef HAVE_UNSETENV /* avoid passing old settings and confusing term size */ unsetenv ("LINES"); unsetenv ("COLUMNS"); /* avoid passing termcap since terminfo should be okay */ unsetenv ("TERMCAP"); #endif /* HAVE_UNSETENV */ /* establish a controlling teletype for the new session */ get_tty (); /* initialize terminal attributes */ SET_TTYMODE (0, &tio); /* become virtual console, fail silently */ if (Options & Opt_console) { #ifdef TIOCCONS unsigned int on = 1; ioctl (0, TIOCCONS, &on); #elif defined (SRIOCREDIR) int fd = open (CONSOLE, O_WRONLY); if (fd < 0 || ioctl (0, SRIOCSREDIR, fd) < 0) { if (fd >= 0) close (fd); } #endif /* SRIOCSREDIR */ } tt_winsize (0); /* set window size */ /* reset signals and spin off the command interpreter */ signal (SIGINT, SIG_DFL); signal (SIGQUIT, SIG_DFL); signal (SIGCHLD, SIG_DFL); /* * mimick login's behavior by disabling the job control signals * a shell that wants them can turn them back on */ #ifdef SIGTSTP signal (SIGTSTP, SIG_IGN); signal (SIGTTIN, SIG_IGN); signal (SIGTTOU, SIG_IGN); #endif /* SIGTSTP */ /* command interpreter path */ if (argv != NULL) { #ifdef DEBUG_CMD int i; for (i = 0; argv[i]; i++) fprintf (stderr, "argv [%d] = \"%s\"\n", i, argv[i]); #endif execvp (argv[0], argv); print_error ("can't execute \"%s\"", argv[0]); } else { const char *argv0, *shell; if ((shell = getenv ("SHELL")) == NULL || *shell == '\0') shell = "/bin/sh"; argv0 = my_basename (shell); if (Options & Opt_loginShell) { char *p = MALLOC ((strlen (argv0) + 2) * sizeof (char), argv0); p[0] = '-'; strcpy (&p[1], argv0); argv0 = p; } execlp (shell, argv0, NULL); print_error ("can't execute \"%s\"", shell); } exit (EXIT_FAILURE); } privileges (RESTORE); if (!(Options & Opt_utmpInhibit)) makeutent (ttydev, display_name); /* stamp /etc/utmp */ privileges (IGNORE); return ptyfd; } /*}}} */ /*{{{ init_command() */ void init_command (char *argv[]) { /* * Initialize the command connection. * This should be called after the X server connection is established. */ /* Enable delete window protocol */ wmDeleteWindow = XInternAtom (Xdisplay, "WM_DELETE_WINDOW", False); XSetWMProtocols (Xdisplay, TermWin.parent, &wmDeleteWindow, 1); #ifdef OFFIX_DND /* Enable OffiX Dnd (drag 'n' drop) protocol */ DndProtocol = XInternAtom (Xdisplay, "DndProtocol", False); DndSelection = XInternAtom (Xdisplay, "DndSelection", False); #endif /* OFFIX_DND */ init_xlocale (); /* get number of available file descriptors */ #ifdef _POSIX_VERSION num_fds = sysconf (_SC_OPEN_MAX); #else num_fds = getdtablesize (); #endif #ifdef META8_OPTION meta_char = (Options & Opt_meta8 ? 0x80 : 033); #endif #ifdef GREEK_SUPPORT greek_init (); #endif Xfd = XConnectionNumber (Xdisplay); cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; if ((cmd_fd = run_command (argv)) < 0) { print_error ("aborting"); exit (EXIT_FAILURE); } } /*}}} */ /*{{{ Xlocale */ /* * This is more or less stolen straight from XFree86 xterm. * This should support all European type languages. */ #ifndef NO_XLOCALE static void init_xlocale (void) { char *p, *s, buf[32], tmp[1024]; XIM xim = NULL; XIMStyle input_style = 0; XIMStyles *xim_styles = NULL; int found; Input_Context = NULL; #ifdef KANJI setlocale (LC_CTYPE, ""); #endif if (rs_inputMethod == NULL #ifndef KANJI || !*rs_inputMethod /* required ? */ #endif ) { if ((p = XSetLocaleModifiers ("@im=none")) != NULL && *p) xim = XOpenIM (Xdisplay, NULL, NULL, NULL); } else { strcpy (tmp, rs_inputMethod); for (s = tmp; *s; /*nil */ ) { char *end, *next_s; while (*s && isspace (*s)) s++; if (!*s) break; end = s; while (*end && (*end != ',')) end++; next_s = end--; while ((end >= s) && isspace (*end)) end--; *(end + 1) = '\0'; if (*s) { strcpy (buf, "@im="); strcat (buf, s); if ((p = XSetLocaleModifiers (buf)) != NULL && *p && (xim = XOpenIM (Xdisplay, NULL, NULL, NULL)) != NULL) break; } if (!*next_s) break; s = (next_s + 1); } } if (xim == NULL && (p = XSetLocaleModifiers ("")) != NULL && *p) xim = XOpenIM (Xdisplay, NULL, NULL, NULL); if (xim == NULL) { print_error ("Failed to open input method"); return; } if (XGetIMValues (xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles) { print_error ("input method doesn't support any style"); XCloseIM (xim); return; } strcpy (tmp, (rs_preeditType ? rs_preeditType : "Root")); for (found = 0, s = tmp; *s && !found; /*nil */ ) { unsigned short i; char *end, *next_s; while (*s && isspace (*s)) s++; if (!*s) break; end = s; while (*end && (*end != ',')) end++; next_s = end--; while ((end >= s) && isspace (*end)) *end-- = 0; if (!strcmp (s, "OverTheSpot")) input_style = (XIMPreeditPosition | XIMStatusArea); else if (!strcmp (s, "OffTheSpot")) input_style = (XIMPreeditArea | XIMStatusArea); else if (!strcmp (s, "Root")) input_style = (XIMPreeditNothing | XIMStatusNothing); for (i = 0; i < xim_styles->count_styles; i++) { if (input_style == xim_styles->supported_styles[i]) { found = 1; break; } } s = next_s; } XFree (xim_styles); if (found == 0) { print_error ("input method doesn't support my preedit type"); XCloseIM (xim); return; } /* * This program only understands the Root preedit_style yet * Then misc.preedit_type should default to: * "OverTheSpot,OffTheSpot,Root" * /MaF */ if (input_style != (XIMPreeditNothing | XIMStatusNothing)) { print_error ("This program only supports the \"Root\" preedit type"); XCloseIM (xim); return; } Input_Context = XCreateIC (xim, XNInputStyle, input_style, XNClientWindow, TermWin.parent, XNFocusWindow, TermWin.parent, NULL); if (Input_Context == NULL) { print_error ("Failed to create input context"); XCloseIM (xim); } } #endif /* NO_XLOCALE */ /*}}} */ /*{{{ window resizing */ /* * Tell the teletype handler what size the window is. * Called after a window size change. */ static void tt_winsize (int fd) { struct winsize ws; if (fd < 0) return; ws.ws_col = (unsigned short) TermWin.ncol; ws.ws_row = (unsigned short) TermWin.nrow; ws.ws_xpixel = ws.ws_ypixel = 0; ioctl (fd, TIOCSWINSZ, &ws); } void tt_resize (void) { tt_winsize (cmd_fd); } /*}}} */ /*{{{ Convert the keypress event into a string */ static void lookup_key (XEvent * ev) { static int numlock_state = 0; #ifdef DEBUG_CMD static int debug_key = 1; /* accessible by a debugger only */ #endif #ifdef GREEK_SUPPORT static short greek_mode = 0; #endif static XComposeStatus compose = {NULL, 0}; static unsigned char kbuf[KBUFSZ]; int ctrl, meta, shft, len; KeySym keysym; /* * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an * escape sequence to toggle the Keypad. * * Always permit `shift' to override the current setting */ shft = (ev->xkey.state & ShiftMask); ctrl = (ev->xkey.state & ControlMask); meta = (ev->xkey.state & Mod1Mask); if (numlock_state || (ev->xkey.state & Mod5Mask)) { numlock_state = (ev->xkey.state & Mod5Mask); /* numlock toggle */ PrivMode ((!numlock_state), PrivMode_aplKP); } #ifndef NO_XLOCALE if (!XFilterEvent (ev, *(&ev->xkey.window))) { if (Input_Context != NULL) { Status status_return; len = XmbLookupString (Input_Context, &ev->xkey, kbuf, sizeof (kbuf), &keysym, &status_return); } else { len = XLookupString (&ev->xkey, kbuf, sizeof (kbuf), &keysym, &compose); } } else len = 0; #else /* NO_XLOCALE */ len = XLookupString (&ev->xkey, kbuf, sizeof (kbuf), &keysym, &compose); /* * have unmapped Latin[2-4] entries -> Latin1 * good for installations with correct fonts, but without XLOCAL */ if (!len && (keysym >= 0x0100) && (keysym < 0x0400)) { len = 1; kbuf[0] = (keysym & 0xFF); } #endif /* NO_XLOCALE */ /* for some backwards compatibility */ #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) #ifdef HOTKEY_CTRL #define HOTKEY ctrl #else #ifdef HOTKEY_META #define HOTKEY meta #endif #endif if (HOTKEY) { if (keysym == ks_bigfont) { change_font (0, FONT_UP); return; } else if (keysym == ks_smallfont) { change_font (0, FONT_DN); return; } } #undef HOTKEY #endif if (shft) { /* Shift + F1 - F10 generates F11 - F20 */ if (keysym >= XK_F1 && keysym <= XK_F10) { keysym += (XK_F11 - XK_F1); shft = 0; /* turn off Shift */ } else if (!ctrl && !meta && (PrivateModes & PrivMode_ShiftKeys)) { switch (keysym) { /* normal XTerm key bindings */ case XK_Prior: /* Shift+Prior = scroll back */ if (TermWin.saveLines) { scr_page (UP, TermWin.nrow * 4 / 5); return; } break; case XK_Next: /* Shift+Next = scroll forward */ if (TermWin.saveLines) { scr_page (DN, TermWin.nrow * 4 / 5); return; } break; case XK_Insert: /* Shift+Insert = paste mouse selection */ selection_request (ev->xkey.time, ev->xkey.x, ev->xkey.y); return; break; /* rxvt extras */ case XK_KP_Add: /* Shift+KP_Add = bigger font */ change_font (0, FONT_UP); return; break; case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ change_font (0, FONT_DN); return; break; } } } switch (keysym) { case XK_Print: #ifdef DEBUG_SELECTION debug_selection (); return; #else #ifdef PRINTPIPE scr_printscreen (ctrl | shft); return; #endif #endif break; case XK_Mode_switch: #ifdef GREEK_SUPPORT greek_mode = !greek_mode; if (greek_mode) { xterm_seq (XTerm_title, (greek_getmode () == GREEK_ELOT928 ? "[Greek: iso]" : "[Greek: ibm]")); greek_reset (); } else xterm_seq (XTerm_title, APL_NAME "-" VERSION); return; #endif break; } if (keysym >= 0xFF00 && keysym <= 0xFFFF) { #ifdef KEYSYM_RESOURCE if (!(shft | ctrl) && KeySym_map[keysym - 0xFF00] != NULL) { const unsigned char *kbuf; unsigned int len; kbuf = (KeySym_map[keysym - 0xFF00]); len = *kbuf++; /* escape prefix */ if (meta #ifdef META8_OPTION && (meta_char == 033) #endif ) { const unsigned char ch = '\033'; tt_write (&ch, 1); } tt_write (kbuf, len); return; } else #endif switch (keysym) { case XK_BackSpace: len = 1; kbuf[0] = (((PrivateModes & PrivMode_BackSpace) ? !(shft | ctrl) : (shft | ctrl)) ? '\b' : '\177'); break; case XK_Tab: if (shft) { len = 3; strcpy (kbuf, "\033[Z"); } break; case XK_Home: len = strlen (strcpy (kbuf, KS_HOME)); break; case XK_Left: /* "\033[D" */ case XK_Up: /* "\033[A" */ case XK_Right: /* "\033[C" */ case XK_Down: /* "\033[B" */ len = 3; strcpy (kbuf, "\033[@"); kbuf[2] = ("DACB"[keysym - XK_Left]); if (PrivateModes & PrivMode_aplCUR) { kbuf[1] = 'O'; } /* do Shift first */ else if (shft) { kbuf[2] = ("dacb"[keysym - XK_Left]); } else if (ctrl) { kbuf[1] = 'O'; kbuf[2] = ("dacb"[keysym - XK_Left]); } break; case XK_Prior: len = 4; strcpy (kbuf, "\033[5~"); break; case XK_Next: len = 4; strcpy (kbuf, "\033[6~"); break; case XK_End: len = strlen (strcpy (kbuf, KS_END)); break; case XK_Select: len = 4; strcpy (kbuf, "\033[4~"); break; case XK_Execute: len = 4; strcpy (kbuf, "\033[3~"); break; case XK_Insert: len = 4; strcpy (kbuf, "\033[2~"); break; case XK_Menu: len = 5; strcpy (kbuf, "\033[29~"); break; case XK_Find: len = 4; strcpy (kbuf, "\033[1~"); break; case XK_Help: len = 5; strcpy (kbuf, "\033[28~"); break; case XK_KP_Enter: /* allow shift to send normal "\033OM" */ if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) { len = 1; kbuf[0] = '\r'; } else { len = 3; strcpy (kbuf, "\033OM"); } break; case XK_KP_F1: /* "\033OP" */ case XK_KP_F2: /* "\033OQ" */ case XK_KP_F3: /* "\033OR" */ case XK_KP_F4: /* "\033OS" */ len = 3; strcpy (kbuf, "\033OP"); kbuf[2] += (keysym - XK_KP_F1); break; case XK_KP_Multiply: /* "\033Oj" : "*" */ case XK_KP_Add: /* "\033Ok" : "+" */ case XK_KP_Separator: /* "\033Ol" : "," */ case XK_KP_Subtract: /* "\033Om" : "-" */ case XK_KP_Decimal: /* "\033On" : "." */ case XK_KP_Divide: /* "\033Oo" : "/" */ case XK_KP_0: /* "\033Op" : "0" */ case XK_KP_1: /* "\033Oq" : "1" */ case XK_KP_2: /* "\033Or" : "2" */ case XK_KP_3: /* "\033Os" : "3" */ case XK_KP_4: /* "\033Ot" : "4" */ case XK_KP_5: /* "\033Ou" : "5" */ case XK_KP_6: /* "\033Ov" : "6" */ case XK_KP_7: /* "\033Ow" : "7" */ case XK_KP_8: /* "\033Ox" : "8" */ case XK_KP_9: /* "\033Oy" : "9" */ /* allow shift to override 'numlock_off' */ if ((PrivateModes & PrivMode_aplKP) == 0) { /* if numlock = off, for non numerics do : */ len = 1; kbuf[0] = ('*' + (keysym - XK_KP_Multiply)); } break; case XK_KP_Left: /* "\033[D" */ case XK_KP_Up: /* "\033[A" */ case XK_KP_Right: /* "\033[C" */ case XK_KP_Down: /* "\033[B" */ len = 3; strcpy (kbuf, "\033[@"); kbuf[2] = ("DACB"[keysym - XK_KP_Left]); if (PrivateModes & PrivMode_aplCUR) { kbuf[1] = 'O'; } else if (ctrl) { kbuf[1] = 'O'; kbuf[2] = ("dacb"[keysym - XK_KP_Left]); } break; case XK_KP_Prior: len = 4; strcpy (kbuf, "\033[5~"); break; case XK_KP_Next: len = 4; strcpy (kbuf, "\033[6~"); break; case XK_KP_End: len = strlen (strcpy (kbuf, KS_END)); break; case XK_KP_Insert: len = 4; strcpy (kbuf, "\033[2~"); break; case XK_KP_Home: len = strlen (strcpy (kbuf, KS_HOME)); break; case XK_KP_Delete: len = strlen (strcpy (kbuf, KS_DELETE)); break; /* Nothing associated with case KP_Begin: at the moment ... */ #define FKEY(n,fkey) len = 5;\ sprintf (kbuf,"\033[%02d~", (int)((n) + (keysym - fkey))) case XK_F1: /* "\033[11~" */ case XK_F2: /* "\033[12~" */ case XK_F3: /* "\033[13~" */ case XK_F4: /* "\033[14~" */ case XK_F5: /* "\033[15~" */ FKEY (11, XK_F1); break; case XK_F6: /* "\033[17~" */ case XK_F7: /* "\033[18~" */ case XK_F8: /* "\033[19~" */ case XK_F9: /* "\033[20~" */ case XK_F10: /* "\033[21~" */ FKEY (17, XK_F6); break; case XK_F11: /* "\033[23~" */ case XK_F12: /* "\033[24~" */ case XK_F13: /* "\033[25~" */ case XK_F14: /* "\033[26~" */ FKEY (23, XK_F11); break; case XK_F15: /* "\033[28~" */ case XK_F16: /* "\033[29~" */ FKEY (28, XK_F15); break; case XK_F17: /* "\033[31~" */ case XK_F18: /* "\033[32~" */ case XK_F19: /* "\033[33~" */ case XK_F20: /* "\033[34~" */ case XK_F21: /* "\033[35~" */ case XK_F22: /* "\033[36~" */ case XK_F23: /* "\033[37~" */ case XK_F24: /* "\033[38~" */ case XK_F25: /* "\033[39~" */ case XK_F26: /* "\033[40~" */ case XK_F27: /* "\033[41~" */ case XK_F28: /* "\033[42~" */ case XK_F29: /* "\033[43~" */ case XK_F30: /* "\033[44~" */ case XK_F31: /* "\033[45~" */ case XK_F32: /* "\033[46~" */ case XK_F33: /* "\033[47~" */ case XK_F34: /* "\033[48~" */ case XK_F35: /* "\033[49~" */ FKEY (31, XK_F17); break; #undef FKEY #ifdef KS_DELETE case XK_Delete: len = strlen (strcpy (kbuf, KS_DELETE)); break; #endif } } else if (ctrl && keysym == XK_minus) { len = 1; kbuf[0] = '\037'; /* Ctrl-Minus generates ^_ (31) */ } else { #ifdef META8_OPTION /* set 8-bit on */ if (meta && (meta_char == 0x80)) { unsigned char *ch; for (ch = kbuf; ch < kbuf + len; ch++) *ch |= 0x80; meta = 0; } #endif #ifdef GREEK_SUPPORT if (greek_mode) len = greek_xlat (kbuf, len); #endif /*nil */ ; } if (len <= 0) return; /* not mapped */ /* * these modifications only affect the static keybuffer * pass Shift/Control indicators for function keys ending with `~' * * eg, * Prior = "ESC[5~" * Shift+Prior = "ESC[5~" * Ctrl+Prior = "ESC[5^" * Ctrl+Shift+Prior = "ESC[5@" */ if (kbuf[0] == '\033' && kbuf[1] == '[' && kbuf[len - 1] == '~') kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~')); /* escape prefix */ if (meta #ifdef META8_OPTION && (meta_char == 033) #endif ) { const unsigned char ch = '\033'; tt_write (&ch, 1); } #ifdef DEBUG_CMD if (debug_key) /* Display keyboard buffer contents */ { char *p; int i; fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int) keysym, len); for (i = 0, p = kbuf; i < len; i++, p++) fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); fprintf (stderr, "'\n"); } #endif /* DEBUG_CMD */ tt_write (kbuf, len); } /*}}} */ /*{{{ cmd_ungetc(), cmd_getc() */ static void cmd_ungetc (unsigned char ch) { if (cmdbuf_ptr > cmdbuf_base) { /* sneak one in */ cmdbuf_ptr--; *cmdbuf_ptr = ch; } else { int n = (cmdbuf_endp - cmdbuf_base); if (n > 0) { if (n == sizeof (cmdbuf_base)) { /* drop one off the end to make room */ n--; cmdbuf_endp--; } memmove ((cmdbuf_base + 1), cmdbuf_base, n); } *cmdbuf_ptr = ch; cmdbuf_endp++; } } /* attempt to `write' COUNT to the input buffer */ unsigned int cmd_write (const unsigned char *str, unsigned int count) { while (count--) cmd_ungetc (str[count]); return 0; } /* cmd_getc() - Return next input character */ /* * Return the next input character after first passing any keyboard input * to the command. */ static unsigned char cmd_getc (void) { #define TIMEOUT_USEC 5000 static short refreshed = 0; fd_set readfds; int retval; struct itimerval value; /* If there have been a lot of new lines, then update the screen * What the heck I'll cheat and only refresh less than every page-full. * the number of pages between refreshes is refresh_limit, which * is incremented here because we must be doing flat-out scrolling. * * refreshing should be correct for small scrolls, because of the * time-out */ if (refresh_count > (refresh_limit * TermWin.nrow)) { if (refresh_limit < REFRESH_PERIOD) refresh_limit++; refresh_count = 0; refreshed = 1; scr_refresh (refresh_type); } /* characters already read in */ if (cmdbuf_ptr < cmdbuf_endp) goto Return_Char; while (1) { while (XPending (Xdisplay)) /* process pending X events */ { XEvent ev; refreshed = 0; XNextEvent (Xdisplay, &ev); process_x_event (&ev); /* in case button actions pushed chars to cmdbuf */ if (cmdbuf_ptr < cmdbuf_endp) goto Return_Char; } /* Nothing to do! */ FD_ZERO (&readfds); FD_SET (cmd_fd, &readfds); FD_SET (Xfd, &readfds); value.it_value.tv_usec = TIMEOUT_USEC; value.it_value.tv_sec = 0; retval = select (num_fds, &readfds, NULL, NULL, (refreshed ? NULL : &value.it_value)); /* See if we can read from the application */ if (FD_ISSET (cmd_fd, &readfds)) { unsigned int count = sizeof (cmdbuf_base) - 1; cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; /* while (count > sizeof(cmdbuf_base) / 2) */ while (count) { int n = read (cmd_fd, cmdbuf_endp, count); if (n <= 0) break; cmdbuf_endp += n; count -= n; } /* some characters read in */ if (cmdbuf_ptr < cmdbuf_endp) goto Return_Char; } /* select statement timed out - better update the screen */ if (retval == 0) { refresh_count = 0; refresh_limit = 1; if (!refreshed) { refreshed = 1; scr_refresh (refresh_type); scrollbar_show (1); } } } return 0; Return_Char: refreshed = 0; return (*cmdbuf_ptr++); } /*}}} */ /*{{{ process an X event */ static void process_x_event (XEvent * ev) { static Time buttonpress_time; static int clicks = 0; #define clickOnce() (clicks <= 1) static int bypass_keystate = 0; int reportmode; switch (ev->type) { case KeyPress: lookup_key (ev); break; case ClientMessage: if (ev->xclient.format == 32 && ev->xclient.data.l[0] == wmDeleteWindow) exit (EXIT_SUCCESS); #ifdef OFFIX_DND /* OffiX Dnd (drag 'n' drop) protocol */ if (ev->xclient.message_type == DndProtocol && (ev->xclient.data.l[0] == DndFile) || (ev->xclient.data.l[0] == DndDir) || (ev->xclient.data.l[0] == DndLink)) { /* Get Dnd data */ Atom ActualType; int ActualFormat; unsigned char *data; unsigned long Size, RemainingBytes; XGetWindowProperty (Xdisplay, Xroot, DndSelection, 0L, 1000000L, False, AnyPropertyType, &ActualType, &ActualFormat, &Size, &RemainingBytes, &data); XChangeProperty (Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, data, strlen (data)); selection_paste (Xroot, XA_CUT_BUFFER0, True); XSetInputFocus (Xdisplay, Xroot, RevertToNone, CurrentTime); } #endif /* OFFIX_DND */ break; case MappingNotify: XRefreshKeyboardMapping (&(ev->xmapping)); break; /* Here's my conclusiion: * If the window is completely unobscured, use bitblt's * to scroll. Even then, they're only used when doing partial * screen scrolling. When partially obscured, we have to fill * in the GraphicsExpose parts, which means that after each refresh, * we need to wait for the graphics expose or Noexpose events, * which ought to make things real slow! */ case VisibilityNotify: switch (ev->xvisibility.state) { case VisibilityUnobscured: refresh_type = FAST_REFRESH; break; case VisibilityPartiallyObscured: refresh_type = SLOW_REFRESH; break; default: refresh_type = NO_REFRESH; break; } break; case FocusIn: if (!TermWin.focus) { TermWin.focus = 1; #ifndef NO_XLOCALE if (Input_Context != NULL) XSetICFocus (Input_Context); #endif } break; case FocusOut: if (TermWin.focus) { TermWin.focus = 0; #ifndef NO_XLOCALE if (Input_Context != NULL) XUnsetICFocus (Input_Context); #endif } break; case ConfigureNotify: resize_window (); menubar_expose (); break; case SelectionClear: selection_clear (); break; case SelectionNotify: selection_paste (ev->xselection.requestor, ev->xselection.property, True); break; case SelectionRequest: selection_send (&(ev->xselectionrequest)); break; case GraphicsExpose: case Expose: if (ev->xany.window == TermWin.vt) { scr_expose (ev->xexpose.x, ev->xexpose.y, ev->xexpose.width, ev->xexpose.height); } else { XEvent unused_xevent; while (XCheckTypedWindowEvent (Xdisplay, ev->xany.window, Expose, &unused_xevent)); while (XCheckTypedWindowEvent (Xdisplay, ev->xany.window, GraphicsExpose, &unused_xevent)); if (isScrollbarWindow (ev->xany.window)) { scrollbar_setNone (); scrollbar_show (0); } #ifndef NO_MENUBAR if (menubar_visible () && isMenuBarWindow (ev->xany.window)) menubar_expose (); #endif Gr_expose (ev->xany.window); } break; case ButtonPress: bypass_keystate = (ev->xbutton.state & (Mod1Mask | ShiftMask)); reportmode = (bypass_keystate ? 0 : (PrivateModes & PrivMode_mouse_report)); if (ev->xany.window == TermWin.vt) { if (ev->xbutton.subwindow != None) Gr_ButtonPress (ev->xbutton.x, ev->xbutton.y); else { if (reportmode) { if (reportmode & PrivMode_MouseX10) { /* no state info allowed */ ev->xbutton.state = 0; } #ifdef MOUSE_REPORT_DOUBLECLICK if (ev->xbutton.button == Button1) { if (ev->xbutton.time - buttonpress_time < MULTICLICK_TIME) clicks++; else clicks = 1; } #else clicks = 1; #endif /* MOUSE_REPORT_DOUBLECLICK */ mouse_report (&(ev->xbutton)); } else switch (ev->xbutton.button) { case Button1: if (ev->xbutton.time - buttonpress_time < MULTICLICK_TIME) clicks++; else clicks = 1; selection_click (clicks, ev->xbutton.x, ev->xbutton.y); break; case Button3: selection_extend (ev->xbutton.x, ev->xbutton.y); break; } buttonpress_time = ev->xbutton.time; return; } } if (isScrollbarWindow (ev->xany.window)) { scrollbar_setNone (); /* * Rxvt-style scrollbar: * move up if mouse if above slider * move dn if mouse if below slider * * XTerm-style scrollbar: * Move display proportional to pointer location * pointer near top -> scroll one line * pointer near bot -> scroll full page */ #ifndef NO_SCROLLBAR_REPORT if (reportmode) { /* * Mouse report disabled scrollbar: * arrow buttons - send up/down * click on scrollbar - send pageup/down */ if (scrollbar_upButton (ev->xbutton.y)) tt_printf ("\033[A"); else if (scrollbar_dnButton (ev->xbutton.y)) tt_printf ("\033[B"); else switch (ev->xbutton.button) { case Button2: tt_printf ("\014"); break; case Button1: tt_printf ("\033[6~"); break; case Button3: tt_printf ("\033[5~"); break; } } else #endif /* NO_SCROLLBAR_REPORT */ { if (scrollbar_upButton (ev->xbutton.y)) { /* I would like continuous scrolling */ if (scr_page (UP, 1)) scrollbar_setUp (); } else if (scrollbar_dnButton (ev->xbutton.y)) { if (scr_page (DN, 1)) scrollbar_setDn (); } else switch (ev->xbutton.button) { case Button2: #ifndef XTERM_SCROLLBAR if (scrollbar_above_slider (ev->xbutton.y) || scrollbar_below_slider (ev->xbutton.y)) #endif scr_move_to (scrollbar_position (ev->xbutton.y), scrollbar_size ()); scrollbar_setMotion (); break; case Button1: /*drop */ case Button3: #ifndef XTERM_SCROLLBAR if (scrollbar_above_slider (ev->xbutton.y)) scr_page (UP, TermWin.nrow / 4); else if (scrollbar_below_slider (ev->xbutton.y)) scr_page (DN, TermWin.nrow / 4); else scrollbar_setMotion (); #else /* XTERM_SCROLLBAR */ scr_page ((ev->xbutton.button == Button1 ? DN : UP), (TermWin.nrow * scrollbar_position (ev->xbutton.y) / scrollbar_size ()) ); #endif /* XTERM_SCROLLBAR */ break; } } return; } #ifndef NO_MENUBAR if (isMenuBarWindow (ev->xany.window)) { menubar_control (&(ev->xbutton)); return; } #endif /* NO_MENUBAR */ break; case ButtonRelease: reportmode = (bypass_keystate ? 0 : (PrivateModes & PrivMode_mouse_report)); if (scrollbar_isUpDn ()) { scrollbar_setNone (); scrollbar_show (0); } if (ev->xany.window == TermWin.vt) { if (ev->xbutton.subwindow != None) Gr_ButtonRelease (ev->xbutton.x, ev->xbutton.y); else { if (reportmode) { switch (reportmode & PrivMode_mouse_report) { case PrivMode_MouseX10: break; case PrivMode_MouseX11: ev->xbutton.state = bypass_keystate; ev->xbutton.button = AnyButton; mouse_report (&(ev->xbutton)); break; } return; } /* * dumb hack to compensate for the failure of click-and-drag * when overriding mouse reporting */ if ((PrivateModes & PrivMode_mouse_report) && (bypass_keystate) && (ev->xbutton.button == Button1) && (clickOnce ())) selection_extend (ev->xbutton.x, ev->xbutton.y); switch (ev->xbutton.button) { case Button1: case Button3: selection_make (ev->xbutton.time); break; case Button2: selection_request (ev->xbutton.time, ev->xbutton.x, ev->xbutton.y); break; } } } #ifndef NO_MENUBAR else if (isMenuBarWindow (ev->xany.window)) { menubar_control (&(ev->xbutton)); } #endif /* NO_MENUBAR */ break; case MotionNotify: #ifndef NO_MENUBAR if (isMenuBarWindow (ev->xany.window)) { menubar_control (&(ev->xbutton)); break; } #endif if ((PrivateModes & PrivMode_mouse_report) && !(bypass_keystate)) break; if (ev->xany.window == TermWin.vt) { if ((ev->xbutton.state & (Button1Mask | Button3Mask)) && clickOnce ()) { Window unused_root, unused_child; int unused_root_x, unused_root_y; unsigned int unused_mask; while (XCheckTypedWindowEvent (Xdisplay, TermWin.vt, MotionNotify, ev)); XQueryPointer (Xdisplay, TermWin.vt, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); #ifdef MOUSE_THRESHOLD /* deal with a `jumpy' mouse */ if ((ev->xmotion.time - buttonpress_time) > MOUSE_THRESHOLD) #endif selection_extend ((ev->xbutton.x), (ev->xbutton.y)); } } else if ((ev->xany.window == scrollBar.win) && scrollbar_isMotion ()) { Window unused_root, unused_child; int unused_root_x, unused_root_y; unsigned int unused_mask; while (XCheckTypedWindowEvent (Xdisplay, scrollBar.win, MotionNotify, ev)); XQueryPointer (Xdisplay, scrollBar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); scr_move_to (scrollbar_position (ev->xbutton.y), scrollbar_size ()); scr_refresh (refresh_type); refresh_count = refresh_limit = 0; scrollbar_show (1); } break; } } /*}}} */ /*{{{ tt_write(), tt_printf() - output to command */ /* * Send count characters directly to the command */ void tt_write (const unsigned char *buf, unsigned int count) { while (count > 0) { int n = write (cmd_fd, buf, count); if (n > 0) { count -= n; buf += n; } } } /* * Send printf() formatted output to the command. * Only use for small ammounts of data. */ void tt_printf (const unsigned char *fmt,...) { static unsigned char buf[256]; va_list arg_ptr; va_start (arg_ptr, fmt); vsprintf (buf, fmt, arg_ptr); va_end (arg_ptr); tt_write (buf, strlen (buf)); } /*}}} */ /*{{{ print pipe */ /*----------------------------------------------------------------------*/ #ifdef PRINTPIPE FILE * popen_printer (void) { FILE *stream = popen (rs_print_pipe, "w"); if (stream == NULL) print_error ("can't open printer pipe"); return stream; } int pclose_printer (FILE * stream) { fflush (stream); /* pclose() reported not to work on SunOS 4.1.3 */ #if defined (__sun__) /* pclose works provided SIGCHLD handler uses waitpid */ return pclose (stream); /* return fclose (stream); */ #else return pclose (stream); #endif } /* * simulate attached vt100 printer */ static void process_print_pipe (void) { const char *const escape_seq = "\033[4i"; const char *const rev_escape_seq = "i4[\033"; int index; FILE *fd; if ((fd = popen_printer ()) != NULL) { for (index = 0; index < 4; /* nil */ ) { unsigned char ch = cmd_getc (); if (ch == escape_seq[index]) index++; else if (index) for ( /*nil */ ; index > 0; index--) fputc (rev_escape_seq[index - 1], fd); if (index == 0) fputc (ch, fd); } pclose_printer (fd); } } #endif /* PRINTPIPE */ /*}}} */ /*{{{ process escape sequences */ static void process_escape_seq (void) { unsigned char ch = cmd_getc (); switch (ch) { /* case 1: do_tek_mode (); break; */ case '#': if (cmd_getc () == '8') scr_E (); break; case '(': scr_charset_set (0, cmd_getc ()); break; case ')': scr_charset_set (1, cmd_getc ()); break; case '*': scr_charset_set (2, cmd_getc ()); break; case '+': scr_charset_set (3, cmd_getc ()); break; #ifdef KANJI case '$': scr_charset_set (-2, cmd_getc ()); break; #endif case '7': scr_cursor (SAVE); break; case '8': scr_cursor (RESTORE); break; case '=': case '>': PrivMode ((ch == '='), PrivMode_aplKP); break; case '@': (void) cmd_getc (); break; case 'D': scr_index (UP); break; case 'E': scr_add_lines ("\n\r", 1, 2); break; case 'G': process_graphics (); break; case 'H': scr_set_tab (1); break; case 'M': scr_index (DN); break; /*case 'N': scr_single_shift (2); break; */ /*case 'O': scr_single_shift (3); break; */ case 'Z': tt_printf (ESCZ_ANSWER); break; /* steal obsolete ESC [ c */ case '[': process_csi_seq (); break; case ']': process_xterm_seq (); break; case 'c': scr_poweron (); break; case 'n': scr_charset_choose (2); break; case 'o': scr_charset_choose (3); break; } } /*}}} */ /*{{{ process CSI (code sequence introducer) sequences `ESC[' */ static void process_csi_seq (void) { unsigned char ch, priv; unsigned int nargs; int arg[ESC_ARGS]; nargs = 0; arg[0] = 0; arg[1] = 0; priv = 0; ch = cmd_getc (); if (ch >= '<' && ch <= '?') { priv = ch; ch = cmd_getc (); } /* read any numerical arguments */ do { int n; for (n = 0; isdigit (ch); ch = cmd_getc ()) n = n * 10 + (ch - '0'); if (nargs < ESC_ARGS) arg[nargs++] = n; if (ch == '\b') { scr_backspace (); } else if (ch == 033) { process_escape_seq (); return; } else if (ch < ' ') { scr_add_lines (&ch, 0, 1); return; } if (ch < '@') ch = cmd_getc (); } while (ch >= ' ' && ch < '@'); if (ch == 033) { process_escape_seq (); return; } else if (ch < ' ') return; switch (ch) { #ifdef PRINTPIPE case 'i': /* printing */ switch (arg[0]) { case 0: scr_printscreen (0); break; case 5: process_print_pipe (); break; } break; #endif case 'A': case 'e': /* up */ scr_gotorc ((arg[0] ? -arg[0] : -1), 0, RELATIVE); break; case 'B': /* down */ scr_gotorc ((arg[0] ? +arg[0] : +1), 0, RELATIVE); break; case 'C': case 'a': /* right */ scr_gotorc (0, (arg[0] ? +arg[0] : +1), RELATIVE); break; case 'D': /* left */ scr_gotorc (0, (arg[0] ? -arg[0] : -1), RELATIVE); break; case 'E': /* down & to first column */ scr_gotorc ((arg[0] ? +arg[0] : +1), 0, R_RELATIVE); break; case 'F': /* up & to first column */ scr_gotorc ((arg[0] ? -arg[0] : -1), 0, R_RELATIVE); break; case 'G': case '`': /* move to col */ scr_gotorc (0, (arg[0] ? +arg[0] : +1), R_RELATIVE); break; case 'd': /* move to row */ scr_gotorc ((arg[0] ? +arg[0] : +1), 0, C_RELATIVE); break; case 'H': case 'f': /* position cursor */ switch (nargs) { case 0: scr_gotorc (0, 0, 0); break; case 1: scr_gotorc ((arg[0] ? arg[0] - 1 : 0), 0, 0); break; default: scr_gotorc (arg[0] - 1, arg[1] - 1, 0); break; } break; case 'I': scr_tab (arg[0] ? +arg[0] : +1); break; case 'Z': scr_tab (arg[0] ? -arg[0] : -1); break; case 'J': scr_erase_screen (arg[0]); break; case 'K': scr_erase_line (arg[0]); break; case '@': scr_insdel_chars ((arg[0] ? arg[0] : 1), INSERT); break; case 'L': scr_insdel_lines ((arg[0] ? arg[0] : 1), INSERT); break; case 'M': scr_insdel_lines ((arg[0] ? arg[0] : 1), DELETE); break; case 'X': scr_insdel_chars ((arg[0] ? arg[0] : 1), ERASE); break; case 'P': scr_insdel_chars ((arg[0] ? arg[0] : 1), DELETE); break; case 'c': tt_printf (VT100_ANS); break; case 'm': process_sgr_mode (nargs, arg); break; case 'n': /* request for information */ switch (arg[0]) { case 5: tt_printf ("\033[0n"); break; /* ready */ case 6: scr_report_position (); break; #if defined (ENABLE_DISPLAY_ANSWER) case 7: tt_printf ("%s\n", display_name); break; #endif case 8: xterm_seq (XTerm_title, APL_NAME "-" VERSION); break; } break; case 'r': /* set top and bottom margins */ if (priv != '?') { if (nargs < 2 || arg[0] >= arg[1]) scr_scroll_region (0, 10000); else scr_scroll_region (arg[0] - 1, arg[1] - 1); break; } /* drop */ case 's': case 't': case 'h': case 'l': process_terminal_mode (ch, priv, nargs, arg); break; case 'g': switch (arg[0]) { case 0: scr_set_tab (0); break; /* delete tab */ case 3: scr_set_tab (-1); break; /* clear all tabs */ } break; case 'W': switch (arg[0]) { case 0: scr_set_tab (1); break; /* = ESC H */ case 2: scr_set_tab (0); break; /* = ESC [ 0 g */ case 5: scr_set_tab (-1); break; /* = ESC [ 3 g */ } break; } } /*}}} */ /*{{{ process xterm text parameters sequences `ESC ] Ps ; Pt BEL' */ static void process_xterm_seq (void) { unsigned char ch, string[STRING_MAX]; int arg; ch = cmd_getc (); for (arg = 0; isdigit (ch); ch = cmd_getc ()) arg = arg * 10 + (ch - '0'); if (ch == ';') { int n = 0; while ((ch = cmd_getc ()) != 007) { if ((n < sizeof (string) - 1)) { /* silently translate whitespace to space char */ if (isspace (ch)) ch = ' '; if (ch >= ' ') string[n++] = ch; } } string[n] = '\0'; xterm_seq (arg, string); } } /*}}} */ /*{{{ process DEC private mode sequences `ESC [ ? Ps mode' */ /* * mode can only have the following values: * 'l' = low * 'h' = high * 's' = save * 'r' = restore * 't' = toggle * so no need for fancy checking */ static void process_terminal_mode (int mode, int priv, unsigned int nargs, int arg[]) { unsigned int i; int state; if (nargs == 0) return; /* make lo/hi boolean */ switch (mode) { case 'l': mode = 0; break; case 'h': mode = 1; break; } switch (priv) { case 0: if (mode && mode != 1) return; /* only do high/low */ for (i = 0; i < nargs; i++) switch (arg[i]) { case 4: scr_insert_mode (mode); break; case 36: PrivMode (mode, PrivMode_BackSpace); break; /* case 38: TEK mode */ } break; #define PrivCases(bit) \ if (mode == 't') state = !(PrivateModes & bit); else state = mode;\ switch (state) {\ case 's': SavedModes |= (PrivateModes & bit); continue; break;\ case 'r': state = (SavedModes & bit) ? 1 : 0;/*drop*/\ default: PrivMode (state, bit); } case '?': for (i = 0; i < nargs; i++) switch (arg[i]) { case 1: /* application cursor keys */ PrivCases (PrivMode_aplCUR); break; /* case 2: - reset charsets to USASCII */ case 3: /* 80/132 */ PrivCases (PrivMode_132); if (PrivateModes & PrivMode_132OK) set_width (state ? 132 : 80); break; /* case 4: - smooth scrolling */ case 5: /* reverse video */ PrivCases (PrivMode_rVideo); scr_rvideo_mode (state); break; case 6: /* relative/absolute origins */ PrivCases (PrivMode_relOrigin); scr_relative_origin (state); break; case 7: /* autowrap */ PrivCases (PrivMode_Autowrap); scr_autowrap (state); break; /* case 8: - auto repeat, can't do on a per window basis */ case 9: /* X10 mouse reporting */ PrivCases (PrivMode_MouseX10); /* orthogonal */ if (PrivateModes & PrivMode_MouseX10) PrivateModes &= ~(PrivMode_MouseX11); break; #ifndef NO_MENUBAR #ifdef menuBar_esc case menuBar_esc: PrivCases (PrivMode_menuBar); map_menuBar (state); break; #endif #endif /* NO_MENUBAR */ #ifdef scrollBar_esc case scrollBar_esc: PrivCases (PrivMode_scrollBar); map_scrollBar (state); break; #endif case 25: /* visible/invisible cursor */ PrivCases (PrivMode_VisibleCursor); scr_cursor_visible (state); break; case 35: PrivCases (PrivMode_ShiftKeys); break; case 36: PrivCases (PrivMode_BackSpace); break; case 40: /* 80 <--> 132 mode */ PrivCases (PrivMode_132OK); break; case 47: /* secondary screen */ PrivCases (PrivMode_Screen); scr_change_screen (state); break; case 66: /* application key pad */ PrivCases (PrivMode_aplKP); break; case 1000: /* X11 mouse reporting */ PrivCases (PrivMode_MouseX11); /* orthogonal */ if (PrivateModes & PrivMode_MouseX11) PrivateModes &= ~(PrivMode_MouseX10); break; #if 0 case 1001: break; /* X11 mouse highlighting */ #endif } #undef PrivCases break; } } /*}}} */ /*{{{ process sgr sequences */ static void process_sgr_mode (unsigned int nargs, int arg[]) { unsigned int i; if (nargs == 0) { scr_rendition (0, ~RS_None); return; } for (i = 0; i < nargs; i++) switch (arg[i]) { case 0: scr_rendition (0, ~RS_None); break; case 1: scr_rendition (1, RS_Bold); break; case 4: scr_rendition (1, RS_Uline); break; case 5: scr_rendition (1, RS_Blink); break; case 7: scr_rendition (1, RS_RVid); break; case 22: scr_rendition (0, RS_Bold); break; case 24: scr_rendition (0, RS_Uline); break; case 25: scr_rendition (0, RS_Blink); break; case 27: scr_rendition (0, RS_RVid); break; case 30: case 31: /* set fg color */ case 32: case 33: case 34: case 35: case 36: case 37: scr_color (minColor + (arg[i] - 30), RS_Bold); break; case 39: /* default fg */ scr_color (restoreFG, RS_Bold); break; case 40: case 41: /* set bg color */ case 42: case 43: case 44: case 45: case 46: case 47: scr_color (minColor + (arg[i] - 40), RS_Blink); break; case 49: /* default bg */ scr_color (restoreBG, RS_Blink); break; } } /*}}} */ /*{{{ process Rob Nation's own graphics mode sequences */ static void process_graphics (void) { unsigned char ch, cmd = cmd_getc (); #ifndef RXVT_GRAPHICS if (cmd == 'Q') /* query graphics */ { tt_printf ("\033G0\n"); /* no graphics */ return; } /* swallow other graphics sequences until terminating ':' */ do ch = cmd_getc (); while (ch != ':'); #else int nargs; int args[NGRX_PTS]; unsigned char *text = NULL; if (cmd == 'Q') /* query graphics */ { tt_printf ("\033G1\n"); /* yes, graphics (color) */ return; } for (nargs = 0; nargs < (sizeof (args) / sizeof (args[0])) - 1; /*nil */ ) { int neg; ch = cmd_getc (); neg = (ch == '-'); if (neg || ch == '+') ch = cmd_getc (); for (args[nargs] = 0; isdigit (ch); ch = cmd_getc ()) args[nargs] = args[nargs] * 10 + (ch - '0'); if (neg) args[nargs] = -args[nargs]; nargs++; args[nargs] = 0; if (ch != ';') break; } if ((cmd == 'T') && (nargs >= 5)) { int i, len = args[4]; text = MALLOC ((len + 1) * sizeof (char), "text"); if (text != NULL) { for (i = 0; i < len; i++) text[i] = cmd_getc (); text[len] = '\0'; } } Gr_do_graphics (cmd, nargs, args, text); #endif } /*}}} */ /*{{{ Read and process output from the application */ void main_loop (void) { int ch; do { while ((ch = cmd_getc ()) == 0); /* wait for something */ if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') { /* Read a text string from the input buffer */ int nlines = 0; unsigned char *str; /* * point to the start of the string, * decrement first since already did get_com_char () */ str = --cmdbuf_ptr; while (cmdbuf_ptr < cmdbuf_endp) { ch = *cmdbuf_ptr; if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') { cmdbuf_ptr++; if (ch == '\n') { nlines++; refresh_count++; if (refresh_count > (refresh_limit * TermWin.nrow)) break; } } else /* unprintable */ { break; } } scr_add_lines (str, nlines, (cmdbuf_ptr - str)); } else { switch (ch) { case 005: tt_printf (VT100_ANS); break; /* terminal Status */ case 007: scr_bell (); break; /* bell */ case '\b': scr_backspace (); break; /* backspace */ case 013: case 014: scr_index (UP); break; /* vertical tab, form feed */ case 016: scr_charset_choose (1); break; /* shift out - acs */ case 017: scr_charset_choose (0); break; /* shift in - acs */ case 033: process_escape_seq (); break; } } } while (ch != EOF); } /*}}} */ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/Xtensions/menubar+graphics/main.h0000644000175000017500000001530011375434150021453 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: main.h */ /*{{{ notes: */ /*----------------------------------------------------------------------* * Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as you don't try * to make money out of it and you include an unaltered copy of this * message (including the copyright). * * This module has been heavily modified by R. Nation * * No additional restrictions are applied * * Additional modifications by mj olesen * No additional restrictions are applied. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ /*}}} */ #ifndef _MAIN_H #define _MAIN_H /*{{{ includes */ #include "VERSION.h" #include "config.h" #include "feature.h" #include #include #include #include /* STDC_HEADERS * don't check for these using configure, since we need them regardless. * if you don't have them -- figure a workaround. * * Sun is often reported as not being STDC_HEADERS, but it's not true * for our purposes and only generates spurious bug reports. */ #include #include #include #ifndef EXIT_SUCCESS /* missing from */ #define EXIT_SUCCESS 0 /* exit function success */ #define EXIT_FAILURE 1 /* exit function failure */ #endif #include /* Xlib, Xutil, Xresource, Xfuncproto */ #include "misc.h" /*}}} */ typedef struct { short width, height; /* window size [pixels] */ short fwidth, fheight; /* font width and height [pixels] */ short ncol, nrow; /* window size [characters] */ short focus; /* window has focus */ short saveLines; /* number of lines that fit in scrollback */ short nscrolled; /* number of line actually scrolled */ short view_start; /* scrollback view starts here */ Window parent, vt; /* parent (main) and vt100 window */ GC gc; /* GC for drawing text */ XFontStruct *font; /* main font structure */ #ifndef NO_BOLDFONT XFontStruct *boldFont; /* bold font */ #endif #ifdef KANJI XFontStruct *kanji; /* Kanji font structure */ #endif #ifdef XPM_BACKGROUND Pixmap pixmap; #ifdef XPM_BUFFERING Pixmap buf_pixmap; #endif #endif } TermWin_t; extern TermWin_t TermWin; /* gap between text and window edges (could be configurable) */ #define TermWin_internalBorder 2 #define MAX_COLS 200 #define MAX_ROWS 128 /* width of scrollBar, menuBar shadow ... don't change! */ #define SHADOW 2 /* convert pixel dimensions to row/column values */ #define Pixel2Width(x) ((x) / TermWin.fwidth) #define Pixel2Height(y) ((y) / TermWin.fheight) #define Pixel2Col(x) Pixel2Width((x) - TermWin_internalBorder) #define Pixel2Row(y) Pixel2Height((y) - TermWin_internalBorder) #define Width2Pixel(n) ((n) * TermWin.fwidth) #define Height2Pixel(n) ((n) * TermWin.fheight) #define Col2Pixel(col) (Width2Pixel(col) + TermWin_internalBorder) #define Row2Pixel(row) (Height2Pixel(row) + TermWin_internalBorder) #define TermWin_TotalWidth() (TermWin.width + 2 * TermWin_internalBorder) #define TermWin_TotalHeight() (TermWin.height + 2 * TermWin_internalBorder) extern Display *Xdisplay; #define Xscreen DefaultScreen(Xdisplay) #define Xcmap DefaultColormap(Xdisplay,Xscreen) #define Xdepth DefaultDepth(Xdisplay,Xscreen) #define Xroot DefaultRootWindow(Xdisplay) #ifdef DEBUG_DEPTH #undef Xdepth #define Xdepth DEBUG_DEPTH #endif #define Opt_console (1LU<<0) #define Opt_loginShell (1LU<<1) #define Opt_iconic (1LU<<2) #define Opt_visualBell (1LU<<3) #define Opt_mapAlert (1LU<<4) #define Opt_reverseVideo (1LU<<5) #define Opt_utmpInhibit (1LU<<6) #define Opt_scrollBar (1LU<<7) #define Opt_meta8 (1LU<<8) /* place holder used for parsing command-line options */ #define Opt_Boolean (1LU<<31) extern unsigned long Options; extern const char *display_name; extern const char *rs_name; /* client instance (resource name) */ /* * XTerm escape sequences: ESC ] Ps;Pt BEL */ #define XTerm_name 0 #define XTerm_iconName 1 #define XTerm_title 2 #define XTerm_logfile 46 /* not implemented */ #define XTerm_font 50 /* * rxvt extensions of XTerm escape sequences: ESC ] Ps;Pt BEL */ #define XTerm_Menu 10 /* set menu item */ #define XTerm_Pixmap 20 /* new bg pixmap */ #define XTerm_restoreFG 39 /* change default fg color */ #define XTerm_restoreBG 49 /* change default bg color */ /*----------------------------------------------------------------------*/ #define restoreFG 39 /* restore default fg color */ #define restoreBG 49 /* restore default bg color */ #define fgColor 0 #define bgColor 1 /* 0-7: black, red, green, yellow, blue, magenta, cyan, white */ #define minColor 2 #define maxColor (minColor+7) #define blackColor (minColor) /* 10-17: Bright black, red, green, yellow, blue, magenta, cyan, white */ #ifdef NO_BRIGHTCOLOR #define whiteColor (maxColor) #else #define minBright (maxColor+1) #define maxBright (minBright+7) #define whiteColor (maxBright) #endif #define NCOLORS (whiteColor+1) #ifdef NO_CURSORCOLOR #define NCURSOR 0 #else #define cursorColor (NCOLORS) #define cursorColor2 (cursorColor+1) #define NCURSOR 2 #endif #ifdef NO_BOLDUNDERLINE #define NBOLDULINE 0 #else #define colorBD (NCOLORS + NCURSOR) #define colorUL (colorBD+1) #define NBOLDULINE 2 #endif #ifdef XTERM_SCROLLBAR #define NSCROLLCOLORS 0 #define NSHADOWCOLORS 0 #else #define scrollColor (NCOLORS + NCURSOR + NBOLDULINE) #define topShadowColor (scrollColor + 1) #define bottomShadowColor (scrollColor + 2) #define NSCROLLCOLORS 1 #define NSHADOWCOLORS 2 #endif #define NRS_COLORS (NCOLORS + NCURSOR + NBOLDULINE + NSCROLLCOLORS) extern const char *rs_color[NRS_COLORS]; extern Pixel PixColors[NRS_COLORS + NSHADOWCOLORS]; #define NFONTS 5 extern const char *rs_font[NFONTS]; #ifdef KANJI extern const char *rs_kfont[NFONTS]; #endif #ifndef NO_BOLDFONT extern const char *rs_boldFont; #endif #ifdef PRINTPIPE extern const char *rs_print_pipe; #endif extern const char *rs_cutchars; /*{{{ prototypes */ _XFUNCPROTOBEGIN extern void map_menuBar (int /* map */ ); extern void map_scrollBar (int /* map */ ); extern void xterm_seq (int /* op */ , char * /* str */ ); /* special (internal) prefix for font commands */ #define FONT_CMD '#' #define FONT_DN "#-" #define FONT_UP "#+" extern void change_font (int /* init */ , const char * /* fontname */ ); extern void set_width (unsigned short /* ncol */ ); extern void resize_window (void); _XFUNCPROTOEND /*}}} */ #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/Xtensions/menubar+graphics/graphics.c0000644000175000017500000003104411375434150022325 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: graphics.c * * This module is all new by Rob Nation * * * Modifications by mj olesen * and Raul Garcia Garcia *----------------------------------------------------------------------*/ /*{{{ includes, defines */ #include "main.h" #ifdef HAVE_UNISTD_H #include #endif #include #include "command.h" /* for tt_printf() */ #include "debug.h" #include "graphics.h" #include "screen.h" /* commands: * 'C' = Clear * 'F' = Fill * 'G' = Geometry * 'L' = Line * 'P' = Points * 'T' = Text * 'W' = Window */ #ifndef GRX_SCALE #define GRX_SCALE 10000 #endif /*}}} */ /* extern functions referenced */ /* extern variables referenced */ /* extern variables declared here */ #ifdef RXVT_GRAPHICS /*{{{ local variables */ static int graphics_up = 0; typedef struct grcmd_t { char cmd; short color; short ncoords; int *coords; unsigned char *text; struct grcmd_t *next; } grcmd_t; typedef struct grwin_t { Window win; int x, y; unsigned int w, h; short screen; grcmd_t *graphics; struct grwin_t *prev, *next; } grwin_t; static grwin_t *gr_root = NULL; /*}}} */ /*----------------------------------------------------------------------* * local functions */ /*{{{ Gr_NewWindow() */ static void Gr_NewWindow (int nargs, int args[]) { int x, y; unsigned int w, h; Window win; grwin_t *grwin; Cursor cursor; if (nargs != 4) { print_error ("NewWindow: 4 args needed, got %d\n", nargs); return; } x = args[0] * TermWin.width / GRX_SCALE + TermWin_internalBorder; y = args[1] * TermWin.height / GRX_SCALE + TermWin_internalBorder; w = args[2] * TermWin.width / GRX_SCALE; h = args[3] * TermWin.height / GRX_SCALE; win = XCreateSimpleWindow (Xdisplay, TermWin.vt, x, y, w, h, 0, PixColors[fgColor], PixColors[bgColor]); cursor = XCreateFontCursor (Xdisplay, XC_crosshair); XDefineCursor (Xdisplay, win, cursor); XMapWindow (Xdisplay, win); XSelectInput (Xdisplay, win, ExposureMask); grwin = MALLOC (sizeof (grwin_t), "grwin"); grwin->win = win; grwin->x = x; grwin->y = y; grwin->w = w; grwin->h = h; grwin->screen = 0; grwin->prev = NULL; grwin->next = gr_root; if (grwin->next) grwin->next->prev = grwin; gr_root = grwin; grwin->graphics = NULL; graphics_up++; tt_printf ("\033W%ld\n", (long) grwin->win); } /*}}} */ /*{{{ Gr_ClearWindow() */ static void Gr_ClearWindow (grwin_t * grwin) { grcmd_t *cmd, *next; for (cmd = grwin->graphics; cmd != NULL; cmd = next) { next = cmd->next; free (cmd->coords); if (cmd->text != NULL) free (cmd->text); free (cmd); } grwin->graphics = NULL; XClearWindow (Xdisplay, grwin->win); } /*}}} */ /*{{{ Gr_Text() */ /* * arg [0] = x * arg [1] = y * arg [2] = alignment * arg [3] = strlen (text) */ static void Gr_Text (grwin_t * grwin, grcmd_t * data) { int x, y, align; if (data->ncoords < 4 || data->text == NULL || *(data->text) == '\0') return; x = data->coords[0] * grwin->w / GRX_SCALE; y = data->coords[1] * grwin->h / GRX_SCALE; align = data->coords[2]; if (align & RIGHT_TEXT) x -= XTextWidth (TermWin.font, data->text, data->coords[3]); else if (align & HCENTER_TEXT) x -= (XTextWidth (TermWin.font, data->text, data->coords[3]) >> 1); if (align & TOP_TEXT) y += TermWin.font->ascent; else if (align & BOTTOM_TEXT) y -= TermWin.font->descent; if (align & VCENTER_TEXT) y -= TermWin.font->descent + ((TermWin.font->ascent + TermWin.font->descent) >> 1); if (align & VCAPS_CENTER_TEXT) y += (TermWin.font->ascent >> 1); #ifdef XPM_BACKGROUND XClearArea (Xdisplay, grwin->win, x, y, Width2Pixel (data->coords[3]), Height2Pixel (1), 0); #endif XDrawString (Xdisplay, grwin->win, TermWin.gc, x, y, data->text, data->coords[3]); } /*}}} */ /*{{{ Gr_Geometry() */ static void Gr_Geometry (grwin_t * grwin, grcmd_t * data) { if (grwin) tt_printf ("\033G%ld %d %d %u %u %d %d %ld %ld %d\n", (long) grwin->win, grwin->x, grwin->y, grwin->w, grwin->h, TermWin.fwidth, TermWin.fheight, (long) GRX_SCALE * TermWin.fwidth / grwin->w, (long) GRX_SCALE * TermWin.fheight / grwin->h, Xdepth); else /* rxvt terminal window size */ tt_printf ("\033G0 0 0 %d %d %d %d %ld %ld %d\n", TermWin.width - 2 * TermWin_internalBorder, TermWin.height - 2 * TermWin_internalBorder, TermWin.fwidth, TermWin.fheight, (long) GRX_SCALE * TermWin.fwidth / (TermWin.width - 2 * TermWin_internalBorder), (long) GRX_SCALE * TermWin.fheight / (TermWin.height - 2 * TermWin_internalBorder), Xdepth); } /*}}} */ /*{{{ Gr_DestroyWindow() */ static void Gr_DestroyWindow (grwin_t * grwin) { grcmd_t *cmd, *next; if (grwin == NULL) return; for (cmd = grwin->graphics; cmd; cmd = next) { next = cmd->next; free (cmd->coords); if (cmd->text != NULL) free (cmd->text); free (cmd); } XDestroyWindow (Xdisplay, grwin->win); if (grwin->next != NULL) grwin->next->prev = grwin->prev; if (grwin->prev != NULL) grwin->prev->next = grwin->next; else gr_root = grwin->next; free (grwin); graphics_up--; } /*}}} */ /*{{{ Gr_Dispatch() */ static void Gr_Dispatch (grwin_t * grwin, grcmd_t * data) { int i, n; union { XPoint pt[NGRX_PTS / 2]; XRectangle rect[NGRX_PTS / 4]; } xdata; if (data->color != fgColor) { XGCValues gcv; gcv.foreground = PixColors[data->color]; XChangeGC (Xdisplay, TermWin.gc, GCForeground, &gcv); } if (grwin) switch (data->cmd) { case 'L': if (data->ncoords > 3) { for (n = i = 0; i < data->ncoords; i += 2, n++) { xdata.pt[n].x = data->coords[i] * grwin->w / GRX_SCALE; xdata.pt[n].y = data->coords[i + 1] * grwin->h / GRX_SCALE; } XDrawLines (Xdisplay, grwin->win, TermWin.gc, xdata.pt, n, CoordModeOrigin); } break; case 'P': if (data->ncoords > 3) { for (n = i = 0; i < data->ncoords; i += 2, n++) { xdata.pt[n].x = data->coords[i] * grwin->w / GRX_SCALE; xdata.pt[n].y = data->coords[i + 1] * grwin->h / GRX_SCALE; } XDrawPoints (Xdisplay, grwin->win, TermWin.gc, xdata.pt, n, CoordModeOrigin); } break; case 'F': if (data->ncoords > 0) { for (n = i = 0; i < data->ncoords; i += 4, n++) { xdata.rect[n].x = data->coords[i] * grwin->w / GRX_SCALE; xdata.rect[n].y = data->coords[i + 1] * grwin->h / GRX_SCALE; xdata.rect[n].width = ((data->coords[i + 2] - data->coords[i] + 1) * grwin->w / GRX_SCALE); xdata.rect[n].height = ((data->coords[i + 3] - data->coords[i + 1] + 1) * grwin->h / GRX_SCALE); #ifdef XPM_BACKGROUND XClearArea (Xdisplay, grwin->win, xdata.rect[n].x, xdata.rect[n].y, xdata.rect[n].width, xdata.rect[n].height, 0); #endif } XFillRectangles (Xdisplay, grwin->win, TermWin.gc, xdata.rect, n); } break; case 'T': Gr_Text (grwin, data); break; case 'C': Gr_ClearWindow (grwin); break; } if (data->color != fgColor) { XGCValues gcv; gcv.foreground = PixColors[fgColor]; XChangeGC (Xdisplay, TermWin.gc, GCForeground, &gcv); } } /*}}} */ /*{{{ Gr_Redraw() */ static void Gr_Redraw (grwin_t * grwin) { grcmd_t *cmd; for (cmd = grwin->graphics; cmd != NULL; cmd = cmd->next) Gr_Dispatch (grwin, cmd); } /*}}} */ #endif /*----------------------------------------------------------------------* * end of static functions */ #ifdef RXVT_GRAPHICS /*{{{ Gr_ButtonReport() */ void Gr_ButtonReport (int but, int x, int y) { grwin_t *grwin; for (grwin = gr_root; grwin != NULL; grwin = grwin->next) if ((x > grwin->x) && (y > grwin->y) && (x < grwin->x + grwin->w) && (y < grwin->y + grwin->h)) break; if (grwin == NULL) return; x = GRX_SCALE * (x - grwin->x) / grwin->w; y = GRX_SCALE * (y - grwin->y) / grwin->h; tt_printf ("\033%c%ld;%d;%d;\n", but, (long) grwin->win, x, y); } /*}}} */ /*{{{ Gr_do_graphics() */ void Gr_do_graphics (int cmd, int nargs, int args[], unsigned char *text) { static Window last_id = None; long win_id; grwin_t *grwin; grcmd_t *newcmd, *oldcmd; int i; if (cmd == 'W') { Gr_NewWindow (nargs, args); return; } win_id = (nargs > 0) ? (Window) args[0] : None; if ((cmd == 'G') && (win_id == None)) { Gr_Geometry (NULL, NULL); return; } if ((win_id == None) && (last_id != None)) win_id = last_id; if (win_id == None) return; grwin = gr_root; while ((grwin != NULL) && (grwin->win != win_id)) grwin = grwin->next; if (grwin == NULL) return; if (cmd == 'G') { Gr_Geometry (grwin, NULL); return; } nargs--; args++; /* skip over window id */ /* record this new command */ newcmd = MALLOC (sizeof (grcmd_t), "grcmd_t"); newcmd->ncoords = nargs; newcmd->coords = MALLOC ((newcmd->ncoords * sizeof (int)), "coords"); newcmd->next = NULL; newcmd->cmd = cmd; newcmd->color = scr_get_fgcolor (); newcmd->text = text; for (i = 0; i < newcmd->ncoords; i++) newcmd->coords[i] = args[i]; /* * If newcmd == fill, and rectangle is full window, drop all prior * commands. */ if ((newcmd->cmd == 'F') && (grwin) && (grwin->graphics)) { for (i = 0; i < newcmd->ncoords; i += 4) { if ((newcmd->coords[i] == 0) && (newcmd->coords[i + 1] == 0) && (newcmd->coords[i + 2] == GRX_SCALE) && (newcmd->coords[i + 3] == GRX_SCALE)) { /* drop previous commands */ oldcmd = grwin->graphics; while (oldcmd->next != NULL) { grcmd_t *tmp = oldcmd; oldcmd = oldcmd->next; free (tmp); } grwin->graphics = NULL; } } } /* insert new command into command list */ oldcmd = grwin->graphics; if (oldcmd == NULL) grwin->graphics = newcmd; else { while (oldcmd->next != NULL) oldcmd = oldcmd->next; oldcmd->next = newcmd; } Gr_Dispatch (grwin, newcmd); } /*}}} */ /*{{{ Gr_scroll() */ void Gr_scroll (int count) { static short prev_start = 0; grwin_t *grwin, *next; if ((count == 0) && (prev_start == TermWin.view_start)) return; prev_start = TermWin.view_start; for (grwin = gr_root; grwin != NULL; grwin = next) { next = grwin->next; grwin->y -= (count * TermWin.fheight); if ((grwin->y + grwin->h) < -(TermWin.saveLines * TermWin.fheight)) Gr_DestroyWindow (grwin); else XMoveWindow (Xdisplay, grwin->win, grwin->x, grwin->y + (TermWin.view_start * TermWin.fheight)); } } /*}}} */ /*{{{ Gr_ClearScreen() */ void Gr_ClearScreen (void) { grwin_t *grwin, *next; for (grwin = gr_root; grwin != NULL; grwin = next) { next = grwin->next; if ((grwin->screen == 0) && (grwin->y + grwin->h > 0)) { if (grwin->y >= 0) Gr_DestroyWindow (grwin); else XResizeWindow (Xdisplay, grwin->win, grwin->w, -grwin->y); } } } /*}}} */ /*{{{ Gr_ChangeScreen() */ void Gr_ChangeScreen (void) { grwin_t *grwin, *next; for (grwin = gr_root; grwin != NULL; grwin = next) { next = grwin->next; if (grwin->y + grwin->h > 0) { if (grwin->screen == 1) { XMapWindow (Xdisplay, grwin->win); grwin->screen = 0; } else { XUnmapWindow (Xdisplay, grwin->win); grwin->screen = 1; } } } } /*}}} */ /*{{{ Gr_expose() */ void Gr_expose (Window win) { grwin_t *grwin; for (grwin = gr_root; grwin != NULL; grwin = grwin->next) { if (grwin->win == win) { Gr_Redraw (grwin); break; } } } /*}}} */ /*{{{ Gr_Resize() */ void Gr_Resize (int w, int h) { grwin_t *grwin; for (grwin = gr_root; grwin != NULL; grwin = grwin->next) { if (TermWin.height != h) { grwin->y += (TermWin.height - h); XMoveWindow (Xdisplay, grwin->win, grwin->x, grwin->y + (TermWin.view_start * TermWin.fheight)); } Gr_Redraw (grwin); } } /*}}} */ /*{{{ Gr_reset() */ void Gr_reset (void) { grwin_t *grwin, *next; for (grwin = gr_root; grwin != NULL; grwin = next) { next = grwin->next; Gr_DestroyWindow (grwin); } graphics_up = 0; } /*}}} */ /*{{{ Gr_Displayed() */ int Gr_Displayed (void) { return graphics_up; } /*}}} */ #endif /* RXVT_GRAPHICS */ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/Xtensions/menubar+graphics/menubar.h0000644000175000017500000000327411375434150022167 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: menubar.h * * Copyright 1995,1996 * mj olesen Queen's Univ at Kingston * * You can do what you like with this source code provided you don't make * money from it and you include an unaltered copy of this message * (including the copyright). As usual, the author accepts no * responsibility for anything, nor does he guarantee anything whatsoever. *----------------------------------------------------------------------*/ #ifndef _MENUBAR_H #define _MENUBAR_H #include /* Xlib, Xutil, Xresource, Xfuncproto */ #include typedef struct { short state; Window win; } menuBar_t; extern menuBar_t menuBar; /*{{{ defines */ #define menuBar_margin 2 /* margin below text */ /*}}} */ /*{{{ macros */ #define menubar_visible() (menuBar.state) #define menuBar_height() (TermWin.fheight + SHADOW) #define menuBar_TotalHeight() (menuBar_height() + SHADOW + menuBar_margin) #define isMenuBarWindow(w) ((w) == menuBar.win) /*}}} */ /*{{{ prototypes */ _XFUNCPROTOBEGIN extern void menubar_control (XButtonEvent * /* ev */ ); extern void menubar_dispatch (char * /* str */ ); extern void menubar_expose (void); extern int menubar_mapping (int /* map */ ); _XFUNCPROTOEND /*}}} */ #ifdef NO_MENUBAR #define menubar_dispatch(str) ((void)0) #define menubar_expose() ((void)0) #define menubar_control(ev) ((void)0) #define menubar_mapping(map) (0) #undef menubar_visible #define menubar_visible() (0) #undef isMenuBarWindow #define isMenuBarWindow(w) (0) #endif #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/Xtensions/graphics/0000755000175000017500000000000011676216151016735 5ustar thepthepxiterm+thai-1.10/src/Xtensions/graphics/screen.c0000644000175000017500000022104211375434150020356 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: screen.c */ /*{{{ notes: */ /*----------------------------------------------------------------------* * This module is all new by Robert Nation * * * Extensive modifications by mj olesen * No additional restrictions are applied. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. * * Design of this module was heavily influenced by the original xvt * design of this module. See info relating to the original xvt elsewhere * in this package. *----------------------------------------------------------------------*/ /*}}} */ /*{{{ includes */ #include "main.h" #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_IOCTL_H #include #endif #include #include /* CARD32 */ #include "command.h" #include "debug.h" #include "graphics.h" #include "screen.h" /*}}} */ /*{{{ defines */ #define PROP_SIZE 4096 #define TABSIZE 8 /* default tab size */ /* Memory copy methods -- rgg 20/11/95 */ #define MEMCOPY memcpy /* no overlap -- rgg 04/11/95 */ /* #define MEMCOPY memmove *//* allows overlap -- rgg 04/11/95 */ /*}}} */ /*{{{ extern functions referenced */ /*}}} */ /*{{{ extern variables referenced */ /*}}} */ /*{{{ extern variables declared here */ #ifndef NO_BRIGHTCOLOR unsigned int colorfgbg = DEFAULT_RSTYLE; #endif /*}}} */ /* #define DEBUG_SCREEN */ /* to do self-check for internal screen corruption */ /* #define DEBUG_COLORS */ /* to print out current color/renditions as they change */ /*{{{ local variables */ /*----------------------------------------------------------------------* */ typedef unsigned char text_t; typedef unsigned int rend_t; static rend_t rstyle = DEFAULT_RSTYLE; #define SPACE_CHAR ' ' #ifdef OLD_COLOR_MODEL #define FILL_STYLE DEFAULT_RSTYLE #else #define FILL_STYLE (rstyle) #endif /* macro prototypes */ void ZERO_LINES (text_t *, rend_t *, int /* nlines */ ); void BLANK_FILL (text_t *, rend_t *, int /* nchars */ ); /* zero both text and rendition */ #define ZERO_LINES(ptext,prend,nlines) do {\ int n = (nlines) * (TermWin.ncol+1);\ if (n > 0) {\ memset ((ptext), 0, (n * sizeof(text_t)));\ memset ((prend), 0, (n * sizeof(rend_t)));\ }} while (0) /* fill text with spaces and fill rendition */ #define BLANK_FILL(ptext,prend,nchars) do {\ int n = (nchars);\ if (n > 0) {\ rend_t * p = prend;\ memset ((ptext), SPACE_CHAR, (n * sizeof(text_t)));\ while (n-- > 0) *p++ = FILL_STYLE;\ }} while (0) /*}}} */ /*{{{ screen_t */ /* * how the screen accounting works * * `text' contains text including the scrollback buffer. Each line is a * fixed length [TermWin.ncol+1] with the final character of each: * '\n': for wrapped lines * `\0': for non-wrapped lines * * `rend' contains rendition information (font, bold, color, etc) * * the layout: * Rows [0 .. (TermWin.saveLines-1)] == scrollback region * Rows [TermWin.saveLines .. TermWin.saveLines + (TermWin.nrow-1)] == * screen region [0 .. (TermWin.nrow-1)] * * `row', `tscroll', `bscroll' are bounded by (0, TermWin.nrow) * * `col' is bounded by (0, TermWin.ncol) * * `TermWin.saveLines' * is the maximum number of lines to save in the scrollback buffer. * This is a fixed number for any particular rxvt instance and is set * by the option `-sl' or resource `saveLines' * * `TermWin.nscrolled' * how many lines have been scrolled (saved) * 0 <= TermWin.nscrolled <= TermWin.saveLines * * `TermWin.view_start' * the offset back into the scrollback buffer for our current view * -(TermWin.nscrolled) <= TermWin.view_start <= 0 * * The selection region is defined for [0 .. (TermWin.nrow-1)], which * corresponds to the regular screen and for [-1 .. -(TermWin.nscrolled)] * which corresponds to the scrolled region. */ typedef struct { text_t *text; /* all the text, including scrollback */ rend_t *rend; /* rendition, using the `RS_' flags */ short row, col; /* cursor position */ short tscroll, bscroll; /* top/bottom of scroll region */ short charset; /* character set number [0..3] */ unsigned int flags; } screen_t; #define Screen_Relative (1<<0) /* relative origin mode flag */ #define Screen_VisibleCursor (1<<1) /* cursor visible? */ #define Screen_Autowrap (1<<2) /* auto-wrap flag */ #define Screen_Insert (1<<3) /* insert mode (vs. overstrike) */ #define Screen_WrapNext (1<<4) /* need to wrap for next char? */ #define Screen_DefaultFlags (Screen_VisibleCursor|Screen_Autowrap) static screen_t screen = {NULL, NULL, 0, 0, 0, 0, 0, Screen_DefaultFlags}; #ifdef NO_SECONDARY_SCREEN #define NSCREENS 0 #else #define NSCREENS 1 static screen_t swap_screen = {NULL, NULL, 0, 0, 0, 0, 0, Screen_DefaultFlags}; #endif /*}}} */ /*{{{ local variables */ static short current_screen = PRIMARY; static short rvideo = 0; /* reverse video */ static char *tabs = NULL; /* a 1 for a location with a tab-stop */ static text_t *linebuf = NULL; #ifdef KANJI static short multiByte = 0; #endif /* Data for save-screen */ static struct { short row, col; short charset; char charset_char; rend_t rstyle; } save = { 0, 0, 0, 'B', DEFAULT_RSTYLE }; /* This tells what's actually on the screen */ static text_t *drawn_text = NULL; static rend_t *drawn_rend = NULL; static char charsets[4] = {'B', 'B', 'B', 'B'}; /* all ascii */ /*}}} */ /*{{{ selection */ /* save selection text with '\n' line endings, but translate * '\n' to '\r' for pasting */ static struct { unsigned char *text; /* selected text */ int len; /* length of selected text */ short op; /* current operation */ #define SELECTION_CLEAR 0 #define SELECTION_BEGIN 1 #define SELECTION_INIT 2 #define SELECTION_CONT 3 #define SELECTION_DONE 4 short screen; /* which screen is being used */ struct { short row, col; } beg, end, mark; } selection = { NULL, 0, SELECTION_CLEAR, PRIMARY, { 0, 0 } , { 0, 0 } , { 0, 0 } }; /* also could add in these: * int firstr, lastr; -- firstr <= row < lastr * if trying to implement X11 mouse highlighting */ /*}}} */ /*{{{ local functions referenced */ static int scroll_text (int row1, int row2, int count); static inline void selection_check (void); /*----------------------------------------------------------------------*/ /*}}} */ /*----------------------------------------------------------------------*/ /*{{{ check_text() - check integrity of screen data structures */ #ifdef DEBUG_SCREEN static void check_text (const char *str) { int r, x; static const char *prev = "?"; fprintf (stderr, "%s\n", str); for (r = 0, x = TermWin.ncol; r < (TermWin.nrow + TermWin.saveLines); r++, x += (TermWin.ncol + 1)) { text_t final = screen.text[x]; if (final != '\0' && final != '\n') { fprintf (stderr, "%s: %s Violation on row %d\n", str, prev, x); exit (EXIT_FAILURE); } } MEM_CHECK ("check_text", str); prev = str; } #else #define check_text(a) ((void)0) #endif /* DEBUG_SCREEN */ /*}}} */ /*{{{ Kanji translation units */ #ifdef KANJI static void eucj2jis (unsigned char *str, int len) { register int i; for (i = 0; i < len; i++) str[i] &= 0x7F; } static void sjis2jis (unsigned char *str, int len) { register int i; for (i = 0; i < len; i += 2, str += 2) { unsigned char *high = str; unsigned char *low = str + 1; (*high) -= (*high > 0x9F ? 0xB1 : 0x71); *high = (*high) * 2 + 1; if (*low > 0x9E) { *low -= 0x7E; (*high)++; } else { if (*low > 0x7E) (*low)--; *low -= 0x1F; } } } static void (*kanji_decode) (unsigned char *str, int len) = eucj2jis; void set_kanji_encoding (const char *str) { if (str && *str) { if (!strcmp (str, "sjis")) kanji_decode = sjis2jis; else if (!strcmp (str, "eucj")) kanji_decode = eucj2jis; } } #endif /* KANJI */ /*}}} */ /*{{{ blank_lines() - add COUNT blank lines in the fill rendition style */ static inline void blank_lines (text_t * text, rend_t * rend, int count) { int r; if (count <= 0) return; /* fill with blank lines */ BLANK_FILL (text, rend, (count * (TermWin.ncol + 1))); /* terminate each line */ text += (TermWin.ncol); for (r = 0; r < count; r++, text += (TermWin.ncol + 1)) *text = '\0'; } /*}}} */ /*{{{ Reset the screen */ /* * called whenever the screen needs to be repaired due * to re-sizing or initialization */ void scr_reset (void) { static short prev_nrow = -1, prev_ncol = -1; int i, ncol = 0; TermWin.view_start = 0; if (prev_ncol == TermWin.ncol && prev_nrow == TermWin.nrow) return; #ifdef DEBUG_SCREEN fprintf (stderr, "reset\n"); #endif /* In case rows/columns are invalid */ if (TermWin.ncol <= 0) TermWin.ncol = 80; if (TermWin.nrow <= 0) TermWin.nrow = 24; #ifndef min #define min(a,b) (((a)<(b)) ? (a) : (b)) #define max(a,b) (((a)>(b)) ? (a) : (b)) #endif ncol = min (prev_ncol, TermWin.ncol); if (prev_nrow < 0) TermWin.nscrolled = 0; for (i = 0; i <= NSCREENS; i++) { text_t *old_text; rend_t *old_rend; int r, oldr, oldr_max; int histsize = TermWin.saveLines; screen_t *scr = &screen; /* allocate space for scrollback (primary screen) + screen */ #if NSCREENS if (i) { histsize = 0; scr = &swap_screen; } #endif /* copy from old buffer to new buffer, as appropriate. */ oldr = oldr_max = prev_nrow; if (prev_nrow > 0) { int n = (TermWin.nrow - prev_nrow); if (n > 0) /* window made taller */ { oldr = (TermWin.nrow); if (histsize) { if (n <= TermWin.nscrolled) /* enough */ { scr->row += (n); oldr = oldr_max; } else { scr->row += (TermWin.nscrolled); oldr -= (TermWin.nscrolled); } TermWin.nscrolled -= (n); } } else if (n < 0) /* window made shorter */ { if (scr->row < TermWin.nrow) { oldr_max = TermWin.nrow; } else /* put extra into scrolled */ { oldr_max = (scr->row + 1); if (histsize) TermWin.nscrolled += (oldr_max - TermWin.nrow); } oldr = oldr_max; } oldr_max += histsize; oldr += histsize; oldr--; } if (scr->row < 0) scr->row = 0; else if (scr->row >= TermWin.nrow) scr->row = (TermWin.nrow - 1); if (scr->col < 0) scr->col = 0; else if (scr->col >= TermWin.ncol) scr->col = (TermWin.ncol - 1); /* reset scroll regions */ scr->tscroll = 0; scr->bscroll = (TermWin.nrow - 1); old_text = scr->text; old_rend = scr->rend; scr->text = MALLOC (((histsize + TermWin.nrow) * (TermWin.ncol + 1)) * sizeof (text_t), "text"); scr->rend = MALLOC (((histsize + TermWin.nrow) * (TermWin.ncol + 1)) * sizeof (rend_t), "rend"); blank_lines (scr->text, scr->rend, (histsize + TermWin.nrow)); if (ncol > 0) { for (r = (TermWin.nrow + histsize - 1); r >= 0 && oldr >= 0; r--, oldr--) { if (oldr < oldr_max) { int roffset = r * (TermWin.ncol + 1); int oroffset = oldr * (prev_ncol + 1); memcpy (&scr->text[roffset], &old_text[oroffset], ncol * sizeof (text_t)); memcpy (&scr->rend[roffset], &old_rend[oroffset], ncol * sizeof (rend_t)); } } } FREE (old_text, "scr_reset", "scr_reset"); FREE (old_rend, "scr_reset", "scr_reset"); } /* Make sure the cursor is on the screen */ if (TermWin.nscrolled < 0) TermWin.nscrolled = 0; else if (TermWin.nscrolled > TermWin.saveLines) TermWin.nscrolled = TermWin.saveLines; prev_ncol = TermWin.ncol; prev_nrow = TermWin.nrow; drawn_text = REALLOC (drawn_text, (TermWin.nrow * (TermWin.ncol + 1)) * sizeof (text_t), "drawn_text"); drawn_rend = REALLOC (drawn_rend, (TermWin.nrow * (TermWin.ncol + 1)) * sizeof (rend_t), "drawn_rend"); ZERO_LINES (drawn_text, drawn_rend, TermWin.nrow); /* ensure the cursor is on the screen */ if (save.row >= TermWin.nrow) save.row = (TermWin.nrow - 1); if (save.col >= TermWin.ncol) save.col = (TermWin.ncol - 1); tabs = REALLOC (tabs, TermWin.ncol * sizeof (char), "tabs"); linebuf = REALLOC (linebuf, (TermWin.ncol + 1) * sizeof (text_t), "linebuf"); memset (tabs, 0, TermWin.ncol * sizeof (char)); #if TABSIZE for (i = 0; i < TermWin.ncol; i += TABSIZE) tabs[i] = 1; #endif tt_resize (); } /*}}} */ /*{{{ Restore power-on configuration */ /* * Clears screen, restores default fonts, etc * * also reset the scrollback buffer */ void scr_poweron (void) { screen_t *scr = &screen; int i; TermWin.view_start = 0; TermWin.nscrolled = 0; /* xterm doesn't do this */ memset (charsets, 'B', sizeof (charsets)); rvideo = 0; scr_rendition (0, ~RS_None); #if NSCREENS scr_change_screen (SECONDARY); scr_erase_screen (2); #endif scr_change_screen (PRIMARY); scr_erase_screen (2); for (i = 0; i <= NSCREENS; i++) { scr->tscroll = 0; scr->bscroll = (TermWin.nrow - 1); scr->row = scr->col = 0; scr->charset = 0; scr->flags = Screen_DefaultFlags; #if NSCREENS scr = &swap_screen; #endif } scr_cursor (SAVE); ZERO_LINES (drawn_text, drawn_rend, TermWin.nrow); scr_reset (); XClearWindow (Xdisplay, TermWin.vt); scr_refresh (SLOW_REFRESH); Gr_reset (); } /*}}} */ /*{{{ Set the rstyle parameter to reflect the selected font */ static inline void set_font_style (void) { rstyle &= ~RS_fontMask; switch (charsets[screen.charset]) { /* DEC Special Character and Line Drawing Set */ case '0': rstyle |= RS_acsFont; break; /* United Kingdom (UK) */ case 'A': rstyle |= RS_ukFont; break; /* United States (USASCII) */ /* case 'B': break; *//* ascii */ /* <: Multinational character set */ /* 5: Finnish character set */ /* C: Finnish character set */ /* K: German character set */ } } /*}}} */ /*{{{ Save/restore the cursor position and rendition style */ void scr_cursor (int mode) { #ifdef DEBUG_COLORS debug_colors (); #endif switch (mode) { case SAVE: save.row = screen.row; save.col = screen.col; save.rstyle = rstyle; save.charset = screen.charset; save.charset_char = charsets[save.charset]; break; case RESTORE: screen.row = save.row; screen.col = save.col; rstyle = save.rstyle; screen.charset = save.charset; charsets[screen.charset] = save.charset_char; set_font_style (); break; } #ifdef DEBUG_COLORS debug_colors (); #endif } /*}}} */ /*{{{ Change between the main and alternate screen */ int scr_change_screen (int scrn) { register int x; TermWin.view_start = 0; if (current_screen == scrn) return current_screen; else { int tmp; tmp = current_screen; current_screen = scrn; scrn = tmp; } #if NSCREENS check_text ("change screen"); /* swap screens, but leave scrollback untouched */ { const int count = (TermWin.nrow) * (TermWin.ncol + 1); const int roffset = (TermWin.saveLines) * (TermWin.ncol + 1); text_t *text = &screen.text[roffset]; rend_t *rend = &screen.rend[roffset]; for (x = 0; x < count; x++) { register text_t t; register rend_t r; t = text[x]; text[x] = swap_screen.text[x]; swap_screen.text[x] = t; r = rend[x]; rend[x] = swap_screen.rend[x]; swap_screen.rend[x] = r; } } x = screen.row; screen.row = swap_screen.row; swap_screen.row = x; x = screen.col; screen.col = swap_screen.col; swap_screen.col = x; x = screen.charset; screen.charset = swap_screen.charset; swap_screen.charset = x; x = screen.flags; screen.flags = swap_screen.flags; swap_screen.flags = x; screen.flags |= Screen_VisibleCursor; swap_screen.flags |= Screen_VisibleCursor; if (Gr_Displayed ()) { Gr_scroll (0); Gr_ChangeScreen (); } #else /* put contents of secondary screen into the scrollback */ if (Gr_Displayed ()) Gr_ClearScreen (); else if (current_screen == PRIMARY) scroll_text (0, (TermWin.nrow - 1), TermWin.nrow); #endif return scrn; } /*}}} */ /*{{{ debug_colors() */ #ifdef DEBUG_COLORS static void debug_colors (void) { int color; char *name[] = {"fg", "bg", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white"}; fprintf (stderr, "Color ( "); if (rstyle & RS_RVid) fprintf (stderr, "rvid "); if (rstyle & RS_Bold) fprintf (stderr, "bold "); if (rstyle & RS_Blink) fprintf (stderr, "blink "); if (rstyle & RS_Uline) fprintf (stderr, "uline "); fprintf (stderr, "): "); color = GET_FGCOLOR (rstyle); #ifndef NO_BRIGHTCOLOR if (color >= minBright && color <= maxBright) { color -= (minBright - minColor); fprintf (stderr, "bright "); } #endif fprintf (stderr, "%s on ", name[color]); color = GET_BGCOLOR (rstyle); #ifndef NO_BRIGHTCOLOR if (color >= minBright && color <= maxBright) { color -= (minBright - minColor); fprintf (stderr, "bright "); } #endif fprintf (stderr, "%s\n", name[color]); } #else #define debug_colors() ((void)0) #endif /* DEBUG_COLORS */ /*}}} */ /*{{{ Set foreground/background text color */ /* * Intensity: * RS_Bold = foreground * RS_Blink = background */ void scr_color (unsigned int color, unsigned int Intensity) { switch (color) { case restoreFG: color = fgColor; assert (Intensity == RS_Bold); break; case restoreBG: color = bgColor; assert (Intensity == RS_Blink); break; default: if (Xdepth <= 2) /* Monochrome - ignore color changes */ { switch (Intensity) { case RS_Bold: color = fgColor; break; case RS_Blink: color = bgColor; break; } } #ifndef NO_BRIGHTCOLOR else { if ((rstyle & Intensity) && color >= minColor && color <= maxColor) color += (minBright - minColor); else if (color >= minBright && color <= maxBright) { if (rstyle & Intensity) return; /* already bold enough! */ color -= (minBright - minColor); } } #endif /* NO_BRIGHTCOLOR */ break; } switch (Intensity) { case RS_Bold: rstyle = SET_FGCOLOR (rstyle, color); break; case RS_Blink: rstyle = SET_BGCOLOR (rstyle, color); break; } debug_colors (); } #ifdef RXVT_GRAPHICS /* return the current foreground/background colors */ inline int scr_get_fgcolor (void) { return GET_FGCOLOR (rstyle); } inline int scr_get_bgcolor (void) { return GET_BGCOLOR (rstyle); } #endif /*}}} */ /*{{{ Change the rendition style */ void scr_rendition (int set, int style) { unsigned int color; debug_colors (); if (set) { rstyle |= style; /* set rendition */ switch (style) { #ifndef NO_BRIGHTCOLOR case RS_Bold: color = GET_FGCOLOR (rstyle); scr_color ((color == fgColor ? GET_FGCOLOR (colorfgbg) : color), RS_Bold); break; case RS_Blink: color = GET_BGCOLOR (rstyle); scr_color ((color == bgColor ? GET_BGCOLOR (colorfgbg) : color), RS_Blink); break; #endif /* NO_BRIGHTCOLOR */ case RS_RVid: if (rvideo) rstyle &= ~(RS_RVid); /* reverse video mode */ break; } } else { rstyle &= ~(style); /* unset rendition */ switch (style) { case ~RS_None: /* default fg/bg colors */ rstyle = DEFAULT_RSTYLE; if (rvideo) rstyle |= RS_RVid; /* reverse video mode */ break; #ifndef NO_BRIGHTCOLOR case RS_Bold: color = GET_FGCOLOR (rstyle); if (color >= minBright && color <= maxBright) { scr_color (color, RS_Bold); /* scr_color (color - (minBright - minColor), RS_Bold); */ if ((rstyle & RS_fgMask) == (colorfgbg & RS_fgMask)) scr_color (restoreFG, RS_Bold); } break; case RS_Blink: color = GET_BGCOLOR (rstyle); if (color >= minBright && color <= maxBright) { scr_color (color, RS_Blink); /* scr_color (color - (minBright - minColor), RS_Blink); */ if ((rstyle & RS_bgMask) == (colorfgbg & RS_bgMask)) scr_color (restoreBG, RS_Blink); } break; #endif /* NO_BRIGHTCOLOR */ case RS_RVid: if (rvideo) rstyle |= RS_RVid; /* reverse video mode */ break; } } debug_colors (); } /*}}} */ /*{{{ Add lines */ void scr_add_lines (const unsigned char *str, int nlines, int cnt) { int i, roffset; /* row offset */ #ifdef KANJI enum { SBYTE, WBYTE1, WBYTE2 } chstat = SBYTE; #endif TermWin.view_start = 0; check_text ("add lines"); if (selection.op) selection_check (); /* do scrolling up front, most of the time */ if (nlines > 0) { nlines += (screen.row - screen.bscroll); if ((nlines > 0) && (screen.tscroll == 0) && (screen.bscroll == (TermWin.nrow - 1))) { scroll_text (screen.tscroll, screen.bscroll, nlines); /* add text into the scrollback buffer */ screen.row -= nlines; if (screen.row < -TermWin.saveLines) screen.row = -TermWin.saveLines; } } if (screen.col >= TermWin.ncol) screen.col = (TermWin.ncol - 1); roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); for (i = 0; i < cnt; i++) { /* * Adds a single character at the current cursor location * new lines in the string */ if (Gr_Displayed ()) Gr_scroll (0); #ifdef KANJI switch (chstat) #endif { #ifdef KANJI case WBYTE1: break; /* never happens? */ case WBYTE2: rstyle |= RS_kanjiMask; chstat = SBYTE; break; case SBYTE: if (multiByte || (str[i] & 0x80)) { rstyle &= ~RS_kanjiMask; rstyle |= RS_kanji1; chstat = WBYTE2; } else #endif /* KANJI */ switch (str[i]) { case 127: continue; break; case '\t': scr_tab (1); continue; break; case '\n': screen.flags &= ~Screen_WrapNext; screen.text[roffset + (TermWin.ncol)] = '\0'; if (screen.row == screen.bscroll) scroll_text (screen.tscroll, screen.bscroll, 1); else if (screen.row < (TermWin.nrow - 1)) { screen.row++; roffset = ((screen.row + TermWin.saveLines) * (TermWin.ncol + 1)); } continue; break; case '\r': screen.col = 0; screen.flags &= ~Screen_WrapNext; screen.text[roffset + (TermWin.ncol)] = '\0'; continue; break; default: #ifdef KANJI rstyle &= ~(RS_kanjiMask); #endif break; } } if (screen.flags & Screen_WrapNext) { screen.text[roffset + (TermWin.ncol)] = '\n'; /* wrap line */ if (screen.row == screen.bscroll) scroll_text (screen.tscroll, screen.bscroll, 1); else if (screen.row < (TermWin.nrow - 1)) { screen.row++; roffset = ((screen.row + TermWin.saveLines) * (TermWin.ncol + 1)); } screen.col = 0; screen.flags &= ~Screen_WrapNext; } if (screen.flags & Screen_Insert) scr_insdel_chars (1, INSERT); screen.text[roffset + (screen.col)] = str[i]; screen.rend[roffset + (screen.col)] = rstyle; screen.col++; if (screen.col == TermWin.ncol) { screen.col--; if (screen.flags & Screen_Autowrap) screen.flags |= Screen_WrapNext; else screen.flags &= ~Screen_WrapNext; } } } /*}}} */ /*{{{ Scroll text on the screen */ /* * Scroll COUNT lines from ROW1 to ROW2 inclusive (ROW1 <= ROW2) * scrolling is up for a +ve COUNT and down for a -ve COUNT */ static int scroll_text (int row1, int row2, int count) { int r; text_t *t_dst, *t_src; rend_t *r_dst, *r_src; if (selection.op) /* move selected region too */ { selection.beg.row -= count; selection.end.row -= count; selection.mark.row -= count; /* * could check ranges here and make sure selection is okay * don't scroll into scrollback depending on the region etc, * but leave for now */ } if (count > 0) /* scroll up */ { int n, x; /* if the line scrolls off the top of the screen, * shift the entire scrollback buffer too */ if ((row1 == 0) && (current_screen == PRIMARY)) { row1 = -TermWin.saveLines; TermWin.nscrolled += count; if (TermWin.nscrolled > TermWin.saveLines) TermWin.nscrolled = TermWin.saveLines; } x = ((row1 + TermWin.saveLines) * (TermWin.ncol + 1)); t_dst = &screen.text[x]; r_dst = &screen.rend[x]; n = (row2 - row1 + 1); if (count > n) { count = n; n = 0; } else { n -= count; } x += count * (TermWin.ncol + 1); t_src = &screen.text[x]; r_src = &screen.rend[x]; /* Forward overlapping memcpy's -- probably OK */ if (n > 0) { n *= (TermWin.ncol + 1); MEMCOPY (t_dst, t_src, n * sizeof (text_t)); MEMCOPY (r_dst, r_src, n * sizeof (rend_t)); t_dst += n; r_dst += n; } #if 0 /* this destroys the '\n' mark for the autowrapped lines */ *(t_dst - 1) = '\0'; /* terminate previous line */ #endif /* copy blank lines in at the bottom */ blank_lines (t_dst, r_dst, count); } else if (count < 0) /* scroll down */ { int x; /* do one line at a time to avoid backward overlapping memcpy's */ x = (row2 + TermWin.saveLines) * (TermWin.ncol + 1); t_dst = &screen.text[x]; r_dst = &screen.rend[x]; x += (count) * (TermWin.ncol + 1); t_src = &screen.text[x]; r_src = &screen.rend[x]; for (r = row2; r >= (row1 - count); r--) { MEMCOPY (t_dst, t_src, (TermWin.ncol + 1) * sizeof (text_t)); t_dst -= (TermWin.ncol + 1); t_src -= (TermWin.ncol + 1); MEMCOPY (r_dst, r_src, (TermWin.ncol + 1) * sizeof (rend_t)); r_dst -= (TermWin.ncol + 1); r_src -= (TermWin.ncol + 1); } /* copy blank lines in at the top */ for (; r >= row1; r--) { BLANK_FILL (t_dst, r_dst, TermWin.ncol); t_dst[TermWin.ncol] = '\0'; t_dst -= (TermWin.ncol + 1); r_dst -= (TermWin.ncol + 1); } } if (Gr_Displayed ()) Gr_scroll (count); return count; } /*}}} */ /*{{{ Handle a backspace */ void scr_backspace (void) { check_text ("backspace"); if (selection.op) selection_check (); if (screen.col == 0 && screen.row > 0) { screen.row--; screen.col = (TermWin.ncol - 1); } else if (screen.flags & Screen_WrapNext) { int roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); screen.text[roffset + (TermWin.ncol)] = '\0'; screen.flags &= ~Screen_WrapNext; } else scr_gotorc (0, -1, RELATIVE); } /*}}} */ /*{{{ Move the cursor to a new tab position */ /* * COUNT is +ve, move forward. COUNT is -ve, move backward */ void scr_tab (int count) { int x = screen.col; if (count > 0) /* tab forward */ { int i; for (i = x + 1; i < TermWin.ncol; i++) { if (tabs[i]) { x = i; count--; if (!count) break; } } } else if (count < 0) /* tab backward */ { int i; count = -count; for (i = x - 1; i >= 0; i--) { if (tabs[i]) { x = i; count--; if (!count) break; } } } else return; if (x != screen.col) scr_gotorc (0, x, R_RELATIVE); } /*}}} */ /*{{{ Move the cursor to a new position */ /* * The relative argument is a pair of flags that specify relative * rather than absolute motion. */ void scr_gotorc (int row, int col, int relative) { TermWin.view_start = 0; if (Gr_Displayed ()) Gr_scroll (0); screen.col = (relative & C_RELATIVE ? (screen.col + col) : col); if (screen.col < 0) screen.col = 0; else if (screen.col >= TermWin.ncol) screen.col = (TermWin.ncol - 1); if (screen.flags & Screen_WrapNext) { int roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); screen.text[roffset + (TermWin.ncol)] = '\0'; screen.flags &= ~Screen_WrapNext; } if (relative & R_RELATIVE) { if (row > 0) { if ((screen.row <= screen.bscroll) && (screen.row + row > screen.bscroll)) screen.row = screen.bscroll; else screen.row += row; } else if (row < 0) { if ((screen.row >= screen.tscroll) && (screen.row + row < screen.tscroll)) screen.row = screen.tscroll; else screen.row += row; } } else { if (screen.flags & Screen_Relative) /* relative origin mode */ { screen.row = row + screen.tscroll; if (screen.row > screen.bscroll) screen.row = screen.bscroll; } else screen.row = row; } if (screen.row < 0) screen.row = 0; else if (screen.row >= TermWin.nrow) screen.row = (TermWin.nrow - 1); } /*}}} */ /*{{{ Move the cursor down one line and scroll if necessary */ void scr_index (int dirn) { TermWin.view_start = 0; if (Gr_Displayed ()) Gr_scroll (0); check_text ("index"); if (screen.flags & Screen_WrapNext) { int roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); screen.text[roffset + (TermWin.ncol)] = '\0'; screen.flags &= ~Screen_WrapNext; } if ((screen.row == screen.bscroll && dirn == UP) || (screen.row == screen.tscroll && dirn == DN)) scroll_text (screen.tscroll, screen.bscroll, dirn); else screen.row += dirn; if (selection.op) selection_check (); } /*}}} */ /*{{{ Erase part or the whole of a line */ void scr_erase_line (int mode) { int count, roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); TermWin.view_start = 0; if (Gr_Displayed ()) Gr_scroll (0); if (screen.flags & Screen_WrapNext) { screen.text[roffset + (TermWin.ncol)] = '\0'; screen.flags &= ~Screen_WrapNext; } switch (mode) { case 0: /* erase to end */ check_text ("erase line End"); roffset += (screen.col); count = (TermWin.ncol - screen.col); break; case 1: /* erase to beginning */ check_text ("erase line Start"); count = (screen.col + 1); break; case 2: /* erase entire */ check_text ("erase line Entire"); count = (TermWin.ncol); break; default: check_text ("erase line None"); return; } BLANK_FILL (&screen.text[roffset], &screen.rend[roffset], count); check_text ("erase line Done"); if (selection.op) selection_check (); } /*}}} */ /*{{{ Erase part or the whole of the screen */ void scr_erase_screen (int mode) { int count, roffset = (TermWin.saveLines) * (TermWin.ncol + 1); TermWin.view_start = 0; switch (mode) { case 0: /* erase to end */ check_text ("erase screen End"); scr_erase_line (0); count = (TermWin.nrow - (screen.row + 1)); roffset += ((screen.row + 1) * (TermWin.ncol + 1)); break; case 1: /* erase to beginning */ check_text ("erase screen Start"); scr_erase_line (1); count = screen.row; break; case 2: /* erase entire */ check_text ("erase screen Entire"); Gr_ClearScreen (); count = TermWin.nrow; break; default: check_text ("erase screen None"); return; break; } blank_lines (&screen.text[roffset], &screen.rend[roffset], count); check_text ("erase screen Done"); } /*}}} */ /*{{{ Fill screen with E's */ void scr_E (void) { int r, roffset = (TermWin.saveLines) * (TermWin.ncol + 1); check_text ("E"); TermWin.view_start = 0; memset (&screen.text[roffset], 'E', ((TermWin.nrow) * (TermWin.ncol + 1)) * sizeof (text_t)); for (r = 0; r < (TermWin.nrow); r++, roffset += (TermWin.ncol + 1)) screen.text[roffset + TermWin.ncol] = '\0'; } /*}}} */ /*{{{ Insert or Delete COUNT lines and scroll */ /* * insdel == +1 * delete lines, scroll up the bottom of the screen to fill the gap * insdel == -1 * insert lines, scroll down the lower lines * other values of insdel are undefined */ void scr_insdel_lines (int count, int insdel) { check_text ("insdel lines"); if (screen.row > screen.bscroll) return; if (count > (screen.bscroll - screen.row + 1)) { if (insdel == DELETE) return; else if (insdel == INSERT) count = (screen.bscroll - screen.row + 1); } TermWin.view_start = 0; if (Gr_Displayed ()) Gr_scroll (0); if (screen.flags & Screen_WrapNext) { int roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); screen.text[roffset + (TermWin.ncol)] = '\0'; screen.flags &= ~Screen_WrapNext; } scroll_text (screen.row, screen.bscroll, insdel * count); } /*}}} */ /*{{{ Insert or Delete COUNT characters from the current position */ /* * insdel == +2, erase chars * insdel == +1, delete chars * insdel == -1, insert chars */ void scr_insdel_chars (int count, int insdel) { int roffset = (screen.row + TermWin.saveLines) * (TermWin.ncol + 1); text_t *text, *textend; rend_t *rend, *rendend; check_text ("insdel chars"); if (insdel == ERASE) { if (count > screen.col) count = screen.col; if (count <= 0) return; screen.col -= count; /* move backwards */ insdel = DELETE; /* delete chars */ } else if (count > (TermWin.ncol - screen.col)) { count = (TermWin.ncol - screen.col); } if (count <= 0) return; TermWin.view_start = 0; if (Gr_Displayed ()) Gr_scroll (0); if (selection.op) selection_check (); screen.text[roffset + (TermWin.ncol)] = '\0'; screen.flags &= ~Screen_WrapNext; text = &screen.text[roffset + (screen.col)]; rend = &screen.rend[roffset + (screen.col)]; if (insdel == DELETE) { /* overlapping copy */ for ( /*nil */ ; (*text && text[count]); text++, rend++) { *text = text[count]; *rend = rend[count]; } /* fill in the end of the line */ for ( /*nil */ ; *text; text++, rend++) { *text = SPACE_CHAR; *rend = FILL_STYLE; } } else { /* INSERT count characters */ textend = &screen.text[roffset + (TermWin.ncol - 1)]; rendend = &screen.rend[roffset + (TermWin.ncol - 1)]; for ( /*nil */ ; (textend - count >= text); textend--, rendend--) { *textend = *(textend - count); *rendend = *(rendend - count); } /* fill in the gap */ for ( /*nil */ ; (textend >= text); textend--, rendend--) { *textend = SPACE_CHAR; *rendend = FILL_STYLE; } } } /*}}} */ /*{{{ Set the scroll region */ void scr_scroll_region (int top, int bot) { if (top < 0) top = 0; if (bot >= TermWin.nrow) bot = (TermWin.nrow - 1); if (top > bot) return; screen.tscroll = top; screen.bscroll = bot; scr_gotorc (0, 0, 0); } /*}}} */ /*{{{ set visible/invisible cursor */ void scr_cursor_visible (int mode) { if (mode) screen.flags |= Screen_VisibleCursor; else screen.flags &= ~Screen_VisibleCursor; } /*}}} */ /*{{{ Set/Unset automatic wrapping */ void scr_autowrap (int mode) { if (mode) screen.flags |= Screen_Autowrap; else screen.flags &= ~Screen_Autowrap; } /*}}} */ /*{{{ Set/Unset margin origin mode */ /* * In absolute origin mode, line numbers are counted relative to top margin * of screen, the cursor can be moved outside the scrolling region. In * relative mode line numbers are relative to top margin of scrolling * region and the cursor cannot be moved outside */ void scr_relative_origin (int mode) { if (mode) screen.flags |= Screen_Relative; else screen.flags &= ~Screen_Relative; scr_gotorc (0, 0, 0); } /*}}} */ /*{{{ Set/Unset automatic insert mode */ void scr_insert_mode (int mode) { if (mode) screen.flags |= Screen_Insert; else screen.flags &= ~Screen_Insert; } /*}}} */ /*{{{ Move the display to line represented by scrollbar */ /* * Move the display so that line represented by scrollbar value Y is at * the top of the screen */ int scr_move_to (int y, int len) { int start = TermWin.view_start; TermWin.view_start = ((len - y) * ((TermWin.nrow - 1) + TermWin.nscrolled) / (len)) - (TermWin.nrow - 1); if (TermWin.view_start < 0) TermWin.view_start = 0; else if (TermWin.view_start > TermWin.nscrolled) TermWin.view_start = TermWin.nscrolled; if (Gr_Displayed ()) Gr_scroll (0); return (TermWin.view_start - start); } /*}}} */ /*{{{ page the screen up/down NLINES */ int scr_page (int dirn, int nlines) { int start = TermWin.view_start; if (!dirn || !nlines) return 0; if (nlines <= 0) nlines = 1; else if (nlines > TermWin.nrow) nlines = TermWin.nrow; TermWin.view_start += nlines * dirn; if (TermWin.view_start < 0) TermWin.view_start = 0; else if (TermWin.view_start > TermWin.nscrolled) TermWin.view_start = TermWin.nscrolled; if (Gr_Displayed ()) Gr_scroll (0); return (TermWin.view_start - start); } /*}}} */ /*{{{ selection service functions */ /* * If (row,col) is within a selected region of text, remove the selection */ static inline void selection_check (void) { int c1, c2, r1, r2; check_text ("check selection"); if (current_screen != selection.screen) return; if ((selection.mark.row < -TermWin.nscrolled) || (selection.mark.row >= TermWin.nrow) || (selection.beg.row < -TermWin.nscrolled) || (selection.beg.row >= TermWin.nrow) || (selection.end.row < -TermWin.nscrolled) || (selection.end.row >= TermWin.nrow)) { selection_reset (); return; } r1 = (screen.row - TermWin.view_start); c1 = ((r1 - selection.mark.row) * (r1 - selection.end.row)); /* selection.mark.row > screen.row - TermWin.view_start * or * selection.end.row > screen.row - TermWin.view_start */ if (c1 < 0) selection_reset (); /* selection.mark.row == screen.row || selection.end.row == screen.row */ else if (c1 == 0) { /* We're on the same row as the start or end of selection */ if ((selection.mark.row < selection.end.row) || ((selection.mark.row == selection.end.row) && (selection.mark.col < selection.end.col))) { r1 = selection.mark.row; c1 = selection.mark.col; r2 = selection.end.row; c2 = selection.end.col; } else { r1 = selection.end.row; c1 = selection.end.col; r2 = selection.mark.row; c2 = selection.mark.col; } if ((screen.row == r1) && (screen.row == r2)) { if ((screen.col >= c1) && (screen.col <= c2)) selection_reset (); } else if (((screen.row == r1) && (screen.col >= c1)) || ((screen.row == r2) && (screen.col <= c2))) selection_reset (); } } #if 0 static inline void selection_range (int firstr, int lastr) { if (firstr >= lastr || firstr < 0 || firstr >= TermWin.nrow || lastr <= 0 || lastr > TermWin.nrow) return; selection.firstr = firstr; selection.lastr = lastr; } #endif /*}}} */ /*{{{ make selection */ /* * make the selection currently delimited by the selection end markers */ void selection_make (Time tm) { unsigned char *str; int r, startr, startc, endr, endc; int roffset; /* row offset */ switch (selection.op) { case SELECTION_CONT: break; case SELECTION_INIT: selection_reset (); selection.end.row = selection.mark.row = selection.beg.row; selection.end.col = selection.mark.col = selection.beg.col; /*drop */ case SELECTION_BEGIN: selection.op = SELECTION_DONE; /*drop */ default: return; break; } selection.op = SELECTION_DONE; FREE (selection.text, "sel_make", "sel_make"); selection.text = NULL; selection.len = 0; selection.screen = current_screen; /* Set start/end row/col to point to the selection endpoints */ if (selection.end.row < selection.mark.row || (selection.end.row == selection.mark.row && selection.end.col <= selection.mark.col)) { startr = selection.end.row; endr = selection.mark.row; startc = selection.end.col; endc = selection.mark.col; } else { startr = selection.mark.row; endr = selection.end.row; startc = selection.mark.col; endc = selection.end.col; } if ((startr < -TermWin.nscrolled || endr >= TermWin.nrow)) { selection_reset (); return; } str = MALLOC (((endr - startr + 1) * (TermWin.ncol + 1) + 1) * sizeof (char), "sel_text"); selection.text = str; *str = '\0'; /* save all points between start and end with selection flag */ roffset = ((startr + TermWin.saveLines) * (TermWin.ncol + 1)); for (r = startr; r <= endr; r++, roffset += (TermWin.ncol + 1)) { int c; int c1 = (r == startr ? startc : 0); int c2 = (r == endr ? endc : (TermWin.ncol - 1)); #ifdef KANJI if ((screen.rend[roffset + c1] & RS_kanjiMask) == RS_kanjiMask) c1--; if ((screen.rend[roffset + c2] & RS_kanjiMask) == RS_kanji1) c2++; #endif /* KANJI */ for (c = c1; c <= c2; c++) *str++ = screen.text[roffset + c]; /* * end-of-line and not autowrap * remove trailing space, but don't remove an entire line! */ if (c2 == (TermWin.ncol - 1) && !screen.text[roffset + (TermWin.ncol)]) { str--; for (c = c2; c >= c1 && isspace (*str); c--) str--; str++; *str++ = '\n'; } } *str = '\0'; selection.len = strlen (selection.text); if (selection.len <= 0) return; XSetSelectionOwner (Xdisplay, XA_PRIMARY, TermWin.vt, tm); if (XGetSelectionOwner (Xdisplay, XA_PRIMARY) != TermWin.vt) print_error ("can't get primary selection"); /* Place in CUT_BUFFER0 for backup */ XChangeProperty (Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, selection.text, selection.len); } /*}}} */ /*{{{ respond to a request for our current selection */ void selection_send (XSelectionRequestEvent * rq) { XEvent ev; static Atom xa_targets = None; if (xa_targets == None) xa_targets = XInternAtom (Xdisplay, "TARGETS", False); ev.xselection.type = SelectionNotify; ev.xselection.property = None; ev.xselection.display = rq->display; ev.xselection.requestor = rq->requestor; ev.xselection.selection = rq->selection; ev.xselection.target = rq->target; ev.xselection.time = rq->time; if (rq->target == xa_targets) { /* * On some systems, the Atom typedef is 64 bits wide. * We need to have a typedef that is exactly 32 bits wide, * because a format of 64 is not allowed by the X11 protocol. */ typedef CARD32 Atom32; Atom32 target_list[2]; target_list[0] = (Atom32) xa_targets; target_list[1] = (Atom32) XA_STRING; XChangeProperty (Xdisplay, rq->requestor, rq->property, xa_targets, 8 * sizeof (target_list[0]), PropModeReplace, (char *) target_list, sizeof (target_list) / sizeof (target_list[0])); ev.xselection.property = rq->property; } else if (rq->target == XA_STRING) { XChangeProperty (Xdisplay, rq->requestor, rq->property, XA_STRING, 8, PropModeReplace, selection.text, selection.len); ev.xselection.property = rq->property; } XSendEvent (Xdisplay, rq->requestor, False, 0, &ev); } /*}}} */ /*{{{ paste selection */ static void PasteIt (unsigned char *data, unsigned int nitems) { unsigned char *p = data, *pmax = data + nitems; for (nitems = 0; p < pmax; p++) { /* do newline -> carriage-return mapping */ if (*p == '\n') { unsigned char cr = '\r'; tt_write (data, nitems); tt_write (&cr, 1); data += (nitems + 1); nitems = 0; } else nitems++; } if (nitems) tt_write (data, nitems); } /* * Respond to a notification that a primary selection has been sent */ void selection_paste (Window win, unsigned prop, int Delete) { long nread, bytes_after; if (prop == None) return; nread = 0; do { unsigned char *data; Atom actual_type; int actual_fmt; long nitems; if ((XGetWindowProperty (Xdisplay, win, prop, nread / 4, PROP_SIZE, Delete, AnyPropertyType, &actual_type, &actual_fmt, &nitems, &bytes_after, &data) != Success) || (actual_type != XA_STRING)) { XFree (data); return; } nread += nitems; PasteIt (data, nitems); XFree (data); } while (bytes_after > 0); } /*}}} */ /*{{{ Request the current primary selection */ void selection_request (Time tm, int x, int y) { /* is release within the window? */ if (x < 0 || y < 0 || x >= TermWin.width || y >= TermWin.height) return; if (selection.text != NULL) { /* internal selection */ PasteIt (selection.text, selection.len); } else if (XGetSelectionOwner (Xdisplay, XA_PRIMARY) == None) { /* no primary selection - use CUT_BUFFER0 */ selection_paste (Xroot, XA_CUT_BUFFER0, False); } else { Atom prop = XInternAtom (Xdisplay, "VT_SELECTION", False); XConvertSelection (Xdisplay, XA_PRIMARY, XA_STRING, prop, TermWin.vt, tm); } } /*}}} */ /*{{{ Clear the current selection */ void selection_reset (void) { int x, nrow = TermWin.nrow; selection.op = SELECTION_CLEAR; selection.end.row = selection.mark.row = 0; selection.end.col = selection.mark.col = 0; if (current_screen == PRIMARY) nrow += TermWin.saveLines; for (x = 0; x < nrow * (TermWin.ncol + 1); x++) screen.rend[x] &= ~(RS_Select); } void selection_clear (void) { FREE (selection.text, "sel_clear", "sel_clear"); selection.text = NULL; selection.len = 0; selection.op = SELECTION_CLEAR; selection_reset (); } /*}}} */ /*{{{ mark selected points (used by selection_extend) */ static void selection_setclr (int set, int startr, int startc, int endr, int endc) { int r, roffset = ((startr + TermWin.saveLines) * (TermWin.ncol + 1)); /* startr <= endr */ if ((startr < -TermWin.nscrolled) || (endr >= TermWin.nrow)) { selection_reset (); return; } for (r = startr; r <= endr; r++) { int c1 = (r == startr ? startc : 0); int c2 = (r == endr ? endc : (TermWin.ncol - 1)); #ifdef KANJI if ((screen.rend[roffset + c1] & RS_kanjiMask) == RS_kanjiMask) c1--; if ((screen.rend[roffset + c2] & RS_kanjiMask) == RS_kanji1) c2++; #endif /* KANJI */ for ( /*nil */ ; c1 <= c2; c1++) { if (set) screen.rend[roffset + c1] |= RS_Select; else screen.rend[roffset + c1] &= ~(RS_Select); } roffset += (TermWin.ncol + 1); } } /*}}} */ /*{{{ start a selection at the specified col/row */ static void selection_start_colrow (int col, int row) { if (selection.op) { /* startr <= endr */ if ((selection.end.row < -TermWin.nscrolled) || (selection.mark.row < -TermWin.nscrolled)) { selection_reset (); } else /* direction of new selection */ { if (selection.end.row < selection.mark.row || (selection.end.row == selection.mark.row && selection.end.col <= selection.mark.col)) selection_setclr (0, /* up */ selection.end.row, selection.end.col, selection.mark.row, selection.mark.col); else selection_setclr (0, /* down */ selection.mark.row, selection.mark.col, selection.end.row, selection.end.col); } } selection.op = SELECTION_INIT; selection.beg.col = col; selection.beg.row = row; selection.beg.row -= TermWin.view_start; } /* * start a selection at the specified x/y pixel location */ void selection_start (int x, int y) { selection_start_colrow (Pixel2Col (x), Pixel2Row (y)); } /*}}} */ /*{{{ extend the selection to the specified col/row */ static void selection_extend_colrow (int col, int row) { int old_row, old_col, old_dirn, dirn; switch (selection.op) { case SELECTION_INIT: selection_reset (); selection.end.col = selection.mark.col = selection.beg.col; selection.end.row = selection.mark.row = selection.beg.row; /*drop */ case SELECTION_BEGIN: selection.op = SELECTION_BEGIN; break; case SELECTION_DONE: case SELECTION_CONT: selection.op = SELECTION_CONT; break; case SELECTION_CLEAR: selection_start_colrow (col, row); /*drop */ default: return; break; } /* Remember old selection for virtual removal */ old_row = selection.end.row; old_col = selection.end.col; if ((old_row < -TermWin.nscrolled) || (selection.mark.row < -TermWin.nscrolled)) { selection_reset (); return; } /* Figure out where new selection is */ selection.end.col = col; selection.end.row = row; if (selection.end.col < 0) selection.end.col = 0; else if (selection.end.col >= TermWin.ncol) selection.end.col = (TermWin.ncol - 1); selection.end.row -= TermWin.view_start; if (selection.end.row < -TermWin.nscrolled) { selection_reset (); return; } else if (selection.end.row >= TermWin.nrow) selection.end.row = (TermWin.nrow - 1); if ((selection.op == SELECTION_BEGIN) && ((selection.end.col != selection.mark.col) || (selection.end.row != selection.mark.row))) selection.op = SELECTION_CONT; /* If new selection is same as old selection just return * or if no highlighting was requested */ if (selection.end.row == old_row && selection.end.col == old_col) return; /* virtual removal -- delete old highlighting and replace with new */ /* determine direction of old selection */ old_dirn = ((old_row < selection.mark.row || (old_row == selection.mark.row && old_col <= selection.mark.col)) ? UP : DN); /* determine direction of new selection */ dirn = ((selection.end.row < selection.mark.row || (selection.end.row == selection.mark.row && selection.end.col <= selection.mark.col)) ? UP : DN); /* If old and new direction are different, clear old, set new */ if (dirn != old_dirn) { if (old_dirn == UP) { selection_setclr (0, old_row, old_col, selection.mark.row, selection.mark.col); selection_setclr (1, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col); } else { selection_setclr (0, selection.mark.row, selection.mark.col, old_row, old_col); selection_setclr (1, selection.end.row, selection.end.col, selection.mark.row, selection.mark.col); } } else { if (old_dirn == UP) { if (old_row < selection.end.row || (old_row == selection.end.row && old_col < selection.end.col)) { selection_setclr (0, old_row, old_col, selection.end.row, selection.end.col); selection_setclr (1, selection.end.row, selection.end.col, selection.end.row, selection.end.col); } else { selection_setclr (1, selection.end.row, selection.end.col, old_row, old_col); } } else { if (selection.end.row < old_row || (selection.end.row == old_row && selection.end.col < old_col)) { selection_setclr (0, selection.end.row, selection.end.col, old_row, old_col); selection_setclr (1, selection.end.row, selection.end.col, selection.end.row, selection.end.col); } else { selection_setclr (1, old_row, old_col, selection.end.row, selection.end.col); } } } } /* * extend the selection to the specified x/y pixel location */ void selection_extend (int x, int y) { selection_extend_colrow (Pixel2Col (x), Pixel2Row (y)); } /*}}} */ /*{{{ double/triple click selection */ /* * by Edward. Der-Hua Liu, Taiwan * cut char support added by A. Haritsis */ void selection_click (int clicks, int x, int y) { if (clicks <= 1) { selection_start (x, y); /* single click */ } else { int beg_c, end_c, beg_r, end_r; text_t *text; /* ensure rows/columns are on the screen */ x = Pixel2Col (x); x = (x <= 0 ? 0 : (x >= TermWin.ncol ? (TermWin.ncol - 1) : x)); beg_c = end_c = x; y = Pixel2Row (y); y = (y <= 0 ? 0 : (y >= TermWin.nrow ? (TermWin.nrow - 1) : y)); beg_r = end_r = y; switch (clicks) { case 3: /* * triple click */ beg_c = 0; end_c = (TermWin.ncol - 1); break; case 2: /* * double click: handle autowrapped lines */ for (text = (screen.text + (beg_r + TermWin.saveLines - TermWin.view_start) * (TermWin.ncol + 1)); /*forever */ ; beg_r--, text -= (TermWin.ncol + 1)) { while (beg_c > 0 && !strchr (rs_cutchars, text[beg_c - 1])) beg_c--; if (beg_c == 0 && beg_r > (TermWin.view_start - TermWin.nscrolled) && *(text - 1) == '\n' && !strchr (rs_cutchars, *(text - 2))) beg_c = (TermWin.ncol - 1); else break; } for (text = (screen.text + (end_r + TermWin.saveLines - TermWin.view_start) * (TermWin.ncol + 1)); /*forever */ ; end_r++, text += (TermWin.ncol + 1)) { while (end_c < (TermWin.ncol - 1) && !strchr (rs_cutchars, text[end_c + 1])) end_c++; if (end_c == (TermWin.ncol - 1) && end_r < (TermWin.view_start + TermWin.nrow - 1) && text[TermWin.ncol] == '\n' && !strchr (rs_cutchars, text[TermWin.ncol + 1])) end_c = 0; else break; } break; default: return; break; } selection_start_colrow (beg_c, beg_r); selection_extend_colrow (end_c, end_r); } } /*}}} */ /*{{{ Report the current cursor position */ void scr_report_position (void) { tt_printf ("\033[%d;%dR", screen.row + 1, screen.col + 1); } /*}}} */ /*{{{ Charset/Font functions */ /* * choose a font */ void scr_charset_choose (int set) { screen.charset = set; set_font_style (); } /* * Set a font */ void scr_charset_set (int set, unsigned int ch) { #ifdef KANJI multiByte = (set < 0); set = abs (set); #endif charsets[set] = (unsigned char) ch; set_font_style (); } /*}}} */ /*{{{ scr_expose / scr_touch */ /* * for the box starting at x, y with size width, height * touch the displayed values */ void scr_expose (int x, int y, int width, int height) { int row, col, end_row, end_col; if (drawn_text == NULL) return; check_text ("touch"); col = Pixel2Col (x); row = Pixel2Row (y); if (col < 0) col = 0; else if (col >= TermWin.ncol) col = (TermWin.ncol - 1); if (row < 0) row = 0; else if (row >= TermWin.nrow) row = (TermWin.nrow - 1); end_col = col + 1 + Pixel2Width (width); end_row = row + 1 + Pixel2Height (height); if (end_row >= TermWin.nrow) end_row = (TermWin.nrow - 1); if (end_col >= TermWin.ncol) end_col = (TermWin.ncol - 1); width = (end_col - col + 1); for ( /*nil */ ; row <= end_row; row++) { int roffset = (col + row * (TermWin.ncol + 1)); memset (&drawn_text[roffset], 0, width * sizeof (text_t)); memset (&drawn_rend[roffset], 0, width * sizeof (rend_t)); } } /* touch the entire screen */ void scr_touch (void) { scr_expose (0, 0, TermWin.width, TermWin.height); } /*}}} */ /*{{{ Refresh screen */ /* * refresh the region defined by rows STARTR and ENDR, inclusively. * * Actually draws to the X window * For X related speed-ups, this is a good place to fiddle. * The arrays drawn_text and drawn_rend contain what I * believe is currently shown on the screen. The arrays in screen contain * what should be displayed. This routine can decide how to refresh the * screen. Calls in command.c decide when to refresh. */ void scr_refresh (int type) { #ifdef XPM_BACKGROUND #undef USE_XCOPYAREA #ifndef NO_BOLDOVERSTRIKE #define NO_BOLDOVERSTRIKE #endif #ifdef XPM_BUFFERING int update = 0; #define drawBuffer (TermWin.buf_pixmap) #endif /* XPM_BUFFERING */ #endif /* XPM_BACKGROUND */ #ifndef drawBuffer #define drawBuffer (TermWin.vt) #endif static int last_xcursor = 0; int r, roffset, doffset, xcursor; #ifdef KANJI static int wbyte = 0; #endif if (type == NO_REFRESH) /* Window not visible, don't update */ return; check_text ("refresh region"); if (last_xcursor < (TermWin.nrow * (TermWin.ncol + 1))) { /* make sure to update it */ drawn_rend[last_xcursor] = RS_attrMask; } xcursor = ((screen.row + TermWin.saveLines) * (TermWin.ncol + 1) + screen.col); last_xcursor = (screen.row + TermWin.view_start); if (last_xcursor >= TermWin.nrow) { last_xcursor = 0; } else { last_xcursor *= (TermWin.ncol + 1); if (screen.flags & Screen_VisibleCursor) { screen.rend[xcursor] |= RS_Cursor; #ifdef KANJI if ((screen.rend[xcursor] & RS_kanjiMask) == RS_kanji1) screen.rend[xcursor + 1] |= RS_Cursor; #endif } } last_xcursor += screen.col; #ifdef USE_XCOPYAREA /* * scroll using bitblt wherever possible * a dirty approximation will ignore the rendition field here * and fix it up later */ if (type == FAST_REFRESH && !Gr_Displayed ()) for (r = 0; r < TermWin.nrow; r++) { int k; int doffset = r * (TermWin.ncol + 1); int roffset = doffset + ((TermWin.saveLines - TermWin.view_start) * (TermWin.ncol + 1)); if (!memcmp (&drawn_text[doffset], &screen.text[roffset], (TermWin.ncol) * sizeof (text_t))) continue; /* * look for a similar line */ for (doffset = 0, k = 0; k < TermWin.nrow; k++, doffset += (TermWin.ncol + 1)) { if (!memcmp (&drawn_text[doffset], &screen.text[roffset], TermWin.ncol * sizeof (text_t))) break; } /* found it */ if (k < TermWin.nrow) { int count; int j = r; roffset += (TermWin.ncol + 1); doffset += (TermWin.ncol + 1); r++; for (count = 1; ((r < TermWin.nrow) && !memcmp (&drawn_text[doffset], &screen.text[roffset], TermWin.ncol * sizeof (text_t)) ); count++, r++) { roffset += (TermWin.ncol + 1); doffset += (TermWin.ncol + 1); } r--; XCopyArea (Xdisplay, TermWin.vt, TermWin.vt, TermWin.gc, TermWin_internalBorder, Row2Pixel (k), Width2Pixel (1), Height2Pixel (count), TermWin_internalBorder, Row2Pixel (j)); /* * Forward overlapping memcpy's are probably OK, * but backwards doesn't work on SunOS 4.1.3 */ k *= (TermWin.ncol + 1); j *= (TermWin.ncol + 1); if (k > j) { while (count-- > 0) { MEMCOPY (&drawn_text[j], &drawn_text[k], count * (TermWin.ncol + 1) * sizeof (text_t)); MEMCOPY (&drawn_rend[j], &drawn_rend[k], count * (TermWin.ncol + 1) * sizeof (rend_t)); k += (TermWin.ncol + 1); j += (TermWin.ncol + 1); } } else { k += (count - 1) * (TermWin.ncol + 1); j += (count - 1) * (TermWin.ncol + 1); while (count-- > 0) { MEMCOPY (&drawn_text[j], &drawn_text[k], (TermWin.ncol + 1) * sizeof (text_t)); MEMCOPY (&drawn_rend[j], &drawn_rend[k], (TermWin.ncol + 1) * sizeof (rend_t)); k -= (TermWin.ncol + 1); j -= (TermWin.ncol + 1); } } } } #endif /* USE_XCOPYAREA */ doffset = 0 * (TermWin.ncol + 1); roffset = doffset + ((TermWin.saveLines - TermWin.view_start) * (TermWin.ncol + 1)); /* For a first cut, do it one character at a time */ for (r = 0; r < TermWin.nrow; roffset += (TermWin.ncol + 1), doffset += (TermWin.ncol + 1), r++) { int c; int ypixel = TermWin.font->ascent + Row2Pixel (r); #ifndef KANJI /* fast way to avoid the next loop (most of the time) ? */ if (!memcmp (&drawn_text[doffset], &screen.text[roffset], (TermWin.ncol) * sizeof (text_t)) && !memcmp (&drawn_rend[doffset], &screen.rend[roffset], (TermWin.ncol) * sizeof (rend_t))) continue; #endif for (c = 0; c < TermWin.ncol; c++) { int count; int x = roffset + c; int x1 = doffset + c; if ((drawn_text[x1] != screen.text[x]) || (drawn_rend[x1] != screen.rend[x]) #ifdef KANJI || (((screen.rend[x] & RS_kanjiMask) == RS_kanji1) && (drawn_text[x1 + 1] != screen.text[x + 1])) #endif /* KANJI */ ) { int fore, back, rend; XGCValues gcvalue; /* GC values */ unsigned long gcmask = 0; /* GC mask */ int outlineCursor = False; /* block cursor */ int xpixel = Col2Pixel (c); drawn_text[x1] = screen.text[x]; drawn_rend[x1] = screen.rend[x]; linebuf[0] = screen.text[x]; rend = screen.rend[x]; x++; c++; for (count = 1; (c < TermWin.ncol && #ifdef KANJI ((rend & ~RS_kanji0) == (screen.rend[x] & ~RS_kanji0)) && #else /* KANJI */ (rend == screen.rend[x]) && #endif /* KANJI */ (drawn_text[doffset + c] != screen.text[x] || drawn_rend[doffset + c] != screen.rend[x] || #ifdef KANJI (x > 0 && (screen.rend[x - 1] & ~RS_kanji1)) || #endif /* KANJI */ (c + 1 < TermWin.ncol && drawn_text[doffset + c + 1] != screen.text[x + 1]))); count++, x++, c++) { drawn_text[doffset + c] = screen.text[x]; drawn_rend[doffset + c] = screen.rend[x]; linebuf[count] = screen.text[x]; } c--; linebuf[count] = '\0'; /* zero-terminate */ #ifdef KANJI /* ensure the correct font is used */ if (rend & RS_kanji1) { if (!wbyte) { wbyte = 1; XSetFont (Xdisplay, TermWin.gc, TermWin.kanji->fid); } if (linebuf[0] & 0x80) kanji_decode (linebuf, count); } else { if (wbyte) { wbyte = 0; XSetFont (Xdisplay, TermWin.gc, TermWin.font->fid); } } #endif /* KANJI */ fore = GET_FGCOLOR (rend); back = GET_BGCOLOR (rend); rend = GET_ATTR (rend); if (rend) { int rvid = 0; if ((rend & (RS_RVid | RS_Select)) == (RS_RVid | RS_Select)) rend &= ~(RS_RVid | RS_Select); else if (rend & (RS_RVid | RS_Select)) rvid = 1; if (rend & RS_Cursor) { if (!TermWin.focus) { outlineCursor = True; rend &= ~(RS_Cursor); } else rvid = (!rvid #ifndef NO_CURSORCOLOR || (PixColors[cursorColor] != PixColors[bgColor]) #endif ); } /* swap foreground/background colors */ if (rvid) { int tmp = back; back = fore; fore = tmp; } /* * do some font character switching */ switch (rend & RS_fontMask) { case RS_acsFont: for (x = 0; x < count; x++) if (linebuf[x] >= 0x5F && linebuf[x] < 0x7F) linebuf[x] = (linebuf[x] == 0x5F ? 0x7F : linebuf[x] - 0x5F); break; case RS_ukFont: for (x = 0; x < count; x++) if (linebuf[x] == '#') linebuf[x] = '\036'; break; } } /* bold characters - order of preference: * 1 - change the foreground color to colorBD * 2 - change the foreground color to bright * 3 - use boldFont * 4 - simulate with overstrike */ #ifdef NO_BRIGHTCOLOR #define MonoBold(x) ((x) & (RS_Bold|RS_Blink)) #else /* NO_BRIGHTCOLOR */ #define MonoBold(x) (((x) & RS_Bold) && fore == fgColor) #endif /* NO_BRIGHTCOLOR */ /* # define MonoBold(x) ((((x) & RS_Bold) && fore == fgColor) || (((x) & RS_Blink) && back == bgColor)) */ /* * blink simulated by simulated bold (overstrike) seems a bit farfetched * comment this out (v2.17 - 04APR96) and see how many people complain */ if (fore != fgColor) { gcvalue.foreground = PixColors[fore]; gcmask |= GCForeground; } #ifndef NO_BOLDUNDERLINE else { if (rend & RS_Bold) /* do bold first */ { gcvalue.foreground = PixColors[colorBD]; if (gcvalue.foreground != PixColors[fgColor]) { gcmask |= GCForeground; rend &= ~RS_Bold; } } else if (rend & RS_Uline) { gcvalue.foreground = PixColors[colorUL]; if (gcvalue.foreground != PixColors[fgColor]) { gcmask |= GCForeground; rend &= ~RS_Uline; } } } #endif /* NO_BOLDUNDERLINE */ if (back != bgColor) { gcvalue.background = PixColors[back]; gcmask |= GCBackground; } #ifndef NO_CURSORCOLOR if ((rend & RS_Cursor) && (PixColors[cursorColor] != PixColors[bgColor])) { gcvalue.background = PixColors[cursorColor]; gcmask |= GCBackground; if (PixColors[cursorColor2] != PixColors[fgColor]) { gcvalue.foreground = PixColors[cursorColor2]; gcmask |= GCForeground; } } #endif /* NO_CURSORCOLOR */ if (gcmask) XChangeGC (Xdisplay, TermWin.gc, gcmask, &gcvalue); #ifdef XPM_BACKGROUND #ifdef XPM_BUFFERING update = 1; #endif /* XPM_BUFFERING */ #endif /* XPM_BACKGROUND */ /*----------------------------------------------------------------------*/ /* * how to write the strings */ #undef drawStringPrep #undef drawString #ifdef XPM_BACKGROUND #ifdef XPM_BUFFERING #define drawStringPrep()\ XCopyArea (Xdisplay, TermWin.pixmap, drawBuffer, TermWin.gc,\ xpixel, (ypixel - TermWin.font->ascent),\ Width2Pixel (count), Height2Pixel (1), \ xpixel, (ypixel - TermWin.font->ascent)) #else /* XPM_BUFFERING */ #define drawStringPrep()\ XClearArea (Xdisplay, drawBuffer, xpixel, \ (ypixel + 2 - Height2Pixel (1)),\ Width2Pixel (count), Height2Pixel (1), 0) #endif /* XPM_BUFFERING */ #endif /* XPM_BACKGROUND */ #define drawString(strFunc)\ strFunc (Xdisplay, drawBuffer, TermWin.gc, xpixel, ypixel, linebuf, count) /*----------------------------------------------------------------------*/ #ifdef KANJI if (wbyte) { count /= 2; #ifdef XPM_BACKGROUND if (back == bgColor) { drawStringPrep (); drawString (XDrawString16); } else #endif /* XPM_BACKGROUND */ drawString (XDrawImageString16); #ifndef NO_BOLDOVERSTRIKE if (MonoBold (rend)) { xpixel++; drawString (XDrawString16); xpixel--; } #endif /* NO_BOLDOVERSTRIKE */ } else #endif /* KANJI */ #ifndef NO_BOLDFONT if (MonoBold (rend) && TermWin.boldFont != NULL) { XSetFont (Xdisplay, TermWin.gc, TermWin.boldFont->fid); #ifdef XPM_BACKGROUND if (back == bgColor) { drawStringPrep (); drawString (XDrawString); } else #endif /* XPM_BACKGROUND */ drawString (XDrawImageString); XSetFont (Xdisplay, TermWin.gc, TermWin.font->fid); } else #endif /* NO_BOLDFONT */ { #ifdef XPM_BACKGROUND if (back == bgColor) { drawStringPrep (); drawString (XDrawString); } else #endif /* XPM_BACKGROUND */ drawString (XDrawImageString); #ifndef NO_BOLDOVERSTRIKE if (MonoBold (rend)) { xpixel++; drawString (XDrawString); xpixel--; } #endif /* NO_BOLDOVERSTRIKE */ } #undef MonoBold /* * On the smallest font, underline overwrites next row */ if ((rend & RS_Uline) && (TermWin.font->descent > 1)) { XDrawLine (Xdisplay, drawBuffer, TermWin.gc, xpixel, ypixel + 1, xpixel + Width2Pixel (count) - 1, ypixel + 1); } if (outlineCursor) { #ifndef NO_CURSORCOLOR if (PixColors[cursorColor] != PixColors[bgColor]) { gcvalue.foreground = PixColors[cursorColor]; gcmask |= GCForeground; XChangeGC (Xdisplay, TermWin.gc, gcmask, &gcvalue); } #endif /* NO_CURSORCOLOR */ XDrawRectangle (Xdisplay, drawBuffer, TermWin.gc, xpixel, (ypixel - TermWin.font->ascent), Width2Pixel (1) - 1, Height2Pixel (1) - 1); } if (gcmask) { /* restore normal colors */ gcvalue.foreground = PixColors[fgColor]; gcvalue.background = PixColors[bgColor]; XChangeGC (Xdisplay, TermWin.gc, gcmask, &gcvalue); } } } } if (screen.flags & Screen_VisibleCursor) { screen.rend[xcursor] &= ~(RS_Cursor); #ifdef KANJI screen.rend[xcursor + 1] &= ~(RS_Cursor); #endif /* KANJI */ } #ifdef XPM_BUFFERING if (update) { XClearArea (Xdisplay, TermWin.vt, 0, Row2Pixel (0), TermWin_TotalWidth (), TermWin_TotalHeight (), 0); XFlush (Xdisplay); } #endif /* XPM_BUFFERING */ #undef drawStringPrep #undef drawString #undef drawBuffer } /*}}} */ /*{{{ Tabs: set/clear */ /* * -1 = clear all tabs * +0 = clear tab stop at current column * +1 = set tab stop at current column */ void scr_set_tab (int mode) { if (mode < 0) memset (tabs, 0, TermWin.ncol * sizeof (char)); else if (screen.col < TermWin.ncol) tabs[screen.col] = (mode != 0); } /*}}} */ /*{{{ toggle reverse video settings */ void scr_rvideo_mode (int mode) { if (rvideo != mode) { register int x, count; rvideo = mode; rstyle ^= RS_RVid; count = (TermWin.nrow + TermWin.saveLines) * (TermWin.ncol + 1); for (x = 0; x < count; x++) screen.rend[x] ^= RS_RVid; scr_refresh (SLOW_REFRESH); #ifdef DEBUG_COLORS debug_colors (); #endif } } /*}}} */ /*{{{ Handle receipt of a bell character */ void scr_bell (void) { #ifndef NO_MAPALERT #ifdef MAPALERT_OPTION if (Options & Opt_mapAlert) #endif XMapWindow (Xdisplay, TermWin.parent); #endif if (Options & Opt_visualBell) { scr_rvideo_mode (!rvideo); scr_rvideo_mode (!rvideo); } else XBell (Xdisplay, 0); } /*}}} */ /*{{{ Print-Pipe */ #ifdef PRINTPIPE void scr_printscreen (int fullhist) { text_t *text; int r, nrows; FILE *fd; if ((fd = popen_printer ()) == NULL) return; nrows = TermWin.nrow; if (fullhist) nrows += TermWin.view_start; text = &screen.text[((TermWin.saveLines - TermWin.view_start) * (TermWin.ncol + 1))]; for (r = 0; r < nrows; r++, text += (TermWin.ncol + 1)) { int i; for (i = (TermWin.ncol - 1); i >= 0 && isspace (text[i]); i--) /*nil */ ; i++; fprintf (fd, "%.*s\n", i, text); } pclose_printer (fd); } #endif /*}}} */ /*{{{ Debugging for selection */ /* * hidden debugging dump */ #ifdef DEBUG_SELECTION static void debug_PasteIt (unsigned char *data, int nitems) { unsigned char *p, *pmax = data + nitems; int i; printf ("\n\""); for (nitems = 0, p = data; p < pmax; p++) { if (*p == '\n') { printf ("[%d chars]\n%.*s\\n\n", nitems, nitems, data); data += (nitems + 1); nitems = 0; } else if (*p == '\r') { printf ("[%d chars]\n%.*s\\r\n", nitems, nitems, data); data += (nitems + 1); nitems = 0; } else nitems++; } if (nitems) printf ("%*s", (nitems), data); printf ("\"\n"); } int debug_selection (void) { printf ("\n%dx%d [chars] %dx%d [pixels] (font: %ux%u), scroll = %d/%d\n", TermWin.ncol, TermWin.nrow, TermWin.width, TermWin.height, Width2Pixel (1), Height2Pixel (1), screen.tscroll, screen.bscroll); printf ("%d lines scrollback, %d lines scrolled, start = %d\n", TermWin.saveLines, TermWin.nscrolled, TermWin.view_start); printf ("selection = screen %d, op = ", selection.screen); switch (selection.op) { case SELECTION_CLEAR: printf ("CLEAR"); break; case SELECTION_BEGIN: printf ("BEGIN"); break; case SELECTION_INIT: printf ("INIT"); break; case SELECTION_CONT: printf ("CONT"); break; case SELECTION_DONE: printf ("DONE"); break; default: printf ("Unknown"); break; } printf ("\n\trow/col\n" "beg\t%d %d\nend\t%d %d\nanchor\t%d %d\ncursor\t%d %d\n" "selection [%d chars]\n", selection.beg.row, selection.beg.col, selection.end.row, selection.end.col, selection.mark.row, selection.mark.col, screen.row, screen.col, selection.len); if (selection.text != NULL) debug_PasteIt (selection.text, selection.len); return 0; } #endif /*}}} */ /*{{{ Mouse Reporting */ /* add the bits: * @ 1 - shift * @ 2 - meta * @ 4 - ctrl */ #define ButtonNumber(x) ((x) == AnyButton ? 3 : ((x) - Button1)) #define KeyState(x) ((((x)&(ShiftMask|ControlMask))+(((x)&Mod1Mask)?2:0))<<2) void mouse_report (XButtonEvent * ev) { tt_printf ("\033[M%c%c%c", (040 + ButtonNumber (ev->button) + KeyState (ev->state)), (041 + Pixel2Col (ev->x)), (041 + Pixel2Row (ev->y))); } #if 0 /* X11 mouse tracking: not yet - maybe never! */ void mouse_tracking (int report, int x, int y, int firstrow, int lastrow) { static int top, bot; if (report) { /* If either coordinate is past the end of the line: * "ESC [ T CxCyCxCyCxCy" * The parameters are begx, begy, endx, endy, * mousex, and mousey */ if ((selection.beg.row < selection.end.row) || ((selection.beg.row == selection.end.row) && (selection.beg.col < selection.end.col))) { if (selection.beg.row >= top && selection.end.row <= bot) tt_printf ("\033[t"); /* start/end are valid locations */ else tt_printf ("\033[T%c%c%c%c", selection.beg.col + 1, selection.beg.row + 1, selection.end.col + 1, selection.end.row + 1); } else { if (selection.end.row >= top && selection.beg.row <= bot) tt_printf ("\033[t"); /* start/end are valid locations */ else tt_printf ("\033[T%c%c%c%c", selection.end.col + 1, selection.end.row + 1, selection.beg.col + 1, selection.beg.row + 1) } tt_printf ("%c%c", Pixel2Col (x) + 1, Pixel2Row (y) + 1); } else { selection_start_colrow (x - 1, y - 1); top = firstrow; bot = lastrow; } } #endif /*}}} */ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/Xtensions/graphics/main.c0000644000175000017500000012076511375434150020035 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: main.c * * Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as * you don't try to make money out of it and you include an * unaltered copy of this message (including the copyright). * * This module has been heavily modified by R. Nation * * No additional restrictions are applied * * Additional modifications by Garrett D'Amore * No additional restrictions are applied. * * Extensive modifications by mj olesen * No additional restrictions are applied. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ /*{{{ includes */ #include "main.h" #ifdef HAVE_UNISTD_H #include #endif #include #include #ifdef XPM_BACKGROUND #include #endif #include "command.h" #include "debug.h" #include "graphics.h" #include "scrollbar.h" #include "screen.h" #include "xdefaults.h" #include "defaults.h" /*}}} */ /*{{{ extern functions referenced */ #ifdef DISPLAY_IS_IP extern char *network_display (const char *display); #endif /*}}} */ /* extern variables referenced */ /*{{{ extern variables declared here */ TermWin_t TermWin; Display *Xdisplay; /* display */ const char *rs_color[NRS_COLORS]; Pixel PixColors[NRS_COLORS + NSHADOWCOLORS]; unsigned long Options = (Opt_scrollBar); const char *display_name = NULL; const char *rs_name = NULL; /* client instance (resource name) */ #ifndef NO_BOLDFONT const char *rs_boldFont = NULL; #endif const char *rs_font[NFONTS]; #ifdef KANJI const char *rs_kfont[NFONTS]; #endif #ifdef PRINTPIPE const char *rs_print_pipe = NULL; #endif const char *rs_cutchars = NULL; /*}}} */ /*{{{ local variables */ static Cursor TermWin_cursor; /* cursor for vt window */ static XSizeHints szHint = { PMinSize | PResizeInc | PBaseSize | PWinGravity, 0, 0, 80, 24, /* x, y, width, height */ 1, 1, /* Min width, height */ 0, 0, /* Max width, height - unused */ 1, 1, /* increments: width, height */ {1, 1}, /* increments: x, y */ {0, 0}, /* Aspect ratio - unused */ 0, 0, /* base size: width, height */ NorthWestGravity /* gravity */ }; static const char *def_colorName[] = { "Black", "White", /* fg/bg */ "Black", /* 0: black (#000000) */ #ifndef NO_BRIGHTCOLOR /* low-intensity colors */ "Red3", /* 1: red (#CD0000) */ "Green3", /* 2: green (#00CD00) */ "Yellow3", /* 3: yellow (#CDCD00) */ "Blue3", /* 4: blue (#0000CD) */ "Magenta3", /* 5: magenta (#CD00CD) */ "Cyan3", /* 6: cyan (#00CDCD) */ "AntiqueWhite", /* 7: white (#FAEBD7) */ /* high-intensity colors */ "Grey25", /* 8: bright black (#404040) */ #endif /* NO_BRIGHTCOLOR */ "Red", /* 1/9: bright red (#FF0000) */ "Green", /* 2/10: bright green (#00FF00) */ "Yellow", /* 3/11: bright yellow (#FFFF00) */ "Blue", /* 4/12: bright blue (#0000FF) */ "Magenta", /* 5/13: bright magenta (#FF00FF) */ "Cyan", /* 6/14: bright cyan (#00FFFF) */ "White", /* 7/15: bright white (#FFFFFF) */ #ifndef NO_CURSORCOLOR NULL, NULL, #endif /* NO_CURSORCOLOR */ #ifndef NO_BOLDUNDERLINE NULL, NULL, #endif /* NO_BOLDUNDERLINE */ "#B2B2B2" /* scrollColor: match Netscape color */ }; #ifdef KANJI /* Kanji font names, roman fonts sized to match */ static const char *def_kfontName[] = { KFONT0, KFONT1, KFONT2, KFONT3, KFONT4 }; #endif /* KANJI */ static const char *def_fontName[] = { FONT0, FONT1, FONT2, FONT3, FONT4 }; /*}}} */ /*{{{ local functions referenced */ #ifdef XPM_BACKGROUND static Pixmap set_bgPixmap (const char * /* file */ ); static struct { short w, h, x, y; Pixmap pixmap; } bgPixmap = { 100, 100, 50, 50, None }; /* the originally loaded pixmap and its scaling */ static XpmAttributes xpmAttr; #endif /* XPM_BACKGROUND */ static void resize (void); /*}}} */ /*----------------------------------------------------------------------*/ static XErrorHandler xerror_handler (Display * display, XErrorEvent * event) { exit (EXIT_FAILURE); return 0; } /*{{{ color aliases, fg/bg bright-bold */ static inline void color_aliases (int idx) { if (rs_color[idx] && isdigit (*rs_color[idx])) { int i = atoi (rs_color[idx]); if (i >= 8 && i <= 15) /* bright colors */ { i -= 8; #ifndef NO_BRIGHTCOLOR rs_color[idx] = rs_color[minBright + i]; return; #endif } if (i >= 0 && i <= 7) /* normal colors */ rs_color[idx] = rs_color[minColor + i]; } } /* * find if fg/bg matches any of the normal (low-intensity) colors */ #ifndef NO_BRIGHTCOLOR static inline void set_colorfgbg (void) { unsigned int i; static char colorfgbg_env[] = "COLORFGBG=default;default;bg"; char *p; int fg = -1, bg = -1; for (i = blackColor; i <= whiteColor; i++) { if (PixColors[fgColor] == PixColors[i]) { fg = (i - blackColor); break; } } for (i = blackColor; i <= whiteColor; i++) { if (PixColors[bgColor] == PixColors[i]) { bg = (i - blackColor); break; } } p = strchr (colorfgbg_env, '='); p++; if (fg >= 0) sprintf (p, "%d;", fg); else strcpy (p, "default;"); p = strchr (p, '\0'); if (bg >= 0) sprintf (p, #ifdef XPM_BACKGROUND "default;" #endif "%d", bg); else strcpy (p, "default"); putenv (colorfgbg_env); colorfgbg = DEFAULT_RSTYLE; for (i = minColor; i <= maxColor; i++) { if (PixColors[fgColor] == PixColors[i] #ifndef NO_BOLDUNDERLINE && PixColors[fgColor] == PixColors[colorBD] #endif /* NO_BOLDUNDERLINE */ /* if we wanted boldFont to have precedence */ #if 0 /* ifndef NO_BOLDFONT */ && TermWin.boldFont == NULL #endif /* NO_BOLDFONT */ ) colorfgbg = SET_FGCOLOR (colorfgbg, i); if (PixColors[bgColor] == PixColors[i]) colorfgbg = SET_BGCOLOR (colorfgbg, i); } } #else /* NO_BRIGHTCOLOR */ #define set_colorfgbg() ((void)0) #endif /* NO_BRIGHTCOLOR */ /*}}} */ #ifdef XPM_BACKGROUND /* * These GEOM strings indicate absolute size/position: * @ `WxH+X+Y' * @ `WxH+X' -> Y = X * @ `WxH' -> Y = X = 50 * @ `W+X+Y' -> H = W * @ `W+X' -> H = W, Y = X * @ `W' -> H = W, X = Y = 50 * @ `0xH' -> H *= H/100, X = Y = 50 (W unchanged) * @ `Wx0' -> W *= W/100, X = Y = 50 (H unchanged) * @ `=+X+Y' -> (H, W unchanged) * @ `=+X' -> Y = X (H, W unchanged) * * These GEOM strings adjust position relative to current position: * @ `+X+Y' * @ `+X' -> Y = X * * And this GEOM string is for querying current scale/position: * @ `?' */ static int scale_pixmap (const char *geom) { static char str[] = "[1000x1000+100+100]"; /* should be big enough */ int w = 0, h = 0, x = 0, y = 0; int flags; int changed = 0; if (geom == NULL) return 0; if (!strcmp (geom, "?")) { sprintf (str, "[%dx%d+%d+%d]", bgPixmap.w, bgPixmap.h, bgPixmap.x, bgPixmap.y); xterm_seq (XTerm_title, str); return 0; } { char *p; int n; if ((p = strchr (geom, ';')) == NULL) p = strchr (geom, '\0'); n = (p - geom); if (n >= sizeof (str) - 1) return 0; strncpy (str, geom, n); str[n] = '\0'; } flags = XParseGeometry (str, &x, &y, &w, &h); if (!flags) { flags |= WidthValue; w = 100; } if (flags & WidthValue) { if (!(flags & XValue)) { x = 50; } if (!(flags & HeightValue)) h = w; if (w && !h) { w = bgPixmap.w * ((float) w / 100); h = bgPixmap.h; } else if (h && !w) { w = bgPixmap.w; h = bgPixmap.h * ((float) h / 100); } if (w > 1000) w = 1000; if (h > 1000) h = 1000; if (bgPixmap.w != w) { bgPixmap.w = w; changed++; } if (bgPixmap.h != h) { bgPixmap.h = h; changed++; } } if (!(flags & YValue)) { if (flags & XNegative) flags |= YNegative; y = x; } if (!(flags & WidthValue) && geom[0] != '=') { x += bgPixmap.x; y += bgPixmap.y; } else { if (flags & XNegative) x += 100; if (flags & YNegative) y += 100; } x = (x <= 0 ? 0 : (x >= 100 ? 100 : x)); y = (y <= 0 ? 0 : (y >= 100 ? 100 : y));; if (bgPixmap.x != x) { bgPixmap.x = x; changed++; } if (bgPixmap.y != y) { bgPixmap.y = y; changed++; } return changed; } static void resize_pixmap (void) { XGCValues gcvalue; GC gc; unsigned int width = TermWin_TotalWidth (); unsigned int height = TermWin_TotalHeight (); if (TermWin.pixmap) XFreePixmap (Xdisplay, TermWin.pixmap); TermWin.pixmap = XCreatePixmap (Xdisplay, TermWin.vt, width, height, Xdepth); gcvalue.foreground = PixColors[bgColor]; gc = XCreateGC (Xdisplay, TermWin.vt, GCForeground, &gcvalue); if (bgPixmap.pixmap) { int w = bgPixmap.w; int h = bgPixmap.h; int x = bgPixmap.x; int y = bgPixmap.y; /* * don't zoom pixmap too much nor expand really small pixmaps */ if (w > 1000 || h > 1000) w = 1; else if (width > (10 * xpmAttr.width) || height > (10 * xpmAttr.height)) w = 0; /* tile */ if (w) { float p, incr; Pixmap tmp; tmp = XCreatePixmap (Xdisplay, TermWin.vt, width, xpmAttr.height, Xdepth); XFillRectangle (Xdisplay, tmp, gc, 0, 0, width, xpmAttr.height); /* * horizontal scaling */ incr = (float) xpmAttr.width; p = 0; if (w == 1) { /* display image directly - no scaling at all */ incr = width; if (xpmAttr.width <= width) { w = xpmAttr.width; x = (width - w) / 2; w += x; } else { x = 0; w = width; } } else if (w < 10) { incr *= w; /* fit W images across screen */ x = 0; w = width; } else { incr *= 100.0 / w; if (w < 100) /* contract */ { w = (w * width) / 100; if (x >= 0) /* position */ { float pos; pos = (float) x / 100 * width - (w / 2); x = (width - w); if (pos <= 0) x = 0; else if (pos < x) x = pos; } else { x = (width - w) / 2; } w += x; } else if (w >= 100) /* expand */ { if (x > 0) /* position */ { float pos; pos = (float) x / 100 * xpmAttr.width - (incr / 2); p = xpmAttr.width - (incr); if (pos <= 0) p = 0; else if (pos < p) p = pos; } x = 0; w = width; } } incr /= width; for ( /*nil */ ; x < w; x++, p += incr) { if (p >= xpmAttr.width) p = 0; XCopyArea (Xdisplay, bgPixmap.pixmap, tmp, gc, (int) p, 0, 1, xpmAttr.height, x, 0); } /* * vertical scaling */ incr = (float) xpmAttr.height; p = 0; if (h == 1) { /* display image directly - no scaling at all */ incr = height; if (xpmAttr.height <= height) { h = xpmAttr.height; y = (height - h) / 2; h += y; } else { y = 0; h = height; } } else if (h < 10) { incr *= h; /* fit H images across screen */ y = 0; h = height; } else { incr *= 100.0 / h; if (h < 100) /* contract */ { h = (h * height) / 100; if (y >= 0) /* position */ { float pos; pos = (float) y / 100 * height - (h / 2); y = (height - h); if (pos < 0.0f) y = 0; else if (pos < y) y = pos; } else { y = (height - h) / 2; } h += y; } else if (h >= 100) /* expand */ { if (y > 0) /* position */ { float pos; pos = (float) y / 100 * xpmAttr.height - (incr / 2); p = xpmAttr.height - (incr); if (pos < 0) p = 0; else if (pos < p) p = pos; } y = 0; h = height; } } incr /= height; for ( /*nil */ ; y < h; y++, p += incr) { if (p >= xpmAttr.height) p = 0; XCopyArea (Xdisplay, tmp, TermWin.pixmap, gc, 0, (int) p, width, 1, 0, y); } XFreePixmap (Xdisplay, tmp); } else { /* tiled */ for (y = 0; y < height; y += xpmAttr.height) { unsigned int h = (height - y); if (h > xpmAttr.height) h = xpmAttr.height; for (x = 0; x < width; x += xpmAttr.width) { unsigned int w = (width - x); if (w > xpmAttr.width) w = xpmAttr.width; XCopyArea (Xdisplay, bgPixmap.pixmap, TermWin.pixmap, gc, 0, 0, w, h, x, y); } } } } else XFillRectangle (Xdisplay, TermWin.pixmap, gc, 0, 0, width, height); #ifdef XPM_BUFFERING if (TermWin.buf_pixmap) XFreePixmap (Xdisplay, TermWin.buf_pixmap); TermWin.buf_pixmap = XCreatePixmap (Xdisplay, TermWin.vt, width, height, Xdepth); XCopyArea (Xdisplay, TermWin.pixmap, TermWin.buf_pixmap, gc, 0, 0, width, height, 0, 0); XSetWindowBackgroundPixmap (Xdisplay, TermWin.vt, TermWin.buf_pixmap); #else /* XPM_BUFFERING */ XSetWindowBackgroundPixmap (Xdisplay, TermWin.vt, TermWin.pixmap); #endif /* XPM_BUFFERING */ XFreeGC (Xdisplay, gc); XClearWindow (Xdisplay, TermWin.vt); XFlush (Xdisplay); XSync (Xdisplay, 0); } #else /* XPM_BACKGROUND */ #define scale_pixmap(str) ((void)0) #define resize_pixmap() ((void)0) #endif /* XPM_BACKGROUND */ /*{{{ Create_Windows() - Open and map the window */ static void Create_Windows (int argc, char *argv[]) { Cursor cursor; XClassHint classHint; XWMHints wmHint; int i, x, y, flags; unsigned int width, height; /* * grab colors before netscape does */ for (i = 0; i < (Xdepth <= 2 ? 2 : NRS_COLORS); i++) { const char *const msg = "can't load color \"%s\""; XColor xcol; if (!rs_color[i]) continue; if (!XParseColor (Xdisplay, Xcmap, rs_color[i], &xcol) || !XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error (msg, rs_color[i]); rs_color[i] = def_colorName[i]; if (!rs_color[i]) continue; if (!XParseColor (Xdisplay, Xcmap, rs_color[i], &xcol) || !XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error (msg, rs_color[i]); switch (i) { case fgColor: case bgColor: /* fatal: need bg/fg color */ print_error ("aborting"); exit (EXIT_FAILURE); break; #ifndef NO_CURSORCOLOR case cursorColor: xcol.pixel = PixColors[bgColor]; break; case cursorColor2: xcol.pixel = PixColors[fgColor]; break; #endif /* NO_CURSORCOLOR */ default: xcol.pixel = PixColors[bgColor]; /* None */ break; } } } PixColors[i] = xcol.pixel; } #ifndef NO_CURSORCOLOR if (Xdepth <= 2 || !rs_color[cursorColor]) PixColors[cursorColor] = PixColors[bgColor]; if (Xdepth <= 2 || !rs_color[cursorColor2]) PixColors[cursorColor2] = PixColors[fgColor]; #endif /* NO_CURSORCOLOR */ #ifndef NO_BOLDUNDERLINE if (Xdepth <= 2 || !rs_color[colorBD]) PixColors[colorBD] = PixColors[fgColor]; if (Xdepth <= 2 || !rs_color[colorUL]) PixColors[colorUL] = PixColors[fgColor]; #endif /* NO_BOLDUNDERLINE */ /* * get scrollBar shadow colors * * The calculations of topShadow/bottomShadow values are adapted * from the fvwm window manager. */ #ifndef XTERM_SCROLLBAR if (Xdepth <= 2) /* Monochrome */ { PixColors[scrollColor] = PixColors[bgColor]; PixColors[topShadowColor] = PixColors[fgColor]; PixColors[bottomShadowColor] = PixColors[fgColor]; } else { XColor xcol, white; /* bottomShadowColor */ xcol.pixel = PixColors[scrollColor]; XQueryColor (Xdisplay, Xcmap, &xcol); xcol.red = ((xcol.red) / 2); xcol.green = ((xcol.green) / 2); xcol.blue = ((xcol.blue) / 2); if (!XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error ("can't allocate %s", "bottomShadowColor"); xcol.pixel = PixColors[minColor]; } PixColors[bottomShadowColor] = xcol.pixel; /* topShadowColor */ white.pixel = WhitePixel (Xdisplay, Xscreen); XQueryColor (Xdisplay, Xcmap, &white); xcol.pixel = PixColors[scrollColor]; XQueryColor (Xdisplay, Xcmap, &xcol); #ifndef min #define min(a,b) (((a)<(b)) ? (a) : (b)) #define max(a,b) (((a)>(b)) ? (a) : (b)) #endif xcol.red = max ((white.red / 5), xcol.red); xcol.green = max ((white.green / 5), xcol.green); xcol.blue = max ((white.blue / 5), xcol.blue); xcol.red = min (white.red, (xcol.red * 7) / 5); xcol.green = min (white.green, (xcol.green * 7) / 5); xcol.blue = min (white.blue, (xcol.blue * 7) / 5); if (!XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error ("can't allocate %s", "topShadowColor"); xcol.pixel = PixColors[whiteColor]; } PixColors[topShadowColor] = xcol.pixel; } #endif /* XTERM_SCROLLBAR */ szHint.base_width = (2 * TermWin_internalBorder + (Options & Opt_scrollBar ? SB_WIDTH : 0)); szHint.base_height = (2 * TermWin_internalBorder); flags = (rs_geometry ? XParseGeometry (rs_geometry, &x, &y, &width, &height) : 0); if (flags & WidthValue) { szHint.width = width; szHint.flags |= USSize; } if (flags & HeightValue) { szHint.height = height; szHint.flags |= USSize; } TermWin.ncol = szHint.width; TermWin.nrow = szHint.height; change_font (1, NULL); if (flags & XValue) { if (flags & XNegative) { x += (DisplayWidth (Xdisplay, Xscreen) - (szHint.width + TermWin_internalBorder)); szHint.win_gravity = NorthEastGravity; } szHint.x = x; szHint.flags |= USPosition; } if (flags & YValue) { if (flags & YNegative) { y += (DisplayHeight (Xdisplay, Xscreen) - (szHint.height + TermWin_internalBorder)); szHint.win_gravity = (szHint.win_gravity == NorthEastGravity ? SouthEastGravity : SouthWestGravity); } szHint.y = y; szHint.flags |= USPosition; } /* parent window - reverse video so we can see placement errors * sub-window placement & size in resize_subwindows() */ TermWin.parent = XCreateSimpleWindow (Xdisplay, Xroot, szHint.x, szHint.y, szHint.width, szHint.height, BORDERWIDTH, PixColors[bgColor], PixColors[fgColor]); xterm_seq (XTerm_title, rs_title); xterm_seq (XTerm_iconName, rs_iconName); /* ignore warning about discarded `const' */ classHint.res_name = rs_name; classHint.res_class = APL_CLASS; wmHint.input = True; wmHint.initial_state = (Options & Opt_iconic ? IconicState : NormalState); wmHint.flags = (InputHint | StateHint); XSetWMProperties (Xdisplay, TermWin.parent, NULL, NULL, argv, argc, &szHint, &wmHint, &classHint); XSelectInput (Xdisplay, TermWin.parent, (KeyPressMask | FocusChangeMask | StructureNotifyMask | VisibilityChangeMask) ); /* vt cursor: Black-on-White is standard, but this is more popular */ TermWin_cursor = XCreateFontCursor (Xdisplay, XC_xterm); { XColor fg, bg; fg.pixel = PixColors[fgColor]; XQueryColor (Xdisplay, Xcmap, &fg); bg.pixel = PixColors[bgColor]; XQueryColor (Xdisplay, Xcmap, &bg); XRecolorCursor (Xdisplay, TermWin_cursor, &fg, &bg); } /* cursor (scrollBar): Black-on-White */ cursor = XCreateFontCursor (Xdisplay, XC_left_ptr); /* the vt window */ TermWin.vt = XCreateSimpleWindow (Xdisplay, TermWin.parent, 0, 0, szHint.width, szHint.height, 0, PixColors[fgColor], PixColors[bgColor]); XDefineCursor (Xdisplay, TermWin.vt, TermWin_cursor); XSelectInput (Xdisplay, TermWin.vt, (ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button3MotionMask)); XMapWindow (Xdisplay, TermWin.vt); XMapWindow (Xdisplay, TermWin.parent); /* scrollBar: size doesn't matter */ scrollBar.win = XCreateSimpleWindow (Xdisplay, TermWin.parent, 0, 0, 1, 1, 0, PixColors[fgColor], PixColors[bgColor]); XDefineCursor (Xdisplay, scrollBar.win, cursor); XSelectInput (Xdisplay, scrollBar.win, (ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask) ); #ifdef XPM_BACKGROUND if (rs_backgroundPixmap != NULL) { char *p = rs_backgroundPixmap; if ((p = strchr (p, ';')) != NULL) { p++; scale_pixmap (p); } set_bgPixmap (rs_backgroundPixmap); } #endif /* XPM_BACKGROUND */ /* graphics context for the vt window */ { XGCValues gcvalue; gcvalue.font = TermWin.font->fid; gcvalue.foreground = PixColors[fgColor]; gcvalue.background = PixColors[bgColor]; TermWin.gc = XCreateGC (Xdisplay, TermWin.vt, GCForeground | GCBackground | GCFont, &gcvalue); } } /*}}} */ /*{{{ window resizing - assuming the parent window is the correct size */ static void resize_subwindows (int width, int height) { int x = 0, y = 0; int old_width = TermWin.width; int old_height = TermWin.height; TermWin.width = TermWin.ncol * TermWin.fwidth; TermWin.height = TermWin.nrow * TermWin.fheight; /* size and placement */ if (scrollbar_visible ()) { scrollBar.beg = 0; scrollBar.end = height; #ifndef XTERM_SCROLLBAR /* arrows are as high as wide - leave 1 pixel gap */ scrollBar.beg += (SB_WIDTH + 1); scrollBar.end -= (SB_WIDTH + 1); #endif width -= SB_WIDTH; XMoveResizeWindow (Xdisplay, scrollBar.win, #ifdef SCROLLBAR_RIGHT width, 0, #else x, 0, #endif SB_WIDTH, height); #ifndef SCROLLBAR_RIGHT x = SB_WIDTH; /* placement of vt window */ #endif } XMoveResizeWindow (Xdisplay, TermWin.vt, x, y, width, height + 1); if (old_width) Gr_Resize (old_width, old_height); XClearWindow (Xdisplay, TermWin.vt); resize_pixmap (); XSync (Xdisplay, 0); } static void resize (void) { szHint.base_width = (2 * TermWin_internalBorder); szHint.base_height = (2 * TermWin_internalBorder); szHint.base_width += (scrollbar_visible ()? SB_WIDTH : 0); szHint.min_width = szHint.base_width + szHint.width_inc; szHint.min_height = szHint.base_height + szHint.height_inc; szHint.width = szHint.base_width + TermWin.width; szHint.height = szHint.base_height + TermWin.height; szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; XSetWMNormalHints (Xdisplay, TermWin.parent, &szHint); XResizeWindow (Xdisplay, TermWin.parent, szHint.width, szHint.height); resize_subwindows (szHint.width, szHint.height); } void map_scrollBar (int map) { if (scrollbar_mapping (map)) { scr_touch (); resize (); } } /* * Redraw window after exposure or size change */ static void resize_window1 (unsigned int width, unsigned int height) { static short first_time = 1; int new_ncol = (width - szHint.base_width) / TermWin.fwidth; int new_nrow = (height - szHint.base_height) / TermWin.fheight; if (first_time || (new_ncol != TermWin.ncol) || (new_nrow != TermWin.nrow)) { int curr_screen = -1; /* scr_reset only works on the primary screen */ if (!first_time) /* this is not the first time thru */ { selection_clear (); curr_screen = scr_change_screen (PRIMARY); } TermWin.ncol = new_ncol; TermWin.nrow = new_nrow; resize_subwindows (width, height); scr_reset (); if (curr_screen >= 0) /* this is not the first time thru */ scr_change_screen (curr_screen); first_time = 0; } } /* * good for toggling 80/132 columns */ void set_width (unsigned short width) { unsigned short height = TermWin.nrow; if (width != TermWin.ncol) { width = szHint.base_width + width * TermWin.fwidth; height = szHint.base_height + height * TermWin.fheight; XResizeWindow (Xdisplay, TermWin.parent, width, height); resize_window1 (width, height); } } /* * Redraw window after exposure or size change */ void resize_window (void) { Window root; XEvent dummy; int x, y; unsigned int border, depth, width, height; while (XCheckTypedWindowEvent (Xdisplay, TermWin.parent, ConfigureNotify, &dummy)); XGetGeometry (Xdisplay, TermWin.parent, &root, &x, &y, &width, &height, &border, &depth); /* parent already resized */ resize_window1 (width, height); } /*}}} */ /*{{{ xterm sequences - title, iconName, color (exptl) */ #ifdef SMART_WINDOW_TITLE static void set_title (const char *str) { char *name; if (XFetchName (Xdisplay, TermWin.parent, &name)) name = NULL; if (name == NULL || strcmp (name, str)) XStoreName (Xdisplay, TermWin.parent, str); if (name) XFree (name); } #else #define set_title(str) XStoreName (Xdisplay, TermWin.parent, str) #endif #ifdef SMART_WINDOW_TITLE static void set_iconName (const char *str) { char *name; if (XGetIconName (Xdisplay, TermWin.parent, &name)) name = NULL; if (name == NULL || strcmp (name, str)) XSetIconName (Xdisplay, TermWin.parent, str); if (name) XFree (name); } #else #define set_iconName(str) XSetIconName (Xdisplay, TermWin.parent, str) #endif #ifdef XTERM_COLOR_CHANGE static void set_window_color (int idx, const char *color) { const char *const msg = "can't load color \"%s\""; XColor xcol; int i; if (color == NULL || *color == '\0') return; /* handle color aliases */ if (isdigit (*color)) { i = atoi (color); if (i >= 8 && i <= 15) /* bright colors */ { i -= 8; #ifndef NO_BRIGHTCOLOR PixColors[idx] = PixColors[minBright + i]; goto Done; #endif } if (i >= 0 && i <= 7) /* normal colors */ { PixColors[idx] = PixColors[minColor + i]; goto Done; } } if (!XParseColor (Xdisplay, Xcmap, color, &xcol) || !XAllocColor (Xdisplay, Xcmap, &xcol)) { print_error (msg, color); return; } /* XStoreColor (Xdisplay, Xcmap, XColor*); */ /* * FIXME: should free colors here, but no idea how to do it so instead, * so just keep gobbling up the colormap */ #if 0 for (i = blackColor; i <= whiteColor; i++) if (PixColors[idx] == PixColors[i]) break; if (i > whiteColor) { /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ XFreeColors (Xdisplay, Xcmap, (PixColors + idx), 1, DisplayPlanes (Xdisplay, Xscreen)); } #endif PixColors[idx] = xcol.pixel; /* XSetWindowAttributes attr; */ /* Cursor cursor; */ Done: if (idx == bgColor) XSetWindowBackground (Xdisplay, TermWin.vt, PixColors[bgColor]); /* handle colorBD, scrollbar background, etc. */ set_colorfgbg (); { XColor fg, bg; fg.pixel = PixColors[fgColor]; XQueryColor (Xdisplay, Xcmap, &fg); bg.pixel = PixColors[bgColor]; XQueryColor (Xdisplay, Xcmap, &bg); XRecolorCursor (Xdisplay, TermWin_cursor, &fg, &bg); } /* the only reasonable way to enforce a clean update */ scr_poweron (); } #else #define set_window_color(idx,color) ((void)0) #endif /* XTERM_COLOR_CHANGE */ #ifdef XPM_BACKGROUND /* * search for FILE in the current working directory, and within the * colon-delimited PATHLIST, adding the file extension EXT if required. * * FILE is either semi-colon or zero terminated */ static const char * search_path (const char *pathlist, const char *file, const char *ext) { static char name[256]; char *p, *path; int maxpath, len; if (!access (file, R_OK)) return file; /* semi-colon delimited */ if ((p = strchr (file, ';')) == NULL) p = strchr (file, '\0'); len = (p - file); /* check about adding a trailing extension */ if (ext != NULL) { char *dot; dot = strrchr (p, '.'); path = strrchr (p, '/'); if (dot != NULL || (path != NULL && dot <= path)) ext = NULL; } /* leave room for an extra '/' and trailing '\0' */ maxpath = sizeof (name) - (len + (ext ? strlen (ext) : 0) + 2); if (maxpath <= 0) return NULL; for (path = pathlist; path != NULL && *path != '\0'; path = p) { int n; /* colon delimited */ if ((p = strchr (path, ':')) == NULL) p = strchr (path, '\0'); n = (p - path); if (*p != '\0') p++; if (n > 0 && n <= maxpath) { strncpy (name, path, n); if (name[n - 1] != '/') name[n++] = '/'; name[n] = '\0'; strncat (name, file, len); if (!access (name, R_OK)) return name; if (ext) { strcat (name, ext); if (!access (name, R_OK)) return name; } } } return NULL; } #endif /* XPM_BACKGROUND */ #ifdef XPM_BACKGROUND #define XPM_EXT ".xpm" Pixmap set_bgPixmap (const char *file) { char *f; assert (file != NULL); if (bgPixmap.pixmap != None) { XFreePixmap (Xdisplay, bgPixmap.pixmap); bgPixmap.pixmap = None; } XSetWindowBackground (Xdisplay, TermWin.vt, PixColors[bgColor]); if (*file != '\0') { XWindowAttributes attr; XGetWindowAttributes (Xdisplay, Xroot, &attr); xpmAttr.closeness = 30000; xpmAttr.colormap = attr.colormap; xpmAttr.valuemask = (XpmCloseness | XpmColormap | XpmSize | XpmReturnPixels); /* search environment variables here too */ if ((f = search_path (rs_path, file, XPM_EXT)) == NULL) #ifdef PATH_ENV if ((f = search_path (getenv (PATH_ENV), file, XPM_EXT)) == NULL) #endif f = search_path (getenv ("PATH"), file, XPM_EXT); if (f == NULL || XpmReadFileToPixmap (Xdisplay, Xroot, f, &bgPixmap.pixmap, NULL, &xpmAttr)) { char *p; /* semi-colon delimited */ if ((p = strchr (file, ';')) == NULL) p = strchr (file, '\0'); print_error ("couldn't load XPM file \"%.*s\"", (p - file), file); resize_pixmap (); } else if (bgPixmap.pixmap != None) resize_pixmap (); } XClearWindow (Xdisplay, TermWin.vt); scr_touch (); XFlush (Xdisplay); return bgPixmap.pixmap; } #undef XPM_EXT #endif /* XPM_BACKGROUND */ /* * XTerm escape sequences: ESC ] Ps;Pt BEL * 0 = change iconName/title * 1 = change iconName * 2 = change title * 46 = change logfile (not implemented) * 50 = change font * * rxvt extensions: * 20 = bg pixmap * 39 = change default fg color * 49 = change default bg color */ void xterm_seq (int op, char *str) { int changed = 0; assert (str != NULL); switch (op) { case XTerm_name: set_title (str); /* drop */ case XTerm_iconName: set_iconName (str); break; case XTerm_title: set_title (str); break; case XTerm_Pixmap: #ifdef XPM_BACKGROUND if (*str != ';') set_bgPixmap (str); while ((str = strchr (str, ';')) != NULL) { str++; changed += scale_pixmap (str); } if (changed) { resize_pixmap (); scr_touch (); } #endif /* XPM_BACKGROUND */ break; case XTerm_restoreFG: set_window_color (fgColor, str); break; case XTerm_restoreBG: set_window_color (bgColor, str); break; case XTerm_logfile: break; case XTerm_font: change_font (0, str); break; } } /*}}} */ /*{{{ change_font() - Switch to a new font */ /* * init = 1 - initialize * * fontname == FONT_UP - switch to bigger font * fontname == FONT_DN - switch to smaller font */ void change_font (int init, const char *fontname) { const char *const msg = "can't load font \"%s\""; XFontStruct *xfont; static char *newfont[NFONTS]; #ifndef NO_BOLDFONT static XFontStruct *boldFont = NULL; #endif static int fnum = FONT0_IDX; /* logical font number */ int idx = 0; /* index into rs_font[] */ #if (FONT0_IDX == 0) #define IDX2FNUM(i) (i) #define FNUM2IDX(f) (f) #else #define IDX2FNUM(i) (i == 0? FONT0_IDX : (i <= FONT0_IDX? (i-1) : i)) #define FNUM2IDX(f) (f == FONT0_IDX ? 0 : (f < FONT0_IDX ? (f+1) : f)) #endif #define FNUM_RANGE(i) (i <= 0 ? 0 : (i >= NFONTS ? (NFONTS-1) : i)) if (!init) { switch (fontname[0]) { case '\0': fnum = FONT0_IDX; fontname = NULL; break; /* special (internal) prefix for font commands */ case FONT_CMD: idx = atoi (fontname + 1); switch (fontname[1]) { case '+': /* corresponds to FONT_UP */ fnum += (idx ? idx : 1); fnum = FNUM_RANGE (fnum); break; case '-': /* corresponds to FONT_DN */ fnum += (idx ? idx : -1); fnum = FNUM_RANGE (fnum); break; default: if (fontname[1] != '\0' && !isdigit (fontname[1])) return; if (idx < 0 || idx >= (NFONTS)) return; fnum = IDX2FNUM (idx); break; } fontname = NULL; break; default: if (fontname != NULL) { /* search for existing fontname */ for (idx = 0; idx < NFONTS; idx++) { if (!strcmp (rs_font[idx], fontname)) { fnum = IDX2FNUM (idx); fontname = NULL; break; } } } else return; break; } /* re-position around the normal font */ idx = FNUM2IDX (fnum); if (fontname != NULL) { char *name; xfont = XLoadQueryFont (Xdisplay, fontname); if (!xfont) return; name = MALLOC (strlen (fontname + 1) * sizeof (char), "font"); if (name == NULL) { XFreeFont (Xdisplay, xfont); return; } strcpy (name, fontname); if (newfont[idx] != NULL) FREE (newfont[idx], "id", "fn"); newfont[idx] = name; rs_font[idx] = newfont[idx]; } } if (TermWin.font) XFreeFont (Xdisplay, TermWin.font); /* load font or substitute */ xfont = XLoadQueryFont (Xdisplay, rs_font[idx]); if (!xfont) { print_error (msg, rs_font[idx]); rs_font[idx] = "fixed"; xfont = XLoadQueryFont (Xdisplay, rs_font[idx]); if (!xfont) { print_error (msg, rs_font[idx]); goto Abort; } } TermWin.font = xfont; #ifndef NO_BOLDFONT /* fail silently */ if (init && rs_boldFont != NULL) boldFont = XLoadQueryFont (Xdisplay, rs_boldFont); #endif #ifdef KANJI if (TermWin.kanji) XFreeFont (Xdisplay, TermWin.kanji); /* load font or substitute */ xfont = XLoadQueryFont (Xdisplay, rs_kfont[idx]); if (!xfont) { print_error (msg, rs_kfont[idx]); rs_kfont[idx] = "k14"; xfont = XLoadQueryFont (Xdisplay, rs_kfont[idx]); if (!xfont) { print_error (msg, rs_kfont[idx]); goto Abort; } } TermWin.kanji = xfont; #endif /* KANJI */ /* alter existing GC */ if (!init) { XSetFont (Xdisplay, TermWin.gc, TermWin.font->fid); } /* set the sizes */ { int fw = XTextWidth (TermWin.font, "MMMMMMMMMM", 10) / 10; int fh = TermWin.font->ascent + TermWin.font->descent; /* not the first time thru and sizes haven't changed */ if (fw == TermWin.fwidth && fh == TermWin.fheight) return; TermWin.fwidth = fw; TermWin.fheight = fh; } /* check that size of boldFont is okay */ #ifndef NO_BOLDFONT if (boldFont != NULL && TermWin.fwidth == (XTextWidth (boldFont, "MMMMMMMMMM", 10) / 10) && TermWin.fheight == (boldFont->ascent + boldFont->descent)) TermWin.boldFont = boldFont; else TermWin.boldFont = NULL; #endif /* NO_BOLDFONT */ set_colorfgbg (); TermWin.width = TermWin.ncol * TermWin.fwidth; TermWin.height = TermWin.nrow * TermWin.fheight; szHint.width_inc = TermWin.fwidth; szHint.height_inc = TermWin.fheight; szHint.min_width = szHint.base_width + szHint.width_inc; szHint.min_height = szHint.base_height + szHint.height_inc; szHint.width = szHint.base_width + TermWin.width; szHint.height = szHint.base_height + TermWin.height; szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; if (!init) resize (); return; Abort: print_error ("aborting"); /* fatal problem */ exit (EXIT_FAILURE); #undef IDX2FNUM #undef FNUM2IDX #undef FNUM_RANGE } /*}}} */ /*{{{ main() */ int main (int argc, char *argv[]) { int i; char *val, **cmd_argv = NULL; /* "WINDOWID=\0" = 10 chars, UINT_MAX = 10 chars */ static char windowid_string[20], *display_string; for (i = 0; i < argc; i++) { if (!strcmp (argv[i], "-e")) { argc = i; argv[argc] = NULL; if (argv[argc + 1] != NULL) { cmd_argv = (argv + argc + 1); if (cmd_argv[0] != NULL) rs_iconName = rs_title = my_basename (cmd_argv[0]); } break; } } rs_name = my_basename (argv[0]); /* * Open display, get options/resources and create the window */ if ((display_name = getenv ("DISPLAY")) == NULL) display_name = ":0"; get_options (argc, argv); Xdisplay = XOpenDisplay (display_name); if (!Xdisplay) { print_error ("can't open display %s", display_name); exit (EXIT_FAILURE); } extract_resources (Xdisplay, rs_name); /* * set any defaults not already set */ if (!rs_title) rs_title = rs_name; if (!rs_iconName) rs_iconName = rs_name; if (!rs_saveLines || (TermWin.saveLines = atoi (rs_saveLines)) < 0) TermWin.saveLines = SAVELINES; /* no point having a scrollbar without having any scrollback! */ if (!TermWin.saveLines) Options &= ~Opt_scrollBar; #ifdef PRINTPIPE if (!rs_print_pipe) rs_print_pipe = PRINTPIPE; #endif if (!rs_cutchars) rs_cutchars = CUTCHARS; #ifndef NO_BOLDFONT if (rs_font[0] == NULL && rs_boldFont != NULL) { rs_font[0] = rs_boldFont; rs_boldFont = NULL; } #endif for (i = 0; i < NFONTS; i++) { if (!rs_font[i]) rs_font[i] = def_fontName[i]; #ifdef KANJI if (!rs_kfont[i]) rs_kfont[i] = def_kfontName[i]; #endif } #ifdef XTERM_REVERSE_VIDEO /* this is how xterm implements reverseVideo */ if (Options & Opt_reverseVideo) { if (!rs_color[fgColor]) rs_color[fgColor] = def_colorName[bgColor]; if (!rs_color[bgColor]) rs_color[bgColor] = def_colorName[fgColor]; } #endif for (i = 0; i < NRS_COLORS; i++) if (!rs_color[i]) rs_color[i] = def_colorName[i]; #ifndef XTERM_REVERSE_VIDEO /* this is how we implement reverseVideo */ if (Options & Opt_reverseVideo) { const char *name; /* swap foreground/background colors */ name = rs_color[fgColor]; rs_color[fgColor] = rs_color[bgColor]; rs_color[bgColor] = name; name = def_colorName[fgColor]; def_colorName[fgColor] = def_colorName[bgColor]; def_colorName[bgColor] = name; } #endif /* convenient aliases for setting fg/bg to colors */ color_aliases (fgColor); color_aliases (bgColor); #ifndef NO_CURSORCOLOR color_aliases (cursorColor); color_aliases (cursorColor2); #endif /* NO_CURSORCOLOR */ #ifndef NO_BOLDUNDERLINE color_aliases (colorBD); color_aliases (colorUL); #endif /* NO_BOLDUNDERLINE */ Create_Windows (argc, argv); scr_reset (); /* initialize screen */ Gr_reset (); /* reset graphics */ /* add scrollBar, do it directly to avoid resize() */ scrollbar_mapping (Options & Opt_scrollBar); #ifdef DEBUG_X XSynchronize (Xdisplay, True); XSetErrorHandler ((XErrorHandler) abort); #else XSetErrorHandler ((XErrorHandler) xerror_handler); #endif #ifdef DISPLAY_IS_IP /* Fixup display_name for export over pty to any interested terminal * clients via "ESC[7n" (e.g. shells). Note we use the pure IP number * (for the first non-loopback interface) that we get from * network_display(). This is more "name-resolution-portable", if you * will, and probably allows for faster x-client startup if your name * server is beyond a slow link or overloaded at client startup. Of * course that only helps the shell's child processes, not us. * * Giving out the display_name also affords a potential security hole */ val = display_name = network_display (display_name); if (val == NULL) #endif /* DISPLAY_IS_IP */ val = XDisplayString (Xdisplay); if (display_name == NULL) display_name = val; /* use broken `:0' value */ i = strlen (val); display_string = MALLOC ((i + 9) * sizeof (char), "display_string"); sprintf (display_string, "DISPLAY=%s", val); sprintf (windowid_string, "WINDOWID=%u", (unsigned int) TermWin.parent); /* add entries to the environment: * @ DISPLAY: in case we started with -display * @ WINDOWID: X window id number of the window * @ COLORTERM: terminal sub-name and also indicates its color * @ TERM: terminal name */ putenv (display_string); putenv (windowid_string); if (Xdepth <= 2) { putenv ("COLORTERM=" COLORTERMENV "-mono"); putenv ("TERM=" TERMENV); } else { #ifdef XPM_BACKGROUND putenv ("COLORTERM=" COLORTERMENV "-xpm"); #else putenv ("COLORTERM=" COLORTERMENV); #endif #ifdef DEFINE_XTERM_COLOR putenv ("TERM=" TERMENV "-color"); #else putenv ("TERM=" TERMENV); #endif } init_command (cmd_argv); main_loop (); /* main processing loop */ return EXIT_SUCCESS; } /*}}} */ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/Xtensions/graphics/screen.h0000644000175000017500000001276511375434150020375 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: screen.h * * This module is all new by Robert Nation * * * Additional modifications by mj olesen * No additional restrictions are applied. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ #ifndef _SCREEN_H #define _SCREEN_H /*{{{ includes */ #include #include "main.h" /*}}} */ /*{{{ defines */ /* Screen refresh methods */ #define NO_REFRESH 2 /* Window not visible at all! */ #define SLOW_REFRESH 1 /* No Bitblt */ #define FAST_REFRESH 0 #define IGNORE 0 #define SAVE 's' #define RESTORE 'r' /* flags for scr_gotorc() */ #define C_RELATIVE 1 /* col movement is relative */ #define R_RELATIVE 2 /* row movement is relative */ #define RELATIVE (R_RELATIVE|C_RELATIVE) /* move row/col relative */ /* modes for scr_insdel_chars(), scr_insdel_lines() */ #define INSERT -1 /* don't change these values */ #define DELETE +1 #define ERASE +2 /* modes for scr_page() */ #define UP +1 /* don't change these values */ #define DN -1 /* arguments for scr_change_screen() */ #define PRIMARY 0 #define SECONDARY 1 /* rendition style flags */ #define RS_None 0 /* Normal */ #define RS_Cursor 0x01000000u /* cursor location */ #define RS_Select 0x02000000u /* selected text */ #define RS_RVid 0x04000000u /* reverse video */ #define RS_Uline 0x08000000u /* underline */ #define RS_acsFont 0x10000000u /* ACS - graphics character set */ #define RS_ukFont 0x20000000u /* UK character set */ #define RS_fontMask (RS_acsFont|RS_ukFont) #ifdef KANJI #define RS_kanji0 0x40000000u /* only kanji */ #define RS_kanji1 0x80000000u /* kanji 1st byte */ #define RS_kanjiMask (RS_kanji0|RS_kanji1) /* kanji 2nd byte */ #endif #define RS_fgMask 0x00001F00u /* 32 colors */ #define RS_Bold 0x00008000u /* bold */ #define RS_bgMask 0x001F0000u /* 32 colors */ #define RS_Blink 0x00800000u /* blink */ #define RS_attrMask (0xFF000000u|RS_Bold|RS_Blink) /*}}} */ /*{{{ macros */ /* how to build & extract colors and attributes */ #define GET_FGCOLOR(r) (((r) & RS_fgMask)>>8) #define GET_BGCOLOR(r) (((r) & RS_bgMask)>>16) #define GET_ATTR(r) (((r) & RS_attrMask)) #define SET_FGCOLOR(r,fg) (((r) & ~RS_fgMask) | ((fg)<<8)) #define SET_BGCOLOR(r,bg) (((r) & ~RS_bgMask) | ((bg)<<16)) #define SET_ATTR(r,a) (((r) & ~RS_attrMask)| (a)) #define DEFAULT_RSTYLE (RS_None | (fgColor<<8) | (bgColor<<16)) /*}}} */ /*{{{ extern variables */ #ifndef NO_BRIGHTCOLOR extern unsigned int colorfgbg; #endif /*}}} */ /*{{{ prototypes: */ _XFUNCPROTOBEGIN extern void scr_reset (void); extern void scr_poweron (void); extern void scr_backspace (void); extern void scr_bell (void); extern void scr_rendition (int /* set */ , int /* style */ ); extern void scr_add_lines (const unsigned char * /* str */ , int /* nlines */ , int /* cnt */ ); extern void scr_tab (int /* count */ ); extern void scr_gotorc (int /* row */ , int /* col */ , int /* relative */ ); extern void scr_index (int /* direction */ ); extern void scr_cursor (int /* mode */ ); extern void scr_cursor_visible (int /* mode */ ); extern void scr_erase_line (int /* mode */ ); extern void scr_erase_screen (int /* mode */ ); extern void scr_insdel_lines (int /* count */ , int /* insdel */ ); extern void scr_insdel_chars (int /* count */ , int /* insdel */ ); extern void scr_scroll_region (int /* top */ , int /* bot */ ); extern void scr_report_position (void); extern void scr_expose (int /* x */ , int /* y */ , int /* width */ , int /* height */ ); extern void scr_touch (void); extern void scr_charset_choose (int /* set */ ); extern void scr_charset_set (int /* set */ , unsigned int /* ch */ ); extern void scr_refresh (int /* type */ ); extern void scr_set_tab (int /* mode */ ); extern void scr_E (void); extern void scr_color (unsigned int /* color */ , unsigned int /* Intensity */ ); extern int scr_move_to (int /* y */ , int /* len */ ); extern int scr_page (int /* dirn */ , int /* n */ ); extern int scr_change_screen (int /* scrn */ ); extern int scr_get_fgcolor (void); extern int scr_get_bgcolor (void); extern void mouse_report (XButtonEvent * /* ev */ ); /* mode selections */ extern void scr_autowrap (int /* mode */ ); extern void scr_relative_origin (int /* mode */ ); extern void scr_insert_mode (int /* mode */ ); extern void scr_rvideo_mode (int /* mode */ ); #ifdef PRINTPIPE extern void scr_printscreen (int /* fullhist */ ); #endif extern void selection_make (Time /* tm */ ); extern void selection_send (XSelectionRequestEvent * /* rq */ ); extern void selection_paste (Window /* win */ , unsigned /* prop */ , int /* Delete */ ); extern void selection_request (Time /* tm */ , int /* x */ , int /* y */ ); extern void selection_reset (void); extern void selection_clear (void); extern void selection_extend (int /* x */ , int /* y */ ); extern void selection_start (int /* x */ , int /* y */ ); extern void selection_click (int /* clicks */ , int /* x */ , int /* y */ ); #ifdef KANJI extern void set_kanji_encoding (const char * /* str */ ); #endif _XFUNCPROTOEND /*}}} */ #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/Xtensions/graphics/graphics.h0000644000175000017500000000322411375434150020704 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: graphics.h * * function declarations for graphics.c, only to be included by the rxvt * source itself. * * To use graphics in external programs only include "rxvtgrx.h" *----------------------------------------------------------------------*/ #ifndef _GRAPHICS_H #define _GRAPHICS_H #include #include "rxvtgrx.h" /* text alignment */ /* * number of graphics points * divisible by 2 (num lines) * divisible by 4 (num rect) */ #define NGRX_PTS 1000 _XFUNCPROTOBEGIN extern void Gr_ButtonReport (int /* but */ , int /* x */ , int /* y */ ); extern void Gr_do_graphics (int /* cmd */ , int /* nargs */ , int /* args */ [], unsigned char * /* text */ ); extern void Gr_scroll (int /* count */ ); extern void Gr_ClearScreen (void); extern void Gr_ChangeScreen (void); extern void Gr_expose (Window /* win */ ); extern void Gr_Resize (int /* w */ , int /* h */ ); extern void Gr_reset (void); extern int Gr_Displayed (void); _XFUNCPROTOEND #ifdef RXVT_GRAPHICS #define Gr_ButtonPress(x,y) Gr_ButtonReport ('P',(x),(y)) #define Gr_ButtonRelease(x,y) Gr_ButtonReport ('R',(x),(y)) #else #define Gr_ButtonPress(x,y) ((void)0) #define Gr_ButtonRelease(x,y) ((void)0) #define Gr_scroll(count) ((void)0) #define Gr_ClearScreen() ((void)0) #define Gr_ChangeScreen() ((void)0) #define Gr_expose(win) ((void)0) #define Gr_Resize(w,h) ((void)0) #define Gr_reset() ((void)0) #define Gr_Displayed() (0) /* return zero */ #endif #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/Xtensions/graphics/feature.h0000644000175000017500000003162711375434150020547 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: feature.h * * Compile-time configuration. * Additional compile-time configuration in "defaults.h" * ---------------------------------------------------------------------- * Copyright 1995,1996 * mj olesen Queen's Univ at Kingston * * You can do what you like with this source code provided you don't make * money from it and you include an unaltered copy of this message * (including the copyright). As usual, the author accepts no * responsibility for anything, nor does he guarantee anything whatsoever. *----------------------------------------------------------------------*/ #ifndef _FEATURE_H #define _FEATURE_H /*{{{ system hacks: */ /*----------------------------------------------------------------------*/ /* Consistent defines - please report on the necessity * @ Unixware: defines (__svr4__) */ #if defined (SVR4) && !defined (__svr4__) #define __svr4__ #endif #if defined (sun) && !defined (__sun__) #define __sun__ #endif /* * sun isn't properly protected? * anyway, it causes problems when is also included */ #if defined (__sun__) #undef HAVE_SYS_IOCTL_H #endif /*}}} */ /*{{{ debugging: */ /*----------------------------------------------------------------------* * #define NDEBUG * to disable whichever assert() macros are used in the code * * #define DEBUG_SCREEN * to do self-check for internal screen corruption * * #define DEBUG_MALLOC * to do self-check on out-of-bound memory usage * * #define DEBUG_CMD * to output some data structures of command.c * (key-buffer contents, command line, tty permissions) * * #define DEBUG_TTY * to output tty settings * * #define DEBUG_COLORS * to print out current color/renditions as they change * * #define DEBUG_SELECTION * to use XK_Print to dump information about the current selection * * #define DEBUG_DEPTH 1 * to set the X color depth, for debugging lower depth modes *----------------------------------------------------------------------*/ /* #define NDEBUG */ #ifndef NDEBUG /* # define DEBUG_SCREEN */ /* # define DEBUG_MALLOC */ /* # define DEBUG_CMD */ /* # define DEBUG_TTY */ /* # define DEBUG_COLORS */ /* # define DEBUG_SELECTION */ /* # define DEBUG_DEPTH 1 */ #endif /*}}} */ /*{{{ screen/colors: */ /*----------------------------------------------------------------------* * #define XPM_BACKGROUND * to add sexy-looking background pixmaps. Needs libxpm * * #define XPM_SCALING * to allow pixmaps to be dynamically scaled * * #define PATH_ENV "RXVTPATH" * to define the name of the environment variable to be used in * addition to the "PATH" environment and the `path' resource * * #define XPM_BUFFERING * to use xpm buffers for the screen update * (bigger & faster? ... but does it work correctly?) * * #define NO_CURSORCOLOR * to avoid enabling a color cursor (-cr, cursorColor, cursorColor2) * * #define NO_BRIGHTCOLOR * to suppress use of BOLD and BLINK attributes for setting * bright foreground and background, respectively. * Simulate BOLD using colorBD, boldFont or overstrike characters. * * #define NO_BOLDUNDERLINE * to disable separate colors for bold/underline * * #define NO_BOLDOVERSTRIKE * to disable using simulated bold using overstrike * * #define NO_BOLDFONT * to compile without support for real bold fonts * * #define NO_SECONDARY_SCREEN * to disable the secondary screen ("\E[?47h" / "\E[?47l") * * #define REFRESH_PERIOD * to limit the number of screenfulls between screen refreshes * during hard & fast scrolling [default: 1] * * #define USE_XCOPYAREA * to use XCopyArea (in place of re-draws) to speed up rxvt. * - I've been told this helps with some graphics adapters like the * PC's et4000. OK, it's good on monochrome Sun-3's that I've tried * too. /RN * - sometimes looks worse and slower /mjo * * #define PRINTPIPE "lpr" * to define a printer pipe which will be used for emulation of an * attached vt100 printer * * #define OLD_COLOR_MODEL * to use the old color model whereby erasing is done with the * default rendition rather than the current rendition * NB: this make break some applications and should used with caution *----------------------------------------------------------------------*/ #define XPM_BACKGROUND #define XPM_SCALING #define PATH_ENV "PATH" #define XPM_BUFFERING /* #define NO_CURSORCOLOR */ /* #define NO_BRIGHTCOLOR */ /* #define NO_BOLDUNDERLINE */ #define NO_BOLDOVERSTRIKE #define NO_BOLDFONT /* #define NO_SECONDARY_SCREEN */ /* #define REFRESH_PERIOD 1 */ /* #define USE_XCOPYAREA */ /* #define PRINTPIPE "lpr" */ /* #define OLD_COLOR_MODEL */ /*}}} */ /*{{{ resources: */ /*----------------------------------------------------------------------* * #define NO_RESOURCES * to blow off the Xdefaults altogether * * #define USE_XGETDEFAULT * to use XGetDefault() instead of the default, which is to use a * substitute for using XGetDefaults() that saves 60-150kB memory * * The default is best if all you want to do is put rxvt defaults * in ~/.Xdefaults file, * * #define XAPPLOADDIR "/usr/lib/X11/app-defaults" * to define where to find installed application defaults for rxvt * Only if USE_XGETDEFAULT is not defined. * * #define OFFIX_DND * to add support for the Offix DND (Drag 'n' Drop) protocol *----------------------------------------------------------------------*/ /* #define NO_RESOURCES */ #define USE_XGETDEFAULT #ifndef XAPPLOADDIR #define XAPPLOADDIR "/usr/lib/X11/app-defaults" #endif /* #define OFFIX_DND */ /*}}} */ /*{{{ keys: */ /*----------------------------------------------------------------------* * #define NO_DELETE_KEY * to use the unadulterated X server value for the Delete key * * #define DONT_GUESS_BACKSPACE * to use ^H for the Backspace key and avoid using the current stty * setting of erase to guess a Backspace value of either ^H or ^? * * #define HOTKEY_CTRL * #define HOTKEY_META * choose one of these values to be the `hotkey' for changing font. * -- obsolete * * #define LINUX_KEYS * to use * Home = "\E[1~", End = "\E[4~" * instead of * Home = "\E[7~", End = "\E[8~" [default] * * #define KEYSYM_RESOURCE * to enable the keysym resource which allows you to define * strings associated with various KeySyms (0xFF00 - 0xFFFF). * Only works with the default hand-rolled resources. * * #define NO_XLOCALE * to disable X11R6 support for European languages * - possibly still beta *----------------------------------------------------------------------*/ #if defined (__sun__) || defined (__svr4__) #define NO_DELETE_KEY /* favoured settings for these systems */ #endif /* #define NO_DELETE_KEY */ /* #define DONT_GUESS_BACKSPACE */ /* #define HOTKEY_CTRL */ /* #define HOTKEY_META */ /* #define LINUX_KEYS */ #define KEYSYM_RESOURCE /* #define NO_XLOCALE */ /*}}} */ /*{{{ mouse/selection: */ /*----------------------------------------------------------------------* * #define NO_SCROLLBAR_REPORT * to disable sending escape sequences (up, down, page up/down) * from the scrollbar when XTerm mouse reporting is enabled * * #define CUTCHAR_RESOURCE * to add run-time support for changing the default cutchars * for double click selection * * #define MOUSE_REPORT_DOUBLECLICK * to have mouse reporting include double-click info for button1 * * #define MULTICLICK_TIME * to set delay between multiple click events [default: 500] *----------------------------------------------------------------------*/ /* #define NO_SCROLLBAR_REPORT */ /* #define CUTCHAR_RESOURCE */ /* #define MOUSE_REPORT_DOUBLECLICK */ /* #define MULTICLICK_TIME 500 */ /*}}} */ /*{{{ bell: */ /*----------------------------------------------------------------------* * #define NO_MAPALERT * to disable automatic de-iconify when a bell is received * * #define MAPALERT_OPTION * to have mapAlert behaviour selectable with mapAlert resource *----------------------------------------------------------------------*/ /* #define NO_MAPALERT */ /* #define MAPALERT_OPTION */ /*}}} */ /*{{{ scrollbar: */ /*----------------------------------------------------------------------* * #define XTERM_SCROLLBAR * to only use the XTerm-style scrollbar - no arrows, bitmapped * instead of the regular scrollbar (with arrows) * * ---------------------------------------------------------------------* * #define SCROLLBAR_RIGHT * to have the scrollbar on the right-hand side * * #define SB_WIDTH * to choose the scrollbar width - should be an even number [default: 10] * for XTERM_SCROLLBAR it is *always* 14. *----------------------------------------------------------------------*/ /* #define XTERM_SCROLLBAR */ /* #define SCROLLBAR_RIGHT */ #define SB_WIDTH 16 /*}}} */ /*{{{ multi-lingual: */ /*----------------------------------------------------------------------* * #define META8_OPTION * to allow run-time selection of Meta (Alt) to set the 8th bit on * * #define GREEK_SUPPORT * to include support for the Greek Elot-928 & IBM-437 keyboard * see doc/README.greek * * #define KANJI * to compile with Kanji support * after compilation, rename executable as `kxvt' *----------------------------------------------------------------------*/ /* #define META8_OPTION */ /* #define GREEK_SUPPORT */ /* #define KANJI */ /*}}} */ /*{{{ misc: */ /*----------------------------------------------------------------------* * #define DISPLAY_IS_IP * to have DISPLAY environment variable and "\E[7n" transmit * display with an IP number * * #define ENABLE_DISPLAY_ANSWER * to have "\E[7n" transmit the display name. * This has been cited as a potential security hole. * * #define ESCZ_ANSWER "\033[?1;2C" * to change what ESC Z transmits instead of the default "\E[?1;2c" * * #define SMART_WINDOW_TITLE * to check the current value of the window-time/icon-name and * avoid re-setting it to the same value -- avoids unnecessary window * refreshes * * #define XTERM_COLOR_CHANGE * to allow foreground/background color to be changed with an * xterm escape sequence "\E]39;color^G" -- still experimental * * #define DEFINE_XTERM_COLOR * to define TERM="xterm-color" instead of just TERM="xterm", which * is a useful addition to COLORTERM for distinguishing color * characteristics since it will be exported across rlogin/rsh *----------------------------------------------------------------------*/ /* #define DISPLAY_IS_IP */ /* #define ENABLE_DISPLAY_ANSWER */ /* #define ESCZ_ANSWER "\033[?1;2C" */ #define SMART_WINDOW_TITLE #define XTERM_COLOR_CHANGE #define DEFINE_XTERM_COLOR /*}}} */ /*{{{ utmp: */ /*----------------------------------------------------------------------* * #define UTMP_SUPPORT * for utmp support to update `/etc/utmp' to show rxvt logins * * For this to work, * - make Rxvt setuid root, a potential security hole but is * reportedly okay - do at your own risk * su * chown root.root rxvt * chmod a+s rxvt * - make Rxvt setuid/setgid to match user/group that owns `/etc/utmp' * * #define UTMP_FILENAME "/var/adm/utmp" (Irix, dec alpha) * #define UTMP_FILENAME "/var/run/utmp" (FreeBSD, NetBSD 0.9) * to define where the utmp file is located if it isn't /etc/utmp * and isn't defined by one of the myriad names in utmp.c * * #define TTYTAB_FILENAME "/etc/ttys" (FreeBSD, NetBSD 0.9) * for BSD-type systems, to define where the tty table is located * if it isn't /etc/ttytab *----------------------------------------------------------------------*/ /* #define UTMP_SUPPORT */ #ifdef UTMP_SUPPORT #ifndef UTMP_FILENAME /* # define UTMP_FILENAME "/var/adm/utmp" */ /* # define UTMP_FILENAME "/var/adm/utmp" */ #endif #ifndef TTYTAB_FILENAME /* # define TTYTAB_FILENAME "/etc/ttys" */ #endif #endif /*}}} */ /*{{{ sort out conflicts */ /*----------------------------------------------------------------------* * end of user configuration section *----------------------------------------------------------------------*/ #ifdef KANJI #undef GREEK_SUPPORT /* Kanji/Greek together is too weird */ #undef XTERM_FONT_CHANGE /* can't ensure font sizes will match */ #endif #ifdef XPM_BUFFERING #ifndef XPM_SCALING #define XPM_SCALING #endif #endif /* Define if you have the Xpm library (-lXpm). */ #ifndef HAVE_LIBXPM #undef XPM_BACKGROUND #endif /* disable what can't be used */ #ifndef XPM_BACKGROUND #undef XPM_BUFFERING #undef XPM_SCALING #undef XTERM_PIXMAP_CHANGE #endif #define APL_CLASS "XTerm" /* class name */ #define APL_SUBCLASS "Rxvt" /* also check resources under this name */ #define APL_NAME "rxvt" /* normal name */ /* COLORTERM, TERM environment variables */ #define COLORTERMENV "rxvt" #ifdef KANJI #define TERMENV "kterm" #else #define TERMENV "xterm" #endif #ifdef NO_MOUSE_REPORT #ifndef NO_MOUSE_REPORT_SCROLLBAR #define NO_MOUSE_REPORT_SCROLLBAR #endif #endif #if defined (NO_RESOURCES) || defined (USE_XGETDEFAULT) #undef KEYSYM_RESOURCE #endif #ifdef NO_RESOURCES #undef USE_XGETDEFAULT #endif /*}}} */ #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/Xtensions/graphics/Makefile.in0000644000175000017500000000573311375434150021007 0ustar thepthep# src/Makefile.in -*- Makefile -*- @MCOMMON@ basedir = $(srcdir)/.. thisdir = src first_rule: all dummy: SRCS = command.c debug.c graphics.c grkelot.c main.c misc.c\ netdisp.c screen.c scrollbar.c utmp.c xdefaults.c OBJS = command.o debug.o graphics.o grkelot.o main.o misc.o\ netdisp.o screen.o scrollbar.o utmp.o xdefaults.o HDRS = command.h debug.h defaults.h feature.h graphics.h grkelot.h\ main.h misc.h rxvtgrx.h screen.h scrollbar.h xdefaults.h # # Distribution variables # DIST = $(HDRS) $(SRCS) Makefile.in gcc-Wall # inference rules .c.o: $(CC) -c $(CPPFLAGS) $(XINC) -I$(basedir) $(CFLAGS) $< #------------------------------------------------------------------------- all: rxvt rxvt: VERSION.h $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(XLIB) VERSION.h: echo "#define VERSION \""$(VERSION)"\"" > $@; tags: $(SRCS) ctags $(SRCS) allbin: rxvt alldoc: clean: $(RMF) rxvt core a.out *.o *.bak *~ realclean: clean $(RMF) VERSION.h tags distclean: (cd $(srcdir); $(RMF) rxvt *~ *.o core a.out) if test $(srcdir) = .; then $(MAKE) realclean; fi (cd $(srcdir); $(RMF) Makefile) install: allbin alldoc $(INSTALL_PROGRAM) rxvt $(DESTDIR)$(bindir)/$(binprefix)rxvt uninstall: (cd $(bindir); $(RMF) $(binprefix)rxvt) distdirs: mkdir $(basedir)/../$(VERNAME)/$(thisdir) distcopy: $(CP) $(DIST) $(basedir)/../$(VERNAME)/$(thisdir) (cd $(basedir)/../$(VERNAME)/$(thisdir) && ln -s ../install.sh ./) # Semi-automatic generation of dependencies: # Use gcc -MM because X11 `makedepend' doesn't work on all systems # and it also includes system headers. # `semi'-automatic since dependencies are generated at distribution time. distdepend: mv Makefile.in Makefile.in~ sed "/^# DO NOT DELETE:/,$$ d" Makefile.in~ > Makefile.in echo "# DO NOT DELETE: ugly dependency list follows" >> Makefile.in gcc -MM $(CPPFLAGS) $(XINC) -I$(basedir) $(SRCS) >> Makefile.in # ----------------------------------------------------------------------- # DO NOT DELETE: ugly dependency list follows command.o: command.c main.h VERSION.h ./../config.h feature.h misc.h \ xdefaults.h command.h debug.h graphics.h rxvtgrx.h grkelot.h \ scrollbar.h screen.h defaults.h debug.o: debug.c ./../config.h feature.h debug.h graphics.o: graphics.c main.h VERSION.h ./../config.h feature.h misc.h \ command.h debug.h graphics.h rxvtgrx.h screen.h grkelot.o: grkelot.c ./../config.h feature.h grkelot.h main.o: main.c main.h VERSION.h ./../config.h feature.h misc.h \ command.h debug.h graphics.h rxvtgrx.h scrollbar.h screen.h \ xdefaults.h defaults.h misc.o: misc.c main.h VERSION.h ./../config.h feature.h misc.h netdisp.o: netdisp.c ./../config.h feature.h screen.o: screen.c main.h VERSION.h ./../config.h feature.h misc.h \ command.h debug.h graphics.h rxvtgrx.h screen.h scrollbar.o: scrollbar.c main.h VERSION.h ./../config.h feature.h \ misc.h scrollbar.h utmp.o: utmp.c ./../config.h feature.h xdefaults.o: xdefaults.c main.h VERSION.h ./../config.h feature.h \ misc.h debug.h defaults.h grkelot.h xdefaults.h xiterm+thai-1.10/src/Xtensions/graphics/rxvtgrx.h0000644000175000017500000000271011375434150020627 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: rxvtgrx.h * * Stuff for text alignment for rxvt special graphics mode * * alignment * Top: * text is placed so that the specified point is at the top of the * capital letters * Center: * text is placed so that the specified point is equidistant from the * bottom of descenders and the top of the capital letters * Botton: * text is placed so that the bottom of descenders is on the specified * point * Base: * text is placed so that the bottom of the characters with no descenders * is on the specified point * Caps_Center: * text is placed so that the specified point is equidistant from the * bottom and tops of capital letters *----------------------------------------------------------------------*/ #ifndef _RXVTGRX_H #define _RXVTGRX_H #define GRX_SCALE 10000 #define RIGHT_TEXT 0x10 #define HCENTER_TEXT 0x20 #define LEFT_TEXT 0x30 #define HORIZONTAL_ALIGNMENT 0x70 #define TOP_TEXT 0x01 #define VCENTER_TEXT 0x02 #define BOTTOM_TEXT 0x03 #define BASE_TEXT 0x04 #define VCAPS_CENTER_TEXT 0x05 #define VERTICAL_ALIGNMENT 0x0F #if 0 /* this would be nicer */ #define TXT_RIGHT 'r' #define TXT_CENTER 'c' #define TXT_LEFT 'l' #define TXT_TOP 't' #define TXT_VCENTER 'v' #define TXT_BOTTOM 'b' #define TXT_BASE '_' #define TXT_VCAPS_CENTER 'C' #endif #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/Xtensions/graphics/README0000644000175000017500000000004511375434150017611 0ustar thepthepThis is an example of rxvt graphics. xiterm+thai-1.10/src/Xtensions/graphics/command.c0000644000175000017500000021046311375434150020522 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: command.c */ /*{{{ notes: */ /*----------------------------------------------------------------------* * Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as * you don't try to make money out of it and you include an * unaltered copy of this message (including the copyright). * * This module has been very heavily modified by R. Nation * * No additional restrictions are applied * * Additional modification by Garrett D'Amore to * allow vt100 printing. No additional restrictions are applied. * * Integrated modifications by Steven Hirsch to * properly support X11 mouse report mode and support for DEC * "private mode" save/restore functions. * * Integrated key-related changes by Jakub Jelinek * to handle Shift+function keys properly. * Should be used with enclosed termcap / terminfo database. * * Extensive modifications by mj olesen * No additional restrictions. * * Further modification and cleanups for Solaris 2.x and Linux 1.2.x * by Raul Garcia Garcia . No additional restrictions. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ /*}}} */ /*{{{ includes: */ #include "main.h" #include "xdefaults.h" #ifdef OFFIX_DND #include #define DndFile 2 #define DndDir 5 #define DndLink 7 #endif #include #ifndef NO_XLOCALE #if (XtSpecificationRelease < 6) #define NO_XLOCALE #else #define X_LOCALE #include #endif #endif /* NO_XLOCALE */ #include #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_SYS_IOCTL_H #include #endif #include /* #define USE_GETGRNAME */ /* * this seems like a bad way to go, since there's no guarantee that * /dev/tty belongs to the group "tty" and not "system" or "wheel" */ #ifdef USE_GETGRNAME #include #endif #ifdef TIME_WITH_SYS_TIME #include #include #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif #if defined (__svr4__) #include /* for struct rlimit */ #include /* for I_PUSH */ #define _NEW_TTY_CTRL /* to get proper defines in */ #endif #ifdef HAVE_SYS_SELECT_H #include #endif #ifdef HAVE_TERMIOS_H #include #else #include #endif #include #include #include "command.h" #include "debug.h" #include "graphics.h" #include "grkelot.h" #include "scrollbar.h" #include "screen.h" #include "defaults.h" /*}}} */ /* #define DEBUG_TTYMODE */ /* #define DEBUG_CMD */ /*{{{ terminal mode defines: */ /* use the fastest baud-rate */ #ifdef B38400 #define BAUDRATE B38400 #else #ifdef B19200 #define BAUDRATE B19200 #else #define BAUDRATE B9600 #endif #endif /* Disable special character functions */ #ifdef _POSIX_VDISABLE #define VDISABLE _POSIX_VDISABLE #else #define VDISABLE 255 #endif /*----------------------------------------------------------------------* * system default characters if defined and reasonable */ #ifndef CINTR #define CINTR '\003' /* ^C */ #endif #ifndef CQUIT #define CQUIT '\034' /* ^\ */ #endif #ifndef CERASE #define CERASE '\010' /* ^H */ #endif #ifndef CKILL #define CKILL '\025' /* ^U */ #endif #ifndef CEOF #define CEOF '\004' /* ^D */ #endif #ifndef CSTART #define CSTART '\021' /* ^Q */ #endif #ifndef CSTOP #define CSTOP '\023' /* ^S */ #endif #ifndef CSUSP #define CSUSP '\032' /* ^Z */ #endif #ifndef CDSUSP #define CDSUSP '\031' /* ^Y */ #endif #ifndef CRPRNT #define CRPRNT '\022' /* ^R */ #endif #ifndef CFLUSH #define CFLUSH '\017' /* ^O */ #endif #ifndef CWERASE #define CWERASE '\027' /* ^W */ #endif #ifndef CLNEXT #define CLNEXT '\026' /* ^V */ #endif #ifndef VDISCRD #ifdef VDISCARD #define VDISCRD VDISCARD #endif #endif #ifndef VWERSE #ifdef VWERASE #define VWERSE VWERASE #endif #endif /*}}} */ /*{{{ defines: */ #define KBUFSZ 8 /* size of keyboard mapping buffer */ #define STRING_MAX 512 /* max string size for process_xterm_seq() */ #define ESC_ARGS 32 /* max # of args for esc sequences */ /* a large REFRESH_PERIOD causes problems with `cat' */ #define REFRESH_PERIOD 1 #ifndef REFRESH_PERIOD #define REFRESH_PERIOD 10 #endif #ifndef MULTICLICK_TIME #define MULTICLICK_TIME 500 #endif /* time factor to slow down a `jumpy' mouse */ #define MOUSE_THRESHOLD 50 #define CONSOLE "/dev/console" /* console device */ /* * key-strings: if only these keys were standardized */ #ifdef LINUX_KEYS #define KS_HOME "\033[1~" /* Home == Find */ #define KS_END "\033[4~" /* End == Select */ #else #define KS_HOME "\033[7~" /* Home */ #define KS_END "\033[8~" /* End */ #endif /* and this one too! */ #ifdef NO_DELETE_KEY #undef KS_DELETE /* use X server definition */ #else #ifndef KS_DELETE #define KS_DELETE "\033[3~" /* Delete = Execute */ #endif #endif /* * ESC-Z processing: * * By stealing a sequence to which other xterms respond, and sending the * same number of characters, but having a distinguishable sequence, * we can avoid having a timeout (when not under an rxvt) for every login * shell to auto-set its DISPLAY. * * This particular sequence is even explicitly stated as obsolete since * about 1985, so only very old software is likely to be confused, a * confusion which can likely be remedied through termcap or TERM. Frankly, * I doubt anyone will even notice. We provide a #ifdef just in case they * don't care about auto-display setting. Just in case the ancient * software in question is broken enough to be case insensitive to the 'c' * character in the answerback string, we make the distinguishing * characteristic be capitalization of that character. The length of the * two strings should be the same so that identical read(2) calls may be * used. */ #define VT100_ANS "\033[?1;2c" /* vt100 answerback */ #ifndef ESCZ_ANSWER #define ESCZ_ANSWER VT100_ANS /* obsolete ANSI ESC[c */ #endif /*}}} */ /*{{{ extern functions referenced */ extern void cleanutent (void); extern void makeutent (const char *pty, const char *hostname); /*}}} */ /* extern variables referenced */ /* extern variables declared here */ /*{{{ local variables */ static char *ptydev = NULL, *ttydev = NULL; /* pty/tty name */ static int cmd_fd = -1; /* file descriptor connected to the command */ static pid_t cmd_pid = -1; /* process id if child */ static int Xfd = -1; /* file descriptor of X server connection */ static unsigned int num_fds = 0; /* number of file descriptors being used */ static struct stat ttyfd_stat; /* original status of the tty we will use */ #ifdef META8_OPTION static unsigned char meta_char = 033; /* Alt-key prefix */ #endif /* DEC private modes */ #define PrivMode_132 (1LU<<0) #define PrivMode_132OK (1LU<<1) #define PrivMode_rVideo (1LU<<2) #define PrivMode_relOrigin (1LU<<3) #define PrivMode_Screen (1LU<<4) #define PrivMode_Autowrap (1LU<<5) #define PrivMode_aplCUR (1LU<<6) #define PrivMode_aplKP (1LU<<7) #define PrivMode_BackSpace (1LU<<8) #define PrivMode_ShiftKeys (1LU<<9) #define PrivMode_VisibleCursor (1LU<<10) #define PrivMode_MouseX10 (1LU<<11) #define PrivMode_MouseX11 (1LU<<12) /* too annoying to implement X11 highlight tracking */ /* #define PrivMode_MouseX11Track (1LU<<13) */ #define PrivMode_scrollBar (1LU<<14) #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11) #define PrivMode(test,bit) do {\ if (test) PrivateModes |= (bit); else PrivateModes &= ~(bit);} while (0) #define PrivMode_Default \ (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) static unsigned long PrivateModes = PrivMode_Default; static unsigned long SavedModes = PrivMode_Default; #undef PrivMode_Default static int refresh_count = 0, refresh_limit = 1, refresh_type = SLOW_REFRESH; static Atom wmDeleteWindow; /* OffiX Dnd (drag 'n' drop) support */ #ifdef OFFIX_DND static Atom DndProtocol, DndSelection; #endif /* OFFIX_DND */ #ifndef NO_XLOCALE static char *rs_inputMethod = ""; /* XtNinputMethod */ static char *rs_preeditType = NULL; /* XtNpreeditType */ static XIC Input_Context; /* input context */ #endif /* NO_XLOCALE */ /* command input buffering */ #ifndef BUFSIZ #define BUFSIZ 4096 #endif static unsigned char cmdbuf_base[BUFSIZ], *cmdbuf_ptr, *cmdbuf_endp; /*}}} */ /*{{{ local functions referenced */ static void privileges (int mode); static RETSIGTYPE Child_signal (int); static RETSIGTYPE Exit_signal (int); static int get_pty (void); static int get_tty (void); static int run_command (char * /* argv */ []); static unsigned char cmd_getc (void); static void lookup_key (XEvent * /* ev */ ); static void process_x_event (XEvent * /* ev */ ); /*static void process_string (int); */ #ifdef PRINTPIPE static void process_print_pipe (void); #endif static void process_escape_seq (void); static void process_csi_seq (void); static void process_xterm_seq (void); static void process_terminal_mode (int /* mode */ , int /* priv */ , unsigned int /* nargs */ , int /* arg */ []); static void process_sgr_mode (unsigned int /* nargs */ , int /* arg */ []); static void process_graphics (void); static void tt_winsize (int /* fd */ ); #ifndef NO_XLOCALE static void init_xlocale (void); #else #define init_xlocale() ((void)0) #endif /*----------------------------------------------------------------------*/ /*}}} */ /*{{{ substitute system functions */ #ifndef _POSIX_VERSION #if defined (__svr4__) static int getdtablesize (void) { struct rlimit rlim; getrlimit (RLIMIT_NOFILE, &rlim); return rlim.rlim_cur; } #endif #endif /*}}} */ /*{{{ take care of suid/sgid super-user (root) privileges */ static void privileges (int mode) { #ifdef HAVE_SETEUID static uid_t euid; static gid_t egid; switch (mode) { case IGNORE: /* * change effective uid/gid - not real uid/gid - so we can switch * back to root later, as required */ seteuid (getuid ()); setegid (getgid ()); break; case SAVE: euid = geteuid (); egid = getegid (); break; case RESTORE: seteuid (euid); setegid (egid); break; } #else switch (mode) { case IGNORE: setuid (getuid ()); setgid (getgid ()); break; case SAVE: break; case RESTORE: break; } #endif } /*}}} */ /*{{{ signal handling, exit handler */ /* * Catch a SIGCHLD signal and exit if the direct child has died */ static RETSIGTYPE Child_signal (int unused) { int pid, save_errno = errno; do { errno = 0; } while ((-1 == (pid = waitpid (cmd_pid, NULL, WNOHANG))) && (errno == EINTR)); if (pid == cmd_pid) exit (EXIT_SUCCESS); errno = save_errno; signal (SIGCHLD, Child_signal); } /* * Catch a fatal signal and tidy up before quitting */ static RETSIGTYPE Exit_signal (int sig) { #ifdef DEBUG_CMD print_error ("signal %d", sig); #endif signal (sig, SIG_DFL); privileges (RESTORE); cleanutent (); privileges (IGNORE); kill (getpid (), sig); } /* * Exit gracefully, clearing the utmp entry and restoring tty attributes */ static void clean_exit (void) { #ifdef DEBUG_CMD fprintf (stderr, "Restoring \"%s\" to mode %03o, uid %d, gid %d\n", ttydev, ttyfd_stat.st_mode, ttyfd_stat.st_uid, ttyfd_stat.st_gid); #endif privileges (RESTORE); chmod (ttydev, ttyfd_stat.st_mode); chown (ttydev, ttyfd_stat.st_uid, ttyfd_stat.st_gid); cleanutent (); privileges (IGNORE); } /*}}} */ /*{{{ Acquire a pseudo-teletype from the system. */ /* * On failure, returns -1. * On success, returns the file descriptor. * * If successful, ttydev and ptydev point to the names of the * master and slave parts */ static int get_pty (void) { int fd = -1; #if defined (__sgi) ptydev = ttydev = _getpty (&fd, O_RDWR | O_NDELAY, 0622, 0); if (ptydev == NULL) goto Failed; #elif defined (__svr4__) { extern char *ptsname (); /* open the STREAMS, clone device /dev/ptmx (master pty) */ if ((fd = open ("/dev/ptmx", O_RDWR)) < 0) { goto Failed; } else { grantpt (fd); /* change slave permissions */ unlockpt (fd); /* unlock slave */ ptydev = ttydev = ptsname (fd); /* get slave's name */ } } #elif defined (_AIX) if ((fd = open ("/dev/ptc", O_RDWR)) < 0) goto Failed; else ptydev = ttydev = ttyname (fd); #else static char pty_name[] = "/dev/pty??"; static char tty_name[] = "/dev/tty??"; int len = strlen (tty_name); char *c1, *c2; ptydev = pty_name; ttydev = tty_name; #define PTYCHAR1 "pqrstuvwxyz" #define PTYCHAR2 "0123456789abcdef" for (c1 = PTYCHAR1; *c1; c1++) { ptydev[len - 2] = ttydev[len - 2] = *c1; for (c2 = PTYCHAR2; *c2; c2++) { ptydev[len - 1] = ttydev[len - 1] = *c2; if ((fd = open (ptydev, O_RDWR)) >= 0) { if (access (ttydev, R_OK | W_OK) == 0) goto Found; close (fd); } } } goto Failed; #endif Found: fcntl (fd, F_SETFL, O_NDELAY); return fd; Failed: print_error ("can't open pseudo-tty"); return -1; } /*}}} */ /*{{{ establish a controlling teletype for new session */ /* * On some systems this can be done with ioctl() but on others we * need to re-open the slave tty. */ static int get_tty (void) { int fd; pid_t pid; /* * setsid() [or setpgrp] must be before open of the terminal, * otherwise there is no controlling terminal (Solaris 2.4, HP-UX 9) */ #ifndef ultrix #ifdef NO_SETSID pid = setpgrp (0, 0); #else pid = setsid (); #endif if (pid < 0) perror (rs_name); #ifdef DEBUG_TTYMODE print_error ("(%s: line %d): PID = %d\n", __FILE__, __LINE__, pid); #endif #endif /* ultrix */ if ((fd = open (ttydev, O_RDWR)) < 0) { print_error ("can't open slave tty %s", ttydev); exit (EXIT_FAILURE); } #if defined (__svr4__) /* * Push STREAMS modules: * ptem: pseudo-terminal hardware emulation module. * ldterm: standard terminal line discipline. * ttcompat: V7, 4BSD and XENIX STREAMS compatibility module. */ ioctl (fd, I_PUSH, "ptem"); ioctl (fd, I_PUSH, "ldterm"); ioctl (fd, I_PUSH, "ttcompat"); #else /* __svr4__ */ { /* change ownership of tty to real uid and real group */ unsigned int mode = 0622; gid_t gid = getgid (); #ifdef USE_GETGRNAME { struct group *gr = getgrnam ("tty"); if (gr) { /* change ownership of tty to real uid, "tty" gid */ gid = gr->gr_gid; mode = 0620; } } #endif /* USE_GETGRNAME */ privileges (RESTORE); fchown (fd, getuid (), gid); /* fail silently */ fchmod (fd, mode); privileges (IGNORE); } #endif /* __svr4__ */ /* * Close all file descriptors. If only stdin/out/err are closed, * child processes remain alive upon deletion of the window. */ { int i; for (i = 0; i < num_fds; i++) if (i != fd) close (i); } /* Reopen stdin, stdout and stderr over the tty file descriptor */ dup (fd); /* 0: stdin */ dup (fd); /* 1: stdout */ dup (fd); /* 2: stderr */ if (fd > 2) close (fd); #ifdef ultrix if ((fd = open ("/dev/tty", O_RDONLY)) >= 0) { ioctl (fd, TIOCNOTTY, 0); close (fd); } else { pid = setpgrp (0, 0); if (pid < 0) perror (rs_name); } /* no error, we could run with no tty to begin with */ #else /* ultrix */ #ifdef TIOCSCTTY ioctl (0, TIOCSCTTY, 0); #endif /* set process group */ #if defined (_POSIX_VERSION) || defined (__svr4__) tcsetpgrp (0, pid); #elif defined (TIOCSPGRP) ioctl (0, TIOCSPGRP, &pid); #endif /* svr4 problems: reports no tty, no job control */ /* # if !defined (__svr4__) && defined (TIOCSPGRP) */ close (open (ttydev, O_RDWR, 0)); /* # endif */ #endif /* ultrix */ privileges (IGNORE); return fd; } /*}}} */ /*{{{ ways to deal with getting/setting termios structure */ #ifdef HAVE_TERMIOS_H typedef struct termios ttymode_t; #ifdef TCSANOW /* POSIX */ #define GET_TERMIOS(fd,tios) tcgetattr (fd, tios) #define SET_TERMIOS(fd,tios) do {\ cfsetospeed (tios, BAUDRATE);\ cfsetispeed (tios, BAUDRATE);\ tcsetattr (fd, TCSANOW, tios);\ } while (0) #else #ifdef TIOCSETA #define GET_TERMIOS(fd,tios) ioctl (fd, TIOCGETA, tios) #define SET_TERMIOS(fd,tios) do {\ tios->c_cflag |= BAUDRATE;\ ioctl (fd, TIOCSETA, tios);\ } while (0) #else #define GET_TERMIOS(fd,tios) ioctl (fd, TCGETS, tios) #define SET_TERMIOS(fd,tios) do {\ tios->c_cflag |= BAUDRATE;\ ioctl (fd, TCSETS, tios);\ } while (0) #endif #endif #define SET_TTYMODE(fd,tios) SET_TERMIOS (fd, tios) #else /* sgtty interface */ typedef struct { struct sgttyb sg; struct tchars tc; struct ltchars lc; int line; int local; } ttymode_t; #define SET_TTYMODE(fd,tt) do { \ tt->sg.sg_ispeed = tt->sg.sg_ospeed = BAUDRATE;\ ioctl (fd, TIOCSETP, &(tt->sg));\ ioctl (fd, TIOCSETC, &(tt->tc));\ ioctl (fd, TIOCSLTC, &(tt->lc));\ ioctl (fd, TIOCSETD, &(tt->line));\ ioctl (fd, TIOCLSET, &(tt->local));\ } while (0) #endif /* HAVE_TERMIOS_H */ /*}}} */ /*{{{ debug_ttymode() */ #ifdef DEBUG_TTYMODE static void debug_ttymode (ttymode_t * ttymode) { #ifdef HAVE_TERMIOS_H /* c_iflag bits */ fprintf (stderr, "Input flags\n"); /* cpp token stringize doesn't work on all machines */ #define FOO(flag,name) \ if ((ttymode->c_iflag) & flag) fprintf (stderr, "%s ", name) /* c_iflag bits */ FOO (IGNBRK, "IGNBRK"); FOO (BRKINT, "BRKINT"); FOO (IGNPAR, "IGNPAR"); FOO (PARMRK, "PARMRK"); FOO (INPCK, "INPCK"); FOO (ISTRIP, "ISTRIP"); FOO (INLCR, "INLCR"); FOO (IGNCR, "IGNCR"); FOO (ICRNL, "ICRNL"); FOO (IXON, "IXON"); FOO (IXOFF, "IXOFF"); #ifdef IUCLC FOO (IUCLC, "IUCLC"); #endif #ifdef IXANY FOO (IXANY, "IXANY"); #endif #ifdef IMAXBEL FOO (IMAXBEL, "IMAXBEL"); #endif fprintf (stderr, "\n\n"); #undef FOO #define FOO(entry, name) \ fprintf (stderr, "%s = %#3o\n", name, ttymode->c_cc [entry]) FOO (VINTR, "VINTR"); FOO (VQUIT, "VQUIT"); FOO (VERASE, "VERASE"); FOO (VKILL, "VKILL"); FOO (VEOF, "VEOF"); FOO (VEOL, "VEOL"); #ifdef VEOL2 FOO (VEOL2, "VEOL2"); #endif #ifdef VSWTC FOO (VSWTC, "VSWTC"); #endif #ifdef VSWTCH FOO (VSWTCH, "VSWTCH"); #endif FOO (VSTART, "VSTART"); FOO (VSTOP, "VSTOP"); FOO (VSUSP, "VSUSP"); #ifdef VDSUSP FOO (VDSUSP, "VDSUSP"); #endif #ifdef VREPRINT FOO (VREPRINT, "VREPRINT"); #endif #ifdef VDISCRD FOO (VDISCRD, "VDISCRD"); #endif #ifdef VWERSE FOO (VWERSE, "VWERSE"); #endif #ifdef VLNEXT FOO (VLNEXT, "VLNEXT"); #endif fprintf (stderr, "\n\n"); #undef FOO #endif /* HAVE_TERMIOS_H */ } #endif /* DEBUG_TTYMODE */ /*}}} */ /*{{{ get_ttymode() */ static void get_ttymode (ttymode_t * tio) { #ifdef HAVE_TERMIOS_H /* * standard System V termios interface */ if (GET_TERMIOS (0, tio) < 0) { /* return error - use system defaults */ tio->c_cc[VINTR] = CINTR; tio->c_cc[VQUIT] = CQUIT; tio->c_cc[VERASE] = CERASE; tio->c_cc[VKILL] = CKILL; tio->c_cc[VSTART] = CSTART; tio->c_cc[VSTOP] = CSTOP; tio->c_cc[VSUSP] = CSUSP; #ifdef VDSUSP tio->c_cc[VDSUSP] = CDSUSP; #endif #ifdef VREPRINT tio->c_cc[VREPRINT] = CRPRNT; #endif #ifdef VDISCRD tio->c_cc[VDISCRD] = CFLUSH; #endif #ifdef VWERSE tio->c_cc[VWERSE] = CWERASE; #endif #ifdef VLNEXT tio->c_cc[VLNEXT] = CLNEXT; #endif } tio->c_cc[VEOF] = CEOF; tio->c_cc[VEOL] = VDISABLE; #ifdef VEOL2 tio->c_cc[VEOL2] = VDISABLE; #endif #ifdef VSWTC tio->c_cc[VSWTC] = VDISABLE; #endif #ifdef VSWTCH tio->c_cc[VSWTCH] = VDISABLE; #endif #if VMIN != VEOF tio->c_cc[VMIN] = 1; #endif #if VTIME != VEOL tio->c_cc[VTIME] = 0; #endif /* input modes */ tio->c_iflag = (BRKINT | IGNPAR | ICRNL | IXON #ifdef IMAXBEL | IMAXBEL #endif ); /* output modes */ tio->c_oflag = (OPOST | ONLCR); /* control modes */ tio->c_cflag = (CS8 | CREAD); /* line discipline modes */ tio->c_lflag = (ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK #if defined (ECHOCTL) && defined (ECHOKE) | ECHOCTL | ECHOKE #endif ); /* * guess an appropriate value for Backspace */ #ifdef DONT_GUESS_BACKSPACE PrivMode (1, PrivMode_BackSpace); /* always ^H */ #else PrivMode ((tio->c_cc[VERASE] == '\b'), PrivMode_BackSpace); #endif /* DONT_GUESS_BACKSPACE */ #else /* HAVE_TERMIOS_H */ /* * sgtty interface */ /* get parameters -- gtty */ if (ioctl (0, TIOCGETP, &(tio->sg)) < 0) { tio->sg.sg_erase = CERASE; /* ^H */ tio->sg.sg_kill = CKILL; /* ^U */ } tio->sg.sg_flags = (CRMOD | ECHO | EVENP | ODDP); /* get special characters */ if (ioctl (0, TIOCGETC, &(tio->tc)) < 0) { tio->tc.t_intrc = CINTR; /* ^C */ tio->tc.t_quitc = CQUIT; /* ^\ */ tio->tc.t_startc = CSTART; /* ^Q */ tio->tc.t_stopc = CSTOP; /* ^S */ tio->tc.t_eofc = CEOF; /* ^D */ tio->tc.t_brkc = -1; } /* get local special chars */ if (ioctl (0, TIOCGLTC, &(tio->lc)) < 0) { tio->lc.t_suspc = CSUSP; /* ^Z */ tio->lc.t_dsuspc = CDSUSP; /* ^Y */ tio->lc.t_rprntc = CRPRNT; /* ^R */ tio->lc.t_flushc = CFLUSH; /* ^O */ tio->lc.t_werasc = CWERASE; /* ^W */ tio->lc.t_lnextc = CLNEXT; /* ^V */ } /* get line discipline */ ioctl (0, TIOCGETD, &(tio->line)); #ifdef NTTYDISC tio->line = NTTYDISC; #endif /* NTTYDISC */ tio->local = (LCRTBS | LCRTERA | LCTLECH | LPASS8 | LCRTKIL); /* * guess an appropriate value for Backspace */ #ifdef DONT_GUESS_BACKSPACE PrivMode (1, PrivMode_BackSpace); /* always ^H */ #else PrivMode ((tio->sg.sg_erase == '\b'), PrivMode_BackSpace); #endif /* DONT_GUESS_BACKSPACE */ #endif /* HAVE_TERMIOS_H */ } /*}}} */ /*{{{ run_command() */ /* * Run the command in a subprocess and return a file descriptor for the * master end of the pseudo-teletype pair with the command talking to * the slave. */ static int run_command (char *argv[]) { ttymode_t tio; int ptyfd; /* Save and then give up any super-user privileges */ privileges (SAVE); privileges (IGNORE); ptyfd = get_pty (); if (ptyfd < 0) return -1; /* store original tty status for restoration clean_exit() -- rgg 04/12/95 */ lstat (ttydev, &ttyfd_stat); #ifdef DEBUG_CMD fprintf (stderr, "Original settings of %s are mode %o, uid %d, gid %d\n", ttydev, ttyfd_stat.st_mode, ttyfd_stat.st_uid, ttyfd_stat.st_gid); #endif /* install exit handler for cleanup */ #ifdef HAVE_ATEXIT atexit (clean_exit); #else #if defined (__sun__) on_exit (clean_exit, NULL); /* non-ANSI exit handler */ #else print_error ("no atexit(), UTMP entries can't be cleaned"); #endif #endif /* * get tty settings before fork() * and make a reasonable guess at the value for BackSpace */ get_ttymode (&tio); /* add Backspace value */ SavedModes |= (PrivateModes & PrivMode_BackSpace); /* add value for scrollBar */ if (scrollbar_visible ()) { PrivateModes |= PrivMode_scrollBar; SavedModes |= PrivMode_scrollBar; } #ifdef DEBUG_TTYMODE debug_ttymode (&tio); #endif /* spin off the command interpreter */ signal (SIGHUP, Exit_signal); #ifndef __svr4__ signal (SIGINT, Exit_signal); #endif signal (SIGQUIT, Exit_signal); signal (SIGTERM, Exit_signal); signal (SIGCHLD, Child_signal); /* need to trap SIGURG for SVR4 (Unixware) rlogin */ /* signal (SIGURG, SIG_DFL); */ cmd_pid = fork (); if (cmd_pid < 0) { print_error ("can't fork"); return -1; } if (cmd_pid == 0) /* child */ { /* signal (SIGHUP, Exit_signal); */ /* signal (SIGINT, Exit_signal); */ #ifdef HAVE_UNSETENV /* avoid passing old settings and confusing term size */ unsetenv ("LINES"); unsetenv ("COLUMNS"); /* avoid passing termcap since terminfo should be okay */ unsetenv ("TERMCAP"); #endif /* HAVE_UNSETENV */ /* establish a controlling teletype for the new session */ get_tty (); /* initialize terminal attributes */ SET_TTYMODE (0, &tio); /* become virtual console, fail silently */ if (Options & Opt_console) { #ifdef TIOCCONS unsigned int on = 1; ioctl (0, TIOCCONS, &on); #elif defined (SRIOCREDIR) int fd = open (CONSOLE, O_WRONLY); if (fd < 0 || ioctl (0, SRIOCSREDIR, fd) < 0) { if (fd >= 0) close (fd); } #endif /* SRIOCSREDIR */ } tt_winsize (0); /* set window size */ /* reset signals and spin off the command interpreter */ signal (SIGINT, SIG_DFL); signal (SIGQUIT, SIG_DFL); signal (SIGCHLD, SIG_DFL); /* * mimick login's behavior by disabling the job control signals * a shell that wants them can turn them back on */ #ifdef SIGTSTP signal (SIGTSTP, SIG_IGN); signal (SIGTTIN, SIG_IGN); signal (SIGTTOU, SIG_IGN); #endif /* SIGTSTP */ /* command interpreter path */ if (argv != NULL) { #ifdef DEBUG_CMD int i; for (i = 0; argv[i]; i++) fprintf (stderr, "argv [%d] = \"%s\"\n", i, argv[i]); #endif execvp (argv[0], argv); print_error ("can't execute \"%s\"", argv[0]); } else { const char *argv0, *shell; if ((shell = getenv ("SHELL")) == NULL || *shell == '\0') shell = "/bin/sh"; argv0 = my_basename (shell); if (Options & Opt_loginShell) { char *p = MALLOC ((strlen (argv0) + 2) * sizeof (char), argv0); p[0] = '-'; strcpy (&p[1], argv0); argv0 = p; } execlp (shell, argv0, NULL); print_error ("can't execute \"%s\"", shell); } exit (EXIT_FAILURE); } privileges (RESTORE); if (!(Options & Opt_utmpInhibit)) makeutent (ttydev, display_name); /* stamp /etc/utmp */ privileges (IGNORE); return ptyfd; } /*}}} */ /*{{{ init_command() */ void init_command (char *argv[]) { /* * Initialize the command connection. * This should be called after the X server connection is established. */ /* Enable delete window protocol */ wmDeleteWindow = XInternAtom (Xdisplay, "WM_DELETE_WINDOW", False); XSetWMProtocols (Xdisplay, TermWin.parent, &wmDeleteWindow, 1); #ifdef OFFIX_DND /* Enable OffiX Dnd (drag 'n' drop) protocol */ DndProtocol = XInternAtom (Xdisplay, "DndProtocol", False); DndSelection = XInternAtom (Xdisplay, "DndSelection", False); #endif /* OFFIX_DND */ init_xlocale (); /* get number of available file descriptors */ #ifdef _POSIX_VERSION num_fds = sysconf (_SC_OPEN_MAX); #else num_fds = getdtablesize (); #endif #ifdef META8_OPTION meta_char = (Options & Opt_meta8 ? 0x80 : 033); #endif #ifdef GREEK_SUPPORT greek_init (); #endif Xfd = XConnectionNumber (Xdisplay); cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; if ((cmd_fd = run_command (argv)) < 0) { print_error ("aborting"); exit (EXIT_FAILURE); } } /*}}} */ /*{{{ Xlocale */ /* * This is more or less stolen straight from XFree86 xterm. * This should support all European type languages. */ #ifndef NO_XLOCALE static void init_xlocale (void) { char *p, *s, buf[32], tmp[1024]; XIM xim = NULL; XIMStyle input_style = 0; XIMStyles *xim_styles = NULL; int found; Input_Context = NULL; #ifdef KANJI setlocale (LC_CTYPE, ""); #endif if (rs_inputMethod == NULL #ifndef KANJI || !*rs_inputMethod /* required ? */ #endif ) { if ((p = XSetLocaleModifiers ("@im=none")) != NULL && *p) xim = XOpenIM (Xdisplay, NULL, NULL, NULL); } else { strcpy (tmp, rs_inputMethod); for (s = tmp; *s; /*nil */ ) { char *end, *next_s; while (*s && isspace (*s)) s++; if (!*s) break; end = s; while (*end && (*end != ',')) end++; next_s = end--; while ((end >= s) && isspace (*end)) end--; *(end + 1) = '\0'; if (*s) { strcpy (buf, "@im="); strcat (buf, s); if ((p = XSetLocaleModifiers (buf)) != NULL && *p && (xim = XOpenIM (Xdisplay, NULL, NULL, NULL)) != NULL) break; } if (!*next_s) break; s = (next_s + 1); } } if (xim == NULL && (p = XSetLocaleModifiers ("")) != NULL && *p) xim = XOpenIM (Xdisplay, NULL, NULL, NULL); if (xim == NULL) { print_error ("Failed to open input method"); return; } if (XGetIMValues (xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles) { print_error ("input method doesn't support any style"); XCloseIM (xim); return; } strcpy (tmp, (rs_preeditType ? rs_preeditType : "Root")); for (found = 0, s = tmp; *s && !found; /*nil */ ) { unsigned short i; char *end, *next_s; while (*s && isspace (*s)) s++; if (!*s) break; end = s; while (*end && (*end != ',')) end++; next_s = end--; while ((end >= s) && isspace (*end)) *end-- = 0; if (!strcmp (s, "OverTheSpot")) input_style = (XIMPreeditPosition | XIMStatusArea); else if (!strcmp (s, "OffTheSpot")) input_style = (XIMPreeditArea | XIMStatusArea); else if (!strcmp (s, "Root")) input_style = (XIMPreeditNothing | XIMStatusNothing); for (i = 0; i < xim_styles->count_styles; i++) { if (input_style == xim_styles->supported_styles[i]) { found = 1; break; } } s = next_s; } XFree (xim_styles); if (found == 0) { print_error ("input method doesn't support my preedit type"); XCloseIM (xim); return; } /* * This program only understands the Root preedit_style yet * Then misc.preedit_type should default to: * "OverTheSpot,OffTheSpot,Root" * /MaF */ if (input_style != (XIMPreeditNothing | XIMStatusNothing)) { print_error ("This program only supports the \"Root\" preedit type"); XCloseIM (xim); return; } Input_Context = XCreateIC (xim, XNInputStyle, input_style, XNClientWindow, TermWin.parent, XNFocusWindow, TermWin.parent, NULL); if (Input_Context == NULL) { print_error ("Failed to create input context"); XCloseIM (xim); } } #endif /* NO_XLOCALE */ /*}}} */ /*{{{ window resizing */ /* * Tell the teletype handler what size the window is. * Called after a window size change. */ static void tt_winsize (int fd) { struct winsize ws; if (fd < 0) return; ws.ws_col = (unsigned short) TermWin.ncol; ws.ws_row = (unsigned short) TermWin.nrow; ws.ws_xpixel = ws.ws_ypixel = 0; ioctl (fd, TIOCSWINSZ, &ws); } void tt_resize (void) { tt_winsize (cmd_fd); } /*}}} */ /*{{{ Convert the keypress event into a string */ static void lookup_key (XEvent * ev) { static int numlock_state = 0; #ifdef DEBUG_CMD static int debug_key = 1; /* accessible by a debugger only */ #endif #ifdef GREEK_SUPPORT static short greek_mode = 0; #endif static XComposeStatus compose = {NULL, 0}; static unsigned char kbuf[KBUFSZ]; int ctrl, meta, shft, len; KeySym keysym; /* * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an * escape sequence to toggle the Keypad. * * Always permit `shift' to override the current setting */ shft = (ev->xkey.state & ShiftMask); ctrl = (ev->xkey.state & ControlMask); meta = (ev->xkey.state & Mod1Mask); if (numlock_state || (ev->xkey.state & Mod5Mask)) { numlock_state = (ev->xkey.state & Mod5Mask); /* numlock toggle */ PrivMode ((!numlock_state), PrivMode_aplKP); } #ifndef NO_XLOCALE if (!XFilterEvent (ev, *(&ev->xkey.window))) { if (Input_Context != NULL) { Status status_return; len = XmbLookupString (Input_Context, &ev->xkey, kbuf, sizeof (kbuf), &keysym, &status_return); } else { len = XLookupString (&ev->xkey, kbuf, sizeof (kbuf), &keysym, &compose); } } else len = 0; #else /* NO_XLOCALE */ len = XLookupString (&ev->xkey, kbuf, sizeof (kbuf), &keysym, &compose); /* * have unmapped Latin[2-4] entries -> Latin1 * good for installations with correct fonts, but without XLOCAL */ if (!len && (keysym >= 0x0100) && (keysym < 0x0400)) { len = 1; kbuf[0] = (keysym & 0xFF); } #endif /* NO_XLOCALE */ /* for some backwards compatibility */ #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) #ifdef HOTKEY_CTRL #define HOTKEY ctrl #else #ifdef HOTKEY_META #define HOTKEY meta #endif #endif if (HOTKEY) { if (keysym == ks_bigfont) { change_font (0, FONT_UP); return; } else if (keysym == ks_smallfont) { change_font (0, FONT_DN); return; } } #undef HOTKEY #endif if (shft) { /* Shift + F1 - F10 generates F11 - F20 */ if (keysym >= XK_F1 && keysym <= XK_F10) { keysym += (XK_F11 - XK_F1); shft = 0; /* turn off Shift */ } else if (!ctrl && !meta && (PrivateModes & PrivMode_ShiftKeys)) { switch (keysym) { /* normal XTerm key bindings */ case XK_Prior: /* Shift+Prior = scroll back */ if (TermWin.saveLines) { scr_page (UP, TermWin.nrow * 4 / 5); return; } break; case XK_Next: /* Shift+Next = scroll forward */ if (TermWin.saveLines) { scr_page (DN, TermWin.nrow * 4 / 5); return; } break; case XK_Insert: /* Shift+Insert = paste mouse selection */ selection_request (ev->xkey.time, ev->xkey.x, ev->xkey.y); return; break; /* rxvt extras */ case XK_KP_Add: /* Shift+KP_Add = bigger font */ change_font (0, FONT_UP); return; break; case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ change_font (0, FONT_DN); return; break; } } } switch (keysym) { case XK_Print: #ifdef DEBUG_SELECTION debug_selection (); return; #else #ifdef PRINTPIPE scr_printscreen (ctrl | shft); return; #endif #endif break; case XK_Mode_switch: #ifdef GREEK_SUPPORT greek_mode = !greek_mode; if (greek_mode) { xterm_seq (XTerm_title, (greek_getmode () == GREEK_ELOT928 ? "[Greek: iso]" : "[Greek: ibm]")); greek_reset (); } else xterm_seq (XTerm_title, APL_NAME "-" VERSION); return; #endif break; } if (keysym >= 0xFF00 && keysym <= 0xFFFF) { #ifdef KEYSYM_RESOURCE if (!(shft | ctrl) && KeySym_map[keysym - 0xFF00] != NULL) { const unsigned char *kbuf; unsigned int len; kbuf = (KeySym_map[keysym - 0xFF00]); len = *kbuf++; /* escape prefix */ if (meta #ifdef META8_OPTION && (meta_char == 033) #endif ) { const unsigned char ch = '\033'; tt_write (&ch, 1); } tt_write (kbuf, len); return; } else #endif switch (keysym) { case XK_BackSpace: len = 1; kbuf[0] = (((PrivateModes & PrivMode_BackSpace) ? !(shft | ctrl) : (shft | ctrl)) ? '\b' : '\177'); break; case XK_Tab: if (shft) { len = 3; strcpy (kbuf, "\033[Z"); } break; case XK_Home: len = strlen (strcpy (kbuf, KS_HOME)); break; case XK_Left: /* "\033[D" */ case XK_Up: /* "\033[A" */ case XK_Right: /* "\033[C" */ case XK_Down: /* "\033[B" */ len = 3; strcpy (kbuf, "\033[@"); kbuf[2] = ("DACB"[keysym - XK_Left]); if (PrivateModes & PrivMode_aplCUR) { kbuf[1] = 'O'; } /* do Shift first */ else if (shft) { kbuf[2] = ("dacb"[keysym - XK_Left]); } else if (ctrl) { kbuf[1] = 'O'; kbuf[2] = ("dacb"[keysym - XK_Left]); } break; case XK_Prior: len = 4; strcpy (kbuf, "\033[5~"); break; case XK_Next: len = 4; strcpy (kbuf, "\033[6~"); break; case XK_End: len = strlen (strcpy (kbuf, KS_END)); break; case XK_Select: len = 4; strcpy (kbuf, "\033[4~"); break; case XK_Execute: len = 4; strcpy (kbuf, "\033[3~"); break; case XK_Insert: len = 4; strcpy (kbuf, "\033[2~"); break; case XK_Menu: len = 5; strcpy (kbuf, "\033[29~"); break; case XK_Find: len = 4; strcpy (kbuf, "\033[1~"); break; case XK_Help: len = 5; strcpy (kbuf, "\033[28~"); break; case XK_KP_Enter: /* allow shift to send normal "\033OM" */ if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) { len = 1; kbuf[0] = '\r'; } else { len = 3; strcpy (kbuf, "\033OM"); } break; case XK_KP_F1: /* "\033OP" */ case XK_KP_F2: /* "\033OQ" */ case XK_KP_F3: /* "\033OR" */ case XK_KP_F4: /* "\033OS" */ len = 3; strcpy (kbuf, "\033OP"); kbuf[2] += (keysym - XK_KP_F1); break; case XK_KP_Multiply: /* "\033Oj" : "*" */ case XK_KP_Add: /* "\033Ok" : "+" */ case XK_KP_Separator: /* "\033Ol" : "," */ case XK_KP_Subtract: /* "\033Om" : "-" */ case XK_KP_Decimal: /* "\033On" : "." */ case XK_KP_Divide: /* "\033Oo" : "/" */ case XK_KP_0: /* "\033Op" : "0" */ case XK_KP_1: /* "\033Oq" : "1" */ case XK_KP_2: /* "\033Or" : "2" */ case XK_KP_3: /* "\033Os" : "3" */ case XK_KP_4: /* "\033Ot" : "4" */ case XK_KP_5: /* "\033Ou" : "5" */ case XK_KP_6: /* "\033Ov" : "6" */ case XK_KP_7: /* "\033Ow" : "7" */ case XK_KP_8: /* "\033Ox" : "8" */ case XK_KP_9: /* "\033Oy" : "9" */ /* allow shift to override 'numlock_off' */ if ((PrivateModes & PrivMode_aplKP) == 0) { /* if numlock = off, for non numerics do : */ len = 1; kbuf[0] = ('*' + (keysym - XK_KP_Multiply)); } break; case XK_KP_Left: /* "\033[D" */ case XK_KP_Up: /* "\033[A" */ case XK_KP_Right: /* "\033[C" */ case XK_KP_Down: /* "\033[B" */ len = 3; strcpy (kbuf, "\033[@"); kbuf[2] = ("DACB"[keysym - XK_KP_Left]); if (PrivateModes & PrivMode_aplCUR) { kbuf[1] = 'O'; } else if (ctrl) { kbuf[1] = 'O'; kbuf[2] = ("dacb"[keysym - XK_KP_Left]); } break; case XK_KP_Prior: len = 4; strcpy (kbuf, "\033[5~"); break; case XK_KP_Next: len = 4; strcpy (kbuf, "\033[6~"); break; case XK_KP_End: len = strlen (strcpy (kbuf, KS_END)); break; case XK_KP_Insert: len = 4; strcpy (kbuf, "\033[2~"); break; case XK_KP_Home: len = strlen (strcpy (kbuf, KS_HOME)); break; case XK_KP_Delete: len = strlen (strcpy (kbuf, KS_DELETE)); break; /* Nothing associated with case KP_Begin: at the moment ... */ #define FKEY(n,fkey) len = 5;\ sprintf (kbuf,"\033[%02d~", (int)((n) + (keysym - fkey))) case XK_F1: /* "\033[11~" */ case XK_F2: /* "\033[12~" */ case XK_F3: /* "\033[13~" */ case XK_F4: /* "\033[14~" */ case XK_F5: /* "\033[15~" */ FKEY (11, XK_F1); break; case XK_F6: /* "\033[17~" */ case XK_F7: /* "\033[18~" */ case XK_F8: /* "\033[19~" */ case XK_F9: /* "\033[20~" */ case XK_F10: /* "\033[21~" */ FKEY (17, XK_F6); break; case XK_F11: /* "\033[23~" */ case XK_F12: /* "\033[24~" */ case XK_F13: /* "\033[25~" */ case XK_F14: /* "\033[26~" */ FKEY (23, XK_F11); break; case XK_F15: /* "\033[28~" */ case XK_F16: /* "\033[29~" */ FKEY (28, XK_F15); break; case XK_F17: /* "\033[31~" */ case XK_F18: /* "\033[32~" */ case XK_F19: /* "\033[33~" */ case XK_F20: /* "\033[34~" */ case XK_F21: /* "\033[35~" */ case XK_F22: /* "\033[36~" */ case XK_F23: /* "\033[37~" */ case XK_F24: /* "\033[38~" */ case XK_F25: /* "\033[39~" */ case XK_F26: /* "\033[40~" */ case XK_F27: /* "\033[41~" */ case XK_F28: /* "\033[42~" */ case XK_F29: /* "\033[43~" */ case XK_F30: /* "\033[44~" */ case XK_F31: /* "\033[45~" */ case XK_F32: /* "\033[46~" */ case XK_F33: /* "\033[47~" */ case XK_F34: /* "\033[48~" */ case XK_F35: /* "\033[49~" */ FKEY (31, XK_F17); break; #undef FKEY #ifdef KS_DELETE case XK_Delete: len = strlen (strcpy (kbuf, KS_DELETE)); break; #endif } } else if (ctrl && keysym == XK_minus) { len = 1; kbuf[0] = '\037'; /* Ctrl-Minus generates ^_ (31) */ } else { #ifdef META8_OPTION /* set 8-bit on */ if (meta && (meta_char == 0x80)) { unsigned char *ch; for (ch = kbuf; ch < kbuf + len; ch++) *ch |= 0x80; meta = 0; } #endif #ifdef GREEK_SUPPORT if (greek_mode) len = greek_xlat (kbuf, len); #endif /*nil */ ; } if (len <= 0) return; /* not mapped */ /* * these modifications only affect the static keybuffer * pass Shift/Control indicators for function keys ending with `~' * * eg, * Prior = "ESC[5~" * Shift+Prior = "ESC[5~" * Ctrl+Prior = "ESC[5^" * Ctrl+Shift+Prior = "ESC[5@" */ if (kbuf[0] == '\033' && kbuf[1] == '[' && kbuf[len - 1] == '~') kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~')); /* escape prefix */ if (meta #ifdef META8_OPTION && (meta_char == 033) #endif ) { const unsigned char ch = '\033'; tt_write (&ch, 1); } #ifdef DEBUG_CMD if (debug_key) /* Display keyboard buffer contents */ { char *p; int i; fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int) keysym, len); for (i = 0, p = kbuf; i < len; i++, p++) fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); fprintf (stderr, "'\n"); } #endif /* DEBUG_CMD */ tt_write (kbuf, len); } /*}}} */ /*{{{ cmd_ungetc(), cmd_getc() */ static void cmd_ungetc (unsigned char ch) { if (cmdbuf_ptr > cmdbuf_base) { /* sneak one in */ cmdbuf_ptr--; *cmdbuf_ptr = ch; } else { int n = (cmdbuf_endp - cmdbuf_base); if (n > 0) { if (n == sizeof (cmdbuf_base)) { /* drop one off the end to make room */ n--; cmdbuf_endp--; } memmove ((cmdbuf_base + 1), cmdbuf_base, n); } *cmdbuf_ptr = ch; cmdbuf_endp++; } } /* attempt to `write' COUNT to the input buffer */ unsigned int cmd_write (const unsigned char *str, unsigned int count) { while (count--) cmd_ungetc (str[count]); return 0; } /* cmd_getc() - Return next input character */ /* * Return the next input character after first passing any keyboard input * to the command. */ static unsigned char cmd_getc (void) { #define TIMEOUT_USEC 5000 static short refreshed = 0; fd_set readfds; int retval; struct itimerval value; /* If there have been a lot of new lines, then update the screen * What the heck I'll cheat and only refresh less than every page-full. * the number of pages between refreshes is refresh_limit, which * is incremented here because we must be doing flat-out scrolling. * * refreshing should be correct for small scrolls, because of the * time-out */ if (refresh_count > (refresh_limit * TermWin.nrow)) { if (refresh_limit < REFRESH_PERIOD) refresh_limit++; refresh_count = 0; refreshed = 1; scr_refresh (refresh_type); } /* characters already read in */ if (cmdbuf_ptr < cmdbuf_endp) goto Return_Char; while (1) { while (XPending (Xdisplay)) /* process pending X events */ { XEvent ev; refreshed = 0; XNextEvent (Xdisplay, &ev); process_x_event (&ev); /* in case button actions pushed chars to cmdbuf */ if (cmdbuf_ptr < cmdbuf_endp) goto Return_Char; } /* Nothing to do! */ FD_ZERO (&readfds); FD_SET (cmd_fd, &readfds); FD_SET (Xfd, &readfds); value.it_value.tv_usec = TIMEOUT_USEC; value.it_value.tv_sec = 0; retval = select (num_fds, &readfds, NULL, NULL, (refreshed ? NULL : &value.it_value)); /* See if we can read from the application */ if (FD_ISSET (cmd_fd, &readfds)) { unsigned int count = sizeof (cmdbuf_base) - 1; cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; /* while (count > sizeof(cmdbuf_base) / 2) */ while (count) { int n = read (cmd_fd, cmdbuf_endp, count); if (n <= 0) break; cmdbuf_endp += n; count -= n; } /* some characters read in */ if (cmdbuf_ptr < cmdbuf_endp) goto Return_Char; } /* select statement timed out - better update the screen */ if (retval == 0) { refresh_count = 0; refresh_limit = 1; if (!refreshed) { refreshed = 1; scr_refresh (refresh_type); scrollbar_show (1); } } } return 0; Return_Char: refreshed = 0; return (*cmdbuf_ptr++); } /*}}} */ /*{{{ process an X event */ static void process_x_event (XEvent * ev) { static Time buttonpress_time; static int clicks = 0; #define clickOnce() (clicks <= 1) static int bypass_keystate = 0; int reportmode; switch (ev->type) { case KeyPress: lookup_key (ev); break; case ClientMessage: if (ev->xclient.format == 32 && ev->xclient.data.l[0] == wmDeleteWindow) exit (EXIT_SUCCESS); #ifdef OFFIX_DND /* OffiX Dnd (drag 'n' drop) protocol */ if (ev->xclient.message_type == DndProtocol && (ev->xclient.data.l[0] == DndFile) || (ev->xclient.data.l[0] == DndDir) || (ev->xclient.data.l[0] == DndLink)) { /* Get Dnd data */ Atom ActualType; int ActualFormat; unsigned char *data; unsigned long Size, RemainingBytes; XGetWindowProperty (Xdisplay, Xroot, DndSelection, 0L, 1000000L, False, AnyPropertyType, &ActualType, &ActualFormat, &Size, &RemainingBytes, &data); XChangeProperty (Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, data, strlen (data)); selection_paste (Xroot, XA_CUT_BUFFER0, True); XSetInputFocus (Xdisplay, Xroot, RevertToNone, CurrentTime); } #endif /* OFFIX_DND */ break; case MappingNotify: XRefreshKeyboardMapping (&(ev->xmapping)); break; /* Here's my conclusiion: * If the window is completely unobscured, use bitblt's * to scroll. Even then, they're only used when doing partial * screen scrolling. When partially obscured, we have to fill * in the GraphicsExpose parts, which means that after each refresh, * we need to wait for the graphics expose or Noexpose events, * which ought to make things real slow! */ case VisibilityNotify: switch (ev->xvisibility.state) { case VisibilityUnobscured: refresh_type = FAST_REFRESH; break; case VisibilityPartiallyObscured: refresh_type = SLOW_REFRESH; break; default: refresh_type = NO_REFRESH; break; } break; case FocusIn: if (!TermWin.focus) { TermWin.focus = 1; #ifndef NO_XLOCALE if (Input_Context != NULL) XSetICFocus (Input_Context); #endif } break; case FocusOut: if (TermWin.focus) { TermWin.focus = 0; #ifndef NO_XLOCALE if (Input_Context != NULL) XUnsetICFocus (Input_Context); #endif } break; case ConfigureNotify: resize_window (); break; case SelectionClear: selection_clear (); break; case SelectionNotify: selection_paste (ev->xselection.requestor, ev->xselection.property, True); break; case SelectionRequest: selection_send (&(ev->xselectionrequest)); break; case GraphicsExpose: case Expose: if (ev->xany.window == TermWin.vt) { scr_expose (ev->xexpose.x, ev->xexpose.y, ev->xexpose.width, ev->xexpose.height); } else { XEvent unused_xevent; while (XCheckTypedWindowEvent (Xdisplay, ev->xany.window, Expose, &unused_xevent)); while (XCheckTypedWindowEvent (Xdisplay, ev->xany.window, GraphicsExpose, &unused_xevent)); if (isScrollbarWindow (ev->xany.window)) { scrollbar_setNone (); scrollbar_show (0); } Gr_expose (ev->xany.window); } break; case ButtonPress: bypass_keystate = (ev->xbutton.state & (Mod1Mask | ShiftMask)); reportmode = (bypass_keystate ? 0 : (PrivateModes & PrivMode_mouse_report)); if (ev->xany.window == TermWin.vt) { if (ev->xbutton.subwindow != None) Gr_ButtonPress (ev->xbutton.x, ev->xbutton.y); else { if (reportmode) { if (reportmode & PrivMode_MouseX10) { /* no state info allowed */ ev->xbutton.state = 0; } #ifdef MOUSE_REPORT_DOUBLECLICK if (ev->xbutton.button == Button1) { if (ev->xbutton.time - buttonpress_time < MULTICLICK_TIME) clicks++; else clicks = 1; } #else clicks = 1; #endif /* MOUSE_REPORT_DOUBLECLICK */ mouse_report (&(ev->xbutton)); } else switch (ev->xbutton.button) { case Button1: if (ev->xbutton.time - buttonpress_time < MULTICLICK_TIME) clicks++; else clicks = 1; selection_click (clicks, ev->xbutton.x, ev->xbutton.y); break; case Button3: selection_extend (ev->xbutton.x, ev->xbutton.y); break; } buttonpress_time = ev->xbutton.time; return; } } if (isScrollbarWindow (ev->xany.window)) { scrollbar_setNone (); /* * Rxvt-style scrollbar: * move up if mouse if above slider * move dn if mouse if below slider * * XTerm-style scrollbar: * Move display proportional to pointer location * pointer near top -> scroll one line * pointer near bot -> scroll full page */ #ifndef NO_SCROLLBAR_REPORT if (reportmode) { /* * Mouse report disabled scrollbar: * arrow buttons - send up/down * click on scrollbar - send pageup/down */ if (scrollbar_upButton (ev->xbutton.y)) tt_printf ("\033[A"); else if (scrollbar_dnButton (ev->xbutton.y)) tt_printf ("\033[B"); else switch (ev->xbutton.button) { case Button2: tt_printf ("\014"); break; case Button1: tt_printf ("\033[6~"); break; case Button3: tt_printf ("\033[5~"); break; } } else #endif /* NO_SCROLLBAR_REPORT */ { if (scrollbar_upButton (ev->xbutton.y)) { /* I would like continuous scrolling */ if (scr_page (UP, 1)) scrollbar_setUp (); } else if (scrollbar_dnButton (ev->xbutton.y)) { if (scr_page (DN, 1)) scrollbar_setDn (); } else switch (ev->xbutton.button) { case Button2: #ifndef XTERM_SCROLLBAR if (scrollbar_above_slider (ev->xbutton.y) || scrollbar_below_slider (ev->xbutton.y)) #endif scr_move_to (scrollbar_position (ev->xbutton.y), scrollbar_size ()); scrollbar_setMotion (); break; case Button1: /*drop */ case Button3: #ifndef XTERM_SCROLLBAR if (scrollbar_above_slider (ev->xbutton.y)) scr_page (UP, TermWin.nrow / 4); else if (scrollbar_below_slider (ev->xbutton.y)) scr_page (DN, TermWin.nrow / 4); else scrollbar_setMotion (); #else /* XTERM_SCROLLBAR */ scr_page ((ev->xbutton.button == Button1 ? DN : UP), (TermWin.nrow * scrollbar_position (ev->xbutton.y) / scrollbar_size ()) ); #endif /* XTERM_SCROLLBAR */ break; } } return; } break; case ButtonRelease: reportmode = (bypass_keystate ? 0 : (PrivateModes & PrivMode_mouse_report)); if (scrollbar_isUpDn ()) { scrollbar_setNone (); scrollbar_show (0); } if (ev->xany.window == TermWin.vt) { if (ev->xbutton.subwindow != None) Gr_ButtonRelease (ev->xbutton.x, ev->xbutton.y); else { if (reportmode) { switch (reportmode & PrivMode_mouse_report) { case PrivMode_MouseX10: break; case PrivMode_MouseX11: ev->xbutton.state = bypass_keystate; ev->xbutton.button = AnyButton; mouse_report (&(ev->xbutton)); break; } return; } /* * dumb hack to compensate for the failure of click-and-drag * when overriding mouse reporting */ if ((PrivateModes & PrivMode_mouse_report) && (bypass_keystate) && (ev->xbutton.button == Button1) && (clickOnce ())) selection_extend (ev->xbutton.x, ev->xbutton.y); switch (ev->xbutton.button) { case Button1: case Button3: selection_make (ev->xbutton.time); break; case Button2: selection_request (ev->xbutton.time, ev->xbutton.x, ev->xbutton.y); break; } } } break; case MotionNotify: if ((PrivateModes & PrivMode_mouse_report) && !(bypass_keystate)) break; if (ev->xany.window == TermWin.vt) { if ((ev->xbutton.state & (Button1Mask | Button3Mask)) && clickOnce ()) { Window unused_root, unused_child; int unused_root_x, unused_root_y; unsigned int unused_mask; while (XCheckTypedWindowEvent (Xdisplay, TermWin.vt, MotionNotify, ev)); XQueryPointer (Xdisplay, TermWin.vt, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); #ifdef MOUSE_THRESHOLD /* deal with a `jumpy' mouse */ if ((ev->xmotion.time - buttonpress_time) > MOUSE_THRESHOLD) #endif selection_extend ((ev->xbutton.x), (ev->xbutton.y)); } } else if ((ev->xany.window == scrollBar.win) && scrollbar_isMotion ()) { Window unused_root, unused_child; int unused_root_x, unused_root_y; unsigned int unused_mask; while (XCheckTypedWindowEvent (Xdisplay, scrollBar.win, MotionNotify, ev)); XQueryPointer (Xdisplay, scrollBar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); scr_move_to (scrollbar_position (ev->xbutton.y), scrollbar_size ()); scr_refresh (refresh_type); refresh_count = refresh_limit = 0; scrollbar_show (1); } break; } } /*}}} */ /*{{{ tt_write(), tt_printf() - output to command */ /* * Send count characters directly to the command */ void tt_write (const unsigned char *buf, unsigned int count) { while (count > 0) { int n = write (cmd_fd, buf, count); if (n > 0) { count -= n; buf += n; } } } /* * Send printf() formatted output to the command. * Only use for small ammounts of data. */ void tt_printf (const unsigned char *fmt,...) { static unsigned char buf[256]; va_list arg_ptr; va_start (arg_ptr, fmt); vsprintf (buf, fmt, arg_ptr); va_end (arg_ptr); tt_write (buf, strlen (buf)); } /*}}} */ /*{{{ print pipe */ /*----------------------------------------------------------------------*/ #ifdef PRINTPIPE FILE * popen_printer (void) { FILE *stream = popen (rs_print_pipe, "w"); if (stream == NULL) print_error ("can't open printer pipe"); return stream; } int pclose_printer (FILE * stream) { fflush (stream); /* pclose() reported not to work on SunOS 4.1.3 */ #if defined (__sun__) /* pclose works provided SIGCHLD handler uses waitpid */ return pclose (stream); /* return fclose (stream); */ #else return pclose (stream); #endif } /* * simulate attached vt100 printer */ static void process_print_pipe (void) { const char *const escape_seq = "\033[4i"; const char *const rev_escape_seq = "i4[\033"; int index; FILE *fd; if ((fd = popen_printer ()) != NULL) { for (index = 0; index < 4; /* nil */ ) { unsigned char ch = cmd_getc (); if (ch == escape_seq[index]) index++; else if (index) for ( /*nil */ ; index > 0; index--) fputc (rev_escape_seq[index - 1], fd); if (index == 0) fputc (ch, fd); } pclose_printer (fd); } } #endif /* PRINTPIPE */ /*}}} */ /*{{{ process escape sequences */ static void process_escape_seq (void) { unsigned char ch = cmd_getc (); switch (ch) { /* case 1: do_tek_mode (); break; */ case '#': if (cmd_getc () == '8') scr_E (); break; case '(': scr_charset_set (0, cmd_getc ()); break; case ')': scr_charset_set (1, cmd_getc ()); break; case '*': scr_charset_set (2, cmd_getc ()); break; case '+': scr_charset_set (3, cmd_getc ()); break; #ifdef KANJI case '$': scr_charset_set (-2, cmd_getc ()); break; #endif case '7': scr_cursor (SAVE); break; case '8': scr_cursor (RESTORE); break; case '=': case '>': PrivMode ((ch == '='), PrivMode_aplKP); break; case '@': (void) cmd_getc (); break; case 'D': scr_index (UP); break; case 'E': scr_add_lines ("\n\r", 1, 2); break; case 'G': process_graphics (); break; case 'H': scr_set_tab (1); break; case 'M': scr_index (DN); break; /*case 'N': scr_single_shift (2); break; */ /*case 'O': scr_single_shift (3); break; */ case 'Z': tt_printf (ESCZ_ANSWER); break; /* steal obsolete ESC [ c */ case '[': process_csi_seq (); break; case ']': process_xterm_seq (); break; case 'c': scr_poweron (); break; case 'n': scr_charset_choose (2); break; case 'o': scr_charset_choose (3); break; } } /*}}} */ /*{{{ process CSI (code sequence introducer) sequences `ESC[' */ static void process_csi_seq (void) { unsigned char ch, priv; unsigned int nargs; int arg[ESC_ARGS]; nargs = 0; arg[0] = 0; arg[1] = 0; priv = 0; ch = cmd_getc (); if (ch >= '<' && ch <= '?') { priv = ch; ch = cmd_getc (); } /* read any numerical arguments */ do { int n; for (n = 0; isdigit (ch); ch = cmd_getc ()) n = n * 10 + (ch - '0'); if (nargs < ESC_ARGS) arg[nargs++] = n; if (ch == '\b') { scr_backspace (); } else if (ch == 033) { process_escape_seq (); return; } else if (ch < ' ') { scr_add_lines (&ch, 0, 1); return; } if (ch < '@') ch = cmd_getc (); } while (ch >= ' ' && ch < '@'); if (ch == 033) { process_escape_seq (); return; } else if (ch < ' ') return; switch (ch) { #ifdef PRINTPIPE case 'i': /* printing */ switch (arg[0]) { case 0: scr_printscreen (0); break; case 5: process_print_pipe (); break; } break; #endif case 'A': case 'e': /* up */ scr_gotorc ((arg[0] ? -arg[0] : -1), 0, RELATIVE); break; case 'B': /* down */ scr_gotorc ((arg[0] ? +arg[0] : +1), 0, RELATIVE); break; case 'C': case 'a': /* right */ scr_gotorc (0, (arg[0] ? +arg[0] : +1), RELATIVE); break; case 'D': /* left */ scr_gotorc (0, (arg[0] ? -arg[0] : -1), RELATIVE); break; case 'E': /* down & to first column */ scr_gotorc ((arg[0] ? +arg[0] : +1), 0, R_RELATIVE); break; case 'F': /* up & to first column */ scr_gotorc ((arg[0] ? -arg[0] : -1), 0, R_RELATIVE); break; case 'G': case '`': /* move to col */ scr_gotorc (0, (arg[0] ? +arg[0] : +1), R_RELATIVE); break; case 'd': /* move to row */ scr_gotorc ((arg[0] ? +arg[0] : +1), 0, C_RELATIVE); break; case 'H': case 'f': /* position cursor */ switch (nargs) { case 0: scr_gotorc (0, 0, 0); break; case 1: scr_gotorc ((arg[0] ? arg[0] - 1 : 0), 0, 0); break; default: scr_gotorc (arg[0] - 1, arg[1] - 1, 0); break; } break; case 'I': scr_tab (arg[0] ? +arg[0] : +1); break; case 'Z': scr_tab (arg[0] ? -arg[0] : -1); break; case 'J': scr_erase_screen (arg[0]); break; case 'K': scr_erase_line (arg[0]); break; case '@': scr_insdel_chars ((arg[0] ? arg[0] : 1), INSERT); break; case 'L': scr_insdel_lines ((arg[0] ? arg[0] : 1), INSERT); break; case 'M': scr_insdel_lines ((arg[0] ? arg[0] : 1), DELETE); break; case 'X': scr_insdel_chars ((arg[0] ? arg[0] : 1), ERASE); break; case 'P': scr_insdel_chars ((arg[0] ? arg[0] : 1), DELETE); break; case 'c': tt_printf (VT100_ANS); break; case 'm': process_sgr_mode (nargs, arg); break; case 'n': /* request for information */ switch (arg[0]) { case 5: tt_printf ("\033[0n"); break; /* ready */ case 6: scr_report_position (); break; #if defined (ENABLE_DISPLAY_ANSWER) case 7: tt_printf ("%s\n", display_name); break; #endif case 8: xterm_seq (XTerm_title, APL_NAME "-" VERSION); break; } break; case 'r': /* set top and bottom margins */ if (priv != '?') { if (nargs < 2 || arg[0] >= arg[1]) scr_scroll_region (0, 10000); else scr_scroll_region (arg[0] - 1, arg[1] - 1); break; } /* drop */ case 's': case 't': case 'h': case 'l': process_terminal_mode (ch, priv, nargs, arg); break; case 'g': switch (arg[0]) { case 0: scr_set_tab (0); break; /* delete tab */ case 3: scr_set_tab (-1); break; /* clear all tabs */ } break; case 'W': switch (arg[0]) { case 0: scr_set_tab (1); break; /* = ESC H */ case 2: scr_set_tab (0); break; /* = ESC [ 0 g */ case 5: scr_set_tab (-1); break; /* = ESC [ 3 g */ } break; } } /*}}} */ /*{{{ process xterm text parameters sequences `ESC ] Ps ; Pt BEL' */ static void process_xterm_seq (void) { unsigned char ch, string[STRING_MAX]; int arg; ch = cmd_getc (); for (arg = 0; isdigit (ch); ch = cmd_getc ()) arg = arg * 10 + (ch - '0'); if (ch == ';') { int n = 0; while ((ch = cmd_getc ()) != 007) { if ((n < sizeof (string) - 1)) { /* silently translate whitespace to space char */ if (isspace (ch)) ch = ' '; if (ch >= ' ') string[n++] = ch; } } string[n] = '\0'; xterm_seq (arg, string); } } /*}}} */ /*{{{ process DEC private mode sequences `ESC [ ? Ps mode' */ /* * mode can only have the following values: * 'l' = low * 'h' = high * 's' = save * 'r' = restore * 't' = toggle * so no need for fancy checking */ static void process_terminal_mode (int mode, int priv, unsigned int nargs, int arg[]) { unsigned int i; int state; if (nargs == 0) return; /* make lo/hi boolean */ switch (mode) { case 'l': mode = 0; break; case 'h': mode = 1; break; } switch (priv) { case 0: if (mode && mode != 1) return; /* only do high/low */ for (i = 0; i < nargs; i++) switch (arg[i]) { case 4: scr_insert_mode (mode); break; case 36: PrivMode (mode, PrivMode_BackSpace); break; /* case 38: TEK mode */ } break; #define PrivCases(bit) \ if (mode == 't') state = !(PrivateModes & bit); else state = mode;\ switch (state) {\ case 's': SavedModes |= (PrivateModes & bit); continue; break;\ case 'r': state = (SavedModes & bit) ? 1 : 0;/*drop*/\ default: PrivMode (state, bit); } case '?': for (i = 0; i < nargs; i++) switch (arg[i]) { case 1: /* application cursor keys */ PrivCases (PrivMode_aplCUR); break; /* case 2: - reset charsets to USASCII */ case 3: /* 80/132 */ PrivCases (PrivMode_132); if (PrivateModes & PrivMode_132OK) set_width (state ? 132 : 80); break; /* case 4: - smooth scrolling */ case 5: /* reverse video */ PrivCases (PrivMode_rVideo); scr_rvideo_mode (state); break; case 6: /* relative/absolute origins */ PrivCases (PrivMode_relOrigin); scr_relative_origin (state); break; case 7: /* autowrap */ PrivCases (PrivMode_Autowrap); scr_autowrap (state); break; /* case 8: - auto repeat, can't do on a per window basis */ case 9: /* X10 mouse reporting */ PrivCases (PrivMode_MouseX10); /* orthogonal */ if (PrivateModes & PrivMode_MouseX10) PrivateModes &= ~(PrivMode_MouseX11); break; #ifdef scrollBar_esc case scrollBar_esc: PrivCases (PrivMode_scrollBar); map_scrollBar (state); break; #endif case 25: /* visible/invisible cursor */ PrivCases (PrivMode_VisibleCursor); scr_cursor_visible (state); break; case 35: PrivCases (PrivMode_ShiftKeys); break; case 36: PrivCases (PrivMode_BackSpace); break; case 40: /* 80 <--> 132 mode */ PrivCases (PrivMode_132OK); break; case 47: /* secondary screen */ PrivCases (PrivMode_Screen); scr_change_screen (state); break; case 66: /* application key pad */ PrivCases (PrivMode_aplKP); break; case 1000: /* X11 mouse reporting */ PrivCases (PrivMode_MouseX11); /* orthogonal */ if (PrivateModes & PrivMode_MouseX11) PrivateModes &= ~(PrivMode_MouseX10); break; #if 0 case 1001: break; /* X11 mouse highlighting */ #endif } #undef PrivCases break; } } /*}}} */ /*{{{ process sgr sequences */ static void process_sgr_mode (unsigned int nargs, int arg[]) { unsigned int i; if (nargs == 0) { scr_rendition (0, ~RS_None); return; } for (i = 0; i < nargs; i++) switch (arg[i]) { case 0: scr_rendition (0, ~RS_None); break; case 1: scr_rendition (1, RS_Bold); break; case 4: scr_rendition (1, RS_Uline); break; case 5: scr_rendition (1, RS_Blink); break; case 7: scr_rendition (1, RS_RVid); break; case 22: scr_rendition (0, RS_Bold); break; case 24: scr_rendition (0, RS_Uline); break; case 25: scr_rendition (0, RS_Blink); break; case 27: scr_rendition (0, RS_RVid); break; case 30: case 31: /* set fg color */ case 32: case 33: case 34: case 35: case 36: case 37: scr_color (minColor + (arg[i] - 30), RS_Bold); break; case 39: /* default fg */ scr_color (restoreFG, RS_Bold); break; case 40: case 41: /* set bg color */ case 42: case 43: case 44: case 45: case 46: case 47: scr_color (minColor + (arg[i] - 40), RS_Blink); break; case 49: /* default bg */ scr_color (restoreBG, RS_Blink); break; } } /*}}} */ /*{{{ process Rob Nation's own graphics mode sequences */ static void process_graphics (void) { unsigned char ch, cmd = cmd_getc (); #ifndef RXVT_GRAPHICS if (cmd == 'Q') /* query graphics */ { tt_printf ("\033G0\n"); /* no graphics */ return; } /* swallow other graphics sequences until terminating ':' */ do ch = cmd_getc (); while (ch != ':'); #else int nargs; int args[NGRX_PTS]; unsigned char *text = NULL; if (cmd == 'Q') /* query graphics */ { tt_printf ("\033G1\n"); /* yes, graphics (color) */ return; } for (nargs = 0; nargs < (sizeof (args) / sizeof (args[0])) - 1; /*nil */ ) { int neg; ch = cmd_getc (); neg = (ch == '-'); if (neg || ch == '+') ch = cmd_getc (); for (args[nargs] = 0; isdigit (ch); ch = cmd_getc ()) args[nargs] = args[nargs] * 10 + (ch - '0'); if (neg) args[nargs] = -args[nargs]; nargs++; args[nargs] = 0; if (ch != ';') break; } if ((cmd == 'T') && (nargs >= 5)) { int i, len = args[4]; text = MALLOC ((len + 1) * sizeof (char), "text"); if (text != NULL) { for (i = 0; i < len; i++) text[i] = cmd_getc (); text[len] = '\0'; } } Gr_do_graphics (cmd, nargs, args, text); #endif } /*}}} */ /*{{{ Read and process output from the application */ void main_loop (void) { int ch; do { while ((ch = cmd_getc ()) == 0); /* wait for something */ if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') { /* Read a text string from the input buffer */ int nlines = 0; unsigned char *str; /* * point to the start of the string, * decrement first since already did get_com_char () */ str = --cmdbuf_ptr; while (cmdbuf_ptr < cmdbuf_endp) { ch = *cmdbuf_ptr; if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') { cmdbuf_ptr++; if (ch == '\n') { nlines++; refresh_count++; if (refresh_count > (refresh_limit * TermWin.nrow)) break; } } else /* unprintable */ { break; } } scr_add_lines (str, nlines, (cmdbuf_ptr - str)); } else { switch (ch) { case 005: tt_printf (VT100_ANS); break; /* terminal Status */ case 007: scr_bell (); break; /* bell */ case '\b': scr_backspace (); break; /* backspace */ case 013: case 014: scr_index (UP); break; /* vertical tab, form feed */ case 016: scr_charset_choose (1); break; /* shift out - acs */ case 017: scr_charset_choose (0); break; /* shift in - acs */ case 033: process_escape_seq (); break; } } } while (ch != EOF); } /*}}} */ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/Xtensions/graphics/graphics.c0000644000175000017500000003104411375434150020700 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: graphics.c * * This module is all new by Rob Nation * * * Modifications by mj olesen * and Raul Garcia Garcia *----------------------------------------------------------------------*/ /*{{{ includes, defines */ #include "main.h" #ifdef HAVE_UNISTD_H #include #endif #include #include "command.h" /* for tt_printf() */ #include "debug.h" #include "graphics.h" #include "screen.h" /* commands: * 'C' = Clear * 'F' = Fill * 'G' = Geometry * 'L' = Line * 'P' = Points * 'T' = Text * 'W' = Window */ #ifndef GRX_SCALE #define GRX_SCALE 10000 #endif /*}}} */ /* extern functions referenced */ /* extern variables referenced */ /* extern variables declared here */ #ifdef RXVT_GRAPHICS /*{{{ local variables */ static int graphics_up = 0; typedef struct grcmd_t { char cmd; short color; short ncoords; int *coords; unsigned char *text; struct grcmd_t *next; } grcmd_t; typedef struct grwin_t { Window win; int x, y; unsigned int w, h; short screen; grcmd_t *graphics; struct grwin_t *prev, *next; } grwin_t; static grwin_t *gr_root = NULL; /*}}} */ /*----------------------------------------------------------------------* * local functions */ /*{{{ Gr_NewWindow() */ static void Gr_NewWindow (int nargs, int args[]) { int x, y; unsigned int w, h; Window win; grwin_t *grwin; Cursor cursor; if (nargs != 4) { print_error ("NewWindow: 4 args needed, got %d\n", nargs); return; } x = args[0] * TermWin.width / GRX_SCALE + TermWin_internalBorder; y = args[1] * TermWin.height / GRX_SCALE + TermWin_internalBorder; w = args[2] * TermWin.width / GRX_SCALE; h = args[3] * TermWin.height / GRX_SCALE; win = XCreateSimpleWindow (Xdisplay, TermWin.vt, x, y, w, h, 0, PixColors[fgColor], PixColors[bgColor]); cursor = XCreateFontCursor (Xdisplay, XC_crosshair); XDefineCursor (Xdisplay, win, cursor); XMapWindow (Xdisplay, win); XSelectInput (Xdisplay, win, ExposureMask); grwin = MALLOC (sizeof (grwin_t), "grwin"); grwin->win = win; grwin->x = x; grwin->y = y; grwin->w = w; grwin->h = h; grwin->screen = 0; grwin->prev = NULL; grwin->next = gr_root; if (grwin->next) grwin->next->prev = grwin; gr_root = grwin; grwin->graphics = NULL; graphics_up++; tt_printf ("\033W%ld\n", (long) grwin->win); } /*}}} */ /*{{{ Gr_ClearWindow() */ static void Gr_ClearWindow (grwin_t * grwin) { grcmd_t *cmd, *next; for (cmd = grwin->graphics; cmd != NULL; cmd = next) { next = cmd->next; free (cmd->coords); if (cmd->text != NULL) free (cmd->text); free (cmd); } grwin->graphics = NULL; XClearWindow (Xdisplay, grwin->win); } /*}}} */ /*{{{ Gr_Text() */ /* * arg [0] = x * arg [1] = y * arg [2] = alignment * arg [3] = strlen (text) */ static void Gr_Text (grwin_t * grwin, grcmd_t * data) { int x, y, align; if (data->ncoords < 4 || data->text == NULL || *(data->text) == '\0') return; x = data->coords[0] * grwin->w / GRX_SCALE; y = data->coords[1] * grwin->h / GRX_SCALE; align = data->coords[2]; if (align & RIGHT_TEXT) x -= XTextWidth (TermWin.font, data->text, data->coords[3]); else if (align & HCENTER_TEXT) x -= (XTextWidth (TermWin.font, data->text, data->coords[3]) >> 1); if (align & TOP_TEXT) y += TermWin.font->ascent; else if (align & BOTTOM_TEXT) y -= TermWin.font->descent; if (align & VCENTER_TEXT) y -= TermWin.font->descent + ((TermWin.font->ascent + TermWin.font->descent) >> 1); if (align & VCAPS_CENTER_TEXT) y += (TermWin.font->ascent >> 1); #ifdef XPM_BACKGROUND XClearArea (Xdisplay, grwin->win, x, y, Width2Pixel (data->coords[3]), Height2Pixel (1), 0); #endif XDrawString (Xdisplay, grwin->win, TermWin.gc, x, y, data->text, data->coords[3]); } /*}}} */ /*{{{ Gr_Geometry() */ static void Gr_Geometry (grwin_t * grwin, grcmd_t * data) { if (grwin) tt_printf ("\033G%ld %d %d %u %u %d %d %ld %ld %d\n", (long) grwin->win, grwin->x, grwin->y, grwin->w, grwin->h, TermWin.fwidth, TermWin.fheight, (long) GRX_SCALE * TermWin.fwidth / grwin->w, (long) GRX_SCALE * TermWin.fheight / grwin->h, Xdepth); else /* rxvt terminal window size */ tt_printf ("\033G0 0 0 %d %d %d %d %ld %ld %d\n", TermWin.width - 2 * TermWin_internalBorder, TermWin.height - 2 * TermWin_internalBorder, TermWin.fwidth, TermWin.fheight, (long) GRX_SCALE * TermWin.fwidth / (TermWin.width - 2 * TermWin_internalBorder), (long) GRX_SCALE * TermWin.fheight / (TermWin.height - 2 * TermWin_internalBorder), Xdepth); } /*}}} */ /*{{{ Gr_DestroyWindow() */ static void Gr_DestroyWindow (grwin_t * grwin) { grcmd_t *cmd, *next; if (grwin == NULL) return; for (cmd = grwin->graphics; cmd; cmd = next) { next = cmd->next; free (cmd->coords); if (cmd->text != NULL) free (cmd->text); free (cmd); } XDestroyWindow (Xdisplay, grwin->win); if (grwin->next != NULL) grwin->next->prev = grwin->prev; if (grwin->prev != NULL) grwin->prev->next = grwin->next; else gr_root = grwin->next; free (grwin); graphics_up--; } /*}}} */ /*{{{ Gr_Dispatch() */ static void Gr_Dispatch (grwin_t * grwin, grcmd_t * data) { int i, n; union { XPoint pt[NGRX_PTS / 2]; XRectangle rect[NGRX_PTS / 4]; } xdata; if (data->color != fgColor) { XGCValues gcv; gcv.foreground = PixColors[data->color]; XChangeGC (Xdisplay, TermWin.gc, GCForeground, &gcv); } if (grwin) switch (data->cmd) { case 'L': if (data->ncoords > 3) { for (n = i = 0; i < data->ncoords; i += 2, n++) { xdata.pt[n].x = data->coords[i] * grwin->w / GRX_SCALE; xdata.pt[n].y = data->coords[i + 1] * grwin->h / GRX_SCALE; } XDrawLines (Xdisplay, grwin->win, TermWin.gc, xdata.pt, n, CoordModeOrigin); } break; case 'P': if (data->ncoords > 3) { for (n = i = 0; i < data->ncoords; i += 2, n++) { xdata.pt[n].x = data->coords[i] * grwin->w / GRX_SCALE; xdata.pt[n].y = data->coords[i + 1] * grwin->h / GRX_SCALE; } XDrawPoints (Xdisplay, grwin->win, TermWin.gc, xdata.pt, n, CoordModeOrigin); } break; case 'F': if (data->ncoords > 0) { for (n = i = 0; i < data->ncoords; i += 4, n++) { xdata.rect[n].x = data->coords[i] * grwin->w / GRX_SCALE; xdata.rect[n].y = data->coords[i + 1] * grwin->h / GRX_SCALE; xdata.rect[n].width = ((data->coords[i + 2] - data->coords[i] + 1) * grwin->w / GRX_SCALE); xdata.rect[n].height = ((data->coords[i + 3] - data->coords[i + 1] + 1) * grwin->h / GRX_SCALE); #ifdef XPM_BACKGROUND XClearArea (Xdisplay, grwin->win, xdata.rect[n].x, xdata.rect[n].y, xdata.rect[n].width, xdata.rect[n].height, 0); #endif } XFillRectangles (Xdisplay, grwin->win, TermWin.gc, xdata.rect, n); } break; case 'T': Gr_Text (grwin, data); break; case 'C': Gr_ClearWindow (grwin); break; } if (data->color != fgColor) { XGCValues gcv; gcv.foreground = PixColors[fgColor]; XChangeGC (Xdisplay, TermWin.gc, GCForeground, &gcv); } } /*}}} */ /*{{{ Gr_Redraw() */ static void Gr_Redraw (grwin_t * grwin) { grcmd_t *cmd; for (cmd = grwin->graphics; cmd != NULL; cmd = cmd->next) Gr_Dispatch (grwin, cmd); } /*}}} */ #endif /*----------------------------------------------------------------------* * end of static functions */ #ifdef RXVT_GRAPHICS /*{{{ Gr_ButtonReport() */ void Gr_ButtonReport (int but, int x, int y) { grwin_t *grwin; for (grwin = gr_root; grwin != NULL; grwin = grwin->next) if ((x > grwin->x) && (y > grwin->y) && (x < grwin->x + grwin->w) && (y < grwin->y + grwin->h)) break; if (grwin == NULL) return; x = GRX_SCALE * (x - grwin->x) / grwin->w; y = GRX_SCALE * (y - grwin->y) / grwin->h; tt_printf ("\033%c%ld;%d;%d;\n", but, (long) grwin->win, x, y); } /*}}} */ /*{{{ Gr_do_graphics() */ void Gr_do_graphics (int cmd, int nargs, int args[], unsigned char *text) { static Window last_id = None; long win_id; grwin_t *grwin; grcmd_t *newcmd, *oldcmd; int i; if (cmd == 'W') { Gr_NewWindow (nargs, args); return; } win_id = (nargs > 0) ? (Window) args[0] : None; if ((cmd == 'G') && (win_id == None)) { Gr_Geometry (NULL, NULL); return; } if ((win_id == None) && (last_id != None)) win_id = last_id; if (win_id == None) return; grwin = gr_root; while ((grwin != NULL) && (grwin->win != win_id)) grwin = grwin->next; if (grwin == NULL) return; if (cmd == 'G') { Gr_Geometry (grwin, NULL); return; } nargs--; args++; /* skip over window id */ /* record this new command */ newcmd = MALLOC (sizeof (grcmd_t), "grcmd_t"); newcmd->ncoords = nargs; newcmd->coords = MALLOC ((newcmd->ncoords * sizeof (int)), "coords"); newcmd->next = NULL; newcmd->cmd = cmd; newcmd->color = scr_get_fgcolor (); newcmd->text = text; for (i = 0; i < newcmd->ncoords; i++) newcmd->coords[i] = args[i]; /* * If newcmd == fill, and rectangle is full window, drop all prior * commands. */ if ((newcmd->cmd == 'F') && (grwin) && (grwin->graphics)) { for (i = 0; i < newcmd->ncoords; i += 4) { if ((newcmd->coords[i] == 0) && (newcmd->coords[i + 1] == 0) && (newcmd->coords[i + 2] == GRX_SCALE) && (newcmd->coords[i + 3] == GRX_SCALE)) { /* drop previous commands */ oldcmd = grwin->graphics; while (oldcmd->next != NULL) { grcmd_t *tmp = oldcmd; oldcmd = oldcmd->next; free (tmp); } grwin->graphics = NULL; } } } /* insert new command into command list */ oldcmd = grwin->graphics; if (oldcmd == NULL) grwin->graphics = newcmd; else { while (oldcmd->next != NULL) oldcmd = oldcmd->next; oldcmd->next = newcmd; } Gr_Dispatch (grwin, newcmd); } /*}}} */ /*{{{ Gr_scroll() */ void Gr_scroll (int count) { static short prev_start = 0; grwin_t *grwin, *next; if ((count == 0) && (prev_start == TermWin.view_start)) return; prev_start = TermWin.view_start; for (grwin = gr_root; grwin != NULL; grwin = next) { next = grwin->next; grwin->y -= (count * TermWin.fheight); if ((grwin->y + grwin->h) < -(TermWin.saveLines * TermWin.fheight)) Gr_DestroyWindow (grwin); else XMoveWindow (Xdisplay, grwin->win, grwin->x, grwin->y + (TermWin.view_start * TermWin.fheight)); } } /*}}} */ /*{{{ Gr_ClearScreen() */ void Gr_ClearScreen (void) { grwin_t *grwin, *next; for (grwin = gr_root; grwin != NULL; grwin = next) { next = grwin->next; if ((grwin->screen == 0) && (grwin->y + grwin->h > 0)) { if (grwin->y >= 0) Gr_DestroyWindow (grwin); else XResizeWindow (Xdisplay, grwin->win, grwin->w, -grwin->y); } } } /*}}} */ /*{{{ Gr_ChangeScreen() */ void Gr_ChangeScreen (void) { grwin_t *grwin, *next; for (grwin = gr_root; grwin != NULL; grwin = next) { next = grwin->next; if (grwin->y + grwin->h > 0) { if (grwin->screen == 1) { XMapWindow (Xdisplay, grwin->win); grwin->screen = 0; } else { XUnmapWindow (Xdisplay, grwin->win); grwin->screen = 1; } } } } /*}}} */ /*{{{ Gr_expose() */ void Gr_expose (Window win) { grwin_t *grwin; for (grwin = gr_root; grwin != NULL; grwin = grwin->next) { if (grwin->win == win) { Gr_Redraw (grwin); break; } } } /*}}} */ /*{{{ Gr_Resize() */ void Gr_Resize (int w, int h) { grwin_t *grwin; for (grwin = gr_root; grwin != NULL; grwin = grwin->next) { if (TermWin.height != h) { grwin->y += (TermWin.height - h); XMoveWindow (Xdisplay, grwin->win, grwin->x, grwin->y + (TermWin.view_start * TermWin.fheight)); } Gr_Redraw (grwin); } } /*}}} */ /*{{{ Gr_reset() */ void Gr_reset (void) { grwin_t *grwin, *next; for (grwin = gr_root; grwin != NULL; grwin = next) { next = grwin->next; Gr_DestroyWindow (grwin); } graphics_up = 0; } /*}}} */ /*{{{ Gr_Displayed() */ int Gr_Displayed (void) { return graphics_up; } /*}}} */ #endif /* RXVT_GRAPHICS */ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/feature.h0000644000175000017500000003206311375434150014750 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: feature.h * * Compile-time configuration. * Additional compile-time configuration in "defaults.h" * ---------------------------------------------------------------------- * Copyright 1995,1996 * mj olesen Queen's Univ at Kingston * * You can do what you like with this source code provided you don't make * money from it and you include an unaltered copy of this message * (including the copyright). As usual, the author accepts no * responsibility for anything, nor does he guarantee anything whatsoever. *----------------------------------------------------------------------*/ #ifndef _FEATURE_H #define _FEATURE_H /*{{{ system hacks: */ /*----------------------------------------------------------------------*/ /* Consistent defines - please report on the necessity * @ Unixware: defines (__svr4__) */ #if defined (SVR4) && !defined (__svr4__) #define __svr4__ #endif #if defined (sun) && !defined (__sun__) #define __sun__ #endif /* * sun isn't properly protected? * anyway, it causes problems when is also included */ #if defined (__sun__) #undef HAVE_SYS_IOCTL_H #endif /*}}} */ /*{{{ debugging: */ /*----------------------------------------------------------------------* * #define NDEBUG * to disable whichever assert() macros are used in the code * * #define DEBUG_SCREEN * to do self-check for internal screen corruption * * #define DEBUG_MALLOC * to do self-check on out-of-bound memory usage * * #define DEBUG_CMD * to output some data structures of command.c * (key-buffer contents, command line, tty permissions) * * #define DEBUG_TTY * to output tty settings * * #define DEBUG_COLORS * to print out current color/renditions as they change * * #define DEBUG_SELECTION * to use XK_Print to dump information about the current selection * * #define DEBUG_DEPTH 1 * to set the X color depth, for debugging lower depth modes *----------------------------------------------------------------------*/ /* #define NDEBUG */ #ifndef NDEBUG /* # define DEBUG_SCREEN */ /* # define DEBUG_MALLOC */ /* # define DEBUG_CMD */ /* # define DEBUG_TTY */ /* # define DEBUG_COLORS */ /* # define DEBUG_SELECTION */ /* # define DEBUG_DEPTH 1 */ #endif /*}}} */ /*{{{ screen/colors: */ /*----------------------------------------------------------------------* * #define XPM_BACKGROUND * to add sexy-looking background pixmaps. Needs libxpm * * #define XPM_SCALING * to allow pixmaps to be dynamically scaled * * #define PATH_ENV "XITERM_PATH" * to define the name of the environment variable to be used in * addition to the "PATH" environment and the `path' resource * * #define XPM_BUFFERING * to use xpm buffers for the screen update * (bigger & faster? ... but does it work correctly?) * * #define NO_CURSORCOLOR * to avoid enabling a color cursor (-cr, cursorColor, cursorColor2) * * #define NO_BRIGHTCOLOR * to suppress use of BOLD and BLINK attributes for setting * bright foreground and background, respectively. * Simulate BOLD using colorBD, boldFont or overstrike characters. * * #define NO_BOLDUNDERLINE * to disable separate colors for bold/underline * * #define NO_BOLDOVERSTRIKE * to disable using simulated bold using overstrike * * #define NO_BOLDFONT * to compile without support for real bold fonts * * #define NO_SECONDARY_SCREEN * to disable the secondary screen ("\E[?47h" / "\E[?47l") * * #define REFRESH_PERIOD * to limit the number of screenfulls between screen refreshes * during hard & fast scrolling [default: 1] * * #define USE_XCOPYAREA * to use XCopyArea (in place of re-draws) to speed up xiterm. * - I've been told this helps with some graphics adapters like the * PC's et4000. OK, it's good on monochrome Sun-3's that I've tried * too. /RN * - sometimes looks worse and slower /mjo * * #define PRINTPIPE "lpr" * to define a printer pipe which will be used for emulation of an * attached vt100 printer * * #define OLD_COLOR_MODEL * to use the old color model whereby erasing is done with the * default rendition rather than the current rendition * NB: this make break some applications and should used with caution *----------------------------------------------------------------------*/ #define XPM_BACKGROUND #define XPM_SCALING #define PATH_ENV "PATH" #define XPM_BUFFERING /* #define NO_CURSORCOLOR */ /* #define NO_BRIGHTCOLOR */ /* #define NO_BOLDUNDERLINE */ #define NO_BOLDOVERSTRIKE /* #define NO_BOLDFONT */ /* #define NO_SECONDARY_SCREEN */ /* #define REFRESH_PERIOD 1 */ /* #define USE_XCOPYAREA */ /* #define PRINTPIPE "lpr" */ /* #define OLD_COLOR_MODEL */ /*}}} */ /*{{{ resources: */ /*----------------------------------------------------------------------* * #define NO_RESOURCES * to blow off the Xdefaults altogether * * #define USE_XGETDEFAULT * to use XGetDefault() instead of the default, which is to use a * substitute for using XGetDefaults() that saves 60-150kB memory * * The default is best if all you want to do is put xiterm defaults * in ~/.Xdefaults file, * * #define XAPPLOADDIR "/usr/lib/X11/app-defaults" * to define where to find installed application defaults for xiterm * Only if USE_XGETDEFAULT is not defined. * * #define OFFIX_DND * to add support for the Offix DND (Drag 'n' Drop) protocol * * #define STATIC_TITLE * to avoid having the title set from program name * Overridden by xdefaults. *----------------------------------------------------------------------*/ /* #define NO_RESOURCES */ #define USE_XGETDEFAULT #ifndef XAPPLOADDIR #define XAPPLOADDIR "/etc/X11/app-defaults" #endif /* #define OFFIX_DND */ #define STATIC_TITLE /*}}} */ /*{{{ keys: */ /*----------------------------------------------------------------------* * #define NO_DELETE_KEY * to use the unadulterated X server value for the Delete key * * #define DONT_GUESS_BACKSPACE * to use ^H for the Backspace key and avoid using the current stty * setting of erase to guess a Backspace value of either ^H or ^? * * #define HOTKEY_CTRL * #define HOTKEY_META * choose one of these values to be the `hotkey' for changing font. * -- obsolete * * #define LINUX_KEYS * to use * Home = "\E[1~", End = "\E[4~" * instead of * Home = "\E[7~", End = "\E[8~" [default] * * #define KEYSYM_RESOURCE * to enable the keysym resource which allows you to define * strings associated with various KeySyms (0xFF00 - 0xFFFF). * Only works with the default hand-rolled resources. * * #define NO_XLOCALE * to disable X11R6 support for European languages * - possibly still beta *----------------------------------------------------------------------*/ #if defined (__sun__) || defined (__svr4__) #define NO_DELETE_KEY /* favoured settings for these systems */ #endif /* #define NO_DELETE_KEY */ /* #define DONT_GUESS_BACKSPACE */ /* #define HOTKEY_CTRL */ /* #define HOTKEY_META */ #define LINUX_KEYS #define KEYSYM_RESOURCE /* #define NO_XLOCALE */ /*}}} */ /*{{{ mouse/selection: */ /*----------------------------------------------------------------------* * #define NO_SCROLLBAR_REPORT * to disable sending escape sequences (up, down, page up/down) * from the scrollbar when XTerm mouse reporting is enabled * * #define CUTCHAR_RESOURCE * to add run-time support for changing the default cutchars * for double click selection * * #define MOUSE_REPORT_DOUBLECLICK * to have mouse reporting include double-click info for button1 * * #define MULTICLICK_TIME * to set delay between multiple click events [default: 500] *----------------------------------------------------------------------*/ /* #define NO_SCROLLBAR_REPORT */ /* #define CUTCHAR_RESOURCE */ /* #define MOUSE_REPORT_DOUBLECLICK */ /* #define MULTICLICK_TIME 500 */ /*}}} */ /*{{{ bell: */ /*----------------------------------------------------------------------* * #define NO_MAPALERT * to disable automatic de-iconify when a bell is received * * #define MAPALERT_OPTION * to have mapAlert behaviour selectable with mapAlert resource *----------------------------------------------------------------------*/ /* #define NO_MAPALERT */ /* #define MAPALERT_OPTION */ /*}}} */ /*{{{ scrollbar: */ /*----------------------------------------------------------------------* * #define XTERM_SCROLLBAR * to only use the XTerm-style scrollbar - no arrows, bitmapped * instead of the regular scrollbar (with arrows) * * ---------------------------------------------------------------------* * #define SCROLLBAR_RIGHT * to have the scrollbar on the right-hand side * * #define SB_WIDTH * to choose the scrollbar width - should be an even number [default: 10] * for XTERM_SCROLLBAR it is *always* 14. *----------------------------------------------------------------------*/ /* #define XTERM_SCROLLBAR */ #define SCROLLBAR_RIGHT #define SB_WIDTH 10 /*}}} */ /*{{{ multi-lingual: */ /*----------------------------------------------------------------------* * #define META8_OPTION * to allow run-time selection of Meta (Alt) to set the 8th bit on * * #define GREEK_SUPPORT * to include support for the Greek Elot-928 & IBM-437 keyboard * see doc/README.greek * * #define KANJI * to compile with Kanji support * after compilation, rename executable as `kxvt' *----------------------------------------------------------------------*/ /* #define META8_OPTION */ /* #define GREEK_SUPPORT */ /* #define KANJI */ #define THAI /*}}} */ /*{{{ misc: */ /*----------------------------------------------------------------------* * #define DISPLAY_IS_IP * to have DISPLAY environment variable and "\E[7n" transmit * display with an IP number * * #define ENABLE_DISPLAY_ANSWER * to have "\E[7n" transmit the display name. * This has been cited as a potential security hole. * * #define ESCZ_ANSWER "\033[?1;2C" * to change what ESC Z transmits instead of the default "\E[?1;2c" * * #define SMART_WINDOW_TITLE * to check the current value of the window-time/icon-name and * avoid re-setting it to the same value -- avoids unnecessary window * refreshes * * #define XTERM_COLOR_CHANGE * to allow foreground/background color to be changed with an * xterm escape sequence "\E]39;color^G" -- still experimental * * #define DEFINE_XTERM_COLOR * to define TERM="xterm-color" instead of just TERM="xterm", which * is a useful addition to COLORTERM for distinguishing color * characteristics since it will be exported across rlogin/rsh *----------------------------------------------------------------------*/ /* #define DISPLAY_IS_IP */ /* #define ENABLE_DISPLAY_ANSWER */ /* #define ESCZ_ANSWER "\033[?1;2C" */ #define SMART_WINDOW_TITLE #define XTERM_COLOR_CHANGE #define DEFINE_XTERM_COLOR /*}}} */ /*{{{ utmp: */ /*----------------------------------------------------------------------* * #define UTMP_SUPPORT * for utmp support to update `/etc/utmp' to show xiterm logins * * For this to work, * - make xiterm setuid root, a potential security hole but is * reportedly okay - do at your own risk * su * chown root.root xiterm * chmod a+s xiterm * - make xiterm setuid/setgid to match user/group that owns `/etc/utmp' * * #define UTMP_FILENAME "/var/adm/utmp" (Irix, dec alpha) * #define UTMP_FILENAME "/var/run/utmp" (FreeBSD, NetBSD 0.9) * to define where the utmp file is located if it isn't /etc/utmp * and isn't defined by one of the myriad names in utmp.c * * #define TTYTAB_FILENAME "/etc/ttys" (FreeBSD, NetBSD 0.9) * for BSD-type systems, to define where the tty table is located * if it isn't /etc/ttytab *----------------------------------------------------------------------*/ #define UTMP_SUPPORT #ifdef UTMP_SUPPORT #ifndef UTMP_FILENAME /* # define UTMP_FILENAME "/var/adm/utmp" */ /* # define UTMP_FILENAME "/var/adm/utmp" */ #endif #ifndef TTYTAB_FILENAME /* # define TTYTAB_FILENAME "/etc/ttys" */ #endif #endif /*}}} */ /*{{{ sort out conflicts */ /*----------------------------------------------------------------------* * end of user configuration section *----------------------------------------------------------------------*/ #ifdef KANJI #undef GREEK_SUPPORT /* Kanji/Greek together is too weird */ #undef XTERM_FONT_CHANGE /* can't ensure font sizes will match */ #endif #ifdef XPM_BUFFERING #ifndef XPM_SCALING #define XPM_SCALING #endif #endif /* Define if you have the Xpm library (-lXpm). */ #ifndef HAVE_LIBXPM #undef XPM_BACKGROUND #endif /* disable what can't be used */ #ifndef XPM_BACKGROUND #undef XPM_BUFFERING #undef XPM_SCALING #undef XTERM_PIXMAP_CHANGE #endif #define APL_CLASS "XTerm" /* class name */ #define APL_SUBCLASS "XiTerm" /* also check resources under this name */ #define APL_NAME "xiterm+thai" /* normal name */ /* COLORTERM, TERM environment variables */ #define COLORTERMENV "xiterm" #ifdef KANJI #define TERMENV "kterm" #else #define TERMENV "xterm" #endif #ifdef NO_MOUSE_REPORT #ifndef NO_MOUSE_REPORT_SCROLLBAR #define NO_MOUSE_REPORT_SCROLLBAR #endif #endif #if defined (NO_RESOURCES) || defined (USE_XGETDEFAULT) #undef KEYSYM_RESOURCE #endif #ifdef NO_RESOURCES #undef USE_XGETDEFAULT #endif /*}}} */ #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/Makefile.in0000644000175000017500000000571211375434150015212 0ustar thepthep# src/Makefile.in -*- Makefile -*- @MCOMMON@ basedir = $(srcdir)/.. thisdir = src first_rule: all dummy: SRCS = command.c debug.c graphics.c grkelot.c main.c misc.c\ netdisp.c screen.c scrollbar.c utmp.c xdefaults.c\ thai.c thaikb.c OBJS = command.o debug.o graphics.o grkelot.o main.o misc.o\ netdisp.o screen.o scrollbar.o utmp.o xdefaults.o\ thai.o thaikb.o HDRS = command.h debug.h defaults.h feature.h graphics.h grkelot.h\ main.h misc.h screen.h scrollbar.h xdefaults.h thaikb.h # # Distribution variables # DIST = $(HDRS) $(SRCS) Makefile.in gcc-Wall # inference rules .c.o: $(CC) -c $(CPPFLAGS) $(XINC) -I$(basedir) $(CFLAGS) $< #------------------------------------------------------------------------- all: xiterm+thai xiterm+thai: VERSION.h $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(XLIB) VERSION.h: echo "#define VERSION \""$(VERSION)"\"" > $@; tags: $(SRCS) ctags $(SRCS) allbin: xiterm+thai alldoc: clean: $(RMF) xiterm+thai core a.out *.o *.bak *~ realclean: clean $(RMF) VERSION.h tags mrproper: (cd $(srcdir) && $(RMF) xiterm+thai *~ *.o core a.out) if test $(srcdir) = .; then $(MAKE) realclean; fi (cd $(srcdir) && $(RMF) Makefile) install: allbin alldoc $(INSTALL_PROGRAM) xiterm+thai $(DESTDIR)$(bindir)/$(binprefix)xiterm+thai uninstall: (cd $(bindir) && $(RMF) $(binprefix)xiterm+thai) # Semi-automatic generation of dependencies: # Use gcc -MM because X11 `makedepend' doesn't work on all systems # and it also includes system headers. # `semi'-automatic since dependencies are generated at distribution time. distdepend: mv Makefile.in Makefile.in~ sed "/^# DO NOT DELETE:/,$$ d" Makefile.in~ > Makefile.in echo "# DO NOT DELETE: ugly dependency list follows" >> Makefile.in gcc -MM $(CPPFLAGS) $(XINC) -I$(basedir) $(SRCS) >> Makefile.in # ----------------------------------------------------------------------- # DO NOT DELETE: ugly dependency list follows command.o: command.c main.h VERSION.h ../config.h feature.h misc.h \ xdefaults.h command.h debug.h graphics.h grkelot.h thaikb.h scrollbar.h \ screen.h defaults.h debug.o: debug.c ../config.h feature.h debug.h graphics.o: graphics.c main.h VERSION.h ../config.h feature.h misc.h \ command.h debug.h graphics.h screen.h grkelot.o: grkelot.c ../config.h feature.h grkelot.h main.o: main.c main.h VERSION.h ../config.h feature.h misc.h command.h \ debug.h graphics.h scrollbar.h screen.h xdefaults.h defaults.h misc.o: misc.c main.h VERSION.h ../config.h feature.h misc.h netdisp.o: netdisp.c ../config.h feature.h screen.o: screen.c main.h VERSION.h ../config.h feature.h misc.h \ command.h debug.h graphics.h screen.h thai.h scrollbar.o: scrollbar.c main.h VERSION.h ../config.h feature.h misc.h \ scrollbar.h utmp.o: utmp.c ../config.h feature.h misc.h xdefaults.o: xdefaults.c main.h VERSION.h ../config.h feature.h misc.h \ debug.h defaults.h grkelot.h thaikb.h xdefaults.h thai.o: thai.c main.h VERSION.h ../config.h feature.h misc.h thai.h thaikb.o: thaikb.c thaikb.h xiterm+thai-1.10/src/grkelot.h0000644000175000017500000000230511375434150014760 0ustar thepthep/* * File: grkelot.h * * Synopsis: string -> greek ELOT928 string; 4-state FSM. * * Copyright (c) 1994 Angelo Haritsis. All rights reserved. * * Redistribution and use in source and binary forms are permitted provided * that the above copyright notice and this paragraph are duplicated in all * such forms and that any documentation, advertising materials, and other * materials related to such distribution and use acknowledge that the * software was developed by Angelo Haritsis. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * $Header: /home/cvs/software/xiterm+thai/src/grkelot.h,v 1.1.1.1 2001-03-14 12:12:36 thep Exp $ */ #ifndef _GRKELOT_H #define _GRKELOT_H #define GREEK_ELOT928 0 #define GREEK_IBM437 1 #ifdef __cplusplus extern "C" { #endif extern void greek_init (void); extern void greek_end (void); extern void greek_reset (void); extern void greek_setmode (int greek_mode); extern int greek_getmode (void); extern int greek_xlat (char *s, int num_chars); #ifdef __cplusplus } #endif #endif /* _GRKELOT_H */ xiterm+thai-1.10/src/thaikb.h0000644000175000017500000000077511375434150014564 0ustar thepthep/* * thaikb.h - Thai keyboard maps * Created: 22 Jul 1999 (split from command.c) * Author: Theppitak Karoonboonyanan */ #ifndef _THAIKB_H #define _THAIKB_H #include #define THAI_KB_KETMANEE 0 #define THAI_KB_TIS820_2538 1 _XFUNCPROTOBEGIN extern void thai_set_keyboard(int thai_kbmode); extern char thai_map_qwerty(unsigned char c); _XFUNCPROTOEND #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/command.h0000644000175000017500000000272011375434150014730 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: command.h * * Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as you don't try * to make money out of it and you include an unaltered copy of this * message (including the copyright). * * This module has been heavily modified by R. Nation * * No additional restrictions are applied. * * Additional modifications by mj olesen * No additional restrictions are applied. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ #ifndef _COMMAND_H #define _COMMAND_H #include #include #define scrollBar_esc 30 _XFUNCPROTOBEGIN extern void init_command (char * /* argv */ []); extern void tt_resize (void); extern void tt_write (const unsigned char * /* str */ , unsigned int /* count */ ); extern void tt_printf (const char * /* fmt */ ,...); extern unsigned int cmd_write (const unsigned char * /* str */ , unsigned int /* count */ ); extern void main_loop (void); extern FILE * popen_printer (void); extern int pclose_printer (FILE * /* stream */ ); _XFUNCPROTOEND #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/gcc-Wall0000755000175000017500000000134311375434150014520 0ustar thepthep#!/bin/sh # gcc -Wall plus other important warnings not included in -Wall for arg do case $arg in -O*) Wuninitialized=-Wuninitialized;; # only makes sense with `-O' esac done exec gcc \ -Wall $Wuninitialized \ -Wwrite-strings \ -Wcast-qual \ -Wbad-function-cast \ -Wpointer-arith \ -Wstrict-prototypes \ -Wmissing-prototypes \ -Wmissing-declarations \ -Wnested-externs \ -Wtraditional \ -Wconversion \ -Wcomment \ -Wcast-align \ -Winline \ -Wshadow \ -Wredundant-decls \ -Wid-clash-31 \ "$@" # -Wall implies: # -Wimplicit # -Wreturn-type # -Wunused # -Wswitch # -Wformat # -Wchar-subscripts # -Wparentheses # -Wmissing-braces ------------------------------------------------------------------------------ xiterm+thai-1.10/src/grkelot.c0000644000175000017500000002716611375434150014767 0ustar thepthep/* * File: grkelot.c * * Synopsis: string -> greek ELOT928 or IBM437 string; * 4-state FSM implementation. * * System: Any (ANSI C) * * This is code derived from a more generic key remapper written by the same * author and used in other environments. It was not written only * for greek kbd bindings. An extension to other languages is easy * (well don't know how the FSM lends itself to Far East languages). * * The FSM can have MAX_STATES states (change it for more). * Each state contains: * 1. many tranlsation tables (registered via kstate_add_xlat()) * 2. many switch codes for transition to other states (registered via * kstate_add_switcher()) : limit is static now: MAX_SWITCHER * 3. life: the number of xlations allowed in a state (0 = unlimited) * * Format of tranlation strings: * -:n1,n2,n3,... * Format of switcher string: * A: * (other switchers apart from A=ascii can be supported; not in this context) * Format of life string: * L (N=0,1,...) * * Copyright (c) 1994,1995 Angelo Haritsis. All rights reserved. * * Redistribution and use in source and binary forms are permitted provided * that the above copyright notice and this paragraph are duplicated in all * such forms and that any documentation, advertising materials, and other * materials related to such distribution and use acknowledge that the * software was developed by Angelo Haritsis. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * $Id: grkelot.c,v 1.1.1.1 2001-03-14 12:12:36 thep Exp $ * * NB: DO NOT ALTER! THIS CODE IS USED IN MANY PLATFORMS!!! * * TODO: make it more dynamic (linked lists is an idea but slower) */ #define XITERM /* define for use by xiterm */ #ifdef XITERM #include "config.h" #include "feature.h" #include "grkelot.h" #endif /* XITERM */ #ifdef GREEK_SUPPORT #include "grkelot.h" #include #include /* --- Macros, Types --------- */ #define MAX_STATES 4 /* max # states for the FSM */ #define MAX_SWITCHER 2U /* per state */ #define MAX_VAL 256 /* for temp allocation */ typedef unsigned char u_char; typedef unsigned int u_int; typedef unsigned long u_long; typedef struct s_xlat { u_int first, last; u_int *pval; /* array of translated values */ } K_XLAT; typedef struct s_switch { u_char type; /* Ascii, Virtual, Scan */ u_int code; u_char nextstate; u_char on; /* current state of key: 0 = off */ } K_SWITCH; typedef struct s_state { u_int num_xlat; /* number of translations */ K_XLAT *xlat; /* State translations ((dynamic - realloc'ed) */ u_int num_switcher; /* number of switcher keys */ K_SWITCH switcher[MAX_SWITCHER]; /* switcher keys to other states */ u_char life; /* 0 = until switched by key */ u_char prev_state; /* filled when jumped to a new state */ } K_STATE; /* type for each one of the different greek standards (xlat types) */ typedef struct s_xlat_type { char *plain; char *accent; char *accent_xtra; char *umlaut; char *acc_uml; } XLAT_TYPE; /* --- Local Data ------------ */ static K_STATE State[MAX_STATES]; /* Current State */ static u_char nStateNow = 0; static K_STATE *pStateNow = &State[0]; static int GreekMode = GREEK_ELOT928; /* * The following are hard-coded for now. The idea is that such strings would * be read from a config file making it possible to change language/encodings * more flexibly. */ /* elot 928 xlations */ static char elot_xlat_plain[] = "65-122:193,194,216,196,197,214,195,199,201,206,202,203,204,205,207,208,81,209,211,212,200,217,87,215,213,198,91,92,93,94,95,96,225,226,248,228,229,246,227,231,233,238,234,235,236,237,239,240,113,241,243,244,232,249,242,247,245,230"; /* c and s give copyright and section sign */ static char elot_xlat_acc[] = "65-122:182,194,216,196,184,214,195,185,186,206,202,203,204,205,188,208,81,209,211,212,200,191,87,215,190,198,91,92,93,94,95,96,220,226," /*248 */ "169,228,221,246,227,222,223,238,234,235,236,237,252,240,113,241," /*243 */ "167,244,232,254,242,247,253,230"; static char elot_xlat_acc_xtra[] = "46-62:183,47,48,49,50,51,52,53,54,55,56,57,58,59,171,61,187"; /* anw teleia, quotes */ static char elot_xlat_uml[] = "65-122:193,194,216,196,197,214,195,199,218,206,202,203,204,205,207,208,81,209,211,212,200,217,87,215,219,198,91,92,93,94,95,96,225,226,248,228,229,246,227,231,250,238,234,235,236,237,239,240,113,241,243,244,232,249,242,247,251,230"; static char elot_xlat_umacc[] = "65-122:193,194,216,196,197,214,195,199,201,206,202,203,204,205,207,208,81,209,211,212,200,217,87,215,213,198,91,92,93,94,95,96,225,226,248,228,229,246,227,231,192,238,234,235,236,237,239,240,113,241,243,244,232,249,242,247,224,230"; /* ibm 437 xlations */ static char i437_xlat_plain[] = "65-122:128,129,150,131,132,148,130,134,136,141,137,138,139,140,142,143,81,144,145,146,135,151,87,149,147,133,91,92,93,94,95,96,152,153,175,155,156,173,154,158,160,165,161,162,163,164,166,167,113,168,169,171,159,224,170,174,172,157"; static char i437_xlat_acc[] = "65-122:234,129,150,131,235,148,130,236,237,141,137,138,139,140,238,143,81,144,145,146,135,240,87,149,239,133,91,92,93,94,95,96,225,153,175,155,226,173,154,227,229,165,161,162,163,164,230,167,113,168,169,171,159,233,170,174,231,157"; static char i437_xlat_acc_xtra[] = "46-46:250"; /* anw teleia */ static char i437_xlat_uml[] = "65-122:128,129,150,131,132,148,130,134,136,141,137,138,139,140,142,143,81,144,145,146,135,151,87,149,147,133,91,92,93,94,95,96,152,153,175,155,156,173,154,158,228,165,161,162,163,164,166,167,113,168,169,171,159,224,170,174,232,157"; static char i437_xlat_umacc[] = "65-122:128,129,150,131,132,148,130,134,136,141,137,138,139,140,142,143,81,144,145,146,135,151,87,149,147,133,91,92,93,94,95,96,152,153,175,155,156,173,154,158,42,165,161,162,163,164,166,167,113,168,169,171,159,224,170,174,42,157"; /* * currently ELOT928 and IBM437 are supported; easy to include others * (not recommended: stick to just these 2 if not only the ELOT one) */ static XLAT_TYPE xlat_type[] = { {elot_xlat_plain, elot_xlat_acc, elot_xlat_acc_xtra, elot_xlat_uml, elot_xlat_umacc}, {i437_xlat_plain, i437_xlat_acc, i437_xlat_acc_xtra, i437_xlat_uml, i437_xlat_umacc}, }; /* the current trasnaltion type */ static XLAT_TYPE *xlat_now = &xlat_type[GREEK_ELOT928]; #define NUM_XLAT_TYPES (sizeof(xlat_type) / sizeof(xlat_type[0])) static void kstate_add_xlat (char *str); static void kstate_add_switcher (char *str); static void kstate_set_life (char *str); /* --- Functions ------------- */ static void kstate_setcurr (int stateno) { u_char prev_state; if ((u_int) stateno > (u_int) MAX_STATES) return; if (pStateNow->life == 1) prev_state = pStateNow->prev_state; else prev_state = nStateNow; pStateNow = &State[nStateNow = stateno]; pStateNow->prev_state = prev_state; } static void kstate_init (void) { pStateNow->num_xlat = pStateNow->num_switcher = pStateNow->life = pStateNow->prev_state = 0; pStateNow->xlat = NULL; } static void kstate_end (void) { int i; for (i = 0; i < pStateNow->num_xlat; i++) free (pStateNow->xlat[i].pval); if (pStateNow->num_xlat > 0) free (pStateNow->xlat); } /* * Hard coded ELOT-928 translations. Could read these from an rc-type file * to support other remappers. */ static void kstate_init_all (int greek_mode) { /* the translation tables for the 4 FSM states for ELOT-928 mappings */ int i; for (i = 0; i < MAX_STATES; i++) { kstate_setcurr (i); kstate_init (); } if (greek_mode < 0 || greek_mode >= NUM_XLAT_TYPES) /* avoid death */ greek_mode = GREEK_ELOT928; xlat_now = &xlat_type[greek_mode]; kstate_setcurr (0); kstate_add_xlat (xlat_now->plain); kstate_add_switcher ("A;:1"); kstate_add_switcher ("A::2"); kstate_set_life ("L0"); kstate_setcurr (1); kstate_add_xlat (xlat_now->accent); kstate_add_xlat (xlat_now->accent_xtra); kstate_add_switcher ("A::3"); kstate_set_life ("L1"); kstate_setcurr (2); kstate_add_xlat (xlat_now->umlaut); kstate_add_switcher ("A;:3"); kstate_set_life ("L1"); kstate_setcurr (3); kstate_add_xlat (xlat_now->acc_uml); kstate_set_life ("L1"); } static void kstate_end_all (void) { int i; for (i = 0; i < MAX_STATES; i++) { kstate_setcurr (i); kstate_end (); } kstate_setcurr (0); } /* * reset FSM */ static void kstate_reset (void) { kstate_setcurr (0); } static void kstate_add_xlat (char *str) { K_XLAT *xlat; u_int *pval_tmp; char *sval; int i; if (str == NULL) return; /* add a new xlat table in state */ if (pStateNow->num_xlat == 0) { pStateNow->xlat = malloc (sizeof (K_XLAT)); } else /* prefer contiguous data, realloc */ pStateNow->xlat = realloc (pStateNow->xlat, (pStateNow->num_xlat + 1) * sizeof (K_XLAT)); xlat = &pStateNow->xlat[pStateNow->num_xlat]; /* parse str and derive first, last, values */ xlat->first = (u_int) atoi (strtok (str, "-")); xlat->last = (u_int) atoi (strtok (NULL, ":")); i = 0; pval_tmp = calloc (MAX_VAL, sizeof (K_XLAT)); while ((sval = strtok (NULL, ",")) != NULL) pval_tmp[i++] = (u_int) (atoi (sval)); xlat->pval = calloc (i, sizeof (K_XLAT)); if (xlat->pval != NULL) memcpy (xlat->pval, pval_tmp, i * sizeof (u_int)); free (pval_tmp); pStateNow->num_xlat++; } /* * Ascii only for this implementation */ static void kstate_add_switcher (char *str) { K_SWITCH *switcher; if (str == NULL) return; if (pStateNow->num_switcher >= MAX_SWITCHER) return; switcher = &pStateNow->switcher[pStateNow->num_switcher]; switch (switcher->type = str[0]) { case 'A': /* ascii eg: A;:2 */ switcher->code = str[1]; switcher->nextstate = atoi (&str[3]); break; } switcher->on = 0; pStateNow->num_switcher++; } /* L1 or L0 */ static void kstate_set_life (char *str) { pStateNow->life = atoi (&str[1]); } static unsigned int kstate_cxlat (unsigned int c) { int i; /* check for ascii switcher */ for (i = 0; i < pStateNow->num_switcher; i++) if (pStateNow->switcher[i].type == 'A' && /* only ascii here */ c == pStateNow->switcher[i].code) { kstate_setcurr (pStateNow->switcher[i].nextstate); pStateNow->switcher[i].on = 1; return ((unsigned int) -1); } /* do translation */ for (i = 0; i < pStateNow->num_xlat; i++) if (c >= pStateNow->xlat[i].first && c <= pStateNow->xlat[i].last) { c = pStateNow->xlat[i].pval[c - pStateNow->xlat[i].first]; break; } /* switch back to previous state if life of current is 1 */ if (pStateNow->life == 1) kstate_setcurr (pStateNow->prev_state); return (c); } #ifdef XITERM void greek_init (void) { kstate_init_all (GreekMode); } void greek_end (void) { kstate_end_all (); } void greek_reset (void) { kstate_reset (); } void greek_setmode (int greek_mode) { GreekMode = greek_mode; } int greek_getmode (void) { return (GreekMode); } /* * xlate a given string in-place - return new string length */ int greek_xlat (char *s, int num_chars) { int i, count; unsigned int c; for (i = 0, count = 0; i < num_chars; i++) { c = kstate_cxlat ((unsigned int) s[i]); if (c != -1) s[count++] = (char) c; } s[count] = '\0'; return (count); } #ifdef TEST int main (void) { /*char text[] = "abcdef;aGDZXC"; */ char text[] = "abcdef;a:ibgdezhuiklmnjoprstyfxcv"; kstate_init_all (GREEK_ELOT928); printf ("text: %s\n", text); greek_xlat (text, strlen (text)); printf ("xlat'ed text: %s\n", text); kstate_end_all (); return 0; } #endif #endif /* XITERM */ #endif /* GREEK_SUPPORT */ xiterm+thai-1.10/src/debug.h0000644000175000017500000000424611375434150014405 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: debug.h * * This module is all original work by Robert Nation * * * Copyright 1994, Robert Nation, no rights reserved. * * You can do what you like with this source code provided you don't make * money from it and you include an unaltered copy of this message * (including the copyright). As usual, the author accepts no * responsibility for anything, nor does he guarantee anything whatsoever. * * Modified by mj olesen * No additional restrictions. * * Modifications by Raul Garcia Garcia *----------------------------------------------------------------------*/ #ifndef _DEBUG_H #define _DEBUG_H #include /*{{{ prototypes */ _XFUNCPROTOBEGIN extern void * safe_malloc (size_t /* size */ , const char * /* id */ ); extern void * safe_calloc (size_t /* count */ , size_t /* size */ , const char * /* id */ ); extern void * safe_realloc (void * /* mem */ , size_t /* size */ , const char * /* id */ ); extern void safe_free (void * /* mem */ , const char * /* id1 */ , const char * /* id2 */ ); extern void safe_mem_check (const char * /* id1 */ , const char * /* id2 */ ); extern void * my_malloc (size_t /* size */ ); extern void * my_calloc (size_t /* count */ , size_t /* size */ ); extern void * my_realloc (void * /* mem */ , size_t /* size */ ); extern void my_free (void * /* mem */ ); _XFUNCPROTOEND /*}}} */ /*{{{ macros */ #ifdef DEBUG_MALLOC #define MALLOC(sz,id) safe_malloc ((sz),id) #define CALLOC(n,sz,id) safe_calloc ((n),(sz),id) #define REALLOC(mem,sz,id) safe_realloc ((mem),(sz),id) #define FREE(mem,id,fn) safe_free ((mem),id,fn) #define MEM_CHECK(id1,id2) safe_mem_check (id1,id2) #else #define MALLOC(sz,id) my_malloc (sz) #define CALLOC(n,sz,id) my_calloc ((n),(sz)) #define REALLOC(mem,sz,id) my_realloc ((mem),(sz)) #define FREE(ptr,id,fn) my_free (ptr) #define MEM_CHECK(id1,id2) ((void)0) #endif /*}}} */ #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/misc.h0000644000175000017500000000240511375434150014245 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: misc.h * * miscellaneous service routines * * Copyright 1996 * mj olesen Queen's Univ at Kingston * * You can do what you like with this source code provided you don't make * money from it and you include an unaltered copy of this message * (including the copyright). As usual, the author accepts no * responsibility for anything, nor does he guarantee anything whatsoever. *----------------------------------------------------------------------*/ /*{{{ includes */ #ifndef _MISC_H #define _MISC_H #include #include /*{{{ prototypes */ _XFUNCPROTOBEGIN extern const char * my_basename (const char *str); extern void print_error (const char *fmt,...); extern int escaped_string (char *str); extern void Draw_Shadow (Window /* win */ , GC /* topShadow */ , GC /* botShadow */ , int /* x */ , int /* y */ , int /* w */ , int /* h */ ); extern void Draw_Triangle (Window /* win */ , GC /* topShadow */ , GC /* botShadow */ , int /* x */ , int /* y */ , int /* w */ , int /* type */ ); _XFUNCPROTOEND /*}}} */ #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/command.c0000644000175000017500000022072011676745634014745 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: command.c */ /*{{{ notes: */ /*----------------------------------------------------------------------* * Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as * you don't try to make money out of it and you include an * unaltered copy of this message (including the copyright). * * This module has been very heavily modified by R. Nation * * No additional restrictions are applied * * Additional modification by Garrett D'Amore to * allow vt100 printing. No additional restrictions are applied. * * Integrated modifications by Steven Hirsch to * properly support X11 mouse report mode and support for DEC * "private mode" save/restore functions. * * Integrated key-related changes by Jakub Jelinek * to handle Shift+function keys properly. * Should be used with enclosed termcap / terminfo database. * * Extensive modifications by mj olesen * No additional restrictions. * * Further modification and cleanups for Solaris 2.x and Linux 1.2.x * by Raul Garcia Garcia . No additional restrictions. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ /*}}} */ /*{{{ includes: */ #include "main.h" #include "xdefaults.h" #include #ifdef OFFIX_DND #include #define DndFile 2 #define DndDir 5 #define DndLink 7 #endif #include #ifndef NO_XLOCALE #define X_LOCALE #include #endif /* NO_XLOCALE */ #include #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_SYS_IOCTL_H #include #endif #include /* #define USE_GETGRNAME */ /* * this seems like a bad way to go, since there's no guarantee that * /dev/tty belongs to the group "tty" and not "system" or "wheel" */ #ifdef USE_GETGRNAME #include #endif #ifdef TIME_WITH_SYS_TIME #include #include #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif #if defined (__svr4__) #include /* for struct rlimit */ #include /* for I_PUSH */ #define _NEW_TTY_CTRL /* to get proper defines in */ #endif #ifdef HAVE_SYS_SELECT_H #include #endif #ifdef HAVE_TERMIOS_H #include #else #include #endif #include #include #include "command.h" #include "debug.h" #include "graphics.h" #include "grkelot.h" #include "thaikb.h" #include "scrollbar.h" #include "screen.h" #include "defaults.h" /*}}} */ /* #define DEBUG_TTYMODE */ /* #define DEBUG_CMD */ /*{{{ terminal mode defines: */ /* use the fastest baud-rate */ #ifdef B38400 #define BAUDRATE B38400 #else #ifdef B19200 #define BAUDRATE B19200 #else #define BAUDRATE B9600 #endif #endif /* Disable special character functions */ #ifdef _POSIX_VDISABLE #define VDISABLE _POSIX_VDISABLE #else #define VDISABLE 255 #endif /*----------------------------------------------------------------------* * system default characters if defined and reasonable */ #ifndef CINTR #define CINTR '\003' /* ^C */ #endif #ifndef CQUIT #define CQUIT '\034' /* ^\ */ #endif #ifndef CERASE #define CERASE '\010' /* ^H */ #endif #ifndef CKILL #define CKILL '\025' /* ^U */ #endif #ifndef CEOF #define CEOF '\004' /* ^D */ #endif #ifndef CSTART #define CSTART '\021' /* ^Q */ #endif #ifndef CSTOP #define CSTOP '\023' /* ^S */ #endif #ifndef CSUSP #define CSUSP '\032' /* ^Z */ #endif #ifndef CDSUSP #define CDSUSP '\031' /* ^Y */ #endif #ifndef CRPRNT #define CRPRNT '\022' /* ^R */ #endif #ifndef CFLUSH #define CFLUSH '\017' /* ^O */ #endif #ifndef CWERASE #define CWERASE '\027' /* ^W */ #endif #ifndef CLNEXT #define CLNEXT '\026' /* ^V */ #endif #ifndef VDISCRD #ifdef VDISCARD #define VDISCRD VDISCARD #endif #endif #ifndef VWERSE #ifdef VWERASE #define VWERSE VWERASE #endif #endif /*}}} */ /*{{{ defines: */ #define KBUFSZ 8 /* size of keyboard mapping buffer */ #define STRING_MAX 512 /* max string size for process_xterm_seq() */ #define ESC_ARGS 32 /* max # of args for esc sequences */ /* a large REFRESH_PERIOD causes problems with `cat' */ #define REFRESH_PERIOD 1 #ifndef REFRESH_PERIOD #define REFRESH_PERIOD 10 #endif #ifndef MULTICLICK_TIME #define MULTICLICK_TIME 500 #endif /* time factor to slow down a `jumpy' mouse */ #define MOUSE_THRESHOLD 50 #define CONSOLE "/dev/console" /* console device */ /* * key-strings: if only these keys were standardized */ #ifdef LINUX_KEYS #define KS_HOME "\033[1~" /* Home == Find */ #define KS_END "\033[4~" /* End == Select */ #else #define KS_HOME "\033[7~" /* Home */ #define KS_END "\033[8~" /* End */ #endif /* and this one too! */ #ifdef NO_DELETE_KEY #undef KS_DELETE /* use X server definition */ #else #ifndef KS_DELETE #define KS_DELETE "\033[3~" /* Delete = Execute */ #endif #endif /* * ESC-Z processing: * * By stealing a sequence to which other xterms respond, and sending the * same number of characters, but having a distinguishable sequence, * we can avoid having a timeout (when not under an xiterm) for every login * shell to auto-set its DISPLAY. * * This particular sequence is even explicitly stated as obsolete since * about 1985, so only very old software is likely to be confused, a * confusion which can likely be remedied through termcap or TERM. Frankly, * I doubt anyone will even notice. We provide a #ifdef just in case they * don't care about auto-display setting. Just in case the ancient * software in question is broken enough to be case insensitive to the 'c' * character in the answerback string, we make the distinguishing * characteristic be capitalization of that character. The length of the * two strings should be the same so that identical read(2) calls may be * used. */ #define VT100_ANS "\033[?1;2c" /* vt100 answerback */ #ifndef ESCZ_ANSWER #define ESCZ_ANSWER VT100_ANS /* obsolete ANSI ESC[c */ #endif /*}}} */ /*{{{ extern functions referenced */ extern void cleanutent (void); extern void makeutent (const char *pty, const char *hostname); /*}}} */ /* extern variables referenced */ /* extern variables declared here */ /*{{{ local variables */ #ifdef THAI int thai_keyboard = 0; #if 0 /* Thai keymap in original code (commented out by Theppitak) */ /* Use thaikb.h instead -- 1999-07-22 */ static char thai_keymap[] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x008, 0x009, 0x00A, 0x00B, 0x00C, 0x00D, 0x00E, 0x00F, 0x010, 0x011, 0x012, 0x013, 0x014, 0x015, 0x016, 0x017, 0x018, 0x019, 0x01A, 0x01B, 0x01C, 0x01D, 0x01E, 0x01F, 0x020, 0x023, 0x02E, 0x0F2, 0x0F3, 0x0F4, 0x0DB, 0x0A7, 0x0F6, 0x0F7, 0x0F5, 0x0F9, 0x0C1, 0x0A2, 0x0E3, 0x0BD, 0x0A8, 0x0C5, 0x02F, 0x05F, 0x0C0, 0x0B6, 0x0D8, 0x0D6, 0x0A4, 0x0B5, 0x0AB, 0x0C7, 0x0B2, 0x0AA, 0x0CC, 0x0C6, 0x0F1, 0x0C4, 0x0DA, 0x0A9, 0x0AF, 0x0AE, 0x0E2, 0x0AC, 0x0E7, 0x0B3, 0x0EB, 0x0C9, 0x0C8, 0x0EE, 0x0EC, 0x0CF, 0x0AD, 0x0F0, 0x0B1, 0x0A6, 0x0B8, 0x0EA, 0x0CE, 0x022, 0x029, 0x0ED, 0x028, 0x0BA, 0x05C, 0x0C5, 0x0D9, 0x0F8, 0x060, 0x0BF, 0x0D4, 0x0E1, 0x0A1, 0x0D3, 0x0B4, 0x0E0, 0x0E9, 0x0C3, 0x0E8, 0x0D2, 0x0CA, 0x0B7, 0x0D7, 0x0B9, 0x0C2, 0x0E6, 0x0BE, 0x0CB, 0x0D0, 0x0D5, 0x0CD, 0x0E4, 0x0BB, 0x0D1, 0x0BC, 0x0B0, 0x07C, 0x02C, 0x025, 0x07F }; #endif #endif static char *ptydev = NULL, *ttydev = NULL; /* pty/tty name */ static int cmd_fd = -1; /* file descriptor connected to the command */ static pid_t cmd_pid = -1; /* process id if child */ static int Xfd = -1; /* file descriptor of X server connection */ static unsigned int num_fds = 0; /* number of file descriptors being used */ static struct stat ttyfd_stat; /* original status of the tty we will use */ #ifdef META8_OPTION static unsigned char meta_char = 033; /* Alt-key prefix */ #endif /* DEC private modes */ #define PrivMode_132 (1LU<<0) #define PrivMode_132OK (1LU<<1) #define PrivMode_rVideo (1LU<<2) #define PrivMode_relOrigin (1LU<<3) #define PrivMode_Screen (1LU<<4) #define PrivMode_Autowrap (1LU<<5) #define PrivMode_aplCUR (1LU<<6) #define PrivMode_aplKP (1LU<<7) #define PrivMode_BackSpace (1LU<<8) #define PrivMode_ShiftKeys (1LU<<9) #define PrivMode_VisibleCursor (1LU<<10) #define PrivMode_MouseX10 (1LU<<11) #define PrivMode_MouseX11 (1LU<<12) /* too annoying to implement X11 highlight tracking */ /* #define PrivMode_MouseX11Track (1LU<<13) */ #define PrivMode_scrollBar (1LU<<14) #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11) #define PrivMode(test,bit) do {\ if (test) PrivateModes |= (bit); else PrivateModes &= ~(bit);} while (0) #define PrivMode_Default \ (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) static unsigned long PrivateModes = PrivMode_Default; static unsigned long SavedModes = PrivMode_Default; #undef PrivMode_Default static int refresh_count = 0, refresh_limit = 1, refresh_type = SLOW_REFRESH; static Atom wmDeleteWindow; /* OffiX Dnd (drag 'n' drop) support */ #ifdef OFFIX_DND static Atom DndProtocol, DndSelection; #endif /* OFFIX_DND */ #ifndef NO_XLOCALE const char *rs_inputMethod = NULL; /* XtNinputMethod */ const char *rs_preeditType = NULL; /* XtNpreeditType */ static XIC Input_Context; /* input context */ static void stringConversionCallback( XIC ic, XPointer client_data, XPointer call_data ); static XICCallback String_Conv_Cb = { 0, (XICProc)&stringConversionCallback }; #endif /* NO_XLOCALE */ /* command input buffering */ #ifndef BUFSIZ #define BUFSIZ 4096 #endif static unsigned char cmdbuf_base[BUFSIZ], *cmdbuf_ptr, *cmdbuf_endp; /*}}} */ /*{{{ local functions referenced */ static void privileges (int mode); static RETSIGTYPE Child_signal (int); static RETSIGTYPE Exit_signal (int); static int get_pty (void); static int get_tty (void); static int run_command (char * /* argv */ []); static unsigned char cmd_getc (void); static void lookup_key (XEvent * /* ev */ ); static void process_x_event (XEvent * /* ev */ ); /*static void process_string (int); */ #ifdef PRINTPIPE static void process_print_pipe (void); #endif static void process_escape_seq (void); static void process_csi_seq (void); static void process_xterm_seq (void); static void process_terminal_mode (int /* mode */ , int /* priv */ , unsigned int /* nargs */ , int /* arg */ []); static void process_sgr_mode (unsigned int /* nargs */ , int /* arg */ []); static void tt_winsize (int /* fd */ ); #ifndef NO_XLOCALE static void init_xlocale (void); #else #define init_xlocale() ((void)0) #endif /* override gcc attribute __wur used in glibc */ static inline int nowarn_chown (const char *file, uid_t uid, gid_t gid) { return chown (file, uid, gid); } #define chown(file,uid,gid) (nowarn_chown((file),(uid),(gid))) static inline int nowarn_fchown (int fd, uid_t uid, gid_t gid) { return fchown (fd, uid, gid); } #define fchown(fd,uid,gid) (nowarn_fchown((fd),(uid),(gid))) /*----------------------------------------------------------------------*/ /*}}} */ /*{{{ substitute system functions */ #ifndef _POSIX_VERSION #if defined (__svr4__) static int getdtablesize (void) { struct rlimit rlim; getrlimit (RLIMIT_NOFILE, &rlim); return rlim.rlim_cur; } #endif #endif /*}}} */ /*{{{ take care of suid/sgid super-user (root) privileges */ static void privileges (int mode) { #ifdef HAVE_SETEUID static uid_t euid; static gid_t egid; switch (mode) { case IGNORE: /* * change effective uid/gid - not real uid/gid - so we can switch * back to root later, as required */ seteuid (getuid ()); setegid (getgid ()); break; case SAVE: euid = geteuid (); egid = getegid (); break; case RESTORE: seteuid (euid); setegid (egid); break; } #else switch (mode) { case IGNORE: setuid (getuid ()); setgid (getgid ()); break; case SAVE: break; case RESTORE: break; } #endif } /*}}} */ /*{{{ signal handling, exit handler */ /* * Catch a SIGCHLD signal and exit if the direct child has died */ static RETSIGTYPE Child_signal (int unused) { int pid, save_errno = errno; do { errno = 0; } while ((-1 == (pid = waitpid (cmd_pid, NULL, WNOHANG))) && (errno == EINTR)); if (pid == cmd_pid) exit (EXIT_SUCCESS); errno = save_errno; signal (SIGCHLD, Child_signal); } /* * Catch a fatal signal and tidy up before quitting */ static RETSIGTYPE Exit_signal (int sig) { #ifdef DEBUG_CMD print_error ("signal %d", sig); #endif signal (sig, SIG_DFL); privileges (RESTORE); cleanutent (); privileges (IGNORE); kill (getpid (), sig); } /* * Exit gracefully, clearing the utmp entry and restoring tty attributes */ static void clean_exit (void) { #ifdef DEBUG_CMD fprintf (stderr, "Restoring \"%s\" to mode %03o, uid %d, gid %d\n", ttydev, ttyfd_stat.st_mode, ttyfd_stat.st_uid, ttyfd_stat.st_gid); #endif privileges (RESTORE); chmod (ttydev, ttyfd_stat.st_mode); /* fail silently, e.g., when installed without sticky bit on */ (void) chown (ttydev, ttyfd_stat.st_uid, ttyfd_stat.st_gid); cleanutent (); privileges (IGNORE); } /*}}} */ /*{{{ Acquire a pseudo-teletype from the system. */ /* * On failure, returns -1. * On success, returns the file descriptor. * * If successful, ttydev and ptydev point to the names of the * master and slave parts */ static int get_pty (void) { int fd = -1; #if defined (__sgi) ptydev = ttydev = _getpty (&fd, O_RDWR | O_NDELAY, 0622, 0); if (ptydev == NULL) goto Failed; #elif defined (__svr4__) || defined (__linux__) { extern char *ptsname (); /* open the STREAMS, clone device /dev/ptmx (master pty) */ if ((fd = open ("/dev/ptmx", O_RDWR)) < 0) { goto Failed; } else { grantpt (fd); /* change slave permissions */ unlockpt (fd); /* unlock slave */ ptydev = ttydev = ptsname (fd); /* get slave's name */ } } #elif defined (_AIX) if ((fd = open ("/dev/ptc", O_RDWR)) < 0) goto Failed; else ptydev = ttydev = ttyname (fd); #else static char pty_name[] = "/dev/pty??"; static char tty_name[] = "/dev/tty??"; int len = strlen (tty_name); char *c1, *c2; ptydev = pty_name; ttydev = tty_name; #define PTYCHAR1 "pqrstuvwxyz" #define PTYCHAR2 "0123456789abcdef" for (c1 = PTYCHAR1; *c1; c1++) { ptydev[len - 2] = ttydev[len - 2] = *c1; for (c2 = PTYCHAR2; *c2; c2++) { ptydev[len - 1] = ttydev[len - 1] = *c2; if ((fd = open (ptydev, O_RDWR)) >= 0) { if (access (ttydev, R_OK | W_OK) == 0) goto Found; close (fd); } } } goto Failed; Found: #endif fcntl (fd, F_SETFL, O_NDELAY); return fd; Failed: print_error ("can't open pseudo-tty"); return -1; } /*}}} */ /*{{{ establish a controlling teletype for new session */ /* * On some systems this can be done with ioctl() but on others we * need to re-open the slave tty. */ static int get_tty (void) { int fd; pid_t pid; /* * setsid() [or setpgrp] must be before open of the terminal, * otherwise there is no controlling terminal (Solaris 2.4, HP-UX 9) */ #ifndef ultrix #ifdef NO_SETSID pid = setpgrp (0, 0); #else pid = setsid (); #endif if (pid < 0) perror (rs_name); #ifdef DEBUG_TTYMODE print_error ("(%s: line %d): PID = %d\n", __FILE__, __LINE__, pid); #endif #endif /* ultrix */ if ((fd = open (ttydev, O_RDWR)) < 0) { print_error ("can't open slave tty %s", ttydev); exit (EXIT_FAILURE); } #if defined (__svr4__) /* * Push STREAMS modules: * ptem: pseudo-terminal hardware emulation module. * ldterm: standard terminal line discipline. * ttcompat: V7, 4BSD and XENIX STREAMS compatibility module. */ ioctl (fd, I_PUSH, "ptem"); ioctl (fd, I_PUSH, "ldterm"); ioctl (fd, I_PUSH, "ttcompat"); #else /* __svr4__ */ { /* change ownership of tty to real uid and real group */ unsigned int mode = 0622; gid_t gid = getgid (); #ifdef USE_GETGRNAME { struct group *gr = getgrnam ("tty"); if (gr) { /* change ownership of tty to real uid, "tty" gid */ gid = gr->gr_gid; mode = 0620; } } #endif /* USE_GETGRNAME */ privileges (RESTORE); (void) fchown (fd, getuid (), gid); /* fail silently */ fchmod (fd, mode); privileges (IGNORE); } #endif /* __svr4__ */ { int i; /* * Close all file descriptors. If only stdin/out/err are closed, * child processes remain alive upon deletion of the window. */ for (i = 0; i < num_fds; i++) if (i != fd) close (i); /* Reopen stdin, stdout and stderr over the tty file descriptor */ for (i = 0; i < 3; i++) if (dup (fd) < 0) { fprintf (stderr, "Fail to dup tty for fd %d: %s\n", i, strerror (errno)); exit (EXIT_FAILURE); } } if (fd > 2) close (fd); #ifdef ultrix if ((fd = open ("/dev/tty", O_RDONLY)) >= 0) { ioctl (fd, TIOCNOTTY, 0); close (fd); } else { pid = setpgrp (0, 0); if (pid < 0) perror (rs_name); } /* no error, we could run with no tty to begin with */ #else /* ultrix */ #ifdef TIOCSCTTY ioctl (0, TIOCSCTTY, 0); #endif /* set process group */ #if defined (_POSIX_VERSION) || defined (__svr4__) tcsetpgrp (0, pid); #elif defined (TIOCSPGRP) ioctl (0, TIOCSPGRP, &pid); #endif /* svr4 problems: reports no tty, no job control */ /* # if !defined (__svr4__) && defined (TIOCSPGRP) */ close (open (ttydev, O_RDWR, 0)); /* # endif */ #endif /* ultrix */ privileges (IGNORE); return fd; } /*}}} */ /*{{{ ways to deal with getting/setting termios structure */ #ifdef HAVE_TERMIOS_H typedef struct termios ttymode_t; #ifdef TCSANOW /* POSIX */ #define GET_TERMIOS(fd,tios) tcgetattr (fd, tios) #define SET_TERMIOS(fd,tios) do {\ cfsetospeed (tios, BAUDRATE);\ cfsetispeed (tios, BAUDRATE);\ tcsetattr (fd, TCSANOW, tios);\ } while (0) #else #ifdef TIOCSETA #define GET_TERMIOS(fd,tios) ioctl (fd, TIOCGETA, tios) #define SET_TERMIOS(fd,tios) do {\ tios->c_cflag |= BAUDRATE;\ ioctl (fd, TIOCSETA, tios);\ } while (0) #else #define GET_TERMIOS(fd,tios) ioctl (fd, TCGETS, tios) #define SET_TERMIOS(fd,tios) do {\ tios->c_cflag |= BAUDRATE;\ ioctl (fd, TCSETS, tios);\ } while (0) #endif #endif #define SET_TTYMODE(fd,tios) SET_TERMIOS (fd, tios) #else /* sgtty interface */ typedef struct { struct sgttyb sg; struct tchars tc; struct ltchars lc; int line; int local; } ttymode_t; #define SET_TTYMODE(fd,tt) do { \ tt->sg.sg_ispeed = tt->sg.sg_ospeed = BAUDRATE;\ ioctl (fd, TIOCSETP, &(tt->sg));\ ioctl (fd, TIOCSETC, &(tt->tc));\ ioctl (fd, TIOCSLTC, &(tt->lc));\ ioctl (fd, TIOCSETD, &(tt->line));\ ioctl (fd, TIOCLSET, &(tt->local));\ } while (0) #endif /* HAVE_TERMIOS_H */ /*}}} */ /*{{{ debug_ttymode() */ #ifdef DEBUG_TTYMODE static void debug_ttymode (ttymode_t * ttymode) { #ifdef HAVE_TERMIOS_H /* c_iflag bits */ fprintf (stderr, "Input flags\n"); /* cpp token stringize doesn't work on all machines */ #define FOO(flag,name) \ if ((ttymode->c_iflag) & flag) fprintf (stderr, "%s ", name) /* c_iflag bits */ FOO (IGNBRK, "IGNBRK"); FOO (BRKINT, "BRKINT"); FOO (IGNPAR, "IGNPAR"); FOO (PARMRK, "PARMRK"); FOO (INPCK, "INPCK"); FOO (ISTRIP, "ISTRIP"); FOO (INLCR, "INLCR"); FOO (IGNCR, "IGNCR"); FOO (ICRNL, "ICRNL"); FOO (IXON, "IXON"); FOO (IXOFF, "IXOFF"); #ifdef IUCLC FOO (IUCLC, "IUCLC"); #endif #ifdef IXANY FOO (IXANY, "IXANY"); #endif #ifdef IMAXBEL FOO (IMAXBEL, "IMAXBEL"); #endif fprintf (stderr, "\n\n"); #undef FOO #define FOO(entry, name) \ fprintf (stderr, "%s = %#3o\n", name, ttymode->c_cc [entry]) FOO (VINTR, "VINTR"); FOO (VQUIT, "VQUIT"); FOO (VERASE, "VERASE"); FOO (VKILL, "VKILL"); FOO (VEOF, "VEOF"); FOO (VEOL, "VEOL"); #ifdef VEOL2 FOO (VEOL2, "VEOL2"); #endif #ifdef VSWTC FOO (VSWTC, "VSWTC"); #endif #ifdef VSWTCH FOO (VSWTCH, "VSWTCH"); #endif FOO (VSTART, "VSTART"); FOO (VSTOP, "VSTOP"); FOO (VSUSP, "VSUSP"); #ifdef VDSUSP FOO (VDSUSP, "VDSUSP"); #endif #ifdef VREPRINT FOO (VREPRINT, "VREPRINT"); #endif #ifdef VDISCRD FOO (VDISCRD, "VDISCRD"); #endif #ifdef VWERSE FOO (VWERSE, "VWERSE"); #endif #ifdef VLNEXT FOO (VLNEXT, "VLNEXT"); #endif fprintf (stderr, "\n\n"); #undef FOO #endif /* HAVE_TERMIOS_H */ } #endif /* DEBUG_TTYMODE */ /*}}} */ /*{{{ get_ttymode() */ static void get_ttymode (ttymode_t * tio) { #ifdef HAVE_TERMIOS_H /* * standard System V termios interface */ if (GET_TERMIOS (0, tio) < 0) { /* return error - use system defaults */ tio->c_cc[VINTR] = CINTR; tio->c_cc[VQUIT] = CQUIT; tio->c_cc[VERASE] = CERASE; tio->c_cc[VKILL] = CKILL; tio->c_cc[VSTART] = CSTART; tio->c_cc[VSTOP] = CSTOP; tio->c_cc[VSUSP] = CSUSP; #ifdef VDSUSP tio->c_cc[VDSUSP] = CDSUSP; #endif #ifdef VREPRINT tio->c_cc[VREPRINT] = CRPRNT; #endif #ifdef VDISCRD tio->c_cc[VDISCRD] = CFLUSH; #endif #ifdef VWERSE tio->c_cc[VWERSE] = CWERASE; #endif #ifdef VLNEXT tio->c_cc[VLNEXT] = CLNEXT; #endif } tio->c_cc[VEOF] = CEOF; tio->c_cc[VEOL] = VDISABLE; #ifdef VEOL2 tio->c_cc[VEOL2] = VDISABLE; #endif #ifdef VSWTC tio->c_cc[VSWTC] = VDISABLE; #endif #ifdef VSWTCH tio->c_cc[VSWTCH] = VDISABLE; #endif #if VMIN != VEOF tio->c_cc[VMIN] = 1; #endif #if VTIME != VEOL tio->c_cc[VTIME] = 0; #endif /* input modes */ tio->c_iflag = (BRKINT | IGNPAR | ICRNL | IXON #ifdef IMAXBEL | IMAXBEL #endif ); /* output modes */ tio->c_oflag = (OPOST | ONLCR); /* control modes */ tio->c_cflag = (CS8 | CREAD); /* line discipline modes */ tio->c_lflag = (ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK #if defined (ECHOCTL) && defined (ECHOKE) | ECHOCTL | ECHOKE #endif ); /* * guess an appropriate value for Backspace */ #ifdef DONT_GUESS_BACKSPACE PrivMode (1, PrivMode_BackSpace); /* always ^H */ #else PrivMode ((tio->c_cc[VERASE] == '\b'), PrivMode_BackSpace); #endif /* DONT_GUESS_BACKSPACE */ #else /* HAVE_TERMIOS_H */ /* * sgtty interface */ /* get parameters -- gtty */ if (ioctl (0, TIOCGETP, &(tio->sg)) < 0) { tio->sg.sg_erase = CERASE; /* ^H */ tio->sg.sg_kill = CKILL; /* ^U */ } tio->sg.sg_flags = (CRMOD | ECHO | EVENP | ODDP); /* get special characters */ if (ioctl (0, TIOCGETC, &(tio->tc)) < 0) { tio->tc.t_intrc = CINTR; /* ^C */ tio->tc.t_quitc = CQUIT; /* ^\ */ tio->tc.t_startc = CSTART; /* ^Q */ tio->tc.t_stopc = CSTOP; /* ^S */ tio->tc.t_eofc = CEOF; /* ^D */ tio->tc.t_brkc = -1; } /* get local special chars */ if (ioctl (0, TIOCGLTC, &(tio->lc)) < 0) { tio->lc.t_suspc = CSUSP; /* ^Z */ tio->lc.t_dsuspc = CDSUSP; /* ^Y */ tio->lc.t_rprntc = CRPRNT; /* ^R */ tio->lc.t_flushc = CFLUSH; /* ^O */ tio->lc.t_werasc = CWERASE; /* ^W */ tio->lc.t_lnextc = CLNEXT; /* ^V */ } /* get line discipline */ ioctl (0, TIOCGETD, &(tio->line)); #ifdef NTTYDISC tio->line = NTTYDISC; #endif /* NTTYDISC */ tio->local = (LCRTBS | LCRTERA | LCTLECH | LPASS8 | LCRTKIL); /* * guess an appropriate value for Backspace */ #ifdef DONT_GUESS_BACKSPACE PrivMode (1, PrivMode_BackSpace); /* always ^H */ #else PrivMode ((tio->sg.sg_erase == '\b'), PrivMode_BackSpace); #endif /* DONT_GUESS_BACKSPACE */ #endif /* HAVE_TERMIOS_H */ } /*}}} */ /*{{{ run_command() */ /* * Run the command in a subprocess and return a file descriptor for the * master end of the pseudo-teletype pair with the command talking to * the slave. */ static int run_command (char *argv[]) { ttymode_t tio; int ptyfd; /* Save and then give up any super-user privileges */ privileges (SAVE); privileges (IGNORE); ptyfd = get_pty (); if (ptyfd < 0) return -1; /* store original tty status for restoration clean_exit() -- rgg 04/12/95 */ lstat (ttydev, &ttyfd_stat); #ifdef DEBUG_CMD fprintf (stderr, "Original settings of %s are mode %o, uid %d, gid %d\n", ttydev, ttyfd_stat.st_mode, ttyfd_stat.st_uid, ttyfd_stat.st_gid); #endif /* install exit handler for cleanup */ #ifdef HAVE_ATEXIT atexit (clean_exit); #else #if defined (__sun__) on_exit (clean_exit, NULL); /* non-ANSI exit handler */ #else print_error ("no atexit(), UTMP entries can't be cleaned"); #endif #endif /* * get tty settings before fork() * and make a reasonable guess at the value for BackSpace */ get_ttymode (&tio); /* add Backspace value */ SavedModes |= (PrivateModes & PrivMode_BackSpace); /* add value for scrollBar */ if (scrollbar_visible ()) { PrivateModes |= PrivMode_scrollBar; SavedModes |= PrivMode_scrollBar; } #ifdef DEBUG_TTYMODE debug_ttymode (&tio); #endif /* spin off the command interpreter */ signal (SIGHUP, Exit_signal); #ifndef __svr4__ signal (SIGINT, Exit_signal); #endif signal (SIGQUIT, Exit_signal); signal (SIGTERM, Exit_signal); signal (SIGCHLD, Child_signal); /* need to trap SIGURG for SVR4 (Unixware) rlogin */ /* signal (SIGURG, SIG_DFL); */ cmd_pid = fork (); if (cmd_pid < 0) { print_error ("can't fork"); return -1; } if (cmd_pid == 0) /* child */ { /* signal (SIGHUP, Exit_signal); */ /* signal (SIGINT, Exit_signal); */ #ifdef HAVE_UNSETENV /* avoid passing old settings and confusing term size */ unsetenv ("LINES"); unsetenv ("COLUMNS"); /* avoid passing termcap since terminfo should be okay */ unsetenv ("TERMCAP"); #endif /* HAVE_UNSETENV */ /* establish a controlling teletype for the new session */ get_tty (); /* initialize terminal attributes */ SET_TTYMODE (0, &tio); /* become virtual console, fail silently */ if (Options & Opt_console) { #ifdef TIOCCONS unsigned int on = 1; ioctl (0, TIOCCONS, &on); #elif defined (SRIOCREDIR) int fd = open (CONSOLE, O_WRONLY); if (fd < 0 || ioctl (0, SRIOCSREDIR, fd) < 0) { if (fd >= 0) close (fd); } #endif /* SRIOCSREDIR */ } tt_winsize (0); /* set window size */ /* reset signals and spin off the command interpreter */ signal (SIGINT, SIG_DFL); signal (SIGQUIT, SIG_DFL); signal (SIGCHLD, SIG_DFL); /* * mimick login's behavior by disabling the job control signals * a shell that wants them can turn them back on */ #ifdef SIGTSTP signal (SIGTSTP, SIG_IGN); signal (SIGTTIN, SIG_IGN); signal (SIGTTOU, SIG_IGN); #endif /* SIGTSTP */ /* command interpreter path */ if (argv != NULL) { #ifdef DEBUG_CMD int i; for (i = 0; argv[i]; i++) fprintf (stderr, "argv [%d] = \"%s\"\n", i, argv[i]); #endif execvp (argv[0], argv); print_error ("can't execute \"%s\"", argv[0]); } else { const char *argv0, *shell; if ((shell = getenv ("SHELL")) == NULL || *shell == '\0') shell = "/bin/sh"; argv0 = my_basename (shell); if (Options & Opt_loginShell) { char *p = MALLOC ((strlen (argv0) + 2) * sizeof (char), argv0); p[0] = '-'; strcpy (&p[1], argv0); argv0 = p; } execlp (shell, argv0, NULL); print_error ("can't execute \"%s\"", shell); } exit (EXIT_FAILURE); } privileges (RESTORE); if (!(Options & Opt_utmpInhibit)) makeutent (ttydev, display_name); /* stamp /etc/utmp */ privileges (IGNORE); return ptyfd; } /*}}} */ /*{{{ init_command() */ void init_command (char *argv[]) { /* * Initialize the command connection. * This should be called after the X server connection is established. */ /* Enable delete window protocol */ wmDeleteWindow = XInternAtom (Xdisplay, "WM_DELETE_WINDOW", False); XSetWMProtocols (Xdisplay, TermWin.parent, &wmDeleteWindow, 1); #ifdef OFFIX_DND /* Enable OffiX Dnd (drag 'n' drop) protocol */ DndProtocol = XInternAtom (Xdisplay, "DndProtocol", False); DndSelection = XInternAtom (Xdisplay, "DndSelection", False); #endif /* OFFIX_DND */ init_xlocale (); /* get number of available file descriptors */ #ifdef _POSIX_VERSION num_fds = sysconf (_SC_OPEN_MAX); #else num_fds = getdtablesize (); #endif #ifdef META8_OPTION meta_char = (Options & Opt_meta8 ? 0x80 : 033); #endif #ifdef GREEK_SUPPORT greek_init (); #endif Xfd = XConnectionNumber (Xdisplay); cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; if ((cmd_fd = run_command (argv)) < 0) { print_error ("aborting"); exit (EXIT_FAILURE); } } /*}}} */ /*{{{ Xlocale */ /* * This is more or less stolen straight from XFree86 xterm. * This should support all European type languages. */ #ifndef NO_XLOCALE static void init_xlocale (void) { char *p, *s, buf[32], tmp[1024]; XIM xim = NULL; XIMStyle input_style = 0; XIMStyles *xim_styles = NULL; int found; XIMValuesList *ic_values = NULL; Input_Context = NULL; #ifdef KANJI setlocale (LC_CTYPE, ""); #endif if (rs_inputMethod == NULL #ifndef KANJI || !*rs_inputMethod /* required ? */ #endif ) { if ((p = XSetLocaleModifiers ("")) != NULL && *p) xim = XOpenIM (Xdisplay, NULL, NULL, NULL); } else { strcpy (tmp, rs_inputMethod); for (s = tmp; *s; /*nil */ ) { char *end, *next_s; while (*s && isspace (*s)) s++; if (!*s) break; end = s; while (*end && (*end != ',')) end++; next_s = end--; while ((end >= s) && isspace (*end)) end--; *(end + 1) = '\0'; if (*s) { strcpy (buf, "@im="); strcat (buf, s); if ((p = XSetLocaleModifiers (buf)) != NULL && *p && (xim = XOpenIM (Xdisplay, NULL, NULL, NULL)) != NULL) break; } if (!*next_s) break; s = (next_s + 1); } } if (xim == NULL) xim = XOpenIM (Xdisplay, NULL, NULL, NULL); if (xim == NULL && (p = XSetLocaleModifiers ("@im=none")) != NULL && *p) xim = XOpenIM (Xdisplay, NULL, NULL, NULL); if (xim == NULL) { print_error ("Failed to open input method"); return; } if (XGetIMValues (xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles) { print_error ("input method doesn't support any style"); XCloseIM (xim); return; } strcpy (tmp, (rs_preeditType ? rs_preeditType : "Root")); for (found = 0, s = tmp; *s && !found; /*nil */ ) { unsigned short i; char *end, *next_s; while (*s && isspace (*s)) s++; if (!*s) break; end = s; while (*end && (*end != ',')) end++; next_s = end--; while ((end >= s) && isspace (*end)) *end-- = 0; if (!strcmp (s, "OverTheSpot")) input_style = (XIMPreeditPosition | XIMStatusArea); else if (!strcmp (s, "OffTheSpot")) input_style = (XIMPreeditArea | XIMStatusArea); else if (!strcmp (s, "Root")) input_style = (XIMPreeditNothing | XIMStatusNothing); for (i = 0; i < xim_styles->count_styles; i++) { if (input_style == xim_styles->supported_styles[i]) { found = 1; break; } } s = next_s; } XFree (xim_styles); if (found == 0) { print_error ("input method doesn't support my preedit type"); XCloseIM (xim); return; } /* * This program only understands the Root preedit_style yet * Then misc.preedit_type should default to: * "OverTheSpot,OffTheSpot,Root" * /MaF */ if (input_style != (XIMPreeditNothing | XIMStatusNothing)) { print_error ("This program only supports the \"Root\" preedit type"); XCloseIM (xim); return; } Input_Context = XCreateIC (xim, XNInputStyle, input_style, XNClientWindow, TermWin.parent, XNFocusWindow, TermWin.parent, NULL); if (Input_Context == NULL) { print_error ("Failed to create input context"); XCloseIM (xim); } if (!XGetIMValues(xim, XNQueryICValuesList, &ic_values, NULL)) { int i; for (i = 0; i < ic_values->count_values; i++) { if (strcmp(ic_values->supported_values[i], XNStringConversionCallback) == 0) { XSetICValues(Input_Context, XNStringConversionCallback, (XPointer)&String_Conv_Cb, NULL); print_error("SCCB registered"); break; } } } } static void stringConversionCallback(XIC ic, XPointer client_data, XPointer call_data) { XIMStringConversionCallbackStruct *conv_data; char buff[255]; char *p; int row, col; int begcol, endcol; conv_data = (XIMStringConversionCallbackStruct *)call_data; if (conv_data->operation != XIMStringConversionRetrieval) { /* not support Substitution */ conv_data->text = NULL; return; } scr_get_position(&row, &col); p = buff; begcol = col + conv_data->position; endcol = -1; switch (conv_data->direction) { case XIMForwardChar: endcol = begcol + conv_data->factor; break; case XIMBackwardChar: endcol = begcol; begcol -= conv_data->factor; break; case XIMForwardWord: case XIMBackwardWord: case XIMCaretUp: case XIMCaretDown: case XIMNextLine: case XIMPreviousLine: case XIMLineStart: case XIMLineEnd: case XIMAbsolutePosition: case XIMDontChange: default: break; } if (0 <= begcol && begcol < endcol && endcol <= TermWin.ncol) { while (begcol < endcol) { *p++ = scr_get_char_rc(row, begcol++); } conv_data->text = (XIMStringConversionText *) malloc(sizeof(XIMStringConversionText)); conv_data->text->length = p - buff; conv_data->text->feedback = 0; conv_data->text->encoding_is_wchar = False; conv_data->text->string.mbs = (char *) malloc(p - buff); memcpy(conv_data->text->string.mbs, buff, p - buff); } } #endif /* NO_XLOCALE */ /*}}} */ /*{{{ window resizing */ /* * Tell the teletype handler what size the window is. * Called after a window size change. */ static void tt_winsize (int fd) { struct winsize ws; if (fd < 0) return; ws.ws_col = (unsigned short) TermWin.ncol; ws.ws_row = (unsigned short) TermWin.nrow; ws.ws_xpixel = ws.ws_ypixel = 0; ioctl (fd, TIOCSWINSZ, &ws); } void tt_resize (void) { tt_winsize (cmd_fd); } /*}}} */ /*{{{ Convert the keypress event into a string */ static void lookup_key (XEvent * ev) { static int numlock_state = 0; #ifdef DEBUG_CMD static int debug_key = 1; /* accessible by a debugger only */ #endif #ifdef GREEK_SUPPORT static short greek_mode = 0; #endif static XComposeStatus compose = {NULL, 0}; static unsigned char kbuf[KBUFSZ]; int ctrl, meta, shft, len; KeySym keysym = 0; /* * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an * escape sequence to toggle the Keypad. * * Always permit `shift' to override the current setting */ shft = (ev->xkey.state & ShiftMask); ctrl = (ev->xkey.state & ControlMask); meta = (ev->xkey.state & Mod1Mask); if (numlock_state || (ev->xkey.state & Mod5Mask)) { numlock_state = (ev->xkey.state & Mod5Mask); /* numlock toggle */ PrivMode ((!numlock_state), PrivMode_aplKP); } #ifndef NO_XLOCALE if (!XFilterEvent (ev, *(&ev->xkey.window))) { if (Input_Context != NULL) { Status status_return; len = XmbLookupString (Input_Context, &ev->xkey, (char *)kbuf, sizeof (kbuf), &keysym, &status_return); } else { len = XLookupString (&ev->xkey, (char *)kbuf, sizeof (kbuf), &keysym, &compose); } } else len = 0; #else /* NO_XLOCALE */ len = XLookupString (&ev->xkey, kbuf, sizeof (kbuf), &keysym, &compose); /* * have unmapped Latin[2-4] entries -> Latin1 * good for installations with correct fonts, but without XLOCAL */ if (!len && (keysym >= 0x0100) && (keysym < 0x0400)) { len = 1; kbuf[0] = (keysym & 0xFF); } #endif /* NO_XLOCALE */ #ifdef THAI /*** change shift-space to ctrl-space (Thep) *** if(shft && keysym==32) { ***********************************************/ if(ctrl && keysym==32) { thai_keyboard = !thai_keyboard; return; } #endif /* for some backwards compatibility */ #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) #ifdef HOTKEY_CTRL #define HOTKEY ctrl #else #ifdef HOTKEY_META #define HOTKEY meta #endif #endif if (HOTKEY) { if (keysym == ks_bigfont) { change_font (0, FONT_UP); return; } else if (keysym == ks_smallfont) { change_font (0, FONT_DN); return; } } #undef HOTKEY #endif if (shft) { /* Shift + F1 - F10 generates F11 - F20 */ if (keysym >= XK_F1 && keysym <= XK_F10) { keysym += (XK_F11 - XK_F1); shft = 0; /* turn off Shift */ } else if (!ctrl && !meta && (PrivateModes & PrivMode_ShiftKeys)) { switch (keysym) { /* normal XTerm key bindings */ case XK_Prior: /* Shift+Prior = scroll back */ if (TermWin.saveLines) { scr_page (UP, TermWin.nrow * 4 / 5); return; } break; case XK_Next: /* Shift+Next = scroll forward */ if (TermWin.saveLines) { scr_page (DN, TermWin.nrow * 4 / 5); return; } break; case XK_Insert: /* Shift+Insert = paste mouse selection */ selection_request (ev->xkey.time, ev->xkey.x, ev->xkey.y); return; break; /* xiterm extras */ case XK_KP_Add: /* Shift+KP_Add = bigger font */ change_font (0, FONT_UP); return; break; case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ change_font (0, FONT_DN); return; break; } } } switch (keysym) { case XK_Print: #ifdef DEBUG_SELECTION debug_selection (); return; #else #ifdef PRINTPIPE scr_printscreen (ctrl | shft); return; #endif #endif break; case XK_Mode_switch: #ifdef GREEK_SUPPORT greek_mode = !greek_mode; if (greek_mode) { xterm_seq (XTerm_title, (greek_getmode () == GREEK_ELOT928 ? "[Greek: iso]" : "[Greek: ibm]")); greek_reset (); } else xterm_seq (XTerm_title, APL_NAME "-" VERSION); return; #endif break; } if (keysym >= 0xFF00 && keysym <= 0xFFFF) { #ifdef KEYSYM_RESOURCE if (!(shft | ctrl) && KeySym_map[keysym - 0xFF00] != NULL) { const unsigned char *kbuf; unsigned int len; kbuf = (KeySym_map[keysym - 0xFF00]); len = *kbuf++; /* escape prefix */ if (meta #ifdef META8_OPTION && (meta_char == 033) #endif ) { const unsigned char ch = '\033'; tt_write (&ch, 1); } tt_write (kbuf, len); return; } else #endif switch (keysym) { case XK_BackSpace: len = 1; kbuf[0] = (((PrivateModes & PrivMode_BackSpace) ? !(shft | ctrl) : (shft | ctrl)) ? '\b' : '\177'); break; case XK_Tab: if (shft) { len = 3; strcpy ((char *)kbuf, "\033[Z"); } break; case XK_Home: len = strlen (strcpy ((char *)kbuf, KS_HOME)); break; case XK_Left: /* "\033[D" */ case XK_Up: /* "\033[A" */ case XK_Right: /* "\033[C" */ case XK_Down: /* "\033[B" */ len = 3; strcpy ((char *)kbuf, "\033[@"); kbuf[2] = ("DACB"[keysym - XK_Left]); if (PrivateModes & PrivMode_aplCUR) { kbuf[1] = 'O'; } /* do Shift first */ else if (shft) { kbuf[2] = ("dacb"[keysym - XK_Left]); } else if (ctrl) { kbuf[1] = 'O'; kbuf[2] = ("dacb"[keysym - XK_Left]); } break; case XK_Prior: len = 4; strcpy ((char *)kbuf, "\033[5~"); break; case XK_Next: len = 4; strcpy ((char *)kbuf, "\033[6~"); break; case XK_End: len = strlen (strcpy ((char *)kbuf, KS_END)); break; case XK_Select: len = 4; strcpy ((char *)kbuf, "\033[4~"); break; case XK_Execute: len = 4; strcpy ((char *)kbuf, "\033[3~"); break; case XK_Insert: len = 4; strcpy ((char *)kbuf, "\033[2~"); break; case XK_Menu: len = 5; strcpy ((char *)kbuf, "\033[29~"); break; case XK_Find: len = 4; strcpy ((char *)kbuf, "\033[1~"); break; case XK_Help: len = 5; strcpy ((char *)kbuf, "\033[28~"); break; case XK_KP_Enter: /* allow shift to send normal "\033OM" */ if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) { len = 1; kbuf[0] = '\r'; } else { len = 3; strcpy ((char *)kbuf, "\033OM"); } break; case XK_KP_F1: /* "\033OP" */ case XK_KP_F2: /* "\033OQ" */ case XK_KP_F3: /* "\033OR" */ case XK_KP_F4: /* "\033OS" */ len = 3; strcpy ((char *)kbuf, "\033OP"); kbuf[2] += (keysym - XK_KP_F1); break; case XK_KP_Multiply: /* "\033Oj" : "*" */ case XK_KP_Add: /* "\033Ok" : "+" */ case XK_KP_Separator: /* "\033Ol" : "," */ case XK_KP_Subtract: /* "\033Om" : "-" */ case XK_KP_Decimal: /* "\033On" : "." */ case XK_KP_Divide: /* "\033Oo" : "/" */ case XK_KP_0: /* "\033Op" : "0" */ case XK_KP_1: /* "\033Oq" : "1" */ case XK_KP_2: /* "\033Or" : "2" */ case XK_KP_3: /* "\033Os" : "3" */ case XK_KP_4: /* "\033Ot" : "4" */ case XK_KP_5: /* "\033Ou" : "5" */ case XK_KP_6: /* "\033Ov" : "6" */ case XK_KP_7: /* "\033Ow" : "7" */ case XK_KP_8: /* "\033Ox" : "8" */ case XK_KP_9: /* "\033Oy" : "9" */ /* allow shift to override 'numlock_off' */ if ((PrivateModes & PrivMode_aplKP) == 0) { /* if numlock = off, for non numerics do : */ len = 1; kbuf[0] = ('*' + (keysym - XK_KP_Multiply)); } break; case XK_KP_Left: /* "\033[D" */ case XK_KP_Up: /* "\033[A" */ case XK_KP_Right: /* "\033[C" */ case XK_KP_Down: /* "\033[B" */ len = 3; strcpy ((char *)kbuf, "\033[@"); kbuf[2] = ("DACB"[keysym - XK_KP_Left]); if (PrivateModes & PrivMode_aplCUR) { kbuf[1] = 'O'; } else if (ctrl) { kbuf[1] = 'O'; kbuf[2] = ("dacb"[keysym - XK_KP_Left]); } break; case XK_KP_Prior: len = 4; strcpy ((char *)kbuf, "\033[5~"); break; case XK_KP_Next: len = 4; strcpy ((char *)kbuf, "\033[6~"); break; case XK_KP_End: len = strlen (strcpy ((char *)kbuf, KS_END)); break; case XK_KP_Insert: len = 4; strcpy ((char *)kbuf, "\033[2~"); break; case XK_KP_Home: len = strlen (strcpy ((char *)kbuf, KS_HOME)); break; case XK_KP_Delete: len = strlen (strcpy ((char *)kbuf, KS_DELETE)); break; /* Nothing associated with case KP_Begin: at the moment ... */ #define FKEY(n,fkey) len = 5;\ sprintf ((char *)kbuf,"\033[%02d~", (int)((n) + (keysym - fkey))) case XK_F1: /* "\033[11~" */ #ifdef THAI thai_keyboard = !thai_keyboard; break; #endif case XK_F2: /* "\033[12~" */ case XK_F3: /* "\033[13~" */ case XK_F4: /* "\033[14~" */ case XK_F5: /* "\033[15~" */ FKEY (11, XK_F1); break; case XK_F6: /* "\033[17~" */ case XK_F7: /* "\033[18~" */ case XK_F8: /* "\033[19~" */ case XK_F9: /* "\033[20~" */ case XK_F10: /* "\033[21~" */ FKEY (17, XK_F6); break; case XK_F11: /* "\033[23~" */ case XK_F12: /* "\033[24~" */ case XK_F13: /* "\033[25~" */ case XK_F14: /* "\033[26~" */ FKEY (23, XK_F11); break; case XK_F15: /* "\033[28~" */ case XK_F16: /* "\033[29~" */ FKEY (28, XK_F15); break; case XK_F17: /* "\033[31~" */ case XK_F18: /* "\033[32~" */ case XK_F19: /* "\033[33~" */ case XK_F20: /* "\033[34~" */ case XK_F21: /* "\033[35~" */ case XK_F22: /* "\033[36~" */ case XK_F23: /* "\033[37~" */ case XK_F24: /* "\033[38~" */ case XK_F25: /* "\033[39~" */ case XK_F26: /* "\033[40~" */ case XK_F27: /* "\033[41~" */ case XK_F28: /* "\033[42~" */ case XK_F29: /* "\033[43~" */ case XK_F30: /* "\033[44~" */ case XK_F31: /* "\033[45~" */ case XK_F32: /* "\033[46~" */ case XK_F33: /* "\033[47~" */ case XK_F34: /* "\033[48~" */ case XK_F35: /* "\033[49~" */ FKEY (31, XK_F17); break; #undef FKEY #ifdef KS_DELETE case XK_Delete: len = strlen (strcpy ((char *)kbuf, KS_DELETE)); break; #endif } } else if (ctrl && keysym == XK_minus) { len = 1; kbuf[0] = '\037'; /* Ctrl-Minus generates ^_ (31) */ } else { #ifdef META8_OPTION /* set 8-bit on */ if (meta && (meta_char == 0x80)) { unsigned char *ch; for (ch = kbuf; ch < kbuf + len; ch++) *ch |= 0x80; meta = 0; } #endif #ifdef GREEK_SUPPORT if (greek_mode) len = greek_xlat (kbuf, len); #endif #ifdef THAI /* Theppitak 1999-07-22 : move here to allow keypad typing */ if(thai_keyboard) { int i; for (i = 0; i < len; i++) kbuf[i] = thai_map_qwerty(kbuf[i]); /*** Use thaikb.h instead of direct array access -Theppitak 1999-07-22 for (i = 0; i < len; i++) kbuf[i] = thai_keymap[kbuf[i]]; ***/ } #endif /*nil */ ; } if (len <= 0) return; /* not mapped */ /* * these modifications only affect the static keybuffer * pass Shift/Control indicators for function keys ending with `~' * * eg, * Prior = "ESC[5~" * Shift+Prior = "ESC[5~" * Ctrl+Prior = "ESC[5^" * Ctrl+Shift+Prior = "ESC[5@" */ if (kbuf[0] == '\033' && kbuf[1] == '[' && kbuf[len - 1] == '~') kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~')); /* escape prefix */ if (meta #ifdef META8_OPTION && (meta_char == 033) #endif ) { const unsigned char ch = '\033'; tt_write (&ch, 1); } #ifdef DEBUG_CMD if (debug_key) /* Display keyboard buffer contents */ { char *p; int i; fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int) keysym, len); for (i = 0, p = kbuf; i < len; i++, p++) fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); fprintf (stderr, "'\n"); } #endif /* DEBUG_CMD */ #if 0 /* Theppitak 1999-07-22 : move code to prevent translation on keypad */ #ifdef THAI if(thai_keyboard) { int i; for (i = 0; i < len; i++) kbuf[i] = thai_map_qwerty(kbuf[i]); /*** Use thaikb.h instead of direct array access -Theppitak 1999-07-22 for (i = 0; i < len; i++) kbuf[i] = thai_keymap[kbuf[i]]; ***/ } #endif #endif /* 0 */ tt_write (kbuf, len); } /*}}} */ /*{{{ cmd_ungetc(), cmd_getc() */ static void cmd_ungetc (unsigned char ch) { if (cmdbuf_ptr > cmdbuf_base) { /* sneak one in */ cmdbuf_ptr--; *cmdbuf_ptr = ch; } else { int n = (cmdbuf_endp - cmdbuf_base); if (n > 0) { if (n == sizeof (cmdbuf_base)) { /* drop one off the end to make room */ n--; cmdbuf_endp--; } memmove ((cmdbuf_base + 1), cmdbuf_base, n); } *cmdbuf_ptr = ch; cmdbuf_endp++; } } /* attempt to `write' COUNT to the input buffer */ unsigned int cmd_write (const unsigned char *str, unsigned int count) { while (count--) cmd_ungetc (str[count]); return 0; } /* cmd_getc() - Return next input character */ /* * Return the next input character after first passing any keyboard input * to the command. */ static unsigned char cmd_getc (void) { #define TIMEOUT_USEC 5000 static short refreshed = 0; fd_set readfds; int retval; struct itimerval value; /* If there have been a lot of new lines, then update the screen * What the heck I'll cheat and only refresh less than every page-full. * the number of pages between refreshes is refresh_limit, which * is incremented here because we must be doing flat-out scrolling. * * refreshing should be correct for small scrolls, because of the * time-out */ if (refresh_count > (refresh_limit * TermWin.nrow)) { if (refresh_limit < REFRESH_PERIOD) refresh_limit++; refresh_count = 0; refreshed = 1; scr_refresh (refresh_type); } /* characters already read in */ if (cmdbuf_ptr < cmdbuf_endp) goto Return_Char; while (1) { while (XPending (Xdisplay)) /* process pending X events */ { XEvent ev; refreshed = 0; XNextEvent (Xdisplay, &ev); process_x_event (&ev); /* in case button actions pushed chars to cmdbuf */ if (cmdbuf_ptr < cmdbuf_endp) goto Return_Char; } /* Nothing to do! */ FD_ZERO (&readfds); FD_SET (cmd_fd, &readfds); FD_SET (Xfd, &readfds); value.it_value.tv_usec = TIMEOUT_USEC; value.it_value.tv_sec = 0; retval = select (num_fds, &readfds, NULL, NULL, (refreshed ? NULL : &value.it_value)); /* See if we can read from the application */ if (FD_ISSET (cmd_fd, &readfds)) { unsigned int count = sizeof (cmdbuf_base) - 1; cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; /* while (count > sizeof(cmdbuf_base) / 2) */ while (count) { int n = read (cmd_fd, cmdbuf_endp, count); if (n <= 0) break; cmdbuf_endp += n; count -= n; } /* some characters read in */ if (cmdbuf_ptr < cmdbuf_endp) goto Return_Char; } /* select statement timed out - better update the screen */ if (retval == 0) { refresh_count = 0; refresh_limit = 1; if (!refreshed) { refreshed = 1; scr_refresh (refresh_type); scrollbar_show (1); } } } return 0; Return_Char: refreshed = 0; return (*cmdbuf_ptr++); } /*}}} */ /*{{{ process an X event */ static void process_x_event (XEvent * ev) { static Time buttonpress_time; static int clicks = 0; #define clickOnce() (clicks <= 1) static int bypass_keystate = 0; int reportmode; switch (ev->type) { case KeyPress: lookup_key (ev); break; case ClientMessage: if (ev->xclient.format == 32 && ev->xclient.data.l[0] == wmDeleteWindow) exit (EXIT_SUCCESS); #ifdef OFFIX_DND /* OffiX Dnd (drag 'n' drop) protocol */ if (ev->xclient.message_type == DndProtocol && (ev->xclient.data.l[0] == DndFile) || (ev->xclient.data.l[0] == DndDir) || (ev->xclient.data.l[0] == DndLink)) { /* Get Dnd data */ Atom ActualType; int ActualFormat; unsigned char *data; unsigned long Size, RemainingBytes; XGetWindowProperty (Xdisplay, Xroot, DndSelection, 0L, 1000000L, False, AnyPropertyType, &ActualType, &ActualFormat, &Size, &RemainingBytes, &data); XChangeProperty (Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, data, strlen (data)); selection_paste (Xroot, XA_CUT_BUFFER0, True); XSetInputFocus (Xdisplay, Xroot, RevertToNone, CurrentTime); } #endif /* OFFIX_DND */ break; case MappingNotify: XRefreshKeyboardMapping (&(ev->xmapping)); break; /* Here's my conclusiion: * If the window is completely unobscured, use bitblt's * to scroll. Even then, they're only used when doing partial * screen scrolling. When partially obscured, we have to fill * in the GraphicsExpose parts, which means that after each refresh, * we need to wait for the graphics expose or Noexpose events, * which ought to make things real slow! */ case VisibilityNotify: switch (ev->xvisibility.state) { case VisibilityUnobscured: refresh_type = FAST_REFRESH; break; case VisibilityPartiallyObscured: refresh_type = SLOW_REFRESH; break; default: refresh_type = NO_REFRESH; break; } break; case FocusIn: if (!TermWin.focus) { TermWin.focus = 1; #ifndef NO_XLOCALE if (Input_Context != NULL) XSetICFocus (Input_Context); #endif } break; case FocusOut: if (TermWin.focus) { TermWin.focus = 0; #ifndef NO_XLOCALE if (Input_Context != NULL) XUnsetICFocus (Input_Context); #endif } break; case ConfigureNotify: resize_window (); break; case SelectionClear: selection_clear (); break; case SelectionNotify: selection_paste (ev->xselection.requestor, ev->xselection.property, True); break; case SelectionRequest: selection_send (&(ev->xselectionrequest)); break; case GraphicsExpose: case Expose: if (ev->xany.window == TermWin.vt) { scr_expose (ev->xexpose.x, ev->xexpose.y, ev->xexpose.width, ev->xexpose.height); } else { XEvent unused_xevent; while (XCheckTypedWindowEvent (Xdisplay, ev->xany.window, Expose, &unused_xevent)); while (XCheckTypedWindowEvent (Xdisplay, ev->xany.window, GraphicsExpose, &unused_xevent)); if (isScrollbarWindow (ev->xany.window)) { scrollbar_setNone (); scrollbar_show (0); } Gr_expose (ev->xany.window); } break; case ButtonPress: bypass_keystate = (ev->xbutton.state & (Mod1Mask | ShiftMask)); reportmode = (bypass_keystate ? 0 : (PrivateModes & PrivMode_mouse_report)); if (ev->xany.window == TermWin.vt) { if (ev->xbutton.subwindow != None) Gr_ButtonPress (ev->xbutton.x, ev->xbutton.y); else { if (reportmode) { if (reportmode & PrivMode_MouseX10) { /* no state info allowed */ ev->xbutton.state = 0; } #ifdef MOUSE_REPORT_DOUBLECLICK if (ev->xbutton.button == Button1) { if (ev->xbutton.time - buttonpress_time < MULTICLICK_TIME) clicks++; else clicks = 1; } #else clicks = 1; #endif /* MOUSE_REPORT_DOUBLECLICK */ mouse_report (&(ev->xbutton)); } else switch (ev->xbutton.button) { case Button1: if (ev->xbutton.time - buttonpress_time < MULTICLICK_TIME) clicks++; else clicks = 1; selection_click (clicks, ev->xbutton.x, ev->xbutton.y); break; case Button3: selection_extend (ev->xbutton.x, ev->xbutton.y); break; case Button4: scr_page (UP, TermWin.nrow / 4); break; case Button5: scr_page (DN, TermWin.nrow / 4); break; } buttonpress_time = ev->xbutton.time; return; } } if (isScrollbarWindow (ev->xany.window)) { scrollbar_setNone (); /* * Xiterm-style scrollbar: * move up if mouse if above slider * move dn if mouse if below slider * * XTerm-style scrollbar: * Move display proportional to pointer location * pointer near top -> scroll one line * pointer near bot -> scroll full page */ #ifndef NO_SCROLLBAR_REPORT if (reportmode) { /* * Mouse report disabled scrollbar: * arrow buttons - send up/down * click on scrollbar - send pageup/down */ if (scrollbar_upButton (ev->xbutton.y)) tt_printf ("\033[A"); else if (scrollbar_dnButton (ev->xbutton.y)) tt_printf ("\033[B"); else switch (ev->xbutton.button) { case Button2: tt_printf ("\014"); break; case Button1: tt_printf ("\033[6~"); break; case Button3: tt_printf ("\033[5~"); break; } } else #endif /* NO_SCROLLBAR_REPORT */ { if (ev->xbutton.button == Button4) { scr_page (UP, TermWin.nrow / 4); } else if (ev->xbutton.button == Button5) { scr_page (DN, TermWin.nrow / 4); } else if (scrollbar_upButton (ev->xbutton.y)) { /* I would like continuous scrolling */ if (ev->xbutton.button == Button1 && scr_page (UP, 1)) scrollbar_setUp (); } else if (scrollbar_dnButton (ev->xbutton.y)) { if (ev->xbutton.button == Button1 && scr_page (DN, 1)) scrollbar_setDn (); } else switch (ev->xbutton.button) { case Button2: #ifndef XTERM_SCROLLBAR if (scrollbar_above_slider (ev->xbutton.y) || scrollbar_below_slider (ev->xbutton.y)) #endif scr_move_to (scrollbar_position (ev->xbutton.y), scrollbar_size ()); scrollbar_setMotion (); break; case Button1: /*drop */ case Button3: #ifndef XTERM_SCROLLBAR if (scrollbar_above_slider (ev->xbutton.y)) scr_page (UP, TermWin.nrow / 4); else if (scrollbar_below_slider (ev->xbutton.y)) scr_page (DN, TermWin.nrow / 4); else scrollbar_setMotion (); #else /* XTERM_SCROLLBAR */ scr_page ((ev->xbutton.button == Button1 ? DN : UP), (TermWin.nrow * scrollbar_position (ev->xbutton.y) / scrollbar_size ()) ); #endif /* XTERM_SCROLLBAR */ break; } } return; } break; case ButtonRelease: reportmode = (bypass_keystate ? 0 : (PrivateModes & PrivMode_mouse_report)); if (scrollbar_isUpDn ()) { scrollbar_setNone (); scrollbar_show (0); } if (ev->xany.window == TermWin.vt) { if (ev->xbutton.subwindow != None) Gr_ButtonRelease (ev->xbutton.x, ev->xbutton.y); else { if (reportmode) { switch (reportmode & PrivMode_mouse_report) { case PrivMode_MouseX10: break; case PrivMode_MouseX11: ev->xbutton.state = bypass_keystate; ev->xbutton.button = AnyButton; mouse_report (&(ev->xbutton)); break; } return; } /* * dumb hack to compensate for the failure of click-and-drag * when overriding mouse reporting */ if ((PrivateModes & PrivMode_mouse_report) && (bypass_keystate) && (ev->xbutton.button == Button1) && (clickOnce ())) selection_extend (ev->xbutton.x, ev->xbutton.y); switch (ev->xbutton.button) { case Button1: case Button3: selection_make (ev->xbutton.time); break; case Button2: selection_request (ev->xbutton.time, ev->xbutton.x, ev->xbutton.y); break; } } } break; case MotionNotify: if ((PrivateModes & PrivMode_mouse_report) && !(bypass_keystate)) break; if (ev->xany.window == TermWin.vt) { if ((ev->xbutton.state & (Button1Mask | Button3Mask)) && clickOnce ()) { Window unused_root, unused_child; int unused_root_x, unused_root_y; unsigned int unused_mask; while (XCheckTypedWindowEvent (Xdisplay, TermWin.vt, MotionNotify, ev)); XQueryPointer (Xdisplay, TermWin.vt, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); #ifdef MOUSE_THRESHOLD /* deal with a `jumpy' mouse */ if ((ev->xmotion.time - buttonpress_time) > MOUSE_THRESHOLD) #endif selection_extend ((ev->xbutton.x), (ev->xbutton.y)); } } else if ((ev->xany.window == scrollBar.win) && scrollbar_isMotion ()) { Window unused_root, unused_child; int unused_root_x, unused_root_y; unsigned int unused_mask; while (XCheckTypedWindowEvent (Xdisplay, scrollBar.win, MotionNotify, ev)); XQueryPointer (Xdisplay, scrollBar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); scr_move_to (scrollbar_position (ev->xbutton.y), scrollbar_size ()); scr_refresh (refresh_type); refresh_count = refresh_limit = 0; scrollbar_show (1); } break; } } /*}}} */ /*{{{ tt_write(), tt_printf() - output to command */ /* * Send count characters directly to the command */ void tt_write (const unsigned char *buf, unsigned int count) { while (count > 0) { int n = write (cmd_fd, buf, count); if (n > 0) { count -= n; buf += n; } } } /* * Send printf() formatted output to the command. * Only use for small ammounts of data. */ void tt_printf (const char *fmt,...) { static char buf[256]; va_list arg_ptr; va_start (arg_ptr, fmt); vsprintf (buf, fmt, arg_ptr); va_end (arg_ptr); tt_write ((unsigned char*)buf, strlen (buf)); } /*}}} */ /*{{{ print pipe */ /*----------------------------------------------------------------------*/ #ifdef PRINTPIPE FILE * popen_printer (void) { FILE *stream = popen (rs_print_pipe, "w"); if (stream == NULL) print_error ("can't open printer pipe"); return stream; } int pclose_printer (FILE * stream) { fflush (stream); /* pclose() reported not to work on SunOS 4.1.3 */ #if defined (__sun__) /* pclose works provided SIGCHLD handler uses waitpid */ return pclose (stream); /* return fclose (stream); */ #else return pclose (stream); #endif } /* * simulate attached vt100 printer */ static void process_print_pipe (void) { const char *const escape_seq = "\033[4i"; const char *const rev_escape_seq = "i4[\033"; int index; FILE *fd; if ((fd = popen_printer ()) != NULL) { for (index = 0; index < 4; /* nil */ ) { unsigned char ch = cmd_getc (); if (ch == escape_seq[index]) index++; else if (index) for ( /*nil */ ; index > 0; index--) fputc (rev_escape_seq[index - 1], fd); if (index == 0) fputc (ch, fd); } pclose_printer (fd); } } #endif /* PRINTPIPE */ /*}}} */ /*{{{ process escape sequences */ static void process_escape_seq (void) { unsigned char ch = cmd_getc (); switch (ch) { /* case 1: do_tek_mode (); break; */ case '#': if (cmd_getc () == '8') scr_E (); break; case '(': scr_charset_set (0, cmd_getc ()); break; case ')': scr_charset_set (1, cmd_getc ()); break; case '*': scr_charset_set (2, cmd_getc ()); break; case '+': scr_charset_set (3, cmd_getc ()); break; #ifdef KANJI case '$': scr_charset_set (-2, cmd_getc ()); break; #endif case '7': scr_cursor (SAVE); break; case '8': scr_cursor (RESTORE); break; case '=': case '>': PrivMode ((ch == '='), PrivMode_aplKP); break; case '@': (void) cmd_getc (); break; case 'D': scr_index (UP); break; case 'E': scr_add_lines ((const unsigned char *)"\n\r", 1, 2); break; case 'H': scr_set_tab (1); break; case 'M': scr_index (DN); break; /*case 'N': scr_single_shift (2); break; */ /*case 'O': scr_single_shift (3); break; */ case 'Z': tt_printf (ESCZ_ANSWER); break; /* steal obsolete ESC [ c */ case '[': process_csi_seq (); break; case ']': process_xterm_seq (); break; case 'c': scr_poweron (); break; case 'n': scr_charset_choose (2); break; case 'o': scr_charset_choose (3); break; } } /*}}} */ /*{{{ process CSI (code sequence introducer) sequences `ESC[' */ static void process_csi_seq (void) { unsigned char ch, priv; unsigned int nargs; int arg[ESC_ARGS]; nargs = 0; arg[0] = 0; arg[1] = 0; priv = 0; ch = cmd_getc (); if (ch >= '<' && ch <= '?') { priv = ch; ch = cmd_getc (); } /* read any numerical arguments */ do { int n; for (n = 0; isdigit (ch); ch = cmd_getc ()) n = n * 10 + (ch - '0'); if (nargs < ESC_ARGS) arg[nargs++] = n; if (ch == '\b') { scr_backspace (); } else if (ch == 033) { process_escape_seq (); return; } else if (ch < ' ') { scr_add_lines (&ch, 0, 1); return; } if (ch < '@') ch = cmd_getc (); } while (ch >= ' ' && ch < '@'); if (ch == 033) { process_escape_seq (); return; } else if (ch < ' ') return; switch (ch) { #ifdef PRINTPIPE case 'i': /* printing */ switch (arg[0]) { case 0: scr_printscreen (0); break; case 5: process_print_pipe (); break; } break; #endif case 'A': case 'e': /* up */ scr_gotorc ((arg[0] ? -arg[0] : -1), 0, RELATIVE); break; case 'B': /* down */ scr_gotorc ((arg[0] ? +arg[0] : +1), 0, RELATIVE); break; case 'C': case 'a': /* right */ scr_gotorc (0, (arg[0] ? +arg[0] : +1), RELATIVE); break; case 'D': /* left */ scr_gotorc (0, (arg[0] ? -arg[0] : -1), RELATIVE); break; case 'E': /* down & to first column */ scr_gotorc ((arg[0] ? +arg[0] : +1), 0, R_RELATIVE); break; case 'F': /* up & to first column */ scr_gotorc ((arg[0] ? -arg[0] : -1), 0, R_RELATIVE); break; case 'G': case '`': /* move to col */ scr_gotorc (0, (arg[0] ? +arg[0] : +1), R_RELATIVE); break; case 'd': /* move to row */ scr_gotorc ((arg[0] ? +arg[0] : +1), 0, C_RELATIVE); break; case 'H': case 'f': /* position cursor */ switch (nargs) { case 0: scr_gotorc (0, 0, 0); break; case 1: scr_gotorc ((arg[0] ? arg[0] - 1 : 0), 0, 0); break; default: scr_gotorc (arg[0] - 1, arg[1] - 1, 0); break; } break; case 'I': scr_tab (arg[0] ? +arg[0] : +1); break; case 'Z': scr_tab (arg[0] ? -arg[0] : -1); break; case 'J': scr_erase_screen (arg[0]); break; case 'K': scr_erase_line (arg[0]); break; case '@': scr_insdel_chars ((arg[0] ? arg[0] : 1), INSERT); break; case 'L': scr_insdel_lines ((arg[0] ? arg[0] : 1), INSERT); break; case 'M': scr_insdel_lines ((arg[0] ? arg[0] : 1), DELETE); break; case 'X': scr_insdel_chars ((arg[0] ? arg[0] : 1), ERASE); break; case 'P': scr_insdel_chars ((arg[0] ? arg[0] : 1), DELETE); break; case 'c': tt_printf (VT100_ANS); break; case 'm': process_sgr_mode (nargs, arg); break; case 'n': /* request for information */ switch (arg[0]) { case 5: tt_printf ("\033[0n"); break; /* ready */ case 6: scr_report_position (); break; #if defined (ENABLE_DISPLAY_ANSWER) case 7: tt_printf ("%s\n", display_name); break; #endif case 8: xterm_seq (XTerm_title, APL_NAME "-" VERSION); break; } break; case 'r': /* set top and bottom margins */ if (priv != '?') { if (nargs < 2 || arg[0] >= arg[1]) scr_scroll_region (0, 10000); else scr_scroll_region (arg[0] - 1, arg[1] - 1); break; } /* drop */ case 's': case 't': case 'h': case 'l': process_terminal_mode (ch, priv, nargs, arg); break; case 'g': switch (arg[0]) { case 0: scr_set_tab (0); break; /* delete tab */ case 3: scr_set_tab (-1); break; /* clear all tabs */ } break; case 'W': switch (arg[0]) { case 0: scr_set_tab (1); break; /* = ESC H */ case 2: scr_set_tab (0); break; /* = ESC [ 0 g */ case 5: scr_set_tab (-1); break; /* = ESC [ 3 g */ } break; } } /*}}} */ /*{{{ process xterm text parameters sequences `ESC ] Ps ; Pt BEL' */ static void process_xterm_seq (void) { unsigned char ch, string[STRING_MAX]; int arg; ch = cmd_getc (); for (arg = 0; isdigit (ch); ch = cmd_getc ()) arg = arg * 10 + (ch - '0'); if (ch == ';') { int n = 0; while ((ch = cmd_getc ()) != 007) { if ((n < sizeof (string) - 1)) { /* silently translate whitespace to space char */ if (isspace (ch)) ch = ' '; if (ch >= ' ') string[n++] = ch; } } string[n] = '\0'; xterm_seq (arg, (char *)string); } } /*}}} */ /*{{{ process DEC private mode sequences `ESC [ ? Ps mode' */ /* * mode can only have the following values: * 'l' = low * 'h' = high * 's' = save * 'r' = restore * 't' = toggle * so no need for fancy checking */ static void process_terminal_mode (int mode, int priv, unsigned int nargs, int arg[]) { unsigned int i; int state; if (nargs == 0) return; /* make lo/hi boolean */ switch (mode) { case 'l': mode = 0; break; case 'h': mode = 1; break; } switch (priv) { case 0: if (mode && mode != 1) return; /* only do high/low */ for (i = 0; i < nargs; i++) switch (arg[i]) { case 4: scr_insert_mode (mode); break; case 36: PrivMode (mode, PrivMode_BackSpace); break; /* case 38: TEK mode */ } break; #define PrivCases(bit) \ if (mode == 't') state = !(PrivateModes & bit); else state = mode;\ switch (state) {\ case 's': SavedModes |= (PrivateModes & bit); continue; break;\ case 'r': state = (SavedModes & bit) ? 1 : 0;/*drop*/\ default: PrivMode (state, bit); } case '?': for (i = 0; i < nargs; i++) switch (arg[i]) { case 1: /* application cursor keys */ PrivCases (PrivMode_aplCUR); break; /* case 2: - reset charsets to USASCII */ case 3: /* 80/132 */ PrivCases (PrivMode_132); if (PrivateModes & PrivMode_132OK) set_width (state ? 132 : 80); break; /* case 4: - smooth scrolling */ case 5: /* reverse video */ PrivCases (PrivMode_rVideo); scr_rvideo_mode (state); break; case 6: /* relative/absolute origins */ PrivCases (PrivMode_relOrigin); scr_relative_origin (state); break; case 7: /* autowrap */ PrivCases (PrivMode_Autowrap); scr_autowrap (state); break; /* case 8: - auto repeat, can't do on a per window basis */ case 9: /* X10 mouse reporting */ PrivCases (PrivMode_MouseX10); /* orthogonal */ if (PrivateModes & PrivMode_MouseX10) PrivateModes &= ~(PrivMode_MouseX11); break; #ifdef scrollBar_esc case scrollBar_esc: PrivCases (PrivMode_scrollBar); map_scrollBar (state); break; #endif case 25: /* visible/invisible cursor */ PrivCases (PrivMode_VisibleCursor); scr_cursor_visible (state); break; case 35: PrivCases (PrivMode_ShiftKeys); break; case 36: PrivCases (PrivMode_BackSpace); break; case 40: /* 80 <--> 132 mode */ PrivCases (PrivMode_132OK); break; case 47: /* secondary screen */ PrivCases (PrivMode_Screen); scr_change_screen (state); break; case 66: /* application key pad */ PrivCases (PrivMode_aplKP); break; case 1000: /* X11 mouse reporting */ PrivCases (PrivMode_MouseX11); /* orthogonal */ if (PrivateModes & PrivMode_MouseX11) PrivateModes &= ~(PrivMode_MouseX10); break; #if 0 case 1001: break; /* X11 mouse highlighting */ #endif } #undef PrivCases break; } } /*}}} */ /*{{{ process sgr sequences */ static void process_sgr_mode (unsigned int nargs, int arg[]) { unsigned int i; if (nargs == 0) { scr_rendition (0, ~RS_None); return; } for (i = 0; i < nargs; i++) switch (arg[i]) { case 0: scr_rendition (0, ~RS_None); break; case 1: scr_rendition (1, RS_Bold); break; case 4: scr_rendition (1, RS_Uline); break; case 5: scr_rendition (1, RS_Blink); break; case 7: scr_rendition (1, RS_RVid); break; case 22: scr_rendition (0, RS_Bold); break; case 24: scr_rendition (0, RS_Uline); break; case 25: scr_rendition (0, RS_Blink); break; case 27: scr_rendition (0, RS_RVid); break; case 30: case 31: /* set fg color */ case 32: case 33: case 34: case 35: case 36: case 37: scr_color (minColor + (arg[i] - 30), RS_Bold); break; case 39: /* default fg */ scr_color (restoreFG, RS_Bold); break; case 40: case 41: /* set bg color */ case 42: case 43: case 44: case 45: case 46: case 47: scr_color (minColor + (arg[i] - 40), RS_Blink); break; case 49: /* default bg */ scr_color (restoreBG, RS_Blink); break; } } /*}}} */ /*{{{ Read and process output from the application */ void main_loop (void) { int ch; do { while ((ch = cmd_getc ()) == 0); /* wait for something */ if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') { /* Read a text string from the input buffer */ int nlines = 0; unsigned char *str; /* * point to the start of the string, * decrement first since already did get_com_char () */ str = --cmdbuf_ptr; while (cmdbuf_ptr < cmdbuf_endp) { ch = *cmdbuf_ptr; if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') { cmdbuf_ptr++; if (ch == '\n') { nlines++; refresh_count++; if (refresh_count > (refresh_limit * TermWin.nrow)) break; } } else /* unprintable */ { break; } } scr_add_lines (str, nlines, (cmdbuf_ptr - str)); } else { switch (ch) { case 005: tt_printf (VT100_ANS); break; /* terminal Status */ case 007: scr_bell (); break; /* bell */ case '\b': scr_backspace (); break; /* backspace */ case 013: case 014: scr_index (UP); break; /* vertical tab, form feed */ case 016: scr_charset_choose (1); break; /* shift out - acs */ case 017: scr_charset_choose (0); break; /* shift in - acs */ case 033: process_escape_seq (); break; } } } while (ch != EOF); } /*}}} */ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/utmp.c0000644000175000017500000003075711375434150014305 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: utmp.c * * Public: * extern void cleanutent (void); * extern void makeutent (const char * pty, const char * hostname); * * Private: * get_tslot (); * write_utmp (); * update_wtmp (); * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. * ---------------------------------------------------------------------*/ /*{{{ notes: */ /*----------------------------------------------------------------------* * Extensive modifications by mj olesen * No additional restrictions are applied. * * Revision 1.6 07DEC95:16 Piet W. Plomp, * wtmp support for (at least linux) * * Revision 1.55 1995/10/16 16:04:16 rgg * now works in Solaris 2.x and Linux 1.2.x * * Revision 1.5 08/09/1993 stempien * Something was wrong with the Linux support! * I fixed it using the provided utmp manipulation routines. * I also surrounded many varables that were not needed for Linux * in the BSD defines to reduce the memory needed to run. * I didn't touch the Sun part of the code so it should still work. * * Revision 1.4 1993/08/09 11:54:15 lipka * now works both on Linux and SunOs 4.1.3. * Brians clean-ups incorporated * * Revision 1.3 1993/08/09 07:16:42 lipka * nearly correct (running) linux-version. * Delete-Window is still a problem * * Revision 1.1 1993/08/07 18:03:53 lipka * Initial revision * * Clean-ups according to suggestions of Brian Stempien * * Bugs: * UTMP should be locked from call to utmp_end() 'til makeutent() (?). * Maybe the child should tell the parent, where the entry is made. * Tested only on Linux. * * Gives weird inital idle times. They go away after one uses the * window, but...... * ------------------------------------------------------------------------ * This version has SYSV wtmp support for (at least Linux) added by: * Piet W. Plomp, * ICCE - Institute for educational technology, * State University of Groningen, The Netherlands, * or (faster) * * all WTMP specific code is #ifdef'd WTMP_SUPPORT, which currently depends * on UTMP_SUPPORT. * This code is valid and tested on linux (libc.so.4.6.27). but is * POSIX compliant. * * My additions are tagged with an entry like "... pwp 95-12-07", where the * former are my initials and the latter the date in yy-mm-dd format. *----------------------------------------------------------------------*/ /*}}}*/ /*{{{ includes, defines */ #include "config.h" #include "feature.h" #include "misc.h" #ifndef UTMP_SUPPORT /* Dummy routines if utmp support isn't wanted */ void cleanutent (void) {} void makeutent (const char * pty, const char * hostname) {} #else /* UTMP_SUPPORT */ #include #include #ifdef HAVE_UTMPX_H # include # include # define USE_SYSV_UTMP #else # include # ifdef HAVE_SETUTENT # define USE_SYSV_UTMP # endif #endif #include #include #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_LASTLOG_H # include #endif #include /* WTMP_SUPPORT added pwp 95-12-07 */ #define WTMP_SUPPORT #include #ifdef HAVE_FCNTL_H # include #endif #ifndef UTMP_FILENAME # ifdef UTMP_FILE # define UTMP_FILENAME UTMP_FILE # else # ifdef _PATH_UTMP # define UTMP_FILENAME _PATH_UTMP # else # define UTMP_FILENAME "/etc/utmp" # endif # endif #endif #ifndef LASTLOG_FILENAME # ifdef _PATH_LASTLOG # define LASTLOG_FILENAME _PATH_LASTLOG # else # define LASTLOG_FILENAME "/usr/adm/lastlog" /* only on BSD systems */ # endif #endif #ifndef WTMP_FILENAME # ifdef WTMP_FILE # define WTMP_FILENAME WTMP_FILE # else # ifdef _PATH_WTMP # define WTMP_FILENAME _PATH_WTMP # else # ifdef SYSV # define WTMP_FILENAME "/etc/wtmp" # else # define WTMP_FILENAME "/usr/adm/wtmp" # endif # endif # endif #endif #ifndef TTYTAB_FILENAME # ifdef TTYTAB # define TTYTAB_FILENAME TTYTAB_FILENAME # else # define TTYTAB_FILENAME "/etc/ttytab" # endif #endif #ifndef USER_PROCESS # define USER_PROCESS 7 #endif #ifndef DEAD_PROCESS # define DEAD_PROCESS 8 #endif /*}}}*/ /*{{{ extern functions referenced */ /*}}}*/ /*{{{ extern variables referenced */ /*}}}*/ /*{{{ extern variables declared here */ /*}}}*/ /*{{{ local variables */ /* don't go off end of ut_id & remember if an entry has been made */ static char ut_id [5] = ""; /*}}}*/ /*{{{ local functions referenced */ /*}}}*/ /*----------------------------------------------------------------------*/ /* * HAVE_SETUTENT corresponds to SYSV-style utmp support. * Without it corresponds to using BSD utmp support. * * SYSV-style utmp support is further divided in normal utmp support * and utmpx support (Solaris 2.x) by HAVE_UTMPX_H */ #ifdef USE_SYSV_UTMP /*{{{ update_wtmp() */ /* * added by pwp 95 12 07 * called by makeutent() and cleanutent() below */ # ifdef WTMP_SUPPORT # ifdef HAVE_UTMPX_H # undef WTMP_FILENAME # define WTMP_FILENAME WTMPX_FILE # define update_wtmp updwtmpx # else /* HAVE_UTMPX_H */ static void update_wtmp (char * fname, struct utmp * putmp) { int fd, retry = 10; /* 10 attempts at locking */ struct flock lck; /* fcntl locking scheme */ if ((fd = open (fname, O_WRONLY|O_APPEND, 0)) < 0) return; lck.l_whence = SEEK_END; /* start lock at current eof */ lck.l_len = 0; /* end at ``largest possible eof'' */ lck.l_start = 0; lck.l_type = F_WRLCK; /* we want a write lock */ # ifndef EACCESS # ifdef EAGAIN # define EACCESS EAGAIN # endif # endif /* attempt lock with F_SETLK - F_SETLKW would cause a deadlock! */ while (retry--) if ((fcntl (fd, F_SETLK, &lck) < 0) && errno != EACCESS) { close (fd); return; /* failed for unknown reason: give up */ } write (fd, putmp, sizeof(struct utmp)); /* unlocking the file */ lck.l_type = F_UNLCK; fcntl (fd, F_SETLK, &lck); close (fd); } # endif /* HAVE_UTMPX_H */ # else /* WTMP_SUPPORT */ # define update_wtmp(fname,putmp) ((void)0) # endif /* WTMP_SUPPORT */ /*}}}*/ /*{{{ makeutent() - make a utmp entry */ void makeutent (const char * pty, const char * hostname) { struct passwd * pwent = getpwuid (getuid ()); #ifdef HAVE_UTMPX_H struct utmpx utmp; struct utmp utmp2; memset (&utmp, 0, sizeof(struct utmpx)); #else struct utmp utmp; memset (&utmp, 0, sizeof(struct utmp)); #endif if (!strncmp (pty, "/dev/", 5)) pty += 5; /* skip /dev/ prefix */ if (!strncmp (pty, "pty", 3) || !strncmp (pty, "tty", 3)) strncpy (ut_id, (pty+3), sizeof(ut_id)); /* bsd naming */ else { int n; if (sscanf (pty, "pts/%d", &n) == 1) sprintf (ut_id, "vt%02x", n); /* sysv naming */ else { print_error ("can't parse tty name \"%s\"", pty); ut_id [0] = '\0'; /* entry not made */ return; } } strncpy (utmp.ut_id, ut_id, sizeof(utmp.ut_id)); utmp.ut_type = DEAD_PROCESS; #ifdef HAVE_UTMPX_H getutmp (&utmp, &utmp2); getutid (&utmp2); /* position to entry in utmp file */ #else getutid (&utmp); /* position to entry in utmp file */ #endif /* set up the new entry */ strncpy (utmp.ut_id, ut_id, sizeof(utmp.ut_id)); strncpy (utmp.ut_line, pty, sizeof(utmp.ut_line)); strncpy (utmp.ut_name, pwent->pw_name, sizeof(utmp.ut_name)); strncpy (utmp.ut_user, pwent->pw_name, sizeof(utmp.ut_user)); strncpy (utmp.ut_host, hostname, sizeof(utmp.ut_host)); #ifndef linux { char * colon = strrchr (utmp.ut_host, ':'); if (colon) *colon = '\0'; } #endif utmp.ut_type = USER_PROCESS; utmp.ut_pid = getpid (); #ifdef HAVE_UTMPX_H utmp.ut_session = getsid (0); utmp.ut_xtime = time (NULL); utmp.ut_tv.tv_usec = 0; #else utmp.ut_time = time (NULL); #endif /* * write a utmp entry to the utmp file */ utmpname (UTMP_FILENAME); #ifdef HAVE_UTMPX_H getutmp (&utmp, &utmp2); pututline (&utmp2); pututxline (&utmp); #else /* if (!utmpInhibit) */ pututline (&utmp); #endif update_wtmp (WTMP_FILENAME, &utmp); endutent (); /* close the file */ } /*}}}*/ /*{{{ cleanutent() - remove a utmp entry */ /*----------------------------------------------------------------------* * there is a nice function "endutent" defined in ; * like "setutent" it takes no arguments, so I think it gets all information * from library-calls. * That's why "setutent" has to be called by the child-process with * file-descriptors 0/1 set to the pty. But that child execs to the * application-program and therefore can't clean it's own utmp-entry!(?) * The master on the other hand doesn't have the correct process-id * and io-channels... I'll do it by hand: * (what's the position of the utmp-entry, the child wrote? :-) *----------------------------------------------------------------------*/ void cleanutent (void) { #ifdef HAVE_UTMPX_H struct utmp utmp; struct utmpx utmpx; if (!ut_id[0]) return; /* entry not made */ utmpname (UTMP_FILENAME); setutent (); if (getutid (&utmp) == NULL) return; utmp.ut_type = DEAD_PROCESS; utmp.ut_time = time (NULL); pututline (&utmp); getutmpx (&utmp, &utmpx); update_wtmp (WTMP_FILENAME, &utmpx); endutent (); #else /* HAVE_UTMPX_H */ struct utmp * putmp; pid_t pid = getpid (); if (!ut_id[0]) return; /* entry not made */ utmpname (UTMP_FILENAME); setutent (); /* * The following code waw copied from the poeigl-1.20 login/init package. * Special thanks to poe for the code examples. */ while ((putmp = getutent ()) != NULL) { if (putmp->ut_pid == pid) { putmp->ut_type = DEAD_PROCESS; putmp->ut_pid = 0; putmp->ut_user[0] = '\0'; putmp->ut_time = time (NULL); pututline (putmp); update_wtmp (WTMP_FILENAME, putmp); break; } } endutent (); #endif /* HAVE_UTMPX_H */ } /*}}}*/ #else /* USE_SYSV_UTMP */ /*{{{ BSD utmp support */ static int utmp_pos = 0; /* position of utmp-stamp */ /*----------------------------------------------------------------------* * get_tslot() - grabbed from xvt-1.0 - modified by David Perry * * find ttyname in /etc/ttytab and return a slot number that can be used to * access the utmp file. Can't use ttyslot() because the tty name is not * that of fd 0. *----------------------------------------------------------------------*/ static int get_tslot (const char * ttyname) { char buf [256], name [256]; FILE *fd; if ((fd = fopen (UTMP_FILENAME, "r")) != NULL) { int i; for (i = 1; fgets (buf, sizeof(buf), fd) != NULL; i++) { if (*buf == '#' || sscanf (buf, "%s", name) != 1) continue; if (!strcmp (ttyname, name)) { fclose (fd); return i; } } fclose (fd); } return -1; } /* * write utmp entry to UTMP_FILENAME */ static int write_utmp (struct utmp * putmp) { int rval = 0; FILE * fd; if ((fd = fopen (UTMP_FILENAME, "r+")) != NULL) { utmp_pos = get_tslot (putmp->ut_line) * sizeof(struct utmp); if (utmp_pos >= 0) { fseek (fd, utmp_pos, 0); fwrite (putmp, sizeof(struct utmp), 1, fd); rval = 1; } fclose (fd); } return rval; } /* * make a utmp entry */ void makeutent (const char * pty, const char * hostname) { struct passwd * pwent = getpwuid (getuid ()); struct utmp utmp; memset (&utmp, 0, sizeof(struct utmp)); if (!strncmp (pty, "/dev/", 5)) pty += 5; /* skip /dev/ prefix */ if (!strncmp (pty, "pty", 3) || !strncmp (pty, "tty", 3)) strncpy (ut_id, (pty+3), sizeof(ut_id)); /* bsd naming */ else { print_error ("can't parse tty name \"%s\"", pty); ut_id [0] = '\0'; /* entry not made */ return; } strncpy (utmp.ut_line, pty, sizeof(utmp.ut_line)); strncpy (utmp.ut_name, pwent->pw_name, sizeof(utmp.ut_name)); strncpy (utmp.ut_host, hostname, sizeof(utmp.ut_host)); utmp.ut_time = time (NULL); if (write_utmp (&utmp) < 0) ut_id [0] = '\0'; /* entry not made */ } /* * remove a utmp entry */ void cleanutent (void) { FILE * fd; if (!ut_id [0] && (fd = fopen (UTMP_FILENAME, "r+")) != NULL) { struct utmp utmp; memset (&utmp, 0, sizeof(struct utmp)); fseek (fd, utmp_pos, 0); fwrite (&utmp, sizeof(struct utmp), 1, fd); fclose (fd); } } /*}}}*/ #endif /* USE_SYSV_UTMP */ #endif /* UTMP_SUPPORT */ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/defaults.h0000644000175000017500000000344311375434150015124 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: defaults.h * * Some wired-in defaults so we can run without external resources. * Split from feature.h so fiddling won't require a full rebuild. * * These values are only used in main.c * ---------------------------------------------------------------------- * Copyright 1995, 1996 * mj olesen Queen's Univ at Kingston * * You can do what you like with this source code provided you don't make * money from it and you include an unaltered copy of this message * (including the copyright). As usual, the author accepts no * responsibility for anything, nor does he guarantee anything whatsoever. *----------------------------------------------------------------------*/ #ifndef _DEFAULTS_H #define _DEFAULTS_H #define BORDERWIDTH 1 /* borderWidth [pixels] */ #define SAVELINES 64 /* saveLines [lines] */ #define KS_BIGFONT XK_greater #define KS_SMALLFONT XK_less #define KS_PAGEUP XK_Prior #define KS_PAGEDOWN XK_Next #define KS_PASTE XK_Insert #define KS_PRINTSCREEN XK_Print /* character class of separating chars for multiple-click selection */ #define CUTCHARS "\t \"&'()*,;<=>?@[\\]^`{|}~" /* fonts used */ #ifdef KANJI #define KFONT0 "k14" #define KFONT1 "jiskan16" #define KFONT2 "jiskan18" #define KFONT3 "jiskan24" #define KFONT4 "jiskan26" /* sizes matched to kanji fonts */ #define FONT0 "7x14" #define FONT1 "8x16" #define FONT2 "9x18" #define FONT3 "12x24" #define FONT4 "13x26" #else /* KANJI */ #define FONT0 "7x14" #define FONT1 "6x10" #define FONT2 "6x13" #define FONT3 "8x13" #define FONT4 "9x15" #endif /* KANJI */ /* the logical position of font0 in the list */ #define FONT0_IDX 2 #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/scrollbar.h0000644000175000017500000000436711375434150015306 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: scrollbar.h * * Copyright 1995,1996 * mj olesen Queen's Univ at Kingston * * You can do what you like with this source code provided you don't make * money from it and you include an unaltered copy of this message * (including the copyright). As usual, the author accepts no * responsibility for anything, nor does he guarantee anything whatsoever. *----------------------------------------------------------------------*/ #ifndef _SCROLLBAR_H #define _SCROLLBAR_H #include #include typedef struct { short beg, end; /* beg/end of slider sub-window */ short top, bot; /* top/bot of slider */ short state; /* scrollbar state */ Window win; } scrollBar_t; extern scrollBar_t scrollBar; /*{{{ prototypes */ _XFUNCPROTOBEGIN extern int scrollbar_mapping (int /* map */ ); extern int scrollbar_show (int /* update */ ); _XFUNCPROTOEND /*}}} */ /*{{{ macros */ #define scrollbar_visible() (scrollBar.state) #define scrollbar_isMotion() (scrollBar.state == 'm') #define scrollbar_isUp() (scrollBar.state == 'U') #define scrollbar_isDn() (scrollBar.state == 'D') #define scrollbar_isUpDn() isupper (scrollBar.state) #define isScrollbarWindow(w) (scrollbar_visible() && (w) == scrollBar.win) #define scrollbar_setNone() do { scrollBar.state = 1; } while (0) #define scrollbar_setMotion() do { scrollBar.state = 'm'; } while (0) #define scrollbar_setUp() do { scrollBar.state = 'U'; } while (0) #define scrollbar_setDn() do { scrollBar.state = 'D'; } while (0) #define scrollbar_upButton(y) ((y) < scrollBar.beg) #define scrollbar_dnButton(y) ((y) > scrollBar.end) #define scrollbar_above_slider(y) ((y) < scrollBar.top) #define scrollbar_below_slider(y) ((y) > scrollBar.bot) #define scrollbar_position(y) ((y) - scrollBar.beg) #define scrollbar_size() (scrollBar.end - scrollBar.beg) /*}}} */ /*{{{ defines */ #ifdef XTERM_SCROLLBAR #undef SB_WIDTH #define SB_WIDTH 14 #else #if !defined (SB_WIDTH) || (SB_WIDTH < 8) #undef SB_WIDTH #define SB_WIDTH 10 /* scrollBar width */ #endif #endif /* XTERM_SCROLLBAR */ /*}}} */ #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/main.h0000644000175000017500000001527111375434150014243 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: main.h */ /*{{{ notes: */ /*----------------------------------------------------------------------* * Copyright 1992 John Bovey, University of Kent at Canterbury. * * You can do what you like with this source code as long as you don't try * to make money out of it and you include an unaltered copy of this * message (including the copyright). * * This module has been heavily modified by R. Nation * * No additional restrictions are applied * * Additional modifications by mj olesen * No additional restrictions are applied. * * As usual, the author accepts no responsibility for anything, nor does * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ /*}}} */ #ifndef _MAIN_H #define _MAIN_H /*{{{ includes */ #include "VERSION.h" #include "config.h" #include "feature.h" #include #include #include #include /* STDC_HEADERS * don't check for these using configure, since we need them regardless. * if you don't have them -- figure a workaround. * * Sun is often reported as not being STDC_HEADERS, but it's not true * for our purposes and only generates spurious bug reports. */ #include #include #include #ifndef EXIT_SUCCESS /* missing from */ #define EXIT_SUCCESS 0 /* exit function success */ #define EXIT_FAILURE 1 /* exit function failure */ #endif #include "misc.h" /*}}} */ typedef struct { short width, height; /* window size [pixels] */ short fwidth, fheight; /* font width and height [pixels] */ short ncol, nrow; /* window size [characters] */ short focus; /* window has focus */ short saveLines; /* number of lines that fit in scrollback */ short nscrolled; /* number of line actually scrolled */ short view_start; /* scrollback view starts here */ Window parent, vt; /* parent (main) and vt100 window */ GC gc; /* GC for drawing text */ XFontStruct *font; /* main font structure */ #ifndef NO_BOLDFONT XFontStruct *boldFont; /* bold font */ #endif #ifdef KANJI XFontStruct *kanji; /* Kanji font structure */ #endif #ifdef XPM_BACKGROUND Pixmap pixmap; #ifdef XPM_BUFFERING Pixmap buf_pixmap; #endif #endif } TermWin_t; extern TermWin_t TermWin; /* gap between text and window edges (could be configurable) */ #define TermWin_internalBorder 2 #define MAX_COLS 200 #define MAX_ROWS 128 /* width of scrollBar shadow ... don't change! */ #define SHADOW 2 /* convert pixel dimensions to row/column values */ #define Pixel2Width(x) ((x) / TermWin.fwidth) #define Pixel2Col(x) Pixel2Width((x) - TermWin_internalBorder) #define Width2Pixel(n) ((n) * TermWin.fwidth) #define Col2Pixel(col) (Width2Pixel(col) + TermWin_internalBorder) #define Pixel2Height(y) ((y) / TermWin.fheight) #define Pixel2Row(y) Pixel2Height((y) - TermWin_internalBorder) #define Height2Pixel(n) ((n) * TermWin.fheight) #define Row2Pixel(row) (Height2Pixel(row) + TermWin_internalBorder) #define TermWin_TotalWidth() (TermWin.width + 2 * TermWin_internalBorder) #define TermWin_TotalHeight() (TermWin.height + 2 * TermWin_internalBorder) extern Display *Xdisplay; #define Xscreen DefaultScreen(Xdisplay) #define Xcmap DefaultColormap(Xdisplay,Xscreen) #define Xdepth DefaultDepth(Xdisplay,Xscreen) #define Xroot DefaultRootWindow(Xdisplay) #ifdef DEBUG_DEPTH #undef Xdepth #define Xdepth DEBUG_DEPTH #endif #define Opt_console (1LU<<0) #define Opt_loginShell (1LU<<1) #define Opt_iconic (1LU<<2) #define Opt_visualBell (1LU<<3) #define Opt_mapAlert (1LU<<4) #define Opt_reverseVideo (1LU<<5) #define Opt_utmpInhibit (1LU<<6) #define Opt_scrollBar (1LU<<7) #define Opt_meta8 (1LU<<8) /* place holder used for parsing command-line options */ #define Opt_Boolean (1LU<<31) extern unsigned long Options; extern const char *display_name; extern const char *rs_name; /* client instance (resource name) */ /* * XTerm escape sequences: ESC ] Ps;Pt BEL */ #define XTerm_name 0 #define XTerm_iconName 1 #define XTerm_title 2 #define XTerm_logfile 46 /* not implemented */ #define XTerm_font 50 /* * xiterm extensions of XTerm escape sequences: ESC ] Ps;Pt BEL */ #define XTerm_Pixmap 20 /* new bg pixmap */ #define XTerm_restoreFG 39 /* change default fg color */ #define XTerm_restoreBG 49 /* change default bg color */ /*----------------------------------------------------------------------*/ #define restoreFG 39 /* restore default fg color */ #define restoreBG 49 /* restore default bg color */ #define fgColor 0 #define bgColor 1 /* 0-7: black, red, green, yellow, blue, magenta, cyan, white */ #define minColor 2 #define maxColor (minColor+7) #define blackColor (minColor) /* 10-17: Bright black, red, green, yellow, blue, magenta, cyan, white */ #ifdef NO_BRIGHTCOLOR #define whiteColor (maxColor) #else #define minBright (maxColor+1) #define maxBright (minBright+7) #define whiteColor (maxBright) #endif #define NCOLORS (whiteColor+1) #ifdef NO_CURSORCOLOR #define NCURSOR 0 #else #define cursorColor (NCOLORS) #define cursorColor2 (cursorColor+1) #ifdef THAI #define cursorColorThai (cursorColor2+1) #define NCURSOR 3 #else #define NCURSOR 2 #endif #endif #ifdef NO_BOLDUNDERLINE #define NBOLDULINE 0 #else #define colorBD (NCOLORS + NCURSOR) #define colorUL (colorBD+1) #define NBOLDULINE 2 #endif #ifdef XTERM_SCROLLBAR #define NSCROLLCOLORS 0 #define NSHADOWCOLORS 0 #else #define scrollColor (NCOLORS + NCURSOR + NBOLDULINE) #define topShadowColor (scrollColor + 1) #define bottomShadowColor (scrollColor + 2) #define scrollBGColor (scrollColor + 3) #define NSCROLLCOLORS 1 #define NSHADOWCOLORS 3 #endif #define NRS_COLORS (NCOLORS + NCURSOR + NBOLDULINE + NSCROLLCOLORS) extern const char *rs_color[NRS_COLORS]; typedef unsigned long Pixel; extern Pixel PixColors[NRS_COLORS + NSHADOWCOLORS]; #define NFONTS 5 extern const char *rs_font[NFONTS]; #ifdef KANJI extern const char *rs_kfont[NFONTS]; #endif #ifndef NO_BOLDFONT extern const char *rs_boldFont; #endif #ifdef PRINTPIPE extern const char *rs_print_pipe; #endif extern const char *rs_cutchars; /*{{{ prototypes */ _XFUNCPROTOBEGIN extern void map_scrollBar (int /* map */ ); extern void xterm_seq (int /* op */ , char * /* str */ ); /* special (internal) prefix for font commands */ #define FONT_CMD '#' #define FONT_DN "#-" #define FONT_UP "#+" extern void change_font (int /* init */ , const char * /* fontname */ ); extern void set_width (unsigned short /* ncol */ ); extern void resize_window (void); _XFUNCPROTOEND /*}}} */ #endif /* whole file */ /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/src/graphics.c0000644000175000017500000000154111375434150015105 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: graphics.c * * This module is all new by Rob Nation * * * Modifications by mj olesen * and Raul Garcia Garcia *----------------------------------------------------------------------*/ /*{{{ includes, defines */ #include "main.h" #ifdef HAVE_UNISTD_H #include #endif #include #include "command.h" /* for tt_printf() */ #include "debug.h" #include "graphics.h" #include "screen.h" /* commands: * 'C' = Clear * 'F' = Fill * 'G' = Geometry * 'L' = Line * 'P' = Points * 'T' = Text * 'W' = Window */ #ifndef GRX_SCALE #define GRX_SCALE 10000 #endif /*}}} */ /* extern functions referenced */ /* extern variables referenced */ /* extern variables declared here */ xiterm+thai-1.10/src/thai.h0000644000175000017500000000101611375434150014234 0ustar thepthep#ifndef _THAI_H #define _THAI_H #include _XFUNCPROTOBEGIN typedef unsigned char text_t; typedef unsigned int rend_t; int thai_compare(text_t *d, text_t *s, rend_t *dr, rend_t *sr, int *result, int *mcol, int *mcolcount); int thai_isupper(unsigned char c); int thai_level(unsigned char c); int ThaiCol2Pixel(int c, unsigned char *start); int ThaiWidth2Pixel (int c, unsigned char *start); int ThaiPixel2Col(int x, int y); int ThaiPixel2Col2(int x, int y); _XFUNCPROTOEND #endif /* _THAI_H */ xiterm+thai-1.10/src/scrollbar.c0000644000175000017500000001555311375434150015300 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: scrollbar.c * * scrollbar routines * * Copyright 1996 * mj olesen Queen's Univ at Kingston * * You can do what you like with this source code provided you don't make * money from it and you include an unaltered copy of this message * (including the copyright). As usual, the author accepts no * responsibility for anything, nor does he guarantee anything whatsoever. *----------------------------------------------------------------------*/ /*{{{ includes */ #include "main.h" #include "scrollbar.h" /*}}}*/ /* extern functions referenced */ /* extern variables referenced */ /*{{{ extern variables declared here */ scrollBar_t scrollBar; /*}}}*/ /*----------------------------------------------------------------------* */ static GC scrollbarGC; #ifdef XTERM_SCROLLBAR /* bitmap scrollbar */ # define sb_width 14 # define sb_height 2 static char sb_bits[] = { 0xaa, 0x0a, 0x54, 0x15}; # if (SB_WIDTH != sb_width) Error, check scrollbar width # endif #else /* XTERM_SCROLLBAR */ static GC topShadowGC, botShadowGC; /* draw triangular up button with a shadow of 2 pixels */ static void Draw_up_button (int x, int y, int state) { const unsigned int sz = (SB_WIDTH), sz2 = (SB_WIDTH / 2); XPoint pt [3]; GC top, bot; switch (state) { case +1: top = topShadowGC; bot = botShadowGC; break; case -1: top = botShadowGC; bot = topShadowGC; break; case 0: top = bot = scrollbarGC; break; } /* fill triangle */ pt[0].x = x; pt[0].y = y + sz - 1; pt[1].x = x + sz - 1; pt[1].y = y + sz - 1; pt[2].x = x + sz2; pt[2].y = y; XFillPolygon (Xdisplay, scrollBar.win, scrollbarGC, pt, 3, Convex, CoordModeOrigin); /* draw base */ XDrawLine (Xdisplay, scrollBar.win, bot, pt[0].x, pt[0].y, pt[1].x, pt[1].y); /* draw shadow */ pt[1].x = x + sz2 - 1; pt[1].y = y; XDrawLine (Xdisplay, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); # if (SHADOW > 1) /* doubled */ pt[0].x++; pt[0].y--; pt[1].y++; XDrawLine (Xdisplay, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); # endif /* draw shadow */ pt[0].x = x + sz2; pt[0].y = y; pt[1].x = x + sz - 1; pt[1].y = y + sz - 1; XDrawLine (Xdisplay, scrollBar.win, bot, pt[0].x, pt[0].y, pt[1].x, pt[1].y); # if (SHADOW > 1) /* doubled */ pt[0].y++; pt[1].x--; pt[1].y--; XDrawLine (Xdisplay, scrollBar.win, bot, pt[0].x, pt[0].y, pt[1].x, pt[1].y); # endif } /* draw triangular down button with a shadow of 2 pixels */ static void Draw_dn_button (int x, int y, int state) { const unsigned int sz = (SB_WIDTH), sz2 = (SB_WIDTH / 2); XPoint pt [3]; GC top, bot; switch (state) { case +1: top = topShadowGC; bot = botShadowGC; break; case -1: top = botShadowGC; bot = topShadowGC; break; case 0: top = bot = scrollbarGC; break; } /* fill triangle */ pt[0].x = x; pt[0].y = y; pt[1].x = x + sz - 1; pt[1].y = y; pt[2].x = x + sz2; pt[2].y = y + sz; XFillPolygon (Xdisplay, scrollBar.win, scrollbarGC, pt, 3, Convex, CoordModeOrigin); /* draw base */ XDrawLine (Xdisplay, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); /* draw shadow */ pt[1].x = x + sz2 - 1; pt[1].y = y + sz - 1; XDrawLine (Xdisplay, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); # if (SHADOW > 1) /* doubled */ pt[0].x++; pt[0].y++; pt[1].y--; XDrawLine (Xdisplay, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); # endif /* draw shadow */ pt[0].x = x + sz2; pt[0].y = y + sz - 1; pt[1].x = x + sz - 1; pt[1].y = y; XDrawLine (Xdisplay, scrollBar.win, bot, pt[0].x, pt[0].y, pt[1].x, pt[1].y); # if (SHADOW > 1) /* doubled */ pt[0].y--; pt[1].x--; pt[1].y++; XDrawLine (Xdisplay, scrollBar.win, bot, pt[0].x, pt[0].y, pt[1].x, pt[1].y); # endif } #endif /* XTERM_SCROLLBAR */ int scrollbar_mapping (int map) { int change = 0; if (map && !scrollbar_visible ()) { scrollBar.state = 1; XMapWindow (Xdisplay, scrollBar.win); change = 1; } else if (!map && scrollbar_visible ()) { scrollBar.state = 0; XUnmapWindow (Xdisplay, scrollBar.win); change = 1; } return change; } int scrollbar_show (int update) { static short last_top, last_bot; /* old (drawn) values */ if (!scrollbar_visible ()) return 0; if (scrollbarGC == None) { XGCValues gcvalue; #ifdef XTERM_SCROLLBAR gcvalue.stipple = XCreateBitmapFromData (Xdisplay, scrollBar.win, sb_bits, sb_width, sb_height); if (!gcvalue.stipple) { print_error ("can't create bitmap"); exit (EXIT_FAILURE); } gcvalue.fill_style = FillOpaqueStippled; gcvalue.foreground = PixColors [fgColor]; gcvalue.background = PixColors [bgColor]; scrollbarGC = XCreateGC (Xdisplay, scrollBar.win, GCForeground|GCBackground | GCFillStyle|GCStipple, &gcvalue); #else /* XTERM_SCROLLBAR */ gcvalue.foreground = (Xdepth <= 2 ? PixColors [fgColor] : PixColors [scrollColor]); scrollbarGC = XCreateGC (Xdisplay, scrollBar.win, GCForeground, &gcvalue); gcvalue.foreground = PixColors [topShadowColor]; topShadowGC = XCreateGC (Xdisplay, scrollBar.win, GCForeground, &gcvalue); gcvalue.foreground = PixColors [bottomShadowColor]; botShadowGC = XCreateGC (Xdisplay, scrollBar.win, GCForeground, &gcvalue); #endif /* XTERM_SCROLLBAR */ } if (update) { int top = (TermWin.nscrolled - TermWin.view_start); int bot = top + (TermWin.nrow-1); int len = (TermWin.nscrolled + (TermWin.nrow-1)); scrollBar.top = (scrollBar.beg + (top * scrollbar_size ()) / len); scrollBar.bot = (scrollBar.beg + (bot * scrollbar_size ()) / len); /* no change */ if ((scrollBar.top == last_top) && (scrollBar.bot == last_bot)) return 0; } /* instead of XClearWindow (Xdisplay, scrollBar.win); */ if (last_top < scrollBar.top) XClearArea (Xdisplay, scrollBar.win, 0, last_top, SB_WIDTH, (scrollBar.top - last_top), False); if (scrollBar.bot < last_bot) XClearArea (Xdisplay, scrollBar.win, 0, scrollBar.bot, SB_WIDTH, (last_bot - scrollBar.bot), False); last_top = scrollBar.top; last_bot = scrollBar.bot; /* scrollbar slider */ XFillRectangle (Xdisplay, scrollBar.win, scrollbarGC, 0, scrollBar.top, SB_WIDTH, (scrollBar.bot - scrollBar.top)); #ifndef XTERM_SCROLLBAR /* shadow for scrollbar slider */ Draw_Shadow (scrollBar.win, topShadowGC, botShadowGC, 0, scrollBar.top, SB_WIDTH, (scrollBar.bot - scrollBar.top)); /* * Redraw scrollbar arrows */ Draw_up_button (0, 0, (scrollbar_isUp() ? -1 : +1)); Draw_dn_button (0, (scrollBar.end + 1), (scrollbar_isDn() ? -1 : +1)); #endif /* XTERM_SCROLLBAR */ return 1; } /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/xdefaults.c0000644000175000017500000005321411375434150015310 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: xdefaults.c * * get resources from ~/.Xdefaults or ~/.Xresources with the memory-saving * default or with XGetDefault() (#define USE_XGETDEFAULT) * * This module is all new by Rob Nation * * You can do what you like with this source code provided you don't make * money from it and you include an unaltered copy of this message * (including the copyright). As usual, the author accepts no * responsibility for anything, nor does he guarantee anything whatsoever. * ---------------------------------------------------------------------* * Extensive modifications by mj olesen * No additional restrictions. * * Coding style: * resource strings are indicated by an `rs_' prefix followed by * the resource name. * eg, `rs_saveLines' is the resource string corresponding to * the `saveLines' resource *----------------------------------------------------------------------*/ /*{{{ includes */ #include "main.h" #include "debug.h" #include "defaults.h" #include "grkelot.h" #include "thaikb.h" #include "xdefaults.h" /*}}}*/ /* #define DEBUG_RESOURCES */ /* extern functions referenced */ /* extern variables referenced */ /*{{{ extern variables declared here */ const char * rs_title = NULL; /* title name for window */ const char * rs_iconName = NULL; /* icon name for window */ const char * rs_geometry = NULL; /* window geometry */ const char * rs_saveLines = NULL; /* scrollback buffer [lines] */ #ifdef KEYSYM_RESOURCE const unsigned char * KeySym_map [256]; /* probably mostly empty */ #endif #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) /* recognized when combined with HOTKEY */ KeySym ks_bigfont = XK_greater; KeySym ks_smallfont = XK_less; #endif #ifdef XPM_BACKGROUND const char * rs_backgroundPixmap = NULL; const char * rs_path = NULL; #endif /*}}}*/ /* local functions referenced */ /*{{{ local variables */ static const char * rs_loginShell = NULL; static const char * rs_utmpInhibit = NULL; static const char * rs_scrollBar = NULL; #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) static const char * rs_bigfont_key = NULL; static const char * rs_smallfont_key = NULL; #endif #ifndef NO_MAPALERT # ifdef MAPALERT_OPTION static const char * rs_mapAlert = NULL; # endif #endif static const char * rs_visualBell = NULL; static const char * rs_reverseVideo = NULL; #ifdef META8_OPTION static const char * rs_meta8 = NULL; #endif #ifdef KANJI static const char * rs_kanji_encoding = NULL; #endif #ifdef GREEK_SUPPORT static const char * rs_greek_keyboard = NULL; #endif #ifdef THAI static const char * rs_thai_space = NULL; static const char * rs_thai_keyboard = NULL; /* Theppitak 1999-07-22 */ extern int thai_spcount; # ifndef NO_XLOCALE extern const char * rs_inputMethod; /* Theppitak 2000-11-18 */ # endif #endif /*}}}*/ /*{{{ monolithic option/resource structure: */ /* * `string' options MUST have a usage argument * `switch' and `boolean' options have no argument * * if there's no desc(ription), it won't appear in usage() */ static const struct { unsigned long flag; const char * * dp; /* data pointer */ const char * const kw; /* keyword */ const char * const opt; /* option */ const char * const arg; /* argument */ const char * const desc; /* description */ } optList[] = { /* INFO() - descriptive information only */ #define INFO(opt,arg,desc) {0, NULL, NULL, opt, arg, desc} /* STRG() - command-line option, with/without resource */ #define STRG(p,kw,opt,arg,desc) {0, &p, kw, opt, arg, desc} /* RSTRG() - resource/long-option */ #define RSTRG(p,kw,arg) {0, &p, kw, NULL, arg, NULL} /* BOOL() - regular boolean `-/+' flag */ #define BOOL(p,kw,opt,flag,desc) {(Opt_Boolean|flag), &p, kw, opt, NULL, desc} /* SWCH() - `-' flag */ #define SWCH(opt,flag,desc) {(flag), NULL, NULL, opt, NULL, desc} /* convenient macros */ #define optList_strlen(i) (optList[i].flag ? 0 : (optList[i].arg ? strlen (optList[i].arg) : 1)) #define optList_isBool(i) (optList[i].flag & Opt_Boolean) #define optList_size() (sizeof(optList)/sizeof(optList[0])) STRG( display_name, NULL, "display", "displayname", "X server to contact" ), STRG( rs_geometry, "geometry", "geometry", "geom", "size (in characters) and position" ), STRG( display_name, NULL, "d", NULL, NULL ), /* short form */ STRG( rs_geometry, NULL, "g", NULL, NULL ), /* short form */ BOOL( rs_reverseVideo, "reverseVideo", "rv", Opt_reverseVideo, "reverse video" ), STRG( rs_color [bgColor], "background", "bg", "color", "background color" ), STRG( rs_color [fgColor], "foreground", "fg", "color", "foreground color" ), /* colors: command-line long-option = resource name */ RSTRG( rs_color [minColor+0], "color0", "color" ), RSTRG( rs_color [minColor+1], "color1", "color" ), RSTRG( rs_color [minColor+2], "color2", "color" ), RSTRG( rs_color [minColor+3], "color3", "color" ), RSTRG( rs_color [minColor+4], "color4", "color" ), RSTRG( rs_color [minColor+5], "color5", "color" ), RSTRG( rs_color [minColor+6], "color6", "color" ), RSTRG( rs_color [minColor+7], "color7", "color" ), #ifndef NO_BRIGHTCOLOR RSTRG( rs_color [minBright+0], "color8", "color" ), RSTRG( rs_color [minBright+1], "color9", "color" ), RSTRG( rs_color [minBright+2], "color10", "color" ), RSTRG( rs_color [minBright+3], "color11", "color" ), RSTRG( rs_color [minBright+4], "color12", "color" ), RSTRG( rs_color [minBright+5], "color13", "color" ), RSTRG( rs_color [minBright+6], "color14", "color" ), RSTRG( rs_color [minBright+7], "color15", "color" ), #endif /* NO_BRIGHTCOLOR */ #ifndef NO_BOLDUNDERLINE RSTRG( rs_color [colorBD], "colorBD", "color" ), RSTRG( rs_color [colorUL], "colorUL", "color" ), #endif /* NO_BOLDUNDERLINE */ #ifndef XTERM_SCROLLBAR RSTRG( rs_color [scrollColor], "scrollColor", "color"), #endif /* XTERM_SCROLLBAR */ #ifdef XPM_BACKGROUND STRG( rs_backgroundPixmap, "backgroundPixmap", "pixmap", "file[;geom]", "background pixmap [scaling optional]" ), RSTRG( rs_path, "path", "search path" ), #endif /* XPM_BACKGROUND */ #ifndef NO_BOLDFONT STRG( rs_boldFont, "boldFont", "fb", "fontname", "bold text font" ), #endif STRG( rs_font [0], "font", "fn", "fontname", "normal text font" ), /* fonts: command-line option = resource name */ RSTRG( rs_font [1], "font1", "fontname" ), RSTRG( rs_font [2], "font2", "fontname" ), RSTRG( rs_font [3], "font3", "fontname" ), RSTRG( rs_font [4], "font4", "fontname" ), #ifdef KANJI STRG( rs_kfont [0], "kfont", "fk", "fontname", "kanji font" ), /* fonts: command-line option = resource name */ RSTRG( rs_kfont [1], "kfont1", "fontname" ), RSTRG( rs_kfont [2], "kfont2", "fontname" ), RSTRG( rs_kfont [3], "kfont3", "fontname" ), RSTRG( rs_kfont [4], "kfont4", "fontname" ), STRG( rs_kanji_encoding, "kanji_encoding", "km", "mode", "kanji encoding; mode = eucj | sjis" ), #endif /* KANJI */ #ifdef GREEK_SUPPORT STRG( rs_greek_keyboard, "greek_keyboard", "grk", "mode", "greek keyboard mapping; mode = iso | ibm" ), #endif #ifdef THAI STRG( rs_thai_space, "thai_space", "tspace", "int", "Space count to trigger compensation"), /* Theppitak 1999-07-22 */ STRG( rs_thai_keyboard, "thai_keyboard", "tkb", "mode", "Thai keyboard mapping; mode = tis | ket" ), # ifndef NO_XLOCALE /* Theppitak 2000-11-18 */ STRG( rs_inputMethod, "thai_im", "tim", "mode", "Thai input method; mode = BasicCheck | Strict | Passthrough" ), # endif #endif SWCH( "iconic", Opt_iconic, "start iconic" ), SWCH( "ic", Opt_iconic, NULL ), /* short form */ STRG( rs_name, NULL, "name", "string", "client instance, icon, and title strings" ), STRG( rs_title, "title", "title", "string", "title name for window" ), STRG( rs_title, NULL, "T", NULL, NULL ), /* short form */ STRG( rs_iconName, "iconName", "n", "string", "icon name for window" ), #ifndef NO_CURSORCOLOR STRG( rs_color [cursorColor], "cursorColor", "cr", "color", "cursor color" ), /* command-line option = resource name */ RSTRG( rs_color [cursorColor2], "cursorColor2", "color" ), #endif /* NO_CURSORCOLOR */ #ifdef THAI RSTRG( rs_color [cursorColorThai], "cursorColorThai", "color" ), #endif BOOL( rs_loginShell, "loginShell", "ls", Opt_loginShell, "login shell" ), BOOL( rs_scrollBar, "scrollBar", "sb", Opt_scrollBar, "scrollbar" ), STRG( rs_saveLines, "saveLines", "sl", "number", "number of scrolled lines to save" ), BOOL( rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit, "utmp inhibit" ), BOOL( rs_visualBell, "visualBell", "vb", Opt_visualBell, "visual bell" ), #ifndef NO_MAPALERT # ifdef MAPALERT_OPTION BOOL( rs_mapAlert, "mapAlert", NULL, Opt_mapAlert, NULL ), # endif #endif #ifdef META8_OPTION BOOL( rs_meta8, "meta8", NULL, Opt_meta8, NULL ), #endif #ifdef PRINTPIPE RSTRG( rs_print_pipe, "print-pipe", "string" ), #endif #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) RSTRG( rs_bigfont_key, "bigfont_key", "keysym" ), RSTRG( rs_smallfont_key, "smallfont_key", "keysym" ), #endif #ifdef CUTCHAR_RESOURCE RSTRG( rs_cutchars, "cutchars", "string" ), #endif /* CUTCHAR_RESOURCE */ SWCH( "C", Opt_console, "intercept console messages" ), INFO( "e", "command arg ...", "command to execute" ) }; #undef INFO #undef STRG #undef RSTRG #undef SWCH #undef BOOL /*}}}*/ /*{{{ usage: */ /*----------------------------------------------------------------------*/ static void usage (int type) { int i, col; #define INDENT 30 fprintf (stderr, "\nUsage v"VERSION":\n " APL_NAME); switch (type) { case 0: /* brief listing */ fprintf (stderr, " [-help]\n "); col = 3; for (i = 0; i < optList_size (); i++) { if (optList[i].desc != NULL) { int len = 2; if (!optList_isBool (i)) { len = optList_strlen (i); if (len > 0) len++; /* account for space */ } len += 4 + strlen (optList[i].opt); col += len; if (col > 79) /* assume regular width */ { fprintf (stderr, "\n "); col = 3 + len; } fprintf (stderr, " [-"); if (optList_isBool (i)) fprintf (stderr, "/+"); fprintf (stderr, "%s", optList[i].opt); if (optList_strlen (i)) fprintf (stderr, " %s]", optList[i].arg); else fprintf (stderr, "]"); } } fprintf (stderr, "\n\n"); break; case 1: /* full command-line listing */ fprintf (stderr, " [options] [-e command args]\n\n" "where options include:\n"); for (i = 0; i < optList_size (); i++) if (optList[i].desc != NULL) fprintf (stderr, " %s%s %-*s%s%s\n", (optList_isBool (i) ? "-/+" : "-"), optList[i].opt, (int)(INDENT - strlen (optList[i].opt) + (optList_isBool (i) ? 0 : 2)), (optList[i].arg ? optList[i].arg : ""), (optList_isBool (i) ? "turn on/off " : ""), optList[i].desc); fprintf (stderr, "\n --help to list long-options\n\n"); break; case 2: /* full resource listing */ fprintf (stderr, " [options] [-e command args]\n\n" "where resources (long-options) include:\n"); for (i = 0; i < optList_size (); i++) if (optList[i].kw != NULL) fprintf (stderr, " %s: %*s\n", optList[i].kw, (int)(INDENT - strlen (optList[i].kw)), (optList_isBool (i) ? "boolean" : optList[i].arg)); #ifdef KEYSYM_RESOURCE fprintf (stderr, " " "keysym.sym" ": %*s\n", (int)(INDENT - strlen ("keysym.sym")), "keysym"); #endif fprintf (stderr, "\n -help to list options\n\n"); break; } exit (EXIT_FAILURE); } /*}}}*/ /*{{{ get command-line options before getting resources */ void get_options (int argc, char * argv[]) { int i, bad_option = 0; static const char * const On = "ON"; static const char * const Off = "OFF"; for (i = 1; i < argc; i++) { int entry, longopt = 0; const char * flag; char * opt = argv [i]; #ifdef DEBUG_RESOURCES fprintf (stderr, "argv[%d] = %s: ", i, argv[i]); #endif if (*opt == '-') { flag = On; if (*++opt == '-') longopt = *opt++; /* long option */ } else if (*opt == '+') { flag = Off; if (*++opt == '+') longopt = *opt++; /* long option */ } else { bad_option = 1; print_error ("bad option \"%s\"", opt); continue; } if (!strcmp (opt, "help")) usage (longopt ? 2 : 1); /* feature: always try to match long-options */ for (entry = 0; entry < optList_size (); entry++) if ((optList[entry].kw && !strcmp (opt, optList[entry].kw)) || (!longopt && optList[entry].opt && !strcmp (opt, optList[entry].opt))) break; if (entry < optList_size ()) { if (optList_strlen (entry)) /* string value */ { char * str = argv [++i]; #ifdef DEBUG_RESOURCES fprintf (stderr, "string (%s,%s) = ", optList[entry].opt ? optList[entry].opt : "nil", optList[entry].kw ? optList[entry].kw : "nil"); #endif if (flag == On && str && optList [entry].dp) { #ifdef DEBUG_RESOURCES fprintf (stderr, "\"%s\"\n", str); #endif *(optList[entry].dp) = str; /* special cases */ if (!strcmp (opt, "n")) { if (!rs_title) rs_title = str; } else if (!strcmp (opt, "name")) { if (!rs_title) rs_title = str; if (!rs_iconName) rs_iconName = str; } } #ifdef DEBUG_RESOURCES else fprintf (stderr, "???\n"); #endif } else /* boolean value */ { #ifdef DEBUG_RESOURCES fprintf (stderr, "boolean (%s,%s) = %s\n", optList[entry].opt, optList[entry].kw, flag); #endif if (flag == On) Options |= (optList[entry].flag); else Options &= ~(optList[entry].flag); if (optList [entry].dp) *(optList [entry].dp) = flag; } } else { /* various old-style options, just ignore * Obsolete since about Jan 96, * so they can probably eventually be removed */ const char * msg = "bad"; if (longopt) { opt--; bad_option = 1; } else if (!strcmp (opt, "7") || !strcmp (opt, "8") || !strcmp (opt, "fat") || !strcmp (opt, "thin") #ifdef GREEK_SUPPORT /* these obsolete 12 May 1996 (v2.17) */ || !strcmp (opt, "grk4") || !strcmp (opt, "grk9") #endif ) msg = "obsolete"; else bad_option = 1; print_error ("%s option \"%s\"", msg, --opt); } } if (bad_option) usage (0); } /*}}}*/ #ifndef NO_RESOURCES /*----------------------------------------------------------------------*/ /*{{{ string functions */ /* * a replacement for strcasecmp() to avoid linking an entire library */ static int my_strcasecmp (const char * s1, const char * s2) { for (/*nil*/; (*s1 && *s2); s1++, s2++) { register int c1 = toupper (*s1); register int c2 = toupper (*s2); if (c1 != c2) return (c1 - c2); } return (int) (*s1 - *s2); } /*}}}*/ #ifndef USE_XGETDEFAULT /*{{{ more string functions */ /* * remove leading/trailing space and strip-off leading/trailing quotes */ static char * trim_string (char * str) { if (str && *str) { int n; while (*str && isspace (*str)) str++; n = strlen (str) - 1; while (n > 0 && isspace (str [n])) n--; str [n+1] = '\0'; /* strip leading/trailing quotes */ if (str [0] == '"') { str++; n--; if (str [n] == '"') str [n--] = '\0'; } if (n < 0) str = NULL; } return str; } /*}}}*/ /*{{{ get_xdefaults() */ /* * the matching algorithm used for memory-save fake resources */ static void get_xdefaults (FILE * stream, const char * name) { unsigned int len; char * str, buffer [256]; if (stream == NULL) return; len = strlen (name); while ((str = fgets (buffer, sizeof(buffer), stream)) != NULL) { unsigned int entry, n; while (*str && isspace (*str)) str++; /* leading whitespace */ if ((str [len] != '*' && str [len] != '.') || (len && strncmp (str, name, len))) continue; str += (len + 1); /* skip `name*' or `name.' */ /* * look for something like this (XK_Delete) * xiterm*keysym.0xFFFF: "\177" */ # ifdef KEYSYM_RESOURCE n = strlen ("keysym"); if (str [n] == '.' && !strncmp (str, "keysym", n)) { int sym; str += (n + 1); /* skip `keysym.' */ /* some scanf() have trouble with a 0x prefix */ if (str [0] == '0' && toupper (str [1]) == 'X') str += 2; if (sscanf (str, "%x:", &sym) == 1) { /* cue to ':', it's there since sscanf() worked */ str = strchr (str, ':'); str = trim_string (str + 1); n = escaped_string (str); /* only do extended keys */ if (sym >= 0xFF00) sym -= 0xFF00; if (sym < 0 || sym > 0xFF) continue; if (n >= 256) n = 255; if (n && KeySym_map [sym] == NULL) /* not already set */ { char * p = MALLOC ((n+1) * sizeof(char), "keysym"); p [0] = n; memcpy (p+1, str, n); KeySym_map [sym] = p; } } } else # undef KEYSYM_kw # endif /* KEYSYM_RESOURCE */ for (entry = 0; entry < optList_size (); entry++) { const char * const kw = optList[entry].kw; if (kw == NULL) continue; n = strlen (kw); if (str [n] == ':' && !strncmp (str, kw, n)) { /* skip `keyword:' */ str = trim_string (str + n + 1); n = (str ? strlen (str) : 0); if (n && *(optList[entry].dp) == NULL) { /* not already set */ char * p = MALLOC ((n+1) * sizeof(char), kw); strcpy (p, str); *(optList[entry].dp) = p; if (optList_isBool (entry)) { if (!my_strcasecmp (str, "TRUE")) Options |= (optList[entry].flag); else Options &= ~(optList[entry].flag); } } break; } } } rewind (stream); } /*}}}*/ #endif /* ! USE_XGETDEFAULT */ #endif /* NO_RESOURCES */ /*{{{ read the resources files */ /* * using XGetDefault() or the hand-rolled replacement */ void extract_resources (Display * display, const char * name) { #ifndef NO_RESOURCES #ifdef USE_XGETDEFAULT /* * get resources using the X library function */ int entry; for (entry = 0; entry < optList_size (); entry++) { char * p; const char * kw = optList[entry].kw; if (kw == NULL || *(optList[entry].dp) != NULL) continue; /* previously set */ if ((p = XGetDefault (display, name, kw)) != NULL || (p = XGetDefault (display, APL_SUBCLASS, kw)) != NULL || (p = XGetDefault (display, APL_CLASS, kw)) != NULL) { *optList[entry].dp = p; if (optList_isBool (entry)) { if (!my_strcasecmp (p, "TRUE")) Options |= (optList[entry].flag); else Options &= ~(optList[entry].flag); } } } #else /* USE_XGETDEFAULT */ /* get resources the hard way, but save lots of memory */ const char * fname[] = { ".Xdefaults", ".Xresources" }; FILE * fd = NULL; char * home; if ((home = getenv ("HOME")) != NULL) { int i, len = strlen (home) + 2; char * f = NULL; for (i = 0; i < (sizeof(fname)/sizeof(fname[0])); i++) { f = REALLOC (f, (len + strlen (fname[i])) * sizeof(char), fname [i]); sprintf (f, "%s/%s", home, fname [i]); if ((fd = fopen (f, "r")) != NULL) break; } FREE (f, "get_Xdefaults", "fname"); } /* * The normal order to match resources is the following: * @ global resources (partial match, ~/.Xdefaults) * @ application file resources (XAPPLOADDIR/RXvt) * @ class resources (~/.Xdefaults) * @ private resources (~/.Xdefaults) * * However, for the hand-rolled resources, the matching algorithm * checks if a resource string value has already been allocated * and won't overwrite it with (in this case) a less specific * resource value. * * This avoids multiple allocation. Also, when we've called this * routine command-line string options have already been applied so we * needn't to allocate for those resources. * * So, search in resources from most to least specific. * * Also, use a special sub-class so that we can use either or both of * "XTerm" and "RXvt" as class names. */ get_xdefaults (fd, name); get_xdefaults (fd, APL_SUBCLASS); #ifdef XAPPLOADDIR { FILE * ad = fopen (XAPPLOADDIR "/" APL_SUBCLASS, "r"); if (ad != NULL) { get_xdefaults (ad, ""); fclose (ad); } } #endif /* XAPPLOADDIR */ get_xdefaults (fd, APL_CLASS); get_xdefaults (fd, ""); /* partial match */ if (fd != NULL) fclose (fd); #endif /* USE_XGETDEFAULT */ #endif /* NO_RESOURCES */ /* * even without resources, at least do this setup for command-line * options and command-line long options */ #ifdef KANJI set_kanji_encoding (rs_kanji_encoding); #endif #ifdef GREEK_SUPPORT /* this could be a function in grkelot.c */ /* void set_greek_keyboard (const char * str); */ if (rs_greek_keyboard) { if (!strcmp (rs_greek_keyboard, "iso")) greek_setmode (GREEK_ELOT928); /* former -grk9 */ else if (!strcmp (rs_greek_keyboard, "ibm")) greek_setmode (GREEK_IBM437); /* former -grk4 */ } #endif /* GREEK_SUPPORT */ #ifdef THAI if(rs_thai_space != NULL) sscanf(rs_thai_space,"%d",&thai_spcount); /* Theppitak 1999-07-22 */ if (rs_thai_keyboard != NULL) { if (strcmp(rs_thai_keyboard, "tis") == 0) { thai_set_keyboard(THAI_KB_TIS820_2538); } else if (strcmp(rs_thai_keyboard, "ket") == 0) { thai_set_keyboard(THAI_KB_KETMANEE); } } #endif #define to_keysym(pks,str) do { KeySym sym;\ if (str && ((sym = XStringToKeysym(str)) != 0)) *pks = sym; } while (0) #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) to_keysym (&ks_bigfont, rs_bigfont_key); to_keysym (&ks_smallfont, rs_smallfont_key); #endif #undef to_keysym } /*}}}*/ /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/src/misc.c0000644000175000017500000001276611375434150014253 0ustar thepthep/*--------------------------------*-C-*---------------------------------* * File: misc.c * * miscellaneous service routines * * Copyright 1996 * mj olesen Queen's Univ at Kingston * * You can do what you like with this source code provided you don't make * money from it and you include an unaltered copy of this message * (including the copyright). As usual, the author accepts no * responsibility for anything, nor does he guarantee anything whatsoever. *----------------------------------------------------------------------*/ /*{{{ includes */ #include #include #include #include #include "main.h" #include "misc.h" /*}}} */ /*----------------------------------------------------------------------*/ const char * my_basename (const char *str) { const char *base = strrchr (str, '/'); return (base ? base + 1 : str); } /* * Print an error message */ void print_error (const char *fmt,...) { va_list arg_ptr; va_start (arg_ptr, fmt); fprintf (stderr, APL_NAME ": "); vfprintf (stderr, fmt, arg_ptr); fprintf (stderr, "\n"); va_end (arg_ptr); } /* * in-place interpretation of string: * backslash-escaped strings: * Emacs-style Ctrl chars: ^@, ^?, ^A, etc. * * return the converted string length */ int escaped_string (char *str) { register char *p = str; int i = 0, len, meta_x = 0; /* use 'i' to increment through destination and p through source */ if (str == NULL || (len = strlen (str)) == 0) return 0; /* Emacs convenience, replace leading `M-..' with `\E..' */ if (!strncmp (p, "M-", 2)) { str[i++] = '\033'; /* destination */ p += 2; len--; if (toupper (*p) == 'X') { meta_x = 1; str[i++] = 'x'; /* destination */ p++; while (isspace (*p)) { p++; len--; } } } for ( /*nil */ ; i < len; i++) { register char ch = *p++; if (ch == '\\') { ch = *p; if (ch >= '0' && ch <= '7') /* octal */ { int j, num = 0; for (j = 0; j < 3 && (ch >= '0' && ch <= '7'); j++) { num = num * 010 + (ch - '0'); p++; len--; ch = *p; } ch = (unsigned char) num; } else { p++; len--; switch (ch) { case 'a': ch = 007; break; /* bell */ case 'b': ch = '\b'; break; /* backspace */ case 'E': case 'e': ch = 033; break; /* escape */ case 'n': ch = '\n'; break; /* newline */ case 'r': ch = '\r'; break; /* carriage-return */ case 't': ch = '\t'; break; /* tab */ } } } else if (ch == '^') { ch = *p; p++; len--; ch = toupper (ch); ch = (ch == '?' ? 127 : (ch - '@')); } str[i] = ch; } /* add trailing carriage-return for `M-xcommand' */ if (meta_x && str[len - 1] != '\r') str[len++] = '\r'; str[len] = '\0'; return len; } /*----------------------------------------------------------------------* * miscellaneous drawing routines */ /* * draw bottomShadow/highlight along top/left sides of the window */ static void Draw_tl (Window win, GC gc, int x, int y, int w, int h) { int shadow = SHADOW; if (w == 0 || h == 0) shadow = 1; w += (x - 1); h += (y - 1); for ( /*nil */ ; shadow > 0; shadow--, x++, y++, w--, h--) { XDrawLine (Xdisplay, win, gc, x, y, w, y); XDrawLine (Xdisplay, win, gc, x, y, x, h); } } /* * draw bottomShadow/highlight along the bottom/right sides of the window */ static void Draw_br (Window win, GC gc, int x, int y, int w, int h) { int shadow = SHADOW; if (w == 0 || h == 0) shadow = 1; w += (x - 1); h += (y - 1); x++; y++; for ( /*nil */ ; shadow > 0; shadow--, x++, y++, w--, h--) { XDrawLine (Xdisplay, win, gc, w, h, w, y); XDrawLine (Xdisplay, win, gc, w, h, x, h); } } void Draw_Shadow (Window win, GC topShadow, GC botShadow, int x, int y, int w, int h) { Draw_tl (win, topShadow, x, y, w, h); Draw_br (win, botShadow, x, y, w, h); } /* button shapes */ void Draw_Triangle (Window win, GC topShadow, GC botShadow, int x, int y, int w, int type) { switch (type) { case 'r': /* right triangle */ XDrawLine (Xdisplay, win, topShadow, x, y, x, y + w); XDrawLine (Xdisplay, win, topShadow, x, y, x + w, y + w / 2); XDrawLine (Xdisplay, win, botShadow, x, y + w, x + w, y + w / 2); break; case 'l': /* right triangle */ XDrawLine (Xdisplay, win, botShadow, x + w, y + w, x + w, y); XDrawLine (Xdisplay, win, botShadow, x + w, y + w, x, y + w / 2); XDrawLine (Xdisplay, win, topShadow, x, y + w / 2, x + w, y); break; case 'd': /* down triangle */ XDrawLine (Xdisplay, win, topShadow, x, y, x + w / 2, y + w); XDrawLine (Xdisplay, win, topShadow, x, y, x + w, y); XDrawLine (Xdisplay, win, botShadow, x + w, y, x + w / 2, y + w); break; case 'u': /* up triangle */ XDrawLine (Xdisplay, win, botShadow, x + w, y + w, x + w / 2, y); XDrawLine (Xdisplay, win, botShadow, x + w, y + w, x, y + w); XDrawLine (Xdisplay, win, topShadow, x, y + w, x + w / 2, y); break; #if 0 case 's': /* square */ XDrawLine (Xdisplay, win, topShadow, x + w, y, x, y); XDrawLine (Xdisplay, win, topShadow, x, y, x, y + w); XDrawLine (Xdisplay, win, botShadow, x, y + w, x + w, y + w); XDrawLine (Xdisplay, win, botShadow, x + w, y + w, x + w, y); break; #endif } } /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/Makefile.in0000644000175000017500000000420011701030420014373 0ustar thepthep# ./Makefile.in -*- Makefile -*- @MCOMMON@ basedir = $(srcdir) etcdir = $(basedir)/etc thisdir = ./ first_rule: all dummy: subdirs = src data doc DIST = INSTALL Make.common.in Makefile.in config.h.in configure\ configure.in install.sh #------------------------------------------------------------------------- all allbin alldoc tags clean: @for I in ${subdirs}; do ${MAKE} -C $$I $@ || exit 1; done # # entry points for other programs # xiterm: (cd src; ${MAKE}) #------------------------------------------------------------------------- configure: configure.in cd $(srcdir); autoconf --localdir=$(srcdir) $(srcdir)/configure.in \ > configure chmod 755 configure config.h.in: configure.in cd $(srcdir); autoheader #install: # @for I in $(subdirs); do (cd $$I; $(MAKE) DESTDIR=/usr/local \ # $@ || exit 1); done install: @for I in $(subdirs); do $(MAKE) -C $$I $@ || exit 1; done Makefiles: $(SHELL) config.status config.status: if test -x config.status; then config.status --recheck; \ else $(SHELL) configure; fi realclean: $(RMF) *~ config.cache @for I in ${subdirs}; do ${MAKE} -C $$I $@ || exit 1; done # distclean goal is for making a clean source tree, but if you have run # configure from a different directory, then doesn't destroy all your # hardly compiled and linked stuff. That's why there is always $(srcdir)/ # In that case most of those commands do nothing, except cleaning *~ # and cleaning source links. mrproper: (cd $(srcdir); $(RMF) *~ config.cache config.h config.log \ config.status; $(RMRF) autom4te.cache) @for I in $(subdirs); do $(MAKE) -C $$I $@ || exit 1; done (cd $(srcdir); $(RMF) Makefile Make.common) tar.gz: $(RMF) ../$(VERNAME).tar.gz (CURDIR=$$(basename $$(pwd)); \ cd ..; test -e $(VERNAME) || ln -s $$CURDIR $(VERNAME); \ tar cvhf - --exclude-vcs --exclude .cvsignore \ --exclude autogen.sh --exclude 'debian*' --exclude '*.org' $(VERNAME) \ | gzip -f9 > $(VERNAME).tar.gz) uuencode: tar.gz uuencode ../$(VERNAME).tar.gz $(VERNAME).tar.gz > ../$(VERNAME).tgz.uu distrib: mrproper configure config.h.in uuencode # ------------------------------------------------------------------------ xiterm+thai-1.10/compatibility/0000755000175000017500000000000011375434151015223 5ustar thepthepxiterm+thai-1.10/compatibility/inputrc0000644000175000017500000000025211375434151016631 0ustar thepthep# Move to ~/.inputrc : international support set meta-flag on set convert-meta off set output-meta on # Home & End support "\e[1~":beginning-of-line "\e[4~":end-of-line xiterm+thai-1.10/compatibility/xterm.seq0000644000175000017500000003726311375434151017107 0ustar thepthep Xterm Control Sequences Edward Moy University of California, Berkeley Revised by Stephen Gildea X Consortium Definitions c The literal character c. C A single (required) character. Ps A single (usually optional) numeric parameter, composed of one of more digits. Pm A multiple numeric parameter composed of any number of single numeric parameters, separated by ; character(s). Pt A text parameter composed of printable characters. VT100 Mode Most of these control sequences are standard VT102 control sequences, but there are some sequences here from later DEC VT terminals, too. VT102 features not supported are smooth scrolling, double size characters, blink- ing characters, and VT52 mode. There are additional control sequences to provide xterm-dependent functions, like the scrollbar or window size. Where the function is specified by DEC or ISO 6429, the code assigned to it is given in parentheses. The escape codes to designate and invoke character sets are specified by ISO 2022; see that document for a discussion of char- acter sets. BEL Bell (Ctrl-G) BS Backspace (Ctrl-H) TAB Horizontal Tab (HT) (Ctrl-I) LF Line Feed or New Line (NL) (Ctrl-J) VT Vertical Tab (Ctrl-K) same as LF FF Form Feed or New Page (NP) (Ctrl-L) same as LF CR Carriage Return (Ctrl-M) SO Shift Out (Ctrl-N) -> Switch to Alternate Character Set: invokes the G1 character set. SI Shift In (Ctrl-O) -> Switch to Standard Character Set: invokes the G0 character set (the default). ESC # 8 DEC Screen Alignment Test (DECALN) ESC ( C Designate G0 Character Set (ISO 2022) C = 0 -> DEC Special Character and Line Drawing Set C = A -> United Kingdom (UK) C = B -> United States (USASCII) ESC ) C Designate G1 Character Set (ISO 2022) C = 0 -> DEC Special Character and Line Drawing Set C = A -> United Kingdom (UK) C = B -> United States (USASCII) ESC * C Designate G2 Character Set (ISO 2022) C = 0 -> DEC Special Character and Line Drawing Set C = A -> United Kingdom (UK) C = B -> United States (USASCII) ESC + C Designate G3 Character Set (ISO 2022) C = 0 -> DEC Special Character and Line Drawing Set C = A -> United Kingdom (UK) C = B -> United States (USASCII) ESC 7 Save Cursor (DECSC) ESC 8 Restore Cursor (DECRC) ESC = Application Keypad (DECPAM) ESC > Normal Keypad (DECPNM) ESC D Index (IND) ESC E Next Line (NEL) ESC F Cursor to lower left corner of screen (if enabled by the hpLowerleftBugCompat resource). ESC H Tab Set (HTS) ESC M Reverse Index (RI) ESC N Single Shift Select of G2 Character Set (SS2): affects next character only ESC O Single Shift Select of G3 Character Set (SS3): affects next character only ESC P Pt ESC \ Device Control String (DCS) xterm implements no DCS functions; Pt is ignored. Pt need not be printable characters. ESC Z Return Terminal ID (DECID). Obsolete form of ESC [ c (DA). ESC [ Ps @ Insert Ps (Blank) Character(s) (default = 1) (ICH) ESC [ Ps A Cursor Up Ps Times (default = 1) (CUU) ESC [ Ps B Cursor Down Ps Times (default = 1) (CUD) ESC [ Ps C Cursor Forward Ps Times (default = 1) (CUF) ESC [ Ps D Cursor Backward Ps Times (default = 1) (CUB) ESC [ Ps ; Ps H Cursor Position [row;column] (default = [1,1]) (CUP) ESC [ Ps J Erase in Display (ED) Ps = 0 -> Clear Below (default) Ps = 1 -> Clear Above Ps = 2 -> Clear All ESC [ Ps K Erase in Line (EL) Ps = 0 -> Clear to Right (default) Ps = 1 -> Clear to Left Ps = 2 -> Clear All ESC [ Ps L Insert Ps Line(s) (default = 1) (IL) ESC [ Ps M Delete Ps Line(s) (default = 1) (DL) ESC [ Ps P Delete Ps Character(s) (default = 1) (DCH) ESC [ Ps ; Ps ; Ps ; Ps ; Ps T Initiate hilite mouse tracking. Parameters are [func;startx;starty;firstrow;lastrow]. See the section Mouse Tracking. ESC [ Ps c Send Device Attributes (DA) Ps = 0 or omitted -> request attributes from terminal -> ESC [ ? 1 ; 2 c (``I am a VT100 with Advanced Video Option.'') ESC [ Ps ; Ps f Horizontal and Vertical Position [row;column] (default = [1,1]) (HVP) ESC [ Ps g Tab Clear (TBC) Ps = 0 -> Clear Current Column (default) Ps = 3 -> Clear All ESC [ Pm h Set Mode (SM) Ps = 4 -> Insert Mode (IRM) Ps = 2 0 -> Automatic Newline (LNM) ESC [ Pm l Reset Mode (RM) Ps = 4 -> Replace Mode (IRM) Ps = 2 0 -> Normal Linefeed (LNM) ESC [ Pm m Character Attributes (SGR) Ps = 0 -> Normal (default) Ps = 1 -> Bold Ps = 4 -> Underscore Ps = 5 -> Blink (appears as Bold) Ps = 7 -> Inverse ESC [ Ps n Device Status Report (DSR) Ps = 5 -> Status Report ESC [ 0 n (``OK'') Ps = 6 -> Report Cursor Position (CPR) [row;column] as ESC [ r ; c R ESC [ Ps ; Ps r Set Scrolling Region [top;bottom] (default = full size of window) (DECSTBM) ESC [ Ps x Request Terminal Parameters (DECREQTPARM) ESC [ ? Pm h DEC Private Mode Set (DECSET) Ps = 1 -> Application Cursor Keys (DECCKM) Ps = 2 -> Designate USASCII for character sets G0-G3. (In the VT102, this selects VT52 mode (DECANM), which xterm doesn't support.) Ps = 3 -> 132 Column Mode (DECCOLM) Ps = 4 -> Smooth (Slow) Scroll (DECSCLM) Ps = 5 -> Reverse Video (DECSCNM) Ps = 6 -> Origin Mode (DECOM) Ps = 7 -> Wraparound Mode (DECAWM) Ps = 8 -> Auto-repeat Keys (DECARM) Ps = 9 -> Send Mouse X & Y on button press. See the sec- tion Mouse Tracking. Ps = 3 8 -> Enter Tektronix Mode (DECTEK) Ps = 4 0 -> Allow 80 <--> 132 Mode Ps = 4 1 -> more(1) fix (see curses resource) Ps = 4 4 -> Turn On Margin Bell Ps = 4 5 -> Reverse-wraparound Mode Ps = 4 6 -> Start Logging (normally disabled by a compile-time option) Ps = 4 7 -> Use Alternate Screen Buffer (unless disabled by the titeInhibit resource) Ps = 1 0 0 0 -> Send Mouse X & Y on button press and release. See the section Mouse Tracking. Ps = 1 0 0 1 -> Use Hilite Mouse Tracking. See the sec- tion Mouse Tracking. ESC [ ? Pm l DEC Private Mode Reset (DECRST) Ps = 1 -> Normal Cursor Keys (DECCKM) Ps = 3 -> 80 Column Mode (DECCOLM) Ps = 4 -> Jump (Fast) Scroll (DECSCLM) Ps = 5 -> Normal Video (DECSCNM) Ps = 6 -> Normal Cursor Mode (DECOM) Ps = 7 -> No Wraparound Mode (DECAWM) Ps = 8 -> No Auto-repeat Keys (DECARM) Ps = 9 -> Don't Send Mouse X & Y on button press Ps = 4 0 -> Disallow 80 <--> 132 Mode Ps = 4 1 -> No more(1) fix (see curses resource) Ps = 4 4 -> Turn Off Margin Bell Ps = 4 5 -> No Reverse-wraparound Mode Ps = 4 6 -> Stop Logging (normally disabled by a compile- time option) Ps = 4 7 -> Use Normal Screen Buffer Ps = 1 0 0 0 -> Don't Send Mouse X & Y on button press and release Ps = 1 0 0 1 -> Don't Use Hilite Mouse Tracking ESC [ ? Pm r Restore DEC Private Mode Values. The value of Ps previously saved is restored. Ps values are the same as for DECSET. ESC [ ? Pm s Save DEC Private Mode Values. Ps values are the same as for DECSET. ESC ] Ps ; Pt BEL Set Text Parameters Ps = 0 -> Change Icon Name and Window Title to Pt Ps = 1 -> Change Icon Name to Pt Ps = 2 -> Change Window Title to Pt Ps = 4 6 -> Change Log File to Pt (normally disabled by a compile-time option) Ps = 5 0 -> Set Font to Pt ESC ^ Pt ESC \ Privacy Message (PM) xterm implements no PM functions; Pt is ignored. Pt need not be printable characters. ESC _ Pt ESC \ Application Program Command (APC) xterm implements no APC functions; Pt is ignored. Pt need not be printable characters. ESC c Full Reset (RIS) ESC l Memory Lock (per HP terminals). Locks memory above the cur- sor. ESC m Memory Unlock (per HP terminals) ESC n Invoke the G2 Character Set (LS2) ESC o Invoke the G3 Character Set (LS3) ESC | Invoke the G3 Character Set as GR (LS3R). Has no visible effect in xterm. ESC } Invoke the G2 Character Set as GR (LS2R). Has no visible effect in xterm. ESC ~ Invoke the G1 Character Set as GR (LS1R). Has no visible effect in xterm. Mouse Tracking The VT widget can be set to send the mouse position and other information on button presses. These modes are typically used by editors and other full- screen applications that want to make use of the mouse. There are three mutually exclusive modes, each enabled (or disabled) by a different parameter in the DECSET (or DECRST) escape sequence. Parameters for all mouse tracking escape sequences generated by xterm encode numeric parameters in a single character as value+040. For example, ! is 1. The screen coodinate system is 1-based. X10 compatibility mode sends an escape sequence on button press encoding the location and the mouse button pressed. It is enabled by specifying parame- ter 9 to DECSET. On button press, xterm sends ESC [ M CbCxCy (6 charac- ters). Cb is button-1. Cx and Cy are the x and y coordinates of the mouse when the button was pressed. Normal tracking mode sends an escape sequence on both button press and release. Modifier information is also sent. It is enabled by specifying parameter 1000 to DECSET. On button press or release, xterm sends ESC [ M CbCxCy. The low two bits of Cb encode button information: 0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release. The upper bits encode what modif- iers were down when the button was pressed and are added together. 4=Shift, 8=Meta, 16=Control. Cx and Cy are the x and y coordinates of the mouse event. The upper left corner is (1,1). Mouse hilite tracking notifies a program of a button press, receives a range of lines from the program, highlights the region covered by the mouse within that range until button release, and then sends the program the release coordinates. It is enabled by specifying parameter 1001 to DECSET. Warn- ing: use of this mode requires a cooperating program or it will hang xterm. On button press, the same information as for normal tracking is generated; xterm then waits for the program to send mouse tracking information. All X events are ignored until the proper escape sequence is received from the pty: ESC [ Ps ; Ps ; Ps ; Ps ; Ps T . The parameters are func, startx, starty, firstrow, and lastrow. func is non-zero to initiate hilite tracking and zero to abort. startx and starty give the starting x and y location for the highlighted region. The ending location tracks the mouse, but will never be above row firstrow and will always be above row lastrow. (The top of the screen is row 1.) When the button is released, xterm reports the ending position one of two ways: if the start and end coordinates are valid text locations: ESC [ t CxCy. If either coordinate is past the end of the line: ESC [ T CxCyCxCyCxCy. The parameters are startx, starty, endx, endy, mousex, and mousey. startx, starty, endx, and endy give the starting and ending character positions of the region. mousex and mousey give the loca- tion of the mouse at button up, which may not be over a character. Tektronix 4014 Mode Most of these sequences are standard Tektronix 4014 control sequences. Graph mode supports the 12-bit addressing of the Tektronix 4014. The major features missing are the write-thru and defocused modes. This document does not describe the commands used in the various Tektronix plotting modes but does describe the commands to switch modes. BEL Bell (Ctrl-G) BS Backspace (Ctrl-H) TAB Horizontal Tab (Ctrl-I) LF Line Feed or New Line (Ctrl-J) VT Cursor up (Ctrl-K) FF Form Feed or New Page (Ctrl-L) CR Carriage Return (Ctrl-M) ESC ETX Switch to VT100 Mode (ESC Ctrl-C) ESC ENQ Return Terminal Status (ESC Ctrl-E) ESC FF PAGE (Clear Screen) (ESC Ctrl-L) ESC SO Begin 4015 APL mode (ignored by xterm) (ESC Ctrl-N) ESC SI End 4015 APL mode (ignored by xterm) (ESC Ctrl-O) ESC ETB COPY (Save Tektronix Codes to file COPYyy-mm-dd.hh:mm:ss) (ESC Ctrl-W) ESC CAN Bypass Condition (ESC Ctrl-X) ESC SUB GIN mode (ESC Ctrl-Z) ESC FS Special Point Plot Mode (ESC Ctrl-\) ESC 8 Select Large Character Set ESC 9 Select #2 Character Set ESC : Select #3 Character Set ESC ; Select Small Character Set ESC ] Ps ; Pt BEL Set Text Parameters of VT window Ps = 0 -> Change Icon Name and Window Title to Pt Ps = 1 -> Change Icon Name to Pt Ps = 2 -> Change Window Title to Pt Ps = 4 6 -> Change Log File to Pt (normally disabled by a compile-time option) ESC ` Normal Z Axis and Normal (solid) Vectors ESC a Normal Z Axis and Dotted Line Vectors ESC b Normal Z Axis and Dot-Dashed Vectors ESC c Normal Z Axis and Short-Dashed Vectors ESC d Normal Z Axis and Long-Dashed Vectors ESC h Defocused Z Axis and Normal (solid) Vectors ESC i Defocused Z Axis and Dotted Line Vectors ESC j Defocused Z Axis and Dot-Dashed Vectors ESC k Defocused Z Axis and Short-Dashed Vectors ESC l Defocused Z Axis and Long-Dashed Vectors ESC p Write-Thru Mode and Normal (solid) Vectors ESC q Write-Thru Mode and Dotted Line Vectors ESC r Write-Thru Mode and Dot-Dashed Vectors ESC s Write-Thru Mode and Short-Dashed Vectors ESC t Write-Thru Mode and Long-Dashed Vectors FS Point Plot Mode (Ctrl-\) GS Graph Mode (Ctrl-]) RS Incremental Plot Mode (Ctrl-^) US Alpha Mode (Ctrl-_) xiterm+thai-1.10/compatibility/xterm.ti0000644000175000017500000001027611375434151016726 0ustar thepthep#------------------------------------------------------------------------- # terminfo modified from the Midnight Commander # # Install using `tic xterm.ti', to be used with the enclosed termcap #------------------------------------------------------------------------- xterm-basic|xterm terminal base (X Window System), am, km, mir, msgr, xenl, xon, cols#80, lines#24, it#8, # Not sure about eo (Erase overstrike with a blank) eo, cr=\r, bel=^G, # Scroll text up, down ind=\n, ri=\EM, # Clear Screen, EOS, EOL, BOL clear=\E[H\E[2J, ed=\E[J, el=\E[K, el1=\E[1K, # Change Scroll Region csr=\E[%i%p1%d;%p2%dr, # CUrsor Position cup=\E[%i%p1%d;%p2%dH, # Horizontal & Vertical Position Absolute hpa=\E[%i%p1%dG, vpa=\E[%i%p1%dd, # Cursor Up/Down/Forward/Backward: any, 1 char cuu=\E[%p1%dA, cud=\E[%p1%dB, cuf=\E[%p1%dC, cub=\E[%p1%dD, cuu1=\E[A, cud1=\n, cuf1=\E[C, cub1=\b, # Misc cursor motion home=\E[H, # Enter insert mode, leave insert mode smir=\E[4h, rmir=\E[4l, # Set tab stops, clear tab stops, tab character # FIXME: does xterm use \E[3k instead of \E[3g (like vt102)? hts=\EH, tbc=\E[3g, ht=\t, # Make cursor invisible, normal, bold civis=\E[?25l, cnorm=\E[?25h, cvvis=\E[?25h, # Save/Restore Cursor position sc=\E7, rc=\E8, # Alternate Char Set (line drawing), enable/enter/exit ACS acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, enacs=\E(B\E)0, smacs=\E(B\E)U^N, rmacs=\E(B\E)0^O, #-- begin AIX 3.2.5 hack # acsc (box2 is the standard AIX form, box1 has been changed to work!) box1=llqqkkxxjjmmwwuuvvttnn, box2=lqkxjmwuvtn, font0=\E(B, font1=\E(0, # position occupied by kend colf7=\E[8~, #-- end AIX 3.2.5 hack # Delete/Insert: Chars, Lines, 1-char, 1-line dch=\E[%p1%dP, dl=\E[%p1%dM, ich=\E[%p1%d@, il=\E[%p1%dL, dch1=\E[P, dl1=\E[M, ich1=\E[@, il1=\E[L, # Erase Chars ech=\E[%p1%dX, # Enter/Leave Fonts: Bold, Reverse, Blink, Underline # standout (enter/leave), Define attribs 1-9 bold=\E[1m, rev=\E[7m, blink=\E[5m, smul=\E[4m, rmul=\E[24m, smso=\E[7m, rmso=\E[27m, # visual bell flash=\E[?5h\E[?5l, # Enter/leave keypad transmit, Cursor keys (sent by terminal). Don't touch # cursor keys! use ANSI cursor keys rather than application cursor keys to # avoid starting in application cursor mode when `$xterm&' is used and to # enable the rxvt Shift/Ctrl cursor extensions. smkx=\E=, rmkx=\E>, kcuu1=\E[A, kcud1=\E[B, kcuf1=\E[C, kcub1=\E[D, # Other nice keys ka1=\EOw, ka3=\EOy, kb2=\EOu, kc1=\EOq, kc3=\EOs # Function keys kf0=\E[21~, kf1=\E[11~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, # Find, Insert, Delete, Select, Prior, Next kfnd=\E[1~, kich1=\E[2~, kdch1=\E[3~, kslt=\E[4~, kpp=\E[5~, knp=\E[6~, # Home (vt100 may use khome=\E[H), End, Backspace, Enter, Backtab khome=\E[7~, kend=\E[8~, kbs=\b, kent=\EOM, kcbt=\E[Z, # Shifted Right, Left, Delete, Prior, Next, Home, End, Ctrl-End kRIT=\E[c, kLFT=\E[d, kDC=\E[3$, kPRV=\E[5$, kNXT=\E[6$, kHOM=\E[7$, kEND=\E[8$, kel=\E[8^, # Reset terminal, turn off all attributes rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>, # dec.ti # rs2=@, # Init terminal is1=\E[?47l\E=\E[?1l, is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, # Leave/Enter CA-Mode. smcup=\E7\E[?47h, rmcup=\E[?47l\E8, # dec.ti # smcup=\E[?7h\E[?1l\E(B\E=, rmcup=\E[?7h, # turn on/off the printer # mc5=\E[5i, mc4=\E[4i, mc4=\E[4i, # # XTerm with color support. # xterm|vs100|xterm terminal emulator (X Window System), use=xterm-basic, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N%e^O%;, sgr0=\E[m^O, # from dec.ti # sgr0=\E[m\E(B, # sgr0=\E[m, # sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m%?%p9%t\E(0%e\E(B%;, xterm-color|color-xterm|color xterm terminal emulator (X Window System), use=xterm, colors#8, pairs#64, # Set all color pairs to the original ones # op=\E[0m, op=\E[39;49m, # Set foreground color, background color setf=\E[%p1%{30}%+%dm, setb=\E[%p1%{40}%+%dm, #--------------------------------------------------------------------- eof xiterm+thai-1.10/compatibility/bashrc0000644000175000017500000000066111375434151016413 0ustar thepthep# Copy to ~/.bashrc: executed by bash for non-login shells. PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/usr/local/bin" PS1="(\u@\h:\W)# " # International options LC_CTYPE=ISO-8859-1 LESSCHARSET=latin1 # Nation specific options # LC_ALL=fr_FR # LANG=fr # MANPATH=/usr/man/fr_FR export PATH PS1 LC_CTYPE LESSCHARSET LC_ALL LANG MANPATH alias q="cd .." alias ll="ls --color=y -l -a -N" alias d="ls --color=y" stty erase ^? xiterm+thai-1.10/compatibility/xterm.tcap0000644000175000017500000000404211375434151017233 0ustar thepthep#------------------------------------------------------------------------- # termcap modified from the Midnight Commander # # From: Jakub Jelinek 1 Sep 1995 # This is a checked termcap entry for the xterm terminal emulator. # It is compatible with the enclosed terminfo entry. # Install this by cutting off the old xterm entry from /etc/termcap # and replacing that place it with this file. # Heavily based on xterm from: # Eric S. Raymond 30 Mar 1995 # Note: If you use the line-drawing character set, the disable afterwards # will leave you in US-ASCII. If you live somewhere that wants a pound sign # at 2/3, change rmacs to "\E(A". Further note: cuf and cub don't seem # to be reliable under my xterm, so they're commented out. #------------------------------------------------------------------------- xterm|vs100|xterm terminal emulator (X11R6 Window System):\ :am:bs:km:mi:ms:pt:xn:xo:co#80:li#24:it#8:\ :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:\ :IC=\E[%d@:LE=\E[%dD:UP=\E[%dA:\ :ac=++\054\054..00II--``aaffgghhjjkkllmmnnooqqssttuuvvwwxx~~:\ :ae=\E(B:al=\E[L:as=\E(0:bl=^G:cd=\E[J:ce=\E[K:\ :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ :ct=\E[3k:dc=\E[P:dl=\E[M:ei=\E[4l:ho=\E[H:\ :ic=\E[@:im=\E[4h:\ :is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l:\ :k0=\E[21~:\ :k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\ :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:\ :F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:\ :F5=\E[28~:F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:\ :*0=\E[1~:kI=\E[2~:kD=\E[3~:*6=\E[4~:kP=\E[5~:kN=\E[6~:\ :kh=\E[7~:@7=\E[8~:kB=\E[Z:\ :ke=\E>:ks=\E=:\ :ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:\ :K1=\EOw:K3=\EOy:K2=\EOu:K4=\EOq:K5=\EOs:\ :kb=^H:up=\E[A:do=^J:nd=\E[C:le=^H:\ :md=\E[1m:me=\E[m:mr=\E[7m:\ :r2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E<:\ :rc=\E8:sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:ta=^I:\ :te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:u6=\E[%d;%dR:\ :u7=\E[6n:u8=\E[?1;2c:u9=\E[c:ue=\E[m:\ :us=\E[4m: xterm-color|color-xterm|xterm with color support:\ :tc=xterm:tc=ansi-pc-color: xiterm+thai-1.10/compatibility/README0000644000175000017500000000041111375434151016077 0ustar thepthepYou shouldn't need theese files (except bashrc & inputrc) if you want to use xterm & xiterm, and you want an equal "behaviour" from both . I recommand against this since xterm _sucks_ memory, slows down your machine & gives no options you should *really* need ... xiterm+thai-1.10/compatibility/XTerm.ad0000644000175000017500000000352011375434151016570 0ustar thepthep! Put this into ~/.Xdefaults, or to app-defaults/XTerm or wherever ! xrm will loaded it. ! ! This will match the key sequences for a regular xterm to those used ! by xiterm and the enclosed termcap and terminfo files. ! ! As usual, the most annoying xterm keys are Home/End and the ubiquitous ! BackSpace/Delete confusion. XTerm*vt100.translations: #override \ BackSpace: string("\010") \n\ ShiftTab: string("\033[Z") \n\ Ctrlminus: string("\037") \n\ Home: string("\033[1~") \n\ End: string("\033[4~") \n\ Delete: string("\033[3~") \n\ ShiftDelete: string("\177") \n\ CtrlDelete: string("\010") \n\ AltReturn: string("\033\015") \n\ Altspace: string("\033\040") \n\ Alta: string("\033a") \n\ Altb: string("\033b") \n\ Altc: string("\033c") \n\ Altd: string("\033d") \n\ Alte: string("\033e") \n\ Altf: string("\033f") \n\ Altg: string("\033g") \n\ Alth: string("\033h") \n\ Alti: string("\033i") \n\ Altj: string("\033j") \n\ Altk: string("\033k") \n\ Altl: string("\033l") \n\ Altm: string("\033m") \n\ Altn: string("\033n") \n\ Alto: string("\033o") \n\ Altp: string("\033p") \n\ Altq: string("\033q") \n\ Altr: string("\033r") \n\ Alts: string("\033s") \n\ Altt: string("\033t") \n\ Altu: string("\033u") \n\ Altv: string("\033v") \n\ Altw: string("\033w") \n\ Altx: string("\033x") \n\ Alty: string("\033y") \n\ Altz: string("\033z") \n\ CtrlUp: string("\033Oa") \n\ CtrlDown: string("\033Ob") \n\ CtrlRight: string("\033Oc") \n\ CtrlLeft: string("\033Od") \n\ ShiftUp: string("\033[a") \n\ ShiftDown: string("\033[b") \n\ ShiftRight: string("\033[c") \n\ ShiftLeft: string("\033[d") \n !EOF xiterm+thai-1.10/doc/0000755000175000017500000000000011701207360013110 5ustar thepthepxiterm+thai-1.10/doc/COPYRIGHT.HISTORY0000644000175000017500000000031111375434151015545 0ustar thepthepxvt original copyright was "Do what you want, but can't make money on it." . Rxvt had the same copyright since it was based on xvt . xiterm moved to GPL with autorization from xvt's original author . xiterm+thai-1.10/doc/xiterm-1.0.lsm0000644000175000017500000000265411375434151015447 0ustar thepthepBegin3 Title: xiterm Version: 1.0 Entered-date: 10JUL97 Description: Xiterm stands for X terminal international ; Xiterm is an 8-bit clean, colour xterm replacement that uses significantly less memory than a conventional xterm. However, it doesn't support toolkit configurability or Tek graphics. Some features can be removed at compile-time to reflect your needs : ANSI-color, bold/blink attributes, modify foreground/background colours, scrollbars with arrow buttons, kanji and greek support, printer-pipe, XPM backgounds with on-the-fly scaling, user-definable menus. Keywords: xiterm rxvt colour color kanji xterm X11 vt100 xpm menu terminal-emulator Author: John Bovey [Univ. Kent at Canterbury] was the creator of the original xvt . Rob Nation [Lockheed] re-wrote most of xvt to make a substantiallly enhanced version called rxvt (Rob's xvt) . Mark Olesen [Queen's Univ. at Kingston] made various improvements and cleanups . Guylhem Aznar [Purpan Univ. at Toulouse, France] cleaned up up a bit and added full PC keyboard support : Home, End, Page up (...) + Keypad support with Numlock & Numlock Off . Maintained-by: Guylhem Aznar Will someone else volunteer ? Primary-site: ftp.nuclecu.unam.mx /linux/local/rxvt 205k rxvt-2.20.tar.gz Alternate-site: tsx-11.mit.edu /pub/linux/sources/usr.bin.X11 205k rxvt-2.20.tar.gz Platforms: X11 Copying-policy: GPL End xiterm+thai-1.10/doc/COPYING0000644000175000017500000004307711375434151014165 0ustar thepthep 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. xiterm+thai-1.10/doc/BUGS0000644000175000017500000000016211375434151013601 0ustar thepthepAny weird iso9995-3 char. (ex : Greek_OMEGA) defined on the xkb keytable will disable 8 bits support when entered xiterm+thai-1.10/doc/Makefile.in0000644000175000017500000000231511375434151015165 0ustar thepthep# doc/Makefile.in -*- Makefile -*- @MCOMMON@ basedir = $(srcdir)/.. thisdir = doc first_rule: all dummy: # # Distribution variables # DIST = Makefile.in README.greek README.xvt FAQ TODO \ xiterm.ref xterm.seq xiterm+thai.1.in LSM.in\ menu.sh jedmenu.sl #------------------------------------------------------------------------- all: alldoc # 2001-11-27 Theppitak Karoonboonyanan : # to be generated by configure instead.. #xiterm.1: xiterm.1.in # sed 's%@VERSION@%$(VERSION)%g;s%@DATE@%$(DATE)%g;s%@MAINT@%$(MAINT)%g' $@.in > $@ # #LSM: LSM.in # sed 's%@VERSION@%$(VERSION)%g;s%@LSMDATE@%$(LSMDATE)%g;s%@MAINT@%$(MAINT)%g' $@.in > $@ tags allbin: alldoc: xiterm+thai.1 LSM clean: # 2001-11-27 Theppitak Karoonboonyanan : # not to remove, as they're not generated by 'make' any more # $(RMF) LSM xiterm.1 *~ realclean: clean mrproper: cd $(srcdir) && $(RMF) LSM xiterm+thai.1 *~ cd $(srcdir) && $(RMF) Makefile install: alldoc $(INSTALL_DATA) xiterm+thai.1 \ $(DESTDIR)$(mandir)/$(manprefix)xiterm+thai.$(manext) uninstall: -cd $(mandir) && $(RMF) $(manprefix)xiterm+thai.$(manext) # ------------------------------------------------------------------------ xiterm+thai-1.10/doc/FAQ0000644000175000017500000002324611375434151013460 0ustar thepthep-------------------------------------------------------------------------- FAQ -------------------------------------------------------------------------- ----- Q: How do I know which xiterm version I'm using? A: The version number is displayed with the usage (-help). For xiterm version 1 and later, the escape sequence `ESC[8n' sets the window title to the version number. ----- Q: Mouse cut/paste suddenly no longer works. A: Make sure that mouse reporting is actually turned off since killing some editors prematurely may leave the mouse in mouse report mode. I've heard that tcsh may use mouse reporting unless it otherwise specified. A quick check is to see if cut/paste works when the Alt or Shift keys are depressed. See doc/xiterm.ref. ----- Q: What's with this bold/blink stuff? I can never get blinking text! A: It is not possible, and likely will never be, for xiterm to have actual blinking text. Instead (if xiterm was compiled without NO_BOLDCOLOR), bold/blink attributes are used to set high-intensity foreground/background colors ... like what you'd see on a PC video adapter. There are programs, notably John Davis' SLang-based ones , that use bold/blink attributes to permit 16 colors. color0-7 are the low-intensity colors. color8-15 are the corresponding high-intensity colors. A side issue of this bold/blink stuff is the question of how the normal default foreground/background colors are to be treated. If the default foreground/background match one of the low-intensity colors (color0-7), the bold/blink attribute will invoke the appropriate high-intensity color (color8-15). In the case that the default foreground doesn't match one of the low-intensity colors, the bold attribute will use an `overstrike' to simulate a bold font. But note this leaves pixel-droppings and so, rather than wasting an inordinate amounts of energy to fix it, its use is simply deprecated. In the case that the default background doesn't match one of the low-intensity colors, the blink attribute is simply ignored (rather than representing it as bold as xterm does). ----- Q: I don't like the screen colors. How do I change them? A: You can change the screen colors at run-time using ~/.Xdefaults resources (or as long-options) ... see the man-page. Here are values that are supposed to resemble a VGA screen, including the murky brown that passes for low-intensity yellow: Xterm*color0: #000000 Xterm*color1: #A80000 Xterm*color2: #00A800 Xterm*color3: #A8A800 Xterm*color4: #0000A8 Xterm*color5: #A800A8 Xterm*color6: #00A8A8 Xterm*color7: #A8A8A8 Xterm*color8: #000054 Xterm*color9: #FF0054 Xterm*color10: #00FF54 Xterm*color11: #FFFF54 Xterm*color12: #0000FF Xterm*color13: #FF00FF Xterm*color14: #00FFFF Xterm*color15: #FFFFFF ----- Q: What's with the strange Backspace/Delete key behaviour? A: Assuming that the physical Backspace key corresponds to the BackSpace keysym (not likely for Linux ... see the following question) there are two standard values that can be used for Backspace: ^H and ^?. Xiterm tries to inherit the current stty settings and uses the value of `erase' to guess the value for backspace. If xiterm wasn't started from a terminal (say, from a menu or by remote shell), then the system value of `erase', which corresponds to CERASE in , will be used (which may not be the same as your stty setting). For starting a new xiterm: use Backspace = ^H $ stty erase ^H $ xiterm use Backspace = ^? $ stty erase ^? $ xiterm NB: generate either value with BackSpace and Ctrl/Shift-BackSpace. Toggle with "ESC[36h" / "ESC[36l" as documented in "doc/xiterm.ref" For an existing xiterm: use Backspace = ^H $ stty erase ^H $ echo -n "^[[36h" use Backspace = ^? $ stty erase ^? $ echo -n "^[[36l" This helps satisfy some of the Backspace discrepancies that occur, but if you use Backspace = ^?, make sure that the termcap/terminfo value properly reflects that. The Delete key (which one would expect to emit ^?) is a another casualty of the ill-defined Backspace problem. To avoid confusion between the Backspace and Delete keys, the Delete key has been assigned an escape sequence to match the vt100 for Execute (ESC[3~) and is in the supplied termcap/terminfo. Some other Backspace problems: some editors use termcap/terminfo, some editors (vim I'm told) expect Backspace = ^H, GNU Emacs (and Emacs-like editors) use ^H for help. Perhaps someday this will all be resolved in a consistent manner ... and maybe xterm will have Home/End values too! ----- Q: Why doesn't the Backspace key work on my Linux machine? A: The XFree86 server has a notorious problem of mapping the Backspace key as Delete in order to match the Linux console. The correct way to fix this: 0 - Complain to your Linux distributer and the XFree86 team, maybe they'll fix it. 1 - Use xmodmap to correct the Backspace mapping ! ~/.Xmodmap ! a correctly-mapped BackSpace keycode 22 = BackSpace *** Make sure the keycode above matches the physical Backspace key on your machine!! (use xev) *** This will also fix the BackSpace problem with Motif applications, such as ``why doesn't Backspace work for Netscape?'' You now have a Backspace key that functions as described in the previous question. 1a - You may also want to fix the regular xterm if it doesn't generates the desired value for BackSpace xterm*vt100.translations: #override \ BackSpace: string(\010) \n or xterm*vt100.translations: #override \ BackSpace: string(\177) \n while you are at it, you may also want to have consistent values to Home/End/Delete xterm*vt100.translations: #override \ Home: string("\033[7~") \n\ End: string("\033[8~") \n\ Delete: string("\033[3~") \n Finally, you can also remap the xiterm key-binding at run-time (next question) but you'll lose the ability to have Ctrl/Shift-Backspace work differently as well as losing the escape sequence toggling of Backspace. ----- Q: I don't like the key-bindings. How do I change them? A: There are some compile-time selections available in "feature.h" and if you've compiled with KEYSYM_RESOURCE + FAKE_RESOURCES you can use the `keysym' resource to alter the keystrings associated with keysym 0xFF00 - 0xFFFF (function, cursor keys, etc). Here's an example for a tn3270 session started using `xiterm -name tn3270' !# ----- special uses ------: ! tn3270 login, remap function and arrow keys. tn3270*font: *clean-bold-*-*--15-* ! keysym - used by xiterm only ! Delete - ^D tn3270*keysym.0xFFFF: \004 ! Home - ^A tn3270*keysym.0xFF50: \001 ! Left - ^B tn3270*keysym.0xFF51: \002 ! Up - ^P tn3270*keysym.0xFF52: \020 ! Right - ^F tn3270*keysym.0xFF53: \006 ! Down - ^N tn3270*keysym.0xFF54: \016 ! End - ^E tn3270*keysym.0xFF57: \005 ! F1 - F12 tn3270*keysym.0xFFBE: \e1 tn3270*keysym.0xFFBF: \e2 tn3270*keysym.0xFFC0: \e3 tn3270*keysym.0xFFC1: \e4 tn3270*keysym.0xFFC2: \e5 tn3270*keysym.0xFFC3: \e6 tn3270*keysym.0xFFC4: \e7 tn3270*keysym.0xFFC5: \e8 tn3270*keysym.0xFFC6: \e9 tn3270*keysym.0xFFC7: \e0 tn3270*keysym.0xFFC8: \e- tn3270*keysym.0xFFC9: \e= ! map Prior/Next to F7/F8 tn3270*keysym.0xFF55: \e7 tn3270*keysym.0xFF56: \e8 ----- Q: I'm using keyboard model XXX that has extra Prior/Next/Insert keys. How do I make use of them? For example, the Sun Keyboard type 4 has the following mappings that xiterm doesn't recognize. KP_Insert == Insert F22 == Print F27 == Home F29 == Prior F33 == End F35 == Next A: Rather than have xiterm try to accomodate all the various possible keyboard mappings, it is better to use `xmodmap' to remap the keys as required for your particular machine. ----- Q: How do I distinguish if I'm running xiterm or a regular xterm? I need this to decide about setting colors etc. A: xiterm always exports the variable "COLORTERM", so you can check and see if that is set. Note that several programs, JED, slrn, Midnight Commander automatically check this variable to decide whether or not to use color. ----- Q: How do I set the correct, full IP address for the DISPLAY variable? A: If you've compiled xiterm with DISPLAY_ENV_AND_ANSWER_IS_IP then it is possible to use the following shell script snippets to correctly set the display. If your version of xiterm wasn't also compiled with ESCZ_RXVT_ANSWER (as assumed in these snippets) then the COLORTERM variable can be used to distinguish xiterm from a regular xterm. Courtesy of Chuck Blake with the following shell script snippets: # Bourne/Korn/POSIX family of shells: [ ${TERM:-foo} = foo ] && TERM=xterm # assume an xterm if we don't know if [ ${TERM:-foo} = xterm ]; then stty -icanon -echo min 0 time 15 # see if enhanced xiterm or not echo -n '^[Z' read term_id stty icanon echo if [ ""${term_id} = '^[[?1;2C' -a ${DISPLAY:-foo} = foo ]; then echo -n '^[[7n' # query the xiterm we are in for the DISPLAY string read DISPLAY # set it in our local shell fi fi csh/tcsh family of shells: if ( !(${?TERM}) ) then # if term is unset, we are probably in an xterm TERM = xterm endif if ( ${TERM} =~ xterm ) then stty -icanon -echo min 0 time 15 # see if enhanced xiterm or not echo -n '^[Z' set term_id=$< stty icanon echo if ( ""${term_id} == "^[[?1;2C" && ${?DISPLAY} == 0 ) then echo -n '^[[7n' # query the xiterm we're in for the DISPLAY string setenv DISPLAY "$<" # set it in our local shell endif endif -- EOF xiterm+thai-1.10/doc/rxvt.ref0000644000175000017500000004122211375434151014621 0ustar thepthep-------------------------------------------------------------------------- xiterm Technical Reference -------------------------------------------------------------------------- Reworked from XTerm & Rxvt documentation and from other sources Definitions c The literal character c. C A single (required) character. Ps A single (usually optional) numeric parameter, composed of one or more digits. Pm A multiple numeric parameter composed of any number of single numeric parameters, separated by ; character(s). Pt A text parameter composed of printable characters. [-] marks unimplemented sequences [*] marks xiterm-specific (non-ANSI/ISO) sequences -------------------------------------------------------------------------- ENQ Enquiry (Ctrl-E), Send Device Attributes (DA) -> request attributes from terminal -> ESC[?1;2c (``I am a VT100 with Advanced Video Option.'') BEL Bell (Ctrl-G) BS Backspace (Ctrl-H) TAB Horizontal Tab (HT) (Ctrl-I) LF Line Feed or New Line (NL) (Ctrl-J) VT Vertical Tab (Ctrl-K) same as LF FF Form Feed or New Page (NP) (Ctrl-L) same as LF CR Carriage Return (Ctrl-M) SO Shift Out (Ctrl-N), invokes the G1 character set -> Switch to Alternate Character Set SI Shift In (Ctrl-O), invokes the G0 character set (the default) -> Switch to Standard Character Set SPC Space Character ESC # 8 DEC Screen Alignment Test (DECALN) Character Sets -------------------------------------------------------------------------- ESC ( C Designate G0 Character Set (ISO 2022) ESC ) C Designate G1 Character Set (ISO 2022) ESC * C Designate G2 Character Set (ISO 2022) ESC + C Designate G3 Character Set (ISO 2022) ESC $ C Designate Kanji Character Set where C = 0 -> DEC Special Character and Line Drawing Set C = A -> United Kingdom (UK) C = B -> United States (USASCII) [-] C = < -> Multinational character set [-] C = 5 -> Finnish character set [-] C = C -> Finnish character set [-] C = K -> German character set ESC 7 Save Cursor (SC) ESC 8 Restore Cursor (RC) ESC = Application Keypad (SMKX) ESC > Normal Keypad (RMKX) - If the numeric keypad is activated, e.g. Num_Lock has been pressed, numbers or control functions are generated by the numeric keypad (see Key Codes section) ESC D Index (IND) ESC E Next Line (NEL) ESC H Tab Set (HTS) ESC M Reverse Index (RI) [-] ESC N Single Shift Select of G2 Character Set (SS2): affects next character only [-] ESC O Single Shift Select of G3 Character Set (SS3): affects next character only ESC Z Obsolete form of ESC [ c Optional (compile-time) returns -> ESC[?1;2C ESC [ Ps @ Insert Ps (Blank) Character(s) [default: 1] (ICH) ESC [ Ps A Cursor Up Ps Times [default: 1] (CUU) ESC [ Ps B Cursor Down Ps Times [default: 1] (CUD) ESC [ Ps C Cursor Forward Ps Times [default: 1] (CUF) ESC [ Ps D Cursor Backward Ps Times [default: 1] (CUB) ESC [ Ps E Cursor Down Ps Times [default: 1] and to first column ESC [ Ps F Cursor Up Ps Times [default: 1] and to first column ESC [ Ps G Cursor to Column Ps (HPA) ESC [ Ps;Ps H Cursor Position [row;column] [default: 1;1] (CUP) ESC [ Ps I Move forward Ps [default: 1] tab stops ESC [ Ps J Erase in Display (ED) Ps = 0 -> Clear Below (default) Ps = 1 -> Clear Above Ps = 2 -> Clear All ESC [ Ps K Erase in Line (EL) Ps = 0 -> Clear to Right (default) Ps = 1 -> Clear to Left (EL1) Ps = 2 -> Clear All ESC [ Ps L Insert Ps Line(s) [default: 1] (IL) ESC [ Ps M Delete Ps Line(s) [default: 1] (DL) ESC [ Ps P Delete Ps Character(s) [default: 1] (DCH) [-] ESC [ Ps;Ps;Ps;Ps;Ps T Initiate hilite mouse tracking. Parameters are [func;startx;starty;firstrow;lastrow]. See the section Mouse Tracking. ESC [ Ps W Tabulator functions Ps = 0 -> Tab Set (HTS) Ps = 2 -> Tab Clear (TBC), Clear Current Column (default) Ps = 5 -> Tab Clear (TBC), Clear All ESC [ Ps X Erase Ps Character(s) [default: 1] (ECH) ESC [ Ps Z Move backward Ps [default: 1] tab stops ESC [ PS ` == ESC [ PS G ESC [ Ps a == ESC [ Ps C ESC [ Ps c Send Device Attributes (DA) Ps = 0 or omitted -> request attributes from terminal -> ESC[?1;2c (``I am a VT100 with Advanced Video Option.'') ESC [ Ps d Cursor to Line Ps (VPA) ESC [ Ps e == ESC [ Ps A ESC [ Ps;Ps f Horizontal and Vertical Position [row;column] [default: 1;1] (HVP) ESC [ Ps g Tab Clear (TBC) Ps = 0 -> Clear Current Column (default) Ps = 3 -> Clear All (TBC) ESC [ Ps i Printing Ps = 4 -> disable transparent print mode (MC4) [-] Ps = 5 -> enable transparent print mode (MC5) ESC [ Pm h Set Mode (SM) ESC [ Pm l Reset Mode (RM) Ps = 4 h -> Insert Mode (SMIR) l -> Replace Mode (RMIR) [-] Ps = 20 h -> Automatic Newline (LNM) l -> Normal Linefeed (LNM) [*] Ps = 36 h -> Backspace key sends BS l -> Backspace key sends DEL ESC [ Pm m Character Attributes (SGR) Ps = 0 -> Normal (default) Ps = 1 / 22 -> On / Off Bold (bright fg) Ps = 4 / 24 -> On / Off Underline Ps = 5 / 25 -> On / Off Blink (bright bg) Ps = 7 / 27 -> On / Off Inverse Ps = 30 / 40 -> fg / bg Black Ps = 31 / 41 -> fg / bg Red Ps = 32 / 42 -> fg / bg Green Ps = 33 / 43 -> fg / bg Yellow Ps = 34 / 44 -> fg / bg Blue Ps = 35 / 45 -> fg / bg Magenta Ps = 36 / 46 -> fg / bg Cyan Ps = 37 / 47 -> fg / bg White Ps = 39 / 49 -> fg / bg Default ESC [ Ps n Device Status Report (DSR) Ps = 5 -> Status Report ESC [ 0 n (``OK'') Ps = 6 -> Report Cursor Position (CPR) [row;column] as ESC [ r ; c R Ps = 7 -> Request Display Name Ps = 8 -> Request Version Number (place in window title) ESC [ Ps;Ps r Set Scrolling Region [top;bottom] [default: full size of window] (CSR) ESC [ Ps x Request Terminal Parameters (DECREQTPARM) ESC [ ? Pm h DEC Private Mode Set (DECSET) ESC [ ? Pm l DEC Private Mode Reset (DECRST) ESC [ ? Pm r Restore previously saved DEC Private Mode Values. ESC [ ? Pm s Save DEC Private Mode Values. ESC [ ? Pm t Toggle DEC Private Mode Values (xiterm extension). Ps = 1 h -> Application Cursor Keys (DECCKM) l -> Normal Cursor Keys (DECCKM) [-] Ps = 2 h -> Designate USASCII for character sets G0-G3. Ps = 3 h -> 132 Column Mode (DECCOLM) l -> 80 Column Mode (DECCOLM) [-] Ps = 4 h -> Smooth (Slow) Scroll (DECSCLM) l -> Jump (Fast) Scroll (DECSCLM) Ps = 5 h -> Reverse Video (DECSCNM) l -> Normal Video (DECSCNM) Ps = 6 h -> Origin Mode (DECOM) l -> Normal Cursor Mode (DECOM) Ps = 7 h -> Wraparound Mode (DECAWM) l -> No Wraparound Mode (DECAWM) [-] Ps = 8 h -> Auto-repeat Keys (DECARM) l -> No Auto-repeat Keys (DECARM) Ps = 9 (X10 XTerm mouse reporting) h -> Send Mouse X & Y on button press. l -> Don't Send Mouse X & Y on button press See the section Mouse Tracking. [*] Ps = 10 h -> menuBar visisble l -> menuBar invisisble Ps = 25 h -> Visible cursor {cnorm/cvvis} l -> Invisible cursor {civis} [*] Ps = 30 h -> scrollBar visisble l -> scrollBar invisisble [*] Ps = 35 h -> Allow XTerm Shift+key sequences l -> Disallow XTerm Shift+key sequences [*] Ps = 36 h -> Backspace key sends BS l -> Backspace key sends DEL [-] Ps = 38 -> Enter Tektronix Mode (DECTEK) Ps = 40 h -> Allow 80 <--> 132 Mode l -> Disallow 80 <--> 132 Mode [-] Ps = 44 h -> Turn On Margin Bell l -> Turn Off Margin Bell [-] Ps = 45 h -> Reverse-wraparound Mode l -> No Reverse-wraparound Mode [-] Ps = 46 h -> Start Logging (normally disabled at compile-time) l -> Stop Logging (normally disabled at compile-time) Ps = 47 h -> Use Alternate Screen Buffer l -> Use Normal Screen Buffer Ps = 66 h -> Application Keypad (DECPAM) l -> Normal Keypad (DECPNM) Ps = 1000 (X11 XTerm mouse reporting) h -> Send Mouse X & Y on button press and release. See the section Mouse Tracking. l -> Don't Send Mouse X & Y on button press and release [-] Ps = 1001 (X11 XTerm mouse tracking) h -> Use Hilite Mouse Tracking. See the section Mouse Tracking. l -> Don't Use Hilite Mouse Tracking ESC ] Ps;Pt BEL Set Text Parameters Ps = 0 -> Change Icon Name and Window Title to Pt Ps = 1 -> Change Icon Name to Pt Ps = 2 -> Change Window Title to Pt [*] Ps = 10 -> menuBar command Pt (compile-time option) see menuBar section below [*] Ps = 20 -> Change default background pixmap to Pt (compile-time option) see XPM section below [*] Ps = 39 -> Change default foreground color to Pt (compile-time option) [-] Ps = 46 -> Change Log File to Pt (normally disabled by a compile-time option) [*] Ps = 49 -> Change default background color to Pt (compile-time option) Ps = 50 -> Set Font to Pt [*] special values of Pt (xiterm extension) "#+n" change up font(s) "#-n" change down font(s) if is missing or 0, a value of 1 is used "" change to font0 "#n" change to font ESC c Full Reset (RIS) ESC n Invoke the G2 Character Set (LS2) ESC o Invoke the G3 Character Set (LS3) -------------------------------------------------------------------------- xiterm XPM -------------------------------------------------------------------------- For the XPM XTerm escape sequence, "ESC ] 20; Pt BEL", Pt can be the name of the background pixmap followed by a sequence of scaling/positioning commands separated by semi-colons. The scaling/positioning commands: `?' = query scale/position `WxH+X+Y' = change scale and position `WxH+X' -> Y = X `WxH' -> Y = X = 50 `W+X+Y' -> H = W `W+X' -> H = W, Y = X `W' -> H = W, X = Y = 50 `=+X+Y' = change position (absolute) `+X+Y' = change position (relative) `=+X' -> Y = X `+X' -> Y = X `Wx0' -> W *= W/100 `0xH' -> H *= H/100 For example: eg. "\E]20;mona.xpm;200" loads the pixmap `mona.xpm' and sets the scaling to 200% or "\E]20;;200;?\a" sets the scaling of the current pixmap to 200% and displays the image geometry in the title. -------------------------------------------------------------------------- xiterm menuBar -------------------------------------------------------------------------- For the menubar XTerm escape sequence, "ESC ] 10; Pt BEL", the syntax of Pt is as follows: = title set menuBar title +/ access menuBar top level -/ remove menuBar top level NUL remove menuBar top level + [/menu/path/]submenu add/access menu - [/menu/path/]submenu remove menu + [/menu/path/]{item}[{rtext}] [action] add/alter item - [/menu/path/]{item} remove item + [/menu/path/]{-} add separator - [/menu/path/]{-} remove separator + ../ access parent menu (1 level) + ../../ access parent menu (multiple levels) Define menu quick arrows BeginRightLeftUpDownEnd NB: the square brackets indicate optional values. The title may contain the following format specifiers: %% literal '%' character %v xiterm version In the `action' associated with a menu item, special characters must be backslash-escaped: `\a', `\b', `\E `\e', `\n', `\r', `\t', '\octal' or in control-character notation: ^@, ^A .. ^Z .. ^_, ^? If `action' begins with a NUL (^@) character followed by non-NUL characters, the leading NUL is stripped off and the balance is sent back to xiterm. To send a string starting with a NUL (^@) character to the program, start action with a pair of NUL characters (^@^@), the first of which will be stripped off and the balance directed to the program. As a concession and a convenience to the many Emacs work-alike editors, an action string can be be starting with the following: `M-...', eg, `M-$' == `\E$' and for Meta-x commands, a carriage-return will be appended if missing and leading space will be skipped eg, `M-x apropos' == `\Exapropos\r' The option {rtext} will be right-justified. In the absence of a specified action, this text will be as the used. So, for example, Pt = `+{Open}{^X^F}' is equivalent to Pt = `+{Open){^X^F}{^X^F}' To only have the right-justified text, either use the same name for both left and right labels, eg: Pt = `+{Open}{Open} Open-File-Action' or simply hide the left label by preceeding it with a dot, eg: Pt = `+{.anyLabel}{Open} Open-File-Action' Since the left label is used for matching, it is necessary. The menus also provide a hook for `quick arrows' to provide easier user access. If nothing has been explicitly set, the default is to emulate the curror keys. The syntax permits each arrow to be altered individually or all four at once with re-entering their common beginning/end text. For example, to explicitly associate cursor actions with the arrows, any of the following forms could be used: Pt = `\\E[A' Pt = `\\E[B' Pt = `\\E[C' Pt = `\\E[D' or Pt = `\\E[A\\E[B\\E[C\\E[D' or Pt = `\\E[ABCD' It is probably easiest just to see the examples. -------------------------------------------------------------------------- Mouse reporting -------------------------------------------------------------------------- ESC [ M report mouse position The lower 2 bits of indicate the button: Button = & 3 - SPACE 0 = Button1 pressed 1 = Button2 pressed 2 = Button3 pressed 3 = button released (X11 mouse report) The upper bits of indicate the modifiers when the button was pressed and are added together (X11 mouse report only): State = & 28 - SPACE 4 = Shift 8 = Meta 16 = Control Col = - SPACE Row = - SPACE -------------------------------------------------------------------------- xiterm special graphics mode: -------------------------------------------------------------------------- ESC G Q query if graphics are available -> ESC G 0 no graphics available -> ESC G 1 graphics available (color only) Add more documentation here, if anyone actually cares. ESC G W ;;;: create window ESC G G : query window -> ESC G ESC G L start line ESC G P start point ESC G F start fill ESC G C clear window ESC G T ;; ;;: place text -------------------------------------------------------------------------- Key Codes -------------------------------------------------------------------------- Normal Shift Control Application Up ESC [ A ESC [ a ESC O a ESC O A Down ESC [ B ESC [ b ESC O b ESC O B Right ESC [ C ESC [ c ESC O c ESC O C Left ESC [ D ESC [ d ESC O d ESC O D Normal Shift Control Tab ^I ESC [ Z ^I BackSpace ^H ^? ^? Normal Shift Control Ctrl+Shift Home == Find ESC [ 1 ~ ESC [ 1 $ ESC [ 1 ^ ESC [ 1 @ Insert ESC [ 2 ~ paste-mouse ESC [ 2 ^ ESC [ 2 @ Execute ESC [ 3 ~ ESC [ 3 $ ESC [ 3 ^ ESC [ 3 @ End == Select ESC [ 4 ~ ESC [ 4 $ ESC [ 4 ^ ESC [ 4 @ Prior ESC [ 5 ~ scroll-up ESC [ 5 ^ ESC [ 5 @ Next ESC [ 6 ~ scroll-down ESC [ 6 ^ ESC [ 6 @ Delete ESC [ 3 ~ ESC [ 3 $ ESC [ 3 ^ ESC [ 3 @ Function Keys: (Note: Shift + F1-10 generates F11-20) Norm Shift Control Ctrl+Shift F1 ESC [ 11 ~ ESC [ 23 ~ ESC [ 11 ^ ESC [ 23 ^ F2 ESC [ 12 ~ ESC [ 24 ~ ESC [ 12 ^ ESC [ 24 ^ F3 ESC [ 13 ~ ESC [ 25 ~ ESC [ 13 ^ ESC [ 25 ^ F4 ESC [ 14 ~ ESC [ 26 ~ ESC [ 14 ^ ESC [ 26 ^ F5 ESC [ 15 ~ ESC [ 28 ~ ESC [ 15 ^ ESC [ 28 ^ F6 ESC [ 17 ~ ESC [ 29 ~ ESC [ 17 ^ ESC [ 29 ^ F7 ESC [ 18 ~ ESC [ 31 ~ ESC [ 18 ^ ESC [ 31 ^ F8 ESC [ 19 ~ ESC [ 32 ~ ESC [ 19 ^ ESC [ 32 ^ F9 ESC [ 20 ~ ESC [ 33 ~ ESC [ 20 ^ ESC [ 33 ^ F10 ESC [ 21 ~ ESC [ 34 ~ ESC [ 21 ^ ESC [ 34 ^ F11 ESC [ 23 ~ ESC [ 23 $ ESC [ 23 ^ ESC [ 23 @ F12 ESC [ 24 ~ ESC [ 24 $ ESC [ 24 ^ ESC [ 24 @ F13 ESC [ 25 ~ ESC [ 25 $ ESC [ 25 ^ ESC [ 25 @ F14 ESC [ 26 ~ ESC [ 26 $ ESC [ 26 ^ ESC [ 26 @ F15 (Help) ESC [ 28 ~ ESC [ 28 $ ESC [ 28 ^ ESC [ 28 @ F16 (Menu) ESC [ 29 ~ ESC [ 29 $ ESC [ 29 ^ ESC [ 29 @ F17 ESC [ 31 ~ ESC [ 31 $ ESC [ 31 ^ ESC [ 31 @ F18 ESC [ 32 ~ ESC [ 32 $ ESC [ 32 ^ ESC [ 32 @ F19 ESC [ 33 ~ ESC [ 33 $ ESC [ 33 ^ ESC [ 33 @ F20 ESC [ 34 ~ ESC [ 34 $ ESC [ 34 ^ ESC [ 34 @ Keypad: use Shift to temporarily override Appl-Keypad setting use Num_Lock to toggle Appl-Keypad setting if Num_Lock is off, escape sequences toggle Appl-Keypad setting ------ Normal Application KP_Enter ^M ESC O M KP_F1 ESC O P ESC O P KP_F2 ESC O Q ESC O Q KP_F3 ESC O R ESC O R KP_F4 ESC O S ESC O S XK_KP_Multiply * ESC O j XK_KP_Add + ESC O k XK_KP_Separator , ESC O l XK_KP_Subtract - ESC O m XK_KP_Decimal . ESC O n XK_KP_Divide / ESC O o XK_KP_0 0 ESC O p XK_KP_1 1 ESC O q XK_KP_2 2 ESC O r XK_KP_3 3 ESC O s XK_KP_4 4 ESC O t XK_KP_5 5 ESC O u XK_KP_6 6 ESC O v XK_KP_7 7 ESC O w XK_KP_8 8 ESC O x XK_KP_9 9 ESC O y -------------------------------------------------------------------------- xiterm+thai-1.10/doc/LSM.in0000644000175000017500000000271411375434151014106 0ustar thepthepBegin3 Title: xiterm Version: @VERSION@ Entered-date: @LSMDATE@ Description: xiterm is an 8-bit clean, colour xterm replacement that uses significantly less memory than a conventional xterm, mostly since it doesn't support toolkit configurability or Tek graphics, but also since features can be removed at compile-time to reflect your needs. Some xiterm features (compilation dependent): ANSI-color, bold/blink attributes modify foreground/background colours, scrollbars with arrow buttons, kanji and greek support, printer-pipe, XPM backgounds with on-the-fly scaling, user-definable menus. The distribution also includes rclock, the smaller/better xclock replacement with appointment scheduling and xbiff functionality. Keywords: xiterm colour color kanji xterm X11 vt100 terminal-emulator xpm Author: * John Bovey [Univ. Kent at Canterbury] was the creator of the original xvt. * Rob Nation [Lockheed] re-wrote most of xvt to make a substantiallly enhanced version called rxvt (Rob's xvt) and also wrote rclock (Rob's clock). * Mark Olesen [Queen's Univ. at Kingston] made various improvements and cleanups. * Guylhem Aznar [Purpan Univ. at Toulouse] renamed rxvt to xiterm, did the same as Mark Olesen and added full keyboard support for the PC102 . Maintained-by: @MAINT@ Primary-site: www.linux-france.com 205k xiterm-@VERSION@.tar.gz Original-site: Platforms: requires X11 installed Copying-policy: GPL End xiterm+thai-1.10/doc/xiterm+thai.1.in0000644000175000017500000004733011375434151016046 0ustar thepthep.\" @(#)xiterm+thai.1 -*- nroff -*- .\"------- .\" Dd distance to space vertically before a "display" .\" These are what n/troff use for interparagraph distance .\"------- .if t .nr Dd .4v .if n .nr Dd 1v .\"------- .\" Sp space down the interparagraph distance .\"------- .de Sp .sp \\n(Ddu .. .\"------- .\" Ds begin a display, indented .5 inches from the surrounding text. .\" .\" Note that uses of Ds and De may NOT be nested. .\"------- .de Ds .Sp .in +0.5i .nf .. .\"------- .\" De end a display (no trailing vertical spacing) .\"------- .de De .fi .in .. .TH XITERM+THAI 1 @DATE@ "X Version 11" "X Tools" .UC .SH NAME xiterm+thai \(em VT102 emulator for the X window system with Thai support .SH SYNOPSIS .B xiterm+thai .RI [ options ] .RB [ \-e .I command .RI [ args ]] .\" .\" change the following strings to suit your installation .\" hk = HOTKEY, bf = BIGFONT, sf = SMALLFONT .\" .ds hk Ctrl .ds hk Alt .ds bf > .ds sf < .\" end of editing region .SH DESCRIPTION .B xiterm+thai \(em version .B @VERSION@ \(em is a color vt102 terminal emulator intended as an .IR xterm (1) replacement for users who do not require features such as Tektronix 4014 emulation and toolkit-style configurability. As a result, .B xiterm+thai uses much less swap space \(em a significant advantage on a machine serving many X sessions. .SH OPTIONS The .B xiterm+thai options (mostly a subset of .IR xterm 's) are listed below. In keeping with the smaller-is-better philosophy, options may be eliminated or default values chosen at compile-time, so options and defaults listed may not accurately reflect the version installed on your system. .LP Note that .B xiterm+thai permits the resource name to be used as a long-option (\-\-/++ option) so the potential command-line options are far greater than those listed. .br For example: `xiterm+thai \-\-loginShell \-\-color1 Orange'. .TP .BR "\-help" , "\-\-help" Print out a message describing available options. .TP .BI \-display " displayname" Attempt to open a window on the named X display .RB ( \-d still respected). In the absence of this option, the display specified by the .B DISPLAY environment variable is used. .TP .BI \-geometry " geom" Window geometry .RB ( \-g still respected); resource .BR geometry . .TP .BR \-rv |+ rv Turn on/off simulated reverse video; resource .BR reverseVideo . .TP .BI \-bg " color" Window background color; resource .BR background . .TP .BI \-fg " color" Window foreground color; resource .BR foreground . .TP .BI \-pixmap: " file[;geom]" Specify XPM file for the background and also optionally specify its scaling with a geometry string; resource .BR backgroundPixmap . .TP .BI \-cr " color" The cursor color; resource .BR cursorColor . .TP .BI \-fn " fontname" Main normal text font; resource .BR font . .TP .BI \-fb " fontname" Main bold text font; resource .BR boldFont . .TP .BI \-fk " fontname" Main Kanji font; resource .BR kfont . .TP .BI \-km " mode" Kanji encoding mode; .BR eucj : EUC Japanese encoding. .BR sjis : Shift JIS encoding; resource .BR kanji_encoding . .TP .BI \-grk " mode" Greek keyboard translation; .BR iso : ISO-8859 mapping. .BR ibm : IBM-437 mapping; resource .BR greek_keyboard . .TP .BI \-tspace " int" Space count to trigger compensation for Thai rendering; default is 2; resource .BR thai_space . .TP .BI \-tkb " mode" Thai keyboard translation; .BR tis : TIS-820.2538; .BR ket: traditional Ketmanee; default is .BR ket ; resource .BR thai_keyboard . .TP .BI \-tim " mode" Thai input method (based on XIM); .BR BasicCheck : weak sequence check for character composition; .BR Strict : strong check for orthographic rules; .BR Passthrough : no check; if unset, value described in the .BR XMODIFIERS environment is used; resource .BR thai_im . .TP .BI \-name " name" Specify the application name under which resources are to be obtained, rather than the default executable file name. Name should not contain `.' or `*' characters. Also sets the icon and title name. .TP .BR \-ls |+ ls Start as a login-shell/sub-shell; resource .BR loginShell . .TP .BR \-ut |+ ut Inhibit/enable writing a utmp entry; resource .BR utmpInhibit . .TP .BR \-vb |+ vb Turn on/off visual bell on receipt of a bell character; resource .BR visualBell . .TP .BR \-sb |+ sb Turn on/off scrollbar; resource .BR scrollBar . .TP .B \-iconic Start iconified, if the window manager supports that option. .TP .BI \-sl " number" Save .I number lines in the scrollback buffer; resource .BR saveLines . .TP \fB\-e\fP \fIcommand\fP [\fIarguments\fP] Run the command with its command-line arguments in the .B xiterm+thai window. If this option is used, it must be the last on the command-line. If there is no .B \-e option then the default is to run the program specified by the .B SHELL environment variable or, failing that, .IR sh (1). .TP .BI \-title " text" Window title .RB ( \-T still respected); resource .BR title . .TP .BI \-n " text" Icon name; resource .BR iconName . .TP .B \-C Capture system console messages. .SH RESOURCES (available also as long-options) .B xiterm+thai accepts application defaults set in XAPPLOADDIR/Xiterm (compile-time defined: usually .BR /usr/lib/X11/app-defaults/Xiterm ) and resources set in .B ~/.Xdefaults or .BR ~/.Xresources . Note that when reading X resources, .B xiterm+thai recognizes two class names: .B XTerm and .BR Xiterm . The class name .B XTerm allows resources common to both .B xiterm+thai and .I xterm to be easily configured, while the class name .B Xiterm allows resources unique to .BR xiterm+thai , notably colors and key-handling, to be shared between different .B xiterm+thai configurations. If no resources are specified, suitable defaults will be used. Command-line arguments can be used to override resource settings. The following resources are allowed: .TP .BI geometry: " geom" Create the window with the specified X window geometry [default 80x24]; option .BR \-geometry . .TP .BI background: " color" Use the specified color as the window's background color [default White]; option .BR \-bg . .TP .BI foreground: " color" Use the specified color as the window's foreground color [default Black]; option .BR \-fg . .TP .BI color n : " color" Use the specified color for the color value .IR n , where 0\-7 corresponds to low-intensity (normal) colors and 8\-15 corresponds to high-intensity (bold = bright foreground, blink = bright background) colors. The canonical names are as follows: 0=black, 1=red, 2=green, 3=yellow, 4=blue, 5=magenta, 6=cyan, 7=white, but the actual color names used are listed in the .B "COLORS AND GRAPHICS" section. .TP .BI colorBD: " color" Use the specified color to display bold characters when the foreground color is the default. .TP .BI colorUL: " color" Use the specified color to display underlined characters when the foreground color is the default. .TP .BI cursorColor: " color" Use the specified color for the cursor. The default is to use the foreground color; option .BR \-cr . .TP .BI cursorColor2: " color" Use the specified color for the color of the cursor text. For this to take effect, .B cursorColor must also be specified. The default is to use the background color. .TP .BI cursorColorThai: " color" Use the specified color for the cursor while in Thai mode. The default is to use the foreground color. .TP .BI reverseVideo: " boolean" .BR True : simulate reverse video by foreground and background colors; option .BR \-rv , .BR False : regular screen colors [default]; option .RB + rv . See note in .B "COLORS AND GRAPHICS" section. .TP .BI scrollColor: " color" Use the specified color for the scrollbar [default #B2B2B2]. .TP .BI backgroundPixmap: " file[;geom]" Use the specified XPM file (note the `.xpm' extension is optional) for the background and also optionally specify its scaling with a geometry string .BR WxH+X+Y , in which .BR "W" / "H" specify the horizontal/vertical scale (percent) and .BR "X" / "Y" locate the image centre (percent). A scale of 0 displays the image with tiling. A scale of 1 displays the image without any scaling. A scale of 2 to 9 specifies the number of images in that direction. No image will be magnified beyond 10 times its original size. The maximum permitted scale is 1000. [default 100x100+50+50] .TP .BI path: " path" Specify the colon-delimited search path for finding XPM files, in addition to the paths specified by the .B RXVTPATH and .B PATH environment variables. .TP .BI font: " fontname" Select the main text font used [default 7x14]; option .BR \-fn . .TP .BI font n : " fontname" Specify the alternative font .IR n . The default font values: .\"------- .\" Table start .\"------- .nr t0 \w'\fBfont4\fP:\0\0\0\0'u .ta \n(t0u .Ds .nf .BR font ":\t7x14" .BR font1 ":\t6x10" .BR font2 ":\t6x13" .BR font3 ":\t8x13" .BR font4 ":\t9x15" .fi .De .\"------- .\" Table end .\"------- .TP .BI boldFont: " fontname" Specify the name of the bold font to use if .B colorBD has not been specified and it is not possible to map the default foreground color to color 8\-15 [default NONE]. This font must be the same height and width as the normal font; option .BR \-fb . .TP .BI kfont: " fontname" Select the main Kanji text font used [default k14]; option .BR \-fk . .TP .BI kfont n : " fontname" Specify the alternative Kanji font .IR n . If compiled for Kanji, the Roman and Kanji font sizes should match. The default font values: .\"------- .\" Table start .\"------- .nr t0 \w'\fBkfont4\fP:\0\0\0\0'u .ta \n(t0u .Ds .nf .BR font ":\t7x14" .BR font1 ":\t8x16" .BR font2 ":\t9x18" .BR font3 ":\t12x24" .BR font4 ":\t13x26" .Sp .BR kfont ":\tk14" .BR kfont1 ":\tjiskan16" .BR kfont2 ":\tjiskan18" .BR kfont3 ":\tjiskan24" .BR kfont4 ":\tjiskan26" .fi .De .\"------- .\" Table end .\"------- .TP .BI kanji_encoding: " mode" Set the Kanji encoding mode to be used; .BR eucj : EUC Japanese encoding [default]. .BR sjis : Shift JIS encoding; option .BR \-km . .TP .BI greek_keyboard: " mode" Set the Greek keyboard translation mode to be used; .BR iso : ISO-8859 mapping (elot-928) [default]. .BR ibm : IBM-437 mapping (DOS codepage 737); option .BR \-grk . Use .B Mode_switch to toggle keyboard input. For more details, see the distributed file .BR README.greek . .TP .BI thai_space: " int" Set the space count to trigger space compensation for previous combining marks; default value is 2; option .BR -tsp . .TP .BI thai_keyboard: " mode" Set the Thai keyboard translation map to use; .BR tis: TIS-820.2538 map; .BR ket: traditional Ketmanee map; default value is .BR ket ; option .BR -tkb . .TP .BI thai_im: " mod" Set the Thai input method (based on XIM) to use; .BR BasicCheck : weak sequence check for character composition; .BR Strict : strong check for orthographic rules; .BR Passthrough : no check; if unset, value described in the .BR XMODIFIERS environment is used; option .BR -tim . .TP .BI title: " text" Set window title string, the default title is the command-line specified after the .B \-e option, if any, otherwise the application name; option .BR \-title . .TP .BI iconName: " text" Set the name used to label the window's icon or displayed in an icon manager window, it also sets the window's title unless it is explicitly set; option .BR \-n . .TP .BI mapAlert: " boolean" .BR True : de-iconify (map) on receipt of a bell character. .BR False : no de-iconify (map) on receipt of a bell character [default]. .TP .BI visualBell: " boolean" .BR True : use visual bell on receipt of a bell character; option .BR \-vb . .BR False : no visual bell [default]; option .RB + vb . .TP .BI loginShell: " boolean" .BR True : start as a login shell by prepending a `\-' to .B argv[0] of the shell; option .BR \-ls . .BR False : start as a normal sub-shell [default]; option .RB + ls . .TP .BI utmpInhibit: " boolean" .BR True : inhibit writing record into the system log file .BR utmp ; option .BR \-ut . .BR False : write record into the system log file .B utmp [default]; option .RB + ut . .TP .BI print-pipe: " string" Specify a command pipe for vt100 printer [default .IR lpr (1)]. Use .B Print to initiate a screen dump to the printer and .B Ctrl-Print or .B Shift-Print to include the scrollback as well. .TP .BI scrollBar: " boolean" .BR True : enable the scrollbar [default]; option .BR \-sb . .BR False : disable the scrollbar; option .RB + sb . Note that the scrollbar position (left/right) and its type (with/without arrows) is compile-time selected. .TP .BI smallfont_key: " keysym" If enabled, use .BI \*(hk- "keysym" to toggle to a smaller font [default .BR \*(hk-\*(sf ]. .TP .BI bigfont_key: " keysym" If enabled, use .BI \*(hk- "keysym" to toggle to a bigger font [default .BR \*(hk-\*(bf ]. .TP .BI saveLines: " number" Save .I number lines in the scrollback buffer [default 64]; option .BR \-sl . .TP .BI meta8: " boolean" .BR True : handle Meta (Alt) + keypress to set the 8th bit. .BR False : handle Meta (Alt) + keypress as an escape prefix [default]. .TP .BI cutchars: " string" The characters used as delimiters for double-click word selection. The built-in default: .br .B TAB SPACE BACKSLASH `"'&()*,;<=>?@[]{|} .TP .BI keysym. sym : " string" Associate .I string with keysym .I sym .RB ( 0xFF00 \- .BR 0xFFFF ). It may contain escape values (\ea: bell, \eb: backspace, \ee, \eE: escape, \en: newline, \er: return, \et: tab, \e000: octal number) or control characters (^?: delete, ^@: null, ^A ...) and may enclosed with double quotes so that it can start or end with whitespace. The intervening resource name .B keysym. cannot be omitted. This resource is only available when compiled with .BR FAKE_RESOURCES . .SH "THE SCROLLBAR" Lines of text that scroll off the top of the .B xiterm+thai window (resource: .BR saveLines ) and can be scrolled back using the scrollbar or by keystrokes. The normal .B xiterm+thai scrollbar has arrows and its behaviour is fairly intuitive. The .B xterm-scrollbar is without arrows and its behaviour mimics that of .IR xterm . .LP Scroll down with .B Button1 .RB ( "xterm-scrollbar" ) or .BR Shift-Next . .br Scroll up with .B Button3 .RB ( "xterm-scrollbar" ) or .BR Shift-Prior . .br Continuous scroll with .BR Button2 . .SH "MOUSE REPORTING" To temporarily override mouse reporting, for either the scrollbar or the normal text selection/insertion, hold either the Shift or the Meta (Alt) key while performing the desired mouse action. .LP If mouse reporting mode is active, the normal scrollbar actions are disabled \(em on the assumption that we are using a fullscreen application. Instead, pressing Button1 and Button3 sends .BR ESC[6~ " (Next)" and .BR ESC[5~ " (Prior)," respectively. Similarly, clicking on the up and down arrows sends .BR ESC[A " (Up) and" .BR ESC[B " (Down)," respectively. .SH "TEXT SELECTION AND INSERTION" The behaviour of text selection and insertion mechanism is similar to .IR xterm . .TP .BR "Selection" : Left click at the beginning of the region, drag to the end of the region and release; Right click to extend the marked region; Left double-click to select a word; Left triple-click to select the entire line. .TP .BR "Insertion" : Pressing and releasing the Middle mouse button (or .BR Shift-Insert ) in an .B xiterm+thai window causes the current text selection to be inserted as if it had been typed on the keyboard. .SH "CHANGING FONTS" You can change fonts on-the-fly, which is to say cycle through the default font and others of various sizes, by using .BR Shift-KP_Add " and " .BR Shift-KP_Subtract . Or, alternatively (if enabled) with .BR \*(hk-\*(bf " and" .BR \*(hk-\*(sf , where the actual key can be selected using resources .BR smallfont_key / bigfont_key . .SH "LOGIN STAMP" .B xiterm+thai tries to write an entry into the .B utmp file (usually .BR /etc/utmp ), so that it can be seen via the .IR who (1) command, and can accept messages. To allow this feature, .B xiterm+thai must be installed setuid root. .SH "COLORS AND GRAPHICS" If graphics support was enabled at compile-time, .B xiterm+thai can be queried with ANSI escape sequences and can address individual pixels instead of text characters. Note the graphics support is still considered beta code. .LP In addition to the default foreground and background colors, .B xiterm+thai can display up to 16 colors (8 ANSI colors plus high-intensity bold/blink versions of the same). Here is a list of the colors with their .B rgb.txt names. .\"------------ .\" Table start .\"------------ .nr t0 \w'\fBcolor15\fP\0\0'u .nr t1 \n(t0+\w'(bright magenta)\0\0'u .ta \n(t0u \n(t1u .Ds .nf .BR color0 "\t(black)\t= Black" .BR color1 "\t(red)\t= Red3" .BR color2 "\t(green)\t= Green3" .BR color3 "\t(yellow)\t= Yellow3" .BR color4 "\t(blue)\t= Blue3" .BR color5 "\t(magenta)\t= Magenta3" .BR color6 "\t(cyan)\t= Cyan3" .BR color7 "\t(white)\t= AntiqueWhite" .Sp .BR color8 "\t(bright black)\t= Grey25" .BR color9 "\t(bright red)\t= Red" .BR color10 "\t(bright green)\t= Green" .BR color11 "\t(bright yellow)\t= Yellow" .BR color12 "\t(bright blue)\t= Blue" .BR color13 "\t(bright magenta)\t= Magenta" .BR color14 "\t(bright cyan)\t= Cyan" .BR color15 "\t(bright white)\t= White" .Sp .ta \n(t1u .BR foreground "\t= Black" .BR background "\t= White" .fi .De .\"---------- .\" Table end .\"---------- .LP It is also possible to specify the color values of .BR foreground , .BR background , .BR cursorColor , .BR cursorColor2 , .BR colorBD , .B colorUL as a number 0\-15, as a convenient shorthand to reference the color name of color0\-color15. .LP Note that .B \-rv .RB ( "reverseVideo: True" ) simulates reverse video by always swapping the foreground/background colors. This is in contrast to .I xterm where the colors are only swapped if they have not otherwise been specified. For example, .TP .B xiterm+thai \-fg Black \-bg White \-rv would yield White on Black, while on .I xterm it would yield Black on White. .SH ENVIRONMENT .B xiterm+thai sets the environment variables .BR TERM, .B COLORTERM and .BR COLORFGBG . The environment variable .B WINDOWID is set to the X window id number of the .B xiterm+thai window and it also uses and sets the environment variable .B DISPLAY to specify which display terminal to use. .B xiterm+thai uses the environment variables .B RXVTPATH and .B PATH to find XPM files. .SH FILES .TP 16 .B /etc/utmp System file for login records. .TP 16 .B /usr/lib/X11/rgb.txt Color names. .SH "SEE ALSO" .IR xterm (1), .IR sh (1), .IR resize (1), .IR X (1), .IR pty (4), .IR tty (4), .IR utmp (5) .SH BUGS Selecting/pasting very large chunks of text is a problem. But as is the case for .IR xterm , it is a bug of the pseudo terminal driver of those systems. .LP xiterm+thai 1.0 has the utmp support cleaned-up and supports .B utmpx (i.e. Solaris 2.x) but there are still some problems. Please inform the maintainer of the correct solutions to utmp problems since he doesn't have root access of his own to test utmp. .LP Cursor change support is not yet implemented. .LP Click-and-drag doesn't work with X11 mouse report overriding. .LP Graphics support is fairly crude. .LP For some fonts there are problems with pixel-droppings being left behind when simulated bold (overstrike) precedes a space character. Fixing .B xiterm+thai to handle these cases requires a lot of energy. So the easiest course by far is to specify a boldFont, specify colorBD or, if it was compiled without NO_BRIGHTCOLOR, to select a foreground color that matches the pixel values of color 0\-7 so that overstrike bold won't be used. .LP Like .IR xterm , .B xiterm+thai handles mono-space fonts only, and only TIS-620 fonts are supported. .SH AUTHOR John Bovey, University of Kent, 1992. .LP Very very very heavily modified by Rob Nation .LP Greek keyboard input: Angelo Haritsis .LP Utmpx addition (Solaris 2.x) and extensive reworking of pseudo-tty handling and addition of BSD sgtty terminal handling support by Raul Garcia Garcia 16/10/95. .LP mj olesen (changes.txt 2.11 to 2.20) .LP Thai language support: Vuthichai Ampornaramveth .\" for those who don't trust LSM entries, be explicit here .SH "CURRENT MAINTAINER" @MAINT@ .SH "LOCATION" .br xiterm+thai-1.10/doc/README.xvt0000644000175000017500000001426711375434151014631 0ustar thepthep------------------------------------------------------------------------- Rxvt is a heavily modified version of xvt, many modifications were made by Rob Nation to make it a little more compact and to add a few simple features. This is the README that came with xvt-2.0. It is included mainly to give the original author credit for his work. README file for xvt 2.0 ----------------------- Xvt is an X terminal-emulator that is designed to be more or less compatible with xterm while using much less swap space. It is mainly intended for use at sites which use large numbers of X terminals but may also be useful on single workstations that are short of memory. On a SPARCstation running SunOS4, an initially invoked xvt uses about 1/3 megabyte of swap while xterm uses about 1.3 megabytes (obtained by running pstat rather than ps which seems to give unreliable size figures on SPARCs). The main way that xvt achieves its small size is by avoiding the use of the X toolkit. The current version of xvt is our default X terminal emulator and has been used for eight months by students, computing support staff and service users and so is fairly well tested. Supported architectures ----------------------- One of the major changes between xvt-1.0 and 2.0 is that xvt-2.0 is much more portable. The released version should build and run on all the architectures I have access to, namely: SunOS4, SunOS5, HP-UX 8.0, HP-UX 9.0, DEC OSF/1 V1.2 and ULTRIX 3.?. In addition, the teletype initialisation code has been completely restructured to make it more portable. Almost all the system dependent code is in the single source file, ttyinit.c. Xterm features not supported ---------------------------- - Tektronix 4014 emulation - Session logging - Pop-up menus. The only one of xterm's popup menu commands that is provided in xvt is displaying and hiding of the scrollbar and this is done simply by pressing any mouse key in the window with the CONTROL key held down. - Toolkit style configurability. In particular, xvt does not allow the user to remap the mouse or keyboard keys. Major xterm features that are supported --------------------------------------- - VT100 emulation. Most of the main escape sequences are supported - certainly all those used by the standard screen based UNIX applications. - Lines that scroll off the top of the window are saved can be scrolled back with a scrollbar. - Text selection and insertion including double and triple click for words and lines. Differences between xvt2.0 and xvt1.0 ------------------------------------- - xvt2.0 is eight bit clean and will generate and display eight bit characters. The META key can be used to generate characters with the eighth bit set (in eight bit mode) or prefix by escape (in seven bit mode). - The teletype setup code has been rewritten to make it much more portable. See the comments at the head of ttyinit.c. - Exposure handling has been made much more efficient so that xvt should now be useable with window managers that provide opaque window movement. - VT100 graphics characters are supported for fonts that include them. - There is now a -ls option to enable the use of a login shell. - Colored text cursors are now supported. - There is support for the -C (console window) option but only on SunOS 4. - Bold characters are generated by overstriking if no bold font is specified. - Function keys generate escape sequences as in xterm. - A number of bugs have been fixed: - Setting the title without a terminating ^G no longer locks up. - Paste followed by a keystroke will always insert in the correct order. - Pasting an uninitialised string will not cause a crash. Other differences between xvt and xterm --------------------------------------- - Xvt has a couple of additional enquiry escape sequences: ESC[7n - causes xvt to respond with the name of its X display in a form that can be used to initialise the DISPLAY environment variable. If this is done in a user's .cshrc file it provides a way to automatically update DISPLAY after an rlogin. Something like the following should work if the initial ^[ in the echo command is an ESC character: if(!($?DISPLAY)) then if($?term) then if($term =~ xterm*) then stty -echo >/dev/tty echo -n '^[[7n' >/dev/tty setenv DISPLAY `line /dev/tty endif endif endif ESC[8n - causes xvt to respond with a hex encoded copy of the server's magic cookie which can be used to update a user's .Xauthority file. We have a program to do this which could be made available if anyone is interested. Known Bugs ---------- - xvt does not know about transferring selections in installments and so making large selections or trying to insert large selections will fail. The maximum selection size supported is server dependent but seems to be a little under 64k on all our servers. - xvt does not look in all the approved places for its X resources. It does, however, work correctly with resources that have been loaded into the server using xrdb Building and installing xvt --------------------------- Xvt does not use imake but does come with a simple Makefile configuration scheme that provides some help with getting the Makefile right. If you want to build xvt on one of the supported architectures then you should uncomment the appropriate definition at the start of the Makefile and then run `make config', which will modify other Makefile comments to bring them into line with the chosen architecture. To install xvt, you should edit the MANDIR and BIN pathnames in the Makefile and then type 'make install' as root. When installed for general use, xvt needs to belong to root and have the setuid flag set so that it can make entries in the /etc/utmp file. Thanks to all the people who have mailed bug reports, patches and local improvements. Some requested additions have gone into V2.0, others perhaps should have, but were left out due to lack of time. Please send bug reports and WIBNIs to: John Bovey Computing Laboratory University of Kent at Canterbury Canterbury Kent UK email: jdb@ukc.ac.uk xiterm+thai-1.10/doc/HISTORY0000644000175000017500000011253311375434151014210 0ustar thepthepFor SVR4 - you'll still need to add -DSVR4 to CFLAGS. Would be nice to do with autoconfig, but so far no patches contributed. Xiterm 1.0 \--------- 1. Various cleans up 2. Disabled menu use and rxvt graphics, since menu is really bugged and rxvt graphics nearly never used . Both are however kept in src/Xtensions if you want to enable them . 3. Full keyboard support by default (Home, End, Page up & down, keypad with different behaviour depending if numlock is on or off) 4. 8 bit is now default since it doesn't eat memory ! 5. Changed name to xiterm to evolve as a program != rxvt 6. Asked original programmer and changed copyright from "don't make money" to GPL, for an easer implantation in various places . 7. New goal : be compatible with every language of the world :-) 2.19 to 2.20 \----------- 1. You can now add snazzy looking menus to any plain (non-X) text application. At the moment, the menuing system is simple but functional. The syntax for controlling the menubar is documented in doc/rxvt.doc, but note that an XTerm sequence `ESC ] 10; Pt BEL' is used so menus created for rxvt will be ignored by an ordinary XTerm. It provides sub-menus, click-and-drag, and even some user definable `quick' arrows keys. However menu manipulation could use refinement to permit multiple menus to be defined -- and the menu refreshing could also use some improvement, but it can be extended and refined later as required/desired. The files doc/menu.sh and doc/jedmenu.sl show sample implementations of menus. --> It compiles and runs on my machine (AIX 3.2.5) but THIS IS CONSIDERED BETA (or even ALPHA) CODE! 2. DEC private modes: Bug fix for 's'ave and 'r'estore parameters, added a 't'oggle parameter to DEC private modes. 3. Made Backspace key selectable with DEC private mode ESC [ ? 36 h/l/s/r/t (high/low/save/restore/toggle) 4. Changed the way the scrollBar is realized to permit on-the-fly toggling of the scrollBar display and added a DEC private mode escape sequence for that. Smoother redraw of scrollBar. Better proportions for the arrows allows a slightly narrower scrollBar. 5. Added support for XTerm font changing sequence: `ESC ] 50; Pt BEL', with (as usual) a few extras. See doc/rxvt.ref 6. Adapted experimental XPM buffering from that supplied by Carsten Haitzler . 7. Replaced `wait' with `waitpid' in src/command.c::Child_signal to avoid a race condition and permit use of pclose() on SunOS. Patch provided by , Thanks John! 8. For easier XPM handling, added `path' resource/long-option and substantially enhanced pixmap scaling to provide very exact control over scaling and positioning of the XPM background image. The XPM XTerm escape sequence has been extended to provide a convenient facility for on-the-fly rescaling. Export COLORTERM="rxvt-xpm" instead of COLORTERM="rxvt" 9. Added export COLORFGBG to give hints to color applications. Typically one of these values is exported, in which `fg' and `bg' are numbers 00-15: COLORFGBG="default;default" -fg -bg colors don't match any of color 0-15 COLORFGBG="fg;default" -fg color matches color 0-15, but -bg color doesn't COLORFGBG="default;bg" -bg color matches color 0-15, but -fg color doesn't COLORFGBG="fg;bg" -fg -bg colors match color 0-15 When compiled with XPM support, the last two values are rendered as follows: COLORFGBG="default;default;bg" -bg color matches color 0-15, but -fg color doesn't COLORFGBG="fg;default;bg" -fg -bg colors match color 0-15 10. Disable Shift+Prior/Next and scrollBar if saveLines == 0. Slight change to key-processing so `shift+meta+key' and `shift+ctrl+key' gets processed as `shift+key'. This provides a way to avoid interpretating `Shift+Prior', `Shift+Next', and `Shift+Insert'. Also, added DEC private mode sequence `ESC [ ? 35 h/l/s/r/t' to disable Shift+key interpretation. Provide for Ctrl+Shift+ combinations for function keys. See doc/rxvt.ref 11. Always match long-option names, even when only preceded by a single -/+. 2.18 to 2.19 \----------- 1. Minor alteration to input mode for Kanji processing. 2. rclock: -adjust option, support for exec on startup syntax, date format may now also include the century 3. Made mouse double-click respect autowrap lines. 4. Added marks for folded editing. 5. Added Offix DND (Drag 'n' Drop) protocol. Added support for XA_TARGETS. 6. added Carsten Haitzler XPM patches to load an XPM file for the background of the terminal window. Uses resource `Rxvt.backgroundPixmap' or long-option `--backgroundPixmap' 7. Use these (XTerm) keybindings exclusively and remove the old equivalent bindings: Shift-Prior = scroll up Shift-Next = scroll down Shift-Insert = paste mouse selection Shift-KP_Add = bigger font Shift-KP_Subtract = smaller font 2.17 to 2.18 \----------- 1. Check for NULL pointers in command-line processing (oops) Also fixed processing of `hidden' arguments such as -d, -g, -T 2. Fixed terminfo hpa/vpa: was `\E..' instead of `\E[..' added invisible cursor (ESC[?25h / ESC[?25l) 3. Fixed broken kanji characters (?? and disappeared cursor box ??) thanks to 4. In privileges(), changed setuid/setgid to seteuid/seteguid so that it's possible to switch back to root later. Perhaps fixed svr4 problems (reports no tty, no job control) in get_tty() ... need to detect these SVR4 features in the configure script. 5. Restored scrollColor, topShadowColor, bottomShadowColor resources that somehow got lost between the beta and release versions. For monochrome displays, fixed scrollbar so it will be visible and suppress color changes. 6. Final? iteration on selection. Store selection text with LF line-endings but paste into rxvt with CR endings. Selection now preserves the newline when trailing space is stripped from non-autowrap lines. Compile-time support for using a keystroke to paste from the cut-buffer. 7. Fixed utmp.c to handle both sysv and bsd pty names. More changes in the works to improve documentation and eliminate race conditions ... this, thankfully, is being done by someone else. 8. Added European language support (X11R6) - let me know of problems and fixes since I only have X11R5. 9. Changed names of color10-color17 to color8-color15 to match with those used by color_xterm ... sorry for the inconvenience, but I didn't have an X11R6 xterm manpage until now and long-term compatibility is quite important. Added a real bold font (define USE_BOLDFONT). I still think it's too much work to avoid pixel droppings for overstrike fonts. Added support for specifying colors for bold/underline (colorBD/colorUL) but it's only done when the foreground = the default foreground ... see the manpage. Compile-time selection of TERM="xterm-color". Reduced the number of rarely-used command-line options since they are accessible on the command-line via their resource names as long options. More rigid differentiation between long and short options: long options are --/++ prefixed; short options -/+ prefixed. Added long-option help to give the resource names. Removed run-time selection of right-hand scrollbar and arrows. Removed run-time selection of (pageup_key/pagedown_key/alert_key). 10. Changed Ctrl-Up,Down,Left,Right to emit "\EOa,b,c,d" instead of the previous "\E[^A,^B,^C,^D" to avoid problems associated with having an embedded "^C" in a key-sequence. Disallow 80/132 column switching as the default (same as xterm). 11. Check for seteuid(). Add "ttcompat" module for SVR4. 12. A few people suggested removing the keystroke for toggling MapAlert and so I have. I agree that it was pointless and/or annoying since there was no way of determining the current toggled state anyhow. 13. Fixed missing `ttydev' for _sgi. Fixes for BSD utmp support. Exported WINDOWID before the window was created (oops). 14. Mouse cut&paste of autowrapped lines should be improved, fixed bug in screen.c::scroll_text(). 15. As was pointed by a user -->> in keeping with X conventions, only an application that starts with 'x' should capitalize the first two letters of the resource file, so the rxvt resource file (and class name) should be named Rxvt not RXvt, this is a minor point. 16. rclock: As well as message reminders, rclock can launch programs and (if no message text is given) act as a cron-type of program. Made default font `7x14'. Fixed graphics context when mail is waiting and a reminder is issued - so the message is actually visible! 17. As suggested by a user, changed the bolding algorithm to be slightly more intuitive: 1. colorBD (if specified) 2. color0-7 -> color8-15 (if possible) 3. boldFont (if specified and found) 4. overstrike (last resort) This takes advantage of the color capability and is the most consistent when toggling font sizes on-the-fly. If you never want overstrike (looks ugly and leaves pixel droppings) or boldFont (you like to switch font sizes on-the-fly), you can remove them at compile-time. The other elements are similarly compile-time selectable. 18. Another user suggestion: scrollbar made more distinct by having the `trough' a different color from the slider -- I opted for making it the same as the default background color so that the slider and arrows appear to `float' on the window. Also removed topShadowColor, bottomShadowColor resources as unnecessary. 19. Dropped distribution of vttest since Tom Dickey is working on an improved version. 2.16 to 2.17 \----------- 1. Fixed problem in scr_refesh_region() that was introduced in v2.16 The problem of `pixel droppings' continues when bold is simulated using overstrike. Using XCopyArea() sometimes helps, but the preferred and simplest solution is item 4 below. 2. Removed 7bit mode. Changed definition of meta so that the ESCAPE is the default and using meta to set the 8bit on an option that can be made run-time configurable (assuming people still use this). Added -/+rv command-line option, resource reverseVideo. NB: it works slightly differently from xterm's in that foreground/background are swapped even if they have been explicitly set. Removed NO_COLOR option -- no more monochrome rxvt (one too #ifdef's). Inherit existing stty settings (at least for control characters) and set value of BackSpace appropriately. Added defines DONT_GUESS_BACKSPACE and NO_DELETE_KEY 3. Added 3D style scrollbar and removed all the old bitmapped scrollbars and arrows with the only exception being the xterm lookalike XTERM_SCROLLBAR which is available in a single width. With arrows, scrollbar behaviour somewhat resembles Motif behaviour. Without arrows, it's the standard xterm behaviour. The default scrollbar (defined at compile-time or set by using scrollBar: True) is to have a scrollbar with arrows arranged on the right-hand side. The scrollBar resource is now exclusively a boolean value scrollbar resources: scrollColor topShadowColor bottomShadowColor NB: if topShadowColor/bottomShadowColor are unset, their values are calculated from scrollColor using an algorithm adapted from fvwm so it shouldn't be too hard to find scrollbar colours that look good with your window manager and don't consume an entire colormap. 4. Added smarter handling of bold/blink when applied to the default fg/bg colours: If the pixel value of fg/bg matches the pixel value of colour COLOR0 through COLOR7, then applying bold/blink to the default fg/bg will select the appropriate colour from BOLD0 through BOLD7 instead of using the overstrike bold. This seems to be the best way to handle bold/blink attributes when the foreground/background match and ANSI colour anyhow. For convenience, it is possible to use colour aliases (next item) for the foreground/background colours instead. My preference is a dull Canadian look: RXvt*foreground: 7 RXvt*background: 10 5. Changed colour aliases (item 7 of last change) and dropped the `#' prefix. This avoids confusion with the regular #rrggbb format of specifying colours and is unambiguous since there are no X11 colours starting with a digit. This also avoids the need to quote the `#' to protect against shell interpretation. 6. Added colour cursor support. -cr (cursorColor), as per XTerm -> the (rectangle) cursor colour -cr2 (cursorColor2), only RXvt -> the text colour. The cursorColor2 maintains contrast in a colour environment and is optional. Thanks Raul Garcia Garcia for the idea. Cleaned up scr_refresh (again ) to avoid some unnecessary colour changes and removed the reverse video graphics context and just swap foreground/background colours instead. 7. Typo in command.c: had seteuid() instead of seteguid() Use cfsetospeed()/cfsetispeed() for POSIX termios handling. 8. Ignore the loginShell option/resource for programs that DON'T end with "sh". A hack but it keeps `rxvt -ls -e rlogin machine' from failing and I don't know of (m)any shells that don't end in "sh". 9. Hard-code dependencies in Makefiles to avoid using X11 makedepend. Added check for atexit() to catch the problem that exists on SunOS but not on Solaris. 10. Collected command-line option parsing and X11 resources into a single file (xdefaults.c), and introduced a monolithic structure (with bit-flags for logical options) to eliminate the massive if-else-if parsing and to reduce possible overlaps/oversights Short help provided for an incorrect argument. For more consistency, more flexibility, and fewer switches, made -grk4/-grk9 options obsolete, and replaced with `-grk mode'. Added the resource `greek_keyboard' while I was there. It is also possible to use a `--' or `++' prefix to get so-called `long options' that correspond to the resource name. For example, rxvt +ls -bg Blue rxvt +loginShell -background Blue rxvt ++loginShell --background Blue rxvt ++ls --bg Blue Error! 11. Changed REFRESH_PERIOD to 1 in command.c, the old idea of providing for fast and furious scrolling needs to be reconsidered so that `cat' works. Still needs some investigation. 12. Changed scr_poweron(), which corresponds to `ESC c', to also reset the scrollback buffer. 13. Changed scr_change_screen() (when compiled with NO_SECONDARY_SCREEN) so that switching from the secondary to primary screen will push the old secondary screen into the scrollback buffer. This is fairly useful if your terminfo has have rmcup=\E[?47l\E8, smcup=\E7\E[?47h. It is NOT particularly useful if rmcup includes \E[2J, like some do. Running with NO_SECONDARY_SCREEN provides faster switching than with a real secondary screen and saves memory too. 14. Now that key values have mostly stabilized, moved the compile-time key choices to "feature.h" ("keys.h" now obsolete). 2.15 to 2.16 \----------- 1. Misc cleanup, rxvt once again passes the vttest (and reverse video works again). Kanji support tested and seems to be okay. Finally, an okay set of regular/bold colours. Compile-time option for a right-side scrollbar. 2. Ctrl-minus now (correctly) generates ^_ [0x1F]. Changed termcap/terminfo to use normal cursor keys instead of application cursor keys (rmkx/smkx, ke/ks) -- otherwise subsequent rxvt/xterm starts with the application cursor keys active. 3. Fixed scr_reset() so that resizing is a lot more sensible. Implemented the equivalent SouthWest resizeGravity (xterm X11R5) so the bottom line of text on the screen stays fixed. If the window is made taller, additional saved lines will be scrolled down onto the screen; if the window is made shorter, lines will be scrolled off the top of the screen, and the top saved lines will be dropped. The old resizing code is available with -DOLD_UGLY_RESIZE. 4. Altered code so all man-page documented command-line options will not trigger errors even if the feature wasn't compiled into rxvt. Added old, backward compatibility command-line options, but they're simply ignored. Eventually they can be removed -- perhaps Jan'97? `-8': use `+7' `-fat': use `-sb' `-thin': use `-arrows' `-meta8thbit' use `-meta8' `-metaescape' use `-meta' `-font_list' use `-font1', `-font2', etc. These ones are just too weird to support: `-ls-': use `+ls' `-ma-': use `+ma' 5. Removed secure-keyboard option, too problematic and obscure. 6. First attempt at GNU autoconfig. Still needs some work, but it's mostly okay. 7. Added minor aliases for foreground/background colours. This permits colour specifications like -fg "#13" -bg "#10", which would set the foreground to colour 13 (bright yellow) and the background to colour 10 (bright black). It's not terribly useful yet, but might eventually be a nice way to have bold/blink colour work even on with the standard fg/bg colours. 2.14 to 2.15 \----------- 1. Small bug: initial width incorrect when there was no scrollBar. 2. Close the gaping security hole. Renounce setuid/setgid privileges immediately and only take them up as needed -- chown() or writing into /etc/utmp. 3. Reverted to using `<' and '>' to toggle smaller/bigger fonts. It seems that many didn't like KP_Subtract/XK_KP_Add -- conflicts with some editors, and not all terminals have a Keypad anyhow. 4. Man page reformatted by Piercarlo Grandi so that it "now is done in the most delightful [sic] elegant 'roff style :-)" 5. Started to integrate the Kanji support based on old patches from the Linux-JE (Japanese Extensions) project. Consider it alpha until one of the JE authors gives it a thorough check. 6. Added compile-time selection of a few different scrollbar widths. 7. When reading X resources, rxvt now recognizes two class names: "XTerm" and "RXvt". The reason for two distinct names is that there are many options common between rxvt and xterm -- to which the class name "XTerm" permits easy access and configuration -- but there are also several options, notably colours and key-handling, unique to rxvt but which are useful to share between different rxvt configurations; the class name "RXvt" permits this. NB: The "RXvt" class takes precedence (in the event of a clash) and is the only one ever used for the application defaults file. 8. The initial value used for the Backspace key (^H or ^?) is now determined from the value of CERASE used to set the termios structures. This removes the need for the BACKSPACE_AS_DELETE compile-time option. 2.13 to 2.14 \----------- 1. Default HOTKEY prefix can now be choosen as `meta', `ctrl' or `shift'. Moved font toggle to KP_Add/KP_Subtract to resemble resolution toggling of the XFree86 server (Linux) and so that Alt-< can generate ESC-< for Emacs usage. Man page and usage() reflect the changes. Note that if you choose the hotkey to be `shift', to mimic the Linux console scrollback, you'll probably want different keybindings for mapAlert and Secure. The choice of the HOTKEY (ctrl or meta) prefix and some of the key-strings can be compile-time defined in "rxvtkeys.h", although probably the only changes desired will be in the string value associated with XK_Delete and in the choice of a HOTKEY (ctrl or meta) prefix. Use shift or ctrl to temporarily toggle Backspace from ^H to ^?. Use shift to temporarily toggle the application keypad. 2. Patch so that setting bold or blink works before or after changing the colour (it used to only work before changing the colour). Also added the option of having DOS VGA colours. Thanks Avery Pennarun 3. Extensive reworking of pseudo-tty handling and addition of BSD sgtty terminal handling and new utmpx (Solaris 2.x) support. MANY thanks to Raul Garcia Garcia (rgg@tid.es). POSIX wtmp support added by Piet W. Plomp (piet@icce.rug.nl) Added -/+ut option (resource: utmpInhibit) so you can sometimes be harder to find :) 4. Finally? cleaned-up selection so that it works properly -- clears a previously selected region without causing a core dump -- define NEW_SELECTION. I believe that this should fix a long-standing problem with the selection mechanism -- probably back from when selection of the scrollback was added -- whereby all accounting was done in terms of screen row values [0 .. RxvtWin.rows-1] plus the current offset value. The anchor and end points were scrolled with the screen, but the beginning point wasn't and extending a region that had its anchor scrolled-off would give complete garbage. The new selection scheme has lots of bounds-checking (too much?) to prevent these problems. If PRINT_PIPE is not defined, then you can use PrintScreen to dump some of the current selection state -- this should help debugging. Thanks to John Davis (davis@space.mit.edu) and Piet W. Plomp (piet@icce.rug.nl) for helping to diagnose the problem. 5. Use information request `ESC [ 8 n' to change the window title to the current rxvt version so you can find out what version you have. 6. Added simple code to permit run-time definition of the keysyms 0xFF00 - 0xFFFF if KEYSYM_RESOURCE (for FAKE_RESOURCES only) is defined. It's not as pretty as that used by xterm since it only works with keysym values rather that key names, but the impact on code size is quite minimal. I use it in conjunction with `-name vm' to remap arrow and function keys for tn3270 ... quite handy. At the moment the string length is only limited by the line length (currently 256) used in "resources.c" The syntax (at the moment) is rxvt*keysym.0xFFnn: "a string value" where `nn' is a 2 digit hex value 00 to FF. Of course if there were an easy and small means of converting key names to keysym values, then that would be better. The enclosing quotes are required to start/end with whitespace. Most of the usual escape values can be used: \b - backspace \e - escape \n - newline \r - carriage return \t - tab \000 - octal number Anyhow, here's a brief example of what it looks like in ~/.Xdefaults: ! F11 key - mimic the output of F1 rxvt*keysym.0xFFC8: \e[11~ ! F12 key - whatever rxvt*keysym.0xFFC9: Hello World!\n"\"String\" ends with whitespace " ! Delete key - remap rxvt*keysym.0xFFFF: "Delete :)" !Scroll_Lock as flow-control (^S) rxvt*keysym.0xFF14: \023 7. Oops -- fixed resource name from scrollbar to scrollBar. Fixed cursor colours to black on white (like xterm) for the scrollbar cursors, but I've left the xterm (`I'-bar) cursor as foreground on background because it looks so nice. Allocate all colours when creating the window so that we don't have to worry about it later and so that we can avoid potential hassles with colour-hungry applications like Netscape. 8. Added a way to distinguish an rxvt from an xterm via the obsolete ESC Z sending the vt100 answer string with 'c' -> 'C'. Added support for resolving the actual IP number of the host for remote DISPLAYs. Changed the answer back for ESC[7n to add a trailing newline to support easier input into the shell. When the display is local (i.e. :0), we add support for sending the first non-loopback interface IP number as the DISPLAY instead of just sending the incorrect ":0". This way telnet/rlogin shells can actually get the correct information into DISPLAY for xclients. Courtesy of Chuck Blake [Note: I've not had a chance to thoroughly test this -- mjo] 2.12 to 2.13 \----------- 1. Shift and Control now only work for non-application mode cursor keys and with function keys. 2. Override XTerm mouse reporting with either Mod1 or Shift. X11 mouse reporting now properly includes modifier keys (see rxvt.ref). Although this effectively degenerates to the Control modifier alone since both Shift and Meta are used to temporarily disable mouse reporting -- I don't know an easy way around this but that's what XTerm does, although since it uses Control to pop-up menus, that doesn't get transmitted either. 3. Moved a few more configuration items from Imakefile to configure.h 4. Added XAPPLOADDIR define to the Imakefile to allow use of the application defaults file XAPPLOADDIR/RXvt when rxvt has been compiled with FAKE_RESOURCES. Now, the following files are checked: XAPPLOADDIR/RXvt (compile-time defined) $HOME/.Xdefaults or $HOME/.Xresources suggested by John Gotts 5. Applied patches by Edward D.H. Liu to fix the speed of pasting rxvt's selection to motif, xew or tk. Finally! reasonable pasting speed to these applications. 6. patches by Gregory Margo for xterm-style proportional scrollbar behaviour: If pointer is near top, scroll one line. If pointer is near bottom, scroll full page. refreshPeriod resource and -refresh option ... still wishing for faster screen refreshing. 7. Bug fix for partial matches (FAKE_RESOURCES). In addition to resources for resource name `rxvt', also get resources for class name `XTerm' as well. Remove checking for `command' resource since it's not found in xterm nor was there any code in place to parse the command arguments ... better just to use the command-line -e option. Replace `fontList' with font1, font2, ... etc. for better xterm compatibility and for ease of configuration. Changed processing of string resources and command-line string options to avoid allocating redundant memory. 8. Previously selected region is now properly cleared when Button1 is pressed. Still have problems with click-and-drag when Mod1 or Shift is used to override mouse reporting -- argh! Until someone gets this properly patched, use Button1 followed by Button3 (to extend region) in these instances. 9. Understands ANSI set default fg/bg colour (\E[39m / \E[49m) 10. In the screen accounting used in screen.c, use a '\n' to terminate wrapped lines instead of '\0'. This should avoid mouse selection of wrapped lines from including a bogus newline. No known side-effects, but changes isolated by #define NEW_WRAPTYPE. 2.11 to 2.12 \----------- 1. Extra functionality for XTerm mouse report mode. If mouse reporting is enabled (the application will handle mouse events) the normal scrollbar operation is disabled -- instead rxvt sends UP/DOWN for the arrow buttons and PageUp/PageDown when Button1 or Button3 are clicked on the scrollbar. Use Mod1 (Alt) key to get the normal scrollbar/arrow button actions and also to get the normal selection functions -- so that you can still cut/paste between X applications. 2. New colour possibilities -- 16 colours. Instead of using fatter characters, a bold attribute now uses a brighter foreground colour. Similarly, a blink attribute will use a brighter background colour. It is also possible to choose these colours through the resources (color0 -- color7) permit specification of the ANSI colours (black, red, green, yellow, blue, magenta, cyan, white), the resources (color10 -- color17) are the brighter bold/blink equivalents. Define USE_FAKE_BOLD to disable. 3. Extensive clean-up of source and headers to separate interdependencies, remove unused variables. Introduced static variables wherever possible to limit scoping and reduced the number of external variables. 4. Allow NumLock to toggle on/off the application keypad. Backspace sends '\b', Ctrl-Backspace sends '\177'. Define BACKSPACE_AS_DELETE to reverse these values or use the escape sequence: ESC [ 36 h Backspace key sends BS ESC [ 36 l Backspace key sends DEL XK_End used to send "\033Ow", which is identical to XK_KP_7 and confuses EDT-type editors. Now, Home = "\033[7~" End = "\033[8~" Changed Alert & Secure keys from Alt-i & Alt-s to Alt-I & Alt-S so they aren't so easily toggled. 5. Extra keystroke info. Pass Control and Shift indicators for function keys (similar to the XJed editor) eg, F1 = ESC [11~ C-F1 = ESC [11^ S-F1 = ESC [11$ also, pass indication of shift status for arrow-keys eg, Up, Down, Right, Left = ESC [A, ESC [B, ESC [C, ESC [D S-Up, S-Down, S-Right, S-Left = ESC [a, ESC [b, ESC [c, ESC [d You wouldn't be able to use these keys for termcap/terminfo applications, but the key sequences are available for remapping within an application. 6. Added configure.h which is included by each source file and by the Imakefile. Common compilation defines are now all contained in configure.h with minor system defines remaining in Imakefile -- makes it much easier to configure. Used XCOMM macro in Imakefile so that it actually works. Also added defaults.h for defining user-specific startup defaults. 7. Added rxvt.ref to provide documentation of the various terminal sequences that are processed. Updated man page to reflect changes. 8. Use xterm-style -/+ to turn on/off options, rationalized resource names to more closely resemble xterm. Option Resource -help - -display displayname - -geometry geom geometry: -bg color background: -fg color foreground: -color color color: where = [0-7], 1[0-7] -fn fontname font: -fontList names fontList: ... -name string - -/+ls loginShell: True/False -/+ma mapAlert: True/False -/+vb visualBell: True/False -/+sb scrollbar: True/False -/+arrows scrollbar: Arrows/True/False -ic - -meta8 meta: 8bit -/+meta meta: True/False -sl number saveLines: -grk4 - -grk9 - -print-pipe name pipe-pipe: -e command arg ... command: -T string title: -n string iconName: -C - -/+7 bits: 7/8 -secure keysym secure_key: -pageup keysym pageup_key: -pagedown keysym pagedown_key: -bigfont keysym bigfont_key: -smallfont keysym smallfont_key: -prkey keysym printscreen_key: greektoggle_key: cutchars: 9. Fixed Button actions for XTerm-style scrollbar so that Button1 and Button3 do different things as they are supposed to. Replace -/+fat with -/+sb and -/+arrows for more consistency with XTerm. Decreased width of `fat' scrollbar (make closer to xterm) and increased width of `thin' scrollbar (arrows too small) -- they are now the same width. Also made it possible to remove the scrollbar altogether. Added a visual bell. Added many more defines to further reduce code size for various cases, see "configure.h". It is also possible to alter settings in "defaults.h" for configuration options that will only affect screen.c and xsetup.c, this should help with compile-time customization for those who don't want to use Xdefaults. Added the define REPLACE_SELECTION_NEWLINE to make the substitution of newlines with carriage returns for selection pasting a compile-time option. 10. Fixed the graphics samples so that if you want to it's actually possible to compile them. Added -name command-line option so that it's possible to select different sets of resources. 11. Integrated initial support for X11 mouse reporting and added Shift + Function Keys support. 2.10 to 2.11 1. If NEW_COLOR_MODEL is defined in screen.c, the new model I described in an earlier email is used. (apparantly there are two, slightly differnt models for using color extensions in a vt-compatible terminal. This flag lets you switch. 2. If XTERM_MOUSE_REPORT is defined in command.c, mouse reporting is turned on/off via the appropriate escape sequences. XTerm already provides this support. 3. If .Xdefaults does not exist, .Xresources is searched for. It seems that many here use .Xresources. 2.09 to 2.10 1. Really fixed the color problem (?) Got color-ls, and it works now. 2. Added patch to allow run-time selection of font list. 2.07 to 2.09 1. Fixed some color-usage errors. 2. Added double and triple-click support compliments of ah@doc.ic.ac.uk (Angelo Haritsis) 3. Added Print Screen capability, as in most vt-100's 2.06 to 2.07 1. Fixed problems with rxvt screwing up tty permisssions (?) 2.03 to 2.06 1. Fixed a limit which imposed a maximum width for the terminal window of 255 characters. There is no limit now. 2. Made provision for applications to get mouse-click feedback when user clicks in a graphics window. See graphics_sample 2.02 to 2.03 1. Fixed memory management just a little. 2.0 to 2.02 1. Bug fixes for color and graphics. 1.97 to 2.0 1. Added ANSI color support. Compile with -DCOLOR 2. Added a graphics mode. Compile with -DGRAPHICS 1.96 to 1.97 1. Bug in refresh() which was causing slow refreshes after clear-screens was fixed. Showed up during emacs start-up. 1.95 to 1.96 1. rxvt did bad things if it received mouse - Motion events without a preceeding button-press. Fixed. 1.94 to 1.95 1. Created a substitute for XGetDefaults, which seemed to account for 1/2 to 2/3 of the memory used by rxvt (according to the SIZE field of ps output). My substitute only reads the .Xdefaults file. Compile with -DFAKE_RESOURCES to get my mini- XDefaults handling, -DREAL_RESOURCES to keep XGetDefault. 1.93 to 1.94 1. Fixed some minor long-standing errors in the vt100 emulation. 2. Fixed ALT- handling in command.c 3. Fixed minor bug with start-of-selection location. 4. Added xterm-type "extend selection" feature using mouse button 3. Button 1 always starts a new selection. Button3 tries to extend the current selection if possible. 5. Fixed problem with bold-face fonts overflowing into the next character for some fonts. 1.92 to 1.93 1. ran gprof to find bottle-necks in the code. Halved user time, but had little effect on total time required to update the display. Seems worth keeping for the more efficient user-time, though. At this point, I think that most of the elapsed time is spent waiting for input or waiting for the X buffers to flush. 2. Used to refresh the screen every 2.2 screen-fulls during flat-out scrolling. Really cuts down on scroll-time. Now, refresh every screen-full (or when there's a pause in activity), but when flat-out scrolling starts, decrease the refresh period, so that its every 10th screenful after a little while. This has no noticeable visible effect, since the scrolling text is absolutely unintelligible anyway, but will improve the scroll "feel" when doing just one or two screenfulls, ie in an ls -l. 3. Surrounded the code which uses XCopyArea with #ifdef's I have never seen this help performance, but I think that there may be some video-systems which benefit from this, particularly in a full-screen editor or slow scrolling type of setting. 4. Performance in flat out scrolling, text only, on a sparc-10, displaying rxvt on an HDS x-terminal: nation@snoopy>/usr/bin/time rxvt -e cat k 6.1 real 3.1 user 2.5 sys nation@snoopy>/usr/bin/time xterm -e cat k 40.8 real 4.6 user 3.4 sys 1.91 to 1.92 1. Added greek-keyboard support patches. 1.85 to 1.91 1. assorted minor patches 1.82 to 1.85 1. Fixed ESC c handling. 2. Fixed minor selection handling bug. 1.81 to 1.82 1. Fixed slow refresh during selection process 2. Fixed problem of not correctly clearing selections of 1 character. 1.80 to 1.81 1. Fixed some scrolling problems, problems with partially obscured windows. 2. Added some neat debugging capability in debug.c 3. Patched up rclock. 1.74 to 1.80 1. Fixed core dump from selecting past the bottom of the screen 2. Fixed a few escape sequences, per the vttest program 3. Broke and fixed handling of moved/resize/new-font handling. 4. Still can't change tab stops correctly. 5. Ran vt-100 test suite. Added capability to change tab stops and enter reverse video, and to switch from 80 to 132 columns and back. Fixed a seg-fault in scroll(). 1.70 to 1.74 1. Fixed cursor drawing errors. 2. Improved smoothness of scroll-back operations. 3. Applied some SVR4 patches. 4. Applied HPUX patches, and a few cursor display patches 5. Fixed up font-changing routines a bit. 6. Fixed a scrolling problem for windows taller than the scroll-back buffer. 1.6 to 1.7 1. Fixed the problem with random rendition flags in the scroll back buffer 2. Fiddled with re-drawing on the scroll-bar, and with how often refreshing occurs. 3. Incorporated some AIX patches. 4. Included #ifdef'd changes to support vt100 printer. 5. Fixed send_string routine, so that it doesn't loose data. 6. Complete re-write of screen.c 1.5 to 1.6 1. Removed all use of a seperate bold font. Now uses over-striking exclusively. 2. Added some more optimizations for drawing speed when the window is re-sized or moved. 3. Implemented speed ups in screen.c 1.47 to 1.48 1. Cleaned up re-drawing on expose events, so rxvt only re-draws the newly exposed parts of the screen. 2. Fixed backspace, which must have broken in 1.45. 3. Added command line option of iconic startup. from 1.45 to 1.47 1. Incorporated improved bsd utmp handling from dperry@ringer.cs.utsa.edu (David Perry) 2. Fixed a very minor bug where the solid-cursor can leave a a bit of a ghost when you resize the window. Its stupid, but it always bothered me. from 1.4 to 1.45 1. Fixed scrolling error when switching to larger fonts 2. Fixed utmp-entry removal for SYSV type systems. 3. Icorportated patches for FreeBSD and svr4 xiterm+thai-1.10/doc/README.rxvt.greek0000644000175000017500000001242511375434151016101 0ustar thepthep ------------------------------- rxvt support for greek keyboard ------------------------------- A. Haritsis rxvt supports both ELOT-928 (ISO-8859-7 standard) and IBM-437 keyboard translations for greek character entry. It is possible to start rxvt windows in any of the two translations, making it possible to use both translations modes simultanesuly on the same screen! No need to convert your files back and forth if you don't want to. When in greek mode, type ; or : twice to emit the respective symbol. No need to switch language mode back and forth! rxvt ISO-8859-7 includes mappings for the following (usually forgotten): anw teleia = ;. << = ;< >> = ;> Also: Copyright = ;c Section = ;s For Greek Elot-928 or IBM-437 keyboard for rxvt & X greek entry support you will need to: 1) compile rxvt with an ANSI C compiler (eg gcc) as follows: Edit configure.h and uncomment the line: /*#define GREEK_SUPPORT*/ Type: xmkmf -a make and your rxvt executable with greek support should be created. Install it as you would do for the normal rxvt. There is no need to change its name. It works fully as a normal rxvt but if you press the 'toggle' keysym (see below) it will switch into greek translation mode. The extra memory it takes in less than 4 kBytes. 2) install greek elot & ibm437 fonts(s) for X-windows eg. cp a_greek_font.pcf.Z /usr/lib/X11/misc/ and ammend the fonts.dir and fonts.alias in /usr/lib/X11/misc/. Greek fonts are available as a separate file which you can download from sunsite (/pub/Linux/X11/misc/greek-xfont-pack.tgz). A new release of a FULL set of fixed (and proportional and Type1 for use by netscape etc) can be found in the HCR archive - see at end). I might upload them at sunsite et all as well. 3) include the following in your X resources: rxvt.font: grfixed (or the name of your preferred greek font) rxvt.bits: 8 (default) rxvt.greektoggle_key: Mode_switch (default) where grfixed is an alias for one of the elot-928 font in the pack. Remember that the default keyboard translation is ELOT928. If you need to start rxvt with suppport for IBM437, use the command line of rxvt to set mode & font (command line option -grk4 can do this). Remember to use an Elot font with the Elot translation mode and a 437 font with the IBM437 mode. You can choose any keysym you wish as the "toggler" greek_switch_keysym. Choosing `VoidSymbol' will effectively _disable_ the greek keyboard. The default is keysym `Mode_switch'. For XFree86 this is defined in the /usr/lib/X11/Xmodmap.* files as: keycode 113 = Mode_switch (it is the Right Alt key or ALtGr) You may define it to be something else with a command like: xmodmap -e "keycode ... = Mode_switch" or changing your ~/.Xmodmap file (see xmodmap(1) and X(1) about this). I personally prefer the AltGr key on PC X terminals since it allows fast switching. Of course this might not be liked by left-handed people. You can redefine it to whtever you like under X, but I would NOT recommend keycodes that have other uses. 5) Not all programs are 8-bit clean -- ie, they sometimes strip the top bit of a character which is essential for the greek fonts. Unfortunately bash is one of these programs (at least I couldn't figure out how to make it to work). Use tcsh instead: it is 8-bit clean. You will generally need to include in your ...rc files: For sh/bash: LC_CTYPE=iso_8859_1; export LC_CTYPE LESSCHARSET=latin1; export LESSCHARSET For bash to be 8-bit clean, add the following lines to ~/.inputrc: set meta-flag on set convert-meta off set output-meta on For csh/tcsh: setenv LC_CTYPE iso_8859_1 setenv LESSCHARSET latin1 Still some applications will have problems. Emacs has its own support for greek characters achieved with the .el script written by sarantos@csd.uch.gr (for 19.20 +). It might be possible to have greek support via emacs invocations with the -nw argument (with this version of rxvt) but I have not tried it. Elvis (vi clone) works fine. I highly recommend vim version 3.15 and later. I have added support for making native languge vi'ing very easy (see langmap option). It's by far the most powerful vi (or maybe editor :-) I have ever seen. If some (terminal-based) applications do not work, please direct complaints to their authors stating that you would like them to be 8-bit clean. I will soon release a linux version of an 8-bit clean curses lib and versions of some useful programs that work with it (eg ytalk). Watch the HCR archive. Do not expect programs that are not running within an rxvt window to have greek keyboard support. For this, it will be needed to change the Xlib so that it supports 4-state FSMs (rather than only 2 - I do not count shift keys or caps lock) for keyboard entry (required for greek keyboards). And something amusing and (maybe) useful: some filesystems (including SunOS and Linux filesystems -- haven't checked others) allow names with 8-bit characters; so you can create files or directories with names containing greek characters! Enjoy, Angelo Haritsis For more greek related tools/fonts etc, have a look at the HELLENIC RESOURCES ARCHIVE (HCR) : ftp://dolphin.doc.ic.ac.uk/pub/greek/ maintained by the above author. xiterm+thai-1.10/doc/TODO0000644000175000017500000000201011375434151013600 0ustar thepthep- Add a front-end config program - Add midnight commander support for scroolbar - Click-and-drag doesn't work for X11 mouse report overriding - It'd be nice to have the scrollbar move when the arrows are pressed and to scroll continuously. - Speed-up screen refreshes - Add X11 mouse highlighting mode? (NOT LIKELY) - Fix problem with pixel-droppings left when bold has been simulated using an overstrike. (NOT LIKELY) - Make cleaner scrollbar updates? - Fix configure to detect SVR4 and to handle install properly when it is found to be ./install.sh - Add Unicode support - Add support for spawning modules (like the way fvwm does). It should then be possible to make a standalone Tek or other graphics window and even some simple pop-up mouse menus that could communicate with rxvt, but not bloat its size. Nice idea, but I'll never have time to even start, so eager volunteers would be nice. - provide a way to hook the scrollbar for private use? eg, for easier scrolling with a standard text editor. xiterm+thai-1.10/README.thai0000644000175000017500000000607611375434151014167 0ustar thepthep** Thai XITERM 1.0 (beta) ** زԪ Ƿ ** 31 Ҥ 2541 Thai XITERM Terminal ѺкԴ͡Ѻ X-Windows ʹѺʹعû͹ʴ Thai XITERM Ѳ ´ѴŧҨҡ XITERM س֡´öͧ XITERM ҡ README *********************************** ** öͧ Thai XITERM ** *********************************** - ͹ »ѺҤ F1 Shift+Space ¹ ʴʶҹТͧ鹾 - Ѵµ˹ column ʹͧѺóء 㹡ʴ Сͤ͡ Mouse - 좹Ҵ硪ѧ˹觢ͧкҧóء١ͧ - áͧҧ óءͨѴ˹觢ͧ column Ţǡѹ çѹ ê¨з;ͧҧҡѺ ӹǹ˹ ( 2 ͧ) *********************************** ** ԸաõԴ ** *********************************** ä configure ¤ make # ./configure # make src/xiterm ˵: - ҡк libXpm Фö ٻҾ繾鹢ͧ Terminal 㹺ҧ configure öǨ libXpm ֧к libXpm Դ 㹡óչҡͧö еͧӡ src/Makefile -DHAVE_LIBXPM *********************************** ** ҹ ** *********************************** Ըա¡ҹ xiterm -fn thai9x13 -cursorColorThai red ¤͹ thai9x13 ͹ ᴧ ҹöк .Xdefaults xiterm*font: thai9x13 xiterm*cursorColorThai: red ͹Ѻ¡͡ -fn -cursorColorThai ء С ͡е÷ǢͧѺ/ -fn (font) : кتشѡ÷ -cursorColorThai (cursorColorThai) : բͧʶҹл͹ -tspace (thai_space) : кبӹǹͧҧ辺͹ͧҧͪóء 0 ҡͧ÷ӡê -pixmap (backgroundPixmap) : кٻҾ (Դ .xpm) 繩ҡѧͧ Terminal ҧ .Xdefaults xiterm*font: thai9x13 xiterm*cursorColorThai: red xiterm*thai_space: 2 xiterm*backgroundPixmap: /home/vuthi/pop.xpm *********************************** ** ** *********************************** ѭ - ͤ͡еͧ͡ҡ仢 ŧҧҹ ҡӡѺѹ /óء ͹/ǹ١͡ҨТҴ TODO - ѴдѺóء§ (͹Ҥҡտ͹дѺóء) ҡѭ س价 : زԪ Ƿ ****************** ͤͺ **************** ش԰Ȥس Һôҽ٧ѵѨҹ ҿѹѲԪҡ ҧҭ蹦Һձ ø觫ѴִѴ Ѵ͹Ѫ ԺѵԻоĵԡ˹ ٴ ҿѧ xiterm+thai-1.10/install.sh0000755000175000017500000001124411375434151014361 0ustar thepthep#! /bin/sh # # install - install a program, script, or datafile # This comes from X11R5. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. # # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" tranformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 xiterm+thai-1.10/test/0000755000175000017500000000000011701206764013331 5ustar thepthepxiterm+thai-1.10/test/menus/0000755000175000017500000000000011701207032014445 5ustar thepthepxiterm+thai-1.10/test/menus/menu.sh0000644000175000017500000000673411375434146015776 0ustar thepthep#!/bin/sh -- # not necessarily useful, but an example of menuBar toggle_menu () { echo -n "[?10t" } menucmd () { echo -n "]10;$@" } menu_clear () { menucmd "-/"; menucmd '=' } menu_title () { menucmd '=' $1 } show_menu () { echo -n "[?10h" } menu () { menucmd '+' $@ } rm_menu () { menucmd '-' $1 } menuitem () { menucmd "+{$1} $2" } rm_menuitem () { menucmd "-{$1}" } separator () { menucmd "+{-}" } rm_separator () { menucmd "-{-}" } #------------------------------------------------------------------------- menu_clear # clear all menus menu_title "xiterm-%v" menu "/Programs" if [ ! -z "$EDITOR" ]; then menuitem "Editor}{`basename $EDITOR`" "$EDITOR\\r" else menuitem "vi}{vi" "vi\\r" fi menuitem "Mail" "Mail\\r" menuitem "News" "slrn\\r" menuitem "News-in-term" "xiterm -e slrn&" menuitem "Commander" "mc\\r" menu "../" exit menu "/Shell/{finger} finger\\r" if [ ! -z $BASH ]; then separator menuitem "Version}{^X^V" fi menuitem ".name" "invisible label!" menu "../" menu "/Terminal/Font" menuitem "Normal" "^@\\E]50;#\\a" menuitem "Larger" "^@\\E]50;#+\\a" menuitem "Smaller" "^@\\E]50;#-\\a" separator menuitem "Font 1" "^@\\E]50;#1\\a" menuitem "Font 2" "^@\\E]50;#2\\a" menuitem "Font 3" "^@\\E]50;#3\\a" menuitem "Font 4" "^@\\E]50;#4\\a" menu "../Screen" menuitem "ReverseVideo" "^@\\E[?5t" menuitem "Toggle Width" "^@\\E[?3t" menuitem "Cursor" "^@\\E[?25t" menuitem "Switch" "^@\\E[?47t" separator menuitem "menuBar" "^@\\E[?10t" menuitem "scrollBar" "^@\\E[?30t" menu "../Keys" menuitem "XTerm" "^@\\E[?35t" menuitem "Backspace" "^@\\E[?36t" menuitem "Cursor" "^@\\E[?1t" menuitem "KeyPad" "^@\\E[?66t" menu "../" if [ "$COLORTERM" = "xiterm-xpm" ]; then separator menu "Background/Pixmap" menuitem "None" "^@\\E]20;\\a" separator # load .xpm files menuitem "Wingdogs" "^@\\E]20;wingdogs\\a" menuitem "Mona" "^@\\E]20;mona\\a" menu "../Scaling" menuitem "Full" "^@\\E]20;;100x100+50+50;?\\a" menuitem "Tiled" "^@\\E]20;;0\\a" separator menuitem "400/25%" "^@\\E]10;\\^@\\\\E]20;;400x025x00x4000x25;?\\^G\\a" menuitem "250/40%" "^@\\E]10;\\^@\\\\E]20;;250x040x00x2500x40;?\\^G\\a" menuitem "200/50%" "^@\\E]10;\\^@\\\\E]20;;200x050x00x2000x50;?\\^G\\a" menuitem "125/80%" "^@\\E]10;\\^@\\\\E]20;;125x080x00x1250x80;?\\^G\\a" menu "../Position" menuitem "5%}{5%" "^@\\E]10;\\^@\\\\E]20;;+5+0-5+0+0-5+0+5;?\\^G\\a" menuitem "10%}{10%" "^@\\E]10;\\^@\\\\E]20;;+10+0-10+0+0-10+0+10;?\\^G\\a" separator menuitem "centre" "^@\\E]20;;=+50+50;?\\a" menu "../../" fi # COLORTERM separator menuitem "Version" "^@\\E[8n" menu "/" show_menu # some extra dumb menus to test that bounds are respected exit menu "/Terminal/Font/Font Sizes" menuitem "Normal" "^@\\E]50;#\\a" menuitem "Larger" "^@\\E]50;#+\\a" menuitem "Smaller" "^@\\E]50;#-\\a" separator menu "Specific" menuitem "Font 1" "^@\\E]50;#1\\a" menuitem "...}" menu "1" menuitem "a" "a" menuitem "b" "b" menuitem "c" "c" menuitem "d" "d" menuitem "e" "e" menuitem "f" "f" menuitem "g" "g" menuitem "h" "h" menuitem "i" "i" menuitem "j" "j" menuitem "k" "k" menuitem "l" "l" menuitem "m" "m" menuitem "n" "n" menuitem "o" "o" menuitem "p" "p" menuitem "q" "q" menuitem "r" "r" menuitem "s" "s" menuitem "t" "t" menuitem "u" "u" menuitem "v" "v" menuitem "w" "w" menuitem "x" "x" menuitem "y" "y" menuitem "z" "z" menu "../../../{-}" menuitem "junk" "junk\\r" menu "/" #--------------------------------------------------------------------- eof xiterm+thai-1.10/test/menus/jedmenu.sl0000644000175000017500000001363611375434146016464 0ustar thepthep%--------------------------------*-SLang-*-------------------------------- % An example of menuBar for the JED editor #if$TERM xterm* define toggle_menu () { tt_send ("\e[?10t"); } define menucmd (str) { tt_send (Sprintf ("\e]10;%s\a", str, 1)); } define menu_clear () { tt_send ("\e]10;-/\a\e]10;=\a"); } define menu_title (str) { menucmd (strcat ("=", str)); } define menu (str) { menucmd (strcat ("+", str)); } define rm_menu (str) { menucmd (strcat ("-", str)); } define menuitem (str,ev) { menucmd (Sprintf ("+{%s} %s", str, ev, 2)); } define rm_menuitem (str) { menucmd (Sprintf ("-{%s}", str, 1)); } define menuFn () { variable ch, cmd; cmd = Null_String; forever { ch = getkey (); if (ch == '\r') break; cmd = strcat (cmd, char (ch)); } eval (cmd); } local_setkey ("menuFn", "\e[m"); % menu define menu_eval (str,ev) { menuitem (str, strncat ("\\e[m", ev, "\\r", 3)); } define menukey (str, key) { menucmd (Sprintf ("+{%s}{%s}", str, key, 2)); } define separator () { menucmd ("+{-}"); } define rm_separator () { menucmd ("-{-}"); } % no other reasonable way to stack hooks? !if (is_defined ("resume_esc")) variable resume_esc = Null_String; !if (is_defined ("suspend_esc")) variable suspend_esc = Null_String; % enable menus and permit 80/132 column toggle resume_esc = strcat (resume_esc, "\e[?10;40h"); suspend_esc = strcat (suspend_esc, "\e[?10;40l"); define resume_hook () { tt_send (resume_esc); } define suspend_hook () { tt_send (suspend_esc); } define exit_hook () { suspend_hook (); menu_clear (); exit_jed (); } %------------------------------------------------------------------------- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % possibly useful things for the JED editor -- assuming Emacs bindings menu_clear (); % clear menus before construction % format _jed_version xyyzz into x.yy-zz menu_title (Sprintf ("Jed %d.%d-%d (xiterm-%%v)", (_jed_version/10000), ((_jed_version mod 10000)/100), (_jed_version mod 100), 3)); % some convenient arrows menucmd ("\\E[mbskip_wordbackward_paragraphforward_paragraphskip_word\\r"); menu ("/File"); menukey ("Open", "^X^F"); menukey ("Save", "^X^W"); menukey ("Save Buffers","^Xs"); menukey ("Insert File", "^Xi"); separator (); menukey ("Shell Cmd", "M-!"); separator (); menukey ("Exit", "^X^C"); menu ("/Edit"); menukey ("Undo", "^_"); % menukey ("Redo", "^G^_"); separator (); menukey ("Cut", "^W"); menukey ("Copy", "M-W"); menukey ("Paste", "^Y"); menu ("/Search"); menukey ("Forward", "^S"); menukey ("Backward", "^R"); menukey ("Replace", "M-%"); separator (); menu ("Regexp"); menukey ("Forward", "M-^S"); menukey ("Backward", "M-^R"); menu_eval ("Replace", "query_replace_match"); menu ("../../"); menu ("Buffers"); menukey ("Kill", "^Xk"); menukey ("List", "^X^B"); menukey ("Switch", "^Xb"); separator (); menu ("Modes"); menu_eval ("C", "c_mode"); menu_eval ("SLang", "slang_mode"); menu_eval ("None", "no_mode"); menu_eval ("LaTeX", "latex_mode"); menu_eval ("Text", "text_mode"); menu_eval ("Fortran", "fortran_mode"); menu ("../../"); menu ("/Window"); menukey ("Delete", "^X0"); menukey ("One", "^X1"); menukey ("Split", "^X2"); menukey ("Other", "^Xo"); separator (); menukey ("Recenter", "^L"); separator (); menu ("Color Schemes"); menu_eval ("White-on-Black", "set_color_scheme(\"white-on-black\")"); menu_eval ("Black-on-White", "set_color_scheme(\"black-on-white\")"); menu_eval ("White-on-default-Black","set_color_scheme(\"white-on-default-black\")"); menu_eval ("Black-on-default-White","set_color_scheme(\"black-on-default-white\")"); menu ("../"); menu ("../"); menu ("/Utils"); menu_eval ("Bufed", "bufed"); menu_eval ("Dired", "dired"); menu_eval ("Mail", "mail"); menu_eval ("Rmail", "rmail"); separator (); menu_eval ("EvalBuffer", "evalbuffer"); menu_eval ("Trim-Buffer", "trim_buffer"); menu ("../"); menu ("/Terminal/Font"); menuitem ("Normal", "^@\\E]50;#\\a"); menuitem ("Larger", "^@\\E]50;#+\\a"); menuitem ("Smaller", "^@\\E]50;#-\\a"); separator (); menuitem ("Font 1", "^@\\E]50;#1\\a"); menuitem ("Font 2", "^@\\E]50;#2\\a"); menuitem ("Font 3", "^@\\E]50;#3\\a"); menuitem ("Font 4", "^@\\E]50;#4\\a"); menu ("../Screen"); menuitem ("Reverse Video", "^@\\E[?5t"); menuitem ("Toggle Width", "^@\\E[?3t"); menuitem ("Cursor", "^@\\E[?25t"); menuitem ("Switch", "^@\\E[?47t"); separator (); menuitem ("menuBar", "^@\\E[?10t"); menuitem ("scrollBar", "^@\\E[?30t"); menu ("../Keys"); menuitem ("XTerm", "^@\\E[?35t"); menuitem ("Backspace", "^@\\E[?36t"); menuitem ("Cursor", "^@\\E[?1t"); menuitem ("KeyPad", "^@\\E[?66t"); menu ("../"); #if$COLORTERM xiterm-xpm separator (); menu ("Background/Pixmap"); menuitem ("None", "^@\\E]20;\\a"); separator (); % load .xpm files menuitem ("Wingdogs", "^@\\E]20;wingdogs\\a"); menuitem ("Mona", "^@\\E]20;mona\\a"); menu ("../Scaling"); menuitem ("Full", "^@\\E]20;;100;?\\a"); menuitem ("Tiled", "^@\\E]20;;0\\a"); separator (); menuitem ("400/25%", "^@\\E]10;\\^@\\\\E]20;;400x025x00x4000x25;?\\^G\\a"); menuitem ("250/40%", "^@\\E]10;\\^@\\\\E]20;;250x040x00x2500x40;?\\^G\\a"); menuitem ("200/50%", "^@\\E]10;\\^@\\\\E]20;;200x050x00x2000x50;?\\^G\\a"); menuitem ("125/80%", "^@\\E]10;\\^@\\\\E]20;;125x080x00x1250x80;?\\^G\\a"); menu ("../Position"); menuitem ("5%}{5%", "^@\\E]10;\\^@\\\\E]20;;-5+0+5+0+0-5+0+5;?\\^G\\a"); menuitem ("10%}{10%", "^@\\E]10;\\^@\\\\E]20;;-10+0+10+0+0-10+0+10;?\\^G\\a"); menuitem ("centre", "^@\\E]20;;=+50+50;?\\a"); menu ("../../"); #endif % COLORTERM separator (); menuitem ("Version", "^@^[[8n"); menu ("/?"); menukey ("Info", "^X?i"); menukey ("Man", "^X?m"); separator (); menukey ("Apropos", "^X?a"); menukey ("Show Key", "^X?k"); menukey ("Where Is", "^X?w"); menu ("/"); resume_hook (); % enable menu, mouse, etc #endif % xterm* %%%%%%%%%%%%%%%%%%%%%%%%%%% end-of-file (SLang) %%%%%%%%%%%%%%%%%%%%%%%%%% xiterm+thai-1.10/test/ISO-8859-10000644000175000017500000000002611375434146014461 0ustar thepthep%׿ xiterm+thai-1.10/test/color0000755000175000017500000000136611375434146014407 0ustar thepthep#!/bin/sh -- # # display ANSI colours and test bold/blink attributes #------------------------------------------------------------------------- echo ""; echo "" echo " 40 41 42 43 44 45 46 47" echo " 40 41 42 43 44 45 46 47" for fg in 30 31 32 33 34 35 36 37 do l1="$fg "; l2=" "; l3=" "; l4=" "; for bg in 40 41 42 43 44 45 46 47 do l1="${l1}[${fg};${bg}m Normal " l2="${l2}[${fg};${bg};1m Bold " l3="${l3}[${fg};${bg};5m Blink " l4="${l4}[${fg};${bg};1;5m Bold! " done echo "$l1" echo "$l2" echo "$l3" echo "$l4" done #------------------------------------------------------------- end-of-file xiterm+thai-1.10/test/TIS-6200000644000175000017500000000035011375434146014222 0ustar thepthep ش԰Ȥس Һôҽ٧ѵѨҹ ѹҾѲԪҡ ҧҭ蹦Һձ ø觫ѴִѴ Ѵ͹Ѫ ԺѵԻоĵԡ˹ ٴ ҿѧ xiterm+thai-1.10/test/README0000644000175000017500000000105111375434146014212 0ustar thepthepThis directory contains : color : shell script to test xiterm color's abitlity ISO-8859-1 : a test file with some ISO-8859-1 chars : accents, signs ... TIS-620 : a test file with Thai message in TIS-620 ------------------------------------------------------------------------------- After compiling, launch a xiterm and type : bash# test/color -> Your screen should get full of colors bash# cat test/ISO-8859-1 -> You should see some accentuated chars & special signs bash# cat test/TIS-620 -> With proper Thai font, you should see Thai message xiterm+thai-1.10/test/graphics/0000755000175000017500000000000011375434146015135 5ustar thepthepxiterm+thai-1.10/test/graphics/grxlib.c0000644000175000017500000000673211375434146016600 0ustar thepthep#include #include #include #include #include #ifdef _AIX # include #else # include #endif #include "grxlib.h" /*----------------------------------------------------------------------*/ void Done (void) { putchar (':'); } void StartLine (long id) { printf ("\033GL%ld", id); } void StartPoint (long id) { printf ("\033GP%ld", id); } void StartFill (long id) { printf ("\033GF%ld", id); } void Extend (int x, int y) { printf (";%d;%d", x, y); } void FillArea (int x1, int y1, int x2, int y2) { printf (";%d;%d;%d;%d", x1, y1, x2, y2); } void PlaceText (long id, int x, int y, int mode, char *text) { printf ("\033GT%ld;%d;%d;%d;%d:%s", id, x, y, mode, strlen(text), text); fflush (stdout); } void ClearWindow (long id) { printf ("\033GC%ld:", id); } void ForeColor (int col) { printf ("\033[3%dm", (col<0||col>7)?0:col); } void DefaultRendition (void) { printf ("\033[m"); } #define LINESZ 100 static char line [LINESZ]; static FILE *infd = NULL; long CreateWin (int x, int y, int w, int h) { long id = 0; fflush (stdout); printf ("\033GW%d;%d;%d;%d:", x, y, w, h); fflush (stdout); while (1) { if ((fgets (line, LINESZ, infd) != NULL) && (sscanf (line,"\033W%ld", &id) == 1)) break; } return id; } void QueryWin (long id, int *nfwidth, int *nfheight) { int id1, x, y, width, height, fwidth, fheight; printf ("\033GG%ld:",id); fflush (stdout); while (1) { if ((fgets (line, sizeof(line), infd) != NULL) && (sscanf (line,"\033G%ld %ld %ld %ld %ld %ld %ld %ld %ld", &id1, &x, &y, &width, &height, &fwidth, &fheight, nfwidth, nfheight) != 0)) break; } } int WaitForCarriageReturn (long *win, int *x, int *y) { int i, len; fgets (line, LINESZ, infd); line [LINESZ-1] = 0; len = strlen (line); for (i = 0; i < len; i++) { if (line [i] == '\033') { int ret = 1; i++; switch (line[i]) { case 'R': ret++; /* drop */ case 'P': sscanf (&line[i+1],"%ld;%d;%d", win, x, y); return ret; break; } } } return 0; } static int fno2; static struct termios ttmode; int InitializeGraphics (int scroll_text_up) { int fno, i; char *screen_tty; struct winsize winsize; fno = fileno (stdout); if (!isatty (fno)) { fprintf (stderr, "stdout must be a tty\n"); return 0; } screen_tty = ttyname (fno); ioctl (fno, TCGETS, (char *)&ttmode); ttmode.c_lflag &= ~ECHO; ioctl (fno, TCSETS, (char *)&ttmode); infd = fopen (screen_tty, "rw"); fno2 = fileno (infd); ioctl (fno2, TCGETS, (char *)&ttmode); ttmode.c_lflag &= ~ECHO; ioctl (fno2, TCSETS, (char *)&ttmode); /* query rxvt to find if graphics are available */ fflush (stdout); printf ("\033GQ"); fflush (stdout); while (1) { if ((fgets (line, LINESZ, infd) != NULL) && (sscanf (line,"\033G%d", &i) == 1)) { if (!i) { fprintf (stderr, "rxvt graphics not available\n"); CloseGraphics (); return 0; } break; } } if (scroll_text_up) { ioctl (fno, TIOCGWINSZ, &winsize); fflush (stdout); for (i = 0; i < winsize.ws_row; i++) putchar ('\n'); fflush (stdout); } return i; } void CloseGraphics (void) { DefaultRendition (); fflush (stdout); ttmode.c_lflag |= ECHO; ioctl (fno2, TCSETS, (char *)&ttmode); fclose (infd); } /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/test/graphics/grxlib.h0000644000175000017500000000172511375434146016602 0ustar thepthep#include "rxvtgrx.h" /* text alignment */ /*function pointer to either StartLine or StartPoint */ typedef void (*LineFunction) (long id); #ifdef __cplusplus extern "C" { #endif extern void StartLine (long id); extern void StartPoint (long id); extern void Extend (int x, int y); extern void StartFill (long id); extern void FillArea (int x1, int y1, int x2, int y2); extern void Done (void); extern void PlaceText (long id, int x, int y, int mode, char *text); extern void ClearWindow (long id); extern long CreateWin (int x, int y, int w, int h); extern void QueryWin (long id, int *nfwidth, int *nfheight); extern void ForeColor (int color); extern void DefaultRendition (void); extern int WaitForCarriageReturn (long *win, int *x, int *y); extern int InitializeGraphics (int scroll_text_up); extern void CloseGraphics (void); #ifdef __cplusplus } #endif /*----------------------- end-of-file (C header) -----------------------*/ xiterm+thai-1.10/test/graphics/qplot.c0000644000175000017500000001271211375434146016443 0ustar thepthep#include #include #include #include #include "grxlib.h" #define Real float #ifndef GRX_SCALE # define GRX_SCALE 10000 #endif #define DEFAULT_DATA_FILE "data" static void axis_round (Real *min, Real *max, Real *grid_spacing) { int logspace; logspace = (int)(log10 ((*max - *min)/10.0) + 0.5); *grid_spacing = pow (10, (double)logspace); *min = (Real)((int)(*min / (*grid_spacing))) * (*grid_spacing); *max = (Real)((int)(*max / (*grid_spacing))+1) * (*grid_spacing); } static int nice_end (int junk) { CloseGraphics (); putchar ('\n'); exit (EXIT_SUCCESS); return 0; } int main (int argc, char **argv) { char line[256], *file = NULL; long id,winclick; int Do_Start = 1,tmp; Real x[1000000], y[1000000]; Real nls[1000]; int m, p, i, j, n, nchars, theight, twidth, xclick, yclick; int downx = 1000,downy = 1000,upx,upy; Real xmax, xmin, ymax, ymin, xdiff, ydiff, xgrid_spacing, ygrid_spacing; FILE *fd; char axis[100]; LineFunction linetype = StartLine; ymax = xmax = -HUGE_VAL; ymin = xmin = HUGE_VAL; for (i = 1; i < argc; i++) { if (*argv[i] == '-') { if (!strcmp (argv[i], "-nl")) linetype = StartPoint; else if (argv[i][1] == '\0') /* use stdin */ file = argv [i]; else { fprintf(stderr, "Usage:\n\t %s [options] [file]\n\n", argv[0]); fprintf(stderr, "where options include:\n" " -pt plot with points instead of lines\n\n"); fprintf(stderr, "file name `-' specifies stdin\n" "if no file name is specified, " "the default is \"%s\"\n\n", DEFAULT_DATA_FILE); return EXIT_FAILURE; } } else { file = argv [i]; } } if (!strcmp (file, "-")) { fd = stdin; file = "stdin"; } else { if (file == NULL) file = DEFAULT_DATA_FILE; if ((fd = fopen (file, "r")) == NULL) { fprintf (stderr, "%s: can't open file \"%s\"\n", argv[0], file); return EXIT_FAILURE; } } m = 0; p = 0; while (fgets(line, sizeof(line),fd) != NULL) { if (sscanf(line,"%f %f",&x[m], &y[m]) == 2) { if (x[m] > xmax) xmax = x[m]; else if (x[m] < xmin) xmin = x[m]; if (y[m] > ymax) ymax = y[m]; else if (y[m] < ymin) ymin = y[m]; m++; } else { nls [p] = m; p++; } } nls [p++] = m; if (m == 0) return; signal (SIGTERM, nice_end); signal (SIGSTOP, nice_end); signal (SIGTSTP, nice_end); signal (SIGINT, nice_end); signal (SIGQUIT, nice_end); if (!InitializeGraphics (1)) return EXIT_FAILURE; n = 1; do { axis_round (&xmin, &xmax, &xgrid_spacing); axis_round (&ymin, &ymax, &ygrid_spacing); id = CreateWin (0, 0, GRX_SCALE, GRX_SCALE); if (id == 0) { fprintf (stderr,"Help id = 0\n"); return EXIT_FAILURE; } /* Fill the window in black for real eye-catching graphics! */ ForeColor (0); StartFill (id); FillArea (0, 0, GRX_SCALE, GRX_SCALE); Done (); /* draw outline box in white */ ForeColor (7); /* Draw outline box */ StartLine(id); Extend (1000, 1000); Extend (1000, 9000); Extend (9000, 9000); Extend (9000, 1000); Extend (1000, 1000); Done(); /* Draw the data - either lines or dots */ xdiff = 8000 / (xmax-xmin); ydiff = 8000 / (ymax-ymin); for (i = j = 0; j < p; j++) { int n = 0; ForeColor (j%6+1); while (((x[i] < xmin) || (x[i] > xmax) || (y[i] < ymin) || (y[i] > ymax)) && (i < nls [j])) i++; while (i < nls [j]) { if (n == 0) linetype (id); Extend (1000+(x[i]-xmin)*xdiff,9000-(y[i]-ymin)*ydiff); n++; if (n > 450) { Done (); n = 0; continue; } i++; while ((i < nls [j]) && ((x [i] < xmin) || (x [i] > xmax) || (y [i] < ymin) || (y [i] > ymax))) i++; } if (n > 0) Done (); } /* Do axis labels in black */ ForeColor (7); QueryWin (id, &twidth,&theight); PlaceText (id, GRX_SCALE/2, 0, HCENTER_TEXT|TOP_TEXT, file); PlaceText (id, GRX_SCALE/2, GRX_SCALE, HCENTER_TEXT|BOTTOM_TEXT, "X"); PlaceText (id, 0, GRX_SCALE/2, LEFT_TEXT|VCENTER_TEXT, "Y"); sprintf (axis, "%f", ymax); nchars = 1000 / twidth; axis [nchars] = 0; PlaceText (id, GRX_SCALE/10, GRX_SCALE/10, RIGHT_TEXT|TOP_TEXT, axis); sprintf (axis, "%f", ymin); axis [nchars] = 0; PlaceText (id, GRX_SCALE/10, 9*GRX_SCALE/10, RIGHT_TEXT|BOTTOM_TEXT,axis); sprintf (axis, "%f",xmax); PlaceText (id, 9*GRX_SCALE/10, 9*GRX_SCALE/10, HCENTER_TEXT|TOP_TEXT,axis); sprintf (axis,"%f",xmin); PlaceText (id, GRX_SCALE/10, 9*GRX_SCALE/10, HCENTER_TEXT|TOP_TEXT,axis); fflush (stdout); do { n = WaitForCarriageReturn (&winclick, &xclick, &yclick); switch (n) { case 1: downx = xclick; downy = yclick; break; case 2: upx = xclick; upy = yclick; if (upx < downx) { tmp = downx; downx = upx; upx = tmp; } if (upy < downy) { tmp = downy; downy = upy; upy = tmp; } xmin = (xmax - xmin) * (downx - 1000) / (8000) + xmin; xmax = (xmax - xmin) * (upx - 1000) / (8000) + xmin; ymax = ymax - (ymax - ymin) * (downy - 1000) / (8000); ymin = ymax - (ymax - ymin) * (upy - 1000) / (8000); break; } } while (n && (n != 2)); } while (n); nice_end (EXIT_SUCCESS); return EXIT_SUCCESS; } /*----------------------- end-of-file (C source) -----------------------*/ xiterm+thai-1.10/test/graphics/data0000644000175000017500000017470411375434146016006 0ustar thepthep6.37e+2 1.52e+2 1.73e+2 5.13e+1 1.77e+2 5.08e+1 1.71e+2 1.83e+1 1.82e+2 1.83e+1 1.84e+2 1.83e+1 1.86e+2 1.83e+1 1.79e+2 5.07e+1 7.07e+1 1.02e+2 1.37e+1 1.14e+2 1.76e+2 5.13e+1 1.65e+2 5.23e+1 1.80e+2 5.08e+1 1.72e+2 5.18e+1 6.33e+2 1.55e+2 1.73e+2 5.13e+1 2.94e+1 1.09e+2 2.06e+1 1.12e+2 6.32e+2 7.78e+1 2.35e+1 1.11e+2 1.81e+2 5.08e+1 2.55e+1 1.11e+2 6.31e+2 7.83e+1 6.17e+2 6.20e+1 2.16e+1 1.12e+2 1.86e+1 1.12e+2 3.04e+1 1.09e+2 3.24e+1 1.09e+2 6.30e+2 7.83e+1 2.75e+1 1.10e+2 3.34e+1 1.09e+2 6.25e+2 1.59e+2 6.29e+2 7.88e+1 4.12e+1 1.07e+2 4.42e+1 1.06e+2 6.24e+2 1.60e+2 6.23e+2 1.60e+2 1.84e+2 5.08e+1 1.89e+2 5.02e+1 1.91e+2 4.99e+1 3.44e+1 1.08e+2 6.22e+2 1.81e+2 6.24e+2 1.79e+2 1.86e+2 5.08e+1 1.85e+2 5.08e+1 3.53e+1 1.08e+2 4.62e+1 1.06e+2 4.81e+1 1.05e+2 6.21e+2 1.81e+2 3.63e+1 1.08e+2 3.83e+1 1.08e+2 4.03e+1 1.08e+2 6.19e+2 1.83e+2 6.20e+2 1.62e+2 6.22e+2 8.03e+1 6.22e+2 1.20e+2 6.24e+2 1.19e+2 6.19e+2 1.63e+2 6.21e+2 8.08e+1 6.16e+2 1.85e+2 6.20e+2 8.13e+1 6.17e+2 1.64e+2 6.19e+2 8.13e+1 6.16e+2 1.65e+2 6.15e+2 1.65e+2 6.15e+2 8.29e+1 1.63e+2 5.28e+1 6.15e+2 1.24e+2 6.13e+2 1.87e+2 6.17e+2 8.23e+1 6.11e+2 8.39e+1 6.13e+2 8.34e+1 5.30e+1 1.04e+2 6.14e+2 1.24e+2 6.12e+2 1.88e+2 6.09e+2 8.44e+1 5.60e+1 6.96e+1 6.58e+1 1.02e+2 6.13e+2 1.25e+2 6.12e+2 1.25e+2 6.10e+2 1.68e+2 6.10e+2 1.26e+2 6.09e+2 1.26e+2 7.66e+1 7.12e+1 6.58e+1 7.01e+1 6.08e+2 1.90e+2 6.10e+2 1.89e+2 9.63e+1 9.85e+1 5.99e+1 1.03e+2 6.08e+2 1.69e+2 9.43e+1 9.86e+1 8.84e+1 7.06e+1 6.05e+2 8.59e+1 6.07e+2 1.91e+2 9.83e+1 9.81e+1 6.07e+2 1.69e+2 6.05e+2 1.28e+2 1.00e+2 9.80e+1 8.55e+1 9.96e+1 6.04e+2 1.29e+2 6.02e+2 1.72e+2 1.53e+2 7.01e+1 6.06e+2 1.92e+2 1.02e+2 9.76e+1 1.04e+2 9.74e+1 1.02e+2 7.06e+1 9.24e+1 7.06e+1 6.02e+2 1.29e+2 8.65e+1 9.96e+1 8.84e+1 9.96e+1 1.12e+2 9.65e+1 9.04e+1 9.91e+1 9.24e+1 9.88e+1 1.07e+2 9.70e+1 1.51e+2 7.01e+1 1.54e+2 7.01e+1 1.56e+2 7.01e+1 1.58e+2 7.01e+1 1.09e+2 9.71e+1 1.14e+2 9.66e+1 1.15e+2 9.65e+1 3.15e+2 1.99e+2 1.04e+2 7.06e+1 5.98e+2 1.96e+2 6.03e+2 1.93e+2 6.05e+2 1.92e+2 5.99e+2 1.74e+2 6.02e+2 1.94e+2 1.47e+2 7.05e+1 1.49e+2 7.10e+1 1.25e+2 6.96e+1 3.21e+2 7.06e+1 1.28e+2 7.01e+1 1.07e+2 7.12e+1 1.24e+2 6.96e+1 1.31e+2 6.96e+1 1.05e+2 7.06e+1 1.19e+2 7.06e+1 1.21e+2 7.07e+1 1.17e+2 9.66e+1 1.19e+2 9.66e+1 1.21e+2 9.66e+1 5.99e+2 1.30e+2 1.44e+2 6.96e+1 1.41e+2 7.06e+1 1.43e+2 7.06e+1 1.37e+2 7.06e+1 1.39e+2 7.12e+1 5.97e+2 1.74e+2 5.98e+2 1.74e+2 5.97e+2 1.31e+2 5.94e+2 1.31e+2 1.33e+2 6.96e+1 1.35e+2 6.95e+1 5.96e+2 1.31e+2 6.00e+2 1.95e+2 1.17e+2 6.99e+1 1.14e+2 7.12e+1 1.15e+2 7.12e+1 1.94e+2 7.01e+1 5.96e+2 1.74e+2 1.13e+2 7.12e+1 2.07e+2 7.01e+1 2.09e+2 7.01e+1 1.10e+2 7.12e+1 1.17e+2 1.92e+2 5.95e+2 1.75e+2 3.00e+2 7.06e+1 5.92e+2 1.32e+2 2.40e+2 9.46e+1 2.23e+2 9.51e+1 3.73e+1 7.06e+1 5.91e+2 1.32e+2 5.91e+2 1.98e+2 2.13e+2 7.01e+1 7.96e+1 7.12e+1 5.90e+2 1.32e+2 5.87e+2 1.33e+2 5.89e+2 1.33e+2 5.85e+2 1.99e+2 5.86e+2 2.00e+2 5.85e+2 1.33e+2 5.84e+2 1.33e+2 5.81e+2 1.34e+2 6.09e+1 7.01e+1 5.84e+2 2.00e+2 5.80e+2 1.34e+2 2.71e+2 5.18e+1 5.79e+2 1.34e+2 2.82e+2 5.34e+1 3.08e+2 1.47e+2 2.81e+2 5.34e+1 5.79e+2 1.34e+2 5.74e+2 1.81e+2 5.76e+2 1.81e+2 5.78e+2 1.81e+2 2.85e+2 5.44e+1 5.80e+2 2.01e+2 2.86e+2 5.44e+1 5.75e+2 1.36e+2 5.77e+2 1.35e+2 5.79e+2 2.01e+2 6.68e+1 1.47e+2 2.76e+2 5.28e+1 2.78e+2 5.33e+1 2.80e+2 5.34e+1 5.73e+2 1.36e+2 5.72e+2 1.36e+2 5.71e+2 1.36e+2 5.68e+2 1.38e+2 2.89e+2 5.51e+1 2.90e+2 5.54e+1 5.69e+2 1.37e+2 5.71e+2 9.14e+1 5.73e+2 9.11e+1 5.69e+2 9.15e+1 5.68e+2 9.20e+1 5.66e+2 9.20e+1 3.99e+2 1.47e+2 5.65e+2 9.19e+1 2.86e+2 1.99e+2 5.62e+2 9.25e+1 5.47e+2 9.40e+1 5.49e+2 9.36e+1 5.59e+2 9.25e+1 5.61e+2 9.22e+1 5.45e+2 9.46e+1 5.41e+2 9.56e+1 5.58e+2 9.25e+1 5.50e+2 9.35e+1 5.32e+2 9.61e+1 5.55e+2 9.30e+1 5.37e+2 9.61e+1 5.39e+2 9.61e+1 3.67e+2 2.28e+1 3.87e+2 2.33e+1 5.52e+2 9.35e+1 5.54e+2 9.33e+1 5.33e+2 9.61e+1 3.55e+2 6.17e+1 3.85e+2 2.33e+1 5.34e+2 9.61e+1 3.84e+2 2.33e+1 3.40e+2 4.57e+1 3.59e+2 6.30e+1 3.61e+2 6.34e+1 3.42e+2 4.57e+1 3.51e+2 6.30e+1 3.49e+2 4.52e+1 3.50e+2 4.52e+1 3.54e+2 4.47e+1 3.47e+2 4.52e+1 3.44e+2 4.57e+1 3.46e+2 4.57e+1 3.83e+2 2.33e+1 3.51e+2 4.52e+1 3.52e+2 4.47e+1 3.43e+2 4.57e+1 7.74e+2 2.33e+1 3.88e+2 2.33e+1 7.94e+2 2.28e+1 3.89e+2 2.28e+1 3.77e+2 6.45e+1 3.63e+2 6.37e+1 3.65e+2 6.40e+1 3.90e+2 2.28e+1 3.81e+2 6.51e+1 3.82e+2 9.35e+1 3.66e+2 6.40e+1 3.82e+2 6.51e+1 3.95e+2 2.28e+1 3.57e+2 2.23e+1 3.96e+2 2.23e+1 7.92e+2 2.28e+1 3.80e+2 1.30e+2 3.59e+2 1.25e+2 3.71e+2 4.62e+1 3.83e+2 6.51e+1 3.73e+2 6.45e+1 3.71e+2 2.28e+1 3.75e+2 4.62e+1 3.76e+2 4.62e+1 3.80e+2 2.33e+1 3.90e+2 4.57e+1 3.87e+2 6.45e+1 3.85e+2 6.45e+1 3.91e+2 2.28e+1 3.85e+2 1.29e+2 3.86e+2 1.29e+2 3.84e+2 1.29e+2 3.67e+2 6.40e+1 3.87e+2 1.29e+2 3.92e+2 2.28e+1 3.70e+2 4.62e+1 3.88e+2 1.29e+2 3.70e+2 6.41e+1 3.74e+2 6.96e+1 3.80e+2 7.01e+1 3.86e+2 4.62e+1 3.82e+2 7.01e+1 7.90e+2 2.28e+1 3.76e+2 6.96e+1 3.78e+2 6.96e+1 3.77e+2 6.96e+1 3.90e+2 1.27e+2 3.77e+2 4.62e+1 3.79e+2 2.33e+1 3.82e+2 4.67e+1 3.83e+2 7.01e+1 7.75e+2 2.33e+1 7.77e+2 2.33e+1 7.79e+2 2.33e+1 3.66e+2 4.63e+1 3.68e+2 4.66e+1 3.75e+2 6.96e+1 3.80e+2 4.67e+1 3.84e+2 4.62e+1 3.85e+2 4.62e+1 3.86e+2 6.96e+1 5.85e+2 4.62e+1 3.94e+2 1.27e+2 3.91e+2 1.28e+2 3.78e+2 4.67e+1 7.62e+2 6.20e+1 4.05e+2 2.23e+1 5.87e+2 4.62e+1 3.90e+2 6.91e+1 3.94e+2 4.52e+1 3.84e+2 6.96e+1 3.62e+2 4.57e+1 5.90e+2 4.50e+1 5.92e+2 4.44e+1 5.86e+2 4.62e+1 3.73e+2 2.28e+1 3.85e+2 6.96e+1 7.96e+2 2.33e+1 3.90e+2 6.40e+1 5.06e+2 1.88e+1 3.85e+2 1.93e+2 3.75e+2 2.33e+1 3.95e+2 4.52e+1 3.77e+2 2.33e+1 3.75e+2 1.29e+2 3.96e+2 4.52e+1 3.74e+2 2.33e+1 3.96e+2 6.25e+1 3.97e+2 6.25e+1 3.92e+2 6.86e+1 4.02e+2 2.23e+1 3.98e+2 4.47e+1 5.07e+2 3.76e+1 3.94e+2 6.35e+1 5.62e+2 1.88e+1 3.97e+2 6.71e+1 2.03e+2 1.99e+2 4.10e+2 2.18e+1 3.99e+2 6.25e+1 7.88e+2 2.28e+1 3.94e+2 6.80e+1 3.96e+2 6.74e+1 5.67e+2 1.94e+1 5.69e+2 1.97e+1 3.09e+2 1.99e+2 4.00e+2 4.47e+1 3.72e+2 1.28e+2 4.03e+2 6.25e+1 4.01e+2 6.20e+1 4.04e+2 6.25e+1 3.98e+2 6.71e+1 4.00e+2 6.65e+1 4.11e+2 2.13e+1 4.04e+2 6.71e+1 6.37e+2 5.13e+1 4.05e+2 6.20e+1 4.02e+2 1.24e+2 4.05e+2 6.15e+1 4.06e+2 6.20e+1 6.40e+2 5.23e+1 4.14e+2 6.15e+1 4.16e+2 6.15e+1 4.08e+2 6.15e+1 4.10e+2 6.14e+1 4.12e+2 6.11e+1 4.03e+2 6.71e+1 7.39e+2 3.76e+1 7.61e+2 2.23e+1 7.63e+2 2.26e+1 7.65e+2 2.29e+1 7.67e+2 2.32e+1 6.41e+2 5.23e+1 5.64e+2 1.88e+1 5.08e+2 3.76e+1 6.43e+2 5.39e+1 5.71e+2 2.03e+1 5.73e+2 2.08e+1 5.75e+2 2.13e+1 5.57e+2 5.08e+1 5.59e+2 5.08e+1 5.62e+2 5.28e+1 5.63e+2 5.28e+1 5.65e+2 5.36e+1 7.52e+2 5.69e+1 4.01e+2 4.47e+1 7.49e+2 5.54e+1 4.05e+2 1.23e+2 4.07e+2 1.23e+2 7.95e+2 4.62e+1 7.51e+2 5.69e+1 7.42e+2 3.83e+1 4.12e+2 1.19e+2 4.14e+2 1.18e+2 4.02e+2 4.47e+1 2.16e+2 1.99e+2 4.16e+2 2.08e+1 4.14e+2 1.98e+1 4.05e+2 6.71e+1 5.69e+2 5.59e+1 6.42e+2 5.34e+1 7.53e+2 5.79e+1 5.10e+2 3.76e+1 4.09e+2 6.56e+1 5.19e+2 3.70e+1 5.21e+2 3.67e+1 4.05e+2 4.47e+1 7.93e+2 4.62e+1 5.70e+2 5.64e+1 7.54e+2 5.83e+1 7.56e+2 5.88e+1 6.50e+2 5.69e+1 6.52e+2 5.78e+1 6.54e+2 5.82e+1 4.05e+2 1.25e+2 4.05e+2 4.42e+1 6.46e+2 5.49e+1 6.13e+2 5.39e+1 7.47e+2 5.49e+1 4.10e+2 4.32e+1 7.50e+2 4.06e+1 5.14e+2 3.76e+1 4.10e+2 6.51e+1 4.09e+2 4.37e+1 5.68e+2 5.47e+1 7.53e+2 4.17e+1 6.17e+2 1.02e+2 6.19e+2 1.01e+2 5.13e+2 3.76e+1 5.16e+2 3.76e+1 4.19e+2 4.11e+1 4.14e+2 6.35e+1 4.21e+2 2.03e+1 4.15e+2 6.30e+1 4.11e+2 8.64e+1 5.12e+2 3.76e+1 2.39e+2 1.99e+2 7.57e+2 2.18e+1 4.16e+2 6.30e+1 5.21e+2 1.02e+2 7.75e+2 1.30e+2 4.14e+2 4.24e+1 4.16e+2 4.22e+1 4.20e+2 2.03e+1 4.20e+2 6.17e+1 4.17e+2 6.30e+1 6.90e+2 5.79e+1 7.49e+2 4.01e+1 4.13e+2 1.06e+2 4.17e+2 2.08e+1 4.23e+2 6.12e+1 4.25e+2 6.10e+1 7.67e+2 1.29e+2 6.46e+2 1.94e+1 7.63e+2 1.26e+2 7.65e+2 1.29e+2 4.22e+2 4.06e+1 7.68e+2 1.29e+2 7.70e+2 1.31e+2 7.56e+2 2.16e+1 5.73e+2 5.81e+1 5.75e+2 5.88e+1 7.47e+2 3.91e+1 7.53e+2 2.08e+1 4.21e+2 6.15e+1 4.87e+2 5.08e+1 7.77e+2 1.29e+2 7.79e+2 1.29e+2 7.58e+2 1.21e+2 7.60e+2 1.23e+2 7.55e+2 4.19e+1 7.57e+2 4.20e+1 7.71e+2 1.30e+2 7.73e+2 1.30e+2 7.53e+2 2.08e+1 7.55e+2 1.17e+2 7.57e+2 1.18e+2 5.71e+2 5.69e+1 7.61e+2 1.24e+2 6.45e+2 5.44e+1 7.53e+2 4.17e+1 6.50e+2 2.05e+1 5.04e+2 3.71e+1 5.17e+2 5.23e+1 7.59e+2 2.18e+1 7.71e+2 4.62e+1 7.44e+2 5.34e+1 7.46e+2 5.37e+1 6.48e+2 1.99e+1 5.59e+2 1.53e+2 6.92e+2 4.11e+1 7.45e+2 3.86e+1 7.41e+2 5.28e+1 5.11e+2 1.05e+2 5.13e+2 1.06e+2 5.15e+2 1.06e+2 6.94e+2 5.64e+1 5.19e+2 5.13e+1 5.18e+2 5.18e+1 5.10e+2 1.05e+2 7.46e+2 3.91e+1 6.91e+2 5.74e+1 6.56e+2 2.14e+1 6.58e+2 2.17e+1 6.94e+2 4.06e+1 7.80e+2 4.62e+1 6.95e+2 5.59e+1 5.05e+2 1.03e+2 5.07e+2 1.04e+2 5.09e+2 1.05e+2 4.94e+2 5.10e+1 7.51e+2 1.12e+2 7.35e+2 5.18e+1 4.99e+2 1.01e+2 5.01e+2 1.02e+2 5.03e+2 1.02e+2 6.44e+2 1.93e+1 5.21e+2 5.10e+1 5.22e+2 5.07e+1 7.39e+2 5.23e+1 4.18e+2 2.08e+1 5.09e+2 5.23e+1 7.40e+2 5.28e+1 6.92e+2 5.74e+1 7.50e+2 1.13e+2 4.09e+2 2.01e+2 5.12e+2 5.23e+1 4.98e+2 1.01e+2 4.88e+2 5.03e+1 7.23e+2 1.78e+1 5.08e+2 5.23e+1 4.25e+2 4.01e+1 7.03e+2 5.18e+1 6.53e+2 2.11e+1 7.07e+2 5.08e+1 7.34e+2 5.18e+1 6.37e+2 1.02e+2 6.38e+2 1.02e+2 7.04e+2 5.13e+1 6.95e+2 3.99e+1 4.97e+2 1.01e+2 6.22e+2 9.96e+1 4.96e+2 1.01e+2 4.96e+2 5.03e+1 4.98e+2 5.00e+1 7.28e+2 1.83e+1 4.86e+2 5.44e+1 7.29e+2 1.02e+2 3.46e+2 4.57e+1 4.27e+2 4.01e+1 7.22e+2 1.78e+1 4.95e+2 1.00e+2 4.91e+2 5.03e+1 7.01e+2 5.23e+1 7.30e+2 1.02e+2 7.32e+2 1.03e+2 7.34e+2 1.04e+2 4.90e+2 5.03e+1 4.09e+2 8.85e+1 6.25e+2 5.28e+1 7.05e+2 5.13e+1 6.96e+2 3.91e+1 7.31e+2 5.13e+1 7.32e+2 5.13e+1 4.25e+2 1.97e+1 7.29e+2 1.83e+1 7.00e+2 5.28e+1 6.99e+2 5.34e+1 4.91e+2 1.01e+2 7.25e+2 1.00e+2 7.27e+2 1.01e+2 4.89e+2 1.01e+2 6.98e+2 3.86e+1 4.27e+2 2.03e+1 7.27e+2 1.83e+1 7.21e+2 9.86e+1 4.26e+2 1.98e+1 6.18e+2 5.08e+1 6.20e+2 5.04e+1 6.22e+2 5.01e+1 7.26e+2 1.83e+1 7.04e+2 5.59e+1 7.32e+2 1.83e+1 7.29e+2 5.13e+1 4.25e+2 5.59e+1 6.99e+2 3.81e+1 4.28e+2 1.93e+1 4.30e+2 4.01e+1 7.09e+2 5.03e+1 7.11e+2 4.99e+1 7.13e+2 4.97e+1 7.00e+2 3.76e+1 7.02e+2 3.69e+1 7.04e+2 3.66e+1 4.93e+2 1.51e+2 6.91e+2 1.15e+2 7.25e+2 1.78e+1 4.27e+2 5.59e+1 5.05e+2 5.18e+1 4.83e+2 1.01e+2 7.33e+2 1.88e+1 4.86e+2 1.01e+2 7.26e+2 5.03e+1 6.39e+2 1.88e+1 4.80e+2 1.01e+2 4.84e+2 1.01e+2 4.23e+2 1.42e+2 4.78e+2 1.01e+2 4.74e+2 1.53e+2 7.24e+2 5.03e+1 4.94e+2 1.78e+1 4.77e+2 1.01e+2 4.84e+2 1.51e+2 4.86e+2 1.51e+2 4.73e+2 1.53e+2 7.44e+2 1.93e+1 4.94e+2 3.66e+1 4.84e+2 3.61e+1 4.79e+2 1.52e+2 7.10e+2 1.78e+1 7.35e+2 1.88e+1 4.28e+2 5.59e+1 7.42e+2 1.93e+1 6.38e+2 1.88e+1 4.76e+2 1.52e+2 4.78e+2 1.52e+2 4.73e+2 1.02e+2 7.21e+2 4.93e+1 7.23e+2 4.93e+1 4.71e+2 1.54e+2 7.20e+2 4.93e+1 4.80e+2 1.83e+1 5.04e+2 5.18e+1 4.85e+2 1.83e+1 6.37e+2 1.83e+1 4.84e+2 1.83e+1 4.30e+2 5.83e+1 4.32e+2 5.94e+1 4.77e+2 1.83e+1 4.73e+2 3.66e+1 6.36e+2 1.83e+1 4.81e+2 1.83e+1 4.32e+2 4.01e+1 4.96e+2 3.61e+1 4.98e+2 3.58e+1 5.03e+2 1.88e+1 5.05e+2 1.90e+1 4.74e+2 3.66e+1 7.39e+2 1.88e+1 4.70e+2 1.02e+2 4.68e+2 1.03e+2 4.99e+2 1.83e+1 4.21e+2 5.74e+1 7.38e+2 1.88e+1 4.93e+2 1.83e+1 4.34e+2 4.01e+1 4.76e+2 3.66e+1 4.67e+2 1.03e+2 7.12e+2 1.78e+1 4.98e+2 1.83e+1 4.79e+2 1.83e+1 4.66e+2 1.03e+2 4.72e+2 3.66e+1 4.75e+2 5.48e+1 4.77e+2 5.45e+1 6.35e+2 1.83e+1 4.78e+2 2.03e+1 4.36e+2 4.06e+1 4.71e+2 5.52e+1 4.73e+2 5.51e+1 7.37e+2 1.88e+1 4.90e+2 3.61e+1 4.35e+2 4.01e+1 4.37e+2 4.11e+1 4.69e+2 3.71e+1 4.79e+2 3.66e+1 4.81e+2 3.66e+1 4.64e+2 1.04e+2 4.68e+2 5.54e+1 7.13e+2 1.78e+1 7.15e+2 1.78e+1 7.17e+2 1.78e+1 7.30e+2 3.71e+1 7.32e+2 3.78e+1 4.33e+2 1.98e+1 4.77e+2 5.07e+1 4.79e+2 5.06e+1 4.63e+2 1.06e+2 5.07e+2 1.88e+1 4.66e+2 5.59e+1 4.35e+2 5.59e+1 4.90e+2 1.83e+1 4.87e+2 3.60e+1 5.09e+2 1.88e+1 4.74e+2 5.08e+1 4.36e+2 5.64e+1 4.39e+2 5.79e+1 4.89e+2 3.61e+1 4.55e+2 1.03e+2 4.74e+2 1.83e+1 4.76e+2 1.83e+1 5.08e+2 1.88e+1 4.73e+2 5.13e+1 4.97e+2 1.83e+1 5.58e+2 1.83e+1 5.60e+2 1.83e+1 4.57e+2 1.00e+2 4.59e+2 9.82e+1 4.62e+2 1.06e+2 7.88e+2 2.28e+1 4.96e+2 1.83e+1 1.01e+2 7.88e+1 4.41e+2 6.10e+1 4.67e+2 3.71e+1 4.35e+2 1.98e+1 4.75e+2 1.83e+1 4.39e+2 2.08e+1 4.42e+2 4.47e+1 4.65e+2 3.76e+1 4.42e+2 6.15e+1 4.41e+2 1.54e+2 4.61e+2 1.09e+2 4.60e+2 7.76e+1 4.62e+2 7.63e+1 4.64e+2 3.76e+1 5.12e+2 1.88e+1 5.14e+2 1.88e+1 4.51e+2 8.90e+1 4.41e+2 2.23e+1 4.57e+2 5.59e+1 4.63e+2 5.57e+1 4.65e+2 5.47e+1 4.61e+2 5.34e+1 4.53e+2 8.59e+1 4.40e+2 8.39e+1 4.58e+2 7.93e+1 4.42e+2 1.54e+2 4.44e+2 1.57e+2 4.46e+2 1.58e+2 4.60e+2 1.98e+1 4.44e+2 4.57e+1 4.56e+2 8.13e+1 4.52e+2 6.56e+1 4.54e+2 6.40e+1 4.40e+2 6.20e+1 4.59e+2 3.91e+1 4.60e+2 3.91e+1 4.62e+2 3.81e+1 4.62e+2 5.74e+1 4.43e+2 1.97e+2 4.61e+2 5.74e+1 4.48e+2 1.84e+2 4.44e+2 2.28e+1 4.57e+2 4.01e+1 4.56e+2 2.03e+1 4.56e+2 1.25e+2 4.44e+2 6.35e+1 4.54e+2 1.93e+2 4.56e+2 1.94e+2 4.52e+2 1.53e+2 4.54e+2 1.49e+2 4.53e+2 4.32e+1 4.55e+2 2.08e+1 4.56e+2 4.06e+1 4.45e+2 2.28e+1 4.51e+2 1.55e+2 4.71e+2 5.13e+1 4.48e+2 1.92e+2 4.50e+2 1.94e+2 4.52e+2 1.94e+2 4.56e+2 1.22e+2 4.58e+2 1.17e+2 4.60e+2 1.15e+2 4.51e+2 4.42e+1 4.49e+2 9.10e+1 4.55e+2 1.05e+2 6.11e+2 1.93e+1 6.13e+2 1.93e+1 4.50e+2 4.52e+1 4.55e+2 1.24e+2 4.42e+2 1.32e+2 4.71e+2 1.83e+1 4.48e+2 4.62e+1 4.54e+2 2.08e+1 4.48e+2 6.92e+1 4.50e+2 6.94e+1 4.48e+2 9.20e+1 4.46e+2 9.10e+1 4.57e+2 6.07e+1 4.59e+2 5.93e+1 4.53e+2 1.29e+2 4.52e+2 1.31e+2 4.46e+2 6.35e+1 4.69e+2 1.83e+1 4.43e+2 1.10e+2 4.53e+2 1.09e+2 4.52e+2 2.18e+1 4.45e+2 1.36e+2 4.51e+2 2.01e+2 4.47e+2 6.40e+1 4.45e+2 1.13e+2 4.48e+2 6.40e+1 4.45e+2 6.86e+1 4.46e+2 6.86e+1 4.48e+2 2.28e+1 4.48e+2 1.29e+2 4.50e+2 2.23e+1 4.55e+2 6.20e+1 4.44e+2 9.10e+1 4.54e+2 6.30e+1 4.64e+2 1.87e+1 4.49e+2 4.57e+1 4.60e+2 1.93e+1 4.53e+2 6.45e+1 4.49e+2 1.14e+2 4.51e+2 1.14e+2 4.53e+2 1.14e+2 4.52e+2 6.10e+1 4.49e+2 6.35e+1 4.63e+2 5.28e+1 4.42e+2 8.79e+1 4.66e+2 1.88e+1 4.78e+2 2.23e+1 4.63e+2 5.18e+1 4.65e+2 1.88e+1 4.64e+2 5.23e+1 7.10e+2 5.03e+1 5.05e+2 1.83e+1 4.05e+2 8.90e+1 7.77e+2 8.85e+1 3.26e+2 9.96e+1 4.59e+2 2.18e+1 3.28e+2 1.02e+2 3.30e+2 1.03e+2 1.62e+2 8.13e+1 1.63e+2 8.08e+1 1.65e+2 8.05e+1 6.97e+1 8.90e+1 7.58e+2 8.90e+1 5.78e+2 1.15e+2 6.99e+2 8.82e+1 6.36e+2 8.90e+1 4.80e+2 8.90e+1 4.24e+2 8.85e+1 2.46e+2 6.86e+1 7.50e+2 8.90e+1 3.87e+2 8.90e+1 2.54e+2 7.22e+1 2.82e+2 8.90e+1 5.89e+2 1.15e+2 6.42e+2 8.90e+1 1.73e+2 8.90e+1 6.06e+2 1.93e+2 5.91e+2 1.16e+2 5.85e+2 1.14e+2 5.87e+2 1.14e+2 5.83e+2 1.14e+2 4.86e+2 8.90e+1 1.41e+2 1.47e+2 5.20e+2 8.90e+1 6.26e+2 1.19e+2 6.28e+2 1.19e+2 6.40e+2 1.19e+2 7.07e+2 8.90e+1 6.62e+2 1.19e+2 3.70e+2 8.90e+1 3.08e+2 8.90e+1 3.10e+2 8.90e+1 6.64e+2 1.19e+2 6.66e+2 1.19e+2 6.68e+2 1.19e+2 7.13e+2 8.90e+1 5.95e+2 1.19e+2 3.28e+2 8.90e+1 3.30e+2 8.90e+1 3.03e+2 8.90e+1 2.14e+2 1.75e+2 6.44e+2 1.19e+2 6.43e+2 1.19e+2 3.92e+2 8.90e+1 4.18e+2 1.47e+2 1.57e+2 1.94e+2 6.19e+2 1.19e+2 6.21e+2 1.19e+2 6.23e+2 1.19e+2 6.55e+2 1.19e+2 6.30e+2 1.19e+2 4.30e+2 1.75e+2 6.52e+2 1.19e+2 5.86e+2 8.90e+1 4.98e+2 8.90e+1 6.56e+2 1.19e+2 1.81e+2 8.90e+1 6.36e+2 1.47e+2 1.85e+2 8.90e+1 1.87e+2 8.90e+1 2.27e+2 8.90e+1 6.38e+2 1.19e+2 2.67e+2 8.90e+1 6.53e+2 1.19e+2 3.07e+2 1.75e+2 6.32e+2 1.19e+2 6.34e+2 1.19e+2 3.95e+2 1.47e+2 5.48e+2 1.75e+2 6.01e+2 1.18e+2 6.41e+2 1.19e+2 6.49e+2 1.19e+2 6.61e+2 1.19e+2 3.52e+2 1.75e+2 5.22e+2 1.46e+2 6.18e+2 1.19e+2 6.45e+2 1.19e+2 6.47e+2 1.19e+2 6.59e+2 1.19e+2 5.48e+2 1.46e+2 3.33e+2 8.90e+1 3.96e+2 1.49e+2 3.95e+2 8.85e+1 5.45e+2 1.46e+2 6.78e+2 1.50e+2 5.43e+2 1.49e+2 3.97e+2 1.48e+2 3.99e+2 1.48e+2 5.46e+2 8.90e+1 6.16e+2 1.19e+2 5.21e+2 1.48e+2 2.17e+2 1.50e+2 6.48e+2 1.19e+2 6.17e+2 1.19e+2 5.21e+2 1.47e+2 5.23e+2 1.47e+2 4.31e+2 1.78e+2 9.04e+1 1.78e+2 9.24e+1 1.81e+2 5.94e+2 8.90e+1 5.98e+2 1.19e+2 1.83e+2 1.46e+2 9.92e+1 1.48e+2 1.01e+2 1.48e+2 6.05e+2 1.19e+2 6.07e+2 1.19e+2 5.97e+2 1.75e+2 2.68e+2 1.02e+2 7.19e+2 1.48e+2 3.96e+2 1.48e+2 3.98e+2 1.48e+2 6.38e+2 1.48e+2 5.99e+2 1.78e+2 6.01e+2 1.79e+2 7.96e+2 7.87e+1 2.01e+2 1.79e+2 5.21e+2 8.90e+1 5.51e+2 1.48e+2 1.89e+2 8.90e+1 1.74e+2 1.78e+2 4.33e+2 1.79e+2 6.09e+2 1.77e+2 1.84e+2 1.78e+2 5.42e+2 8.90e+1 5.44e+2 8.90e+1 7.13e+2 1.47e+2 7.15e+2 1.47e+2 2.20e+2 8.90e+1 6.63e+2 8.90e+1 1.83e+2 1.78e+2 7.21e+2 8.90e+1 3.54e+2 1.79e+2 1.04e+2 1.46e+2 5.52e+2 1.49e+2 8.55e+1 1.48e+2 6.95e+2 1.48e+2 6.97e+2 1.48e+2 7.36e+2 1.78e+2 6.16e+2 1.78e+2 6.22e+2 1.77e+2 6.04e+2 1.79e+2 6.12e+2 1.78e+2 1.07e+2 1.48e+2 6.15e+2 1.79e+2 7.09e+2 8.90e+1 2.81e+2 1.48e+2 5.75e+2 1.11e+2 1.85e+2 1.78e+2 6.14e+2 1.79e+2 4.49e+2 1.77e+2 2.38e+2 1.78e+2 3.27e+2 8.90e+1 2.28e+2 1.79e+2 1.91e+2 1.75e+2 1.93e+2 1.73e+2 1.95e+2 1.72e+2 4.50e+2 1.78e+2 4.36e+2 1.79e+2 4.38e+2 1.79e+2 6.08e+2 1.79e+2 7.77e+2 1.74e+2 6.13e+2 1.78e+2 7.40e+2 1.80e+2 2.23e+2 1.80e+2 3.07e+2 1.46e+2 1.57e+2 9.71e+1 4.73e+2 1.75e+2 1.26e+2 1.79e+2 6.20e+2 1.78e+2 7.80e+2 1.78e+2 2.25e+2 1.78e+2 2.92e+2 1.47e+2 2.94e+2 1.46e+2 2.82e+2 1.49e+2 6.18e+2 1.79e+2 7.91e+2 7.93e+1 6.07e+2 1.79e+2 6.30e+2 1.78e+2 6.98e+2 1.78e+2 7.17e+2 8.90e+1 7.19e+2 8.90e+1 3.05e+2 1.78e+2 4.44e+2 1.79e+2 6.06e+2 1.79e+2 5.98e+2 1.78e+2 7.96e+1 1.48e+2 7.37e+2 1.78e+2 7.55e+2 1.78e+2 5.70e+2 1.47e+2 6.09e+2 1.79e+2 4.47e+2 1.78e+2 4.51e+2 1.78e+2 2.20e+2 1.78e+2 2.19e+2 1.78e+2 6.01e+2 8.90e+1 1.24e+2 1.79e+2 2.36e+2 1.78e+2 4.33e+2 1.79e+2 4.35e+2 1.80e+2 2.17e+2 1.78e+2 4.32e+2 1.79e+2 5.25e+2 1.79e+2 3.03e+2 1.80e+2 2.19e+2 1.77e+2 5.70e+1 1.78e+2 5.43e+2 1.79e+2 5.38e+2 1.79e+2 5.42e+2 1.79e+2 2.83e+2 1.79e+2 7.95e+2 1.58e+2 7.77e+2 1.78e+2 7.51e+2 1.79e+2 7.53e+2 1.80e+2 2.15e+2 1.78e+2 2.01e+2 1.78e+2 5.79e+1 1.79e+2 2.21e+2 1.78e+2 7.37e+2 1.48e+2 5.53e+2 1.49e+2 2.84e+2 1.79e+2 2.33e+2 1.78e+2 2.35e+2 1.78e+2 4.30e+2 1.77e+2 6.88e+2 1.79e+2 5.21e+2 1.78e+2 5.16e+2 1.49e+2 4.34e+2 1.78e+2 6.14e+2 1.81e+2 7.50e+2 1.78e+2 2.24e+2 1.80e+2 2.26e+2 1.81e+2 5.32e+2 1.78e+2 4.54e+2 1.78e+2 6.98e+2 1.46e+2 7.00e+2 1.46e+2 6.12e+2 1.19e+2 5.79e+2 1.48e+2 4.42e+2 1.78e+2 1.78e+2 1.78e+2 5.21e+2 1.78e+2 6.29e+1 1.51e+2 6.48e+1 1.51e+2 6.68e+1 1.52e+2 6.28e+2 1.78e+2 7.96e+2 1.78e+2 6.13e+2 1.19e+2 6.06e+2 1.75e+2 7.95e+2 1.78e+2 1.52e+2 9.56e+1 6.82e+2 1.78e+2 6.37e+2 1.19e+2 5.45e+2 1.78e+2 6.97e+2 1.79e+2 5.36e+2 1.79e+2 6.12e+2 1.79e+2 7.93e+2 1.79e+2 4.42e+2 1.79e+2 1.88e+2 1.78e+2 2.82e+2 1.50e+2 2.84e+2 1.50e+2 2.86e+2 1.50e+2 5.05e+2 1.79e+2 2.75e+2 1.47e+2 6.85e+2 1.78e+2 6.73e+2 1.79e+2 1.84e+2 8.90e+1 7.43e+2 1.75e+2 6.95e+2 1.79e+2 6.72e+2 1.78e+2 5.60e+1 1.78e+2 1.90e+2 1.79e+2 6.71e+2 1.75e+2 6.95e+2 1.47e+2 5.46e+2 1.78e+2 6.20e+2 1.79e+2 7.47e+1 8.90e+1 7.66e+1 8.99e+1 1.05e+2 1.49e+2 1.07e+2 1.49e+2 1.10e+2 1.79e+2 7.90e+2 7.98e+1 4.26e+2 1.78e+2 7.90e+2 1.78e+2 2.89e+2 1.81e+2 6.16e+2 1.79e+2 6.18e+2 1.79e+2 2.67e+2 1.78e+2 5.30e+2 1.79e+2 4.38e+2 1.79e+2 4.36e+2 1.78e+2 2.17e+2 1.79e+2 2.89e+2 1.79e+2 1.31e+2 1.78e+2 1.76e+2 1.78e+2 3.73e+1 8.85e+1 3.93e+1 8.74e+1 4.40e+2 1.78e+2 2.00e+2 1.79e+2 3.04e+2 1.50e+2 7.87e+2 1.79e+2 4.37e+2 1.78e+2 4.23e+2 1.77e+2 2.66e+2 1.78e+2 5.97e+2 1.47e+2 5.99e+2 1.46e+2 1.23e+2 1.78e+2 6.95e+2 1.79e+2 4.05e+2 1.78e+2 2.11e+2 8.85e+1 3.06e+2 1.79e+2 5.54e+2 1.49e+2 6.86e+2 1.79e+2 2.14e+2 1.78e+2 7.02e+2 1.79e+2 1.66e+2 1.78e+2 3.07e+2 1.79e+2 4.41e+2 1.78e+2 5.20e+2 1.78e+2 2.86e+2 1.79e+2 5.12e+2 1.79e+2 7.57e+2 1.77e+2 2.79e+2 1.49e+2 3.44e+1 9.15e+1 3.63e+1 9.34e+1 1.33e+2 1.78e+2 6.73e+2 8.90e+1 2.16e+2 1.81e+2 7.84e+2 1.78e+2 5.61e+2 1.49e+2 5.34e+2 1.79e+2 1.09e+2 1.79e+2 1.08e+2 1.79e+2 1.05e+2 1.80e+2 1.97e+2 1.78e+2 3.50e+2 1.78e+2 7.49e+2 1.48e+2 1.64e+2 1.79e+2 2.90e+2 1.79e+2 1.13e+2 1.78e+2 7.33e+2 1.78e+2 6.22e+2 1.80e+2 6.74e+2 1.78e+2 4.22e+2 1.78e+2 1.37e+2 1.80e+2 4.04e+2 1.80e+2 4.75e+2 1.78e+2 5.76e+2 1.16e+2 5.78e+2 1.25e+2 5.79e+2 1.28e+2 5.07e+2 1.79e+2 5.99e+1 1.79e+2 6.75e+2 1.79e+2 2.28e+2 1.75e+2 5.15e+2 1.78e+2 2.30e+2 1.79e+2 3.64e+2 1.79e+2 2.03e+2 1.78e+2 3.90e+2 1.78e+2 5.08e+2 1.79e+2 3.89e+2 1.78e+2 2.42e+2 1.77e+2 1.78e+2 1.46e+2 2.45e+2 1.49e+2 1.45e+2 1.80e+2 2.02e+2 1.79e+2 7.37e+1 1.78e+2 7.85e+2 1.79e+2 3.01e+2 1.78e+2 6.92e+2 1.78e+2 7.83e+2 1.78e+2 1.96e+2 1.78e+2 5.59e+2 1.49e+2 1.22e+2 1.79e+2 4.14e+2 1.78e+2 5.65e+2 1.48e+2 6.43e+2 1.78e+2 3.46e+2 1.78e+2 6.19e+1 1.51e+2 4.04e+2 1.49e+2 4.43e+2 1.79e+2 4.45e+2 1.79e+2 7.47e+1 1.80e+2 1.34e+2 1.79e+2 6.48e+1 1.79e+2 7.82e+2 1.78e+2 6.27e+2 1.79e+2 1.82e+2 1.48e+2 3.61e+2 1.78e+2 1.44e+2 1.79e+2 5.80e+2 1.79e+2 6.52e+2 1.78e+2 4.01e+2 1.78e+2 5.77e+2 1.49e+2 9.73e+1 1.49e+2 4.77e+2 1.48e+2 7.86e+0 1.48e+2 3.55e+2 1.79e+2 6.49e+2 1.78e+2 6.09e+2 1.19e+2 6.11e+2 1.19e+2 5.10e+2 1.78e+2 2.44e+2 1.78e+2 3.54e+2 1.49e+2 3.56e+2 1.50e+2 2.10e+2 1.78e+2 3.08e+2 1.78e+2 3.18e+2 1.79e+2 7.12e+2 1.78e+2 1.11e+2 1.49e+2 1.78e+2 1.79e+2 1.80e+2 1.79e+2 6.80e+2 1.79e+2 9.92e+1 1.79e+2 7.79e+2 1.79e+2 5.31e+2 1.47e+2 5.33e+2 1.46e+2 2.46e+2 1.49e+2 5.75e+2 1.78e+2 5.09e+2 1.78e+2 1.86e+2 1.48e+2 2.54e+2 1.49e+2 2.30e+2 1.79e+2 5.76e+2 1.79e+2 2.83e+2 1.49e+2 3.79e+2 1.49e+2 5.82e+2 1.48e+2 1.03e+2 1.80e+2 6.68e+1 1.49e+2 1.54e+2 1.80e+2 5.19e+2 1.78e+2 6.88e+0 1.49e+2 1.04e+2 1.79e+2 7.88e+2 1.79e+2 5.43e+2 1.50e+2 6.53e+2 1.79e+2 4.18e+2 1.78e+2 4.20e+2 1.78e+2 1.09e+2 1.49e+2 9.24e+1 1.79e+2 1.06e+2 1.79e+2 5.37e+2 1.48e+2 6.19e+1 1.79e+2 6.58e+1 1.78e+2 6.62e+2 1.79e+2 4.92e+2 1.78e+2 6.97e+1 1.49e+2 6.37e+2 1.49e+2 4.00e+2 1.79e+2 5.30e+1 1.47e+2 2.40e+2 1.79e+2 2.61e+2 1.79e+2 1.98e+2 1.79e+2 2.80e+2 1.79e+2 5.18e+2 1.78e+2 7.47e+2 1.49e+2 5.93e+2 1.49e+2 5.73e+2 1.48e+2 2.40e+2 1.49e+2 1.60e+2 1.79e+2 2.09e+2 1.78e+2 5.57e+2 1.48e+2 5.86e+2 1.48e+2 6.70e+2 1.80e+2 7.22e+2 8.85e+1 7.24e+2 8.82e+1 7.26e+2 8.79e+1 2.40e+2 1.78e+2 5.55e+2 1.49e+2 6.35e+2 1.79e+2 4.94e+2 1.77e+2 3.57e+2 1.79e+2 6.48e+2 1.79e+2 6.46e+2 1.79e+2 3.59e+2 1.79e+2 6.24e+2 1.78e+2 2.12e+2 1.80e+2 4.87e+2 1.78e+2 7.59e+2 1.78e+2 2.39e+2 1.49e+2 3.76e+2 1.79e+2 1.55e+2 1.79e+2 7.84e+2 8.74e+1 6.56e+2 1.79e+2 7.45e+2 1.49e+2 2.45e+2 1.80e+2 2.47e+2 1.81e+2 3.79e+2 1.80e+2 3.48e+2 1.78e+2 1.40e+2 1.79e+2 2.38e+2 1.49e+2 5.55e+2 1.47e+2 5.88e+2 1.79e+2 6.90e+2 1.49e+2 5.58e+2 1.49e+2 3.84e+2 1.79e+2 2.88e+2 1.49e+2 7.44e+2 1.79e+2 7.41e+2 1.78e+2 5.62e+2 1.78e+2 7.50e+2 1.48e+2 2.04e+2 1.78e+2 3.09e+2 1.78e+2 6.23e+2 1.79e+2 4.71e+1 1.50e+2 3.19e+2 1.79e+2 7.48e+2 1.78e+2 5.86e+2 1.79e+2 4.91e+1 1.48e+2 7.25e+2 1.49e+2 7.27e+2 1.51e+2 5.79e+1 1.51e+2 5.99e+1 1.51e+2 3.83e+1 1.47e+2 1.87e+2 1.49e+2 3.17e+2 1.78e+2 2.60e+2 1.80e+2 5.82e+2 1.79e+2 8.45e+1 1.49e+2 7.66e+2 1.79e+2 3.95e+2 1.79e+2 5.57e+2 1.78e+2 5.01e+2 1.79e+2 7.08e+2 1.78e+2 7.22e+2 1.45e+2 6.22e+2 1.47e+2 2.56e+2 1.49e+2 5.66e+2 1.79e+2 5.81e+2 1.78e+2 3.93e+2 1.79e+2 5.83e+2 1.79e+2 3.00e+2 1.49e+2 6.59e+2 1.79e+2 7.11e+2 1.79e+2 7.56e+1 1.79e+2 1.70e+2 1.79e+2 4.50e+2 8.90e+1 4.52e+2 8.90e+1 4.82e+2 1.78e+2 5.96e+2 1.49e+2 3.75e+2 1.78e+2 1.63e+2 1.79e+2 4.61e+2 1.49e+2 1.67e+1 1.48e+2 2.97e+2 1.49e+2 7.74e+2 1.79e+2 8.74e+1 1.78e+2 2.77e+2 1.79e+2 9.63e+1 1.79e+2 5.16e+2 1.80e+2 2.96e+2 1.79e+2 5.84e+2 1.48e+2 2.71e+2 1.79e+2 7.71e+2 1.78e+2 3.73e+2 1.78e+2 1.76e+2 1.48e+2 4.83e+2 1.79e+2 4.85e+2 1.79e+2 5.56e+2 1.79e+2 6.89e+2 1.49e+2 6.79e+2 1.79e+2 5.44e+2 1.49e+2 6.35e+2 1.49e+2 3.83e+2 1.78e+2 5.65e+2 1.79e+2 7.06e+2 1.78e+2 6.41e+2 1.79e+2 1.89e+2 1.78e+2 7.36e+2 1.78e+2 4.86e+2 1.78e+2 4.77e+2 1.79e+2 4.83e+2 1.48e+2 1.59e+2 1.79e+2 1.17e+2 1.78e+2 3.74e+2 1.79e+2 1.21e+2 1.81e+2 6.68e+1 1.79e+2 2.74e+2 1.80e+2 5.49e+2 1.79e+2 5.21e+1 1.46e+2 4.80e+2 1.78e+2 1.74e+2 1.49e+2 5.74e+2 1.49e+2 6.45e+2 1.79e+2 8.06e+1 1.81e+2 4.11e+2 1.78e+2 4.17e+2 1.77e+2 4.06e+2 1.49e+2 4.80e+2 1.79e+2 4.82e+2 1.79e+2 6.95e+2 1.49e+2 5.73e+2 1.80e+2 5.61e+2 1.79e+2 9.24e+1 1.49e+2 6.38e+2 1.78e+2 4.76e+2 1.50e+2 4.78e+2 1.78e+2 9.83e+1 1.48e+2 7.66e+2 1.49e+2 3.81e+2 1.50e+2 3.83e+2 1.51e+2 3.85e+2 1.51e+2 2.34e+2 1.80e+2 3.58e+2 1.79e+2 6.19e+2 1.47e+2 2.72e+2 1.80e+2 3.75e+2 1.48e+2 3.40e+2 1.78e+2 7.62e+2 1.77e+2 3.65e+2 1.79e+2 5.64e+2 1.79e+2 9.63e+1 1.49e+2 5.01e+1 1.50e+2 8.65e+1 1.49e+2 4.27e+2 1.49e+2 1.14e+2 1.49e+2 6.39e+2 1.78e+2 3.52e+2 1.78e+2 2.23e+2 1.48e+2 3.34e+2 8.90e+1 3.36e+2 8.90e+1 9.83e+0 1.48e+2 2.38e+2 1.80e+2 7.34e+2 1.78e+2 2.53e+2 1.50e+2 2.89e+2 1.51e+2 9.33e+1 1.49e+2 7.70e+2 1.75e+2 7.72e+2 1.72e+2 7.74e+2 1.70e+2 6.05e+2 1.48e+2 7.26e+2 1.78e+2 5.59e+2 1.79e+2 6.63e+2 1.79e+2 2.35e+2 1.48e+2 2.33e+2 1.79e+2 5.63e+2 1.49e+2 7.66e+1 1.78e+2 5.46e+2 1.48e+2 7.73e+2 1.78e+2 2.58e+2 1.79e+2 8.35e+1 1.78e+2 6.03e+2 8.82e+1 3.52e+2 1.46e+2 1.42e+2 1.78e+2 4.48e+2 1.49e+2 1.08e+1 1.49e+2 2.45e+2 1.79e+2 3.41e+2 1.81e+2 2.05e+2 1.48e+2 9.04e+1 1.49e+2 5.62e+2 1.49e+2 2.67e+2 1.46e+2 4.28e+2 1.47e+2 5.45e+2 1.49e+2 3.80e+2 1.79e+2 4.76e+2 1.78e+2 2.75e+1 1.46e+2 2.94e+1 1.44e+2 4.22e+1 1.49e+2 5.48e+2 8.83e+1 3.97e+2 1.78e+2 7.07e+1 1.79e+2 8.84e+1 1.79e+2 7.07e+2 1.79e+2 4.78e+2 1.79e+2 3.76e+2 1.49e+2 5.92e+2 1.79e+2 3.18e+2 1.48e+2 4.05e+2 1.49e+2 5.11e+1 8.90e+1 2.73e+2 1.79e+2 4.71e+2 1.78e+2 1.16e+2 1.80e+2 2.22e+2 1.49e+2 7.70e+2 1.79e+2 7.80e+2 8.90e+1 4.98e+2 1.79e+2 6.97e+1 1.79e+2 2.57e+2 1.78e+2 2.55e+2 1.49e+2 3.78e+2 1.48e+2 6.03e+2 1.80e+2 6.05e+2 1.80e+2 1.80e+2 1.45e+2 2.06e+2 1.79e+2 5.78e+2 1.48e+2 3.79e+2 8.90e+1 5.72e+2 1.79e+2 1.86e+1 1.49e+2 5.67e+2 1.79e+2 6.57e+2 1.78e+2 2.95e+2 1.78e+2 2.54e+2 1.49e+2 5.11e+1 1.48e+2 1.13e+2 1.49e+2 6.03e+2 1.47e+2 4.74e+2 1.49e+2 3.15e+2 1.79e+2 7.04e+2 1.79e+2 7.24e+2 1.78e+2 7.64e+2 1.51e+2 7.48e+2 1.49e+2 8.55e+1 1.79e+2 1.15e+2 1.49e+2 1.16e+2 1.48e+2 6.00e+2 1.78e+2 5.96e+2 1.78e+2 4.93e+2 1.79e+2 7.53e+2 1.50e+2 7.54e+2 1.50e+2 3.05e+2 1.49e+2 2.59e+2 1.81e+2 6.73e+2 1.49e+2 5.23e+2 8.90e+1 2.75e+2 1.49e+2 2.86e+2 1.49e+2 7.18e+2 1.49e+2 6.72e+2 1.49e+2 3.67e+2 1.78e+2 4.11e+2 1.50e+2 4.73e+2 1.78e+2 4.14e+2 1.49e+2 4.12e+1 1.49e+2 4.91e+2 1.78e+2 4.12e+2 1.48e+2 4.52e+2 1.48e+2 3.42e+2 1.80e+2 2.29e+2 1.48e+2 3.38e+2 1.78e+2 1.67e+1 1.49e+2 4.10e+2 1.49e+2 5.64e+2 1.49e+2 6.34e+2 1.49e+2 4.84e+2 1.48e+2 4.80e+2 1.47e+2 4.82e+2 1.46e+2 7.25e+2 1.78e+2 4.86e+2 1.81e+2 4.88e+2 1.81e+2 4.90e+2 1.82e+2 4.25e+2 1.50e+2 5.48e+2 1.49e+2 6.64e+2 1.48e+2 6.70e+2 1.51e+2 7.68e+2 1.82e+2 2.03e+2 8.90e+1 2.07e+2 1.49e+2 4.59e+2 1.50e+2 3.27e+2 1.49e+2 3.53e+1 1.49e+2 2.02e+2 1.48e+2 2.04e+2 1.48e+2 7.24e+2 1.50e+2 3.05e+2 8.90e+1 3.07e+2 8.90e+1 4.13e+2 1.48e+2 1.86e+2 1.78e+2 5.71e+2 1.49e+2 5.97e+2 1.78e+2 3.96e+2 1.49e+2 6.65e+2 1.49e+2 6.78e+2 1.80e+2 8.74e+1 1.48e+2 7.11e+2 1.48e+2 6.77e+2 1.79e+2 1.73e+2 1.49e+2 7.38e+2 1.79e+2 9.43e+1 1.48e+2 2.12e+2 1.48e+2 4.03e+1 8.90e+1 4.22e+1 8.86e+1 4.42e+1 8.89e+1 3.82e+2 1.79e+2 5.91e+2 1.79e+2 3.97e+2 1.50e+2 5.42e+2 1.49e+2 3.34e+2 1.78e+2 4.58e+2 1.79e+2 4.71e+1 1.48e+2 7.05e+2 1.78e+2 5.77e+2 1.50e+2 4.69e+2 1.78e+2 5.72e+2 1.49e+2 1.83e+2 1.47e+2 1.19e+2 1.79e+2 3.44e+1 1.48e+2 4.23e+2 1.48e+2 3.93e+0 1.48e+2 5.99e+2 1.79e+2 7.37e+1 8.90e+1 1.37e+1 1.49e+2 2.63e+2 1.49e+2 2.06e+2 1.95e+2 4.66e+2 1.49e+2 4.10e+2 1.80e+2 3.29e+2 1.49e+2 3.14e+1 1.49e+2 5.81e+2 1.47e+2 2.53e+2 1.78e+2 7.52e+2 1.49e+2 7.63e+2 1.49e+2 3.62e+2 8.90e+1 3.64e+2 8.90e+1 8.25e+1 1.78e+2 3.81e+2 1.80e+2 1.83e+2 1.74e+2 1.85e+2 1.72e+2 2.11e+2 1.49e+2 2.21e+2 1.49e+2 4.22e+2 1.49e+2 4.91e+0 1.48e+2 8.25e+1 1.49e+2 9.53e+1 1.49e+2 5.75e+2 1.48e+2 2.81e+2 1.49e+2 7.29e+2 8.90e+1 2.94e+0 1.49e+2 6.06e+2 1.49e+2 1.27e+1 1.49e+2 3.83e+2 1.49e+2 3.69e+2 1.79e+2 2.08e+2 1.48e+2 1.48e+2 1.48e+2 4.81e+1 1.49e+2 2.33e+2 1.48e+2 7.73e+2 1.49e+2 4.20e+2 1.49e+2 4.09e+2 1.48e+2 4.59e+2 1.80e+2 4.12e+2 1.48e+2 5.87e+2 1.49e+2 3.32e+2 1.78e+2 5.65e+2 1.49e+2 5.01e+2 1.49e+2 3.98e+2 1.49e+2 5.22e+2 1.48e+2 5.87e+2 1.78e+2 1.20e+2 1.80e+2 4.32e+1 1.50e+2 4.52e+1 1.50e+2 1.86e+1 1.50e+2 3.16e+2 1.49e+2 2.92e+2 1.49e+2 6.52e+2 1.48e+2 6.54e+2 1.47e+2 6.63e+2 1.49e+2 5.99e+1 1.81e+2 4.49e+2 1.79e+2 4.51e+2 1.79e+2 5.05e+2 1.49e+2 7.53e+2 1.49e+2 4.49e+2 1.47e+2 2.95e+2 1.49e+2 7.49e+2 1.48e+2 2.56e+2 1.78e+2 2.47e+2 1.49e+2 6.68e+2 1.48e+2 1.76e+1 1.48e+2 1.73e+2 1.79e+2 6.91e+2 1.48e+2 6.92e+2 1.47e+2 4.74e+2 1.79e+2 1.32e+2 1.48e+2 1.34e+2 1.48e+2 8.06e+1 1.49e+2 4.65e+2 1.78e+2 2.26e+1 1.51e+2 2.45e+1 1.52e+2 4.63e+2 1.78e+2 2.61e+2 1.49e+2 4.15e+2 1.49e+2 3.30e+2 1.78e+2 5.85e+2 1.49e+2 2.13e+2 1.48e+2 4.31e+2 1.50e+2 7.59e+2 1.48e+2 4.73e+2 1.50e+2 7.06e+2 1.49e+2 7.58e+2 1.48e+2 7.28e+2 1.78e+2 1.95e+2 1.96e+2 5.51e+2 1.49e+2 4.47e+2 1.79e+2 2.68e+2 1.49e+2 7.21e+2 1.78e+2 3.53e+1 1.50e+2 2.07e+2 1.48e+2 7.28e+2 1.48e+2 6.76e+2 1.49e+2 5.94e+2 1.48e+2 3.04e+1 1.48e+2 1.94e+2 1.49e+2 3.29e+2 1.79e+2 7.29e+2 1.49e+2 5.40e+1 8.90e+1 7.16e+2 8.90e+1 7.31e+2 1.49e+2 2.21e+2 1.48e+2 2.23e+2 1.48e+2 4.67e+2 1.49e+2 3.23e+2 1.79e+2 4.26e+2 1.46e+2 2.46e+2 1.79e+2 2.25e+2 1.49e+2 2.19e+2 1.49e+2 1.62e+2 1.49e+2 1.37e+2 1.49e+2 3.86e+2 1.48e+2 3.84e+2 1.49e+2 4.53e+2 1.48e+2 7.44e+2 1.46e+2 7.46e+2 1.46e+2 1.40e+2 1.49e+2 1.47e+1 1.48e+2 4.98e+2 1.49e+2 4.34e+2 1.48e+2 1.21e+2 1.48e+2 3.22e+2 1.47e+2 3.24e+2 1.47e+2 2.00e+2 1.46e+2 2.14e+2 1.49e+2 2.05e+2 1.48e+2 5.81e+2 1.49e+2 5.79e+2 1.49e+2 7.71e+2 1.48e+2 7.73e+2 1.48e+2 5.41e+2 8.90e+1 5.30e+1 1.49e+2 7.30e+2 1.78e+2 4.08e+2 1.50e+2 4.10e+2 1.51e+2 6.02e+2 1.49e+2 6.15e+2 1.49e+2 5.92e+2 1.49e+2 2.09e+2 1.47e+2 2.11e+2 1.46e+2 5.74e+2 1.50e+2 4.05e+2 1.48e+2 4.35e+2 1.48e+2 1.94e+2 9.76e+1 3.44e+1 1.49e+2 8.15e+1 1.49e+2 5.68e+2 1.79e+2 3.25e+2 1.79e+2 7.20e+2 1.78e+2 7.66e+2 1.78e+2 5.90e+2 1.47e+2 6.69e+2 1.50e+2 3.94e+2 1.50e+2 1.51e+2 1.49e+2 5.73e+2 1.50e+2 4.47e+2 1.49e+2 4.68e+2 1.79e+2 2.60e+2 1.49e+2 1.97e+2 1.48e+2 4.06e+2 1.50e+2 3.24e+2 1.79e+2 4.12e+1 1.51e+2 3.28e+2 1.78e+2 6.73e+2 1.48e+2 2.51e+2 1.79e+2 2.55e+2 1.79e+2 4.83e+2 1.49e+2 4.85e+2 1.49e+2 3.05e+2 1.48e+2 7.62e+2 1.49e+2 4.92e+2 1.49e+2 4.99e+2 1.49e+2 5.21e+1 1.48e+2 7.17e+2 1.81e+2 1.90e+2 1.48e+2 1.90e+2 1.50e+2 1.92e+2 1.50e+2 1.92e+2 1.49e+2 1.33e+2 1.49e+2 3.25e+2 1.49e+2 7.83e+2 8.90e+1 3.22e+2 1.79e+2 7.68e+2 1.79e+2 4.56e+2 1.49e+2 2.47e+2 1.79e+2 7.90e+2 1.59e+2 5.60e+1 1.47e+2 3.83e+1 1.49e+2 1.63e+2 1.49e+2 5.57e+2 1.50e+2 5.59e+2 1.50e+2 5.61e+2 1.50e+2 3.11e+2 1.49e+2 2.09e+2 1.49e+2 1.45e+2 1.50e+2 4.93e+2 1.49e+2 4.58e+2 1.49e+2 5.40e+1 1.49e+2 7.70e+2 1.49e+2 1.52e+2 1.50e+2 4.77e+2 1.48e+2 3.26e+2 1.79e+2 7.65e+2 1.78e+2 3.93e+2 1.49e+2 1.42e+2 1.50e+2 4.27e+2 1.49e+2 4.89e+2 1.49e+2 1.86e+2 1.49e+2 1.70e+2 1.49e+2 4.56e+2 1.49e+2 1.17e+2 1.49e+2 4.52e+2 1.49e+2 3.10e+2 1.48e+2 6.31e+2 1.49e+2 6.33e+2 1.49e+2 1.56e+2 1.45e+2 6.52e+2 1.50e+2 5.40e+1 1.79e+2 6.13e+2 1.48e+2 7.16e+2 1.48e+2 5.23e+2 1.49e+2 6.03e+2 1.49e+2 7.87e+2 1.60e+2 4.92e+2 1.49e+2 1.69e+2 1.50e+2 2.73e+2 1.49e+2 7.67e+2 1.49e+2 7.88e+2 1.60e+2 1.61e+2 1.49e+2 4.81e+2 1.49e+2 4.21e+2 1.48e+2 7.01e+2 1.49e+2 4.16e+2 1.49e+2 4.63e+2 1.49e+2 7.69e+2 1.49e+2 7.68e+2 1.49e+2 4.78e+2 1.49e+2 3.20e+2 1.48e+2 3.91e+2 1.49e+2 4.68e+2 1.49e+2 5.10e+2 1.49e+2 7.41e+2 1.49e+2 6.21e+2 1.49e+2 5.35e+2 1.49e+2 4.97e+2 1.49e+2 6.88e+2 1.49e+2 6.14e+2 1.49e+2 1.50e+2 1.49e+2 6.56e+2 1.49e+2 4.32e+2 1.48e+2 3.81e+2 8.90e+1 3.83e+2 8.90e+1 2.71e+2 1.49e+2 5.89e+1 1.49e+2 1.98e+2 1.46e+2 5.32e+2 8.90e+1 3.93e+1 1.49e+2 2.01e+2 1.45e+2 2.07e+2 8.90e+1 4.54e+2 1.49e+2 2.32e+2 1.49e+2 6.14e+2 1.49e+2 6.16e+2 1.50e+2 7.04e+2 1.49e+2 7.19e+2 1.48e+2 6.20e+2 1.49e+2 1.41e+2 1.49e+2 7.81e+2 1.62e+2 4.03e+1 1.50e+2 4.63e+2 1.48e+2 1.47e+2 1.49e+2 1.31e+2 1.50e+2 6.39e+2 1.48e+2 1.08e+2 1.47e+2 5.21e+2 1.49e+2 4.69e+2 1.49e+2 5.70e+2 1.49e+2 7.53e+2 1.49e+2 7.03e+2 1.49e+2 6.48e+1 1.49e+2 5.03e+2 1.49e+2 3.07e+2 1.50e+2 2.91e+2 1.49e+2 2.52e+2 1.48e+2 7.09e+2 1.49e+2 7.75e+2 1.49e+2 4.82e+2 1.49e+2 7.85e+2 1.49e+2 7.63e+2 1.78e+2 1.17e+2 1.48e+2 1.19e+2 1.48e+2 6.01e+2 1.49e+2 7.18e+2 1.79e+2 3.69e+2 1.48e+2 2.20e+2 1.49e+2 2.26e+1 1.48e+2 1.49e+2 1.48e+2 1.48e+2 1.48e+2 2.16e+1 1.49e+2 1.51e+2 1.47e+2 2.79e+2 1.49e+2 3.24e+1 1.50e+2 5.60e+1 8.90e+1 4.17e+2 1.49e+2 6.51e+2 1.50e+2 3.27e+2 1.51e+2 3.29e+2 1.52e+2 1.52e+2 1.49e+2 1.53e+2 1.49e+2 1.55e+2 1.49e+2 7.57e+2 1.49e+2 6.28e+2 1.48e+2 4.00e+2 1.49e+2 5.60e+1 1.79e+2 5.79e+1 1.80e+2 6.44e+2 1.49e+2 7.40e+2 1.48e+2 6.78e+2 1.48e+2 7.42e+2 1.49e+2 1.72e+2 1.48e+2 3.70e+2 1.50e+2 2.90e+2 1.49e+2 3.57e+2 1.49e+2 4.70e+2 1.50e+2 4.78e+2 1.49e+2 7.50e+2 1.49e+2 6.18e+2 1.49e+2 4.43e+2 1.48e+2 4.45e+2 1.48e+2 5.07e+2 1.49e+2 7.05e+2 1.48e+2 1.02e+2 1.49e+2 6.88e+1 1.50e+2 3.12e+2 1.50e+2 2.27e+2 1.49e+2 2.35e+1 1.49e+2 1.75e+2 1.46e+2 2.51e+2 1.49e+2 3.31e+2 1.48e+2 1.71e+2 1.49e+2 4.62e+2 1.48e+2 6.62e+2 1.49e+2 4.19e+2 1.49e+2 7.89e+2 1.59e+2 3.47e+2 1.48e+2 2.67e+2 1.49e+2 2.18e+2 1.48e+2 2.20e+2 1.48e+2 5.12e+2 1.49e+2 3.35e+2 1.48e+2 7.86e+2 8.85e+1 2.85e+1 1.48e+2 5.40e+2 1.49e+2 2.48e+2 1.79e+2 3.49e+2 1.46e+2 3.51e+2 1.46e+2 2.49e+2 1.78e+2 7.17e+1 1.49e+2 5.53e+2 1.47e+2 3.90e+2 1.50e+2 2.28e+2 1.49e+2 7.14e+2 1.49e+2 1.46e+2 1.49e+2 3.31e+2 1.46e+2 3.33e+2 1.43e+2 1.83e+2 1.49e+2 1.85e+2 1.48e+2 6.60e+2 1.49e+2 3.04e+2 1.48e+2 4.31e+2 1.49e+2 3.36e+2 1.49e+2 1.43e+2 1.50e+2 6.45e+2 1.48e+2 4.50e+2 1.49e+2 6.19e+1 1.49e+2 2.66e+2 1.49e+2 5.28e+2 1.49e+2 7.83e+2 1.48e+2 2.06e+1 1.48e+2 7.10e+2 1.48e+2 7.56e+2 1.48e+2 3.36e+2 1.50e+2 3.38e+2 1.50e+2 4.59e+2 1.49e+2 1.89e+2 1.50e+2 3.32e+2 1.80e+2 6.61e+2 1.48e+2 6.11e+2 1.48e+2 4.40e+2 1.48e+2 6.26e+2 1.50e+2 4.96e+2 1.49e+2 5.99e+2 1.49e+2 4.42e+2 1.49e+2 5.39e+2 1.49e+2 4.81e+1 8.90e+1 1.68e+2 1.49e+2 5.21e+2 8.90e+1 5.75e+2 1.50e+2 4.40e+2 1.48e+2 1.45e+2 1.49e+2 1.79e+2 1.49e+2 4.53e+2 1.49e+2 7.21e+2 1.49e+2 6.64e+2 8.90e+1 6.66e+2 8.90e+1 1.23e+2 1.48e+2 2.44e+2 1.48e+2 2.46e+2 1.47e+2 2.48e+2 1.46e+2 3.68e+2 1.48e+2 3.70e+2 1.49e+2 7.20e+2 1.48e+2 1.69e+2 1.49e+2 1.71e+2 1.49e+2 5.38e+2 1.49e+2 5.26e+2 8.90e+1 1.88e+2 1.49e+2 5.51e+2 8.90e+1 4.44e+2 1.49e+2 2.91e+2 1.78e+2 5.21e+1 8.90e+1 1.58e+2 1.46e+2 1.60e+2 1.45e+2 1.62e+2 1.45e+2 3.41e+2 1.48e+2 4.20e+2 1.46e+2 1.81e+2 1.50e+2 6.19e+1 1.81e+2 6.38e+1 1.82e+2 6.58e+1 1.82e+2 3.55e+2 1.49e+2 8.45e+1 1.47e+2 5.36e+2 1.50e+2 4.45e+2 1.48e+2 3.56e+2 1.47e+2 2.65e+1 1.49e+2 3.46e+2 1.48e+2 5.67e+2 1.48e+2 3.58e+2 1.49e+2 1.25e+2 1.48e+2 6.59e+2 1.49e+2 3.71e+2 1.49e+2 7.36e+2 1.49e+2 3.58e+2 1.46e+2 4.17e+2 1.48e+2 6.78e+1 1.48e+2 5.16e+2 1.49e+2 1.67e+2 1.50e+2 1.16e+2 1.49e+2 4.52e+1 8.90e+1 1.90e+2 1.48e+2 3.18e+2 1.49e+2 3.39e+2 1.50e+2 2.50e+2 1.49e+2 4.30e+2 1.48e+2 1.44e+2 1.47e+2 1.15e+2 1.48e+2 1.72e+2 1.49e+2 7.62e+2 1.78e+2 7.34e+2 1.49e+2 5.11e+2 8.90e+1 6.46e+2 1.48e+2 5.06e+2 1.48e+2 4.96e+2 1.49e+2 7.71e+2 2.95e+1 2.30e+2 1.49e+2 1.23e+2 1.47e+2 7.81e+2 1.49e+2 7.83e+2 1.50e+2 3.59e+2 1.49e+2 1.73e+2 1.48e+2 5.29e+2 1.48e+2 4.16e+2 1.48e+2 3.14e+2 1.46e+2 6.09e+2 1.47e+2 3.68e+2 1.49e+2 3.66e+2 1.48e+2 2.10e+2 1.96e+2 3.89e+2 1.49e+2 6.58e+2 1.49e+2 5.25e+2 1.49e+2 3.77e+2 8.90e+1 3.54e+2 1.49e+2 2.00e+2 1.99e+2 6.23e+2 1.49e+2 3.17e+2 1.50e+2 7.80e+2 1.48e+2 7.11e+2 1.49e+2 4.38e+2 1.49e+2 7.84e+2 8.90e+1 4.12e+1 1.46e+2 6.86e+2 1.49e+2 3.45e+2 1.49e+2 1.40e+2 1.49e+2 6.50e+2 1.49e+2 1.15e+2 1.49e+2 5.28e+2 8.90e+1 3.34e+1 8.90e+1 6.57e+2 1.50e+2 3.22e+2 8.79e+1 6.58e+1 1.51e+2 5.17e+2 1.49e+2 1.28e+2 1.49e+2 3.45e+2 1.50e+2 3.43e+2 1.48e+2 5.54e+2 8.90e+1 4.34e+2 1.50e+2 7.33e+2 1.49e+2 6.85e+2 1.48e+2 6.47e+2 1.49e+2 6.49e+2 1.49e+2 3.92e+2 1.49e+2 5.25e+2 8.90e+1 6.24e+2 1.49e+2 5.36e+2 8.90e+1 5.38e+2 8.90e+1 5.40e+2 8.90e+1 7.76e+2 1.47e+2 2.32e+2 1.49e+2 4.97e+2 1.48e+2 7.61e+2 1.79e+2 3.64e+2 1.49e+2 7.07e+1 8.71e+1 7.27e+1 8.62e+1 5.85e+2 1.77e+2 5.95e+2 1.48e+2 3.60e+2 1.48e+2 4.37e+2 1.47e+2 4.39e+2 1.47e+2 7.58e+2 1.79e+2 7.60e+2 1.79e+2 4.66e+2 8.90e+1 1.11e+2 1.48e+2 4.75e+2 1.49e+2 3.47e+2 1.49e+2 3.19e+2 1.46e+2 4.13e+2 1.49e+2 4.15e+2 1.49e+2 2.11e+2 1.97e+2 3.38e+2 8.90e+1 3.50e+2 1.48e+2 3.61e+2 1.48e+2 1.87e+2 1.50e+2 4.74e+2 1.49e+2 6.64e+2 1.48e+2 7.52e+2 1.46e+2 3.53e+2 1.50e+2 5.79e+2 1.47e+2 2.00e+2 1.49e+2 7.80e+2 1.49e+2 2.42e+2 1.50e+2 3.24e+1 8.73e+1 3.41e+2 8.90e+1 3.43e+2 1.49e+2 2.58e+2 1.50e+2 2.60e+2 1.51e+2 5.12e+2 8.90e+1 5.14e+2 8.90e+1 2.12e+2 1.97e+2 7.62e+2 8.90e+1 5.79e+1 8.90e+1 1.99e+2 1.48e+2 5.35e+2 8.90e+1 7.60e+2 8.90e+1 3.48e+2 1.49e+2 7.78e+2 1.63e+2 7.80e+2 1.63e+2 4.99e+2 1.48e+2 5.01e+2 1.48e+2 7.53e+2 1.79e+2 7.55e+2 1.80e+2 1.98e+2 1.49e+2 7.10e+2 1.46e+2 5.31e+2 8.90e+1 3.47e+2 8.84e+1 3.49e+2 8.83e+1 9.04e+1 1.46e+2 7.74e+2 1.64e+2 3.41e+2 1.49e+2 5.73e+2 1.47e+2 2.21e+2 1.00e+2 3.04e+1 8.90e+1 7.59e+2 8.90e+1 2.36e+2 1.49e+2 4.70e+2 8.90e+1 7.89e+2 8.90e+1 2.37e+2 1.50e+2 2.39e+2 1.50e+2 2.41e+2 1.51e+2 7.76e+2 1.49e+2 6.56e+2 8.90e+1 4.65e+2 8.90e+1 3.60e+2 1.47e+2 3.62e+2 1.47e+2 7.79e+2 1.49e+2 7.71e+2 8.90e+1 7.73e+2 8.90e+1 7.75e+2 8.90e+1 4.68e+2 8.90e+1 2.21e+2 2.00e+2 2.23e+2 2.00e+2 2.25e+2 2.00e+2 6.27e+2 1.49e+2 4.72e+2 8.90e+1 4.74e+2 8.90e+1 6.59e+2 1.49e+2 3.43e+2 8.90e+1 7.66e+2 8.39e+1 2.16e+2 1.99e+2 6.68e+1 8.90e+1 6.88e+1 8.90e+1 1.96e+2 1.46e+2 4.22e+2 1.46e+2 2.15e+2 1.99e+2 7.33e+2 8.90e+1 2.20e+2 2.01e+2 7.55e+2 8.90e+1 7.57e+2 8.90e+1 5.71e+2 9.15e+1 2.19e+2 2.00e+2 1.17e+1 8.90e+1 3.51e+2 8.90e+1 3.53e+2 8.93e+1 7.63e+2 8.90e+1 2.65e+1 8.83e+1 2.85e+1 8.80e+1 3.46e+2 8.90e+1 5.30e+2 8.90e+1 7.86e+2 1.46e+2 7.88e+2 1.45e+2 7.70e+2 8.90e+1 3.00e+2 1.50e+2 5.89e+1 8.90e+1 4.02e+2 8.90e+1 5.55e+2 1.46e+2 7.86e+0 8.90e+1 7.96e+2 8.90e+1 4.06e+2 8.90e+1 4.63e+2 8.90e+1 7.64e+2 8.90e+1 2.71e+2 8.90e+1 3.75e+2 8.90e+1 7.51e+2 1.78e+2 4.67e+2 1.47e+2 4.69e+2 1.46e+2 4.98e+2 1.47e+2 1.76e+1 8.90e+1 1.96e+1 8.90e+1 7.66e+2 8.90e+1 7.68e+2 8.89e+1 2.06e+1 8.90e+1 2.26e+1 8.90e+1 2.45e+1 8.90e+1 7.47e+2 1.74e+2 9.04e+1 8.83e+1 9.24e+1 8.80e+1 7.66e+2 1.67e+2 7.68e+2 1.66e+2 3.45e+2 8.83e+1 2.74e+2 2.03e+2 2.76e+2 2.03e+2 7.50e+2 8.90e+1 7.52e+2 8.91e+1 7.53e+2 8.91e+1 7.38e+2 8.90e+1 7.57e+2 1.70e+2 7.59e+2 1.70e+2 2.98e+2 1.48e+2 6.09e+1 8.90e+1 7.92e+2 8.85e+1 8.74e+1 8.90e+1 4.61e+2 8.90e+1 5.56e+2 8.90e+1 5.58e+2 8.89e+1 5.60e+2 8.91e+1 4.04e+2 8.90e+1 5.63e+2 8.90e+1 5.65e+2 8.90e+1 5.89e+0 8.90e+1 6.29e+1 8.90e+1 6.48e+1 8.90e+1 5.68e+2 8.90e+1 5.70e+2 8.90e+1 9.53e+1 8.91e+1 4.90e+2 8.85e+1 4.92e+2 8.82e+1 7.50e+2 1.73e+2 6.21e+2 8.90e+1 6.23e+2 8.90e+1 7.45e+2 1.48e+2 8.55e+1 8.90e+1 1.47e+1 8.90e+1 1.68e+2 8.90e+1 4.73e+2 1.47e+2 5.06e+2 8.90e+1 7.43e+2 8.79e+1 7.45e+2 8.78e+1 4.94e+2 8.90e+1 6.20e+2 8.90e+1 7.48e+2 8.92e+1 5.76e+2 8.90e+1 5.98e+2 8.90e+1 1.31e+2 8.85e+1 2.93e+2 8.90e+1 7.96e+1 8.90e+1 4.00e+2 8.90e+1 4.87e+2 8.90e+1 4.89e+2 8.90e+1 6.85e+2 1.49e+2 4.28e+2 8.85e+1 1.74e+2 8.85e+1 5.78e+2 8.82e+1 2.74e+2 8.85e+1 2.76e+2 8.77e+1 4.21e+2 8.85e+1 4.23e+2 8.82e+1 4.31e+2 8.92e+1 6.49e+2 8.90e+1 6.51e+2 8.90e+1 7.47e+2 8.74e+1 2.88e+2 8.90e+1 4.19e+2 8.90e+1 6.47e+2 8.90e+1 3.68e+2 8.90e+1 3.31e+2 8.85e+1 6.42e+2 8.90e+1 1.75e+2 8.85e+1 1.77e+2 8.85e+1 7.41e+2 8.85e+1 3.57e+2 8.85e+1 2.97e+2 8.90e+1 4.17e+2 8.90e+1 2.79e+2 1.97e+2 6.83e+2 1.47e+2 2.59e+2 1.97e+2 3.11e+2 8.90e+1 7.75e+2 6.66e+1 4.55e+2 8.90e+1 3.92e+2 9.35e+1 7.26e+2 8.90e+1 1.83e+2 9.35e+1 1.85e+2 9.35e+1 4.77e+2 9.35e+1 6.86e+2 1.47e+2 3.23e+2 9.35e+1 3.22e+2 9.35e+1 2.13e+2 8.85e+1 2.35e+1 9.35e+1 5.36e+2 9.35e+1 3.21e+2 9.35e+1 4.91e+2 9.35e+1 2.89e+2 9.35e+1 7.07e+1 9.35e+1 5.25e+2 9.35e+1 2.16e+1 9.35e+1 7.17e+1 9.35e+1 3.26e+2 9.35e+1 2.89e+2 9.35e+1 3.20e+2 9.35e+1 3.14e+1 9.35e+1 3.34e+1 9.35e+1 1.27e+1 9.35e+1 2.97e+2 9.35e+1 3.04e+1 9.35e+1 3.44e+1 9.35e+1 7.56e+1 9.35e+1 2.93e+2 9.35e+1 3.29e+2 9.35e+1 3.39e+2 9.35e+1 2.98e+2 9.35e+1 2.08e+2 8.90e+1 3.41e+2 9.35e+1 2.85e+1 9.35e+1 1.08e+2 9.35e+1 3.40e+2 9.35e+1 2.55e+1 9.35e+1 2.65e+1 9.35e+1 3.38e+2 9.35e+1 1.11e+2 9.35e+1 8.55e+1 9.35e+1 2.77e+2 9.35e+1 1.96e+1 9.35e+1 1.05e+2 9.35e+1 1.03e+2 9.35e+1 2.90e+2 9.35e+1 7.47e+1 9.35e+1 6.88e+2 1.47e+2 2.75e+2 9.35e+1 2.58e+2 9.35e+1 9.92e+1 9.35e+1 3.31e+2 9.35e+1 2.86e+2 9.35e+1 3.43e+2 9.35e+1 5.79e+2 9.35e+1 3.36e+2 9.35e+1 3.50e+2 9.35e+1 3.10e+2 9.35e+1 3.52e+2 9.35e+1 9.04e+1 9.35e+1 3.18e+2 9.35e+1 3.45e+2 9.35e+1 3.47e+2 9.35e+1 5.30e+1 9.35e+1 1.99e+2 8.85e+1 3.17e+2 9.35e+1 2.05e+2 8.85e+1 3.80e+2 9.35e+1 3.82e+2 9.35e+1 3.54e+2 9.35e+1 8.45e+1 9.35e+1 1.15e+2 9.35e+1 9.73e+1 9.35e+1 1.18e+2 9.35e+1 1.20e+2 9.35e+1 4.52e+1 9.35e+1 5.21e+1 9.35e+1 9.63e+1 9.35e+1 1.16e+2 9.35e+1 3.32e+2 9.35e+1 8.94e+1 9.35e+1 9.53e+1 9.35e+1 5.50e+1 9.35e+1 2.52e+2 9.35e+1 3.09e+2 9.35e+1 7.66e+1 9.35e+1 3.49e+2 9.35e+1 5.56e+2 9.35e+1 1.01e+2 9.35e+1 3.08e+2 9.35e+1 4.71e+1 9.35e+1 4.91e+1 9.35e+1 3.11e+2 9.35e+1 1.95e+2 8.85e+1 9.33e+1 9.35e+1 3.83e+1 9.35e+1 2.57e+2 9.35e+1 7.82e+2 9.35e+1 2.47e+2 9.35e+1 2.78e+2 9.30e+1 2.37e+2 9.35e+1 4.81e+1 9.35e+1 2.69e+2 9.35e+1 3.61e+2 9.35e+1 3.60e+2 9.35e+1 3.77e+2 9.35e+1 2.51e+2 9.35e+1 6.09e+1 9.35e+1 2.53e+2 9.35e+1 5.79e+1 9.35e+1 3.03e+2 9.35e+1 3.55e+2 9.35e+1 7.09e+2 8.85e+1 2.91e+2 9.35e+1 3.71e+2 9.35e+1 3.34e+2 9.35e+1 8.74e+1 9.35e+1 6.78e+1 9.35e+1 1.97e+2 8.85e+1 2.45e+2 9.35e+1 3.04e+2 9.35e+1 2.80e+2 9.30e+1 3.53e+1 9.35e+1 5.99e+1 9.35e+1 3.62e+2 9.35e+1 3.48e+2 9.35e+1 4.22e+1 9.35e+1 7.58e+2 9.35e+1 7.60e+2 9.35e+1 2.01e+2 8.85e+1 3.72e+2 9.35e+1 5.27e+2 8.85e+1 3.13e+2 9.35e+1 2.79e+2 9.35e+1 2.02e+2 8.85e+1 2.83e+2 9.36e+1 3.68e+2 9.35e+1 3.57e+2 9.35e+1 3.02e+2 9.35e+1 3.73e+1 9.35e+1 7.21e+2 1.47e+2 7.23e+2 1.47e+2 2.42e+2 9.35e+1 2.44e+2 9.35e+1 2.26e+1 8.90e+1 7.76e+1 9.35e+1 4.33e+2 1.75e+2 3.76e+2 9.35e+1 2.13e+2 9.35e+1 2.66e+2 9.35e+1 3.66e+2 9.35e+1 3.64e+2 9.35e+1 7.01e+2 1.47e+2 2.65e+2 9.35e+1 7.96e+1 9.35e+1 8.15e+1 9.35e+1 3.74e+2 9.35e+1 5.50e+2 9.35e+1 3.15e+2 8.85e+1 3.17e+2 8.85e+1 3.80e+2 8.85e+1 4.61e+2 9.35e+1 5.04e+2 9.35e+1 3.73e+2 9.35e+1 4.71e+2 8.85e+1 7.03e+2 1.47e+2 7.53e+2 9.35e+1 2.16e+2 9.35e+1 7.86e+1 9.35e+1 2.32e+2 7.37e+1 2.85e+1 8.85e+1 5.61e+2 1.51e+2 6.11e+2 7.37e+1 6.13e+2 7.37e+1 2.07e+2 9.35e+1 5.10e+2 9.35e+1 6.94e+2 2.95e+1 5.55e+2 1.32e+2 6.91e+2 1.47e+2 6.93e+2 1.47e+2 7.00e+2 1.47e+2 1.52e+2 9.35e+1 5.74e+2 1.47e+2 5.76e+2 1.47e+2 5.78e+2 1.47e+2 2.15e+2 8.85e+1 1.98e+2 9.35e+1 2.00e+2 9.35e+1 4.27e+2 1.48e+2 4.29e+2 1.49e+2 3.83e+1 8.90e+1 7.80e+2 1.47e+2 7.82e+2 1.47e+2 5.73e+2 1.47e+2 5.71e+2 1.47e+2 6.95e+2 1.47e+2 4.18e+2 7.37e+1 7.79e+2 1.47e+2 7.96e+2 1.75e+2 5.63e+2 1.47e+2 6.16e+2 7.37e+1 5.70e+2 8.85e+1 5.72e+2 8.85e+1 7.72e+2 9.35e+1 5.64e+2 1.48e+2 4.19e+2 7.37e+1 5.67e+2 1.47e+2 5.69e+2 1.47e+2 4.99e+2 7.37e+1 5.95e+2 7.37e+1 4.17e+2 7.37e+1 4.46e+2 7.37e+1 4.39e+2 7.37e+1 2.29e+2 8.85e+1 3.11e+2 7.37e+1 5.94e+2 7.37e+1 4.03e+1 8.84e+1 6.78e+1 8.91e+1 5.60e+2 1.47e+2 7.24e+2 1.47e+2 5.80e+2 1.32e+2 2.60e+2 7.37e+1 7.47e+1 7.37e+1 3.53e+2 7.37e+1 2.42e+2 1.47e+2 2.44e+2 1.47e+2 3.10e+2 7.37e+1 3.83e+2 8.83e+1 3.51e+2 7.37e+1 3.09e+2 7.37e+1 4.37e+2 7.37e+1 4.41e+2 7.37e+1 1.02e+2 7.37e+1 3.49e+2 7.37e+1 5.57e+2 1.48e+2 3.45e+2 1.47e+2 3.47e+2 1.47e+2 3.48e+2 1.47e+2 6.97e+1 7.37e+1 2.15e+2 1.47e+2 5.50e+1 1.46e+2 6.77e+2 1.47e+2 7.65e+2 1.47e+2 7.81e+2 1.47e+2 3.51e+2 1.49e+2 1.01e+2 7.37e+1 5.00e+2 7.37e+1 5.62e+2 1.47e+2 7.72e+2 8.85e+1 7.74e+2 8.81e+1 2.57e+2 7.37e+1 1.87e+2 1.47e+2 1.00e+2 7.37e+1 7.09e+2 1.47e+2 3.48e+2 7.37e+1 6.09e+1 8.85e+1 6.29e+1 8.85e+1 7.37e+1 7.37e+1 5.03e+2 7.37e+1 2.12e+2 1.47e+2 4.52e+1 1.47e+2 4.43e+2 7.37e+1 5.21e+1 1.47e+2 7.70e+2 8.90e+1 5.01e+2 7.37e+1 6.18e+2 7.37e+1 6.20e+2 7.37e+1 6.22e+2 7.37e+1 3.57e+2 7.37e+1 4.22e+2 7.37e+1 4.24e+2 7.37e+1 2.59e+2 7.37e+1 3.63e+1 8.85e+1 7.56e+1 7.37e+1 3.37e+2 8.85e+1 2.82e+2 1.80e+2 7.41e+2 1.48e+2 3.53e+1 1.47e+2 4.03e+2 7.37e+1 2.14e+2 1.47e+2 4.48e+2 7.37e+1 7.68e+2 1.47e+2 7.70e+2 1.47e+2 7.27e+1 7.37e+1 5.70e+1 8.85e+1 5.89e+1 8.85e+1 4.05e+2 7.37e+1 3.80e+2 7.37e+1 2.34e+2 2.95e+1 6.96e+2 1.47e+2 7.86e+1 7.37e+1 3.58e+2 7.37e+1 7.74e+2 1.47e+2 7.76e+2 1.47e+2 4.31e+2 1.47e+2 7.56e+2 1.75e+2 5.55e+2 1.47e+2 2.77e+2 7.37e+1 3.99e+2 7.37e+1 3.05e+2 7.37e+1 4.47e+2 7.37e+1 2.07e+2 7.37e+1 1.89e+2 1.47e+2 1.91e+2 1.47e+2 3.84e+2 8.85e+1 3.86e+2 8.85e+1 3.65e+2 7.37e+1 4.49e+2 7.37e+1 3.25e+2 7.37e+1 7.05e+2 1.47e+2 2.79e+2 7.37e+1 3.14e+2 7.37e+1 2.54e+2 7.37e+1 6.38e+1 7.37e+1 5.02e+2 7.37e+1 4.32e+1 7.37e+1 9.83e+1 7.37e+1 4.12e+2 7.37e+1 4.14e+2 7.37e+1 7.26e+2 1.47e+2 7.28e+2 1.47e+2 4.52e+1 7.37e+1 2.72e+2 7.37e+1 4.09e+2 7.37e+1 7.64e+2 1.47e+2 6.48e+1 8.90e+1 2.70e+2 7.37e+1 4.91e+1 1.47e+2 6.09e+2 7.37e+1 7.66e+1 7.37e+1 7.91e+2 7.37e+1 6.78e+1 7.37e+1 2.53e+2 7.37e+1 5.60e+1 1.99e+2 2.56e+2 1.47e+2 3.47e+2 7.37e+1 5.90e+2 7.37e+1 4.03e+1 1.47e+2 9.53e+1 7.37e+1 3.42e+2 7.37e+1 3.94e+2 7.37e+1 2.37e+2 1.47e+2 7.84e+2 1.47e+2 7.86e+2 1.47e+2 3.24e+2 7.37e+1 4.02e+2 7.37e+1 7.88e+2 1.47e+2 2.56e+2 7.37e+1 7.10e+2 1.48e+2 7.12e+2 1.48e+2 2.68e+2 7.37e+1 2.67e+2 7.37e+1 1.47e+1 1.50e+2 5.98e+2 7.37e+1 2.71e+2 7.37e+1 3.22e+2 7.37e+1 3.75e+2 7.37e+1 3.46e+2 7.37e+1 4.71e+1 1.47e+2 2.11e+2 1.47e+2 3.23e+2 7.37e+1 7.77e+2 1.47e+2 4.62e+1 7.37e+1 7.55e+2 8.85e+1 2.34e+2 1.49e+2 6.00e+2 7.37e+1 2.45e+2 1.47e+2 2.00e+2 7.37e+1 2.02e+2 7.37e+1 5.66e+2 7.37e+1 4.26e+2 7.37e+1 3.84e+2 7.37e+1 1.94e+2 1.47e+2 6.03e+2 7.37e+1 6.05e+2 7.37e+1 3.31e+2 7.37e+1 3.96e+2 7.37e+1 4.15e+2 7.37e+1 3.38e+2 7.37e+1 3.32e+2 7.37e+1 3.73e+1 1.47e+2 3.08e+2 7.37e+1 3.34e+2 7.37e+1 3.30e+2 7.37e+1 3.98e+2 7.37e+1 4.12e+1 7.37e+1 6.58e+1 7.37e+1 3.15e+2 7.37e+1 4.08e+2 7.37e+1 4.27e+2 7.37e+1 2.01e+2 1.32e+2 2.03e+2 1.32e+2 7.95e+2 1.47e+2 2.49e+2 7.37e+1 6.29e+1 7.37e+1 1.33e+2 7.37e+1 1.35e+2 7.37e+1 3.10e+2 1.48e+2 3.78e+2 7.37e+1 2.40e+2 7.37e+1 2.66e+2 7.37e+1 3.88e+2 8.85e+1 3.90e+2 8.85e+1 3.92e+2 8.85e+1 3.64e+2 7.37e+1 2.84e+2 1.77e+2 5.16e+2 7.37e+1 3.83e+2 7.37e+1 2.84e+2 7.37e+1 8.25e+1 7.37e+1 4.92e+2 7.37e+1 5.28e+2 7.37e+1 9.14e+1 7.37e+1 9.33e+1 7.37e+1 3.63e+2 7.37e+1 4.30e+2 1.77e+2 7.96e+2 7.37e+1 7.86e+0 1.47e+2 9.83e+0 1.47e+2 4.96e+2 7.37e+1 2.44e+2 7.37e+1 8.65e+1 7.37e+1 4.50e+2 7.37e+1 7.19e+2 1.47e+2 4.93e+2 7.37e+1 3.40e+2 7.37e+1 4.33e+2 1.47e+2 4.87e+2 8.85e+1 2.55e+2 7.37e+1 5.05e+2 7.37e+1 7.43e+2 1.47e+2 3.36e+2 7.37e+1 1.05e+2 7.37e+1 5.01e+1 1.47e+2 4.03e+1 7.37e+1 3.50e+2 8.85e+1 4.32e+2 7.37e+1 2.41e+2 7.37e+1 2.43e+2 7.37e+1 4.98e+2 1.47e+2 5.04e+2 7.37e+1 1.68e+2 1.48e+2 1.25e+2 7.37e+1 1.27e+2 7.37e+1 6.02e+2 1.77e+2 4.29e+2 7.37e+1 2.89e+2 7.37e+1 2.36e+2 1.47e+2 7.17e+1 1.47e+2 5.27e+2 7.37e+1 3.21e+2 7.37e+1 1.16e+2 7.37e+1 1.18e+2 7.37e+1 3.94e+2 1.77e+2 2.85e+2 1.77e+2 3.60e+2 7.37e+1 3.29e+2 7.37e+1 2.48e+2 7.37e+1 3.41e+2 7.37e+1 4.26e+2 1.47e+2 5.79e+1 1.47e+2 2.21e+2 9.35e+1 3.24e+1 8.90e+1 5.36e+2 1.78e+2 3.17e+2 7.37e+1 5.17e+2 9.35e+1 4.28e+2 1.77e+2 6.03e+2 1.77e+2 2.65e+2 8.90e+1 4.66e+2 7.37e+1 4.22e+1 8.85e+1 4.42e+1 8.83e+1 4.62e+1 8.83e+1 1.13e+2 7.37e+1 1.15e+2 7.37e+1 2.16e+2 7.37e+1 3.75e+2 1.77e+2 5.41e+2 1.77e+2 3.71e+2 7.37e+1 5.14e+2 7.37e+1 9.04e+1 7.37e+1 7.06e+2 1.47e+2 7.08e+2 1.47e+2 3.87e+2 7.37e+1 4.32e+2 1.77e+2 7.31e+2 1.48e+2 1.23e+2 7.37e+1 2.39e+2 1.47e+2 4.72e+2 1.77e+2 1.30e+2 7.37e+1 1.42e+2 1.47e+2 2.86e+2 1.77e+2 1.08e+1 1.75e+2 1.77e+2 1.77e+2 5.07e+2 7.37e+1 1.10e+2 7.37e+1 8.35e+1 8.85e+1 4.28e+2 1.47e+2 7.33e+2 1.47e+2 1.21e+2 7.37e+1 3.60e+2 1.47e+2 3.34e+2 1.47e+2 5.72e+2 7.37e+1 5.19e+2 1.47e+2 5.21e+2 1.47e+2 5.22e+2 1.47e+2 7.37e+1 1.47e+2 7.56e+1 1.47e+2 6.97e+1 1.47e+2 7.36e+2 1.47e+2 3.56e+2 1.77e+2 3.83e+1 7.37e+1 6.04e+2 1.77e+2 2.08e+2 1.77e+2 1.76e+2 1.77e+2 7.66e+2 1.77e+2 5.12e+2 7.37e+1 1.20e+2 1.77e+2 3.97e+2 1.77e+2 6.97e+2 1.77e+2 5.19e+2 7.37e+1 1.37e+1 1.50e+2 5.02e+2 1.47e+2 6.01e+2 1.77e+2 2.94e+1 1.32e+2 5.63e+2 7.37e+1 3.96e+2 8.85e+1 3.98e+2 8.85e+1 6.73e+2 1.78e+2 3.89e+2 7.37e+1 4.19e+2 1.77e+2 5.06e+2 1.77e+2 1.99e+2 1.75e+2 2.77e+2 1.47e+2 8.15e+1 7.37e+1 7.30e+2 1.46e+2 2.89e+2 7.37e+1 2.69e+2 1.77e+2 5.37e+2 1.78e+2 7.67e+2 1.77e+2 5.18e+2 1.75e+2 5.66e+2 8.85e+1 4.81e+1 7.37e+1 1.21e+2 1.77e+2 3.00e+2 7.37e+1 3.98e+2 1.77e+2 6.48e+1 1.48e+2 6.68e+1 1.48e+2 6.88e+1 1.48e+2 4.71e+1 7.37e+1 2.48e+2 8.85e+1 4.75e+2 1.77e+2 3.13e+2 1.77e+2 3.73e+1 7.37e+1 5.88e+2 7.37e+1 4.20e+2 1.77e+2 6.98e+2 1.77e+2 4.75e+2 1.48e+2 4.77e+2 1.49e+2 5.64e+2 7.37e+1 4.74e+2 1.77e+2 5.42e+2 7.37e+1 4.76e+2 1.77e+2 9.53e+1 1.32e+2 2.46e+2 1.47e+2 3.14e+2 1.77e+2 3.11e+2 1.77e+2 4.99e+2 1.77e+2 3.84e+2 1.77e+2 2.87e+2 1.77e+2 3.93e+1 1.77e+2 9.83e+1 1.77e+2 4.26e+2 1.77e+2 2.67e+2 1.77e+2 2.18e+2 1.47e+2 5.39e+2 1.77e+2 4.87e+2 7.37e+1 4.89e+2 7.37e+1 1.22e+2 1.77e+2 2.13e+2 1.77e+2 5.43e+2 1.77e+2 8.84e+1 7.37e+1 4.83e+2 7.37e+1 3.09e+2 1.77e+2 2.72e+2 1.77e+2 1.19e+2 1.77e+2 3.86e+2 1.77e+2 3.03e+2 7.37e+1 2.68e+2 1.77e+2 2.89e+2 1.77e+2 4.64e+2 1.47e+2 4.66e+2 1.47e+2 5.71e+2 7.37e+1 3.85e+2 1.77e+2 3.74e+2 1.77e+2 3.87e+2 1.77e+2 4.01e+2 1.47e+2 4.27e+2 1.77e+2 3.83e+1 1.77e+2 1.96e+2 1.47e+2 3.68e+2 7.37e+1 2.14e+2 1.77e+2 1.23e+2 1.76e+2 2.66e+2 1.77e+2 2.45e+2 7.37e+1 3.82e+2 1.77e+2 2.89e+2 1.77e+2 5.50e+2 7.37e+1 5.90e+2 8.85e+1 4.60e+2 1.77e+2 4.62e+2 1.77e+2 2.18e+2 1.32e+2 5.54e+2 1.77e+2 5.31e+2 1.77e+2 2.19e+2 1.77e+2 4.51e+2 1.77e+2 1.17e+2 1.77e+2 5.53e+2 1.77e+2 4.34e+2 1.77e+2 7.91e+2 1.47e+2 3.63e+1 1.77e+2 3.58e+2 1.77e+2 3.34e+1 1.77e+2 5.08e+2 1.77e+2 2.45e+1 1.32e+2 5.01e+1 1.77e+2 4.03e+1 1.77e+2 7.75e+2 1.77e+2 2.23e+2 1.47e+2 5.00e+2 1.77e+2 4.21e+2 1.77e+2 4.00e+2 1.77e+2 7.94e+2 1.77e+2 7.51e+2 1.77e+2 4.35e+2 1.47e+2 4.37e+2 1.47e+2 6.07e+2 1.77e+2 3.07e+2 1.77e+2 4.39e+2 1.47e+2 7.69e+2 1.77e+2 2.21e+2 7.37e+1 2.23e+2 7.37e+1 5.44e+2 1.77e+2 1.69e+2 1.77e+2 3.52e+2 1.76e+2 7.52e+2 1.77e+2 3.63e+2 1.77e+2 1.67e+2 1.77e+2 5.33e+2 1.77e+2 1.24e+2 1.76e+2 1.68e+2 1.77e+2 4.35e+2 1.77e+2 6.99e+2 1.77e+2 4.12e+1 1.77e+2 2.12e+2 1.77e+2 1.63e+2 1.47e+2 6.21e+2 1.77e+2 4.64e+2 1.77e+2 6.08e+2 1.77e+2 5.55e+2 1.77e+2 2.20e+2 1.77e+2 5.32e+2 1.77e+2 2.88e+2 7.37e+1 5.45e+2 1.77e+2 5.34e+2 1.77e+2 2.15e+2 1.77e+2 4.77e+2 1.77e+2 1.55e+2 1.77e+2 7.88e+2 8.85e+1 3.04e+1 1.77e+2 4.22e+1 1.77e+2 1.53e+2 1.77e+2 6.47e+2 1.77e+2 4.16e+2 1.77e+2 4.25e+2 1.77e+2 1.73e+2 1.77e+2 8.35e+1 7.37e+1 1.51e+2 1.77e+2 1.91e+2 1.77e+2 3.67e+2 7.37e+1 2.55e+1 1.77e+2 4.63e+2 1.77e+2 1.92e+2 1.77e+2 6.22e+2 1.77e+2 4.71e+2 1.77e+2 5.50e+2 1.77e+2 3.54e+2 1.77e+2 2.94e+1 1.77e+2 7.93e+2 1.77e+2 4.23e+2 1.77e+2 3.17e+2 1.47e+2 1.06e+2 1.77e+2 6.19e+2 1.77e+2 3.59e+2 1.77e+2 1.93e+2 1.77e+2 6.74e+2 1.77e+2 9.43e+1 1.77e+2 2.95e+2 1.77e+2 7.58e+2 1.77e+2 5.35e+2 1.77e+2 7.49e+2 1.51e+2 7.51e+2 1.52e+2 4.32e+1 1.77e+2 4.96e+2 1.47e+2 1.17e+1 1.77e+2 3.00e+2 1.77e+2 3.89e+2 1.77e+2 4.42e+1 1.77e+2 2.99e+2 1.77e+2 3.47e+2 1.77e+2 2.16e+2 1.77e+2 1.05e+2 1.77e+2 5.14e+2 1.77e+2 4.18e+2 1.77e+2 2.92e+2 1.77e+2 3.90e+2 1.77e+2 3.61e+2 1.77e+2 3.56e+2 1.46e+2 7.78e+2 1.77e+2 1.56e+2 1.77e+2 6.51e+2 1.77e+2 8.84e+0 1.77e+2 2.25e+2 1.47e+2 6.42e+2 1.77e+2 2.97e+2 1.77e+2 6.09e+2 1.77e+2 1.26e+2 1.77e+2 5.97e+2 1.77e+2 2.92e+2 7.37e+1 1.57e+2 1.77e+2 1.74e+2 1.77e+2 4.95e+2 1.77e+2 5.15e+2 1.77e+2 7.37e+2 1.47e+2 4.71e+1 1.77e+2 7.00e+2 1.77e+2 5.85e+2 7.37e+1 3.67e+2 1.77e+2 1.61e+2 1.77e+2 4.17e+2 1.77e+2 4.78e+2 1.77e+2 4.50e+2 1.77e+2 5.01e+1 7.37e+1 1.82e+2 1.77e+2 5.11e+1 7.37e+1 4.84e+2 1.77e+2 6.68e+2 1.77e+2 1.25e+2 1.77e+2 4.53e+2 1.77e+2 7.91e+2 1.77e+2 1.27e+1 1.77e+2 3.93e+2 1.77e+2 3.14e+1 1.77e+2 4.03e+2 1.77e+2 5.30e+2 1.77e+2 4.05e+2 1.77e+2 6.24e+2 1.77e+2 4.56e+2 1.77e+2 2.55e+1 7.37e+1 4.65e+2 1.77e+2 5.68e+2 7.37e+1 9.43e+1 1.32e+2 6.25e+2 1.77e+2 2.36e+2 1.47e+2 1.28e+2 1.77e+2 1.11e+2 7.37e+1 5.82e+2 7.37e+1 5.61e+2 1.77e+2 7.32e+2 1.76e+2 6.43e+2 1.77e+2 2.33e+2 1.77e+2 4.62e+2 1.47e+2 4.68e+2 1.77e+2 1.15e+2 1.77e+2 1.00e+2 1.77e+2 5.56e+2 1.77e+2 4.81e+1 1.92e+2 3.19e+2 1.77e+2 4.79e+2 1.47e+2 3.47e+2 1.77e+2 4.67e+2 1.77e+2 1.58e+2 1.77e+2 2.26e+1 1.32e+2 7.04e+2 1.77e+2 4.11e+2 1.77e+2 5.99e+2 1.77e+2 7.39e+2 1.47e+2 5.30e+1 7.37e+1 1.15e+2 1.77e+2 5.13e+2 1.77e+2 3.52e+2 8.85e+1 4.49e+2 1.77e+2 2.96e+2 1.77e+2 4.66e+2 1.77e+2 5.79e+1 7.37e+1 3.11e+2 1.47e+2 3.13e+2 1.47e+2 1.14e+2 1.77e+2 4.38e+2 1.77e+2 7.37e+2 1.77e+2 1.10e+2 1.77e+2 1.27e+2 1.77e+2 6.39e+2 1.77e+2 6.52e+2 1.77e+2 4.14e+2 1.47e+2 7.01e+2 1.77e+2 3.93e+0 1.77e+2 1.09e+2 1.77e+2 5.21e+1 1.77e+2 1.04e+2 1.77e+2 2.23e+2 1.77e+2 3.34e+1 7.37e+1 2.47e+2 1.47e+2 1.97e+2 1.77e+2 4.81e+2 1.77e+2 4.63e+2 7.37e+1 1.67e+2 1.75e+2 7.77e+2 1.77e+2 2.78e+2 1.76e+2 4.45e+2 1.77e+2 2.59e+2 1.77e+2 7.06e+2 1.77e+2 3.71e+2 1.77e+2 7.35e+2 1.77e+2 2.34e+2 8.85e+1 2.36e+2 8.85e+1 1.35e+2 1.77e+2 4.48e+2 1.77e+2 5.76e+2 7.37e+1 3.04e+2 1.77e+2 7.12e+2 1.77e+2 7.27e+1 1.32e+2 5.03e+2 1.47e+2 4.39e+2 1.77e+2 4.63e+2 1.47e+2 7.56e+2 1.77e+2 1.39e+2 1.77e+2 6.48e+2 1.77e+2 3.72e+2 1.77e+2 7.86e+2 1.77e+2 3.93e+1 1.32e+2 1.13e+2 1.77e+2 3.59e+2 1.47e+2 7.76e+2 1.77e+2 6.67e+2 1.77e+2 1.57e+1 1.77e+2 7.31e+2 1.76e+2 1.36e+2 1.77e+2 7.15e+2 1.77e+2 4.44e+2 1.47e+2 4.46e+2 1.47e+2 4.48e+2 1.47e+2 2.69e+2 1.47e+2 7.34e+2 1.47e+2 6.09e+1 1.77e+2 1.08e+2 1.77e+2 2.00e+2 1.77e+2 1.40e+2 1.77e+2 2.71e+2 1.47e+2 2.09e+2 1.50e+2 5.28e+2 1.77e+2 2.56e+2 1.77e+2 4.37e+2 1.77e+2 7.34e+2 1.76e+2 1.34e+2 1.77e+2 1.37e+2 1.47e+2 1.42e+2 1.77e+2 1.67e+1 1.77e+2 4.70e+2 1.77e+2 5.57e+2 1.77e+2 2.35e+1 1.32e+2 7.14e+2 1.77e+2 2.47e+2 1.77e+2 2.20e+2 1.47e+2 5.41e+2 7.37e+1 7.86e+1 1.77e+2 6.70e+2 1.77e+2 6.79e+2 1.77e+2 5.77e+2 7.37e+1 6.50e+2 1.77e+2 1.33e+2 1.77e+2 2.55e+2 1.48e+2 7.83e+2 1.77e+2 4.58e+2 7.37e+1 6.26e+2 1.77e+2 6.80e+2 1.77e+2 6.27e+2 1.77e+2 7.96e+1 1.77e+2 6.83e+2 1.77e+2 5.65e+2 1.77e+2 7.79e+2 1.77e+2 3.15e+2 1.47e+2 2.52e+2 1.77e+2 6.28e+2 1.77e+2 7.16e+2 1.76e+2 3.11e+2 1.16e+2 7.47e+1 1.32e+2 1.88e+2 1.77e+2 2.95e+2 7.37e+1 1.32e+2 1.77e+2 1.37e+2 1.77e+2 7.07e+2 1.77e+2 7.26e+2 1.77e+2 6.11e+2 1.77e+2 6.58e+2 1.76e+2 6.38e+1 1.77e+2 2.48e+2 1.77e+2 7.50e+2 1.77e+2 2.36e+2 1.77e+2 2.37e+2 1.77e+2 2.43e+2 1.77e+2 2.49e+2 1.77e+2 2.32e+2 1.77e+2 7.80e+2 1.77e+2 6.82e+2 1.77e+2 8.06e+1 1.77e+2 7.81e+2 1.77e+2 4.79e+2 1.77e+2 4.55e+2 1.47e+2 6.88e+0 1.77e+2 1.76e+1 1.77e+2 3.02e+2 1.77e+2 4.87e+2 1.77e+2 3.63e+1 1.32e+2 3.83e+1 1.32e+2 5.26e+2 1.77e+2 4.88e+2 1.77e+2 2.02e+2 1.77e+2 5.26e+2 1.47e+2 1.12e+2 1.77e+2 5.80e+2 1.77e+2 5.66e+2 1.77e+2 2.46e+2 1.77e+2 2.80e+2 1.77e+2 7.19e+2 1.77e+2 7.17e+1 1.77e+2 2.78e+2 1.47e+2 1.76e+1 1.47e+2 4.80e+2 1.77e+2 5.74e+2 7.37e+1 2.55e+2 1.77e+2 6.56e+2 1.76e+2 1.86e+1 1.77e+2 6.65e+2 1.77e+2 2.26e+2 1.47e+2 2.31e+2 1.77e+2 6.38e+2 1.77e+2 5.25e+2 1.77e+2 5.60e+1 1.77e+2 4.52e+2 7.37e+1 4.54e+2 7.37e+1 1.86e+1 1.33e+2 5.89e+1 1.75e+2 6.09e+1 1.75e+2 5.89e+2 1.77e+2 2.01e+2 1.77e+2 2.03e+2 1.77e+2 3.20e+2 1.77e+2 8.35e+1 1.77e+2 5.20e+2 1.77e+2 2.45e+1 1.77e+2 4.13e+2 1.77e+2 2.42e+2 1.77e+2 6.84e+2 1.77e+2 4.67e+2 7.37e+1 6.77e+2 1.77e+2 6.09e+1 7.37e+1 2.41e+2 1.77e+2 2.50e+2 1.77e+2 5.63e+2 1.77e+2 7.07e+1 1.77e+2 7.11e+2 1.77e+2 6.48e+1 1.77e+2 5.70e+1 7.37e+1 3.28e+2 1.77e+2 4.91e+1 8.85e+1 6.36e+2 1.77e+2 7.29e+2 1.76e+2 6.15e+2 1.77e+2 3.29e+2 1.77e+2 7.85e+2 1.77e+2 9.83e+1 1.32e+2 1.65e+2 1.47e+2 5.52e+2 1.47e+2 5.54e+2 1.47e+2 3.50e+2 1.77e+2 4.68e+2 1.47e+2 5.79e+2 1.77e+2 5.48e+2 1.77e+2 4.08e+2 1.77e+2 6.68e+1 1.77e+2 1.96e+1 1.77e+2 5.30e+1 1.77e+2 6.78e+2 1.77e+2 2.26e+1 1.77e+2 1.43e+2 1.77e+2 5.67e+2 1.77e+2 5.47e+2 1.77e+2 7.28e+2 1.77e+2 2.50e+2 1.47e+2 1.82e+2 1.47e+2 1.84e+2 1.47e+2 7.96e+2 1.77e+2 2.16e+1 1.77e+2 3.62e+2 1.47e+2 4.40e+2 1.77e+2 4.67e+2 1.47e+2 6.63e+2 1.77e+2 3.23e+2 1.77e+2 4.90e+2 8.85e+1 2.04e+2 1.77e+2 8.45e+1 1.77e+2 4.53e+2 1.47e+2 6.88e+2 1.77e+2 6.85e+2 1.77e+2 5.37e+2 1.77e+2 5.39e+2 1.77e+2 3.42e+2 1.77e+2 6.88e+1 1.77e+2 6.86e+2 1.77e+2 2.05e+2 1.77e+2 3.46e+2 1.32e+2 5.40e+1 1.76e+2 4.90e+2 1.77e+2 8.55e+1 1.77e+2 2.44e+2 1.32e+2 7.17e+2 1.77e+2 2.70e+2 8.85e+1 2.72e+2 8.85e+1 2.08e+2 1.76e+2 2.60e+2 1.47e+2 2.38e+2 8.85e+1 2.40e+2 8.85e+1 1.41e+2 1.47e+2 6.12e+2 1.77e+2 8.65e+1 1.77e+2 3.01e+2 1.48e+2 7.20e+2 1.77e+2 5.27e+2 1.47e+2 3.30e+2 1.77e+2 5.82e+2 1.76e+2 7.18e+2 1.77e+2 6.14e+2 1.77e+2 4.22e+1 1.32e+2 2.29e+2 7.37e+1 8.94e+1 1.32e+2 4.44e+2 1.77e+2 2.16e+1 1.32e+2 4.62e+2 7.37e+1 1.00e+2 1.32e+2 2.35e+1 1.75e+2 2.55e+1 1.75e+2 2.45e+1 7.37e+1 4.04e+2 1.47e+2 5.84e+2 1.76e+2 3.27e+2 8.91e+1 3.38e+2 1.77e+2 4.49e+2 1.47e+2 5.37e+2 8.85e+1 2.51e+2 1.47e+2 6.92e+2 1.77e+2 5.45e+2 7.37e+1 9.14e+1 1.32e+2 3.21e+2 1.77e+2 4.61e+2 7.37e+1 7.43e+2 1.77e+2 5.15e+2 1.47e+2 6.35e+2 1.77e+2 2.92e+2 1.32e+2 5.87e+2 1.77e+2 5.22e+2 1.77e+2 6.19e+1 1.47e+2 3.53e+1 8.90e+1 7.25e+2 1.77e+2 1.10e+2 1.48e+2 3.44e+2 1.77e+2 5.11e+1 1.33e+2 2.14e+2 1.32e+2 3.25e+2 1.77e+2 2.06e+1 1.32e+2 3.27e+2 1.77e+2 4.62e+2 8.85e+1 5.42e+2 1.32e+2 7.45e+2 1.77e+2 3.18e+2 1.48e+2 3.20e+2 1.48e+2 2.93e+2 7.37e+1 4.11e+2 1.47e+2 4.13e+2 1.47e+2 6.89e+2 1.77e+2 5.84e+2 7.37e+1 3.41e+2 1.47e+2 7.46e+2 1.77e+2 5.75e+2 1.77e+2 1.32e+2 1.47e+2 1.49e+2 1.47e+2 3.81e+2 1.48e+2 8.45e+1 1.32e+2 8.65e+1 1.32e+2 5.86e+2 1.76e+2 1.98e+2 1.46e+2 5.99e+1 1.47e+2 3.35e+2 1.77e+2 5.31e+2 1.47e+2 2.90e+2 1.32e+2 3.31e+2 1.77e+2 1.96e+1 1.47e+2 4.03e+1 1.32e+2 3.46e+2 1.77e+2 5.69e+2 1.77e+2 5.23e+2 7.37e+1 4.82e+2 7.37e+1 2.00e+2 1.47e+2 7.24e+2 1.77e+2 2.75e+2 1.47e+2 1.52e+2 1.47e+2 2.51e+2 8.91e+1 5.70e+2 1.77e+2 3.32e+2 1.77e+2 3.85e+2 1.47e+2 3.22e+2 1.47e+2 4.05e+2 1.47e+2 5.51e+2 1.47e+2 4.57e+2 7.37e+1 7.17e+1 1.16e+2 5.73e+2 1.77e+2 5.44e+2 7.37e+1 3.36e+2 1.77e+2 5.11e+2 7.37e+1 5.01e+1 1.32e+2 1.93e+2 7.37e+1 3.92e+2 1.47e+2 2.79e+2 1.46e+2 3.21e+2 1.17e+2 3.23e+2 1.17e+2 1.01e+2 1.47e+2 1.03e+2 1.47e+2 5.52e+2 7.37e+1 2.65e+2 1.47e+2 2.83e+2 1.47e+2 5.34e+2 1.47e+2 5.77e+2 1.77e+2 9.33e+1 1.48e+2 2.94e+2 1.47e+2 5.74e+2 1.77e+2 3.57e+2 1.32e+2 2.45e+2 1.32e+2 1.05e+2 1.47e+2 1.07e+2 1.47e+2 5.50e+2 1.47e+2 6.00e+2 8.85e+1 1.46e+2 1.47e+2 1.71e+2 1.47e+2 4.52e+2 1.47e+2 6.32e+2 1.47e+2 6.34e+2 1.47e+2 4.80e+2 1.47e+2 2.25e+2 1.32e+2 2.54e+2 1.32e+2 2.85e+2 1.48e+2 5.60e+2 7.37e+1 4.17e+2 1.47e+2 3.47e+2 1.32e+2 1.76e+2 1.77e+2 5.22e+2 7.37e+1 4.60e+2 7.37e+1 5.33e+2 1.47e+2 3.14e+1 1.47e+2 2.49e+2 1.47e+2 3.24e+2 1.47e+2 8.15e+1 1.32e+2 4.51e+2 1.47e+2 2.89e+2 1.47e+2 1.88e+2 1.18e+2 5.62e+2 7.37e+1 3.23e+2 1.47e+2 1.76e+2 1.47e+2 3.04e+1 7.37e+1 5.05e+2 1.46e+2 3.43e+2 1.47e+2 2.09e+2 1.18e+2 9.43e+1 1.47e+2 1.83e+2 1.18e+2 1.30e+2 1.47e+2 4.57e+2 1.47e+2 4.59e+2 1.47e+2 2.72e+2 1.47e+2 2.74e+2 1.47e+2 5.61e+2 7.37e+1 1.38e+2 1.47e+2 1.40e+2 1.47e+2 1.62e+2 1.47e+2 1.29e+2 1.47e+2 6.48e+1 1.32e+2 6.17e+2 1.47e+2 1.47e+1 1.32e+2 2.11e+2 1.18e+2 3.63e+1 1.91e+2 1.61e+2 1.47e+2 4.81e+1 1.32e+2 2.97e+2 1.32e+2 2.12e+2 1.18e+2 8.94e+1 1.18e+2 2.21e+2 1.18e+2 3.17e+2 1.16e+2 3.19e+2 1.16e+2 1.96e+1 1.75e+2 1.71e+2 1.32e+2 2.61e+2 1.48e+2 2.82e+2 1.18e+2 2.01e+2 1.47e+2 3.34e+1 1.32e+2 2.37e+2 1.32e+2 2.89e+2 1.32e+2 1.36e+2 1.47e+2 4.70e+2 1.47e+2 4.72e+2 1.47e+2 5.23e+2 1.47e+2 2.22e+2 1.18e+2 7.86e+2 1.18e+2 2.80e+2 1.47e+2 2.32e+2 8.85e+1 2.36e+2 1.32e+2 3.06e+2 1.32e+2 1.90e+2 1.18e+2 4.21e+2 1.18e+2 4.71e+1 1.32e+2 2.79e+2 1.18e+2 3.27e+2 1.47e+2 1.14e+2 1.18e+2 4.12e+1 1.75e+2 1.37e+1 1.32e+2 6.58e+1 1.32e+2 1.69e+2 1.18e+2 4.22e+2 1.18e+2 2.84e+2 1.18e+2 7.88e+2 1.18e+2 1.70e+2 1.18e+2 5.36e+2 7.37e+1 2.79e+2 8.85e+1 2.20e+2 1.18e+2 1.71e+2 1.18e+2 2.31e+2 8.85e+1 3.29e+2 1.47e+2 3.31e+2 1.47e+2 1.68e+2 1.18e+2 7.48e+2 1.47e+2 2.95e+2 1.47e+2 4.72e+2 1.18e+2 1.33e+2 1.47e+2 2.86e+2 1.32e+2 6.17e+2 1.18e+2 9.53e+1 1.47e+2 4.32e+1 1.32e+2 2.88e+2 1.18e+2 4.20e+2 1.18e+2 6.99e+2 1.18e+2 6.26e+2 1.18e+2 6.03e+2 1.47e+2 2.33e+2 1.32e+2 2.89e+2 1.32e+2 7.79e+2 1.18e+2 1.74e+2 1.47e+2 6.09e+1 1.18e+2 2.87e+2 1.18e+2 7.16e+2 1.47e+2 1.73e+2 1.47e+2 1.15e+2 1.18e+2 6.16e+2 1.18e+2 5.79e+1 1.32e+2 2.15e+2 1.18e+2 1.64e+2 1.18e+2 7.00e+2 1.18e+2 6.27e+2 1.18e+2 8.45e+1 1.18e+2 2.82e+2 1.77e+2 2.84e+2 1.78e+2 2.33e+2 1.47e+2 1.91e+2 1.18e+2 7.07e+2 1.18e+2 2.26e+1 1.47e+2 2.17e+2 1.18e+2 2.07e+2 1.18e+2 1.14e+2 1.47e+2 7.85e+2 1.18e+2 1.17e+2 1.18e+2 6.22e+2 1.47e+2 8.84e+1 1.18e+2 8.55e+1 1.18e+2 5.11e+2 1.18e+2 7.96e+1 1.32e+2 2.16e+2 1.18e+2 7.74e+2 1.18e+2 2.24e+2 1.18e+2 5.17e+2 1.18e+2 2.75e+2 1.18e+2 7.17e+1 1.32e+2 2.96e+2 1.47e+2 2.98e+2 1.47e+2 6.77e+2 1.18e+2 6.19e+1 1.18e+2 1.65e+2 8.85e+1 7.84e+2 1.18e+2 4.42e+1 1.32e+2 2.35e+1 7.37e+1 1.72e+2 1.18e+2 8.35e+1 1.32e+2 7.27e+2 1.18e+2 2.12e+2 1.32e+2 3.93e+2 1.47e+2 3.95e+2 1.47e+2 3.97e+2 1.47e+2 5.99e+1 1.18e+2 5.06e+2 1.47e+2 6.80e+2 1.18e+2 7.06e+2 1.18e+2 7.10e+2 1.18e+2 7.92e+2 1.18e+2 2.19e+2 1.18e+2 5.14e+2 1.47e+2 3.75e+2 1.18e+2 4.19e+2 1.18e+2 5.18e+2 1.18e+2 8.65e+1 1.18e+2 1.81e+2 1.18e+2 4.41e+2 1.47e+2 2.66e+2 1.18e+2 9.43e+1 1.18e+2 6.30e+2 1.18e+2 6.79e+2 1.18e+2 5.32e+2 7.37e+1 7.32e+2 1.18e+2 3.39e+2 1.47e+2 2.28e+2 1.47e+2 2.74e+2 1.18e+2 5.09e+2 1.18e+2 2.92e+2 1.18e+2 1.10e+2 1.18e+2 4.47e+2 1.18e+2 2.49e+2 1.16e+2 3.84e+2 1.47e+2 8.25e+1 1.32e+2 1.46e+2 1.18e+2 6.29e+2 1.18e+2 5.15e+2 1.18e+2 6.22e+2 1.18e+2 1.66e+2 1.18e+2 3.47e+2 1.18e+2 4.63e+2 1.18e+2 6.97e+2 1.18e+2 5.43e+2 1.18e+2 9.63e+1 1.18e+2 1.47e+2 1.18e+2 1.76e+2 1.18e+2 7.31e+2 1.17e+2 5.79e+2 8.85e+1 3.77e+2 1.18e+2 1.36e+2 1.18e+2 5.81e+2 1.18e+2 2.43e+2 1.32e+2 6.24e+2 1.18e+2 5.95e+2 1.18e+2 6.23e+2 1.18e+2 4.48e+2 1.18e+2 6.69e+2 1.18e+2 4.11e+2 1.18e+2 2.18e+2 1.18e+2 6.68e+2 1.18e+2 7.16e+2 1.18e+2 2.90e+2 1.18e+2 5.42e+2 1.18e+2 2.26e+2 1.18e+2 5.94e+2 1.18e+2 6.19e+2 1.47e+2 5.96e+2 1.18e+2 4.36e+2 1.18e+2 1.50e+2 1.18e+2 7.69e+2 1.18e+2 3.55e+2 1.18e+2 5.08e+2 1.18e+2 2.68e+2 1.32e+2 6.21e+2 1.18e+2 2.26e+1 1.62e+2 4.37e+2 1.18e+2 5.16e+2 8.85e+1 5.00e+2 8.85e+1 5.93e+2 1.18e+2 4.10e+2 1.18e+2 3.53e+2 1.18e+2 1.09e+2 1.18e+2 5.07e+2 1.18e+2 6.66e+2 1.18e+2 7.28e+2 1.18e+2 5.06e+2 1.18e+2 4.69e+2 1.18e+2 4.71e+2 1.18e+2 1.21e+2 1.18e+2 5.97e+2 1.18e+2 3.03e+2 1.32e+2 7.20e+2 1.18e+2 3.61e+2 1.32e+2 3.63e+2 1.32e+2 4.35e+2 1.18e+2 7.35e+2 1.18e+2 5.21e+2 1.18e+2 8.15e+1 1.18e+2 6.73e+2 1.18e+2 3.83e+2 1.47e+2 5.46e+2 1.18e+2 5.79e+2 1.18e+2 5.32e+2 1.18e+2 2.52e+2 1.18e+2 4.64e+2 1.18e+2 5.44e+2 1.18e+2 4.49e+2 1.18e+2 4.51e+2 1.18e+2 3.14e+2 1.18e+2 7.15e+2 1.18e+2 6.14e+2 1.18e+2 6.67e+2 1.18e+2 6.59e+2 1.18e+2 1.73e+2 1.18e+2 2.64e+2 1.18e+2 6.00e+2 1.18e+2 1.53e+2 1.18e+2 3.24e+1 1.32e+2 5.82e+2 1.18e+2 3.44e+2 1.18e+2 3.15e+2 1.32e+2 1.51e+2 1.18e+2 1.39e+2 1.18e+2 6.76e+2 1.18e+2 1.30e+2 1.18e+2 3.99e+2 1.18e+2 4.75e+2 7.37e+1 2.49e+2 1.18e+2 3.13e+2 1.18e+2 5.05e+2 1.18e+2 5.98e+2 1.18e+2 3.85e+2 1.18e+2 7.34e+2 1.18e+2 6.31e+2 1.18e+2 7.25e+2 1.18e+2 4.70e+2 1.18e+2 3.84e+2 1.18e+2 1.62e+2 1.18e+2 7.19e+2 1.18e+2 6.28e+2 1.47e+2 4.98e+2 1.18e+2 6.04e+2 1.48e+2 6.58e+2 1.18e+2 1.23e+2 1.18e+2 3.83e+2 1.18e+2 4.88e+2 1.47e+2 2.04e+2 1.18e+2 3.18e+2 1.18e+2 7.95e+2 1.18e+2 6.32e+2 1.18e+2 1.41e+2 1.18e+2 2.91e+2 1.47e+2 6.03e+2 1.18e+2 5.90e+2 1.18e+2 2.34e+2 1.18e+2 2.45e+2 1.18e+2 3.32e+2 1.47e+2 7.13e+2 1.18e+2 7.71e+2 1.18e+2 3.11e+2 1.32e+2 5.85e+2 1.18e+2 4.67e+2 1.18e+2 2.47e+2 1.18e+2 7.67e+2 1.18e+2 4.72e+2 7.37e+1 3.45e+2 1.18e+2 6.63e+2 1.18e+2 4.18e+2 1.47e+2 4.20e+2 1.47e+2 1.07e+2 1.18e+2 3.04e+2 1.32e+2 1.05e+2 1.32e+2 5.61e+2 1.18e+2 7.68e+2 1.18e+2 2.87e+2 1.32e+2 3.74e+2 1.18e+2 4.50e+2 1.18e+2 1.26e+2 1.18e+2 5.60e+2 1.18e+2 7.47e+1 1.18e+2 3.42e+2 1.18e+2 6.72e+2 1.18e+2 5.52e+2 1.18e+2 2.06e+2 1.18e+2 5.37e+2 1.18e+2 4.66e+2 1.18e+2 2.59e+2 1.18e+2 7.37e+1 1.18e+2 1.25e+2 1.18e+2 2.99e+2 1.18e+2 6.71e+2 1.18e+2 5.44e+2 1.47e+2 7.62e+2 1.47e+2 4.38e+2 1.18e+2 5.32e+2 1.47e+2 5.91e+2 1.18e+2 1.61e+2 1.18e+2 2.53e+2 1.18e+2 1.06e+2 1.18e+2 5.99e+2 1.18e+2 3.70e+2 1.18e+2 6.19e+1 1.32e+2 1.24e+2 1.18e+2 5.35e+2 7.37e+1 6.96e+2 1.18e+2 2.56e+2 1.18e+2 3.68e+2 1.18e+2 3.96e+2 1.18e+2 7.37e+2 1.18e+2 3.53e+2 1.32e+2 5.90e+2 1.77e+2 2.05e+2 1.18e+2 2.62e+2 1.18e+2 2.27e+2 1.18e+2 2.28e+2 1.18e+2 7.38e+2 1.18e+2 2.81e+2 1.75e+2 5.29e+2 1.18e+2 3.51e+2 1.18e+2 6.05e+2 1.18e+2 6.38e+1 1.18e+2 5.70e+2 1.18e+2 5.23e+2 1.18e+2 1.28e+2 1.18e+2 3.16e+2 1.18e+2 7.65e+2 1.18e+2 1.54e+2 1.18e+2 2.02e+2 1.18e+2 5.34e+2 1.18e+2 3.79e+2 1.18e+2 1.00e+2 1.18e+2 3.80e+2 1.18e+2 4.33e+2 1.18e+2 5.50e+1 8.85e+1 3.08e+2 1.18e+2 2.33e+2 1.18e+2 4.61e+2 1.18e+2 4.43e+2 1.18e+2 5.24e+2 1.18e+2 9.53e+1 1.75e+2 1.79e+2 1.47e+2 1.81e+2 1.47e+2 1.06e+2 8.85e+1 4.25e+2 1.18e+2 3.00e+2 1.18e+2 6.09e+1 1.32e+2 5.10e+2 1.47e+2 1.56e+2 1.18e+2 3.25e+2 1.18e+2 3.50e+2 1.18e+2 5.63e+2 1.18e+2 2.55e+1 1.62e+2 7.56e+1 1.18e+2 3.52e+2 1.18e+2 5.25e+2 1.47e+2 7.24e+2 1.18e+2 2.55e+2 1.18e+2 3.27e+2 1.18e+2 3.22e+2 1.18e+2 1.55e+2 1.18e+2 1.06e+2 1.32e+2 6.06e+2 1.18e+2 9.83e+1 1.18e+2 3.01e+2 1.18e+2 6.15e+2 1.47e+2 5.22e+2 1.18e+2 7.63e+2 1.18e+2 6.44e+2 1.47e+2 6.46e+2 1.47e+2 6.48e+2 1.47e+2 1.94e+2 1.18e+2 3.86e+2 1.18e+2 4.94e+2 1.47e+2 7.22e+2 1.18e+2 3.94e+2 1.18e+2 7.46e+2 1.18e+2 4.28e+2 1.18e+2 4.17e+2 1.18e+2 4.32e+2 1.18e+2 5.11e+2 1.47e+2 7.52e+2 1.18e+2 5.66e+2 1.18e+2 1.32e+2 1.18e+2 1.58e+2 1.18e+2 2.07e+2 1.47e+2 1.33e+2 1.18e+2 5.53e+2 1.18e+2 1.78e+2 1.18e+2 3.44e+1 1.32e+2 3.52e+2 1.32e+2 6.95e+2 1.18e+2 6.55e+2 1.18e+2 3.67e+2 1.18e+2 2.54e+2 1.18e+2 7.62e+2 1.18e+2 3.07e+2 1.18e+2 3.32e+2 1.18e+2 1.57e+2 1.18e+2 3.54e+2 1.32e+2 1.02e+2 1.18e+2 xiterm+thai-1.10/test/graphics/Makefile.in0000644000175000017500000000200611375434146017200 0ustar thepthep# test/graphics/Makefile.in -*- Makefile -*- @MCOMMON@ basedir = $(srcdir)/../.. thisdir = src/graphics first_rule: qplot dummy: SRCS = grxlib.c qplot.c OBJS = grxlib.o qplot.o HDRS = grxlib.h # # Distribution variables # DIST = $(HDRS) $(SRCS) README data Makefile.in # inference rules .c.o: $(CC) -c $(CPPFLAGS) -I.. $(DEFS) $(CFLAGS) $< #------------------------------------------------------------------------- all: graphics: qplot qplot: $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) -lm tags: $(SRCS) ctags $(SRCS) alldoc: allbin: qplot clean: $(RMF) qplot core a.out *.o *.bak *~ realclean: clean $(RMF) tags distclean: (cd $(srcdir); $(RMF) qplot *~ *.o core a.out) if test $(srcdir) = .; then $(MAKE) realclean; fi (cd $(srcdir); $(RMF) Makefile) install uninstall: distdirs: mkdir $(basedir)/../$(VERNAME)/$(thisdir) distcopy: $(CP) $(DIST) $(basedir)/../$(VERNAME)/$(thisdir) # ----------------------------------------------------------------------- # forget dependencies, there are too few xiterm+thai-1.10/test/graphics/README0000644000175000017500000000014711375434146016017 0ustar thepthepThis is an example of rxvt graphics. To include this, add : #define RXVT_GRAPHICS in src/features.h xiterm+thai-1.10/config.h.in0000644000175000017500000000764111701207343014377 0ustar thepthep/* config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if you have the `atexit' function. */ #undef HAVE_ATEXIT /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have libXpm available. */ #undef HAVE_LIBXPM /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `seteuid' function. */ #undef HAVE_SETEUID /* Define to 1 if you have the `setutent' function. */ #undef HAVE_SETUTENT /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_BYTEORDER_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKIO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `unsetenv' function. */ #undef HAVE_UNSETENV /* Define to 1 if you have the header file. */ #undef HAVE_UTMPX_H /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if doesn't define. */ #undef gid_t /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `int' if does not define. */ #undef mode_t /* Define to `int' if does not define. */ #undef pid_t /* Define to `int' if doesn't define. */ #undef uid_t xiterm+thai-1.10/README0000644000175000017500000000277511375434151013245 0ustar thepthep-------------------------------------------------------------------------- Using GNU autoconfig -------------------------------------------------------------------------- 1. ./configure to generate config.h and the various Makefiles. Note this is the first attempt at GNU autoconfig, so minor hand-editing of Makefiles may be needed. 2. set the main preferences: Edit "src/feature.h" and (optionally) the default compile-time values: Edit "src/defaults.h" 3. Build it (repeat step 2 as desired): make 4. Install xiterm: make install you may also want to install etc/terminfo etc/termcap 5. If compiled with UTMP_SUPPORT, you'll have to install xiterm setuid root or setuid/setgid to match the file permissions on /etc/utmp NB: SunOS (with/without gcc?) gets reported by configure as #undef STDC_HEADERS #define HAVE_SYS_IOCTL_H 1 but the ioctl() defines aren't protected against multiple inclusion, in this case by so use a hack in "feature.h" to avoid the problem. Gave up checking for `STDC_HEADERS', since they really should be there and I don't want to deal with the problems when they don't exist. SunOS users might complain to the right places and get their system headers fixed so that one day the rest of us won't have to keep compensating :( SVR4 users (that aren't using gcc) will have to add -DSVR4 to CPPFLAGS for configure. -- EOF xiterm+thai-1.10/configure.in0000644000175000017500000000531711701207241014660 0ustar thepthepdnl# -*- sh -*- dnl# Process this file with autoconf to produce a configure script. dnl# AC_INIT(src/feature.h) DATE="5 January 2012" LSMDATE=05JAN12 VERSION=1.10 VERNAME=xiterm+thai-${VERSION} MAINT="Theppitak Karoonboonyanan " AC_SUBST(DATE) AC_SUBST(LSMDATE) AC_SUBST(VERSION) AC_SUBST(VERNAME) AC_SUBST(MAINT) dnl# dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure' dnl# if test -z "${CFLAGS}"; then if test -z "${CCOPTS}"; then CCOPTS='-Wall -O3 -fno-strength-reduce' if test "x$GCC" = xyes; then if test x$system = xLinux; then CCOPTS='-Wall -O3 -fno-strength-reduce' fi fi fi CFLAGS="$CCOPTS" fi dnl# Checks for programs. dnl AC_MAKE_SET AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PATH_PROG(RM, rm, rm) AC_PATH_PROG(CP, cp, cp) dnl# system hacks AC_AIX AC_ISC_POSIX AC_GNU_SOURCE dnl# need a neat way to detect SVR4 or its features dnl# in src/command.c we use these functions: dnl# grantpt(), unlockpt(), ptsname(), which are defined in dnl# - but are these also defined for other systems? dnl# hack to find if this is SVR4 -- who knows? dnl## AC_MSG_CHECKING(for SVR4) dnl## AC_EGREP_CPP(yes, dnl## [#if defined (SVR4) || defined (_SVR4) || defined (__svr4__) dnl## yes; dnl## #endif dnl## ], [AC_MSG_RESULT(yes); AC_DEFINE(PERHAPS_SVR4)], AC_MSG_RESULT(perhaps not?)) AC_C_CONST AC_C_INLINE PKG_CHECK_MODULES(X,x11) AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, AC_DEFINE(HAVE_LIBXPM,1,[Define to 1 if you have libXpm available.]) X_LIBS="-lXpm $X_LIBS", , -lX11) dnl# Checks for header files. AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h termios.h \ sys/ioctl.h sys/select.h sys/time.h \ sys/sockio.h sys/byteorder.h \ utmpx.h unistd.h) AC_HEADER_TIME dnl# "stdlib.h", "stdarg.h", "string.h", "float.h" dnl# skip this test, Sun always fails anyhow. dnl> AC_HEADER_STDC dnl# Missing typedefs and replacements AC_TYPE_MODE_T dnl> AC_CHECK_TYPE(umode_t, int) dnl> AC_CHECK_TYPE(off_t, long) AC_TYPE_PID_T AC_TYPE_UID_T dnl# Checks for library functions. AC_TYPE_SIGNAL dnl> AC_FUNC_VPRINTF AC_CHECK_FUNCS(atexit unsetenv setutent seteuid) dnl> AC_CHECK_FUNCS(gettimeofday putenv select socket) CFLAGS=${CFLAGS--O} LDFLAGS=${LDFLAGS--O} CPPFLAGS="$CPPFLAGS" AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(LIBS) dnl# common parts of the Makefile MCOMMON=./Make.common AC_SUBST_FILE(MCOMMON) AC_CONFIG_HEADER(config.h) AC_OUTPUT(Make.common Makefile src/Makefile data/Makefile \ doc/Makefile doc/LSM doc/xiterm+thai.1) echo " Configuration: Source code location: ${srcdir} Compiler: ${CC} Compiler flags: ${CFLAGS} Install path: ${prefix}/bin" dnl# X11 versions: ${X_LIBS} echo "" xiterm+thai-1.10/Changelog0000644000175000017500000003641211701207325014164 0ustar thepthep2012-01-05 Theppitak Karoonboonyanan * configure.in: Version 1.10 2012-01-04 Theppitak Karoonboonyanan * configure.in, Makefile.in, -xiterm+thai.spec.in: Drop the outdated, unmaintaned RPM spec. 2012-01-04 Theppitak Karoonboonyanan * Makefile.in: Force distrib tarball regeneration on tar.gz target. 2012-01-04 Theppitak Karoonboonyanan * Makefile.in: Check and make $(VERNAME) symlink before tarring. 2012-01-04 Theppitak Karoonboonyanan * Makefile.in: Use --exclude-vcs instead of --exclude CVS when creating distrib tarball. 2011-12-30 Theppitak Karoonboonyanan * src/main.c (resize_subwindows): - Add variable attribute 'unused' to old_height, to get rid of gcc warning. It's currently unused due to empty Gr_Resize() implementation, but may not be the case if Xtensions/ are used. Reporter: Neutron Soutmun. 2011-12-29 Theppitak Karoonboonyanan Get rid of gcc warning on unused results from chown() and fchown(). We'd like it to fail silently, e.g., when program is installed without sticky bit on. * src/command.c: - Add inline wrappers for chown() and fchown() to override the __wur attribute declared in glibc. - (clean_exit, get_tty): cast the results to void. Reporter: Neutron Soutmun. 2011-12-28 Theppitak Karoonboonyanan * src/command.c (get_tty): Check for return value from dup() and give up on any failure. [triggerred by gcc warning] Thanks Neutron Soutmun for the report. 2011-12-27 Theppitak Karoonboonyanan * src/main.c: Add missing include which caused FTBFS on absense of libxpm support. 2008-06-21 Theppitak Karoonboonyanan * Makefile.in: Use 'make -C ' instead of (cd && make'). 2008-04-25 Theppitak Karoonboonyanan * -src/oldthai.c: Remove unused source. 2008-04-24 Theppitak Karoonboonyanan * configure.in: Version 1.09 2008-04-23 Theppitak Karoonboonyanan * src/thai.c (movetab, levtable): Declare const data const. Make levtable short int array. 2008-04-23 Theppitak Karoonboonyanan * test/README, +test/TIS-620: Add Thai test file. 2008-04-23 Theppitak Karoonboonyanan * src/thai.h: Enclose prototypes with _XFUNCPROTO{BEGIN,END}. * src/thaikb.{c,h}: Update my e-mail address. 2008-04-23 Theppitak Karoonboonyanan * src/thai.c: - Reorder functions according to declarations in the header. - Declare local symbols static. 2008-04-22 Theppitak Karoonboonyanan * src/Makefile.in: Update object dependencies with 'make distdepend'. 2008-04-22 Theppitak Karoonboonyanan Fix security risk for X11 connection stealth, as per Debian security audit team's comment. * src/main.c (main): Instead of guaranteeing fallback value for display_name by initializing it beforehand, try -display argument and alike before resorting to DISPLAY environment, and stop there if nothing is given. No more default display. (Fix adjusted from Neutron Soutmun's patch.) 2008-04-22 Theppitak Karoonboonyanan * src/xdefaults.c (optList): Fix typo in thai_im description. * doc/xiterm+thai.1.in: Use "mode" for -tkb and thai_keyboard parameter, to be consistent with -[-]help message. 2008-04-22 Theppitak Karoonboonyanan * doc/xiterm+thai.1.in: Add Thai-specific info. - options: -tspace, -tkb, -tim. - resources: cursorColorThai, thai_space, thai_keyboard, thai_im. - credit for Vuthichai for Thai language support. 2008-04-21 Theppitak Karoonboonyanan * src/feature.h: Replace APL_NAME with "xiterm+thai". * src/xdefaults.c (optList): Also guard rs_inputMethod option element. 2008-04-21 Theppitak Karoonboonyanan * doc/xiterm+thai.1.in: Replace "xiterm" text with "xiterm+thai". 2008-04-21 Theppitak Karoonboonyanan * configure.in, doc/Makefile.in, doc/xiterm.1.in -> doc/xiterm+thai.1.in: Rename manpage from xiterm.1 to xiterm+thai.1. 2008-04-20 Theppitak Karoonboonyanan * src/xdefaults.c: Guard rs_inputMethod declaration with NO_XLOCALE. 2008-04-20 Theppitak Karoonboonyanan Fix GCC warngings. * src/thaikb.{c,h} (thai_map_qwerty): Make char parameter unsigned. * src/utmp.c: Include "misc.h" for print_error() prototype. * src/xdefaults.c (usage): Cast field width argument for in format string from size_t to int. 2008-04-20 Theppitak Karoonboonyanan Fix GCC warnings. * src/command.{c,h} (tt_write): Change buffer parameter back to unsigned char. Still let tt_printf accepts plain char, as most format strings are literal. * src/command.c (tt_printf): Cast buffer to unsigned char when calling tt_write(). * src/command.c (lookup_key): Declare a local char 'ch' unsigned char. Uncast kbuf when calling tt_write(). * src/screen.c (selection_make): Cast away unsigned when calling strlen(). * src/screen.c (selection_send): Cast target_list to (unsigned char *) when calling XChangeProperty(). * src/screen.c (PasteIt): Declare first parameter const pointer. * src/screen.c (selection_paste): Declare long variables unsigned, to satisfy XGetWindowProperty() prototype. * src/screen.c (drawString macro): Cast away unsigned from linebuf, to satisfy XDrawString*() functions. * src/screen.c (scr_refresh): Add default case, to make sure 'top' is always initialized, although such added case never happens. * src/screen.c (thai_complexclear): Initialize 'from'. 2008-04-19 Theppitak Karoonboonyanan Fix GCC warnings, plus code rearrangement. * src/thai.{c,h}: - Move the global movetab[] array from .h to .c, make it static, and reformat it. - Declare prototypes for public functions in .h. * src/thai.c (ThaiCol2Pixel, ThaiWidth2Pixel): Make string parameters unsigned. * src/thai.c (thaistrlen): Change function def from K&R to ANSI C. Rename parameters to be more meaningful. * src/screen.c: Include thai.h, for function prototypes. Remove typedefs duplicated with thai.h. * src/screen.c (str_refresh): Declare start_text unsigned. 2008-04-19 Theppitak Karoonboonyanan Fix GCC warnings. * src/command.c (lookup_key): More casts for kbuf. * src/command.c (process_escape_seq): Cast strings as unsigned char for scr_add_lines() and xterm_seq() calls. * src/main.c (scale_pixmap): Define w and h variables as unsigned int. 2008-04-19 Theppitak Karoonboonyanan Fix GCC warnings. * src/command.c (get_pty): Move 'Found:' label into preprocessing condition that actually uses it. * src/command.c (stringConversionCallback): Remove unused variable 'i'. * src/command.c (lookup_key): Cast away unsigned from kbuf where needed. * src/command.{c,h} (tt_write, tt_printf): Use plain char for the first buffer argument. 2008-04-19 Theppitak Karoonboonyanan * configure.in: Add -Wall to default CFLAGS. 2008-04-19 Theppitak Karoonboonyanan Eliminate dependency on Xt header . * src/main.h: Remove #include . Its only use here was the Pixel typedef, which is plain unsigned long in Xlib headers. So, replace it with a typedef. * src/xdefaults.h: Remove #include . Just include the required instead, for the KeySym and Display data types. * src/command.c: #include formerly indirectly included via , for the XComposeStatus data type. Also eliminate the XtSpecificationRelease macro check for X11 release. We now assume xorg 7 which is > X11R6 anyway. * src/misc.h: #include formerly indirectly included via , for the Window and GC data types. 2008-04-19 Theppitak Karoonboonyanan * Makefile.in: Re-group shell commands from "(cd X; make Y || exit 1)" to "(cd X; make Y) || exit 1", so the build exits with error when an error occurs. (Comment by Paul Wise during Debian package sponsoring.) * Makefile.in, data/Makefile.in, doc/Makefile.in, src/Makefile.in: Change "cd X; make Y" constructs to "cd X && make Y". 2008-04-07 Theppitak Karoonboonyanan * configure.in: Version 1.08 2008-04-07 Theppitak Karoonboonyanan * data/xiterm+thai.png: Replace the broken image. 2008-04-06 Theppitak Karoonboonyanan Do not link against the unused libSM and libICE (dpkg-shlibdeps warnings reported from Debian). * configure.in: Replace AC_PATH_XTRA with PKG_CHECK_MODULES, and only check for x11. * configure.in, Make.common.in: Only use X_LIBS. Eliminate X_PRE_LIBS and X_EXTRA_LIBS usage, which were formerly passed from AC_PATH_XTRA. 2008-04-01 Theppitak Karoonboonyanan Fix gcc warnings about const pointer qualifiers. * src/main.c (Create_Windows, search_path, set_bgPixmap): Declare pointers as const. * src/main.c (set_bgPixmap): Cast away const from pointer, to satisfy XpmReadFileToPixmap() prototype. 2008-03-31 Theppitak Karoonboonyanan Add desktop icon taken from debian package, as prepared by Neutron Soutmun. * +data/xiterm+thai.png: Add the icon. * +data/Makefile.in: Add make rules to manage data. * icon.xpm -> data/icon.xpm: Move old icon to data subdir. * Make.common.in: Add datadir variable. * Makefile.in (subdirs): Add data to subdirs. * configure.in: Generate data/Makefile. 2008-02-07 Theppitak Karoonboonyanan * configure.in: Define HAVE_XPM with AC_DEFINE. 2008-02-05 Theppitak Karoonboonyanan * configure.in: Version 1.07 2008-02-05 Theppitak Karoonboonyanan * Make.common.in, Makefile.in: Also clear autom4te.cache on 'make mrproper'. 2008-02-05 Theppitak Karoonboonyanan * src/Makefile.in: Rename binary from xiterm to xiterm+thai, to avoid conflict with openi18n's xiterm. 2008-02-05 Theppitak Karoonboonyanan * src/main.c (xterm_seq): Catenate version in title string with configured version, rather than hard coding. 2008-02-05 Theppitak Karoonboonyanan * Make.common.in: Remove -s option for install, so binary is not installed stripped by default. Let distros do that at their choices. E.g. http://bugs.debian.org/438296 2008-02-05 Theppitak Karoonboonyanan * src/command.c, src/xdefaults.c: Use const pointer for rs_inputMethod {and also rs_preeditType}, fixing warning about incompatible pointer. 2008-02-05 Theppitak Karoonboonyanan Fix FTBFS with gcc: * configure.in: Define _GNU_SOURCE with AC_GNU_SOURCE. * src/utmp.c: Include in addition to . 2008-02-04 Theppitak Karoonboonyanan * Makefile.in: Exclude autogen.sh from distribution. 2008-02-04 Theppitak Karoonboonyanan * Makefile.in: exclude debian/ subdir and backup files from distributed tarball. 2006-01-09 Chanop Silpa-Anan * debian/*: Fix xlibs-dev bug. 2004-02-25 Chanop Silpa-Anan * debian/*: Update and upload debian package. 2003-03-14 Theppitak Karoonboonyanan * configure.in, src/main.c: Version 1.06 2003-03-13 Theppitak Karoonboonyanan * xiterm+thai.spec.in: Comment out sources that are not included in source tarball 2003-03-10 Theppitak Karoonboonyanan * src/command.c: Add wheel mouse scrolling support. Fix up/down button in scroll bar to accept only Button1. 2003-03-01 Theppitak Karoonboonyanan * src/command.c: Check IM values whether XNStringConversionCallback is supported before setting the callback. * src/command.c, xiterm+thai.spec.in: Re-implement stringConversionCallback() (again) due to last fix in XFree86 4.3.0. 2003-01-14 Theppitak Karoonboonyanan * xiterm+thai.spec.in: Fix "%install" mess in comment (rpmbuild oddity). 2002-12-31 Theppitak Karoonboonyanan * src/command.c: Fix XSetICValues() missing trailing NULL argument. * src/command.c: Re-implement stringConversionCallback() according to clarified protocol for backward retrievals. Add XIMStringConversionSubstitution checking (black magic quietly agreed by Thai XIM in XFree86). 2002-01-06 Theppitak Karoonboonyanan * src/command.c: Fix duplicated events bug for special keys, due to uninitialized variable "keysym". Fix String_Conv_Cb initialization type warning. * configure.in, src/main.c: Version 1.05. 2001-12-07 Chanop Silpa-Anan * configure.in: remove -m486 from default optimization flag since it prevents other architecture to compile by default. 2001-11-27 Theppitak Karoonboonyanan * xiterm+thai.spec -> xiterm+thai.spec.in: Use %{name}, %{version}, %{release} variables which should be substituted at configure time. Use manifest * configure.in: Add code to xiterm.spec generation. * src/feature.h: Comment out UTMP_SUPPORT, as it does not compile on RH7.2. * configure.in, Make.common.in, doc/Makefile.in: Move package name & versions from Make.common.in to configure.in. Let configure.in handle doc/LSM and doc/xiterm.1 instead of make. * Makefile.in: Also clear xiterm+thai.spec before 'make distrib'. Fix 'make distrib' so that CVS's and .cvsignore's are not included in the tarball. Use -h option of tar to read symlinks, so that, when working with cvs, one can 'make distrib' by creating symlink $(NAME)-$(VERSION) pointing to xiterm+thai repository. * configure.in: Version 1.04 2001-08-01 Chanop Silpa-Anan * src/command.c: use /dev/ptmx for linux platform this fix a problem in using devfs. 2001-02-22 Theppitak Karoonboonyanan * src/command.c, src/screen.c : Add XNStringConversionCallback support for experiment with the new Thai XIM. 2001-01-02 Theppitak Karoonboonyanan * src/command.c : Make XMODIFIERS come before "@im=none" (by changing the order of the calls to XLocaleModifiers()). * Make.common.in, src/main.c : Release version 1.04pre1 2001-01-01 Theppitak Karoonboonyanan * xiterm+thai.spec : Use variables in sources, path names; use BuildRoot * Make.common.in : Add -D option to INSTALL_PROGRAM and INSTALL_DATA to have directory prepared 2000-11-18 Theppitak Karoonboonyanan * src/command.c : Add XSetICFocus() to force initialization of Input_Context which is necessary for XIM tasks. * src/command.c, src/xdefaults.c : Add -tim option (thai_im resource) for specifying Thai XIM mode. 2000-11-09 Theppitak Karoonboonyanan * Changelog : Create GNUish changelog to keep track of changes * src/main.c : Add setlocale() as per Lucy's contribution to support new Thai XKB map of XFree86 4.0.1 which conforms to * Make.common.in, src/main.c : Release version 1.03 xiterm+thai-1.10/aclocal.m40000644000175000017500000001416111701207343014207 0ustar thepthep# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES