1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- S Y S T E M . C R T L --
9 -- Copyright (C) 2004-2006, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
32 ------------------------------------------------------------------------------
34 -- This package provides the low level interface to the C Run Time Library
35 -- on 64 bit VMS. Note that routines that allocate memory remain 32bit.
37 with System
.Parameters
;
39 package System
.CRTL
is
42 subtype chars
is System
.Address
;
43 -- Pointer to null-terminated array of characters
45 subtype DIRs
is System
.Address
;
46 -- Corresponds to the C type DIR*
48 subtype FILEs
is System
.Address
;
49 -- Corresponds to the C type FILE*
51 subtype int
is Integer;
53 type long
is range -(2 ** (System
.Parameters
.long_bits
- 1))
54 .. +(2 ** (System
.Parameters
.long_bits
- 1)) - 1;
56 subtype off_t
is Integer;
58 type size_t
is mod 2 ** Standard
'Address_Size;
60 function atoi
(A
: System
.Address
) return Integer;
61 pragma Import
(C
, atoi
, "decc$atoi");
63 procedure clearerr
(stream
: FILEs
);
64 pragma Import
(C
, clearerr
, "decc$clearerr");
66 function dup
(handle
: int
) return int
;
67 pragma Import
(C
, dup
, "decc$dup");
69 function dup2
(from
, to
: int
) return int
;
70 pragma Import
(C
, dup2
, "decc$dup2");
72 function fclose
(stream
: FILEs
) return int
;
73 pragma Import
(C
, fclose
, "decc$fclose");
75 function fdopen
(handle
: int
; mode
: chars
) return FILEs
;
76 pragma Import
(C
, fdopen
, "decc$fdopen");
78 function fflush
(stream
: FILEs
) return int
;
79 pragma Import
(C
, fflush
, "decc$fflush");
81 function fgetc
(stream
: FILEs
) return int
;
82 pragma Import
(C
, fgetc
, "decc$fgetc");
84 function fgets
(strng
: chars
; n
: int
; stream
: FILEs
) return chars
;
85 pragma Import
(C
, fgets
, "decc$_fgets64");
87 function fopen
(filename
: chars
; Mode
: chars
) return FILEs
;
88 pragma Import
(C
, fopen
, "decc$fopen");
90 function fputc
(C
: int
; stream
: FILEs
) return int
;
91 pragma Import
(C
, fputc
, "decc$fputc");
93 function fputs
(Strng
: chars
; Stream
: FILEs
) return int
;
94 pragma Import
(C
, fputs
, "decc$fputs");
96 procedure free
(Ptr
: System
.Address
);
97 pragma Import
(C
, free
, "decc$free");
104 pragma Import
(C
, freopen
, "decc$freopen");
111 pragma Import
(C
, fseek
, "decc$fseek");
113 function ftell
(stream
: FILEs
) return long
;
114 pragma Import
(C
, ftell
, "decc$ftell");
116 function getenv
(S
: String) return System
.Address
;
117 pragma Import
(C
, getenv
, "decc$getenv");
119 function isatty
(handle
: int
) return int
;
120 pragma Import
(C
, isatty
, "decc$isatty");
122 function lseek
(fd
: int
; offset
: off_t
; direction
: int
) return off_t
;
123 pragma Import
(C
, lseek
, "decc$lseek");
125 function malloc
(Size
: size_t
) return System
.Address
;
126 pragma Import
(C
, malloc
, "decc$malloc");
128 procedure memcpy
(S1
: System
.Address
; S2
: System
.Address
; N
: size_t
);
129 pragma Import
(C
, memcpy
, "decc$_memcpy64");
131 procedure memmove
(S1
: System
.Address
; S2
: System
.Address
; N
: size_t
);
132 pragma Import
(C
, memmove
, "decc$_memmove64");
134 procedure mktemp
(template
: chars
);
135 pragma Import
(C
, mktemp
, "decc$_mktemp64");
137 function pclose
(stream
: System
.Address
) return int
;
138 pragma Import
(C
, pclose
, "decc$pclose");
140 function popen
(command
, mode
: System
.Address
) return System
.Address
;
141 pragma Import
(C
, popen
, "decc$popen");
143 function read
(fd
: int
; buffer
: chars
; nbytes
: int
) return int
;
144 pragma Import
(C
, read
, "decc$read");
147 (Ptr
: System
.Address
; Size
: size_t
) return System
.Address
;
148 pragma Import
(C
, realloc
, "decc$realloc");
150 procedure rewind
(stream
: FILEs
);
151 pragma Import
(C
, rewind
, "decc$rewind");
153 procedure rmdir
(dir_name
: String);
154 pragma Import
(C
, rmdir
, "decc$rmdir");
162 pragma Import
(C
, setvbuf
, "decc$setvbuf");
164 procedure tmpnam
(string : chars
);
165 pragma Import
(C
, tmpnam
, "decc$_tmpnam64");
167 function tmpfile
return FILEs
;
168 pragma Import
(C
, tmpfile
, "decc$tmpfile");
170 function ungetc
(c
: int
; stream
: FILEs
) return int
;
171 pragma Import
(C
, ungetc
, "decc$ungetc");
173 function unlink
(filename
: chars
) return int
;
174 pragma Import
(C
, unlink
, "decc$unlink");
176 function write
(fd
: int
; buffer
: chars
; nbytes
: int
) return int
;
177 pragma Import
(C
, write
, "decc$write");