// --------------------------- VSBASE.C ------------------------------

#include "vsbase.h"

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

/*
struct SREGS sregs;
union REGS inregs, outregs;

int ArgC    = 1;

PRIVATE char *dumbname[] = {
    "VSPACE",
    NULL
};
char **ArgV = dumbname;

extern void BASE_Abort(const char *str, ...) {
    va_list arg;

    FinishProgram();
    printf("哪哪哪哪哪哪哪哪哪哪哪哪哪哪 ERROR 哪哪哪哪哪哪哪哪哪哪哪腬n");
    va_start(arg, str);
    vprintf(str, arg);
    va_end(arg);
    exit(1);
}

void BASE_Require(const char *cond, const char *file, int line) {
    BASE_Abort("Condition %s failed in source file %s, line %d.\n",
               cond, file, line);
}

int BASE_CheckArg(const char *parm) {
    int i;

    for (i = 1; i < ArgC; i++) {
        if (   (ArgV[i][0] == '-' || ArgV[i][0] == '/')
            && strcmpi(ArgV[i]+1, parm) == 0)
            return i+1;
    }
    return -1;
}

// ---------------------------------


dword RND_Seed1 = 0x07834348B;
dword RND_Seed2 = 0x078ED7F34;
dword RND_Seed3 = 0x0a78332bf;

// ------------------------------
*/

extern FILE *VSBASE_LogFile = NULL;
extern void VSLOG(const char *fmt, ...) {
    va_list arg;

    if (VSBASE_LogFile != NULL) {
        va_start(arg, fmt);
        vfprintf(VSBASE_LogFile, fmt, arg);
        va_end(arg);
    }
}


// --------------------------- BASE.C ------------------------------

