sourcepawn/compiler/amx.h
author javalia <javalia.javalia@gmail.com>
Mon Jul 04 15:26:08 2011 -0700 (2011-07-04)
changeset 3327 826d78be69ab
parent 1952 b7aa2b626807
permissions -rw-r--r--
Increase symbol name limit to 63 characters (bug 4564, r=dvander).
     1 /*  Pawn Abstract Machine (for the Pawn language)
     2  *
     3  *  Copyright (c) ITB CompuPhase, 1997-2006
     4  *
     5  *  This software is provided "as-is", without any express or implied warranty.
     6  *  In no event will the authors be held liable for any damages arising from
     7  *  the use of this software.
     8  *
     9  *  Permission is granted to anyone to use this software for any purpose,
    10  *  including commercial applications, and to alter it and redistribute it
    11  *  freely, subject to the following restrictions:
    12  *
    13  *  1.  The origin of this software must not be misrepresented; you must not
    14  *      claim that you wrote the original software. If you use this software in
    15  *      a product, an acknowledgment in the product documentation would be
    16  *      appreciated but is not required.
    17  *  2.  Altered source versions must be plainly marked as such, and must not be
    18  *      misrepresented as being the original software.
    19  *  3.  This notice may not be removed or altered from any source distribution.
    20  *
    21  *  Version: $Id$
    22  */
    23 
    24 #ifndef AMX_H_INCLUDED
    25 #define AMX_H_INCLUDED
    26 
    27 #include <stdlib.h>   /* for size_t */
    28 #include <limits.h>
    29 
    30 #if defined FREEBSD && !defined __FreeBSD__
    31   #define __FreeBSD__
    32 #endif
    33 #if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
    34   #include <sclinux.h>
    35 #endif
    36 
    37 #if defined __GNUC__
    38   #include <stdint.h>
    39   #if !defined HAVE_STDINT_H
    40     #define HAVE_STDINT_H
    41   #endif
    42 #elif !defined HAVE_STDINT_H
    43   #if defined __LCC__ || defined __DMC__ || defined LINUX || (defined __WATCOMC__ && __WATCOMC__ >= 1200)
    44     #if defined HAVE_INTTYPES_H
    45       #include <inttypes.h>
    46     #else
    47       #include <stdint.h>
    48     #endif
    49   #elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
    50     /* The ISO C99 defines the int16_t and int_32t types. If the compiler got
    51      * here, these types are probably undefined.
    52      */
    53     #if defined __MACH__
    54       #include <ppc/types.h>
    55       typedef unsigned short int  uint16_t;
    56       typedef unsigned long int   uint32_t;
    57     #elif defined __FreeBSD__
    58       #include <inttypes.h>
    59     #else
    60       typedef short int           int16_t;
    61       typedef unsigned short int  uint16_t;
    62       #if defined SN_TARGET_PS2
    63         typedef int               int32_t;
    64         typedef unsigned int      uint32_t;
    65       #else
    66         typedef long int          int32_t;
    67         typedef unsigned long int uint32_t;
    68       #endif
    69       #if defined __WIN32__ || defined _WIN32 || defined WIN32
    70         typedef __int64	          int64_t;
    71         typedef unsigned __int64  uint64_t;
    72         #define HAVE_I64
    73       #elif defined __GNUC__
    74         typedef long long         int64_t;
    75         typedef unsigned long long uint64_t;
    76         #define HAVE_I64
    77       #endif
    78     #endif
    79   #endif
    80   #define HAVE_STDINT_H
    81 #endif
    82 #if defined _LP64 || defined WIN64 || defined _WIN64
    83   #if !defined __64BIT__
    84     #define __64BIT__
    85   #endif
    86 #endif
    87 
    88 #if HAVE_ALLOCA_H
    89   #include <alloca.h>
    90 #endif
    91 #if defined __WIN32__ || defined _WIN32 || defined WIN32 /* || defined __MSDOS__ */
    92   #if !defined alloca
    93     #define alloca(n)   _alloca(n)
    94   #endif
    95 #endif
    96 
    97 #if !defined arraysize
    98   #define arraysize(array)  (sizeof(array) / sizeof((array)[0]))
    99 #endif
   100 #if !defined assert_static
   101   /* see "Compile-Time Assertions" by Ralf Holly,
   102    * C/C++ Users Journal, November 2004
   103    */
   104   #define assert_static(e) \
   105     do { \
   106       enum { assert_static__ = 1/(e) }; \
   107     } while (0)
   108 #endif
   109 
   110 #ifdef  __cplusplus
   111 extern  "C" {
   112 #endif
   113 
   114 #if defined PAWN_DLL
   115   #if !defined AMX_NATIVE_CALL
   116     #define AMX_NATIVE_CALL __stdcall
   117   #endif
   118   #if !defined AMXAPI
   119     #define AMXAPI          __stdcall
   120   #endif
   121 #endif
   122 
   123 /* calling convention for native functions */
   124 #if !defined AMX_NATIVE_CALL
   125   #define AMX_NATIVE_CALL
   126 #endif
   127 /* calling convention for all interface functions and callback functions */
   128 #if !defined AMXAPI
   129   #if defined STDECL
   130     #define AMXAPI      __stdcall
   131   #elif defined CDECL
   132     #define AMXAPI      __cdecl
   133   #elif defined GCC_HASCLASSVISIBILITY
   134     #define AMXAPI __attribute__ ((visibility("default")))
   135   #else
   136     #define AMXAPI
   137   #endif
   138 #endif
   139 #if !defined AMXEXPORT
   140   #define AMXEXPORT
   141 #endif
   142 
   143 /* File format version (in CUR_FILE_VERSION)
   144  *   0 (original version)
   145  *   1 (opcodes JUMP.pri, SWITCH and CASETBL)
   146  *   2 (compressed files)
   147  *   3 (public variables)
   148  *   4 (opcodes SWAP.pri/alt and PUSHADDR)
   149  *   5 (tagnames table)
   150  *   6 (reformatted header)
   151  *   7 (name table, opcodes SYMTAG & SYSREQ.D)
   152  *   8 (opcode STMT, renewed debug interface)
   153  *   9 (macro opcodes)
   154  * MIN_FILE_VERSION is the lowest file version number that the current AMX
   155  * implementation supports. If the AMX file header gets new fields, this number
   156  * often needs to be incremented. MAX_AMX_VERSION is the lowest AMX version that
   157  * is needed to support the current file version. When there are new opcodes,
   158  * this number needs to be incremented.
   159  * The file version supported by the JIT may run behind MIN_AMX_VERSION. So
   160  * there is an extra constant for it: MAX_FILE_VER_JIT.
   161  */
   162 #define CUR_FILE_VERSION  9     /* current file version; also the current AMX version */
   163 #define MIN_FILE_VERSION  6     /* lowest supported file format version for the current AMX version */
   164 #define MIN_AMX_VERSION   9     /* minimum AMX version needed to support the current file format */
   165 #define MAX_FILE_VER_JIT  8     /* file version supported by the JIT */
   166 #define MIN_AMX_VER_JIT   8     /* AMX version supported by the JIT */
   167 
   168 #if !defined PAWN_CELL_SIZE
   169   #define PAWN_CELL_SIZE 32     /* by default, use 32-bit cells */
   170 #endif
   171 #if PAWN_CELL_SIZE==16
   172   typedef uint16_t  ucell;
   173   typedef int16_t   cell;
   174 #elif PAWN_CELL_SIZE==32
   175   typedef uint32_t  ucell;
   176   typedef int32_t   cell;
   177 #elif PAWN_CELL_SIZE==64
   178   typedef uint64_t  ucell;
   179   typedef int64_t   cell;
   180 #else
   181   #error Unsupported cell size (PAWN_CELL_SIZE)
   182 #endif
   183 
   184 #define UNPACKEDMAX   (((cell)1 << (sizeof(cell)-1)*8) - 1)
   185 #define UNLIMITED     (~1u >> 1)
   186 
   187 struct tagAMX;
   188 typedef cell (AMX_NATIVE_CALL *AMX_NATIVE)(struct tagAMX *amx, cell *params);
   189 typedef int (AMXAPI *AMX_CALLBACK)(struct tagAMX *amx, cell index,
   190                                    cell *result, cell *params);
   191 typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
   192 typedef int (AMXAPI *AMX_IDLE)(struct tagAMX *amx, int AMXAPI Exec(struct tagAMX *, cell *, int));
   193 #if !defined _FAR
   194   #define _FAR
   195 #endif
   196 
   197 #if defined _MSC_VER
   198   #pragma warning(disable:4103)  /* disable warning message 4103 that complains
   199                                   * about pragma pack in a header file */
   200   #pragma warning(disable:4100)  /* "'%$S' : unreferenced formal parameter" */
   201 #endif
   202 
   203 /* Some compilers do not support the #pragma align, which should be fine. Some
   204  * compilers give a warning on unknown #pragmas, which is not so fine...
   205  */
   206 #if (defined SN_TARGET_PS2 || defined __GNUC__) && !defined AMX_NO_ALIGN
   207   #define AMX_NO_ALIGN
   208 #endif
   209 
   210 #if !defined AMX_NO_ALIGN
   211   #if defined LINUX || defined __FreeBSD__
   212     #pragma pack(1)         /* structures must be packed (byte-aligned) */
   213   #elif defined MACOS && defined __MWERKS__
   214 	#pragma options align=mac68k
   215   #else
   216     #pragma pack(push)
   217     #pragma pack(1)         /* structures must be packed (byte-aligned) */
   218     #if defined __TURBOC__
   219       #pragma option -a-    /* "pack" pragma for older Borland compilers */
   220     #endif
   221   #endif
   222 #endif
   223 
   224 typedef struct tagAMX_NATIVE_INFO {
   225   const char _FAR *name;
   226   AMX_NATIVE func;
   227 } AMX_NATIVE_INFO;
   228 
   229 #define AMX_USERNUM     4
   230 #define sEXPMAX         19      /* maximum name length for file version <= 6 */
   231 #define sNAMEMAX        63      /* maximum name length of symbol name */
   232 
   233 typedef struct tagAMX_FUNCSTUB {
   234   ucell address;
   235   char name[sEXPMAX+1];
   236 } AMX_FUNCSTUB;
   237 
   238 typedef struct tagFUNCSTUBNT {
   239   ucell address;
   240   uint32_t nameofs;
   241 } AMX_FUNCSTUBNT;
   242 
   243 /* The AMX structure is the internal structure for many functions. Not all
   244  * fields are valid at all times; many fields are cached in local variables.
   245  */
   246 typedef struct tagAMX {
   247   unsigned char _FAR *base; /* points to the AMX header plus the code, optionally also the data */
   248   unsigned char _FAR *data; /* points to separate data+stack+heap, may be NULL */
   249   AMX_CALLBACK callback;
   250   AMX_DEBUG debug       ; /* debug callback */
   251   /* for external functions a few registers must be accessible from the outside */
   252   cell cip              ; /* instruction pointer: relative to base + amxhdr->cod */
   253   cell frm              ; /* stack frame base: relative to base + amxhdr->dat */
   254   cell hea              ; /* top of the heap: relative to base + amxhdr->dat */
   255   cell hlw              ; /* bottom of the heap: relative to base + amxhdr->dat */
   256   cell stk              ; /* stack pointer: relative to base + amxhdr->dat */
   257   cell stp              ; /* top of the stack: relative to base + amxhdr->dat */
   258   int flags             ; /* current status, see amx_Flags() */
   259   /* user data */
   260   long usertags[AMX_USERNUM] ;
   261   void _FAR *userdata[AMX_USERNUM] ;
   262   /* native functions can raise an error */
   263   int error             ;
   264   /* passing parameters requires a "count" field */
   265   int paramcount;
   266   /* the sleep opcode needs to store the full AMX status */
   267   cell pri              ;
   268   cell alt              ;
   269   cell reset_stk        ;
   270   cell reset_hea        ;
   271   /* extra fields for increased performance */
   272   cell sysreq_d         ; /* relocated address/value for the SYSREQ.D opcode */
   273   #if defined JIT
   274     /* support variables for the JIT */
   275     int reloc_size      ; /* required temporary buffer for relocations */
   276     long code_size      ; /* estimated memory footprint of the native code */
   277   #endif
   278 } AMX;
   279 
   280 /* The AMX_HEADER structure is both the memory format as the file format. The
   281  * structure is used internaly.
   282  */
   283 typedef struct tagAMX_HEADER {
   284   int32_t size          ; /* size of the "file" */
   285   uint16_t magic        ; /* signature */
   286   char    file_version  ; /* file format version */
   287   char    amx_version   ; /* required version of the AMX */
   288   int16_t flags         ;
   289   int16_t defsize       ; /* size of a definition record */
   290   int32_t cod           ; /* initial value of COD - code block */
   291   int32_t dat           ; /* initial value of DAT - data block */
   292   int32_t hea           ; /* initial value of HEA - start of the heap */
   293   int32_t stp           ; /* initial value of STP - stack top */
   294   int32_t cip           ; /* initial value of CIP - the instruction pointer */
   295   int32_t publics       ; /* offset to the "public functions" table */
   296   int32_t natives       ; /* offset to the "native functions" table */
   297   int32_t libraries     ; /* offset to the table of libraries */
   298   int32_t pubvars       ; /* the "public variables" table */
   299   int32_t tags          ; /* the "public tagnames" table */
   300   int32_t nametable     ; /* name table */
   301 } AMX_HEADER;
   302 
   303 #if PAWN_CELL_SIZE==16
   304   #define AMX_MAGIC     0xf1e2
   305 #elif PAWN_CELL_SIZE==32
   306   #define AMX_MAGIC     0xf1e0
   307 #elif PAWN_CELL_SIZE==64
   308   #define AMX_MAGIC     0xf1e1
   309 #endif
   310 
   311 enum {
   312   AMX_ERR_NONE,
   313   /* reserve the first 15 error codes for exit codes of the abstract machine */
   314   AMX_ERR_EXIT,         /* forced exit */
   315   AMX_ERR_ASSERT,       /* assertion failed */
   316   AMX_ERR_STACKERR,     /* stack/heap collision */
   317   AMX_ERR_BOUNDS,       /* index out of bounds */
   318   AMX_ERR_MEMACCESS,    /* invalid memory access */
   319   AMX_ERR_INVINSTR,     /* invalid instruction */
   320   AMX_ERR_STACKLOW,     /* stack underflow */
   321   AMX_ERR_HEAPLOW,      /* heap underflow */
   322   AMX_ERR_CALLBACK,     /* no callback, or invalid callback */
   323   AMX_ERR_NATIVE,       /* native function failed */
   324   AMX_ERR_DIVIDE,       /* divide by zero */
   325   AMX_ERR_SLEEP,        /* go into sleepmode - code can be restarted */
   326   AMX_ERR_INVSTATE,     /* invalid state for this access */
   327 
   328   AMX_ERR_MEMORY = 16,  /* out of memory */
   329   AMX_ERR_FORMAT,       /* invalid file format */
   330   AMX_ERR_VERSION,      /* file is for a newer version of the AMX */
   331   AMX_ERR_NOTFOUND,     /* function not found */
   332   AMX_ERR_INDEX,        /* invalid index parameter (bad entry point) */
   333   AMX_ERR_DEBUG,        /* debugger cannot run */
   334   AMX_ERR_INIT,         /* AMX not initialized (or doubly initialized) */
   335   AMX_ERR_USERDATA,     /* unable to set user data field (table full) */
   336   AMX_ERR_INIT_JIT,     /* cannot initialize the JIT */
   337   AMX_ERR_PARAMS,       /* parameter error */
   338   AMX_ERR_DOMAIN,       /* domain error, expression result does not fit in range */
   339   AMX_ERR_GENERAL,      /* general error (unknown or unspecific error) */
   340 };
   341 
   342 /*      AMX_FLAG_CHAR16   0x01     no longer used */
   343 #define AMX_FLAG_DEBUG    0x02  /* symbolic info. available */
   344 #define AMX_FLAG_COMPACT  0x04  /* compact encoding */
   345 #define AMX_FLAG_SLEEP    0x08  /* script uses the sleep instruction (possible re-entry or power-down mode) */
   346 #define AMX_FLAG_NOCHECKS 0x10  /* no array bounds checking; no BREAK opcodes */
   347 #define AMX_FLAG_SYSREQN 0x800  /* script new (optimized) version of SYSREQ opcode */
   348 #define AMX_FLAG_NTVREG 0x1000  /* all native functions are registered */
   349 #define AMX_FLAG_JITC   0x2000  /* abstract machine is JIT compiled */
   350 #define AMX_FLAG_BROWSE 0x4000  /* busy browsing */
   351 #define AMX_FLAG_RELOC  0x8000  /* jump/call addresses relocated */
   352 
   353 #define AMX_EXEC_MAIN   (-1)    /* start at program entry point */
   354 #define AMX_EXEC_CONT   (-2)    /* continue from last address */
   355 
   356 #define AMX_USERTAG(a,b,c,d)    ((a) | ((b)<<8) | ((long)(c)<<16) | ((long)(d)<<24))
   357 
   358 #if !defined AMX_COMPACTMARGIN
   359   #define AMX_COMPACTMARGIN 64
   360 #endif
   361 
   362 /* for native functions that use floating point parameters, the following
   363  * two macros are convenient for casting a "cell" into a "float" type _without_
   364  * changing the bit pattern
   365  */
   366 #if PAWN_CELL_SIZE==32
   367   #define amx_ftoc(f)   ( * ((cell*)&f) )   /* float to cell */
   368   #define amx_ctof(c)   ( * ((float*)&c) )  /* cell to float */
   369 #elif PAWN_CELL_SIZE==64
   370   #define amx_ftoc(f)   ( * ((cell*)&f) )   /* float to cell */
   371   #define amx_ctof(c)   ( * ((double*)&c) ) /* cell to float */
   372 #else
   373   #error Unsupported cell size
   374 #endif
   375 
   376 #define amx_StrParam(amx,param,result)                                      \
   377     do {                                                                    \
   378       cell *amx_cstr_; int amx_length_;                                     \
   379       amx_GetAddr((amx), (param), &amx_cstr_);                              \
   380       amx_StrLen(amx_cstr_, &amx_length_);                                  \
   381       if (amx_length_ > 0 &&                                                \
   382           ((result) = (void*)alloca((amx_length_ + 1) * sizeof(*(result)))) != NULL) \
   383         amx_GetString((char*)(result), amx_cstr_, sizeof(*(result))>1, amx_length_ + 1); \
   384       else (result) = NULL;                                                 \
   385     } while (0)
   386 
   387 uint16_t * AMXAPI amx_Align16(uint16_t *v);
   388 uint32_t * AMXAPI amx_Align32(uint32_t *v);
   389 #if defined _I64_MAX || defined HAVE_I64
   390   uint64_t * AMXAPI amx_Align64(uint64_t *v);
   391 #endif
   392 int AMXAPI amx_Allot(AMX *amx, int cells, cell *amx_addr, cell **phys_addr);
   393 int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params);
   394 int AMXAPI amx_Cleanup(AMX *amx);
   395 int AMXAPI amx_Clone(AMX *amxClone, AMX *amxSource, void *data);
   396 int AMXAPI amx_Exec(AMX *amx, cell *retval, int index);
   397 int AMXAPI amx_FindNative(AMX *amx, const char *name, int *index);
   398 int AMXAPI amx_FindPublic(AMX *amx, const char *funcname, int *index);
   399 int AMXAPI amx_FindPubVar(AMX *amx, const char *varname, cell *amx_addr);
   400 int AMXAPI amx_FindTagId(AMX *amx, cell tag_id, char *tagname);
   401 int AMXAPI amx_Flags(AMX *amx,uint16_t *flags);
   402 int AMXAPI amx_GetAddr(AMX *amx,cell amx_addr,cell **phys_addr);
   403 int AMXAPI amx_GetNative(AMX *amx, int index, char *funcname);
   404 int AMXAPI amx_GetPublic(AMX *amx, int index, char *funcname);
   405 int AMXAPI amx_GetPubVar(AMX *amx, int index, char *varname, cell *amx_addr);
   406 int AMXAPI amx_GetString(char *dest,const cell *source, int use_wchar, size_t size);
   407 int AMXAPI amx_GetTag(AMX *amx, int index, char *tagname, cell *tag_id);
   408 int AMXAPI amx_GetUserData(AMX *amx, long tag, void **ptr);
   409 int AMXAPI amx_Init(AMX *amx, void *program);
   410 int AMXAPI amx_InitJIT(AMX *amx, void *reloc_table, void *native_code);
   411 int AMXAPI amx_MemInfo(AMX *amx, long *codesize, long *datasize, long *stackheap);
   412 int AMXAPI amx_NameLength(AMX *amx, int *length);
   413 AMX_NATIVE_INFO * AMXAPI amx_NativeInfo(const char *name, AMX_NATIVE func);
   414 int AMXAPI amx_NumNatives(AMX *amx, int *number);
   415 int AMXAPI amx_NumPublics(AMX *amx, int *number);
   416 int AMXAPI amx_NumPubVars(AMX *amx, int *number);
   417 int AMXAPI amx_NumTags(AMX *amx, int *number);
   418 int AMXAPI amx_Push(AMX *amx, cell value);
   419 int AMXAPI amx_PushArray(AMX *amx, cell *amx_addr, cell **phys_addr, const cell array[], int numcells);
   420 int AMXAPI amx_PushString(AMX *amx, cell *amx_addr, cell **phys_addr, const char *string, int pack, int use_wchar);
   421 int AMXAPI amx_RaiseError(AMX *amx, int error);
   422 int AMXAPI amx_Register(AMX *amx, const AMX_NATIVE_INFO *nativelist, int number);
   423 int AMXAPI amx_Release(AMX *amx, cell amx_addr);
   424 int AMXAPI amx_SetCallback(AMX *amx, AMX_CALLBACK callback);
   425 int AMXAPI amx_SetDebugHook(AMX *amx, AMX_DEBUG debug);
   426 int AMXAPI amx_SetString(cell *dest, const char *source, int pack, int use_wchar, size_t size);
   427 int AMXAPI amx_SetUserData(AMX *amx, long tag, void *ptr);
   428 int AMXAPI amx_StrLen(const cell *cstring, int *length);
   429 int AMXAPI amx_UTF8Check(const char *string, int *length);
   430 int AMXAPI amx_UTF8Get(const char *string, const char **endptr, cell *value);
   431 int AMXAPI amx_UTF8Len(const cell *cstr, int *length);
   432 int AMXAPI amx_UTF8Put(char *string, char **endptr, int maxchars, cell value);
   433 
   434 #if PAWN_CELL_SIZE==16
   435   #define amx_AlignCell(v) amx_Align16(v)
   436 #elif PAWN_CELL_SIZE==32
   437   #define amx_AlignCell(v) amx_Align32(v)
   438 #elif PAWN_CELL_SIZE==64 && (defined _I64_MAX || defined HAVE_I64)
   439   #define amx_AlignCell(v) amx_Align64(v)
   440 #else
   441   #error Unsupported cell size
   442 #endif
   443 
   444 #define amx_RegisterFunc(amx, name, func) \
   445   amx_Register((amx), amx_NativeInfo((name),(func)), 1);
   446 
   447 #if !defined AMX_NO_ALIGN
   448   #if defined LINUX || defined __FreeBSD__
   449     #pragma pack()    /* reset default packing */
   450   #elif defined MACOS && defined __MWERKS__
   451     #pragma options align=reset
   452   #else
   453     #pragma pack(pop) /* reset previous packing */
   454   #endif
   455 #endif
   456 
   457 #ifdef  __cplusplus
   458 }
   459 #endif
   460 
   461 typedef enum {
   462   OP_NONE,              /* invalid opcode */
   463   OP_LOAD_PRI,
   464   OP_LOAD_ALT,
   465   OP_LOAD_S_PRI,
   466   OP_LOAD_S_ALT,
   467   OP_LREF_PRI,
   468   OP_LREF_ALT,
   469   OP_LREF_S_PRI,
   470   OP_LREF_S_ALT,
   471   OP_LOAD_I,
   472   OP_LODB_I,
   473   OP_CONST_PRI,
   474   OP_CONST_ALT,
   475   OP_ADDR_PRI,
   476   OP_ADDR_ALT,
   477   OP_STOR_PRI,
   478   OP_STOR_ALT,
   479   OP_STOR_S_PRI,
   480   OP_STOR_S_ALT,
   481   OP_SREF_PRI,
   482   OP_SREF_ALT,
   483   OP_SREF_S_PRI,
   484   OP_SREF_S_ALT,
   485   OP_STOR_I,
   486   OP_STRB_I,
   487   OP_LIDX,
   488   OP_LIDX_B,
   489   OP_IDXADDR,
   490   OP_IDXADDR_B,
   491   OP_ALIGN_PRI,
   492   OP_ALIGN_ALT,
   493   OP_LCTRL,
   494   OP_SCTRL,
   495   OP_MOVE_PRI,
   496   OP_MOVE_ALT,
   497   OP_XCHG,
   498   OP_PUSH_PRI,
   499   OP_PUSH_ALT,
   500   OP_PUSH_R,
   501   OP_PUSH_C,
   502   OP_PUSH,
   503   OP_PUSH_S,
   504   OP_POP_PRI,
   505   OP_POP_ALT,
   506   OP_STACK,
   507   OP_HEAP,
   508   OP_PROC,
   509   OP_RET,
   510   OP_RETN,
   511   OP_CALL,
   512   OP_CALL_PRI,
   513   OP_JUMP,
   514   OP_JREL,
   515   OP_JZER,
   516   OP_JNZ,
   517   OP_JEQ,
   518   OP_JNEQ,
   519   OP_JLESS,
   520   OP_JLEQ,
   521   OP_JGRTR,
   522   OP_JGEQ,
   523   OP_JSLESS,
   524   OP_JSLEQ,
   525   OP_JSGRTR,
   526   OP_JSGEQ,
   527   OP_SHL,
   528   OP_SHR,
   529   OP_SSHR,
   530   OP_SHL_C_PRI,
   531   OP_SHL_C_ALT,
   532   OP_SHR_C_PRI,
   533   OP_SHR_C_ALT,
   534   OP_SMUL,
   535   OP_SDIV,
   536   OP_SDIV_ALT,
   537   OP_UMUL,
   538   OP_UDIV,
   539   OP_UDIV_ALT,
   540   OP_ADD,
   541   OP_SUB,
   542   OP_SUB_ALT,
   543   OP_AND,
   544   OP_OR,
   545   OP_XOR,
   546   OP_NOT,
   547   OP_NEG,
   548   OP_INVERT,
   549   OP_ADD_C,
   550   OP_SMUL_C,
   551   OP_ZERO_PRI,
   552   OP_ZERO_ALT,
   553   OP_ZERO,
   554   OP_ZERO_S,
   555   OP_SIGN_PRI,
   556   OP_SIGN_ALT,
   557   OP_EQ,
   558   OP_NEQ,
   559   OP_LESS,
   560   OP_LEQ,
   561   OP_GRTR,
   562   OP_GEQ,
   563   OP_SLESS,
   564   OP_SLEQ,
   565   OP_SGRTR,
   566   OP_SGEQ,
   567   OP_EQ_C_PRI,
   568   OP_EQ_C_ALT,
   569   OP_INC_PRI,
   570   OP_INC_ALT,
   571   OP_INC,
   572   OP_INC_S,
   573   OP_INC_I,
   574   OP_DEC_PRI,
   575   OP_DEC_ALT,
   576   OP_DEC,
   577   OP_DEC_S,
   578   OP_DEC_I,
   579   OP_MOVS,
   580   OP_CMPS,
   581   OP_FILL,
   582   OP_HALT,
   583   OP_BOUNDS,
   584   OP_SYSREQ_PRI,
   585   OP_SYSREQ_C,
   586   OP_FILE,    /* obsolete */
   587   OP_LINE,    /* obsolete */
   588   OP_SYMBOL,  /* obsolete */
   589   OP_SRANGE,  /* obsolete */
   590   OP_JUMP_PRI,
   591   OP_SWITCH,
   592   OP_CASETBL,
   593   OP_SWAP_PRI,
   594   OP_SWAP_ALT,
   595   OP_PUSH_ADR,
   596   OP_NOP,
   597   OP_SYSREQ_N,
   598   OP_SYMTAG,  /* obsolete */
   599   OP_BREAK,
   600   OP_PUSH2_C,
   601   OP_PUSH2,
   602   OP_PUSH2_S,
   603   OP_PUSH2_ADR,
   604   OP_PUSH3_C,
   605   OP_PUSH3,
   606   OP_PUSH3_S,
   607   OP_PUSH3_ADR,
   608   OP_PUSH4_C,
   609   OP_PUSH4,
   610   OP_PUSH4_S,
   611   OP_PUSH4_ADR,
   612   OP_PUSH5_C,
   613   OP_PUSH5,
   614   OP_PUSH5_S,
   615   OP_PUSH5_ADR,
   616   OP_LOAD_BOTH,
   617   OP_LOAD_S_BOTH,
   618   OP_CONST,
   619   OP_CONST_S,
   620   /* ----- */
   621   OP_SYSREQ_D,
   622   OP_SYSREQ_ND,
   623   /* ----- */
   624   OP_HEAP_I,
   625   OP_PUSH_H_C,
   626   OP_GENARRAY,
   627   OP_NUM_OPCODES
   628 } OPCODE;
   629 
   630 #endif /* AMX_H_INCLUDED */