home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************\
- / \
- Manual V1.0, by Reinhard Grams © 1994
- \ /
- \*************************************************************/
-
- macro_name="Manual V1.0"
- macro_path="/MANU"
-
- /**************************************************************/
- call InitVariables()
- /**************************************************************/
-
- MAX_LINES=14
-
- text_path="TOASTER:LWE/MANUAL"
- item=1
-
- /**************************************************************/
-
- call OpenLibs()
- call GlobalsRequester(macro_name)
-
- call LoadConfig()
- item=Requester()
- if (item=0) then call CleanExit()
- call SaveConfig()
- call DoManual()
- call SaveConfig()
-
- call CloseLibs()
- exit 0
-
- /**************************************************************/
-
- Requester:
-
- mes.ENGLISH.1="Select Topic"
- mes.GERMAN.1="Auswahl des Themas"
- mes.ENGLISH.2="General Overview About Requester Formulas Library ADPro Installation"
- mes.GERMAN.2="Allgemeines Kurzübersicht Version Requester Formeln Library ADPro Installation"
-
- item=VariableChoice(mes.language.1,"",mes.language.2,words(mes.language.2),item)
- return item
-
- /**************************************************************/
-
- SaveConfig:
-
- if (open(state, config, 'W')) then do
- call writeln(state, "CONF")
- call writeln(state, item)
- call writeln(state, text_path)
- call close state
- end
- return
-
- /**************************************************************/
-
- LoadConfig:
-
- if (exists(config)) then do
- if (open(state, config, 'R')) then do
- if (readln(state)="CONF") then do
- parse value readln(state) with item .
- text_path=readln(state)
- end
- end
- call close state
- end
- return
-
- /**************************************************************/
- /**************************************************************/
-
- DoManual:
-
- page=trunc(item)
-
- text_ext.ENGLISH=".ENG"
- text_ext.GERMAN=".GER"
-
- names.1="GENERAL"
- names.2="OVERVIEW"
- names.3="ABOUT"
- names.4="REQUEST"
- names.5="FORMULAS"
- names.6="LIBRARY"
- names.7="ADPRO"
- names.8="INSTALL"
-
- title.ENGLISH.1="General"
- title.ENGLISH.2="Overwiev"
- title.ENGLISH.3="About"
- title.ENGLISH.4="Requester"
- title.ENGLISH.5="Formulas"
- title.ENGLISH.6="Library"
- title.ENGLISH.7="ADPro"
- title.ENGLISH.8="Installation"
-
- title.GERMAN.1="Allgemeines"
- title.GERMAN.2="Übersicht"
- title.GERMAN.3="Version"
- title.GERMAN.4="Requester"
- title.GERMAN.5="Formeln"
- title.GERMAN.6="Library"
- title.GERMAN.7="ADPro"
- title.GERMAN.8="Installation"
-
- file_name=names.page||text_ext.language
- page_title=title.language.page
-
- call LoadPage(file_name)
- call TextRequester(page_title,"text",language)
-
- return
-
- /**************************************************************/
-
- LoadPage: parse arg name
-
- readed=0
- page_name=LW_ADDFILE(text_path,name)
- do while (~exists(page_name))
- text_path=SelectFile(messages.language.TEXT_MESS,"TOASTER:","",selection1,"DRAWER")
- if (text_path="") then call CleanExit()
- page_name=LW_ADDFILE(text_path,name)
- end
- if (open(state, page_name, 'R')) then do
- lines=0
- do until (text.language.readed="[END]" | lines>MAX_LINES)
- readed=readed+1
- text.language.readed=readln(state)
- if (text.language.readed="[PAGE]") then lines=0
- else lines=lines+1
- end
- end
- if (text.language.readed~="[END]") then do
- readed=readed+1
- text.language.readed="[END]"
- end
-
- return readed
-
- /**************************************************************/
- /**************************************************************/
-
- ErrorMessage: parse arg status, add_string, user_cancel
-
- continue=0
- if (status~="") then do
- if (user_cancel~="") then user_sel=2; else user_sel=1
- if (verify(status,"0123456789")=0) then do
- if (status>0 & status<INTERNAL_ERR) then do
- if (add_string~="") then do
- continue=notify(user_sel,! errors.language.status"!",add_string)
- end
- else do
- continue=notify(user_sel,! errors.language.status"!")
- end
- end
- else do
- continue=notify(1,! errors.language.INTERNAL_ERR"!")
- end
- end
- else do
- if (add_string~="") then continue=notify(user_sel,! status,add_string)
- else continue=notify(user_sel,! status)
- end
- end
- return continue
-
- /**************************************************************/
-
- CleanExit: parse arg status, add_string, user_cancel
-
- call end_all()
- call ErrorMessage(status, add_string, user_cancel)
- call CloseLibs()
- exit 0
-
- /**************************************************************/
-
- OpenLibs:
-
- if (~show('L',rexxlib)) then do
- if ~addlib(rexxlib,0,-30,0) then do
- call ErrorMessage(OPEN_LIB_ERR,rexxlib)
- exit 10
- end
- if (~show('L',rexxlib)) then do
- call ErrorMessage(OPEN_LIB_ERR,rexxlib)
- exit 10
- end
- end
- if (~show('L',mathlib)) then do
- if ~addlib(mathlib,0,-30,0) then do
- call ErrorMessage(OPEN_LIB_ERR,mathlib)
- exit 10
- end
- if (~show('L',mathlib)) then do
- call ErrorMessage(OPEN_LIB_ERR,mathlib)
- exit 10
- end
- end
- if (~show('L',supplib)) then do
- if ~addlib(supplib,0,-30,0) then do
- call ErrorMessage(OPEN_LIB_ERR,supplib)
- exit 10
- end
- if (~show('L',supplib)) then do
- call ErrorMessage(OPEN_LIB_ERR,mathlib)
- exit 10
- end
- end
- port=addlib("LWModelerARexx.port",0)
- return
-
- /**************************************************************/
-
- CloseLibs:
-
- if (port~="") then call remlib("LWModelerARexx.port")
- return
-
- /**************************************************************/
-
- SelectFile: PROCEDURE EXPOSE selected_file selected_drawer
- parse arg title, drawer_name, file_name, config_file, mode
-
- if (exists(config_file)) then do
- if (open(state,config_file,'R')) then do
- if (readln(state)="FSEL") then do
- drawer_name=readln(state)
- file_name=readln(state)
- end
- call close state
- end
- end
- if (mode=DRAWER) then choice=getfilename(title,drawer_name,"")
- else choice=getfilename(title,drawer_name,file_name)
- if (choice="(none)") then return ""
- selected_drawer=LW_Drawer(choice)
- selected_file=LW_File(choice)
- if (mode~="DRAWER") then do
- if (selected_file="") then return ""
- end
- if (open(state,config_file,'W')) then do
- call writeln(state, "FSEL")
- call writeln(state, selected_drawer)
- call writeln(state, selected_file)
- call close(state)
- end
- select
- when (mode="DRAWER") then choice=selected_drawer
- when (mode="FILE") then choice=selected_file
- otherwise nop
- end
-
- return choice
-
- /**************************************************************/
-
- HelpRequester: parse arg title, text_array, language
-
- select
- when (help_type=HELP_NEVER) then return
- when (help_type=HELP_FIRST) then do
- if (exists(config)) then return
- end
- otherwise nop
- end
- if (~TextRequester(title,text_array,language)) then do
- call GlobalsRequester(title,1)
- end
- return
-
- /**************************************************************/
-
- TextRequester: parse arg title, text_array, language
-
- hpages=1
- hline=1
- do until (str="[END]")
- interpret("str="text_array"."language"."hline)
- if (str="[PAGE]") then hpages=hpages+1
- hline=hline+1
- end
- call req_begin(title||pmes.language.1 "1" pmes.language.2 hpages)
- hline=1; continue=1; hpage=1
- do while (continue)
- interpret("htext="text_array"."language"."hline)
- select
- when (htext="[PAGE]") then do
- go_on=req_post()
- call req_end()
- if (go_on) then do
- hpage=hpage+1
- call req_begin(title||pmes.language.1 hpage pmes.language.2 hpages)
- end
- else continue=0
- end
- when (htext="[END]") then do
- go_on=req_post()
- call req_end()
- continue=0
- end
- otherwise do
- id.hline=req_addcontrol("",'t',htext)
- end
- end
- hline=hline+1
- end
- return go_on
-
- /**************************************************************/
-
- SaveSettings: PROCEDURE EXPOSE ENV_ERR envpath globals language,
- help_type verbose extension_digits
-
- if (~exists(envpath)) then do
- address command "makedir" envpath
- if (~exists(envpath)) then call CleanExit(ENV_ERR)
- end
- ok=0
- if (open(state, globals, 'W')) then do
- call writeln(state, "GLBS")
- call writeln(state, language help_type verbose extension_digits)
- call close(state)
- ok=1
- end
- return ok
-
- /**************************************************************/
-
- LoadSettings: PROCEDURE EXPOSE ENV_ERR envpath globals language,
- help_type verbose extension_digits
-
- if (~exists(envpath)) then do
- address command "makedir" envpath
- if (~exists(envpath)) then call CleanExit(ENV_ERR)
- end
- ok=0
- if (exists(globals)) then do
- if (open(state, globals, 'R')) then do
- if (readln(state)="GLBS") then do
- parse value readln(state) with language help_type,
- verbose extension_digits .
- ok=1
- end
- call close(state)
- end
- end
- return ok
-
- /**************************************************************/
-
- GlobalsRequester: PROCEDURE EXPOSE ENV_ERR envpath globals language,
- help_type verbose extension_digits
- parse arg title, force
-
- loaded=LoadSettings()
- if (force="") then do
- if (loaded) then return
- end
- call req_begin(title": Globals")
- id_la=req_addcontrol("Language", 'ch',"English German")
- id_he=req_addcontrol("Help", 'ch',"First Always Never")
- id_ve=req_addcontrol("Verbose", 'b')
- id_ex=req_addcontrol("Ext. Digits", 'n')
- call req_setval(id_la, language)
- call req_setval(id_he, help_type)
- call req_setval(id_ve, verbose)
- call req_setval(id_ex, extension_digits)
- if (~req_post()) then do; call req_end(); return 0; end
- language=req_getval(id_la)
- help_type=req_getval(id_he)
- verbose=req_getval(id_ve)
- extension_digits=req_getval(id_ex)
- call req_end()
- if (extension_digits<2) then extension_digits=2
- call SaveSettings()
- return
-
- /**************************************************************/
-
- GetExtension: PROCEDURE; parse arg exname
-
- l=length(exname)
- s=verify(reverse(exname),"0123456789")
- if (s>l) then return exname
- if (s<2) then return ""
- return substr(exname,length(exname)+2-s)
-
- /**************************************************************/
-
- GetBaseName: PROCEDURE; parse arg exname
-
- b=length(exname)-length(GetExtension(exname))
- return substr(exname,1,b)
-
- /**************************************************************/
-
- GetExtensionDigits: PROCEDURE; parse arg exname
-
- return length(GetExtension(exname))
-
- /**************************************************************/
-
- MakeExtension: PROCEDURE; parse arg exname, ext_digits
-
- return right(exname,ext_digits,'0')
-
- /**************************************************************/
-
- VariableChoice: PROCEDURE EXPOSE language ENGLISH GERMAN pmes.
- parse arg title, descriptor, array, visible, selected
-
- vchoice=0
- to_show=words(array); coffset=1; cpage=1; cpages=to_show/visible;
- if ((to_show//visible)>0) then cpages=cpages+1; cpages=trunc(cpages)
- do while (to_show>0)
- if (to_show>visible) then citems=visible; else citems=to_show
- vc=""; do i=coffset to citems+coffset-1; vc=vc word(array,i); end
- if (cpages>1) then call req_begin(title||pmes.language.1 cpage pmes.language.2 cpages)
- else call req_begin(title)
- vci=req_addcontrol(descriptor,'cv',vc)
- call req_setval(vci,selected)
- if (~req_post()) then do; call req_end(); return 0; end
- vchoice=req_getval(vci)
- call req_end()
- to_show=to_show-citems; coffset=coffset+citems
- end
- return vchoice
-
- /**************************************************************/
-
- error:
- syntax:
-
- t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
- call CleanExit()
-
- /**************************************************************/
- /**************************************************************/
-
- InitVariables:
-
- mathlib="rexxmathlib.library"
- rexxlib="rexxsupport.library"
- supplib="LWE.library"
- port=""
-
- envpath="ENV:LWEnhancer"
- globals=envpath"/LWEN.GLB"
- envname=envpath||macro_path
- config=envname".CNF"
-
- selection1=envname".1"
-
- /**************************************************************/
-
- ENGLISH=1
- GERMAN=2
-
- HELP_FIRST=1
- HELP_ALWAYS=2
- HELP_NEVER=3
-
- help_type=HELP_FIRST
- language=ENGLISH
- verbose=1
- extension_digits=3
-
- /**************************************************************/
-
- pmes.ENGLISH.1=": Page"
- pmes.ENGLISH.2="from"
- pmes.GERMAN.1=": Seite"
- pmes.GERMAN.2="von"
-
- NO_ERROR=0
- FILE_ERR=1
- OPEN_LIB_ERR=2
- READ_ERR=3
- WRITE_ERR=4
- ENV_ERR=5
- INTERNAL_ERR=6
-
- errors.ENGLISH.FILE_ERR="File not found"
- errors.ENGLISH.OPEN_LIB_ERR="Can't open Library"
- errors.ENGLISH.READ_ERR="Read Error"
- errors.ENGLISH.WRITE_ERR="Write Error"
- errors.ENGLISH.ENV_ERR="Can't create"
- errors.ENGLISH.INTERNAL_ERR="Internal Error"
-
- errors.GERMAN.FILE_ERR="Datei nicht gefunden"
- errors.GERMAN.OPEN_LIB_ERR="Kann Library nicht öffnen"
- errors.GERMAN.READ_ERR="Fehler beim Lesen der Datei"
- errors.GERMAN.WRITE_ERR="Fehler beim Schreiben der Datei"
- errors.GERMAN.ENV_ERR="Kann Verzeichnis nicht anlegen"
- errors.GERMAN.INTERNAL_ERR="Interner Fehler"
-
- /**************************************************************/
-
- TEXT_MESS=1
-
- messages.ENGLISH.TEXT_MESS="Please select the Help Directory"
- messages.GERMAN.TEXT_MESS="Bitte wählen Sie das Hilfeverzeichnis"
-
- /**************************************************************/
-
- return
-
-