flat assembler
Message board for the users of flat assembler.

Index > Main > user error message line numbers,

Author
Thread Post new topic Reply to topic
lazer1



Joined: 24 Jan 2006
Posts: 185
lazer1 03 Jun 2006, 09:43
I sometimes use the display command for
user level warning messages,

it would be useful to have some inbuilt symbols that will
give the file and line number at the point of invocation eg:

an include file: xyz.i
Code:
macro  xyz  number
  {
   if number > 5 
           display  number, ' too big, file: ',__file__, ', line: ',__line__
   end if
   mov ax,number 
   }
    


and a source file: uvw.asm:

Code:
f:
   mov bx,10
   xyz 10
   ret
    


here when I compile uvw.asm, I want the following error message:

10 too big, file: uvw.asm, line: 3 Razz

where although the macro is defined in xyz.i line 1,
it is invoked in uvw.asm at line 3 so the error message needs to
give the file + line of invocation,

here I am asking or suggesting for inbuilt variables __file__ and __line__
which give these 2 numbers for the outermost invocation location, Laughing

because if it gives the innermost invocation position that doesnt help
locate the error,

my guess is that it probably could be implemented by defining an internal variable at each macro expansion just on the first pass of the compiler,

ie whenever the compiler sees a macro on the first pass it can insert
an internal equ like:

__file__ equ 'thisfile'
__line__ equ 123

that way on further passes the location info should be propagated
correctly,

Shocked
Post 03 Jun 2006, 09:43
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 03 Jun 2006, 11:05
Post 03 Jun 2006, 11:05
View user's profile Send private message Visit poster's website Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 03 Jun 2006, 20:41
Did this make it into 1.66?
Post 03 Jun 2006, 20:41
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
lazer1



Joined: 24 Jan 2006
Posts: 185
lazer1 05 Jun 2006, 14:07
Tomasz Grysztar wrote:
As for line number see http://board.flatassembler.net/topic.php?t=1154


as an alternative suggestion, can you implement
a command display_location

so that eg:

Code:
display_location
    


would echo something like:

file x.i line 3, in file y.i line 10, in file z.i line 100, in file f.asm line 20
Razz
?

that would be more useful in a way,
fasm must have some such function inbuilt for its own error messaging,
Post 05 Jun 2006, 14:07
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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 cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.