function.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <grass/glocale.h>
  4. #include "expression.h"
  5. #include "func_proto.h"
  6. func_desc func_descs[] = {
  7. {"add", c_varop, f_add},
  8. {"sub", c_binop, f_sub},
  9. {"mul", c_varop, f_mul},
  10. {"div", c_binop, f_div},
  11. {"mod", c_binop, f_mod},
  12. {"pow", c_binop, f_pow},
  13. {"neg", c_unop, f_neg},
  14. {"abs", c_unop, f_abs},
  15. {"gt", c_cmpop, f_gt},
  16. {"ge", c_cmpop, f_ge},
  17. {"lt", c_cmpop, f_lt},
  18. {"le", c_cmpop, f_le},
  19. {"eq", c_cmpop, f_eq},
  20. {"ne", c_cmpop, f_ne},
  21. {"and", c_logop, f_and},
  22. {"or", c_logop, f_or},
  23. {"and2", c_logop, f_and2},
  24. {"or2", c_logop, f_or2},
  25. {"not", c_not, f_not},
  26. {"bitand", c_logop, f_bitand},
  27. {"bitor", c_logop, f_bitor},
  28. {"xor", c_logop, f_bitxor},
  29. {"shiftl", c_shiftop, f_shiftl},
  30. {"shiftr", c_shiftop, f_shiftr},
  31. {"shiftru", c_shiftop, f_shiftru},
  32. {"bitnot", c_not, f_bitnot},
  33. {"sqrt", c_double1, f_sqrt},
  34. {"sin", c_double1, f_sin},
  35. {"cos", c_double1, f_cos},
  36. {"tan", c_double1, f_tan},
  37. {"acos", c_double1, f_acos},
  38. {"asin", c_double1, f_asin},
  39. {"exp", c_double12, f_exp},
  40. {"log", c_double12, f_log},
  41. {"atan", c_double12, f_atan},
  42. {"int", c_int, f_int},
  43. {"float", c_float, f_float},
  44. {"double", c_double, f_double},
  45. {"round", c_round, f_round},
  46. {"eval", c_eval, f_eval},
  47. {"if", c_if, f_if},
  48. {"isnull", c_isnull, f_isnull},
  49. {"max", c_varop, f_max},
  50. {"min", c_varop, f_min},
  51. {"median", c_varop, f_median},
  52. {"mode", c_varop, f_mode},
  53. {"nmax", c_varop, f_nmax},
  54. {"nmin", c_varop, f_nmin},
  55. {"nmedian", c_varop, f_nmedian},
  56. {"nmode", c_varop, f_nmode},
  57. {"graph", c_graph, f_graph},
  58. {"rand", c_binop, f_rand},
  59. {"null", c_int0, f_null},
  60. {"col", c_int0, f_col},
  61. {"row", c_int0, f_row},
  62. {"depth", c_int0, f_depth},
  63. {"x", c_double0, f_x},
  64. {"y", c_double0, f_y},
  65. {"z", c_double0, f_z},
  66. {"ewres", c_double0, f_ewres},
  67. {"nsres", c_double0, f_nsres},
  68. {"tbres", c_double0, f_tbres},
  69. {NULL}
  70. };
  71. void print_function_names(void)
  72. {
  73. int i;
  74. fprintf(stderr, _("Known functions:"));
  75. for (i = 0; func_descs[i].name; i++)
  76. fprintf(stderr, "%c%-10s", i % 7 ? ' ' : '\n', func_descs[i].name);
  77. fprintf(stderr, "\n");
  78. }