home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / dataflex / set.pkg < prev    next >
Encoding:
Text File  |  1993-08-10  |  2.4 KB  |  92 lines

  1. //************************************************************************
  2. //
  3. // Copyright 1987-1992 Data Access Corporation, Miami FL, USA
  4. // All Rights reserved
  5. // DataFlex is a registered trademark of Data Access Corporation.
  6. //
  7. //
  8. //     $Source: /u3/source.30/product/pkg/RCS/set.pkg,v $
  9. //     $Revision: 1.1 $
  10. //     $State: Exp $
  11. //     $Author: james $
  12. //     $Date: 1992/09/08 14:43:09 $
  13. //     $Locker:  $
  14. //
  15. //     $Log: set.pkg,v $
  16. //Revision 1.1  1992/09/08  14:43:09  james
  17. //Initial revision
  18. //
  19. //Revision 1.4  92/05/14  17:15:20  SWM
  20. //Updated Copyright slug.
  21. //
  22. //Revision 1.3  92/03/09  19:04:28  james
  23. //Added #CHKSUB directive to insure source
  24. //only compiled with correct revision of 
  25. //compiler.
  26. //
  27. //Revision 1.2  91/11/26  17:43:48  elsa
  28. //Only a test
  29. //
  30. //Revision 1.1  91/10/23  10:22:35  elsa
  31. //Initial revision
  32. //
  33. //************************************************************************/
  34.  
  35. //************************************************************************
  36. //     File Name: Set.Pkg
  37. // Creation Date: January 1, 1991
  38. // Modified Date: May 23, 1991
  39. //     Author(s): Steven A. Lowe
  40. //
  41. // This module contains the Set class definition.
  42. //************************************************************************/
  43.  
  44. #CHKSUB 1 1 // Verify the UI subsystem.
  45.  
  46. use ui
  47.  
  48.  
  49. class Set is an ARRAY
  50.  
  51.   Function Find_Element string ElemStr returns integer
  52.     local integer ndx retVal ArrMax
  53.     local string ArrVal
  54.     get item_count to ArrMax
  55.     move -1 to retVal
  56.     move 0 to ndx
  57.     while (ndx < ArrMax AND retVal = -1)
  58.       get array_value item ndx to ArrVal
  59.       if ArrVal eq ElemStr move ndx to retVal
  60.       calc (ndx + 1) to ndx
  61.     end
  62.     function_return retVal
  63.   end_function
  64.  
  65.   procedure Add_Element string ElemStr returns integer
  66.     local integer retVal  
  67.     if (Find_Element(current_object,ElemStr)) lt 0 ;
  68.         set array_value item (item_count(current_object)) to ElemStr
  69.   end_procedure
  70.  
  71.   procedure Remove_Element string ElemStr
  72.     local integer ndx ArrMax counter
  73.     local string tempVal
  74.     get Find_Element item ElemStr to ndx
  75.     if ndx gt -1 send delete_item ndx
  76.   end_procedure
  77.  
  78. end_class
  79.  
  80. //
  81. // global function to create set instances at random
  82. //
  83. function make_set FOR DESKTOP returns integer
  84.   local integer retval
  85.   object SetTemplate is a Set 
  86.     move current_object to retval
  87.   end_object
  88.   function_return retval
  89. end_function
  90.  
  91.  
  92.