├── coco ├── Coco.exe ├── run.cmd └── Parser.frame ├── Concept ├── oos.ebnf └── ObjectBase.sqf ├── CompilerDlls ├── Compiler-0.6.0-ALPHA.dll ├── Compiler-0.6.1-ALPHA.dll ├── Compiler-0.6.2-ALPHA.dll ├── Compiler-0.7.0-ALPHA.dll ├── Compiler-0.7.1-ALPHA.dll ├── Compiler-0.7.2-ALPHA.dll ├── Compiler-0.7.3-ALPHA.dll ├── Compiler-0.7.4-ALPHA.dll └── Compiler-0.8.0-ALPHA.dll ├── stdLibrary └── std │ ├── ISerializable.oos │ ├── IO │ ├── IOException.oos │ ├── EndOfStreamException.oos │ └── Stream.oos │ ├── UI │ ├── Display.oos │ └── Control.oos │ ├── Side.oos │ ├── Vehicle.oos │ ├── config.oos │ ├── Group.oos │ ├── Tupel.oos │ ├── Man.oos │ ├── context.oos │ ├── base │ └── VehicleBase.oos │ └── Marker.oos ├── ObjectOrientedScripting ├── Wrapper │ ├── App.config │ ├── CompilerInterfaces │ │ └── ICompiler_1.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Wrapper.csproj │ └── Version.cs ├── WrapperUI │ ├── App.config │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── Program.cs │ ├── WrapperUI.csproj │ └── Form1.resx ├── Compiler │ ├── Resources │ │ └── InternalClasses │ │ │ ├── script.oos │ │ │ ├── Exception.oos │ │ │ ├── object.oos │ │ │ ├── functions.oos │ │ │ ├── string.oos │ │ │ ├── array.oos │ │ │ └── vec3.oos │ ├── OOS │ │ ├── LanguageObjects │ │ │ ├── Interfaces │ │ │ │ ├── iHasId.cs │ │ │ │ ├── iName.cs │ │ │ │ ├── iBreakable.cs │ │ │ │ ├── iGetIndex.cs │ │ │ │ ├── iHasType.cs │ │ │ │ ├── iTemplate.cs │ │ │ │ ├── iHasObject.cs │ │ │ │ ├── iOperatorFunction.cs │ │ │ │ ├── iCodeBlock.cs │ │ │ │ ├── iArgList.cs │ │ │ │ ├── iClass.cs │ │ │ │ └── iFunction.cs │ │ │ ├── break.cs │ │ │ ├── Base.cs │ │ │ ├── Value.cs │ │ │ ├── Namespace.cs │ │ │ ├── DotOperator.cs │ │ │ ├── Null.cs │ │ │ ├── Template.cs │ │ │ ├── Throw.cs │ │ │ ├── AssignContainer.cs │ │ │ ├── NewInstance.cs │ │ │ ├── HelperClasses │ │ │ │ ├── PrintCodeHelpers.cs │ │ │ │ └── ArgList.cs │ │ │ ├── oosInterface.cs │ │ │ ├── VirtualFunction.cs │ │ │ ├── NativeAssign.cs │ │ │ ├── Return.cs │ │ │ ├── InstanceOf.cs │ │ │ ├── Switch.cs │ │ │ ├── Deref.cs │ │ │ ├── While.cs │ │ │ ├── NativeOperator.cs │ │ │ ├── NativeFunction.cs │ │ │ ├── NewArray.cs │ │ │ ├── For.cs │ │ │ ├── ForEach.cs │ │ │ ├── VariableAssignment.cs │ │ │ ├── Cast.cs │ │ │ ├── IfElse.cs │ │ │ ├── NativeInstruction.cs │ │ │ ├── Case.cs │ │ │ ├── oosEnum.cs │ │ │ ├── Native.cs │ │ │ ├── TryCatch.cs │ │ │ └── ArrayAccess.cs │ │ └── enums.cs │ ├── SqfConfigObjects │ │ ├── iSqfConfigChildren.cs │ │ ├── iSqfConfig.cs │ │ ├── SqfConfigField.cs │ │ ├── SqfConfigClass.cs │ │ └── SqfConfigFile.cs │ ├── Compiler │ │ └── PostProcessFile.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Logger │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Logger.cs │ └── Logger.csproj ├── Project.cs └── ObjectOrientedScripting.sln ├── README.md ├── .gitattributes ├── TestProject ├── test.oosproj └── test.def ├── KnownIssues.txt └── .gitignore /coco/Coco.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X39/ObjectOrientedScripting/HEAD/coco/Coco.exe -------------------------------------------------------------------------------- /Concept/oos.ebnf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X39/ObjectOrientedScripting/HEAD/Concept/oos.ebnf -------------------------------------------------------------------------------- /coco/run.cmd: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | Coco.exe -o ..\ObjectOrientedScripting\Compiler\OOS\ -frames .\ ..\Concept\oos.ebnf 3 | pause -------------------------------------------------------------------------------- /CompilerDlls/Compiler-0.6.0-ALPHA.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X39/ObjectOrientedScripting/HEAD/CompilerDlls/Compiler-0.6.0-ALPHA.dll -------------------------------------------------------------------------------- /CompilerDlls/Compiler-0.6.1-ALPHA.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X39/ObjectOrientedScripting/HEAD/CompilerDlls/Compiler-0.6.1-ALPHA.dll -------------------------------------------------------------------------------- /CompilerDlls/Compiler-0.6.2-ALPHA.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X39/ObjectOrientedScripting/HEAD/CompilerDlls/Compiler-0.6.2-ALPHA.dll -------------------------------------------------------------------------------- /CompilerDlls/Compiler-0.7.0-ALPHA.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X39/ObjectOrientedScripting/HEAD/CompilerDlls/Compiler-0.7.0-ALPHA.dll -------------------------------------------------------------------------------- /CompilerDlls/Compiler-0.7.1-ALPHA.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X39/ObjectOrientedScripting/HEAD/CompilerDlls/Compiler-0.7.1-ALPHA.dll -------------------------------------------------------------------------------- /CompilerDlls/Compiler-0.7.2-ALPHA.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X39/ObjectOrientedScripting/HEAD/CompilerDlls/Compiler-0.7.2-ALPHA.dll -------------------------------------------------------------------------------- /CompilerDlls/Compiler-0.7.3-ALPHA.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X39/ObjectOrientedScripting/HEAD/CompilerDlls/Compiler-0.7.3-ALPHA.dll -------------------------------------------------------------------------------- /CompilerDlls/Compiler-0.7.4-ALPHA.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X39/ObjectOrientedScripting/HEAD/CompilerDlls/Compiler-0.7.4-ALPHA.dll -------------------------------------------------------------------------------- /CompilerDlls/Compiler-0.8.0-ALPHA.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X39/ObjectOrientedScripting/HEAD/CompilerDlls/Compiler-0.8.0-ALPHA.dll -------------------------------------------------------------------------------- /stdLibrary/std/ISerializable.oos: -------------------------------------------------------------------------------- 1 | namespace std 2 | { 3 | interface ISerializable 4 | { 5 | array GetObjectData(); 6 | void SetObjectData(array); 7 | } 8 | } -------------------------------------------------------------------------------- /ObjectOrientedScripting/Wrapper/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/WrapperUI/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ObjectOrientedScripting 2 | Object Oriented Scripting developed by the community for SQF (ArmA) 3 | 4 | 5 | Documentation is located here: 6 | https://github.com/X39/ObjectOrientedScripting/wiki 7 | 8 | feel free to enhance the documentation ... right now everything is a stub :3 9 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/WrapperUI/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/Resources/InternalClasses/script.oos: -------------------------------------------------------------------------------- 1 | native script 2 | { 3 | assign simple () 4 | scriptNull 5 | endAssign 6 | 7 | fnc simple bool done() 8 | scriptDone _this 9 | endFnc 10 | 11 | fnc simple void terminate() 12 | terminate _this 13 | endFnc 14 | } -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Interfaces/iHasId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.Interfaces 8 | { 9 | public interface iHasId 10 | { 11 | int ID {get;} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Interfaces/iName.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.Interfaces 8 | { 9 | public interface iName 10 | { 11 | Ident Name {get; set;} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Interfaces/iBreakable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.Interfaces 8 | { 9 | interface iBreakable 10 | { 11 | string BreakScope { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Interfaces/iGetIndex.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.Interfaces 8 | { 9 | public interface iGetIndex 10 | { 11 | int getIndex(Ident ident); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Interfaces/iHasType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.Interfaces 8 | { 9 | public interface iHasType 10 | { 11 | VarTypeObject ReferencedType {get;} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Interfaces/iTemplate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.Interfaces 8 | { 9 | public interface iTemplate 10 | { 11 | Template TemplateObject { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Interfaces/iHasObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.Interfaces 8 | { 9 | public interface iHasObject 10 | { 11 | pBaseLangObject ReferencedObject {get;} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/Resources/InternalClasses/Exception.oos: -------------------------------------------------------------------------------- 1 | //Changes in here have to be reflected in Compiler.cs __NEXCEPT 2 | 3 | class Exception 4 | { 5 | public string Message; 6 | 7 | public inline Exception() 8 | { 9 | this.Message = ""; 10 | } 11 | 12 | public inline Exception(string message) 13 | { 14 | this.Message = message; 15 | } 16 | } -------------------------------------------------------------------------------- /Concept/ObjectBase.sqf: -------------------------------------------------------------------------------- 1 | [ 2 | [//Class Register 3 | "ClassOrInterface1", 4 | "ClassOrInterface2", 5 | "ClassOrInterfaceN" 6 | ], 7 | [//Variable/Function names register 8 | "VarOrFunctionName1", 9 | "VarOrFunctionName2", 10 | "VarOrFunctionNameN" 11 | ], 12 | "VirtualFunctionOrVar1", 13 | "VirtualFunctionOrVar2", 14 | "VirtualFunctionOrVarN" 15 | ] -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/SqfConfigObjects/iSqfConfigChildren.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | 8 | namespace Compiler.SqfConfigObjects 9 | { 10 | public interface iSqfConfigChildren : iSqfConfig 11 | { 12 | List Children { get; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Interfaces/iOperatorFunction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.Interfaces 8 | { 9 | public interface iOperatorFunction : iFunction 10 | { 11 | OverridableOperator OperatorType { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Interfaces/iCodeBlock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.Interfaces 8 | { 9 | public interface iCodeBlock 10 | { 11 | List ReturnCommands { get; } 12 | bool AlwaysReturns { get; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /stdLibrary/std/IO/IOException.oos: -------------------------------------------------------------------------------- 1 | namespace std 2 | { 3 | namespace IO 4 | { 5 | class IOException extends Exception 6 | { 7 | public inline IOException() 8 | { 9 | base("IOException"); 10 | } 11 | 12 | public inline IOException(string message) 13 | { 14 | base(message); 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /stdLibrary/std/UI/Display.oos: -------------------------------------------------------------------------------- 1 | namespace std 2 | { 3 | namespace UI 4 | { 5 | native Display 6 | { 7 | assign (string className, string varName) 8 | uiNamespace setVariable [varName, findDisplay 46 createDisplay className]; 9 | varName 10 | endAssign 11 | 12 | fnc simple void close() 13 | _this closeDisplay 1 14 | endFnc 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/SqfConfigObjects/iSqfConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | 8 | namespace Compiler.SqfConfigObjects 9 | { 10 | public interface iSqfConfig 11 | { 12 | string Name { get; set; } 13 | void addChild(iSqfConfig obj); 14 | void write(StreamWriter writer, int tabCount = 0); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Wrapper/CompilerInterfaces/ICompiler_1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | 8 | namespace Wrapper 9 | { 10 | public interface ICompiler_1 11 | { 12 | Version getVersion(); 13 | void setFlags(string[] strArr); 14 | void CheckSyntax(string filepath); 15 | void Compile(Project proj); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Interfaces/iArgList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.Interfaces 8 | { 9 | public interface iArgList 10 | { 11 | /// 12 | /// Returns the Arglist required for this iFunction 13 | /// 14 | List ArgList { get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Interfaces/iClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.Interfaces 8 | { 9 | public interface iClass : iName 10 | { 11 | List ExtendedClasses { get; } 12 | VarTypeObject VTO { get; } 13 | iOperatorFunction getOperatorFunction(OverridableOperator op); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /TestProject/test.oosproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | testProjecttest 5 | X39 6 | .\test.oos 7 | .\output\ 8 | .\build\ 9 | 10 | 11 | 12 | //text FOO 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /stdLibrary/std/IO/EndOfStreamException.oos: -------------------------------------------------------------------------------- 1 | using ::std::IO::IOException; 2 | namespace std 3 | { 4 | namespace IO 5 | { 6 | class EndOfStreamException extends IOException 7 | { 8 | public inline EndOfStreamException() 9 | { 10 | base("EndOfStreamException"); 11 | } 12 | 13 | public inline EndOfStreamException(string message) 14 | { 15 | base(message); 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/Resources/InternalClasses/object.oos: -------------------------------------------------------------------------------- 1 | class object flags disableConstructor noObjectExtends virtualFunctionsOnly 2 | { 3 | public virtual string toString() 4 | { 5 | return SQF str(this) as string; 6 | } 7 | public virtual bool equals(object obj) 8 | { 9 | return SQF (this) isEqualTo (obj) as bool; 10 | } 11 | } 12 | native nobject flags disableConstructor noObjectExtends 13 | { 14 | fnc string toString() 15 | str _this 16 | endFnc 17 | fnc bool equals(nobject obj) 18 | _this isEqualTo ( obj ) 19 | endFnc 20 | } -------------------------------------------------------------------------------- /TestProject/test.def: -------------------------------------------------------------------------------- 1 | #define TESTB 2 | #define TEST5 3 | #define TEST6 //test6 4 | 5 | #ifdef TESTB 6 | //testb is defined 7 | #else 8 | //testb is not defined 9 | #endif 10 | 11 | #ifdef TEST2 12 | //test2 is defined 13 | #else 14 | //test2 is not defined 15 | #endif 16 | 17 | #ifdef TEST3 18 | #ifdef TEST4 19 | //test3 is defined & test4 is defined 20 | #else 21 | //test3 is defined & test4 is not defined 22 | #endif 23 | #else 24 | #ifdef TEST5 25 | //test3 is not defined & test5 is defined 26 | #else 27 | //test3 is not defined & test5 is not defined 28 | #endif 29 | #endif 30 | 31 | TEST6 -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/Resources/InternalClasses/functions.oos: -------------------------------------------------------------------------------- 1 | static fnc simple bool isServer () isServer endFnc 2 | static fnc simple bool isDedicated () isDedicated endFnc 3 | static fnc simple void sleep (scalar t) sleep ( t ) endFnc 4 | static fnc simple scalar random (scalar max) random ( max ) endFnc 5 | static fnc simple scalar mod (scalar i, scalar X) ( i ) mod ( X ) endFnc 6 | static fnc simple scalar floor (scalar i) floor ( i ) endFnc 7 | static fnc simple scalar time () time endFnc 8 | 9 | 10 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/WrapperUI/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace WrapperUI 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main(string[] args) 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1(args.Length > 0 ? args[0] : "")); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /stdLibrary/std/Side.oos: -------------------------------------------------------------------------------- 1 | using ::std::base::VehicleBase 2 | namespace std 3 | { 4 | native Side 5 | { 6 | assign simple () 7 | sideLogic 8 | endAssign 9 | fnc simple ::std::Side asEast() east endFnc 10 | fnc simple ::std::Side asWest() west endFnc 11 | fnc simple ::std::Side asResistance() resistance endFnc 12 | fnc simple ::std::Side asCivilian() resistance endFnc 13 | fnc simple ::std::Side asLogic() sideLogic endFnc 14 | fnc simple ::std::Side asEnemy() sideEnemy endFnc 15 | fnc simple ::std::Side asFriendly() sideFriendly endFnc 16 | fnc simple ::std::Side asUnknown() sideUnknown endFnc 17 | } 18 | } -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/break.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class Break : pBaseLangObject 10 | { 11 | public Break(pBaseLangObject parent) : base(parent) {} 12 | public override int doFinalize() { return 0; } 13 | 14 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 15 | { 16 | string tab = new string('\t', this.getAllParentsOf().Count); 17 | var breakable = this.getFirstOf(); 18 | sw.Write(tab + "breakOut \"" + breakable.BreakScope + "\""); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Base.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class Base : pBaseLangObject 10 | { 11 | public Base() : base(null) 12 | { 13 | 14 | } 15 | public override int finalize() 16 | { 17 | HelperClasses.NamespaceResolver.BaseClass = this; 18 | return base.finalize(); 19 | } 20 | public override int doFinalize() { return 0; } 21 | 22 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 23 | { 24 | foreach(var it in this.children) 25 | { 26 | it.writeOut(sw, cfg); 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Value.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class Value : pBaseLangObject 10 | { 11 | public VarTypeObject varType; 12 | public string value; 13 | public Value(pBaseLangObject parent) : base(parent) 14 | { 15 | varType = new VarTypeObject(VarType.Void); 16 | value = ""; 17 | } 18 | public override int doFinalize() { return 0; } 19 | public override string ToString() 20 | { 21 | return this.value; 22 | } 23 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 24 | { 25 | sw.Write(this.value); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /stdLibrary/std/Vehicle.oos: -------------------------------------------------------------------------------- 1 | using std::Config 2 | using std::Context 3 | using std::base::VehicleBase 4 | using std::Man 5 | 6 | namespace std 7 | { 8 | native Vehicle extends ::std::base::VehicleBase 9 | { 10 | assign simple (string name, scalar i, scalar j, scalar k) 11 | name createVehicle [i, j, k] 12 | endAssign 13 | 14 | assign simple (string name, vec3 pos) 15 | name createVehicle pos 16 | endAssign 17 | 18 | 19 | 20 | fnc void setFuel (scalar i) 21 | if(!local _this) exitWith 22 | { 23 | throw __NEXCEPT("VehicleNotLocalException"); 24 | }; 25 | _this setFuel ( i ); 26 | endFnc 27 | 28 | fnc simple scalar getFuel() 29 | fuel _this 30 | endFnc 31 | 32 | fnc simple bool inVehicle(::std::Man man) 33 | unit in _this 34 | endFnc 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Interfaces/iFunction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.Interfaces 8 | { 9 | public interface iFunction : iName, iArgList, iCodeBlock, iHasType 10 | { 11 | /// 12 | /// Return type of this iFunction 13 | /// 14 | VarTypeObject ReturnType { get; } 15 | /// 16 | /// Returns a Template object which then can deref some unknown class conflicts in 17 | /// ArgList field 18 | /// 19 | Template TemplateArguments { get; } 20 | /// 21 | /// Returns functions encapsulation 22 | /// 23 | Encapsulation FunctionEncapsulation { get; } 24 | bool IsAsync { get; } 25 | bool IsConstructor { get; } 26 | bool IsVirtual { get; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Namespace.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class Namespace : pBaseLangObject, Interfaces.iName 10 | { 11 | public Ident Name { get { return ((Ident)this.children[0]); } set { this.children[0] = value; } } 12 | public Namespace(pBaseLangObject parent) : base(parent) 13 | { 14 | this.children.Add(null); 15 | } 16 | public override int doFinalize() { return 0; } 17 | public override string ToString() 18 | { 19 | return "ns->" + this.Name.FullyQualifiedName; 20 | } 21 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 22 | { 23 | foreach (var it in this.children.GetRange(1, this.children.Count - 1)) 24 | { 25 | it.writeOut(sw, cfg); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/DotOperator.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Compiler.OOS_LanguageObjects 9 | { 10 | public class DotOperator : pBaseLangObject 11 | { 12 | 13 | public DotOperator(pBaseLangObject parent, int line, int pos, string file) : base(parent) 14 | { 15 | this.Line = line; 16 | this.Pos = pos; 17 | this.File = file; 18 | } 19 | 20 | public int Line { get; internal set; } 21 | public int Pos { get; internal set; } 22 | public string File { get; internal set; } 23 | public VarTypeObject ReferencedType { get; internal set; } 24 | 25 | public override int doFinalize() 26 | { 27 | return 0; 28 | } 29 | 30 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 31 | { 32 | throw new NotImplementedException(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/Compiler/PostProcessFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | using Wrapper; 8 | 9 | namespace Compiler 10 | { 11 | public class PostProcessFile 12 | { 13 | private MemoryStream fileStream; 14 | public MemoryStream FileStream { get { return this.fileStream; } } 15 | private string filePath; 16 | public string FilePath { get { return filePath; } } 17 | private string name; 18 | public string Name { get { return name; } } 19 | 20 | public PostProcessFile(string path, string name) 21 | { 22 | this.fileStream = new MemoryStream(); 23 | this.filePath = path; 24 | this.name = name; 25 | } 26 | public void resetPosition() 27 | { 28 | this.fileStream.Seek(0, SeekOrigin.Begin); 29 | } 30 | public override string ToString() 31 | { 32 | return filePath; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Null.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class Null : pBaseLangObject, Interfaces.iHasType 10 | { 11 | public int Line { get; internal set; } 12 | public int Pos { get; internal set; } 13 | public string File { get; internal set; } 14 | public VarTypeObject ReferencedType { get; internal set; } 15 | public Null(pBaseLangObject parent, int line, int pos, string file) : base(parent) 16 | { 17 | this.Line = line; 18 | this.Pos = pos; 19 | this.File = file; 20 | ReferencedType = new VarTypeObject(VarType.NullObject); 21 | } 22 | public override int doFinalize() 23 | { 24 | return 0; 25 | } 26 | 27 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 28 | { 29 | throw new Exception(); 30 | } 31 | 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /KnownIssues.txt: -------------------------------------------------------------------------------- 1 | - Passing an object of the same class which you are in right now will result in 2 | the object getting assigned an invalid type 3 | ((Internally it will ref to the function which is for sure nonsense ... 4 | however ... harder to fix then it might sounds in first place due to the 5 | lower logic behind it)) 6 | 7 | - (Not rly an issue but more of a note) currently only idents are allowed to be 8 | callen. Thus you cannot call from an expression 9 | following would be invalid: 10 | `(new foobar()).foo()` 11 | due to the fact that it is the following: 12 | `.` 13 | 14 | - Casts currently do not check if given object is kind of cast target thus you 15 | can enforce invalid object types 16 | 17 | - Downcasting has to be done explicit 18 | 19 | - casting to an object having a template requires you to write it like so (example shows array cast): 20 | < array >yourVariable 21 | 22 | - creating a new template object which gets another template object as kind requires you to write it like so (example shows array in another array): 23 | new array< array >() -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/SqfConfigObjects/SqfConfigField.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | 8 | namespace Compiler.SqfConfigObjects 9 | { 10 | class SqfConfigField : iSqfConfig 11 | { 12 | string name; 13 | bool isArray; 14 | public string Name { get { return this.name; } set { this.name = value; } } 15 | public string value; 16 | public SqfConfigField(string name, string value, bool isArray = false) 17 | { 18 | this.name = name; 19 | this.value = value; 20 | this.isArray = isArray; 21 | } 22 | public void addChild(iSqfConfig obj) 23 | { 24 | throw new Exception("Not Added Exception, if you ever experience this create a bug. SqfConfigField"); 25 | } 26 | public void write(StreamWriter writer, int tabCount = 0) 27 | { 28 | string tab = new string('\t', tabCount); 29 | writer.WriteLine(tab + name + (isArray ? "[] = " : " = ") + value + ";"); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/Resources/InternalClasses/string.oos: -------------------------------------------------------------------------------- 1 | native string 2 | { 3 | assign simple () 4 | "" 5 | endAssign 6 | 7 | assign simple (::string s) 8 | s 9 | endAssign 10 | 11 | fnc simple scalar length () 12 | count _this 13 | endFnc 14 | 15 | fnc simple string subString (scalar off, scalar len) 16 | _this select [off, len] 17 | endFnc 18 | 19 | fnc simple scalar indexOf (::string s) 20 | _this find ( s ) 21 | endFnc 22 | 23 | fnc simple bool contains (::string s) 24 | (_this find ( s ) ) >= 0 25 | endFnc 26 | 27 | fnc simple string toString () 28 | _this 29 | endFnc 30 | 31 | fnc simple array toArray() 32 | toArray _this 33 | endFnc 34 | 35 | fnc simple string append(::string s) 36 | _this + ( s ) 37 | endFnc 38 | 39 | fnc simple array split(::string delimiter) 40 | _this splitString ( delimiter ) 41 | endFnc 42 | 43 | fnc simple string toUpper() 44 | toUpper _this 45 | endFnc 46 | 47 | fnc simple string toLower() 48 | toLower _this 49 | endFnc 50 | } -------------------------------------------------------------------------------- /ObjectOrientedScripting/WrapperUI/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34209 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WrapperUI.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Template.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class Template : pBaseLangObject 10 | { 11 | public int Line { get; internal set; } 12 | public int Pos { get; internal set; } 13 | public string File { get; internal set; } 14 | public List vtoList; 15 | public Template(pBaseLangObject parent, int line, int pos, string file) : base(parent) 16 | { 17 | this.Line = line; 18 | this.Pos = pos; 19 | this.File = file; 20 | vtoList = new List(); 21 | } 22 | public override int doFinalize() 23 | { 24 | int errCount = 0; 25 | foreach(var it in this.vtoList) 26 | { 27 | if(it.ident != null) 28 | { 29 | errCount += it.ident.finalize(); 30 | } 31 | } 32 | return errCount; 33 | } 34 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) { } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/Resources/InternalClasses/array.oos: -------------------------------------------------------------------------------- 1 | native array 2 | { 3 | assign simple () 4 | [] 5 | endAssign 6 | 7 | fnc simple scalar pushBack (T _val) 8 | _this pushBack ( _val ) 9 | endFnc 10 | 11 | fnc simple scalar popBack () 12 | _this deleteAt ( (count _this) - 1) 13 | endFnc 14 | 15 | fnc simple scalar find (T _val) 16 | _this find ( _val ) 17 | endFnc 18 | 19 | fnc simple bool contains (T _val) 20 | _val in _this 21 | endFnc 22 | 23 | fnc simple void resize (scalar _i) 24 | _this resize ( _i ) 25 | endFnc 26 | 27 | fnc simple T deleteAt (scalar _i) 28 | _this deleteAt ( _i ) 29 | endFnc 30 | 31 | fnc simple ::array getRange(scalar index, scalar len) 32 | { 33 | _this select [index, len] 34 | } 35 | 36 | fnc simple void deleteRange (scalar index, scalar len) 37 | _this deleteRange [index, len] 38 | endFnc 39 | 40 | fnc simple scalar length () 41 | count _this 42 | endFnc 43 | 44 | fnc simple scalar append (::array arr) 45 | _this append ( arr ) 46 | endFnc 47 | 48 | operator simple T [] (scalar _i) 49 | _this select ( _i ) 50 | endOperator 51 | } -------------------------------------------------------------------------------- /stdLibrary/std/config.oos: -------------------------------------------------------------------------------- 1 | namespace std 2 | { 3 | native Config 4 | { 5 | assign simple() configFile endAssign 6 | 7 | fnc simple ::std::Config extend(string s) _this >> ( s ) endFnc 8 | 9 | fnc simple scalar count() count _this endFnc 10 | 11 | operator simple ::std::Config [] (scalar _i) _this select _i endOperator 12 | 13 | fnc simple bool isValid() (configName _this) == "" endFnc 14 | 15 | fnc string parent() 16 | private ["_var", "_index"]; 17 | _var = configHierarchy _this; 18 | _index = ((_var pushBack 1) - 1); 19 | if(_index < 0) exitWith {_this}; 20 | (_var select _index) 21 | endFnc 22 | 23 | fnc simple array<::std::Config> hierarchy() configHierarchy _this endFnc 24 | 25 | fnc simple bool isClass() isClass _this endFnc 26 | fnc simple bool isText() isText _this endFnc 27 | fnc simple bool isNumber() isNumber _this endFnc 28 | 29 | fnc simple scalar getNumber() getNumber _this endFnc 30 | fnc simple string getText() getText _this endFnc 31 | fnc simple string name() configName _this endFnc 32 | } 33 | } -------------------------------------------------------------------------------- /stdLibrary/std/Group.oos: -------------------------------------------------------------------------------- 1 | using ::std::base::VehicleBase 2 | using ::std::Side 3 | namespace std 4 | { 5 | native Group 6 | { 7 | assign simple (::std::Side side) 8 | createGroup side 9 | endAssign 10 | // fnc simple void setGroupIdGlobal () setGroupIdGlobal _this endFnc 11 | // fnc simple void setGroupId () setGroupId _this endFnc 12 | fnc simple string getGroupId () groupId _this endFnc 13 | fnc simple string getNetId () netId _this endFnc 14 | fnc void delete () 15 | if(!local _this) exitWith 16 | { 17 | throw __NEXCEPT("GroupNotLocalException"); 18 | }; 19 | deleteGroup _this; 20 | endFnc 21 | fnc simple array<::std::Man> getUnits () units _this endFnc 22 | fnc simple void join (array<::std::Man> u) u join _this endFnc 23 | fnc simple void joinSilent (array<::std::Man> u) u joinSilent _this endFnc 24 | fnc simple ::std::Man getLeader () leader _this endFnc 25 | } 26 | static fnc simple array<::std::Group> getAllGroups () allGroups endFnc 27 | } -------------------------------------------------------------------------------- /ObjectOrientedScripting/Logger/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Logger")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Logger")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e401b9ed-51d2-494c-97fe-cbcb8bec0516")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Compiler")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Compiler")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("5a4e36b9-a82f-49e4-9e63-77d79df00bb3")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/WrapperUI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("WrapperUI")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("WrapperUI")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c6cf4783-9a6f-482e-847f-ccffa6bc2d83")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Wrapper/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ObjectOrientedSQF")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ObjectOrientedSQF")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("9b3cf59c-7c90-4d8f-8972-cb46f1178f05")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Project.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | 5 | namespace ObjectOrientedSQF 6 | { 7 | public class Project 8 | { 9 | private string _projectTitle; 10 | public string ProjectTitle 11 | { 12 | set { this._projectTitle = value; } 13 | get { return this._projectTitle; } 14 | } 15 | private string _author; 16 | public string Author 17 | { 18 | set { this._author = value; } 19 | get { return this._author; } 20 | } 21 | private string _mainfile; 22 | public string Mainfile 23 | { 24 | set { this._mainfile = value; } 25 | get { return this._mainfile; } 26 | } 27 | private string _outputFolder; 28 | public string OutputFolder 29 | { 30 | set { this._outputFolder = value; } 31 | get { return this._outputFolder; } 32 | } 33 | 34 | private Project() 35 | { 36 | 37 | } 38 | static Project openProject(string file) 39 | { 40 | if (file == null) 41 | throw new ArgumentException("Provided parameter 'file' is null"); 42 | if (!File.Exists(file)) 43 | throw new ArgumentException("Provided parameter 'file' is refering a not existing file"); 44 | if(!file.EndsWith(".oos.proj")) 45 | throw new ArgumentException("Provided parameter 'file' is refering a to a non .oos.proj file"); 46 | 47 | Project proj = new Project(); 48 | 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Throw.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class Throw : pBaseLangObject 10 | { 11 | public Throw(pBaseLangObject parent) : base(parent) { } 12 | public override int doFinalize() 13 | { 14 | if (!((Expression)this.children[0]).ReferencedType.IsKindOf(Wrapper.Compiler.InternalObjectVarTypes.VT_Exception)) 15 | { 16 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0057, ((Expression)this.children[0]).Line, ((Expression)this.children[0]).Pos, ((Expression)this.children[0]).File)); 17 | return 1; 18 | } 19 | if (!this.getFirstOf().IsThrowing) 20 | { 21 | var fnc = this.getFirstOf(); 22 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0059, fnc.Name.Line, fnc.Name.Pos, fnc.Name.File)); 23 | return 1; 24 | } 25 | return 0; 26 | } 27 | 28 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 29 | { 30 | string tab = new string('\t', this.getAllParentsOf().Count); 31 | sw.Write(tab + "throw "); 32 | foreach(var it in this.children) 33 | { 34 | it.writeOut(sw, cfg); 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /stdLibrary/std/IO/Stream.oos: -------------------------------------------------------------------------------- 1 | using ::std::IO::EndOfStreamException; 2 | 3 | namespace std 4 | { 5 | namespace IO 6 | { 7 | class Stream 8 | { 9 | private array Buffer; 10 | 11 | public void Stream() 12 | { 13 | this.Buffer = new array(); 14 | } 15 | public scalar read() 16 | { 17 | if(this.Buffer.length() == 0) 18 | { 19 | return -1; 20 | } 21 | else 22 | { 23 | return this.Buffer.deleteAt(0); 24 | } 25 | } 26 | public array read(scalar i, scalar len) throwing 27 | { 28 | if(this.Buffer.length() <= i + len) 29 | { 30 | throw new EndOfStreamException("Index + Length is larger then the available number of elements in Stream"); 31 | } 32 | auto tmp = this.Buffer.getRange(i, len); 33 | this.Buffer.deleteRange(i, len); 34 | return tmp; 35 | } 36 | public void write(scalar i) 37 | { 38 | this.Buffer.pushBack(i); 39 | } 40 | public void write(array range) 41 | { 42 | this.Buffer.append(range); 43 | } 44 | public boolean hasNext() 45 | { 46 | return this.Buffer.length() > 0; 47 | } 48 | public boolean elementCount() 49 | { 50 | return this.Buffer.length(); 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/SqfConfigObjects/SqfConfigClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | 8 | namespace Compiler.SqfConfigObjects 9 | { 10 | class SqfConfigClass : iSqfConfigChildren 11 | { 12 | List children; 13 | string name; 14 | public List Children { get { return this.children; } } 15 | public string Name { get { return this.name; } set { this.name = value; } } 16 | public SqfConfigClass(string name) 17 | { 18 | this.children = new List(); 19 | this.name = name; 20 | } 21 | public void addChild(iSqfConfig obj) 22 | { 23 | if (obj is SqfConfigFile) 24 | throw new Exception("Not Added Exception, if you ever experience this create a bug. SqfConfigClass"); 25 | this.children.Add(obj); 26 | } 27 | public int countChildren() 28 | { 29 | int count = 0; 30 | foreach (var it in this.children) 31 | { 32 | if (it is SqfConfigClass) 33 | { 34 | count += ((SqfConfigClass)it).countChildren(); 35 | } 36 | else 37 | count++; 38 | } 39 | return count; 40 | } 41 | public void write(StreamWriter writer, int tabCount = 0) 42 | { 43 | if (this.countChildren() == 0) 44 | return; 45 | string tab = new string('\t', tabCount); 46 | writer.WriteLine(tab + "class " + name); 47 | writer.WriteLine(tab + "{"); 48 | foreach (iSqfConfig c in children) 49 | { 50 | c.write(writer, tabCount + 1); 51 | } 52 | writer.WriteLine(tab + "};"); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/Resources/InternalClasses/vec3.oos: -------------------------------------------------------------------------------- 1 | native vec3 2 | { 3 | assign simple () [0, 0, 0] endAssign 4 | assign simple (scalar x, scalar y, scalar z) [x, y, z] endAssign 5 | assign (array xyz) 6 | if(count xyz != 3) exitWith 7 | { 8 | throw __NEXCEPT("InvalidArgumentException"); 9 | }; 10 | xyz 11 | endAssign 12 | 13 | fnc simple scalar getX () _this select 0 endFnc 14 | fnc simple scalar getY () _this select 1 endFnc 15 | fnc simple scalar getZ () _this select 2 endFnc 16 | 17 | fnc simple void setX (scalar val) _this set [0, val] endFnc 18 | fnc simple void setY (scalar val) _this set [1, val] endFnc 19 | fnc simple void setZ (scalar val) _this set [2, val] endFnc 20 | 21 | fnc simple vec3 add(vec3 other) _this vectorAdd other endFnc 22 | fnc simple vec3 diff(vec3 other) _this vectorDiff other endFnc 23 | fnc simple vec3 dot(vec3 other) _this vectorDotProduct other endFnc 24 | fnc simple vec3 cross(vec3 other) _this vectorCrossProduct other endFnc 25 | fnc simple scalar cos(vec3 other) _this vectorCos other endFnc 26 | fnc simple scalar magnitude() vectorMagnitude _this endFnc 27 | fnc simple scalar magnitudeSqr() vectorMagnitudeSqr _this endFnc 28 | fnc simple vec3 multiply(scalar n) _this vectorMultiply n endFnc 29 | fnc simple scalar distance(vec3 other) _this vectorDistance other endFnc 30 | fnc simple scalar distanceSqr(vec3 other) _this vectorDistanceSqr other endFnc 31 | fnc simple vec3 normalized() vectorNormalized _this endFnc 32 | 33 | operator simple scalar [] (scalar index) _this select ( index ) endOperator 34 | } 35 | -------------------------------------------------------------------------------- /stdLibrary/std/Tupel.oos: -------------------------------------------------------------------------------- 1 | using ::std::base::VehicleBase 2 | namespace std 3 | { 4 | native Tupel2 5 | { 6 | assign simple (T1 item1, T2 item2) 7 | [item1, item2] 8 | endAssign 9 | 10 | fnc simple T1 getItem1 () 11 | _this select 0 12 | endFnc 13 | fnc simple T2 getItem2 () 14 | _this select 1 15 | endFnc 16 | } 17 | native Tupel3 18 | { 19 | assign simple (T1 item1, T2 item2, T3 item3) 20 | [item1, item2, item3] 21 | endAssign 22 | 23 | fnc simple T1 getItem1 () 24 | _this select 0 25 | endFnc 26 | fnc simple T2 getItem2 () 27 | _this select 1 28 | endFnc 29 | fnc simple T3 getItem3 () 30 | _this select 2 31 | endFnc 32 | } 33 | native Tupel4 34 | { 35 | assign simple (T1 item1, T2 item2, T3 item3, T4 item4) 36 | [item1, item2, item3, item4] 37 | endAssign 38 | 39 | fnc simple T1 getItem1 () 40 | _this select 0 41 | endFnc 42 | fnc simple T2 getItem2 () 43 | _this select 1 44 | endFnc 45 | fnc simple T3 getItem3 () 46 | _this select 2 47 | endFnc 48 | fnc simple T4 getItem4 () 49 | _this select 3 50 | endFnc 51 | } 52 | native Tupel5 53 | { 54 | assign simple (T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) 55 | [item1, item2, item3, item4, item5] 56 | endAssign 57 | 58 | fnc simple T1 getItem1 () 59 | _this select 0 60 | endFnc 61 | fnc simple T2 getItem2 () 62 | _this select 1 63 | endFnc 64 | fnc simple T3 getItem3 () 65 | _this select 2 66 | endFnc 67 | fnc simple T4 getItem4 () 68 | _this select 3 69 | endFnc 70 | fnc simple T5 getItem5 () 71 | _this select 4 72 | endFnc 73 | } 74 | } -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/AssignContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class AssignContainer : pBaseLangObject, Interfaces.iName, Interfaces.iHasType 10 | { 11 | 12 | public Ident Name { get { return ((Ident)this.children[0]); } set { this.children[0] = value; } } 13 | public VariableAssignment assign { get { return ((VariableAssignment)this.children[1]); } set { this.children[1] = value; } } 14 | public string FullyQualifiedName { get { return ((Ident)this.children[0]).FullyQualifiedName; } } 15 | public VarTypeObject ReferencedType { get { return ((Ident)this.children[0]).ReferencedType; } } 16 | public pBaseLangObject ReferencedObject { get { return ((Ident)this.children[0]).ReferencedObject; } } 17 | public AssignContainer(pBaseLangObject parent) : base(parent) 18 | { 19 | this.addChild(null); 20 | this.addChild(null); 21 | } 22 | public override int doFinalize() { return 0; } 23 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 24 | { 25 | string tab = new string('\t', this.getAllParentsOf().Count); 26 | sw.Write(tab); 27 | if (((Variable)this.Name.LastIdent.ReferencedObject).encapsulation == Encapsulation.NA || ((Variable)this.Name.LastIdent.ReferencedObject).encapsulation == Encapsulation.Static) 28 | { 29 | this.Name.writeOut(sw, cfg); 30 | sw.Write(" = "); 31 | this.assign.writeOut(sw, cfg); 32 | } 33 | else 34 | { 35 | this.Name.writeOut(sw, cfg); 36 | sw.Write(" set [" + ((Variable)this.Name.LastIdent.ReferencedObject).SqfVariableName + ", "); 37 | this.assign.writeOut(sw, cfg); 38 | sw.Write("]"); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Logger/Logger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | 8 | public class Logger 9 | { 10 | public enum LogLevel 11 | { 12 | DEBUG = 0, 13 | VERBOSE, 14 | INFO, 15 | WARNING, 16 | ERROR, 17 | CONTINUE 18 | } 19 | private static readonly string[] logLevelTranslated = { 20 | "[DEBUG] ", 21 | "[VERBOSE]", 22 | "[INFO] ", 23 | "[WARNING]", 24 | "[ERROR] ", 25 | " " 26 | }; 27 | private static Logger _instance; 28 | public static Logger Instance { get { if (_instance == null) _instance = new Logger(); return _instance; } } 29 | private StreamWriter fstream; 30 | 31 | private LogLevel lastLogLevel; 32 | private LogLevel minLogLevel; 33 | public LogLevel LoggingLevel { get { return minLogLevel; } set { minLogLevel = value; } } 34 | public Logger() 35 | { 36 | String filePath = DateTime.Now.ToString("dd-MM-yyyy_HH-mm-ss") + ".log"; 37 | lastLogLevel = LogLevel.CONTINUE; 38 | minLogLevel = LogLevel.INFO; 39 | } 40 | ~Logger() 41 | { 42 | this.close(); 43 | } 44 | public void setLogFile(string path) 45 | { 46 | if (this.fstream != null) 47 | this.close(); 48 | try 49 | { 50 | this.fstream = new StreamWriter(new FileStream(path == "" ? DateTime.Now.ToString("dd-MM-yyyy_HH-mm-ss") + ".log" : path, FileMode.CreateNew)); 51 | } 52 | catch (Exception ex) 53 | { 54 | Console.WriteLine("Could not initiate the logger: " + ex.Message); 55 | this.fstream = null; 56 | } 57 | } 58 | public void log(LogLevel l, string msg) 59 | { 60 | if (l != LogLevel.CONTINUE) 61 | lastLogLevel = l; 62 | if (lastLogLevel < minLogLevel) 63 | return; 64 | String line = logLevelTranslated[(int)l] + "\t" + msg; 65 | Console.WriteLine(line); 66 | if (this.fstream != null) 67 | fstream.WriteLine(line); 68 | } 69 | public void close() 70 | { 71 | if (this.fstream == null) 72 | return; 73 | this.fstream.Close(); 74 | this.fstream = null; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/NewInstance.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class NewInstance : pBaseLangObject, Interfaces.iName, Interfaces.iHasType, Interfaces.iHasObject, Interfaces.iTemplate 10 | { 11 | 12 | public Ident Name { get { return ((Ident)this.children[0]); } set { this.children[0] = value; } } 13 | public string FullyQualifiedName { get { return ((Ident)this.children[0]).LastIdent.FullyQualifiedName; } } 14 | public VarTypeObject ReferencedType { get; internal set; } 15 | public pBaseLangObject ReferencedObject { get { return ((Ident)this.children[0]).LastIdent.ReferencedObject; } } 16 | public Template TemplateObject { get; set; } 17 | public NewInstance(pBaseLangObject parent) : base(parent) 18 | { 19 | this.addChild(null); 20 | } 21 | 22 | public override int finalize() 23 | { 24 | if (this.IsFinalized) 25 | return 0; 26 | int errCount = 0; 27 | foreach (pBaseLangObject blo in children) 28 | if (blo != null) 29 | errCount += blo.finalize(); 30 | if (this is Interfaces.iTemplate && ((Interfaces.iTemplate)this).TemplateObject != null) 31 | errCount += ((Interfaces.iTemplate)this).TemplateObject.finalize(); 32 | errCount += this.doFinalize(); 33 | if (this is Interfaces.iHasType && ((Interfaces.iHasType)this).ReferencedType.IsObject) 34 | errCount += ((Interfaces.iHasType)this).ReferencedType.ident.finalize(); 35 | this.IsFinalized = true; 36 | return errCount; 37 | } 38 | public override int doFinalize() 39 | { 40 | ReferencedType = new VarTypeObject(((Ident)this.children[0]).LastIdent.ReferencedType); 41 | if(this.TemplateObject != null) 42 | { 43 | this.ReferencedType.TemplateObject = this.TemplateObject; 44 | } 45 | return 0; 46 | } 47 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 48 | { 49 | foreach (var it in this.children) 50 | { 51 | it.writeOut(sw, cfg); 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /stdLibrary/std/UI/Control.oos: -------------------------------------------------------------------------------- 1 | namespace std 2 | { 3 | namespace UI 4 | { 5 | native Control 6 | { 7 | assign (::std::UI::Display d, scalar idc, string className) 8 | (uiNamespace getVariable ( d )) ctrlCreate [className, idc]; 9 | [d, idc] 10 | endAssign 11 | 12 | fnc simple string className() 13 | ctrlClassName ((uiNamespace getVariable (_this select 0)) displayControl (_this select 1)) 14 | endFnc 15 | 16 | fnc simple string className() 17 | ctrlClassName ((uiNamespace getVariable (_this select 0)) displayControl (_this select 1)) 18 | endFnc 19 | 20 | fnc simple bool isCommited() 21 | ctrlCommitted ((uiNamespace getVariable (_this select 0)) displayControl (_this select 1)) 22 | endFnc 23 | 24 | fnc simple bool getEnabled() 25 | ctrlEnabled ((uiNamespace getVariable (_this select 0)) displayControl (_this select 1)) 26 | endFnc 27 | 28 | fnc simple array getPosition() 29 | ctrlPosition ((uiNamespace getVariable (_this select 0)) displayControl (_this select 1)) 30 | endFnc 31 | 32 | fnc simple void setEnabled(bool flag) 33 | ((uiNamespace getVariable (_this select 0)) displayControl (_this select 1)) ctrlEnable ( flag ) 34 | endFnc 35 | 36 | fnc simple void setPosition(scalar x, scalar y) 37 | ((uiNamespace getVariable (_this select 0)) displayControl (_this select 1)) ctrlSetPosition [x, y] 38 | endFnc 39 | 40 | fnc simple void setPosition(scalar x, scalar y, scalar w, scalar h) 41 | ((uiNamespace getVariable (_this select 0)) displayControl (_this select 1)) ctrlSetPosition [x, y, w, h] 42 | endFnc 43 | 44 | 45 | fnc simple void commit(scalar time) 46 | ((uiNamespace getVariable (_this select 0)) displayControl (_this select 1)) ctrlCommit ( time ) 47 | endFnc 48 | 49 | fnc simple void delete() 50 | ctrlDelete ((uiNamespace getVariable (_this select 0)) displayControl (_this select 1)) 51 | endFnc 52 | 53 | fnc simple void delete() 54 | ctrlDelete ((uiNamespace getVariable (_this select 0)) displayControl (_this select 1)) 55 | endFnc 56 | 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/HelperClasses/PrintCodeHelpers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.HelperClasses 8 | { 9 | class PrintCodeHelpers 10 | { 11 | public static void printCodeLines(List instructions, string tab, System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 12 | { 13 | foreach (var it in instructions) 14 | { 15 | if (it is Ident) 16 | sw.Write(tab + '\t'); 17 | if (it is Variable && ((Variable)it).getAllChildrenOf().Count == 0) 18 | continue; 19 | it.writeOut(sw, cfg); 20 | sw.WriteLine(";"); 21 | } 22 | } 23 | public static void printPrivateArray(pBaseLangObject obj, string tab, System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg, int scopeIndex = -1) 24 | { 25 | var varList = obj.getAllChildrenOf(false, null, -1, scopeIndex); 26 | var forLoopList = obj.getAllChildrenOf(false, null, -1, scopeIndex); 27 | foreach(var it in forLoopList) 28 | { 29 | if(it.forArg1 != null && it.forArg1 is Variable) 30 | { 31 | varList.Add((Variable)it.forArg1); 32 | } 33 | } 34 | if (varList.Count > 0) 35 | { 36 | if (varList.Count == 1) 37 | sw.Write(tab + '\t' + "private "); 38 | else 39 | sw.Write(tab + '\t' + "private ["); 40 | 41 | for (int i = 0; i < varList.Count; i++) 42 | { 43 | var it = varList[i]; 44 | if (i != 0) 45 | { 46 | sw.Write(", "); 47 | } 48 | if (it is Variable) 49 | { 50 | sw.Write('"' + ((Variable)it).SqfVariableName + '"'); 51 | } 52 | else 53 | { 54 | throw new Exception(); 55 | } 56 | } 57 | if (varList.Count > 1) 58 | sw.Write("]"); 59 | sw.WriteLine(";"); 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/oosInterface.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class oosInterface : pBaseLangObject, Interfaces.iName, Interfaces.iClass, Interfaces.iHasId, Interfaces.iGetIndex 10 | { 11 | //Is set in Compiler.cs before finalize is callen 12 | public static Variable GlobalInterfaceRegisterVariable; 13 | 14 | 15 | public Ident Name { get { return ((Ident)this.children[0]); } set { this.children[0] = value; } } 16 | public List ExtendedClasses { get { return new List(); } } 17 | public VarTypeObject VTO { get; set; } 18 | public int ID { get; set; } 19 | 20 | public oosInterface(pBaseLangObject parent) : base(parent) 21 | { 22 | this.children.Add(null); 23 | } 24 | public override int doFinalize() { return 0; } 25 | public override string ToString() 26 | { 27 | return "interface->" + this.Name.FullyQualifiedName; 28 | } 29 | public Interfaces.iOperatorFunction getOperatorFunction(OverridableOperator op) 30 | { 31 | return null; 32 | } 33 | 34 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) { } 35 | 36 | public int getIndex(Ident ident) 37 | { 38 | int index = 0; 39 | var refObj = ident.ReferencedObject; 40 | if (refObj is VirtualFunction) 41 | { 42 | var obj = (Interfaces.iName)refObj; 43 | for (int i = 0; i < this.children.Count; i++) 44 | { 45 | var it = this.children[i]; 46 | if (it is Interfaces.iName && ((Interfaces.iName)it).Name.OriginalValue == obj.Name.OriginalValue) 47 | { 48 | if (it is VirtualFunction && obj is VirtualFunction && HelperClasses.ArgList.matchesArglist(((VirtualFunction)it).ArgList, ((VirtualFunction)obj).ArgList)) 49 | { 50 | return index; 51 | } 52 | } 53 | if (it is VirtualFunction && ((VirtualFunction)it).IsVirtual) 54 | index++; 55 | } 56 | } 57 | throw new Exception(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Logger/Logger.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {AB1BED91-BEDF-485C-B697-2D0DB1DC7D47} 8 | Library 9 | Properties 10 | Logger 11 | Logger 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 53 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/VirtualFunction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class VirtualFunction : pBaseLangObject, Interfaces.iName, Interfaces.iFunction 10 | { 11 | public Ident Name { get { return ((Ident)this.children[0]); } set { this.children[0] = value; } } 12 | public VarTypeObject varType; 13 | public List argTypes; 14 | 15 | /// 16 | /// Return type of this iFunction 17 | /// 18 | public VarTypeObject ReturnType { get { return this.varType; } } 19 | public VarTypeObject ReferencedType { get { return this.ReturnType; } } 20 | /// 21 | /// Returns a Template object which then can deref some unknown class conflicts in 22 | /// ArgList field 23 | /// 24 | public Template TemplateArguments { get { return null; } } 25 | /// 26 | /// Returns functions encapsulation 27 | /// 28 | public Encapsulation FunctionEncapsulation { get { return Encapsulation.Public; } } 29 | /// 30 | /// Returns the Arglist required for this iFunction 31 | /// 32 | public List ArgList { get { return this.argTypes; } } 33 | public bool IsConstructor { get { return false; } } 34 | public bool IsAsync { get; set; } 35 | public VirtualFunction(pBaseLangObject parent) : base(parent) 36 | { 37 | argTypes = new List(); 38 | this.children.Add(null); 39 | varType = null; 40 | } 41 | public override int doFinalize() { return 0; } 42 | public override string ToString() 43 | { 44 | return "vFnc->" + this.Name.FullyQualifiedName; 45 | } 46 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) { } 47 | public List ReturnCommands { get { return new List(); } } 48 | public bool AlwaysReturns { get { return true; } } 49 | 50 | 51 | public bool IsVirtual { get { return true; } } 52 | 53 | 54 | public string SqfVariableName 55 | { 56 | get 57 | { 58 | var casted = (Interfaces.iGetIndex)this.Parent; 59 | return "{0} select ({1} select 0) select " + (casted.getIndex(this.Name)); 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/NativeAssign.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class NativeAssign : NativeInstruction, Interfaces.iFunction 10 | { 11 | private Ident name; 12 | public Ident Name { get { return name; } set { name = value; } } 13 | public bool IsConstructor { get { return true; } } 14 | public NativeAssign(pBaseLangObject parent, int line, int pos, string file) : base(parent, line, pos, file) 15 | { 16 | if (parent is Native) 17 | { 18 | this.name = ((Native)parent).Name; 19 | this.VTO = new VarTypeObject(this.name); 20 | } 21 | else 22 | { 23 | throw new Exception("Never NEVER ever this should happen! If it does, report to dev."); 24 | } 25 | } 26 | public bool IsVirtual { get { return false; } } 27 | public override int doFinalize() 28 | { 29 | int errCount = 0; 30 | if (VTO.ident != null) 31 | errCount += VTO.ident.finalize(); 32 | return errCount; 33 | } 34 | 35 | public VarTypeObject ReturnType { get { return this.VTO; } } 36 | public Template TemplateArguments { get { return this.getFirstOf().TemplateObject; } } 37 | public Encapsulation FunctionEncapsulation { get { return Encapsulation.Public; } } 38 | public bool IsAsync { get { return false; } } 39 | public List ArgList 40 | { 41 | get 42 | { 43 | List retList = new List(); 44 | foreach (var it in this.children) 45 | { 46 | if (it is Variable) 47 | { 48 | retList.Add(((Variable)it).varType); 49 | } 50 | else if (it is Ident) 51 | { 52 | //Do nothing as we got the Name here 53 | } 54 | else 55 | { 56 | throw new Exception(); 57 | } 58 | } 59 | return retList; 60 | } 61 | } 62 | 63 | public List ReturnCommands { get { return new List(); } } 64 | public bool AlwaysReturns { get { return true; } } 65 | public VarTypeObject ReferencedType { get { return this.ReturnType; } } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Return.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class Return : pBaseLangObject 10 | { 11 | public int Line { get; internal set; } 12 | public int Pos { get; internal set; } 13 | public string File { get; internal set; } 14 | public Return(pBaseLangObject parent, int line, int pos, string file) : base(parent) 15 | { 16 | this.Line = line; 17 | this.Pos = pos; 18 | this.File = file; 19 | } 20 | public override int doFinalize() 21 | { 22 | int errCount = 0; 23 | var fnc = this.getFirstOf(); 24 | if(this.children.Count > 0) 25 | { 26 | var returnExpression = (Expression)this.children[0]; 27 | if (fnc.IsAsync) 28 | { 29 | if (!returnExpression.ReferencedType.Equals(new VarTypeObject(VarType.Void))) 30 | { 31 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0022, this.Line, this.Pos, this.File)); 32 | errCount++; 33 | } 34 | } 35 | else 36 | { 37 | if (!returnExpression.ReferencedType.Equals(fnc.varType)) 38 | { 39 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0022, this.Line, this.Pos, this.File)); 40 | errCount++; 41 | } 42 | } 43 | } 44 | else if(fnc.varType.varType != VarType.Void) 45 | { 46 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0023, this.Line, this.Pos, this.File)); 47 | errCount++; 48 | } 49 | return errCount; 50 | } 51 | 52 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 53 | { 54 | string tab = new string('\t', this.getAllParentsOf().Count); 55 | sw.Write(tab); 56 | foreach (var it in this.children) 57 | { 58 | it.writeOut(sw, cfg); 59 | } 60 | sw.Write(" breakOut \"" + Wrapper.Compiler.ScopeNames.function + "\""); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/HelperClasses/ArgList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects.HelperClasses 8 | { 9 | public class ArgList 10 | { 11 | public static bool matchesArglist(List lArgs, List rArgs, Variable lVar = null) 12 | { 13 | if (lArgs.Count != rArgs.Count) 14 | return false; 15 | bool flag = true; 16 | if (lVar == null || lVar.TemplateObject == null) 17 | { 18 | for (int i = 0; i < lArgs.Count; i++) 19 | { 20 | var lIt = lArgs[i]; 21 | var rIt = rArgs[i]; 22 | if (lIt.IsObject && lIt.ident.ReferencedObject is oosEnum) 23 | { 24 | lIt = ((oosEnum)lIt.ident.ReferencedObject).ReferencedType; 25 | } 26 | if (!lIt.Equals(rIt)) 27 | { 28 | flag = false; 29 | break; 30 | } 31 | } 32 | } 33 | else 34 | { 35 | Template toResolved = lVar.TemplateObject; 36 | Template toAnonymous = ((Interfaces.iTemplate)lVar.varType.ident.LastIdent.ReferencedObject).TemplateObject; 37 | if (toResolved.vtoList.Count != toAnonymous.vtoList.Count) 38 | throw new Exception(); 39 | for (int i = 0; i < lArgs.Count; i++) 40 | { 41 | var lIt = resolveVarTypeObject(lArgs[i], toAnonymous, toResolved); 42 | var rIt = rArgs[i]; 43 | 44 | if (!lIt.Equals(rIt)) 45 | { 46 | flag = false; 47 | break; 48 | } 49 | } 50 | } 51 | return flag; 52 | } 53 | public static VarTypeObject resolveVarTypeObject(VarTypeObject objToDeref, Template anonymous, Template resolved) 54 | { 55 | if (anonymous == null || resolved == null) 56 | return objToDeref; 57 | if (resolved.vtoList.Count != anonymous.vtoList.Count) 58 | throw new Exception(); 59 | for (int i = 0; i < anonymous.vtoList.Count; i++) 60 | { 61 | if (objToDeref.Equals(anonymous.vtoList[i])) 62 | return resolved.vtoList[i]; 63 | } 64 | return objToDeref; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /stdLibrary/std/Man.oos: -------------------------------------------------------------------------------- 1 | using std::Config 2 | using std::Context 3 | using std::base::VehicleBase 4 | using std::Group 5 | 6 | namespace std 7 | { 8 | native Man extends ::std::base::VehicleBase 9 | { 10 | enum AiSection 11 | { 12 | Target = "TARGET", 13 | Autotarget = "AUTOTARGET", 14 | Move = "MOVE", 15 | Anim = "ANIM", 16 | Teamswitch = "TEAMSWITCH", 17 | FSM = "FSM", 18 | Aimingerror = "AIMINGERROR", 19 | Suppression = "SUPPRESSION", 20 | Checkvisible = "CHECKVISIBLE", 21 | Cover = "COVER", 22 | Autocombat = "AUTOCOMBAT" 23 | } 24 | 25 | enum Rank 26 | { 27 | Private = "PRIVATE", 28 | Corporal = "CORPORAL", 29 | Sergeant = "SERGEANT", 30 | Lieutenant = "LIEUTENANT", 31 | Captain = "CAPTAIN", 32 | Major = "MAJOR", 33 | Colonel = "COLONEL" 34 | } 35 | 36 | enum VisionMode 37 | { 38 | DayTime = 0, 39 | NightVision = 1, 40 | FLIR = 2 41 | } 42 | 43 | assign simple (::std::Group group, string type, scalar i, scalar j, scalar k) 44 | ( group ) createUnit [type, [i, j, k], [], 0, "FORM"] 45 | endAssign 46 | 47 | assign (::std::Group group, string type, scalar i, scalar j, scalar k, scalar skill, Rank rank) 48 | private "_unit"; 49 | _unit = ( group ) createUnit [type, [i, j, k], [], 0, "FORM"]; 50 | _unit setRank rank; 51 | _unit setSkill skill; 52 | _unit 53 | endAssign 54 | 55 | assign simple (::std::Group group, string type, vec3 position) 56 | ( group ) createUnit [type, position, [], 0, "FORM"] 57 | endAssign 58 | 59 | assign (::std::Group group, string type, vec3 position, scalar skill, Rank rank) 60 | private "_unit"; 61 | _unit = ( group ) createUnit [type, position, [], 0, "FORM"]; 62 | _unit setRank rank; 63 | _unit setSkill skill; 64 | _unit 65 | endAssign 66 | 67 | fnc void disableAI(AiSection section) 68 | if(!local _this) exitWith 69 | { 70 | 71 | __NEXCEPT("UnitNotLocalException"); 72 | }; 73 | _this disableAI ( section ) 74 | endFnc 75 | 76 | fnc void enableAI(AiSection section) 77 | if(!local _this) exitWith 78 | { 79 | throw __NEXCEPT("UnitNotLocalException"); 80 | }; 81 | _this enableAI ( section ) 82 | endFnc 83 | 84 | fnc simple VisionMode getVisionMode() currentVisionMode _this endFnc 85 | } 86 | static fnc simple ::std::Man getPlayer() player endFnc 87 | } 88 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/InstanceOf.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class InstanceOf : pBaseLangObject, Interfaces.iHasType 10 | { 11 | public pBaseLangObject LIdent { get { return (pBaseLangObject)this.children[0]; } set { this.children[0] = value; } } 12 | public Ident RIdent { get { return (Ident)this.children[1]; } set { this.children[1] = value; } } 13 | public InstanceOf(pBaseLangObject parent) : base(parent) 14 | { 15 | this.addChild(null); 16 | this.addChild(null); 17 | } 18 | public VarTypeObject ReferencedType { get { return new VarTypeObject(VarType.Bool); } } 19 | public override int doFinalize() 20 | { 21 | int errCount = 0; 22 | if(LIdent is Cast) 23 | { 24 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0030, ((Ident)((Cast)LIdent).children[0]).Line, ((Ident)((Cast)LIdent).children[0]).Pos)); 25 | errCount++; 26 | } 27 | else if (LIdent is Ident) 28 | { 29 | var varType = ((Ident)LIdent).LastIdent.ReferencedType; 30 | if (!varType.IsObject) 31 | { 32 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0028, ((Ident)LIdent).Line, ((Ident)LIdent).Pos)); 33 | errCount++; 34 | } 35 | } 36 | else 37 | { 38 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.UNKNOWN, RIdent.Line, RIdent.Pos)); 39 | errCount++; 40 | } 41 | var refObject = RIdent.LastIdent.ReferencedObject; 42 | if (!(refObject is oosClass || refObject is oosInterface)) 43 | { 44 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0029, RIdent.Line, RIdent.Pos)); 45 | errCount++; 46 | } 47 | return errCount; 48 | } 49 | 50 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 51 | { 52 | sw.Write("(("); 53 | sw.Write(oosClass.GlobalClassRegisterVariable.SqfVariableName); 54 | sw.Write(" select ("); 55 | this.LIdent.writeOut(sw, cfg); 56 | sw.Write(" select 0)) find ("); 57 | sw.Write('"' + this.RIdent.LastIdent.FullyQualifiedName + '"'); 58 | sw.Write(") != -1)"); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Switch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class Switch : pBaseLangObject, Interfaces.iHasType, Interfaces.iCodeBlock 10 | { 11 | public pBaseLangObject expression { get { return this.children[0]; } set { this.children[0] = value; } } 12 | public List CodeInstructions { get { return this.children.GetRange(1, this.children.Count - 1); } } 13 | public VarTypeObject ReferencedType { get { return ((Expression)expression).ReferencedType; } } 14 | public Case DefaultCase { get; internal set; } 15 | public Switch(pBaseLangObject parent) : base(parent) 16 | { 17 | this.children.Add(null); 18 | this.DefaultCase = null; 19 | } 20 | public override int doFinalize() 21 | { 22 | int errCount = 0; 23 | var caseList = this.getAllChildrenOf(); 24 | bool flag = false; 25 | foreach (var it in caseList) 26 | { 27 | if (it.Cases.Count == 0) 28 | { 29 | if (flag) 30 | { 31 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0020, it.Line, it.Pos)); 32 | errCount++; 33 | } 34 | else 35 | { 36 | flag = true; 37 | this.DefaultCase = it; 38 | } 39 | } 40 | } 41 | //ToDo: Check for duplicated case 42 | return errCount; 43 | } 44 | 45 | public List ReturnCommands 46 | { 47 | get { return new List(); } 48 | } 49 | 50 | 51 | public bool AlwaysReturns 52 | { 53 | get 54 | { 55 | var caseList = this.getAllChildrenOf(); 56 | if(!caseList.TrueForAll(it => it.AlwaysReturns)) 57 | return false; 58 | return this.DefaultCase != null; 59 | } 60 | } 61 | 62 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 63 | { 64 | string tab = new string('\t', this.Parent.getAllParentsOf().Count); 65 | sw.Write(tab + "switch ("); 66 | this.expression.writeOut(sw, cfg); 67 | sw.WriteLine(") do"); 68 | sw.WriteLine(tab + "{"); 69 | HelperClasses.PrintCodeHelpers.printCodeLines(this.CodeInstructions, tab, sw, cfg); 70 | sw.Write(tab + "}"); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/WrapperUI/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34209 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WrapperUI.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WrapperUI.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Wrapper/Wrapper.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {A3B85D87-D67F-4C01-94A2-379CCA4EA094} 8 | Exe 9 | Properties 10 | Wrapper 11 | Wrapper 12 | v4.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | Wrapper.Program 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | {ab1bed91-bedf-485c-b697-2d0db1dc7d47} 59 | Logger 60 | 61 | 62 | 63 | 70 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Deref.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class Deref : pBaseLangObject, Interfaces.iHasType 10 | { 11 | 12 | public Deref(pBaseLangObject parent, int line, int pos, string file) : base(parent) 13 | { 14 | Ident ident = new Ident(null, "string", line, pos, file); 15 | this.ReferencedType = new VarTypeObject(ident); 16 | this.Line = line; 17 | this.Pos = pos; 18 | this.File = file; 19 | } 20 | 21 | public int Line { get; internal set; } 22 | public int Pos { get; internal set; } 23 | public string File { get; internal set; } 24 | public VarTypeObject ReferencedType { get; internal set; } 25 | 26 | public override int doFinalize() 27 | { 28 | int errCount = 0; 29 | foreach (var it in this.children) 30 | { 31 | if(it is Ident) 32 | { 33 | Ident ident = (Ident)it; 34 | var refObj = ident.LastIdent.ReferencedObject; 35 | if(refObj is Function) 36 | { 37 | Function fnc = (Function)refObj; 38 | if(fnc.IsVirtual) 39 | { 40 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0053, this.Line, this.Pos, this.File)); 41 | errCount++; 42 | } 43 | } 44 | else if(refObj is Variable) 45 | { 46 | Variable obj = (Variable)refObj; 47 | if(obj.encapsulation != Encapsulation.Static) 48 | { 49 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0054, this.Line, this.Pos, this.File)); 50 | errCount++; 51 | } 52 | } 53 | else 54 | { 55 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0052, this.Line, this.Pos, this.File)); 56 | errCount++; 57 | } 58 | } 59 | else 60 | { 61 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.UNKNOWN, this.Line, this.Pos, this.File)); 62 | errCount++; 63 | } 64 | } 65 | return errCount; 66 | } 67 | 68 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 69 | { 70 | sw.Write('"'); 71 | foreach(var it in this.children) 72 | { 73 | it.writeOut(sw, cfg); 74 | } 75 | sw.Write('"'); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/While.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Compiler.OOS_LanguageObjects 9 | { 10 | public class While : pBaseLangObject, Interfaces.iCodeBlock, Interfaces.iBreakable 11 | { 12 | public pBaseLangObject expression { get { return this.children[0]; } set { this.children[0] = value; } } 13 | public List CodeInstructions { get { return this.children.GetRange(1, this.children.Count - 1); } } 14 | public string BreakScope { get { return Wrapper.Compiler.ScopeNames.loop; } } 15 | 16 | public While(pBaseLangObject parent) : base(parent) 17 | { 18 | this.children.Add(null); 19 | } 20 | public override int doFinalize() { return 0; } 21 | public List ReturnCommands 22 | { 23 | get { return this.getAllChildrenOf(); } 24 | } 25 | public bool AlwaysReturns 26 | { 27 | get 28 | { 29 | if (this.ReturnCommands.Count > 0) 30 | return true; 31 | var codeBlocks = this.getAllChildrenOf(); 32 | foreach (var it in codeBlocks) 33 | { 34 | if (it.AlwaysReturns) 35 | return true; 36 | } 37 | return false; 38 | } 39 | } 40 | 41 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 42 | { 43 | string tab = new string('\t', this.Parent.getAllParentsOf().Count); 44 | sw.Write(tab + "while {"); 45 | this.expression.writeOut(sw, cfg); 46 | sw.WriteLine("} do"); 47 | sw.WriteLine(tab + "{"); 48 | var varList = this.getAllChildrenOf(); 49 | if (varList.Count > 0) 50 | { 51 | if (varList.Count == 1) 52 | sw.Write(tab + '\t' + "private "); 53 | else 54 | sw.Write(tab + '\t' + "private ["); 55 | 56 | for (int i = 0; i < varList.Count; i++) 57 | { 58 | var it = varList[i]; 59 | if (i != 0) 60 | { 61 | sw.Write(", "); 62 | } 63 | if (it is Variable) 64 | { 65 | sw.Write('"' + ((Variable)it).SqfVariableName + '"'); 66 | } 67 | else 68 | { 69 | throw new Exception(); 70 | } 71 | } 72 | if (varList.Count > 1) 73 | sw.Write("]"); 74 | sw.WriteLine(";"); 75 | } 76 | if (this.getAllChildrenOf(true).Count > 0) 77 | { 78 | sw.WriteLine(tab + '\t' + "scopeName \"" + this.BreakScope + "\";"); 79 | } 80 | HelperClasses.PrintCodeHelpers.printCodeLines(this.CodeInstructions, tab, sw, cfg); 81 | sw.Write(tab + "}"); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/NativeOperator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class NativeOperator : NativeInstruction, Interfaces.iOperatorFunction 10 | { 11 | public NativeOperator(pBaseLangObject parent, int line, int pos, string file) : base(parent, line, pos, file) 12 | { 13 | this.addChild(null); 14 | VTO = null; 15 | } 16 | public override int doFinalize() 17 | { 18 | int errCount = 0; 19 | if (VTO.ident != null) 20 | errCount += VTO.ident.finalize(); 21 | return errCount; 22 | } 23 | public bool IsConstructor { get { return false; } } 24 | public bool IsVirtual { get { return false; } } 25 | /// 26 | /// Return type of this iFunction 27 | /// 28 | public VarTypeObject ReturnType { get { return this.VTO; } } 29 | public VarTypeObject ReferencedType { get { return this.ReturnType; } } 30 | /// 31 | /// Returns a Template object which then can deref some unknown class conflicts in 32 | /// ArgList field 33 | /// 34 | public Template TemplateArguments { get { return this.getFirstOf().TemplateObject; } } 35 | /// 36 | /// Returns functions encapsulation 37 | /// 38 | public Encapsulation FunctionEncapsulation { get { return Encapsulation.Public; } } 39 | /// 40 | /// Returns the Arglist required for this iFunction 41 | /// 42 | public List ArgList 43 | { 44 | get 45 | { 46 | List retList = new List(); 47 | foreach (var it in this.children) 48 | { 49 | if (it is Variable) 50 | { 51 | retList.Add(((Variable)it).varType); 52 | } 53 | else if (it is Ident) 54 | { 55 | //Do nothing as we got the Name here 56 | } 57 | else 58 | { 59 | throw new Exception(); 60 | } 61 | } 62 | return retList; 63 | } 64 | } 65 | public bool IsAsync { get { return false; } } 66 | 67 | public Ident Name { get { return (Ident)this.children[0]; } set { this.children[0] = value; } } 68 | public override string ToString() 69 | { 70 | return "nOp->" + Enum.GetName(typeof(OverridableOperator), this.OperatorType); 71 | } 72 | private OverridableOperator opType; 73 | public OverridableOperator OperatorType { get { return opType; } set { this.Name = new Ident(this, Enum.GetName(typeof(OverridableOperator), value), this.Line, this.Pos, this.File); this.opType = value; } } 74 | 75 | public List ReturnCommands { get { return new List(); } } 76 | public bool AlwaysReturns { get { return true; } } 77 | 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/NativeFunction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class NativeFunction : NativeInstruction, Interfaces.iFunction 10 | { 11 | public Ident Name { get { return (Ident)this.children[0]; } set { this.children[0] = value; } } 12 | public bool IsConstructor { get { return false; } } 13 | public bool IsVirtual { get { return false; } } 14 | /// 15 | /// Return type of this iFunction 16 | /// 17 | public VarTypeObject ReturnType { get { return this.VTO; } } 18 | public VarTypeObject ReferencedType { get { return this.ReturnType; } } 19 | /// 20 | /// Returns a Template object which then can deref some unknown class conflicts in 21 | /// ArgList field 22 | /// 23 | public Template TemplateArguments { get { return this.getFirstOf().TemplateObject; } } 24 | /// 25 | /// Returns functions encapsulation 26 | /// 27 | public Encapsulation FunctionEncapsulation { get { return this.Parent is Native ? Encapsulation.Public : Encapsulation.Static; } } 28 | /// 29 | /// Returns the Arglist required for this iFunction 30 | /// 31 | public List ArgList 32 | { 33 | get 34 | { 35 | List retList = new List(); 36 | foreach (var it in this.children) 37 | { 38 | if (it is Variable) 39 | { 40 | retList.Add(((Variable)it).varType); 41 | } 42 | else if (it is Ident) 43 | { 44 | //Do nothing as we got the Name here 45 | } 46 | else 47 | { 48 | throw new Exception(); 49 | } 50 | } 51 | return retList; 52 | } 53 | } 54 | public bool IsAsync { get { return false; } } 55 | 56 | public NativeFunction(pBaseLangObject parent, int line, int pos, string file) : base(parent, line, pos, file) 57 | { 58 | this.addChild(null); 59 | } 60 | public override int doFinalize() 61 | { 62 | int errCount = 0; 63 | errCount += this.Name.finalize(); 64 | if (VTO.ident != null) 65 | errCount += VTO.ident.finalize(); 66 | if (Code.Contains("_this") && !(this.Parent is Native)) 67 | { 68 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0049, this.Line, this.Pos, this.File)); 69 | errCount++; 70 | } 71 | return errCount; 72 | } 73 | public override string ToString() 74 | { 75 | return "nFnc->" + this.Name.FullyQualifiedName; 76 | } 77 | public List ReturnCommands { get { return new List(); } } 78 | public bool AlwaysReturns { get { return true; } } 79 | 80 | 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/NewArray.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class NewArray : pBaseLangObject, Interfaces.iHasType 10 | { 11 | 12 | public NewArray(pBaseLangObject parent) : base(parent) 13 | { 14 | this.ReferencedType = null; 15 | } 16 | public VarTypeObject ReferencedType { get; internal set; } 17 | public override int finalize() 18 | { 19 | if (this.IsFinalized) 20 | return 0; 21 | int errCount = 0; 22 | foreach (pBaseLangObject blo in children) 23 | if (blo != null) 24 | errCount += blo.finalize(); 25 | errCount += this.doFinalize(); 26 | if (this is Interfaces.iTemplate && ((Interfaces.iTemplate)this).TemplateObject != null) 27 | errCount += ((Interfaces.iTemplate)this).TemplateObject.doFinalize(); 28 | if (this is Interfaces.iHasType && ((Interfaces.iHasType)this).ReferencedType.IsObject) 29 | errCount += ((Interfaces.iHasType)this).ReferencedType.ident.finalize(); 30 | this.IsFinalized = true; 31 | return errCount; 32 | } 33 | public override int doFinalize() 34 | { 35 | int errCount = 0; 36 | foreach(var it in this.children) 37 | { 38 | if(it is Expression) 39 | { 40 | Expression exp = (Expression)it; 41 | if (this.ReferencedType == null) 42 | this.ReferencedType = exp.ReferencedType; 43 | if (!this.ReferencedType.Equals(exp.ReferencedType)) 44 | { 45 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0013, exp.Line, exp.Pos)); 46 | errCount++; 47 | } 48 | } 49 | else 50 | { 51 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.UNKNOWN)); 52 | errCount++; 53 | } 54 | } 55 | if (this.ReferencedType != null) 56 | { 57 | this.ReferencedType = new VarTypeObject(this.ReferencedType); 58 | switch(this.ReferencedType.varType) 59 | { 60 | case VarType.Bool: 61 | this.ReferencedType.varType = VarType.BoolArray; 62 | break; 63 | case VarType.Scalar: 64 | this.ReferencedType.varType = VarType.ScalarArray; 65 | break; 66 | } 67 | } 68 | return errCount; 69 | } 70 | 71 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 72 | { 73 | sw.Write("["); 74 | bool flag = false; 75 | foreach (var it in this.children) 76 | { 77 | if (flag) 78 | sw.Write(", "); 79 | else 80 | flag = true; 81 | it.writeOut(sw, cfg); 82 | } 83 | sw.Write("]"); 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/For.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class For : pBaseLangObject, Interfaces.iCodeBlock, Interfaces.iBreakable 10 | { 11 | public pBaseLangObject forArg1 { get { return this.children[0]; } set { this.children[0] = value; } } 12 | public pBaseLangObject forArg2 { get { return this.children[1]; } set { this.children[1] = value; } } 13 | public pBaseLangObject forArg3 { get { return this.children[2]; } set { this.children[2] = value; } } 14 | public List CodeInstructions { get { return this.children.GetRange(3, this.children.Count - 3); } } 15 | public string BreakScope { get { return Wrapper.Compiler.ScopeNames.loop; } } 16 | 17 | public For(pBaseLangObject parent) : base(parent) 18 | { 19 | this.children.Add(null); 20 | this.children.Add(null); 21 | this.children.Add(null); 22 | } 23 | public override int doFinalize() { return 0; } 24 | 25 | public List ReturnCommands 26 | { 27 | get { return this.getAllChildrenOf(); } 28 | } 29 | 30 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 31 | { 32 | //ToDo: Fix the wrong private of the forArg1 variable from inside of the loop to parent codeblock 33 | string tab = new string('\t', this.Parent.getAllParentsOf().Count); 34 | 35 | if (this.forArg1 != null) 36 | { 37 | this.forArg1.writeOut(sw, cfg); 38 | sw.WriteLine(";"); 39 | } 40 | sw.Write(tab + "while {"); 41 | if (this.forArg2 != null) 42 | { 43 | this.forArg2.writeOut(sw, cfg); 44 | } 45 | else 46 | { 47 | sw.Write("true"); 48 | } 49 | sw.WriteLine("} do"); 50 | sw.WriteLine(tab + "{"); 51 | HelperClasses.PrintCodeHelpers.printPrivateArray(this, tab, sw, cfg, 0); 52 | if (this.getAllChildrenOf(true).Count > 0) 53 | { 54 | sw.WriteLine(tab + '\t' + "scopeName \"" + this.BreakScope + "\";"); 55 | } 56 | HelperClasses.PrintCodeHelpers.printCodeLines(this.CodeInstructions, tab, sw, cfg); 57 | if (this.forArg3 != null) 58 | { 59 | this.forArg3.writeOut(sw, cfg); 60 | } 61 | sw.WriteLine(";"); 62 | sw.Write(tab + "}"); 63 | } 64 | 65 | public override List getScopeItems(int scopeIndex) 66 | { 67 | switch (scopeIndex) 68 | { 69 | case 0: 70 | return this.CodeInstructions; 71 | default: 72 | return this.children; 73 | } 74 | } 75 | 76 | public bool AlwaysReturns 77 | { 78 | get 79 | { 80 | if (this.ReturnCommands.Count > 0) 81 | return true; 82 | var codeBlocks = this.getAllChildrenOf(); 83 | foreach (var it in codeBlocks) 84 | { 85 | if (it.AlwaysReturns) 86 | return true; 87 | } 88 | return false; 89 | } 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/ForEach.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class ForEach : pBaseLangObject, Interfaces.iCodeBlock, Interfaces.iBreakable 10 | { 11 | public Ident Variable { get { return (Ident)this.children[0]; } set { this.children[0] = value; } } 12 | public Variable Itterator { get { return (Variable)this.children[1]; } set { this.children[1] = value; } } 13 | public List CodeInstructions { get { return this.children.GetRange(2, this.children.Count - 2); } } 14 | public string BreakScope { get { return Wrapper.Compiler.ScopeNames.loop; } } 15 | 16 | public ForEach(pBaseLangObject parent) : base(parent) 17 | { 18 | this.children.Add(null); 19 | this.children.Add(null); 20 | } 21 | private static bool warningSurpression = false; 22 | public override int doFinalize() 23 | { 24 | if (!Variable.LastIdent.ReferencedType.IsObject && !Variable.LastIdent.ReferencedType.ident.LastIdent.ReferencedObject.isType("::array")) 25 | { 26 | Logger.Instance.log(Logger.LogLevel.ERROR, "Currently only arrays are allowed in ForEach"); 27 | return 1; 28 | } 29 | //ToDo: implement the type check 30 | if (!warningSurpression) 31 | { 32 | warningSurpression = true; 33 | Logger.Instance.log(Logger.LogLevel.WARNING, "foreach currently is not able to fully validate type safety! Thus OOS cannot confirm types are considered as safe."); 34 | } 35 | return 0; 36 | } 37 | 38 | public List ReturnCommands 39 | { 40 | get { return this.getAllChildrenOf(); } 41 | } 42 | 43 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 44 | { 45 | string tab = new string('\t', this.Parent.getAllParentsOf().Count); 46 | if ((Variable.LastIdent.ReferencedType.IsObject && Variable.LastIdent.ReferencedType.ident.LastIdent.ReferencedObject.isType("::array")) || (Variable is Interfaces.iHasType && ((Interfaces.iHasType)Variable).ReferencedType.IsArray)) 47 | { 48 | sw.WriteLine(tab + '{'); 49 | HelperClasses.PrintCodeHelpers.printPrivateArray(this, tab, sw, cfg); 50 | if (this.getAllChildrenOf(true).Count > 0) 51 | { 52 | sw.WriteLine(tab + '\t' + "scopeName \"" + this.BreakScope + "\";"); 53 | } 54 | sw.WriteLine(tab + '\t' + Itterator.SqfVariableName + " = _x;"); 55 | HelperClasses.PrintCodeHelpers.printCodeLines(this.CodeInstructions, tab, sw, cfg); 56 | sw.Write(tab + "} foreach "); 57 | Variable.writeOut(sw, cfg); 58 | } 59 | else 60 | { 61 | throw new Exception(); 62 | } 63 | } 64 | 65 | 66 | public bool AlwaysReturns 67 | { 68 | get 69 | { 70 | if (this.ReturnCommands.Count > 0) 71 | return true; 72 | var codeBlocks = this.getAllChildrenOf(); 73 | foreach (var it in codeBlocks) 74 | { 75 | if (it.AlwaysReturns) 76 | return true; 77 | } 78 | return false; 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Wrapper/Version.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Wrapper 8 | { 9 | public class Version 10 | { 11 | private int _main; 12 | private int _side; 13 | private int _rev; 14 | private string _extra; 15 | public int Main { get { return this._main; } set { this._main = value; } } 16 | public int Side { get { return this._side; } set { this._side = value; } } 17 | public int Revision { get { return this._rev; } set { this._rev = value; } } 18 | public string Extra { get { return this._extra; } set { this._extra = value; } } 19 | public static implicit operator Version(string input) 20 | { 21 | return new Version(input); 22 | } 23 | public Version(string s) 24 | { 25 | _main = -1; 26 | _side = -1; 27 | _rev = -1; 28 | _extra = ""; 29 | if (s.Contains("-")) 30 | { 31 | this.Extra = s.Remove(0, s.IndexOf('-') + 1); 32 | s = s.Substring(0, s.IndexOf('-')); 33 | } 34 | string[] sArr = s.Split('.'); 35 | switch(sArr.Length) 36 | { 37 | default: 38 | throw new ArgumentException("Unknown Version Syntax"); 39 | case 3: 40 | this.Revision = Convert.ToInt32(sArr[2]); 41 | goto case 2; 42 | case 2: 43 | this.Side = Convert.ToInt32(sArr[1]); 44 | goto case 1; 45 | case 1: 46 | this.Main = Convert.ToInt32(sArr[0]); 47 | break; 48 | } 49 | } 50 | public override string ToString() 51 | { 52 | return _main + (_side >= 0 ? "." + _side : ".0") + (_rev >= 0 ? "." + _rev : ".0") + (_extra.Length > 0 ? "-" + _extra : ""); 53 | } 54 | public static bool operator <(Version x, Version y) 55 | { 56 | if (x._main < y._main) 57 | return true; 58 | else if (x._main > y._main) 59 | return false; 60 | 61 | if (x._side < y._side) 62 | return true; 63 | else if (x._side > y._side) 64 | return false; 65 | 66 | if (x._rev < y._rev) 67 | return true; 68 | return false; 69 | } 70 | public static bool operator >(Version x, Version y) 71 | { 72 | if (x._main > y._main) 73 | return true; 74 | else if (x._main < y._main) 75 | return false; 76 | 77 | if (x._side > y._side) 78 | return true; 79 | else if (x._side < y._side) 80 | return false; 81 | 82 | if (x._rev > y._rev) 83 | return true; 84 | return false; 85 | } 86 | public static bool operator ==(Version x, Version y) 87 | { 88 | return x._main == y._main && x._side == y._side && x._rev == y._rev; 89 | } 90 | public static bool operator !=(Version x, Version y) 91 | { 92 | return x._main != y._main && x._side != y._side && x._rev != y._rev; 93 | } 94 | public override bool Equals(object obj) 95 | { 96 | return base.Equals(obj); 97 | } 98 | public override int GetHashCode() 99 | { 100 | return base.GetHashCode(); 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /stdLibrary/std/context.oos: -------------------------------------------------------------------------------- 1 | namespace std 2 | { 3 | native Context 4 | { 5 | assign simple() missionNamespace endAssign 6 | 7 | fnc simple string getString(string ident) _this getVariable ( ident ) endFnc 8 | fnc simple string getString(string ident, string defValue) _this getVariable [ident, defValue] endFnc 9 | fnc simple void setString(string ident, string val) _this setVariable [ident, val] endFnc 10 | fnc simple void setString(string ident, string val, bool publish) _this setVariable [ident, val, publish] endFnc 11 | 12 | fnc simple scalar getScalar(string ident) _this getVariable ( ident ) endFnc 13 | fnc simple scalar getScalar(string ident, scalar defValue) _this getVariable [ident, defValue] endFnc 14 | fnc simple void setScalar(string ident, scalar val) _this setVariable [ident, val] endFnc 15 | fnc simple void setScalar(string ident, scalar val, bool publish) _this setVariable [ident, val, publish] endFnc 16 | 17 | fnc simple bool getBool(string ident) _this getVariable ( ident ) endFnc 18 | fnc simple bool getBool(string ident, bool defValue) _this getVariable [ident, defValue] endFnc 19 | fnc simple void setBool(string ident, bool val) _this setVariable [ident, val] endFnc 20 | fnc simple void setBool(string ident, bool val, bool publish) _this setVariable [ident, val, publish] endFnc 21 | 22 | fnc simple object getObject(string ident) _this getVariable ( ident ) endFnc 23 | fnc simple object getObject(string ident, object defValue) _this getVariable [ident, defValue] endFnc 24 | fnc simple void setObject(string ident, object val) _this setVariable [ident, val] endFnc 25 | fnc simple void setObject(string ident, object val, bool publish) _this setVariable [ident, val, publish] endFnc 26 | 27 | fnc simple nobject getNativeObject(string ident) _this getVariable ( ident ) endFnc 28 | fnc simple nobject getNativeObject(string ident, nobject defValue) _this getVariable [ident, defValue] endFnc 29 | fnc simple void setNativeObject(string ident, nobject val) _this setVariable [ident, val] endFnc 30 | fnc simple void setNativeObject(string ident, nobject val, bool publish) _this setVariable [ident, val, publish] endFnc 31 | 32 | fnc simple void setContext(::std::Context n) ( ident ) endFnc 33 | fnc simple ::std::Context toMissionContext () missionNamespace endFnc 34 | fnc simple ::std::Context toUiContext() uiNamespace endFnc 35 | fnc simple ::std::Context toParsingContext() parsingNamespace endFnc 36 | fnc simple ::std::Context toProfileContext() profileNamespace endFnc 37 | 38 | fnc simple void saveProfileContext() saveProfileNamespace endFnc 39 | } 40 | } -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/VariableAssignment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class VariableAssignment : pBaseLangObject, Interfaces.iHasType 10 | { 11 | public AssignmentCharacters Operation { get; set; } 12 | public VarTypeObject ReferencedType 13 | { 14 | get 15 | { 16 | if (this.children.Count == 0) 17 | return null; 18 | if (this.children[0] is Interfaces.iHasType) 19 | return ((Interfaces.iHasType)this.children[0]).ReferencedType; 20 | else 21 | return null; 22 | } 23 | } 24 | 25 | public VariableAssignment(pBaseLangObject parent) : base(parent) {} 26 | public override int doFinalize() { return 0; } 27 | 28 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 29 | { 30 | if (this.Parent is Ident || this.Parent is AssignContainer) 31 | { 32 | Ident parent = this.Parent is AssignContainer ? ((AssignContainer)this.Parent).Name.NextWorkerIdent : (Ident)this.Parent; 33 | string varName = '(' + parent.WriteOutValue + ')'; 34 | switch (this.Operation) 35 | { 36 | case AssignmentCharacters.PlusOne: 37 | sw.Write(varName + " + 1"); 38 | break; 39 | case AssignmentCharacters.MinusOne: 40 | sw.Write(varName + " - 1"); 41 | break; 42 | case AssignmentCharacters.AdditionAssign: 43 | sw.Write(varName + " + ("); 44 | foreach (var it in this.children) 45 | { 46 | it.writeOut(sw, cfg); 47 | } 48 | sw.Write(")"); 49 | break; 50 | case AssignmentCharacters.SubstractionAssign: 51 | sw.Write(varName + " - ("); 52 | foreach (var it in this.children) 53 | { 54 | it.writeOut(sw, cfg); 55 | } 56 | sw.Write(")"); 57 | break; 58 | case AssignmentCharacters.MultiplicationAssign: 59 | sw.Write(varName + " * ("); 60 | foreach (var it in this.children) 61 | { 62 | it.writeOut(sw, cfg); 63 | } 64 | sw.Write(")"); 65 | break; 66 | case AssignmentCharacters.DivisionAssign: 67 | sw.Write(varName + " / ("); 68 | foreach (var it in this.children) 69 | { 70 | it.writeOut(sw, cfg); 71 | } 72 | sw.Write(")"); 73 | break; 74 | default: 75 | foreach (var it in this.children) 76 | { 77 | it.writeOut(sw, cfg); 78 | } 79 | break; 80 | } 81 | } 82 | else if (this.Parent is Variable) 83 | { 84 | foreach(var it in this.children) 85 | { 86 | it.writeOut(sw, cfg); 87 | } 88 | } 89 | else 90 | { 91 | throw new NotImplementedException(); 92 | } 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Cast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class Cast : pBaseLangObject, Interfaces.iHasType, Interfaces.iHasObject 10 | { 11 | public VarTypeObject varType; 12 | public Cast(pBaseLangObject parent) : base(parent) { } 13 | public override int doFinalize() 14 | { 15 | int errCount = 0; 16 | if (this.varType.ident != null) 17 | errCount += this.varType.ident.doFinalize(); 18 | var childType = ((Ident)this.children[0]).LastIdent.ReferencedType; 19 | if (this.varType.varType == VarType.Object && childType.varType != VarType.Object) 20 | {//Non-Object to object 21 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0031, ((Ident)this.children[0]).Line, ((Ident)this.children[0]).Pos)); 22 | errCount++; 23 | } 24 | if (this.varType.varType != VarType.Object && childType.varType == VarType.Object) 25 | {//Object to non-object 26 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0033, ((Ident)this.children[0]).Line, ((Ident)this.children[0]).Pos)); 27 | errCount++; 28 | } 29 | if (this.varType.Equals(childType)) 30 | {//Same type 31 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0034, ((Ident)this.children[0]).Line, ((Ident)this.children[0]).Pos)); 32 | errCount++; 33 | } 34 | return errCount; 35 | } 36 | public pBaseLangObject ReferencedObject { get { return ((Ident)this.children[0]).ReferencedObject; } } 37 | public VarTypeObject ReferencedType { get { return varType; } } 38 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 39 | { 40 | //ToDo: do the actual casting stuff 41 | string tab = this.Parent is Interfaces.iCodeBlock ? new string('\t', this.getAllParentsOf().Count) : ""; 42 | if (this.children.Count != 1 || !(this.children[0] is Ident)) 43 | throw new Exception(); 44 | Ident ident = (Ident)this.children[0]; 45 | switch (ident.LastIdent.ReferencedType.varType) 46 | { 47 | case VarType.Object: 48 | ident.writeOut(sw, cfg); 49 | break; 50 | case VarType.Bool: 51 | switch(this.ReferencedType.varType) 52 | { 53 | case VarType.Scalar: 54 | sw.Write("parseNumber "); 55 | ident.writeOut(sw, cfg); 56 | break; 57 | default: 58 | ident.writeOut(sw, cfg); 59 | break; 60 | } 61 | break; 62 | case VarType.Scalar: 63 | switch (this.ReferencedType.varType) 64 | { 65 | case VarType.Bool: 66 | sw.Write("if("); 67 | ident.writeOut(sw, cfg); 68 | sw.Write(" > 0) then {true} else {false}"); 69 | break; 70 | default: 71 | ident.writeOut(sw, cfg); 72 | break; 73 | } 74 | break; 75 | default: 76 | throw new Exception(); 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/IfElse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class IfElse : pBaseLangObject, Interfaces.iCodeBlock 10 | { 11 | public VarType functionVarType; 12 | private int endMarker; 13 | 14 | public pBaseLangObject expression { get { return this.children[0]; } set { this.children[0] = value; } } 15 | public bool HasElse { get { return this.ElseInstructions.Count > 0; } } 16 | public List IfInstructions { get { return this.children.GetRange(1, endMarker); } } 17 | public List ElseInstructions { get { return this.children.GetRange(endMarker + 1, this.children.Count - (endMarker + 1)); } } 18 | 19 | public IfElse(pBaseLangObject parent) : base(parent) 20 | { 21 | this.children.Add(null); 22 | } 23 | public override int doFinalize() { return 0; } 24 | public void markIfEnd() 25 | { 26 | endMarker = this.children.Count - 1; 27 | } 28 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 29 | { 30 | string tab = new string('\t', this.Parent.getAllParentsOf().Count); 31 | sw.Write(tab + "if("); 32 | this.expression.writeOut(sw, cfg); 33 | sw.WriteLine(") then"); 34 | sw.WriteLine(tab + "{"); 35 | HelperClasses.PrintCodeHelpers.printPrivateArray(this, tab, sw, cfg, 1); 36 | HelperClasses.PrintCodeHelpers.printCodeLines(this.IfInstructions, tab, sw, cfg); 37 | sw.Write(tab + "}"); 38 | if (this.ElseInstructions.Count > 0) 39 | { 40 | sw.WriteLine("\n" + tab + "else"); 41 | sw.WriteLine(tab + "{"); 42 | HelperClasses.PrintCodeHelpers.printPrivateArray(this, tab, sw, cfg, 2); 43 | HelperClasses.PrintCodeHelpers.printCodeLines(this.ElseInstructions, tab, sw, cfg); 44 | sw.Write(tab + "}"); 45 | } 46 | } 47 | 48 | public List ReturnCommands 49 | { 50 | get { return this.getAllChildrenOf(); } 51 | } 52 | public bool AlwaysReturns 53 | { 54 | get 55 | { 56 | if (!this.HasElse) 57 | return false; 58 | bool flag = false; 59 | foreach (var it in this.IfInstructions) 60 | { 61 | if (it is Return || (it is Interfaces.iCodeBlock && ((Interfaces.iCodeBlock)it).AlwaysReturns)) 62 | { 63 | flag = true; 64 | break; 65 | } 66 | } 67 | if (!flag) 68 | return false; 69 | foreach (var it in this.IfInstructions) 70 | { 71 | if (it is Return || (it is Interfaces.iCodeBlock && ((Interfaces.iCodeBlock)it).AlwaysReturns)) 72 | { 73 | return true; 74 | } 75 | } 76 | return false; 77 | } 78 | } 79 | public override List getScopeItems(int scopeIndex) 80 | { 81 | switch (scopeIndex) 82 | { 83 | case 0: 84 | var list = new List(); 85 | list.Add(this.expression); 86 | return list; 87 | case 1: 88 | return this.IfInstructions; 89 | case 2: 90 | return this.ElseInstructions; 91 | default: 92 | return this.children; 93 | } 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/NativeInstruction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Text.RegularExpressions; 7 | 8 | namespace Compiler.OOS_LanguageObjects 9 | { 10 | public class NativeInstruction : pBaseLangObject 11 | { 12 | public int Line { get; internal set; } 13 | public int Pos { get; internal set; } 14 | public string File { get; internal set; } 15 | VarTypeObject vto; 16 | public VarTypeObject VTO 17 | { 18 | get { return vto; } 19 | set { vto = value; } 20 | } 21 | public string Code { get; set; } 22 | public bool IsSimple { get; set; } 23 | 24 | public NativeInstruction(pBaseLangObject parent, int line, int pos, string file) : base(parent) 25 | { 26 | this.Line = line; 27 | this.Pos = pos; 28 | this.File = file; 29 | } 30 | public virtual string getCode(string[] argList) 31 | { 32 | if (this.children.Count == 0 && argList.Length == 0) 33 | return Code; 34 | if(argList.Length < this.children.Count - (this.Parent is Native ? 0 : 1)) 35 | { 36 | throw new Exception("Should never happen exception got raised. Please report to developer!"); 37 | } 38 | string outString; 39 | if (this.IsSimple) 40 | { 41 | outString = Code; 42 | if (this.Parent is Native) 43 | outString = Regex.Replace(outString, "\\b" + "_this" + "\\b", argList[0].Trim()); 44 | if (this.children.Count > 0 && children[0] is Ident) 45 | { 46 | if (this.Parent is Native) 47 | { 48 | for (int i = 1; i < argList.Length; i++) 49 | { 50 | outString = Regex.Replace(outString, "\\b" + ((Variable)this.children[i]).Name.OriginalValue + "\\b", argList[i].Trim()); 51 | } 52 | } 53 | else 54 | { 55 | for (int i = 0; i < argList.Length; i++) 56 | { 57 | outString = Regex.Replace(outString, "\\b" + ((Variable)this.children[i + 1]).Name.OriginalValue + "\\b", argList[i].Trim()); 58 | } 59 | } 60 | } 61 | else 62 | { 63 | for (int i = 0; i < argList.Length; i++) 64 | { 65 | outString = Regex.Replace(outString, "\\b" + ((Variable)this.children[i]).Name.OriginalValue + "\\b", argList[i].Trim()); 66 | } 67 | } 68 | } 69 | else 70 | { 71 | outString = "["; 72 | for (int i = 0; i < argList.Length; i++) 73 | { 74 | if (i > 0) 75 | outString += ','; 76 | outString += argList[i]; 77 | } 78 | outString += "] call {"; 79 | string tmp = Code; 80 | tmp = Regex.Replace(tmp, "\\b" + "_this" + "\\b", "(_this select 0)"); 81 | int offset = (this.children.Count > 0 && children[0] is Ident ? 1 : 0); 82 | for (int i = offset; i < this.children.Count; i++) 83 | { 84 | tmp = Regex.Replace(tmp, "\\b" + ((Variable)this.children[i]).Name.OriginalValue + "\\b", "(_this select " + (i - offset) + ")"); 85 | } 86 | outString += tmp + "}"; 87 | } 88 | return outString; 89 | } 90 | public override int doFinalize() 91 | { 92 | return 0; 93 | } 94 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) { } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Case.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class Case : pBaseLangObject, Interfaces.iCodeBlock, Interfaces.iBreakable 10 | { 11 | int endMarker; 12 | public List Cases { get { return this.children.GetRange(0, endMarker); } } 13 | public List CodeInstructions { get { return this.children.GetRange(endMarker, this.children.Count - (endMarker)); } } 14 | public string BreakScope { get { return Wrapper.Compiler.ScopeNames.oosCase; } } 15 | 16 | public void markEnd() 17 | { 18 | endMarker = this.children.Count; 19 | } 20 | public int Line { get; internal set; } 21 | public int Pos { get; internal set; } 22 | public string File { get; internal set; } 23 | public Case(pBaseLangObject parent, int line, int pos, string file) : base(parent) 24 | { 25 | this.Line = line; 26 | this.Pos = pos; 27 | this.File = file; 28 | } 29 | public override int doFinalize() 30 | { 31 | int errCount = 0; 32 | var switchElement = this.Parent.getFirstOf(); 33 | foreach (var expression in this.Cases) 34 | { 35 | if (expression != null) 36 | { 37 | if (!((Expression)expression).ReferencedType.Equals(switchElement.ReferencedType) && !(switchElement.ReferencedType.IsObject && switchElement.ReferencedType.ident.ReferencedObject is oosEnum)) 38 | { 39 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0024, this.Line, this.Pos, this.File)); 40 | errCount++; 41 | } 42 | } 43 | } 44 | return errCount; 45 | } 46 | 47 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 48 | { 49 | string tab = new string('\t', this.Parent.getAllParentsOf().Count); 50 | var caseList = this.Cases; 51 | if (caseList.Count == 0) 52 | { 53 | sw.WriteLine(tab + "default {"); 54 | } 55 | else 56 | { 57 | foreach (var it in caseList) 58 | { 59 | sw.Write(tab + "case "); 60 | it.writeOut(sw, cfg); 61 | sw.Write(":"); 62 | } 63 | sw.WriteLine("{"); 64 | } 65 | HelperClasses.PrintCodeHelpers.printPrivateArray(this, tab, sw, cfg); 66 | HelperClasses.PrintCodeHelpers.printCodeLines(this.CodeInstructions.GetRange(0, this.CodeInstructions.Count - 1), tab, sw, cfg); 67 | var lastInstruction = CodeInstructions.Last(); 68 | if (!(lastInstruction is Break)) 69 | { 70 | lastInstruction.writeOut(sw, cfg); 71 | sw.WriteLine(";"); 72 | } 73 | sw.Write(tab + "}"); 74 | } 75 | 76 | public List ReturnCommands 77 | { 78 | get { return this.getAllChildrenOf(); } 79 | } 80 | 81 | 82 | public bool AlwaysReturns 83 | { 84 | get 85 | { 86 | if (this.ReturnCommands.Count > 0) 87 | return true; 88 | var codeBlocks = this.getAllChildrenOf(); 89 | foreach(var it in codeBlocks) 90 | { 91 | if (it.AlwaysReturns) 92 | return true; 93 | } 94 | return false; 95 | } 96 | } 97 | 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /stdLibrary/std/base/VehicleBase.oos: -------------------------------------------------------------------------------- 1 | using std::Config 2 | using std::Context 3 | 4 | namespace std 5 | { 6 | namespace base 7 | { 8 | native VehicleBase flags disableConstructor 9 | { 10 | fnc simple void setDirection (scalar i) _this setDir ( i ) endFnc 11 | fnc simple void setPosition (scalar i, scalar j, scalar k) _this setPos [i, j, k] endFnc 12 | fnc simple void setPositionASL (scalar i, scalar j, scalar k) _this setPosASL [i, j, k] endFnc 13 | fnc simple void setVelocity (scalar i, scalar j, scalar k) _this setVelocity [i, j, k] endFnc 14 | fnc simple void setDamage (scalar i) _this setDamage ( i ) endFnc 15 | 16 | fnc simple void attachTo (::std::base::VehicleBase vehicle) _this attachTo [vehicle] endFnc 17 | fnc simple void attachTo (::std::base::VehicleBase vehicle, array offset) _this attachTo [vehicle, offset] endFnc 18 | fnc simple void attachTo (::std::base::VehicleBase vehicle, array offset, string memPoint) _this attachTo [vehicle, offset, memPoint] endFnc 19 | 20 | fnc simple scalar getDamage () damage _this endFnc 21 | fnc simple scalar getDirection () direction _this endFnc 22 | fnc simple vec3 getPosition () position _this endFnc 23 | fnc simple vec3 getPositionASL () getPosASL _this endFnc 24 | fnc simple vec3 getVectorDir () vectorDir _this endFnc 25 | fnc simple vec3 getVectorUp () vectorUp _this endFnc 26 | fnc simple vec3 getVelocity () velocity _this endFnc 27 | fnc simple scalar getSpeed () speed _this endFnc 28 | fnc simple string getType () typeOf _this endFnc 29 | fnc simple ::std::Config getConfigEntry () configFile >> "CfgVehicles" >> typeOf _this endFnc 30 | fnc simple ::std::Context getContext () _this endFnc 31 | fnc simple ::std::base::VehicleBase getAttachedToObject () attachedTo _this endFnc 32 | fnc simple array<::std::base::VehicleBase> getAttachedObjects() attachedObjects _this endFnc 33 | 34 | fnc simple bool isKindOf (string type) _this isKindOf ( type ) endFnc 35 | fnc simple bool isAlive () alive _this endFnc 36 | fnc simple bool isAttachedTo (::std::base::VehicleBase vehicle) attachedTo _this == ( vehicle ) endFnc 37 | 38 | 39 | fnc simple void delete () deleteVehicle _this endFnc 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/oosEnum.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class oosEnum : pBaseLangObject, Interfaces.iName, Interfaces.iHasType 10 | { 11 | public class EnumEntry : pBaseLangObject, Interfaces.iName 12 | { 13 | public EnumEntry(pBaseLangObject parent) : base(parent) 14 | { 15 | this.addChild(null); 16 | this.addChild(null); 17 | } 18 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 19 | { 20 | } 21 | public Ident Name { get { return ((Ident)this.children[0]); } set { this.children[0] = value; } } 22 | public Value Value { get { return ((Value)this.children[1]); } set { this.children[1] = value; } } 23 | public override string ToString() 24 | { 25 | return "enumEntry->" + this.Name.FullyQualifiedName + "<->" + (this.Value == null ? "NULL" : this.Value.ToString()); 26 | } 27 | } 28 | public Ident Name { get { return ((Ident)this.children[0]); } set { this.children[0] = value; } } 29 | public oosEnum(pBaseLangObject parent) : base(parent) 30 | { 31 | this.children.Add(null); 32 | this.ReferencedType = new VarTypeObject(VarType.Void); 33 | } 34 | public override int doFinalize() 35 | { 36 | int errCount = 0; 37 | var list = this.getAllChildrenOf(); 38 | VarTypeObject vto = null; 39 | int offset = 0; 40 | List usedValues = new List(); 41 | for (int i = 0; i < list.Count; i++) 42 | { 43 | var it = list[i]; 44 | if(it.Value == null) 45 | { 46 | Value val = new Value(it); 47 | val.value = (i + offset).ToString(); 48 | it.Value = val; 49 | it.Value.varType.varType = VarType.Scalar; 50 | } 51 | else 52 | { 53 | if(it.Value.varType.varType == VarType.Scalar) 54 | { 55 | offset = int.Parse(it.Value.value) - i; 56 | } 57 | } 58 | if (usedValues.Contains(it.Value.value)) 59 | { 60 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0048, it.Name.Line, it.Name.Pos, it.Name.File)); 61 | errCount++; 62 | } 63 | usedValues.Add(it.Value.value); 64 | if(vto == null) 65 | { 66 | vto = it.Value.varType; 67 | } 68 | else if(!vto.Equals(it.Value.varType)) 69 | { 70 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0047, it.Name.Line, it.Name.Pos, it.Name.File)); 71 | errCount++; 72 | } 73 | } 74 | this.ReferencedType.ident = vto.ident; 75 | this.ReferencedType.varType = vto.varType; 76 | this.ReferencedType.TemplateObject = vto.TemplateObject; 77 | 78 | 79 | if (list.Count == 1) 80 | { 81 | Logger.Instance.log(Logger.LogLevel.WARNING, "Enum '" + this.Name.OriginalValue + "' only has a single value assigned to it"); 82 | } 83 | 84 | return errCount; 85 | } 86 | public override string ToString() 87 | { 88 | return "enum->" + this.Name.FullyQualifiedName; 89 | } 90 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 91 | { 92 | 93 | } 94 | 95 | public VarTypeObject ReferencedType { get; internal set; } 96 | public VarTypeObject RealType { get; internal set; } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/SqfConfigObjects/SqfConfigFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | 8 | namespace Compiler.SqfConfigObjects 9 | { 10 | public class SqfConfigFile : iSqfConfigChildren 11 | { 12 | List children; 13 | string name; 14 | public string Name { get { return this.name; } set { this.name = value; } } 15 | public List Children { get { return this.children; } } 16 | public SqfConfigFile(string name) 17 | { 18 | this.children = new List(); 19 | this.name = name; 20 | } 21 | public void addChild(iSqfConfig obj) 22 | { 23 | if (obj is SqfConfigField) 24 | throw new Exception("Not Added Exception, if you ever experience this create a bug. SqfConfigFile"); 25 | this.children.Add(obj); 26 | } 27 | public void writeOut(string path) 28 | { 29 | if(!Directory.Exists(path)) 30 | { 31 | Directory.CreateDirectory(path); 32 | } 33 | if (path.EndsWith("\\")) 34 | path += this.Name; 35 | else 36 | path += '\\' + this.Name; 37 | StreamWriter writer = new StreamWriter(path); 38 | write(writer, 0); 39 | writer.Flush(); 40 | writer.Close(); 41 | } 42 | public void write(StreamWriter writer, int tabCount = 0) 43 | { 44 | foreach (iSqfConfig c in children) 45 | c.write(writer, 0); 46 | } 47 | public void addParentalClass(string name) 48 | { 49 | var configClass = new SqfConfigClass(name); 50 | configClass.Children.AddRange(this.Children); 51 | this.children.Clear(); 52 | this.addChild(configClass); 53 | } 54 | public void setValue(string path, string value) 55 | { 56 | string[] pathArray = path.Split(new char[] { '/' }); 57 | iSqfConfigChildren cfgClass = this; 58 | bool flag; 59 | for (int i = 0; i < pathArray.Length - 1; i++) 60 | { 61 | string s = pathArray[i]; 62 | flag = true; 63 | foreach(var it in cfgClass.Children) 64 | { 65 | if(it.Name == s) 66 | { 67 | flag = false; 68 | if(it is iSqfConfigChildren) 69 | { 70 | cfgClass = (iSqfConfigChildren)it; 71 | break; 72 | } 73 | else 74 | { 75 | throw new Exception("Action would override existing field '" + s + "' with same name! Cannot continue."); 76 | } 77 | } 78 | } 79 | if(flag) 80 | { 81 | var configClass = new SqfConfigClass(s); 82 | cfgClass.addChild(configClass); 83 | cfgClass = configClass; 84 | } 85 | } 86 | string fieldName = pathArray.Last(); 87 | flag = true; 88 | foreach(var it in cfgClass.Children) 89 | { 90 | if (it.Name == fieldName) 91 | { 92 | flag = false; 93 | if(it is SqfConfigField) 94 | { 95 | ((SqfConfigField)it).value = value; 96 | break; 97 | } 98 | else 99 | { 100 | throw new Exception("Action would override existing class with same name! Cannot continue."); 101 | } 102 | } 103 | } 104 | if(flag) 105 | { 106 | var field = new SqfConfigField(fieldName, value); 107 | cfgClass.addChild(field); 108 | } 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /stdLibrary/std/Marker.oos: -------------------------------------------------------------------------------- 1 | using std::Config 2 | using std::Context 3 | using std::base::VehicleBase 4 | using std::Man 5 | 6 | namespace std 7 | { 8 | native Marker 9 | { 10 | enum Shape 11 | { 12 | Icon = "ICON", 13 | Rectangle = "RECTANGLE", 14 | Ellipse = "ELLIPSE" 15 | } 16 | 17 | enum Brush 18 | { 19 | Solid = "Solid", 20 | SolidFull = "SolidFull", 21 | Horizontal = "Horizontal", 22 | Vertical = "Vertical", 23 | Grid = "Grid", 24 | FDiagonal = "FDiagonal", 25 | BDiagonal = "BDiagonal", 26 | DiagGrid = "DiagGrid", 27 | Cross = "Cross", 28 | Border = "Border", 29 | SolidBorder = "SolidBorder" 30 | } 31 | 32 | enum Color 33 | { 34 | Default = "Default", 35 | ColorBlack = "ColorBlack", 36 | ColorGrey = "ColorGrey", 37 | ColorRed = "ColorRed", 38 | ColorGreen = "ColorGreen", 39 | ColorBlue = "ColorBlue", 40 | ColorYellow = "ColorYellow", 41 | ColorOrange = "ColorOrange", 42 | ColorWhite = "ColorWhite", 43 | ColorPink = "ColorPink", 44 | ColorBrown = "ColorBrown", 45 | ColorKhaki = "ColorKhaki", 46 | ColorWEST = "ColorWEST", 47 | ColorEAST = "ColorEAST", 48 | ColorGUER = "ColorGUER", 49 | ColorCIV = "ColorCIV", 50 | ColorUNKNOWN = "ColorUNKNOWN", 51 | LightRed = "Color1_FD_F", 52 | LightKhaki = "Color2_FD_F", 53 | LightOrange = "Color3_FD_F", 54 | LightBlue = "Color4_FD_F", 55 | ColorBLUFOR = "ColorBLUFOR", 56 | ColorCivilian = "ColorCivilian", 57 | ColorIndependent = "ColorIndependent", 58 | ColorOPFOR = "ColorOPFOR" 59 | } 60 | 61 | assign simple (string name) 62 | createMarker [name, [0, 0, 0]] 63 | endAssign 64 | assign simple (string name, scalar i, scalar j, scalar k) 65 | createMarker [name, [i, j, k]] 66 | endAssign 67 | 68 | fnc simple void setDirection(scalar angle) _this setMarkerDir ( angle ) endFnc 69 | fnc simple scalar getDirection() markerDir _this endFnc 70 | fnc simple void setAlpha(scalar angle) _this setMarkerAlpha ( angle ) endFnc 71 | fnc simple scalar getAlpha() markerAlpha _this endFnc 72 | fnc simple void setColor(Color c) _this setMarkerColor ( c ) endFnc 73 | fnc simple Color getColor() markerColor _this endFnc 74 | fnc simple void setBrush(Brush brush) _this setMarkerBrush ( brush ) endFnc 75 | fnc simple Brush getBrush() markerBrush _this endFnc 76 | fnc simple void setType(string t) _this setMarkerType ( t ) endFnc 77 | fnc simple string getType() markerType _this endFnc 78 | fnc simple void setText(string t) _this setMarkerText ( t ) endFnc 79 | fnc simple string getType() markerText _this endFnc 80 | fnc simple void setShape(Shape shape) _this setMarkerShape ( shape ) endFnc 81 | fnc simple Shape getShape() markerShape _this endFnc 82 | fnc simple void setSize(scalar x, scalar y) _this setMarkerSize [x, y] endFnc 83 | fnc simple array getSize() markerSize _this endFnc 84 | fnc simple void setPosition(scalar x, scalar y) _this setMarkerPos [x, y, 0] endFnc 85 | fnc simple vec3 getPosition() markerPos _this endFnc 86 | 87 | fnc simple void delete() deleteMarker _this endFnc 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/Native.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class Native : pBaseLangObject, Interfaces.iName, Interfaces.iTemplate, Interfaces.iClass 10 | { 11 | public int Line { get; internal set; } 12 | public int Pos { get; internal set; } 13 | public string File { get; internal set; } 14 | public Template TemplateObject { get; set; } 15 | public Ident Name { get { return ((Ident)this.children[0]); } set { this.children[0] = value; } } 16 | public List parentIdents; 17 | public Native(pBaseLangObject parent, int line, int pos, string file) : base(parent) 18 | { 19 | this.addChild(null); 20 | this.Line = line; 21 | this.Pos = pos; 22 | this.File = file; 23 | this.parentIdents = new List(); 24 | } 25 | public override int doFinalize() 26 | { 27 | int errCount = 0; 28 | foreach(var it in this.parentIdents) 29 | { 30 | errCount += it.finalize(); 31 | } 32 | if(errCount == 0) 33 | { 34 | foreach(var it in this.parentIdents) 35 | { 36 | Native nClass = (Native)it.LastIdent.ReferencedObject; 37 | foreach(var child in nClass.children) 38 | { 39 | if (child is NativeFunction) 40 | { 41 | var nf = (NativeFunction)child; 42 | var nf2 = new NativeFunction(this, nf.Line, nf.Pos, nf.File); 43 | nf2.Code = nf.Code; 44 | nf2.IsSimple = nf.IsSimple; 45 | for (int i = 1; i < nf.children.Count; i++) 46 | nf2.addChild(nf.children[i]); 47 | nf2.VTO = new VarTypeObject(nf.VTO); 48 | nf2.Name = new Ident(this, nf.Name.OriginalValue, nf.Name.Line, nf.Name.Pos, nf.Name.File); 49 | this.addChild(nf2); 50 | nf2.finalize(); 51 | } 52 | else if(child is NativeOperator) 53 | { 54 | var no = (NativeOperator)child; 55 | var no2 = new NativeOperator(this, no.Line, no.Pos, no.File); 56 | no2.Code = no.Code; 57 | no2.IsSimple = no.IsSimple; 58 | for (int i = 1; i < no.children.Count; i++) 59 | no2.addChild(no.children[i]); 60 | no2.OperatorType = no.OperatorType; 61 | no2.VTO = new VarTypeObject(no.VTO); 62 | no2.Name = new Ident(this, no.Name.OriginalValue, no.Name.Line, no.Name.Pos, no.Name.File); 63 | this.addChild(no2); 64 | no2.finalize(); 65 | } 66 | } 67 | } 68 | } 69 | return errCount; 70 | } 71 | 72 | public List ExtendedClasses 73 | { 74 | get { return parentIdents; } 75 | } 76 | 77 | public VarTypeObject VTO { get; set; } 78 | public void addParent(Ident ident) 79 | { 80 | this.parentIdents.Add(ident); 81 | } 82 | public Interfaces.iOperatorFunction getOperatorFunction(OverridableOperator op) 83 | { 84 | var opFncList = this.getAllChildrenOf(); 85 | foreach(var it in opFncList) 86 | { 87 | if(it.OperatorType == op) 88 | { 89 | return it; 90 | } 91 | } 92 | return null; 93 | } 94 | public override string ToString() 95 | { 96 | return "native->" + this.Name.FullyQualifiedName; 97 | } 98 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) { } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/TryCatch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public class TryCatch : pBaseLangObject, Interfaces.iCodeBlock 10 | { 11 | public VarType functionVarType; 12 | private int endMarker; 13 | 14 | public pBaseLangObject variable { get { return this.children[0]; } set { this.children[0] = value; } } 15 | public List TryInstructions { get { return this.children.GetRange(1, endMarker); } } 16 | public List CatchInstructions 17 | { 18 | get 19 | { 20 | List objList = new List(); 21 | objList.Add(this.variable); 22 | objList.AddRange(this.children.GetRange(endMarker + 1, this.children.Count - (endMarker + 1))); 23 | return objList; 24 | } 25 | } 26 | 27 | public TryCatch(pBaseLangObject parent) : base(parent) 28 | { 29 | this.children.Add(null); 30 | } 31 | public override int doFinalize() 32 | { 33 | if (!((Variable)variable).ReferencedType.IsKindOf(Wrapper.Compiler.InternalObjectVarTypes.VT_Exception)) 34 | { 35 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0056, ((Variable)variable).Line, ((Variable)variable).Pos)); 36 | return 1; 37 | } 38 | return 0; 39 | } 40 | public void markEnd() 41 | { 42 | endMarker = this.children.Count - 1; 43 | } 44 | 45 | public List ReturnCommands 46 | { 47 | get { return this.getAllChildrenOf(); } 48 | } 49 | 50 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 51 | { 52 | string tab = new string('\t', this.Parent.getAllParentsOf().Count); 53 | sw.WriteLine(tab + "try"); 54 | sw.WriteLine(tab + "{"); 55 | HelperClasses.PrintCodeHelpers.printPrivateArray(this, tab, sw, cfg, 1); 56 | HelperClasses.PrintCodeHelpers.printCodeLines(this.TryInstructions, tab, sw, cfg); 57 | sw.WriteLine(tab + "}"); 58 | sw.WriteLine(tab + "catch"); 59 | sw.WriteLine(tab + "{"); 60 | HelperClasses.PrintCodeHelpers.printPrivateArray(this, tab, sw, cfg, 2); 61 | this.variable.writeOut(sw, cfg); 62 | sw.WriteLine(" = _exception;"); 63 | HelperClasses.PrintCodeHelpers.printCodeLines(this.CatchInstructions, tab, sw, cfg); 64 | sw.Write(tab + "}"); 65 | } 66 | public bool AlwaysReturns 67 | { 68 | get 69 | { 70 | bool flag = false; 71 | foreach (var it in this.TryInstructions) 72 | { 73 | if (it is Return || (it is Interfaces.iCodeBlock && ((Interfaces.iCodeBlock)it).AlwaysReturns)) 74 | { 75 | flag = true; 76 | break; 77 | } 78 | } 79 | if (!flag) 80 | return false; 81 | foreach (var it in this.CatchInstructions) 82 | { 83 | if (it is Return || (it is Interfaces.iCodeBlock && ((Interfaces.iCodeBlock)it).AlwaysReturns)) 84 | { 85 | return true; 86 | } 87 | } 88 | return false; 89 | } 90 | } 91 | public override List getScopeItems(int scopeIndex) 92 | { 93 | switch(scopeIndex) 94 | { 95 | case 0: 96 | var list = new List(); 97 | list.Add(this.variable); 98 | return list; 99 | case 1: 100 | return this.TryInstructions; 101 | case 2: 102 | return this.CatchInstructions; 103 | default: 104 | return this.children; 105 | } 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # Build results 11 | [Dd]ebug/ 12 | [Dd]ebugPublic/ 13 | [Rr]elease/ 14 | [Rr]eleases/ 15 | x64/ 16 | x86/ 17 | build/ 18 | bld/ 19 | [Bb]in/ 20 | [Oo]bj/ 21 | BugFiles/ 22 | 23 | # Roslyn cache directories 24 | *.ide/ 25 | 26 | # MSTest test Results 27 | [Tt]est[Rr]esult*/ 28 | [Bb]uild[Ll]og.* 29 | 30 | #NUNIT 31 | *.VisualState.xml 32 | TestResult.xml 33 | 34 | # Build Results of an ATL Project 35 | [Dd]ebugPS/ 36 | [Rr]eleasePS/ 37 | dlldata.c 38 | 39 | *_i.c 40 | *_p.c 41 | *_i.h 42 | *.ilk 43 | *.meta 44 | *.obj 45 | *.pch 46 | *.pdb 47 | *.pgc 48 | *.pgd 49 | *.rsp 50 | *.sbr 51 | *.tlb 52 | *.tli 53 | *.tlh 54 | *.tmp 55 | *.tmp_proj 56 | *.log 57 | *.vspscc 58 | *.vssscc 59 | .builds 60 | *.pidb 61 | *.svclog 62 | *.scc 63 | 64 | # Chutzpah Test files 65 | _Chutzpah* 66 | 67 | # Visual C++ cache files 68 | ipch/ 69 | *.aps 70 | *.ncb 71 | *.opensdf 72 | *.sdf 73 | *.cachefile 74 | 75 | # Visual Studio profiler 76 | *.psess 77 | *.vsp 78 | *.vspx 79 | 80 | # TFS 2012 Local Workspace 81 | $tf/ 82 | 83 | # Guidance Automation Toolkit 84 | *.gpState 85 | 86 | # ReSharper is a .NET coding add-in 87 | _ReSharper*/ 88 | *.[Rr]e[Ss]harper 89 | *.DotSettings.user 90 | 91 | # JustCode is a .NET coding addin-in 92 | .JustCode 93 | 94 | # TeamCity is a build add-in 95 | _TeamCity* 96 | 97 | # DotCover is a Code Coverage Tool 98 | *.dotCover 99 | 100 | # NCrunch 101 | _NCrunch_* 102 | .*crunch*.local.xml 103 | 104 | # MightyMoose 105 | *.mm.* 106 | AutoTest.Net/ 107 | 108 | # Web workbench (sass) 109 | .sass-cache/ 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.[Pp]ublish.xml 129 | *.azurePubxml 130 | # TODO: Comment the next line if you want to checkin your web deploy settings 131 | # but database connection strings (with potential passwords) will be unencrypted 132 | *.pubxml 133 | *.publishproj 134 | 135 | # NuGet Packages 136 | *.nupkg 137 | # The packages folder can be ignored because of Package Restore 138 | **/packages/* 139 | # except build/, which is used as an MSBuild target. 140 | !**/packages/build/ 141 | # If using the old MSBuild-Integrated Package Restore, uncomment this: 142 | #!**/packages/repositories.config 143 | 144 | # Windows Azure Build Output 145 | csx/ 146 | *.build.csdef 147 | 148 | # Windows Store app package directory 149 | AppPackages/ 150 | 151 | # Others 152 | sql/ 153 | *.Cache 154 | ClientBin/ 155 | [Ss]tyle[Cc]op.* 156 | ~$* 157 | *~ 158 | *.dbmdl 159 | *.dbproj.schemaview 160 | *.pfx 161 | *.publishsettings 162 | node_modules/ 163 | 164 | # RIA/Silverlight projects 165 | Generated_Code/ 166 | 167 | # Backup & report files from converting an old project file 168 | # to a newer Visual Studio version. Backup files are not needed, 169 | # because we have git ;-) 170 | _UpgradeReport_Files/ 171 | Backup*/ 172 | UpgradeLog*.XML 173 | UpgradeLog*.htm 174 | 175 | # SQL Server files 176 | *.mdf 177 | *.ldf 178 | 179 | # Business Intelligence projects 180 | *.rdl.data 181 | *.bim.layout 182 | *.bim_*.settings 183 | 184 | # Microsoft Fakes 185 | FakesAssemblies/ 186 | 187 | # ========================= 188 | # Operating System Files 189 | # ========================= 190 | 191 | # OSX 192 | # ========================= 193 | 194 | .DS_Store 195 | .AppleDouble 196 | .LSOverride 197 | 198 | # Thumbnails 199 | ._* 200 | 201 | # Files that might appear on external disk 202 | .Spotlight-V100 203 | .Trashes 204 | 205 | # Directories potentially created on remote AFP share 206 | .AppleDB 207 | .AppleDesktop 208 | Network Trash Folder 209 | Temporary Items 210 | .apdisk 211 | 212 | # Windows 213 | # ========================= 214 | 215 | # Windows image file caches 216 | Thumbs.db 217 | ehthumbs.db 218 | 219 | # Folder config file 220 | Desktop.ini 221 | 222 | # Recycle Bin used on file shares 223 | $RECYCLE.BIN/ 224 | 225 | # Windows Installer files 226 | *.cab 227 | *.msi 228 | *.msm 229 | *.msp 230 | 231 | # Windows shortcuts 232 | *.lnk 233 | /TestProject/output 234 | /TestProject/build 235 | /Output 236 | *.cs.old 237 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/ObjectOrientedScripting.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CF84C111-A032-4014-B391-640F9F144F0A}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wrapper", "Wrapper\Wrapper.csproj", "{A3B85D87-D67F-4C01-94A2-379CCA4EA094}" 9 | ProjectSection(ProjectDependencies) = postProject 10 | {AB1BED91-BEDF-485C-B697-2D0DB1DC7D47} = {AB1BED91-BEDF-485C-B697-2D0DB1DC7D47} 11 | EndProjectSection 12 | EndProject 13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Compiler", "Compiler\Compiler.csproj", "{E8FB7167-440C-4708-A884-3D674EFD6179}" 14 | ProjectSection(ProjectDependencies) = postProject 15 | {A3B85D87-D67F-4C01-94A2-379CCA4EA094} = {A3B85D87-D67F-4C01-94A2-379CCA4EA094} 16 | {AB1BED91-BEDF-485C-B697-2D0DB1DC7D47} = {AB1BED91-BEDF-485C-B697-2D0DB1DC7D47} 17 | EndProjectSection 18 | EndProject 19 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Concept", "Concept", "{5D8F86FF-A0FB-4916-A9EA-330753451618}" 20 | ProjectSection(SolutionItems) = preProject 21 | ..\Concept\example.def = ..\Concept\example.def 22 | ..\Concept\example.oos = ..\Concept\example.oos 23 | ..\Concept\example.oosproj = ..\Concept\example.oosproj 24 | ..\Concept\example.sqf = ..\Concept\example.sqf 25 | ..\Concept\objectOrientedSQF.txt = ..\Concept\objectOrientedSQF.txt 26 | ..\Concept\oos.ebnf = ..\Concept\oos.ebnf 27 | EndProjectSection 28 | EndProject 29 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logger", "Logger\Logger.csproj", "{AB1BED91-BEDF-485C-B697-2D0DB1DC7D47}" 30 | EndProject 31 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "work", "work", "{F883BE8F-A145-4D8C-84A0-77F968C34A79}" 32 | ProjectSection(SolutionItems) = preProject 33 | ..\TestProject\cBar.oos = ..\TestProject\cBar.oos 34 | ..\TestProject\cFoo.oos = ..\TestProject\cFoo.oos 35 | ..\TestProject\test.def = ..\TestProject\test.def 36 | ..\TestProject\test.oos = ..\TestProject\test.oos 37 | ..\TestProject\test.oosproj = ..\TestProject\test.oosproj 38 | EndProjectSection 39 | EndProject 40 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WrapperUI", "WrapperUI\WrapperUI.csproj", "{3DD117A7-39B4-40B7-9EF3-CF54B28B107E}" 41 | EndProject 42 | Global 43 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 44 | Debug|Any CPU = Debug|Any CPU 45 | Release|Any CPU = Release|Any CPU 46 | EndGlobalSection 47 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 48 | {A3B85D87-D67F-4C01-94A2-379CCA4EA094}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 49 | {A3B85D87-D67F-4C01-94A2-379CCA4EA094}.Debug|Any CPU.Build.0 = Debug|Any CPU 50 | {A3B85D87-D67F-4C01-94A2-379CCA4EA094}.Release|Any CPU.ActiveCfg = Release|Any CPU 51 | {A3B85D87-D67F-4C01-94A2-379CCA4EA094}.Release|Any CPU.Build.0 = Release|Any CPU 52 | {E8FB7167-440C-4708-A884-3D674EFD6179}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 53 | {E8FB7167-440C-4708-A884-3D674EFD6179}.Debug|Any CPU.Build.0 = Debug|Any CPU 54 | {E8FB7167-440C-4708-A884-3D674EFD6179}.Release|Any CPU.ActiveCfg = Release|Any CPU 55 | {E8FB7167-440C-4708-A884-3D674EFD6179}.Release|Any CPU.Build.0 = Release|Any CPU 56 | {AB1BED91-BEDF-485C-B697-2D0DB1DC7D47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 57 | {AB1BED91-BEDF-485C-B697-2D0DB1DC7D47}.Debug|Any CPU.Build.0 = Debug|Any CPU 58 | {AB1BED91-BEDF-485C-B697-2D0DB1DC7D47}.Release|Any CPU.ActiveCfg = Release|Any CPU 59 | {AB1BED91-BEDF-485C-B697-2D0DB1DC7D47}.Release|Any CPU.Build.0 = Release|Any CPU 60 | {3DD117A7-39B4-40B7-9EF3-CF54B28B107E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 61 | {3DD117A7-39B4-40B7-9EF3-CF54B28B107E}.Debug|Any CPU.Build.0 = Debug|Any CPU 62 | {3DD117A7-39B4-40B7-9EF3-CF54B28B107E}.Release|Any CPU.ActiveCfg = Release|Any CPU 63 | {3DD117A7-39B4-40B7-9EF3-CF54B28B107E}.Release|Any CPU.Build.0 = Release|Any CPU 64 | EndGlobalSection 65 | GlobalSection(SolutionProperties) = preSolution 66 | HideSolutionNode = FALSE 67 | EndGlobalSection 68 | GlobalSection(NestedProjects) = preSolution 69 | {A3B85D87-D67F-4C01-94A2-379CCA4EA094} = {CF84C111-A032-4014-B391-640F9F144F0A} 70 | {E8FB7167-440C-4708-A884-3D674EFD6179} = {CF84C111-A032-4014-B391-640F9F144F0A} 71 | {5D8F86FF-A0FB-4916-A9EA-330753451618} = {CF84C111-A032-4014-B391-640F9F144F0A} 72 | {AB1BED91-BEDF-485C-B697-2D0DB1DC7D47} = {CF84C111-A032-4014-B391-640F9F144F0A} 73 | {F883BE8F-A145-4D8C-84A0-77F968C34A79} = {CF84C111-A032-4014-B391-640F9F144F0A} 74 | {3DD117A7-39B4-40B7-9EF3-CF54B28B107E} = {CF84C111-A032-4014-B391-640F9F144F0A} 75 | EndGlobalSection 76 | EndGlobal 77 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/WrapperUI/WrapperUI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {3DD117A7-39B4-40B7-9EF3-CF54B28B107E} 8 | WinExe 9 | Properties 10 | WrapperUI 11 | WrapperUI 12 | v4.5 13 | 512 14 | publish\ 15 | true 16 | Disk 17 | false 18 | Foreground 19 | 7 20 | Days 21 | false 22 | false 23 | true 24 | 0 25 | 0.7.2.%2a 26 | false 27 | false 28 | true 29 | 30 | 31 | AnyCPU 32 | true 33 | full 34 | false 35 | bin\Debug\ 36 | DEBUG;TRACE 37 | prompt 38 | 4 39 | 40 | 41 | AnyCPU 42 | pdbonly 43 | true 44 | bin\Release\ 45 | TRACE 46 | prompt 47 | 4 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | Form 64 | 65 | 66 | Form1.cs 67 | 68 | 69 | 70 | 71 | Form1.cs 72 | 73 | 74 | ResXFileCodeGenerator 75 | Resources.Designer.cs 76 | Designer 77 | 78 | 79 | True 80 | Resources.resx 81 | 82 | 83 | SettingsSingleFileGenerator 84 | Settings.Designer.cs 85 | 86 | 87 | True 88 | Settings.settings 89 | True 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | {a3b85d87-d67f-4c01-94a2-379cca4ea094} 98 | Wrapper 99 | 100 | 101 | 102 | 103 | False 104 | Microsoft .NET Framework 4.5 %28x86 and x64%29 105 | true 106 | 107 | 108 | False 109 | .NET Framework 3.5 SP1 110 | false 111 | 112 | 113 | 114 | 121 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/enums.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Compiler.OOS_LanguageObjects 8 | { 9 | public enum Encapsulation 10 | { 11 | Private, 12 | Protected, 13 | Public, 14 | Static, 15 | NA 16 | } 17 | public enum VarType 18 | { 19 | Scalar, 20 | Bool, 21 | Auto, 22 | Void, 23 | Object, 24 | NullObject, 25 | Other, 26 | ScalarArray, 27 | BoolArray, 28 | StringArray 29 | } 30 | public enum OverridableOperator 31 | { 32 | ArrayAccess, 33 | LessThenLessThen, 34 | GreaterThenGreaterThen, 35 | ExplicitEquals 36 | } 37 | public enum AssignmentCharacters 38 | { 39 | SimpleAssign, // = 40 | PlusOne, // ++ 41 | MinusOne, // -- 42 | AdditionAssign, // += 43 | SubstractionAssign, // -= 44 | MultiplicationAssign, // *= 45 | DivisionAssign // /= 46 | } 47 | public class VarTypeObject : Interfaces.iTemplate 48 | { 49 | private Template template; 50 | 51 | 52 | public Template TemplateObject 53 | { 54 | get { return this.template; } 55 | set { if (value != null) this.template = value; } 56 | } 57 | public bool IsObject { get { return this.varType == VarType.Object; } } 58 | public bool IsArray { get { return this.varType == VarType.BoolArray || this.varType == VarType.ScalarArray || this.varType == VarType.StringArray; } } 59 | public VarTypeObject(Ident i, Template template = null) 60 | { 61 | this.ident = i; 62 | this.varType = VarType.Object; 63 | this.template = template; 64 | 65 | if (this.template == null && (this.ident.ReferencedObject is Interfaces.iTemplate)) 66 | { 67 | this.template = ((Interfaces.iTemplate)this.ident.ReferencedObject).TemplateObject; 68 | } 69 | } 70 | public VarTypeObject(VarType v) 71 | { 72 | this.ident = null; 73 | this.varType = v; 74 | if (v == VarType.Object) 75 | throw new Exception("Not possible! Please create a new ident refering to ::object"); 76 | template = null; 77 | //TODO: Allow anonymous objects 78 | } 79 | public VarTypeObject(VarTypeObject vto) 80 | { 81 | this.ident = vto.ident; 82 | this.varType = vto.varType; 83 | template = vto.template; 84 | } 85 | public void copyFrom(VarTypeObject vto) 86 | { 87 | this.ident = vto.ident; 88 | this.varType = vto.varType; 89 | template = vto.template; 90 | } 91 | public Ident ident; 92 | public VarType varType; 93 | public override bool Equals(object obj) 94 | { 95 | if (obj is HelperClasses.NamespaceResolver) 96 | { 97 | if (!this.IsObject) 98 | return false; 99 | HelperClasses.NamespaceResolver nsrL = this.ident.LastIdent; 100 | HelperClasses.NamespaceResolver nsrR = (HelperClasses.NamespaceResolver)obj; 101 | if (nsrL != null && nsrR != null) 102 | return nsrL.isSame(nsrR); 103 | else 104 | return ((VarTypeObject)obj).ident.FullyQualifiedName.Equals(this.ident.FullyQualifiedName); 105 | } 106 | else 107 | { 108 | if (!(obj is VarTypeObject)) 109 | return false; 110 | if (((VarTypeObject)obj).varType != this.varType) 111 | return false; 112 | if (this.varType != VarType.Object) 113 | return true; 114 | HelperClasses.NamespaceResolver nsrL = this.ident.LastIdent; 115 | HelperClasses.NamespaceResolver nsrR = ((VarTypeObject)obj).ident.LastIdent; 116 | if (nsrL != null && nsrR != null) 117 | return nsrL.isSame(nsrR); 118 | else 119 | return ((VarTypeObject)obj).ident.FullyQualifiedName.Equals(this.ident.FullyQualifiedName); 120 | } 121 | } 122 | public bool IsKindOf(VarTypeObject vto) 123 | { 124 | if (this.varType != VarType.Object) 125 | return false; 126 | HelperClasses.NamespaceResolver nsrL = this.ident.LastIdent; 127 | HelperClasses.NamespaceResolver nsrR = vto.ident.LastIdent; 128 | if (!(nsrL.Reference is Interfaces.iClass)) 129 | return false; 130 | if (!(nsrR.Reference is Interfaces.iClass)) 131 | return false; 132 | var list = new List(); 133 | list.AddRange(((Interfaces.iClass)nsrL.Reference).ExtendedClasses); 134 | list.Add(((Interfaces.iClass)nsrL.Reference).Name); 135 | foreach(var it in list) 136 | { 137 | HelperClasses.NamespaceResolver nsrTmp = it.LastIdent; 138 | if (nsrTmp.isSame(nsrR)) 139 | return true; 140 | } 141 | return false; 142 | } 143 | public override int GetHashCode() { return base.GetHashCode(); } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/WrapperUI/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /coco/Parser.frame: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------- 2 | Compiler Generator Coco/R, 3 | Copyright (c) 1990, 2004 Hanspeter Moessenboeck, University of Linz 4 | extended by M. Loeberbauer & A. Woess, Univ. of Linz 5 | with improvements by Pat Terry, Rhodes University 6 | 7 | This program is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any 10 | later version. 11 | 12 | This program is distributed in the hope that it will be useful, but 13 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | for more details. 16 | 17 | You should have received a copy of the GNU General Public License along 18 | with this program; if not, write to the Free Software Foundation, Inc., 19 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | 21 | As an exception, it is allowed to write an extension of Coco/R that is 22 | used as a plugin in non-free software. 23 | 24 | If not otherwise stated, any source code generated by Coco/R (other than 25 | Coco/R itself) does not fall under the GNU General Public License. 26 | ----------------------------------------------------------------------*/ 27 | -->begin 28 | using System; 29 | 30 | -->namespace 31 | 32 | public class Parser { 33 | -->constants 34 | const bool _T = true; 35 | const bool _x = false; 36 | const int minErrDist = 2; 37 | 38 | public Scanner scanner; 39 | public string file; 40 | public Errors errors; 41 | 42 | public Token t; // last recognized token 43 | public Token la; // lookahead token 44 | int errDist = minErrDist; 45 | 46 | -->declarations 47 | 48 | public Base BaseObject { get; set;} 49 | 50 | public Parser(Scanner scanner, string file) { 51 | this.scanner = scanner; 52 | this.file = file; 53 | errors = new Errors(); 54 | } 55 | public static List UsedFiles = new List(); 56 | 57 | bool peekCompare(params int[] values) 58 | { 59 | Token t = la; 60 | foreach(int i in values) 61 | { 62 | if(i != -1 && t.kind != i) 63 | { 64 | scanner.ResetPeek(); 65 | return false; 66 | } 67 | if (t.next == null) 68 | t = scanner.Peek(); 69 | else 70 | t = t.next; 71 | } 72 | scanner.ResetPeek(); 73 | return true; 74 | } 75 | bool peekString(int count, params string[] values) 76 | { 77 | Token t = la; 78 | for(; count > 0; count --) 79 | t = scanner.Peek(); 80 | foreach(var it in values) 81 | { 82 | if(t.val == it) 83 | { 84 | scanner.ResetPeek(); 85 | return true; 86 | } 87 | } 88 | scanner.ResetPeek(); 89 | return false; 90 | } 91 | 92 | 93 | void SynErr (int n) { 94 | if (errDist >= minErrDist) errors.SynErr(la.line, la.col, n); 95 | errDist = 0; 96 | } 97 | void Warning (string msg) { 98 | errors.Warning(la.line, la.col, msg); 99 | } 100 | 101 | public void SemErr (string msg) { 102 | if (errDist >= minErrDist) errors.SemErr(t.line, t.col, msg); 103 | errDist = 0; 104 | } 105 | 106 | void Get () { 107 | for (;;) { 108 | t = la; 109 | la = scanner.Scan(); 110 | if (la.kind <= maxT) { ++errDist; break; } 111 | -->pragmas 112 | la = t; 113 | } 114 | } 115 | 116 | void Expect (int n) { 117 | if (la.kind==n) Get(); else { SynErr(n); } 118 | } 119 | 120 | bool StartOf (int s) { 121 | return set[s, la.kind]; 122 | } 123 | 124 | void ExpectWeak (int n, int follow) { 125 | if (la.kind == n) Get(); 126 | else { 127 | SynErr(n); 128 | while (!StartOf(follow)) Get(); 129 | } 130 | } 131 | 132 | 133 | bool WeakSeparator(int n, int syFol, int repFol) { 134 | int kind = la.kind; 135 | if (kind == n) {Get(); return true;} 136 | else if (StartOf(repFol)) {return false;} 137 | else { 138 | SynErr(n); 139 | while (!(set[syFol, kind] || set[repFol, kind] || set[0, kind])) { 140 | Get(); 141 | kind = la.kind; 142 | } 143 | return StartOf(syFol); 144 | } 145 | } 146 | 147 | 148 | -->productions 149 | 150 | public void Parse() { 151 | la = new Token(); 152 | la.val = ""; 153 | Get(); 154 | -->parseRoot 155 | } 156 | 157 | static readonly bool[,] set = { 158 | -->initialization 159 | }; 160 | } // end Parser 161 | 162 | 163 | public class Errors { 164 | public int count = 0; // number of errors detected 165 | public System.IO.TextWriter errorStream = Console.Out; // error messages go to this stream 166 | public string errMsgFormat = "line {0} col {1}: {2}"; // 0=line, 1=column, 2=text 167 | 168 | public virtual void SynErr (int line, int col, int n) { 169 | string s; 170 | switch (n) { 171 | -->errors 172 | default: s = "error " + n; break; 173 | } 174 | Logger.Instance.log(Logger.LogLevel.ERROR, String.Format(errMsgFormat, line, col, s)); 175 | //errorStream.WriteLine(errMsgFormat, line, col, s); 176 | count++; 177 | } 178 | 179 | public virtual void SemErr (int line, int col, string s) { 180 | Logger.Instance.log(Logger.LogLevel.ERROR, String.Format(errMsgFormat, line, col, s)); 181 | //errorStream.WriteLine(errMsgFormat, line, col, s); 182 | count++; 183 | } 184 | 185 | public virtual void SemErr (string s) { 186 | Logger.Instance.log(Logger.LogLevel.ERROR, s); 187 | //errorStream.WriteLine(s); 188 | count++; 189 | } 190 | 191 | public virtual void Warning (int line, int col, string s) { 192 | Logger.Instance.log(Logger.LogLevel.WARNING, String.Format(errMsgFormat, line, col, s)); 193 | //errorStream.WriteLine(errMsgFormat, line, col, s); 194 | } 195 | 196 | public virtual void Warning(string s) { 197 | Logger.Instance.log(Logger.LogLevel.WARNING, s); 198 | //errorStream.WriteLine(s); 199 | } 200 | } // Errors 201 | 202 | 203 | public class FatalError: Exception { 204 | public FatalError(string m): base(m) {} 205 | } 206 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/Compiler/OOS/LanguageObjects/ArrayAccess.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | 8 | namespace Compiler.OOS_LanguageObjects 9 | { 10 | public class ArrayAccess : pBaseLangObject 11 | { 12 | 13 | public ArrayAccess(pBaseLangObject parent) : base(parent) { } 14 | public override int doFinalize() 15 | { 16 | int errCount = 0; 17 | foreach(var it in this.getAllChildrenOf()) 18 | { 19 | if(it.ReferencedType.varType != VarType.Scalar) 20 | { 21 | Logger.Instance.log(Logger.LogLevel.ERROR, ErrorStringResolver.resolve(ErrorStringResolver.LinkerErrorCode.LNK0050, it.Line, it.Pos, it.File)); 22 | errCount++; 23 | } 24 | } 25 | return errCount; 26 | } 27 | public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg) 28 | { 29 | if(this.Parent is Ident) 30 | { 31 | var parentIdent = (Ident)this.Parent; 32 | if(parentIdent.ReferencedObject is Variable) 33 | { 34 | var variable = (Variable)parentIdent.ReferencedObject; 35 | bool printSelect = true; 36 | if(variable.ReferencedType.IsObject) 37 | { 38 | if (variable.ReferencedType.ident.ReferencedObject is Interfaces.iClass) 39 | { 40 | var c = (Interfaces.iClass)variable.ReferencedType.ident.ReferencedObject; 41 | var fnc = c.getOperatorFunction(OverridableOperator.ArrayAccess); 42 | if (fnc != null) 43 | { 44 | printSelect = false; 45 | string variableName = ((Ident)this.Parent).WriteOutValue; 46 | #region Copied from FunctionCall 47 | 48 | bool flag = false; 49 | if (fnc is NativeInstruction) 50 | { 51 | var nIns = (NativeInstruction)fnc; 52 | List stringList = new List(); 53 | stringList.Add(variableName); 54 | foreach (var it in this.children) 55 | { 56 | using (MemoryStream memStream = new MemoryStream()) 57 | { 58 | StreamWriter memStreamWriter = new StreamWriter(memStream); 59 | it.writeOut(memStreamWriter, cfg); 60 | memStreamWriter.Flush(); 61 | memStream.Seek(0, SeekOrigin.Begin); 62 | stringList.Add(new StreamReader(memStream).ReadToEnd()); 63 | } 64 | } 65 | sw.Write(nIns.getCode(stringList.ToArray())); 66 | } 67 | else 68 | { 69 | if (fnc.FunctionEncapsulation == Encapsulation.Static || fnc.IsConstructor) 70 | { 71 | sw.Write('['); 72 | } 73 | else 74 | { 75 | sw.Write('[' + variableName); 76 | flag = true; 77 | } 78 | foreach (var it in this.children) 79 | { 80 | if (flag) 81 | sw.Write(", "); 82 | else 83 | flag = true; 84 | it.writeOut(sw, cfg); 85 | } 86 | if (fnc is Function) 87 | { 88 | if (fnc.FunctionEncapsulation == Encapsulation.Static || fnc.IsConstructor) 89 | { 90 | sw.Write(']' + " call " + ((Function)fnc).SqfVariableName); 91 | } 92 | else 93 | { 94 | sw.Write(']' + " call " + '(' + variableName + ')' + ((Function)fnc).SqfVariableName); 95 | } 96 | } 97 | else 98 | { 99 | throw new Exception(); 100 | } 101 | } 102 | #endregion 103 | } 104 | } 105 | } 106 | if (printSelect) 107 | { 108 | bool flag = false; 109 | if (this.getFirstOf(false, typeof(Ident)) != null) 110 | flag = true; 111 | //if(((Ident)this.Parent).HasCallWrapper) 112 | //{ 113 | sw.Write((flag ? "(" : "") + ((Ident)this.Parent).WriteOutValue); 114 | //} 115 | sw.Write(" select "); 116 | foreach(var it in this.children) 117 | { 118 | it.writeOut(sw, cfg); 119 | } 120 | if (flag) 121 | sw.Write(')'); 122 | } 123 | } 124 | } 125 | else 126 | { 127 | throw new Exception(); 128 | } 129 | } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /ObjectOrientedScripting/WrapperUI/Form1.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | 186, 17 125 | 126 | 127 | 326, 17 128 | 129 | --------------------------------------------------------------------------------