aa1a7fb63f75fe64ab9a8924788a33709760989a
[haskell-directory.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 "HsBaseConfig.h"
13
14 /* ultra-evil... */
15 #undef PACKAGE_BUGREPORT
16 #undef PACKAGE_NAME
17 #undef PACKAGE_STRING
18 #undef PACKAGE_TARNAME
19 #undef PACKAGE_VERSION
20
21 /* Needed to get the macro version of errno on some OSs (eg. Solaris).
22    We must do this, because these libs are only compiled once, but
23    must work in both single-threaded and multi-threaded programs. */
24 #define _REENTRANT 1
25
26 #include "HsFFI.h"
27
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <math.h>
31
32 #if HAVE_SYS_TYPES_H
33 #include <sys/types.h>
34 #endif
35 #if HAVE_UNISTD_H
36 #include <unistd.h>
37 #endif
38 #if HAVE_SYS_STAT_H
39 #include <sys/stat.h>
40 #endif
41 #if HAVE_FCNTL_H
42 # include <fcntl.h>
43 #endif
44 #if HAVE_TERMIOS_H
45 #include <termios.h>
46 #endif
47 #if HAVE_SIGNAL_H
48 #include <signal.h>
49 /* Ultra-ugly: OpenBSD uses broken macros for sigemptyset and sigfillset (missing casts) */
50 #if __OpenBSD__
51 #undef sigemptyset
52 #undef sigfillset
53 #endif
54 #endif
55 #if HAVE_ERRNO_H
56 #include <errno.h>
57 #endif
58 #if HAVE_STRING_H
59 #include <string.h>
60 #endif
61 #if HAVE_DIRENT_H
62 #include <dirent.h>
63 #endif
64 #if HAVE_UTIME_H
65 #include <utime.h>
66 #endif
67 #if HAVE_SYS_UTSNAME_H
68 #include <sys/utsname.h>
69 #endif
70 #if HAVE_GETTIMEOFDAY
71 #  if HAVE_SYS_TIME_H
72 #   include <sys/time.h>
73 #  endif
74 #elif HAVE_GETCLOCK
75 # if HAVE_SYS_TIMERS_H
76 #  define POSIX_4D9 1
77 #  include <sys/timers.h>
78 # endif
79 #endif
80 #if HAVE_TIME_H
81 #include <time.h>
82 #endif
83 #if HAVE_SYS_TIMEB_H
84 #include <sys/timeb.h>
85 #endif
86 #if HAVE_WINDOWS_H
87 #include <windows.h>
88 #endif
89 #if HAVE_SYS_TIMES_H
90 #include <sys/times.h>
91 #endif
92 #if HAVE_WINSOCK_H && defined(__MINGW32__)
93 #include <winsock.h>
94 #endif
95 #if HAVE_LIMITS_H
96 #include <limits.h>
97 #endif
98 #if HAVE_WCTYPE_H
99 #include <wctype.h>
100 #endif
101 #if HAVE_INTTYPES_H
102 # include <inttypes.h>
103 #elif HAVE_STDINT_H
104 # include <stdint.h>
105 #endif
106
107 #if !defined(__MINGW32__) && !defined(irix_HOST_OS)
108 # if HAVE_SYS_RESOURCE_H
109 #  include <sys/resource.h>
110 # endif
111 #endif
112
113 #if !HAVE_GETRUSAGE && HAVE_SYS_SYSCALL_H
114 # include <sys/syscall.h>
115 # if defined(SYS_GETRUSAGE)     /* hpux_HOST_OS */
116 #  define getrusage(a, b)  syscall(SYS_GETRUSAGE, a, b)
117 #  define HAVE_GETRUSAGE 1
118 # endif
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__)
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(_MSC_VER) && !defined(__MINGW32__) && !defined(_WIN32)
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(_MSC_VER) && !defined(__MINGW32__) && !defined(_WIN32)
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(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
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(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
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(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
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 INLINE HsInt
462 __hscore_mkdir( HsAddr pathName, HsInt mode )
463 {
464 #if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
465   return mkdir(pathName);
466 #else
467   return mkdir(pathName,mode);
468 #endif
469 }
470
471 INLINE HsInt
472 __hscore_lstat( HsAddr fname, HsAddr st )
473 {
474 #if HAVE_LSTAT
475   return lstat((const char*)fname, (struct stat*)st);
476 #else
477   return stat((const char*)fname, (struct stat*)st);
478 #endif
479 }
480
481 #ifdef PATH_MAX
482 /* A size that will contain many path names, but not necessarily all
483  * (PATH_MAX is not defined on systems with unlimited path length,
484  * e.g. the Hurd).
485  */
486 INLINE HsInt __hscore_long_path_size() { return PATH_MAX; }
487 #else
488 INLINE HsInt __hscore_long_path_size() { return 4096; }
489 #endif
490
491 #ifdef R_OK
492 INLINE mode_t __hscore_R_OK() { return R_OK; }
493 #endif
494 #ifdef W_OK
495 INLINE mode_t __hscore_W_OK() { return W_OK; }
496 #endif
497 #ifdef X_OK
498 INLINE mode_t __hscore_X_OK() { return X_OK; }
499 #endif
500
501 #ifdef S_IRUSR
502 INLINE mode_t __hscore_S_IRUSR() { return S_IRUSR; }
503 #endif
504 #ifdef S_IWUSR
505 INLINE mode_t __hscore_S_IWUSR() { return S_IWUSR; }
506 #endif
507 #ifdef S_IXUSR
508 INLINE mode_t __hscore_S_IXUSR() { return S_IXUSR; }
509 #endif
510
511 INLINE HsAddr
512 __hscore_d_name( struct dirent* d )
513 {
514   return (HsAddr)(d->d_name);
515 }
516
517 INLINE HsInt
518 __hscore_end_of_dir( void )
519 {
520   return READDIR_ERRNO_EOF;
521 }
522
523 INLINE void
524 __hscore_free_dirent(HsAddr dEnt)
525 {
526 #if HAVE_READDIR_R
527   free(dEnt);
528 #endif
529 }
530
531 INLINE HsInt
532 __hscore_sizeof_stat( void )
533 {
534   return sizeof(struct stat);
535 }
536
537 INLINE time_t __hscore_st_mtime ( struct stat* st ) { return st->st_mtime; }
538 INLINE off_t  __hscore_st_size  ( struct stat* st ) { return st->st_size; }
539 #if !defined(_MSC_VER)
540 INLINE mode_t __hscore_st_mode  ( struct stat* st ) { return st->st_mode; }
541 #endif
542
543 #if HAVE_TERMIOS_H
544 INLINE tcflag_t __hscore_lflag( struct termios* ts ) { return ts->c_lflag; }
545
546 INLINE void
547 __hscore_poke_lflag( struct termios* ts, tcflag_t t ) { ts->c_lflag = t; }
548
549 INLINE unsigned char*
550 __hscore_ptr_c_cc( struct termios* ts )
551 { return (unsigned char*) &ts->c_cc; }
552
553 INLINE HsInt
554 __hscore_sizeof_termios( void )
555 {
556 #ifndef __MINGW32__
557   return sizeof(struct termios);
558 #else
559   return 0;
560 #endif
561 }
562 #endif
563
564 #if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(_WIN32)
565 INLINE HsInt
566 __hscore_sizeof_sigset_t( void )
567 {
568   return sizeof(sigset_t);
569 }
570 #endif
571
572 INLINE int
573 __hscore_echo( void )
574 {
575 #ifdef ECHO
576   return ECHO;
577 #else
578   return 0;
579 #endif
580
581 }
582
583 INLINE int
584 __hscore_tcsanow( void )
585 {
586 #ifdef TCSANOW
587   return TCSANOW;
588 #else
589   return 0;
590 #endif
591
592 }
593
594 INLINE int
595 __hscore_icanon( void )
596 {
597 #ifdef ICANON
598   return ICANON;
599 #else
600   return 0;
601 #endif
602 }
603
604 INLINE int __hscore_vmin( void )
605 {
606 #ifdef VMIN
607   return VMIN;
608 #else
609   return 0;
610 #endif
611 }
612
613 INLINE int __hscore_vtime( void )
614 {
615 #ifdef VTIME
616   return VTIME;
617 #else
618   return 0;
619 #endif
620 }
621
622 INLINE int __hscore_sigttou( void )
623 {
624 #ifdef SIGTTOU
625   return SIGTTOU;
626 #else
627   return 0;
628 #endif
629 }
630
631 INLINE int __hscore_sig_block( void )
632 {
633 #ifdef SIG_BLOCK
634   return SIG_BLOCK;
635 #else
636   return 0;
637 #endif
638 }
639
640 INLINE int __hscore_sig_setmask( void )
641 {
642 #ifdef SIG_SETMASK
643   return SIG_SETMASK;
644 #else
645   return 0;
646 #endif
647 }
648
649 INLINE int
650 __hscore_f_getfl( void )
651 {
652 #ifdef F_GETFL
653   return F_GETFL;
654 #else
655   return 0;
656 #endif
657 }
658
659 INLINE int
660 __hscore_f_setfl( void )
661 {
662 #ifdef F_SETFL
663   return F_SETFL;
664 #else
665   return 0;
666 #endif
667 }
668
669 // defined in rts/RtsStartup.c.
670 extern void* __hscore_get_saved_termios(int fd);
671 extern void __hscore_set_saved_termios(int fd, void* ts);
672
673 INLINE int __hscore_hs_fileno (FILE *f) { return fileno (f); }
674
675 INLINE int __hscore_open(char *file, int how, mode_t mode) {
676 #ifdef __MINGW32__
677         if ((how & O_WRONLY) || (how & O_RDWR) || (how & O_APPEND))
678           return _sopen(file,how,_SH_DENYRW,mode);
679         else
680           return _sopen(file,how,_SH_DENYWR,mode);
681 #else
682         return open(file,how,mode);
683 #endif
684 }
685
686 // These are wrapped because on some OSs (eg. Linux) they are
687 // macros which redirect to the 64-bit-off_t versions when large file
688 // support is enabled.
689 //
690 INLINE off_t __hscore_lseek(int fd, off_t off, int whence) {
691         return (lseek(fd,off,whence));
692 }
693
694 INLINE int __hscore_stat(char *file, struct stat *buf) {
695         return (stat(file,buf));
696 }
697
698 INLINE int __hscore_fstat(int fd, struct stat *buf) {
699         return (fstat(fd,buf));
700 }
701
702 // select-related stuff
703
704 #if !defined(__MINGW32__)
705 INLINE int  hsFD_SETSIZE(void) { return FD_SETSIZE; }
706 INLINE void hsFD_CLR(int fd, fd_set *fds) { FD_CLR(fd, fds); }
707 INLINE int  hsFD_ISSET(int fd, fd_set *fds) { return FD_ISSET(fd, fds); }
708 INLINE void hsFD_SET(int fd, fd_set *fds) { FD_SET(fd, fds); }
709 INLINE int  sizeof_fd_set(void) { return sizeof(fd_set); }
710 extern void hsFD_ZERO(fd_set *fds);
711 #endif
712
713 // gettimeofday()-related
714
715 #if !defined(__MINGW32__)
716 #define TICK_FREQ  50
717
718 INLINE HsInt sizeofTimeVal(void) { return sizeof(struct timeval); }
719
720 INLINE HsInt getTicksOfDay(void)
721 {
722     struct timeval tv;
723     gettimeofday(&tv, (struct timezone *) NULL);
724     return (tv.tv_sec * TICK_FREQ +
725             tv.tv_usec * TICK_FREQ / 1000000);
726 }
727
728 INLINE void setTimevalTicks(struct timeval *p, HsInt ticks)
729 {
730     p->tv_sec  = ticks / TICK_FREQ;
731     p->tv_usec = (ticks % TICK_FREQ) * (1000000 / TICK_FREQ);
732 }
733 #endif /* !defined(__MINGW32__) */
734
735 // Directory-related
736
737 #if defined(__MINGW32__)
738
739 /* Make sure we've got the reqd CSIDL_ constants in scope;
740  * w32api header files are lagging a bit in defining the full set.
741  */
742 #if !defined(CSIDL_APPDATA)
743 #define CSIDL_APPDATA 0x001a
744 #endif
745 #if !defined(CSIDL_PERSONAL)
746 #define CSIDL_PERSONAL 0x0005
747 #endif
748 #if !defined(CSIDL_PROFILE)
749 #define CSIDL_PROFILE 0x0028
750 #endif
751 #if !defined(CSIDL_WINDOWS)
752 #define CSIDL_WINDOWS 0x0024
753 #endif
754
755 INLINE int __hscore_CSIDL_PROFILE()  { return CSIDL_PROFILE;  }
756 INLINE int __hscore_CSIDL_APPDATA()  { return CSIDL_APPDATA;  }
757 INLINE int __hscore_CSIDL_WINDOWS()  { return CSIDL_WINDOWS;  }
758 INLINE int __hscore_CSIDL_PERSONAL() { return CSIDL_PERSONAL; }
759 #endif
760
761 #if defined(__MINGW32__)
762 INLINE unsigned int __hscore_get_osver(void) { return _osver; }
763 #endif
764
765 /* ToDo: write a feature test that doesn't assume 'environ' to
766  *    be in scope at link-time. */
767 extern char** environ;
768 INLINE char **__hscore_environ() { return environ; }
769
770 /* lossless conversions between pointers and integral types */
771 INLINE void *    __hscore_from_uintptr(uintptr_t n) { return (void *)n; }
772 INLINE void *    __hscore_from_intptr (intptr_t n)  { return (void *)n; }
773 INLINE uintptr_t __hscore_to_uintptr  (void *p)     { return (uintptr_t)p; }
774 INLINE intptr_t  __hscore_to_intptr   (void *p)     { return (intptr_t)p; }
775
776 #endif /* __HSBASE_H__ */
777