1 /* Copyright (C) 2008-2011 GAMS Development and others 2 All Rights Reserved. 3 This code is published under the Eclipse Public License. 4 5 Author: Stefan Vigerske 6 7 WARNING: 8 The NL instruction (codes, format, semantics, etc.) are subject to change. 9 Thus, there is no warranty that a code based on this file is going to work fine 10 after changes in the GAMS I/O libraries as provided by GAMS. 11 GAMS is NOT obligated to issue a warning when it changes the NL instructions. 12 */ 13 14 #ifndef GAMSNLINSTR_H_ 15 #define GAMSNLINSTR_H_ 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 /** GAMS nonlinear expressions opcodes */ 22 typedef enum 23 { 24 nlNoOp = 0, /* no operation */ 25 nlPushV = 1, /* push variable */ 26 nlPushI = 2, /* push immediate (constant) */ 27 nlStore = 3, /* store row */ 28 nlAdd = 4, /* add */ 29 nlAddV = 5, /* add variable */ 30 nlAddI = 6, /* add immediate */ 31 nlSub = 7, /* minus */ 32 nlSubV = 8, /* subtract variable */ 33 nlSubI = 9, /* subtract immediate */ 34 nlMul = 10, /* multiply */ 35 nlMulV = 11, /* multiply variable */ 36 nlMulI = 12, /* multiply immediate */ 37 nlDiv = 13, /* divide */ 38 nlDivV = 14, /* divide variable */ 39 nlDivI = 15, /* divide immediate */ 40 nlUMin = 16, /* unary minus */ 41 nlUMinV = 17, /* unary minus variable */ 42 nlHeader = 18, /* header */ 43 nlEnd = 19, /* end of instruction list */ 44 nlCallArg1 = 20, 45 nlCallArg2 = 21, 46 nlCallArgN = 22, 47 nlFuncArgN = 23, 48 nlMulIAdd = 24, 49 nlPushZero = 25, 50 nlChk = 26, 51 nlAddO = 27, 52 nlPushO = 28, 53 nlInvoc = 29, 54 nlStackIn = 30, 55 MAXINS = 31 56 } GamsOpCode; 57 58 /** GAMS nonlinear expression opcode names as strings */ 59 #ifdef __GNUC__ 60 __attribute__((unused)) 61 #endif 62 static const char* GamsOpCodeName[MAXINS] = 63 { 64 "nlNoOp", 65 "nlPushV", 66 "nlPushI", 67 "nlStore", 68 "nlAdd", 69 "nlAddV", 70 "nlAddI", 71 "nlSub", 72 "nlSubV", 73 "nlSubI", 74 "nlMul", 75 "nlMulV", 76 "nlMulI", 77 "nlDiv", 78 "nlDivV", 79 "nlDivI", 80 "nlUMin", 81 "nlUMinV", 82 "nlHeader", 83 "nlEnd", 84 "nlCallArg1", 85 "nlCallArg2", 86 "nlCallArgN", 87 "nlFuncArgN", 88 "nlMulIAdd", 89 "nlPushZero", 90 "nlChk", 91 "nlAddO", 92 "nlPushO", 93 "nlInvoc", 94 "nlStackIn" 95 }; 96 97 /** GAMS nonlinear function codes */ 98 typedef enum 99 { 100 fnmapval=0,fnceil,fnfloor,fnround, 101 fnmod,fntrunc,fnsign,fnmin, 102 fnmax,fnsqr,fnexp,fnlog, 103 fnlog10,fnsqrt,fnabs,fncos, 104 fnsin,fnarctan,fnerrf,fndunfm, 105 fndnorm,fnpower,fnjdate,fnjtime, 106 fnjstart,fnjnow,fnerror,fngyear, 107 fngmonth,fngday,fngdow,fngleap, 108 fnghour,fngminute,fngsecond, 109 fncurseed,fntimest,fntimeco, 110 fntimeex,fntimecl,fnfrac,fnerrorl, 111 fnheaps,fnfact,fnunfmi,fnpi, 112 fnncpf,fnncpcm,fnentropy,fnsigmoid, 113 fnlog2,fnboolnot,fnbooland, 114 fnboolor,fnboolxor,fnboolimp, 115 fnbooleqv,fnrelopeq,fnrelopgt, 116 fnrelopge,fnreloplt,fnrelople, 117 fnrelopne,fnifthen,fnrpower, 118 fnedist,fndiv,fndiv0,fnsllog10, 119 fnsqlog10,fnslexp,fnsqexp,fnslrec, 120 fnsqrec,fncvpower,fnvcpower, 121 fncentropy,fngmillisec,fnmaxerror, 122 fntimeel,fngamma,fnloggamma,fnbeta, 123 fnlogbeta,fngammareg,fnbetareg, 124 fnsinh,fncosh,fntanh,fnmathlastrc, 125 fnmathlastec,fnmathoval,fnsignpower, 126 fnhandle,fnncpvusin,fnncpvupow, 127 fnbinomial,fnrehandle,fngamsver, 128 fndelhandle,fntan,fnarccos, 129 fnarcsin,fnarctan2,fnsleep,fnheapf, 130 fncohandle,fngamsrel,fnpoly, 131 fnlicensestatus,fnlicenselevel,fnheaplimit, 132 fndummy 133 } GamsFuncCode; 134 135 #ifdef __GNUC__ 136 __attribute__((unused)) 137 #endif 138 static const char* GamsFuncCodeName[fndummy+1] = 139 { 140 "mapval","ceil","floor","round", 141 "mod","trunc","sign","min", 142 "max","sqr","exp","log", 143 "log10","sqrt","abs","cos", 144 "sin","arctan","errf","dunfm", 145 "dnorm","power","jdate","jtime", 146 "jstart","jnow","error","gyear", 147 "gmonth","gday","gdow","gleap", 148 "ghour","gminute","gsecond", 149 "curseed","timest","timeco", 150 "timeex","timecl","frac","errorl", 151 "heaps","fact","unfmi","pi", 152 "ncpf","ncpcm","entropy","sigmoid", 153 "log2","boolnot","booland", 154 "boolor","boolxor","boolimp", 155 "booleqv","relopeq","relopgt", 156 "relopge","reloplt","relople", 157 "relopne","ifthen","rpower", 158 "edist","div","div0","sllog10", 159 "sqlog10","slexp","sqexp","slrec", 160 "sqrec","cvpower","vcpower", 161 "centropy","gmillisec","maxerror", 162 "timeel","gamma","loggamma","beta", 163 "logbeta","gammareg","betareg", 164 "sinh","cosh","tanh","mathlastrc", 165 "mathlastec","mathoval","signpower", 166 "handle","ncpvusin","ncpvupow", 167 "binomial","rehandle","gamsver", 168 "delhandle","tan","arccos", 169 "arcsin","arctan2","sleep","heapf", 170 "cohandle","gamsrel","poly", 171 "licensestatus","licenselevel","heaplimit", 172 "dummy" 173 }; 174 175 176 #ifdef __cplusplus 177 } 178 #endif 179 180 #endif /*GAMSNLINSTR_H_*/ 181