From davis at space.mit.edu Sat Nov 4 11:54:05 2006 From: davis at space.mit.edu (John E. Davis) Date: Tue Jan 30 08:52:12 2007 Subject: [slang-users] slang 2.0.7 released Message-ID: <200611041654.kA4Gs5nD015982@aluche.mit.edu> Version 2.0.7 of the slang library is now available. See for downloading options. It may take a day or so for the mirror sites to pick up the latest version. The relevant MD5 sums are: 9d139f0a1cfb2c1ed2adf8e5c6658878 slang-2.0.7.tar.gz 78cb00b86d97bbaca63b2c61dccb0d0c 2.0.6__2.0.7.diff.bz2.sig 084602526f71f7b533303a2ce93b0ff1 2.0.6__2.0.7.diff.bz2 d491e650e451111c016f0693bf3862f9 2.0.6__2.0.7.diff.gz 522d9075a721ebe235211dc96c7db2d1 slang-2.0.7.tar.bz2 99b6a9217aee62b79ffd2e4ffacd87f1 2.0.6__2.0.7.diff.gz.sig e392a1944bfea5949f6eca3eda8abf3b slang-2.0.7.tar.bz2.sig 4b1eef9f06a6c8f773e32e121a2e80a4 slang-2.0.7.tar.gz.sig This is primarily a bug-fix release, but also includes a new socket module and some performance enhancements. The detailed changes are listed below. This version is binary compatible with previous slang-2 versions. Enjoy. --John Changes since 2.0.6 1. src/slmath.c: if a double precision array was passed to nint, it was treated as a single precision one leading to a core dump. 2. src/sldisply.c: The Is_Fg_BGR variable was re-introduced and a typo affecting it was corrected. 3. src/slinclud.h: Do not include malloc.h on FreeBSD (Renato Botelho garga at freebsd, org). 4. doc/tm/cslang.tm: Changed a couple of occurances of "unsigned char" to "SLtype". (Doug Burke dburke at head, cfa, harvard, edu) 5. doc/tm/rtl/list.tm: Documentation changed to indicate that the third parameters to list_append/insert are optional. (Doug Burke). 6. src/slwcwidth.c: Added a new function to the API called SLwchar_set_wcwidth_flags. This may be used to force SLwchar_wcwidth to 1 for double width characters. Such a feature is sometimes needed for fixed fonts that treat single and double width characters the same. 7. slsh/lib/slshrl.sl: The readline-massage hook was interpreting lines beginning with a '.' as RPN. 8. slsh/lib/sldb*.sl: The debugger was not stopping upon errors generated by the deprecated function verror. 9. src/slparse.c: "++()" was flagged by the parser as an error, but no error message for it was being generated. 10. src/slang.h: #if HAVE_LONG_LONG changed to #ifdef HAVE_LONG_LONG 11. src/slsmg.c: Return right away if SLsmg_write_chars is told to write 0 characters. Also a bug fixed in the logic of this routine involving the test for overwriting the second half of a double width character. 12. src/slrline.c: Finished the UTF-8 support by the readline functions. 13. slsh/*.c: Added slsh_get/set_prompt_hook functions for setting of the slsh command-line prompt. (Douglas Burke) 14. src/sltoken.c: Added additional string representations for tokens so that some error messages will not appear to be so cryptic. 15. src/sltoken.c: _pSLparse_error: Use the line number of the input stream if the linenumber associated with a token is unknown. 16. src/slparse.c: Inline arrays and lists are allowed to have a trailing comma, e.g., [1,2,] is the same as [1,2]. 17. doc/tm/rtl/type.tm: typo in example for atof corrected (Doug Burke). 18. Improvements for building on DOS/Windows (Mike Noble): * The various mkfiles/makefile.all now include a clean: target * The top-level mkfiles directory now includes 3 new files: A build.sh script, which auto-generates the Makefiles (using mkmake) and commences a build, similar to the build.bat script which was already there (and which I tweaked slightly). Seed makefile.dos and makefile.sh scripts, which get copied to the root of the S-Lang distro when either build.sh or build.bat are run. This makes it easier to build everything at once, or clean, etc, from the top of the distro. * A few new paragraphs in INSTALL.pc * In the various mkfiles/makefile.all, "CFLAGS +=" changed to "CFLAGS =" to avoid nmake 1.5 problems. * Simplified the module build targets in modules/makefile.all, and made it much easier to add new modules in the future. 19. Added module support for cygwin. This involved a few minor changes to the Makefiles and aclocal.m4 (Mike Noble) 20. slsh/slsh.c: Brief copyright message displayed when started up in interactive mode. 21. src/slarray.c: Improved support for mixed-type inline arrays: NULLs supported (["foo", NULL]) where it makes sense, and type-promotion rules are used to determine the resulting type when concatenating mix-type arrays (["foo"], NULL, ["bar\0"]); 22. src/slrline.c: SLrline_close was not freeing the history creating a memory leak. 23. src/keywhash.c: Removed obsolete and unused "do_while" keyword, and regenerated keywhash.c 24. doc/tm/slang.tm: List of keywords updated to reflect the actual keywords used. 25. modules/mkfiles/makefile.all: Updated VC-specific LINK_CMD macro to support the changes outlines in 18 above (Dino Sangoid). 26. src/slang.c,src/slboseos.c: Added hooks for entering and leaving a function. The beginning-of-statement and end-of-statement hooks were found insufficient to support a debugger support. See the documentation for _bofeof_info for more information. 27. slsh/lib/sldbcore.sl: Modified to use the bof/eof hooks introduced in #26. 28. Various documentation tweaks. 29. src/slboseos.c: Changed the beginning-of-function handler to include the filename. 30. src/slsh/lib/require.sl: Removed the "feature not provided" message. 31. src/slrline.c: Tabs were not being expanded properly when the window was horizontally scrolled. Also, the last column of the display is not used in case the terminal has automatic margins. 32. lib/sldbcore.sl: The debugger's "finish" command was not quite working as it should have. 33. lib/sldbcore.sl: Added an sldb_initialize function that can be overridden by the debugger. 34. src/slposio.c: Made changes to allow arbitrary objects to be attached to file descriptors. 35. src/sl*tty.c: Set SLKeyBoard_Quit to 0 in the init_tty routines. 36. modules/socket-module.c: A new module that defines various socket functions. This required additions to the configure script and related files. 37. src/slstrops.c, slsh/readline.c: Removed statements that were never reached. 38. src/sltypes.c: foreach(X) where X is String_Type produces a sequence of UChar_Type objects. This is consistent with typeof(X[i]). Also added "using" forms to specify char or byte-semantics: foreach (X) using ("bytes"|"chars"). The default is byte semantics. Updated the corresponding docs. 39. src/slang.h: Added SLang_push/pop_wchar macros. 40. src/sldisply.c: This file was failing to compile with Kanji support enabled. Kanji is unsupported in slang-2. 41. src/slcurses.*: Alt-character set handling was not working. Once again, I strongly encourage you to modify your programs to use the native SLsmg routines instead of the partial curses emulation hacks. 42. slsh/lib/sldbsock.sl: New file to implement socket-based debugger. 43. slsh/scripts/sldb: Added --pid option for debugging a separate process via the socket-based debugger interface. 44. src/slang.c: If a try-finally block contained a return statement, the function would sometimes continue after the finally block. 45. modules/termios-module.c: Added tcget/seti/ospeed functions for setting baudrates of termios structures. Also added CRTSCTS constant to the module. 46. src/slclass.c: If an application calls SLang_pop_mmt with a non-MMT type specified, a SL_Application_Error exception will be generated. 47. src/slang.c: A misplaced return statement was introduced by #44 above. 48. src/slparse.c: Allow the "finally" keyword to be followed by a colon, e.g., try foo; finally: bar; 49. src/sltoken.c,slang,c: "Dollar" and long-longs were not being properly handled in byte-compiled files. 50. src/test/Makefile: Changes were made to test byte-compiled versions of the test scripts. 51. modules/socket-module.c: added #include to get it to compile on mac osx. 52. src/slmath.c: The data field was not properly used by the nint function. 53. modules/select-module.c: Call SLang_handle_interrupt when the select system calls gets interrupted. 54. src/slposio.c: Add == and != operators to FD_Type objects so that fileno(stdin)==fileno(stdin) works as expected. 55. src/slarray.c: wherefirst and wherelast were not working with empty arrays. 56. src/slmisc.c: SLang_guess_type was failing on numbers containing a leading '+' sign. 57. src/slimport.c: The name of the SLANG_MODULE_PATH environment variable may be changed in src/Makefile. 58. src/slrline.c: Added a delete-to-beginning-of-line (delbol) function and bound it to ^U. 59. slsh/Makefile.in: $(CFLAGS) added to the final link line. (Nelson H. F. Beebe) 60. src/slmath.c: Avoid the use of function pointers to standard math functions to support a wider range of compilers. 61. autoconf/aclocal.m4: IRIX compilers do not require "-K pic" 62. autoconf/configure.ac: Probe for socklen_t. 63. */Makefile.in: Added support for the $LIBS env variable 64. src/slerr.c: Added fflush(stdout) to SLang_vmessage. 65. slsh/lib/sldbcore.sl: The eof hook was improperly handling the debugger step. 66. src/slarray.c: Optimization added for index-array operations on double, float, and int arrays. 67. src/slarith.c: Optimization added for boolean operations between [U]Char_Types. 68. lib/structfuns.sl: Typo in the documentation corrected (Doug Burke) 69. lib/*.sl, lib/tm/*.tm, lib/help/*.hlp: Documentation for the functions in *.sl has been moved to *.tm and integrated into the help system. 70. src/slwclut.c: a missing "default" label in a switch statement was causing invalid character class specifiers to pass. 71. src/slang.c: Optimization added for struct method calls. In addition, linenumber information was propagated for such function calls to permit better interaction with the debugger. 72. slsh/lib/profile.sl: profile_on was not being called with an argument. From mnoble at space.mit.edu Wed Nov 8 12:34:07 2006 From: mnoble at space.mit.edu (Michael Noble) Date: Tue Jan 30 08:52:12 2007 Subject: [slang-users] S-Lang XPA and DS9 module updated Message-ID: <20061108173407.GA30892@svoboda.mit.edu> Version 0.4.3 of the S-Lang XPA and DS9 module is now available at http://space.mit.edu/cxc/software/slang/modules/xpa/ The driver for this release was to address two serious issues: - When DS9 bins images from event lists the FITS header it returns for the image does not reflect BITPIX=-32, but rather BITPIX=8 from the original event list. This could cause image pixel arrays retrieved by ds9_get_array() to have the wrong S-Lang datatype (making them essentially corrupt/unusable); we now check if DS9 has binned the image itself, and if so reset BITPIX accordingly. - MAC OS/X testing revealed that char arrays returned by the S-Lang XPAGet() wrapper were not always properly NULL-terminated. The regression tests were updated to interoperate with a wider number of DS9 versions, and several minor new functions were added. Please see the CHANGELOG for more details. Best, -- Mike Noble From joerg at alea.gnuu.de Sat Nov 18 15:33:54 2006 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Tue Jan 30 08:52:12 2007 Subject: [slang-users] Bug in SLutf8_skip_chars? Message-ID: Hi, the Debian maintainer of libslang2 added a patch to the newest version 2.0.6-4 that fixes a bug in SLutf8_skip_chars(). http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=392942 But this bug breaks jed. Now, the question is, what's the right return value of SLutf8_skip_chars? #v+ #include #include int main(void) { SLuchar_Type string[] = "\xE4"; unsigned int dnum; SLutf8_skip_chars(string, string+1, 1, &dnum, 1); printf("%d\n", dnum); return 0; } #v- % dpkg -l libslang2 ii libslang2 2.0.6-3 The S-Lang programming library - runtime ver % ./test 1 % dpkg -l libslang2 ii libslang2 2.0.6-4 The S-Lang programming library - runtime ver % ./test 0 Bye, J?rg. -- Ein Narr, er sieht die Weisheit nicht selbst wenn sie n?rrisch zu ihm spricht. From davis at space.mit.edu Sat Nov 18 21:48:23 2006 From: davis at space.mit.edu (John E. Davis) Date: Tue Jan 30 08:52:12 2007 Subject: [slang-users] Bug in SLutf8_skip_chars? In-Reply-To: References: Message-ID: <200611190248.kAJ2mN1W015928@aluche.mit.edu> =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >the Debian maintainer of libslang2 added a patch to the newest version >2.0.6-4 that fixes a bug in SLutf8_skip_chars(). >http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=392942 But this bug >breaks jed. Now, the question is, what's the right return value of >SLutf8_skip_chars? [...] >% dpkg -l libslang2 >ii libslang2 2.0.6-3 The S-Lang programming library - runtime ver >% ./test >1 >% dpkg -l libslang2 >ii libslang2 2.0.6-4 The S-Lang programming library - runtime ver >% ./test >0 The correct return value is 1. The code was designed to work with malformed UTF-8 sequences. In general, an N byte sequence contains U valid UTF-8 encoded characters and B invalid bytes, where N > U + B The function returns U+B via the parameter list. Note that for a completely valid UTF-8 byte-sequence, B will be 0 and the function will behave the same as the debian patched version. So, it seems to me that the problem is that the application (whiptail in this case) is using this function incorrectly. If either SLsmg_write_nstring or SLsmg_write_string is doing something wrong, then I will make every effort to correct the problem. But as far as SLutf8_skip_chars goes, it is ok and should not have been patched. Thanks, --John From davis at space.mit.edu Sun Nov 19 00:29:08 2006 From: davis at space.mit.edu (John E. Davis) Date: Tue Jan 30 08:52:12 2007 Subject: [slang-users] Bug in SLutf8_skip_chars? In-Reply-To: <200611190248.kAJ2mN1W015928@aluche.mit.edu> References: <200611190248.kAJ2mN1W015928@aluche.mit.edu> Message-ID: <200611190529.kAJ5T8B9019495@aluche.mit.edu> I wrote: >using this function incorrectly. If either SLsmg_write_nstring or >SLsmg_write_string is doing something wrong, then I will make every >effort to correct the problem. But as far as SLutf8_skip_chars goes, >it is ok and should not have been patched. I did find a problem with SLsmg_write_nstring when used with double-width characters. I encourage the debian slang maintainers to back out the patch they added to SLutf8_skip_chars and add the patch that is now in slang's svn repository to the SLsmg_write_nstring and SLsmg_write_wrapped_string functions. Here is the patch with repect to slang-2.0.7: --- slang-2.0.7/src/slsmg.c 2006-11-04 10:57:31.000000000 -0500 +++ slsmg.c 2006-11-19 00:03:00.000000000 -0500 @@ -808,34 +808,6 @@ (unsigned char *)str + strlen (str)); } -void SLsmg_write_nstring (char *str, unsigned int n) -{ - unsigned int width; - unsigned char *blank = (unsigned char *)" "; - unsigned char *u = (unsigned char *)str; - - /* Avoid a problem if a user accidently passes a negative value */ - if ((int) n < 0) - return; - - if (u == NULL) width = 0; - else - { - unsigned char *umax; - - width = strlen ((char *)u); - if (UTF8_Mode) - umax = SLutf8_skip_chars (u, u+width, n, &width, 0); - else - { - if (width > n) width = n; - umax = u + width; - } - SLsmg_write_chars (u, umax); - } - - while (width++ < n) SLsmg_write_chars (blank, blank+1); -} void SLsmg_write_wrapped_string (SLuchar_Type *u, int r, int c, unsigned int dr, unsigned int dc, @@ -844,15 +816,26 @@ int maxc = (int) dc; unsigned char *p, *pmax; int utf8_mode = UTF8_Mode; + unsigned char display_8bit = (unsigned char) SLsmg_Display_Eight_Bit; + + if (utf8_mode) + display_8bit = 0xA0; if ((dr == 0) || (dc == 0)) return; + if (u == NULL) + u = (unsigned char *)""; + p = u; pmax = u + strlen ((char *)u); dc = 0; while (1) { + SLwchar_Type wc; + unsigned int nconsumed; unsigned char ch = *p; + unsigned int ddc; + if ((ch == 0) || (ch == '\n')) { int diff; @@ -876,27 +859,82 @@ continue; } - if ((int) dc == maxc) - { - SLsmg_gotorc (r, c); - SLsmg_write_chars (u, p); - if (dr == 1) break; + /* If the width of the characters buffered so far extend to or beyond + * the width of the box, then write them out and goto the + * next line. Note that dc > maxc if the displayable width of + * the last character to be written is greater than the width + * of the box. This will be the case if (maxc= maxc) + goto write_chars_and_reset; - r++; - dc = 0; - dr--; - u = p; + nconsumed = 1; + if (ch < 0x80) + { + p++; + if ((ch >= 0x20) && (ch != 0x7F)) + { + dc++; + continue; + } + /* Otherwise display as ^X */ + dc += 2; continue; } - dc++; - if (utf8_mode) - p = SLutf8_skip_chars (p, pmax, 1, NULL, 0); + nconsumed = 1; + if ((utf8_mode == 0) + || (NULL == SLutf8_decode (p, pmax, &wc, &nconsumed))) + { + if ((utf8_mode == 0) + && (display_8bit && (*p >= display_8bit))) + { + dc++; + p += nconsumed; + continue; + } + + ddc = 4*nconsumed; /* */ + } + else if (wc < (SLwchar_Type)display_8bit) + ddc = 4; /* displays as */ else - p++; + ddc = SLwchar_wcwidth (wc); + + dc += ddc; + if (((int)dc > maxc) && (maxc > (int)ddc)) + { + dc -= ddc; + goto write_chars_and_reset; + } + p += nconsumed; + continue; + + write_chars_and_reset: + SLsmg_gotorc (r, c); + SLsmg_write_chars (u, p); + while ((int)dc < maxc) + { + SLsmg_write_char (' '); + dc++; + } + if (dr == 1) break; + r++; + dc = 0; + dr--; + u = p; } } +void SLsmg_write_nstring (char *str, unsigned int n) +{ + /* Avoid a problem if a user accidently passes a negative value */ + if ((int) n < 0) + return; + + SLsmg_write_wrapped_string ((unsigned char *)str, This_Row, This_Col, 1, n, 1); +} + int SLsmg_Tab_Width = 8; /* Minimum value for which eight bit char is displayed as is. */ From joerg at alea.gnuu.de Sun Nov 19 10:07:09 2006 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Tue Jan 30 08:52:12 2007 Subject: [slang-users] Bug in SLutf8_skip_chars? References: <200611190248.kAJ2mN1W015928@aluche.mit.edu> <200611190529.kAJ5T8B9019495@aluche.mit.edu> Message-ID: Hello John, "John E. Davis" wrote: > I wrote: >>using this function incorrectly. If either SLsmg_write_nstring or >>SLsmg_write_string is doing something wrong, then I will make every >>effort to correct the problem. But as far as SLutf8_skip_chars goes, >>it is ok and should not have been patched. > > I did find a problem with SLsmg_write_nstring when used with > double-width characters. Thanks a lot! I filed a bug report to the libslang2 package and pointed the maintainer to your message. I hope he will fix it soon. Have a nice day, J?rg. -- Eine Blume geht ?ber eine Wiese, sieht einen sch?nen Menschen und rei?t ihm den Kopf ab.