first commit

This commit is contained in:
2026-06-22 11:49:35 +02:00
commit d805f2ba86
619 changed files with 126873 additions and 0 deletions

View File

@ -0,0 +1,82 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#ifndef __NASCIIENC__
#define __NASCIIENC__
#include "ntypes.h"
/*!
@short ASCII encoding.
This class currently provide two commonly used encoding method:
yEnc and UUEncode.
@author Emmanuel Julien (ejulien@gsworks.fr)
*/
namespace nAsciiEncoder
{
/*!
@short Perform UUEncoding.
@param source Input binary stream.
@param len Input binary stream length.
@param uuenc Output buffer.
@param max Output buffer length.
@return The number of bytes written to the output buffer.
@note If yenc is NULL the function can be used to check the size
of the encoded stream prior to allocating an output buffer.
*/
uint UUEncode(const uchar *source, size_t len, uchar *uuenc = 0, size_t max = 0);
/*!
@short Perform UUDecoding.
@param source UUEncoded byte stream.
@param len UUEncoded byte stream length.
@param bin Output buffer.
@param max Output buffer length.
@return The number of bytes written to the output buffer.
@note If bin is NULL the function can be used to check the size
of the decoded stream prior to allocating an output buffer.
*/
uint UUDecode(const uchar *source, size_t len, uchar *bin = 0, size_t max = 0);
/*!
@short Perform yEncoding.
@param source Input binary stream.
@param len Input binary stream length.
@param yenc Output buffer.
@param max Output buffer length.
@param line_len Number of character to output before a line-feed character is sent.
@return The number of bytes written to the output buffer.
@note If yenc is NULL the function can be used to check the size
of the encoded stream prior to allocating an output buffer.
*/
uint yEncode(const uchar *source, size_t len, uchar *yenc = 0, size_t max = 0, uint line_len = 64);
/*!
@short Perform yDecoding.
@param source yEncoded byte stream.
@param len yEncoded byte stream length.
@param bin Output buffer.
@param max Output buffer length.
@return The number of bytes written to the output buffer.
@note If bin is NULL the function can be used to check the size
of the decoded stream prior to allocating an output buffer.
*/
uint yDecode(const uchar *source, size_t len, uchar *bin = 0, size_t max = 0);
};
#endif // __NASCIIENC__

View File

@ -0,0 +1,50 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
------------------------------------------------------------------------------*/
#ifndef __NASCII_PARSER__
#define __NASCII_PARSER__
/*!
@short ASCII parsing tools.
@author Emmanuel Julien (ejulien@gsworks.fr)
*/
namespace GS {
namespace AsciiParser {
/// Return true is the provided character is uppercase.
bool IsUpperCase(const char s);
/// Return whether a constant is float or int.
bool IsConstantFloat(const char *s, const char *e);
/// Find a character inside an ASCII block.
const char *Find(const char *s, const char *e, char f);
/// Run to end of string.
const char *RunToEOS(const char *s, const char *e);
/// Run to end of line marker.
const char *RunToEOL(const char *s, const char *e);
/// Skip end of line marker.
const char *SkipEOL(const char *s, const char *e);
/*!
@short Run to the end of a group started with character 'op' closed with character 'cl'.
@note This function automatically skips nested group of the same kind.
*/
const char *RunToEOG(const char *s, const char *e, char op, char cl);
/// Run to the end of a C comment block (/*...*/).
const char *RunToEOC(const char *s, const char *e);
/// Run to the end of a C expression.
const char *RunToEOE(const char *s, const char *e);
/// Skip non-{space/tab/comments} string.
const char *SkipEntry(const char *s, const char *e, bool skip_minus = false);
/// Skip spaces.
const char *SkipSpace(const char *s, const char *e);
/// Go to the next entry.
const char *NextEntry(const char *s, const char *e, bool skip_minus = false);
}
}
#endif // __NASCII_PARSER__