1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef FORMULA_COMPILER_HRC
21 #define FORMULA_COMPILER_HRC
23 /* Central definition of OpCodes for spreadsheet functions */
25 /*** Special commands ***/
26 #define SC_OPCODE_PUSH 0 /* internal commands */
27 #define SC_OPCODE_CALL 1
28 #define SC_OPCODE_STOP 2
29 #define SC_OPCODE_EXTERNAL 3
30 #define SC_OPCODE_NAME 4
31 #define SC_OPCODE_EXTERNAL_REF 5
32 #define SC_OPCODE_IF 6 /* jump commands */
33 #define SC_OPCODE_IF_ERROR 7
34 #define SC_OPCODE_IF_NA 8
35 #define SC_OPCODE_CHOSE 9
36 #define SC_OPCODE_OPEN 10 /* parentheses and separators */
37 #define SC_OPCODE_CLOSE 11
38 #define SC_OPCODE_SEP 12
39 #define SC_OPCODE_MISSING 13 /* special OpCodes */
40 #define SC_OPCODE_BAD 14
41 #define SC_OPCODE_STRINGXML 15
42 #define SC_OPCODE_SPACES 16
43 #define SC_OPCODE_MAT_REF 17
44 #define SC_OPCODE_DB_AREA 18 /* additional access operators */
45 #define SC_OPCODE_MACRO 19
46 #define SC_OPCODE_COL_ROW_NAME 20
47 #define SC_OPCODE_COL_ROW_NAME_AUTO 21
48 #define SC_OPCODE_PERCENT_SIGN 22 /* operator _follows_ value */
49 #define SC_OPCODE_ARRAY_OPEN 23
50 #define SC_OPCODE_ARRAY_CLOSE 24
51 #define SC_OPCODE_ARRAY_ROW_SEP 25
52 #define SC_OPCODE_ARRAY_COL_SEP 26 /* some convs use sep != col_sep */
53 #define SC_OPCODE_STOP_DIV 27
54 #define SC_OPCODE_SKIP 28 /* used to skip raw tokens during string compilation */
56 /*** error constants #... ***/
57 #define SC_OPCODE_START_ERRORS 30
58 #define SC_OPCODE_ERROR_NULL 30
59 #define SC_OPCODE_ERROR_DIVZERO 31
60 #define SC_OPCODE_ERROR_VALUE 32
61 #define SC_OPCODE_ERROR_REF 33
62 #define SC_OPCODE_ERROR_NAME 34
63 #define SC_OPCODE_ERROR_NUM 35
64 #define SC_OPCODE_ERROR_NA 36
65 #define SC_OPCODE_STOP_ERRORS 37
67 /*** Binary operators ***/
68 #define SC_OPCODE_START_BIN_OP 40
69 #define SC_OPCODE_ADD 40
70 #define SC_OPCODE_SUB 41
71 #define SC_OPCODE_MUL 42
72 #define SC_OPCODE_DIV 43
73 #define SC_OPCODE_AMPERSAND 44
74 #define SC_OPCODE_POW 45
75 #define SC_OPCODE_EQUAL 46
76 #define SC_OPCODE_NOT_EQUAL 47
77 #define SC_OPCODE_LESS 48
78 #define SC_OPCODE_GREATER 49
79 #define SC_OPCODE_LESS_EQUAL 50
80 #define SC_OPCODE_GREATER_EQUAL 51
81 #define SC_OPCODE_AND 52
82 #define SC_OPCODE_OR 53
83 #define SC_OPCODE_INTERSECT 54
84 #define SC_OPCODE_UNION 55
85 #define SC_OPCODE_RANGE 56
86 #define SC_OPCODE_STOP_BIN_OP 57
88 /* NOTE: binary and unary operators must be in sequence for compiler! */
90 /*** Unary operators ***/
91 #define SC_OPCODE_START_UN_OP 60
92 #define SC_OPCODE_NOT 60
93 #define SC_OPCODE_NEG 61
94 #define SC_OPCODE_NEG_SUB 62
95 #define SC_OPCODE_STOP_UN_OP 63
97 #define SC_OPCODE_START_FUNCTION 65
99 /*** Functions without parameters ***/
100 #define SC_OPCODE_START_NO_PAR 65
101 #define SC_OPCODE_PI 65
102 #define SC_OPCODE_RANDOM 66
103 #define SC_OPCODE_TRUE 67
104 #define SC_OPCODE_FALSE 68
105 #define SC_OPCODE_GET_ACT_DATE 69
106 #define SC_OPCODE_GET_ACT_TIME 70
107 #define SC_OPCODE_NO_VALUE 71
108 #define SC_OPCODE_CURRENT 72
109 #define SC_OPCODE_STOP_NO_PAR 73
111 /*** Functions with one parameter ***/
112 #define SC_OPCODE_START_1_PAR 80
113 #define SC_OPCODE_DEG 80 /* trigonometric */
114 #define SC_OPCODE_RAD 81
115 #define SC_OPCODE_SIN 82
116 #define SC_OPCODE_COS 83
117 #define SC_OPCODE_TAN 84
118 #define SC_OPCODE_COT 85
119 #define SC_OPCODE_ARC_SIN 86
120 #define SC_OPCODE_ARC_COS 87
121 #define SC_OPCODE_ARC_TAN 88
122 #define SC_OPCODE_ARC_COT 89
123 #define SC_OPCODE_SIN_HYP 90
124 #define SC_OPCODE_COS_HYP 91
125 #define SC_OPCODE_TAN_HYP 92
126 #define SC_OPCODE_COT_HYP 93
127 #define SC_OPCODE_ARC_SIN_HYP 94 /* transcendent */
128 #define SC_OPCODE_ARC_COS_HYP 95
129 #define SC_OPCODE_ARC_TAN_HYP 96
130 #define SC_OPCODE_ARC_COT_HYP 97
131 #define SC_OPCODE_COSECANT 98
132 #define SC_OPCODE_SECANT 99
133 #define SC_OPCODE_COSECANT_HYP 100
134 #define SC_OPCODE_SECANT_HYP 101
135 #define SC_OPCODE_EXP 102
136 #define SC_OPCODE_LN 103
137 #define SC_OPCODE_SQRT 104
138 #define SC_OPCODE_FACT 105
139 #define SC_OPCODE_GET_YEAR 106 /* date and time */
140 #define SC_OPCODE_GET_MONTH 107
141 #define SC_OPCODE_GET_DAY 108
142 #define SC_OPCODE_GET_HOUR 109
143 #define SC_OPCODE_GET_MIN 110
144 #define SC_OPCODE_GET_SEC 111
145 #define SC_OPCODE_PLUS_MINUS 112 /* miscellaneous */
146 #define SC_OPCODE_ABS 113
147 #define SC_OPCODE_INT 114
148 #define SC_OPCODE_PHI 115
149 #define SC_OPCODE_GAUSS 116
150 #define SC_OPCODE_IS_EMPTY 117 /* obtain type */
151 #define SC_OPCODE_IS_STRING 118
152 #define SC_OPCODE_IS_NON_STRING 119
153 #define SC_OPCODE_IS_LOGICAL 120
154 #define SC_OPCODE_TYPE 121
155 #define SC_OPCODE_IS_REF 122
156 #define SC_OPCODE_IS_VALUE 123
157 #define SC_OPCODE_IS_FORMULA 124
158 #define SC_OPCODE_IS_NV 125
159 #define SC_OPCODE_IS_ERR 126
160 #define SC_OPCODE_IS_ERROR 127
161 #define SC_OPCODE_IS_EVEN 128
162 #define SC_OPCODE_IS_ODD 129
163 #define SC_OPCODE_N 130
164 #define SC_OPCODE_GET_DATE_VALUE 131 /* string functions */
165 #define SC_OPCODE_GET_TIME_VALUE 132
166 #define SC_OPCODE_CODE 133
167 #define SC_OPCODE_TRIM 134
168 #define SC_OPCODE_UPPER 135
169 #define SC_OPCODE_PROPPER 136
170 #define SC_OPCODE_LOWER 137
171 #define SC_OPCODE_LEN 138
172 #define SC_OPCODE_T 139 /* miscellaneous, part 21 */
173 #define SC_OPCODE_VALUE 140
174 #define SC_OPCODE_CLEAN 141
175 #define SC_OPCODE_CHAR 142
176 #define SC_OPCODE_LOG10 143
177 #define SC_OPCODE_EVEN 144
178 #define SC_OPCODE_ODD 145
179 #define SC_OPCODE_STD_NORM_DIST 146
180 #define SC_OPCODE_FISHER 147
181 #define SC_OPCODE_FISHER_INV 148
182 #define SC_OPCODE_S_NORM_INV 149
183 #define SC_OPCODE_GAMMA_LN 150
184 #define SC_OPCODE_ERROR_TYPE 151
185 #define SC_OPCODE_ERR_CELL 152
186 #define SC_OPCODE_FORMULA 153
187 #define SC_OPCODE_ARABIC 154
188 #define SC_OPCODE_INFO 155
189 #define SC_OPCODE_BAHTTEXT 156
190 #define SC_OPCODE_JIS 157
191 #define SC_OPCODE_ASC 158
192 #define SC_OPCODE_UNICODE 159
193 #define SC_OPCODE_UNICHAR 160
194 #define SC_OPCODE_GAMMA 161
195 #define SC_OPCODE_STOP_1_PAR 162
197 /*** Functions with more than one parameters ***/
198 #define SC_OPCODE_START_2_PAR 201
199 #define SC_OPCODE_ARC_TAN_2 201
200 #define SC_OPCODE_CEIL 202
201 #define SC_OPCODE_FLOOR 203
202 #define SC_OPCODE_ROUND 204
203 #define SC_OPCODE_ROUND_UP 205
204 #define SC_OPCODE_ROUND_DOWN 206
205 #define SC_OPCODE_TRUNC 207
206 #define SC_OPCODE_LOG 208
207 #define SC_OPCODE_POWER 209
208 #define SC_OPCODE_GGT 210
209 #define SC_OPCODE_KGV 211
210 #define SC_OPCODE_MOD 212
211 #define SC_OPCODE_SUM_PRODUCT 213
212 #define SC_OPCODE_SUM_SQ 214
213 #define SC_OPCODE_SUM_X2MY2 215
214 #define SC_OPCODE_SUM_X2DY2 216
215 #define SC_OPCODE_SUM_XMY2 217
216 #define SC_OPCODE_GET_DATE 218
217 #define SC_OPCODE_GET_TIME 219
218 #define SC_OPCODE_GET_DIFF_DATE 220
219 #define SC_OPCODE_GET_DIFF_DATE_360 221
220 #define SC_OPCODE_MIN 222
221 #define SC_OPCODE_MAX 223
222 #define SC_OPCODE_SUM 224
223 #define SC_OPCODE_PRODUCT 225
224 #define SC_OPCODE_AVERAGE 226
225 #define SC_OPCODE_COUNT 227
226 #define SC_OPCODE_COUNT_2 228
227 #define SC_OPCODE_NBW 229
228 #define SC_OPCODE_IKV 230
229 #define SC_OPCODE_VAR 231
230 #define SC_OPCODE_VAR_P 232
231 #define SC_OPCODE_ST_DEV 233
232 #define SC_OPCODE_ST_DEV_P 234
233 #define SC_OPCODE_B 235
234 #define SC_OPCODE_NORM_DIST 236
235 #define SC_OPCODE_EXP_DIST 237
236 #define SC_OPCODE_BINOM_DIST 238
237 #define SC_OPCODE_POISSON_DIST 239
238 #define SC_OPCODE_KOMBIN 240
239 #define SC_OPCODE_KOMBIN_2 241
240 #define SC_OPCODE_VARIATIONEN 242
241 #define SC_OPCODE_VARIATIONEN_2 243
242 #define SC_OPCODE_BW 244
243 #define SC_OPCODE_DIA 245
244 #define SC_OPCODE_GDA 246
245 #define SC_OPCODE_GDA_2 247
246 #define SC_OPCODE_VBD 248
247 #define SC_OPCODE_LAUFZ 249
248 #define SC_OPCODE_LIA 250
249 #define SC_OPCODE_RMZ 251
250 #define SC_OPCODE_COLUMNS 252
251 #define SC_OPCODE_ROWS 253
252 #define SC_OPCODE_COLUMN 254
253 #define SC_OPCODE_ROW 255
254 #define SC_OPCODE_ZGZ 256
255 #define SC_OPCODE_ZW 257
256 #define SC_OPCODE_ZZR 258
257 #define SC_OPCODE_ZINS 259
258 #define SC_OPCODE_ZINS_Z 260
259 #define SC_OPCODE_KAPZ 261
260 #define SC_OPCODE_KUM_ZINS_Z 262
261 #define SC_OPCODE_KUM_KAP_Z 263
262 #define SC_OPCODE_EFFEKTIV 264
263 #define SC_OPCODE_NOMINAL 265
264 #define SC_OPCODE_SUB_TOTAL 266
265 #define SC_OPCODE_DB_SUM 267 /* database functions */
266 #define SC_OPCODE_DB_COUNT 268
267 #define SC_OPCODE_DB_COUNT_2 269
268 #define SC_OPCODE_DB_AVERAGE 270
269 #define SC_OPCODE_DB_GET 271
270 #define SC_OPCODE_DB_MAX 272
271 #define SC_OPCODE_DB_MIN 273
272 #define SC_OPCODE_DB_PRODUCT 274
273 #define SC_OPCODE_DB_STD_DEV 275
274 #define SC_OPCODE_DB_STD_DEV_P 276
275 #define SC_OPCODE_DB_VAR 277
276 #define SC_OPCODE_DB_VAR_P 278
277 #define SC_OPCODE_INDIRECT 279 /* management functions */
278 #define SC_OPCODE_ADDRESS 280
279 #define SC_OPCODE_MATCH 281
280 #define SC_OPCODE_COUNT_EMPTY_CELLS 282
281 #define SC_OPCODE_COUNT_IF 283
282 #define SC_OPCODE_SUM_IF 284
283 #define SC_OPCODE_LOOKUP 285
284 #define SC_OPCODE_V_LOOKUP 286
285 #define SC_OPCODE_H_LOOKUP 287
286 #define SC_OPCODE_MULTI_AREA 288
287 #define SC_OPCODE_OFFSET 289
288 #define SC_OPCODE_INDEX 290
289 #define SC_OPCODE_AREAS 291
290 #define SC_OPCODE_CURRENCY 292 /* string functions */
291 #define SC_OPCODE_REPLACE 293
292 #define SC_OPCODE_FIXED 294
293 #define SC_OPCODE_FIND 295
294 #define SC_OPCODE_EXACT 296
295 #define SC_OPCODE_LEFT 297
296 #define SC_OPCODE_RIGHT 298
297 #define SC_OPCODE_SEARCH 299
298 #define SC_OPCODE_MID 300
299 #define SC_OPCODE_TEXT 301
300 #define SC_OPCODE_SUBSTITUTE 302
301 #define SC_OPCODE_REPT 303
302 #define SC_OPCODE_CONCAT 304
303 #define SC_OPCODE_MAT_VALUE 305 /* matrix functions */
304 #define SC_OPCODE_MAT_DET 306
305 #define SC_OPCODE_MAT_INV 307
306 #define SC_OPCODE_MAT_MULT 308
307 #define SC_OPCODE_MAT_TRANS 309
308 #define SC_OPCODE_MATRIX_UNIT 310
309 #define SC_OPCODE_BACK_SOLVER 311 /* BackSolver */
310 #define SC_OPCODE_HYP_GEOM_DIST 312 /* statistical functions */
311 #define SC_OPCODE_LOG_NORM_DIST 313
312 #define SC_OPCODE_T_DIST 314
313 #define SC_OPCODE_F_DIST 315
314 #define SC_OPCODE_CHI_DIST 316
315 #define SC_OPCODE_WEIBULL 317
316 #define SC_OPCODE_NEG_BINOM_VERT 318
317 #define SC_OPCODE_KRIT_BINOM 319
318 #define SC_OPCODE_KURT 320
319 #define SC_OPCODE_HAR_MEAN 321
320 #define SC_OPCODE_GEO_MEAN 322
321 #define SC_OPCODE_STANDARD 323
322 #define SC_OPCODE_AVE_DEV 324
323 #define SC_OPCODE_SCHIEFE 325
324 #define SC_OPCODE_DEV_SQ 326
325 #define SC_OPCODE_MEDIAN 327
326 #define SC_OPCODE_MODAL_VALUE 328
327 #define SC_OPCODE_Z_TEST 329
328 #define SC_OPCODE_T_TEST 330
329 #define SC_OPCODE_RANK 331
330 #define SC_OPCODE_PERCENTILE 332
331 #define SC_OPCODE_PERCENT_RANK 333
332 #define SC_OPCODE_LARGE 334
333 #define SC_OPCODE_SMALL 335
334 #define SC_OPCODE_FREQUENCY 336
335 #define SC_OPCODE_QUARTILE 337
336 #define SC_OPCODE_NORM_INV 338
337 #define SC_OPCODE_CONFIDENCE 339
338 #define SC_OPCODE_F_TEST 340
339 #define SC_OPCODE_TRIM_MEAN 341
340 #define SC_OPCODE_PROB 342
341 #define SC_OPCODE_CORREL 343
342 #define SC_OPCODE_COVAR 344
343 #define SC_OPCODE_PEARSON 345
344 #define SC_OPCODE_RSQ 346
345 #define SC_OPCODE_STEYX 347
346 #define SC_OPCODE_SLOPE 348
347 #define SC_OPCODE_INTERCEPT 349
348 #define SC_OPCODE_TREND 350
349 #define SC_OPCODE_GROWTH 351
350 #define SC_OPCODE_RGP 352
351 #define SC_OPCODE_RKP 353
352 #define SC_OPCODE_FORECAST 354
353 #define SC_OPCODE_CHI_INV 355
354 #define SC_OPCODE_GAMMA_DIST 356
355 #define SC_OPCODE_GAMMA_INV 357
356 #define SC_OPCODE_T_INV 358
357 #define SC_OPCODE_F_INV 359
358 #define SC_OPCODE_CHI_TEST 360
359 #define SC_OPCODE_LOG_INV 361
360 #define SC_OPCODE_TABLE_OP 362
361 #define SC_OPCODE_BETA_DIST 363
362 #define SC_OPCODE_BETA_INV 364
363 #define SC_OPCODE_WEEK 365 /* miscellaneous */
364 #define SC_OPCODE_GET_DAY_OF_WEEK 366
365 #define SC_OPCODE_NO_NAME 367
366 #define SC_OPCODE_STYLE 368
367 #define SC_OPCODE_DDE 369
368 #define SC_OPCODE_BASE 370
369 #define SC_OPCODE_TABLE 371
370 #define SC_OPCODE_TABLES 372
371 #define SC_OPCODE_MIN_A 373
372 #define SC_OPCODE_MAX_A 374
373 #define SC_OPCODE_AVERAGE_A 375
374 #define SC_OPCODE_ST_DEV_A 376
375 #define SC_OPCODE_ST_DEV_P_A 377
376 #define SC_OPCODE_VAR_A 378
377 #define SC_OPCODE_VAR_P_A 379
378 #define SC_OPCODE_EASTERSUNDAY 380
379 #define SC_OPCODE_DECIMAL 381
380 #define SC_OPCODE_CONVERT 382
381 #define SC_OPCODE_ROMAN 383
382 #define SC_OPCODE_MIRR 384
383 #define SC_OPCODE_CELL 385
384 #define SC_OPCODE_ISPMT 386
385 #define SC_OPCODE_HYPERLINK 387
386 #define SC_OPCODE_INDIRECT_XL 388 /* See also INDIRECT for OOO variant */
387 #define SC_OPCODE_ADDRESS_XL 389 /* See also ADRESS for OOO variant */
388 #define SC_OPCODE_GET_PIVOT_DATA 390
389 #define SC_OPCODE_EUROCONVERT 391
390 #define SC_OPCODE_NUMBERVALUE 392
391 #define SC_OPCODE_CHISQ_DIST 393
392 #define SC_OPCODE_CHISQ_INV 394
393 #define SC_OPCODE_BITAND 395
394 #define SC_OPCODE_BITOR 396
395 #define SC_OPCODE_BITXOR 397
396 #define SC_OPCODE_BITRSHIFT 398
397 #define SC_OPCODE_BITLSHIFT 399
398 #define SC_OPCODE_GET_DATEDIF 400
399 #define SC_OPCODE_XOR 401
400 #define SC_OPCODE_AVERAGE_IF 402
401 #define SC_OPCODE_SUM_IFS 403
402 #define SC_OPCODE_AVERAGE_IFS 404
403 #define SC_OPCODE_COUNT_IFS 405
404 #define SC_OPCODE_SKEWP 406
405 #define SC_OPCODE_STOP_2_PAR 407
406 #define SC_OPCODE_LAST_OPCODE_ID 406 /* last OpCode */
408 #define SC_OPCODE_STOP_FUNCTION 407
411 #define SC_OPCODE_INTERNAL_BEGIN 9999
412 #define SC_OPCODE_TTT 9999
413 #define SC_OPCODE_INTERNAL_END 9999
415 /*** from here on ExtraData contained ***/
416 #define SC_OPCODE_DATA_TOKEN_1 10000
418 #define SC_OPCODE_NONE 0xFFFF
421 #endif /* FORMULA_COMPILER_HRC */
423 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */