home *** CD-ROM | disk | FTP | other *** search
- App RecordErrors
- In -
- Out RecErrors
- Type Module
- Max 32k
- Ver 1.05g
-
- Define Module
- Name : RecordErrors
- Version : 1.05
- Author : Justin Fletcher
- Init : StartCode
- { Final : ExitCode }
- Commands
- Name : RecordErrors
- Help : ...
- RecordErrors simply takes all the error messages produced and
- dumps them directly into a file so that they may be read later.
- It is intended for use with the NoError module which click on
- error boxes OK buttons after a moment or two.
- End Commands
- WimpSWIs
- SWI Wimp_ReportError
- Pre ^wimpreport
- End WimpSWIs
- WorkSpace 512+16
- End Module
-
- {
- The RecordErrors module
- =======================
- This program is PD so long as the source and resultant module code are
- distributed togther. This code needs to be assembled with !JFPatch
- pre-assembler. Refer to the !Help file for more information.
-
- History
- -------
- Version 1.00 : 22nd April 1995
- Written using WimpSWIVe 0.03
- 1.01 : 23rd April 1995
- Error from added to message
- 1.02 : 24th April 1995 (really late 23rd April 1995)
- Bit 5 checked for incase of auto-checking boxes
- 1.03 : 14th May 1995
- Error copied to claimed memory to aleviate filecore bugs
- 1.04 : 14th May 1995
- Option to include user name in output
- 1.05 : 21 Jun 1995
- Uses automatic assembly for workspace/WimpSWIve
- Contact
- -------
- Any comments, queries, donations or bug reports can be sent to :
-
- Fidonet NetMail : Justin Fletcher at Arcade (0181 655 4412) [2:254/27]
- E-Mail : Gerph@arcade.demon.co.uk
-
- Snail Mail :
- Justin Fletcher
- “Galadriel”
- 17b Cromwell Road,
- Weeting,
- Brandon,
- Suffolk.
- IP27 0QT
- }
-
- PRE
- # COND INLINE
- # COND users Do you want to include the users name
- END PRE
-
- # REM OFF
-
- .StartCode
- STMFD (sp)!,{link}
- ADR r0,`setupvar
- SWI "OS_CLI"
- LDMFD (sp)!,{pc}^
- :
- .`setupvar
- EQUS "If ""<RecordErrors$File>"" = """" Then Set RecordErrors$File Null:"+CHR$0
- ALIGN
- :
- .wimpreport
- STMFD (sp)!,{r1,r3-r9,link}
- REM "%I"+CHR$4
- BL copyerror
- BL openfile
- BL endoffile
- BL showerror
- BL closefile
- LDMFD (sp)!,{r1,r3-r9,pc}^
- :
- .copyerror
- STMFD (sp)!,{r1,r5,link} ; Stack registers
- REM "copying error to %&C"
- LDR r5,[r0]
- STR r5,[r12] ; copy error number
- ADD r0,r0,#4 ; from error
- ADD r1,r12,#4 ; to buffer+4
- BL movectrl ; copy the string
- REM "Second copy routine"
- CMP r2,#0 ; is r2 <=0 ?
- BLE _ce_notaskname ; if so, no task name
- MOV r0,r2 ; from task name
- ADD r1,r12,#256 ; to buffer+256
- BL movectrl ; copy the string
- MOV r2,r0 ; r2=new task
- ._ce_notaskname
- MOV r0,r12 ; r0=new error block
- LDMFD (sp)!,{r1,r5,pc} ; Return from call
-
- .`filename
- EQUS "<RecordErrors$File>"+CHR$0
- ALIGN
- .openfile
- STMFD (sp)!,{r0-r5,link}
- REM "Opening"
- MOV r0,#&C0 ; open file for update
- ADR r1,`filename
- SWI "XOS_Find"
- CMP r0,#0
- MOVEQ r0,#&80 ; if not found output
- SWIEQ "XOS_Find"
- MOV r8,r0 ; r8 = file handle
- LDMFD (sp)!,{r0-r5,pc}
- :
- .closefile
- STMFD (sp)!,{r0-r5,link}
- REM "Closing"
- MOV r1,r8
- MOV r0,#0
- SWI "XOS_Find" ; close file
- MOV r0,#18 ; settype code
- ADR r1,`filename
- MOV r2,#&F00
- ADD r2,r2,#&FF ; as text
- SWI "XOS_File"
- LDMFD (sp)!,{r0-r5,pc}
- :
- .endoffile
- STMFD (sp)!,{r0-r5,link}
- REM "Moving to end of file"
- MOV r0,#2 ; read length of file
- MOV r1,r8 ; file handle
- SWI "XOS_Args"
- MOV r0,#1 ; write PTR#file
- SWI "XOS_Args" ; PTR#file=EXT#file !
- LDMFD (sp)!,{r0-r5,pc}
- :
- .putstring
- ; string at r2 into file
- STMFD (sp)!,{r0-r5,link}
- REM "Putting string"
- BL putstringsemi
- BL putnewline
- LDMFD (sp)!,{r0-r5,pc}^
- :
- .putnewline
- STMFD (sp)!,{r0-r5,link}
- MOV r1,r8 ; file handle
- MOV r0,#10
- SWI "XOS_BPut"
- LDMFD (sp)!,{r0-r5,pc}^
- :
- .putstringsemi
- ; string at r2 into file without linefeed (semicolon at end!)
- STMFD (sp)!,{r0-r5,link}
- REM "Putting"
- ; MOV r0,r2
- ; SWI "OS_Write0"
- ; SWI "OS_NewLine" ; 3 testing line ^
- MOV r1,r8 ; file handle
- .psloop
- LDRB r0,[r2],#1
- CMP r0,#32
- SWIGE "XOS_BPut"
- BGE psloop
- LDMFD (sp)!,{r0-r5,pc}^
- :
- ;if bit 5 is set (exit now), and bit 6 set (press button) then output
- ;if bit 5 is set (exit now), and bit 6 clear (no button press) then no output
- ;if bit 5 is clear (exit when clicked) then output
- .showerror
- STMFD (sp)!,{r0-r5,link}
- EOR r1,r1,#1<<6 ; invert bit six for check below
- TST r1,#1<<5 ; is bit 5 set (exit immediately)
- TSTNE r1,#1<<6 ; if so, check bit 6 (press button)
- LDMNEFD (sp)!,{r0-r5,pc} ; Return from call if
- ADR r2,`header
- BL putstring
- ADR r2,`titleleft
- BL putstringsemi
- TST r1,#1<<4 ; is ‘just title’ flag set ?
- ADREQ r2,`errorfrom ; if not then add error from
- BLEQ putstringsemi
- LDMFD (sp),{r0-r2} ; reread registers
- CMP r2,#0
- ADRLE r2,`unknown
- BL putstring
- ADR r2,`messageleft
- BL putstringsemi
- ADD r2,r0,#4
- BL putstring
- # COND OF users
- ADR r0,`uservar ; variable to read
- ADD r1,r12,#512 ; buffer
- MOV r2,#16 ; length of buffer
- MOV r3,#0 ; count
- MOV r4,#3 ; convert to string
- SWI "XOS_ReadVarVal" ; read it
- BVS _se_nousername ; if error
- MOV r0,#0
- STRB r0,[r1,r2] ; terminate string
- ADR r2,`userleft ; address of bit before user
- BL putstringsemi ; put it
- MOV r2,r1 ; ready for username
- BL putstring ; put it
- ._se_nousername
- # COND END
- BL putnewline
- LDMFD (sp)!,{r0-r5,pc}
- :
- .`header
- EQUS "**Error**"+CHR$0
- ALIGN
- .`titleleft
- EQUS " Title : "+CHR$0
- ALIGN
- .`messageleft
- EQUS " Message : "+CHR$0
- ALIGN
- .`errorfrom
- EQUS "Error from "+CHR$0
- ALIGN
- .`unknown
- EQUS "unknown task"+CHR$0
- ALIGN
- # COND OF users
- .`userleft
- EQUS " User : "+CHR$0
- ALIGN
- .`uservar
- EQUS "Area$Name"+CHR$0
- ALIGN
- # COND END
-
- # LIBRARY "Strings",#movectrl
-
- #POST
- #RUN <CODE>
-