home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / misc / BST_SystemDocs.lha / BeastV1 / Examples / BST_System / BST_Example2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-03  |  18.7 KB  |  618 lines

  1.  
  2. /****h* Beast/BST_Example2.c [1.0] **************
  3. *
  4. *    NAME
  5. *      BST_Example2 --
  6. *
  7. *    COPYRIGHT
  8. *      Maverick Software Development
  9. *
  10. *    FUNCTION
  11. *
  12. *    AUTHOR
  13. *      Jacco van Weert
  14. *
  15. *    CREATION DATE
  16. *      17-Mar-96
  17. *
  18. *    MODIFICATION HISTORY
  19. *
  20. *    NOTES
  21. *
  22. ****************************************************
  23. */
  24. #include <BEAST:Include/proto/Beast.h>
  25. #include <proto/exec.h>
  26. #include <stdio.h>
  27.  
  28. struct Library *BeastBase;
  29.  
  30. struct TagItem EmptyList[] =
  31. {
  32.   {TAG_DONE, 0}
  33. };
  34.  
  35.  
  36. /*************************************************************
  37.  ***** math class instance definitions, only used for sizeof()!!
  38.  *****/
  39. struct math_ax2_Instance
  40. {
  41.     LONG    A;
  42. };
  43. struct math_bx_Instance
  44. {
  45.     LONG    B;
  46. };
  47. struct math_c_Instance
  48. {
  49.     LONG    C;
  50. };
  51. struct math_xy_Instance
  52. {
  53.     LONG    X,Y;
  54. };
  55.  
  56.  
  57. /***************************************************************************
  58.  ===========================================================================
  59.  **** MATH_ax2_Class methods
  60.  ***************************/
  61. __geta4 rfcall (mth_ax2_Init, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  62. {
  63.   struct math_ax2_Instance *Instance = Macro_GetInstance;
  64.  
  65.   Instance->A = 1;
  66.   return( MethodFlags );
  67. }
  68.  
  69.  
  70.  
  71. /**********************************************
  72.  ----------------------------------------------
  73.  **** Method called when a new X number arrives
  74.  ****/
  75. __geta4 rfcall (mth_ax2_InputX, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  76. {
  77.   struct math_ax2_Instance *Instance = Macro_GetInstance;
  78.   struct TagItem       *cur_ti;
  79.  
  80.   /******************************
  81.    **** Search for the BTA_X tag.
  82.    ****/
  83.   if ( cur_ti = BST_FindTagItem( BTA_X, TagList ))
  84.     {
  85.       LONG X = cur_ti->ti_Data;
  86.  
  87.       struct TagItem TL_Output[] =
  88.       { {BTA_Y, (Instance->A * X*X)},        /**** Calculate A * X^2  ****/
  89.       {TAG_DONE, 0}
  90.       };
  91.       MethodFlags = OBJ_ToOutput( Object,TL_Output, OBM_OUTPUT, 0 );
  92.     }
  93.  
  94.   return( MethodFlags );
  95. }
  96.  
  97.  
  98.  
  99. /***************************************************************
  100.  ---------------------------------------------------------------
  101.  **** Method called the object connected to this method requests
  102.  **** for new input.
  103.  ****/
  104. __geta4 rfcall (mth_ax2_OutputX, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  105. {
  106.   struct math_ax2_Instance *Instance = Macro_GetInstance;
  107.  
  108.   /**************************************************************
  109.    **** We don't cache the A*X*X result so, get it from our input
  110.    ****/
  111.   OBJ_FromInput( Object, OBM_INPUT, 0, EmptyList );
  112.   return( MethodFlags );
  113. }
  114.  
  115.  
  116.  
  117. /*****************************************************************
  118.  -----------------------------------------------------------------
  119.  **** Method call to set some attributes
  120.  **** Note: This routine is a little bit overdone, but it's a demo
  121.  ****/
  122. __geta4 rfcall (mth_ax2_SetAttr, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  123. {
  124.   struct math_ax2_Instance *Instance = Macro_GetInstance;
  125.  
  126.   struct TagItem *cur_ti, *numberof_ti = NULL;
  127.   ULONG  the_tag, nr_attr = 0xFFFFFFFF;
  128.  
  129.   /*******************************
  130.    **** Check for the BTA_NumberOf
  131.    ****/
  132.   if (numberof_ti = BST_FindTagItem( BTA_NumberOf, TagList ))
  133.       {    nr_attr = numberof_ti->ti_Data; }
  134.  
  135.  
  136.   /************************
  137.    **** Set every attribute
  138.    ****/
  139.   for (cur_ti = TagList; ( cur_ti->ti_Tag != TAG_DONE ) &
  140.                ( nr_attr >  0  )       ; cur_ti = BST_NextTagItem( cur_ti ))
  141.     {
  142.       the_tag         = cur_ti->ti_Tag;
  143.       cur_ti->ti_Tag |= BTF_Ignore;
  144.       nr_attr--;
  145.       switch( the_tag )
  146.         {
  147.       case BTA_LongNumber: Instance->A = cur_ti->ti_Data;  break;
  148.           default        : nr_attr++;
  149.                         cur_ti->ti_Tag  &= ~BTF_Ignore; break;
  150.         }
  151.     }
  152.  
  153.   /****************************************************
  154.    **** Reset the MethodFlags if all attributes are set
  155.    ****/
  156.   if (  numberof_ti )
  157.     if (!(numberof_ti->ti_Data = nr_attr))
  158.     MethodFlags &= ~( MTHF_DOPARENTS | MTHF_DOCHILDREN | MTHF_PASSTOCHILD );
  159.  
  160.   return( MethodFlags );
  161. }
  162.  
  163.  
  164.  
  165.  
  166.  
  167. /***************************************************************************
  168.  ===========================================================================
  169.  **** MATH_bx_Class methods
  170.  **************************/
  171. __geta4 rfcall (mth_bx_Init, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  172. {
  173.   struct math_bx_Instance *Instance = Macro_GetInstance;
  174.  
  175.   Instance->B = 1.0;
  176.   return( MethodFlags );
  177. }
  178.  
  179.  
  180.  
  181. /**********************************************
  182.  ----------------------------------------------
  183.  **** Method called when a new X number arrives
  184.  ****/
  185. __geta4 rfcall (mth_bx_InputX, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  186. {
  187.   struct math_bx_Instance *Instance = Macro_GetInstance;
  188.   struct TagItem       *cur_ti;
  189.  
  190.   /******************************
  191.    **** Search for the BTA_X tag.
  192.    ****/
  193.   if ( cur_ti = BST_FindTagItem( BTA_X, TagList ))
  194.     {
  195.       LONG X = cur_ti->ti_Data;
  196.  
  197.       struct TagItem TL_Output[] =
  198.       { {BTA_Y, (Instance->B * X)},        /**** Calculate B * X   ****/
  199.       {TAG_DONE, 0}
  200.       };
  201.       MethodFlags = OBJ_ToOutput( Object,TL_Output, OBM_OUTPUT, 0 );
  202.     }
  203.  
  204.   return( MethodFlags );
  205. }
  206.  
  207.  
  208.  
  209. /***************************************************************
  210.  ---------------------------------------------------------------
  211.  **** Method called the object connected to this method requests
  212.  **** for new input.
  213.  ****/
  214. __geta4 rfcall (mth_bx_OutputX, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  215. {
  216.   struct my_bx_Instance *Instance = Macro_GetInstance;
  217.  
  218.   /************************************************************
  219.    **** We don't cache the B*X result so, get it from our input
  220.    ****/
  221.   OBJ_FromInput( Object, OBM_INPUT, 0, EmptyList );
  222.   return( MethodFlags );
  223. }
  224.  
  225.  
  226.  
  227. /*****************************************************************
  228.  -----------------------------------------------------------------
  229.  **** Method call to set some attributes
  230.  **** Note: This routine is a little bit overdone, but it's a demo
  231.  ****/
  232. __geta4 rfcall (mth_bx_SetAttr, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  233. {
  234.   struct math_bx_Instance *Instance = Macro_GetInstance;
  235.  
  236.   struct TagItem *cur_ti, *numberof_ti = NULL;
  237.   ULONG  the_tag, nr_attr = 0xFFFFFFFF;
  238.  
  239.   /*******************************
  240.    **** Check for the BTA_NumberOf
  241.    ****/
  242.   if (numberof_ti = BST_FindTagItem( BTA_NumberOf, TagList ))
  243.       {    nr_attr = numberof_ti->ti_Data; }
  244.  
  245.  
  246.   /************************
  247.    **** Set every attribute
  248.    ****/
  249.   for (cur_ti = TagList; ( cur_ti->ti_Tag != TAG_DONE ) &
  250.                ( nr_attr >  0  )       ; cur_ti = BST_NextTagItem( cur_ti ))
  251.     {
  252.       the_tag         = cur_ti->ti_Tag;
  253.       cur_ti->ti_Tag |= BTF_Ignore;
  254.       nr_attr--;
  255.       switch( the_tag )
  256.         {
  257.       case BTA_LongNumber: Instance->B = cur_ti->ti_Data;  break;
  258.           default        : nr_attr++;
  259.                         cur_ti->ti_Tag  &= ~BTF_Ignore; break;
  260.         }
  261.     }
  262.  
  263.   /****************************************************
  264.    **** Reset the MethodFlags if all attributes are set
  265.    ****/
  266.   if (  numberof_ti )
  267.     if (!(numberof_ti->ti_Data = nr_attr))
  268.     MethodFlags &= ~( MTHF_DOPARENTS | MTHF_DOCHILDREN | MTHF_PASSTOCHILD );
  269.  
  270.   return( MethodFlags );
  271. }
  272.  
  273.  
  274.  
  275. /***************************************************************************
  276.  ===========================================================================
  277.  **** MATH_c_Class methods
  278.  *************************/
  279. __geta4 rfcall (mth_c_Init, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  280. {
  281.   struct math_c_Instance *Instance = Macro_GetInstance;
  282.  
  283.   Instance->C = 0.0;
  284.   return( MethodFlags );
  285. }
  286.  
  287.  
  288.  
  289. /**********************************************
  290.  ----------------------------------------------
  291.  **** Method called when a new X number arrives
  292.  ****/
  293. __geta4 rfcall (mth_c_InputX, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  294. {
  295.   struct math_c_Instance *Instance = Macro_GetInstance;
  296.  
  297.   struct TagItem TL_Output[] =
  298.     { {BTA_Y,    Instance->C},
  299.       {TAG_DONE, 0}
  300.     };
  301.   MethodFlags = OBJ_ToOutput( Object,TL_Output, OBM_OUTPUT, 0 );
  302.  
  303.   return( MethodFlags );
  304. }
  305.  
  306.  
  307.  
  308. /***************************************************************
  309.  ---------------------------------------------------------------
  310.  **** Method called the object connected to this method requests
  311.  **** for new input.
  312.  ****/
  313. __geta4 rfcall (mth_c_OutputX, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  314. {
  315.  
  316.   /***********************************
  317.    **** Just call our OBM_INPUT method
  318.    ****/
  319.   OBJ_DoMethod( Object, OBM_INPUT, EmptyList, 0 );
  320.   return( MethodFlags );
  321. }
  322.  
  323.  
  324.  
  325. /*****************************************************************
  326.  -----------------------------------------------------------------
  327.  **** Method call to set some attributes
  328.  **** Note: This routine is a little bit overdone, but it's a demo
  329.  ****/
  330. __geta4 rfcall (mth_c_SetAttr, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  331. {
  332.   struct math_c_Instance *Instance = Macro_GetInstance;
  333.  
  334.   struct TagItem *cur_ti, *numberof_ti = NULL;
  335.   ULONG  the_tag, nr_attr = 0xFFFFFFFF;
  336.  
  337.   /*******************************
  338.    **** Check for the BTA_NumberOf
  339.    ****/
  340.   if (numberof_ti = BST_FindTagItem( BTA_NumberOf, TagList ))
  341.       {    nr_attr = numberof_ti->ti_Data; }
  342.  
  343.  
  344.   /************************
  345.    **** Set every attribute
  346.    ****/
  347.   for (cur_ti = TagList; ( cur_ti->ti_Tag != TAG_DONE ) &
  348.                ( nr_attr >  0  )       ; cur_ti = BST_NextTagItem( cur_ti ))
  349.     {
  350.       the_tag         = cur_ti->ti_Tag;
  351.       cur_ti->ti_Tag |= BTF_Ignore;
  352.       nr_attr--;
  353.       switch( the_tag )
  354.         {
  355.       case BTA_LongNumber:     Instance->C = cur_ti->ti_Data;  break;
  356.           default           :     nr_attr++;
  357.                       cur_ti->ti_Tag  &= ~BTF_Ignore; break;
  358.         }
  359.     }
  360.  
  361.   /****************************************************
  362.    **** Reset the MethodFlags if all attributes are set
  363.    ****/
  364.   if (  numberof_ti )
  365.     if (!(numberof_ti->ti_Data = nr_attr))
  366.     MethodFlags &= ~( MTHF_DOPARENTS | MTHF_DOCHILDREN | MTHF_PASSTOCHILD );
  367.  
  368.   return( MethodFlags );
  369. }
  370.  
  371.  
  372.  
  373.  
  374. /***************************************************************************
  375.  ===========================================================================
  376.  **** MATH_xy_Class methods
  377.  **************************/
  378. __geta4 rfcall (mth_xy_Init, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  379. {
  380.   struct math_xy_Instance *Instance = Macro_GetInstance;
  381.  
  382.   Instance->X = 0.0;
  383.   Instance->Y = 0.0;
  384.   return( MethodFlags );
  385. }
  386.  
  387.  
  388.  
  389. /**********************************************************
  390.  ----------------------------------------------------------
  391.  **** Method called when a new _part_ of the result arrives
  392.  ****/
  393. __geta4 rfcall (mth_xy_InputY, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  394. {
  395.   struct math_xy_Instance *Instance = Macro_GetInstance;
  396.   struct TagItem      *cur_ti;
  397.  
  398.   /******************************
  399.    **** Search for the BTA_Y tag.
  400.    ****/
  401.   if ( cur_ti = BST_FindTagItem( BTA_Y, TagList ))
  402.     {
  403.       Instance->Y = Instance->Y + cur_ti->ti_Data;
  404.     }
  405.  
  406.   return( MethodFlags );
  407. }
  408.  
  409.  
  410.  
  411. /***************************************************************
  412.  ---------------------------------------------------------------
  413.  **** Method called the object connected to this method requests
  414.  **** for new input.
  415.  ****/
  416. __geta4 rfcall (mth_xy_OutputX, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  417. {
  418.   struct math_xy_Instance *Instance = Macro_GetInstance;
  419.  
  420.   Instance->Y = 0;    /**** Reset the result ****/
  421.  
  422.   struct TagItem TL_Output[] =
  423.     { {BTA_X, Instance->X},
  424.       {TAG_DONE, 0}
  425.     };
  426.   MethodFlags = OBJ_ToOutput( Object, TL_Output, OBM_OUTPUT, 0 );
  427.  
  428.   printf("**** Y result = %ld \n", Instance->Y );
  429.  
  430.   return( MethodFlags );
  431. }
  432.  
  433.  
  434.  
  435. /*****************************************************************
  436.  -----------------------------------------------------------------
  437.  **** Method call to set some attributes
  438.  **** Note: This routine is a little bit overdone, but it's a demo
  439.  ****/
  440. __geta4 rfcall (mth_xy_SetAttr, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  441. {
  442.   struct math_xy_Instance *Instance = Macro_GetInstance;
  443.  
  444.   struct TagItem *cur_ti, *numberof_ti = NULL;
  445.   ULONG  the_tag, nr_attr = 0xFFFFFFFF;
  446.  
  447.   /*******************************
  448.    **** Check for the BTA_NumberOf
  449.    ****/
  450.   if (numberof_ti = BST_FindTagItem( BTA_NumberOf, TagList ))
  451.       {    nr_attr = numberof_ti->ti_Data; }
  452.  
  453.  
  454.   /************************
  455.    **** Set every attribute
  456.    ****/
  457.   for (cur_ti = TagList; ( cur_ti->ti_Tag != TAG_DONE ) &
  458.                ( nr_attr >  0  )       ; cur_ti = BST_NextTagItem( cur_ti ))
  459.     {
  460.       the_tag         = cur_ti->ti_Tag;
  461.       cur_ti->ti_Tag |= BTF_Ignore;
  462.       nr_attr--;
  463.       switch( the_tag )
  464.         {
  465.       case BTA_X: Instance->X = cur_ti->ti_Data;  break;
  466.           default   : nr_attr++;
  467.                     cur_ti->ti_Tag  &= ~BTF_Ignore; break;
  468.         }
  469.     }
  470.  
  471.   /****************************************************
  472.    **** Reset the MethodFlags if all attributes are set
  473.    ****/
  474.   if (  numberof_ti )
  475.     if (!(numberof_ti->ti_Data = nr_attr))
  476.     MethodFlags &= ~( MTHF_DOPARENTS | MTHF_DOCHILDREN | MTHF_PASSTOCHILD );
  477.  
  478.   return( MethodFlags );
  479. }
  480.  
  481.  
  482.  
  483.  
  484. /*********************************/
  485. /**** M A I N - P R O G R A M ****/
  486. /*********************************/
  487. main()
  488. {
  489.   struct BST_Class  *math_ax2_class, *math_bx_class, *math_c_class, *math_xy_class;
  490.   struct BST_Object *math_ax2_obj,   *math_bx_obj,   *math_c_obj,   *math_xy_obj;
  491.   
  492.   printf("*** Beast OO Example2 START ***\n");
  493.   if (BeastBase = (struct Library *)OpenLibrary("beast.library",0))
  494.     {
  495.  
  496.       math_ax2_class = BST_MakeClass( "MATH_ax2Class", sizeof( struct math_ax2_Instance ));
  497.       math_bx_class  = BST_MakeClass( "MATH_bxClass",  sizeof( struct math_bx_Instance  ));
  498.       math_c_class   = BST_MakeClass( "MATH_cClass",   sizeof( struct math_c_Instance   ));
  499.       math_xy_class  = BST_MakeClass( "MATH_xyClass",  sizeof( struct math_xy_Instance  ));
  500.  
  501.  
  502.       CLSS_AddMethod( math_ax2_class, &mth_ax2_Init,    OBM_INIT    );
  503.       CLSS_AddMethod( math_ax2_class, &mth_ax2_InputX,  OBM_INPUT   );
  504.       CLSS_AddMethod( math_ax2_class, &mth_ax2_OutputX, OBM_OUTPUT  );
  505.       CLSS_AddMethod( math_ax2_class, &mth_ax2_SetAttr, OBM_SETATTR );
  506.       CLSS_AddMethod( math_bx_class,  &mth_bx_Init,     OBM_INIT    );
  507.       CLSS_AddMethod( math_bx_class,  &mth_bx_InputX,   OBM_INPUT   );
  508.       CLSS_AddMethod( math_bx_class,  &mth_bx_OutputX,  OBM_OUTPUT  );
  509.       CLSS_AddMethod( math_bx_class,  &mth_bx_SetAttr,     OBM_SETATTR );
  510.       CLSS_AddMethod( math_c_class,   &mth_c_Init,      OBM_INIT    );
  511.       CLSS_AddMethod( math_c_class,   &mth_c_InputX,    OBM_INPUT   );
  512.       CLSS_AddMethod( math_c_class,   &mth_c_OutputX,   OBM_OUTPUT  );
  513.       CLSS_AddMethod( math_c_class,   &mth_c_SetAttr,     OBM_SETATTR );
  514.       CLSS_AddMethod( math_xy_class,  &mth_xy_Init,     OBM_INIT    );
  515.       CLSS_AddMethod( math_xy_class,  &mth_xy_InputY,   OBM_INPUT   );
  516.       CLSS_AddMethod( math_xy_class,  &mth_xy_OutputX,  OBM_OUTPUT  );
  517.       CLSS_AddMethod( math_xy_class,  &mth_xy_SetAttr,     OBM_SETATTR );
  518.  
  519.  
  520.       BST_AddClass(   math_ax2_class );
  521.       BST_AddClass(   math_bx_class  );
  522.       BST_AddClass(   math_c_class   );
  523.       BST_AddClass(   math_xy_class  );
  524.  
  525.       /***************************
  526.        **** Now create the objects
  527.        ****/
  528.       math_ax2_obj = OBJ_NewObject( NULL, "MATH_ax2Class", NULL );
  529.       if (math_ax2_obj != NULL)
  530.       {
  531.     math_bx_obj = OBJ_NewObject( NULL, "MATH_bxClass", NULL );
  532.     if (math_bx_obj != NULL)
  533.     {
  534.       math_c_obj = OBJ_NewObject( NULL, "MATH_cClass", NULL );
  535.       if (math_c_obj != NULL)
  536.       {
  537.         math_xy_obj = OBJ_NewObject( NULL, "MATH_xyClass", NULL );
  538.         if (math_xy_obj != NULL)
  539.         {
  540.           OBJ_DoMethod( math_ax2_obj, OBM_INIT, EmptyList, 0 );
  541.           OBJ_DoMethod( math_bx_obj,  OBM_INIT, EmptyList, 0 );
  542.           OBJ_DoMethod( math_c_obj,   OBM_INIT, EmptyList, 0 );
  543.  
  544.           /**** Create the connection (the actual program) ****
  545.            *
  546.            * The object connection will look like;
  547.            *
  548.            *
  549.            *     OBM_INPUT  ,--------------, OBM_OUTPUT
  550.            *  ,------------>| math_ax2_obj |------------,
  551.            *  |        `--------------'            |
  552.            *  |                            | OBM_INPUT
  553.            *  |  OBM_INPUT  ,--------------, OBM_OUTPUT \    ,-------------, OBM_OUTPUT
  554.            *  |------------>| math_bx_obj  |--------------->| math_xy_obj |---,
  555.            *  |        `--------------'        /    `-------------'      |
  556.            *  |                        |              |
  557.            *  |  OBM_INPUT    ,--------------, OBM_OUTPUT |              |
  558.            *  |------------>| math_c_obj   |------------'              |
  559.            *  |        `--------------'                  |
  560.            *  |                                  |
  561.            *  `---------------------------------------------------------------'
  562.            *
  563.            *******************************************************/
  564.  
  565.           OBJ_CreateConnection( math_ax2_obj, math_xy_obj,  OBM_OUTPUT, OBM_INPUT );
  566.           OBJ_CreateConnection( math_bx_obj,  math_xy_obj,  OBM_OUTPUT, OBM_INPUT );
  567.           OBJ_CreateConnection( math_c_obj,   math_xy_obj,  OBM_OUTPUT, OBM_INPUT );
  568.           OBJ_CreateConnection( math_xy_obj,  math_ax2_obj, OBM_OUTPUT, OBM_INPUT );
  569.           OBJ_CreateConnection( math_xy_obj,  math_bx_obj,  OBM_OUTPUT, OBM_INPUT );
  570.           OBJ_CreateConnection( math_xy_obj,  math_c_obj,   OBM_OUTPUT, OBM_INPUT );
  571.  
  572.  
  573.           /**** Setting our values ****/
  574.           { struct TagItem TL_SetAttr[] = { {BTA_NumberOf, 1}, {BTA_LongNumber, 1}, {TAG_DONE, 0} };
  575.             OBJ_DoMethod( math_ax2_obj, OBM_SETATTR, TL_SetAttr, 0 ); }
  576.           { struct TagItem TL_SetAttr[] = { {BTA_NumberOf, 1}, {BTA_LongNumber, 1}, {TAG_DONE, 0} };
  577.             OBJ_DoMethod( math_bx_obj,  OBM_SETATTR, TL_SetAttr, 0 ); }
  578.           { struct TagItem TL_SetAttr[] = { {BTA_NumberOf, 1}, {BTA_LongNumber, 4}, {TAG_DONE, 0} };
  579.             OBJ_DoMethod( math_c_obj,   OBM_SETATTR, TL_SetAttr, 0 ); }
  580.  
  581.           { struct TagItem TL_SetAttr[] = { {BTA_NumberOf, 1}, {BTA_X, 2}, {TAG_DONE, 0} };
  582.             OBJ_DoMethod( math_xy_obj,  OBM_SETATTR, TL_SetAttr, 0 ); }
  583.  
  584.           /**** Play around ****/
  585.           { struct TagItem TL_Start[] = { {TAG_DONE, 0} };
  586.             OBJ_DoMethod( math_xy_obj, OBM_OUTPUT, TL_Start, 0 ); }
  587.  
  588.         }
  589.       }
  590.     }
  591.       }
  592.  
  593.       /**************************
  594.        **** Get rid of our object
  595.        ****/
  596.       OBJ_DisposeObject( math_ax2_obj );
  597.       OBJ_DisposeObject( math_bx_obj  );
  598.       OBJ_DisposeObject( math_c_obj   );
  599.       OBJ_DisposeObject( math_xy_obj  );
  600.  
  601.       /***********************
  602.        **** Remove the classes
  603.        ****/
  604.       BST_RemoveClass( math_xy_class  );
  605.       BST_RemoveClass( math_c_class   );
  606.       BST_RemoveClass( math_bx_class  );
  607.       BST_RemoveClass( math_ax2_class );
  608.  
  609.       BST_FreeClass(   math_xy_class  );
  610.       BST_FreeClass(   math_c_class   );
  611.       BST_FreeClass(   math_bx_class  );
  612.       BST_FreeClass(   math_ax2_class );
  613.  
  614.       CloseLibrary( BeastBase );
  615.     }
  616.   printf("*** Beast OO Example2 END ***\n");
  617. }
  618.