Commit d57499ef authored by Donald Haase's avatar Donald Haase
Browse files

Initial commit of libdreamscript from NesterDCSE-src_2005-12-24.zip

parents
This diff is collapsed.
This diff is collapsed.
#ifndef _FILE_OBJECT_H_
#define _FILE_OBJECT_H_
#include "../kjs/value.h"
#include "../kjs/internal.h"
#include "../kjs/function_object.h"
#include "../kjs/port_kjs.h"
using namespace KJS;
class FileInstanceImp : public ObjectImp
{
public:
FileInstanceImp(ObjectImp* proto);
~FileInstanceImp();
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
// Start JS Functions
CString toString();
bool open(const char* fn, const char* mode);
void close();
bool seek(int offset, int origin);
bool tell(int& result);
bool eof();
bool readNumber(float& n);
bool writeNumber(float n);
bool readInt8(int8& n);
bool readInt16(int16& n);
bool readInt32(int32& n);
bool writeInt8(int8 n);
bool writeInt16(int16 n);
bool writeInt32(int32 n);
bool readUInt8(uint8& n);
bool readUInt16(uint16& n);
bool readUInt32(uint32& n);
bool writeUInt8(uint8 n);
bool writeUInt16(uint16 n);
bool writeUInt32(uint32 n);
bool readString(CString& result, uint32 size);
bool readAll(CString& result);
bool writeString(const char* str);
bool readChar(CString& result);
// End JS Functions
FILE* GetFILE() { return fp; }
private:
CString filename;
FILE* fp;
};
class FilePrototypeImp : public FileInstanceImp
{
public:
FilePrototypeImp(ExecState* exec, ObjectPrototypeImp* objectProto);
Value get(ExecState *exec, const Identifier &p) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
};
class FileProtoFuncImp : public InternalFunctionImp
{
public:
FileProtoFuncImp(ExecState* exec, int i, int len);
virtual bool implementsCall() const { return true; }
virtual Value call(ExecState* exec, Object& thisObj, const List& args);
enum { E_toString, E_open, E_close, E_seek, E_tell, E_eof, E_readNumber, E_writeNumber, E_readInt8, E_readInt16,
E_readInt32, E_writeInt8, E_writeInt16, E_writeInt32, E_readUInt8, E_readUInt16, E_readUInt32, E_writeUInt8,
E_writeUInt16, E_writeUInt32, E_readAll, E_readString, E_writeString, E_readChar };
private:
int id;
};
class FileObjectImp : public InternalFunctionImp
{
public:
FileObjectImp(ExecState* exec, FunctionPrototypeImp* funcProto, FilePrototypeImp* fileProto);
virtual bool implementsConstruct() const { return true; }
virtual Object construct(ExecState* exec, const List &args);
Object construct(const List &);
};
void InitFileClass(ExecState* exec, Object globobj);
extern Object g_FilePrototype;
extern Object g_File;
#endif
/* Automatically generated from file_object.cpp using ./create_hash_table. DO NOT EDIT ! */
const struct HashEntry fileProtoTableEntries[] = {
{ "readNumber", FileProtoFuncImp::E_readNumber, DontEnum|Function, 0, &fileProtoTableEntries[26] },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ "seek", FileProtoFuncImp::E_seek, DontEnum|Function, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ "writeInt8", FileProtoFuncImp::E_writeInt8, DontEnum|Function, 0, 0 },
{ "writeUInt8", FileProtoFuncImp::E_writeUInt8, DontEnum|Function, 0, 0 },
{ "close", FileProtoFuncImp::E_close, DontEnum|Function, 0, 0 },
{ "writeInt32", FileProtoFuncImp::E_writeInt32, DontEnum|Function, 0, &fileProtoTableEntries[28] },
{ "readInt8", FileProtoFuncImp::E_readInt8, DontEnum|Function, 0, &fileProtoTableEntries[25] },
{ "writeInt16", FileProtoFuncImp::E_writeInt16, DontEnum|Function, 0, &fileProtoTableEntries[22] },
{ "tell", FileProtoFuncImp::E_tell, DontEnum|Function, 0, &fileProtoTableEntries[24] },
{ "open", FileProtoFuncImp::E_open, DontEnum|Function, 0, &fileProtoTableEntries[21] },
{ "readUInt32", FileProtoFuncImp::E_readUInt32, DontEnum|Function, 0, 0 },
{ "readInt16", FileProtoFuncImp::E_readInt16, DontEnum|Function, 0, 0 },
{ "writeNumber", FileProtoFuncImp::E_writeNumber, DontEnum|Function, 0, &fileProtoTableEntries[23] },
{ "toString", FileProtoFuncImp::E_toString, DontEnum|Function, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ "eof", FileProtoFuncImp::E_eof, DontEnum|Function, 0, 0 },
{ "readInt32", FileProtoFuncImp::E_readInt32, DontEnum|Function, 0, &fileProtoTableEntries[27] },
{ "readUInt8", FileProtoFuncImp::E_readUInt8, DontEnum|Function, 0, 0 },
{ "readUInt16", FileProtoFuncImp::E_readUInt16, DontEnum|Function, 0, &fileProtoTableEntries[29] },
{ "writeUInt16", FileProtoFuncImp::E_writeUInt16, DontEnum|Function, 0, 0 },
{ "writeUInt32", FileProtoFuncImp::E_writeUInt32, DontEnum|Function, 0, 0 },
{ "readAll", FileProtoFuncImp::E_readAll, DontEnum|Function, 0, 0 },
{ "readString", FileProtoFuncImp::E_readString, DontEnum|Function, 0, 0 },
{ "writeString", FileProtoFuncImp::E_writeString, DontEnum|Function, 0, 0 },
{ "readChar", FileProtoFuncImp::E_readChar, DontEnum|Function, 0, 0 }
};
const struct HashTable fileProtoTable = { 2, 30, fileProtoTableEntries, 21 };
This diff is collapsed.
#ifndef _FILESYSTEM_OBJECT_H_
#define _FILESYSTEM_OBJECT_H_
#include "../kjs/value.h"
#include "../kjs/object.h"
#include "../kjs/types.h"
#include "../kjs/interpreter.h"
#include "punk_array.h"
using namespace KJS;
class FileSystemFunctionImp;
class FileSystemImp : public ObjectImp
{
public:
FileSystemImp();
enum { E_toString, E_resetCD, E_getCWD, E_setCWD, E_getFileList, E_getFile, E_copy, E_mkdir, E_remove };
virtual UString className() const { return "FileSystem"; }
virtual Value get(ExecState *exec, const Identifier &propertyName) const;
Value getValueProperty(ExecState *exec, int token) const;
static const ClassInfo info;
CString m_cwd;
private:
};
class FileSystemFunctionImp : public ObjectImp
{
public:
FileSystemFunctionImp(ExecState *exec, int i, int len);
virtual bool implementsCall() const { return true; }
virtual Value call(ExecState* exec, Object &thisObj, const List &args);
protected:
uint32 id;
};
void InitFileSystemObject(ExecState* exec, Object obj);
extern FileSystemImp* g_filesystemImp;
#endif
/* Automatically generated from filesystem_object.cpp using ./create_hash_table. DO NOT EDIT ! */
namespace KJS {
const struct HashEntry filesystemTableEntries[] = {
{ "getFileList", FileSystemImp::E_getFileList, DontDelete|ReadOnly|Function, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ "getCWD", FileSystemImp::E_getCWD, DontDelete|ReadOnly|Function, 0, &filesystemTableEntries[9] },
{ "toString", FileSystemImp::E_toString, DontDelete|ReadOnly|Function, 0, 0 },
{ "mkdir", FileSystemImp::E_mkdir, DontDelete|ReadOnly|Function, 1, 0 },
{ "setCWD", FileSystemImp::E_setCWD, DontDelete|ReadOnly|Function, 0, 0 },
{ "remove", FileSystemImp::E_remove, DontDelete|ReadOnly|Function, 1, 0 },
{ "resetCD", FileSystemImp::E_resetCD, DontDelete|ReadOnly|Function, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ "getFile", FileSystemImp::E_getFile, DontDelete|ReadOnly|Function, 0, &filesystemTableEntries[10] },
{ "copy", FileSystemImp::E_copy, DontDelete|ReadOnly|Function, 2, 0 }
};
const struct HashTable filesystemTable = { 2, 11, filesystemTableEntries, 9 };
} // namespace
This diff is collapsed.
This diff is collapsed.
/* Automatically generated from font_object.cpp using ./create_hash_table. DO NOT EDIT ! */
namespace KJS {
const struct HashEntry fontTableEntries[] = {
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ "load", FontInstanceImp::E_load, DontDelete|DontEnum|ReadOnly|Function, 1, &fontTableEntries[7] },
{ "toString", FontInstanceImp::E_toString, DontDelete|DontEnum|ReadOnly|Function, 0, &fontTableEntries[10] },
{ 0, 0, 0, 0, 0 },
{ "unload", FontInstanceImp::E_unload, DontDelete|DontEnum|ReadOnly|Function, 0, &fontTableEntries[8] },
{ "draw", FontInstanceImp::E_draw, DontDelete|DontEnum|ReadOnly|Function, 6, 0 },
{ "drawWithBorder", FontInstanceImp::E_drawWithBorder, DontDelete|DontEnum|ReadOnly|Function, 7, &fontTableEntries[9] },
{ "getWidth", FontInstanceImp::E_getWidth, DontDelete|DontEnum|ReadOnly|Function, 2, 0 },
{ "setBilinear", FontInstanceImp::E_setBilinear, DontDelete|DontEnum|ReadOnly|Function, 1, 0 }
};
const struct HashTable fontTable = { 2, 11, fontTableEntries, 7 };
} // namespace
This diff is collapsed.
#ifndef _GLOBAL_OBJECT_H_
#define _GLOBAL_OBJECT_H_
#include "../kjs/value.h"
#include "../kjs/object.h"
#include "../kjs/types.h"
#include "../kjs/interpreter.h"
using namespace KJS;
class GlobalFunctionImp;
class GlobalImp : public ObjectImp
{
public:
GlobalImp();
virtual UString className() const { return "Global"; }
static const ClassInfo info;
};
class GlobalFunctionImp : public ObjectImp
{
public:
GlobalFunctionImp(ExecState *exec, int i, int len);
enum { E_toString, E_print, E_println, E_include, E_includeOnce, E_packColor };
virtual bool implementsCall() const { return true; }
virtual Value call(ExecState* exec, Object &thisObj, const List &args);
protected:
uint32 id;
};
void InitGlobal(ExecState* exec, Object obj);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment