| 133 | #include "table.h" |
| 134 | |
| 135 | const char * Tok2Cmdname(int tok) |
| 136 | { |
| 137 | if (tok < 0) |
| 138 | { |
| 139 | return cmds[0].name; |
| 140 | } |
| 141 | if (tok==COMMAND) return "command"; |
| 142 | if (tok==ANY_TYPE) return "any_type"; |
| 143 | if (tok==NONE) return "nothing"; |
| 144 | //if (tok==IFBREAK) return "if_break"; |
| 145 | //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys"; |
| 146 | //if (tok==ORDER_VECTOR) return "ordering"; |
| 147 | //if (tok==REF_VAR) return "ref"; |
| 148 | //if (tok==OBJECT) return "object"; |
| 149 | //if (tok==PRINT_EXPR) return "print_expr"; |
| 150 | if (tok==IDHDL) return "identifier"; |
| 151 | // we do not blackbox objects during table generation: |
| 152 | //if (tok>MAX_TOK) return getBlackboxName(tok); |
| 153 | int i = 0; |
| 154 | while (cmds[i].tokval!=0) |
| 155 | { |
| 156 | if ((cmds[i].tokval == tok)&&(cmds[i].alias==0)) |
| 157 | { |
| 158 | return cmds[i].name; |
| 159 | } |
| 160 | i++; |
| 161 | } |
| 162 | i=0;// try again for old/alias names: |
| 163 | while (cmds[i].tokval!=0) |
| 164 | { |
| 165 | if (cmds[i].tokval == tok) |
| 166 | { |
| 167 | return cmds[i].name; |
| 168 | } |
| 169 | i++; |
| 170 | } |
| 171 | #if 0 |
| 172 | char *s=(char*)malloc(10); |
| 173 | snprintf(s,10,"(%d)",tok); |
| 174 | return s; |
| 175 | #else |
| 176 | return cmds[0].name; |
| 177 | #endif |
| 178 | } |
| 179 | /*---------------------------------------------------------------------*/ |
| 180 | /** |
| 181 | * @brief compares to entry of cmdsname-list |