home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 November / Chip_2002-11_cd1.bin / zkuste / delphi / kompon / d456 / CAJSCRPT.ZIP / ifps3 / ifps3common.pas < prev    next >
Pascal/Delphi Source File  |  2002-08-26  |  4KB  |  166 lines

  1. {
  2.   This unit contains constants used by the compiler and executer.
  3. }
  4. {$I ifps3_def.inc}
  5. unit ifps3common;
  6.  
  7. interface
  8.  
  9. const
  10.   {The name of the main proc }
  11.   IFPSMainProcName = '!MAIN';
  12. { The lowest supported build by the executer. }
  13.   IFPSLowBuildSupport = 12;
  14. { The current build of the compiler and executer. }
  15.   IFPSCurrentBuildNo = 17;
  16. { The current version of the script engine }
  17.   IFPSCurrentversion = '1.02';
  18. { The header of a compiled IFPS3 binary must start with this }
  19.   IFPSValidHeader = 1397769801;
  20. { Start of the positive stack }
  21.   IFPSAddrStackStart = 1610612736;
  22. { Start of the negative stack }
  23.   IFPSAddrNegativeStackStart = 1073741824;
  24. type
  25. { TIFPSBaseType is the most basic type -type }
  26.   TIFPSBaseType = Byte;
  27. @link(OnUseVariable)
  28.   TIFPSVariableType is used in TIFPSComp.OnUseVariable event }
  29.   TIFPSVariableType = (ivtGlobal, ivtParam, ivtVariable);
  30.  
  31. const
  32. { Executer internal type for return addresses, can not be used as a type }
  33.   btReturnAddress = 0;
  34. { A 1 byte unsigned integer (byte) }
  35.   btU8 = 1;
  36. { A 1 byte signed integer (Shortint) }
  37.   btS8 = 2;
  38. { A 2 byte unsigned integer (word) }
  39.   btU16 = 3;
  40. { A 2 byte signed integer (smallint) }
  41.   btS16 = 4;
  42. { A 4 byte unsigned integer (cardinal/longword) }
  43.   btU32 = 5;
  44. { A 4 byte signed integer (Integer/Longint) }
  45.   btS32 = 6;
  46. { A 4 byte float (single) }
  47.   btSingle = 7;
  48. { A 8 byte float (double) }
  49.   btDouble = 8;
  50. { A 10 byte float (extended) }
  51.   btExtended = 9;
  52. { A string }
  53.   btString = 10;
  54. { A record }
  55.   btRecord = 11;
  56. { An array}
  57.   btArray = 12;
  58. { A pointer }
  59.   btPointer = 13;
  60. { A PChar (internally the same as a string) }
  61.   btPChar = 14;
  62. { A resource pointer: Variable that can contain things from outside the script engine }
  63.   btResourcePointer = 15;
  64. { A variant }
  65.   btVariant = 16;
  66. {$IFNDEF NOINT64}
  67. { An 8 byte signed integer (int64) }
  68.   btS64 = 17;
  69. {$ENDIF}
  70. { Compile time class type; In IFPS3 external classes are not of one defined type (They could be anything from an integer to a pointer) }
  71.   btClass = 128;
  72. { Compile time enumeration; This will be a btu32 when compiled }
  73.   btEnum = 129;
  74. { Compile time procedural pointer (will be btu32 when compiled) }
  75.   btProcPtr = 130;
  76.  
  77.  
  78. { Make a hash of a string }
  79. function MakeHash(const s: string): Longint;
  80.  
  81. const
  82. { Script internal command: Assign command }
  83.   CM_A = 0;
  84. { Script internal command: Calculate Command }
  85.   CM_CA = 1;
  86. { Script internal command: Push}
  87.   CM_P = 2;
  88. { Script internal command: Push Var}
  89.   CM_PV = 3;
  90. { Script internal command: Pop}
  91.   CM_PO = 4;
  92. { Script internal command: Call}
  93.   Cm_C = 5;
  94. { Script internal command: Goto}
  95.   Cm_G = 6;
  96. { Script internal command: Conditional Goto}
  97.   Cm_CG = 7;
  98. { Script internal command: Conditional NOT Goto}
  99.   Cm_CNG = 8;
  100. { Script internal command: Ret}
  101.   Cm_R = 9;
  102. { Script internal command: Set Stack Type}
  103.   Cm_ST = 10;
  104. { Script internal command: Push Type}
  105.   Cm_Pt = 11;
  106. { Script internal command: Compare}
  107.   CM_CO = 12;
  108. { Script internal command: Call Var}
  109.   Cm_cv = 13;
  110. { Script internal command: Set Pointer}
  111.   cm_sp = 14;
  112. { Script internal command: Boolean NOT}
  113.   cm_bn = 15;
  114. { Script internal command: Var Minus}
  115.   cm_vm = 16;
  116. { Script internal command: Set Flag}
  117.   cm_sf = 17;
  118. { Script internal command: Flag Goto}
  119.   cm_fg = 18;
  120. { Script internal command: Push Exception Handler}
  121.   cm_puexh = 19;
  122. { Script internal command: Pop Exception Handler}
  123.   cmd_poexh = 20;
  124.  
  125.  
  126. type
  127. {Byte}
  128.   TbtU8 = Byte;
  129. {Shortint}
  130.   TbtS8 = ShortInt;
  131. {word}
  132.   TbtU16 = Word;
  133. {Smallint}
  134.   TbtS16 = SmallInt;
  135. {Cardinal/Longword}
  136.   TbtU32 = Cardinal;
  137. {Integer/Longint}
  138.   TbtS32 = Longint;
  139. {Single}
  140.   TbtSingle = Single;
  141. {Double}
  142.   TbtDouble = double;
  143. {Extended}
  144.   TbtExtended = Extended;
  145. {String/Pchar}
  146.   TbtString = string;
  147. {$IFNDEF NOINT64}
  148. { An 8 byte signed integer (int64) }
  149.   tbts64 = int64;
  150. {$ENDIF}
  151.  
  152. implementation
  153.  
  154. function MakeHash(const s: string): Longint;
  155. {small hash maker}
  156. var
  157.   I: Integer;
  158. begin
  159.   Result := 0;
  160.   for I := 1 to Length(s) do
  161.     Result := ((Result shl 7) or (Result shr 25)) + Ord(s[I]);
  162. end;
  163.  
  164. end.
  165.