home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p024 / 12.img / ADS1.LIB / CALUSRF.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-17  |  2.6 KB  |  93 lines

  1. /*****************************************************************************
  2.       CALUSRF.C
  3.       ¬⌐┼v (C) 1988-1992  Autodesk ñ╜Ñq
  4.  
  5.       Ñ╗╡{ªíñwÑ╤ Autodesk ñ╜Ñq╡∙ÑU¬⌐┼v, ╢╚⌐≤ñU¡z▒í¬pñUÑi▒┬╗P▒zíu│\ÑiívíC
  6.       ╗╒ñUñú▒oÑHÑ⌠ª≤º╬ªí╡oªµ⌐╬ÑX¬⌐ª╣╡{ªí¬║íu¡∞⌐l╜Xív; ª²ñ╣│\▒zªb»S⌐w¡lÑ═
  7.       ¬║ñuº@ñW╡▓ªXª╣╡{ªí¬║íuÑ╪¬║╜Xív¿╧Ñ╬íCª│├÷│o├■¡lÑ═ñuº@¬║▒°Ñ≤ªpñU:
  8.  
  9.       ( i)  │]¡pñW╗Pñuº@ñW¼╥»┬║Θ░w╣∩ Autodesk ñ╜Ñq¬║▓ú½~íC
  10.       (ii)  ╕ⁿª│íu¬⌐┼v  (C) 1988-1992  Autodesk ñ╜Ñqív¬║¬⌐┼v│qºiíC
  11.  
  12.  
  13.  
  14.       AUTODESKñ╜Ñq┤ú¿╤ª╣╡{ªí╢╚¿╤º@íu├■ªⁿív¬║░╤ª╥, ª╙ÑBñú▒╞░úª│Ñ⌠ª≤┐∙╗~¬║
  15.       Ñi»αíCAUTODESKñ╜Ñq»Sª╣º_╗{Ñ⌠ª≤»S⌐wÑ╬│~ñº╛A║┘⌐╩, ÑHñ╬░╙╖~╛P░Γ⌐╥┴⌠ºt
  16.       ÑX¿π¬║½O├╥íCAUTODESKñ╜ÑqªP«╔ÑτñúÑX¿πª╣╡{ªí░⌡ªµ«╔ñ@⌐wñú╖|íuññ┬_ív⌐╬
  17.       íuº╣Ñ■╡L╗~ív¬║½O├╥íC
  18.  
  19.  
  20.   Description: The user-defined functions for the Geometry Calculator.
  21.  
  22. *****************************************************************************/
  23.  
  24.  
  25. /****************************************************************************/
  26. /*  INCLUDES                                                                */
  27. /****************************************************************************/
  28.  
  29. #include "cal.h"
  30.  
  31.  
  32. /****************************************************************************/
  33. /*.doc cal_MAX_func(internal)*/
  34. /*+
  35.   Calculator function which returns maximum from a given set of numbers.
  36. -*/
  37. /****************************************************************************/
  38.  
  39.  
  40. static void
  41. /*FCN*/cal_MAX_func()
  42. {
  43.     int        i;
  44.     double     max;
  45.     value_type type;
  46.  
  47.     if (no_of_params < 2) {
  48.         error(0, "íuMAX Ñ\134»α¿τªíívª▄ñ╓╗▌¡n 2 ╢╡░╤╝╞");
  49.         return;
  50.     }
  51.  
  52.     max  = -1e30;
  53.     type = int_type;
  54.  
  55.     for (i=0; i<no_of_params; i++) {
  56.         if (!IS_REAL(i)) {
  57.             error(0, "íuMAX Ñ\134»α¿τªíívÑu╗▌¡n 1 ╢╡íu╣Ω╝╞ív⌐╬íu╛π╝╞ív░╤╝╞");
  58.             return;
  59.         }
  60.         if (params[i].type == real_type) {
  61.             type = real_type;
  62.         }
  63.         if (params[i].r > max) {
  64.             max = params[i].r;
  65.         }
  66.     } /*for*/
  67.  
  68.     result.type = type;
  69.     result.r    = max;
  70.  
  71. } /*cal_MAX_func*/
  72.  
  73.  
  74. /****************************************************************************/
  75. /*.doc cal_register_user_functions(external)*/
  76. /*+
  77.   Insert the registration of all your calculator functions into the
  78.   following function. The example how to do is, we hope, selfexplanatory.
  79. -*/
  80. /****************************************************************************/
  81.  
  82.  
  83. void
  84. /*FCN*/cal_register_user_functions()
  85. {
  86.     cal_register_function("MAX", cal_MAX_func);
  87.  
  88.     /* Add registering your own functions here.... */
  89.  
  90. } /*cal_register_user_functions*/
  91.  
  92.  
  93.