| 1 |
(* wrapc.def provides access to more of the C library. |
| 2 |
|
| 3 |
Copyright (C) 2001-2025 Free Software Foundation, Inc. |
| 4 |
Contributed by Gaius Mulley <[email protected]>. |
| 5 |
|
| 6 |
This file is part of GNU Modula-2. |
| 7 |
|
| 8 |
GNU Modula-2 is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation; either version 3, or (at your option) |
| 11 |
any later version. |
| 12 |
|
| 13 |
GNU Modula-2 is distributed in the hope that it will be useful, but |
| 14 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
General Public License for more details. |
| 17 |
|
| 18 |
Under Section 7 of GPL version 3, you are granted additional |
| 19 |
permissions described in the GCC Runtime Library Exception, version |
| 20 |
3.1, as published by the Free Software Foundation. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License and |
| 23 |
a copy of the GCC Runtime Library Exception along with this program; |
| 24 |
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 25 |
<http://www.gnu.org/licenses/>. *) |
| 26 |
|
| 27 |
DEFINITION MODULE wrapc ; |
| 28 |
|
| 29 |
FROM SYSTEM IMPORT ADDRESS ; |
| 30 |
|
| 31 |
|
| 32 |
(* |
| 33 |
strtime - returns the C string for the equivalent C asctime |
| 34 |
function. |
| 35 |
*) |
| 36 |
|
| 37 |
PROCEDURE strtime () : ADDRESS ; |
| 38 |
|
| 39 |
|
| 40 |
(* |
| 41 |
filesize - assigns the size of a file, f, into low, high and |
| 42 |
returns zero if successful. |
| 43 |
*) |
| 44 |
|
| 45 |
PROCEDURE filesize (f: INTEGER; VAR low, high: CARDINAL) : INTEGER ; |
| 46 |
|
| 47 |
|
| 48 |
(* |
| 49 |
fileinode - return the inode associated with file, f. |
| 50 |
*) |
| 51 |
|
| 52 |
PROCEDURE fileinode (f: INTEGER; VAR low, high: CARDINAL) : INTEGER ; |
| 53 |
|
| 54 |
|
| 55 |
(* |
| 56 |
filemtime - returns the mtime of a file, f. |
| 57 |
*) |
| 58 |
|
| 59 |
PROCEDURE filemtime (f: INTEGER) : INTEGER ; |
| 60 |
|
| 61 |
|
| 62 |
(* |
| 63 |
getrand - returns a random number between 0..n-1 |
| 64 |
*) |
| 65 |
|
| 66 |
PROCEDURE getrand (n: INTEGER) : INTEGER ; |
| 67 |
|
| 68 |
|
| 69 |
(* |
| 70 |
getusername - returns a C string describing the current user. |
| 71 |
*) |
| 72 |
|
| 73 |
PROCEDURE getusername () : ADDRESS ; |
| 74 |
|
| 75 |
|
| 76 |
(* |
| 77 |
getnameuidgid - fills in the, uid, and, gid, which represents |
| 78 |
user, name. |
| 79 |
*) |
| 80 |
|
| 81 |
PROCEDURE getnameuidgid (name: ADDRESS; VAR uid, gid: INTEGER) ; |
| 82 |
|
| 83 |
|
| 84 |
(* |
| 85 |
in C these procedure functions are really macros, so we provide |
| 86 |
real C functions and let gm2 call these if the builtins |
| 87 |
are unavailable. |
| 88 |
*) |
| 89 |
|
| 90 |
PROCEDURE signbit (r: REAL) : INTEGER ; |
| 91 |
PROCEDURE signbitf (s: SHORTREAL) : INTEGER ; |
| 92 |
PROCEDURE signbitl (l: LONGREAL) : INTEGER ; |
| 93 |
|
| 94 |
|
| 95 |
(* |
| 96 |
isfinite - provide non builtin alternative to the gcc builtin isfinite. |
| 97 |
Returns 1 if x is finite and 0 if it is not. |
| 98 |
*) |
| 99 |
|
| 100 |
PROCEDURE isfinite (x: REAL) : INTEGER ; |
| 101 |
|
| 102 |
|
| 103 |
(* |
| 104 |
isfinitef - provide non builtin alternative to the gcc builtin isfinite. |
| 105 |
Returns 1 if x is finite and 0 if it is not. |
| 106 |
*) |
| 107 |
|
| 108 |
PROCEDURE isfinitef (x: SHORTREAL) : INTEGER ; |
| 109 |
|
| 110 |
|
| 111 |
(* |
| 112 |
isfinitel - provide non builtin alternative to the gcc builtin isfinite. |
| 113 |
Returns 1 if x is finite and 0 if it is not. |
| 114 |
*) |
| 115 |
|
| 116 |
PROCEDURE isfinitel (x: LONGREAL) : INTEGER ; |
| 117 |
|
| 118 |
|
| 119 |
(* |
| 120 |
isnan - provide non builtin alternative to the gcc builtin isnan. |
| 121 |
Returns 1 if x is a NaN otherwise return 0. |
| 122 |
*) |
| 123 |
|
| 124 |
PROCEDURE isnan (x: REAL) : INTEGER ; |
| 125 |
|
| 126 |
|
| 127 |
(* |
| 128 |
isnanf - provide non builtin alternative to the gcc builtin isnanf. |
| 129 |
Returns 1 if x is a NaN otherwise return 0. |
| 130 |
*) |
| 131 |
|
| 132 |
PROCEDURE isnanf (x: SHORTREAL) : INTEGER ; |
| 133 |
|
| 134 |
|
| 135 |
(* |
| 136 |
isnanl - provide non builtin alternative to the gcc builtin isnanl. |
| 137 |
Returns 1 if x is a NaN otherwise return 0. |
| 138 |
*) |
| 139 |
|
| 140 |
PROCEDURE isnanl (x: LONGREAL) : INTEGER ; |
| 141 |
|
| 142 |
|
| 143 |
(* |
| 144 |
SeekSet - return the system libc SEEK_SET value. |
| 145 |
*) |
| 146 |
|
| 147 |
PROCEDURE SeekSet () : INTEGER ; |
| 148 |
|
| 149 |
|
| 150 |
(* |
| 151 |
SeekEnd - return the system libc SEEK_END value. |
| 152 |
*) |
| 153 |
|
| 154 |
PROCEDURE SeekEnd () : INTEGER ; |
| 155 |
|
| 156 |
|
| 157 |
(* |
| 158 |
ReadOnly - return the system value of O_RDONLY. |
| 159 |
*) |
| 160 |
|
| 161 |
PROCEDURE ReadOnly () : BITSET ; |
| 162 |
|
| 163 |
|
| 164 |
(* |
| 165 |
WriteOnly - return the system value of O_WRONLY. |
| 166 |
*) |
| 167 |
|
| 168 |
PROCEDURE WriteOnly () : BITSET ; |
| 169 |
|
| 170 |
|
| 171 |
END wrapc. |