/* ** $VER: IFFMaster.dopus 0.001 (12 Feb 1996) ** ** ** © 1996 Andreas Mixich ** ** PROGRAMNAME: ** IFFMaster.dopus ** ** FUNCTION: ** This one is quite useless. ;-) It will replace IFFMasters main-window ** by displaying the contents of the whole file in an interactive DOPUS ** lister. You may then click on an entry to display it with IFFMaster's ** Info-window. ** ** ** $HISTORY: ** ** 12 Feb 1996 : 0.01 : initial release */ /* enable support functions */ OPTIONS RESULTS SIGNAL ON ERROR SIGNAL ON FAILURE SIGNAL ON HALT SIGNAL ON BREAK_C SIGNAL ON SYNTAX /* add the needed libraries */ IF ~SHOW('LIBRARIES','rexxsupport.library') THEN CALL ADDLIB('rexxsupport.library',0,-30,0) /* define some usefull vars */ LF = '0A'x /* linefeed */ scriptname = 'IFFMaster.dopus' /* insert scriptname. will be needed later */ iffport = 'IFFMASTER.1' /* Name of port for IFFMaster */ dopusport = 'DOPUS.1' /* name of Dopus port */ iffmastercommand = 'GFX:Tools/IFFMaster' /* set to where you keep IFFMaster */ PARSE ARG file /* what file to operate upon */ ADDRESS Value iffport IF ~SHOW('Ports',iffport) THEN DO ADDRESS COMMAND 'Run >NIL: '||iffmastercommand ADDRESS COMMAND 'WaitForPort '||iffport IF ~SHOW('Ports',iffport) THEN EXIT 10 END 'MAINWINDOW OFF' /* not needed now */ 'LOAD '||file /* load file into IFFMaster */ 'ENTRIES' /* how many entries are in the IFF file ? */ num = RESULT /* first one is 0 ! */ 'CURSORPOS 0' /* goto first position entry */ DO i = 1 TO num 'CHUNKID' id = RESULT 'CHUNKTYPE' type = RESULT 'CHUNKDEPTH' depth = RESULT IF depth = "RESULT" THEN depth = '' 'CHUNKINFO' info = RESULT 'CHUNKSIZE' size = RESULT entry.i = id||' '||type||' '||depth||' '||info||' '||size IF i ~= num THEN 'CURSORPOS' i END ADDRESS Value dopusport /* talk to DOPUS now */ 'STATUS 3' win = RESULT 'STATUS 13' win path = RESULT 'CLEARWIN' 'SETWINTITLE '||file 'ADDCUSTHANDLER IFFDOPUS' /* we will simulate the GUI in DOPIS' lister */ 'ADDCUSTENTRY "Click here to get back." 0 2 3 1 ' /* so we can get back upon request */ DO i = 1 TO num 'ADDCUSTENTRY "'||entry.i||'" 0 1 0 1 0' /* add entry No. i */ END 'DISPLAYDIR' /* open our message port */ ourport = OpenPort('IFFDOPUS') handlerstatus = 'OPEN' DO UNTIL handlerstatus = 'CLOSE' CALL WaitPkt(IFFDOPUS) Packet = GetPkt(IFFDOPUS) IF Packet ~= null() THEN DO Cmd = GetArg(Packet, 0) IF Cmd = '1' | Cmd = '2' THEN DO Arg1 = GetArg(Packet, 1) /* entry number */ Arg2 = GetArg(Packet, 2) /* entry text */ Arg3 = GetArg(Packet, 3) /* userdata */ CALL Reply(Packet, 0) ADDRESS VALUE dopusport 'Busy on' IF Cmd = '1' THEN DO IF Arg1 = 0 THEN handlerstatus = 'CLOSE' ELSE CALL showchunk(Arg1) END ELSE NOP 'Busy off' END ELSE CALL Reply(Packet, 0) IF Cmd = 'CLOSE' THEN handlerstatus = 'CLOSE' END END /* close up the port */ 'STATUS 13 SET 'path win CALL ClosePort(ourport) EXIT(0) /* what to do if user double clicked on chunk */ showchunk: PARSE ARG arg1 ADDRESS Value iffport 'CURSORPOS' arg1-1 'INFOWINDOW ON' RETURN(0) /* universal requester function */ DREQUEST: PARSE VAR ErrText, RtValue ADDRESS DOPUS.1 REQUEST scriptname||'0a'x||ErrText||'0a'x||RtValue RETURN RtValue /* what to do on BREAK_C or on HALT */ BREAK_C: HALT: Err1 = 'Script interrupted' Err2 = 'Execution Ceased at line - 'SIGL Err3 = 'Source Line: 'SourceLine(SIGL) ErrText = Err1'*n'Err2'*n'Err3 CALL DRequest(ErrText,10) EXIT(RtValue) RETURN /* routine for an error */ ERROR: SYNTAX: FAILURE: Err1 = 'Trapped Error: 'ErrorText(rc) Err2 = 'Line 'SIGL':'SourceLine(SIGL) ErrText = Err1'*n'Err2 CALL DRequest(ErrText,20) EXIT(RtValue) RETURN