Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/branches/idlbasis-devel/src/system/Basis/Implementation/sml-basis.idl
ViewVC logotype

Annotation of /sml/branches/idlbasis-devel/src/system/Basis/Implementation/sml-basis.idl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1245 - (view) (download)

1 : blume 1245 /* sml-basis.idl
2 :     *
3 :     * COPYRIGHT (c) 2001 Bell Labs, Lucent Technologies.
4 :     *
5 :     * This file is a ML-IDL specification of the run-time library
6 :     * that supports the generic system interfaces of the SML'97 Basis.
7 :     */
8 :    
9 :     sml_structure ("SMLBasis");
10 :     sml_signature ("SML_BASIS");
11 :     clib_name ("SMLBasis");
12 :    
13 :     cpp_quote("#include \"ml-timer.h\""); /* for Time_t */
14 :    
15 :    
16 :     /******************** Useful IDL types ********************/
17 :    
18 :     typedef [string] char* idl_string;
19 :    
20 :     /******************** Common SML types ********************/
21 :    
22 :     typedef [sml_type ("Word8Vector.vector")] sml_value ML_word8vec_t;
23 :     typedef [sml_type ("Word8Vector.vector option")] sml_value ML_word8vec_opt_t;
24 :     typedef [sml_type ("Word8Array.array")] sml_value ML_word8arr_t;
25 :     typedef [sml_type ("CharVector.vector")] sml_value ML_charvec_t;
26 :     typedef [sml_type ("CharVector.vector option")] sml_value ML_charvec_opt_t;
27 :     typedef [sml_type ("CharArray.array")] sml_value ML_chararr_t;
28 :     typedef [sml_type ("unit")] sml_value ML_unit_t;
29 :     typedef [sml_type ("bool")] sml_value ML_bool_t;
30 :     typedef [sml_type ("int")] sml_value ML_int_t;
31 :     typedef [sml_type ("Int32.int")] sml_value ML_int32_t;
32 :     typedef [sml_type ("string")] sml_value ML_string_t;
33 :     typedef [sml_type ("string option")] sml_value ML_string_opt_t;
34 :     typedef [sml_type ("string list")] sml_value ML_string_list_t;
35 :     typedef [sml_type ("int option")] sml_value ML_int_opt_t;
36 :    
37 :     /******************** Exported run-time system types ********************/
38 :     /* typedef [ptr] struct struct_iodesc *IODesc_t; */
39 :     /* typedef [ptr] struct struct_directory *Directory_t; */
40 :     typedef [sml_type("Unsafe.Object.object")] sml_value ML_iodesc_t;
41 :     typedef [sml_type("Unsafe.Object.object")] sml_value ML_directory_t;
42 :     typedef [exclude] struct struct_time {
43 :     int seconds;
44 :     int uSeconds;
45 :     } Time_t;
46 :     typedef [sml_type ("(word * Unsafe.Object.object) list")] sml_value
47 :     ML_polldesc_list_t;
48 :     typedef [sml_type ("(word * Unsafe.Object.object) list")] sml_value
49 :     ML_pollinfo_list_t;
50 :    
51 :     /******************** Types for argument passing ********************/
52 :    
53 :     typedef struct struct_date {
54 :     int tm_sec;
55 :     int tm_min;
56 :     int tm_hour;
57 :     int tm_mday;
58 :     int tm_mon;
59 :     int tm_year;
60 :     int tm_wday;
61 :     int tm_yday;
62 :     int tm_isdst;
63 :     } Date_t;
64 :    
65 :    
66 :     /******************** IEEEReal support ********************/
67 :    
68 :     const sml_int TO_NEAREST = 0;
69 :     const sml_int TO_NEGINF = 1;
70 :     const sml_int TO_POSINF = 2;
71 :     const sml_int TO_ZERO = 3;
72 :    
73 :     sml_int getRoundingMode ();
74 :     void setRoundingMode ([in] sml_int mode);
75 :    
76 :     /******************** BinPrimIO and TextPrimIO support ********************/
77 :    
78 :     /* openFile flags: one of (OPEN_RD, OPEN_WR, OPEN_RDWR) ored with others */
79 :     const sml_int OPEN_RD = 1;
80 :     const sml_int OPEN_WR = 2;
81 :     const sml_int OPEN_RDWR = 3;
82 :     const sml_int OPEN_CREATE = 4;
83 :     const sml_int OPEN_TRUNC = 8;
84 :     const sml_int OPEN_APPEND = 16;
85 :    
86 :     [sml_context] ML_iodesc_t openFile (
87 :     [in] ML_string_t s,
88 :     [in] sml_int flags);
89 :     void closeFile ([in] ML_iodesc_t iod);
90 :    
91 :     /* compare two ID descriptors; returns <0, =0, or >0 */
92 :     sml_int cmpIODesc ([in] ML_iodesc_t iod1, [in] ML_iodesc_t iod2);
93 :    
94 :     /* I/O operations: non-blocking is supported by passing true for
95 :     * the first argument. If the operation would block, then it returns
96 :     * either NONE (for read*Vec) or -1. EOF is signalled by returning
97 :     * either SOME("") (for read*Vec) or 0. Errors are signalled by raising
98 :     * an exception.
99 :     */
100 :     [sml_context] ML_charvec_opt_t readTextVec (
101 :     [in] boolean noblock,
102 :     [in] ML_iodesc_t iod,
103 :     [in] sml_int nbytes);
104 :     [sml_context] ML_int_t readTextArr (
105 :     [in] boolean noblock,
106 :     [in] ML_iodesc_t iod,
107 :     [in] ML_chararr_t arr,
108 :     [in] sml_int nbytes,
109 :     [in] sml_int offset);
110 :     [sml_context] ML_int_t writeTextVec (
111 :     [in] boolean noblock,
112 :     [in] ML_iodesc_t iod,
113 :     [in] ML_charvec_t buf,
114 :     [in] sml_int offset,
115 :     [in] sml_int nbytes);
116 :     [sml_context] ML_int_t writeTextArr (
117 :     [in] boolean noblock,
118 :     [in] ML_iodesc_t iod,
119 :     [in] ML_chararr_t buf,
120 :     [in] sml_int offset,
121 :     [in] sml_int nbytes);
122 :     [sml_context] ML_word8vec_opt_t readBinVec (
123 :     [in] boolean noblock,
124 :     [in] ML_iodesc_t iod,
125 :     [in] sml_int nbytes);
126 :     [sml_context] ML_int_t readBinArr (
127 :     [in] boolean noblock,
128 :     [in] ML_iodesc_t iod,
129 :     [in] ML_word8arr_t arr,
130 :     [in] sml_int nbytes,
131 :     [in] sml_int offset);
132 :     [sml_context] ML_int_t writeBinVec (
133 :     [in] boolean noblock,
134 :     [in] ML_iodesc_t iod,
135 :     [in] ML_word8vec_t buf,
136 :     [in] sml_int offset,
137 :     [in] sml_int nbytes);
138 :     [sml_context] ML_int_t writeBinArr (
139 :     [in] boolean noblock,
140 :     [in] ML_iodesc_t iod,
141 :     [in] ML_word8arr_t buf,
142 :     [in] sml_int offset,
143 :     [in] sml_int nbytes);
144 :     const sml_int SET_POS_BEGIN = 0;
145 :     const sml_int SET_POS_CUR = 1;
146 :     const sml_int SET_POS_END = 2;
147 :     [sml_context] ML_int32_t getPos ([in] ML_iodesc_t iod);
148 :     [sml_context] ML_unit_t setPos (
149 :     [in] ML_iodesc_t iod,
150 :     [in] ML_int32_t offset,
151 :     [in] sml_int whence);
152 :    
153 :     /******************** TextIO support ********************/
154 :    
155 :     ML_iodesc_t getStdIn ();
156 :     ML_iodesc_t getStdOut ();
157 :     ML_iodesc_t getStdErr ();
158 :    
159 :     /******************** OS support ********************/
160 :    
161 :     [sml_context] ML_string_t errorName ([in] int err);
162 :     [sml_context] ML_string_t errorMessage ([in] int err);
163 :     [sml_context] ML_int_opt_t syserror ([in] idl_string errName);
164 :    
165 :     /******************** OS.Process support ********************/
166 :    
167 :     [sml_context] ML_int_t osSystem ([in] idl_string name);
168 :     void exit ([in] sml_int sts);
169 :     [sml_context] ML_string_opt_t getEnv ([in] idl_string ss);
170 :     void osSleep ([in, ref] Time_t *t);
171 :    
172 :     /******************** OS.FileSys support ********************/
173 :    
174 :     [sml_context] ML_directory_t openDir ([in] idl_string path);
175 :     [sml_context] ML_string_opt_t readDir ([in] ML_directory_t dir);
176 :     [sml_context] ML_unit_t rewindDir ([in] ML_directory_t dir);
177 :     [sml_context] ML_unit_t closeDir ([in] ML_directory_t dir);
178 :     [sml_context] ML_unit_t chDir ([in] idl_string path);
179 :     [sml_context] ML_string_t getDir ();
180 :     [sml_context] ML_unit_t mkDir ([in] idl_string path);
181 :     [sml_context] ML_unit_t rmDir ([in] idl_string path);
182 :     [sml_context] ML_bool_t isReg ([in] idl_string path);
183 :     [sml_context] ML_bool_t isDir ([in] idl_string path);
184 :     [sml_context] ML_bool_t isLink ([in] idl_string path);
185 :     [sml_context] ML_string_t readLink ([in] idl_string path);
186 :     [sml_context] ML_int32_t fileSize ([in] idl_string path);
187 :     /* NOTE: modTime returns the time in seconds! */
188 :     [sml_context] ML_int32_t modTime ([in] idl_string path);
189 :     [sml_context] ML_unit_t setTime ([in] idl_string path, [in, unique] Time_t *t);
190 :     [sml_context] ML_unit_t removeFile ([in] idl_string path);
191 :     [sml_context] ML_unit_t renameFile ([in] idl_string old, [in] idl_string new);
192 :     const sml_int A_READ = 1;
193 :     const sml_int A_WRITE = 2;
194 :     const sml_int A_EXEC = 4;
195 :     [sml_context] ML_bool_t fileAccess ([in] idl_string path, [in] sml_int mode);
196 :     [sml_context] ML_string_t tmpName ();
197 :     [sml_context] ML_word8vec_t fileId ([in] idl_string path);
198 :    
199 :     /******************** OS.IO support ********************/
200 :    
201 :     const sml_int IOD_KIND_FILE = 0;
202 :     const sml_int IOD_KIND_DIR = 1;
203 :     const sml_int IOD_KIND_SYMLINK = 2;
204 :     const sml_int IOD_KIND_TTY = 3;
205 :     const sml_int IOD_KIND_PIPE = 4;
206 :     const sml_int IOD_KIND_SOCKET = 5;
207 :     const sml_int IOD_KIND_DEVICE = 6;
208 :    
209 :     [sml_context] ML_int_t ioDescKind ([in] ML_iodesc_t iod);
210 :    
211 :     /* bit flags for poll descriptors and poll_info descriptors */
212 :     const sml_word POLL_RD = 1;
213 :     const sml_word POLL_WR = 2;
214 :     const sml_word POLL_ERR = 4;
215 :    
216 :     [sml_context] ML_pollinfo_list_t osPoll (
217 :     [in] ML_polldesc_list_t pds,
218 :     [in, unique] Time_t *t);
219 :    
220 :     /******************** Time support ********************/
221 :    
222 :     void now ([out, ref] Time_t *t);
223 :    
224 :     /******************** Date support ********************/
225 :    
226 :     void gmTime ([in, ref] Time_t *t, [out, ref] Date_t *date);
227 :     void localTime ([in, ref] Time_t *t, [out, ref] Date_t *date);
228 :    
229 :    
230 :     /******************** Timer support ********************/
231 :    
232 :     [sml_context] void getCPUTime (
233 :     [out, ref] Time_t *u,
234 :     [out, ref] Time_t *s,
235 :     [out, ref] Time_t *g);
236 :    
237 :     /******************** CommandLine support ********************/
238 :    
239 :     void cmdName ([out, ref] idl_string *s);
240 :     [sml_context] ML_string_list_t cmdArgs ();

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0