Not loading configuration when started with fiename on command line

Bugs

Modérateur : xcasadmin

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

Not loading configuration when started with fiename on command line

Message par XcasEngGuy » mar. oct. 31, 2023 11:53 pm

xcas 1.9.0-66 (c) 2000-18, Bernard Parisse, Renee De Graeve

When I start xcas with a file on the commandline:

$XCAS_ROOT/xcas.exe "$(pwd)/eq_funcs.xws" "$@"

from a modified runxcas.en the Bandeau and other items at the bottom are not there. Any filename on the command line seems to cause this behavior. Turning them on and saving the config does not make them come up the next time I start xcas. This used to work, but I can't remember how many versions back that was. The stock works fine, the items appear as they should, however they were when I saved configuration in the cfg menu.

By the way, is the configuration saved in the xws file? That might cause it.

Thanks
Matt

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

Re: Not loading configuration when started with fiename on command line

Message par parisse » jeu. nov. 02, 2023 11:50 am

The global configuration is saved in ~/.xcasrc on Unix systems (and therefore always esay to find), and in the start directory in xcas.rc in Windows. The issue is most probably that xcas.rc was not found in your situation, perhaps because the start directory was not c:\xcaswin or c:\xcas64.

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

Re: Not loading configuration when started with fiename on command line

Message par XcasEngGuy » ven. nov. 03, 2023 10:44 pm

I'm using Windows 10 and it seems that it is more than that. If you drag and drop a xws file to one of the original batch files that run xcas, the same thing happens.

Matt

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

Re: Not loading configuration when started with fiename on command line

Message par parisse » sam. nov. 04, 2023 10:35 am

If the env variable XCAS_ROOT is set, then xcas.rc should be read from this directory. If not, then you can run xcas from a shell with I/O (like the bash shell inside xcas directory) and see some informations displayed about xcas.rc.

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

Re: Not loading configuration when started with fiename on command line

Message par XcasEngGuy » sam. nov. 04, 2023 5:33 pm

I got xcas to run from a DOS command window using the bash inside the xcas directory using:

./runxcas.en

It opens the xcas window with the proper config but I can't get it to display the messages from xcas and it doesn't open the xws file on the command line. I ran xcas.exe from the DOS window and it also doesn't display the messages, just opens the default xcas window with the proper configuration.

I have cygwin installed on my machine and if I run runxcas.en from a cygwin bash shell (in mintty) i can see the messages which indicate that xcas.rc is found but the xws file on the command line is not opened.

I hope this is not too confusing.

If I open xcas with the batch file the xws file opens but xcas.rc appears to not be opened.

Matt

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

Re: Not loading configuration when started with fiename on command line

Message par parisse » dim. nov. 05, 2023 10:40 am

When you run xcas from your cygwin terminal, you should be able to open an xws file, you have probably to put an absolute path like /cygdrive/c/....

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

Re: Not loading configuration when started with fiename on command line

Message par XcasEngGuy » ven. nov. 10, 2023 6:26 pm

if I run mintty in the xcas directory in cygwin and enter:

xcas /cygdrive/c/Programs_OS/xcas64/newton.xws

I get:

Matt@RM /cygdrive/c/Programs_OS/xcas64
$ xcas /cygdrive/c/Programs_OS/xcas64/newton.xws
// Using locale /usr/local/share/locale/
// C
// /usr/local/share/locale/
// giac
// UTF-8
GSL error handler off
// Using help file aide_cas
// root dir /xcas64/
// Read 1240 entries from cache /xcas64/doc/en/cascmd_en/html_mtt
// Read 1526 entries from cache /xcas64/doc/en/cascmd_en/html_mall
// Read 1078 entries from cache /xcas64/doc/en/cascmd_en/html_vall
Added 26 synonyms
// Using menu file /xcas64/doc/en/xcasex
// Using menu file /xcas64/doc/en/xcasmenu
Found XCAS_ROOT /xcas64
// Reading config file /xcas64/xcas.rc
[widget_size([0,15,40,10],1244,183,900,788,2,2,0,[56,255,60,255,58,255,216,255,56,255,49],"cygstart.exe",0,0,"","","A4",60),cas_setup(0,0,1,1,0,[1e-12,1e-15],12,[4,100,0,25],0,1,0,1),xcas_mode(0),xyztrange([-10.0,10.0,-10.0,10.0,-10.0,10.0,-10.0,10.0,-10.0,10.0,-1.4,1.1,1,0.0,1.0,3]),autosimplify('Nop')]
// User configuration done
// Maximum number of parallel threads 4
Threads allowed 1
// Reading config file xcas.rc
[widget_size([0,15,40,10],1244,183,900,788,2,2,0,[56,255,60,255,58,255,216,255,56,255,49],"cygstart.exe",0,0,"","","A4",60),cas_setup(0,0,1,1,0,[1e-12,1e-15],12,[4,100,0,25],0,1,0,1),xcas_mode(0),xyztrange([-10.0,10.0,-10.0,10.0,-10.0,10.0,-10.0,10.0,-10.0,10.0,-1.4,1.1,1,0.0,1.0,3]),autosimplify('Nop')]
// User configuration done
// Maximum number of parallel threads 4
Threads allowed 1
0
Capture_20231110-132414.jpg
Capture_20231110-132414.jpg (31.02 Kio) Consulté 2049 fois
But the xws file is not opened. The config seems to be read in OK.

Matt

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

Re: Not loading configuration when started with fiename on command line

Message par XcasEngGuy » mer. déc. 06, 2023 9:09 pm

Callin my batch file with a xws file

copy /Y "C:\Programs_OS\xcas64\eq_funcs_template.xws" eq_funcs.xws
set PATH=C:\Programs_OS\xcas64;%PATH%
rem Save path from input file for saveas dialog
echo %~d1%~p1 | gclip
bash.exe '/cygdrive/C/Programs_OS/xcas64/runxcas.en' %1
rem erase /P eq_funcs.xws

together with bash script:

#! bash
export LANG=en_EN:en
export XCAS_ROOT='/cygdrive/C/Programs_OS/xcas64'
#export XCAS_HOME='/cygdrive/p'
# export XCAS_AUTOSAVEFOLDER='/cygdrive/p'
export XCAS_LOCALE="$XCAS_ROOT/locale/"
export XCAS_HELP="$XCAS_ROOT/aide_cas"
$XCAS_ROOT/xcas.exe "$(pwd)/eq_funcs.xws" "$@"

will load both xws files, but not the config (or whatever is not letting the bandeau be displayed).

modifying the bash script to:

#! bash
export LANG=en_EN:en
export XCAS_ROOT='/cygdrive/C/Programs_OS/xcas64'
#export XCAS_HOME='/cygdrive/p'
# export XCAS_AUTOSAVEFOLDER='/cygdrive/p'
export XCAS_LOCALE="$XCAS_ROOT/locale/"
export XCAS_HELP="$XCAS_ROOT/aide_cas"
$XCAS_ROOT/xcas.exe

will display the bandeau but no file is loaded (since there is no file)

This was not a problem with previous versions.

Any suggestions for something I can try?

Matt

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

Re: Not loading configuration when started with fiename on command line

Message par XcasEngGuy » mer. déc. 06, 2023 9:56 pm

I guess I'm late bringing this up but I had a chance to switch to earlier versions of xcas and the last version without this bug was:

xcas 1.9.0-49 (c) 2000-18,

I'm running Win 10 22H2 OS build 19045.3693

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

Re: Not loading configuration when started with fiename on command line

Message par parisse » ven. déc. 08, 2023 7:37 am

I'm afraid I do not have a source version to compare. But I can probably add support for running a script at load time in xcas. I'll keep you informed!

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

Re: Not loading configuration when started with fiename on command line

Message par XcasEngGuy » ven. déc. 08, 2023 8:00 pm

I guess I should point out that the scripts I have shown above are modifications of the default scripts that come with xcas. I am puzzled that this problem can exist. Something changed after Version 1.9.0-49

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

Re: Not loading configuration when started with fiename on command line

Message par parisse » dim. déc. 10, 2023 12:50 pm

I have implemented a user replacement for the config file: if you pass config=filename as 1st argument, then xcas will load filename instead of xcas.rc. For example
xcas config=xcas.rc
will load xcas.rc from current directory instead of searching the config file at default location.

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

Re: Not loading configuration when started with fiename on command line

Message par XcasEngGuy » dim. déc. 10, 2023 7:37 pm

Thank you. This does load the config file. After experimenting with it, this problem acts like the bandeau configuration is not stored in the xcas.rc file. Can you tell me where the bandeau configuration is stored so I can research this further? If I know where in the xcas.rc file the visibility of the bandeau is stored I can tell if it is getting reset.

Matt

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

Re: Not loading configuration when started with fiename on command line

Message par parisse » mer. janv. 24, 2024 1:35 pm

Sorry for the late reply.
The bandeau/scientific keyboard configuration is encoded in xcas.rc after the fontsize and geometry of the window by bits 0 and 1 of an integer, e.g. 1 here:
widget_size(18,40,90,900,550,1
0 or 1 means scientific keyboard OFF/ON
+
0 or 2 means Bandeau OFF/ON

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

Re: Not loading configuration when started with fiename on command line

Message par XcasEngGuy » dim. janv. 28, 2024 11:07 pm

Here is the contents of xcas.rc on my machine.

widget_size([0,17,40,10],1275,90,903,927,2,0,0,[88,255,60,255,216,255,56,255,56,255,49],"'/cygdrive/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'",0,0,"","","A4",60);
cas_setup(0,0,1,1,0,[1e-12,1e-15],12,[4,100,0,25],0,1,0,1),xcas_mode(0);
xyztrange([-10.0,10.0,-10.0,10.0,-10.0,10.0,-10.0,10.0,-10.0,10.0,-1.4,1.1,1,0.0,1.0,3]);
autosimplify('Nop')

I believe that the 2 after 927 in widget_size is the integer you specified. xcas honors that value as long as no xcas file is included on the command line. Here are my startup files:

xcasen.bat:
copy /Y "C:\Programs_OS\xcas64\eq_funcs_template.xws" eq_funcs.xws
set PATH=%PATH%;C:\Programs_OS\xcas64
bash.exe '/cygdrive/C/Programs_OS/xcas64/runxcas.en' %~nx1

runxcas.en:
#! bash
export LANG=en
export XCAS_ROOT='/cygdrive/C/Programs_OS/xcas64'
export XCAS_LOCALE="$XCAS_ROOT/locale/"
export XCAS_HELP="$XCAS_ROOT/aide_cas"
xcas.exe eq_funcs.xws "$@"
#
# config=xcas.rc

Note: In runxcas.en I have 2 xws files specified on the command line. Either one alone also prevents the bandau from displaying.

Répondre