//This code is copyright Andrew Story (Kaslai/Aslai) All rights reserved.
//This and derivative works can be distributed as seen fit,
//so long as this notice remains unchanged and present

#pragma once
#ifndef WIN
#define UNIX
#endif

#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>

#define getInt(a) (args[(a)])
#define getString(a) ((char*)args[(a)])


struct AParse
{
    AParse();

    int charToInt( const char* in , const char* terminators = "\0", int termlen = 1 );
    int strcmpl( const char* str1, const char* str2 );
    struct function
    {
        char* id;
        char* format;
        void* userdata;
        void ( *func )( void* data, int* func );
    };
    function* funcs;
    int funcCount;
    char* readWord( char* in, int* length = 0, bool copy = true, const char* terminators = "\0", int termlen = 1, int terminate = 0, int dead = 0 );
    void addFunc( char* id, char* format, void ( *func )( void*, int* func ), void* userdata = 0 );
    void clearFuncs();
    bool parseScipt( const char* fname );
    bool parseScipt( void* fdata, int len );


};