mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-26 14:55:36 +03:00
Add a data argument in INI/SMC_ParseFile() to pass through to callbacks (bug 6228)
This commit is contained in:
parent
2162059352
commit
6d6a1c1ab0
@ -63,7 +63,7 @@ static cell AMX_NATIVE_CALL SMC_SetParseStart(AMX *amx, cell *params)
|
|||||||
|
|
||||||
if ((funcName = get_amxstring(amx, params[2], 0, length)) && length)
|
if ((funcName = get_amxstring(amx, params[2], 0, length)) && length)
|
||||||
{
|
{
|
||||||
p->parse_start = registerSPForwardByName(amx, funcName, FP_CELL, FP_DONE);
|
p->parse_start = registerSPForwardByName(amx, funcName, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->parse_start == -1)
|
if (p->parse_start == -1)
|
||||||
@ -91,7 +91,7 @@ static cell AMX_NATIVE_CALL SMC_SetParseEnd(AMX *amx, cell *params)
|
|||||||
|
|
||||||
if ((funcName = get_amxstring(amx, params[2], 0, length)) && length)
|
if ((funcName = get_amxstring(amx, params[2], 0, length)) && length)
|
||||||
{
|
{
|
||||||
p->parse_end = registerSPForwardByName(amx, funcName, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
p->parse_end = registerSPForwardByName(amx, funcName, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->parse_end == -1)
|
if (p->parse_end == -1)
|
||||||
@ -119,17 +119,17 @@ static cell AMX_NATIVE_CALL SMC_SetReaders(AMX *amx, cell *params)
|
|||||||
|
|
||||||
if ((funcName = get_amxstring(amx, params[2], 0, kvLength)) && kvLength)
|
if ((funcName = get_amxstring(amx, params[2], 0, kvLength)) && kvLength)
|
||||||
{
|
{
|
||||||
p->key_value = registerSPForwardByName(amx, funcName, FP_CELL, FP_STRING, FP_STRING, FP_DONE);
|
p->key_value = registerSPForwardByName(amx, funcName, FP_CELL, FP_STRING, FP_STRING, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kvLength && (funcName = get_amxstring(amx, params[3], 1, nsLength)) && nsLength)
|
if (kvLength && (funcName = get_amxstring(amx, params[3], 1, nsLength)) && nsLength)
|
||||||
{
|
{
|
||||||
p->new_section = registerSPForwardByName(amx, funcName, FP_CELL, FP_STRING, FP_DONE);
|
p->new_section = registerSPForwardByName(amx, funcName, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kvLength && (funcName = get_amxstring(amx, params[4], 2, esLength)) && esLength)
|
if (kvLength && (funcName = get_amxstring(amx, params[4], 2, esLength)) && esLength)
|
||||||
{
|
{
|
||||||
p->end_section = registerSPForwardByName(amx, funcName, FP_CELL, FP_DONE);
|
p->end_section = registerSPForwardByName(amx, funcName, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->key_value == -1 || (nsLength && p->new_section == -1) || (esLength && p->end_section == -1))
|
if (p->key_value == -1 || (nsLength && p->new_section == -1) || (esLength && p->end_section == -1))
|
||||||
@ -157,7 +157,7 @@ static cell AMX_NATIVE_CALL SMC_SetRawLine(AMX *amx, cell *params)
|
|||||||
|
|
||||||
if ((funcName = get_amxstring(amx, params[2], 0, length)) && length)
|
if ((funcName = get_amxstring(amx, params[2], 0, length)) && length)
|
||||||
{
|
{
|
||||||
p->raw_line = registerSPForwardByName(amx, funcName, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
p->raw_line = registerSPForwardByName(amx, funcName, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->raw_line == -1)
|
if (p->raw_line == -1)
|
||||||
@ -169,7 +169,7 @@ static cell AMX_NATIVE_CALL SMC_SetRawLine(AMX *amx, cell *params)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// native SMCError:SMC_ParseFile(SMCParser:handle, const file[], &line = 0, &col = 0);
|
// native SMCError:SMC_ParseFile(SMCParser:handle, const file[], &line = 0, &col = 0, any:data = 0);
|
||||||
static cell AMX_NATIVE_CALL SMC_ParseFile(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL SMC_ParseFile(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
ParseInfo *p = TextParsersHandles.lookup(params[1]);
|
ParseInfo *p = TextParsersHandles.lookup(params[1]);
|
||||||
@ -180,6 +180,11 @@ static cell AMX_NATIVE_CALL SMC_ParseFile(AMX *amx, cell *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*params / sizeof(cell) >= 5)
|
||||||
|
{
|
||||||
|
p->data = params[5];
|
||||||
|
}
|
||||||
|
|
||||||
int length;
|
int length;
|
||||||
const char *file = build_pathname("%s", get_amxstring(amx, params[2], 0, length));
|
const char *file = build_pathname("%s", get_amxstring(amx, params[2], 0, length));
|
||||||
|
|
||||||
@ -222,7 +227,7 @@ static cell AMX_NATIVE_CALL INI_CreateParser(AMX *amx, cell *params)
|
|||||||
return createParser();
|
return createParser();
|
||||||
}
|
}
|
||||||
|
|
||||||
// native bool:INI_ParseFile(INIParser:handle, const file[], &line = 0, &col = 0);
|
// native bool:INI_ParseFile(INIParser:handle, const file[], &line = 0, &col = 0, any:data = 0);
|
||||||
static cell AMX_NATIVE_CALL INI_ParseFile(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL INI_ParseFile(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
ParseInfo *p = TextParsersHandles.lookup(params[1]);
|
ParseInfo *p = TextParsersHandles.lookup(params[1]);
|
||||||
@ -236,6 +241,11 @@ static cell AMX_NATIVE_CALL INI_ParseFile(AMX *amx, cell *params)
|
|||||||
int length;
|
int length;
|
||||||
const char *file = build_pathname("%s", get_amxstring(amx, params[2], 0, length));
|
const char *file = build_pathname("%s", get_amxstring(amx, params[2], 0, length));
|
||||||
|
|
||||||
|
if (*params / sizeof(cell) >= 5)
|
||||||
|
{
|
||||||
|
p->data = params[5];
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int line, col;
|
unsigned int line, col;
|
||||||
bool result = textparsers->ParseFile_INI(file, p, &line, &col);
|
bool result = textparsers->ParseFile_INI(file, p, &line, &col);
|
||||||
|
|
||||||
@ -261,7 +271,7 @@ static cell AMX_NATIVE_CALL INI_SetParseStart(AMX *amx, cell *params)
|
|||||||
|
|
||||||
if ((funcName = get_amxstring(amx, params[2], 0, length)) && length)
|
if ((funcName = get_amxstring(amx, params[2], 0, length)) && length)
|
||||||
{
|
{
|
||||||
p->parse_start = registerSPForwardByName(amx, funcName, FP_CELL, FP_DONE);
|
p->parse_start = registerSPForwardByName(amx, funcName, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->parse_start == -1)
|
if (p->parse_start == -1)
|
||||||
@ -289,7 +299,7 @@ static cell AMX_NATIVE_CALL INI_SetParseEnd(AMX *amx, cell *params)
|
|||||||
|
|
||||||
if ((funcName = get_amxstring(amx, params[2], 0, length)))
|
if ((funcName = get_amxstring(amx, params[2], 0, length)))
|
||||||
{
|
{
|
||||||
p->parse_end = registerSPForwardByName(amx, funcName, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
p->parse_end = registerSPForwardByName(amx, funcName, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->parse_end == -1)
|
if (p->parse_end == -1)
|
||||||
@ -317,12 +327,12 @@ static cell AMX_NATIVE_CALL INI_SetReaders(AMX *amx, cell *params)
|
|||||||
|
|
||||||
if ((funcName = get_amxstring(amx, params[2], 0, kvLength)) && kvLength)
|
if ((funcName = get_amxstring(amx, params[2], 0, kvLength)) && kvLength)
|
||||||
{
|
{
|
||||||
p->key_value = registerSPForwardByName(amx, funcName, FP_CELL, FP_STRING, FP_STRING, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
p->key_value = registerSPForwardByName(amx, funcName, FP_CELL, FP_STRING, FP_STRING, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kvLength && (funcName = get_amxstring(amx, params[3], 1, nsLength)) && nsLength)
|
if (kvLength && (funcName = get_amxstring(amx, params[3], 1, nsLength)) && nsLength)
|
||||||
{
|
{
|
||||||
p->new_section = registerSPForwardByName(amx, funcName, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
p->new_section = registerSPForwardByName(amx, funcName, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->key_value == -1 || (nsLength && p->new_section == -1))
|
if (p->key_value == -1 || (nsLength && p->new_section == -1))
|
||||||
@ -350,7 +360,7 @@ static cell AMX_NATIVE_CALL INI_SetRawLine(AMX *amx, cell *params)
|
|||||||
|
|
||||||
if ((funcName = get_amxstring(amx, params[2], 0, length)) && length)
|
if ((funcName = get_amxstring(amx, params[2], 0, length)) && length)
|
||||||
{
|
{
|
||||||
p->raw_line = registerSPForwardByName(amx, funcName, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_DONE);
|
p->raw_line = registerSPForwardByName(amx, funcName, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->raw_line == -1)
|
if (p->raw_line == -1)
|
||||||
|
@ -30,6 +30,7 @@ public:
|
|||||||
end_section = -1;
|
end_section = -1;
|
||||||
raw_line = -1;
|
raw_line = -1;
|
||||||
handle = -1;
|
handle = -1;
|
||||||
|
data = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -41,19 +42,19 @@ public:
|
|||||||
void ReadSMC_ParseStart()
|
void ReadSMC_ParseStart()
|
||||||
{
|
{
|
||||||
if (parse_start != -1)
|
if (parse_start != -1)
|
||||||
executeForwards(parse_start, handle);
|
executeForwards(parse_start, handle, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadSMC_ParseEnd(bool halted, bool failed)
|
void ReadSMC_ParseEnd(bool halted, bool failed)
|
||||||
{
|
{
|
||||||
if (parse_end != -1)
|
if (parse_end != -1)
|
||||||
executeForwards(parse_end, handle, halted ? 1 : 0, failed ? 1 : 0);
|
executeForwards(parse_end, handle, halted ? 1 : 0, failed ? 1 : 0, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name)
|
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name)
|
||||||
{
|
{
|
||||||
if (new_section != -1)
|
if (new_section != -1)
|
||||||
return (SMCResult)executeForwards(new_section, handle, name);
|
return (SMCResult)executeForwards(new_section, handle, name, data);
|
||||||
|
|
||||||
return SMCResult_Continue;
|
return SMCResult_Continue;
|
||||||
}
|
}
|
||||||
@ -61,7 +62,7 @@ public:
|
|||||||
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
|
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
|
||||||
{
|
{
|
||||||
if (key_value != -1)
|
if (key_value != -1)
|
||||||
return (SMCResult)executeForwards(key_value, handle, key, value);
|
return (SMCResult)executeForwards(key_value, handle, key, value, data);
|
||||||
|
|
||||||
return SMCResult_Continue;
|
return SMCResult_Continue;
|
||||||
}
|
}
|
||||||
@ -69,7 +70,7 @@ public:
|
|||||||
SMCResult ReadSMC_LeavingSection(const SMCStates *states)
|
SMCResult ReadSMC_LeavingSection(const SMCStates *states)
|
||||||
{
|
{
|
||||||
if (end_section != -1)
|
if (end_section != -1)
|
||||||
return (SMCResult)executeForwards(end_section, handle);
|
return (SMCResult)executeForwards(end_section, handle, data);
|
||||||
|
|
||||||
return SMCResult_Continue;
|
return SMCResult_Continue;
|
||||||
}
|
}
|
||||||
@ -77,7 +78,7 @@ public:
|
|||||||
SMCResult ReadSMC_RawLine(const SMCStates *states, const char *line)
|
SMCResult ReadSMC_RawLine(const SMCStates *states, const char *line)
|
||||||
{
|
{
|
||||||
if (raw_line != -1)
|
if (raw_line != -1)
|
||||||
return (SMCResult)executeForwards(raw_line, handle, line, states->line);
|
return (SMCResult)executeForwards(raw_line, handle, line, states->line, data);
|
||||||
|
|
||||||
return SMCResult_Continue;
|
return SMCResult_Continue;
|
||||||
}
|
}
|
||||||
@ -90,19 +91,19 @@ public:
|
|||||||
void ReadINI_ParseStart()
|
void ReadINI_ParseStart()
|
||||||
{
|
{
|
||||||
if (parse_start != -1)
|
if (parse_start != -1)
|
||||||
executeForwards(parse_start, handle);
|
executeForwards(parse_start, handle, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadINI_ParseEnd(bool halted)
|
void ReadINI_ParseEnd(bool halted)
|
||||||
{
|
{
|
||||||
if (parse_end != -1)
|
if (parse_end != -1)
|
||||||
executeForwards(parse_end, handle, halted ? 1 : 0);
|
executeForwards(parse_end, handle, halted ? 1 : 0, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReadINI_NewSection(const char *section, bool invalid_tokens, bool close_bracket, bool extra_tokens, unsigned int *curtok)
|
bool ReadINI_NewSection(const char *section, bool invalid_tokens, bool close_bracket, bool extra_tokens, unsigned int *curtok)
|
||||||
{
|
{
|
||||||
if (new_section != -1)
|
if (new_section != -1)
|
||||||
return executeForwards(new_section, handle, section, invalid_tokens, close_bracket, extra_tokens, *curtok) > 0 ? true : false;
|
return executeForwards(new_section, handle, section, invalid_tokens, close_bracket, extra_tokens, *curtok, data) > 0 ? true : false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -110,7 +111,7 @@ public:
|
|||||||
bool ReadINI_KeyValue(const char *key, const char *value, bool invalid_tokens, bool equal_token, bool quotes, unsigned int *curtok)
|
bool ReadINI_KeyValue(const char *key, const char *value, bool invalid_tokens, bool equal_token, bool quotes, unsigned int *curtok)
|
||||||
{
|
{
|
||||||
if (key_value != -1)
|
if (key_value != -1)
|
||||||
return executeForwards(key_value, handle, key, value, invalid_tokens, equal_token, quotes, *curtok) > 0 ? true : false;
|
return executeForwards(key_value, handle, key, value, invalid_tokens, equal_token, quotes, *curtok, data) > 0 ? true : false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -118,7 +119,7 @@ public:
|
|||||||
bool ReadINI_RawLine(const char *line, unsigned int *curtok)
|
bool ReadINI_RawLine(const char *line, unsigned int *curtok)
|
||||||
{
|
{
|
||||||
if (raw_line != -1)
|
if (raw_line != -1)
|
||||||
return executeForwards(raw_line, handle, line, *curtok) > 0 ? true : false;
|
return executeForwards(raw_line, handle, line, *curtok, data) > 0 ? true : false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -130,6 +131,7 @@ public:
|
|||||||
int end_section;
|
int end_section;
|
||||||
int raw_line;
|
int raw_line;
|
||||||
int handle;
|
int handle;
|
||||||
|
cell data;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern NativeHandle<ParseInfo> TextParsersHandles;
|
extern NativeHandle<ParseInfo> TextParsersHandles;
|
||||||
|
@ -91,11 +91,12 @@ native INI_DestroyParser(&INIParser:handle);
|
|||||||
* @param file A string containing the file path.
|
* @param file A string containing the file path.
|
||||||
* @param line An optional by reference cell to store the last line number read.
|
* @param line An optional by reference cell to store the last line number read.
|
||||||
* @param col An optional by reference cell to store the last column number read.
|
* @param col An optional by reference cell to store the last column number read.
|
||||||
|
* @param data An optional handle or value to pass through to callback functions
|
||||||
|
*
|
||||||
* @return An SMCParseError result.
|
* @return An SMCParseError result.
|
||||||
* @error Invalid or corrupt handle.
|
* @error Invalid or corrupt handle.
|
||||||
*/
|
*/
|
||||||
native bool:INI_ParseFile(INIParser:handle, const file[], &line = 0, &col = 0);
|
native bool:INI_ParseFile(INIParser:handle, const file[], &line = 0, &col = 0, any:data = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the INI_ParseStart function of a parse handle.
|
* Sets the INI_ParseStart function of a parse handle.
|
||||||
@ -105,10 +106,11 @@ native bool:INI_ParseFile(INIParser:handle, const file[], &line = 0, &col = 0);
|
|||||||
* Called when parsing is started.
|
* Called when parsing is started.
|
||||||
*
|
*
|
||||||
* @param handle A handle to an INI Parse structure.
|
* @param handle A handle to an INI Parse structure.
|
||||||
|
* @param data Handle or value passed in INI_ParseFile
|
||||||
*
|
*
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*
|
*
|
||||||
* public OnParseStart(INIParser:handle)
|
* public OnParseStart(INIParser:handle, any:data)
|
||||||
* -
|
* -
|
||||||
* @param handle Handle to an INI Parse structure.
|
* @param handle Handle to an INI Parse structure.
|
||||||
* @param func A ParseStart callback.
|
* @param func A ParseStart callback.
|
||||||
@ -127,10 +129,11 @@ native INI_SetParseStart(INIParser:handle, const func[]);
|
|||||||
*
|
*
|
||||||
* @param handle A handle to an INI Parse structure.
|
* @param handle A handle to an INI Parse structure.
|
||||||
* @param halted True if abnormally halted, false otherwise.
|
* @param halted True if abnormally halted, false otherwise.
|
||||||
|
* @param data Handle or value passed in INI_ParseFile
|
||||||
*
|
*
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*
|
*
|
||||||
* public OnParseEnd(INIParser:handle, bool:halted)
|
* public OnParseEnd(INIParser:handle, bool:halted, any:data)
|
||||||
* -
|
* -
|
||||||
* @param handle Handle to an INI Parse structure.
|
* @param handle Handle to an INI Parse structure.
|
||||||
* @param func A ParseEnd callback.
|
* @param func A ParseEnd callback.
|
||||||
@ -155,9 +158,11 @@ native INI_SetParseEnd(INIParser:handle, const func[]);
|
|||||||
* @param extra_tokens True if extra tokens were detected on the line.
|
* @param extra_tokens True if extra tokens were detected on the line.
|
||||||
* @param curtok Contains current token in the line where the section name starts.
|
* @param curtok Contains current token in the line where the section name starts.
|
||||||
* You can add to this offset when failing to point to a token.
|
* You can add to this offset when failing to point to a token.
|
||||||
|
* @param data Handle or value passed in INI_ParseFile
|
||||||
|
*
|
||||||
* @return True to keep parsing, false otherwise.
|
* @return True to keep parsing, false otherwise.
|
||||||
*
|
*
|
||||||
* public bool:OnNewSection(INIParser:handle, const section[], bool:invalid_tokens, bool:close_bracket, bool:extra_tokens, curtok)
|
* public bool:OnNewSection(INIParser:handle, const section[], bool:invalid_tokens, bool:close_bracket, bool:extra_tokens, curtok, any:data)
|
||||||
*
|
*
|
||||||
* KeyValue:
|
* KeyValue:
|
||||||
* Called when the parser finds a new key/value pair.
|
* Called when the parser finds a new key/value pair.
|
||||||
@ -170,9 +175,11 @@ native INI_SetParseEnd(INIParser:handle, const func[]);
|
|||||||
* @param quotes Whether value was enclosed in quotes.
|
* @param quotes Whether value was enclosed in quotes.
|
||||||
* @param curtok Contains the token index of the start of the value string.
|
* @param curtok Contains the token index of the start of the value string.
|
||||||
* This can be changed when returning false.
|
* This can be changed when returning false.
|
||||||
|
* @param data Handle or value passed in INI_ParseFile
|
||||||
|
*
|
||||||
* @return True to keep parsing, false otherwise.
|
* @return True to keep parsing, false otherwise.
|
||||||
*
|
*
|
||||||
* public bool:OnKeyValue(INIParser:handle, const key[], const value[], bool:invalid_tokens, bool:equal_token, bool:quotes, curtok)
|
* public bool:OnKeyValue(INIParser:handle, const key[], const value[], bool:invalid_tokens, bool:equal_token, bool:quotes, curtok, any:data)
|
||||||
* -
|
* -
|
||||||
* @param handle Handle to an INI Parse structure.
|
* @param handle Handle to an INI Parse structure.
|
||||||
* @param kv A KeyValue callback.
|
* @param kv A KeyValue callback.
|
||||||
@ -193,10 +200,11 @@ native INI_SetReaders(INIParser:smc, const kvFunc[], const nsFunc[] = "" );
|
|||||||
* @param line Contents of line.
|
* @param line Contents of line.
|
||||||
* @param lineno The line number it occurs on.
|
* @param lineno The line number it occurs on.
|
||||||
* @param curtok Pointer to optionally store failed position in string.
|
* @param curtok Pointer to optionally store failed position in string.
|
||||||
|
* @param data Handle or value passed in INI_ParseFile
|
||||||
*
|
*
|
||||||
* @return True to keep parsing, false otherwise.
|
* @return True to keep parsing, false otherwise.
|
||||||
*
|
*
|
||||||
* public bool:OnRawLine(INIParser:smc, const line[], lineno, curtok)
|
* public bool:OnRawLine(INIParser:smc, const line[], lineno, curtok, any:data)
|
||||||
*
|
*
|
||||||
* @param handle Handle to an INI Parse structure.
|
* @param handle Handle to an INI Parse structure.
|
||||||
* @param func A RawLine callback.
|
* @param func A RawLine callback.
|
||||||
|
@ -122,11 +122,12 @@ native SMC_DestroyParser(&SMCParser:handle);
|
|||||||
* @param file A string containing the file path.
|
* @param file A string containing the file path.
|
||||||
* @param line An optional by reference cell to store the last line number read.
|
* @param line An optional by reference cell to store the last line number read.
|
||||||
* @param col An optional by reference cell to store the last column number read.
|
* @param col An optional by reference cell to store the last column number read.
|
||||||
|
* @param data An optional handle or value to pass through to callback functions
|
||||||
*
|
*
|
||||||
* @return An SMCParseError result.
|
* @return An SMCParseError result.
|
||||||
* @error Invalid or corrupt handle.
|
* @error Invalid or corrupt handle.
|
||||||
*/
|
*/
|
||||||
native SMCError:SMC_ParseFile(SMCParser:handle, const file[], &line = 0, &col = 0);
|
native SMCError:SMC_ParseFile(SMCParser:handle, const file[], &line = 0, &col = 0, any:data = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the SMC_ParseStart function of a parse handle.
|
* Sets the SMC_ParseStart function of a parse handle.
|
||||||
@ -136,10 +137,11 @@ native SMCError:SMC_ParseFile(SMCParser:handle, const file[], &line = 0, &col =
|
|||||||
* Called when parsing is started.
|
* Called when parsing is started.
|
||||||
*
|
*
|
||||||
* @param handle Handle to an SMC Parse structure.
|
* @param handle Handle to an SMC Parse structure.
|
||||||
|
* @param data Handle or value passed in SMC_ParseFile
|
||||||
*
|
*
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*
|
*
|
||||||
* public OnParseStart(SMCParser:handle)
|
* public OnParseStart(SMCParser:handle, any:data)
|
||||||
* -
|
* -
|
||||||
* @param handle Handle to an SMC Parse structure.
|
* @param handle Handle to an SMC Parse structure.
|
||||||
* @param func A ParseStart callback.
|
* @param func A ParseStart callback.
|
||||||
@ -159,10 +161,11 @@ native SMC_SetParseStart(SMCParser:handle, const func[]);
|
|||||||
* @param handle Handle to an SMC Parse structure.
|
* @param handle Handle to an SMC Parse structure.
|
||||||
* @param halted True if abnormally halted, false otherwise.
|
* @param halted True if abnormally halted, false otherwise.
|
||||||
* @param failed True if parsing failed, false otherwise.
|
* @param failed True if parsing failed, false otherwise.
|
||||||
|
* @param data Handle or value passed in SMC_ParseFile
|
||||||
*
|
*
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*
|
*
|
||||||
* public OnParseEnd(SMCParser:handle, bool:halted, bool:failed)
|
* public OnParseEnd(SMCParser:handle, bool:halted, bool:failed, any:data)
|
||||||
* -
|
* -
|
||||||
* @param handle Handle to an SMC Parse structure.
|
* @param handle Handle to an SMC Parse structure.
|
||||||
* @param func A ParseEnd callback.
|
* @param func A ParseEnd callback.
|
||||||
@ -183,10 +186,11 @@ native SMC_SetParseEnd(SMCParser:handle, const func[]);
|
|||||||
*
|
*
|
||||||
* @param handle Handle to an SMC Parse structure.
|
* @param handle Handle to an SMC Parse structure.
|
||||||
* @param name String containing section name.
|
* @param name String containing section name.
|
||||||
|
* @param data Handle or value passed in SMC_ParseFile
|
||||||
*
|
*
|
||||||
* @return An SMCResult action to take.
|
* @return An SMCResult action to take.
|
||||||
*
|
*
|
||||||
* public SMCResult:OnNewSection(SMCParser:handle, const name[])
|
* public SMCResult:OnNewSection(SMCParser:handle, const name[], any:data)
|
||||||
*
|
*
|
||||||
* KeyValue:
|
* KeyValue:
|
||||||
* Called when the parser finds a new key/value pair.
|
* Called when the parser finds a new key/value pair.
|
||||||
@ -194,19 +198,21 @@ native SMC_SetParseEnd(SMCParser:handle, const func[]);
|
|||||||
* @param handle Handle to an SMC Parse structure.
|
* @param handle Handle to an SMC Parse structure.
|
||||||
* @param key String containing key name.
|
* @param key String containing key name.
|
||||||
* @param value String containing value name.
|
* @param value String containing value name.
|
||||||
|
* @param data Handle or value passed in SMC_ParseFile
|
||||||
*
|
*
|
||||||
* @return An SMCResult action to take.
|
* @return An SMCResult action to take.
|
||||||
*
|
*
|
||||||
* public SMCResult:OnKeyValue(SMCParser:handle, const key[], const value[])
|
* public SMCResult:OnKeyValue(SMCParser:handle, const key[], const value[], any:data)
|
||||||
*
|
*
|
||||||
* EndSection:
|
* EndSection:
|
||||||
* Called when the parser finds the end of the current section.
|
* Called when the parser finds the end of the current section.
|
||||||
*
|
*
|
||||||
* @param handle Handle to an SMC Parse structure.
|
* @param handle Handle to an SMC Parse structure.
|
||||||
|
* @param data Handle or value passed in SMC_ParseFile
|
||||||
*
|
*
|
||||||
* @return An SMCResult action to take.
|
* @return An SMCResult action to take.
|
||||||
*
|
*
|
||||||
* public SMCResult:OnEndSection(SMCParser:handle)
|
* public SMCResult:OnEndSection(SMCParser:handle, any:data)
|
||||||
* -
|
* -
|
||||||
* @param handle Handle to an SMC Parse structure.
|
* @param handle Handle to an SMC Parse structure.
|
||||||
* @param kv A KeyValue callback.
|
* @param kv A KeyValue callback.
|
||||||
@ -227,10 +233,11 @@ native SMC_SetReaders(SMCParser:smc, const kvFunc[], const nsFunc[] = "", const
|
|||||||
* @param handle Handle to an SMC Parse structure.
|
* @param handle Handle to an SMC Parse structure.
|
||||||
* @param line A string containing the raw line from the file.
|
* @param line A string containing the raw line from the file.
|
||||||
* @param lineno The line number it occurs on.
|
* @param lineno The line number it occurs on.
|
||||||
|
* @param data Handle or value passed in SMC_ParseFile
|
||||||
*
|
*
|
||||||
* @return An SMCResult action to take.
|
* @return An SMCResult action to take.
|
||||||
*
|
*
|
||||||
* public SMCResult:SMC_RawLine(SMCParser:handle, const line[], lineno)
|
* public SMCResult:SMC_RawLine(SMCParser:handle, const line[], lineno, any:data)
|
||||||
* -
|
* -
|
||||||
* @param handle Handle to an SMC Parse structure.
|
* @param handle Handle to an SMC Parse structure.
|
||||||
* @param func A RawLine callback.
|
* @param func A RawLine callback.
|
||||||
|
Loading…
Reference in New Issue
Block a user