#] #] ********************* #] loaddefs link d_Qndfs 'PROFILE.NDF' - very old split window, menu] system of QNial, but interesting # came with QNial, maybe some adaptations f_QNialMenus := 'PROFILE.NDF' ; loaddefs_start f_QNialMenus ; #**************************** # List of operators, generated with : # $ cat "$d_Qndfs""PROFILE.NDF" | grep "^#]" | sed 's/^#\]/ /' # ********************* loaddefs link d_Qndfs 'PROFILE.NDF' - very old split window, menu] system of QNial, but interesting Demo IS EXTERNAL EXPRESSION - Latent IS EXTERNAL EXPRESSION - Monostyle IS EXTERNAL EXPRESSION - Readselections IS EXTERNAL EXPRESSION - Recover IS EXTERNAL EXPRESSION - boxtext IS EXTERNAL OPERATION - centertext IS EXTERNAL OPERATION - drawselectwindow IS EXTERNAL OPERATION - driver IS EXTERNAL OPERATION - man IS EXTERNAL OPERATION - menupick IS EXTERNAL OPERATION - menucontrol IS EXTERNAL OPERATION - menusetup IS EXTERNAL OPERATION - popup IS EXTERNAL OPERATION - saveselections IS EXTERNAL OPERATION - boxtext IS OPERATION Color Org Strings { - Demo IS { - driver IS OPERATION Filename { - Latent IS { - Monostyle IS ( - menucontrol IS OPERATION Menu Org Depth { - menusetup IS OPERATION Title { - Readselections IS { - Recover IS { - saveselections IS OPERATION Selections { - #*********************************** Blue := 1; White := 4; Brightyellow := 11; Brightred := 10; Brightblue := 9 ; Lightblue := 5; Green := 7; __Bgrd := Blue ; __Text := White ; __Ctxt := Brightyellow ; __Cbck := Lightblue ; Commandcol := Brightblue Green 0; # Menu descriptors aimenu := [ '' , [ ' AI Capabilities' 'driver . link nialroot ''nialhelp\ai'' ' , ' Logic Programming' 'driver . link nialroot ''nialhelp\lpintro'' ' , ' Frame Language' 'driver . link nialroot ''nialhelp\frame'' ' , ' Rule-Based Systems' 'driver . link nialroot ''nialhelp\rbi'' ', ' An Expert System' 'driver . link nialroot ''nialhelp\es'' ' ] ]; intromenu := [ '' , [ ' Introduction' 'driver . link nialroot ''nialhelp\intro'' ' , ' Tutorial Demonstration' 'load link nialroot ''teach'' ' , ' Array Editor Example' 'load link nialroot ''aredit'' ' , ' Direct Access Files ' 'driver . link nialroot ''nialhelp\cfs'' ', ' Roster Database' 'driver . link nialroot ''nialhelp\rosters'' ' , ' AI Toolkit' aimenu, ' Some Games' 'load link nialroot ''games'' ' ] ]; topmenu := [ 'Topics' , [ ' Programming in Windows' 'load link nialroot ''loop'' ' , ' Howell''s Windows' 'load link nialroot ''loophow' ' ', ' Top Level Loop Environment' 'clearws', ' Tutorial Manual Environment' 'load link nialroot ''tutorial'' ', ' AI Toolkit' aimenu, ' Introduction to Q''Nial' intromenu ] ]; Demomenu := ['Next Page','Previous Page','Scroll Forwd', 'Scroll Backwd','Go to Page ','Enter Q''Nial','Quit']; Normal := __Text __Bgrd 0; Popupcolor := __Text __Bgrd 0; Recoversw := o; Reversevideo := __Bgrd __Text 0; Screencol := __Text __Bgrd 0; Title := 'Q''Nial Development Environment'; Titlecol := __Text __Bgrd 0; Underlined := Brightred Brightyellow 0; IF flag_debug THEN write 'loading Demo' ; ENDIF ; #] Demo IS EXTERNAL EXPRESSION - Demo IS EXTERNAL EXPRESSION IF flag_debug THEN write 'loading Latent' ; ENDIF ; #] Latent IS EXTERNAL EXPRESSION - Latent IS EXTERNAL EXPRESSION IF flag_debug THEN write 'loading Monostyle' ; ENDIF ; #] Monostyle IS EXTERNAL EXPRESSION - Monostyle IS EXTERNAL EXPRESSION IF flag_debug THEN write 'loading Readselections' ; ENDIF ; #] Readselections IS EXTERNAL EXPRESSION - Readselections IS EXTERNAL EXPRESSION IF flag_debug THEN write 'loading Recover' ; ENDIF ; #] Recover IS EXTERNAL EXPRESSION - Recover IS EXTERNAL EXPRESSION IF flag_debug THEN write 'loading boxtext' ; ENDIF ; #] boxtext IS EXTERNAL OPERATION - boxtext IS EXTERNAL OPERATION IF flag_debug THEN write 'loading centertext' ; ENDIF ; #] centertext IS EXTERNAL OPERATION - centertext IS EXTERNAL OPERATION IF flag_debug THEN write 'loading drawselectwindow' ; ENDIF ; #] drawselectwindow IS EXTERNAL OPERATION - drawselectwindow IS EXTERNAL OPERATION IF flag_debug THEN write 'loading driver' ; ENDIF ; #] driver IS EXTERNAL OPERATION - driver IS EXTERNAL OPERATION IF flag_debug THEN write 'loading man' ; ENDIF ; #] man IS EXTERNAL OPERATION - man IS EXTERNAL OPERATION IF flag_debug THEN write 'loading menupick' ; ENDIF ; #] menupick IS EXTERNAL OPERATION - menupick IS EXTERNAL OPERATION IF flag_debug THEN write 'loading menucontrol' ; ENDIF ; #] menucontrol IS EXTERNAL OPERATION - menucontrol IS EXTERNAL OPERATION IF flag_debug THEN write 'loading menusetup' ; ENDIF ; #] menusetup IS EXTERNAL OPERATION - menusetup IS EXTERNAL OPERATION IF flag_debug THEN write 'loading popup' ; ENDIF ; #] popup IS EXTERNAL OPERATION - popup IS EXTERNAL OPERATION IF flag_debug THEN write 'loading saveselections' ; ENDIF ; #] saveselections IS EXTERNAL OPERATION - saveselections IS EXTERNAL OPERATION IF flag_debug THEN write 'loading boxtext' ; ENDIF ; #] boxtext IS OPERATION Color Org Strings { - boxtext IS OPERATION Color Org Strings { setwindow [ Org , [ tally , 4 + max EACH tally ] Strings , Color , Color , Color , '' ] ; Clearwindow ; putstrings Strings ( 0 2 ) Color } library "centerte IF flag_debug THEN write 'loading Demo' ; ENDIF ; #] Demo IS { - Demo IS { Selections := Readselections ; IF not empty Selections THEN menusetup Title ; menucontrol Topmenu ( 5 10 ) 0 ; ELSE saveselections [ 0 ] ; setwindow Null ; ENDIF ; } IF flag_debug THEN write 'loading driver' ; ENDIF ; #] driver IS OPERATION Filename { - driver IS OPERATION Filename { Dirfn := open Filename "d ; IF isfault Dirfn or ( ( Numpages := filetally Dirfn ) = 0 ) THEN boxtext Popupcolor ( 4 1 ) [ 'Sorry, the demonstration file: ' , link ' ' ( string Filename ) , 'is not available. Press any key to continue. ' ] ; Readchar ; ELSE Select := 0 ; Pageno := 0 ; Starttextcol := ( max EACH tally Demomenu ) + 3 ; Endtext := 78 - Starttextcol ; Changed := l ; REPEAT IF Changed THEN Record := readrecord Dirfn Pageno ; Spageno Textlines Resultlines := execute Record ; Textwlength := min ( tally Textlines ) 20 ; Startnial := max 10 ( Textwlength + 3 ) ; Textw := [ 1 Starttextcol , Textwlength Endtext , Normal, Normal, Normal, 'Description' ] ; Nialw := [ Startnial 1 , ( 23 - Startnial ) 77 , Normal, Normal, Normal, 'Q''Nial Interpreter Window' ] ; setwindow [0 0,25 80,Normal,Normal]; Clearwindow ; setwindow Textw ; putstrings [ Textlines , 0 0 , Normal ] ; Resultpos := 0 0 ; ENDIF ; setwindow Nialw ; Clearwindow ; putstrings [ Resultlines , 0 0 , Normal , Resultpos ] ; Pagemsg := link 'page ' ( string ( Pageno + 1 ) ) ' of ' ( string Numpages ) ; Select := popup Normal (0 0) Pagemsg Demomenu ; Changed := l ; IF Select ~= ??Quit THEN CASE Select FROM 0 : Pageno := Pageno + 1 mod Numpages END 1 : Pageno := Pageno - 1 mod Numpages END 2 : Resultpos := Resultpos + ( ( first second Nialw - 1 ) min ( tally Resultlines - 1 ) ) 0 ; Changed := o ; END 3 : Resultpos := Resultpos - ( ( first second Nialw - 1 ) max 0 ) 0 ; Changed := o ; END 4 : Clearwindow ; setcursor 0 0 ; Pageno := (read 'Pageno: ') - 1 mod Numpages ; END 5 : setwindow [ 10 35 , 14 44 , Normal, Normal, Normal] ; Clearwindow ; Break ; END 6 : Select := ??Quit END ENDCASE ; ENDIF ; UNTIL Select = ??Quit ENDREPEAT ; ENDIF ; close Dirfn ; } IF flag_debug THEN write 'loading Latent' ; ENDIF ; #] Latent IS { - Latent IS { Monostyle ; Demo ; } IF flag_debug THEN write 'loading Monostyle' ; ENDIF ; #] Monostyle IS ( - Monostyle IS ( Screencol Titlecol Commandcol := Normal Normal Normal ; Popupcolor := Normal ; ) IF flag_debug THEN write 'loading menucontrol' ; ENDIF ; #] menucontrol IS OPERATION Menu Org Depth { - menucontrol IS OPERATION Menu Org Depth { NONLOCAL Recoversw ; Recoversw := o ; Title := first Menu ; Strings := EACH first second Menu ; Actions := EACH second second Menu ; Selections := Readselections ; Select := Selections @ Depth ; % recur if there are multiple menus open; IF tally Selections - 1 > Depth THEN menucontrol ( Select pick Actions ) ( + ( 2 2 ) Org ( Select 0 ) ) ( Depth + 1 ) ; ELSE Select := popup Normal Org Title Strings ; IF Select = ??Quit THEN Selections := front Selections ; saveselections Selections ; ELSE Action := Select pick Actions ; Selections @ Depth := Select ; saveselections Selections ; IF isstring Action THEN setwindow [ 10 40 , 3 38 , Normal , Normal ] ; puttext ( Normal ) ( 1 1 ) ( 'Loading selection. Please wait.' ) ; Result := execute Action ; % control will never return here if a load is executed; IF Result ~= ??noexpr THEN boxtext Popupcolor ( 20 7 ) [ 'Sorry, the selection: ' , link ' ' ( string . Select pick Strings ) , 'failed. Press any key to continue. ' ] ; Readchar ; ENDIF ; ELSE % recur on the selected submenu; saveselections ( Selections append 0 ) ; menucontrol ( Select pick Actions ) ( + ( 2 2 ) Org ( Select 0 ) ) ( Depth + 1 ) ; ENDIF ; ENDIF ; ENDIF ; % jump to top level to redisplay the menus; Recoversw := l ; Toplevel ; } IF flag_debug THEN write 'loading menusetup' ; ENDIF ; #] menusetup IS OPERATION Title { - menusetup IS OPERATION Title { Clearscreen ; setwindow [ 0 0 , 25 80 , Screencol ] ; boxtext Titlecol ( 1 1 ) [ centertext Title 72 ] ; boxtext Commandcol ( 18 50 ) [ ' Up' , ' Down' , ' Select', ' Previous Menu', ' Recover' ] ; } library "popup IF flag_debug THEN write 'loading Readselections' ; ENDIF ; #] Readselections IS { - Readselections IS { Menusw := link nialroot 'nialhelp\menusw' ; Menufile := open Menusw "r ; IF isfault Menufile THEN saveselections [ 0 ] ; [ 0 ] ELSE Selections := execute readfile Menufile ; close Menufile ; Selections ENDIF } IF flag_debug THEN write 'loading Recover' ; ENDIF ; #] Recover IS { - Recover IS { NONLOCAL Recoversw ; EACH close tell 16 ; IF Recoversw THEN Recoversw := o ; Latent ; ELSE setwindow [ 0 0 , 25 80 , Normal, Normal ] ; Clearwindow ; Answer := popup Normal (3 35) ' Recover ' ['Quit the Program', 'Return to the Program','Enter Break Mode','Leave Q''Nial']; CASE Answer FROM 0 : saveselections [ 0 ] ; END 1 : Latent ; END 2 : Break ; Latent ; END 3 : Bye ; END ELSE Latent ; ENDCASE ; ENDIF ; } IF flag_debug THEN write 'loading saveselections' ; ENDIF ; #] saveselections IS OPERATION Selections { - saveselections IS OPERATION Selections { Menufile := open ( link nialroot 'nialhelp\menusw' ) "w ; writefile Menufile ( display Selections ) ; close Menufile ; } loaddefs_ended f_QNialMenus ; # enddoc