home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / misc_programming / MSC / MSCTEST.ADA < prev    next >
Encoding:
Text File  |  1990-11-15  |  1.5 KB  |  74 lines

  1. with text_io;   use text_io;
  2. with fio;
  3. with iio;
  4.  
  5. procedure msctest is
  6.   i, j: integer;
  7.   a, b: float;
  8.  
  9.   procedure msc_start;
  10.     pragma INTERFACE(microsoft_C, msc_start);
  11.  
  12.   procedure msc_end;
  13.     pragma INTERFACE(microsoft_C, msc_end);
  14.  
  15.   function cinttst1(x: integer) return integer;
  16.     pragma INTERFACE(microsoft_C, cinttst1);
  17.  
  18.   procedure cinttst2(x, y: integer; z: out integer);
  19.     pragma INTERFACE(microsoft_C, cinttst2);
  20.  
  21.   procedure cflttst(x: in out float;
  22.             y: in out float);
  23.     pragma INTERFACE(microsoft_C, cflttst);
  24.  
  25. begin
  26.   put_line("Beginning of Ada/Microsoft-C Interface Example.");
  27.   new_line;
  28.  
  29.   put_line("Calling msc_start.");
  30.   new_line;
  31.   msc_start;
  32.  
  33.   put_line("Calling cinttst1 ...");
  34.   new_line;
  35.  
  36.   i := cinttst1(4);
  37.  
  38.   new_line;
  39.   put_line("... result returned from cinttst1:");
  40.   put("  i (16) = ");  iio.put(i);  new_line;
  41.   new_line;
  42.  
  43.   put_line("Calling cinttst2 ...");
  44.   new_line;
  45.  
  46.   i := 5;
  47.   cinttst2(i, 11, j);
  48.  
  49.   new_line;
  50.   put_line("... result returned from cinttst2:");
  51.   put("  j (55) = ");  iio.put(j);  new_line;
  52.   new_line;
  53.  
  54.   put_line("Calling cflttst ...");
  55.   new_line;
  56.  
  57.   a := 1.23456;
  58.   b := 9.87654;
  59.  
  60.   cflttst(a,b);
  61.  
  62.   new_line;
  63.   put_line("... results returned from cflttst:");
  64.   put("  a (8.76543) = ");  fio.put(a, aft => 5, exp => 0);  new_line;
  65.   put("  b (2.34567) = ");  fio.put(b, aft => 5, exp => 0);  new_line;
  66.   new_line;
  67.  
  68.   put_line("Calling msc_end.");
  69.   msc_end;
  70.  
  71.   new_line;
  72.   put_line("End of Ada/Microsoft-C Interface Example.");
  73. end;
  74.