Compiler: Add __line
Imported from SA-MP: 605ae7f4d3
This is a backport from Pawn 4.0. It sets to the current line number during compile time.
Documention for 3.x actually mention this.
This commit is contained in:
parent
fcdeea683b
commit
1866afd80b
@ -1449,7 +1449,8 @@ static void setconstants(void)
|
|||||||
add_constant("ucharmax",(1 << (sizeof(cell)-1)*8)-1,sGLOBAL,0);
|
add_constant("ucharmax",(1 << (sizeof(cell)-1)*8)-1,sGLOBAL,0);
|
||||||
|
|
||||||
add_constant("__Pawn",VERSION_INT,sGLOBAL,0);
|
add_constant("__Pawn",VERSION_INT,sGLOBAL,0);
|
||||||
|
add_constant("__line", 0, sGLOBAL, 0);
|
||||||
|
|
||||||
pc_anytag=pc_addtag("any");
|
pc_anytag=pc_addtag("any");
|
||||||
|
|
||||||
debug=0;
|
debug=0;
|
||||||
|
@ -281,6 +281,7 @@ static void readline(unsigned char *line)
|
|||||||
{
|
{
|
||||||
int i,num,cont;
|
int i,num,cont;
|
||||||
unsigned char *ptr;
|
unsigned char *ptr;
|
||||||
|
symbol *sym;
|
||||||
|
|
||||||
if (lptr==term_expr)
|
if (lptr==term_expr)
|
||||||
return;
|
return;
|
||||||
@ -358,6 +359,9 @@ static void readline(unsigned char *line)
|
|||||||
line+=strlen((char*)line);
|
line+=strlen((char*)line);
|
||||||
} /* if */
|
} /* if */
|
||||||
fline+=1;
|
fline+=1;
|
||||||
|
sym=findconst("__line");
|
||||||
|
assert(sym!=NULL);
|
||||||
|
sym->addr=fline;
|
||||||
} while (num>=0 && cont);
|
} while (num>=0 && cont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user