mathops.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* Copyright (C) 2005-2010 Valeriy Argunov (nporep AT mail DOT ru) */
  2. /*
  3. * This library is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU Lesser General Public License as published by
  5. * the Free Software Foundation; either version 2.1 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Lesser General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Lesser General Public License
  14. * along with this library; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. */
  17. #include "declarations.h"
  18. #include "variant.h"
  19. #ifndef QSP_MATHDEFINES
  20. #define QSP_MATHDEFINES
  21. #define QSP_OPSLEVELS 2
  22. #define QSP_MAXOPSNAMES 100
  23. #define QSP_OPMAXARGS 10
  24. #define QSP_STACKSIZE 30
  25. #define QSP_MAXITEMS 100
  26. #define QSP_VALSDELIM QSP_FMT("|")
  27. typedef void (*QSP_FUNCTION)(QSPVariant *, int, QSPVariant *);
  28. typedef struct
  29. {
  30. int Code;
  31. QSP_CHAR *Name;
  32. int NameLen;
  33. } QSPMathOpName;
  34. typedef struct
  35. {
  36. int Priority;
  37. int ResType;
  38. int MinArgsCount;
  39. int MaxArgsCount;
  40. int ArgsTypes[QSP_OPMAXARGS];
  41. QSP_FUNCTION Func;
  42. } QSPMathOperation;
  43. enum
  44. {
  45. qspOpUnknown,
  46. qspOpStart,
  47. qspOpEnd,
  48. qspOpValue,
  49. qspOpOpenBracket,
  50. qspOpMinus,
  51. qspOpComma,
  52. qspOpCloseBracket,
  53. qspOpMul,
  54. qspOpDiv,
  55. qspOpAdd,
  56. qspOpSub,
  57. qspOpMod,
  58. qspOpNe,
  59. qspOpLeq,
  60. qspOpGeq,
  61. qspOpEq,
  62. qspOpLt,
  63. qspOpGt,
  64. qspOpAnd,
  65. qspOpOr,
  66. qspOpAppend,
  67. qspOpFirst_Function,
  68. qspOpNot = qspOpFirst_Function,
  69. qspOpLoc,
  70. qspOpObj,
  71. qspOpMin,
  72. qspOpMax,
  73. qspOpRand,
  74. qspOpIIf,
  75. qspOpRGB,
  76. qspOpLen,
  77. qspOpIsNum,
  78. qspOpLCase,
  79. qspOpUCase,
  80. qspOpInput,
  81. qspOpStr,
  82. qspOpVal,
  83. qspOpArrSize,
  84. qspOpIsPlay,
  85. qspOpDesc,
  86. qspOpTrim,
  87. qspOpGetObj,
  88. qspOpStrComp,
  89. qspOpStrFind,
  90. qspOpStrPos,
  91. qspOpMid,
  92. qspOpArrPos,
  93. qspOpArrComp,
  94. qspOpInstr,
  95. qspOpReplace,
  96. qspOpFunc,
  97. qspOpDynEval,
  98. qspOpRnd,
  99. qspOpCountObj,
  100. qspOpMsecsCount,
  101. qspOpQSPVer,
  102. qspOpUserText,
  103. qspOpCurLoc,
  104. qspOpSelObj,
  105. qspOpSelAct,
  106. qspOpMainText,
  107. qspOpStatText,
  108. qspOpCurActs,
  109. qspOpLast_Operation
  110. };
  111. /* External functions */
  112. void qspInitMath();
  113. QSPVariant qspExprValue(QSP_CHAR *);
  114. #endif