(c) 2022 YSI contibutors, licensed under MPL 1.1
Ensures debug levels are set and defines debug functions.
General debug levels:
- -1 - Run-time selected debug level.
- 0 - No debug information.
- 1 - Callbacks and timers.
- 2 - Remote functions.
- 3 - Stock functions.
- 4 - Static functions.
- 5 - Utility functions.
- 6 - Code.
- 7 - Loops.
If you use Debug_Print0
you get an optional debug print controlled by the global state ysi_debug
- which is either on or off.
Debug_Code1(code)
Name | Info |
---|---|
code |
Code to run. |
Code is not a variable, it's a code chunk and may be written as so:
Debug_Code1{if (bla == 2) { bla++; YSI_PrintF__("%d", bla); }}
Or:
C:1{if (bla == 2) { bla++; YSI_PrintF__("%d", bla); }}
The code must all be on one line to avoid errors. This isn't really a function as the first parameter is part of the name. Only compiles the code when _DEBUG %gt;= 1
.
native
Debug_Code2(code)
Name | Info |
---|---|
code |
Code to run. |
Code is not a variable, it's a code chunk and may be written as so:
Debug_Code2(if (bla == 2) { bla++; YSI_PrintF__("%d", bla); });
Or:
C:2(if (bla == 2) { bla++; YSI_PrintF__("%d", bla); });
The code must all be on one line to avoid errors. This isn't really a function as the first parameter is part of the name. Only compiles the code when _DEBUG %gt;= 2
.
native
Debug_Code3(code)
Name | Info |
---|---|
code |
Code to run. |
Code is not a variable, it's a code chunk and may be written as so:
Debug_Code3(if (bla == 2) { bla++; YSI_PrintF__("%d", bla); });
Or:
C:3(if (bla == 2) { bla++; YSI_PrintF__("%d", bla); });
The code must all be on one line to avoid errors. This isn't really a function as the first parameter is part of the name. Only compiles the code when _DEBUG %gt;= 3
.
native
Debug_Code4(code)
Name | Info |
---|---|
code |
Code to run. |
Code is not a variable, it's a code chunk and may be written as so:
Debug_Code4(if (bla == 2) { bla++; YSI_PrintF__("%d", bla); });
Or:
C:4(if (bla == 2) { bla++; YSI_PrintF__("%d", bla); });
The code must all be on one line to avoid errors. This isn't really a function as the first parameter is part of the name. Only compiles the code when _DEBUG %gt;= 4
.
native
Debug_Code5(code)
Name | Info |
---|---|
code |
Code to run. |
Code is not a variable, it's a code chunk and may be written as so:
Debug_Code5(if (bla == 2) { bla++; YSI_PrintF__("%d", bla); });
Or:
C:5(if (bla == 2) { bla++; YSI_PrintF__("%d", bla); });
The code must all be on one line to avoid errors. This isn't really a function as the first parameter is part of the name. Only compiles the code when _DEBUG %gt;= 5
.
native
Debug_Code6(code)
Name | Info |
---|---|
code |
Code to run. |
Code is not a variable, it's a code chunk and may be written as so:
Debug_Code6(if (bla == 2) { bla++; YSI_PrintF__("%d", bla); });
Or:
C:6(if (bla == 2) { bla++; YSI_PrintF__("%d", bla); });
The code must all be on one line to avoid errors. This isn't really a function as the first parameter is part of the name. Only compiles the code when _DEBUG %gt;= 6
.
native
Debug_Code7(code)
Name | Info |
---|---|
code |
Code to run. |
Code is not a variable, it's a code chunk and may be written as so:
Debug_Code7(if (bla == 2) { bla++; YSI_PrintF__("%d", bla); });
Or:
C:7(if (bla == 2) { bla++; YSI_PrintF__("%d", bla); });
The code must all be on one line to avoid errors. This isn't really a function as the first parameter is part of the name. Only compiles the code when _DEBUG %gt;= 7
.
native
Debug_Disable()
bool:
Turn off level 0 prints.
Turn off level 0 prints.
ysi_debug
Source Target Condition off
1 cells
Debug_Enable()
bool:
Turn on level 0 prints.
Turn on level 0 prints.
ysi_debug
Source Target Condition CONST_PAWNDOC on
1 cells
Debug_GetState()
bool:
Get the current debug state.
Get the current debug state.
ysi_debug
Source Target Condition ysi_debug : ysi_debug : on ysi_debug : ysi_debug : on
1 cells
Debug_IsStringLike(addr, len)
Name | Info |
---|---|
addr |
A pointer to a thing that might be a string. |
len |
The maximum length of the supposed string. |
bool:
Prints a string passed as a vararg to the calling function.
3 cells
Debug_Kill_()
Stop the server running.
1 cells
Debug_Level(level)
Name | Info |
---|---|
level |
The new debug level to enable prints on. |
Set the debug level when the code is compiled with _DEBUG=-1
, which means full run-time selection. Returns the level, or sets it when a parameter is given.
1 cells
Debug_Print0(str[], ...)
Name | Info |
---|---|
str |
[] The format specifier string. |
... |
{_,Bit,Text,Group,File,Float,Text3D} |
str |
The format specifier string. |
This isn't really a function as the first parameter is part of the name:
Debug_Print0("variables: %d, %d", i, j);
Or:
Debug_Print0("variables: %d, %d", i, j);
_DEBUG
level 0 prints are ALWAYS compiled, but are runtime switched using the automata ysi_debug
. When then state is ysi_debug : on
, the prints are executed. When then state is ysi_debug : off
, they aren't.
This isn't really a function as the first parameter is part of the name:
Debug_Print0("variables: %d, %d", i, j);
Or:
Debug_Print0("variables: %d, %d", i, j);
_DEBUG
level 0 prints are ALWAYS compiled, but are runtime switched using the automata ysi_debug
. When then state is ysi_debug : on
, the prints are executed. When then state is ysi_debug : off
, they aren't.
ysi_debug
1 cells
Debug_Print1(str[], ...)
Name | Info |
---|---|
str |
[] The format specifier string. |
... |
{_,Bit,Text,Group,File,Float,Text3D} |
This isn't really a function as the first parameter is part of the name:
Debug_Print1("variables: %d, %d", i, j);
Or:
Debug_Print1("variables: %d, %d", i, j);
Only prints the data when _DEBUG %gt;= 1
.
native
Debug_Print2(str[], ...)
Name | Info |
---|---|
str |
[] The format specifier string. |
... |
{_,Bit,Text,Group,File,Float,Text3D} |
This isn't really a function as the first parameter is part of the name:
Debug_Print2("variables: %d, %d", i, j);
Or:
Debug_Print2("variables: %d, %d", i, j);
Only prints the data when _DEBUG %gt;= 2
.
native
Debug_Print3(str[], ...)
Name | Info |
---|---|
str |
[] The format specifier string. |
... |
{_,Bit,Text,Group,File,Float,Text3D} |
This isn't really a function as the first parameter is part of the name:
Debug_Print3("variables: %d, %d", i, j);
Or:
Debug_Print3("variables: %d, %d", i, j);
Only prints the data when _DEBUG %gt;= 3
.
native
Debug_Print4(str[], ...)
Name | Info |
---|---|
str |
[] The format specifier string. |
... |
{_,Bit,Text,Group,File,Float,Text3D} |
This isn't really a function as the first parameter is part of the name:
Debug_Print4("variables: %d, %d", i, j);
Or:
Debug_Print4("variables: %d, %d", i, j);
Only prints the data when _DEBUG %gt;= 4
.
native
Debug_Print5(str[], ...)
Name | Info |
---|---|
str |
[] The format specifier string. |
... |
{_,Bit,Text,Group,File,Float,Text3D} |
This isn't really a function as the first parameter is part of the name:
Debug_Print5("variables: %d, %d", i, j);
Or:
Debug_Print5("variables: %d, %d", i, j);
Only prints the data when _DEBUG %gt;= 5
.
native
Debug_Print6(str[], ...)
Name | Info |
---|---|
str |
[] The format specifier string. |
... |
{_,Bit,Text,Group,File,Float,Text3D} |
This isn't really a function as the first parameter is part of the name:
Debug_Print6("variables: %d, %d", i, j);
Or:
Debug_Print6("variables: %d, %d", i, j);
Only prints the data when _DEBUG %gt;= 6
.
native
Debug_Print7(str[], ...)
Name | Info |
---|---|
str |
[] The format specifier string. |
... |
{_,Bit,Text,Group,File,Float,Text3D} |
This isn't really a function as the first parameter is part of the name:
Debug_Print7("variables: %d, %d", i, j);
Or:
Debug_Print7("variables: %d, %d", i, j);
Only prints the data when _DEBUG %gt;= 7
.
native
Debug_PrintArray(arr[], size)
Name | Info |
---|---|
arr |
[] |
size |
Does some strange mangling of YSI_FILTERSCRIPT
because at one point I found a compiler bug where the first automata in the script could conflict with the first variable in the script. I don't know what triggered it, and it has never shown up since I messed about with this file to try mangle some things. Never the less, if it ever happens again this code might detect it. Actually, that's less likely now, since that variable is now very unlikely to be the first in the script ever.
108 cells
Debug_PrintQ_IMPL(tag, size, expr[], file[], line, ...)
Name | Info |
---|---|
tag |
Debug_PrintQ_TAG |
size |
Debug_PrintQ_SIZEOF |
expr |
[] |
file |
[] |
line |
|
... |
{_,Bit,Text,Group,File,Float,Text3D} |
Try and print a wide range of variables, with their source expression. Examples: new arr[] = {33, 33, 33}; new Float:farr[] = {11.0, 11.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0}; new MyCustomTag:mctarr[] = { MyCustomTag:6, MyCustomTag:7 }; new str[] = "hello"; new var1 = 2; new Float:f = 5.5; Debug_Q(str); Debug_Q(var1); Debug_Q(f); Debug_Q(arr); Debug_Q(farr, 7); Debug_Q(mctarr); If an array length cannot be determined you can pass it as a second arg. All tags are supported, the output from the above is: [Q] C:\Users\Alex\Documents\SA-MP\gamemodes\IsMaybeAString.pwn:16 str[6] = "hello" (full data dumped to: _fgdjkeGjAz.tmp) [Q] C:\Users\Alex\Documents\SA-MP\gamemodes\IsMaybeAString.pwn:17 var1 = 2 [Q] C:\Users\Alex\Documents\SA-MP\gamemodes\IsMaybeAString.pwn:18 Float:f = 5.500 [Q] C:\Users\Alex\Documents\SA-MP\gamemodes\IsMaybeAString.pwn:19 arr[3] = { 33, 33, 33 } [Q] C:\Users\Alex\Documents\SA-MP\gamemodes\IsMaybeAString.pwn:20 Float:farr[7] = { 11.000, 11.000, 11.000, 12.000, 13.000, ... } (full data dumped to: _HOf6OQgcC8.tmp) [Q] C:\Users\Alex\Documents\SA-MP\gamemodes\IsMaybeAString.pwn:21 MyCustomTag:mctarr[2] = { 6, 7 } Note: Temporary files are automatically deleted after a month.
AMX_GetTagByValue
Debug_IsStringLike
Debug_PrintQ_PRINT
FIXES_fclose
FIXES_format
FIXES_fwrite
YSI_PrintF__
__param5_offset
ftemporary
getarg
150 cells
Debug_SetState()
Mostly exists to define the full range of ysi_debug
states.
Mostly exists to define the full range of ysi_debug
states.
ysi_debug
Source Target Condition ysi_debug : ysi_debug : on ysi_debug : ysi_debug : on on
1 cells
ScriptInit_OnCodeInit()
Does some strange mangling of YSI_FILTERSCRIPT
because at one point I found a compiler bug where the first automata in the script could conflict with the first variable in the script. I don't know what triggered it, and it has never shown up since I messed about with this file to try mangle some things. Never the less, if it ever happens again this code might detect it. Actually, that's less likely now, since that variable is now very unlikely to be the first in the script ever.
public
5 cells