misc/liblua/lopcodes.c
author nemo
Mon, 08 Dec 2014 09:35:14 -0500
changeset 10634 35d059bd0932
parent 10017 de822cd3df3a
permissions -rw-r--r--
Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     1
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     2
** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     3
** See Copyright Notice in lua.h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     4
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     5
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     6
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     7
#define lopcodes_c
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     8
#define LUA_CORE
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     9
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    10
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    11
#include "lopcodes.h"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    12
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    13
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    14
/* ORDER OP */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    15
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    16
const char *const luaP_opnames[NUM_OPCODES+1] = {
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    17
  "MOVE",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    18
  "LOADK",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    19
  "LOADBOOL",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    20
  "LOADNIL",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    21
  "GETUPVAL",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    22
  "GETGLOBAL",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    23
  "GETTABLE",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    24
  "SETGLOBAL",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    25
  "SETUPVAL",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    26
  "SETTABLE",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    27
  "NEWTABLE",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    28
  "SELF",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    29
  "ADD",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    30
  "SUB",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    31
  "MUL",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    32
  "DIV",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    33
  "MOD",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    34
  "POW",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    35
  "UNM",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    36
  "NOT",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    37
  "LEN",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    38
  "CONCAT",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    39
  "JMP",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    40
  "EQ",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    41
  "LT",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    42
  "LE",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    43
  "TEST",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    44
  "TESTSET",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    45
  "CALL",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    46
  "TAILCALL",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    47
  "RETURN",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    48
  "FORLOOP",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    49
  "FORPREP",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    50
  "TFORLOOP",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    51
  "SETLIST",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    52
  "CLOSE",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    53
  "CLOSURE",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    54
  "VARARG",
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    55
  NULL
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    56
};
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    57
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    58
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    59
#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    60
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    61
const lu_byte luaP_opmodes[NUM_OPCODES] = {
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    62
/*       T  A    B       C     mode        opcode   */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    63
  opmode(0, 1, OpArgR, OpArgN, iABC)        /* OP_MOVE */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    64
 ,opmode(0, 1, OpArgK, OpArgN, iABx)        /* OP_LOADK */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    65
 ,opmode(0, 1, OpArgU, OpArgU, iABC)        /* OP_LOADBOOL */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    66
 ,opmode(0, 1, OpArgR, OpArgN, iABC)        /* OP_LOADNIL */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    67
 ,opmode(0, 1, OpArgU, OpArgN, iABC)        /* OP_GETUPVAL */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    68
 ,opmode(0, 1, OpArgK, OpArgN, iABx)        /* OP_GETGLOBAL */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    69
 ,opmode(0, 1, OpArgR, OpArgK, iABC)        /* OP_GETTABLE */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    70
 ,opmode(0, 0, OpArgK, OpArgN, iABx)        /* OP_SETGLOBAL */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    71
 ,opmode(0, 0, OpArgU, OpArgN, iABC)        /* OP_SETUPVAL */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    72
 ,opmode(0, 0, OpArgK, OpArgK, iABC)        /* OP_SETTABLE */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    73
 ,opmode(0, 1, OpArgU, OpArgU, iABC)        /* OP_NEWTABLE */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    74
 ,opmode(0, 1, OpArgR, OpArgK, iABC)        /* OP_SELF */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    75
 ,opmode(0, 1, OpArgK, OpArgK, iABC)        /* OP_ADD */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    76
 ,opmode(0, 1, OpArgK, OpArgK, iABC)        /* OP_SUB */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    77
 ,opmode(0, 1, OpArgK, OpArgK, iABC)        /* OP_MUL */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    78
 ,opmode(0, 1, OpArgK, OpArgK, iABC)        /* OP_DIV */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    79
 ,opmode(0, 1, OpArgK, OpArgK, iABC)        /* OP_MOD */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    80
 ,opmode(0, 1, OpArgK, OpArgK, iABC)        /* OP_POW */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    81
 ,opmode(0, 1, OpArgR, OpArgN, iABC)        /* OP_UNM */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    82
 ,opmode(0, 1, OpArgR, OpArgN, iABC)        /* OP_NOT */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    83
 ,opmode(0, 1, OpArgR, OpArgN, iABC)        /* OP_LEN */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    84
 ,opmode(0, 1, OpArgR, OpArgR, iABC)        /* OP_CONCAT */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    85
 ,opmode(0, 0, OpArgR, OpArgN, iAsBx)       /* OP_JMP */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    86
 ,opmode(1, 0, OpArgK, OpArgK, iABC)        /* OP_EQ */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    87
 ,opmode(1, 0, OpArgK, OpArgK, iABC)        /* OP_LT */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    88
 ,opmode(1, 0, OpArgK, OpArgK, iABC)        /* OP_LE */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    89
 ,opmode(1, 1, OpArgR, OpArgU, iABC)        /* OP_TEST */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    90
 ,opmode(1, 1, OpArgR, OpArgU, iABC)        /* OP_TESTSET */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    91
 ,opmode(0, 1, OpArgU, OpArgU, iABC)        /* OP_CALL */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    92
 ,opmode(0, 1, OpArgU, OpArgU, iABC)        /* OP_TAILCALL */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    93
 ,opmode(0, 0, OpArgU, OpArgN, iABC)        /* OP_RETURN */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    94
 ,opmode(0, 1, OpArgR, OpArgN, iAsBx)       /* OP_FORLOOP */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    95
 ,opmode(0, 1, OpArgR, OpArgN, iAsBx)       /* OP_FORPREP */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    96
 ,opmode(1, 0, OpArgN, OpArgU, iABC)        /* OP_TFORLOOP */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    97
 ,opmode(0, 0, OpArgU, OpArgU, iABC)        /* OP_SETLIST */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    98
 ,opmode(0, 0, OpArgN, OpArgN, iABC)        /* OP_CLOSE */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    99
 ,opmode(0, 1, OpArgU, OpArgN, iABx)        /* OP_CLOSURE */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   100
 ,opmode(0, 1, OpArgU, OpArgN, iABC)        /* OP_VARARG */
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   101
};
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   102