\ autoload file
\ hs 22.02.97
only forth also definitions hidden also  system also decimal
[ifdef] floats-on	floats-on [then]

: ?load-file	( str -- )
	dup file-exists? if ??cr load-file else cr ." --> Can't load " ". then ;

\ ********************************************************************************************
\ This part between the star lines should not be removed, in case you find a bug or would like
\ to include a feature, let me know it.  hs 21.11.96
: auto-install
	p" cd <Forthmacs$Dir>"  "cli drop
	p" enumdir risc_os.installjob fileliste" "cli drop
	p" fileliste" read fopen
	astring astring locals| cmd job fd |
	begin	job fd fgetline
	while	p" risc_os.installjob." cmd "copy  job cmd "cat ??cr cr cmd load-file
	repeat
	fd fclose	
        p" wipe fileliste ~C~V"				"cli drop
	p" Ifthere risc_os.installjob.* then wipe risc_os.installjob.* ~C~V" "cli drop
	p" back"					"cli drop
	??cr ;
auto-install  forget auto-install
\ *******************************************************************************************


libcall: emacs

: cli-undefined
	astring astring locals| command line |
	command "copy  p"  " command "cat  get-tail command "cat  command "cli
	if command (interpret-do-undefined else .cli-out then
	 ; ' cli-undefined is interpret-do-undefined
: ?fload	\ name
	blword ?load-file ;
: edit		( filename -- error? )
	astring "move astring astring locals| oldfilepath command filename |
	p" File$Path" getenv ?dup 0= if nullstring then oldfilepath "copy
	p" Set File$Path @.,<Forthmacs$Dir>.risc_os.bin.cmd." "cli drop
	p" emacs " command "copy  filename command "cat  command "shell
	oldfilepath c@
	if	p" Set File$Path "  command "copy   oldfilepath command "cat
	else	p" Unset File$Path" command "copy
	then command "cli drop
	erase-screen ;
: ed	blword edit ;
only forth also definitions

p" Forthmacsoptions" get-env-var d# 255 and
\ dup d# 01 and [if] ?fload lib.compatible	??cr [then]
dup d# 16 and [if] ?fload blocks 		??cr [then]
dup d# 08 and [if] ?fload modem			??cr [then]
dup d# 64 and [if] ?fload lib.clock		??cr [then]
dup d# 04 and [if] ?fload tracer		??cr [then]
dup d# 02 and [if] ?fload debugger		??cr [then]
dup d# 32 and [if] ?fload profiler		??cr [then]
dup d# 128 and [if] ?fload optimizer		??cr [then]
drop