home *** CD-ROM | disk | FTP | other *** search
/ Aminet 10 / aminetcdnumber101996.iso / Aminet / misc / math / MCalc17.lha / MCalc / Source / MCalc.h < prev    next >
Text File  |  1995-11-29  |  17KB  |  439 lines

  1. /*
  2. Auto:        smake MCalc
  3. */
  4.  
  5.  
  6. /* $Revision Header built automatically *************** (do not edit) ************
  7. **
  8. ** © Copyright by GuntherSoft
  9. **
  10. ** File             : SnakeSYS:CPrgs/MUICalc/MCalc.h
  11. ** Created on       : Saturday, 02.10.93 02:16:34
  12. ** Created by       : Kai Iske
  13. ** Current revision : V1.7
  14. **
  15. **
  16. ** Purpose
  17. ** -------
  18. **   - Header-File for MCalc
  19. **
  20. ** Revision V1.7
  21. ** --------------
  22. ** created on Mittwoch, 15.02.95 13:52:27  by  Kai Iske.   LogMessage :
  23. **  -*-  changed on Donnerstag, 07.12.95 00:03:07  by  Kai Iske.   LogMessage :
  24. **   - Recompilded using SAS-C 6.56 and MUI 3.0 header
  25. **  -*-  created on Mittwoch, 15.02.95 13:52:27  by  Kai Iske.   LogMessage :
  26. **   - MCalc didn`t calc the (n over k) function correctly. It used
  27. **     to calculate n!/(n-k)!, not n!/(k! * (n-k)!)
  28. **     (Reported by :Andreas Gabold)
  29. **
  30. ** Revision V1.6
  31. ** --------------
  32. ** created on Freitag, 27.01.95 15:59:41  by  Kai Iske.   LogMessage :
  33. **  -*-  changed on Freitag, 27.01.95 16:33:37  by  Kai Iske.   LogMessage :
  34. **   - Archive didn`t contain Protos.h header file
  35. **     (Reported by : Kay-Uwe Drankmeister)
  36. **  -*-  changed on Freitag, 27.01.95 16:32:58  by  Kai Iske.   LogMessage :
  37. **   - Function group was vertically sizable. Changed
  38. **     (Reported by : Kay-Uwe Drankmeister)
  39. **  -*-  changed on Freitag, 27.01.95 16:22:02  by  Kai Iske.   LogMessage :
  40. **   - Within the Prefs window, some entries positions in the cycle
  41. **     chain were mixed up.
  42. **     (Reported by : Kay-Uwe Drankmeister)
  43. **  -*-  changed on Freitag, 27.01.95 16:19:00  by  Kai Iske.   LogMessage :
  44. **   - RegisterGroup wasn`t contained in CycleChain
  45. **     (Reported by : Kay-Uwe Drankmeister)
  46. **  -*-  changed on Freitag, 27.01.95 16:18:00  by  Kai Iske.   LogMessage :
  47. **   - LinReg, StdDev, and Constants windows won`t have menus
  48. **     anymore, sorry ;)
  49. **  -*-  changed on Freitag, 27.01.95 16:04:15  by  Kai Iske.   LogMessage :
  50. **   - Std.Deviation, Lin.Regression and Constants window didn`t
  51. **     have a cycle-chain set.
  52. **     (Reported by : Kay-Uwe Drankmeister)
  53. **  -*-  created on Freitag, 27.01.95 15:59:41  by  Kai Iske.   LogMessage :
  54. **   - Changed items within "Windows" menu, to toggle menus
  55. **
  56. ** Revision V1.5
  57. ** --------------
  58. ** created on Donnerstag, 25.08.94 03:09:39  by  Kai Iske.   LogMessage :
  59. **  -*-  changed on Saturday, 21.01.95 17:43:49  by  --- Unknown ---.   LogMessage :
  60. **   - Added new function to menu/ARexx. DELETEHISTORY will delete
  61. **     an entry from the history list.
  62. **     (Requested by : Sorry, I lost you name, but thanks for the
  63. **     suggestions and the translation of the manual)
  64. **  -*-  changed on Samstag, 21.01.95 17:15:17  by  Kai Iske.   LogMessage :
  65. **   - Added support for GRADS
  66. **     (Requested by : Sorry, I lost you name, but thanks for the
  67. **     suggestions and the translation of the manual)
  68. **  -*-  changed on Samstag, 21.01.95 16:07:13  by  Kai Iske.   LogMessage :
  69. **   - Introduced exg operator, which exchanges the contents
  70. **     of two memories
  71. **     (Requested by : Sorry, I lost you name, but thanks for the
  72. **     suggestions and the translation of the manual)
  73. **  -*-  changed on Samstag, 21.01.95 01:06:35  by  Kai Iske.   LogMessage :
  74. **   - Added great support for physical constants. 31 listed
  75. **     (Requested by : Sorry, I lost you name, but thanks for the
  76. **     suggestions and the translation of the manual)
  77. **  -*-  changed on Freitag, 20.01.95 18:37:04  by  Kai Iske.   LogMessage :
  78. **   - Added full features linear regression support
  79. **     (Requested by : Volker Güth)
  80. **  -*-  changed on Freitag, 20.01.95 12:58:05  by  Kai Iske.   LogMessage :
  81. **   - Added standard deviation support
  82. **     (Requested by : Volker Güth)
  83. **  -*-  changed on Freitag, 20.01.95 12:26:16  by  Kai Iske.   LogMessage :
  84. **   - Added (n k) n-over-k function, 1/x, and the y-th root of x
  85. **     function.
  86. **     (Requested by : Sorry, I lost you name, but thanks for the
  87. **     suggestions and the translation of the manual)
  88. **  -*-  changed on Donnerstag, 19.01.95 17:51:12  by  Kai Iske.   LogMessage :
  89. **   - Increased number of internal memories from 3 to 18 (I-Z)
  90. **  -*-  changed on Donnerstag, 19.01.95 17:25:41  by  Kai Iske.   LogMessage :
  91. **   - Changed function group to use Registers/Cycle Gadget,
  92. **     according to your MUI settings.
  93. **   - MCalc requested any muimaster.library, even though version
  94. **     7 (MUI 2.x) was required
  95. **  -*-  changed on Mittwoch, 18.01.95 19:58:42  by  Kai Iske.   LogMessage :
  96. **   - Some of the input gadgets didn`t react on key nor mouse
  97. **     activations.
  98. **     (Reported by : Andreas Kirchwitz, and several others)
  99. **  -*-  changed on Freitag, 26.08.94 14:22:31  by  Kai Iske.   LogMessage :
  100. **   - Recompiled scanner using Flex 2.4.7
  101. **  -*-  created on Donnerstag, 25.08.94 03:09:39  by  Kai Iske.   LogMessage :
  102. **   - The format identifier for binary values has been changed;
  103. **     I forgot to change the output format identifier as well.
  104. **
  105. ** Revision V1.4
  106. ** --------------
  107. ** created on Thursday, 17.03.94 20:09:05  by  Kai Iske.   LogMessage :
  108. **  -*-  changed on Donnerstag, 18.08.94 17:35:24  by  Kai Iske.   LogMessage :
  109. **   - MCalc didn`t even care about Percent calculations
  110. **  -*-  changed on Sonntag, 07.08.94 20:30:27  by  Kai Iske.   LogMessage :
  111. **   - atan() wasn`t definied for some ranges (somehow)
  112. **  -*-  changed on Sonntag, 07.08.94 20:17:13  by  Kai Iske.   LogMessage :
  113. **   - The InputString will be default object now
  114. **  -*-  created on Thursday, 17.03.94 20:09:05  by  Kai Iske.   LogMessage :
  115. **   - Recompiled with Scanner generated by flex 2.4.6
  116. **
  117. ** Revision V1.3
  118. ** --------------
  119. ** created on Friday, 11.02.94 23:34:08  by  Kai Iske.   LogMessage :
  120. **  -*-  changed on Friday, 11.02.94 23:35:32  by  Kai Iske.   LogMessage :
  121. **   - One couldn`t use 1e3 for scientific notation of 1000. You
  122. **     had to write 1.0e3. Changed
  123. **     (Reported by : Henry Norman)
  124. **   - No more error lines will be copied from History
  125. **     (Requested by : Stefan Stuntz)
  126. **  -*-  created on Friday, 11.02.94 23:34:08  by  Kai Iske.   LogMessage :
  127. **   - "Radiant" was wrong. Changed. Why didn`t anybody tell me.
  128. **     (Reported by : Henry Norman)
  129. **   - Chose wrong case for mathematical "e".
  130. **     (Reported by : Henry Norman)
  131. **
  132. ** Revision V1.2
  133. ** --------------
  134. ** created on Tuesday, 19.10.93 23:41:00  by  Kai Iske.   LogMessage :
  135. **  -*-  changed on Wednesday, 08.12.93 23:48:31  by  Kai Iske.   LogMessage :
  136. **   - Default number of history lines increased
  137. **     (Requested by : Stefan Stuntz)
  138. **  -*-  changed on Sunday, 05.12.93 22:30:41  by  Kai Iske.   LogMessage :
  139. **   - No checks were made on the ENTRY argument to an ARexx
  140. **     function
  141. **  -*-  changed on Sunday, 05.12.93 18:13:56  by  Kai Iske.   LogMessage :
  142. **   - For calculations via ARexx one can set the type, size, sign
  143. **     and angle flags seperately, now
  144. **  -*-  changed on Sunday, 05.12.93 17:50:09  by  Kai Iske.   LogMessage :
  145. **   - Improved error handling from within ARexx commands a bit
  146. **  -*-  changed on Sunday, 05.12.93 17:46:35  by  Kai Iske.   LogMessage :
  147. **   - MUIProCalc may output TeX style mathematical expressions
  148. **     when using the ARexx commands. Additionally there is another
  149. **     option to convert expressions to TeX format.
  150. **     (Requested by : Volker Güth)
  151. **  -*-  changed on Sunday, 05.12.93 16:47:59  by  Kai Iske.   LogMessage :
  152. **   - Added more ARexx functions to the default ones
  153. **     (CALC, GETINPUT, GETOUTPUT)
  154. **     (Requested by : Volker Güth)
  155. **  -*-  changed on Sunday, 05.12.93 01:47:36  by  Kai Iske.   LogMessage :
  156. **   - MUIProCalc didn`t handle extremly small values
  157. **     (Reported by : Volker Güth)
  158. **  -*-  changed on Sunday, 05.12.93 01:38:18  by  Kai Iske.   LogMessage :
  159. **   - Default values weren`t set up
  160. **   - ACLR and CLR gadget have got menu entries too, now
  161. **     (Requested by : Volker Güth)
  162. **   - History entries may be copied to clipboard now
  163. **     (Requested by : Volker Güth)
  164. **  -*-  changed on Saturday, 27.11.93 01:01:25  by  Kai Iske.   LogMessage :
  165. **   - Recompiled using SAS 6.50
  166. **  -*-  changed on Wednesday, 20.10.93 00:24:41  by  Kai Iske.   LogMessage :
  167. **   - Bug in ListView display fixed
  168. **  -*-  created on Tuesday, 19.10.93 23:41:00  by  Kai Iske.   LogMessage :
  169. **   - You may now tell MCalc to clear the input string after
  170. **     hitting RETURN or EXEC.
  171. **
  172. ** Revision V1.1
  173. ** --------------
  174. ** created on Tuesday, 12.10.93 01:50:26  by  Kai Iske.   LogMessage :
  175. **  -*-  changed on Sunday, 17.10.93 15:03:10  by  Kai Iske.   LogMessage :
  176. **   - Save and Use gadgets weren`t arranged as proposed
  177. **     by the AUISG. (Reported by: Stefan Stuntz)
  178. **   - Changed layout of Prefs window a bit
  179. **     (Suggested by: Stefan Stuntz)
  180. **  -*-  changed on Friday, 15.10.93 18:39:50  by  Kai Iske.   LogMessage :
  181. **   - NOT operator didn`t behave as expected ;) It was a simple
  182. **     negate... (Reported by : Top on IRC)
  183. **  -*-  changed on Thursday, 14.10.93 18:01:32  by  Kai Iske.   LogMessage :
  184. **   - Hex-Values may be entered using 'C'-Style now (e.g. 0xff)
  185. **  -*-  changed on Thursday, 14.10.93 00:34:55  by  Kai Iske.   LogMessage :
  186. **   - One can use the faktorian '!' behind numbers now, too.
  187. **     (Suggested by : Top on IRC)
  188. **  -*-  changed on Thursday, 14.10.93 00:28:52  by  Kai Iske.   LogMessage :
  189. **   - One could accidentially change the ordering of the
  190. **     functions and input-gadgets groups by using
  191. **     'No Functions' and 'No Input' (reported by: Top on IRC)
  192. **  -*-  created on Tuesday, 12.10.93 01:50:26  by  Kai Iske.   LogMessage :
  193. **   - Order of Input and Ouput gadgets (String + ListView) may be
  194. **     set now, ie. the input string may show up underneith the
  195. **     ListView and vice versa (Requested by Dirk Federlein)
  196. **
  197. ** Revision V1.0
  198. ** --------------
  199. ** created on Saturday, 02.10.93 02:16:34  by  Kai Iske.   LogMessage :
  200. **     --- Initial release ---
  201. **
  202. *********************************************************************************/
  203. #define REVISION "1.7"
  204. #define REVDATE  "07.12.95"
  205. #define REVTIME  "00:03:07"
  206. #define AUTHOR   "Kai Iske"
  207. #define VERNUM   1
  208. #define REVNUM   7
  209.  
  210.  
  211. #ifndef        MCALC_H
  212. #define        MCALC_H
  213.  
  214.  
  215.  
  216. /**********************************************************************/
  217. /*                         Parser-Prototypes                          */
  218. /**********************************************************************/
  219. int        yyparse(void);
  220. int        yyerror(char *s);
  221. ULONG        make_ulong(double OldVal);
  222. double        calc_fak(double Fak);
  223. double        calc_angle(double Value);
  224. BOOL        check_angle(double Value, int Mode);
  225. BOOL        add_standard_value(double Value);
  226. BOOL        add_linear_value(double ValueX, double ValueY);
  227. int        numbers_in_list(struct List *Lst);
  228. double        calc_average(struct List *Lst, BOOL LinearValueY);
  229. double        calc_population(struct List *Lst, BOOL LinearValueY);
  230. double        calc_sample(struct List *Lst, BOOL LinearValueY);
  231. double        calc_powsum(struct List *Lst, BOOL LinearValueY);
  232. double        calc_sum(struct List *Lst, BOOL LinearValueY);
  233. double        calc_xysum(void);
  234. double        calc_lralpha(void);
  235. double        calc_lrbeta(void);
  236. double        calc_lrassessx(double y);
  237. double        calc_lrassessy(double x);
  238. double        calc_lrcorr(void);
  239. double        calc_lrcovar(void);
  240.  
  241.  
  242.  
  243.  
  244.  
  245. /**********************************************************************/
  246. /*                         Scanner-Prototypes                         */
  247. /**********************************************************************/
  248. int    yylex(void);
  249. void    yyrestart(FILE *File);
  250. void    count(void);
  251. int    calc_int_value(char *s);
  252. int    calc_hex_value(char *s, int leng);
  253. int    calc_bin_value(char *s);
  254. int    calc_oct_value(char *s);
  255. int    calc_dbl_value(char *s);
  256.  
  257.  
  258.  
  259. /**********************************************************************/
  260. /*                   Error-Codes for Scanner/Parser                   */
  261. /**********************************************************************/
  262. #define    ERR_PARSE    1
  263. #define    ERR_UNKNOWN_CHR    2
  264. #define    ERR_DIVBY0    3
  265. #define    ERR_OVERFLOW    4
  266. #define    ERR_NOMEM    5
  267. #define    ERR_UNDERFLOW    6
  268.  
  269.  
  270.  
  271.  
  272. /**********************************************************************/
  273. /*                      My constant definitions                       */
  274. /**********************************************************************/
  275. #define Pi      ((double) 3.141592653589793)
  276.  
  277.  
  278.  
  279.  
  280. /**********************************************************************/
  281. /*                        Assembler-Prototypes                        */
  282. /**********************************************************************/
  283. ULONG    __asm MyASL(register __d0 ULONG In, register __d1 ULONG Out);
  284. ULONG    __asm MyASR(register __d0 ULONG In, register __d1 ULONG Out);
  285. ULONG    __asm MyLSL(register __d0 ULONG In, register __d1 ULONG Out);
  286. ULONG    __asm MyLSR(register __d0 ULONG In, register __d1 ULONG Out);
  287. ULONG    __asm MyROL(register __d0 ULONG In, register __d1 ULONG Out);
  288. ULONG    __asm MyROR(register __d0 ULONG In, register __d1 ULONG Out);
  289. ULONG    __asm MyXOR(register __d0 ULONG In, register __d1 ULONG Out);
  290. ULONG    __asm MyNAND(register __d0 ULONG In, register __d1 ULONG Out);
  291. ULONG    __asm MyNOR(register __d0 ULONG In, register __d1 ULONG Out);
  292. ULONG    __asm MyNXOR(register __d0 ULONG In, register __d1 ULONG Out);
  293. APTR    __asm DoCreatePool(register __d0 ULONG, register __d1 ULONG, register __d2 ULONG);
  294. void    __asm DoDeletePool(register __a0 APTR);
  295. APTR    __asm AllocVecPool(register __a0 APTR, register __d0 ULONG);
  296. void    __asm FreeVecPool(register __a0 APTR, register __a1 APTR);
  297.  
  298.  
  299.  
  300. /**********************************************************************/
  301. /*                   Structure for ListView display                   */
  302. /**********************************************************************/
  303. struct    ListStruct
  304. {
  305.     char    Input[258];
  306.     char    Output[258];
  307. };
  308.  
  309.  
  310.  
  311.  
  312. /**********************************************************************/
  313. /*       Node to use for Standard/Linear Regression calculation       */
  314. /**********************************************************************/
  315. struct    DoubleNode
  316. {
  317.     struct    Node    Link;
  318.     double        ValueX;
  319.     double        ValueY;
  320. };
  321.  
  322.  
  323.  
  324. /**********************************************************************/
  325. /*                   Node for displaying constants                    */
  326. /**********************************************************************/
  327. struct    ConstNode
  328. {
  329.     char        *Constant;
  330.     char        *Value;
  331.     char        *Notation;
  332. };
  333.  
  334.  
  335.  
  336. /**********************************************************************/
  337. /*                         Some nice defines                          */
  338. /**********************************************************************/
  339.  
  340.     // This is our Version string
  341.  
  342. #define    MUIVERS        "$VER:MCalc "REVISION" ("REVDATE")"
  343.  
  344.  
  345.     // These are for Button/Menu IDs
  346.  
  347. enum{
  348.     DUMMY,
  349.  
  350.     ID_QUIT,            // Quit program
  351.     ID_ABOUT,            // Display About
  352.     ID_PREFS,            // Open Prefs
  353.  
  354.     ID_PICKLEFT,            // Pick left entry from History
  355.     ID_PICKRIGHT,            // Pick right entry from History
  356.     ID_CLIPCUTLEFT,            // Clip left entry to clipboard
  357.     ID_CLIPCUTRIGHT,        // Clip right entry to clipboard
  358.     ID_DELHISTORY,            // Delete active entry from History
  359.  
  360.     ID_DECIMAL,            // Switch to dec display
  361.     ID_HEXDECIMAL,            // Switch to hex display
  362.     ID_OCTAL,            // Switch to oct display
  363.     ID_BINARY,            // Switch to bin display
  364.  
  365.     ID_8BIT,            // Set 8-Bit Base
  366.     ID_16BIT,            // Set 16-Bit Base
  367.     ID_32BIT,            // Set 32-Bit Base
  368.  
  369.     ID_SIGNED,            // Switch to signed dec ouput
  370.     ID_UNSIGNED,            // Switch to unsigned dec output
  371.  
  372.     ID_RAD,                // Radiant angles
  373.     ID_DEG,                // Degree angles
  374.     ID_GRAD,            // Grads angles
  375.  
  376.     ID_STDHISTORY,            // Open std.deviation history
  377.     ID_CLOSESTD,            // Close std.deviation history
  378.     ID_LINHISTORY,            // Open lin.regression history
  379.     ID_CLOSELIN,            // Close lin.regression history
  380.     ID_CONSTANTS,            // Open constants window
  381.     ID_CLOSECONST,            // Close constants window
  382.     ID_SELECTCONST,            // Select constant
  383.  
  384.     ID_INPUT,            // Received input from String gadget
  385.     ID_LISTVIEW,            // Double clicked on ListView
  386.     ID_EXEC,            // Translate input
  387.     ID_CLEAR,            // Clear input gadget
  388.     ID_ALLCLEAR,            // Clear input gadget AND memory
  389.  
  390.     ID_PREFS_QUIT,            // Close Prefs window
  391.     ID_PREFS_NEW            // New Prefs set
  392. };
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399. /**********************************************************************/
  400. /*                    Definitions for Online-Help                     */
  401. /**********************************************************************/
  402. #define    HELPFILE        "MCalc.guide"
  403. #define    NODE_MAIN        "Main"
  404. #define    NODE_INOUTPUT        "InputOutput"
  405. #define    NODE_FUNCTIONS        "FuncTables"
  406. #define    NODE_STDDEVIATION    "StdDeviation"
  407. #define    NODE_LINREGRESSION    "LinRegression"
  408. #define    NODE_INPUTS        "Inputs"
  409. #define    NODE_PREFS        "Prefs"
  410. #define    NODE_LAYOUT        "Layout"
  411. #define    NODE_OUTPUT        "Output"
  412. #define    NODE_HISTORY        "History"
  413. #define    NODE_MISC        "Misc"
  414. #define    NODE_WINDOWS        "Windows"
  415.  
  416.  
  417. /**********************************************************************/
  418. /*                   Defines for Clipboard support                    */
  419. /**********************************************************************/
  420. #define ID_FTXT    MAKE_ID('F','T','X','T')
  421. #define ID_CHRS    MAKE_ID('C','H','R','S')
  422.  
  423.  
  424. /**********************************************************************/
  425. /*                       Some defines for ARexx                       */
  426. /**********************************************************************/
  427. #define    GET_OUTPUT        1
  428. #define    GET_INPUT        2
  429.  
  430. #define    NORMAL_OUTPUT        1
  431. #define    TEX_OUTPUT        2
  432.  
  433. #define    GET_ACTIVE        -1
  434. #define    GET_TOPMOST        -2
  435. #define    GET_BOTTOMMOST        -3
  436.  
  437. #include    "Protos.h"
  438. #endif
  439.