Path: utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!munnari!sibyl.eleceng.ua.oz.au!ian From: munnari!sibyl.eleceng.ua.oz.au!ian@UUNET.UU.NET Newsgroups: gnu.emacs.bug Subject: function-key-sequence, support for NS Sys V.2.2 etc (part 1 of 2) Message-ID: <8811232252.AA22735@uunet.UU.NET> Date: 24 Nov 88 07:17:02 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 350 In GNU Emacs 18.52.12 of Sun Nov 20 1988 on sibyl (usg-unix-v) All bug fixes and enhancements are included as a shar file at the end of this message. function-key-sequence bug: This lisp function (keypad.el) stopped working between 18.47 and 18.52. A fix has been applied to Fwhere-is-internal. Better USG support: HIGHPRI does nothing on USG systems. Setpriority has been modified to better emulate the BSD version. Sys_suspend has also been modified so that the shell started on vanilla USG systems runs at the default priority and not HIGHPRI. Use TCSETAW ioctl instead of TCSETA when exiting emacs or doing a fake suspend. Otherwise the screen can get garbled. I assume this would be true of all USG systems but I have only tested it on National Semiconductors version. Emacsclient didn't parse its command arguments properly when compiled with HAVE_SYSV_IPC. I have changed it so it much more closely mimics the BSD version (which should also be a win for maintainability). Support for National Semiconductors System V.2.2 for the ICM 3216: I have written a s-ns5-2-2.h. Slight modifications were required to crt0.c and alloca.s. A change was needed to malloc.c in order to work around a bug in the NS version of ulimit(2). For emacs to work on this system fixes to the terminal driver and to the libc routine signal(2), are also required. I am happy to provide patches for these to anyone who wants them but since they would contain some NS code I'm not sure if you would want to distribute them. The NS compiler puts static variables in the .data section as do many compilers on usg systems. I have provided an alternative fix for this problem which is to pipe the compilers assembler output through an awk script. The following shar file consists of two new files s-ns5-2-2.h System dependendent file for National Semiconductor Sys V.2.2 on an ICM 3216 (probably also on other 32000 machines). move_to_bss An awk script to filter the assembler output of the compiler. diff-ns5.2.2.h Context differences to the files in emacs/src and to emacs/src/emacsclient.c. All changes to the emacs src are conditionally compiled dependent on the definition of NS5, ULIMIT_BREAK_VALUE, NS_STATIC_LOSSAGE or IWD_FIX. The changes to emacsclient.c have not been conditionalised. This is part 1 of two. This is a shell archive of new files for emacs. The second part will contain context differences for the existing files. ------------------Cut Here---------------------------------------- # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by ian on Thu Nov 24 02:12:43 CST 1988 # Contents: s-ns5-2-2.h move_to_bss echo x - s-ns5-2-2.h sed 's/^@//' > "s-ns5-2-2.h" <<'@//E*O*F s-ns5-2-2.h//' /* Definitions file for GNU Emacs running on National Semiconductor System V Release 2.2 for the ICM-3216. You may also need to fix bugs in the terminal driver and in the libc routine "signal" for GNU emacs to work. Fixes for those bugs are available from ian@sibyl.eleceng.ua.oz. Copyright (C) 1988 Ian Dall This file is not part of GNU Emacs (yet) but may be distributed under the same terms as GNU Emacs GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing. Refer to the GNU Emacs General Public License for full details. Everyone is granted permission to copy, modify and redistribute GNU Emacs, but only under the conditions described in the GNU Emacs General Public License. A copy of this license is supposed to have been given to you along with GNU Emacs so you can know your rights and responsibilities. It should be in a file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ /* * Define symbols to identify the version of Unix this is. * Define all the symbols that apply correctly. */ #include "s-usg5-2-2.h" #define NS5 /* On early NS systems ulimit was buggy. If set emacs uses this value * for the maximum sbrk value instead of getting it from ulimit. */ #define ULIMIT_BREAK_VALUE 0x7E0000 /* Two alternative methods of preventing the compiler from putting * uninitialised static variables in .bss. If you are using the NS * compiler, you must define one or other of these. */ #undef static #define NS_STATIC_LOSSAGE /* Early NS compilers have this bug. I believe it has been fixed in later * releases. */ #define SHORT_CAST_BUG #define SEGMENT_MASK (NBPS - 1) /* Variables to get crt0.c to come out correctly */ #define CRT0_DUMMIES bogus_fp, #define DOT_GLOBAL_START #define IWD_FIX /* Non NS specific bug fixes and enhancemants by Ian Dall */ #undef LOAD_AVE_TYPE /* Loadst does not support USG style load data */ #define HAVE_SYSVIPC /* Set this to /bin/mail unless you have a better mail posting program */ #define MAIL_PROGRAM_NAME "/usr/local/bin/remail" /* Macro definitions to emulate BSD functions with SysV ones */ #ifndef BSTRING #define BSTRING #endif #ifdef BSTRING #undef bcopy #undef bzero #undef bcmp #define bcopy(a,b,s) memcpy(b,a,s) #define bzero(a,s) memset(a,0,s) #define bcmp memcmp #endif @//E*O*F s-ns5-2-2.h// chmod u=rw,g=r,o=r s-ns5-2-2.h echo x - move_to_bss sed 's/^@//' > "move_to_bss" <<'@//E*O*F move_to_bss//' # AWK script to hack the assembler output from the compiler so that it puts # uninitialised data in .bss ( instead of .data). This script can not deal # with all possible assembler input and there is no guarantee that the C # compiler won't put out some form which this script can't handle. It works # for all C compiler output tested so far. The -g option must be used. BEGIN {} /^ \.def.*\.scl 3;.*\.endef/ { if (bss) #This .def must be a new allocation -- must print out old one { out_bss = 1; out_size = size; out_val = val; out_type = type; out_align = align; out_dsize = dsize; } else { line_processed = 1; print $0; } align = 0; size = 0; for (i = 0; i < NF; i++) { if ($i == ".val") val = substr($(i+1), 1, length($(i+1)) - 1); if ($i == ".size") size = substr($(i+1), 1, length($(i+1)) - 1) + 0; if ($i == ".type") type = substr($(i+1), 1, length($(i+1)) - 1) + 0; } # Weird comparison to see if this is a function. Type is actually interpreted # as an octal number. if ( type"" ~ /.*[45].$/ || (type"" ~ /.*[2367].$/ && size == 0)) bss = 0; else bss = 1; } /^ ?\.align/ { if (align && bss) #This .align must be a new allocation -- must print out old one { out_bss = 1; out_size = size; out_val = val; out_type = type; out_align = align; out_dsize = dsize; line_no = 0; bss = 0; } line_processed = 1; align = $2; print $0; } /^ ?\.data/ { print $0; line_processed = 1;} bss == 1 && /^ ?\.double / { if ($2 == "0" || $2 == "0x0") { dsize += 4; line_processed = 1; } else bss = 0; } bss == 1 && (/^ ?.ascii/ || /^ ?.byte/ || /^ ?.word/ || /^ ?.int/ || /^ ?.float/ || /^ ?.long/) { bss = 0; } /^ ?\.space/ { if (bss) dsize += $2; else print $0; line_processed = 1; } /^[A-Za-z._][A-Za-z0-9._]*:/ { if ($1 != val":") { if (bss) #This label must be a new allocation -- must print out old one { out_bss = 1; out_size = size; out_val = val; out_type = type; out_align = align; out_dsize = dsize; } if ($2 == ".space") { if(!align) align = 1 x_bss = sprintf (" .bss %s, %s, %d", substr($1, 1, length($1) - 1), $3, align); } else { print $0; line_processed = 1; } } else if (!bss) { print $0; } line_processed = 1; } out_bss == 0 && bss == 0 && x_bss == "" && line_processed == 0 && line_no == 0{ print $0; line_processed = 1; align = 0;} # On reading a line which isn't part of a static data allocation, print out # the .bss directive if we are at the end of a static allocation, otherwise # print out any buffered lines out_bss == 1 || line_processed == 0 || x_bss != "" { if ( !out_bss ) { out_bss = bss; out_size = size; out_val = val; out_type = type; out_align = align; out_dsize = dsize; bss = 0; size = 0; align = 0; dsize = 0; val = ""; type = 0; } if (out_bss) { # The type is actually octal in the assembly file. Awk doesn't # handle octal but we can do comparisons as if it did. ie awk reads # octal 14 as decimal 14. if (out_type == 2 || out_type == 14) { if (!out_align) out_align = 1; if (!out_size) out_size = 1; } if (out_type == 3 || out_type == 15) { if (!out_align) out_align = 2; if (!out_size) out_size = 2; } if (out_type == 4 || out_type == 5 || out_type == 16 || out_type == 17) { if (!out_align) out_align = 4; if (!out_size) out_size = 4; } if (!out_align) out_align = 1; if (!out_size) out_size = out_dsize; printf (" .bss %s, %d, %d\n", out_val, out_size, out_align); } if ( x_bss != "") { print x_bss; x_bss = ""; } else { # if (!out_bss) # { # for (i = 0; i < line_no; i++) print line[i]; # } if ( !line_processed) print $0; } out_bss = 0; line_no = 0; } {line_processed = 0;} # END {for (i = 0; i < line_no; i++) print line[i];} @//E*O*F move_to_bss// chmod u=rw,g=r,o=r move_to_bss echo Inspecting for damage in transit... temp=/tmp/shar$$; dtemp=/tmp/.shar$$ trap "rm -f $temp $dtemp; exit" 0 1 2 3 15 cat > $temp <<\!!! 80 415 2561 s-ns5-2-2.h 180 735 4102 move_to_bss 260 1150 6663 total !!! wc s-ns5-2-2.h move_to_bss | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp if [ -s $dtemp ] then echo "Ouch [diff of wc output]:" ; cat $dtemp else echo "No problems found." fi exit 0