Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

rhsfun_math.c

Go to the documentation of this file.
00001 /*************************************************************************
00002  *
00003  *  file:  rhsfun_math.c
00004  *
00005  * =======================================================================
00006  *  Support routines for doing math in the RHS of productions.
00007  *  BUGBUG more comments here.  Nothing in soarkernel.h either.
00008  *  
00009  *  
00010  * =======================================================================
00011  *
00012  * Copyright 1995-2003 Carnegie Mellon University,
00013  *                                                                               University of Michigan,
00014  *                                                                               University of Southern California/Information
00015  *                                                                               Sciences Institute. All rights reserved.
00016  *                                                                              
00017  * Redistribution and use in source and binary forms, with or without
00018  * modification, are permitted provided that the following conditions are met:
00019  *
00020  * 1.   Redistributions of source code must retain the above copyright notice,
00021  *              this list of conditions and the following disclaimer. 
00022  * 2.   Redistributions in binary form must reproduce the above copyright notice,
00023  *              this list of conditions and the following disclaimer in the documentation
00024  *              and/or other materials provided with the distribution. 
00025  *
00026  * THIS SOFTWARE IS PROVIDED BY THE SOAR CONSORTIUM ``AS IS'' AND ANY EXPRESS OR
00027  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00028  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
00029  * EVENT SHALL THE SOAR CONSORTIUM  OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
00030  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00031  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00032  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00033  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00034  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036  * The views and conclusions contained in the software and documentation are
00037  * those of the authors and should not be interpreted as representing official
00038  * policies, either expressed or implied, of Carnegie Mellon University, the
00039  * University of Michigan, the University of Southern California/Information
00040  * Sciences Institute, or the Soar consortium.
00041  * =======================================================================
00042  */
00043 
00044 #include "soarkernel.h"
00045 #include <math.h>
00046 #include <errno.h>
00047 #include "rhsfun.h"
00048 
00049 /* --------------------------------------------------------------------
00050                                 Plus
00051 
00052    Takes any number of int_constant or float_constant arguments, and
00053    returns their sum.
00054 -------------------------------------------------------------------- */
00055 
00056 Symbol *plus_rhs_function_code(list * args)
00057 {
00058     bool float_found;
00059     long i;
00060     float f = 0;
00061     Symbol *arg;
00062     cons *c;
00063 
00064     for (c = args; c != NIL; c = c->rest) {
00065         arg = c->first;
00066         if ((arg->common.symbol_type != INT_CONSTANT_SYMBOL_TYPE) &&
00067             (arg->common.symbol_type != FLOAT_CONSTANT_SYMBOL_TYPE)) {
00068             print_with_symbols("Error: non-number (%y) passed to + function\n", arg);
00069             return NIL;
00070         }
00071     }
00072 
00073     i = 0;
00074     float_found = FALSE;
00075     while (args) {
00076         arg = args->first;
00077         if (arg->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE) {
00078             if (float_found)
00079                 f += arg->ic.value;
00080             else
00081                 i += arg->ic.value;
00082         } else {
00083             if (float_found)
00084                 f += arg->fc.value;
00085             else {
00086                 float_found = TRUE;
00087                 f = arg->fc.value + i;
00088             }
00089         }
00090         args = args->rest;
00091     }
00092     if (float_found)
00093         return make_float_constant(f);
00094     return make_int_constant(i);
00095 }
00096 
00097 /* --------------------------------------------------------------------
00098                                 Times
00099 
00100    Takes any number of int_constant or float_constant arguments, and
00101    returns their product.
00102 -------------------------------------------------------------------- */
00103 
00104 Symbol *times_rhs_function_code(list * args)
00105 {
00106     bool float_found;
00107     long i;
00108     float f = 0;
00109     Symbol *arg;
00110     cons *c;
00111 
00112     for (c = args; c != NIL; c = c->rest) {
00113         arg = c->first;
00114         if ((arg->common.symbol_type != INT_CONSTANT_SYMBOL_TYPE) &&
00115             (arg->common.symbol_type != FLOAT_CONSTANT_SYMBOL_TYPE)) {
00116             print_with_symbols("Error: non-number (%y) passed to * function\n", arg);
00117             return NIL;
00118         }
00119     }
00120 
00121     i = 1;
00122     float_found = FALSE;
00123     while (args) {
00124         arg = args->first;
00125         if (arg->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE) {
00126             if (float_found)
00127                 f *= arg->ic.value;
00128             else
00129                 i *= arg->ic.value;
00130         } else {
00131             if (float_found)
00132                 f *= arg->fc.value;
00133             else {
00134                 float_found = TRUE;
00135                 f = arg->fc.value * i;
00136             }
00137         }
00138         args = args->rest;
00139     }
00140     if (float_found)
00141         return make_float_constant(f);
00142     return make_int_constant(i);
00143 }
00144 
00145 /* --------------------------------------------------------------------
00146                                 Minus
00147 
00148    Takes one or more int_constant or float_constant arguments.
00149    If 0 arguments, returns NIL (error).
00150    If 1 argument (x), returns -x.
00151    If >=2 arguments (x, y1, ..., yk), returns x - y1 - ... - yk.
00152 -------------------------------------------------------------------- */
00153 
00154 Symbol *minus_rhs_function_code(list * args)
00155 {
00156     Symbol *arg;
00157     float f = 0;                /* For gcc -Wall */
00158     long i = 0;                 /* For gcc -Wall */
00159     cons *c;
00160     bool float_found;
00161 
00162     if (!args) {
00163         print("Error: '-' function called with no arguments\n");
00164         return NIL;
00165     }
00166 
00167     for (c = args; c != NIL; c = c->rest) {
00168         arg = c->first;
00169         if ((arg->common.symbol_type != INT_CONSTANT_SYMBOL_TYPE) &&
00170             (arg->common.symbol_type != FLOAT_CONSTANT_SYMBOL_TYPE)) {
00171             print_with_symbols("Error: non-number (%y) passed to - function\n", arg);
00172             return NIL;
00173         }
00174     }
00175 
00176     if (!args->rest) {
00177         /* --- only one argument --- */
00178         arg = args->first;
00179         if (arg->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE)
00180             return make_int_constant(-arg->ic.value);
00181         return make_float_constant(-arg->fc.value);
00182     }
00183 
00184     /* --- two or more arguments --- */
00185     arg = args->first;
00186     float_found = FALSE;
00187     if (arg->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE)
00188         i = arg->ic.value;
00189     else {
00190         float_found = TRUE;
00191         f = arg->fc.value;
00192     }
00193     for (c = args->rest; c != NIL; c = c->rest) {
00194         arg = c->first;
00195         if (arg->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE) {
00196             if (float_found)
00197                 f -= arg->ic.value;
00198             else
00199                 i -= arg->ic.value;
00200         } else {
00201             if (float_found)
00202                 f -= arg->fc.value;
00203             else {
00204                 float_found = TRUE;
00205                 f = i - arg->fc.value;
00206             }
00207         }
00208     }
00209 
00210     if (float_found)
00211         return make_float_constant(f);
00212     return make_int_constant(i);
00213 }
00214 
00215 /* --------------------------------------------------------------------
00216                      Floating-Point Division
00217 
00218    Takes one or more int_constant or float_constant arguments.
00219    If 0 arguments, returns NIL (error).
00220    If 1 argument (x), returns 1/x.
00221    If >=2 arguments (x, y1, ..., yk), returns x / y1 / ... / yk.
00222 -------------------------------------------------------------------- */
00223 
00224 Symbol *fp_divide_rhs_function_code(list * args)
00225 {
00226     Symbol *arg;
00227     float f;
00228     cons *c;
00229 
00230     if (!args) {
00231         print("Error: '/' function called with no arguments\n");
00232         return NIL;
00233     }
00234 
00235     for (c = args; c != NIL; c = c->rest) {
00236         arg = c->first;
00237         if ((arg->common.symbol_type != INT_CONSTANT_SYMBOL_TYPE) &&
00238             (arg->common.symbol_type != FLOAT_CONSTANT_SYMBOL_TYPE)) {
00239             print_with_symbols("Error: non-number (%y) passed to / function\n", arg);
00240             return NIL;
00241         }
00242     }
00243 
00244     if (!args->rest) {
00245         /* --- only one argument --- */
00246         arg = args->first;
00247         if (arg->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE)
00248             f = (float) arg->ic.value;
00249         else
00250             f = arg->fc.value;
00251         if (f != 0.0)
00252             return make_float_constant((float) (1.0 / f));
00253         print("Error: attempt to divide ('/') by zero.\n");
00254         return NIL;
00255     }
00256 
00257     /* --- two or more arguments --- */
00258     arg = args->first;
00259     if (arg->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE)
00260         f = (float) arg->ic.value;
00261     else
00262         f = arg->fc.value;
00263     for (c = args->rest; c != NIL; c = c->rest) {
00264         arg = c->first;
00265         if (arg->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE) {
00266             if (arg->ic.value)
00267                 f /= arg->ic.value;
00268             else {
00269                 print("Error: attempt to divide ('/') by zero.\n");
00270                 return NIL;
00271             }
00272         } else {
00273             if (arg->fc.value != 0.0)
00274                 f /= arg->fc.value;
00275             else {
00276                 print("Error: attempt to divide ('/') by zero.\n");
00277                 return NIL;
00278             }
00279         }
00280     }
00281     return make_float_constant(f);
00282 }
00283 
00284 /* --------------------------------------------------------------------
00285                      Integer Division (Quotient)
00286 
00287    Takes two int_constant arguments, and returns their quotient.
00288 -------------------------------------------------------------------- */
00289 
00290 Symbol *div_rhs_function_code(list * args)
00291 {
00292     Symbol *arg1, *arg2;
00293 
00294     arg1 = args->first;
00295     arg2 = args->rest->first;
00296 
00297     if (arg1->common.symbol_type != INT_CONSTANT_SYMBOL_TYPE) {
00298         print_with_symbols("Error: non-integer (%y) passed to div function\n", arg1);
00299         return NIL;
00300     }
00301     if (arg2->common.symbol_type != INT_CONSTANT_SYMBOL_TYPE) {
00302         print_with_symbols("Error: non-integer (%y) passed to div function\n", arg2);
00303         return NIL;
00304     }
00305 
00306     if (arg2->ic.value == 0) {
00307         print("Error: attempt to divide ('div') by zero.\n");
00308         return NIL;
00309     }
00310 
00311     return make_int_constant(arg1->ic.value / arg2->ic.value);
00312     /* Warning: ANSI doesn't say precisely what happens if one or both of the
00313        two args is negative. */
00314 }
00315 
00316 /* --------------------------------------------------------------------
00317                           Integer Modulus
00318 
00319    Takes two int_constant arguments (x,y) and returns (x mod y), i.e.,
00320    the remainder after dividing x by y.
00321 -------------------------------------------------------------------- */
00322 
00323 Symbol *mod_rhs_function_code(list * args)
00324 {
00325     Symbol *arg1, *arg2;
00326 
00327     arg1 = args->first;
00328     arg2 = args->rest->first;
00329 
00330     if (arg1->common.symbol_type != INT_CONSTANT_SYMBOL_TYPE) {
00331         print_with_symbols("Error: non-integer (%y) passed to mod function\n", arg1);
00332         return NIL;
00333     }
00334     if (arg2->common.symbol_type != INT_CONSTANT_SYMBOL_TYPE) {
00335         print_with_symbols("Error: non-integer (%y) passed to mod function\n", arg2);
00336         return NIL;
00337     }
00338 
00339     if (arg2->ic.value == 0) {
00340         print("Error: attempt to divide ('mod') by zero.\n");
00341         return NIL;
00342     }
00343 
00344     return make_int_constant(arg1->ic.value % arg2->ic.value);
00345     /* Warning:  ANSI guarantees this does the right thing if both args are
00346        positive.  If one or both is negative, it only guarantees that
00347        (a/b)*b + a%b == a. */
00348 }
00349 
00350 /*
00351  * SIN_RHS_FUNCTION_CODE
00352  *
00353  * Returns as a float the sine of an angle measured in radians.
00354  */
00355 Symbol *sin_rhs_function_code(list * args)
00356 {
00357     Symbol *arg;
00358     float arg_value;
00359 
00360     if (!args) {
00361         print("Error: 'sin' function called with no arguments\n");
00362         return NIL;
00363     }
00364 
00365     arg = args->first;
00366     if (arg->common.symbol_type == FLOAT_CONSTANT_SYMBOL_TYPE)
00367         arg_value = arg->fc.value;
00368     else if (arg->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE)
00369         arg_value = (float) arg->ic.value;
00370     else {
00371         print_with_symbols("Error: 'sin' function called with non-numeric argument %y\n", arg);
00372         return NIL;
00373     }
00374 
00375     return make_float_constant((float) sin(arg_value));
00376 }
00377 
00378 /*
00379  * COS_RHS_FUNCTION_CODE
00380  *
00381  * Returns as a float the cosine of an angle measured in radians.
00382  */
00383 Symbol *cos_rhs_function_code(list * args)
00384 {
00385     Symbol *arg;
00386     float arg_value;
00387 
00388     if (!args) {
00389         print("Error: 'cos' function called with no arguments\n");
00390         return NIL;
00391     }
00392 
00393     arg = args->first;
00394     if (arg->common.symbol_type == FLOAT_CONSTANT_SYMBOL_TYPE)
00395         arg_value = arg->fc.value;
00396     else if (arg->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE)
00397         arg_value = (float) arg->ic.value;
00398     else {
00399         print_with_symbols("Error: 'cos' function called with non-numeric argument %y\n", arg);
00400         return NIL;
00401     }
00402     return make_float_constant((float) cos(arg_value));
00403 }
00404 
00405 /*
00406  * SQRT_RHS_FUNCTION_CODE
00407  *
00408  * Returns as a float the square root of its argument (integer or float).
00409  */
00410 Symbol *sqrt_rhs_function_code(list * args)
00411 {
00412     Symbol *arg;
00413     float arg_value;
00414 
00415     if (!args) {
00416         print("Error: 'sqrt' function called with no arguments\n");
00417         return NIL;
00418     }
00419 
00420     arg = args->first;
00421     if (arg->common.symbol_type == FLOAT_CONSTANT_SYMBOL_TYPE)
00422         arg_value = arg->fc.value;
00423     else if (arg->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE)
00424         arg_value = (float) arg->ic.value;
00425     else {
00426         print_with_symbols("Error: 'sqrt' function called with non-numeric argument %y\n", arg);
00427         return NIL;
00428     }
00429     return make_float_constant((float) sqrt(arg_value));
00430 }
00431 
00432 /*
00433  * ATAN2_RHS_FUNCTION_CODE
00434  *
00435  * Returns as a float in radians the arctangent of (first_arg/second_arg)
00436  * which are floats or integers.
00437  */
00438 Symbol *atan2_rhs_function_code(list * args)
00439 {
00440     Symbol *arg;
00441     cons *c;
00442     float numer_value, denom_value;
00443 
00444     if (!args) {
00445         print("Error: 'atan2' function called with no arguments\n");
00446         return NIL;
00447     }
00448 
00449     for (c = args; c != NIL; c = c->rest) {
00450         arg = c->first;
00451         if ((arg->common.symbol_type != INT_CONSTANT_SYMBOL_TYPE)
00452             && (arg->common.symbol_type != FLOAT_CONSTANT_SYMBOL_TYPE)) {
00453             print_with_symbols("Error: non-number (%y) passed to atan2\n", arg);
00454             return NIL;
00455         }
00456     }
00457 
00458     if (!args->rest) {
00459         print("Error: 'atan2' function called with only one argument\n");
00460         return NIL;
00461     }
00462 
00463     arg = args->first;
00464     if (arg->common.symbol_type == FLOAT_CONSTANT_SYMBOL_TYPE)
00465         numer_value = arg->fc.value;
00466     else
00467         numer_value = (float) arg->ic.value;
00468 
00469     c = args->rest;
00470     if (c->rest) {
00471         print("Error: 'atan2' function called with more than two arguments.\n");
00472         return NIL;
00473     }
00474     arg = c->first;
00475     if (arg->common.symbol_type == FLOAT_CONSTANT_SYMBOL_TYPE)
00476         denom_value = arg->fc.value;
00477     else
00478         denom_value = (float) arg->ic.value;
00479 
00480     return make_float_constant((float) atan2(numer_value, denom_value));
00481 }
00482 
00483 /*
00484  * ABS_RHS_FUNCTION_CODE
00485  *
00486  * Returns the absolute value of a float as a float, of an int as an int.
00487  */
00488 Symbol *abs_rhs_function_code(list * args)
00489 {
00490     Symbol *arg, *return_value;
00491 
00492     if (!args) {
00493         print("Error: 'abs' function called with no arguments\n");
00494         return NIL;
00495     }
00496 
00497     arg = args->first;
00498     if (arg->common.symbol_type == FLOAT_CONSTANT_SYMBOL_TYPE)
00499         return_value = make_float_constant((float) fabs(arg->fc.value));
00500     else if (arg->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE)
00501         return_value = make_int_constant((arg->ic.value < 0) ? -arg->ic.value : arg->ic.value);
00502     else {
00503         print_with_symbols("Error: 'abs' function called with non-numeric argument %y\n", arg);
00504         return NIL;
00505     }
00506     return return_value;
00507 }
00508 
00509 /* --------------------------------------------------------------------
00510                          int
00511 
00512    Casts the given symbol into an integer.  If the symbol is a sym
00513    constant, a conversion is done.  If the symbol is a float, then
00514    the integer portion is returned.
00515 -------------------------------------------------------------------- */
00516 
00517 Symbol *int_rhs_function_code(list * args)
00518 {
00519     Symbol *sym;
00520 
00521     if (!args) {
00522         print("Error: 'int' function called with no arguments.\n");
00523         return NIL;
00524     }
00525 
00526     if (args->rest) {
00527         print("Error: 'int' takes exactly 1 argument.\n");
00528         return NIL;
00529     }
00530 
00531     sym = (Symbol *) args->first;
00532     if (sym->common.symbol_type == VARIABLE_SYMBOL_TYPE) {
00533         print_with_symbols("Error: variable (%y) passed to 'int' RHS function.\n", sym);
00534         return NIL;
00535     } else if (sym->common.symbol_type == IDENTIFIER_SYMBOL_TYPE) {
00536         print_with_symbols("Error: identifier (%y) passed to 'int' RHS function.\n", sym);
00537         return NIL;
00538     } else if (sym->common.symbol_type == SYM_CONSTANT_SYMBOL_TYPE) {
00539         long int_val;
00540 
00541         errno = 0;
00542         int_val = strtol(symbol_to_string(sym, FALSE, NIL, 0), NULL, 10);
00543         if (errno) {
00544             print("Error: bad integer (%y) given to 'int' RHS function\n", sym);
00545             return NIL;
00546         }
00547         return make_int_constant(int_val);
00548     } else if (sym->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE) {
00549         return sym;
00550     } else if (sym->common.symbol_type == FLOAT_CONSTANT_SYMBOL_TYPE) {
00551         double int_part;
00552         modf((double) sym->fc.value, &int_part);
00553         return make_int_constant((long) int_part);
00554     }
00555 
00556     print("Error: unknown symbol type (%y) given to 'int' RHS function\n", sym);
00557     return NIL;
00558 }
00559 
00560 /* --------------------------------------------------------------------
00561                          float
00562 
00563    Casts the given symbol into an float.  If the symbol is a sym
00564    constant, a conversion is done.  If the symbol is an int, then
00565    the integer portion is converted.
00566 -------------------------------------------------------------------- */
00567 
00568 Symbol *float_rhs_function_code(list * args)
00569 {
00570     Symbol *sym;
00571 
00572     if (!args) {
00573         print("Error: 'float' function called with no arguments.\n");
00574         return NIL;
00575     }
00576 
00577     if (args->rest) {
00578         print("Error: 'float' takes exactly 1 argument.\n");
00579         return NIL;
00580     }
00581 
00582     sym = (Symbol *) args->first;
00583     if (sym->common.symbol_type == VARIABLE_SYMBOL_TYPE) {
00584         print_with_symbols("Error: variable (%y) passed to 'float' RHS function.\n", sym);
00585         return NIL;
00586     } else if (sym->common.symbol_type == IDENTIFIER_SYMBOL_TYPE) {
00587         print_with_symbols("Error: identifier (%y) passed to 'float' RHS function.\n", sym);
00588         return NIL;
00589     } else if (sym->common.symbol_type == SYM_CONSTANT_SYMBOL_TYPE) {
00590         double float_val;
00591 
00592         errno = 0;
00593         /*float_val = strtod(symbol_to_string (sym, FALSE, NIL,0), NULL, 10); */
00594         float_val = strtod(symbol_to_string(sym, FALSE, NIL, 0), NULL);
00595         if (errno) {
00596             print("Error: bad float (%y) given to 'float' RHS function\n", sym);
00597             return NIL;
00598         }
00599         return make_float_constant((float) float_val);
00600     } else if (sym->common.symbol_type == FLOAT_CONSTANT_SYMBOL_TYPE) {
00601         return sym;
00602     } else if (sym->common.symbol_type == INT_CONSTANT_SYMBOL_TYPE) {
00603         return make_float_constant((float) sym->ic.value);
00604     }
00605 
00606     print("Error: unknown symbol type (%y) given to 'float' RHS function\n", sym);
00607     return NIL;
00608 }
00609 
00610 /* ====================================================================
00611 
00612                   Initialize the Built-In RHS Math Functions
00613 
00614 ====================================================================
00615 */
00616 
00617 void init_built_in_rhs_math_functions(void)
00618 {
00619     add_rhs_function(make_sym_constant("+"), plus_rhs_function_code, -1, TRUE, FALSE);
00620     add_rhs_function(make_sym_constant("*"), times_rhs_function_code, -1, TRUE, FALSE);
00621     add_rhs_function(make_sym_constant("-"), minus_rhs_function_code, -1, TRUE, FALSE);
00622     add_rhs_function(make_sym_constant("/"), fp_divide_rhs_function_code, -1, TRUE, FALSE);
00623     add_rhs_function(make_sym_constant("div"), div_rhs_function_code, 2, TRUE, FALSE);
00624     add_rhs_function(make_sym_constant("mod"), mod_rhs_function_code, 2, TRUE, FALSE);
00625 
00626     add_rhs_function(make_sym_constant("sin"), sin_rhs_function_code, 1, TRUE, FALSE);
00627     add_rhs_function(make_sym_constant("cos"), cos_rhs_function_code, 1, TRUE, FALSE);
00628     add_rhs_function(make_sym_constant("atan2"), atan2_rhs_function_code, 2, TRUE, FALSE);
00629     add_rhs_function(make_sym_constant("sqrt"), sqrt_rhs_function_code, 1, TRUE, FALSE);
00630     add_rhs_function(make_sym_constant("abs"), abs_rhs_function_code, 1, TRUE, FALSE);
00631     add_rhs_function(make_sym_constant("int"), int_rhs_function_code, 1, TRUE, FALSE);
00632     add_rhs_function(make_sym_constant("float"), float_rhs_function_code, 1, TRUE, FALSE);
00633 
00634 }
00635 
00636 void remove_built_in_rhs_math_functions(void)
00637 {
00638     remove_rhs_function(make_sym_constant("+"));
00639     remove_rhs_function(make_sym_constant("*"));
00640     remove_rhs_function(make_sym_constant("-"));
00641     remove_rhs_function(make_sym_constant("/"));
00642     remove_rhs_function(make_sym_constant("div"));
00643     remove_rhs_function(make_sym_constant("mod"));
00644     remove_rhs_function(make_sym_constant("sin"));
00645     remove_rhs_function(make_sym_constant("cos"));
00646     remove_rhs_function(make_sym_constant("atan2"));
00647     remove_rhs_function(make_sym_constant("sqrt"));
00648     remove_rhs_function(make_sym_constant("abs"));
00649     remove_rhs_function(make_sym_constant("int"));
00650     remove_rhs_function(make_sym_constant("float"));
00651 }

Generated on Thu Dec 11 13:00:20 2003 for Soar Kernel by doxygen 1.3.5