#define _REENTRANT 1 (needed to get the right errno on some OSs)
[ghc-base.git] / include / HsBase.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The University of Glasgow 2001-2004
4  *
5  * Definitions for package `base' which are visible in Haskell land.
6  *
7  * ---------------------------------------------------------------------------*/
8
9 #ifndef __HSBASE_H__
10 #define __HSBASE_H__
11
12 #include "ghcconfig.h"
13
14 #include "HsBaseConfig.h"
15
16 /* ultra-evil... */
17 #undef PACKAGE_BUGREPORT
18 #undef PACKAGE_NAME
19 #undef PACKAGE_STRING
20 #undef PACKAGE_TARNAME
21 #undef PACKAGE_VERSION
22
23 /* Needed to get the macro version of errno on some OSs (eg. Solaris).
24    We must do this, because these libs are only compiled once, but
25    must work in both single-threaded and multi-threaded programs. */
26 #define _REENTRANT 1
27
28 #include "HsFFI.h"
29
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <math.h>
33
34 #if HAVE_SYS_TYPES_H
35 #include <sys/types.h>
36 #endif
37 #if HAVE_UNISTD_H
38 #include <unistd.h>
39 #endif
40 #if HAVE_SYS_STAT_H
41 #include <sys/stat.h>
42 #endif
43 #if HAVE_FCNTL_H
44 # include <fcntl.h>
45 #endif
46 #if HAVE_TERMIOS_H
47 #include <termios.h>
48 #endif
49 #if HAVE_SIGNAL_H
50 #include <signal.h>
51 /* Ultra-ugly: OpenBSD uses broken macros for sigemptyset and sigfillset (missing casts) */
52 #if __OpenBSD__
53 #undef sigemptyset
54 #undef sigfillset
55 #endif
56 #endif
57 #if HAVE_ERRNO_H
58 #include <errno.h>
59 #endif
60 #if HAVE_STRING_H
61 #include <string.h>
62 #endif
63 #if HAVE_DIRENT_H
64 #include <dirent.h>
65 #endif
66 #if HAVE_UTIME_H
67 #include <utime.h>
68 #endif
69 #if HAVE_SYS_UTSNAME_H
70 #include <sys/utsname.h>
71 #endif
72 #if HAVE_GETTIMEOFDAY
73 #  if HAVE_SYS_TIME_H
74 #   include <sys/time.h>
75 #  endif
76 #elif HAVE_GETCLOCK
77 # if HAVE_SYS_TIMERS_H
78 #  define POSIX_4D9 1
79 #  include <sys/timers.h>
80 # endif
81 #endif
82 #if HAVE_TIME_H
83 #include <time.h>
84 #endif
85 #if HAVE_SYS_TIMEB_H
86 #include <sys/timeb.h>
87 #endif
88 #if HAVE_WINDOWS_H
89 #include <windows.h>
90 #endif
91 #if HAVE_SYS_TIMES_H
92 #include <sys/times.h>
93 #endif
94 #if HAVE_WINSOCK_H && defined(mingw32_HOST_OS)
95 #include <winsock.h>
96 #endif
97 #if HAVE_LIMITS_H
98 #include <limits.h>
99 #endif
100 #if HAVE_WCTYPE_H
101 #include <wctype.h>
102 #endif
103 #if HAVE_INTTYPES_H
104 # include <inttypes.h>
105 #elif HAVE_STDINT_H
106 # include <stdint.h>
107 #endif
108
109 #if !defined(mingw32_HOST_OS) && !defined(irix_HOST_OS)
110 # if HAVE_SYS_RESOURCE_H
111 #  include <sys/resource.h>
112 # endif
113 #endif
114
115 #ifdef hpux_HOST_OS
116 #include <sys/syscall.h>
117 #define getrusage(a, b)  syscall(SYS_GETRUSAGE, a, b)
118 #define HAVE_GETRUSAGE
119 #endif
120
121 /* For System */
122 #if HAVE_SYS_WAIT_H
123 #include <sys/wait.h>
124 #endif
125 #if HAVE_VFORK_H
126 #include <vfork.h>
127 #endif
128 #include "lockFile.h"
129 #include "dirUtils.h"
130 #include "WCsubst.h"
131
132 #include "runProcess.h"
133
134 #if defined(mingw32_HOST_OS)
135 #include <io.h>
136 #include <fcntl.h>
137 #include "timeUtils.h"
138 #include <shlobj.h>
139 #include <share.h>
140 #endif
141
142 #if HAVE_SYS_SELECT_H
143 #include <sys/select.h>
144 #endif
145
146 /* in inputReady.c */
147 int inputReady(int fd, int msecs, int isSock);
148
149 /* in Signals.c */
150 extern HsInt nocldstop;
151
152 #if !defined(mingw32_HOST_OS)
153 /* in execvpe.c */
154 extern int execvpe(char *name, char *const argv[], char **envp);
155 extern void pPrPr_disableITimers (void);
156 #endif
157
158 /* -----------------------------------------------------------------------------
159    64-bit operations, defined in longlong.c
160    -------------------------------------------------------------------------- */
161
162 #ifdef SUPPORT_LONG_LONGS
163
164 StgInt stg_gtWord64 (StgWord64, StgWord64);
165 StgInt stg_geWord64 (StgWord64, StgWord64);
166 StgInt stg_eqWord64 (StgWord64, StgWord64);
167 StgInt stg_neWord64 (StgWord64, StgWord64);
168 StgInt stg_ltWord64 (StgWord64, StgWord64);
169 StgInt stg_leWord64 (StgWord64, StgWord64);
170
171 StgInt stg_gtInt64 (StgInt64, StgInt64);
172 StgInt stg_geInt64 (StgInt64, StgInt64);
173 StgInt stg_eqInt64 (StgInt64, StgInt64);
174 StgInt stg_neInt64 (StgInt64, StgInt64);
175 StgInt stg_ltInt64 (StgInt64, StgInt64);
176 StgInt stg_leInt64 (StgInt64, StgInt64);
177
178 StgWord64 stg_remWord64  (StgWord64, StgWord64);
179 StgWord64 stg_quotWord64 (StgWord64, StgWord64);
180
181 StgInt64 stg_remInt64    (StgInt64, StgInt64);
182 StgInt64 stg_quotInt64   (StgInt64, StgInt64);
183 StgInt64 stg_negateInt64 (StgInt64);
184 StgInt64 stg_plusInt64   (StgInt64, StgInt64);
185 StgInt64 stg_minusInt64  (StgInt64, StgInt64);
186 StgInt64 stg_timesInt64  (StgInt64, StgInt64);
187
188 StgWord64 stg_and64  (StgWord64, StgWord64);
189 StgWord64 stg_or64   (StgWord64, StgWord64);
190 StgWord64 stg_xor64  (StgWord64, StgWord64);
191 StgWord64 stg_not64  (StgWord64);
192
193 StgWord64 stg_uncheckedShiftL64   (StgWord64, StgInt);
194 StgWord64 stg_uncheckedShiftRL64  (StgWord64, StgInt);
195 StgInt64  stg_uncheckedIShiftL64  (StgInt64, StgInt);
196 StgInt64  stg_uncheckedIShiftRL64 (StgInt64, StgInt);
197 StgInt64  stg_uncheckedIShiftRA64 (StgInt64, StgInt);
198
199 StgInt64  stg_intToInt64    (StgInt);
200 StgInt    stg_int64ToInt    (StgInt64);
201 StgWord64 stg_int64ToWord64 (StgInt64);
202
203 StgWord64 stg_wordToWord64  (StgWord);
204 StgWord   stg_word64ToWord  (StgWord64);
205 StgInt64  stg_word64ToInt64 (StgWord64);
206
207 StgInt64  stg_integerToInt64 (StgInt sa, StgByteArray /* Really: mp_limb_t* */ da);
208 StgWord64 stg_integerToWord64 (StgInt sa, StgByteArray /* Really: mp_limb_t* */ da);
209
210 #endif /* SUPPORT_LONG_LONGS */
211
212 /* -----------------------------------------------------------------------------
213    INLINE functions.
214
215    These functions are given as inlines here for when compiling via C,
216    but we also generate static versions into the cbits library for
217    when compiling to native code.
218    -------------------------------------------------------------------------- */
219
220 #ifndef INLINE
221 # if defined(_MSC_VER)
222 #  define INLINE extern __inline
223 # elif defined(__GNUC__)
224 #  define INLINE extern inline
225 # else
226 #  define INLINE inline
227 # endif
228 #endif
229
230 INLINE int __hscore_get_errno(void) { return errno; }
231 INLINE void __hscore_set_errno(int e) { errno = e; }
232
233 #if !defined(_MSC_VER)
234 INLINE int __hscore_s_isreg(m)  { return S_ISREG(m);  }
235 INLINE int __hscore_s_isdir(m)  { return S_ISDIR(m);  }
236 INLINE int __hscore_s_isfifo(m) { return S_ISFIFO(m); }
237 INLINE int __hscore_s_isblk(m)  { return S_ISBLK(m);  }
238 INLINE int __hscore_s_ischr(m)  { return S_ISCHR(m);  }
239 #ifdef S_ISSOCK
240 INLINE int __hscore_s_issock(m) { return S_ISSOCK(m); }
241 #endif
242 #endif
243
244 #if !defined(mingw32_HOST_OS) && !defined(_MSC_VER)
245 INLINE int
246 __hscore_sigemptyset( sigset_t *set )
247 { return sigemptyset(set); }
248
249 INLINE int
250 __hscore_sigfillset( sigset_t *set )
251 { return sigfillset(set); }
252
253 INLINE int
254 __hscore_sigaddset( sigset_t * set, int s )
255 { return sigaddset(set,s); }
256
257 INLINE int
258 __hscore_sigdelset( sigset_t * set, int s )
259 { return sigdelset(set,s); }
260
261 INLINE int
262 __hscore_sigismember( sigset_t * set, int s )
263 { return sigismember(set,s); }
264 #endif
265
266 INLINE void *
267 __hscore_memcpy_dst_off( char *dst, int dst_off, char *src, size_t sz )
268 { return memcpy(dst+dst_off, src, sz); }
269
270 INLINE void *
271 __hscore_memcpy_src_off( char *dst, char *src, int src_off, size_t sz )
272 { return memcpy(dst, src+src_off, sz); }
273
274 INLINE HsBool
275 __hscore_supportsTextMode()
276 {
277 #if defined(mingw32_HOST_OS)
278   return HS_BOOL_FALSE;
279 #else
280   return HS_BOOL_TRUE;
281 #endif
282 }
283
284 INLINE HsInt
285 __hscore_bufsiz()
286 {
287   return BUFSIZ;
288 }
289
290 INLINE HsInt
291 __hscore_seek_cur()
292 {
293   return SEEK_CUR;
294 }
295
296 INLINE HsInt
297 __hscore_o_binary()
298 {
299 #if defined(_MSC_VER)
300   return O_BINARY;
301 #else
302   return CONST_O_BINARY;
303 #endif
304 }
305
306 INLINE int
307 __hscore_o_rdonly()
308 {
309 #ifdef O_RDONLY
310   return O_RDONLY;
311 #else
312   return 0;
313 #endif
314 }
315
316 INLINE int
317 __hscore_o_wronly( void )
318 {
319 #ifdef O_WRONLY
320   return O_WRONLY;
321 #else
322   return 0;
323 #endif
324 }
325
326 INLINE int
327 __hscore_o_rdwr( void )
328 {
329 #ifdef O_RDWR
330   return O_RDWR;
331 #else
332   return 0;
333 #endif
334 }
335
336 INLINE int
337 __hscore_o_append( void )
338 {
339 #ifdef O_APPEND
340   return O_APPEND;
341 #else
342   return 0;
343 #endif
344 }
345
346 INLINE int
347 __hscore_o_creat( void )
348 {
349 #ifdef O_CREAT
350   return O_CREAT;
351 #else
352   return 0;
353 #endif
354 }
355
356 INLINE int
357 __hscore_o_excl( void )
358 {
359 #ifdef O_EXCL
360   return O_EXCL;
361 #else
362   return 0;
363 #endif
364 }
365
366 INLINE int
367 __hscore_o_trunc( void )
368 {
369 #ifdef O_TRUNC
370   return O_TRUNC;
371 #else
372   return 0;
373 #endif
374 }
375
376 INLINE int
377 __hscore_o_noctty( void )
378 {
379 #ifdef O_NOCTTY
380   return O_NOCTTY;
381 #else
382   return 0;
383 #endif
384 }
385
386 INLINE int
387 __hscore_o_nonblock( void )
388 {
389 #ifdef O_NONBLOCK
390   return O_NONBLOCK;
391 #else
392   return 0;
393 #endif
394 }
395
396 INLINE HsInt
397 __hscore_seek_set( void )
398 {
399   return SEEK_SET;
400 }
401
402 INLINE HsInt
403 __hscore_seek_end( void )
404 {
405   return SEEK_END;
406 }
407
408 INLINE int
409 __hscore_ftruncate( int fd, off_t where )
410 {
411 #if defined(HAVE_FTRUNCATE)
412   return ftruncate(fd,where);
413 #elif defined(HAVE__CHSIZE)
414   return _chsize(fd,where);
415 #else
416 #error at least ftruncate or _chsize functions are required to build
417 #endif
418 }
419
420 INLINE HsInt
421 __hscore_setmode( HsInt fd, HsBool toBin )
422 {
423 #if defined(mingw32_HOST_OS) || defined(_MSC_VER)
424   return setmode(fd,(toBin == HS_BOOL_TRUE) ? _O_BINARY : _O_TEXT);
425 #else
426   return 0;
427 #endif
428 }
429
430 #if __GLASGOW_HASKELL__
431
432 INLINE HsInt
433 __hscore_PrelHandle_write( HsInt fd, HsAddr ptr, HsInt off, int sz )
434 {
435   return write(fd,(char *)ptr + off, sz);
436 }
437
438 INLINE HsInt
439 __hscore_PrelHandle_read( HsInt fd, HsAddr ptr, HsInt off, int sz )
440 {
441   return read(fd,(char *)ptr + off, sz);
442
443 }
444
445 #if defined(mingw32_HOST_OS) || defined(_MSC_VER)
446 INLINE HsInt
447 __hscore_PrelHandle_send( HsInt fd, HsAddr ptr, HsInt off, int sz )
448 {
449     return send(fd,(char *)ptr + off, sz, 0);
450 }
451
452 INLINE HsInt
453 __hscore_PrelHandle_recv( HsInt fd, HsAddr ptr, HsInt off, int sz )
454 {
455     return recv(fd,(char *)ptr + off, sz, 0);
456 }
457 #endif
458
459 #endif /* __GLASGOW_HASKELL__ */
460
461 #if defined(mingw32_HOST_OS) || defined(_MSC_VER)
462 INLINE long *
463 __hscore_Time_ghcTimezone( void ) { return &_timezone; }
464
465 INLINE char **
466 __hscore_Time_ghcTzname( void ) { return _tzname; }
467 #endif
468
469 INLINE HsInt
470 __hscore_mkdir( HsAddr pathName, HsInt mode )
471 {
472 #if defined(mingw32_HOST_OS) || defined(_MSC_VER)
473   return mkdir(pathName);
474 #else
475   return mkdir(pathName,mode);
476 #endif
477 }
478
479 INLINE HsInt
480 __hscore_lstat( HsAddr fname, HsAddr st )
481 {
482 #if HAVE_LSTAT
483   return lstat((const char*)fname, (struct stat*)st);
484 #else
485   return stat((const char*)fname, (struct stat*)st);
486 #endif
487 }
488
489 #ifdef PATH_MAX
490 /* A size that will contain many path names, but not necessarily all
491  * (PATH_MAX is not defined on systems with unlimited path length,
492  * e.g. the Hurd).
493  */
494 INLINE HsInt __hscore_long_path_size() { return PATH_MAX; }
495 #else
496 INLINE HsInt __hscore_long_path_size() { return 4096; }
497 #endif
498
499 #ifdef R_OK
500 INLINE mode_t __hscore_R_OK() { return R_OK; }
501 #endif
502 #ifdef W_OK
503 INLINE mode_t __hscore_W_OK() { return W_OK; }
504 #endif
505 #ifdef X_OK
506 INLINE mode_t __hscore_X_OK() { return X_OK; }
507 #endif
508
509 #ifdef S_IRUSR
510 INLINE mode_t __hscore_S_IRUSR() { return S_IRUSR; }
511 #endif
512 #ifdef S_IWUSR
513 INLINE mode_t __hscore_S_IWUSR() { return S_IWUSR; }
514 #endif
515 #ifdef S_IXUSR
516 INLINE mode_t __hscore_S_IXUSR() { return S_IXUSR; }
517 #endif
518
519 INLINE HsAddr
520 __hscore_d_name( struct dirent* d )
521 {
522   return (HsAddr)(d->d_name);
523 }
524
525 INLINE HsInt
526 __hscore_end_of_dir( void )
527 {
528   return READDIR_ERRNO_EOF;
529 }
530
531 INLINE void
532 __hscore_free_dirent(HsAddr dEnt)
533 {
534 #if HAVE_READDIR_R
535   free(dEnt);
536 #endif
537 }
538
539 INLINE HsInt
540 __hscore_sizeof_stat( void )
541 {
542   return sizeof(struct stat);
543 }
544
545 INLINE time_t __hscore_st_mtime ( struct stat* st ) { return st->st_mtime; }
546 INLINE off_t  __hscore_st_size  ( struct stat* st ) { return st->st_size; }
547 #if !defined(_MSC_VER)
548 INLINE mode_t __hscore_st_mode  ( struct stat* st ) { return st->st_mode; }
549 #endif
550
551 #if HAVE_TERMIOS_H
552 INLINE tcflag_t __hscore_lflag( struct termios* ts ) { return ts->c_lflag; }
553
554 INLINE void
555 __hscore_poke_lflag( struct termios* ts, tcflag_t t ) { ts->c_lflag = t; }
556
557 INLINE unsigned char*
558 __hscore_ptr_c_cc( struct termios* ts )
559 { return (unsigned char*) &ts->c_cc; }
560
561 INLINE HsInt
562 __hscore_sizeof_termios( void )
563 {
564 #ifndef mingw32_HOST_OS
565   return sizeof(struct termios);
566 #else
567   return 0;
568 #endif
569 }
570 #endif
571
572 #if !defined(mingw32_HOST_OS) && !defined(_MSC_VER)
573 INLINE HsInt
574 __hscore_sizeof_sigset_t( void )
575 {
576   return sizeof(sigset_t);
577 }
578 #endif
579
580 INLINE int
581 __hscore_echo( void )
582 {
583 #ifdef ECHO
584   return ECHO;
585 #else
586   return 0;
587 #endif
588
589 }
590
591 INLINE int
592 __hscore_tcsanow( void )
593 {
594 #ifdef TCSANOW
595   return TCSANOW;
596 #else
597   return 0;
598 #endif
599
600 }
601
602 INLINE int
603 __hscore_icanon( void )
604 {
605 #ifdef ICANON
606   return ICANON;
607 #else
608   return 0;
609 #endif
610 }
611
612 INLINE int __hscore_vmin( void )
613 {
614 #ifdef VMIN
615   return VMIN;
616 #else
617   return 0;
618 #endif
619 }
620
621 INLINE int __hscore_vtime( void )
622 {
623 #ifdef VTIME
624   return VTIME;
625 #else
626   return 0;
627 #endif
628 }
629
630 INLINE int __hscore_sigttou( void )
631 {
632 #ifdef SIGTTOU
633   return SIGTTOU;
634 #else
635   return 0;
636 #endif
637 }
638
639 INLINE int __hscore_sig_block( void )
640 {
641 #ifdef SIG_BLOCK
642   return SIG_BLOCK;
643 #else
644   return 0;
645 #endif
646 }
647
648 INLINE int __hscore_sig_setmask( void )
649 {
650 #ifdef SIG_SETMASK
651   return SIG_SETMASK;
652 #else
653   return 0;
654 #endif
655 }
656
657 INLINE int
658 __hscore_f_getfl( void )
659 {
660 #ifdef F_GETFL
661   return F_GETFL;
662 #else
663   return 0;
664 #endif
665 }
666
667 INLINE int
668 __hscore_f_setfl( void )
669 {
670 #ifdef F_SETFL
671   return F_SETFL;
672 #else
673   return 0;
674 #endif
675 }
676
677 // defined in rts/RtsStartup.c.
678 extern void* __hscore_get_saved_termios(int fd);
679 extern void __hscore_set_saved_termios(int fd, void* ts);
680
681 INLINE int __hscore_hs_fileno (FILE *f) { return fileno (f); }
682
683 INLINE int __hscore_open(char *file, int how, mode_t mode) {
684 #ifdef mingw32_HOST_OS
685         if ((how & O_WRONLY) || (how & O_RDWR) || (how & O_APPEND))
686           return _sopen(file,how,_SH_DENYRW,mode);
687         else
688           return _sopen(file,how,_SH_DENYWR,mode);
689 #else
690         return open(file,how,mode);
691 #endif
692 }
693
694 // These are wrapped because on some OSs (eg. Linux) they are
695 // macros which redirect to the 64-bit-off_t versions when large file
696 // support is enabled.
697 //
698 INLINE off_t __hscore_lseek(int fd, off_t off, int whence) {
699         return (lseek(fd,off,whence));
700 }
701
702 INLINE int __hscore_stat(char *file, struct stat *buf) {
703         return (stat(file,buf));
704 }
705
706 INLINE int __hscore_fstat(int fd, struct stat *buf) {
707         return (fstat(fd,buf));
708 }
709
710 // select-related stuff
711
712 #if !defined(mingw32_HOST_OS)
713 INLINE int  hsFD_SETSIZE(void) { return FD_SETSIZE; }
714 INLINE void hsFD_CLR(int fd, fd_set *fds) { FD_CLR(fd, fds); }
715 INLINE int  hsFD_ISSET(int fd, fd_set *fds) { return FD_ISSET(fd, fds); }
716 INLINE void hsFD_SET(int fd, fd_set *fds) { FD_SET(fd, fds); }
717 INLINE int  sizeof_fd_set(void) { return sizeof(fd_set); }
718 extern void hsFD_ZERO(fd_set *fds);
719 #endif
720
721 // gettimeofday()-related
722
723 #if !defined(mingw32_HOST_OS)
724 #define TICK_FREQ  50
725
726 INLINE HsInt sizeofTimeVal(void) { return sizeof(struct timeval); }
727
728 INLINE HsInt getTicksOfDay(void)
729 {
730     struct timeval tv;
731     gettimeofday(&tv, (struct timezone *) NULL);
732     return (tv.tv_sec * TICK_FREQ +
733             tv.tv_usec * TICK_FREQ / 1000000);
734 }
735
736 INLINE void setTimevalTicks(struct timeval *p, HsInt ticks)
737 {
738     p->tv_sec  = ticks / TICK_FREQ;
739     p->tv_usec = (ticks % TICK_FREQ) * (1000000 / TICK_FREQ);
740 }
741 #endif /* !defined(mingw32_HOST_OS) */
742
743 // Directory-related
744
745 #if defined(mingw32_HOST_OS)
746
747 /* Make sure we've got the reqd CSIDL_ constants in scope;
748  * w32api header files are lagging a bit in defining the full set.
749  */
750 #if !defined(CSIDL_APPDATA)
751 #define CSIDL_APPDATA 0x001a
752 #endif
753 #if !defined(CSIDL_PERSONAL)
754 #define CSIDL_PERSONAL 0x0005
755 #endif
756 #if !defined(CSIDL_PROFILE)
757 #define CSIDL_PROFILE 0x0028
758 #endif
759 #if !defined(CSIDL_WINDOWS)
760 #define CSIDL_WINDOWS 0x0024
761 #endif
762
763 INLINE int __hscore_CSIDL_PROFILE()  { return CSIDL_PROFILE;  }
764 INLINE int __hscore_CSIDL_APPDATA()  { return CSIDL_APPDATA;  }
765 INLINE int __hscore_CSIDL_WINDOWS()  { return CSIDL_WINDOWS;  }
766 INLINE int __hscore_CSIDL_PERSONAL() { return CSIDL_PERSONAL; }
767 #endif
768
769 #if defined(mingw32_HOST_OS)
770 INLINE unsigned int __hscore_get_osver(void) { return _osver; }
771 #endif
772
773 /* ToDo: write a feature test that doesn't assume 'environ' to
774  *    be in scope at link-time. */
775 extern char** environ;
776 INLINE char **__hscore_environ() { return environ; }
777
778 /* lossless conversions between pointers and integral types */
779 INLINE void *    __hscore_from_uintptr(uintptr_t n) { return (void *)n; }
780 INLINE void *    __hscore_from_intptr (intptr_t n)  { return (void *)n; }
781 INLINE uintptr_t __hscore_to_uintptr  (void *p)     { return (uintptr_t)p; }
782 INLINE intptr_t  __hscore_to_intptr   (void *p)     { return (intptr_t)p; }
783
784 #endif /* __HSBASE_H__ */
785