10 ! digitizer.BAS ! %include "digitcom.bas" external integer function sys$crelog,lib$sys_trnlog,sys$cancel on error goto error_trap gosub paint_screen call lib$sys_trnlog('TALOS_DEVICE',,talos_dev$,,,) IF talos_dev$ = "TALOS_DEVICE" THEN CALL VTPOS(1%,23%,2%,0%) INPUT "What terminal line is the digitizer connected to (e.g. TTA1:)";talos_dev$ call str$upcase(talos_dev$,talos_dev$) talos_dev$ = "_" + talos_dev$ if pos(talos_dev$,"_",1%) = 0% talos_dev$ = talos_dev$ + ":" if pos(talos_dev$,":",1%) = 0% end if call vtpos(18%,6%,0%,7%) print talos_dev$ stat% = sys$crelog(2% by value,'TALOS_DEVICE', TALOS_DEV$,) ! ! $ASSIGN terminals (note that logical names are used) ! CALL SYS$ASSIGN('TALOS_DEVICE',CHAN1%,,) x_scale = 1.0 y_scale = 1.0 x_offset% = 0 y_offset% = 0 x_origin% = 0 y_origin% = 0 map_x_origin% = 0 map_y_origin% = 0 x_rotate_deg = 0 x_rotate_rad = 0 function_mode% = 0 question_loop: call vtpos(1%,23%,2%,0%) Input "What file do you want the output to go to ";output_file$ area = 0.0 call vtpos(1%,22%,2%,0%) goto program_end if len(trm$(output_file$)) = 0% call str$upcase(output_file$,output_file$) call vtpos(35%,4%,2%,7%) print trm$(output_file$) first% = -1% xy_pair% = 0% array_pointer% = -1% OPEN output_file$ FOR OUTPUT AS FILE #20% & ,MAP FILE_IO & ,ACCESS WRITE & ,ORGANIZATION SEQUENTIAL ! ! call vtpos(1%,23%,2%,0%) INPUT "Value to write to file with coordinates ";var_OUT$ goto program_end if len(trm$(var_out$)) = 0% call vtpos(35%,5%,2%,7%) print trm$(var_out$); ! function_mode% = 0, point ! function_mode% = 1, area ! function_mode% = 2, length call mode_print(function_mode%) call vtpos(14%,8%,0%,7%) print using "####.####",x_scale; call vtpos(34%,8%,0%,7%) print using "####.####",y_scale; call vtpos(14%,10%,0%,7%) print using "######",map_x_origin%; call vtpos(34%,10%,0%,7%) print using "######",map_y_origin%; call vtpos(62%,10%,0%,7%) print using "###.####",x_rotate_deg; call vtpos(14%,12%,0%,7%) print using "########",x_coord%; call vtpos(34%,12%,0%,7%) print using "########",y_coord%; call vtpos(52%,12%,0%,7%) print using "###,###,###,###",area; call vtpos(1%,23%,2%,0%) ! ! CALL send_digitizer_ast to generate initial $QIO requests ! CALL send_digitizer_ast(1%) ! ! Loop waiting for I/O operations to complete ! CALL SYS$HIBER x_first% = first_x y_first% = first_y x% = val%(seg$(output_array$(array_pointer%),3%,10%)) y% = val%(seg$(output_array$(array_pointer%),12%,19%)) if x_first% <> x% or & y_first% <> y% then x_coord_out$ = format$(x_first%,"########.") y_coord_out$ = format$(y_first%,"########.") array_pointer% = array_pointer% + 1 output_array$(array_pointer%) = talos_out$ output_array2$(array_pointer%) = var_out$ end if print #20% using "############.", area for i% = 0% to array_pointer% talos_out$ = output_array$(i%) var_out$ = output_array2$(i%) put #20% next i% mat output_array$ = nul$ mat output_array2$ = nul$ array_pointer% = 0% close #20% status% = sys$cancel(chan1% by value) IF (STAT% AND 1%) = 0% THEN PRINT "ERROR IN SYS$CANCEL =";STAT% end if !print chr$(7) goto question_loop paint_screen: esc$ = chr$(27%) reverse$ = chr$(27%) + "[7m" normal$ = chr$(27%) + "[0m" blink$ = chr$(27%) + "[5m" double_wide$ = esc$ + "#6" normal_wide$ = esc$ + "#5" call vtpos(1%,1%,1%,0%) ! 1,1 and clear screen call vtpos(7%,2%,0%,0%) print double_wide$; "Talos Digitizer Interface" call vtpos(4%,4%,0%,0%) print "Function:" call vtpos(21%,4%,0%,0%) print "Recording to:" call vtpos(4%,6%,0%,0%) print "Talos Device:" call vtpos(5%,8%,0%,0%) print "X-Scale:" call vtpos(25%,8%,0%,0%) print "Y-Scale:" call vtpos(4%,10%,0%,0%) print "X-Origin:" call vtpos(24%,10%,0%,0%) print "Y-Origin:" call vtpos(46%,10%,0%,0%) print "X-Axis Rotate:" call vtpos(5%,12%,0%,0%) print "X-Coord:" call vtpos(25%,12%,0%,0%) print "Y-Coord:" call vtpos(46%,12%,0%,0%) print "Area:" return error_trap: if err = 2% then resume 200 end if print "Error handler received an error ";err;" -- ";ert$(err);"." resume 1000 200 !error handler trap since resume has to go to a line number call vtpos(1%,22%,2%,0%) print chr$(7) + "You have entered an illegal file name, please try again." goto question_loop program_end: 1000 PRINT "Talos Digitizer Interface Ends" end