From davis at space.mit.edu Wed Feb 7 23:39:36 2007 From: davis at space.mit.edu (John E. Davis) Date: Wed Feb 7 23:41:22 2007 Subject: [slang-users] test--please ignore Message-ID: <200702080439.l184dap8030175@aluche.mit.edu> Hi, I have switched web hosts and this email is to test the migration of the slang-users mailing-list to the new provider. I apologize for any inconvenience. Thanks, --John From brianahr at gmail.com Mon Feb 12 21:02:06 2007 From: brianahr at gmail.com (Brian Ahr) Date: Mon Feb 12 21:04:07 2007 Subject: [slang-users] embedding slsh ? Message-ID: <45D11C1E.4010905@gmail.com> Hi, I am curious if there are any plans to make the interactive S-lang interpreter (slsh) accessible from the S-lang library? It is possible to embed slsh as it stands now, although applications which do so would probably wind up including parts of slsh, and thus would be required to manually merge any patches/updates to slsh. Having access to slsh through the library would allow applications to embed an interactive S-lang interpreter without having to modify/reuse parts of slsh itself. Thanks, Brian From davis at space.mit.edu Tue Feb 13 23:17:33 2007 From: davis at space.mit.edu (John E. Davis) Date: Tue Feb 13 23:19:31 2007 Subject: [slang-users] embedding slsh ? In-Reply-To: <45D11C1E.4010905@gmail.com> References: <45D11C1E.4010905@gmail.com> Message-ID: <200702140417.l1E4HXAS026955@aluche.mit.edu> Brian Ahr wrote: >I am curious if there are any plans to make the interactive S-lang >interpreter (slsh) accessible from the S-lang library? > >It is possible to embed slsh as it stands now, although applications >which do so would probably wind up including parts of slsh, and thus >would be required to manually merge any patches/updates to slsh. Having >access to slsh through the library would allow applications to embed an >interactive S-lang interpreter without having to modify/reuse parts of >slsh itself. I am not exactly sure what parts of slsh you would like to see merged into the slang library. In some sense, slsh is a wrapper around the slang readline routines (SLrline), and the slang interpreter (SLang_load_*). There is not much else to it. If you want your program to prompt for interactive input to be fed to the slang interpreter, then you can use something as simple as fgets followed by SLang_load_string. Alternatively, have you considered making parts of your application available as a module and then load that module into slsh? Thanks, --John From brianahr at gmail.com Tue Feb 13 23:48:45 2007 From: brianahr at gmail.com (Brian Ahr) Date: Tue Feb 13 23:50:33 2007 Subject: [slang-users] embedding slsh ? In-Reply-To: <200702140417.l1E4HXAS026955@aluche.mit.edu> References: <45D11C1E.4010905@gmail.com> <200702140417.l1E4HXAS026955@aluche.mit.edu> Message-ID: <45D294AD.4020305@gmail.com> I would be particularly interested in seeing the following functions available from the library: * slsh_interactive * slsh_use_readline * slsh_init_readline_intrinsics Granted, thats a pretty small chunk of code. It also seems that slsh loads the autoload.sl and slshrl.sl files on start up - and the behavior of the above listed functions does not quite match the behavior of slsh unless those files are loaded. I suppose applications could load those files manually, given the installation prefix to S-lang. The desired functionality would be to allow the interactive interpreter to access the internals of a running copy/instance of the host program - and be able to take advantage of the existing readline functionality defined in slsh/readline.c. I hadn't thought about loading part of my application as a module. I'll look into that as well. Thanks, ~Brian John E. Davis wrote: > Brian Ahr wrote: > >> I am curious if there are any plans to make the interactive S-lang >> interpreter (slsh) accessible from the S-lang library? >> >> It is possible to embed slsh as it stands now, although applications >> which do so would probably wind up including parts of slsh, and thus >> would be required to manually merge any patches/updates to slsh. Having >> access to slsh through the library would allow applications to embed an >> interactive S-lang interpreter without having to modify/reuse parts of >> slsh itself. >> > > I am not exactly sure what parts of slsh you would like to see merged > into the slang library. In some sense, slsh is a wrapper around the > slang readline routines (SLrline), and the slang interpreter > (SLang_load_*). There is not much else to it. > > If you want your program to prompt for interactive input to be fed to > the slang interpreter, then you can use something as simple as fgets > followed by SLang_load_string. Alternatively, have you considered > making parts of your application available as a module and then load > that module into slsh? > > Thanks, > --John > > From davis at space.mit.edu Fri Feb 16 00:05:37 2007 From: davis at space.mit.edu (John E. Davis) Date: Fri Feb 16 00:07:20 2007 Subject: [slang-users] embedding slsh ? In-Reply-To: <45D294AD.4020305@gmail.com> References: <45D11C1E.4010905@gmail.com> <200702140417.l1E4HXAS026955@aluche.mit.edu> <45D294AD.4020305@gmail.com> Message-ID: <200702160505.l1G55be7007203@aluche.mit.edu> Brian Ahr wrote: >I would be particularly interested in seeing the following functions >available from the library: > >* slsh_interactive >* slsh_use_readline >* slsh_init_readline_intrinsics I may create a separate readline module that can be loaded into the interpreter. But do not look for that anytime soon. >Granted, thats a pretty small chunk of code. It also seems that slsh >loads the autoload.sl and slshrl.sl files on start up - and the behavior >of the above listed functions does not quite match the behavior of slsh >unless those files are loaded. I suppose applications could load those >files manually, given the installation prefix to S-lang. It is recommended that an application's load-path include the slsh directories. [...] >I hadn't thought about loading part of my application as a module. I'll >look into that as well. I think that may be your best bet at the moment, especially if your application has an interactive command-line where the user "lives" most of the time. Otherwise, I would just use a simple combination of SLrline_open, SLrline_read_line, SLang_load_string, and SLclose. If you app has a GUI, you might want to consider Mike Noble's SLgtk. His latest announcement contains the following note that might be relevant: Includes gPrompt, a lightweight terminal-like widget with an embedded S-Lang prompt, scrolling output, and a simple history mechanism. gPrompt facilitates the complementary use of a GUI & interactive command line within a single application process, without resorting to the complexity of multithreading. Good luck, --John From mnoble at space.mit.edu Fri Feb 16 11:27:34 2007 From: mnoble at space.mit.edu (Michael Noble) Date: Fri Feb 16 11:29:32 2007 Subject: [slang-users] XPA and Gtk S-Lang modules updated Message-ID: <20070216162734.GA28482@svoboda.mit.edu> New versions of the XPA and Gtk modules for S-Lang are now available at: http://space.mit.edu/cxc/software/slang/modules/xpa/ http://space.mit.edu/cxc/software/slang/modules/slgtk/ The release: - Updates imdisplay to: support scaling/flipping/flopping of composite image at launch, more intelligently manage screen real estate via window chaining, and include online help. - Includes gPrompt, a lightweight terminal-like widget with an embedded S-Lang prompt, scrolling output, and a simple history mechanism. gPrompt facilitates the complementary use of a GUI & interactive command line within a single application process, without resorting to the complexity of multithreading. - Provides Gtk 2.10.9 support, including binaries for i686 Linux and Mac OS/X (both PowerPC and Intel). - Bundles TESS [The (Te)st (S)ystem for (S)Lang] version 0.3.0, to reduce by one the dependencies for end-user regression testing. More details on SLxpa and SLgtk are given below. Regards, Michael S. Noble ------------------------------------------------ SLxpa is a set of bindings which facilitate using the XPA interprocess communication library directly from S-Lang. It may also be used to drive the popular DS9 astronomical imager directly from S-Lang, combining the strength of DS9 imaging with the power and speed of S-Lang's array-based mathematical capabilities. SLgtk augments the core numerical strengths of S-Lang by making it possible to quickly construct sophisticated graphical interfaces from relatively simple, and highly portable, scripts. One example is the "VWhere," a tool for visual data mining and correlation, described in http://arxiv.org/pdf/astro-ph/0412003 Two others are the volview 3D volume visualizer described at http://space.mit.edu/cxc/software/slang/modules/volview/ and the lightweight imdisplay rendering tool described at http://space.mit.edu/cxc/software/slang/modules/slgtk/doc/html/slgtk-6.html Imdisplay allows an effectively unlimited number of images to be easily stacked into a composite image. Transparency is respected, in the sense that if any input image contains an alpha channel then the rendered result will, too, and be suitably blended. A wide variety of file formats are supported on input, including raw S-Lang arrays, FITS, JPEG, PNG, GIF, XPM, TIFF, and animations. The rendered result may also be saved to a variety of formats, including JPEG, PNG, and FITS. From mcqueenorama at gmail.com Tue Feb 27 23:17:40 2007 From: mcqueenorama at gmail.com (Brian McQueen) Date: Tue Feb 27 23:18:35 2007 Subject: [slang-users] Compile Probs Net BSD Message-ID: <5b3fa8f0702272017i19780097peb10eb434468f065@mail.gmail.com> I'm getting "'PROD_RESULT_TYPE' undeclared" errors on: NetBSD 2.1.0_STABLE From mcqueenorama at gmail.com Wed Feb 28 12:11:18 2007 From: mcqueenorama at gmail.com (Brian McQueen) Date: Wed Feb 28 12:14:47 2007 Subject: [slang-users] slcurl compile problem Message-ID: <5b3fa8f0702280911w3dc39c0dy1ea53d810fd8b3f9@mail.gmail.com> Sorry, but I'm also having a problem compiling slcurl on the same NetBSD system. I know curl in installed well because I use libcurl quite often. I decided to try use it via slangt as an extension language now, but its not compiling. The problem is clear, but I don't see why its happening. Even though its including curl.h, and curl.h is in /sys/pkg/include, the definitions from curl.h do not seem to be available. I think its a problem with including the header file more than once: cc -O2 -shared -fPIC -I/arpa/gm/m/mcqueeno/include -I/sys/pkg/include curl-module.c -o curl-module.so -L/arpa/gm/m/mcqueeno/lib -lslang -L/sys/pkg/lib -lcurl -lm curl-module.c: In function `do_setopt': curl-module.c:667: error: `CURLOPT_SOURCE_URL' undeclared (first use in this function) curl-module.c:667: error: (Each undeclared identifier is reported only once curl-module.c:667: error: for each function it appears in.) curl-module.c:668: error: `CURLOPT_SOURCE_USERPWD' undeclared (first use in this function) curl-module.c:671: error: `CURLOPT_SOURCE_QUOTE' undeclared (first use in this function) curl-module.c:673: error: `CURLOPT_SOURCE_PREQUOTE' undeclared (first use in this function) curl-module.c:675: error: `CURLOPT_SOURCE_POSTQUOTE' undeclared (first use in this function) curl-module.c: At top level: curl-module.c:1539: error: `CURLOPT_SOURCE_URL' undeclared here (not in a function) curl-module.c:1539: error: initializer element is not constant curl-module.c:1539: error: (near initialization for `Module_IConstants[71].value') curl-module.c:1539: error: initializer element is not constant curl-module.c:1539: error: (near initialization for `Module_IConstants[71]') From davis at space.mit.edu Wed Feb 28 21:04:34 2007 From: davis at space.mit.edu (John E. Davis) Date: Wed Feb 28 21:05:56 2007 Subject: [slang-users] slcurl compile problem In-Reply-To: <5b3fa8f0702280911w3dc39c0dy1ea53d810fd8b3f9@mail.gmail.com> References: <5b3fa8f0702280911w3dc39c0dy1ea53d810fd8b3f9@mail.gmail.com> Message-ID: <200703010204.l2124YCq007376@aluche.mit.edu> Brian McQueen wrote: >cc -O2 -shared -fPIC -I/arpa/gm/m/mcqueeno/include -I/sys/pkg/include >curl-module.c -o curl-module.so -L/arpa/gm/m/mcqueeno/lib -lslang >-L/sys/pkg/lib -lcurl > -lm >curl-module.c: In function `do_setopt': >curl-module.c:667: error: `CURLOPT_SOURCE_URL' undeclared (first use It seems that your version of curl does not support CURLOPT_SOURCE_URL, etc. I just released version 0.1.2 of the module that should take care of this. Please try it. Thanks, --John From mcqueenorama at gmail.com Thu Mar 1 13:09:44 2007 From: mcqueenorama at gmail.com (Brian McQueen) Date: Thu Mar 1 13:12:09 2007 Subject: [slang-users] slcurl compile problem In-Reply-To: <5b3fa8f0703011002h64efd805s4b3fa75c092934a4@mail.gmail.com> References: <5b3fa8f0702280911w3dc39c0dy1ea53d810fd8b3f9@mail.gmail.com> <200703010204.l2124YCq007376@aluche.mit.edu> <5b3fa8f0703011002h64efd805s4b3fa75c092934a4@mail.gmail.com> Message-ID: <5b3fa8f0703011009h614666e6odfddec7d66e71c95@mail.gmail.com> I should have mentioned that my curl version is 7.16.1. On 3/1/07, Brian McQueen wrote: > Thanks - there is a new problem now. I in order to simplify the > discussion I upgraded curl to the most recent version and used your > latest slcurl and rebuilt everything. This latest slcurl gives an > Application error: > > prompt>./bin/slsh ./share/slsh/local-packages/babelfish.sl > Application error: Type 45 not registered > prompt> > > > > On 2/28/07, John E. Davis wrote: > > Brian McQueen wrote: > > >cc -O2 -shared -fPIC -I/arpa/gm/m/mcqueeno/include -I/sys/pkg/include > > >curl-module.c -o curl-module.so -L/arpa/gm/m/mcqueeno/lib -lslang > > >-L/sys/pkg/lib -lcurl > > > -lm > > >curl-module.c: In function `do_setopt': > > >curl-module.c:667: error: `CURLOPT_SOURCE_URL' undeclared (first use > > > > It seems that your version of curl does not support > > CURLOPT_SOURCE_URL, etc. I just released version 0.1.2 of the module > > that should take care of this. Please try it. > > > > Thanks, > > --John > > > From mcqueenorama at gmail.com Fri Mar 2 12:46:54 2007 From: mcqueenorama at gmail.com (Brian McQueen) Date: Fri Mar 2 12:48:31 2007 Subject: [slang-users] Fwd: make out slcurl with libtool In-Reply-To: <200703021726.l22HQV3c029587@sdf.lonestar.org> References: <200703021726.l22HQV3c029587@sdf.lonestar.org> Message-ID: <5b3fa8f0703020946l5130317dh79a6168eb2dacc77@mail.gmail.com> I wanted to get it to compile with libtool so I could use the libraries without needing to set LD_LIBRARY_PATH. I made a half hearted attempt at updating the Makefile and the compile fails as shown below. I am missing something as you can see by the undefined symbols. Also there is a reference to "main" coming from somewhere. Any clues for me? libtool --mode=link cc -O2 -I/arpa/gm/m/mcqueeno/include -I/arpa/gm/m/mcqueeno/include curl-module.c -o curl-module.so -L/arpa/gm/m/mcqueeno/lib -lslang -L/arpa/gm/m/mcqueeno/lib -lcurl -lm cc -O2 -I/arpa/gm/m/mcqueeno/include -I/arpa/gm/m/mcqueeno/include curl-module.c -o curl-module.so -L/arpa/gm/m/mcqueeno/lib -lslang /arpa/gm/m/mcqueeno/lib/libcurl.so -L/usr/pkg/lib /usr/pkg/lib/libidn.so /usr/pkg/lib/libintl.so -lssl -lcrypto /usr/pkg/lib/libz.so -lm -Wl,--rpath -Wl,/arpa/gm/m/mcqueeno/lib -Wl,--rpath -Wl,/usr/pkg/lib -Wl,--rpath -Wl,/arpa/gm/m/mcqueeno/lib -Wl,--rpath -Wl,/usr/pkg/lib /usr/pkg/lib/libcrypto.so: warning: warning: reference to compatibility times(); include for correct reference ld: warning: libintl.so.0, needed by /usr/pkg/lib/libidn.so, may conflict with libintl.so.3 /usr/lib/crt0.o(.text+0xf0): In function `__start': : undefined reference to `main' /usr/lib/crt0.o(.text+0xf4): In function `__start': : undefined reference to `main' /arpa/gm/m/mcqueeno/lib/libslang.so: undefined reference to `tgetnum' /arpa/gm/m/mcqueeno/lib/libslang.so: undefined reference to `tgetflag' /arpa/gm/m/mcqueeno/lib/libslang.so: undefined reference to `tgetent' /arpa/gm/m/mcqueeno/lib/libslang.so: undefined reference to `tgetstr' *** Error code 1 Stop. make: stopped in /arpa/gm/m/mcqueeno/slcurl-0.1.2/src From mcqueenorama at gmail.com Tue Mar 6 11:50:36 2007 From: mcqueenorama at gmail.com (Brian McQueen) Date: Tue Mar 6 11:53:57 2007 Subject: [slang-users] curl_escape Message-ID: <5b3fa8f0703060850j6e153b1cl13e53a1cb0550deb@mail.gmail.com> I was going through translate and found the encoding subroutines. Did you know curl has that too? I decided to add in the curl_escape and unescape function to your curl-module. I think it will take me a few hours though, because I don't know what's going on in there with the interpreter stack, and MMT type and SLang_Function_Num_Args for example. It seems like a good exercise though so I will continue, unless you stick it in there first. I bet you could do it in about 20 minutes. There is a curl_easy_escape and a curl_easy_unescape. From mcqueenorama at gmail.com Wed Mar 7 19:47:47 2007 From: mcqueenorama at gmail.com (Brian McQueen) Date: Wed Mar 7 19:49:25 2007 Subject: [slang-users] intrinsic curl_easy_escape sample Message-ID: <5b3fa8f0703071647s35db6f7ckdd51c0674f5ab517@mail.gmail.com> Here is an attempt with a known problem. curl_easy_escape actually mallocs for its returned string, which means this thing has a memory leak. I figure that means I need to turn it into a memory managed thing. What do you think of this? Also I don't know what the hashed strings are. Could you say a word about those? Here is the sample: static void escape_intrin (void) { SLang_MMT_Type *mmt; Easy_Type *ez; char *unescaped_string = NULL; char *esc_string = NULL; if (-1 == SLpop_string (&unescaped_string)) return; if (NULL == (mmt = pop_easy_type (&ez, 0))) return; esc_string = curl_easy_escape(ez->handle, unescaped_string, 0); if (esc_string == NULL) return; (void) SLang_push_string (esc_string); SLfree(unescaped_string); SLang_free_mmt (mmt); } From davis at space.mit.edu Wed Mar 7 22:06:31 2007 From: davis at space.mit.edu (John E. Davis) Date: Wed Mar 7 22:07:26 2007 Subject: [slang-users] intrinsic curl_easy_escape sample In-Reply-To: <5b3fa8f0703071647s35db6f7ckdd51c0674f5ab517@mail.gmail.com> References: <5b3fa8f0703071647s35db6f7ckdd51c0674f5ab517@mail.gmail.com> Message-ID: <200703080306.l2836VVl028332@aluche.mit.edu> Brian McQueen wrote: >Also I don't know what the hashed strings are. Could you say a word >about those? The function char *SLang_create_slstring (char *str) returns a copy of "str". It will create a new copy if it does not already have a copy of the string in an internal hash table. If a copy is in the hash table, it just returns a pointer to it and updates a reference count. Such strings have the property that they can be tested for equality by simply comparing the pointers: if (str0 == str1) .... That is, if str0 and str1 are known to be strings created in this manner, there is no need to call strcmp to test for equality. Also, such strings should be regarded as read-only--- do not modify the their contents. The function SLang_free_slstring (char *str) must be used to free the string. >static void escape_intrin (void) >{ > SLang_MMT_Type *mmt; > Easy_Type *ez; > char *unescaped_string = NULL; > char *esc_string = NULL; > > if (-1 == SLpop_string (&unescaped_string)) > return; Here, SLpop_string will return a malloced string--- not a hashed one. This is useful if you intend to modify the bytes of the string. From the docs, it seems that curl_easy_escape does not modify the string. If this is the case, it would be better to use if (-1 == SLang_pop_slstring (&unescaped_string)) return; > > if (NULL == (mmt = pop_easy_type (&ez, 0))) > return; There is a memory leak here. You want: if (NULL == (mmt = pop_easy_type (&ez, 0))) { SLfree (unescaped_string); /* if SLpop_string is used */ /* SLang_free_slstring (unescaped_string); */ return; } > esc_string = curl_easy_escape(ez->handle, unescaped_string, 0); > > if (esc_string == NULL) > return; This too exhibits the same memory leak. Also, you should generate an error. I would use: if (esc_string == NULL) { SLang_free_mmt (mmt); SLfree (unescaped_string); SLang_set_error (Curl_Error); return; } > (void) SLang_push_string (esc_string); > SLfree(unescaped_string); > SLang_free_mmt (mmt); Since esc_string returned by curl_easy_escape is malloced, you can use (void) SLang_push_malloced_string (esc_string); SLang_free_mmt (mmt); Here, SLang_push_malloced_string will also free the string. I hope this helps. Feel free to submit a patch for the curl-module once you have these functions working. Thanks, --John From mcqueenorama at gmail.com Thu Mar 8 01:04:24 2007 From: mcqueenorama at gmail.com (Brian McQueen) Date: Thu Mar 8 01:05:30 2007 Subject: [slang-users] curl_easy_unescape sample and problem Message-ID: <5b3fa8f0703072204t1fef79f5vf795706d2c47afd2@mail.gmail.com> Here is an unescape that works fine, but only on strings. I found a problem I didn't know how to solve when I tried to do unescape on more general input data. First I am not sure what form the input data wouldbe in - probably not a hashed string. Secondly I need to return both the malloced string and the length of the malloced string. Would I push two items back onto the stack? How would I grab them to use them through the interpreter? Here is the unescape sample. The escape one is also included. I'll make a patch of these when I'm happy with them: static void unescape_intrin (void) { SLang_MMT_Type *mmt; Easy_Type *ez; char *escaped_string = NULL; char *unescaped_string = NULL; if (-1 == SLang_pop_slstring (&escaped_string)) return; if (NULL == (mmt = pop_easy_type (&ez, 0))) { SLang_free_slstring(escaped_string); return; } unescaped_string = curl_easy_unescape(ez->handle, escaped_string, 0, NULL); if (unescaped_string == NULL) { SLang_free_mmt(mmt); SLang_free_slstring(escaped_string); SLang_set_error(Curl_Error); return; } (void) SLang_push_malloced_string (unescaped_string); SLang_free_slstring(escaped_string); SLang_free_mmt(mmt); } Here is a good curl_easy escape: static void escape_intrin (void) { SLang_MMT_Type *mmt; Easy_Type *ez; char *unescaped_string = NULL; char *escaped_string = NULL; if (-1 == SLang_pop_slstring (&unescaped_string)) return; if (NULL == (mmt = pop_easy_type (&ez, 0))) { SLang_free_slstring(unescaped_string); return; } escaped_string = curl_easy_escape(ez->handle, unescaped_string, 0); if (escaped_string == NULL) { SLang_free_mmt(mmt); SLang_free_slstring(unescaped_string); SLang_set_error(Curl_Error); return; } (void) SLang_push_malloced_string (escaped_string); SLang_free_slstring(unescaped_string); SLang_free_mmt(mmt); } From mcqueenorama at gmail.com Thu Mar 8 11:52:57 2007 From: mcqueenorama at gmail.com (Brian McQueen) Date: Thu Mar 8 11:54:41 2007 Subject: [slang-users] patch for curl_easy_escape and curl_easy_unescape Message-ID: <5b3fa8f0703080852w31917ecbybbb72d4b16d8df0c@mail.gmail.com> Is this a useful format for the patch? *** slcurl-0.1.2/src/curl-module.c Wed Feb 28 17:59:58 2007 --- slcurl/src/curl-module.c Wed Mar 7 21:55:22 2007 *************** *** 799,804 **** --- 799,864 ---- return -1; } + static void unescape_intrin (void) + { + SLang_MMT_Type *mmt; + Easy_Type *ez; + char *escaped_string = NULL; + char *unescaped_string = NULL; + + if (-1 == SLang_pop_slstring (&escaped_string)) + return; + + if (NULL == (mmt = pop_easy_type (&ez, 0))) { + SLang_free_slstring(escaped_string); + return; + } + + unescaped_string = curl_easy_unescape(ez->handle, escaped_string, 0, NULL); + + if (unescaped_string == NULL) { + SLang_free_mmt(mmt); + SLang_free_slstring(escaped_string); + SLang_set_error(Curl_Error); + return; + } + + (void) SLang_push_malloced_string (unescaped_string); + + SLang_free_slstring(escaped_string); + SLang_free_mmt(mmt); + + } + + static void escape_intrin (void) + { + SLang_MMT_Type *mmt; + Easy_Type *ez; + char *unescaped_string = NULL; + char *escaped_string = NULL; + + if (-1 == SLang_pop_slstring (&unescaped_string)) + return; + + if (NULL == (mmt = pop_easy_type (&ez, 0))) { + SLang_free_slstring(unescaped_string); + return; + } + + escaped_string = curl_easy_escape(ez->handle, unescaped_string, 0); + + if (escaped_string == NULL) { + SLang_free_mmt(mmt); + SLang_free_slstring(unescaped_string); + SLang_set_error(Curl_Error); + return; + } + + (void) SLang_push_malloced_string (escaped_string); + + SLang_free_slstring(unescaped_string); + SLang_free_mmt(mmt); + } static void setopt_intrin (void) { *************** *** 1446,1451 **** --- 1506,1513 ---- static SLang_Intrin_Fun_Type Module_Intrinsics [] = { MAKE_INTRINSIC_1("curl_new", new_curl_intrin, SLANG_VOID_TYPE, SLANG_STRING_TYPE), + MAKE_INTRINSIC_0("curl_easy_escape", escape_intrin, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("curl_easy_unescape", unescape_intrin, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("curl_setopt", setopt_intrin, SLANG_VOID_TYPE), MAKE_INTRINSIC_1("curl_global_init", global_init, SLANG_VOID_TYPE, SLANG_LONG_TYPE), MAKE_INTRINSIC_0("curl_global_cleanup", global_cleanup, SLANG_VOID_TYPE), From mcqueenorama at gmail.com Thu Mar 8 12:16:35 2007 From: mcqueenorama at gmail.com (Brian McQueen) Date: Thu Mar 8 12:18:40 2007 Subject: [slang-users] Fwd: translate patch In-Reply-To: <200703081709.l28H9n91029093@sdf.lonestar.org> References: <200703081709.l28H9n91029093@sdf.lonestar.org> Message-ID: <5b3fa8f0703080916s6e5a8d62v2e9af280c95fce4b@mail.gmail.com> Here is a patch for translate so it uses the new curl features. Its a bit of a shame to remove your cool encoder though. *** ./slcurl-0.1.2/demo/translate Wed Feb 28 17:59:58 2007 --- translate Thu Mar 8 09:07:12 2007 *************** *** 70,95 **** throw NotImplementedError, "Translating from $from to $to is not supported"$; } - - private define make_encode_table () - { - variable table = array_map (String_Type, &sprintf, ("%%%02X", [0:255])); - variable ok = [['A':'Z'], ['a':'z'], ['0':'9'], '.', '-', '*', '_', '/', '~']; - table[ok] = array_map (String_Type, &char, ok); - table[' '] = "+"; - return table; - } - private variable Encode_Table = make_encode_table (); - - private define encode (text) - { - variable len = strlen (text); - variable new_text = String_Type[len]; - variable i; - _for i (0, len-1, 1) - new_text[i] = Encode_Table[text[i]]; - return strjoin (new_text, ""); - } private define parse_output (str) { --- 70,75 ---- *************** *** 119,126 **** define babelfish (from, to, text) { variable c = curl_new ("http://babelfish.altavista.com/babelfish/tr?il=en"); variable postdata = ! strcat ("doit=done&urltext=", text, "&lp=", lookup_translation (from, to), "&Submit=Translate", "&enc=utf8"); --- 99,109 ---- define babelfish (from, to, text) { variable c = curl_new ("http://babelfish.altavista.com/babelfish/tr?il=en"); + + variable in_str = curl_easy_escape(c, text); + variable postdata = ! strcat ("doit=done&urltext=", in_str, "&lp=", lookup_translation (from, to), "&Submit=Translate", "&enc=utf8"); *************** *** 148,153 **** --- 131,137 ---- { variable lang_out = My_Language, lang_in = NULL; variable i = 1; + while (i < __argc) { variable arg = __argv[i]; *************** *** 179,186 **** text = ""; variable line; while (-1 != fgets (&line, stdin)) ! text = strcat (text, encode (line)); } message (babelfish (lang_in, lang_out, text)); } --- 163,171 ---- text = ""; variable line; while (-1 != fgets (&line, stdin)) ! text = strcat (text, line); } + message (babelfish (lang_in, lang_out, text)); } From davis at space.mit.edu Fri Mar 9 22:56:27 2007 From: davis at space.mit.edu (John E. Davis) Date: Fri Mar 9 22:58:10 2007 Subject: [slang-users] patch for curl_easy_escape and curl_easy_unescape In-Reply-To: <5b3fa8f0703080852w31917ecbybbb72d4b16d8df0c@mail.gmail.com> References: <5b3fa8f0703080852w31917ecbybbb72d4b16d8df0c@mail.gmail.com> Message-ID: <200703100356.l2A3uRlw011147@aluche.mit.edu> Brian McQueen wrote: >*** slcurl-0.1.2/src/curl-module.c Wed Feb 28 17:59:58 2007 >--- slcurl/src/curl-module.c Wed Mar 7 21:55:22 2007 I integrated the patch into the development snapshot of the module, which you can obtain from its svn repository at http://opensvn.csie.org/jedsoft/slang/modules/slcurl/trunk Thanks, --John From mcqueenorama at gmail.com Tue Mar 13 13:10:30 2007 From: mcqueenorama at gmail.com (Brian McQueen) Date: Tue Mar 13 13:12:29 2007 Subject: [slang-users] export an array of structs Message-ID: <5b3fa8f0703131110r285775d9q5d67476ddeee2d46@mail.gmail.com> I am able to gain access to my shm from the interpreter. But so far its only been to the really simple parts of my shm. One part of my shm is an array of structs. How do I make an array of structs available to the interpreter? Its application managed and of a fixed size. I tried this to get the very first element of the array, but I'm getting an error. The array really has about 10k elements. I thought with this I'd be able to see the first struct in the array, but I'm getting this error: Null_Type does not permit structure access ./site.sl:2::Not Implemented I think its due to the fact that the array is empty right now so its all zeroed out. But how would I export the entire array? I see a SLANG_ARRAY_TYPE, but how would I tell the interpreter the size of the array, because MAKE_ISTRUCT_FIELD seems to have no slot for array size? Here is what I've tried in order to get a peek at the first element of the array of structs: static SLang_IStruct_Field_Type slang_struct_array_in_shm [] = { MAKE_ISTRUCT_FIELD(post_req_t, value1, "value1", SLANG_ULLONG_TYPE, 1), MAKE_ISTRUCT_FIELD(post_req_t, total_num, "total_size", SLANG_ULLONG_TYPE, 1), MAKE_ISTRUCT_FIELD(post_req_t, cur_num, "cur_size", SLANG_ULLONG_TYPE, 1), MAKE_ISTRUCT_FIELD(post_req_t, rtime, "max_time", SLANG_ULLONG_TYPE, 1), SLANG_END_ISTRUCT_TABLE }; if (-1 == SLadd_istruct_table (slang_struct_array_in_shm, (VOID_STAR) &shm_ptr->my_struct_array[0], "my_array_item")) exit (1); I try to get it through the interpreter like this: () = printf("struct 1:value1:%llu:\n", my_array_item.value1); From davis at space.mit.edu Wed Mar 14 19:47:40 2007 From: davis at space.mit.edu (John E. Davis) Date: Wed Mar 14 19:48:58 2007 Subject: [slang-users] export an array of structs In-Reply-To: <5b3fa8f0703131110r285775d9q5d67476ddeee2d46@mail.gmail.com> References: <5b3fa8f0703131110r285775d9q5d67476ddeee2d46@mail.gmail.com> Message-ID: <200703150047.l2F0leTn007873@aluche.mit.edu> Brian McQueen wrote: >I am able to gain access to my shm from the interpreter. But so far >its only been to the really simple parts of my shm. One part of my >shm is an array of structs. How do I make an array of structs >available to the interpreter? Its application managed and of a fixed >size. I tried this to get the very first element of the array, but Instead of trying to map the array of structs directly onto slang arrays, have you considered creating simple functions that are callable from the interpreter to access the array? I think that in the end this simpler choice will also turn out to be more robust if you were to change the internal representation. >Here is what I've tried in order to get a peek at the first element of >the array of structs: > >static SLang_IStruct_Field_Type slang_struct_array_in_shm [] = { > MAKE_ISTRUCT_FIELD(post_req_t, value1, "value1", SLANG_ULLONG_TYPE, 1), > MAKE_ISTRUCT_FIELD(post_req_t, total_num, "total_size", >SLANG_ULLONG_TYPE, 1), > MAKE_ISTRUCT_FIELD(post_req_t, cur_num, "cur_size", SLANG_ULLONG_TYPE, 1), > MAKE_ISTRUCT_FIELD(post_req_t, rtime, "max_time", SLANG_ULLONG_TYPE, 1), > SLANG_END_ISTRUCT_TABLE >}; If each element of the array consists of unsigned long long values, then I would create a function that returns the ith element of the array as a slang structure. For example, suppose your code defines the structure typedef struct { post_req_t rtime; post_req_t cur_num; . . } Foo_Type and an array of NUM of them: #define NUM_FOOS 512 Foo_Type My_Foos[NUM_FOOS]; Then use: SLang_CStruct_Field_Type My_Foo_Fields [] = { MAKE_CSTRUCT_FIELD(Foo_Type, rtime, "max_time", SLANG_ULLONG_TYPE, 0), MAKE_CSTRUCT_FIELD(Foo_Type, cur_num, "cur_size", SLANG_ULLONG_TYPE, 0), . . SLANG_END_CSTRUCT_TABLE }; static void get_foo (int *ip) { Foo_Type *foop; if ((*ip < 0) || (*ip >= NUM_FOOS)) { SLang_set_error (SL_InvalidParm_Error); return; } foop = &Array_of_Foos[*ip]; SLang_push_cstruct ((VOID_STAR) foop, My_Foo_Fields); } static void set_foo (int *ip) { Foo_Type *foop; if ((*ip < 0) || (*ip >= NUM_FOOS)) { SLang_set_error (SL_InvalidParm_Error); return; } foop = &Array_of_Foos[*ip]; (void) SLang_pop_cstruct ((VOID_STAR) foop, My_Foo_Fields); } Then add these functions as slang intrinsics using lines such as MAKE_INTRINSIC_0("get_foo", get_foo, SLANG_VOID_TYPE, SLANG_INT_TYPE), MAKE_INTRINSIC_0("set_foo", set_foo, SLANG_VOID_TYPE, SLANG_INT_TYPE), in your intrinsic table. Then from the interpreter you should be able to get, say the 10th element of your array using s = get_foo (10); and set the the max_time field using s.max_time = whatever; set_foo (s, 10); The advantage of this approach is that it gives you flexibility for future changes to the underlying data structures. I hope this idea is clear. Thanks, --John From ptsekov at gmx.net Fri Apr 20 17:29:59 2007 From: ptsekov at gmx.net (Pavel Tsekov) Date: Fri Apr 20 17:32:15 2007 Subject: [slang-users] Re: mc sets process group differently from shell; forgets to close fd# 3 In-Reply-To: <200704202142.07098.vda.linux@googlemail.com> References: <200704202142.07098.vda.linux@googlemail.com> Message-ID: On Fri, 20 Apr 2007, Denis Vlasenko wrote: > Hi mc people, > > If you compile and run the following program > under shell and under mc... > > #include > #include > #include > #include > #include > int main(int argc, char **argv) > { > int i, numfd = open("/dev/null", O_RDONLY); > > printf("pid=%d\n", getpid()); > printf("ppid=%d\n", getppid()); > printf("tty_pgrp=%d\n", (int)tcgetpgrp(0)); > printf("task_pgrp=%d\n", (int)getpgrp()); > for (i = 0; i < numfd; i++) { > printf("fd# %d: '%s'\n", i, ttyname(i)); > } > return 0; > } > > you will see the following: > > bash-3.2# ./z > pid=8183 > ppid=8181 > tty_pgrp=8183 <========== child is in its own process group > task_pgrp=8183 <========== > fd# 0: '/dev/pts/4' > fd# 1: '/dev/pts/4' > fd# 2: '/dev/pts/4' > > bash-3.2# echo $$ ; exec mc > 8181 > > # ./z > pid=8212 > ppid=8181 > tty_pgrp=8181 <========== child is in mc's process group > task_pgrp=8181 <========== child is in mc's process group > fd# 0: '/dev/pts/4' > fd# 1: '/dev/pts/4' > fd# 2: '/dev/pts/4' > fd# 3: '/dev/tty' <=== ??! [...] > Big one (actually, I think it's a bug): stray fd# opened > to controlling terminal. The descriptor to /dev/tty is created by S-Lang in SLang_init_tty(). Maybe it would make sense to mark it FD_CLOEXEC ? Thanks! From ptsekov at gmx.net Sat Apr 21 04:56:06 2007 From: ptsekov at gmx.net (Pavel Tsekov) Date: Sat Apr 21 04:58:26 2007 Subject: [slang-users] Re: mc sets process group differently from shell; forgets to close fd# 3 In-Reply-To: <200704210233.45745.vda.linux@googlemail.com> References: <200704202142.07098.vda.linux@googlemail.com> <200704210233.45745.vda.linux@googlemail.com> Message-ID: On Sat, 21 Apr 2007, Denis Vlasenko wrote: > On Friday 20 April 2007 23:29, Pavel Tsekov wrote: >>> Big one (actually, I think it's a bug): stray fd# opened >>> to controlling terminal. >> >> The descriptor to /dev/tty is created by S-Lang in SLang_init_tty(). >> Maybe it would make sense to mark it FD_CLOEXEC ? > > Absolutely. We could do this in MC itself but I wonder if there is any reason why this isn't done in S-Lang. Maybe the S-Lang developer could shed some light ? From davis at space.mit.edu Sat Apr 21 13:08:44 2007 From: davis at space.mit.edu (John E. Davis) Date: Sat Apr 21 13:09:34 2007 Subject: [slang-users] Re: mc sets process group differently from shell; forgets to close fd# 3 In-Reply-To: References: <200704202142.07098.vda.linux@googlemail.com> <200704210233.45745.vda.linux@googlemail.com> Message-ID: <200704211708.l3LH8ifL004554@aluche.mit.edu> Pavel Tsekov wrote: >We could do this in MC itself but I wonder if there is any >reason why this isn't done in S-Lang. Maybe the S-Lang developer >could shed some light ? I will look into the ramifications of the flag and if it looks ok, the flag will be applied to the descriptor in the upcoming 2.1.0 release. Thanks, --John From ptsekov at gmx.net Sat Apr 21 14:52:38 2007 From: ptsekov at gmx.net (Pavel Tsekov) Date: Sat Apr 21 14:55:33 2007 Subject: [slang-users] Re: mc sets process group differently from shell; forgets to close fd# 3 In-Reply-To: <200704211708.l3LH8ifL004554@aluche.mit.edu> References: <200704202142.07098.vda.linux@googlemail.com> <200704210233.45745.vda.linux@googlemail.com> <200704211708.l3LH8ifL004554@aluche.mit.edu> Message-ID: On Sat, 21 Apr 2007, John E. Davis wrote: > Pavel Tsekov wrote: >> We could do this in MC itself but I wonder if there is any >> reason why this isn't done in S-Lang. Maybe the S-Lang developer >> could shed some light ? > > I will look into the ramifications of the flag and if it looks ok, the > flag will be applied to the descriptor in the upcoming 2.1.0 release. Thanks, John! Please, drop a note so that we know of your decision. From davis at space.mit.edu Thu Apr 26 18:38:35 2007 From: davis at space.mit.edu (John E. Davis) Date: Thu Apr 26 18:39:27 2007 Subject: [slang-users] A new release of the slang cfitsio module Message-ID: <200704262238.l3QMcZqT028629@aluche.mit.edu> A new version of the cfitsio module for the slang interpreter has been released. The module was written to facilitate the manipulation of fits files from within a slang interpretive environment such as that provided by slsh or isis. More information about the module and extensive documentation may be found at . Users of the isis spectral modeling program should note that the module already comes bundled with isis. More information about isis is available from . Thanks, --John From joerg at alea.gnuu.de Sat Apr 28 10:39:11 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Sat Apr 28 16:16:06 2007 Subject: [slang-users] Why #if leaves a value on stack? Message-ID: Hi, % slsh slsh> () = evalfile("stkcheck"); slsh> enable_stack_check(); slsh> 1; :3: 1 object(s) left on the stack 1 slsh> #if (1) ***string***:1: 1 object(s) left on the stack slsh> message("bla"); bla slsh> #endif How can I circumvent this? Bye, J?rg. -- Computer Science is no more about Computers than astronomy is about telescopes. (Edsger Wybe Dijkstra) From joerg at alea.gnuu.de Sat Apr 28 17:40:00 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Sat Apr 28 17:44:08 2007 Subject: [slang-users] need to send signals two times Message-ID: Hi, variable quit = 0; define sig_handler(sig) { quit = 1; message("got signal $sig"$); } signal(SIGHUP, &sig_handler); signal(SIGINT, &sig_handler); signal(SIGQUIT, &sig_handler); variable fifo_name = "/tmp/jed.latex." + string(getpid()); if (mkfifo(fifo_name, 0600) != 0) throw ApplicationError, "Could not create FIFO"; message(fifo_name); try { message("before fopen"); variable fifo = fopen(fifo_name, "r"); message("after fopen"); if (quit) { if (fifo != NULL) fclose(fifo); break; } } finally () = remove(fifo_name); run it with slsh /tmp/test.sl and hit ^C. At me, I have to hit a second time ^C to get the output ?got signal 2?. % slsh --version slsh version 0.7.5-0 S-Lang Library Version: 2.0.6 Bye, J?rg. -- Mancher Hahn meint, dass die Sonne seinetwegen aufgeht. (Theodor Fontane) From davis at space.mit.edu Sat Apr 28 19:11:17 2007 From: davis at space.mit.edu (John E. Davis) Date: Sat Apr 28 19:12:10 2007 Subject: [slang-users] need to send signals two times In-Reply-To: References: Message-ID: <200704282311.l3SNBHMv011158@aluche.mit.edu> =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >run it with slsh /tmp/test.sl and hit ^C. At me, I have to hit a second >time ^C to get the output ???got signal 2???. The problem is that the "signal" intrinsic established the signal in such a way that system calls were restarted. When the signal fired, the handler implicitly set the signal disposition to interrupt the system call. This is why the second ^C caused the fopen to be interrupted. In any case, the latest version in the svn repository corrects this behavior by setting the disposition to always interrupt system calls. Incidently, you might find it interesting to compare the slsh version with the corresponding C version, which is appended below. Thanks, --John #include #include #include #include #include #include #include static int quit = 0; static void sig_handler (int sig) { (void) sig; quit++; } int main (int argc, char **argv) { char *fifo_name = "/tmp/testfifo"; FILE *fp; signal(SIGHUP, &sig_handler); signal(SIGINT, &sig_handler); signal(SIGQUIT, &sig_handler); if (mkfifo(fifo_name, 0600) != 0) { (void) fprintf (stderr, "Could not create FIFO\n"); exit (1); } (void) fprintf (stdout, "before fopen\n"); fp = fopen(fifo_name, "r"); (void) fprintf (stdout, "after fopen\n"); if (quit) (void) fprintf (stderr, "quit=%d, fp=%p\n", quit, (void*)fp); if (fp != NULL) (void) fclose (fp); (void) remove(fifo_name); return 0; } From joerg at alea.gnuu.de Sun Apr 29 07:47:45 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Sun Apr 29 08:18:20 2007 Subject: [slang-users] Re: need to send signals two times References: <200704282311.l3SNBHMv011158@aluche.mit.edu> Message-ID: Hallo John, "John E. Davis" wrote: > =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >>run it with slsh /tmp/test.sl and hit ^C. At me, I have to hit a second >>time ^C to get the output ???got signal 2???. > > The problem is that the "signal" intrinsic established the signal in > such a way that system calls were restarted. When the signal fired, > the handler implicitly set the signal disposition to interrupt the > system call. This is why the second ^C caused the fopen to be > interrupted. In any case, the latest version in the svn repository > corrects this behavior by setting the disposition to always interrupt > system calls. Does jed (and jed-script) suffer from the same problem? This explains, why my process doesn't read and quit. I think the return from fopen() and the SIGHUP happen nearly at the same time or the return from fopen() a little bit before. So the fopen() is suspended again, but nobody ever does open the pipe. > Incidently, you might find it interesting to compare the slsh version > with the corresponding C version, which is appended below. Do you mean the C code look nearly the same as the SLang code? Bye, J?rg. -- Macht besitzen und nicht aus?ben ist wahre Gr??e. (Friedl Beutelrock) From davis at space.mit.edu Sun Apr 29 12:30:52 2007 From: davis at space.mit.edu (John E. Davis) Date: Sun Apr 29 12:31:25 2007 Subject: [slang-users] Re: need to send signals two times In-Reply-To: References: <200704282311.l3SNBHMv011158@aluche.mit.edu> Message-ID: <200704291630.l3TGUqQ1028304@aluche.mit.edu> =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >Does jed (and jed-script) suffer from the same problem? This explains, >why my process doesn't read and quit. I think the return from fopen() and >the SIGHUP happen nearly at the same time or the return from fopen() a >little bit before. So the fopen() is suspended again, but nobody ever >does open the pipe. If you can tell me what you want to happen, I may be able to make other suggestions. Do you want the fopen to block until a signal has been received? Do you want SIGHUP to cause the process to exit? >> Incidently, you might find it interesting to compare the slsh version >> with the corresponding C version, which is appended below. > >Do you mean the C code look nearly the same as the SLang code? It is nearly identical but SIGINT or SIGHUP do not cause the fopen to be interrupted. This is because the default signal disposition is to restart the system calls. Thanks, --John From davis at space.mit.edu Sun Apr 29 14:39:39 2007 From: davis at space.mit.edu (John E. Davis) Date: Sun Apr 29 14:40:28 2007 Subject: [slang-users] Re: need to send signals two times In-Reply-To: References: <200704282311.l3SNBHMv011158@aluche.mit.edu> Message-ID: <200704291839.l3TIddKN030224@aluche.mit.edu> =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >Does jed (and jed-script) suffer from the same problem? This explains, >why my process doesn't read and quit. I think the return from fopen() and >the SIGHUP happen nearly at the same time or the return from fopen() a >little bit before. So the fopen() is suspended again, but nobody ever >does open the pipe. I also think that it is useful to point out that the slang stdio functions (fopen, fputs, fgets, ...) are wrappers around the corresponding C library functions. Unfortunately, the behavior of the C library stdio functions in the presence of signals is poorly defined. For example, consider the C library fputs function. This function writes a string to a file descriptor. It returns EOF upon error, and a non-negative integer upon sucess. In particular, it may not may not return the number of characters sucessfully written, and the non-negative value 0 is a perfectly acceptable return value from this function. What happens if the underlying low-level write function was interrupted by a signal whose disposition was set to not to restart system calls? The fputs function may have written out some of the bytes but not all of them but the ambiguity of the return value does not permit the exact number written to be determined in a portable manner. As a result, a file may become corrupted because information has been lost and there is no portable way to recover from this situation. For reasons such as this, I do not trust nor would use the stdio functions for mission-critical operations. Instead, use the lower-level read/write functions since they have well defined behaviors in the presence of signals. --John From davis at space.mit.edu Sun Apr 29 15:35:20 2007 From: davis at space.mit.edu (John E. Davis) Date: Sun Apr 29 15:36:28 2007 Subject: [slang-users] need to send signals two times In-Reply-To: References: Message-ID: <200704291935.l3TJZKja031142@aluche.mit.edu> Here is version of your script that uses open/close: # slsh /tmp/foo.sl before open -- press ^C got signal 2 caught SignalError removing fifo % foo.sl variable quit = 0; new_exception ("SignalError", RunTimeError, "Signal Error"); define sig_handler(sig) { quit++; message("got signal $sig"$); throw SignalError; } define slsh_main () { signal(SIGHUP, &sig_handler); signal(SIGINT, &sig_handler); signal(SIGQUIT, &sig_handler); variable fifo_name = "/tmp/jed.latex." + string(getpid()); if (mkfifo(fifo_name, 0600) != 0) throw ApplicationError, "Could not create FIFO"; try { message("before open -- press ^C"); variable fifo = open(fifo_name, O_RDONLY); message("after open"); if (quit) { message ("quit=$quit, fifo=$fifo"$); if (fifo != NULL) ()=close(fifo); break; } } catch SignalError: message ("caught SignalError"); finally { message ("removing fifo"); () = remove(fifo_name); } } From joerg at alea.gnuu.de Sun Apr 29 15:06:16 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Sun Apr 29 18:35:30 2007 Subject: [slang-users] Re: need to send signals two times References: <200704282311.l3SNBHMv011158@aluche.mit.edu> <200704291630.l3TGUqQ1028304@aluche.mit.edu> Message-ID: Hello John, "John E. Davis" wrote: > =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >>Does jed (and jed-script) suffer from the same problem? This explains, >>why my process doesn't read and quit. I think the return from fopen() and >>the SIGHUP happen nearly at the same time or the return from fopen() a >>little bit before. So the fopen() is suspended again, but nobody ever >>does open the pipe. > > If you can tell me what you want to happen, I may be able to make > other suggestions. I want to spawn a process latex_comm with open_process (in jed) that creates a fifo and goes into an endless loop of opening, reading and closing the pipe until it sees the string 'quit'. Than it leaves the loop, removes the pipe and quits. http://www.minet.uni-jena.de/~joergs/jjm/latex_comm.sl The main process (jed) spawns a second process xdvi. xdvi writes infos to the pipe of latex_comm and instructs this way the main process to switch to a line and/or buffer. Upon quit of jed the subprocess latex_comm should also stop. To do this, jed writes 'quit' into the pipe. But if this is the last thing jed does latex_comm gets a SIGHUP at the "same time" its fopen() call returns. So the fopen() is reseted and the process stays alive, while its parent is gone. > Do you want the fopen to block until a signal has been received? Do > you want SIGHUP to cause the process to exit? No, it should not quit upon SIGHUP. It must remove the pipe. Bye, J?rg. -- Der Wunsch, klug zu erscheinen, verhindert oft, es zu werden. (Francois de la Rochefoucauld) From joerg at alea.gnuu.de Mon May 14 06:22:26 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Mon May 14 08:12:49 2007 Subject: [slang-users] Version compare Message-ID: Hi, I want to add a workaround for SLang version before pre2.0.7-21. But how do I check for those version? #if (orelse {_slang_version < 20007} {_slang_version == 20007 and strcmp(_slang_version_string, "pre", 3) == 0)}) workaround(); #else real_code(); #endif The whole version checking is very ugly, because "2.0.7" < "pre2.0.7" and "pre2.0.7-4" > "pre2.0.7-21". It would be nice to have a _slang_pre_version that contains the prerelease version number: e.g. for pre2.0.7-21 _slang_version is 20007 and _slang_pre_version is 21. But how can I check with the current versioning scheme for pre2.0.7-21? Bye, J?rg. -- Erfahrung hei?t gar nichts. Man kann seine Sache auch 35 Jahre schlecht machen. (Kurt Tucholsky) From davis at space.mit.edu Mon May 14 12:55:45 2007 From: davis at space.mit.edu (John E. Davis) Date: Mon May 14 12:56:54 2007 Subject: [slang-users] Version compare In-Reply-To: References: Message-ID: <200705141655.l4EGtj7r007380@aluche.mit.edu> =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >I want to add a workaround for SLang version before pre2.0.7-21. But how >do I check for those version? I would not bother worrying about "pre" releases since they reflect snapshots that one has taken from SVN repository and do not represent an announced release. Nevertheless if your want to include this possibility in your test, you should create a function to perform the comparision and use that, e.g., #if (slang_version_lt("pre2.0.7-4")) workaround (); #else real_code (); #endif Here slang_version_lt is defined as follows: private define parse_slang_version (v) { variable major, minor, patch, pre; if (4 == sscanf (v, "pre%d.%d.%d-%d", &major, &minor, &patch, &pre)) return (major, minor, patch, pre); if (3 != sscanf (v, "%d.%d.%d", &major, &minor, &patch)) throw InternalError, "Unexpected version number format"; return major, minor, patch, 0; } % Returns < 0 if _slang_version < version % == 0 if _slang_version == version % > 0 if _slang_version > version define slang_version_cmp (version) { variable maj0, min0, pat0, pre0; variable maj1, min1, pat1, pre1; (maj0, min0, pat0, pre0) = parse_slang_version (_slang_version_string); (maj1, min1, pat1, pre1) = parse_slang_version (version); variable v0 = maj0*10000 + min0*100 + pat0; variable v1 = maj1*10000 + min1*100 + pat1; if (v0 != v1) return v0 - v1; if (pre0 == 0) return 1; if (pre1 == 0) return -1; return pre0 - pre1; } define slang_version_lt (version) { return slang_version_cmp (version) < 0; } define slang_version_le (version) { return slang_version_cmp (version) <= 0; } define slang_version_gt (version) { return slang_version_cmp (version) > 0; } define slang_version_ge (version) { return slang_version_cmp (version) >= 0; } --John From mlichvar at redhat.com Tue May 15 10:46:23 2007 From: mlichvar at redhat.com (Miroslav Lichvar) Date: Tue May 15 10:47:15 2007 Subject: [slang-users] Memory leak in SLtt_get_terminfo Message-ID: <20070515144623.GB27773@localhost> Hi, a memory leak occurs when SLtt_get_terminfo function is called repeatedly as data allocated in _pSLtt_tigetent are lost. Attached is a patch that deletes the old entry when a new entry is requested, that should at least keep the size of the leak constant. -- Miroslav Lichvar -------------- next part -------------- Index: src/sldisply.c =================================================================== --- src/sldisply.c (revision 116) +++ src/sldisply.c (working copy) @@ -2374,6 +2374,8 @@ || !strcmp (term, "screen")); # ifndef USE_TERMCAP + if (NULL != Terminfo) + _pSLtt_tifreeent (Terminfo); if (NULL == (Terminfo = _pSLtt_tigetent (term))) { if (almost_vtxxx) /* Special cases. */ Index: src/sltermin.c =================================================================== --- src/sltermin.c (revision 116) +++ src/sltermin.c (working copy) @@ -347,6 +347,16 @@ return NULL; } +void _pSLtt_tifreeent (SLterminfo_Type *t) +{ + SLfree ((char *)t->string_table); + SLfree ((char *)t->string_offsets); + SLfree ((char *)t->numbers); + SLfree ((char *)t->boolean_flags); + SLfree ((char *)t->terminal_names); + SLfree ((char *)t); +} + #ifdef SLANG_UNTIC # define UNTIC_COMMENT(x) ,x #else From wich at stack.nl Wed May 23 08:12:06 2007 From: wich at stack.nl (Remko van der Vossen) Date: Wed May 23 08:13:01 2007 Subject: [slang-users] const char* argument in functions like SLsmg_write_nstring Message-ID: <20070523121206.GL24191@wichetael.dyndns.org> Hello everyone, Why are the string arguments of functions like SLsmg_write_nstring not of type const char* but of type char*? This makes it quite annoying to write strings from a C++ std::string with its c_str() member function as this returns a const char*. Furthermore I see no reason whatsoever why SLsmg_write_nstring and the likes should not use const char* type, save for internal variables being of unsigned char* type which is easily solvable and for SLutf8_skip_chars taking unsigned char* instead of const unsigned char* which should also be changed in my opinion. Taking $type instead of const $type only limits the possible inputs of the function when it is not necessary. As such I think it would be an improvement if this was changed. Regards, Remko van der Vossen -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.jedsoft.org/pipermail/slang-users-l/attachments/20070523/73f05ad8/attachment.bin From davis at space.mit.edu Wed May 23 12:43:47 2007 From: davis at space.mit.edu (John E. Davis) Date: Wed May 23 12:44:05 2007 Subject: [slang-users] const char* argument in functions like SLsmg_write_nstring In-Reply-To: <20070523121206.GL24191@wichetael.dyndns.org> References: <20070523121206.GL24191@wichetael.dyndns.org> Message-ID: <200705231643.l4NGhlud003776@aluche.mit.edu> Remko van der Vossen wrote: >Why are the string arguments of functions like SLsmg_write_nstring not >of type const char* but of type char*? This makes it quite annoying to The main reason is that slang dates from a time when not all compilers supported the const keyword. Moreover, at that time autoconf did not exist or if it did, it was not in wide-spread usage. Hence, the most portable solution was to avoid using const. I will revisit this issue for slang 3 -- until then you will have to use a typecast. --John From wich at stack.nl Wed May 23 16:29:30 2007 From: wich at stack.nl (Remko van der Vossen) Date: Wed May 23 16:30:09 2007 Subject: [slang-users] const char* argument in functions like SLsmg_write_nstring In-Reply-To: <200705231643.l4NGhlud003776@aluche.mit.edu> References: <20070523121206.GL24191@wichetael.dyndns.org> <200705231643.l4NGhlud003776@aluche.mit.edu> Message-ID: <20070523202930.GQ24191@wichetael.dyndns.org> On Wed, May 23, 2007 at 12:43:47PM -0400, John E. Davis wrote: > Remko van der Vossen wrote: > >Why are the string arguments of functions like SLsmg_write_nstring not > >of type const char* but of type char*? This makes it quite annoying to > > The main reason is that slang dates from a time when not all > compilers supported the const keyword. Moreover, at that time There exist(ed) compilers which do not support the const keyword? I would say such compiler would be broken by design... > autoconf did not exist or if it did, it was not in wide-spread usage. > Hence, the most portable solution was to avoid using const. The relation to autoconf escapes me, but then again, I know nothing about auto* anyway... > I will revisit this issue for slang 3 -- until then you will have to > use a typecast. Any ideas on when this would be available? Regards, Remko van der Vossen. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.jedsoft.org/pipermail/slang-users-l/attachments/20070523/21bb173f/attachment.bin From joerg at alea.gnuu.de Fri May 25 05:10:47 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Fri May 25 06:02:45 2007 Subject: [slang-users] Re: const char* argument in functions like SLsmg_write_nstring References: <20070523121206.GL24191@wichetael.dyndns.org> <200705231643.l4NGhlud003776@aluche.mit.edu> Message-ID: Hallo John, "John E. Davis" wrote: > Remko van der Vossen wrote: >>Why are the string arguments of functions like SLsmg_write_nstring not >>of type const char* but of type char*? This makes it quite annoying to > > The main reason is that slang dates from a time when not all > compilers supported the const keyword. Moreover, at that time > autoconf did not exist or if it did, it was not in wide-spread usage. > Hence, the most portable solution was to avoid using const. > > I will revisit this issue for slang 3 -- until then you will have to > use a typecast. Why not introduce a new configure option --enable-const and make the changes in SLang 2? In SLang 3 you can change the default from --disable-const to --enable-const and everyone with a broken compiler can still use SLang. Bye, J?rg. -- Was der Bauer nicht kennt, das frisst er nicht. W?rde der St?dter kennen, was er frisst, er w?rde umgehend Bauer werden. Oliver Hassencamp From davis at space.mit.edu Sat May 26 02:28:21 2007 From: davis at space.mit.edu (John E. Davis) Date: Sat May 26 02:29:00 2007 Subject: [slang-users] Re: const char* argument in functions like SLsmg_write_nstring In-Reply-To: References: <20070523121206.GL24191@wichetael.dyndns.org> <200705231643.l4NGhlud003776@aluche.mit.edu> Message-ID: <200705260628.l4Q6SLp2009867@aluche.mit.edu> =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >Why not introduce a new configure option --enable-const and make the >changes in SLang 2? In SLang 3 you can change the default from >--disable-const to --enable-const and everyone with a broken compiler can >still use SLang. I am not worried about such compilers being in use anymore. However, I do not want to modify the slang-2 API at this point. I may add additional functionality to the API, but I will not change what is there. Keep in mind that making changes such as "char *" -> "const char *" in slang.h is more than cosmetic. It would require additional typecasts to the underlying functions that could ripple throughout the library. Such a big change will have to wait until the next major release. Right now I am preparing for the upcoming slang 2.1 release, which is a minor release. --John From davis at space.mit.edu Sat May 26 02:36:48 2007 From: davis at space.mit.edu (John E. Davis) Date: Sat May 26 02:37:01 2007 Subject: [slang-users] const char* argument in functions like SLsmg_write_nstring Message-ID: <200705260636.l4Q6amHG009928@aluche.mit.edu> On Wed, 23 May 2007 22:29:30 +0200, Remko van der Vossen said: >> The main reason is that slang dates from a time when not all >> compilers supported the const keyword. Moreover, at that time > >There exist(ed) compilers which do not support the const keyword? I would >say such compiler would be broken by design... I have used Ultrix compilers that were not 100 percent ANSI compliant. While those compilers provided some support for function prototypes, the const keyword was not supported. >> autoconf did not exist or if it did, it was not in wide-spread usage. >> Hence, the most portable solution was to avoid using const. > >The relation to autoconf escapes me, but then again, I know nothing >about auto* anyway... When you run "configure" to build the source code, the script probes your system to see what libraries exist, what compiler options and features are available, etc. Prior to autoconf, it was necessary for the installer to edit makefiles, use OS-specific makefiles, etc. >> I will revisit this issue for slang 3 -- until then you will have to >> use a typecast. > >Any ideas on when this would be available? I have no idea. I am still working on version 2. --John From p.boekholt at gmail.com Sat May 26 11:31:20 2007 From: p.boekholt at gmail.com (Paul Boekholt) Date: Sat May 26 11:32:09 2007 Subject: [slang-users] slsqlite 1.2 Message-ID: Hello, Version 1.2 of slsqlite is out. Slsqlite is a module to use SQLite, the embedded database (http://sqlite.org), with S-Lang. This version adds support for placeholders - that is prepared statement syntax like sqlite_exec(db, "delete from items where feed = ?", feed). You can get it from http://www.cheesit.com/downloads/slang/slsqlite/ From davis at space.mit.edu Mon May 28 17:41:04 2007 From: davis at space.mit.edu (John E. Davis) Date: Mon May 28 17:42:03 2007 Subject: [slang-users] slang 2.1.0 released Message-ID: <200705282141.l4SLf4s4004448@aluche.mit.edu> Version 2.1.0 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: 65d79b966e60e9b3cf9249a678f4c9d7 2.0.7__2.1.0.diff.bz2 f3ceadfa533530de9ce3121c1903f832 2.0.7__2.1.0.diff.bz2.sig 659be912427adba3649da7edd79853fe 2.0.7__2.1.0.diff.gz 02379ea006faf1e17629421618076063 2.0.7__2.1.0.diff.gz.sig dd390256bf7e3b47c03248ea71993c34 changes.txt eecc51a998467c22dc17e95859b343f9 changes.txt.sig f542820c19c0cfb815b46bcd7b1784f2 slang-2.1.0.tar.bz2 1292f73054f64fa24b2bc76e87a46fed slang-2.1.0.tar.bz2.sig 451f341b271a81bf9027031b4cfd2acf slang-2.1.0.tar.gz bfd89a4363145c9e51aa0d8b4a387e45 slang-2.1.0.tar.gz.sig This version contains a number of significant new features-- see below for what's new. Version 2.1.0 is binary compatible with previous slang-2 versions. Enjoy. --John NEWS for version 2.1 Building the library ==================== `make install' installs the shared version of the library. Previously `make install' installed just the static version and a separate step (`make install-elf') was required to install the shared version. Now, `make install-static' is necessary to install the static one. Interpreter News ================= Syntax enhancements: -------------------- 1. Short circuiting boolean operators: if ((x == y) || (y == 3) && (x != 4)) ... (orelse and andelse are deprecated) 2. Structure definitions allow embdedded assignment expressions: s = struct {x = 3, name="foo", a = [1:10]}; 3. Qualifiers (aka "keywords") added to the language: save_file ("foo.c"; overwrite=1); plot_points ([1:10], sin([1:10]); color="red", style="solid"); 3. Expressions such as (a < b < c) now interpreted to mean (a Ok, I have installed the 2.1 version and now Am having problems with my SLAG project.. > slsh menu.sl Produces the following : Module /usr/lib/slang/v2/modules/slagmenu-module.so is incompatible with this version of S-Lang Traceback: import ./menu.sl:6::Import Error The compile script for the Menu module: #!/bin/sh # # clear cc -o slagmenu-module.so -shared -fPIC -l slang -I ../include \ appmenu.c utils.c quickselect.c \ -L/usr/lib -lslang -ldl -lm cp -av slagmenu-module.so /usr/lib/slang/v2/modules The start of the Program: % A TEst menu Case % Add traceback Debug Flags _debug_info = 1; _traceback = 1; import ("slagmenu", "Global") ; ............ ................ ANY Ideas ? -- 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 mnoble at space.mit.edu Wed May 30 11:34:24 2007 From: mnoble at space.mit.edu (Michael Noble) Date: Wed May 30 11:35:34 2007 Subject: [slang-users] SLIRP 1.9.3: multicore parallelization with OpenMP Message-ID: <20070530153424.GA25425@svoboda.mit.edu> Version 1.9.3 of the SLIRP module generator for S-Lang is now available at http://space.mit.edu/cxc/slirp/ The most noteworthy feature added of late is parallelization support for multicore / multiprocessor systems. When the -openmp switch is used vectorized codes will be generated with OpenMP pragmas and automatically parallelized by OpenMP-enabled compilers. This feature was actually added in version 1.9.2 in late March, but I neglected to announce it here. The changelog entries for both versions are given below. Best, Mike Noble ------------ ------------------------------------ SLIRP: The S-Lang Interface Package Change Log mnoble@space.mit.edu ------------------------------------ Changes in v1.9.3 1. New -debug option for using S-Lang debugger (S-Lang 2 only) 2. Improved parsing of uncommon const usages in argument type decls. 3. Ensure -vec flag is reflected in generated Makefiles 4. Don't alloc return value in vectorized wrappers before validating input Changes in v1.9.2 1. Vectorized code may be parallelized for multiprocessors with -openmp (requires OpenMP >= 2.0 support in compiler). See examples/openmp. 2. Propagate C/C++ PIC compile flags to Fortran codes, too 3. Detect whether fortran compiler properly handles list-directed I/O with commas, and cause regression test to fail if not 4. Generated Makefiles: . should now work by default on wider set of mixed FORTRAN/C/C++ scenarios (issue reported by dmaitra at science dot uva dot nl) . now include install: and uninstall: targets . use chcon tool, when available, to avoid potential SELinux obstacles when loading generated modules. 5. Streamlined configure compiler variable settings (watch for breakage!) 6. Moved examples/opengl to examples/gl. From davis at space.mit.edu Wed May 30 11:35:37 2007 From: davis at space.mit.edu (John E. Davis) Date: Wed May 30 11:36:34 2007 Subject: [slang-users] Problems with modules ... In-Reply-To: <465D7E38.6090604@aim.com> References: <465D7E38.6090604@aim.com> Message-ID: <200705301535.l4UFZbSA030791@aluche.mit.edu> Ben Duncan wrote: >Ok, I have installed the 2.1 version and now Am having problems with my SLAG >project.. > > > slsh menu.sl > >Produces the following : > >Module /usr/lib/slang/v2/modules/slagmenu-module.so is incompatible with this >version of S-Lang >Traceback: import >./menu.sl:6::Import Error Does slangmenu-module.c contain a line such as SLANG_MODULE(slagmenu); ? The SLANG_MODULE macro adds version information to the module. What does shell> nm /usr/lib/slang/v2/modules/slagmenu-module.so | grep SLmodule produce? If you do not see SLmodule_slagmenu_api_version in the output of the nm command, then I suspect that you may have compiled your module against slang-1, or the compiler found the slang-1 slang.h file. Thanks, --John From mnoble at space.mit.edu Wed May 30 11:45:46 2007 From: mnoble at space.mit.edu (Michael Noble) Date: Wed May 30 11:46:34 2007 Subject: [slang-users] SLgtk 0.7.0 released Message-ID: <20070530154546.GA25880@svoboda.mit.edu> Version 0.7.0 of the Gtk module for S-Lang is now available at http://space.mit.edu/cxc/slgtk This release adds several minor enhancements to the VWhere data mining tool & improves its robustness, broadens the support for Cairo, and drops support for S-Lang version 1. Regards, Mike Noble -------------------------------- Version 0.7.0: . VWhere 1.3.8: . elminate potential crash after Cancel-ing plot window . added log scaling for axes . cleaner & more accurate axis titles & tick labels . tooltip help for Quit button in control window . Mininum S-Lang version is 2.0.5 (1.x series no longer supported) . Updated WITH_LIBRARY & related autoconf macros . Added new functions to simplify log/lin scaling in plots: _gtk_plot_set_scale, _gtk_plot_xlin, _gtk_plot_ylin, _gtk_plot_xlog, _gtk_plot_ylog Each expects 1 plot descriptor arg & operates upon the current plot. . GtkPlot widget updates: . gtkplotps.c driver (avoid segv w/ superscripts) . gtkplot.c: provided alternative PGPLOT-like tick marks calculator . gtkplotdata.c: do not SEGV when ticks->values is NULL . Cairo suport: . conditional activation of PDF, PS, & SVG surface support . conditionalized Cairo wrappings . cairo example may now be optionally saved to PDF file . Bundle SLIRP 1.9.3 From linux4ms at aim.com Wed May 30 12:38:24 2007 From: linux4ms at aim.com (Ben Duncan) Date: Wed May 30 12:28:34 2007 Subject: [slang-users] Problems with modules ... In-Reply-To: <200705301535.l4UFZbSA030791@aluche.mit.edu> References: <465D7E38.6090604@aim.com> <200705301535.l4UFZbSA030791@aluche.mit.edu> Message-ID: <465DA880.8020203@aim.com> Thanks, I had the MAin module named appmenu.c and I had : SLANG_MODULE ( appmenu ) Following the examples in the SLANG modules, I renamed my appmenu.c to slangmenu-mdoule.c and changed SLANG_MODULE to SLANG_MODULE ( slagmenu ) All is well again ... Anyway, a few weeks ago you posted something about the readline from slang. I have a module called datainput that is VERY sophisticated. Handles insert / replace, hot key to end of field , beginning of field, and scrolling up to 255 characters on a line. It also allows hidden, "mapped" (A overlay for what a character in a field can accept), which means phone numbers, zip codes, and other such interesting combinations, want it for the readline replacement? davis@space.mit.edu wrote: > Ben Duncan wrote: >> Ok, I have installed the 2.1 version and now Am having problems with my SLAG >> project.. >> -- 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 mlichvar at redhat.com Thu May 31 06:12:45 2007 From: mlichvar at redhat.com (Miroslav Lichvar) Date: Thu May 31 06:13:48 2007 Subject: [slang-users] slang 2.1.0 released In-Reply-To: <200705282141.l4SLf4s4004448@aluche.mit.edu> References: <200705282141.l4SLf4s4004448@aluche.mit.edu> Message-ID: <20070531101245.GA1090@localhost> On Mon, May 28, 2007 at 05:41:04PM -0400, John E. Davis wrote: ... > Applications wishing to take advantage of these features > should use the new function `SLrline_open2' instead of > `SLrline_open'. For an example, see how this function is used in > slsh/src/readline.c. > > SLclass_patch_intrin_fun_table was added to facilitiate the patching > of intrinsic tables during runtime. If you have created dynamically > loaded modules, then you may have a good idea what this function is > for. > > The SLang_Traceback variable is now interpreted as a bitmapped > integer providing greater flexibility and control over traceback > messages. > > SLerr_throw was added to permit applications to mimic the semantics > of the `throw' statement. > > SLang_verror_va was added to support calling the error routines with > a va_list argument. While preparing an update for Fedora, I've noticed that these new symbols don't have a new version assigned in the linker script. Can this be please fixed? Diff between 2.0.7 and 2.1.0: SLang_push_ref SLang_verror_va SLclass_patch_intrin_fun_table SLclass_patch_intrin_fun_table1 SLerr_throw SLrline_bol SLrline_eol SLrline_init SLrline_move SLrline_open2 It's necessary to keep the script up to date. Otherwise symbol versioning shouldn't be used and the library soname should be bumped. Thanks, -- Miroslav Lichvar From linux4ms at aim.com Thu Jun 7 15:02:09 2007 From: linux4ms at aim.com (Ben Duncan) Date: Thu Jun 7 14:50:33 2007 Subject: [slang-users] C Structure help ... Message-ID: <46685631.80508@aim.com> Ok, I am back working on my SLAG modules after a years worth of off time on it ... I have an Appgen structure like this: /* *************************************************************** The Appgen Structure *************************************************************** */ typedef struct { DB * di_apgn; /* OUR Appgen DB Structure Pointer */ int di_size; /* -1 means recompute */ char *file_name; /* What is OUR file name for this instance? */ char *rec_key; /* Appgen has a key size limit of 132 */ int is_locked; /* IS the file locked ? */ int Attribute; /* What is the LAST Attribute we dealt with? */ int Sub_Val; /* WHat is the LAST Multi Value ? */ int MV_CNT; /* Keep up with our Looping on MV's */ char *MV_BUFFER ; /* On AppGen MV Extract, this is WHERE */ /* We keep up with the returned malloc */ /* IT is OUR duty to keep with it since */ /* Appgen just allocates it and pushes */ /* the MV string onto it .... */ } APGN_Type I need to know how Do I pass that back and forth to/from the Slang/SLAG program. I already have done this with python where the Python example is like: import appgen APGN_FILE = appgen.open("MyFile", "r") (APGN_FILE becomes a APGN_Type inside of Python) When I need to read the file in Python, is simply do a : APGN_FILE.readrec("PROG.NAME",0) (Where PROG.NAME is the record key} How do I go about doing this ? 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 linux4ms at aim.com Thu Jun 7 15:23:07 2007 From: linux4ms at aim.com (Ben Duncan) Date: Thu Jun 7 15:11:32 2007 Subject: [slang-users] C Structure help ... In-Reply-To: <46685631.80508@aim.com> References: <46685631.80508@aim.com> Message-ID: <46685B1B.5090706@aim.com> Ok, am going to use some of the CODE form the socket module as my examples/protos, looks like it does it the way I need it done ... linux4ms@aim.com wrote: > Ok, I am back working on my SLAG modules after a years worth of off time > on it ... > -- 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 davis at space.mit.edu Thu Jun 7 15:33:01 2007 From: davis at space.mit.edu (John E. Davis) Date: Thu Jun 7 15:33:33 2007 Subject: [slang-users] C Structure help ... In-Reply-To: <46685631.80508@aim.com> References: <46685631.80508@aim.com> Message-ID: <200706071933.l57JX11f030372@aluche.mit.edu> Ben Duncan wrote: >I have an Appgen structure like this: > > >/* >*************************************************************** > The Appgen Structure >*************************************************************** >*/ > >typedef struct >{ > > DB * di_apgn; /* OUR Appgen DB Structure Pointer */ > int di_size; /* -1 means recompute */ > char *file_name; /* What is OUR file name for this instance? */ > char *rec_key; /* Appgen has a key size limit of 132 */ > int is_locked; /* IS the file locked ? */ > int Attribute; /* What is the LAST Attribute we dealt with? */ > int Sub_Val; /* WHat is the LAST Multi Value ? */ > int MV_CNT; /* Keep up with our Looping on MV's */ > > char *MV_BUFFER ; /* On AppGen MV Extract, this is WHERE */ > /* We keep up with the returned malloc */ > /* IT is OUR duty to keep with it since */ > /* Appgen just allocates it and pushes */ > /* the MV string onto it .... */ > >} APGN_Type > >I need to know how Do I pass that back and forth to/from the Slang/SLAG > program. I think that the easiest way to do this is to use Mike Noble's slirp package to automatically generate the code. Basically you point slirp at the header file and it performs its magic. You can read more about slirp at . If you want to hand-wrap it you will have to create an initializer and a destructor for the object and then make use of slang's MMT functions. For examples of this approach see the code in the modules directory of the slang distribution. As a quick overview, you will first need to register the type using, e.g., int APGN_Type_Id; static int register_apgn_type (void) { SLang_Class_Type *cl; if (NULL == (cl = SLclass_allocate_class ("APGN_Type"))) return -1; if (-1 == SLclass_set_destroy_function (cl, destroy_apgen)) return -1; /* By registering as SLANG_VOID_TYPE, slang will dynamically allocate a * type. */ if (-1 == SLclass_register_class (cl, SLANG_VOID_TYPE, sizeof (APGN_Type), SLANG_CLASS_TYPE_MMT)) return -1; APGN_Type_Id = SLclass_get_class_id (cl); return 0; } Here destroy_apgen is a callback function that slang will call when an APGN_Type instance is nolonger referenced: static void destroy_apgen (SLtype type, VOID_STAR f) { APGN_Type *apgn = (APGN_Type *)f; apgn_delete (apgn); /* code to free apgn */ } You will need a constructor for this object. You hinted at something to be used in a slang script as APGN_FILE = appgen_open("MyFile", "r"); So create a slang-intrinsic function such as: static void intrin_appgen_open (char *file, char *mode) { SLang_MMT_Type *mmt; APGN_Type *apgn; /* Add code to create an instance of APGN_Type from file/mode */ apgn = some_code (file, mode); if (NULL == (mmt = SLang_creat_mmt (APGN_Type_Id, (VOID_STAR)apgn))) { /* failed */ delete_apgn (apgn); return; } if (-1 == SLang_push_mmt (mmt)) SLang_free_mmt (mmt); } Then register that function using the SLns_add_intrinsic_function routine: . . register_apgn_type (); SLns_add_intrinsic_function (NULL, "appgen_open", (FVOID_STAR) intrin_appgen_open, SLANG_VOID_TYPE, 2, SLANG_STRING_TYPE, SLANG_STRING_TYPE); The above function says that when calling appgen_open from slang, the C function intrin_appgen_open should be called, which returns void and takes 2 char * arguments. I hope this helps. --John From linux4ms at aim.com Fri Jun 8 10:40:46 2007 From: linux4ms at aim.com (Ben Duncan) Date: Fri Jun 8 10:28:48 2007 Subject: [slang-users] C Structure help ... In-Reply-To: <200706072012.l57KCRnC031548@aluche.mit.edu> References: <200706072012.l57KCRnC031548@aluche.mit.edu> Message-ID: <46696A6E.3040106@aim.com> Ok, another question. My Structure keeps track of a BUFFER and a some other strings ... What is the diff between using malloc / calloc / free versus SLmalloc, SLcalloc and SLfree ? Any advantages, disadvantages ? 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 mnoble at space.mit.edu Fri Jun 8 10:37:17 2007 From: mnoble at space.mit.edu (Michael Noble) Date: Fri Jun 8 10:38:49 2007 Subject: [slang-users] C Structure help ... In-Reply-To: <46696A6E.3040106@aim.com> References: <200706072012.l57KCRnC031548@aluche.mit.edu> <46696A6E.3040106@aim.com> Message-ID: <20070608143717.GA9078@svoboda.mit.edu> > What is the diff between using malloc / calloc / free versus > SLmalloc, SLcalloc and SLfree ? The S-Lang versions ensure that SLang_Error reflects any error that may have arisen. For example, this would enable an out of memory condition to be thrown as a S-Lang error and then detected/caught in S-Lang scope, instead of having the process creep along in some undefined state. -Mike From linux4ms at aim.com Fri Jun 8 12:14:45 2007 From: linux4ms at aim.com (Ben Duncan) Date: Fri Jun 8 12:02:50 2007 Subject: [slang-users] C Structure help ... In-Reply-To: <46696A6E.3040106@aim.com> References: <200706072012.l57KCRnC031548@aluche.mit.edu> <46696A6E.3040106@aim.com> Message-ID: <46698075.1020509@aim.com> And another question ..... What are the advantages/disadvantages of using passed values versus POP'd values ? i.e.: static int apgn_replace(char *value, int *attribute) { APGN_Type *p; SLang_MMT_Type *mmt; .......... if (NULL == (mmt = SLang_pop_mmt (APGN_Type_Id))) { SLang_free_mmt (mmt); return -2; } p = SLang_object_from_mmt (mmt); replace(p->apgn_db, value, *atribute, 0) ............ Where INSTRINSICS are defined as: ... MAKE_INTRINSIC_SI("apgn_store", apgn_store), .... ******** versus ********* static int apgn_replace( VOID ) { char *value ; int attribute ; SLang_MMT_Type *mmt; if ( SLang_pop_integer ( &attribute ) != 0 ) { SLang_verror (SL_INVALID_PARM, "\n Incorrect parameters!\n "); return -1 ; } if ( SLpop_string ( &value ) != 0 ) { SLang_verror (SL_INVALID_PARM, "\n Incorrect parameters!\n "); return -1 ; } ...... ............. Where THE INSTRINSICS is defined as: ... MAKE_INTRINSIC_O("apgn_store", apgn_store), .... 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 mnoble at space.mit.edu Fri Jun 8 14:05:53 2007 From: mnoble at space.mit.edu (Michael Noble) Date: Fri Jun 8 14:06:53 2007 Subject: [slang-users] C Structure help ... In-Reply-To: <46698075.1020509@aim.com> References: <200706072012.l57KCRnC031548@aluche.mit.edu> <46696A6E.3040106@aim.com> <46698075.1020509@aim.com> Message-ID: <20070608180553.GA14925@svoboda.mit.edu> > What are the advantages/disadvantages of using passed values > versus POP'd values ? The main advantage of explicitly popping arguments from the stack is flexibility. For example, it's cleaner/easier to support functions with a variable number of arguments. Another reason to choose explicit popping is because it facilitates custom usage messages. For example, if your wrapper is coded as > apgn_replace(char *value, int *attribute) and you call it with 0 or 1 arguments then something like :1::Stack Underflow Error is returned. Not terribly helpful. However, coded as > apgn_replace( VOID ) then in the wrapper you can do things like if (SLang_Num_Function_Args < SOMETHING || pop_arg_one() == FAIL || pop_arg_two() == FAIL || ...) emit_helpful_usage_message( ...); As a concrete example, consider the hypot() intrinsic called from ISIS (our astrophysical modeling and analysis tool): isis> hypot :1::Stack Underflow Error If we replace it with a parallel version generated by SLIRP isis> import("phypot") and again call it with no arguments isis> hypot Usage: double = hypot(double,double) This function has been vectorized and parallelized. the result is much more useful, no? Hope This Helps, Mike From linux4ms at aim.com Sun Jun 10 12:31:27 2007 From: linux4ms at aim.com (Ben Duncan) Date: Sun Jun 10 12:18:34 2007 Subject: [slang-users] USIng the LIST inside of C ... Message-ID: <466C275F.8090200@aim.com> I would like to USE the LIST functions: such as : list = { "hello", 7, 3.14, {&sin, &cos}} then list_insert (list, 0, "hi"); list_append (list, 0, "there"); list_insert (list, -1, "before"); list_append (list, -1, "after"); inside of my C SLAG programs, then return the created LIST back to the S-Lang program. Any Pointers on how to go about doing this ? Here is a snippet of code of my doing this with python : static PyObject *apgn_extrall ( apgnobject * dp, PyObject * args ) { PyObject *list; PyObject *attr_string; char message[256]; char *Buffer; char END_TEXT [] = { 0xff, '\0' } ; int Attribute = 0; int idx = 0; int status = 0; int MV_CNT = 0; int SubVal = 0; if ( !PyArg_ParseTuple ( args, "i:extrall", &Attribute ) ) return NULL; check_apgnobject_open ( dp ); if ( dp->rec_key == NULL ) { sprintf ( message, "No Record has been read! " ); PyErr_SetString ( ApgnError, message ); return NULL; } if ( Attribute < 1 ) { sprintf ( message, "Invalid Attribute Requested! " ); PyErr_SetString ( ApgnError, message ); return NULL; } /* Create and Allocate a Managed Python List */ list = PyList_New ( 0 ); if ( list == NULL ) { Py_DECREF ( list ); sprintf ( message, "CANNOT Allocate appgen LIST in extrall! " ); PyErr_SetString ( ApgnError, message ); return NULL; } /* Check OUR attribute status for number of Multi values */ MV_CNT = db_stat( dp->di_apgn, Attribute, -1 ) ; if ( MV_CNT == -1 ) { return list ; } if ( MV_CNT == 0 ) { return list ; } /* Go thru Extracting EACH attribute from a Multi value Append each of the STRINGS return to the end of the list */ for (idx = 1 ; idx <= MV_CNT ; idx++ ) { Buffer = str_extract ( dp->di_apgn, Attribute, idx ); attr_string = PyString_FromString ( Buffer ); free ( Buffer ); status = PyList_Append ( list, attr_string ); Py_DECREF ( attr_string ); if ( status != 0 ) { sprintf ( message, "Invalid MV BUFFER APPEND ! " ); PyErr_SetString ( ApgnError, message ); Py_DECREF ( list ); return NULL; } } /* Return the list back to the Python program */ return list; } .. As Always, 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 davis at space.mit.edu Sun Jun 10 14:10:59 2007 From: davis at space.mit.edu (John E. Davis) Date: Sun Jun 10 14:11:36 2007 Subject: [slang-users] USIng the LIST inside of C ... In-Reply-To: <466C275F.8090200@aim.com> References: <466C275F.8090200@aim.com> Message-ID: <200706101810.l5AIAxee024477@aluche.mit.edu> Ben Duncan wrote: >I would like to USE the LIST functions: >such as : > > list = { "hello", 7, 3.14, {&sin, &cos}} > > then > > list_insert (list, 0, "hi"); > list_append (list, 0, "there"); > list_insert (list, -1, "before"); > list_append (list, -1, "after"); > >inside of my C SLAG programs, then return the created LIST >back to the S-Lang program. > >Any Pointers on how to go about doing this ? I have not yet created an API to access the slang interpreter list functions from C. Until then, you can should be able to call the interpreter from C and have it create the list for you. Consider this slang function: define _create_list () { variable args = __pop_args (_NARGS); return { __push_args (args) }; } This can be used from the slang interpreter via, e.g., list = _create_list ("hello", 7, 3.14); Moreover, you can call this from C (error checking has been omitted for clarity): (void) SLang_start_arg_list (); (void) SLang_push_string ("hello"); (void) SLang_push_int (7); (void) SLang_push_double (3.14); (void) SLang_end_arg_list (); (void) SLang_execute_function ("_create_list"); This will create the list and leave it on the slang stack. You will have to use a similar approach if you want to manipulate the list from C. --John From linux4ms at aim.com Mon Jun 11 08:40:46 2007 From: linux4ms at aim.com (Ben Duncan) Date: Mon Jun 11 08:29:51 2007 Subject: [slang-users] USIng the LIST inside of C ... In-Reply-To: <200706101810.l5AIAxee024477@aluche.mit.edu> References: <466C275F.8090200@aim.com> <200706101810.l5AIAxee024477@aluche.mit.edu> Message-ID: <466D42CE.2040703@aim.com> Thanks ... would something MORE abbreviated like the following Work? Sample: /* Abbreviated C source for get_multivalues */ void get_multivalues (int Attribute) { int idx, MV_CNT ; char *Buffer; /* Gimme a COUNT of Multi values in EACH attribute ... */ MV_CNT = db_stat( dp->di_apgn, Attribute, -1 ) ; (void) SLang_start_arg_list (); for (idx = 1 ; idx <= MV_CNT ; idx++ ) { Buffer = str_extract ( dp->di_apgn, Attribute, idx ); (void) SLang_push_string (Buffer) free ( Buffer ); } (void) SLang_end_arg_list (); } --------------------------------------------------------------------- % SLANG Code Base: % Gimme ALL the MV strings on Attribute 33 ... get_mutlivalues( 33 ) ; MyList = __pop_args (_NARGS); davis@space.mit.edu wrote: > > I have not yet created an API to access the slang interpreter list > functions from C. Until then, you can should be able to call the > interpreter from C and have it create the list for you. Consider this > slang function: > -- 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 davis at space.mit.edu Mon Jun 11 12:51:11 2007 From: davis at space.mit.edu (John E. Davis) Date: Mon Jun 11 12:51:54 2007 Subject: [slang-users] USIng the LIST inside of C ... In-Reply-To: <466D42CE.2040703@aim.com> References: <466C275F.8090200@aim.com> <200706101810.l5AIAxee024477@aluche.mit.edu> <466D42CE.2040703@aim.com> Message-ID: <200706111651.l5BGpBjF022140@aluche.mit.edu> Ben Duncan wrote: >Thanks ... would something MORE abbreviated like the following Work? Almost. If you want a list, instead of >get_mutlivalues( 33 ) ; >MyList = __pop_args (_NARGS); use: get_mutlivalues( 33 ) ; MyList = __pop_list (_NARGS); or if you omit the calls to SLang_start/end_arg_list, you can just use: MyList = {get_mutlivalues( 33 )}; Keep in mind that this method makes use of the slang stack with a fixed size. The default stack length is 2500 and cannot currently be changed at runtime. The code was written in such a way to easily permit me to add such functionality but I have never needed it. If your objects are just strings, then I encourage you to use an array of strings. Then the stack size would not be an issue, and you will be able to use a number of the array-based intrinsic functions such as "where". Then you will be playing to the strengths of the interpreter. Good luck, --John From joerg at alea.gnuu.de Mon Jun 11 17:36:10 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Tue Jun 12 04:45:09 2007 Subject: [slang-users] isalpha in SLang Message-ID: Hi, why only isdigit() is available in SLang? How can I test for an alphabetical character? Bye, J?rg. -- Der Wille und nicht die Gabe macht den Geber. From linux4ms at aim.com Wed Jun 13 13:16:03 2007 From: linux4ms at aim.com (Ben Duncan) Date: Wed Jun 13 13:05:41 2007 Subject: [slang-users] USIng the LIST inside of C ... In-Reply-To: <200706111651.l5BGpBjF022140@aluche.mit.edu> References: <466C275F.8090200@aim.com> <200706101810.l5AIAxee024477@aluche.mit.edu> <466D42CE.2040703@aim.com> <200706111651.l5BGpBjF022140@aluche.mit.edu> Message-ID: <46702653.3010603@aim.com> I have been pondering this. IS the stack just limited to 2500, or is that the largest bytes any single item can be? What I need to do is something that has no preset size initially. An array would work. In pseudo code something like this ( actual program would be in C ): static void Myfunction () { while get next string-item. push string-item onto array return array to interprator. } .... S-Lang code: variable MyArray = MyFunction(file, attribute) ; .... and so on .. Thanks .. davis@space.mit.edu wrote: > Ben Duncan wrote: > If your objects are just strings, then I encourage you to use an array > of strings. Then the stack size would not be an issue, and you will > be able to use a number of the array-based intrinsic functions such as > "where". Then you will be playing to the strengths of the > interpreter. > > Good luck, > --John > _______________________________________________ > slang-users-l mailing list > slang-users-l@jedsoft.org > http://mailman.jedsoft.org/mailman/listinfo/slang-users-l -- 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 linux4ms at aim.com Wed Jun 13 18:08:57 2007 From: linux4ms at aim.com (Ben Duncan) Date: Wed Jun 13 18:00:42 2007 Subject: [slang-users] SLang Arrays in C .... Message-ID: <46706AF9.6070102@aim.com> Is there a simple mechanism to continue to add a string to the end of an array using the C Api? 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 davis at space.mit.edu Thu Jun 14 01:27:22 2007 From: davis at space.mit.edu (John E. Davis) Date: Thu Jun 14 01:27:49 2007 Subject: [slang-users] isalpha in SLang In-Reply-To: References: Message-ID: <200706140527.l5E5RMfF011754@aluche.mit.edu> =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >why only isdigit() is available in SLang? How can I test for an >alphabetical character? I will add the isxxx character class functions to the next release. Meanwhile, you can try this hack: define isalpha (x) { return "" == strtrans (char(x), "\\a", ""); } --John From davis at space.mit.edu Thu Jun 14 01:30:42 2007 From: davis at space.mit.edu (John E. Davis) Date: Thu Jun 14 01:31:54 2007 Subject: [slang-users] SLang Arrays in C .... In-Reply-To: <46706AF9.6070102@aim.com> References: <46706AF9.6070102@aim.com> Message-ID: <200706140530.l5E5Ugo1011783@aluche.mit.edu> Ben Duncan wrote: >Is there a simple mechanism to continue to >add a string to the end of an array using the C Api? Not in the public API. --John From davis at space.mit.edu Thu Jun 14 01:34:08 2007 From: davis at space.mit.edu (John E. Davis) Date: Thu Jun 14 01:34:55 2007 Subject: [slang-users] USIng the LIST inside of C ... In-Reply-To: <46702653.3010603@aim.com> References: <466C275F.8090200@aim.com> <200706101810.l5AIAxee024477@aluche.mit.edu> <466D42CE.2040703@aim.com> <200706111651.l5BGpBjF022140@aluche.mit.edu> <46702653.3010603@aim.com> Message-ID: <200706140534.l5E5Y8Sq011823@aluche.mit.edu> Ben Duncan wrote: >I have been pondering this. IS the stack just limited to 2500, or is >that the largest bytes any single item can be? 2500 objects of arbitrary size, e.g, 2500 million-element arrays. >What I need to do is something that has no preset size initially. An >array would work. >In pseudo code something like this ( actual program would be in C ): > >static void Myfunction () >{ >while > get next string-item. > push string-item onto array > >return array to interprator. >} For this, you will need to malloc an initial size array, and then call realloc when necessary. --John From blacktrash at gmx.net Sun Jun 17 05:35:39 2007 From: blacktrash at gmx.net (Christian Ebert) Date: Sun Jun 17 05:37:01 2007 Subject: [slang-users] Re: overlong space/tab in command-line revisited In-Reply-To: <20061115105228.GA19914@krille.blacktrash.org> References: <455682B2.5010806@gmx.de> <20061113080216.GB10842@krille.blacktrash.org> <4558C527.2040508@gmx.de> <20061113223304.GA24975@krille.blacktrash.org> <455907DE.1060708@gmx.de> <20061114060015.GA27082@krille.blacktrash.org> <455AAF38.7010600@gmx.de> <20061115105228.GA19914@krille.blacktrash.org> Message-ID: <20070617093539.GE461@krille.blacktrash.org> Hello, [slang-users: sorry for my first post being a crosspost, but I'm not sure into which "department" this belongs] * Christian Ebert on Wednesday, November 15, 2006 at 10:52:28 +0000: > * Thomas Schultz on Wednesday, November 15, 2006 at 07:10:00 +0100: >> IIRC, the error > > It's /only/ a display problem; functionality is not interfered > with by it. > >> you are getting there is related to pressing on >> a slrn command line/minibuffer, right? > > Almost. This was from my example. I try to update the symptoms as > best as I can: > > It happens when entering the first (and only the first) > or (eg. for path completion) on the command-line, not only > after ^X, but in any command: > > Paste from GNU screen: > > #v+ > Temporary file (^G aborts): La /Users/chris/LaTeX/ > #v- > > displays as: > > #v+ > Temporary file (^G aborts): La > /Users/chris/LaTeX > #v- > > no matter how wide the terminal is. > > Pressing after execution ^L always clears the display of the > additonal line. > > This is reproducable in Apple's Terminal.app and Xterm, with and > without GNU Screen. > >> Have you updated to slang 2.0.7? > > $ slsh --version > slsh version 0.7.7-1; S-Lang version: pre2.1.0-4 > > It happens when I compile S-Lang with GNU readline as well -- but > this might concern slsh only. > >> According to the changelog, John did some work on the readline >> interface, so maybe it was some bug that he now fixed. > > I cannot reproduce it slsh, but this might be the wrong place to > check. Playing around with: $ slrn --version Slrn 0.9.8.1pl2 [2005-02-17] * Note: This version is a developer preview. S-Lang Library Version: 2.0.0 ^^^^^ I found out that this does *not* happen with an /earlier/ version of S-Lang. Perhaps this gives some clue about what's going on. c -- Make Slrn newsreader read MIME (Python required): From davis at space.mit.edu Mon Jun 18 00:38:51 2007 From: davis at space.mit.edu (John E. Davis) Date: Mon Jun 18 00:39:19 2007 Subject: [slang-users] Re: overlong space/tab in command-line revisited In-Reply-To: <20070617093539.GE461@krille.blacktrash.org> References: <455682B2.5010806@gmx.de> <20061113080216.GB10842@krille.blacktrash.org> <4558C527.2040508@gmx.de> <20061113223304.GA24975@krille.blacktrash.org> <455907DE.1060708@gmx.de> <20061114060015.GA27082@krille.blacktrash.org> <455AAF38.7010600@gmx.de> <20061115105228.GA19914@krille.blacktrash.org> <20070617093539.GE461@krille.blacktrash.org> Message-ID: <200706180438.l5I4cpI7010157@aluche.mit.edu> Christian Ebert wrote: >> It happens when entering the first (and only the first) >> or (eg. for path completion) on the command-line, not only >> after ^X, but in any command: >> >> Paste from GNU screen: >> >> #v+ >> Temporary file (^G aborts): La /Users/chris/LaTeX/ >> #v- >> >> displays as: >> >> #v+ >> Temporary file (^G aborts): La >> /Users/chris/LaTeX >> #v- >> >> no matter how wide the terminal is. As far as I can see, this bug was also present in slang-1 but was not triggered before. Please try slang pre2.1.1-9, which is in the slang's svn repository. Does it address the issue? Thanks, --John From blacktrash at gmx.net Mon Jun 18 05:18:24 2007 From: blacktrash at gmx.net (Christian Ebert) Date: Mon Jun 18 05:19:23 2007 Subject: [slang-users] Re: overlong space/tab in command-line revisited In-Reply-To: <200706180438.l5I4cpI7010157@aluche.mit.edu> References: <455682B2.5010806@gmx.de> <20061113080216.GB10842@krille.blacktrash.org> <4558C527.2040508@gmx.de> <20061113223304.GA24975@krille.blacktrash.org> <455907DE.1060708@gmx.de> <20061114060015.GA27082@krille.blacktrash.org> <455AAF38.7010600@gmx.de> <20061115105228.GA19914@krille.blacktrash.org> <20070617093539.GE461@krille.blacktrash.org> <200706180438.l5I4cpI7010157@aluche.mit.edu> Message-ID: <20070618091824.GB27007@krille.blacktrash.org> * John E. Davis on Monday, June 18, 2007 at 00:38:51 -0400: > Christian Ebert wrote: >>> It happens when entering the first (and only the first) >>> or (eg. for path completion) on the command-line, not only >>> after ^X, but in any command: > > As far as I can see, this bug was also present in slang-1 but was not > triggered before. Please try slang pre2.1.1-9, which is in the > slang's svn repository. Does it address the issue? It does indeed! Thank you for the instant fix. c -- Make Slrn newsreader read MIME (Python required): From linux4ms at aim.com Mon Jun 18 18:02:33 2007 From: linux4ms at aim.com (Ben Duncan) Date: Mon Jun 18 17:51:36 2007 Subject: [slang-users] Seq Fault on Variable ... Message-ID: <467700F9.7080001@aim.com> Ok, I have a C program that has the following definitions: >>>>>>>>> static char Var_ts_heading [32] ; int Var_ts_count ; char Var_ts_status ; int Var_tli_lineid ; char Var_tli_displayname [32] ; char Var_tli_type [32] ; char Var_tli_program [32] ; char *Var_heading_ptr = Var_ts_heading ; char *Var_displayname_ptr = Var_tli_displayname ; char *Var_type_ptr = Var_tli_type ; char *Var_program_ptr= Var_tli_program ; SLang_Intrin_Var_Type Module_Variables [] = { MAKE_VARIABLE("Var_Ts_Heading", &Var_heading_ptr, SLANG_STRING_TYPE, 1), MAKE_VARIABLE("Var_Ts_Count", &Var_ts_count, SLANG_INT_TYPE, 0), MAKE_VARIABLE("Var_Tli_Lineid", &Var_tli_lineid, SLANG_INT_TYPE, 0), MAKE_VARIABLE("Var_Tli_displayname", &Var_displayname_ptr, SLANG_STRING_TYPE, 1), MAKE_VARIABLE("Var_Tli_Type", &Var_type_ptr, SLANG_STRING_TYPE, 1), MAKE_VARIABLE("Var_Tli_Program", &Var_program_ptr, SLANG_STRING_TYPE, 1), SLANG_END_INTRIN_VAR_TABLE }; When accessing it via a Slang script I get a seg fault on Var_Ts_Count: Creating the structure Getting the STATUS data Printing the STATUS data Var_Ts_Heading is |ORIGNAL | Var_Tli_Displayname is |ORIGNAL | Printing the COUNT data Segmentation fault test.sl program: % A TEst menu Case % Add traceback Debug Flags _debug_info = 1; _traceback = 1; import ("testmmt", "Global") ; fprintf (stdout, "Creating the structure \n" ) ; variable MyStruct = CreateStruct ( ) ; fprintf (stdout, "Getting the STATUS data \n" ) ; StatusStruct ( MyStruct ) ; fprintf (stdout, "Printing the STATUS data \n" ) ; fprintf (stdout, "Var_Ts_Heading is |%-s| \n", Var_Ts_Heading ) ; fprintf (stdout, "Var_Tli_Displayname is |%-s| \n", Var_Tli_displayname ) ; fprintf (stdout, "Printing the COUNT data \n" ) ; fprintf (stdout, "Var_Ts_Count is %d \n", Var_Ts_Count ) ; fprintf (stdout, "ALL DONE \n" ) ; Any ideas on what is going on ? 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 davis at space.mit.edu Tue Jun 19 00:22:53 2007 From: davis at space.mit.edu (John E. Davis) Date: Tue Jun 19 00:23:41 2007 Subject: [slang-users] Seq Fault on Variable ... In-Reply-To: <467700F9.7080001@aim.com> References: <467700F9.7080001@aim.com> Message-ID: <200706190422.l5J4MrmE017363@aluche.mit.edu> Ben Duncan wrote: >import ("testmmt", "Global") ; > >fprintf (stdout, "Creating the structure \n" ) ; >variable MyStruct = CreateStruct ( ) ; >fprintf (stdout, "Getting the STATUS data \n" ) ; >StatusStruct ( MyStruct ) ; >fprintf (stdout, "Printing the STATUS data \n" ) ; > >fprintf (stdout, "Var_Ts_Heading is |%-s| \n", Var_Ts_Heading ) ; >fprintf (stdout, "Var_Tli_Displayname is |%-s| \n", Var_Tli_displayname ) ; >fprintf (stdout, "Printing the COUNT data \n" ) ; >fprintf (stdout, "Var_Ts_Count is %d \n", Var_Ts_Count ) ; >fprintf (stdout, "ALL DONE \n" ) ; > > >Any ideas on what is going on ? I need more information. For example, how were CreateStruct and StatusStruct implemented? My suspicion is that one of these functions has corrupted the memory in some way. The complete source code for a minimally-sized module that illustrates the problem would be ideal. Thanks, --John From blacktrash at gmx.net Tue Jun 19 09:21:54 2007 From: blacktrash at gmx.net (Christian Ebert) Date: Tue Jun 19 09:22:49 2007 Subject: [slang-users] Need to pass explicit LDFLAGS to link iconv on MacOS Message-ID: <20070619132154.GA7042@krille.blacktrash.org> Hi, I used to configure my build of svn HEAD with the following params (MacOS 10.4.9): FINKPREFIX=/sw \ ./configure --prefix=/usr/local \ --with-pcre=/sw --with-png=/sw --with-iconv=/sw Contrary to the pcre module which was linked in nicely I got for iconv: ~$ slsh slsh version 0.8.1-0; S-Lang version: pre2.1.1-9 Copyright (C) 2005-2007 John E. Davis This is free software with ABSOLUTELY NO WARRANTY. slsh> import ("iconv"); Error linking to /usr/local/lib/slang/v2/modules/iconv-module.so: dlopen(/usr/local/lib/slang/v2/modules/iconv-module.so, 10): Symbol not found: _libiconv Referenced from: /usr/local/lib/slang/v2/modules/iconv-module.so Expected in: flat namespace Traceback: import :1::Import Error slsh> Jusf found out I can avoid this by doing: FINKPREFIX=/sw LDFLAGS="-liconv LDFLAGS" \ ./configure --prefix=/usr/local \ --with-pcre=/sw --with-png=/sw --with-iconv=/sw I'm no good at this, but the --with-iconv flag doesn't seem to have the desired effect here. c -- Make Slrn newsreader read MIME (Python required): From linux4ms at aim.com Tue Jun 19 10:12:39 2007 From: linux4ms at aim.com (Ben Duncan) Date: Tue Jun 19 09:58:50 2007 Subject: [slang-users] Seq Fault on Variable ... In-Reply-To: <200706190422.l5J4MrmE017363@aluche.mit.edu> References: <467700F9.7080001@aim.com> <200706190422.l5J4MrmE017363@aluche.mit.edu> Message-ID: <4677E457.3050501@aim.com> YOU WERE right. I was memsetting using the WRONG pointers. Ok, NOW I have a fully documented C Program that creates and destroys MMT's. It's DESIGN function was to FULLY explain the MMT function as well as the usage of MAKE_xxxxxxx stuff so that newbie's to S-Lang can understand what is going on (Ok, I needed to do it SO I could understand more fully as well). DO want a COPY of this program, John. It would make a FINE edition onto the website as a example of how to create MMT and access variables. It has fairly straight forward documentation in-line with the C code ? Thanks ... davis@space.mit.edu wrote: > Ben Duncan wrote: >> import ("testmmt", "Global") ; -- 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 linux4ms at aim.com Tue Jun 19 11:34:43 2007 From: linux4ms at aim.com (Ben Duncan) Date: Tue Jun 19 11:20:51 2007 Subject: [slang-users] Seq Fault on Variable ... In-Reply-To: <200706191514.l5JFEadA031456@aluche.mit.edu> References: <467700F9.7080001@aim.com> <200706190422.l5J4MrmE017363@aluche.mit.edu> <4677E457.3050501@aim.com> <200706191514.l5JFEadA031456@aluche.mit.edu> Message-ID: <4677F793.4090104@aim.com> Yup, totally self-contained .... It turned out to be a really good example of how MMT's work. Do you want me to send it to you or the list ? davis@space.mit.edu wrote: > Ben Duncan wrote: >> DO want a COPY of this program, John. It would make a FINE edition onto the >> website as a example of how to create MMT and access variables. It has fairly >> straight forward documentation in-line with the C code ? > > Hi Ben, If it is self-contained, I may be able to add it to the demo > directory. > > Thanks, > --John -- 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 davis at space.mit.edu Tue Jun 19 12:04:39 2007 From: davis at space.mit.edu (John E. Davis) Date: Tue Jun 19 12:05:51 2007 Subject: [slang-users] Need to pass explicit LDFLAGS to link iconv on MacOS In-Reply-To: <20070619132154.GA7042@krille.blacktrash.org> References: <20070619132154.GA7042@krille.blacktrash.org> Message-ID: <200706191604.l5JG4dat004775@aluche.mit.edu> Christian Ebert wrote: >I'm no good at this, but the --with-iconv flag doesn't seem to >have the desired effect here. I believe that version pre2.1.1-10 in the svn repository solves this problem. I would appreciate it if you try that version and let me know if it resolves the issue. Thanks, --John From linux4ms at aim.com Tue Jun 19 13:28:05 2007 From: linux4ms at aim.com (Ben Duncan) Date: Tue Jun 19 13:13:56 2007 Subject: [slang-users] A Nice demo of USing MMT types in C Message-ID: <46781225.6090104@aim.com> Attached is a Demo of both a C program and the .sl program. It is used a Active demo to teach about using MMT types, and calling / accessing C functions / variables from inside of the S-Lang environment.: -- 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 -------------- next part -------------- /* ******************************************************************** * This is the program testmmt.c. It is a DEMO program that is an * * attempt to document via a working MODEL, the S-lang C Api * * using program variables, and the Memeory Managed types. * * Memory Managed Types are where we wish to have a "item"/type * * that we wish to use thru our C program, but be controlled by * * The S-Lang environment. * * * * Written By Ben Duncan of Jackson, MS and released under the * * GPL 2 license and higher. Copyrighted 2007 * * Compile with the following statement: * * gcc -shared -fPIC -I /usr/include -I ../include -W1,-R/usr/lib \ * * -lm -o testmmt-module.so testmmt.c * * then copy to the slang module root directory. * ******************************************************************** */ #include SLANG_MODULE(testmmt); static char *Module_Version_String = "$Revision: 1.0 $"; static int TEST_Type_Id = 0; int TEST_Initialized = 0; /* ******************************************************************** * The following is our TEST structures we are going to use to * * inside of the C program / S-Lang environment. Their intents' * * are to modifiable, store some arbitrary type of data and be * * passed around. It is ALSO the intent that multiple "NAMED" * * instances of them can be created and be passed to / from the C * * program for modification and access. I have CHOSEN NOT to make * * make them ACCESABLE to the S-Lang interpreter, because I wish to * * simulate something one would do when writing a DATABASE module * * or other MODULE that may take ANY kind of structure. * ******************************************************************** */ typedef struct Test_Item { int tli_lineid ; char tli_displayname [32] ; char tli_type [32] ; char tli_program [32] ; } testitem; typedef struct Test_Set { char ts_heading [32] ; int ts_count ; char ts_status ; testitem *ts_item ; } testset; /* ******************************************************************** * The VARIBALES where will place our C structure fields to MAKE * * the data from the ABOVE structures avialable to the S-Lang * * interpreter and environment. This is done with the function * * status_struct. * ******************************************************************** */ char Var_ts_heading [32] ; static int Var_ts_count ; char Var_ts_status ; static int Var_tli_lineid ; char Var_tli_displayname [32] ; char Var_tli_type [32] ; char Var_tli_program [32] ; char *Var_heading_ptr = Var_ts_heading ; char *Var_displayname_ptr = Var_tli_displayname ; char *Var_type_ptr = Var_tli_type ; char *Var_program_ptr= Var_tli_program ; /* ******************************************************************** * This frees the internal C structure and all of the memeory * * allocated for it. * ******************************************************************** */ static void free_test_type (testset *ts_ptr) { if (ts_ptr->ts_item != NULL ) { SLfree( (char *) ts_ptr->ts_item ) ; } SLfree ((char *) ts_ptr); } /* ******************************************************************** * Our DESTRUCTOR for the MMT. Called when the envrionment * * gets shutdown. * ******************************************************************** */ static void destroy_testset (SLtype type, VOID_STAR ptr) { testset *ts_ptr = (testset *) ptr; (void) type; free_test_type (ts_ptr ) ; } /* ******************************************************************** * This will create the C structures and initilize the memeory * * required for it. IT IS ALSO where the Memory Managed Type (MMT) * * will get created and then passed back to the S-Lang environment * ******************************************************************** */ static SLang_MMT_Type *allocate_test_type ( void ) { testitem *ti_ptr; testset *ts_ptr; SLang_MMT_Type *mmt; /* ******************************************************************** * We are NOW going to MALLOC and initilize our 2 structures. * ******************************************************************** */ ts_ptr = (testset *) SLmalloc (sizeof (testset)); if (ts_ptr == NULL) { return NULL; } memset ((char *) ts_ptr, 0, sizeof (testset)); ts_ptr->ts_item = NULL ; ti_ptr = (testitem *) SLmalloc (sizeof (testitem)); if (ti_ptr == NULL) { free_test_type (ts_ptr) ; return NULL; } memset ((char *) ti_ptr, 0, sizeof (testitem)); strcpy(ts_ptr->ts_heading, "ORIGNAL " ) ; ts_ptr->ts_count = 0 ; ts_ptr->ts_status = 'A' ; ts_ptr->ts_item = ti_ptr ; ti_ptr->tli_lineid = 1 ; strcpy(ti_ptr->tli_displayname, "ORIGNAL " ) ; strcpy(ti_ptr->tli_type, "ORIGNAL " ) ; strcpy(ti_ptr->tli_program, "ORIGNAL " ) ; /* ******************************************************************** * We are NOW going to ACTUALLY create our very OWN MMT at this * * point. If we get a NULL return value, we are busted, so clear * * out everthing we have done to this point .... * ******************************************************************** */ if (NULL == (mmt = SLang_create_mmt (TEST_Type_Id, (VOID_STAR) ts_ptr))) { free_test_type (ts_ptr) ; return NULL; } return mmt; } /* ******************************************************************** * This is OUR function we call from within the interpretor to * * get our MMT created. Notice HOW we DO NOT return any VALUES on * * any KIND of status. We are PUSHING the MMT onto the stack, if we * * have sucesfully created it, otherwise we push a NULL onto the * * stack. We will have to TEST inside of our S-Lang script, for the * * NULL value and take the necesary action if a NULL gets returned. * * We avoid using a RETURN of any value, because then we WILL have * * to deal with the return CODES as well. This is a simplier way to * * process the creation of a MMT item. * ******************************************************************** */ static void create_struct ( void ) { SLang_MMT_Type *mmt; if (NULL == (mmt = allocate_test_type () )) { (void) SLang_push_null(); return ; } if (-1 == SLang_push_mmt (mmt)) { SLang_free_mmt (mmt); (void) SLang_push_null(); return ; } return ; } /* ******************************************************************** * The following is designed to update OUR test structures in a very* * simplistic mode. The following are the meanings : * * First parameter is WHAT we are going to change, the second is * * The VALUE to be changed * * 1 = ts_heading, String Value * * 2 = ts)count, INTEGER value * * 3 = ts_status, SIngle Characer * * 4 = tli_lineid, INTEGER value * * 5 = tli_displayname, STRING value * * 6 = tli_type, STRING value * * 7 = tli_program, STRING value * * * * TO KEEP THINGS simple, we are going to be PUSHING these on the * * stack in REVERSE order from the interpreter. SO the FIRST * * value is going to be second and the second first, like this: * * () = update_struct("MY VALUE", 1 MMT ) ; * * * * Note that we are USING a "pointer" de-reference to get to the * * TEST ITEMS from a pointer in the TEST SET. This is example of * * One could build a simple structure head into a really complex * * structure of a linked list. * ******************************************************************** */ static int update_struct ( void ) { SLang_MMT_Type *mmt ; int changeid ; int integervalue ; char *MyString = NULL ; testset *ts_ptr ; testitem *ti_ptr ; if (NULL == (mmt = SLang_pop_mmt (TEST_Type_Id))) return -1 ; ts_ptr = SLang_object_from_mmt (mmt); if (ts_ptr->ts_item == NULL ) { SLang_verror (SL_NOT_IMPLEMENTED, "WE DO NOT HAVE A DETAIL LINE !!"); SLang_free_mmt (mmt); return -1 ; } ti_ptr = ts_ptr->ts_item ; if (SLang_Num_Function_Args != 3 ) { SLang_verror (SL_INTRINSIC_ERROR, "INVALID NUMBER OF ARGUMENTS PASSED !!!! " ) ; return -1 ; } if (-1 == SLang_pop_integer(&changeid)) { SLang_verror (SL_INTRINSIC_ERROR, "INVALID INTEGER ARGUMENT PASSED !!!! " ) ; return -1 ; } switch ( changeid ) { case 1: if (-1 == SLpop_string (&MyString)) { SLang_verror (SL_INTRINSIC_ERROR, "INVALID #1 STRING ARGUMENT PASSED !!!! " ) ; return -1; } sprintf( ts_ptr->ts_heading , "%-30s", MyString ) ; break ; case 2: if (-1 == SLang_pop_integer (&integervalue)) { SLang_verror (SL_INTRINSIC_ERROR, "INVALID #2 INTEGER ARGUMENT PASSED !!!! " ) ; return -1; } ts_ptr->ts_count = integervalue ; break ; case 3: if (-1 == SLang_pop_integer (&integervalue)) { SLang_verror (SL_INTRINSIC_ERROR, "INVALID #3 CHARACTER ARGUMENT PASSED !!!! " ) ; return -1; } ts_ptr->ts_status = integervalue ; break ; case 4: if (-1 == SLang_pop_integer (&integervalue)) { SLang_verror (SL_INTRINSIC_ERROR, "INVALID #4 INTEGERARGUMENT PASSED !!!! " ) ; return -1; } ti_ptr->tli_lineid = integervalue ; break ; case 5: if (-1 == SLpop_string (&MyString)) { SLang_verror (SL_INTRINSIC_ERROR, "INVALID #5 STRING ARGUMENT PASSED !!!! " ) ; return -1; } sprintf( ti_ptr->tli_displayname , "%-30s", MyString ) ; break ; case 6: if (-1 == SLpop_string (&MyString)) { SLang_verror (SL_INTRINSIC_ERROR, "INVALID #6 STRING ARGUMENT PASSED !!!! " ) ; return -1; } sprintf( ti_ptr->tli_type , "%-30s", MyString ) ; break ; case 7: if (-1 == SLpop_string (&MyString)) { SLang_verror (SL_INTRINSIC_ERROR, "INVALID #6 STRING ARGUMENT PASSED !!!! " ) ; return -1; } sprintf( ti_ptr->tli_program , "%-30s", MyString ) ; break ; default: SLang_verror (SL_INTRINSIC_ERROR, "INVALID # ARGUMENT PASSED !!!! " ) ; return -1; } if ( MyString != NULL ) { SLfree ( MyString ) ; } SLang_free_mmt (mmt); return 0 ; } /* ******************************************************************** * This clears out the structure we passed back to it. It simply * * resets the values to some known values for our amusement. * ******************************************************************** */ static void clear_struct ( void ) { SLang_MMT_Type *mmt ; testset *ts_ptr ; testitem *ti_ptr ; if (NULL == (mmt = SLang_pop_mmt (TEST_Type_Id))) { SLang_verror (SL_NOT_IMPLEMENTED, "WE DO NOT HAVE A MMT TYPE !!"); return ; } ts_ptr = SLang_object_from_mmt (mmt); if (ts_ptr->ts_item == NULL ) { SLang_verror (SL_NOT_IMPLEMENTED, "WE DO NOT HAVE A DETAIL LINE !!"); SLang_free_mmt (mmt); return ; } ti_ptr = ts_ptr->ts_item ; strcpy(ts_ptr->ts_heading, "RESET " ) ; ts_ptr->ts_count = 0 ; ts_ptr->ts_status = 'O' ; ti_ptr->tli_lineid = 1 ; strcpy(ti_ptr->tli_displayname, "RESET " ) ; strcpy(ti_ptr->tli_type, "RESET " ) ; strcpy(ti_ptr->tli_program, "RESET " ) ; SLang_free_mmt (mmt); } /* ******************************************************************** * This Gets the VALUES stored on the MMT and puts them out on the * * interpreter accessable variables. This is so we can have access * * to whatever we have stored on our MMT structures * ******************************************************************** */ static void status_struct ( void ) { SLang_MMT_Type *mmt ; testset *ts_ptr ; testitem *ti_ptr ; if (NULL == (mmt = SLang_pop_mmt (TEST_Type_Id))) { SLang_verror (SL_NOT_IMPLEMENTED, "WE DO NOT HAVE A MMT TYPE !!"); return ; } ts_ptr = SLang_object_from_mmt (mmt); if (ts_ptr->ts_item == NULL ) { SLang_verror (SL_NOT_IMPLEMENTED, "WE DO NOT HAVE A DETAIL LINE !!"); SLang_free_mmt (mmt); return ; } ti_ptr = ts_ptr->ts_item ; sprintf( Var_ts_heading, "%-30s", ts_ptr->ts_heading ) ; Var_ts_count = ts_ptr->ts_count ; Var_ts_status = ts_ptr->ts_status ; Var_tli_lineid = ti_ptr->tli_lineid ; sprintf( Var_tli_displayname, "%-30s", ti_ptr->tli_displayname ) ; sprintf( Var_tli_type, "%-30s", ti_ptr->tli_type ) ; sprintf( Var_tli_program, "%-30s", ti_ptr->tli_program ) ; SLang_free_mmt (mmt); } /* ******************************************************************** * This closes out MMT structure, freeing all memeory that was * * allocated to it. BE CAREFUL, the "NAMED" variable inside of your * * S-Lang program will still be there, but the C structure will be * * gone. * * * * As an alternative, you MIGHT wish to leave the "MASTER" * * structure "alive" but have some sort of "status" flag during the * * duration of the S-Lang script. * ******************************************************************** */ static void close_struct ( void ) { SLang_MMT_Type *mmt ; testset *ts_ptr ; testitem *ti_ptr ; if (NULL == (mmt = SLang_pop_mmt (TEST_Type_Id))) { SLang_verror (SL_NOT_IMPLEMENTED, "WE DO NOT HAVE A MMT TYPE !!"); return ; } ts_ptr = SLang_object_from_mmt (mmt); if (ts_ptr->ts_item == NULL ) { SLang_verror (SL_NOT_IMPLEMENTED, "WE DO NOT HAVE A DETAIL LINE !!"); SLang_free_mmt (mmt); return ; } ti_ptr = ts_ptr->ts_item ; if (ti_ptr != NULL ) { SLfree( (char *) ti_ptr ) ; } SLfree ((char *) ts_ptr); SLang_free_mmt (mmt); } /* ******************************************************************** * The following is designed to create our Accessable Functions, * * accessable named variable, accessable constants that are * * AVAILBLE to and from the interpreter. Named variable's MAYBE * * marked as read only, meaning ONLY the C program can MODIFY them * * CONSTANTS are where we ill set up any type of NON MODIFIABLE * * variables we wish to use from inside the interpreter * ******************************************************************** */ #define I SLANG_INT_TYPE #define S SLANG_STRING_TYPE /* ******************************************************************** * See the cslang guide at 5.3.2 for more information on using * * MAKE_INSTRINSIC macro. * ******************************************************************** */ static SLang_Intrin_Fun_Type Module_Funs [] = { MAKE_INTRINSIC_0 ( "CreateStruct", create_struct, SLANG_VOID_TYPE ), MAKE_INTRINSIC_0 ( "UpdateStruct", update_struct, SLANG_VOID_TYPE ), MAKE_INTRINSIC_0 ( "ClearStruct", clear_struct, SLANG_VOID_TYPE ), MAKE_INTRINSIC_0 ( "StatusStruct", status_struct, SLANG_VOID_TYPE ), MAKE_INTRINSIC_0 ( "Close_Struct", close_struct, SLANG_VOID_TYPE ), SLANG_END_INTRIN_FUN_TABLE }; /* ******************************************************************** * See the cslang guide at 5.4.0 for more information on using * * MAKE_VARIABLE macro. * ******************************************************************** */ static SLang_Intrin_Var_Type Module_Variables [] = { MAKE_VARIABLE("Var_Ts_Heading", &Var_heading_ptr, SLANG_STRING_TYPE, 1), MAKE_VARIABLE("Var_Ts_Count", &Var_ts_count, SLANG_INT_TYPE, 0), MAKE_VARIABLE("Var_Ts_Status", &Var_ts_status, SLANG_INT_TYPE, 0), MAKE_VARIABLE("Var_Tli_Lineid", &Var_tli_lineid, SLANG_INT_TYPE, 0), MAKE_VARIABLE("Var_Tli_displayname", &Var_displayname_ptr, SLANG_STRING_TYPE, 1), MAKE_VARIABLE("Var_Tli_Type", &Var_type_ptr, SLANG_STRING_TYPE, 1), MAKE_VARIABLE("Var_Tli_Program", &Var_program_ptr, SLANG_STRING_TYPE, 1), SLANG_END_INTRIN_VAR_TABLE }; /* ******************************************************************** * This is the MACRO to make CONSTANTS that are avialable to the * * S-Lang environment. A Constant is a single Character or Integer * * by defination. * * It's usage is defined as :MAKE_ICONSTANT("VAR", ) * * where "VAR is our S-lang constant named variable and the next * * Parameter can be a integer or a SINGLE character type * * We aslo have avialable the "MAKE_ICONSTANT_T(n,v,t)" to make a * * constant variable named "n" of a single VALUE of "v" of the * * type of "t" (I assume SLANG_INT_TYPE or SLANG_CHAR_TYPE ) * ******************************************************************** */ static SLang_IConstant_Type Module_Constants [] = { SLANG_END_ICONST_TABLE }; #undef I #undef S /* ******************************************************************** * WHere we ACTUALLY do the registration of NEW class of data types * * This is setting our S-Lang environment up to handle the "type" * * we have created and are going to use throughout this program. * * Of important notice, is that we are ONLY setting up the "testset"* * and not the "testitem". This is BECAUSE testitem is NOT really * * a NEW type (We could make it one) since it is a CHILD of the * * testset type. As an idea, the testset could be the TYPE that * * that gives you access into some sort of a linked list, but you * * are not wanting the COMPLETE linked list to be of a * * "type"/"class" * ******************************************************************** */ static int register_test_type (void) { SLang_Class_Type *cl; if (NULL == (cl = SLclass_allocate_class ("testset"))) return -1; if (-1 == SLclass_set_destroy_function (cl, destroy_testset)) return -1; /* ******************************************************************** * By registering as SLANG_VOID_TYPE, slang will dynamically * * allocate a new type. * ******************************************************************** */ if (-1 == SLclass_register_class (cl, SLANG_VOID_TYPE, sizeof (testset), SLANG_CLASS_TYPE_MMT)) return -1; /* ******************************************************************** * This SETS up our new type indicator * ******************************************************************** */ TEST_Type_Id = SLclass_get_class_id (cl); return 0; } /* ******************************************************************** * Here we are going the initilization routines. We are creating * * a NAMED space with the "_ns" module then one that does not use * * the named space. * ******************************************************************** */ int init_testmmt_module_ns (char *ns_name) { SLang_NameSpace_Type *ns; ns = SLns_create_namespace (ns_name); if (ns == NULL) return -1; /* ******************************************************************** * WE must REGISTER any "NEW" types with S-Lang's interpreter via * * SLclass_register_class. See the S-Lang library programmer's * * guide for more information. * ******************************************************************** */ if (-1 == register_test_type ()) return -1; /* ******************************************************************** * Ok, we are going to pass to our SLang interperter all of our * * things, such as the "functions" , named variables, constants * * The named VARIABLES are defined variables FROM the C program * * are directly accessable to the interpreter stack for reference * ******************************************************************** */ if ( ( -1 == SLns_add_intrin_fun_table ( ns, Module_Funs, "__TESTMMT__" ) ) || ( -1 == SLns_add_intrin_var_table ( ns, Module_Variables, NULL ) ) || ( -1 == SLns_add_iconstant_table ( ns, Module_Constants, NULL ) ) ) return -1; TEST_Initialized = 1; return 0; } /* ******************************************************************** * This initilizer will do prettymuch the same thing as the above. * * However, it does not MAP to any namespace so everthing is * * GLOBAL as far as the interperter is converned. * ******************************************************************** */ int init_testmmt_module ( void ) { if (-1 == register_test_type ()) return -1; if ( ( -1 == SLadd_intrin_fun_table ( Module_Funs, NULL ) ) || ( -1 == SLadd_intrin_var_table ( Module_Variables, NULL ) ) || ( -1 == SLadd_iconstant_table ( Module_Constants, NULL ) ) ) return -1; TEST_Initialized = 1; return 0; } /* ******************************************************************** * This function is designed to "shut" down the module safely. * * You can put things in it such as, freeing MALLOC'd stuff, setting* * variables to some sort of state, etc. It is optional * ******************************************************************** */ void deinit_module ( void ) { TEST_Initialized = 0; } ************************** CUT HERE ******************************** % testmmt.sl % Save this program as testmmt.sl % run from the command line as >slsh testmmt.sl % % A TEst menu Case % Add traceback Debug Flags _debug_info = 1; _traceback = 1; import ("testmmt", "Global") ; define print_structure ( StructIn ) { StatusStruct ( StructIn ) ; fprintf (stdout, "\nPrinting the STATUS data \n" ) ; fprintf (stdout, "Var_Ts_Heading is |%-s| \n", Var_Ts_Heading ) ; fprintf (stdout, "Var_Ts_Count is %d \n", Var_Ts_Count ) ; fprintf (stdout, "Var_Ts_Status is %c \n", Var_Ts_Status ) ; fprintf (stdout, "Var_Tli_Lineid is %d \n", Var_Tli_Lineid ) ; fprintf (stdout, "Var_Tli_Displayname is |%-s| \n", Var_Tli_displayname ) ; fprintf (stdout, "Var_Tli_type is |%-s| \n", Var_Tli_Type) ; fprintf (stdout, "Var_Tli_program is |%-s| \n", Var_Tli_Program) ; } % MAKE_INTRINSIC_0 ( "CreateStruct", create_struct, SLANG_VOID_TYPE ), % MAKE_INTRINSIC_0 ( "UpdateStruct", update_struct, SLANG_VOID_TYPE ), % MAKE_INTRINSIC_0 ( "GetStruct", update_struct, SLANG_VOID_TYPE ), % MAKE_INTRINSIC_0 ( "ClearStruct", clear_struct, SLANG_VOID_TYPE ), % MAKE_INTRINSIC_0 ( "StatusStruct", status_struct, SLANG_VOID_TYPE ), % MAKE_INTRINSIC_0 ( "Close_Struct", close_struct, SLANG_VOID_TYPE ), % MAKE_VARIABLE("Var_Ts_Heading", &Var_ts_heading, SLANG_STRING_TYPE, 1), % MAKE_VARIABLE("Var_Ts_Count", &Var_ts_count, SLANG_INT_TYPE, 1), % MAKE_VARIABLE("Var_Tli_Lineid", &Var_tli_lineid, SLANG_INT_TYPE, 1), % MAKE_VARIABLE("Var_Tli_displayname", &Var_tli_displayname, SLANG_STRING_TYPE, 1), % MAKE_VARIABLE("Var_Tli_Type", &Var_tli_type, SLANG_STRING_TYPE, 1), % MAKE_VARIABLE("Var_Tli_Program", &Var_tli_program, SLANG_STRING_TYPE, 1), fprintf (stdout, "Creating the structures \n" ) ; variable MyStruct = CreateStruct ( ) ; if ( MyStruct == NULL ) { fprintf (stdout, "WE DO NOT HAVE A STRUCTURE !!!! \n" ) ; exit (-1) ; } variable SecondStruct = CreateStruct ( ) ; if ( SecondStruct == NULL ) { fprintf (stdout, "WE DO NOT HAVE A 2nd STRUCTURE !!!! \n" ) ; exit (-1) ; } fprintf (stdout, "Getting the STATUS data \n" ) ; StatusStruct ( MyStruct ) ; print_structure ( MyStruct ) ; variable C_VAL = 1 ; UpdateStruct ( "NEW VALUE", C_VAL , MyStruct ) ; print_structure ( MyStruct ) ; fprintf (stdout, "\n GONNA TEST SECOND STRUCTURE !!! \n " ) ; C_VAL = 1 ; UpdateStruct ( "SECOND STRUCTURE ", C_VAL , SecondStruct ) ; C_VAL = 3 ; UpdateStruct ( 'Z' , C_VAL , SecondStruct ) ; C_VAL = 5 ; UpdateStruct ( "SECOND VALUE", C_VAL , SecondStruct ) ; StatusStruct ( SecondStruct ) ; print_structure ( SecondStruct ) ; fprintf (stdout, "ALL DONE \n" ) ; From blacktrash at gmx.net Tue Jun 19 18:59:30 2007 From: blacktrash at gmx.net (Christian Ebert) Date: Tue Jun 19 19:00:58 2007 Subject: [slang-users] Need to pass explicit LDFLAGS to link iconv on MacOS In-Reply-To: <200706191604.l5JG4dat004775@aluche.mit.edu> References: <20070619132154.GA7042@krille.blacktrash.org> <200706191604.l5JG4dat004775@aluche.mit.edu> Message-ID: <20070619225930.GC331@krille.blacktrash.org> * John E. Davis on Tuesday, June 19, 2007 at 12:04:39 -0400: > Christian Ebert wrote: >> I'm no good at this, but the --with-iconv flag doesn't seem to >> have the desired effect here. > > I believe that version pre2.1.1-10 in the svn repository solves this > problem. I would appreciate it if you try that version and let me > know if it resolves the issue. It does. Great. Thank you. c -- Make Slrn newsreader read MIME (Python required): From linux4ms at aim.com Thu Jun 21 16:37:42 2007 From: linux4ms at aim.com (Ben Duncan) Date: Thu Jun 21 16:25:45 2007 Subject: [slang-users] John, Please verify .... Message-ID: <467AE196.5060608@aim.com> If I am doing this correctly. The routine is designed to get Multi values from a attribute in the AppGen Data File and create an array item of them. As Always .. 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 -------------- next part -------------- /* ********************************************************************** * This routine is designed to extract all of a multi value attribute * * and put them in a S-lang Array type. Appgen will give us the count * * of the Multi values in a particular attribute, so we know that * * before hand. * ********************************************************************** */ static void apgn_extrall ( ) { APGN_Type *dp ; SLang_MMT_Type *mmt ; SLang_Array_Type *array_type ; int MV_CNT = 0 ; int idx = 0 ; int atrib_num = 0 ; char *attribute ; char **atrib_list ; /* ******************************************************************** * Ourt attribute list starts OUT with a value of 512 for number of * * pointers. We will increase it by 1024 each time as the needs * * arise. * ******************************************************************** */ unsigned int num_atribs = 0 ; unsigned int ArgCnt = SLang_Num_Function_Args ; if (ArgCnt != 1 ) { SLang_verror (SL_Usage_Error, "Usage: agextrall ( file, attribute number ) " ) ; return ; } if ( SLang_pop_integer ( &atrib_num ) != 0 ) { SLang_verror (SL_INVALID_PARM, "\n Invalid atribute NUMBER on agextrall!\n "); return ; } if (NULL == (mmt = SLang_pop_mmt (APGN_Type_Id))) return; dp = SLang_object_from_mmt (mmt); AppGen_Status = check_appgen_open ( dp ); if ( AppGen_Status == -1 ) { SLang_free_mmt (mmt); return ; } /* ******************************************************************** * This GIVES us the number of attributes in our MV list BEFORE * * WE have to do anything with it. If our value is less than 1 (one)* * we have zero ( 0 ) attributes, or if it is a -1 is a invalid * * exsisting attribute, so ignore them * ******************************************************************** */ MV_CNT = db_stat( dp->di_apgn, Attribute, -1 ) ; if ( MV_CNT < 1 ) { SLang_free_mmt (mmt); (void) SLang_push_null(); return ; } atrib_list = (char **) SLmalloc (sizeof (char *) * MV_CNT ); if (atrib_list == NULL) { SLang_verror (SL_MALLOC_ERROR, "Cannot get Memory for MV atrib list !! " ) ; SLang_free_mmt (mmt); SLang_push_null (); return; } /* Always reset the atr looping information */ dp->Attribute = atrib_num ; dp->MV_CNT = 0 ; dp->Sub_Val = 0 ; /* ******************************************************************** * Appgen's str_extract returns the correct atribute and returns * * a pointer to a MALLOC'd buffer that that string item is in. * * In Appgen, MV number 0 is the whole attribute, since we are * * TRYING to parse out the individual items, we will have to be 1 * * ahead of our idx count here ... * ******************************************************************** */ for (idx = 0 ; idx < MV_CNT ; idx++ ) { Buffer = str_extract ( dp->di_apgn, Attribute, ( idx + 1 ) ); atrib_list [idx] = SLmake_string ( (char *)Buffer ) ; free ( Buffer ); /* SAVE our count in case we BLOW up !! */ num_atribs = idx ; if ( atrib_list [idx] == NULL ) { /* ******************************************************* * Gosh I HATE goto's, I really do !!! But there is * * NO real easy way round this at this point !!! * ******************************************************* */ SLang_verror (SL_MALLOC_ERROR, "Cannot make string from Attribute!! " ) ; goto attribute_error ; } } if (NULL == (at = SLang_create_array (SLANG_STRING_TYPE, 0, (VOID_STAR) atrib_list, &MV_CNT, 1))) { SLang_verror (SL_MALLOC_ERROR, "Cannot Create ARRAY for Attributes!! " ) ; goto attribute_error ; } if (-1 == SLang_push_array (at, 1)) { SLang_verror (SL_INTRIN_ERROR, "Cannot Push Attribute Array on Stack !! " ) ; goto attribute_error ; } return; attribute_error: /* ******************************************************************** * we will first free each of the strings we have created, then we * * will FREE the keeper of the string list itself. * ******************************************************************** */ while (num_atribs > 0) { num_atribs--; SLfree (atrib_list[num_atribs]); } SLang_push_null (); return; } From joerg at alea.gnuu.de Thu Jun 21 17:51:43 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Thu Jun 21 19:02:45 2007 Subject: [slang-users] Bug in profiler.sl Message-ID: Hi, % cat prof-x.sl require ("profile"); profile_calibrate (); profile_on(1); define barE() { throw DataError; } define fooE() { try barE(); catch DataError; } define bar() { } define foo() { try bar(); catch DataError; } profile_off(); profile_begin (); foo(); fooE(); profile_end (); profile_report(stdout); profile_begin (); fooE(); foo(); profile_end (); profile_report(stdout); exit(0); % jed-script prof-x.sl #---------------------------------------------------------------- # Function Call Profile Report #---------------------------------------------------------------- #function ncalls ms/call totalselfms totalsecs Function File foo 1 0.0202 0.0152 0.0000 1 0 /home/joerg/prof-x.sl bar 1 0.0050 0.0050 0.0000 0 0 /home/joerg/prof-x.sl fooE 1 0.0000 0.0000 0.0000 0 0 /home/joerg/prof-x.sl barE 1 0.0000 0.0000 0.0000 0 0 /home/joerg/prof-x.sl #---------------------------------------------------------------- # Function Call Profile Report #---------------------------------------------------------------- #function ncalls ms/call totalselfms totalsecs Function File fooE 1 0.0000 0.0000 0.0000 0 0 /home/joerg/prof-x.sl barE 1 0.0000 0.0000 0.0000 0 0 /home/joerg/prof-x.sl After an Error the profiler does something wrong. % jed --version jed version: 0.99.19-95/Unix Compiled with GNU C 4.1 S-Lang version: pre2.1.1-10 *** Compiled against S-Lang 20007 but linked to 20101 jed compile-time options: +LINE_ATTRIBUTES +BUFFER_LOCAL_VARS +SAVE_NARROW +TTY_MENUS +EMACS_LOCKING +MULTICLICK +SUBPROCESSES +DFA_SYNTAX +ABBREVS +COLOR_COLUMNS +LINE_MARKS +GPM_MOUSE +IMPORT Using JED_ROOT=/usr/share/jed Bye, J?rg. -- Ein Narr, er sieht die Weisheit nicht, selbst wenn sie n?rrisch zu ihm spricht. From davis at space.mit.edu Fri Jun 22 00:55:41 2007 From: davis at space.mit.edu (John E. Davis) Date: Fri Jun 22 00:57:46 2007 Subject: [slang-users] Bug in profiler.sl In-Reply-To: References: Message-ID: <200706220455.l5M4tfY1023093@aluche.mit.edu> =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >% jed --version >jed version: 0.99.19-95/Unix > Compiled with GNU C 4.1 >S-Lang version: pre2.1.1-10 Try pre2.1.1-13. Thanks, --John From joerg at alea.gnuu.de Fri Jun 22 17:14:55 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Fri Jun 22 17:19:58 2007 Subject: [slang-users] Re: Bug in profiler.sl References: <200706220455.l5M4tfY1023093@aluche.mit.edu> Message-ID: Hi John, "John E. Davis" wrote: > =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >>% jed --version >>jed version: 0.99.19-95/Unix >> Compiled with GNU C 4.1 >>S-Lang version: pre2.1.1-10 > > Try pre2.1.1-13. Thanks, --John Yes, it works, but I can't use non?function profiling aka. statement profiling anymore. % jed-script prof-x.sl #---------------------------------------------------------------- # Function Call Profile Report #---------------------------------------------------------------- #function ncalls ms/call totalselfms totalsecs Function File bar 10 0.0055 0.0550 0.0001 0 0 /home/joerg/prof-x.sl foo 1 0.0504 -0.0046 0.0001 10 0 /home/joerg/prof-x.sl % cat prof-x.sl require ("profile"); profile_calibrate (); profile_on(0); define bar() { () = 12 + 4; () = 27 / 3; } define foo() { loop (10) bar(); } profile_off(); profile_begin (); foo(); profile_report(stdout); exit(0); Sch?ne Gr??e, J?rg. -- Es ist au?erdem ein weit verbreiteter Irrtum das USENET ?helfen? soll. Tats?chlich wurde USENET nachweislich zur pers?nlichen Belustigung seiner Erfinder geschaffen. J?rg Klemenz , From davis at space.mit.edu Fri Jun 22 17:47:14 2007 From: davis at space.mit.edu (John E. Davis) Date: Fri Jun 22 17:47:59 2007 Subject: [slang-users] Re: Bug in profiler.sl In-Reply-To: References: <200706220455.l5M4tfY1023093@aluche.mit.edu> Message-ID: <200706222147.l5MLlEDb014351@aluche.mit.edu> =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >Yes, it works, but I can't use non???function profiling aka. statement >profiling anymore. You can, but you did not enable the hooks to generate line by line stats: >% cat prof-x.sl >require ("profile"); > >profile_calibrate (); > >profile_on(0); By using 0 as an argument, you are telling the code generator not to generate code to call the line by line hooks. Use profile_on (1); to generate the code. >define bar() { > () = 12 + 4; > () = 27 / 3; >} >define foo() { > loop (10) > bar(); >} >profile_off(); > >profile_begin (); With no arguments, which is equivalent to profile_begin(0), you are telling the profiler not to add line-by-line hooks. If you want those hooks established, then use profile_begin (1); --John From p.boekholt at gmail.com Sat Jun 23 10:11:30 2007 From: p.boekholt at gmail.com (Paul Boekholt) Date: Sat Jun 23 10:12:11 2007 Subject: [slang-users] slexpat 0.30.0 Message-ID: Hello, Version 0.3.0 of slexpat, an S-Lang interface to James Clark's xml parser library, is now available from http://www.cheesit.com/downloads/slexpat. From p.boekholt at gmail.com Sat Jun 23 10:30:24 2007 From: p.boekholt at gmail.com (Paul Boekholt) Date: Sat Jun 23 10:31:13 2007 Subject: [slang-users] Re: slexpat 0.30.0 In-Reply-To: References: Message-ID: 2007/6/23, Paul Boekholt : > Hello, > > Version 0.3.0 of slexpat, an S-Lang interface to James Clark's xml > parser library, is now available from > http://www.cheesit.com/downloads/slexpat. Sorry, that should be http://www.cheesit.com/downloads/slang/slexpat The version should be 0.3.0. From linux4ms at aim.com Sun Jun 24 10:46:02 2007 From: linux4ms at aim.com (Ben Duncan) Date: Sun Jun 24 10:32:36 2007 Subject: [slang-users] Making a Array .... Message-ID: <467E83AA.9020808@aim.com> I need a way to create a String array that can be extended. i.e. (Pseudo Code) variable MyArray = Array_Type [ ] ; variable MyString ; while ( getnextstring (MyString) { if MyString == NULL break ; MyArray = MyArray + MyString } SO that a strings will always add to and increase the size of the array. I need to do this so I can use the handy dandy array functions. Any pointers, help code will be appreciated .... 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 mnoble at space.mit.edu Sun Jun 24 10:59:28 2007 From: mnoble at space.mit.edu (Michael Noble) Date: Sun Jun 24 10:59:37 2007 Subject: [slang-users] Making a Array .... In-Reply-To: <467E83AA.9020808@aim.com> References: <467E83AA.9020808@aim.com> Message-ID: <20070624145928.GA23179@svoboda.mit.edu> > I need a way to create a String array that can be extended. Try something like this: variable string_arr = String_Type[0]; ... string_arr = [ string_arr, new_string ]; Best, Mike From linux4ms at aim.com Sun Jun 24 12:44:43 2007 From: linux4ms at aim.com (Ben Duncan) Date: Sun Jun 24 12:31:37 2007 Subject: [slang-users] Making a Array .... In-Reply-To: <20070624145928.GA23179@svoboda.mit.edu> References: <467E83AA.9020808@aim.com> <20070624145928.GA23179@svoboda.mit.edu> Message-ID: <467E9F7B.2000503@aim.com> PERFECT !!!!! mnoble@space.mit.edu wrote: >> I need a way to create a String array that can be extended. > > Try something like this: > > variable string_arr = String_Type[0]; > > ... > > string_arr = [ string_arr, new_string ]; > > Best, > Mike 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 linux4ms at aim.com Sun Jun 24 16:33:52 2007 From: linux4ms at aim.com (Ben Duncan) Date: Sun Jun 24 16:20:41 2007 Subject: [slang-users] SQL .. Message-ID: <467ED530.5090602@aim.com> Has anyone done a module that uses a SQL database , such as Postgres, MySql , etc ? 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 mnoble at space.mit.edu Sun Jun 24 20:57:40 2007 From: mnoble at space.mit.edu (Michael Noble) Date: Sun Jun 24 20:58:45 2007 Subject: [slang-users] SQL .. In-Reply-To: <467ED530.5090602@aim.com> References: <467ED530.5090602@aim.com> Message-ID: <20070625005740.GA31049@svoboda.mit.edu> > Has anyone done a module that uses a SQL database , such as > Postgres, MySql , etc ? Paul Boekholt has done one. It's available at http://www.cheesit.com/downloads/slang/slmysql.html Good Luck, -Mike From davis at space.mit.edu Sat Jun 30 01:06:06 2007 From: davis at space.mit.edu (John E. Davis) Date: Sat Jun 30 01:06:37 2007 Subject: [slang-users] slang 2.1.1 released Message-ID: <200706300506.l5U5667S029499@aluche.mit.edu> Version 2.1.1 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: b95067bb1204fc18e7b9fc71ffc1f21b 2.1.0__2.1.1.diff.bz2 7c2ae45523a4c76ab05fe82cf125dc67 2.1.0__2.1.1.diff.bz2.sig d42eea3f00a65e69f453911a48f0cb52 2.1.0__2.1.1.diff.gz 07d11e3e0e267d00ee336cb6bf5cdd20 2.1.0__2.1.1.diff.gz.sig 4465440c158a32aaebed6ef07e7408ac slang-2.1.1.tar.bz2 ae047379b9b0a836959e68bc03f0c208 slang-2.1.1.tar.bz2.sig 41f875c4cb830d38fcff57211ca29e6c slang-2.1.1.tar.gz 4db72473ffcf39e7785331e014da08ec slang-2.1.1.tar.gz.sig This version is primarily a bug-fix release. The main new feature in this release is a function (readascii) that may be used to read (non-binary) data files, e.g., columns of numbers. Enjoy. --John Changes since 2.1.0 1. slsh/lib/print.sl: Only the first element of arrays such as Float_Type[1,1,1,10] were getting printed. 2. src/slscanf.c: strings containing only whitespace were not parsed properly by _pSLang_sscanf when %s was used in the format. 3. slsh/lib/readascii.sl: A flexible ascii data file reader. 4. src/slang.ver: Updated the linker version script (mlichvar at redhat, com). 5. src/slang.ver: The wildcard for the SLANG2 symbols was picking up the SLANG2.1.0 symbols. (mlichvar at redhat, com). 6. slsh/lib/readascii.sl: Added type and cols qualifiers. Updated docs. 7. src/slang.c: If auto_declare is non-zero, and a reference to an undefined variable is made, that variable will be automatically created and given static scope. 8. slsh/lib/autoload.sl: readascii added. 9. src/slrline.c: The redraw function was ignoring the application installed update hook, disrupting the display when a redraw was requested. 10. autoconf/configure.ac: -liconv was not getting added when creating the iconv module on systems with a standalone iconv library. 11. slsh/lib/readascii.sl: Added "as_list" qualifier to return values in lists rather than arrays. 12. src/slscanf.c: Added inf/nan support to sscanf. 13. src/slboseos.c: Before calling the hooks, push the error context so that they will work in the presence of errors. 14. lib/slsh/tm/profile.tm: Documented the profile_* functions. 15. doc/tm/slang.tm: Added documentation about qualifiers. 16. src/slarray.c,modules/*.c: Use SLindex_Type instead of int for indexing arrays. Currently SLindex_Type is typedefd as an int. 17. src/slang.c: Added SLang_pop_array_index to the API. Applications should use this function instead of SLang_pop_int for getting array indices. This new symbol is versioned at 2.1.1. 18. src/slstruct.c: SLang_pop_cstruct will now force SLang_Array_Type objects to linear ones. 19. ./NEWS: Updated 20. slsh/lib/test_readascii.sl: Changed the "list" qualifier to "as_list". From joerg at alea.gnuu.de Mon Jul 2 07:40:45 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Mon Jul 2 08:38:28 2007 Subject: [slang-users] stkcheck conflicts with profile Message-ID: Hi John, using stkcheck while profiling breaks profile. Can you do anything about this? E.g. disable stkcheck if profiling is active or abort profiling if stkcheck is active? Bye, J?rg. -- Es liegt in der Natur des Menschen, vern?nftig zu denken und unlogisch zu handeln! Das Gesagte ist nicht das Gemeinte und das Geh?rte nicht das Verstandene! From davis at space.mit.edu Mon Jul 2 12:31:41 2007 From: davis at space.mit.edu (John E. Davis) Date: Mon Jul 2 12:32:35 2007 Subject: [slang-users] stkcheck conflicts with profile In-Reply-To: References: Message-ID: <200707021631.l62GVfK5007391@aluche.mit.edu> =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >using stkcheck while profiling breaks profile. Can you do anything about >this? E.g. disable stkcheck if profiling is active or abort profiling if >stkcheck is active? The debugger, profiler, and stack checker are implemented by defining hooks that get called before and after the execution of every statement/function. There is only one set of such hooks and for that reason, only one of the above tasks can be performed at a time. The only work-around that I can see would be to integrate the stack checker into the profiler but I do not believe this to be worth the effort. --John From joerg at alea.gnuu.de Tue Jul 3 07:52:27 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Tue Jul 3 07:56:48 2007 Subject: [slang-users] Re: stkcheck conflicts with profile References: <200707021631.l62GVfK5007391@aluche.mit.edu> Message-ID: Hi John, "John E. Davis" wrote: > =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >>using stkcheck while profiling breaks profile. Can you do anything about >>this? E.g. disable stkcheck if profiling is active or abort profiling if >>stkcheck is active? > > The debugger, profiler, and stack checker are implemented by defining > hooks that get called before and after the execution of every > statement/function. There is only one set of such hooks and for that > reason, only one of the above tasks can be performed at a time. > > The only work-around No, I don't want a work-around. You should add something like this if (_get_bof_handler != profiler_bof) throw UsageError, "Another process grabbed the bof handler. Please pay attention that stckcheck is not active"; to profile_end() or if (_get_bof_handler != NULL and _get_bof_handler != stkcheck_bof) throw UsageError, "Another bof handler is active. You can't use stkcheck and profiler at the same time"; to enable_stack_check(). It took me some time to find out that stkcheck is the cause of cluttered profiling output. Bye, J?rg. -- ?Programming today is a race between software engineers striving to build bigger and better idiot?proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.? (Rich Cook) From linux4ms at aim.com Thu Jul 26 08:31:42 2007 From: linux4ms at aim.com (Ben Duncan) Date: Thu Jul 26 08:15:01 2007 Subject: [slang-users] Windows Version ? Message-ID: <46A8942E.2030105@aim.com> Is there a Windows Version of S-Lang available based upon the new release ? 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 davis at space.mit.edu Wed Aug 1 02:57:06 2007 From: davis at space.mit.edu (John E. Davis) Date: Wed Aug 1 02:58:06 2007 Subject: [slang-users] Windows Version ? In-Reply-To: <46A8942E.2030105@aim.com> References: <46A8942E.2030105@aim.com> Message-ID: <200708010657.l716v6k5006225@aluche.mit.edu> Ben Duncan wrote: >Is there a Windows Version of S-Lang available based upon the >new release ? You will have to compile it from source--- I do not distribute binaries. FWIW, a windows version gets created as part of my nightly builds using a cross-compiler. --John From joerg at alea.gnuu.de Sat Aug 4 08:34:07 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Sat Aug 4 08:58:22 2007 Subject: [slang-users] path_* functions -- suggestions Message-ID: Hi, I have some suggestens for the path functions: 1. It would be very helpful if the directory separator would be available. 2. I would like to have a function path_compress() or path_canonicalize() to remove .. and . from a path to make it easier to compare two paths with strcmp(). Or a function pathcmp(). 3. path_concat() should compress the path on the concatenation point. private define path_concat(left, right) { if (path_basename(left) == "") % left has a trailing dir separator left = path_dirname(left); forever { #ifdef UNIX if (strncmp(right, "../", 3) == 0) #else if (strncmp(right, "..\\", 3) == 0) #endif { left = path_dirname(left); right = substr(right, 4, -1); } #ifdef UNIX else if (strncmp(right, "./", 2) == 0) #else else if (strncmp(right, ".\\", 2) == 0) #endif right = substr(right, 3, -1); else break; } return Global->path_concat(left, right); } 4. It would be handy to have a function to get the leading directory. This would make it possible to say in the code above path_first(right) == ".." Bye, J?rg. -- Nutze die Talente, die du hast. Die W?lder w?ren sehr still, wenn nur die begabtesten V?gel s?ngen. (Henry van Dyke) From davis at space.mit.edu Sun Sep 9 14:02:54 2007 From: davis at space.mit.edu (John E. Davis) Date: Sun Sep 9 14:03:18 2007 Subject: [slang-users] slang 2.1.2 released Message-ID: <200709091802.l89I2s7d004318@aluche.mit.edu> Version 2.1.2 of the slang library is now available. This is primarily a maintenance release with much of the work going into better Cygwin integration. I have also created cygwin-specific binaries of slang-2.1.2 as well as several other slang applications and modules. You can see what is currently available from . As usual, pointers to the source code may be found at . It may take a day or so for the mirror sites to pick up the latest version. Changes since 2.1.1 1. slsh/lib/readascii.sl: Typo in the usage message corrected. 2. autoconf/aclocal.m4: Fixed elf link problem on freebsd (Renato Botelho) 3. doc/tm/slang.tm: Some documentation updates 4. slsh/lib/cmdopt.sl: The value passed to a callback function was not be converted to the specified type, e.g., for cmdopt_add (opt, "foo", &callback; type="int"); callback was not being passed an integer. 5. src/slang.c,slassoc.c: Optimization tweaks for inc/decrementing associative arrays (e.g., foo["bar"]++). 6. src/slerr.c: When SLang_set_error is called, then add the string representation of the error message to the message queue. 7. doc/tm/strops.tm: Corrected the documentation for the string_match function. (Guenter Milde) 8. src/sllimits.h: Increased the size of the hash table that stores SLstrings for better efficiency. 9. src/slstrops.c:_pSLang_push_nstring: Inlined the call to _pSLang_push_slstring. 10. slsh/lib/structfuns.sl: Ignore any NULL arguments. 11. slsh/src/readline.c: Turned on output processing in the call to SLang_init_tty. 12. src/slang.h: Several functions were marked as "extern" and not as SL_EXTERN. This makes a difference for CYGWIN and WIN32. 13. src/Makefile.in, autoconf/*: Better support for the creation of cygwin DLLs. 14. src/slang.h: Under windows+cygwin, if SLANG_DLL is not defined, the it will get defined as 1. This means that by default, the application will get compiled against the slang DLL. To build against a static version of the library. compile your code using -DSLANG_DLL=0. 15. Backed out the previous change (#14) to avoid breaking third-party code that compiles against the library. 16. Makefile: `make` will only build the shared version of the library. Use `make static` to create the static version. 17. src/slcmplex.c; Division by zero errors are no longer trapped. This has been the default behavior for reals; this change applies to complex numbers. 18. */*/*.tm: Documentation updates 19. src/slrline.c: When completing a quoted string, the final quote character will automatically get added (instead of a space as before). 20. src/slrline.c: SLang_peek_at_stack+SLang_pop_int recoded as wrappers around inlined versions. 21. src/Makefile.in: Avoid creating a symlink if the target is the same as the link (affects cygwin). 22. src/slsh.c: If exit is called without arguments, interpret that as exit(0). 23. src/slsh.c: Prior to entering interactive mode, turn tracebacks off. 24. src/Makfile.in: LDFLAGS was not getting used. 25. doc/tm/: Some typos corrected (J??rg Sommer) 26. slsh/Makefile.in: slsh/doc/html/*.html gets installed in $prefix/share/doc/slsh/. From joerg at alea.gnuu.de Thu Oct 4 16:53:56 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Thu Oct 4 17:08:10 2007 Subject: [slang-users] Why __add_string() is not used for strcat()? Message-ID: Hi, why is the function registered with __add_string() not used for strlen(), strcat() and thelike? I thought this functions is used everywhere a string is needed. Bye, J?rg. -- Mathematiker beim Kuchenessen (aus dem wahren Leben): J: Du ?berlegst wohl, wie du das St?ck optimal teilst? K: Ja, ich wende gerade den Simplex?Algorithmus darauf an. C: Schau mal, da hast du schon vier Ecken. From davis at space.mit.edu Thu Oct 4 18:21:33 2007 From: davis at space.mit.edu (John E. Davis) Date: Thu Oct 4 18:22:12 2007 Subject: [slang-users] Why __add_string() is not used for strcat()? In-Reply-To: References: Message-ID: <200710042221.l94MLX8m009824@aluche.mit.edu> =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >why is the function registered with __add_string() not used for strlen(), >strcat() and thelike? I thought this functions is used everywhere a >string is needed. No. It simply defines a string representation of a user-defined type. It does not automatically convert the object to a string when one is needed. To understand the rationale behind this decision, consider: z = 1+2i; vmessage ("z=%S", z); This results in the message z=(1 + 2i) since "%S" is a format-specifier for the string representation of the object. If the string representation were to be used in all contexts, then strcat (z,z) would produce "(1 + 2i)(1 + 2i)" instead of a type-mismatch error. So if a function calls for a string, then it must be passed a string and not some other object, e.g., use string(z) to get the string representation. The C interface permits application-defined types to be transparantly converted to strings, but I have not added a "typecast" method to the slang layer yet. Is that what you are looking for? Thanks, --John From joerg at alea.gnuu.de Thu Oct 4 19:02:47 2007 From: joerg at alea.gnuu.de (=?UTF-8?Q?J=C3=B6rg?= Sommer) Date: Thu Oct 4 19:23:12 2007 Subject: [slang-users] Re: Why __add_string() is not used for strcat()? References: <200710042221.l94MLX8m009824@aluche.mit.edu> Message-ID: Hello John, "John E. Davis" wrote: > =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >>why is the function registered with __add_string() not used for strlen(), >>strcat() and thelike? I thought this functions is used everywhere a >>string is needed. > > No. It simply defines a string representation of a user-defined type. > It does not automatically convert the object to a string when one is > needed. > > [?] > > The C interface permits application-defined types to be transparantly > converted to strings, but I have not added a "typecast" method to the > slang layer yet. Is that what you are looking for? Yes. I want to fake the access to a variable. Every write access should trigger an update of another variable. For this, I want to use a user defined data type and overload the assignment variable. Because the rest of the code must still work I have to wrap all accesses to this variable. A method to overload the typecast would be very nice. Bye, J?rg. -- A red sign on the door of a physics professor: 'If this sign is blue, you're going too fast.' From davis at space.mit.edu Sun Oct 7 01:16:35 2007 From: davis at space.mit.edu (John E. Davis) Date: Sun Oct 7 01:17:36 2007 Subject: [slang-users] Re: Why __add_string() is not used for strcat()? In-Reply-To: References: <200710042221.l94MLX8m009824@aluche.mit.edu> Message-ID: <200710070516.l975GZdr021323@aluche.mit.edu> =?UTF-8?Q?J=C3=B6rg?= Sommer wrote: >> The C interface permits application-defined types to be transparantly >> converted to strings, but I have not added a "typecast" method to the >> slang layer yet. Is that what you are looking for? [...] >A method to overload the typecast would be very nice. The latest development version (pre2.1.3-11) includes an __add_typecast intrinsic function that permits this. Does it work for you? Thanks, --John From p.boekholt at gmail.com Sat Oct 13 09:13:17 2007 From: p.boekholt at gmail.com (Paul Boekholt) Date: Sat Oct 13 09:13:45 2007 Subject: [slang-users] sqlite module 0.4.0 Message-ID: Hi, I've finished version 0.4.0 of the sqlite module. This version adds a sqlite_get_array() function to execute a query and get a 2-D array of results. Get it from http://www.cheesit.com/downloads/slang/slsqlite.html. From yenwenchieh at gmx.de Sat Oct 13 11:21:06 2007 From: yenwenchieh at gmx.de (Wenchieh Yen) Date: Sat Oct 13 11:21:45 2007 Subject: [slang-users] [slang-2.1.2] Mac OS X and terminfo Message-ID: <5CF3B94A-5D61-4C9D-8A9D-B1CD8AD31CFF@gmx.de> I noticed some Slang-related issues by compiling Midnight Commander with UTF8 support on Mac OS X: 1. REAL_UNIX_SYSTEM should be set to 'defined' in slang.h on OS X. Otherwise, some external reference cannot be resolved when linked by other applications such as Midnight Commander. Define __APPLE__ will solve this. 2. Recent ncurses(w) (at least for version 5.6) provides ncurses(w)5- config for finding out where the terminfo databse is. However, MISC_TERMINFO_DIRS is kinda hard-coded to $FINKPREFIX. Please see the attached diff file. - Wenchieh Yen -------------- next part -------------- A non-text attachment was scrubbed... Name: slang-2.1.2.patch Type: application/octet-stream Size: 3128 bytes Desc: not available Url : http://mailman.jedsoft.org/pipermail/slang-users-l/attachments/20071013/500182df/slang-2.1.2.obj -------------- next part -------------- From davis at space.mit.edu Tue Oct 30 15:59:59 2007 From: davis at space.mit.edu (John E. Davis) Date: Tue Oct 30 20:00:19 2007 Subject: [slang-users] slang 2.1.3 released Message-ID: <200710310059.l9V0xxDu017448@aluche.mit.edu> Version 2.1.3 of the slang library was released over the weekend. As usual, pointers to the source code may be found at . A Cygwin binary is available from . This is primarily a bug fix release. The detailed changes are appended below. Enjoy. --John Changes since 2.1.2 1. autoconf/Makefile.in: If any */Makefile.in is more recent than the corresponding Makefile, request that the configure script be rerun. 2. src/slcmplex.c: If the complex number z is 0, then return 1 for z^0. 3. src/slerr.c: SLang_set_error: If the error code is SL_UserBreak_Error, then do not add a string representation to the queue in case this function was called from a signal handler. This avoids a call to malloc, which is generally a bad idea on systems where malloc is not reentrant. 4. slsh/lib/sldbcore.sl: The "c" alias was not working. (John Houck) 5. src/slsmg.c: Avoid a possible segv if SLsmg_Scroll_Hash_Border is greater than the display size. (Miroslav Lichvar). 6. src/slang.c: Line number information was not always getting propagated in slang code involving function dereferences, e.g., (@funcptr)(args). The bug-fix checks to see that funcptr is callable. 7. src/slparse.c: Generate bos/eos byte-code for empty code blocks, e.g., while (1){}. 8. lib/sldbcore.sl: When exiting the debugger via the "exit" command, the old SIGINT handler was not getting installed. 9. src/slang.c: Make sure check_signals gets called when returning from inner_interp. 10. src/slsig.c: If a slang script establishes a signal handler for SIGINT, then set SLKeyBoard_Quit to 1 if SIGINT is received. 11. src/slstruct.c: New intrinsic:__add_typecast. This may be used to define a typecast function for a user-defined type. 12. autoconf/aclocal.m4: Added support for ncurses5-config to query the terminfo path (Wenchieh Yen). 13. src/slang.h: If __APPLE__ is defined, then also define __unix__. 14. src/slmath.c: Avoid a NULL pointer dereference when feqs(a,b) is called with mixed scalar and array arguments. 15. src/slsmg,c: Avoid writing a double-wide character to the last column of the display. 16. src/sltermin.c: Search the autoconf-derived terminfo dirs before the hard-coded paths (Wenchieh Yen). 17. doc/tm/rtl/math.tm: feqs documentation updated to reflect a default relative difference of 0.01. 18. doc/tm/rtl/eval.tm: In one example, get_path_delimiter is incorrectly used (Frank Primini). 19. src/slstrops.c: Memory corruption was occuring when using a number greater than 10^256 in a "%f" format statement. 20. src/slstrops.c: Small tweak in the way #19 was implemented. 21. modules/socket-module.c: If INADDR_NONE is defined, use it to test the return value of inet_addr. 22. src/slang.c: SLang_start_arg_list made a wrapper around start_arg_list. From davis at space.mit.edu Tue Nov 6 13:50:17 2007 From: davis at space.mit.edu (John E. Davis) Date: Tue Nov 6 18:50:52 2007 Subject: [slang-users] statistics module version 1.0.0 released Message-ID: <200711061850.lA6IoHXI032288@aluche.mit.edu> Version 1.0.0 of the slang statistics module has been released. You can find out more about the module from . A cygwin binary is available from . Note: the module require slang version 2.1.0 or greater. It will not work with slang-2.0.x versions. From wich at stack.nl Tue Nov 27 13:41:51 2007 From: wich at stack.nl (Remko van der Vossen) Date: Tue Nov 27 13:47:57 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string Message-ID: <20071127134151.GF27179@wichetael.dyndns.org> Hello, I have a small problem which I seem unable to resolve, I write items from an stl list of strings to a scrollable window using SLsmg_write_nstring and indicate the cursor in said window by using reverse video with SLsmg_set_color. However as soon as the window starts scrolling, the text in the cursorline gets garbled, (shifted and combined with the string which was on that line previously,) all other lines both above and below the cursor remain fine. I have condensed the problem to the enclosed test program. Am I doing something wrong? I know the documentation is a little sketchy on parts of the API, so it could easily be that I am doing something that is not allowed or that I am forgetting something. Or am I running into a bug in the library? Kind regards, Remko van der Vossen --- #include #include #include #include int main() { bool not_done = true; //SLutf8_enable(-1); //SLsmg_utf8_enable(1); SLtt_get_terminfo(); SLkp_init(); SLang_init_tty(-1, 0, 0); SLang_set_abort_signal(0); SLtt_get_screen_size(); SLsmg_init_smg(); SLtt_Use_Ansi_Colors = 1; SLtt_set_color(1, 0, "black", "white"); SLtt_set_cursor_visibility(-1); std::list some_list; std::list::iterator cursor = some_list.begin(); while (rand()%40 && some_list.size() < 1000) { std::string some_string; while (rand()%50 && some_string.size() < 1000) { some_string += 0x20 + rand()%0x60; } some_list.insert(cursor, some_string); } cursor = some_list.begin(); while (not_done) { std::list::iterator i = cursor; for (size_t j = SLtt_Screen_Rows/2; i != some_list.begin() && 0 < j; --j) --i; for (size_t r = 0; r < SLtt_Screen_Rows; ++r) { SLsmg_gotorc(r, 0); if (i == some_list.end()) { SLsmg_set_color(0); SLsmg_write_nstring(0, SLtt_Screen_Cols); continue; } SLsmg_set_color(i == cursor ? 1 : 0); //XSLANG const_cast because of s-lang const api issue SLsmg_write_nstring(const_cast(i->c_str()), SLtt_Screen_Cols); ++i; } SLsmg_refresh(); while (SLang_input_pending(1)) { switch(SLkp_getkey()) { case 'q': not_done = false; break; case 'j': if (++cursor == some_list.end()) --cursor; break; case 'k': if (cursor != some_list.begin()) --cursor; break; } } } SLsmg_reset_smg(); SLang_reset_tty(); return 0; } -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2265 bytes Desc: not available Url : http://mailman.jedsoft.org/pipermail/slang-users-l/attachments/20071127/0587319f/smime.bin From davis at space.mit.edu Tue Nov 27 22:31:14 2007 From: davis at space.mit.edu (John E. Davis) Date: Wed Nov 28 03:32:09 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string In-Reply-To: <20071127134151.GF27179@wichetael.dyndns.org> References: <20071127134151.GF27179@wichetael.dyndns.org> Message-ID: <200711280331.lAS3VEl7031528@aluche.mit.edu> Remko van der Vossen wrote: > I have a small problem which I seem unable to resolve, I write items >=66rom an stl list of strings to a scrollable window using > SLsmg_write_nstring and indicate the cursor in said window by using > reverse video with SLsmg_set_color. However as soon as the window starts > scrolling, the text in the cursorline gets garbled, (shifted and > combined with the string which was on that line previously,) all other > lines both above and below the cursor remain fine. I have condensed the > problem to the enclosed test program. I am unable to reproduce the problem (using g++ 4.1.2). What version of slang are you using? What terminal are you using? Thanks, --John From wich at stack.nl Wed Nov 28 12:57:35 2007 From: wich at stack.nl (Remko van der Vossen) Date: Wed Nov 28 12:58:19 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string In-Reply-To: <200711280331.lAS3VEl7031528@aluche.mit.edu> References: <20071127134151.GF27179@wichetael.dyndns.org> <200711280331.lAS3VEl7031528@aluche.mit.edu> Message-ID: <20071128125735.GJ27179@wichetael.dyndns.org> On Tue, Nov 27, 2007 at 10:31:14PM +0000, John E. Davis wrote: > Remko van der Vossen wrote: > > I have a small problem which I seem unable to resolve, I write items > >=66rom an stl list of strings to a scrollable window using > > SLsmg_write_nstring and indicate the cursor in said window by using > > reverse video with SLsmg_set_color. However as soon as the window starts > > scrolling, the text in the cursorline gets garbled, (shifted and > > combined with the string which was on that line previously,) all other > > lines both above and below the cursor remain fine. I have condensed the > > problem to the enclosed test program. > > I am unable to reproduce the problem (using g++ 4.1.2). What version > of slang are you using? What terminal are you using? slang version is 2.1.3 xterminal is mlterm version 2.9.3 LANG is set to ja_JP.UTF-8 glibc version 2.4 Regards, Remko van der Vossen -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2265 bytes Desc: not available Url : http://mailman.jedsoft.org/pipermail/slang-users-l/attachments/20071128/4a6abc65/smime.bin From wich at stack.nl Wed Nov 28 15:19:48 2007 From: wich at stack.nl (Remko van der Vossen) Date: Wed Nov 28 15:20:21 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string In-Reply-To: <20071128125735.GJ27179@wichetael.dyndns.org> References: <20071127134151.GF27179@wichetael.dyndns.org> <200711280331.lAS3VEl7031528@aluche.mit.edu> <20071128125735.GJ27179@wichetael.dyndns.org> Message-ID: <20071128151948.GK27179@wichetael.dyndns.org> On Wed, Nov 28, 2007 at 01:57:35PM +0100, Remko van der Vossen wrote: > On Tue, Nov 27, 2007 at 10:31:14PM +0000, John E. Davis wrote: > > Remko van der Vossen wrote: > > > I have a small problem which I seem unable to resolve, I write items > > >=66rom an stl list of strings to a scrollable window using > > > SLsmg_write_nstring and indicate the cursor in said window by using > > > reverse video with SLsmg_set_color. However as soon as the window starts > > > scrolling, the text in the cursorline gets garbled, (shifted and > > > combined with the string which was on that line previously,) all other > > > lines both above and below the cursor remain fine. I have condensed the > > > problem to the enclosed test program. > > > > I am unable to reproduce the problem (using g++ 4.1.2). What version > > of slang are you using? What terminal are you using? > > slang version is 2.1.3 > xterminal is mlterm version 2.9.3 > LANG is set to ja_JP.UTF-8 > glibc version 2.4 It seems to be a problem in combination with glibc, when I try the same binary on a different system with the same versions of slang and mlterm and the same LANG but glibc version 2.6.1 the problem does not occur. Now the question is if this is a bug purely in glibc or does slang do something that doesn't agree with glibc 2.4. Does slang support glibc 2.4? Regards, Remko van der Vossen. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2265 bytes Desc: not available Url : http://mailman.jedsoft.org/pipermail/slang-users-l/attachments/20071128/c400d4bf/smime.bin From davis at space.mit.edu Wed Nov 28 16:26:39 2007 From: davis at space.mit.edu (John E. Davis) Date: Wed Nov 28 16:27:21 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string Message-ID: <200711281626.lASGQdNd017377@aluche.mit.edu> On Wed, 28 Nov 2007 16:19:48 +0100, Remko van der Vossen said: >> slang version is 2.1.3 >> xterminal is mlterm version 2.9.3 >> LANG is set to ja_JP.UTF-8 >> glibc version 2.4 > >It seems to be a problem in combination with glibc, when I try the same >binary on a different system with the same versions of slang and mlterm >and the same LANG but glibc version 2.6.1 the problem does not occur. > >Now the question is if this is a bug purely in glibc or does slang do >something that doesn't agree with glibc 2.4. Does slang support glibc >2.4? I have not heard of any slang-related issues with glibc 2.4. Did you compile slang for glibc 2.4? Does the problem occur if you use xterm? Does a C version of you code show the same problems? How do the smgtest and pager programs distributed in the slang/demo directory perform? Thanks, --John From wich at stack.nl Wed Nov 28 17:24:51 2007 From: wich at stack.nl (Remko van der Vossen) Date: Wed Nov 28 17:28:22 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string In-Reply-To: <200711281626.lASGQdNd017377@aluche.mit.edu> References: <200711281626.lASGQdNd017377@aluche.mit.edu> Message-ID: <20071128172451.GL27179@wichetael.dyndns.org> On Wed, Nov 28, 2007 at 11:26:39AM -0500, John E. Davis wrote: > On Wed, 28 Nov 2007 16:19:48 +0100, Remko van der Vossen said: > >> slang version is 2.1.3 > >> xterminal is mlterm version 2.9.3 > >> LANG is set to ja_JP.UTF-8 > >> glibc version 2.4 > > > >It seems to be a problem in combination with glibc, when I try the same > >binary on a different system with the same versions of slang and mlterm > >and the same LANG but glibc version 2.6.1 the problem does not occur. > > > >Now the question is if this is a bug purely in glibc or does slang do > >something that doesn't agree with glibc 2.4. Does slang support glibc > >2.4? > > I have not heard of any slang-related issues with glibc 2.4. Did you > compile slang for glibc 2.4? Does the problem occur if you use xterm? > Does a C version of you code show the same problems? How do the > smgtest and pager programs distributed in the slang/demo directory > perform? My observation about glibc seems incorrect, the testing environment was not the same. I ran the original test in screen and the test on the glibc 2.6.1 machine outside of a screen. Further testing seems to show glibc 2.4 or 2.6.1 does not matter (much). I have not yet tried a C versions of the code. An overview: case glibc xterm screen app 01 2.4 mlterm yes test fails 02 2.4 mlterm no test works 03 2.4 xterm yes test works 04 2.4 xterm no test works 05 2.4 uxterm yes test works 06 2.6.1 mlterm yes test fails, but better than case 01 07 2.6.1 mlterm no test works 08 2.4 mlterm yes smgtest act fails *1 09 2.4 mlterm no smgtest act fails *1 10 2.4 uxterm yes smgtest works 11 2.4 mlterm yes pager works 12 2.4 mlterm no pager works screen is version 4.0.3 on both machines *1 The "Another Color Test" fails, the first screen (black, white, green, red in clockwise order) is incorrect (no white) the second, third and forth screens in the cycle appear to be correct. (All other tests, notably the wrapped string and monochrome tests, seem to work fine.) btw, after the BCE color test the background does not switch back to black which might impact some of the other tests, it might be wise to reset it to blak after the test. For these tests it did not seem to matter, I tried all tests with both a black and blue background with the same results. Judging from the tests with just my test program it would seem to be an issue with mlterm and screen, but I have no such problems with any n(w)curses based programs that are on the same system... I don't know if I have any slang programs that could exhibit the same problems. Let me know if you want me to test some specific other combinations, I will strip the c++ from my test program and see if that yields the same results and let you know about it. Hopefully you can reproduce the problem with the above information. Regards, Remko van der Vossen -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2265 bytes Desc: not available Url : http://mailman.jedsoft.org/pipermail/slang-users-l/attachments/20071128/e7c92428/smime.bin From wich at stack.nl Wed Nov 28 17:39:35 2007 From: wich at stack.nl (Remko van der Vossen) Date: Wed Nov 28 17:40:23 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string In-Reply-To: <20071128172451.GL27179@wichetael.dyndns.org> References: <200711281626.lASGQdNd017377@aluche.mit.edu> <20071128172451.GL27179@wichetael.dyndns.org> Message-ID: <20071128173935.GM27179@wichetael.dyndns.org> On Wed, Nov 28, 2007 at 06:24:51PM +0100, Remko van der Vossen wrote: > On Wed, Nov 28, 2007 at 11:26:39AM -0500, John E. Davis wrote: > > > > Does a C version of you code show the same problems? > > I will strip the c++ from my test program and see if that yields the same > results and let you know about it. I stripped the c++ from the test program I have and it seems a c program exhibits exactly the same problem, the c code is enclosed below. Regards, Remko van der Vossen --- #include #include #include #define MAXSTRLEN 1000 #define MAXNSTR 1000 int main() { int not_done = 1; //SLutf8_enable(-1); //SLsmg_utf8_enable(1); SLtt_get_terminfo(); SLkp_init(); SLang_init_tty(-1, 0, 0); SLang_set_abort_signal(0); SLtt_get_screen_size(); SLsmg_init_smg(); SLtt_Use_Ansi_Colors = 1; SLtt_set_color(1, 0, "black", "white"); SLtt_set_cursor_visibility(-1); char* strings = (char*)malloc(MAXSTRLEN * MAXNSTR); if (strings == NULL) return 1; char* cursor = strings; size_t nstrings = 0; while (rand()%40 && nstrings < MAXNSTR) { char* p = cursor; while (rand()%50 && p - cursor - 1 < MAXSTRLEN) { *p++ = 0x20 + rand()%0x60; } p = 0; cursor += MAXSTRLEN; } cursor = strings; while (not_done) { char* i = cursor; size_t j; for (j = SLtt_Screen_Rows/2; i != strings && 0 < j; --j) i -= MAXSTRLEN; size_t r; for (r = 0; r < SLtt_Screen_Rows; ++r) { SLsmg_gotorc(r, 0); if (i == strings + MAXSTRLEN * MAXNSTR) { SLsmg_set_color(0); SLsmg_write_nstring(0, SLtt_Screen_Cols); continue; } SLsmg_set_color(i == cursor ? 1 : 0); //XSLANG const_cast because of s-lang const api issue SLsmg_write_nstring(i, SLtt_Screen_Cols); i += MAXSTRLEN; } SLsmg_refresh(); while (SLang_input_pending(1)) { switch(SLkp_getkey()) { case 'q': not_done = 0; break; case 'j': if ((cursor += MAXSTRLEN) == strings + MAXSTRLEN * MAXNSTR) cursor -= MAXSTRLEN; break; case 'k': if (cursor != strings) cursor -= MAXSTRLEN; break; } } } SLsmg_reset_smg(); SLang_reset_tty(); free(strings); return 0; } -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2265 bytes Desc: not available Url : http://mailman.jedsoft.org/pipermail/slang-users-l/attachments/20071128/e4b4b522/smime.bin From davis at space.mit.edu Wed Nov 28 22:55:44 2007 From: davis at space.mit.edu (John E. Davis) Date: Thu Nov 29 03:56:34 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string In-Reply-To: <20071128172451.GL27179@wichetael.dyndns.org> References: <200711281626.lASGQdNd017377@aluche.mit.edu> <20071128172451.GL27179@wichetael.dyndns.org> Message-ID: <200711290355.lAT3tiqH032197@aluche.mit.edu> Remko van der Vossen wrote: > Judging from the tests with just my test program it would seem to be an > issue with mlterm and screen, but I have no such problems with > any n(w)curses based programs that are on the same system... I don't > know if I have any slang programs that could exhibit the same problems. I do not think it is a slang problem because when run under screen, slang knows nothing about the underlying terminal. Rather it interacts with screen using the escape sequences that are defined in the screen-specific terminfo file, which is invariant with respect to the terminal that screen is using. It is also possible that your terminfo file for mlterm is incorrect. Does setting your TERM variable to vt00 prior to running screen make a difference? This will cause screen to interact with mlterm as if it is a vt100. Finally, if TERMCAP is defined in your screen environment, then unset it. If it is defined in the environment, slang will use it for the terminal definition database. Thanks, --John From wich at stack.nl Mon Dec 3 17:50:01 2007 From: wich at stack.nl (Remko van der Vossen) Date: Mon Dec 3 17:51:14 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string In-Reply-To: <200711290355.lAT3tiqH032197@aluche.mit.edu> References: <200711281626.lASGQdNd017377@aluche.mit.edu> <20071128172451.GL27179@wichetael.dyndns.org> <200711290355.lAT3tiqH032197@aluche.mit.edu> Message-ID: <20071203175001.GQ27179@wichetael.dyndns.org> On Wed, Nov 28, 2007 at 10:55:44PM +0000, John E. Davis wrote: > Remko van der Vossen wrote: > > Judging from the tests with just my test program it would seem to be an > > issue with mlterm and screen, but I have no such problems with > > any n(w)curses based programs that are on the same system... I don't > > know if I have any slang programs that could exhibit the same problems. > > I do not think it is a slang problem because when run under screen, > slang knows nothing about the underlying terminal. Rather it > interacts with screen using the escape sequences that are defined in > the screen-specific terminfo file, which is invariant with respect to > the terminal that screen is using. > > It is also possible that your terminfo file for mlterm is incorrect. > Does setting your TERM variable to vt00 prior to running screen make a > difference? This will cause screen to interact with mlterm as if it > is a vt100. I set TERM to vt100, the problem still exists, but is different, i.e. I get different garbling, the basic problem is still the same though > Finally, if TERMCAP is defined in your screen environment, then unset > it. If it is defined in the environment, slang will use it for the > terminal definition database. Having TERMCAP set or unset seems to make no difference whatsoever. I am not sure though that this is not a slang problem. By moving the cursorline down to a certain point and then up again, I can change the lines below the cursorline. These changes then stay invariant if I move the cursorline further up and back down again, until I go over the changed line with the cursorline. This while I redraw and refresh the entire window each time. To me this doesn't look like a terminal problem, but a slang problem. Regards, Remko van der Vossen. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2265 bytes Desc: not available Url : http://mailman.jedsoft.org/pipermail/slang-users-l/attachments/20071203/5ad17756/smime.bin From davis at space.mit.edu Mon Dec 3 18:28:06 2007 From: davis at space.mit.edu (John E. Davis) Date: Mon Dec 3 18:29:13 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string In-Reply-To: <20071203175001.GQ27179@wichetael.dyndns.org> References: <200711281626.lASGQdNd017377@aluche.mit.edu> <20071128172451.GL27179@wichetael.dyndns.org> <200711290355.lAT3tiqH032197@aluche.mit.edu> <20071203175001.GQ27179@wichetael.dyndns.org> Message-ID: <200712031828.lB3IS6IW015341@aluche.mit.edu> Remko van der Vossen wrote: > To me this doesn't look like a terminal problem, but a slang problem. I still believe it is a problem with screen. The fact remains that screen sits between slang and the physical terminal and, as far as I know, presents the same abstract terminal to slang regardless of the underlying physical terminal. Pictorially, here is the situation as I see it: SLANG --(screen-specific-escape sequences)--> SCREEN --(mlterm-specific escape seqences)--> MLTERM SLANG --(screen-specific-escape sequences)--> SCREEN --(xterm-specific escape seqences)--> XTERM You reported that slang+screen works properly for xterm but fails for mlterm. I do not understand how slang can be responsible for this behavior since the escape sequences it sends to screen do not change. To test this hypothesis, please try this: In mlterm do: script /tmp/mlterm.log /path/to/your/slsmg/code (press the keys to produce the problem, then quit) exit In xterm, do: script /tmp/xterm.log /path/to/your/slsmg/code (press the EXACT same keys as above, then quit) exit Then send me xterm.log and mlterm.log. Thanks, --John From wich at stack.nl Mon Dec 3 21:47:04 2007 From: wich at stack.nl (Remko van der Vossen) Date: Mon Dec 3 21:48:25 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string In-Reply-To: <200712031828.lB3IS6IW015341@aluche.mit.edu> References: <200711281626.lASGQdNd017377@aluche.mit.edu> <20071128172451.GL27179@wichetael.dyndns.org> <200711290355.lAT3tiqH032197@aluche.mit.edu> <20071203175001.GQ27179@wichetael.dyndns.org> <200712031828.lB3IS6IW015341@aluche.mit.edu> Message-ID: <20071203214703.GR27179@wichetael.dyndns.org> On Mon, Dec 03, 2007 at 01:28:06PM -0500, John E. Davis wrote: > Remko van der Vossen wrote: > > script /tmp/xterm.log > /path/to/your/slsmg/code > (press the EXACT same keys as above, then quit) > exit script doesn't work inside of screen, it quits immediately. But ayways, it doesn't matter anymore for me, I will not be using slang after all. I just noticed slang is GPL not LGPL and as I want to license my code 2-BSD, that is a no go. Regards, Remko van der Vossen. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2265 bytes Desc: not available Url : http://mailman.jedsoft.org/pipermail/slang-users-l/attachments/20071203/26dc1f67/smime.bin From davis at space.mit.edu Mon Dec 3 22:25:59 2007 From: davis at space.mit.edu (John E. Davis) Date: Mon Dec 3 22:26:16 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string In-Reply-To: <20071203214703.GR27179@wichetael.dyndns.org> References: <200711281626.lASGQdNd017377@aluche.mit.edu> <20071128172451.GL27179@wichetael.dyndns.org> <200711290355.lAT3tiqH032197@aluche.mit.edu> <20071203175001.GQ27179@wichetael.dyndns.org> <200712031828.lB3IS6IW015341@aluche.mit.edu> <20071203214703.GR27179@wichetael.dyndns.org> Message-ID: <200712032225.lB3MPxJI020790@aluche.mit.edu> Remko van der Vossen wrote: >> script /tmp/xterm.log >> /path/to/your/slsmg/code >> (press the EXACT same keys as above, then quit) >> exit > > script doesn't work inside of screen, it quits immediately. My mistake. I meant before starting screen, i.e., script /tmp/xterm.log screen /path/to/your/slsmg/code (press the EXACT same keys as above, then quit) exit (screen) exit (script) > But ayways, it doesn't matter anymore for me, I will not be using slang > after all. I just noticed slang is GPL not LGPL and as I want to license > my code 2-BSD, that is a no go. Good luck, --John From wich at stack.nl Mon Dec 3 22:31:57 2007 From: wich at stack.nl (Remko van der Vossen) Date: Mon Dec 3 22:32:18 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string In-Reply-To: <200712032225.lB3MPxJI020790@aluche.mit.edu> References: <200711281626.lASGQdNd017377@aluche.mit.edu> <20071128172451.GL27179@wichetael.dyndns.org> <200711290355.lAT3tiqH032197@aluche.mit.edu> <20071203175001.GQ27179@wichetael.dyndns.org> <200712031828.lB3IS6IW015341@aluche.mit.edu> <20071203214703.GR27179@wichetael.dyndns.org> <200712032225.lB3MPxJI020790@aluche.mit.edu> Message-ID: <20071203223156.GB8744@wichetael.dyndns.org> On Mon, Dec 03, 2007 at 05:25:59PM -0500, John E. Davis wrote: > Remko van der Vossen wrote: > >> script /tmp/xterm.log > >> /path/to/your/slsmg/code > >> (press the EXACT same keys as above, then quit) > >> exit > > > > script doesn't work inside of screen, it quits immediately. > > My mistake. I meant before starting screen, i.e., > > script /tmp/xterm.log > screen > /path/to/your/slsmg/code > (press the EXACT same keys as above, then quit) > exit (screen) > exit (script) Well, you can't test if screen is messing it up if you want test what's coming out of the test program running inside the screen. You would need to compare both the output of the program within screen and contained in screen. > > But ayways, it doesn't matter anymore for me, I will not be using slang > > after all. I just noticed slang is GPL not LGPL and as I want to license > > my code 2-BSD, that is a no go. > > Good luck, Thanks. Remko van der Vossen. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2265 bytes Desc: not available Url : http://mailman.jedsoft.org/pipermail/slang-users-l/attachments/20071203/c72da855/smime.bin From davis at space.mit.edu Tue Dec 4 06:34:10 2007 From: davis at space.mit.edu (John E. Davis) Date: Tue Dec 4 06:34:33 2007 Subject: [slang-users] Curious behaviour with SLsmg_set_color and SLsmg_write_string In-Reply-To: <20071203223156.GB8744@wichetael.dyndns.org> References: <200711281626.lASGQdNd017377@aluche.mit.edu> <20071128172451.GL27179@wichetael.dyndns.org> <200711290355.lAT3tiqH032197@aluche.mit.edu> <20071203175001.GQ27179@wichetael.dyndns.org> <200712031828.lB3IS6IW015341@aluche.mit.edu> <20071203214703.GR27179@wichetael.dyndns.org> <200712032225.lB3MPxJI020790@aluche.mit.edu> <20071203223156.GB8744@wichetael.dyndns.org> Message-ID: <200712040634.lB46YAu3031284@aluche.mit.edu> > Well, you can't test if screen is messing it up if you want test what's > coming out of the test program running inside the screen. You would need > to compare both the output of the program within screen and contained in > screen. You are correct. Fortunately, there is another way to achieve grab the output. Instead of `script`, use, e.g., /path/to/your/slsmg/program > /tmp/xterm.log Of course, you will not be able to see what is happening on the display. For that `tee` can be used: /path/to/your/slsmg/program | tee /tmp/xterm.log Thanks, --John From laurent.perez at unicaen.fr Tue Dec 4 10:06:00 2007 From: laurent.perez at unicaen.fr (Laurent Perez) Date: Tue Dec 4 10:02:25 2007 Subject: [slang-users] new modules Message-ID: <20071204100600.GB2527@unicaen.fr> Hello, Two new modules are available at : http://laurent.perez2.free.fr/comp/slang/modules/modules.html slftdi : a module to talk to FTDI USB chips using libftdi. slgtkdatabox : bindings for GtkDatabox, a Gtk widget for data plotting. Regards ; Laurent. From laurent.perez at unicaen.fr Wed Dec 19 11:13:07 2007 From: laurent.perez at unicaen.fr (Laurent Perez) Date: Wed Dec 19 11:09:33 2007 Subject: [slang-users] new slgtkdatabox version Message-ID: <20071219111307.GB2499@unicaen.fr> Hello all, I just uploaded an updated version of S-Lang bindings for GtkDatabox-0.8.2 http://laurent.perez2.free.fr/comp/slang/modules/modules.html Regards ; Laurent. From laurent.perez at unicaen.fr Sat Dec 22 15:34:56 2007 From: laurent.perez at unicaen.fr (Laurent Perez) Date: Sat Dec 22 15:30:46 2007 Subject: [slang-users] slglade Message-ID: <20071222153456.GA2485@unicaen.fr> Hello all, Is someone using slglade module ? I just had to change : "_slgtk_version_string" to : "_gtk_module_version_string" in "init_glade_module_ns" function for the module to be built with latest slgtk (0.7.2), but I'am having "usage" error whenever I call a slgtk function in a script using slglade. Did someone noticed the same behavior ? Thanks ; Laurent. From laurent.perez at unicaen.fr Sun Dec 23 14:44:33 2007 From: laurent.perez at unicaen.fr (Laurent Perez) Date: Sun Dec 23 14:41:05 2007 Subject: [slang-users] serial module Message-ID: <20071223144433.GA2492@unicaen.fr> Hello all, I uploaded 2 new modules : - a module for serial port access. - a module to perform ioctl system calls, needed by the serial module. Regards ; Laurent. From laurent.perez at unicaen.fr Wed Dec 26 12:43:09 2007 From: laurent.perez at unicaen.fr (Laurent Perez) Date: Wed Dec 26 12:39:05 2007 Subject: [slang-users] serial module In-Reply-To: <20071223144433.GA2492@unicaen.fr> References: <20071223144433.GA2492@unicaen.fr> Message-ID: <20071226124309.GA2710@unicaen.fr> Hello, I forgot to mention that you will need to patch termios module in order to use serial module. Files can be found here : http://laurent.perez2.free.fr/comp/slang/modules/modules.html Regards ; Laurent. From laurent.perez at unicaen.fr Mon Dec 31 10:56:33 2007 From: laurent.perez at unicaen.fr (Laurent Perez) Date: Mon Dec 31 10:52:51 2007 Subject: [slang-users] new module Message-ID: <20071231105633.GA2486@unicaen.fr> Dear all, I just uploaded a new module. Slxosd provide bindings for XOSD, a library for displaying text on the root window of your X server. It looks useless, so you certainly need it ;-) You will find it here : http://laurent.perez2.free.fr/comp/slang/modules/modules.html Happy new year. Laurent. From linux4ms at aim.com Mon Dec 31 15:13:05 2007 From: linux4ms at aim.com (Ben Duncan) Date: Mon Dec 31 15:09:52 2007 Subject: [slang-users] new module In-Reply-To: <20071231105633.GA2486@unicaen.fr> References: <20071231105633.GA2486@unicaen.fr> Message-ID: <47790701.80901@aim.com> yeah, thats what the said about Mosaic too ....;-> Laurent Perez wrote: > Dear all, > > I just uploaded a new module. Slxosd provide bindings for XOSD, a library > for displaying text on the root window of your X server. It looks > useless, so you certainly need it ;-) > You will find it here : > > http://laurent.perez2.free.fr/comp/slang/modules/modules.html > > Happy new year. > > > Laurent. > _______________________________________________ > slang-users-l mailing list > slang-users-l@jedsoft.org > http://mailman.jedsoft.org/mailman/listinfo/slang-users-l -- 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