From 1866afd80b7c6d89187b59e598b6b72761c2a8ff Mon Sep 17 00:00:00 2001 From: Arkshine Date: Thu, 14 Aug 2014 21:06:21 +0200 Subject: [PATCH] Compiler: Add __line Imported from SA-MP: https://github.com/Zeex/pawn/commit/605ae7f4d3530640f50c2d5d59668deb0db15079 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. --- compiler/libpc300/sc1.c | 3 ++- compiler/libpc300/sc2.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/libpc300/sc1.c b/compiler/libpc300/sc1.c index 6fc5aaa3..9e25c7e6 100755 --- a/compiler/libpc300/sc1.c +++ b/compiler/libpc300/sc1.c @@ -1449,7 +1449,8 @@ static void setconstants(void) add_constant("ucharmax",(1 << (sizeof(cell)-1)*8)-1,sGLOBAL,0); add_constant("__Pawn",VERSION_INT,sGLOBAL,0); - + add_constant("__line", 0, sGLOBAL, 0); + pc_anytag=pc_addtag("any"); debug=0; diff --git a/compiler/libpc300/sc2.c b/compiler/libpc300/sc2.c index 88290444..5f7839d5 100755 --- a/compiler/libpc300/sc2.c +++ b/compiler/libpc300/sc2.c @@ -281,6 +281,7 @@ static void readline(unsigned char *line) { int i,num,cont; unsigned char *ptr; + symbol *sym; if (lptr==term_expr) return; @@ -358,6 +359,9 @@ static void readline(unsigned char *line) line+=strlen((char*)line); } /* if */ fline+=1; + sym=findconst("__line"); + assert(sym!=NULL); + sym->addr=fline; } while (num>=0 && cont); }