/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

  1. indexing
  2. copyright: "(C) 2007 Paolo Redaelli "
  3. license: "LGPL v2 or later"
  4. date: "$Date:$"
  5. revision: "$REvision:$"
  6. deferred class GLIB_BASIC_TYPES
  7. -- GLib defines a number of commonly used types, which can be
  8. -- divided into 4 groups:
  9. -- o New types which are not part of standard C - gboolean, gsize,
  10. -- gssize.
  11. -- o Integer types which are guaranteed to be the same size across
  12. -- all platforms - gint8, guint8, gint16, guint16, gint32, guint32,
  13. -- gint64, guint64.
  14. -- o Types which are easier to use than their standard C
  15. -- counterparts - gpointer, gconstpointer, guchar, guint, gushort,
  16. -- gulong.
  17. -- o Types which correspond exactly to standard C types, but are
  18. -- included for completeness - gchar, gint, gshort, glong, gfloat,
  19. -- gdouble.
  20. insert ANY undefine is_equal, copy end
  21. feature -- Basic Types: standard GLib types, defined for ease-of-use and portability.
  22. -- #include <glib.h>
  23. -- typedef gboolean;
  24. -- typedef gpointer;
  25. -- typedef gconstpointer;
  26. -- typedef gchar;
  27. -- typedef guchar;
  28. -- typedef gint;
  29. -- typedef guint;
  30. -- typedef gshort;
  31. -- typedef gushort;
  32. -- typedef glong;
  33. -- typedef gulong;
  34. -- typedef gint8;
  35. -- typedef guint8;
  36. -- typedef gint16;
  37. -- typedef guint16;
  38. -- typedef gint32;
  39. -- typedef guint32;
  40. -- #define G_HAVE_GINT64
  41. -- typedef gint64;
  42. -- typedef guint64;
  43. -- #define G_GINT64_CONSTANT (val)
  44. -- #define G_GUINT64_CONSTANT (val)
  45. -- typedef gfloat;
  46. -- typedef gdouble;
  47. -- typedef gsize;
  48. -- typedef gssize;
  49. gboolean: INTEGER is
  50. -- The standard boolean typein Glib type system. Variables of
  51. -- this type should only contain the value TRUE (i.e. 1) or
  52. -- FALSE (i.e. 0).
  53. -- typedef gint gboolean;
  54. do
  55. -- Empty by design
  56. end
  57. -- --------------------------------------------------------------------------
  58. -- gpointer
  59. -- typedef void* gpointer;
  60. -- An untyped pointer. gpointer looks better and is easier to use than void*.
  61. -- gconstpointer
  62. -- typedef const void *gconstpointer;
  63. -- An untyped pointer to constant data. The data pointed to should not be
  64. -- changed.
  65. -- This is typically used in function prototypes to indicate that the data
  66. -- pointed to will not be altered by the function.
  67. -- --------------------------------------------------------------------------
  68. -- gchar
  69. -- typedef char gchar;
  70. -- Corresponds to the standard C char type.
  71. -- --------------------------------------------------------------------------
  72. -- guchar
  73. -- typedef unsigned char guchar;
  74. -- Corresponds to the standard C unsigned char type.
  75. -- --------------------------------------------------------------------------
  76. -- gint
  77. -- typedef int gint;
  78. -- Corresponds to the standard C int type. Values of this type can range from
  79. -- G_MININT to G_MAXINT.
  80. -- --------------------------------------------------------------------------
  81. -- guint
  82. -- typedef unsigned int guint;
  83. -- Corresponds to the standard C unsigned int type. Values of this type can
  84. -- range from 0 to G_MAXUINT.
  85. -- --------------------------------------------------------------------------
  86. -- gshort
  87. -- typedef short gshort;
  88. -- Corresponds to the standard C short type. Values of this type can range
  89. -- from G_MINSHORT to G_MAXSHORT.
  90. -- --------------------------------------------------------------------------
  91. -- gushort
  92. -- typedef unsigned short gushort;
  93. -- Corresponds to the standard C unsigned short type. Values of this type can
  94. -- range from 0 to G_MAXUSHORT.
  95. glong_size: INTEGER is
  96. external "C use <glib.h>"
  97. alias "sizeof(glong)"
  98. end
  99. glong: INTEGER is
  100. -- typedef long glong;
  101. -- Corresponds to the standard C long type. Values of this type can
  102. -- range from G_MINLONG to G_MAXLONG.
  103. do
  104. -- empty by design
  105. ensure glong_is_32_bit: glong_size=4
  106. end
  107. -- gulong
  108. -- typedef unsigned long gulong;
  109. -- Corresponds to the standard C unsigned long type. Values of this type can
  110. -- range from 0 to G_MAXULONG.
  111. -- gint8
  112. -- typedef signed char gint8;
  113. -- A signed integer guaranteed to be 8 bits on all platforms. Values of this
  114. -- type can range from -128 to 127.
  115. -- guint8
  116. -- typedef unsigned char guint8;
  117. -- An unsigned integer guaranteed to be 8 bits on all platforms. Values of
  118. -- this type can range from 0 to 255.
  119. -- gint16
  120. -- typedef signed short gint16;
  121. -- A signed integer guaranteed to be 16 bits on all platforms. Values of this
  122. -- type can range from -32,768 to 32,767.
  123. -- guint16
  124. -- typedef unsigned short guint16;
  125. -- An unsigned integer guaranteed to be 16 bits on all platforms. Values of
  126. -- this type can range from 0 to 65,535.
  127. -- gint32
  128. -- typedef signed int gint32;
  129. -- A signed integer guaranteed to be 32 bits on all platforms. Values of this
  130. -- type can range from -2,147,483,648 to 2,147,483,647.
  131. -- guint32
  132. -- typedef unsigned int guint32;
  133. -- An unsigned integer guaranteed to be 32 bits on all platforms. Values of
  134. -- this type can range from 0 to 4,294,967,295.
  135. -- gint64
  136. -- G_GNUC_EXTENSION typedef signed long long gint64;
  137. -- A signed integer guaranteed to be 64 bits on all platforms. Values of this
  138. -- type can range from -9,223,372,036,854,775,808 to
  139. -- 9,223,372,036,854,775,807.
  140. -- guint64
  141. -- G_GNUC_EXTENSION typedef unsigned long long guint64;
  142. -- An unsigned integer guaranteed to be 64 bits on all platforms. Values of
  143. -- this type can range from 0 to 18,446,744,073,709,551,615.
  144. -- G_GINT64_CONSTANT()
  145. -- #define G_GINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##LL))
  146. -- This macro is used to insert 64-bit integer literals into the source code.
  147. -- val : a literal integer value, e.g. 0x1d636b02300a7aa7U.
  148. -- G_GUINT64_CONSTANT()
  149. -- #define G_GUINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##ULL))
  150. -- This macro is used to insert 64-bit unsigned integer literals into the
  151. -- source code.
  152. -- val : a literal integer value, e.g. 0x1d636b02300a7aa7U.
  153. -- Since 2.10
  154. -- gfloat
  155. -- typedef float gfloat;
  156. -- Corresponds to the standard C float type. Values of this type can range
  157. -- from -G_MAXFLOAT to G_MAXFLOAT.
  158. -- gdouble
  159. -- typedef double gdouble;
  160. -- Corresponds to the standard C double type. Values of this type can range
  161. -- from -G_MAXDOUBLE to G_MAXDOUBLE.
  162. gsize: INTEGER is
  163. -- An unsigned 32-bit integer intended to represent sizes of
  164. -- data structures.
  165. -- typedef unsigned int gsize;
  166. -- TODO: should be NATURAL, since it is implemented as an unsigned int.
  167. do
  168. -- empty by design
  169. end
  170. gssize: INTEGER is
  171. -- A signed 32-bit integer intended to represent sizes of
  172. -- data structures.
  173. -- typedef signed int gssize;
  174. do
  175. -- Empty by design
  176. end
  177. feature -- Limits of Basic Types
  178. -- Limits of Basic Types: portable method of determining the limits of the standard types.
  179. -- #include <glib.h>
  180. -- #define G_MININT
  181. -- #define G_MAXINT
  182. -- #define G_MAXUINT
  183. -- #define G_MINSHORT
  184. -- #define G_MAXSHORT
  185. -- #define G_MAXUSHORT
  186. -- #define G_MINLONG
  187. -- #define G_MAXLONG
  188. -- #define G_MAXULONG
  189. -- #define G_MININT8
  190. -- #define G_MAXINT8
  191. -- #define G_MAXUINT8
  192. -- #define G_MININT16
  193. -- #define G_MAXINT16
  194. -- #define G_MAXUINT16
  195. -- #define G_MININT32
  196. -- #define G_MAXINT32
  197. -- #define G_MAXUINT32
  198. -- #define G_MININT64
  199. -- #define G_MAXINT64
  200. -- #define G_MAXUINT64
  201. -- #define G_MAXSIZE
  202. -- #define G_MINFLOAT
  203. -- #define G_MAXFLOAT
  204. -- #define G_MINDOUBLE
  205. -- #define G_MAXDOUBLE
  206. -- Description
  207. -- These macros provide a portable method to determine the limits of some of the standard integer and floating point types.
  208. -- Details
  209. -- G_MININT
  210. -- #define G_MININT INT_MIN
  211. -- The minimum value which can be held in a gint.
  212. -- G_MAXINT
  213. -- #define G_MAXINT INT_MAX
  214. -- The maximum value which can be held in a gint.
  215. -- G_MAXUINT
  216. -- #define G_MAXUINT UINT_MAX
  217. -- The maximum value which can be held in a guint.
  218. -- G_MINSHORT
  219. -- #define G_MINSHORT SHRT_MIN
  220. -- The minimum value which can be held in a gshort.
  221. -- G_MAXSHORT
  222. -- #define G_MAXSHORT SHRT_MAX
  223. -- The maximum value which can be held in a gshort.
  224. -- G_MAXUSHORT
  225. -- #define G_MAXUSHORT USHRT_MAX
  226. -- The maximum value which can be held in a gushort.
  227. -- G_MINLONG
  228. -- #define G_MINLONG LONG_MIN
  229. -- The minimum value which can be held in a glong.
  230. -- G_MAXLONG
  231. -- #define G_MAXLONG LONG_MAX
  232. -- The maximum value which can be held in a glong.
  233. -- G_MAXULONG
  234. -- #define G_MAXULONG ULONG_MAX
  235. -- The maximum value which can be held in a gulong.
  236. -- G_MININT8
  237. -- #define G_MININT8 ((gint8) 0x80)
  238. -- The minimum value which can be held in a gint8.
  239. -- Since 2.4
  240. -- G_MAXINT8
  241. -- #define G_MAXINT8 ((gint8) 0x7f)
  242. -- The maximum value which can be held in a gint8.
  243. -- Since 2.4
  244. -- G_MAXUINT8
  245. -- #define G_MAXUINT8 ((guint8) 0xff)
  246. -- The maximum value which can be held in a guint8.
  247. -- Since 2.4
  248. -- G_MININT16
  249. -- #define G_MININT16 ((gint16) 0x8000)
  250. -- The minimum value which can be held in a gint16.
  251. -- Since 2.4
  252. -- G_MAXINT16
  253. -- #define G_MAXINT16 ((gint16) 0x7fff)
  254. -- The maximum value which can be held in a gint16.
  255. -- Since 2.4
  256. -- G_MAXUINT16
  257. -- #define G_MAXUINT16 ((guint16) 0xffff)
  258. -- The maximum value which can be held in a guint16.
  259. -- Since 2.4
  260. -- G_MININT32
  261. -- #define G_MININT32 ((gint32) 0x80000000)
  262. -- The minimum value which can be held in a gint32.
  263. -- Since 2.4
  264. -- G_MAXINT32
  265. -- #define G_MAXINT32 ((gint32) 0x7fffffff)
  266. -- The maximum value which can be held in a gint32.
  267. -- Since 2.4
  268. -- G_MAXUINT32
  269. -- #define G_MAXUINT32 ((guint32) 0xffffffff)
  270. -- The maximum value which can be held in a guint32.
  271. -- Since 2.4
  272. -- G_MININT64
  273. -- #define G_MININT64 ((gint64) G_GINT64_CONSTANT(0x8000000000000000))
  274. -- The minimum value which can be held in a gint64.
  275. -- G_MAXINT64
  276. -- #define G_MAXINT64 G_GINT64_CONSTANT(0x7fffffffffffffff)
  277. -- The maximum value which can be held in a gint64.
  278. -- G_MAXUINT64
  279. -- #define G_MAXUINT64 G_GINT64_CONSTANT(0xffffffffffffffffU)
  280. -- The maximum value which can be held in a guint64.
  281. -- G_MAXSIZE
  282. -- #define G_MAXSIZE G_MAXUINT
  283. -- The maximum value which can be held in a gsize.
  284. -- Since 2.4
  285. -- G_MINFLOAT
  286. -- #define G_MINFLOAT FLT_MIN
  287. -- The minimum positive value which can be held in a gfloat.
  288. -- If you are interested in the smallest value which can be held in a gfloat, use -G_MAX_FLOAT.
  289. -- G_MAXFLOAT
  290. -- #define G_MAXFLOAT FLT_MAX
  291. -- The maximum value which can be held in a gfloat.
  292. -- G_MINDOUBLE
  293. -- #define G_MINDOUBLE DBL_MIN
  294. -- The minimum positive value which can be held in a gdouble.
  295. -- If you are interested in the smallest value which can be held in a gdouble, use -G_MAXDOUBLE.
  296. -- G_MAXDOUBLE
  297. -- #define G_MAXDOUBLE DBL_MAX
  298. -- The maximum value which can be held in a gdouble.
  299. end