From joerg at alea.gnuu.de Sun Jul 2 18:04:15 2006 From: joerg at alea.gnuu.de (=?iso-8859-1?Q?J=F6rg?= Sommer) Date: Tue Jan 30 08:52:11 2007 Subject: [slang-users] Include files like C #include does Message-ID: Hi, is it possible to include/evaluate files in a way their content is evaluated as it was there? I would like to split a file and take out a big block. But if I do this I must lower some access restrictions to make it possible to access the functions from the split-out-code. I search a function like #include for C that imports the content of a file into another file. Is this possible with SLang? Bye, J?rg. -- Life can only be understood backwards, but it must be lived forwards. (Soren Kierkegaard) From joerg at alea.gnuu.de Mon Jul 3 12:12:31 2006 From: joerg at alea.gnuu.de (=?iso-8859-1?Q?J=F6rg?= Sommer) Date: Tue Jan 30 08:52:11 2007 Subject: [slang-users] Include files like C #include does In-Reply-To: <20060703074029.GA5467@unicaen.fr> References: <20060703074029.GA5467@unicaen.fr> Message-ID: <20060703161231.GB25024@alea.gnuu.de> Salut Laurent, Laurent Perez schrieb am Mon 03. Jul, 09:40 (+0200): > * J?rg Sommer [2006-07-02 22:04] : > > > is it possible to include/evaluate files in a way their content is > > evaluated as it was there? I would like to split a file and take out a > > big block. But if I do this I must lower some access restrictions to make > > it possible to access the functions from the split-out-code. I search a > > function like #include for C that imports the content of a file into > > another file. Is this possible with SLang? > > Hi, > > Doesn't > > () = evalfile ("myfile.sl"); > > fit your needs ? No. I have this: #v+ implements("foo"); private fun() {} static do_something() { fun(); } #v- If I want to move do_something() in a separate file I must make fun at least static. #v+ implements("foo"); static fun() {} () = evalfile("new_file", current_namespace()); #v- But then fun is accessable form anywhere. Bye, J?rg. -- "...anytime you install something new on the Windows platform, you risk spending the next five or six hours trying to figure out what happened" -- Robert Roblin, Adobe From mnoble at space.mit.edu Fri Jul 7 15:22:06 2006 From: mnoble at space.mit.edu (Michael Noble) Date: Tue Jan 30 08:52:11 2007 Subject: [slang-users] slirp 1.9 released Message-ID: <20060707192206.GA30471@svoboda.mit.edu> Friends, I am pleased to announce that SLIRP 1.9 has been released to http://space.mit.edu/CXC/software/slang/modules/slirp The main advance in this version is function vectorization, although a number of enhancements were also made for C++ and FORTRAN support. Vectorization is a powerful feature which allows functions to be called with either scalar slsh> cos(PI) -1 or array slsh> cos( [ 1 : 10000 * PI : PI / 2 ] ) Double_Type[20000] semantics. S-Lang provides a number of functions which are natively vectorized and demonstrably outperform their analogues in other scripting languages, making S-Lang highly suitable for intensive numerical work in science and engineering. SLIRP now extends this capability, with commensurate performance and economy of codesize, to a wide range of external C, C++, and FORTRAN codes, with few restrictions on the quantity, datatype, or dimensionality of the function arguments that may be automatically vectorized. More details are available in the documentation and a forthcoming paper. Regards, Mike Noble ---------------------------------------------------------------------------- Changes in v1.9 1. Added support for automatic vectorization of wrapper functions 2. To enlarge the default coverage of wrapped APIs, when autotyping is on (the default) typedef'd structs not explicitly mapped by your interface file will be mapped to opaque types with a free() finalizer 3. examples/triv module renamed kitchensink, because that's what it is! 4. Corrected bug with default values for C funcs with 1 arg of basic type 5. Usage statements for ref/array args now reflect "[]" instead of "_ptr" 6. More and better documentation 7. Fix configure bug when no FORTRAN compiler detected (Laurent Perez) 8. Most of emitted code is now embedded within fold markers 9. New #rename directive, equivalent to -rename command line switch 10. Allow more than 9 arguments (ugh!!) in an argmap 11. Fixed C++ support bugs: - #ifndef after full-line C++ comment was being ignored - conditional compilation directives w/in C++ block not being honored - overloaded methods with zero args now always dispatched correctly 12. For flexibility, allow destination type(s) of #copy annotations to be undefined at the time the #copy is issued 13. Proxy annotation for string* arrays can now accept a NULL default value 14. Generated stub code now includes globals defined w/in the interface 15. Introduced $cleanup parameter, to avoid memory leaks w/in annotations when they cause wrapper to exit prematurely (e.g. with an error) 16. Enhanced support for multi-dimensional C arrays like double foo[2][2] 17. Opaque wrappers for pointer array types (e.g. double**) now reflect their C type (e.g. as double_ptr_ptr) rather than mapping to void_ptr 18. Usage stmts for FORTRAN funcs now more accurately reflect arrayness 19. Arrays transparently converted to/from FORTRAN column-major layout 20. Allow #argmap(ignore) blocks to be specified in a single line; i.e., to implicitly terminate sans an #end directive 21. New #argmap(setup) method, which allows code to be injected into a function wrapper prior to the marshaling of its arguments from S-Lang 22. New -ignore option to tune where/how ignored symbols are emitted: by default they now go to ./ignored.txt (not stderr) From ben at versaccounting.com Thu Jul 13 21:15:03 2006 From: ben at versaccounting.com (Ben Duncan) Date: Tue Jan 30 08:52:11 2007 Subject: [slang-users] Wxwindows .... Message-ID: <44B6F017.60300@versaccounting.com> has anyone done a wxwindows module yet for s-lang ? And ... FWIW .. I am 50% complete on my MVISAM databse engine that I will tying back to s-lang / SLAG ... (MVISAM - multi user, multi value, multi key PICK like database engine based upon B*/+trees ) 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 Jul 18 20:50:08 2006 From: davis at space.mit.edu (John E. Davis) Date: Tue Jan 30 08:52:11 2007 Subject: [slang-users] Include files like C #include does In-Reply-To: <20060703161231.GB25024@alea.gnuu.de> References: <20060703074029.GA5467@unicaen.fr> <20060703161231.GB25024@alea.gnuu.de> Message-ID: <200607190050.k6J0o8xK030447@aluche.mit.edu> J?rg Sommer wrote: >If I want to move do_something() in a separate file I must make fun at >least static. I have thought a number of times about adding #include using the same semantics as the CPP but it was never a high priority. >implements("foo"); >static fun() {} >() = evalfile("new_file", current_namespace()); > >But then fun is accessable form anywhere. It is accessable in the sense that it would have to be referenced using foo->fun. I suspect that there may be a larger problem you are trying to solve and that using "#include" is just one mechanism to deal with it. If so, what is the larger problem? Thanks, --John From joerg at alea.gnuu.de Wed Jul 19 16:41:25 2006 From: joerg at alea.gnuu.de (=?iso-8859-1?Q?J=F6rg?= Sommer) Date: Tue Jan 30 08:52:11 2007 Subject: [slang-users] Include files like C #include does References: <20060703074029.GA5467@unicaen.fr> <20060703161231.GB25024@alea.gnuu.de> <200607190050.k6J0o8xK030447@aluche.mit.edu> Message-ID: Hello John, "John E. Davis" wrote: > J?rg Sommer wrote: >>implements("foo"); >>static fun() {} >>() = evalfile("new_file", current_namespace()); >> >>But then fun is accessable form anywhere. > > It is accessable in the sense that it would have to be referenced > using foo->fun. > > I suspect that there may be a larger problem you are trying to solve > and that using "#include" is just one mechanism to deal with it. If > so, what is the larger problem? No it's not a real problem. It's more an academic requirement that all publicly accessable function must be documented and their arguments must be checked. Regards, J?rg. -- - StGB ?? 328 Absatz 2, Nr.3 : Mit Freiheitsstrafe bis zu f?nf Jahren oder mit Geldstrafe wird bestraft, wer eine nukleare Explosion verursacht. From joerg at alea.gnuu.de Tue Jul 25 13:33:42 2006 From: joerg at alea.gnuu.de (=?iso-8859-1?Q?J=F6rg?= Sommer) Date: Tue Jan 30 08:52:12 2007 Subject: [slang-users] autoload loads two times Message-ID: Hi, can someone explain why the stkcheck file is loaded two times? #v+ !if ( is_defined("enable_stack_check") ) autoload("enable_stack_check", "stkcheck"); try { message(string(_featurep("stkcheck"))); enable_stack_check(); message(string(_featurep("stkcheck"))); } catch OpenError: {} #v- #v+ % xjed -batch -l /tmp/bug.sl -l /tmp/bug.sl loading /tmp/bug.sl 0 loading /usr/share/jed/jed-extra/stkcheck.slc loading /tmp/bug.sl 0 loading /usr/share/jed/jed-extra/stkcheck.slc #v- J?rg. -- Wer A sagt, mu? nicht B sagen. Er kann auch erkennen, da? A falsch war. (Erich K?stner) From davis at space.mit.edu Tue Jul 25 18:37:33 2006 From: davis at space.mit.edu (John E. Davis) Date: Tue Jan 30 08:52:12 2007 Subject: [slang-users] autoload loads two times In-Reply-To: References: Message-ID: <200607252237.k6PMbXl7026054@aluche.mit.edu> J?rg Sommer wrote: >can someone explain why the stkcheck file is loaded two times? [...] >% xjed -batch -l /tmp/bug.sl -l /tmp/bug.sl >loading /tmp/bug.sl >0 >loading /usr/share/jed/jed-extra/stkcheck.slc >loading /tmp/bug.sl >0 >loading /usr/share/jed/jed-extra/stkcheck.slc >#v- What version of xjed are you using? How does jed-extra/stkcheck.sl differ from the version distributed with slang? # xjed -batch -n -l /tmp/bug.sl -l /tmp/bug.sl loading /usr/local/jed/lib/site.sl loading /usr/local/jed/lib/os.sl loading /usr/local/jed/lib/menus.sl loading /usr/local/etc/jed.conf loading /usr/local/jed/lib/compress.sl loading /usr/local/jed/lib/modeinfo.sl loading /tmp/bug.sl loading /usr/local/share/slsh/stkcheck.sl 1 loading /tmp/bug.sl 1 # xjed --version jed version: 0.99.18/Unix Compiled with GNU C 3.3 S-Lang version: pre2.0.7-47 *** Compiled against S-Lang 20006 but linked to 20007 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/local/jed Thanks, --John From joerg at alea.gnuu.de Tue Jul 25 17:46:59 2006 From: joerg at alea.gnuu.de (=?iso-8859-1?Q?J=F6rg?= Sommer) Date: Tue Jan 30 08:52:12 2007 Subject: [slang-users] autoload loads two times References: Message-ID: J?rg Sommer wrote: > Hi, > > can someone explain why the stkcheck file is loaded two times? My example was wrong. #v+ % head /tmp/bug* ==> /tmp/bug.sl <== implements("bug"); autoload("enable_stack_check", "stkcheck"); try { enable_stack_check(); } catch OpenError: {} () = evalfile("/tmp/bug2.sl"); ==> /tmp/bug2.sl <== autoload("enable_stack_check", "stkcheck"); try { enable_stack_check(); } catch OpenError: {} ==> /tmp/bug3.sl <== implements("bug"); autoload("Global->enable_stack_check", "stkcheck"); try { enable_stack_check(); } catch OpenError: {} () = evalfile("/tmp/bug2.sl"); #v- In bug3.sl the "Global->" was added to bug.sl. #v+ % xjed -batch -l /tmp/bug.sl | tail -n5 loading /usr/share/jed/lib/compress.slc loading /tmp/bug.sl loading /usr/share/slsh/stkcheck.sl loading /tmp/bug2.sl loading /usr/share/slsh/stkcheck.sl % xjed -batch -l /tmp/bug3.sl | tail -n5 loading /usr/share/jed/lib/modeinfo.slc loading /usr/share/jed/lib/compress.slc loading /tmp/bug3.sl loading /usr/share/slsh/stkcheck.sl loading /tmp/bug2.sl #v- If I put the autoload() before the implements in bug.sl stkcheck.sl is not loaded twice. If I use evalfile() in bug.sl instead of autoload(), stkcheck.sl is also loaded only one time. I think this is a bug. autoload should behave like evalfile() in this case. Regards, J?rg. -- Ein Mensch sieht ein und das ist wichtig, nichts ist ganz flach und nichts ganz richtig. (Eugen Roth) From joerg at alea.gnuu.de Tue Jul 25 19:07:02 2006 From: joerg at alea.gnuu.de (=?iso-8859-1?Q?J=F6rg?= Sommer) Date: Tue Jan 30 08:52:12 2007 Subject: [slang-users] autoload loads two times References: <200607252237.k6PMbXl7026054@aluche.mit.edu> Message-ID: Hello John, "John E. Davis" wrote: > J?rg Sommer wrote: >>can someone explain why the stkcheck file is loaded two times? > [...] >>% xjed -batch -l /tmp/bug.sl -l /tmp/bug.sl >>loading /tmp/bug.sl >>0 >>loading /usr/share/jed/jed-extra/stkcheck.slc >>loading /tmp/bug.sl >>0 >>loading /usr/share/jed/jed-extra/stkcheck.slc >>#v- > > How does jed-extra/stkcheck.sl differ from the version distributed with > slang? It's not there. jed-extra is the last element of the load path and the error that stkcheck.sl was not found is catched by the try block. Regards, J?rg. -- Die am Lautesten reden, haben stets am wenigsten zu sagen. From davis at space.mit.edu Wed Jul 26 12:33:04 2006 From: davis at space.mit.edu (John E. Davis) Date: Tue Jan 30 08:52:12 2007 Subject: [slang-users] autoload loads two times In-Reply-To: References: Message-ID: <200607261633.k6QGX4X5008203@aluche.mit.edu> J?rg Sommer wrote: >==> /tmp/bug.sl <== >implements("bug"); >autoload("enable_stack_check", "stkcheck"); Since "bug" is the active namespace, stkcheck will be loaded into the "bug" namespace. >try >{ > enable_stack_check(); >} >catch OpenError: {} The above will cause stkcheck to load. >() = evalfile("/tmp/bug2.sl"); This will cause bug2.sl to load. Since no namespace argument was specified, an anonymous one will be used with public symbols going into the global namespace. >==> /tmp/bug2.sl <== >autoload("enable_stack_check", "stkcheck"); Since an anonymous namespace is active in this context, stkcheck will get loaded into its own anonymous namespace when enable_stack_check is called. >try >{ > enable_stack_check(); >} >catch OpenError: {} The above will trigger stkcheck.sl to get loaded. >==> /tmp/bug3.sl <== >implements("bug"); >autoload("Global->enable_stack_check", "stkcheck"); This will cause stkcheck.sl to get loaded using the global namespace for public objects. >try >{ > enable_stack_check(); >} >catch OpenError: {} This will cause stkcheck.sl to load with enable_stack_check placed into the global namespace. >() = evalfile("/tmp/bug2.sl"); Since enable_stack_check is defined in the global namespace when bug2.sl is loaded, its autoload statement placing it there will have no effect. >% xjed -batch -l /tmp/bug.sl | tail -n5 >loading /usr/share/jed/lib/compress.slc >loading /tmp/bug.sl >loading /usr/share/slsh/stkcheck.sl >loading /tmp/bug2.sl >loading /usr/share/slsh/stkcheck.sl The above is exactly what I expected to see. >% xjed -batch -l /tmp/bug3.sl | tail -n5 >loading /usr/share/jed/lib/modeinfo.slc >loading /usr/share/jed/lib/compress.slc >loading /tmp/bug3.sl >loading /usr/share/slsh/stkcheck.sl >loading /tmp/bug2.sl The single load of stkcheck.sl is also correct. >If I put the autoload() before the implements in bug.sl stkcheck.sl is >not loaded twice. If I use evalfile() in bug.sl instead of autoload(), >stkcheck.sl is also loaded only one time. I think this is a bug. autoload >should behave like evalfile() in this case. Please re-read the docs for autoload and evalfile. If something is not clear in the documentation, let me know and I will attempt to improve it. Thanks, --John