home *** CD-ROM | disk | FTP | other *** search
/ ftptest.leeds.ac.uk / 2015.02.ftptest.leeds.ac.uk.tar / ftptest.leeds.ac.uk / bionet / CAE-GROUP / SCL-WIN3x / FED_PLUS.EXE / ALG.C next >
C/C++ Source or Header  |  1994-07-21  |  2KB  |  82 lines

  1. static char rcsid[] = "$Id: alg.c,v 1.2 1993/10/15 18:48:48 libes Exp $";
  2.  
  3. /************************************************************************
  4. ** Module:    Algorithm
  5. ** Description:    This module implements the Algorithm abstraction.  An
  6. **    algorithm can be a procedure, a function, or a rule.  It consists
  7. **    of a name, a return type (for functions and rules), a list of
  8. **    formal parameters, and a list of statements (body).
  9. ** Constants:
  10. **    ALGORITHM_NULL    - the null algorithm
  11. **
  12. ************************************************************************/
  13.  
  14. /*
  15.  * This code was developed with the support of the United States Government,
  16.  * and is not subject to copyright.
  17.  *
  18.  * $Log: alg.c,v $
  19.  * Revision 1.2  1993/10/15  18:48:48  libes
  20.  * CADDETC certified
  21.  *
  22.  * Revision 1.5  1993/02/16  03:13:56  libes
  23.  * add Where type
  24.  *
  25.  * Revision 1.4  1992/08/18  17:13:43  libes
  26.  * rm'd extraneous error messages
  27.  *
  28.  * Revision 1.3  1992/06/08  18:06:57  libes
  29.  * prettied up interface to print_objects_when_running
  30.  */
  31.  
  32. #define ALG_C
  33. #include "alg.h"
  34. #include "object.h"
  35. #include "schema.h"
  36. #include "memory.h"
  37.  
  38. Scope
  39. ALGcreate(char type)
  40. {
  41.     Scope s = SCOPEcreate(type);
  42.  
  43.     switch(type) {
  44.     case OBJ_PROCEDURE:
  45.         s->u.proc = PROC_new();
  46.         break;
  47.     case OBJ_FUNCTION:
  48.         s->u.func = FUNC_new();
  49.         break;
  50.     case OBJ_RULE:
  51.         s->u.rule = RULE_new();
  52.         break;
  53.     }
  54.     return s;
  55. }
  56.  
  57. /*
  58. ** Procedure:    ALGinitialize
  59. ** Parameters:    -- none --
  60. ** Returns:    void
  61. ** Description:    Initialize the Algorithm module.
  62. */
  63.  
  64. Symbol *
  65. WHERE_get_symbol(Generic w)
  66. {
  67.     return(((Where)w)->label);
  68. }
  69.  
  70. void
  71. ALGinitialize(void)
  72. {
  73.     MEMinitialize(&FUNC_fl,sizeof(struct Function),    100,50);
  74.     MEMinitialize(&RULE_fl,sizeof(struct Rule),    100,50);
  75.     MEMinitialize(&PROC_fl,sizeof(struct Procedure),100,50);
  76.     MEMinitialize(&WHERE_fl,sizeof(struct Where),100,50);
  77.     OBJcreate(OBJ_RULE,SCOPE_get_symbol,"rule",OBJ_UNUSED_BITS);
  78.     OBJcreate(OBJ_PROCEDURE,SCOPE_get_symbol,"procedure",OBJ_PROCEDURE_BITS);
  79.     OBJcreate(OBJ_FUNCTION,SCOPE_get_symbol,"function",OBJ_FUNCTION_BITS);
  80.     OBJcreate(OBJ_WHERE,WHERE_get_symbol,"where",OBJ_UNFINDABLE_BITS);
  81. }
  82.