$ Verify_Setting := 'F$VERIFY(F$LOGI("FORMS$DEMO_DEBUG")) $ SET = "SET" $ ON = "ON" $ Set on $ On Control_Y Then Goto ctrl_y_exit ! CTRL-Y handler $ Set Control=(T,Y) ! Allow CTRL-Y $ On Warning Then Continue $ On Error Then Goto Ctrl_y_exit $ On Severe_Error Then Goto Ctrl_y_exit $! $!----------------------------------------------------------------------------- $! $! © Copyright 2005 Hewlett-Packard Development Company,L.P. $! $! Consistent with FAR 12.211 and 12.212, Commercial Computer Software, $! Computer Software Documentation, and Technical Data for Commercial $! Items are licensed to the U.S. Government under vendor's standard $! commercial license. $! $!----------------------------------------------------------------------------- $! $! $! Facility: $! DECforms Demonstrations $! $! Description: $! $! Using this command file $! ----------------------- $! $! This command file is run like this: $! $! $ @FORMS$EXAMPLES:FORMS$DEMO $! $! It brings up a menu of all the possible demo files, and lets $! you run any of them. It continues to run your choice of demo $! until you press F10 (or CTRL/Z). $! $! It runs boths kinds of demos: $! - FORMS$DEMO_*.EXE (sample applications from HP) $! - FORMS$DEMO_*_FORM.EXE (enabled by FORMS$DEMO_ENABLE program) $! - DEMO_*.EXE (sample applications from Customer) $! - DEMO_*_FORM.EXE (enabled by FORMS$DEMO_ENABLE program) $! $! ( Files named FORMS$xxx are supplied by HP ) $! ( Files named DEMO__xxx are customer supplied ) $! $! Parameters: (Normally, these are both omitted) $! $! P1 = Directory where demo files are $! default: FORMS$EXAMPLES: $! -OPTIONAL- $! $! P2 = Location of the DEMO_ENABLE program $! default: same dev:[dir] as this file $! -OPTIONAL- $! $! ----------------------------------------------------------------------------- $! $! Adding your own demos to FORMS$EXAMPLES: $! ---------------------------------------- $! $! You can add your own demos to FORMS$EXAMPLES by following these $! conventions: $! $! A) To Create Applications that call Forms: $! $! 1) Create your application program. Include your form $! (link it in) with your program for fastest startup. $! Use this naming convention for the image file: $! $! DEMO_xxx.EXE $! $! 2) If your .FORM file is not linked in, use the same $! naming convention for it: $! $! DEMO_xxx.FORM $! $! 3) Place the file(s) in the FORMS$EXAMPLES: directory $! $! $! B) To Create Forms that are ENABLED by FORMS$DEMO_ENABLE (no $! application program): $! $! 1) Create your IFDL with the internal form name that is the $! same as the file name. That is, if your IFDL source file $! is called DEMO_MYFORM_FORM.IFDL, then your IFDL would look $! like this: $! $! Form DEMO_MYFORM_FORM $! . . . $! End Form $! $! 2) Be sure to include an ENABLE RESPONSE in your form that $! activates all or some of the panels. (If you do not, your $! form will not do anything.) $! $! 3) Compile your form and make it into a shareable image like $! this: $! $! $ FORMS TRANSLATE /NOCOMMENTS $! $ FORMS EXTRACT OBJECT $! $ LINK /SHAREABLE $! $! 4) Place the shareable image into FORMS$EXAMPLES: $! $!------------------------------------------------------------------------------ $! $! Modification History: $! $! 14-Feb-89 DEC Original version $! 11-Jul-89 DEC Shareable images, better names $! $!----------------------------------------------------------------------------- $! $! $! Reset commands we use $! $ DEFINE = "DEFINE" $ EXIT = "EXIT" $ GOTO = "GOTO" $ IF = "IF" $ THEN = "THEN" $ ELSE = "ELSE" $ RUN = "RUN" $! $! Set up highlight escape sequences $! $ ESC[0,7]= 27 $ BOLD = ESC + "[1m" $ REV = ESC + "[7m" $ HI = ESC + "[7;4m" $ BOFF = ESC + "[0m" $ WIDE = ESC + "#6" $ NUM_KEYS= ESC + ">" $ WIDTH_80= ESC + "[?3l" $ GROFF[0,7]= 15 $ RESET_SCREEN = ESC + "[2J" + ESC + "[H" + GROFF + NUM_KEYS + WIDTH_80 $ term_size = f$getdvi("SYS$COMMAND","TT_PAGE") -1 ! "-1" to prevent scroll $ BOTTOM_LINE = ESC + "[''term_size';1H" + ESC + "[J" + GROFF $! $! Set keypad numeric, for simpler use of the menu $! (We restore it later) $! $ Keypad = F$GETDVI("SYS$COMMAND","TT_APP_KEYPAD") $ BroadCasts = .NOT. F$GETDVI("SYS$COMMAND","TT_NOBRDCST") $ Width = 80 $!!$ Width = F$GETDVI("SYS$COMMAND","TT_WIDTH") $ Set Terminal/NOAPPLICATION/NOBROADCAST/WIDTH=80 $! $! Return status variable $! $ return_status = 1 !default is ok $! $! Assume ENABLE program is in same location as this command file $! unless P2 overrides with another location $! $ IF P2 .nes. "" $ Then $ ! Make sure logicals have ":" on the end $ LAST_CHAR = f$extr(f$len(P2)-1,1,P2) $ If (LAST_CHAR .nes. "]") - .and. (LAST_CHAR .nes. ">") - .and. (LAST_CHAR .nes. ":") - Then P2 = P2 + ":" $ DEMO_LOC = P2 $ Else $ THIS_FILE = F$envi("procedure") $ DEMO_LOC = f$parse(this_file,,,"device") + f$parse(this_file,,,"directory") $ ENDIF $! $! This symbol is used below to run the *_FORM.EXE files $! $ DEMO_ENABLE := "$''DEMO_LOC'FORMS$DEMO_ENABLE" $! $! Setup symbol to the directory containing all the demo files $! $ IF P1 .nes. "" $ Then $ ! Make sure logicals have ":" on the end $ LAST_CHAR = f$extr(f$len(P1)-1,1,P1) $ If (LAST_CHAR .nes. "]") - .and. (LAST_CHAR .nes. ">") - .and. (LAST_CHAR .nes. ":") - Then P1 = P1 + ":" $ DEMO_DIR = P1 $ Else $ DEMO_DIR := "FORMS$EXAMPLES:" $ ENDIF $ $! $! $! $! Find out what applications/forms are available to the user $! ----------------------------------------------------------- $! $ DEMO_SPEC = "''DEMO_DIR'*.EXE" $ EXCLUDE_APPL_FILES = ",ENABLE," !Include all commas $ EXCLUDE_FORM_FILES = "" !Include all commas $! $ CNT_APPL = 0 $ CNT_FORM = 0 $ CTX = "" !For F$Search $! $! Loop to find all the .EXE files in the demo directory $! $EXE_FILE_LOOP: $! $ DEMO_FILESPEC = F$SEARCH( DEMO_SPEC, CTX ) $ IF DEMO_FILESPEC .EQS. "" Then goto END_EXE_FILE_LOOP $! $! Is this .EXE a valid demo file? (Naming conventions) $! $ DEMO_NAME = F$PARSE( DEMO_FILESPEC, , , "NAME") $ If (F$LOCA("FORMS$", DEMO_NAME) .gt. 0) - .And. (F$LOCA("DEMO_", DEMO_NAME) .gt. 0) - THEN GOTO EXE_FILE_LOOP $! $! Strip naming convention stuff, so we have the demo name we'll display to the $! user. $ DEMO_NAME = DEMO_NAME - "DEMO_" - "FORMS$" - "_FORM" $! $! $! Did we already get this demo? (Search lists) $! If so, skip it $! $ CNT2 = 0 $EXE_SEA_LIST_LOOP: $ CNT2 = CNT2 + 1 $ If CNT2 .gt. CNT_FORM .and. CNT2 .gt. CNT_APPL Then goto END_EXE_SEA_LIST_LOOP $ If CNT2 .le. CNT_FORM Then - If DEMO_NAME .eqs. FORM_DEMO_NAME_'CNT2 Then GOTO EXE_FILE_LOOP $ If CNT2 .le. CNT_APPL Then - If DEMO_NAME .eqs. APPL_DEMO_NAME_'CNT2 Then GOTO EXE_FILE_LOOP $ GOTO EXE_SEA_LIST_LOOP $END_EXE_SEA_LIST_LOOP: $! $! $! Is this a FORM (shareable image) or an APPLication program? $! $ If F$LOCA("_FORM.EXE", DEMO_FILESPEC) .lt. F$LEN(DEMO_FILESPEC) $ Then $ ! $ ! Its a FORM Shareable image $ ! $ $ ! Are we to Exclude it? $ ! $ If f$loc(","+DEMO_NAME+",",EXCLUDE_FORM_FILES) .lt. - f$LEN(EXCLUDE_FORM_FILES) then goto EXE_FILE_LOOP $ ! $ ! We want this one, so save it's two names (File & Demo) $ ! $ CNT_FORM = CNT_FORM + 1 $ FORM_FILESPEC_'CNT_FORM = DEMO_FILESPEC $ FORM_DEMO_NAME_'CNT_FORM = DEMO_NAME $! $ Else $ ! $ ! Its an APPLICATION image $ ! $ ! Are we to Exclude it? $ ! $ If f$loc(","+DEMO_NAME+",",EXCLUDE_APPL_FILES) .lt. - f$LEN(EXCLUDE_APPL_FILES) then goto EXE_FILE_LOOP $ ! $ ! We want this one, so save it's two names (File & Demo) $ ! $ CNT_APPL = CNT_APPL + 1 $ APPL_FILESPEC_'CNT_APPL = DEMO_FILESPEC $ APPL_DEMO_NAME_'CNT_APPL = DEMO_NAME $! $ EndIf $! $! Loop for more... $! $ GOTO EXE_FILE_LOOP $ $END_EXE_FILE_LOOP: $! $! We need to know how many APPLICATIONS we found $! $ APPL_DEMO_MAX = CNT_APPL ! Save the number of APPLICATION EXE's we found $ FORM_DEMO_MAX = CNT_FORM ! Save the number of FORM EXE's we found $ DEMO_MAX = APPL_DEMO_MAX + FORM_DEMO_MAX $! $ GOTO GET_DEMO_2 ! Skip the pause $! $! $! Get the user's choice $! --------------------- $! $GET_DEMO: ! Pause, if re-running a demo $! $ open /read keyboard sys$command: $ Read /prompt="''BOTTOM_LINE'Press ''REV' Return ''BOFF' to run another demo... " /End=exit keyboard USER_CHOICE $ Close/Nolog keyboard $! $GET_DEMO_2: $! $! Header message $! $ write sys$output RESET_SCREEN $ write sys$output " " $ write sys$output " ''WIDE'''BOLD' DECforms Demos ''BOFF'" $ write sys$output " " $! $ IF DEMO_MAX .le. 0 Then GOTO NO_DEMOS $ IF APPL_DEMO_MAX .le. 0 Then GOTO END_DISPLAY_APPL_LOOP $ Type SYS$INPUT These Demo Applications are available: $! $ CNT = 1 $! $! Display the APPLICATION files, two across $! $DISPLAY_APPL_LOOP: $ CNT2 = CNT + 1 $ IF CNT .gt. APPL_DEMO_MAX Then GOTO END_DISPLAY_APPL_LOOP $ IF CNT2 .gt. APPL_DEMO_MAX $ Then OUT_LINE = F$FAO(" ''HI' !2UL ''BOFF' !25AS", (CNT), APPL_DEMO_NAME_'CNT ) $ ELSE OUT_LINE = F$FAO(" ''HI' !2UL ''BOFF' !25AS ''HI' !2UL ''BOFF' !AS", (CNT), APPL_DEMO_NAME_'CNT, (CNT2), APPL_DEMO_NAME_'CNT2 ) $ ENDIF $ Write sys$output OUT_LINE $ CNT = CNT + 2 $ GOTO DISPLAY_APPL_LOOP $! $END_DISPLAY_APPL_LOOP: $! $ IF FORM_DEMO_MAX .le. 0 Then GOTO END_DISPLAY_FORM_LOOP $ Type SYS$INPUT These Demo Forms are available: $! $ CNT = 1 $! $! Display the *_FORM.EXE files, two across $! $DISPLAY_FORM_LOOP: $ CNT2 = CNT + 1 $ IF CNT .gt. FORM_DEMO_MAX Then GOTO END_DISPLAY_FORM_LOOP $ IF CNT2 .gt. FORM_DEMO_MAX $ Then OUT_LINE = F$FAO(" ''HI' !2UL ''BOFF' !25AS", (CNT+APPL_DEMO_MAX), FORM_DEMO_NAME_'CNT ) $ ELSE OUT_LINE = F$FAO(" ''HI' !2UL ''BOFF' !25AS ''HI' !2UL ''BOFF' !AS", (CNT+APPL_DEMO_MAX), FORM_DEMO_NAME_'CNT, (CNT2+APPL_DEMO_MAX), FORM_DEMO_NAME_'CNT2 ) $ ENDIF $ Write sys$output OUT_LINE $ CNT = CNT + 2 $ GOTO DISPLAY_FORM_LOOP $! $END_DISPLAY_FORM_LOOP: $! $ write sys$output " " $! $! Ask the user which demo to run $! $ open /read keyboard sys$command: $ Read /prompt="Your Choice (0 to exit): " /End=exit keyboard USER_CHOICE $ Close/Nolog keyboard $ $! Did user type name or number? $! $ If USER_CHOICE .eqs. "" Then Goto DISPATCH $ If f$type(USER_CHOICE) .eqs. "INTEGER" Then Goto DISPATCH $ ! $ ! User typed name, see if there's a matching demo $ ! $ CNT2 = 0 $ USER_CHOICE = f$edit(USER_CHOICE,"UPCASE") $! $ NAME_MATCH_LOOP: $ CNT2 = CNT2 + 1 $ If CNT2 .gt. FORM_DEMO_MAX .and. CNT2 .gt. APPL_DEMO_MAX Then goto END_NAME_MATCH_LOOP $! $ If CNT2 .le. APPL_DEMO_MAX $ Then $ If F$LOCA(USER_CHOICE,APPL_DEMO_NAME_'CNT2) .eq. 0 $ Then $ USER_CHOICE = CNT2 $ GOTO DISPATCH $ EndIf $ EndIf $! $ If CNT2 .le. FORM_DEMO_MAX $ Then $ If F$LOCA(USER_CHOICE,FORM_DEMO_NAME_'CNT2) .eq. 0 $ Then $ USER_CHOICE = CNT2 + APPL_DEMO_MAX !Offset $ GOTO DISPATCH $ EndIf $ EndIf $! $ GOTO NAME_MATCH_LOOP $! $ END_NAME_MATCH_LOOP: $ ! $ ! Since we didn't find it, report an error $ ! $ Goto USER_ERROR $! $! $DISPATCH: $ USER_DEMO = F$INTEGER(USER_CHOICE) $! $! Which demo is it? $! $ if USER_DEMO .eq. 0 Then GOTO EXIT $ if USER_DEMO .lt. 0 Then GOTO USER_ERROR $ if USER_DEMO .le. APPL_DEMO_MAX Then GOTO USER_DEMO_APPL $ if USER_DEMO .le. DEMO_MAX Then GOTO USER_DEMO_FORM $! $USER_ERROR: $ Write sys$output "Choose a number from 1 to ", DEMO_MAX $ Goto GET_DEMO $! $USER_DEMO_APPL: $! $! Execute one of the applications $! ------------------------------- $! $! Special cases: $! $! FORMS$SAMPLE_FORM needs a logical to point to the form $! FORMS$CHECKING* needs a logical to point to the form $! $!!!$ DEMO_FILE = APPL_DEMO_NAME_'USER_DEMO $ DEMO_FILE = F$PARSE( APPL_FILESPEC_'USER_DEMO, , , "NAME") $! $ If DEMO_FILE .EQS. "FORMS$SAMPLE_PROGRAM" $ Then Define/USER FORMS$SAMPLE_FORM 'DEMO_DIR'FORMS$SAMPLE_FORM $ ENDIF $ If F$EXTR(0,14,DEMO_FILE) .EQS. "FORMS$CHECKING" $ Then Define/USER FORMS$CHECKING_FORM 'DEMO_DIR'FORMS$CHECKING_FORM $ ENDIF $! $! For applications with a form the same name as the .EXE, $! define the logical automatically (if form exists) $! $ FORM_FILE_ACTUAL = F$SEAR("''DEMO_DIR'''DEMO_FILE'.FORM") $ If FORM_FILE_ACTUAL .nes. "" Then - Define/USER 'DEMO_FILE' 'FORM_FILE_ACTUAL' $! $! $! Setup display device if necessary $! $ If f$trnlnm("FORMS$DEFAULT_DEVICE") .eqs. "" $ Then $ Define/USER FORMS$DEFAULT_DEVICE SYS$INPUT $ Endif $! $! Point SYS$INPUT to the terminal, and execute the image $! Turn off Tracing $ Define/USER Sys$Input 'F$trnlnm("SYS$OUTPUT")' /Nolog $ Define/USER Forms$Trace 0 $! $ DEMO_FILE = APPL_FILESPEC_'USER_DEMO $ SET NOON $ RUN 'DEMO_FILE $ SET ON $! $! For now, always continue, even if there's an error $! $ GOTO GET_DEMO $!!$ return_status = $status $!!$ if return_status then GOTO GET_DEMO $!!$ goto exit $! $USER_DEMO_FORM: $! $! Execute one of the FORMS $! ------------------------ $! $! Setup display device if necessary $! $ If f$trnlnm("FORMS$DEFAULT_DEVICE") .eqs. "" $ Then $ Define/USER FORMS$DEFAULT_DEVICE SYS$INPUT $ Endif $! $! Point SYS$INPUT to the terminal, and enable the form $! Turn off Tracing $! $ Define/USER Sys$Input 'F$trnlnm("SYS$OUTPUT")' /Nolog $ Define/USER Forms$Trace 0 $! $ USER_DEMO = USER_DEMO - APPL_DEMO_MAX ! Correct for offset $!$!!! DEMO_FILE = DEMO_DIR + "FORMS$DEMO_" + FORM_DEMO_NAME_'USER_DEMO $ DEMO_FILE = FORM_FILESPEC_'USER_DEMO $ SET NOON $ DEMO_ENABLE 'DEMO_FILE $ SET ON $! $! For now, always continue, even if there's an error $! $ GOTO GET_DEMO $!!$ return_status = $status $!!$ if return_status then GOTO GET_DEMO $!!$ goto exit $! $! $! Control-Y handler $! $ ctrl_y_exit: $ return_status = 1 $ goto exit $! $! No demo's found $! $ No_Demos: $ Write sys$output "No Demo files found in: ''DEMO_DIR'" $ goto exit $! $! And exit faithfully $! $ EXIT: $! $! Close files, reset things $! $ close/nolog keyboard ! Just in case it was open $ If KEYPAD Then SET TERM/APPLICATION $ If BROADCASTS Then SET TERM/BROADCAST $!!$ SET TERM/WIDTH='WIDTH $! $! Return the status, quietly $! $ EXIT 'return_status + F$VERIFY() - F$VERIFY(Verify_Setting)