home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / ada_1 / Examples_ada_test_int < prev    next >
Encoding:
Text File  |  1994-08-14  |  709 b   |  29 lines

  1. -- ++
  2. -- A simple test for interfacing C to Ada. This example is from the AdaEd
  3. -- documentation.
  4. -- --
  5.  
  6. procedure C_INTERFACES is
  7.    type ARA10 is array(1..10) of INTEGER;
  8.    A10: ARA10 := (1,2,3,4,5,6,7,8,9,10);
  9.  
  10. procedure PRINTA(A:ARA10);
  11. -- PRINTA prints an array of 10 elements of type INTEGER
  12. pragma INTERFACE(C, PRINTA);
  13.  
  14. procedure PRINTS1(A:STRING; LEN: INTEGER);
  15. -- PRINTS1 prints an array of LEN elements of type CHARACTER
  16. pragma INTERFACE(C, PRINTS1);
  17.  
  18. procedure PRINTS(A:STRING) is
  19. -- This routine prints a string by passing the string and its length
  20. -- to the routine PRINTS1 which is written in C.
  21. begin
  22.    PRINTS1(A, A'length);
  23. end;
  24.  
  25. begin
  26.    PRINTA(A10);
  27.    PRINTS("this is any string");
  28. end;
  29.