From mnoble at space.mit.edu Thu Jan 31 22:11:17 2008 From: mnoble at space.mit.edu (Michael Noble) Date: Thu Jan 31 22:11:32 2008 Subject: [slang-users] slirp 1.9.4 released Message-ID: <20080131221117.GA11235@svoboda.mit.edu> I am pleased to announce that SLIRP 1.9.4 has been released to http://space.mit.edu/cxc/slirp SLIRP is a vectorizing code generator, aimed primarily at simplifying the process of creating modules for the S-Lang scripting language. It can dramatically reduce the time and effort required to make C, C++, and Fortran code callable directly from the S-Lang interpreter, automatically vectorize functions to take advantage of the powerful numerical and array capabilities native to S-Lang, and even generate Makefiles to automate the build process. Another distinguishing feature, of special interest as multiprocessor and multicore desktops become more prevalent, is that SLIRP can generate parallelizable wrappers for OpenMP-aware compilers. Details of the changes in v1.9.4 are appended below. Regards, Michael S. Noble ------------------------------------ Changes in v1.9.4 1. Provide S-Lang access to Fortran COMMON block variables, via: get_commblock_list: gives names of all common blocks in module get_commblock: retrieves a CommBlock handle to a given block get_commblock_value: retrieves value of named variable in block set_commblock_value: assigns value to named variable in block Common block variables may also be set/get with struct.field notation, such as variable com1 = get_commblock("com1"); print(com1.energy); com1.energy = 1.1F; 2. Support passing CHARACTER arrays to/from Fortran calls. 3. New -fortran_strlen option, to customize where hidden string length args s/be placed in wrappers of Fortran calls accepting CHARACTER args As a result, the internal FTN_STR_LEN argmap has been removed. 4. Allow object code(s) to be specified at slirp invocation ... they will be treated as if they were part of an -ldflags specification and added as link dependencies to the generated module. 5. Improve Makefile distclean: target (Rafael Laboissiere, at, Debian) 6. Generated makefiles: . Now show SLIRP wrapper command used to create them . Have corrected .SUFFIX rule . Fortran compiler FC variable now includes path for disambiguation . If .sl is found at generation time then 'make install' will install it to the S-Lang/slsh subdirectory in $prefix/share 7. Modified some internal usages of array/function dereferencing, for compatibility with SLang 2.1.x. 8. New verbose help (-vh/-vhelp/--vhelp) option, so that rarely used options do not clutter normal -help output 9. Fortran parameter() statements now recognized for array dimensions. 10. Arguments passed to Fortran routines for array dimensions are now automatically made optional from S-Lang scope. 11. OUT annotations now have precedence over IN when both match a pattern. 12. All Fortran function wrappers now emitted to a single .f file, instead of one output .f file for each input .f file wrapped. 13. Search for .dylib shared libs when establishing S-Lang installation location on Darwin, and .dll.a libs on cygwin. 14. Improved documentation on installation, including a README with explicit tips on using configure options to find S-Lang, etc. From troy_slang at piggo.com Tue Feb 12 11:50:37 2008 From: troy_slang at piggo.com (Troy Piggins) Date: Tue Feb 12 11:52:40 2008 Subject: [slang-users] generating random characters Message-ID: <20080212214941@troy.piggo.com> I'm looking at a slang macro for slrn and I wanted to add 3 random characters to a string. Can't find a standard slang function that does this. I did find some random number generators in the gsl module, but am reluctant to use that because not sure how many "regular" slrn users would have extra slang modules installed. I was thinking as a workaround using the internal bash function $RANDOM which generates a random number between 0 and 32767. Then I was going to limit that to an upper limit of 26, convert that to a corresponding alphabetical char and do that 3 times. Seems tedious. I think for the purposes of what I need I could get away with just numbers instead of alphabetical chars and skip the step of upper limit 26, convert to char, and repeat 3 times. I could just set an upper limit of 999 and take a random number. Here's what I came up with: variable rnd= system( "RND=$RANDOM; let 'RND %= 999'; echo $RND"); Trouble is it is always outputting 0. If I use this: variable rnd= system( "RND=$RANDOM; let 'RND %= 999'"); it always outputs 35212. 2 questions: 1. What am I doing wrong above? 2. Is there a better way to do this with standard slang? 3. Is there a simple way to generate random alpha chars? -- Troy Piggins From olecom at gmail.com Tue Feb 12 12:30:01 2008 From: olecom at gmail.com (Oleg Verych) Date: Tue Feb 12 12:30:39 2008 Subject: [slang-users] generating random characters In-Reply-To: <20080212214941@troy.piggo.com> References: <20080212214941@troy.piggo.com> Message-ID: <8499950a0802120430s561af293u5374507c9e80acdf@mail.gmail.com> On Feb 12, 2008 12:50 PM, Troy Piggins wrote: > I'm looking at a slang macro for slrn and I wanted to add 3 random characters > to a string. Can't find a standard slang function that does this. I did find > some random number generators in the gsl module, but am reluctant to use that > because not sure how many "regular" slrn users would have extra slang modules > installed. > > I was thinking as a workaround using the internal bash function $RANDOM which > generates a random number between 0 and 32767. Then I was going to limit that > to an upper limit of 26, convert that to a corresponding alphabetical char and > do that 3 times. Seems tedious. > > I think for the purposes of what I need I could get away with just numbers > instead of alphabetical chars and skip the step of upper limit 26, convert to > char, and repeat 3 times. I could just set an upper limit of 999 and take a > random number. > > Here's what I came up with: > > variable rnd= system( "RND=$RANDOM; let 'RND %= 999'; echo $RND"); > > Trouble is it is always outputting 0. maybe it's return code, that matters? (Just some general stuff) olecom@flower:/tmp/blinux$ a() { RND=$RANDOM; let 'RND %= 999'; return $RND; } olecom@flower:/tmp/blinux$ a olecom@flower:/tmp/blinux$ $? bash: 181: command not found olecom@flower:/tmp/blinux$ a olecom@flower:/tmp/blinux$ $? bash: 128: command not found olecom@flower:/tmp/blinux$ a olecom@flower:/tmp/blinux$ $? bash: 250: command not found olecom@flower:/tmp/blinux$ [] > 1. What am I doing wrong above? > 2. Is there a better way to do this with standard slang? > 3. Is there a simple way to generate random alpha chars? olecom@flower:/tmp/blinux$ dd bs=1 count=1 References: <20080212214941@troy.piggo.com> Message-ID: <20080212151317.GA23414@svoboda.mit.edu> > I was thinking as a workaround using the internal bash function > $RANDOM which generates a random number between 0 and 32767. Will all slrn users, e.g. those on Windows, have access to bash? Below is a "random" number generator I've used in several projects, stemming from the linear congruential method described in Knuth's "The Art of Computer Programming," Vol 2, Section 3.2.1. Hope This Helps, Mike --- private variable rseed = getpid(); private define random() { rseed = (rseed * 0x5DEECEDL + 0xB) & ((1 shl 30) - 1); (rseed shr 6) / ((1 shl 24) * 1.0); } From davis at space.mit.edu Tue Feb 12 17:03:54 2008 From: davis at space.mit.edu (John E. Davis) Date: Tue Feb 12 17:04:43 2008 Subject: [slang-users] generating random characters In-Reply-To: <20080212151317.GA23414@svoboda.mit.edu> References: <20080212214941@troy.piggo.com> <20080212151317.GA23414@svoboda.mit.edu> Message-ID: <200802121703.m1CH3sBo020015@aluche.mit.edu> Michael Noble wrote: > private variable rseed = getpid(); > private define random() >{ > rseed = (rseed * 0x5DEECEDL + 0xB) & ((1 shl 30) - 1); > (rseed shr 6) / ((1 shl 24) * 1.0); >} Another one that is ok for the purposes Troy has in mind is: private variable Random; define srandom (r) { Random = r; } srandom (_time() * getpid()); define random () { Random = (Random*69069U + 1013904243U)&0xFFFFFFFFU; return Random; } define urandom () { return random()/4294967296.0; } Here, urandom() returns a random number between 0 and 1, whereas random returns a random unsigned integer between 0 and 0xFFFFFFFF. FWIW, the next slang release (2.1.4) will include a random number module. The module will feature a generator that according to the "dieharder" battery of tests has slightly better statistical properties than the Mersenne Twister and is about as fast. This module is not yet in the svn repository but will appear on the next update. Good luck, --John From troy_slang at piggo.com Tue Feb 12 20:02:12 2008 From: troy_slang at piggo.com (Troy Piggins) Date: Tue Feb 12 20:03:46 2008 Subject: [slang-users] Re: generating random characters In-Reply-To: <20080212151317.GA23414@svoboda.mit.edu> References: <20080212214941@troy.piggo.com> <20080212151317.GA23414@svoboda.mit.edu> Message-ID: <20080213060015@troy.piggo.com> * Michael Noble is quoted & my replies are inline below : > > I was thinking as a workaround using the internal bash function > > $RANDOM which generates a random number between 0 and 32767. > > Will all slrn users, e.g. those on Windows, have access to bash? No - that is one big problem with my method. > Below is a "random" number generator I've used in several projects, > stemming from the linear congruential method described in Knuth's > "The Art of Computer Programming," Vol 2, Section 3.2.1. > > Hope This Helps, > Mike > > --- > > private variable rseed = getpid(); > private define random() > { > rseed = (rseed * 0x5DEECEDL + 0xB) & ((1 shl 30) - 1); > (rseed shr 6) / ((1 shl 24) * 1.0); > } Thanks Michael. That is a much better way than mine. Might still prefer John's. -- Troy Piggins From troy_slang at piggo.com Tue Feb 12 20:03:37 2008 From: troy_slang at piggo.com (Troy Piggins) Date: Tue Feb 12 20:05:45 2008 Subject: [slang-users] Re: generating random characters In-Reply-To: <200802121703.m1CH3sBo020015@aluche.mit.edu> References: <20080212214941@troy.piggo.com> <20080212151317.GA23414@svoboda.mit.edu> <200802121703.m1CH3sBo020015@aluche.mit.edu> Message-ID: <20080213060217@troy.piggo.com> * John E. Davis is quoted & my replies are inline below : > Michael Noble wrote: > > private variable rseed = getpid(); > > private define random() > >{ > > rseed = (rseed * 0x5DEECEDL + 0xB) & ((1 shl 30) - 1); > > (rseed shr 6) / ((1 shl 24) * 1.0); > >} > > Another one that is ok for the purposes Troy has in mind is: > > private variable Random; > define srandom (r) > { > Random = r; > } > srandom (_time() * getpid()); > > define random () > { > Random = (Random*69069U + 1013904243U)&0xFFFFFFFFU; > return Random; > } > define urandom () > { > return random()/4294967296.0; > } Excellent - that'll do nicely. Thankyou. > Here, urandom() returns a random number between 0 and 1, whereas > random returns a random unsigned integer between 0 and 0xFFFFFFFF. > > FWIW, the next slang release (2.1.4) will include a random number > module. The module will feature a generator that according to the > "dieharder" battery of tests has slightly better statistical > properties than the Mersenne Twister and is about as fast. This > module is not yet in the svn repository but will appear on the next > update. Interesting - thanks for that. -- Troy Piggins From troy_slang at piggo.com Wed Feb 13 07:09:37 2008 From: troy_slang at piggo.com (Troy Piggins) Date: Wed Feb 13 07:10:55 2008 Subject: [slang-users] Re: generating random characters In-Reply-To: <200802121703.m1CH3sBo020015@aluche.mit.edu> References: <20080212214941@troy.piggo.com> <20080212151317.GA23414@svoboda.mit.edu> <200802121703.m1CH3sBo020015@aluche.mit.edu> Message-ID: <20080213164852@troy.piggo.com> * John E. Davis is quoted & my replies are inline below : > Michael Noble wrote: > > private variable rseed = getpid(); > > private define random() > >{ > > rseed = (rseed * 0x5DEECEDL + 0xB) & ((1 shl 30) - 1); > > (rseed shr 6) / ((1 shl 24) * 1.0); > >} Isn't there a problem with this? Because I'm calling this macro from within slrn, rseed is always giving the pid of the same slrn and so is the same number? > Another one that is ok for the purposes Troy has in mind is: > > private variable Random; > define srandom (r) > { > Random = r; > } > srandom (_time() * getpid()); Perhaps I should have explained more detail about my reasons for wanting random numbers. I have a macro that uses _time to generate the left hand side of my Message-IDs like this 20080213165912@usenet.piggo.com : #v+ define create_msg_id() { variable sd= "usenet"; variable hostname= "piggo.com"; variable tm= localtime( _time ()); return sprintf ("%d%02d%02d%02d%02d%02d@%s.%s", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, sd, hostname); } #v- I was thinking this was unique enough to serve as M-IDs, but a suggestion from Peter J Ross and also a recent experience I had where my system clock jumped forward in the future made me realise that it could be possible to have 2 M-IDs created the same. You'd have to be really, really unlucky to get that considering it would have to be the exact same second, but ... PJR suggest inserting 3 random chars after the numbers like: 20080213165912.xyz@usenet.piggo.com And that's where my little quest here began. So coming back to your suggestion - wouldn't the getpid always generate the same pid if called from within the same slrn process? And if we are trying to prevent a possible mishap with the time-generated LHS of M-ID anyway, I think it'd be dangerous to use _time again for this random part? > define random () > { > Random = (Random*69069U + 1013904243U)&0xFFFFFFFFU; > return Random; > } > define urandom () > { > return random()/4294967296.0; > } > > Here, urandom() returns a random number between 0 and 1, whereas > random returns a random unsigned integer between 0 and 0xFFFFFFFF. I'd be after a random number between 0 and 999 for my purposes :) > FWIW, the next slang release (2.1.4) will include a random number > module. The module will feature a generator that according to the > "dieharder" battery of tests has slightly better statistical > properties than the Mersenne Twister and is about as fast. This > module is not yet in the svn repository but will appear on the next > update. So it will be part of "standard" s-lang 2.1.4? Any idea how far away that release is? Or with all your time spent at the moment on the slrn-mafia chasing a release, am I asking a bit much? :) -- Troy Piggins | http://piggo.com/~troy "At my house, we call them 'Uh-Oh's.'" From davis at space.mit.edu Wed Feb 13 09:09:06 2008 From: davis at space.mit.edu (John E. Davis) Date: Wed Feb 13 09:09:58 2008 Subject: [slang-users] Re: generating random characters In-Reply-To: <20080213164852@troy.piggo.com> References: <20080212214941@troy.piggo.com> <20080212151317.GA23414@svoboda.mit.edu> <200802121703.m1CH3sBo020015@aluche.mit.edu> <20080213164852@troy.piggo.com> Message-ID: <200802130909.m1D996Jk016543@aluche.mit.edu> Troy Piggins wrote: >> > private variable rseed = getpid(); >> > private define random() >> >{ >> > rseed = (rseed * 0x5DEECEDL + 0xB) & ((1 shl 30) - 1); >> > (rseed shr 6) / ((1 shl 24) * 1.0); >> >} > > Isn't there a problem with this? Because I'm calling this macro from within > slrn, rseed is always giving the pid of the same slrn and so is the same > number? Each time the random function is called, rseed will change. Its initial value is that of the pid. [...] > So coming back to your suggestion - wouldn't the getpid always generate the > same pid if called from within the same slrn process? And if we are trying to The idea is that you call random each time you want a pseudo random number. getpid is only used once to initialize the value. > prevent a possible mishap with the time-generated LHS of M-ID anyway, I think > it'd be dangerous to use _time again for this random part? You have to seed the random number generator is some way. Using the current time and process id are typical ways to do this. And this only needs to happen once. >> define random () >> { >> Random = (Random*69069U + 1013904243U)&0xFFFFFFFFU; >> return Random; >> } >> define urandom () >> { >> return random()/4294967296.0; >> } >> >> Here, urandom() returns a random number between 0 and 1, whereas >> random returns a random unsigned integer between 0 and 0xFFFFFFFF. > > I'd be after a random number between 0 and 999 for my purposes :) If you use the above definition of random, then use: r = random() mod 1000; >> FWIW, the next slang release (2.1.4) will include a random number >> module. The module will feature a generator that according to the [...] > So it will be part of "standard" s-lang 2.1.4? Any idea how far away that > release is? Or with all your time spent at the moment on the slrn-mafia > chasing a release, am I asking a bit much? :) It will be a standard module in slang-2.1.4. I do not have any release plans at this time-- perhaps sometime in the spring. I plan to make that my last release of the 2.1 series. I hope this clears up your confusion with the random number seed. Thanks, --John From cedre.m at gmail.com Tue Mar 4 11:49:20 2008 From: cedre.m at gmail.com (cedre.m) Date: Tue Mar 4 11:50:08 2008 Subject: [slang-users] [Patch] Use of glibc wcwidth Message-ID: <47a269090803040349qa6079f9ua451472ed5934533@mail.gmail.com> Hello, I am Japanese centos user. I use slang library(ntsysv, system-config-*). Thank you. This patch resolves unicode ambiguous width problem, by wcwidth(glibc). http://www.unicode.org/reports/tr11/#Ambiguous http://mediasrv.ns.ac.yu/unicode/www.unicode.org/unicode/reports/tr11-4/index.htm http://www.stained-g.net/shinichiro/unicode5-ambiguous-width.html http://people.debian.org/~kubota/unicode-symbols-width2.html.en -- Sugiyama cedre.m@gmail.com -------------- next part -------------- # using glibc wcwidth instead of slwcwidth. # cedre.m@gmail.com diff -urN slang-2.1.3/autoconf/configure.ac slang-2.1.3-wcwidth/autoconf/configure.ac --- slang-2.1.3/autoconf/configure.ac 2007-08-30 03:54:49.000000000 +0900 +++ slang-2.1.3-wcwidth/autoconf/configure.ac 2008-03-04 19:08:17.000000000 +0900 @@ -220,6 +220,21 @@ AC_SUBST(GNU_READLINE) AC_SUBST(LIB_READLINE) +gnu_wcwidth=unknown +AC_ARG_WITH([gnu-wcwidth], + [ --without-gnu-wcwidth Don't use the glibc wcwidth.], + gnu_wcwidth=$withval) + +if test "$gnu_wcwidth" != "no"; then + AC_EGREP_CPP(yes,[ +#include +#include +#if defined(__GLIBC__) && defined(_WCHAR_H) && defined(__STDC_ISO_10646__) +yes +#endif +],AC_DEFINE(HAVE_GNU_WCWIDTH,1,[Define if you want glibc wcwidth.])) +fi + JD_GET_MODULES(src/modules.unx) JD_CREATE_MODULE_ORULES diff -urN slang-2.1.3/src/config.hin slang-2.1.3-wcwidth/src/config.hin --- slang-2.1.3/src/config.hin 2007-08-30 12:29:28.000000000 +0900 +++ slang-2.1.3-wcwidth/src/config.hin 2008-03-04 19:08:17.000000000 +0900 @@ -78,6 +78,8 @@ #undef HAVE_SYS_MMAN_H +#undef HAVE_GNU_WCWIDTH + /* Set these to the appropriate values */ #undef SIZEOF_SHORT #undef SIZEOF_INT diff -urN slang-2.1.3/src/slsmg.c slang-2.1.3-wcwidth/src/slsmg.c --- slang-2.1.3/src/slsmg.c 2007-10-14 03:34:10.000000000 +0900 +++ slang-2.1.3-wcwidth/src/slsmg.c 2008-03-04 19:08:17.000000000 +0900 @@ -214,44 +214,46 @@ unsigned char vt100_char; unsigned char ascii; SLwchar_Type unicode; + SLwchar_Type unicode_not_ambiguous; // not_wide ? } ACS_Def_Type; static SLCONST ACS_Def_Type UTF8_ACS_Map[] = { - {'+', '>', 0x2192 }, /* RIGHTWARDS ARROW */ - {',', '<', 0x2190 }, /* LEFTWARDS ARROW */ - {'-', '^', 0x2191 }, /* UPWARDS ARROW */ - {'.', 'v', 0x2193 }, /* DOWNWARDS ARROW */ - {'0', '#', 0x25AE }, /* BLACK VERTICAL RECTANGLE */ - {'`', '+', 0x25C6 }, /* BLACK DIAMOND */ - {'a', ':', 0x2592 }, /* MEDIUM SHADE */ - {'f', '\'', 0x00B0 },/* DEGREE SIGN */ - {'g', '#', 0x00B1 }, /* PLUS-MINUS SIGN */ - {'h', '#', 0x2592 }, /* MEDIUM SHADE */ - {'i', '#', 0x2603 }, /* SNOWMAN */ - {'j', '+', 0x2518 }, /* BOX DRAWINGS LIGHT UP AND LEFT */ - {'k', '+', 0x2510 }, /* BOX DRAWINGS LIGHT DOWN AND LEFT */ - {'l', '+', 0x250c }, /* BOX DRAWINGS LIGHT DOWN AND RIGHT */ - {'m', '+', 0x2514 }, /* BOX DRAWINGS LIGHT UP AND RIGHT */ - {'n', '+', 0x253C }, /* BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */ - {'o', '~', 0x23BA }, /* HORIZONTAL SCAN LINE-1 */ - {'p', '-', 0x23BB }, /* HORIZONTAL SCAN LINE-3 (ncurses addition) */ - {'q', '-', 0x2500 }, /* BOX DRAWINGS LIGHT HORIZONTAL */ - {'r', '-', 0x23BC }, /* HORIZONTAL SCAN LINE-7 (ncurses addition) */ - {'s', '_', 0x23BD }, /* HORIZONTAL SCAN LINE-9 */ - {'t', '+', 0x251C }, /* BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ - {'u', '+', 0x2524 }, /* BOX DRAWINGS LIGHT VERTICAL AND LEFT */ - {'v', '+', 0x2534 }, /* BOX DRAWINGS LIGHT UP AND HORIZONTAL */ - {'w', '+', 0x252C }, /* BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */ - {'x', '|', 0x2502 }, /* BOX DRAWINGS LIGHT VERTICAL */ - {'y', '<', 0x2264 }, /* LESS-THAN OR EQUAL TO (ncurses addition) */ - {'z', '>', 0x2265 }, /* GREATER-THAN OR EQUAL TO (ncurses addition) */ - {'{', '*', 0x03C0 }, /* GREEK SMALL LETTER PI (ncurses addition) */ - {'|', '!', 0x2260 }, /* NOT EQUAL TO (ncurses addition) */ - {'}', 'f', 0x00A3 }, /* POUND SIGN (ncurses addition) */ - {'~', 'o', 0x00B7 }, /* MIDDLE DOT */ - {0, 0, 0} + {'+', '>', 0x2192, 0}, /* RIGHTWARDS ARROW [A/21AA] */ + {',', '<', 0x2190, 0}, /* LEFTWARDS ARROW [A/21A9] */ + {'-', '^', 0x2191, 0x2303}, /* UPWARDS ARROW [A/2303] */ + {'.', 'v', 0x2193, 0x2304}, /* DOWNWARDS ARROW [A/2304] */ + {'0', '#', 0x25AE, 0}, /* BLACK VERTICAL RECTANGLE */ + {'`', '+', 0x25C6, 0x2666}, /* BLACK DIAMOND [BLACK DIAMOND SUIT] */ + {'a', ':', 0x2592, 0}, /* MEDIUM SHADE [A]. */ + {'f', '\'', 0x00B0, 0xFF9F},/* DEGREE SIGN + [HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK] */ + {'g', '#', 0x00B1, 0}, /* PLUS-MINUS SIGN [A]. */ + {'h', '#', 0x2592, 0}, /* MEDIUM SHADE [A]. */ + {'i', '#', 0x2603, 0}, /* SNOWMAN [N] */ + {'j', '+', 0x2518, 0}, /* BOX DRAWINGS LIGHT UP AND LEFT [A] */ + {'k', '+', 0x2510, 0}, /* BOX DRAWINGS LIGHT DOWN AND LEFT [A] */ + {'l', '+', 0x250c, 0}, /* BOX DRAWINGS LIGHT DOWN AND RIGHT [A] */ + {'m', '+', 0x2514, 0}, /* BOX DRAWINGS LIGHT UP AND RIGHT [A] */ + {'n', '+', 0x253C, 0}, /* BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL [A] */ + {'o', '~', 0x23BA, 0}, /* HORIZONTAL SCAN LINE-1 [N] */ + {'p', '-', 0x23BB, 0}, /* HORIZONTAL SCAN LINE-3 (ncurses addition) [N] */ + {'q', '-', 0x2500, 0}, /* BOX DRAWINGS LIGHT HORIZONTAL [A] */ + {'r', '-', 0x23BC, 0}, /* HORIZONTAL SCAN LINE-7 (ncurses addition) [N] */ + {'s', '_', 0x23BD, 0}, /* HORIZONTAL SCAN LINE-9 [N] */ + {'t', '+', 0x251C, 0}, /* BOX DRAWINGS LIGHT VERTICAL AND RIGHT [A] */ + {'u', '+', 0x2524, 0}, /* BOX DRAWINGS LIGHT VERTICAL AND LEFT [A] */ + {'v', '+', 0x2534, 0}, /* BOX DRAWINGS LIGHT UP AND HORIZONTAL [A] */ + {'w', '+', 0x252C, 0}, /* BOX DRAWINGS LIGHT DOWN AND HORIZONTAL [A] */ + {'x', '|', 0x2502, 0}, /* BOX DRAWINGS LIGHT VERTICAL [A] */ + {'y', '<', 0x2264, 0}, /* LESS-THAN OR EQUAL TO (ncurses addition) [A]. */ + {'z', '>', 0x2265, 0}, /* GREATER-THAN OR EQUAL TO (ncurses addition) [A] */ + {'{', '*', 0x03C0, 0}, /* GREEK SMALL LETTER PI (ncurses addition) [A]. */ + {'|', '!', 0x2260, 0}, /* NOT EQUAL TO (ncurses addition) [A]. */ + {'}', 'f', 0x00A3, 0}, /* POUND SIGN (ncurses addition) [N] */ + {'~', 'o', 0x00B7, 0xFF65},/* MIDDLE DOT [HALFWIDTH KATAKANA MIDDLE DOT] */ + {0, 0, 0, 0} }; #define ACS_MODE_NONE -1 @@ -288,7 +290,12 @@ acs = UTF8_ACS_Map; while (acs->vt100_char != 0) { - ACS_Map[acs->vt100_char] = acs->unicode; + if (SLwchar_wcwidth(acs->unicode) == 1) + ACS_Map[acs->vt100_char] = acs->unicode; + else if (acs->unicode_not_ambiguous) + ACS_Map[acs->vt100_char] = acs->unicode_not_ambiguous; + else + ACS_Map[acs->vt100_char] = acs->ascii; acs++; } break; diff -urN slang-2.1.3/src/slwcwidth.c slang-2.1.3-wcwidth/src/slwcwidth.c --- slang-2.1.3/src/slwcwidth.c 2007-01-11 01:09:07.000000000 +0900 +++ slang-2.1.3-wcwidth/src/slwcwidth.c 2008-03-04 19:08:17.000000000 +0900 @@ -24,8 +24,13 @@ #include "slang.h" #include "_slang.h" +#ifndef HAVE_GNU_WCWIDTH #define DEFINE_PSLWC_WIDTH_TABLE #include "slwcwidth.h" +#else +#include +#define SL_WIDTH_ALOOKUP(y,x) y = wcwidth((wchar_t)x) +#endif static int Ignore_Double_Width = 0; int SLwchar_wcwidth (SLwchar_Type ch) From laurent.perez at unicaen.fr Tue Mar 4 23:01:48 2008 From: laurent.perez at unicaen.fr (Laurent Perez) Date: Tue Mar 4 23:02:18 2008 Subject: [slang-users] new ao module Message-ID: <20080304230148.GA2460@unicaen.fr> Hello all, I uploaded [1] a new module. Slao provide bindings for libao [2], a cross platform audio library. You probably don't need to add beeping abilities to your slang scripts. Slao may be used to generate arbitrary waveforms with your sound card, providing you with a multi channels, low frequency (and sometimes low quality) function generator. Slao can also create and play wav, au and raw files. Regards ; Laurent. Links : [1] http://laurent.perez2.free.fr/comp/slang/modules/modules.html [2] http://www.xiph.org/ao From p.boekholt at gmail.com Wed Mar 5 19:18:47 2008 From: p.boekholt at gmail.com (Paul Boekholt) Date: Wed Mar 5 19:19:32 2008 Subject: [slang-users] Ruby module for S-Lang Message-ID: Hi, I've uploaded a beta version of a module to embed the Ruby interpreter in S-Lang. The module can pass Ruby objects back to S-Lang and call methods on them with the dot operator ("ruby_object.method()"). For now the module only works with Ruby 1.8. You can get it from http://www.cheesit.com/downloads/slang/slruby.html. From cedre.m at gmail.com Tue Mar 11 13:25:31 2008 From: cedre.m at gmail.com (cedre.m) Date: Tue Mar 11 13:26:35 2008 Subject: [slang-users] Re: [Patch] Use of glibc wcwidth In-Reply-To: <47a269090803040349qa6079f9ua451472ed5934533@mail.gmail.com> References: <47a269090803040349qa6079f9ua451472ed5934533@mail.gmail.com> Message-ID: <47a269090803110625n6328593cm85a7e83c743e7642@mail.gmail.com> This is patch for slang(revision:231). 2008/3/4, cedre. m : > Hello, I am Japanese centos user. > I use slang library(ntsysv, system-config-*). Thank you. > > This patch resolves unicode ambiguous width problem, by wcwidth(glibc). > -- Sugiyama cedre.m@gmail.com -------------- next part -------------- diff -ur slang-r231/autoconf/configure.ac slang-r231-ambiguous/autoconf/configure.ac --- slang-r231/autoconf/configure.ac 2008-03-11 20:55:25.000000000 +0900 +++ slang-r231-ambiguous/autoconf/configure.ac 2008-03-11 20:54:51.000000000 +0900 @@ -220,6 +220,21 @@ AC_SUBST(GNU_READLINE) AC_SUBST(LIB_READLINE) +gnu_wcwidth=unknown +AC_ARG_WITH([gnu-wcwidth], + [ --without-gnu-wcwidth Don't use the glibc wcwidth.], + gnu_wcwidth=$withval) + +if test "$gnu_wcwidth" != "no"; then + AC_EGREP_CPP(yes,[ +#include +#include +#if defined(__GLIBC__) && defined(_WCHAR_H) && defined(__STDC_ISO_10646__) +yes +#endif +],AC_DEFINE(HAVE_GNU_WCWIDTH,1,[Define if you want glibc wcwidth.])) +fi + JD_GET_MODULES(src/modules.unx) JD_CREATE_MODULE_ORULES diff -ur slang-r231/src/config.hin slang-r231-ambiguous/src/config.hin --- slang-r231/src/config.hin 2008-03-11 20:55:24.000000000 +0900 +++ slang-r231-ambiguous/src/config.hin 2008-03-11 20:53:09.000000000 +0900 @@ -78,6 +78,8 @@ #undef HAVE_SYS_MMAN_H +#undef HAVE_GNU_WCWIDTH + /* Set these to the appropriate values */ #undef SIZEOF_SHORT #undef SIZEOF_INT diff -ur slang-r231/src/slang.h slang-r231-ambiguous/src/slang.h --- slang-r231/src/slang.h 2008-03-11 20:55:24.000000000 +0900 +++ slang-r231-ambiguous/src/slang.h 2008-03-11 20:36:58.000000000 +0900 @@ -330,6 +330,7 @@ #define SLWCWIDTH_SINGLE_WIDTH 0x0001 /* all double width characters given as single width */ #define SLWCWIDTH_CJK_LEGACY 0x0002 /* Ambiguous characters given width of 2 */ +#define SLWCWIDTH_GLIBC 0x0004 SL_EXTERN int SLwchar_set_wcwidth_flags (int flags); /* The skip_char functions also skip over malformed strings counting each byte diff -ur slang-r231/src/slcommon.c slang-r231-ambiguous/src/slcommon.c --- slang-r231/src/slcommon.c 2008-03-11 20:55:24.000000000 +0900 +++ slang-r231-ambiguous/src/slcommon.c 2008-03-11 20:38:46.000000000 +0900 @@ -150,6 +150,8 @@ { if ((*cjk == 0) || (0==strcmp(cjk,"yes"))) (void) SLwchar_set_wcwidth_flags (SLWCWIDTH_CJK_LEGACY); + else if (0==strcmp(cjk,"glibc")) + (void) SLwchar_set_wcwidth_flags (SLWCWIDTH_GLIBC); } return mode; } diff -ur slang-r231/src/slwcwidth.c slang-r231-ambiguous/src/slwcwidth.c --- slang-r231/src/slwcwidth.c 2008-03-11 20:55:24.000000000 +0900 +++ slang-r231-ambiguous/src/slwcwidth.c 2008-03-11 20:51:35.000000000 +0900 @@ -26,6 +26,9 @@ #define DEFINE_PSLWC_WIDTH_TABLE #include "slwcwidth.h" +#ifdef HAVE_GNU_WCWIDTH +#include +#endif static int Width_Flags = 0; int SLwchar_wcwidth (SLwchar_Type ch) @@ -44,6 +47,10 @@ { if (Width_Flags & SLWCWIDTH_CJK_LEGACY) w = 2; +#ifdef HAVE_GNU_WCWIDTH + else if (Width_Flags & SLWCWIDTH_GLIBC) + w = wcwidth((wchar_t)ch); +#endif else w = 1; } From p.boekholt at gmail.com Tue Apr 1 19:49:58 2008 From: p.boekholt at gmail.com (Paul Boekholt) Date: Tue Apr 1 19:51:03 2008 Subject: [slang-users] slruby 0.0.2 Message-ID: Hi, The second beta of the Ruby module for S-Lang is out. This version should also work with Ruby 1.9. It needs more testing with Ruby 1.9 though, in fact Ruby 1.9 itself is still in development. You can get the module from http://www.cheesit.com/downloads/slang/slruby.html From p.boekholt at gmail.com Tue Apr 15 18:40:07 2008 From: p.boekholt at gmail.com (Paul Boekholt) Date: Tue Apr 15 18:40:48 2008 Subject: [slang-users] slruby 0.0.3 Message-ID: Hi, Version 0.0.3 of the Ruby module is out. - use an extconf.rb to generate the Makefile - fixed a problem when yielding multiple arguments to S-Lang in Ruby 1.9. - added support for the '[]=' method for RubyValues. This means you can use Ruby hashes in S-Lang: slsh> variable x = rb_eval("{}"); slsh> x["foo"]=1; slsh> x[PI]="foo"; slsh> x.inspect(); {"foo"=>1, 3.14159265358979=>"foo"} - S-Lang functions called from Ruby now return an array instead of just the top value on the stack. Get it from http://www.cheesit.com/downloads/slang/slruby From mlichvar at redhat.com Wed Apr 23 17:09:18 2008 From: mlichvar at redhat.com (Miroslav Lichvar) Date: Wed Apr 23 17:10:33 2008 Subject: [slang-users] system wchar functions support? Message-ID: <20080423170918.GA9485@localhost> Hi, I was wondering if there is any interest in using libc functions for handling wide characters? The main benefit would be support of other multibyte encodings than UTF-8. It could be controlled by a configure option. The patch in attachment should demonstrate what I mean, it's not complete, but it allowed me to successfully run some S-Lang applications in non-UTF-8 environment. Comments? -- Miroslav Lichvar -------------- next part -------------- Index: slang.h =================================================================== --- slang.h (revision 233) +++ slang.h (working copy) @@ -47,6 +47,7 @@ # ifndef __unix__ # define __unix__ 1 # endif +# define SYSTEM_WCHAR 1 #endif #if defined(__APPLE__) @@ -282,6 +283,7 @@ /*{{{ UTF-8 and Wide Char support */ +#ifndef SYSTEM_WCHAR #if SLANG_SIZEOF_INT == 4 typedef unsigned int SLwchar_Type; # define SLANG_WCHAR_TYPE SLANG_UINT_TYPE @@ -293,10 +295,18 @@ # define SLang_push_wchar SLang_push_ulong # define SLang_pop_wchar SLang_pop_ulong #endif +#else +# define SLANG_WCHAR_TYPE SLANG_UINT_TYPE +typedef wchar_t SLwchar_Type; +#endif typedef unsigned char SLuchar_Type; /* Maximum multi-byte len for a unicode wchar */ -#define SLUTF8_MAX_MBLEN 6 +#ifndef SYSTEM_WCHAR +# define SLUTF8_MAX_MBLEN 6 +#else +# define SLUTF8_MAX_MBLEN MB_CUR_MAX +#endif /* If argument is 1, force UTF-8 mode on. If argument is 0, force mode off. * If -1, determine mode from the locale. Index: slinclud.h =================================================================== --- slinclud.h (revision 233) +++ slinclud.h (working copy) @@ -30,4 +30,8 @@ # include #endif +#ifdef SYSTEM_WCHAR +# include +#endif + #endif /* _SLANG_INCLUDE_H_ */ Index: slutf8.c =================================================================== --- slutf8.c (revision 233) +++ slutf8.c (working copy) @@ -24,6 +24,8 @@ #include "slang.h" #include "_slang.h" +#ifndef SYSTEM_WCHAR + static unsigned char Len_Map[256] = { 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* - 31 */ @@ -115,9 +117,11 @@ } return w; } +#endif unsigned char *SLutf8_skip_char (unsigned char *s, unsigned char *smax) { +#ifndef SYSTEM_WCHAR unsigned int len; if (s >= smax) @@ -134,6 +138,18 @@ return s + 1; return s + len; +#else + size_t len; + + if (s >= smax) + return s; + + len = mbrlen(s, smax - s, NULL); + if (len <= 1) + return s + 1; + + return s + len; +#endif } SLuchar_Type *SLutf8_skip_chars (SLuchar_Type *s, SLuchar_Type *smax, @@ -145,6 +161,7 @@ n = 0; while ((n < num) && (s < smax)) { +#ifndef SYSTEM_WCHAR unsigned int len = Len_Map[*s]; if (len <= 1) @@ -167,10 +184,19 @@ n++; continue; } - +#else + unsigned int len; + + len = s - SLutf8_skip_char(s, smax); +#endif if (ignore_combining) { +#ifndef SYSTEM_WCHAR SLwchar_Type w = fast_utf8_decode (s, len); +#else + SLwchar_Type w; + SLutf8_decode (s, smax, &w, NULL); +#endif if (0 != SLwchar_wcwidth (w)) n++; s += len; @@ -213,6 +239,7 @@ n = 0; while ((n < num) && (s > smin)) { +#ifndef SYSTEM_WCHAR unsigned char ch; unsigned int dn; @@ -266,6 +293,18 @@ smax = s; } +#else + SLwchar_Type w; + + s--; + if (NULL != SLutf8_decode(s, smax, &w, NULL)) + { + if ((ignore_combining == 0) + || (0 != SLwchar_wcwidth (w))) + n++; + smax = s; + } +#endif } if (dnum != NULL) @@ -313,6 +352,7 @@ unsigned char *SLutf8_decode (unsigned char *u, unsigned char *umax, SLwchar_Type *wp, unsigned int *nconsumedp) { +#ifndef SYSTEM_WCHAR unsigned int len; unsigned char ch; SLwchar_Type w; @@ -362,6 +402,31 @@ return NULL; return u + len; +#else + size_t len; + + if (u >= umax) + { + *wp = 0; + if (nconsumedp != NULL) + *nconsumedp = 0; + return NULL; + } + + len = mbrtowc(wp, u, umax - u, NULL); + if (len <= 0) + { + *wp = 0; + if (nconsumedp != NULL) + *nconsumedp = 1; + return NULL; + } + + if (nconsumedp != NULL) + *nconsumedp = len; + + return u + len; +#endif } @@ -373,6 +438,7 @@ */ SLuchar_Type *SLutf8_encode (SLwchar_Type w, SLuchar_Type *u, unsigned int ulen) { +#ifndef SYSTEM_WCHAR SLuchar_Type *umax = u + ulen; /* U-00000000 - U-0000007F: 0xxxxxxx */ @@ -451,6 +517,18 @@ *u++ = (w & 0x3F)|0x80; return u; +#else + int len; + + if (ulen < MB_CUR_MAX) + return NULL; + + len = wctomb(u, w); + if (len < 0) + return NULL; + + return u + len; +#endif } /* Like SLutf8_encode, but null terminates the result. Index: slcommon.c =================================================================== --- slcommon.c (revision 233) +++ slcommon.c (working copy) @@ -90,6 +90,7 @@ #ifdef HAVE_NL_LANGINFO_CODESET locale = nl_langinfo (CODESET); if ((locale != NULL) && (*locale)) +# ifndef SYSTEM_WCHAR { if ((0 == strcmp (locale, "UTF-8")) || (0 == strcmp (locale, "utf-8")) @@ -99,6 +100,9 @@ return 0; } +# else + return 1; +# endif #endif locale = setlocale (LC_ALL, ""); Index: slsmg.c =================================================================== --- slsmg.c (revision 233) +++ slsmg.c (working copy) @@ -26,6 +26,10 @@ #include "slang.h" #include "_slang.h" +#ifdef HAVE_LANGINFO_H +# include +#endif + typedef struct { int n; /* number of chars written last time */ @@ -177,6 +181,21 @@ tt_Screen_Rows = &SLtt_Screen_Rows; tt_Screen_Cols = &SLtt_Screen_Cols; tt_unicode_ok = &_pSLtt_UTF8_Mode; +#ifdef HAVE_NL_LANGINFO_CODESET +#ifdef SYSTEM_WCHAR + if ((tt_unicode_ok != NULL) && (*tt_unicode_ok > 0)) + { + char *locale; + locale = nl_langinfo (CODESET); + if ((locale != NULL) && (*locale) && + (!((0 == strcmp (locale, "UTF-8")) + || (0 == strcmp (locale, "utf-8")) + || (0 == strcmp (locale, "utf8")) + || (0 == strcmp (locale, "UTF8"))))) + tt_unicode_ok = NULL; + } +#endif +#endif tt_normal_video = SLtt_normal_video; tt_goto_rc = SLtt_goto_rc; Index: slwclut.c =================================================================== --- slwclut.c (revision 233) +++ slwclut.c (working copy) @@ -125,6 +125,8 @@ return 0; } +static int is_of_class (int char_class, SLwchar_Type w); + static void add_char_class (SLwchar_Lut_Type *r, unsigned char char_class) { unsigned int i; @@ -135,7 +137,11 @@ for (i = 0; i < 256; i++) { +#ifndef SYSTEM_WCHAR if (SL_CLASSIFICATION_LOOKUP(i) & char_class) +#else + if (is_of_class(char_class, i)) +#endif lut[i] = 1; } } @@ -149,7 +155,11 @@ return r->lut[wch]; if (r->char_class +#ifndef SYSTEM_WCHAR && (SL_CLASSIFICATION_LOOKUP(wch) & r->char_class)) +#else + && (is_of_class(r->char_class, wch))) +#endif return 1; /* FIXME. I should use a binary search for this... */ Index: slischar.c =================================================================== --- slischar.c (revision 233) +++ slischar.c (working copy) @@ -26,7 +26,9 @@ #include "slang.h" #include "_slang.h" -#define DEFINE_PSLWC_CLASSIFICATION_TABLE +#ifndef SYSTEM_WCHAR +# define DEFINE_PSLWC_CLASSIFICATION_TABLE +#endif #include "slischar.h" #define MODE_VARIABLE _pSLinterp_UTF8_Mode @@ -34,7 +36,11 @@ int SLwchar_islower (SLwchar_Type ch) { if (MODE_VARIABLE) +#ifndef SYSTEM_WCHAR return SL_CLASSIFICATION_LOOKUP(ch) & SLCHARCLASS_LOWER; +#else + return iswlower(ch); +#endif if (ch < 256) return islower ((unsigned char) ch); @@ -45,7 +51,11 @@ int SLwchar_isupper (SLwchar_Type ch) { if (MODE_VARIABLE) +#ifndef SYSTEM_WCHAR return SL_CLASSIFICATION_LOOKUP(ch) & SLCHARCLASS_UPPER; +#else + return iswupper(ch); +#endif if (ch < 256) return isupper ((unsigned char) ch); @@ -56,7 +66,11 @@ int SLwchar_isalpha (SLwchar_Type ch) { if (MODE_VARIABLE) +#ifndef SYSTEM_WCHAR return SL_CLASSIFICATION_LOOKUP(ch) & SLCHARCLASS_ALPHA; +#else + return iswalpha(ch); +#endif if (ch < 256) return isalpha ((unsigned char) ch); @@ -67,7 +81,11 @@ int SLwchar_isxdigit (SLwchar_Type ch) { if (MODE_VARIABLE) +#ifndef SYSTEM_WCHAR return SL_CLASSIFICATION_LOOKUP(ch) & SLCHARCLASS_XDIGIT; +#else + return iswxdigit(ch); +#endif if (ch < 256) return isxdigit ((unsigned char) ch); @@ -78,7 +96,11 @@ int SLwchar_isspace (SLwchar_Type ch) { if (MODE_VARIABLE) +#ifndef SYSTEM_WCHAR return SL_CLASSIFICATION_LOOKUP(ch) & SLCHARCLASS_SPACE; +#else + return iswspace(ch); +#endif if (ch < 256) return isspace ((unsigned char) ch); @@ -89,7 +111,11 @@ int SLwchar_isblank (SLwchar_Type ch) { if (MODE_VARIABLE) +#ifndef SYSTEM_WCHAR return SL_CLASSIFICATION_LOOKUP(ch) & SLCHARCLASS_BLANK; +#else + return iswblank(ch); +#endif return (ch == ' ') || (ch == '\t'); } @@ -97,7 +123,11 @@ int SLwchar_iscntrl (SLwchar_Type ch) { if (MODE_VARIABLE) +#ifndef SYSTEM_WCHAR return SL_CLASSIFICATION_LOOKUP(ch) & SLCHARCLASS_CNTRL; +#else + return iswcntrl(ch); +#endif if (ch < 256) return iscntrl ((unsigned char) ch); @@ -108,7 +138,11 @@ int SLwchar_isprint (SLwchar_Type ch) { if (MODE_VARIABLE) +#ifndef SYSTEM_WCHAR return SL_CLASSIFICATION_LOOKUP(ch) & SLCHARCLASS_PRINT; +#else + return iswprint(ch); +#endif if (ch < 256) return isprint ((unsigned char) ch); @@ -124,11 +158,15 @@ int SLwchar_isdigit (SLwchar_Type ch) { +#ifndef SYSTEM_WCHAR if (MODE_VARIABLE) { unsigned char t = SL_CLASSIFICATION_LOOKUP(ch); return DIGITCLASS(t); } +#else + return iswdigit(ch); +#endif if ((unsigned)ch < 256) return isdigit ((unsigned char) ch); @@ -138,11 +176,15 @@ int SLwchar_isgraph (SLwchar_Type ch) { +#ifndef SYSTEM_WCHAR if (MODE_VARIABLE) { unsigned char t = SL_CLASSIFICATION_LOOKUP(ch); return GRAPHCLASS(t); } +#else + return iswgraph(ch); +#endif if ((unsigned)ch < 256) return isgraph ((unsigned char) ch); @@ -153,10 +195,14 @@ int SLwchar_isalnum (SLwchar_Type ch) { if (MODE_VARIABLE) +#ifndef SYSTEM_WCHAR { unsigned char t = SL_CLASSIFICATION_LOOKUP(ch); return ALNUMCLASS(t); } +#else + return iswalnum(ch); +#endif if ((unsigned)ch < 256) return isalnum ((unsigned char) ch); @@ -168,10 +214,14 @@ int SLwchar_ispunct (SLwchar_Type ch) { if (MODE_VARIABLE) +#ifndef SYSTEM_WCHAR { unsigned char t = SL_CLASSIFICATION_LOOKUP(ch); return PUNCTCLASS(t); } +#else + return iswpunct(ch); +#endif if ((unsigned)ch < 256) return ispunct ((unsigned char) ch); Index: slwcwidth.c =================================================================== --- slwcwidth.c (revision 233) +++ slwcwidth.c (working copy) @@ -24,12 +24,15 @@ #include "slang.h" #include "_slang.h" -#define DEFINE_PSLWC_WIDTH_TABLE -#include "slwcwidth.h" +#ifndef SYSTEM_WCHAR +# define DEFINE_PSLWC_WIDTH_TABLE +# include "slwcwidth.h" +#endif static int Width_Flags = 0; int SLwchar_wcwidth (SLwchar_Type ch) { +#ifndef SYSTEM_WCHAR int w; SL_WIDTH_ALOOKUP(w,ch); @@ -48,6 +51,12 @@ w = 1; } return w; +#else + if (Width_Flags & SLWCWIDTH_SINGLE_WIDTH) + return 1; + + return wcwidth(ch); +#endif } int SLwchar_set_wcwidth_flags (int flags) From laurent.perez at unicaen.fr Thu Apr 24 20:46:37 2008 From: laurent.perez at unicaen.fr (Laurent Perez) Date: Thu Apr 24 20:47:58 2008 Subject: [slang-users] slglade module updated Message-ID: <20080424204637.GA2479@unicaen.fr> Hi, I have updated Christopher Stawarz's SLglade module so that it works with the latest S-Lang / SLgtk versions. You can get it from : http://laurent.perez2.free.fr/comp/slang/modules/modules.html Regards ; Laurent. From p.boekholt at gmail.com Sat Apr 26 12:00:16 2008 From: p.boekholt at gmail.com (Paul Boekholt) Date: Sat Apr 26 12:01:30 2008 Subject: [slang-users] slruby 0.0.4 Message-ID: Hi, Version 0.0.4 of the Ruby module is out. Changes include: - support for accessing S-Lang variables from Ruby - support for passing bstrings to Ruby - Ruby strings are now passed to S-Lang as bstrings Get it from http://www.cheesit.com/downloads/slang/slruby From mcqueenorama at gmail.com Sat Apr 26 21:32:12 2008 From: mcqueenorama at gmail.com (Brian McQueen) Date: Sat Apr 26 21:33:37 2008 Subject: [slang-users] using it in a daemon Message-ID: <5b3fa8f0804261432p2aebb31fp5d62918a18d8394b@mail.gmail.com> I've got a daemon that gathers system statistics on a linux box. I embedded the slang interpreter the other day so the admins can now some up with equations in slang to calculate whatever weird stuff they want to calculate. From davis at space.mit.edu Mon Apr 28 04:31:18 2008 From: davis at space.mit.edu (John E. Davis) Date: Mon Apr 28 04:32:01 2008 Subject: [slang-users] system wchar functions support? In-Reply-To: <20080423170918.GA9485@localhost> References: <20080423170918.GA9485@localhost> Message-ID: <200804280431.m3S4VIVo001764@aluche.mit.edu> Miroslav Lichvar wrote: > I was wondering if there is any interest in using libc functions for > handling wide characters? The main benefit would be support of other > multibyte encodings than UTF-8. It could be controlled by a configure > option. The problem with adding such support to the 2.x series is that it would break binary compatibility. So such a feature would have to wait until version 3, which I have not thought about yet. As such, version 3 is at least a year or two down the road. Perhaps by then UTF-8 will be widespread enough that supporting other multibyte encodings will be unnecessary. >From my point of view, I see more and more people migrating towards UTF-8. Do you have a different sense of where UTF-8 will be in a few years? Thanks, --John From mlichvar at redhat.com Mon Apr 28 15:43:02 2008 From: mlichvar at redhat.com (Miroslav Lichvar) Date: Mon Apr 28 15:44:09 2008 Subject: [slang-users] system wchar functions support? In-Reply-To: <200804280431.m3S4VIVo001764@aluche.mit.edu> References: <20080423170918.GA9485@localhost> <200804280431.m3S4VIVo001764@aluche.mit.edu> Message-ID: <20080428154302.GA29009@localhost> On Mon, Apr 28, 2008 at 12:31:18AM -0400, John E. Davis wrote: > Miroslav Lichvar wrote: > > I was wondering if there is any interest in using libc functions for > > handling wide characters? The main benefit would be support of other > > multibyte encodings than UTF-8. It could be controlled by a configure > > option. > > The problem with adding such support to the 2.x series is that it > would break binary compatibility. In the common case where sizeof(wchar_t) == sizeof(int) == 4 and SLUTF8_MAX_MBLEN == MB_CUR_MAX for UTF-8 it would be compatible, or not? To prevent unexpected problems, the application would need to do something like SLutf8_enable(2) to enable the new behavior for non-UTF-8 locale. > So such a feature would have to > wait until version 3, which I have not thought about yet. As > such, version 3 is at least a year or two down the road. Perhaps by > then UTF-8 will be widespread enough that supporting other multibyte > encodings will be unnecessary. > > From my point of view, I see more and more people migrating towards > UTF-8. Do you have a different sense of where UTF-8 will be in a few > years? No. I was just curious to hear if there are others who would welcome the support. If it was implemented, I could remove an ugly hack in newt (a library for user interfaces) that tries to workaround the problem by constantly redrawing screen. Thanks, -- Miroslav Lichvar From laurent.perez at unicaen.fr Tue Apr 29 09:06:49 2008 From: laurent.perez at unicaen.fr (Laurent Perez) Date: Tue Apr 29 09:07:25 2008 Subject: [slang-users] slxosd-0.2 Message-ID: <20080429090649.GA2485@unicaen.fr> Hi, There is a new slxosd release. It fixes a bug reported by Paul Boekholt. http://laurent.perez2.free.fr/comp/slang/modules/modules.html Thanks. Laurent. From p.boekholt at gmail.com Wed Apr 30 07:14:18 2008 From: p.boekholt at gmail.com (Paul Boekholt) Date: Wed Apr 30 07:14:42 2008 Subject: [slang-users] slxosd-0.2 In-Reply-To: <20080429090649.GA2485@unicaen.fr> References: <20080429090649.GA2485@unicaen.fr> Message-ID: Hi, 2008/4/29, Laurent Perez : > Hi, > > There is a new slxosd release. It fixes a bug reported by Paul Boekholt. > > http://laurent.perez2.free.fr/comp/slang/modules/modules.html Great! However, it still segfaults with this script: #!/usr/bin/env slsh require ("xosd"); variable fp, line, osd, n, t, last_lines, persist, update; variable cmd = "free"; last_lines = 10; % number of lines to print update = 1; % update delay in seconds persist = 10; % time to persist on screen (in seconds) private define create_osd() { variable osd = xosd_create (last_lines); if (-1 == xosd_set_colour (osd, "cornflower blue")) message (xosd_error); if (-1 == xosd_set_outline_colour (osd, "blue")) message (xosd_error); if (-1 == xosd_set_outline_offset (osd, 1)) message (xosd_error); % if (-1 == xosd_set_shadow_offset (osd, 1)) % message (xosd_error); if (-1 == xosd_set_pos (osd, XOSD_top)) message (xosd_error); if (-1 == xosd_set_timeout (osd, persist)) message (xosd_error); return osd; } n = 0; t = 0; forever { n = 0; variable osd; try { fp = popen (cmd, "r"); if (fp == NULL) throw OpenError; osd = create_osd(); while (-1 != fgets (&line, fp)) { if (strlen (line) > 0) { if (n > 0) () = xosd_scroll (osd, 1); () = xosd_print (osd, last_lines - 1, line); n += 1; } } () = fclose (fp); } catch OpenError: { () = xosd_print (osd, last_lines - 1, "Failed to open " + cmd); } sleep (update); } If I change the osd = create_osd(); to osd = NULL; osd = create_osd(); then it seems to work fine. I guess it's a problem in the xosd library. From laurent.perez at unicaen.fr Wed Apr 30 09:51:05 2008 From: laurent.perez at unicaen.fr (Laurent Perez) Date: Wed Apr 30 09:51:43 2008 Subject: [slang-users] slxosd-0.2 In-Reply-To: References: <20080429090649.GA2485@unicaen.fr> Message-ID: <20080430095105.GA2504@unicaen.fr> * Paul Boekholt [2008-04-30 09:14] : > Great! However, it still segfaults with this script: Hi, I can't reproduce this bug here (xosd-2.2.14). Does this script segfaults too ? #!/usr/bin/env slsh require ("xosd"); variable osd; forever { osd = xosd_create (1); sleep (.1); } Thanks. Laurent. From p.boekholt at gmail.com Wed Apr 30 10:16:46 2008 From: p.boekholt at gmail.com (Paul Boekholt) Date: Wed Apr 30 10:17:43 2008 Subject: [slang-users] slxosd-0.2 In-Reply-To: <20080430095105.GA2504@unicaen.fr> References: <20080429090649.GA2485@unicaen.fr> <20080430095105.GA2504@unicaen.fr> Message-ID: Hi, 2008/4/30, Laurent Perez : > I can't reproduce this bug here (xosd-2.2.14). > Does this script segfaults too ? > > #!/usr/bin/env slsh > > require ("xosd"); > > variable osd; > > forever > { > osd = xosd_create (1); > sleep (.1); > } No, now I get Xlib: connection to ":0.0" refused by server Xlib: Maximum number of clients reached I think I was still using the 0.1 version. I've installed 0.2, now it works fine. Sorry! From laurent.perez at unicaen.fr Tue May 13 21:36:11 2008 From: laurent.perez at unicaen.fr (Laurent Perez) Date: Tue May 13 21:37:24 2008 Subject: [slang-users] slgtkdatabox module updated Message-ID: <20080513213611.GC2471@unicaen.fr> Hi, I just uploaded slgtkdatabox-0.3 which reflect changes in GtkDatabox API. Get it from here : http://laurent.perez2.free.fr/comp/slang/modules/modules.html Regards ; Laurent. From p.boekholt at gmail.com Mon May 19 18:41:28 2008 From: p.boekholt at gmail.com (Paul Boekholt) Date: Mon May 19 18:42:27 2008 Subject: [slang-users] slruby 0.0.5 Message-ID: Hi, Version 0.0.5 of the Ruby module is out. - rb_call_method takes the ruby object as the first argument (this was the second argument by the documentation, but didn't work) - added some unit tests -support for passing unsigned integers to Ruby Get it from http://www.cheesit.com/downloads/slang/slruby From mnoble at space.mit.edu Mon May 19 20:43:00 2008 From: mnoble at space.mit.edu (Michael Noble) Date: Mon May 19 20:43:30 2008 Subject: [slang-users] slgtk 0.7.3 released Message-ID: <20080519204300.GA15950@svoboda.mit.edu> Version 0.7.3 of the Gtk module for S-Lang is now available at http://space.mit.edu/cxc/slgtk This is a minor bugfix release, consisting of . Two Makefile patches for Debian compliance (Rafael Laboissiere, at, Debian) . Fix an incorrect attempt at dereferencing in gtkplot.sl . Modified array/function dereferencing in gtkplot.sl, for compatibility with SLang 2.1.x. . Stop contributed rgbwidget.sl from leaving items on stack. . Search for .dylib shared libs when establishing S-Lang install location on Darwin, and .dll.a libs on Cygwin. . Detailed usage info may be viewed for imdisplay by passing "help" option to the functional form or command line wrapper. From mnoble at space.mit.edu Mon May 19 21:23:07 2008 From: mnoble at space.mit.edu (Michael Noble) Date: Mon May 19 21:23:29 2008 Subject: [slang-users] slirp 1.9.5 Message-ID: <20080519212307.GA17710@svoboda.mit.edu> Version 1.9.5 of the SLIRP code generator is available at http://space.mit.edu/cxc/slirp The changes made since v1.9.4 are included below. Enjoy, Michael S. Noble --------------------- 1. Corrected bug in #else clause handling during macro preprocessing (reported by John Houck at space dot mit dot edu) 2. Improved support for parsing macros with continued lines 3. Look for stdint.h during configure & auto map int32_t, etc types 4. Improvements in Fortran wrapping: . include files are now supported . 'entry' keyword is now supported . -nocom switch can be given to shrink module size by not wrapping common blocks when they are not desired 5. Better ignoring of C++ comments embedded within C comments 6. Improved EOF detection when parsing conditional compilation blocks 7. Enhanced man pages with hyphen patch from Rafael L. at Debian 8. Postscript docs discontinued, due to Latex conversion problems From p.boekholt at gmail.com Fri Jun 13 18:24:31 2008 From: p.boekholt at gmail.com (Paul Boekholt) Date: Fri Jun 13 18:25:27 2008 Subject: [slang-users] slruby 0.0.6 Message-ID: Hi, SLruby 0.0.6 is out. - Ruby Bignums are now passed as doubles - Ruby symbols are passed as strings - Ruby function SLang.import_namespace added to import a SLang namespace into a Ruby module Get it from http://www.cheesit.com/downloads/slang/slruby From laurent.perez at unicaen.fr Wed Jun 18 14:49:51 2008 From: laurent.perez at unicaen.fr (Laurent Perez) Date: Wed Jun 18 14:50:09 2008 Subject: [slang-users] inotify module Message-ID: <20080618144951.GB2488@unicaen.fr> Hello, A new S-Lang module for inotify, the file change notification system for Linux kernel is available at : http://laurent.perez2.free.fr/comp/slang/modules/modules.html Regards ; Laurent Perez. From laurent.perez at unicaen.fr Tue Jul 1 20:48:03 2008 From: laurent.perez at unicaen.fr (Laurent Perez) Date: Tue Jul 1 20:48:55 2008 Subject: [slang-users] new exif module Message-ID: <20080701204803.GA2507@unicaen.fr> Hello, A new S-Lang module for retrieving EXIF data from image files is available at : http://laurent.perez2.free.fr/comp/slang/modules/modules.html Regards ; Laurent. From linux4ms at aim.com Thu Jul 24 18:25:44 2008 From: linux4ms at aim.com (Ben Duncan) Date: Thu Jul 24 18:20:02 2008 Subject: [slang-users] Documentation ... Message-ID: <4888C928.7030606@aim.com> Is there a PDF of the HTML "C Library Reference" or at least a tgz version of this html somewhere ? Thanks ... -- Ben Duncan - Business Network Solutions, Inc. 336 Elton Road Jackson MS, 39212 "Never attribute to malice, that which can be adequately explained by stupidity" - Hanlon's Razor From p.boekholt at gmail.com Sat Aug 2 09:57:50 2008 From: p.boekholt at gmail.com (Paul Boekholt) Date: Sat Aug 2 09:58:09 2008 Subject: [slang-users] slruby 0.1.0 Message-ID: Hi, SLruby 0.1.0 is out. - Added tm documentation Get it from http://www.cheesit.com/downloads/slang/slruby.html