1 module as; 2 import as.def; 3 import std..string; 4 public import as.engine; 5 public import as.mod; 6 public import as.func; 7 public import as.context; 8 public import as.tinf; 9 public import as.obj; 10 11 /** 12 Gets the version of the angelscript library 13 */ 14 string getLibraryVersion() { 15 return cast(string)asGetLibraryVersion().fromStringz; 16 } 17 18 /** 19 Gets the library options of the angelscript library 20 */ 21 string getLibraryOptions() { 22 return cast(string)asGetLibraryOptions().fromStringz; 23 } 24 25 /** 26 Shorthand for CallConv.CDecl 27 */ 28 enum CDECL = CallConv.CDecl; 29 30 /** 31 Shorthand for CallConv.DDecl 32 */ 33 enum DCall = CallConv.DDecl; 34 35 /** 36 Shorthand for CallConv.DDeclObjLast 37 */ 38 enum DCallObjLast = CallConv.DDeclObjLast; 39 40 /** 41 Shorthand for CallConv.DDeclObjFirst 42 */ 43 enum DCallObjFirst = CallConv.DDeclObjFirst; 44 45 /** 46 All the error codes AngelScript can return 47 */ 48 enum ReturnCodes : asERetCodes { 49 Success = asERetCodes.asSUCCESS, 50 Error = asERetCodes.asERROR, 51 ContextActive = asERetCodes.asCONTEXT_ACTIVE, 52 ContextNotFinished = asERetCodes.asCONTEXT_NOT_FINISHED, 53 ContextNotPrepared = asERetCodes.asCONTEXT_NOT_PREPARED, 54 InvalidArg = asERetCodes.asINVALID_ARG, 55 NoFunction = asERetCodes.asNO_FUNCTION, 56 NotSupported = asERetCodes.asNOT_SUPPORTED, 57 InvalidName = asERetCodes.asINVALID_NAME, 58 NameTaken = asERetCodes.asNAME_TAKEN, 59 InvalidDeclaration = asERetCodes.asINVALID_DECLARATION, 60 InvalidObject = asERetCodes.asINVALID_OBJECT, 61 InvalidType = asERetCodes.asINVALID_TYPE, 62 AlreadyRegistered = asERetCodes.asALREADY_REGISTERED, 63 MultipleFunctions = asERetCodes.asMULTIPLE_FUNCTIONS, 64 NoModule = asERetCodes.asNO_MODULE, 65 NoGlobalVar = asERetCodes.asNO_GLOBAL_VAR, 66 InvalidConfiguration = asERetCodes.asINVALID_CONFIGURATION, 67 InvalidInterface = asERetCodes.asINVALID_INTERFACE, 68 CantBindAllFunctions = asERetCodes.asCANT_BIND_ALL_FUNCTIONS, 69 LowerArrayDimensionNotRegistered = asERetCodes.asLOWER_ARRAY_DIMENSION_NOT_REGISTERED, 70 WrongConfigGroup = asERetCodes.asWRONG_CONFIG_GROUP, 71 ConfigGroupInUse = asERetCodes.asCONFIG_GROUP_IS_IN_USE, 72 IllegalBehaviourForType = asERetCodes.asILLEGAL_BEHAVIOUR_FOR_TYPE, 73 WrongCallingConv = asERetCodes.asWRONG_CALLING_CONV, 74 BuildInProgress = asERetCodes.asBUILD_IN_PROGRESS, 75 InitGlobalVarsFailed = asERetCodes.asINIT_GLOBAL_VARS_FAILED, 76 OutOfMemory = asERetCodes.asOUT_OF_MEMORY, 77 ModuleInUse = asERetCodes.asMODULE_IS_IN_USE 78 } 79 80 /** 81 The type of a message 82 */ 83 enum MessageType { 84 85 /** 86 An info message 87 */ 88 Info = asEMsgType.asMSGTYPE_INFORMATION, 89 90 /** 91 A warning message 92 */ 93 Warning = asEMsgType.asMSGTYPE_WARNING, 94 95 /** 96 An error message 97 */ 98 Error = asEMsgType.asMSGTYPE_ERROR 99 } 100 101 alias MessageCallback = extern(C) void function(const(asSMessageInfo)*, void*); 102 alias NativeMessage = const(asSMessageInfo)*; 103 104 /** 105 Message info 106 */ 107 struct MessageInfo { 108 public: 109 this(const(asSMessageInfo)* info) { 110 this.section = info.section !is null ? cast(string)info.section.fromStringz : null; 111 this.row = info.row; 112 this.col = info.col; 113 this.type = cast(MessageType)info.type; 114 this.message = cast(string)info.message.fromStringz; 115 } 116 117 /** 118 The section the message occured at 119 */ 120 string section; 121 122 /** 123 The row the message occured at 124 */ 125 int row; 126 127 /** 128 The column the message occured at 129 */ 130 int col; 131 132 /** 133 The type of the message 134 */ 135 MessageType type; 136 137 /** 138 The message body 139 */ 140 string message; 141 }