PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/src/wrappers/glib/library/fundamentals/glib_basic_types.e

http://github.com/tybor/Liberty
Specman e | 476 lines | 27 code | 177 blank | 272 comment | 0 complexity | 57032f81d0b9080e8a890946f26ce402 MD5 | raw file
  1indexing
  2	copyright: "(C) 2007 Paolo Redaelli "
  3	license: "LGPL v2 or later"
  4	date: "$Date:$"
  5	revision: "$REvision:$"
  6
  7deferred class GLIB_BASIC_TYPES
  8	-- GLib defines a number of commonly used types, which can be
  9	-- divided into 4 groups:
 10
 11	-- o New types which are not part of standard C - gboolean, gsize,
 12	-- gssize. 
 13
 14	-- o Integer types which are guaranteed to be the same size across
 15	-- all platforms - gint8, guint8, gint16, guint16, gint32, guint32,
 16	-- gint64, guint64.
 17
 18	-- o Types which are easier to use than their standard C
 19	-- counterparts - gpointer, gconstpointer, guchar, guint, gushort,
 20	-- gulong.
 21
 22	-- o Types which correspond exactly to standard C types, but are
 23	-- included for completeness - gchar, gint, gshort, glong, gfloat,
 24	-- gdouble.
 25
 26insert ANY undefine is_equal, copy end
 27
 28feature -- Basic Types: standard GLib types, defined for ease-of-use and portability.
 29	--  #include <glib.h>
 30
 31	--  typedef     gboolean;
 32	--  typedef     gpointer;
 33	--  typedef     gconstpointer;
 34	--  typedef     gchar;
 35	--  typedef     guchar;
 36
 37	--  typedef     gint;
 38	--  typedef     guint;
 39	--  typedef     gshort;
 40	--  typedef     gushort;
 41	--  typedef     glong;
 42	--  typedef     gulong;
 43
 44	--  typedef     gint8;
 45	--  typedef     guint8;
 46	--  typedef     gint16;
 47	--  typedef     guint16;
 48	--  typedef     gint32;
 49	--  typedef     guint32;
 50
 51	--  #define     G_HAVE_GINT64
 52	--  typedef     gint64;
 53	--  typedef     guint64;
 54	--  #define     G_GINT64_CONSTANT               (val)
 55	--  #define     G_GUINT64_CONSTANT              (val)
 56
 57	--  typedef     gfloat;
 58	--  typedef     gdouble;
 59
 60	--  typedef     gsize;
 61	--  typedef     gssize;
 62
 63	gboolean: INTEGER is	
 64			-- The standard boolean typein Glib type system. Variables of
 65			-- this type should only contain the value TRUE (i.e. 1) or
 66			-- FALSE (i.e. 0).
 67		
 68			--  typedef gint   gboolean;
 69		do
 70			-- Empty by design
 71		end
 72
 73	--    --------------------------------------------------------------------------
 74
 75	--   gpointer
 76
 77	--  typedef void* gpointer;
 78
 79	--    An untyped pointer. gpointer looks better and is easier to use than void*.
 80
 81	--   gconstpointer
 82
 83	--  typedef const void *gconstpointer;
 84
 85	--    An untyped pointer to constant data. The data pointed to should not be
 86	--    changed.
 87
 88	--    This is typically used in function prototypes to indicate that the data
 89	--    pointed to will not be altered by the function.
 90
 91	--    --------------------------------------------------------------------------
 92
 93	--   gchar
 94
 95	--  typedef char   gchar;
 96
 97	--    Corresponds to the standard C char type.
 98
 99	--    --------------------------------------------------------------------------
100
101	--   guchar
102
103	--  typedef unsigned char   guchar;
104
105	--    Corresponds to the standard C unsigned char type.
106
107	--    --------------------------------------------------------------------------
108
109	--   gint
110
111	--  typedef int    gint;
112
113	--    Corresponds to the standard C int type. Values of this type can range from
114	--    G_MININT to G_MAXINT.
115
116	--    --------------------------------------------------------------------------
117
118	--   guint
119
120	--  typedef unsigned int    guint;
121
122	--    Corresponds to the standard C unsigned int type. Values of this type can
123	--    range from 0 to G_MAXUINT.
124
125	--    --------------------------------------------------------------------------
126
127	--   gshort
128
129	--  typedef short  gshort;
130
131	--    Corresponds to the standard C short type. Values of this type can range
132	--    from G_MINSHORT to G_MAXSHORT.
133
134	--    --------------------------------------------------------------------------
135
136	--   gushort
137
138	--  typedef unsigned short  gushort;
139
140	--    Corresponds to the standard C unsigned short type. Values of this type can
141	--    range from 0 to G_MAXUSHORT.
142
143	glong_size: INTEGER is
144		external "C use <glib.h>"
145		alias "sizeof(glong)"
146		end
147	
148	glong: INTEGER is
149			--  typedef long   glong;
150		
151			-- Corresponds to the standard C long type. Values of this type can
152			-- range from G_MINLONG to G_MAXLONG.
153		do
154			-- empty by design
155		ensure glong_is_32_bit: glong_size=4
156		end
157
158	--   gulong
159
160	--  typedef unsigned long   gulong;
161
162	--    Corresponds to the standard C unsigned long type. Values of this type can
163	--    range from 0 to G_MAXULONG.
164
165	--   gint8
166
167	--  typedef signed char gint8;
168
169	--    A signed integer guaranteed to be 8 bits on all platforms. Values of this
170	--    type can range from -128 to 127.
171
172	--   guint8
173
174	--  typedef unsigned char guint8;
175
176	--    An unsigned integer guaranteed to be 8 bits on all platforms. Values of
177	--    this type can range from 0 to 255.
178
179	--   gint16
180
181	--  typedef signed short gint16;
182
183	--    A signed integer guaranteed to be 16 bits on all platforms. Values of this
184	--    type can range from -32,768 to 32,767.
185
186	--   guint16
187
188	--  typedef unsigned short guint16;
189
190	--    An unsigned integer guaranteed to be 16 bits on all platforms. Values of
191	--    this type can range from 0 to 65,535.
192
193	--   gint32
194
195	--  typedef signed int gint32;
196
197	--    A signed integer guaranteed to be 32 bits on all platforms. Values of this
198	--    type can range from -2,147,483,648 to 2,147,483,647.
199
200	--   guint32
201
202	--  typedef unsigned int guint32;
203
204	--    An unsigned integer guaranteed to be 32 bits on all platforms. Values of
205	--    this type can range from 0 to 4,294,967,295.
206
207	--   gint64
208
209	--  G_GNUC_EXTENSION typedef signed long long gint64;
210
211	--    A signed integer guaranteed to be 64 bits on all platforms. Values of this
212	--    type can range from -9,223,372,036,854,775,808 to
213	--    9,223,372,036,854,775,807.
214
215	--   guint64
216
217	--  G_GNUC_EXTENSION typedef unsigned long long guint64;
218
219	--    An unsigned integer guaranteed to be 64 bits on all platforms. Values of
220	--    this type can range from 0 to 18,446,744,073,709,551,615.
221
222	--   G_GINT64_CONSTANT()
223
224	--  #define G_GINT64_CONSTANT(val)  (G_GNUC_EXTENSION (val##LL))
225
226	--    This macro is used to insert 64-bit integer literals into the source code.
227
228	--    val : a literal integer value, e.g. 0x1d636b02300a7aa7U.
229
230	--   G_GUINT64_CONSTANT()
231
232	--  #define G_GUINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##ULL))
233
234	--    This macro is used to insert 64-bit unsigned integer literals into the
235	--    source code.
236
237	--    val : a literal integer value, e.g. 0x1d636b02300a7aa7U.
238
239	--    Since 2.10
240
241	--   gfloat
242
243	--  typedef float   gfloat;
244
245	--    Corresponds to the standard C float type. Values of this type can range
246	--    from -G_MAXFLOAT to G_MAXFLOAT.
247
248	--   gdouble
249
250	--  typedef double  gdouble;
251
252	--    Corresponds to the standard C double type. Values of this type can range
253	--    from -G_MAXDOUBLE to G_MAXDOUBLE.
254
255	gsize: INTEGER is
256			-- An unsigned 32-bit integer intended to represent sizes of
257			-- data structures.
258
259			--  typedef unsigned int gsize;
260		
261			-- TODO: should be NATURAL, since it is implemented as an unsigned int.
262		do
263			-- empty by design
264		end
265
266	gssize: INTEGER is
267			-- A signed 32-bit integer intended to represent sizes of
268			-- data structures.
269
270			-- typedef signed int gssize;
271		do
272			-- Empty by design
273		end
274	
275feature -- Limits of Basic Types
276	-- Limits of Basic Types:  portable method of determining the limits of the standard types.
277	
278-- #include <glib.h>
279
280
281-- #define     G_MININT
282-- #define     G_MAXINT
283-- #define     G_MAXUINT
284
285-- #define     G_MINSHORT
286-- #define     G_MAXSHORT
287-- #define     G_MAXUSHORT
288
289-- #define     G_MINLONG
290-- #define     G_MAXLONG
291-- #define     G_MAXULONG
292
293-- #define     G_MININT8
294-- #define     G_MAXINT8
295-- #define     G_MAXUINT8
296
297-- #define     G_MININT16
298-- #define     G_MAXINT16
299-- #define     G_MAXUINT16
300
301-- #define     G_MININT32
302-- #define     G_MAXINT32
303-- #define     G_MAXUINT32
304
305-- #define     G_MININT64
306-- #define     G_MAXINT64
307-- #define     G_MAXUINT64
308
309-- #define     G_MAXSIZE
310
311-- #define     G_MINFLOAT
312-- #define     G_MAXFLOAT
313
314-- #define     G_MINDOUBLE
315-- #define     G_MAXDOUBLE
316
317-- Description
318
319-- These macros provide a portable method to determine the limits of some of the standard integer and floating point types.
320-- Details
321-- G_MININT
322
323-- #define G_MININT	INT_MIN
324
325-- The minimum value which can be held in a gint.
326-- G_MAXINT
327
328-- #define G_MAXINT	INT_MAX
329
330-- The maximum value which can be held in a gint.
331-- G_MAXUINT
332
333-- #define G_MAXUINT	UINT_MAX
334
335-- The maximum value which can be held in a guint.
336-- G_MINSHORT
337
338-- #define G_MINSHORT	SHRT_MIN
339
340-- The minimum value which can be held in a gshort.
341-- G_MAXSHORT
342
343-- #define G_MAXSHORT	SHRT_MAX
344
345-- The maximum value which can be held in a gshort.
346-- G_MAXUSHORT
347
348-- #define G_MAXUSHORT	USHRT_MAX
349
350-- The maximum value which can be held in a gushort.
351-- G_MINLONG
352
353-- #define G_MINLONG	LONG_MIN
354
355-- The minimum value which can be held in a glong.
356-- G_MAXLONG
357
358-- #define G_MAXLONG	LONG_MAX
359
360-- The maximum value which can be held in a glong.
361-- G_MAXULONG
362
363-- #define G_MAXULONG	ULONG_MAX
364
365-- The maximum value which can be held in a gulong.
366-- G_MININT8
367
368-- #define G_MININT8	((gint8)  0x80)
369
370-- The minimum value which can be held in a gint8.
371
372-- Since 2.4
373-- G_MAXINT8
374
375-- #define G_MAXINT8	((gint8)  0x7f)
376
377-- The maximum value which can be held in a gint8.
378
379-- Since 2.4
380-- G_MAXUINT8
381
382-- #define G_MAXUINT8	((guint8) 0xff)
383
384-- The maximum value which can be held in a guint8.
385
386-- Since 2.4
387-- G_MININT16
388
389-- #define G_MININT16	((gint16)  0x8000)
390
391-- The minimum value which can be held in a gint16.
392
393-- Since 2.4
394-- G_MAXINT16
395
396-- #define G_MAXINT16	((gint16)  0x7fff)
397
398-- The maximum value which can be held in a gint16.
399
400-- Since 2.4
401-- G_MAXUINT16
402
403-- #define G_MAXUINT16	((guint16) 0xffff)
404
405-- The maximum value which can be held in a guint16.
406
407-- Since 2.4
408-- G_MININT32
409
410-- #define G_MININT32	((gint32)  0x80000000)
411
412-- The minimum value which can be held in a gint32.
413
414-- Since 2.4
415-- G_MAXINT32
416
417-- #define G_MAXINT32	((gint32)  0x7fffffff)
418
419-- The maximum value which can be held in a gint32.
420
421-- Since 2.4
422-- G_MAXUINT32
423
424-- #define G_MAXUINT32	((guint32) 0xffffffff)
425
426-- The maximum value which can be held in a guint32.
427
428-- Since 2.4
429-- G_MININT64
430
431-- #define G_MININT64	((gint64) G_GINT64_CONSTANT(0x8000000000000000))
432
433-- The minimum value which can be held in a gint64.
434-- G_MAXINT64
435
436-- #define G_MAXINT64	G_GINT64_CONSTANT(0x7fffffffffffffff)
437
438-- The maximum value which can be held in a gint64.
439-- G_MAXUINT64
440
441-- #define G_MAXUINT64	G_GINT64_CONSTANT(0xffffffffffffffffU)
442
443-- The maximum value which can be held in a guint64.
444-- G_MAXSIZE
445
446-- #define G_MAXSIZE	G_MAXUINT
447
448-- The maximum value which can be held in a gsize.
449
450-- Since 2.4
451-- G_MINFLOAT
452
453-- #define G_MINFLOAT	FLT_MIN
454
455-- The minimum positive value which can be held in a gfloat.
456
457-- If you are interested in the smallest value which can be held in a gfloat, use -G_MAX_FLOAT.
458-- G_MAXFLOAT
459
460-- #define G_MAXFLOAT	FLT_MAX
461
462-- The maximum value which can be held in a gfloat.
463-- G_MINDOUBLE
464
465-- #define G_MINDOUBLE	DBL_MIN
466
467-- The minimum positive value which can be held in a gdouble.
468
469-- If you are interested in the smallest value which can be held in a gdouble, use -G_MAXDOUBLE.
470-- G_MAXDOUBLE
471
472-- #define G_MAXDOUBLE	DBL_MAX
473
474-- The maximum value which can be held in a gdouble.
475end
476