Update spcomp and includes to latest 1.10-fork
disable warning 241: Array-based enum structs will be removed in 1.11
This commit is contained in:
Vendored
+94
-82
@@ -47,9 +47,9 @@
|
||||
*/
|
||||
enum SMCResult
|
||||
{
|
||||
SMCParse_Continue, /**< Continue parsing */
|
||||
SMCParse_Halt, /**< Stop parsing here */
|
||||
SMCParse_HaltFail /**< Stop parsing and return failure */
|
||||
SMCParse_Continue, /**< Continue parsing */
|
||||
SMCParse_Halt, /**< Stop parsing here */
|
||||
SMCParse_HaltFail /**< Stop parsing and return failure */
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -57,66 +57,77 @@ enum SMCResult
|
||||
*/
|
||||
enum SMCError
|
||||
{
|
||||
SMCError_Okay = 0, /**< No error */
|
||||
SMCError_StreamOpen, /**< Stream failed to open */
|
||||
SMCError_StreamError, /**< The stream died... somehow */
|
||||
SMCError_Custom, /**< A custom handler threw an error */
|
||||
SMCError_InvalidSection1, /**< A section was declared without quotes, and had extra tokens */
|
||||
SMCError_InvalidSection2, /**< A section was declared without any header */
|
||||
SMCError_InvalidSection3, /**< A section ending was declared with too many unknown tokens */
|
||||
SMCError_InvalidSection4, /**< A section ending has no matching beginning */
|
||||
SMCError_InvalidSection5, /**< A section beginning has no matching ending */
|
||||
SMCError_InvalidTokens, /**< There were too many unidentifiable strings on one line */
|
||||
SMCError_TokenOverflow, /**< The token buffer overflowed */
|
||||
SMCError_InvalidProperty1, /**< A property was declared outside of any section */
|
||||
SMCError_Okay = 0, /**< No error */
|
||||
SMCError_StreamOpen, /**< Stream failed to open */
|
||||
SMCError_StreamError, /**< The stream died... somehow */
|
||||
SMCError_Custom, /**< A custom handler threw an error */
|
||||
SMCError_InvalidSection1, /**< A section was declared without quotes, and had extra tokens */
|
||||
SMCError_InvalidSection2, /**< A section was declared without any header */
|
||||
SMCError_InvalidSection3, /**< A section ending was declared with too many unknown tokens */
|
||||
SMCError_InvalidSection4, /**< A section ending has no matching beginning */
|
||||
SMCError_InvalidSection5, /**< A section beginning has no matching ending */
|
||||
SMCError_InvalidTokens, /**< There were too many unidentifiable strings on one line */
|
||||
SMCError_TokenOverflow, /**< The token buffer overflowed */
|
||||
SMCError_InvalidProperty1 /**< A property was declared outside of any section */
|
||||
};
|
||||
|
||||
// Called when parsing is started.
|
||||
//
|
||||
// @param smc The SMC Parse Handle.
|
||||
/**
|
||||
* Called when parsing is started.
|
||||
*
|
||||
* @param smc The SMC Parse Handle.
|
||||
*/
|
||||
typedef SMC_ParseStart = function void (SMCParser smc);
|
||||
|
||||
// Called when the parser is entering a new section or sub-section.
|
||||
//
|
||||
// Note: Enclosing quotes are always stripped.
|
||||
//
|
||||
// @param smc The SMC Parser.
|
||||
// @param name String containing section name.
|
||||
// @param opt_quotes True if the section name was quote-enclosed in the file.
|
||||
// @return An SMCResult action to take.
|
||||
/**
|
||||
* Called when the parser is entering a new section or sub-section.
|
||||
*
|
||||
* Note: Enclosing quotes are always stripped.
|
||||
*
|
||||
* @param smc The SMC Parser.
|
||||
* @param name String containing section name.
|
||||
* @param opt_quotes True if the section name was quote-enclosed in the file.
|
||||
* @return An SMCResult action to take.
|
||||
*/
|
||||
typedef SMC_NewSection = function SMCResult (SMCParser smc, const char[] name, bool opt_quotes);
|
||||
|
||||
// Called when the parser finds a new key/value pair.
|
||||
//
|
||||
// Note: Enclosing quotes are always stripped.
|
||||
//
|
||||
// @param smc The SMCParser.
|
||||
// @param key String containing key name.
|
||||
// @param value String containing value name.
|
||||
// @param key_quotes Whether or not the key was enclosed in quotes.
|
||||
// @param value_quotes Whether or not the value was enclosed in quotes.
|
||||
// @return An SMCResult action to take.
|
||||
/**
|
||||
* Called when the parser finds a new key/value pair.
|
||||
*
|
||||
* Note: Enclosing quotes are always stripped.
|
||||
*
|
||||
* @param smc The SMCParser.
|
||||
* @param key String containing key name.
|
||||
* @param value String containing value name.
|
||||
* @param key_quotes Whether or not the key was enclosed in quotes.
|
||||
* @param value_quotes Whether or not the value was enclosed in quotes.
|
||||
* @return An SMCResult action to take.
|
||||
*/
|
||||
typedef SMC_KeyValue = function SMCResult (SMCParser smc, const char[] key, const char[] value, bool key_quotes, bool value_quotes);
|
||||
|
||||
// Called when the parser finds the end of the current section.
|
||||
//
|
||||
// @param smc The SMCParser.
|
||||
// @return An SMCResult action to take.
|
||||
/** Called when the parser finds the end of the current section.
|
||||
*
|
||||
* @param smc The SMCParser.
|
||||
* @return An SMCResult action to take.
|
||||
*/
|
||||
typedef SMC_EndSection = function SMCResult (SMCParser smc);
|
||||
|
||||
// Called when parsing is halted.
|
||||
//
|
||||
// @param smc The SMCParser.
|
||||
// @param halted True if abnormally halted, false otherwise.
|
||||
// @param failed True if parsing failed, false otherwise.
|
||||
/**
|
||||
* Called when parsing is halted.
|
||||
*
|
||||
* @param smc The SMCParser.
|
||||
* @param halted True if abnormally halted, false otherwise.
|
||||
* @param failed True if parsing failed, false otherwise.
|
||||
*/
|
||||
typedef SMC_ParseEnd = function void (SMCParser smc, bool halted, bool failed);
|
||||
|
||||
// Callback for whenever a new line of text is about to be parsed.
|
||||
//
|
||||
// @param smc The SMCParser.
|
||||
// @param line A string containing the raw line from the file.
|
||||
// @param lineno The line number it occurs on.
|
||||
// @return An SMCResult action to take.
|
||||
/**
|
||||
* Callback for whenever a new line of text is about to be parsed.
|
||||
*
|
||||
* @param smc The SMCParser.
|
||||
* @param line A string containing the raw line from the file.
|
||||
* @param lineno The line number it occurs on.
|
||||
* @return An SMCResult action to take.
|
||||
*/
|
||||
typedef SMC_RawLine = function SMCResult (SMCParser smc, const char[] line, int lineno);
|
||||
|
||||
// An SMCParser is a callback-driven parser for SourceMod configuration files.
|
||||
@@ -130,10 +141,10 @@ methodmap SMCParser < Handle
|
||||
|
||||
// Parses an SMC file.
|
||||
//
|
||||
// @param file A string containing the file path.
|
||||
// @param line An optional variable to store the last line number read.
|
||||
// @param col An optional variable to store the last column number read.
|
||||
// @return An SMCParseError result.
|
||||
// @param file A string containing the file path.
|
||||
// @param line An optional variable to store the last line number read.
|
||||
// @param col An optional variable to store the last column number read.
|
||||
// @return An SMCParseError result.
|
||||
public native SMCError ParseFile(const char[] file, int &line = 0, int &col = 0);
|
||||
|
||||
// Sets the callback for receiving SMC_ParseStart events.
|
||||
@@ -168,76 +179,77 @@ methodmap SMCParser < Handle
|
||||
|
||||
// Gets an error string for an SMCError code.
|
||||
//
|
||||
// @param error The SMCParseError code.
|
||||
// @param buffer A string buffer for the error (contents undefined on failure).
|
||||
// @param buf_max The maximum size of the buffer.
|
||||
// @return The number of characters written to buffer.
|
||||
// @param error The SMCParseError code.
|
||||
// @param buffer A string buffer for the error (contents undefined on failure).
|
||||
// @param buf_max The maximum size of the buffer.
|
||||
// @return The number of characters written to buffer.
|
||||
public native void GetErrorString(SMCError error, char[] buffer, int buf_max);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new SMC file format parser. This is used to set parse hooks.
|
||||
*
|
||||
* @return A new Handle to an SMC Parse structure.
|
||||
* @return A new Handle to an SMC Parse structure.
|
||||
*/
|
||||
native SMCParser SMC_CreateParser();
|
||||
|
||||
/**
|
||||
* Parses an SMC file.
|
||||
*
|
||||
* @param smc A Handle to an SMC Parse structure.
|
||||
* @param file A string containing the file path.
|
||||
* @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.
|
||||
* @return An SMCParseError result.
|
||||
* @error Invalid or corrupt Handle.
|
||||
* @param smc A Handle to an SMC Parse structure.
|
||||
* @param file A string containing the file path.
|
||||
* @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.
|
||||
* @return An SMCParseError result.
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native SMCError SMC_ParseFile(Handle smc, const char[] file, int &line=0, int &col=0);
|
||||
|
||||
/**
|
||||
* Gets an error string for an SMCError code.
|
||||
*
|
||||
* @note SMCError_Okay returns false.
|
||||
* @note SMCError_Custom (which is thrown on SMCParse_HaltFail) returns false.
|
||||
*
|
||||
* @param error The SMCParseError code.
|
||||
* @param buffer A string buffer for the error (contents undefined on failure).
|
||||
* @param buf_max The maximum size of the buffer.
|
||||
* @return True on success, false otherwise.
|
||||
* @param error The SMCParseError code.
|
||||
* @param buffer A string buffer for the error (contents undefined on failure).
|
||||
* @param buf_max The maximum size of the buffer.
|
||||
* @return True on success, false otherwise.
|
||||
*/
|
||||
native bool SMC_GetErrorString(SMCError error, char[] buffer, int buf_max);
|
||||
|
||||
/**
|
||||
* Sets the SMC_ParseStart function of a parse Handle.
|
||||
*
|
||||
* @param smc Handle to an SMC Parse.
|
||||
* @param func SMC_ParseStart function.
|
||||
* @error Invalid or corrupt Handle.
|
||||
* @param smc Handle to an SMC Parse.
|
||||
* @param func SMC_ParseStart function.
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native void SMC_SetParseStart(Handle smc, SMC_ParseStart func);
|
||||
|
||||
/**
|
||||
* Sets the SMC_ParseEnd of a parse handle.
|
||||
*
|
||||
* @param smc Handle to an SMC Parse.
|
||||
* @param func SMC_ParseEnd function.
|
||||
* @error Invalid or corrupt Handle.
|
||||
* @param smc Handle to an SMC Parse.
|
||||
* @param func SMC_ParseEnd function.
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native void SMC_SetParseEnd(Handle smc, SMC_ParseEnd func);
|
||||
|
||||
/**
|
||||
* Sets the three main reader functions.
|
||||
*
|
||||
* @param smc An SMC parse Handle.
|
||||
* @param ns An SMC_NewSection function pointer.
|
||||
* @param kv An SMC_KeyValue function pointer.
|
||||
* @param es An SMC_EndSection function pointer.
|
||||
* @param smc An SMC parse Handle.
|
||||
* @param ns An SMC_NewSection function pointer.
|
||||
* @param kv An SMC_KeyValue function pointer.
|
||||
* @param es An SMC_EndSection function pointer.
|
||||
*/
|
||||
native void SMC_SetReaders(Handle smc, SMC_NewSection ns, SMC_KeyValue kv, SMC_EndSection es);
|
||||
|
||||
/**
|
||||
* Sets a raw line reader on an SMC parser Handle.
|
||||
*
|
||||
* @param smc Handle to an SMC Parse.
|
||||
* @param func SMC_RawLine function.
|
||||
* @param smc Handle to an SMC Parse.
|
||||
* @param func SMC_RawLine function.
|
||||
*/
|
||||
native void SMC_SetRawLine(Handle smc, SMC_RawLine func);
|
||||
|
||||
Reference in New Issue
Block a user