| View previous topic :: View next topic |
| Author |
Message |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Tue Nov 09, 2004 8:05 am Post subject: working out code error line |
|
|
hi all,
this is a question that i have been meaning to ask for some time and am finally doing it
when i work on a program, i have a lot of tabs that contain individual files that i use #INCLUDE to include into the compiled final version
this is a great way for me to keep each file to a decent level
BUT when compiled, and it says error XX at line YY, how do i know which file it refers to? in other words, what is the order of compilation of the files within a project?
i need to know this as a user reports an error that i cannot reproduce on my computer and the line he reports the error as being...well, i have no idea in which file it is as i have some 10 files in the one project
hope this makes sense
thanks in advance
serge |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Tue Nov 09, 2004 8:57 am Post subject: |
|
|
I agree, Serge, it's really difficult. The only way to do it at the moment is to compile the program, note the order in which the files are included, and then subtract the number of lines in each file starting from the first, until you get a number that's less than the number of lines in the next file. Because included files may themselves include files, it won't always be as simple as going through the list of #include directives in the first file.
Because of this, I suggested that VDS has the capability to produce a map file, which is a file containing the line number of the start of each source file and every label in the compiled file. However, because there will not be any more updates to VDS 5, you'll have to wait for VDS 6 for this. In the meantime, you'll either have to work it out manually using the method I suggested, or write a script to do it. _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Tue Nov 09, 2004 12:10 pm Post subject: |
|
|
hi jules,
something like what you described would have been fantastic as currently the "error number at line" is practically unworkable and a suitable work around has to be found
hi skit,
i thought of that but the trace sample i tried is somewhat cryptic and trying to work out which part of which part of the code of the 10 files that total some 2000 lines is causing the problem seems like a headache in itself although as a last resort i will try it to see if i can get to the bottom of it all
serge |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Tue Nov 23, 2004 12:28 am Post subject: |
|
|
i wrote a little script to help me with working out the error line number reported by a user when i have several files in the one project
as i mentioned in another post, the vds ide will compile the files according to the order of #INCLUDE
so this program looks for which files contains the #INCLUDE code, which it then assumes is the main program, and then adds the other files in the project at the end of the main program in the order of the listed #INCLUDE
you can then enter the error number reported by a user and presto, the line that causes the problem is selected
this program saves nothing so there is no risk to the code
feel free to change it to suit your needs - i basically wrote it to suit mine
it does include some basic ai in that you can only process the project once you have selected a file that contains #INCLUDE code, you cannot select line number 0 or one that is bigger than the length of the resulting code
ps you will need dr dread's string.dll
| Code: |
#define function, string
external @path(%0)string.dll
Title 123
DIALOG CREATE,New Dialog,-1,0,760,560
REM *** Modified by Dialog Designer on 20/11/2004 - 23:03 ***
DIALOG ADD,TEXT,TEXT1,10,10,,,Code
DIALOG ADD,LIST,LIST1,25,10,554,524
DIALOG ADD,TEXT,TEXT2,10,580,,,Folder Code Files
DIALOG ADD,BUTTON,browse_b,7,681,64,16,Browse
DIALOG ADD,LIST,LIST2,25,580,170,248,,CLICK
DIALOG ADD,BUTTON,process_b,285,615,100,30,Process
DIALOG ADD,BUTTON,quit_b,510,615,100,30,Quit
DIALOG ADD,EDIT,EDIT1,390,625,84,19
DIALOG ADD,TEXT,TEXT3,370,625,,,Line Number
DIALOG ADD,BUTTON,goto_b,421,635,64,24,Go To...
DIALOG SHOW
dialog disable, process_b
:timer
dialog set, text1, Code [@fadd(@index(list1),1) / @count(list1)]
:Evloop
wait event, @fdiv(1,10)
goto @event()
:list2CLICK
list create, 15
list loadfile, 15, %%folder\@item(list2).dsc
%%dummy = @text(15)
%%temp = @string(StringCount, %%dummy, #include)
if @greater(%%temp,0)
dialog enable, process_b
else
dialog disable, process_b
warn This file does not contain any #INCLUDE code.
end
list close, 15
goto evloop
:browse_bBUTTON
dialog disable, process_b
%%folder = @dirdlg(,%%folder)
if @both(@ok(),%%folder)
list clear, list1
list clear, list2
list filelist, list2, %%folder\*.dsc
if @greater(@count(list2),0)
%i = 0
repeat
list seek, list2, %i
list put, list2, @name(@item(list2))
%i = @succ(%i)
until @equal(%i,@count(list2))
list seek, list2, 0
end
end
goto evloop
:process_bBUTTON
list create, 15
list create, 14
list loadfile, 15, %%folder\@item(list2).dsc
list loadfile, list1, %%folder\@item(list2).dsc
%i = 0
repeat
list seek, 15, %i
if @greater(@pos(#include,@item(15)),0)
list clear, 14
list loadfile, 14, %%folder\@substr(@item(15),10,@len(@item(15)))
list append, list1, 14
end
%i = @succ(%i)
until @equal(%i,@count(15))
list close, 14
list close, 15
goto evloop
:goto_bBUTTON
if @not(@numeric(@dlgtext(edit1)))
warn Entry needs to be a number.
goto evloop
end
if @greater(@dlgtext(edit1),@count(list1))
warn The number entered is greater than the number of items in the list.
goto evloop
end
if @equal(@dlgtext(edit1),0)
warn The line number has to be greater than zero.
goto evloop
end
list seek, list1, @fsub(@dlgtext(edit1),1)
goto evloop
:Close
:quit_bBUTTON
exit
|
serge |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Thu Dec 02, 2004 4:15 am Post subject: |
|
|
Hi Serge,
This is interesting because I have the same problem with a 4 TAB hefty program I wrote about a year ago, but I kinda shelfed it.
It keep crashing when ever I bounced from TAB to TAB to quickly, and tracking down the exact error seemed imposible (st first I thought it needed some time delays), I might work on that program again soon, If I find a solution, I'll let you know, GL.. |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Thu Dec 02, 2004 1:06 pm Post subject: |
|
|
hi vtol,
is my code above of any use to you to work out where the error is?
serge _________________
|
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Mon Dec 26, 2005 7:56 am Post subject: |
|
|
Hey Serge,
This doesn't work for me. I just tried it on the FTP demo and it only processes the ftpex.dsc file (i.e. 87 lines). The combined ftpex.dsc and included ftp.dsc total 223 lines.
PS Merry Christmas _________________ cheers
Dave |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Dec 26, 2005 9:33 am Post subject: |
|
|
dave,
you need to select the dsc file that contains #INCLUDE of the other dsc files
did you do that?
merry christmas and all the best for 2006 to you too
serge _________________
|
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Mon Dec 26, 2005 10:38 am Post subject: |
|
|
| Serge wrote: | you need to select the dsc file that contains #INCLUDE of the other dsc files
did you do that? |
Yep. It wouldn't let me select the one without #INCLUDE. _________________ cheers
Dave |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Dec 26, 2005 11:55 am Post subject: |
|
|
i think it is because the code assumes that #INCLUDE lists a file with the .dsc extension and the #INCLUDE in the ftp program does not ... it just lists the filename without any .dsc extension
so, either amend my code to deal with that or change the #INCLUDE in the ftp program to include the .dsc extension after the file name
serge _________________
|
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Mon Dec 26, 2005 8:16 pm Post subject: |
|
|
I tried that... still no go.
But on further investigation I've discovered that your code was inserting "E " (E space) between %%folder and ftp.dsc. Once I realised what was happening it easy to fix.
I just changed the 10 in this line:
| Code: | list loadfile, 14, %%folder\@substr(@item(15),10,@len(@item(15)))
|
To 12 (to suit not having #INCLUDE in the gutter). Plus I added an info line to show what was being included:
| Code: | info %%folder\@substr(@item(15),12,@len(@item(15)))
list loadfile, 14, %%folder\@substr(@item(15),12,@len(@item(15)))
|
_________________ cheers
Dave |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Tue Dec 27, 2005 1:14 am Post subject: |
|
|
it's been a while since i wrote that code and i don't remember adding "E " to filenames included in #INCLUDE ... i'm glad you sorted it all out and that it is working for you ... i have used it several times and found it very handy
serge _________________
|
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Tue Dec 27, 2005 8:41 am Post subject: |
|
|
| Serge wrote: | | it's been a while since i wrote that code and i don't remember adding "E " to filenames included in #INCLUDE |
I should have been more specific. The E was from the 9 character in the string " #INCLUDE".
| Quote: | | i'm glad you sorted it all out and that it is working for you ... i have used it several times and found it very handy |
And thanks for sharing it. Having this has given me the confidence to split a 2,000 line script I'm currently working on into more manageable separate included files. _________________ cheers
Dave |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Tue Dec 27, 2005 2:22 pm Post subject: |
|
|
| Quote: | | I should have been more specific. The E was from the 9 character in the string " #INCLUDE". |
i wonder if the code i use uses 10 or 12 as the code works great for me ... may be i did and don't remember ... must be old age ... what are we talking about again??!?!?
serge (i think) _________________
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|