snb90@uk.ac.soton.ecs (Stewart Brodie) (06/04/91)
I have a small problem with a program I have written. It calls a procedure to load the window templates into memory and then create the windows so that the window handles are all set up correctly. However, when run, the program returns 'Not in a procedure at line 1740' where line 1740 is the ENDPROC statement. At first I thought that it was probably caused by BASICs stack begin corrupted due to lack of memory, so I increased the WimpSlot to 640K (The program only needs about 96K). The problem persisted, so I ensured that the block into which the templates were being loaded was large enough to hold the window with the most icons. I made the block over the size of the template file, but still the error comes. The code goes roughly along these lines ... (I can't remember the exact order of the SYS parameters, but they are right in my program.) DEF PROC_load_templates SYS "Wimp_LoadTemplate",,q%,indirect%,in_end%,,"Info" TO ,,indirect% SYS "Wimp_CreateWindow",,q% TO info_handle% SYS "Wimp_LoadTemplate",,q%,indirect%,in_end%,,"Folder" TO ,,indirect% SYS "Wimp_CreateWindow",,q% TO folder_handle% PROC_set_icon_text(info_handle%,0,"My Program Name") PROC_set_icon_text(info_handle%,1,"Purpose of Prog") PROC_set_icon_text(info_handle%,2,"Version of Prog") PROC_set_icon_text(info_handle%,3,"Author of Prog") ENDPROC Does anybody have any ideas as to the cause of this error? set_icon_text just sets icon texts up by poking the indirected icons and then setting their state. If I move the ENDPROC to before the first PROC_set_icon_text the problem still persists. Any clues would be most welcome. Stewart Brodie Department of Computer Science Southampton University
gtoal@castle.ed.ac.uk (G Toal) (06/05/91)
In article <7970@ecs.soton.ac.uk> snb90@uk.ac.soton.ecs (Stewart Brodie) writes:
:I have a small problem with a program I have written. It calls a
:procedure to load the window templates into memory and then create the
:windows so that the window handles are all set up correctly. However,
:when run, the program returns 'Not in a procedure at line 1740' where
:line 1740 is the ENDPROC statement. At first I thought that it was
:probably caused by BASICs stack begin corrupted due to lack of memory,
:so I increased the WimpSlot to 640K (The program only needs about 96K).
:The problem persisted, so I ensured that the block into which the
:templates were being loaded was large enough to hold the window with the
:most icons. I made the block over the size of the template file, but
:still the error comes.
: The code goes roughly along these lines ... (I can't remember the
:exact order of the SYS parameters, but they are right in my program.)
:
:DEF PROC_load_templates
Look at the procedure/code *BEFORE* the line above - you may well
have dropped down into it. Especially if what is before is the end
of your main program...
G
sidney@rhea.trl.OZ.AU (todd sidney) (06/05/91)
In comp.sys.acorn you write: >I have a small problem with a program I have written. It calls a >procedure to load the window templates into memory and then create the >windows so that the window handles are all set up correctly. However, >when run, the program returns 'Not in a procedure at line 1740' where >line 1740 is the ENDPROC statement. At first I thought that it was I suspect that the problem is not caused by any code within the procedure. It is more likely that during the normal execution of the program the procedure is run without being called as a procedure. I know this sounds cryptic, so I will give an example. 10 REM start of main program 20 ... 30 ... 40.. 200 REM end of main program 1000 DEFPROCfred (or whatever) ... ... the procedure code 1900 ENDPROC Note that the main program does not have an END statement. Thus when the main program has finished running it will continue on into the procedure. Since the procedure has not been "called" an error will occur when execution reached the ENDPROC statement. This error could also occur if you GOTO into the procedure, but you wouldn't be using a goto would you? Todd Sidney t.sidney@trl.oz.au