Loading Programs in new sessions

Messages in english

Modérateur : xcasadmin

XcasEngGuy
Messages : 146
Inscription : mer. janv. 13, 2010 3:20 pm

Loading Programs in new sessions

Message par XcasEngGuy » dim. mars 26, 2017 12:39 am

I have developed a "library" of programs that I use to decompose and reassemble equations as well as other functions I use frequently. I normally load them into a program level in line one. Is there a way to cause a new session to be preloaded with stuff (like maybe a template)?

parisse
Messages : 5740
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Loading Programs in new sessions

Message par parisse » dim. mars 26, 2017 6:59 am

You can add a load command in ~/.xcasrc (or xcas.rc on windows)

XcasEngGuy
Messages : 146
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Loading Programs in new sessions

Message par XcasEngGuy » jeu. mai 18, 2017 7:50 pm

I can't find a reference to a load command. Is it in the documentation? A simple example load command would probably fix my problem.

Matt

parisse
Messages : 5740
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Loading Programs in new sessions

Message par parisse » ven. mai 19, 2017 5:35 am

You can enter any valid xcas command in ~/.xcasrc, including read("filename");

XcasEngGuy
Messages : 146
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Loading Programs in new sessions

Message par XcasEngGuy » ven. mai 19, 2017 2:54 pm

Sorry, I still am having trouble getting it. Is there any documentation for "valid xcas commands"? Does xcas have a command line somewhere that I can try commands on? I feel like I am missing a very simple bit of something. A list of valid commands would be great. By the way, are there command line options for xcas?

Matt

parisse
Messages : 5740
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Loading Programs in new sessions

Message par parisse » ven. mai 19, 2017 6:01 pm

Valid xcas command means any command you write in a xcas history level. For example read("filename") is an xcas command that reads the file and runs it.

XcasEngGuy
Messages : 146
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Loading Programs in new sessions

Message par XcasEngGuy » sam. mai 20, 2017 8:57 pm

I understand now. I ended up using a template .xws file because it gave me more flexibility. I implemented this with a modified start script (runxcas.en in my case). The modified script follows:

#! /bin/bash
export LANG=en
export XCAS_ROOT='/cygdrive/C/Programs_OS/xcas'
# export XCAS_HOME='/cygdrive/p'
# export XCAS_AUTOSAVEFOLDER='/cygdrive/p'
export XCAS_LOCALE="$XCAS_ROOT/locale/"
export XCAS_HELP="$XCAS_ROOT/aide_cas"
cp /cygdrive/C/Programs_OS/xcas/eq_funcs_template.xws /cygdrive/C/Programs_OS/xcas/eq_funcs.xws
if [ "$1" == "" ]
then
$XCAS_ROOT/xcas.exe /cygdrive/C/Programs_OS/xcas/eq_funcs.xws
else
$XCAS_ROOT/xcas.exe /cygdrive/C/Programs_OS/xcas/eq_funcs.xws "$1"
fi

the cp command guards against accidentally hitting save in the template (instead of save-as). The if statement was necessary to prevent the creation of an empty window when called with no filename in $1.

Thanks for the help,
Matt

Répondre