summaryrefslogtreecommitdiff
path: root/src/3rdparty/squirrel/sq
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/squirrel/sq')
-rw-r--r--src/3rdparty/squirrel/sq/Makefile24
-rw-r--r--src/3rdparty/squirrel/sq/sq.c300
-rw-r--r--src/3rdparty/squirrel/sq/sq.dsp101
3 files changed, 0 insertions, 425 deletions
diff --git a/src/3rdparty/squirrel/sq/Makefile b/src/3rdparty/squirrel/sq/Makefile
deleted file mode 100644
index 3f241ff50..000000000
--- a/src/3rdparty/squirrel/sq/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-SQUIRREL= ..
-
-
-OUT= $(SQUIRREL)/bin/sq
-INCZ= -I$(SQUIRREL)/include -I. -I$(SQUIRREL)/sqlibs
-LIBZ= -L$(SQUIRREL)/lib
-LIB= -lsquirrel -lsqstdlib
-
-OBJS= sq.o
-
-SRCS= sq.c
-
-
-sq32:
- g++ -O2 -fno-rtti -o $(OUT) $(SRCS) $(INCZ) $(LIBZ) $(LIB)
-
-sqprof:
- g++ -O2 -pg -fno-rtti -pie -gstabs -g3 -o $(OUT) $(SRCS) $(INCZ) $(LIBZ) $(LIB)
-
-sq64:
- g++ -O2 -fno-rtti -D_SQ64 -o $(OUT) $(SRCS) $(INCZ) $(LIBZ) $(LIB)
-
-clean:
- rm -f $(OUT)
diff --git a/src/3rdparty/squirrel/sq/sq.c b/src/3rdparty/squirrel/sq/sq.c
deleted file mode 100644
index 0b6c014a9..000000000
--- a/src/3rdparty/squirrel/sq/sq.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/* see copyright notice in squirrel.h */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-
-#if defined(_MSC_VER) && defined(_DEBUG)
-#include <crtdbg.h>
-#include <conio.h>
-#endif
-#include <squirrel.h>
-#include <sqstdblob.h>
-#include <sqstdsystem.h>
-#include <sqstdio.h>
-#include <sqstdmath.h>
-#include <sqstdstring.h>
-#include <sqstdaux.h>
-
-#define scfprintf fprintf
-#define scfopen fopen
-#define scvprintf vprintf
-
-
-void PrintVersionInfos();
-
-#if defined(_MSC_VER) && defined(_DEBUG)
-int MemAllocHook( int allocType, void *userData, size_t size, int blockType,
- long requestNumber, const unsigned char *filename, int lineNumber)
-{
-// if(requestNumber==585)_asm int 3;
- return 1;
-}
-#endif
-
-
-SQInteger quit(HSQUIRRELVM v)
-{
- int *done;
- sq_getuserpointer(v,-1,(SQUserPointer*)&done);
- *done=1;
- return 0;
-}
-
-void printfunc(HSQUIRRELVM v,const SQChar *s,...)
-{
- va_list vl;
- va_start(vl, s);
- vprintf( s, vl);
- va_end(vl);
-}
-
-void PrintVersionInfos()
-{
- fprintf(stdout,"%s %s (%d bits)\n",SQUIRREL_VERSION,SQUIRREL_COPYRIGHT,sizeof(SQInteger)*8);
- if(sizeof(SQFloat) != sizeof(float)) {
- fprintf(stdout,"[%d bits floats]\n",sizeof(SQFloat)*8);
- }
-}
-
-void PrintUsage()
-{
- fprintf(stderr,"usage: sq <options> <scriptpath [args]>.\n"
- "Available options are:\n"
- " -c compiles the file to bytecode(default output 'out.cnut')\n"
- " -o specifies output file for the -c option\n"
- " -c compiles only\n"
- " -d generates debug infos\n"
- " -v displays version infos\n"
- " -h prints help\n");
-}
-
-#define _INTERACTIVE 0
-#define _DONE 2
-//<<FIXME>> this func is a mess
-int getargs(HSQUIRRELVM v,int argc, char* argv[])
-{
- int i;
- int compiles_only = 0;
- static SQChar temp[500];
- const SQChar *ret=NULL;
- char * output = NULL;
- int lineinfo=0;
- if(argc>1)
- {
- int arg=1,exitloop=0;
- while(arg < argc && !exitloop)
- {
-
- if(argv[arg][0]=='-')
- {
- switch(argv[arg][1])
- {
- case 'd': //DEBUG(debug infos)
- sq_enabledebuginfo(v,1);
- break;
- case 'c':
- compiles_only = 1;
- break;
- case 'o':
- if(arg < argc) {
- arg++;
- output = argv[arg];
- }
- break;
- case 'v':
- PrintVersionInfos();
- return _DONE;
-
- case 'h':
- PrintVersionInfos();
- PrintUsage();
- return _DONE;
- default:
- PrintVersionInfos();
- printf("unknown prameter '-%c'\n",argv[arg][1]);
- PrintUsage();
- return _DONE;
- }
- }else break;
- arg++;
- }
-
- // src file
-
- if(arg<argc) {
- const SQChar *filename=NULL;
- filename=argv[arg];
-
- arg++;
- sq_pushroottable(v);
- sq_pushstring(v,"ARGS",-1);
- sq_newarray(v,0);
- for(i=arg;i<argc;i++)
- {
- const SQChar *a;
- a=argv[i];
- sq_pushstring(v,a,-1);
-
- sq_arrayappend(v,-2);
- }
- sq_createslot(v,-3);
- sq_pop(v,1);
- if(compiles_only) {
- if(SQ_SUCCEEDED(sqstd_loadfile(v,filename,SQTrue))){
- SQChar *outfile = "out.cnut";
- if(output) {
- outfile = output;
- }
- if(SQ_SUCCEEDED(sqstd_writeclosuretofile(v,outfile)))
- return _DONE;
- }
- }
- else {
- if(SQ_SUCCEEDED(sqstd_dofile(v,filename,SQFalse,SQTrue))) {
- return _DONE;
- }
- }
- //if this point is reached an error occured
- {
- const SQChar *err;
- sq_getlasterror(v);
- if(SQ_SUCCEEDED(sq_getstring(v,-1,&err))) {
- printf("Error [%s]\n",err);
- return _DONE;
- }
- }
-
- }
- }
-
- return _INTERACTIVE;
-}
-
-void Interactive(HSQUIRRELVM v)
-{
-
-#define MAXINPUT 1024
- SQChar buffer[MAXINPUT];
- SQInteger blocks =0;
- SQInteger string=0;
- SQInteger retval=0;
- SQInteger done=0;
- PrintVersionInfos();
-
- sq_pushroottable(v);
- sq_pushstring(v,"quit",-1);
- sq_pushuserpointer(v,&done);
- sq_newclosure(v,quit,1);
- sq_setparamscheck(v,1,NULL);
- sq_createslot(v,-3);
- sq_pop(v,1);
-
- while (!done)
- {
- SQInteger i = 0;
- printf("\nsq>");
- for(;;) {
- int c;
- if(done)return;
- c = getchar();
- if (c == '\n') {
- if (i>0 && buffer[i-1] == '\\')
- {
- buffer[i-1] = '\n';
- }
- else if(blocks==0)break;
- buffer[i++] = '\n';
- }
- else if (c=='}') {blocks--; buffer[i++] = (SQChar)c;}
- else if(c=='{' && !string){
- blocks++;
- buffer[i++] = (SQChar)c;
- }
- else if(c=='"' || c=='\''){
- string=!string;
- buffer[i++] = (SQChar)c;
- }
- else if (i >= MAXINPUT-1) {
- fprintf(stderr, "sq : input line too long\n");
- break;
- }
- else{
- buffer[i++] = (SQChar)c;
- }
- }
- buffer[i] = '\0';
-
- if(buffer[0]=='='){
- sprintf(sq_getscratchpad(v,MAXINPUT),"return (%s)",&buffer[1]);
- memcpy(buffer,sq_getscratchpad(v,-1),(strlen(sq_getscratchpad(v,-1))+1)*sizeof(SQChar));
- retval=1;
- }
- i=strlen(buffer);
- if(i>0){
- SQInteger oldtop=sq_gettop(v);
- if(SQ_SUCCEEDED(sq_compilebuffer(v,buffer,i,"interactive console",SQTrue))){
- sq_pushroottable(v);
- if(SQ_SUCCEEDED(sq_call(v,1,retval,SQTrue)) && retval){
- printf("\n");
- sq_pushroottable(v);
- sq_pushstring(v,"print",-1);
- sq_get(v,-2);
- sq_pushroottable(v);
- sq_push(v,-4);
- sq_call(v,2,SQFalse,SQTrue);
- retval=0;
- printf("\n");
- }
- }
-
- sq_settop(v,oldtop);
- }
- }
-}
-
-int main(int argc, char* argv[])
-{
- HSQUIRRELVM v;
-
- const SQChar *filename=NULL;
-#if defined(_MSC_VER) && defined(_DEBUG)
- _CrtSetAllocHook(MemAllocHook);
-#endif
-
- v=sq_open(1024);
- sq_setprintfunc(v,printfunc);
-
- sq_pushroottable(v);
-
- sqstd_register_bloblib(v);
- sqstd_register_iolib(v);
- sqstd_register_systemlib(v);
- sqstd_register_mathlib(v);
- sqstd_register_stringlib(v);
-
- //aux library
- //sets error handlers
- sqstd_seterrorhandlers(v);
-
- //gets arguments
- switch(getargs(v,argc,argv))
- {
- case _INTERACTIVE:
- Interactive(v);
- break;
- case _DONE:
- default:
- break;
- }
-
- sq_close(v);
-
-#if defined(_MSC_VER) && defined(_DEBUG)
- _getch();
- _CrtMemDumpAllObjectsSince( NULL );
-#endif
- return 0;
-}
-
diff --git a/src/3rdparty/squirrel/sq/sq.dsp b/src/3rdparty/squirrel/sq/sq.dsp
deleted file mode 100644
index 77887d064..000000000
--- a/src/3rdparty/squirrel/sq/sq.dsp
+++ /dev/null
@@ -1,101 +0,0 @@
-# Microsoft Developer Studio Project File - Name="sq" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=sq - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "sq.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "sq.mak" CFG="sq - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "sq - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "sq - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_LocalPath ".."
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "sq - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /I "..\sqstdlib" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x410 /d "NDEBUG"
-# ADD RSC /l 0x410 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 squirrel.lib sqstdlib.lib /nologo /subsystem:console /machine:I386 /out:"../bin/sq.exe" /libpath:"../lib"
-
-!ELSEIF "$(CFG)" == "sq - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\sqstdlib" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x410 /d "_DEBUG"
-# ADD RSC /l 0x410 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 squirrel.lib sqstdlib.lib /nologo /subsystem:console /debug /machine:I386 /out:"../bin/sq.exe" /pdbtype:sept /libpath:"../lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "sq - Win32 Release"
-# Name "sq - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\sq.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project