Raised This Month: $32 Target: $400
 8% 

[INFO] Pawn compiler constants


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-03-2014 , 13:27   [INFO] Pawn compiler constants
Reply With Quote #1

I was really bored, so about half an hour ago, I was goofing around and wanted to implement __DATE__ constant in Sublime Text. When I compiled that code (without really implementing it), it compiled just fine. I quickly put '-l' (listing) compiler switch, which shows pre-processor stuff, so I was able to see what happened, and I really found today's date in the code.

I took a quick look at Pawn compiler code (sc1.c file precisely). I found some neat stuff I didn't know about, there are few more constants!
So, I ran this code on my local server:
PHP Code:
server_print("Constants:");
server_print("__DATE__: %s"__DATE__); // Current date
server_print("__TIME__: %s"__TIME__); // Current time
server_print("cellbits: %d"cellbits); // Cell size in bits
server_print("cellmax: %d"cellmax); // Maximum value that cell can hold
server_print("cellmin: %d"cellmin// Minimum value that cell can hold
server_print("__Pawn: %d"__Pawn); // Pawn version as an integer
server_print("debug: %d"debug); // Debug level, I guess (-d compiler switch alters this) 
And this is the output in server console:


I just thought it may be useful to someone, so I decided to share this. I personaly find __DATE__ and __TIME__ really useful.
There are actually few more, but I don't think they are worth mentioning.

Last edited by klippy; 12-03-2014 at 13:29.
klippy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-03-2014 , 13:42   Re: [INFO] Pawn compiler constants
Reply With Quote #2

in AMXX 1.8.3, three new constants have been added:

__LINE__
__BINARY_PATH__
__BINARY_NAME__
__________________
Arkshine is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-03-2014 , 14:02   Re: [INFO] Pawn compiler constants
Reply With Quote #3

Thank you for mentioning it.
klippy is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-03-2014 , 18:17   Re: [INFO] Pawn compiler constants
Reply With Quote #4

Nice sharing. I don't know about this. ;)
zmd94 is offline
mde...
Junior Member
Join Date: Jul 2013
Location: Moscow
Old 12-04-2014 , 00:03   Re: [INFO] Pawn compiler constants
Reply With Quote #5

Thanks a lot)
mde... is offline
Send a message via ICQ to mde... Send a message via Skype™ to mde...
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 12-04-2014 , 04:57   Re: [INFO] Pawn compiler constants
Reply With Quote #6

Interesting, thanks for sharing.
__________________
Kia is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-28-2015 , 17:08   Re: [INFO] Pawn compiler constants
Reply With Quote #7

Didn't want to open a new thread to ask this, since it's pretty much the same topic.

Arkshine, what do you think of adding __FUNCTION__ and __FILE__ constants? Could be useful for run-time debugging in my opinion.
klippy is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Location: Siiiiiiiiuu
Old 07-29-2015 , 06:30   Re: [INFO] Pawn compiler constants
Reply With Quote #8

Sorry for the off-topic over here but you just remind me an old question i had and never asked. Is it possible to modify cellmax and cellmin?
__________________
Jhob94 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-29-2015 , 10:09   Re: [INFO] Pawn compiler constants
Reply With Quote #9

It is, by compiling amxxpc with PAWN_CELL_SIZE of either 16 or 64 (it's 32 by default). But I don't see a reason why would you do that. I've never seen 16 or 64 bit AMXX yet.
klippy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode