home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / vrac / adaada.zip / ADAADA.ZIP / SRC / CW_ADA / CW_EDSY_.ADA < prev    next >
Text File  |  1994-10-12  |  12KB  |  364 lines

  1. -- Copyright (c) 1994 ARINC Research Corporation
  2. -- From material copyright (c) 1991, 1992 Premia Corporation
  3. --
  4. -- This material may be reproduced by or for the US Government pursuant 
  5. -- to the copyright license under DFAR Clause 252.227-7013 (1988)
  6. --
  7. -- Developed for US Air Force under contract no. F41608-90-D-0544-0005
  8. --
  9. -- MODIFICATIONS
  10. --   94/06 - J. Neuse, SD/OSE/EA  - Initial code
  11. --   94/10 - O. Sluder, SD/OSE/EA - Cleanup
  12.  
  13. with CW_TYPES;
  14.  
  15. -- *************
  16. -- *           *
  17. -- *  CW_EDSY  *  BODY
  18. -- *           *
  19. -- *************
  20.  
  21. package body CW_EDSY is
  22.  
  23.   -- The following pragmas are required by the Meridian OpenAda for
  24.   -- Windows 2.0 compiler in the package spec and body of code to be
  25.   -- included in a DLL, or an application calling the DLL will 
  26.   -- general protection fault
  27.   pragma SUPPRESS (elaboration_check);
  28.   pragma SUPPRESS (storage_check);
  29.  
  30.   -- .....................
  31.   -- .                   .
  32.   -- .  ColorAlternate1  .  BODY
  33.   -- .                   .
  34.   -- .....................
  35.   --
  36.     -- NOTES
  37.     --   Again, ColorAlternate1 uses the color IDs as specified in the 
  38.     --   User's Guide, Appendix A. The original Codewright function 
  39.     --   specifies an unsigned 16 bit return value. The Meridian INTEGER 
  40.     --   type was chosen since this type will represent the possible 
  41.     --   values returned for Codewright's color scheme.
  42.  
  43.   function ColorAlternate1 (color : in integer) return integer is
  44.  
  45.     Return_Word : CW_TYPES.WORD;
  46.  
  47.     -- ........................
  48.     -- .                      .
  49.     -- .  CW_ColorAlternate1  .  SPEC
  50.     -- .                      .
  51.     -- ........................
  52.  
  53.     function CW_ColorAlternate1 (color : in integer) return CW_TYPES.WORD;
  54.     pragma INTERFACE (windows, CW_ColorAlternate1, "ColorAlternate1");
  55.  
  56.   begin
  57.  
  58.     Return_Word := CW_ColorAlternate1 (color);
  59.     return INTEGER (Return_Word);
  60.  
  61.   end ColorAlternate1;
  62.  
  63.   -- .....................
  64.   -- .                   .
  65.   -- .  ColorAlternate2  .  BODY
  66.   -- .                   .
  67.   -- .....................
  68.   --
  69.     -- NOTES
  70.     --   Again, ColorAlternate2 uses the color IDs as specified in the 
  71.     --   User's Guide, Appendix A. The original Codewright function 
  72.     --   specifies an unsigned 16 bit return value. The Meridian INTEGER 
  73.     --   type was chosen since this type will represent the possible 
  74.     --   values returned for Codewright's color scheme.
  75.  
  76.   function ColorAlternate2 (color : in integer) return integer is
  77.  
  78.     Return_Word : CW_TYPES.WORD;
  79.  
  80.     -- ........................
  81.     -- .                      .
  82.     -- .  CW_ColorAlternate2  .  SPEC
  83.     -- .                      .
  84.     -- ........................
  85.  
  86.     function CW_ColorAlternate2 (color : in integer) return CW_TYPES.WORD;
  87.     pragma INTERFACE (windows, CW_ColorAlternate2, "ColorAlternate2");
  88.  
  89.   begin
  90.  
  91.     Return_Word := CW_ColorAlternate2 (color);
  92.     return INTEGER (Return_Word);
  93.  
  94.   end ColorAlternate2;
  95.  
  96.   -- .....................
  97.   -- .                   .
  98.   -- .  ColorAlternate3  .  BODY
  99.   -- .                   .
  100.   -- .....................
  101.   --
  102.     -- NOTES
  103.     --   Again, ColorAlternate3 uses the color IDs as specified in the 
  104.     --   User's Guide, Appendix A. The original Codewright function 
  105.     --   specifies an unsigned 16 bit return value. The Meridian INTEGER 
  106.     --   type was chosen since this type will represent the possible 
  107.     --   values returned for Codewright's color scheme.
  108.  
  109.   function ColorAlternate3 (color : in integer) return integer is
  110.  
  111.     Return_Word : CW_TYPES.WORD;
  112.  
  113.     -- ........................
  114.     -- .                      .
  115.     -- .  CW_ColorAlternate3  .  SPEC
  116.     -- .                      .
  117.     -- ........................
  118.  
  119.     function CW_ColorAlternate3 (color : in integer) return CW_TYPES.WORD;
  120.     pragma INTERFACE (windows, CW_ColorAlternate3, "ColorAlternate3");
  121.  
  122.   begin
  123.  
  124.     Return_Word := CW_ColorAlternate3 (color);
  125.     return INTEGER (Return_Word);
  126.  
  127.   end ColorAlternate3;
  128.  
  129.   -- .....................
  130.   -- .                   .
  131.   -- .  ColorAlternate4  .  BODY
  132.   -- .                   .
  133.   -- .....................
  134.   --
  135.     -- NOTES
  136.     --   Again, ColorAlternate4 uses the color IDs as specified in the 
  137.     --   User's Guide, Appendix A. The original Codewright function 
  138.     --   specifies an unsigned 16 bit return value. The Meridian INTEGER 
  139.     --   type was chosen since this type will represent the possible 
  140.     --   values returned for Codewright's color scheme.
  141.  
  142.   function ColorAlternate4 (color : in integer) return integer is
  143.  
  144.     Return_Word : CW_TYPES.WORD;
  145.  
  146.     -- ........................
  147.     -- .                      .
  148.     -- .  CW_ColorAlternate4  .  SPEC
  149.     -- .                      .
  150.     -- ........................
  151.  
  152.     function CW_ColorAlternate4 (color : in integer) return CW_TYPES.WORD;
  153.     pragma INTERFACE (windows, CW_ColorAlternate4, "ColorAlternate4");
  154.  
  155.   begin
  156.  
  157.     Return_Word := CW_ColorAlternate4 (color);
  158.     return INTEGER (Return_Word);
  159.  
  160.   end ColorAlternate4;
  161.  
  162.   -- ...................
  163.   -- .                 .
  164.   -- .  ColorComments  .  BODY
  165.   -- .                 .
  166.   -- ...................
  167.   --
  168.     -- NOTES
  169.     --   Again, ColorComments uses the color IDs as specified in the
  170.     --   User's Guide, Appendix A. The original Codewright function 
  171.     --   specifies an unsigned 16 bit return value. The Meridian INTEGER 
  172.     --   type was chosen since this type will represent the possible 
  173.     --   values returned for Codewright's color scheme. This function 
  174.     --   operates similarly to the ColorAlternate functions.  It returns 
  175.     --   the color codes as specified in the Window, Colors Dialogue for 
  176.     --   Comments.
  177.  
  178.   function ColorComments (color : in integer) return integer is
  179.  
  180.     Return_Word : CW_TYPES.WORD;
  181.  
  182.     -- ......................
  183.     -- .                    .
  184.     -- .  CW_ColorComments  .  SPEC
  185.     -- .                    .
  186.     -- ......................
  187.  
  188.     function CW_ColorComments (color : in integer) return CW_TYPES.WORD;
  189.     pragma INTERFACE (windows, CW_ColorComments, "ColorComments");
  190.  
  191.   begin
  192.  
  193.     Return_Word := CW_ColorComments (color);
  194.     return INTEGER (Return_Word);
  195.  
  196.   end ColorComments;
  197.  
  198.   -- ...................
  199.   -- .                 .
  200.   -- .  ColorKeywords  .  BODY
  201.   -- .                 .
  202.   -- ...................
  203.   --
  204.     -- NOTES
  205.     --   Again, ColorKeywords uses the color IDs as specified in the
  206.     --   User's Guide, Appendix A. The original Codewright function 
  207.     --   specifies an unsigned 16 bit return value. The Meridian INTEGER 
  208.     --   type was chosen since this type will represent the possible 
  209.     --   values returned for Codewright's color scheme. This function 
  210.     --   operates similarly to the ColorAlternate functions.  It returns 
  211.     --   the color codes as specified in the Window, Colors Dialogue for 
  212.     --   Keywords.
  213.  
  214.   function ColorKeywords (color : in integer) return integer is
  215.  
  216.     Return_Word : CW_TYPES.WORD;
  217.  
  218.     -- ......................
  219.     -- .                    .
  220.     -- .  CW_ColorKeywords  .  SPEC
  221.     -- .                    .
  222.     -- ......................
  223.  
  224.     function CW_ColorKeywords (color : in integer) return CW_TYPES.WORD;
  225.     pragma INTERFACE (windows, CW_ColorKeywords, "ColorKeywords");
  226.  
  227.   begin
  228.  
  229.     Return_Word := CW_ColorKeywords (color);
  230.     return INTEGER (Return_Word);
  231.  
  232.   end ColorKeywords;
  233.  
  234.   -- .....................
  235.   -- .                   .
  236.   -- .  HashCreateTable  .  BODY
  237.   -- .                   .
  238.   -- .....................
  239.  
  240.   function HashCreateTable (entries  : in integer;
  241.                             datasize : in integer;
  242.                             mode     : in integer) return SYSTEM.ADDRESS is
  243.  
  244.     Return_LPVOID : CW_TYPES.LPVOID;
  245.  
  246.     -- ........................
  247.     -- .                      .
  248.     -- .  CW_HashCreateTable  .  SPEC
  249.     -- .                      .
  250.     -- ........................
  251.  
  252.     function CW_HashCreateTable (entries  : in integer;
  253.                                  datasize : in integer;
  254.                                  mode     : in integer) return CW_TYPES.LPVOID;
  255.     pragma INTERFACE (windows, CW_HashCreateTable, "HashCreateTable");
  256.  
  257.   begin
  258.  
  259.     Return_LPVOID := CW_HashCreateTable (entries, datasize, mode);
  260.     return SYSTEM.ADDRESS (Return_LPVOID);
  261.  
  262.   end HashCreateTable;
  263.  
  264.   -- ...................
  265.   -- .                 .
  266.   -- .  HashFindEntry  .  BODY
  267.   -- .                 .
  268.   -- ...................
  269.  
  270.   function HashFindEntry (hashTab : in SYSTEM.ADDRESS;
  271.                           key     : in STRING;
  272.                           keyLen  : in integer) return SYSTEM.ADDRESS is
  273.  
  274.     Pass_LPSTR    : CW_TYPES.LPSTR;
  275.     Pass_LPVOID   : CW_TYPES.LPVOID;
  276.     Return_LPVOID : CW_TYPES.LPVOID;
  277.     Temp_Address  : SYSTEM.ADDRESS;
  278.  
  279.     -- ......................
  280.     -- .                    .
  281.     -- .  CW_HashFindEntry  .  SPEC
  282.     -- .                    .
  283.     -- ......................
  284.  
  285.     function CW_HashFindEntry (hashTab : in CW_TYPES.LPVOID;
  286.                                key     : in SYSTEM.ADDRESS;
  287.                                keyLen  : in integer) return CW_TYPES.LPVOID;
  288.     pragma INTERFACE (windows, CW_HashFindEntry, "HashFindEntry");
  289.  
  290.   begin
  291.  
  292.     Pass_LPVOID  := CW_TYPES.LPVOID (hashTab);
  293.     Pass_LPSTR   := new STRING'(key & ASCII.NUL);
  294.     Temp_Address := Pass_LPSTR.all (Pass_LPSTR.all'FIRST)'ADDRESS;
  295.  
  296.     Return_LPVOID := CW_HashFindEntry (Pass_LPVOID, Temp_Address, keyLen);
  297.     return SYSTEM.ADDRESS (Return_LPVOID);
  298.  
  299.   end HashFindEntry;
  300.  
  301.   -- ..................
  302.   -- .                .
  303.   -- .  HashGetEntry  .  BODY
  304.   -- .                .
  305.   -- ..................
  306.  
  307.   function HashGetEntry (hashTab : in SYSTEM.ADDRESS;
  308.                          key     : in STRING;
  309.                          keyLen  : in integer) return SYSTEM.ADDRESS is
  310.  
  311.     Pass_LPSTR    : CW_TYPES.LPSTR;
  312.     Pass_LPVOID   : CW_TYPES.LPVOID;
  313.     Return_LPVOID : CW_TYPES.LPVOID;
  314.     Temp_Address  : SYSTEM.ADDRESS;
  315.  
  316.     -- .....................
  317.     -- .                   .
  318.     -- .  CW_HashGetEntry  .  SPEC
  319.     -- .                   .
  320.     -- .....................
  321.  
  322.     function CW_HashGetEntry (hashTab : in CW_TYPES.LPVOID;
  323.                               key     : in SYSTEM.ADDRESS;
  324.                               keyLen  : in integer) return CW_TYPES.LPVOID;
  325.     pragma INTERFACE (windows, CW_HashGetEntry, "HashGetEntry");
  326.  
  327.   begin
  328.  
  329.     Pass_LPVOID  := CW_TYPES.LPVOID (hashTab);
  330.     Pass_LPSTR   := new STRING'(key & ASCII.NUL);
  331.     Temp_Address := Pass_LPSTR.all (Pass_LPSTR.all'FIRST)'ADDRESS;
  332.  
  333.     Return_LPVOID := CW_HashGetEntry (Pass_LPVOID, Temp_Address, keyLen);
  334.     return SYSTEM.ADDRESS (Return_LPVOID);
  335.  
  336.   end HashGetEntry;
  337.  
  338.   -- ...............
  339.   -- .             .
  340.   -- .  LibExport  .  BODY
  341.   -- .             .
  342.   -- ...............
  343.  
  344.   procedure LibExport (execStr : in STRING) is
  345.  
  346.     Pass_LPSTR : CW_TYPES.LPSTR;
  347.  
  348.     -- ..................
  349.     -- .                .
  350.     -- .  CW_LibExport  .  SPEC
  351.     -- .                .
  352.     -- ..................
  353.  
  354.     procedure CW_LibExport (execStr : in SYSTEM.ADDRESS);
  355.     pragma INTERFACE (windows, CW_LibExport, "LibExport");
  356.  
  357.   begin
  358.  
  359.     Pass_LPSTR := new STRING'(execStr & ASCII.NUL);
  360.     CW_LibExport (Pass_LPSTR.all (Pass_LPSTR.all'FIRST)'ADDRESS);
  361.   end LibExport;
  362.  
  363. end CW_EDSY;
  364.