- Subject: Re: [Jed-users-l] JED: Shift-arrow to mark text
- From: Manfred Hanke <Manfred.Hanke@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 25 Apr 2011 20:15:55 +0200
Hi,
Doug Kramer wrote:
> I could not find documentation for either "evalfile" or "require" on
> jedsoft.org, and am unsure of the difference.
I agree that it is always difficult for new users. You may, however,
discover that the interactive help offered by jed/S-Lang is quite
helpful. I attach below the documentation obtained from
menu Help => Describe Function => evalfile
menu Help => Describe Function => require
> When must evalfile be followed with "pop()"?
> When do we assign it to parens: '() = evalfile("cua")'?
evalfile has a return value. Assigning it to empty parentheses (which
discards that value) is probably identical to leaving it on the stack
and calling the pop function afterwards.
>> I downloaded cuamark.sl, but cannot copy it to /usr/share/jed/lib even
>> with "sudo cp":
>>
>> $ sudo cp jed/cuamark.sl /usr/share/jed/lib/
>> [sudo] password for doog:
>> cp: cannot stat `jed/cuamark.sl': Permission denied
I guess there must be something else wrong. Were you in your home
directory before? Try
$ sudo cp ~doog/jed/cuamark.sl /usr/share/jed/lib
>> How would I load the file from ~/jed/cuamark.sl ?
require("/home/doog/jed/cuamark.sl");
should in principle do the job.
You can probably also add something like
set_jed_library_path( "/home/doog/jed," + get_jed_library_path() );
to your ~/.jedrc.
>> I'm quite happy with the design philosophy (and implementation) of JED,
>> and hope to learn better how to customize it.
I'm sure you will. Enjoy!
Cheers,
Manfred
--------------------------------------------------------------------------------
> evalfile: intrinsic function
>
> SYNOPSIS
> Interpret a file containing S-Lang code
>
> USAGE
> Int_Type evalfile (String_Type file [,String_Type namespace])
>
> DESCRIPTION
> The `evalfile' function loads `file' into the interpreter
> and executes it. If called with the optional namespace argument,
> the file will be loaded into the specified namespace, which will be
> created if necessary. If given no namespace argument and the file
> has already been loaded, then it will be loaded again into an
> anonymous namespace. A namespace argument given by the empty string
> will also cause the file to be loaded into a new anonymous namespace.
>
> If no errors were encountered, 1 will be returned; otherwise,
> a S-Lang exception will be thrown and the function will return zero.
>
> EXAMPLE
>
> define load_file (file)
> {
> try
> {
> () = evalfile (file);
> }
> catch AnyError;
> }
>
> NOTES
> For historical reasons, the return value of this function is not
> really useful.
>
> The file is searched along an application-defined load-path. The
> `get_slang_load_path' and `set_slang_load_path' functions
> may be used to set and query the path.
>
> SEE ALSO
> eval, autoload, set_slang_load_path, get_slang_load_path
--------------------------------------------------------------------------------
> require: library function
>
> SYNOPSIS
> Make sure a feature is present, and load it if not
>
> USAGE
> require (feature [,namespace [,file]])
> String_Type feature, namespace, file;
>
> DESCRIPTION
> The `require' function ensures that a specified "feature" is present.
> If the feature is not present, the `require' function will attempt to
> load the feature from a file. If the `namespace' argument is present
> and non-NULL, the specified namespace will be used. The default is to use
> the current non-anonymous namespace. If called with three arguments, the
> feature will be loaded from the file specified by the third argument
> if it does not already exist in the namespace. Otherwise, the feature
> will be loaded from a file given by the name of the feature, with
> ".sl" appended.
>
> If after loading the file, if the feature is not present,
> a warning message will be issued.
>
> EXAMPLE
> require ("histogram");
> require ("histogram", "foo");
> require ("histogram", "foo", "/home/bob/hist.sl");
> require ("histogram", ,"/home/bob/hist.sl");
>
> NOTES
> "feature" is an abstract quantity that is undefined here.
_______________________________________________
Jed-users-l mailing list
Jed-users-l@xxxxxxxx
http://mailman.jtan.com/mailman/listinfo/jed-users-l
[2011 date index]
[2011 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]