Adlibbing Export Documentation My personal favorite for a command name, the small file adlibbing.scr takes compressed (statistics) data from a library disk and saves it as a file that can be read as a spreadsheet with the command adlibbing library.scr,filename,number<return>, where adlibbing means "to" (ad) the filename from the "library disk" (lib) move it ("ing") as a play on the word to adlib (ad libitum, at pleasure; to improvise). [The idiosyncratic convention used by Micromotion's MasterForth is to use "ing" when the command is followed by a parameter; for example, renaming data.scr,filename<return> renames the file from data.scr to filename; using data.scr<return> opens the file data.scr; removing data.scr<return> deletes the file data.scr; including summary.scr<return> opens the Summary program file and loads screen 1 (the load control screen).] The statistics are those calculated by the Runtime or Summary programs for each trial, including amplitudes and latencies of the responses (see runtime.scr in Appendix A for a list of the statistics). The statistics reduce to sixteen numbers the information about each trial (i.e., the data is "compressed"). The sixteen numbers are the columns; the rows are the trials. By exporting these numbers, a spreadsheet can be used to perform any user-created analyses, being completely independent of the Forth programs. This adds a further degree of flexibility. The askiing routine in another appendix listing converts data disks to ASCII that can be used by a spreadsheet; at the time of the original programming, Excel could not read these files because the number of columns was too great. The spreadsheets created by adlibbing are manageable because the columns are more limited, therefore they have seen practical application. As with the other programs in these appendices, this file has been modified in the following ways: comments have been expanded; screens have been idenfified by numbers; and for documentation, instructions have been included as comments. \ screen 0 \ ADLIBBING.SCR file \ This file converts forth binary library files to ascii format for use by spreadsheets. \ the first line is the comment from the data file. \ each of the following lines are individual compressed trial data (statistics), \ delimited by spaces and followed by a return. \ \ TO USE: adlibbing file1,file2,scr# \ where: file1 is a forth binary library file. \ file2 either exists or not and will be the ascii file. \ scr# is the screen number in the library file. \ \ NOTE: this program is based on EVOLUTION.SCR and ASKIING.SCR routines. \ NOTE: this program not parameterized at the moment, meaning that different sizes of data are not \ represented by a single variable or value that can easily be changed in just one place. \ screen 1 \ this screen controls all loading of the adlibbing routines. need it not \if forget it create it 108 #trls ! 186 is pts \ set default parameter here. \ set default parameter here. debug off decimal 2 size 1- thru decimal \ screen 2 \ adlibbing \ formatting ... : stroke ( a # --) \ show data on screen (debug on) or move to file (debug off). debug @ if cr type else putdata then ; : comma ( -- ascii) \ used to parse command line (file1,file2,scr#). ascii , ; : return ( --) \ used to indicate the end of each trial. 13 cto" stroke 10 cto" stroke ; : delimiter ( --) \ a space is used as the delimiter between data within a trial. " " stroke ; \ file control ... : getfiles ( --scr#) \ use: getfiles file1,file2,scr#. \ where: file1 is known library file. \ file 2 is known or new file. \ scr# is the library file1 screen number where the data is store. \ (use Summary menu option 6 to display the contents of a library disk.) comma word count data open dup 0= if flush abort then ( abort if file1 is not found) is input comma word count 2dup screens open ?dup 0= \ make or open output if ( make file2 if it does not already exist) screens make else ( write over old file2) -rot 2drop then is output bl word count <$ $* $> ( dstr# flag) 2drop ( scr#) ; \ screen 3 \ continued : getcomment ( scr# -- dscr#) \ move the comment (entered during the Runtime program) to the file. 1k um* ( dscr#) 2dup input 6 + 2! ram drop 64 getdata 2drop ram drop 64 -trailing stroke return ; : adlibize ( dscr# --) \ this is the workhorse routine that actually does the transfer. \ dscr# is the double-number library screen location. 1k 0 d+ input 6 + 2! ( dscr# = pointer into input file) ram erase ram drop ( to) #trls @ 32 * ( amount of data to get from file) getdata 2drop ram drop ( n) 1 #trls @ bounds ?do 23 0 at i s>d 4 d.r dup ( n n) 32 bounds ?do i @ 0 <# #s #> stroke delimiter 2 +loop return 32 + ( n') nuf? ?leave loop ( n') drop ; \ screen 4 \ continued : finale ( --) input close output close roadrunner ; : adlibbing ( --) \ this is the main execution word. \ use: adlibbing file1=known,file2=known|new,scr#. \ much of this definition is devoted to the user interface. getfiles ( scr#) dark 0 0 at ." Processing trial number " 0 3 at ." Input file " input is default filename type 0 4 at ." Output file " output is default filename type 0 6 at ." Press <return> <return> to stop " 0 7 at ." Press any other key to pause, then again to resume" ( scr#) getcomment ( dscr#) adlibize output is default 0 9 at filesize d. ." bytes in output file" finale ; \ screen 5 \ instructions: \ \ dark \ Instructions: \ Type "flush<return>" \ You MUST set the parameters #TRLS and PTS: \ e.g., "108. #trls !<return> 186 is pts <return>" \ Then type "adlibbing file1,file2,scr#<return>" \ where file1 is a forth binary LIBRARY file \ file2 is to be the new ascii file, \ and scr# is the screen number in library file. \ Notes: \ File2 can already exist [it will be overwritten] \ or adlibbing will make file2 if it does not exist. \ Repeat "adlibbing file3,file4,scr#<return>" as many \ times as you wish.