1 /**
2 Copyright 2018 Mark Fisher
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in 
6 the Software without restriction, including without limitation the rights to 
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
8 of the Software, and to permit persons to whom the Software is furnished to do 
9 so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in all 
12 copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
20 SOFTWARE.
21 **/
22 module dxx.util.script;
23 
24 //private import utils.misc : fileToArray;
25 //private import qscript.qscript;
26 
27 private import std.datetime;
28 private import std.stdio;
29 
30 private import dxx.util.config;
31 private import dxx.util.messages;
32 private import dxx.util.log;
33 
34 mixin __Text;
35 
36 class Script { // : QScript {
37     string scriptName;
38     
39 //protected:
40  //override bool onRuntimeError(RuntimeError error){
41 //        MsgLog.error(MsgText!(DXXConfig.messages.MSG_ERR_SCRIPT_RUNTIME)(scriptName,error.functionName,error.instructionIndex));
42 //        return true;
43  //}
44 //
45  //override bool onUndefinedFunctionCall(string fName){
46 //        MsgLog.error(MsgText!(DXXConfig.messages.MSG_ERR_SCRIPT_UNDEFINED_FUNCTION)(scriptName,fName));
47 //        return true;
48  //}
49 private:
50 	///// writeln function
51 	//QData writeln(QData[] args){
52 	//	std.stdio.writeln (args[0].strVal);
53 	//	return QData(0);
54 	//}
55 	///// write function
56 	//QData write(QData[] args){
57 	//	std.stdio.write (args[0].strVal);
58 	//	return QData(0);
59 	//}
60 	///// write int
61 	//QData writeInt(QData[] args){
62 	//	std.stdio.write(args[0].intVal);
63 	//	return QData(0);
64 	//}
65 	///// write double
66 	//QData writeDbl(QData[] args){
67 	//	std.stdio.write(args[0].doubleVal);
68 	//	return QData(0);
69 	//}
70 	///// readln function
71 	//QData readln(QData[] args){
72 	//	string s = std.stdio.readln;
73 	//	s.length--;
74 	//	return QData(s);
75 	//}
76 public:
77 	/// constructor
78 	this (string name){
79         this.scriptName = name;
80 		//this.addFunction(Function("writeln", DataType("void"), [DataType("string")]), &writeln);
81 		//this.addFunction(Function("write", DataType("void"), [DataType("string")]), &write);
82 		//this.addFunction(Function("writeInt", DataType("void"), [DataType("int")]), &writeInt);
83 		//this.addFunction(Function("writeDbl", DataType("void"), [DataType("double")]), &writeDbl);
84 		//this.addFunction(Function("readln", DataType("string"), []), &readln);
85 	}
86 };
87