Language-Haskell

 view release on metacpan or  search on metacpan

hugs98-Nov2003/src/prelude.h  view on Meta::CPAN

#define DIRECTORY_MODULE 1
#define MULTI_LINEFEED   1 /* Platform-independent linefeed handling        */
#define MULTI_INST       0
#define WANT_FIXED_SIZE_TABLES 0 /* use fixed-size tables for internal structs */
                                 /* (as opposed to dynamically growable ones)  */

#define SHORT_CIRCUIT_COERCIONS 1

#define FAST_WHATIS      1
#define FAST_WHATIS1     1	 /* can only use if FAST_WHATIS is 1 */

/*---------------------------------------------------------------------------
 * Platform-dependent settings:
 *-------------------------------------------------------------------------*/

#if HAVE_MACSYSTEM	/* Macintosh system() prototype. */
int macsystem(char *filenames);
#endif


/*---------------------------------------------------------------------------
 * Include windows.h and friends:
 *-------------------------------------------------------------------------*/

#if     HUGS_FOR_WINDOWS
#include <windows.h>			/* Misc. Windows hackery	   */

#if	__MSDOS__
# define INT           int
# define UNSIGNED      unsigned
# define CHAR	       char
# define TCHAR         char
# define UCHAR	       UNSIGNED CHAR
# define ULONG	       unsigned long
# define APIENTRY      PASCAL
# define HUGE          huge
# define LPOFNHOOKPROC FARPROC
# define CMDdata(w,l)  (HIWORD(l))	/* decoding WM_COMMAND message	   */
# define CMDitem(w,l)  (w)
# define CMDhwnd(w,l)  ((HWND)(LOWORD(l)))
#else
# define HUGE
# define CMDdata(w,l)  (HIWORD(w))	/* decoding WM_COMMAND message	   */
# define CMDitem(w,l)  (LOWORD(w))
# define CMDhwnd(w,l)  ((HWND)(l))
#endif

#if HUGS_FOR_WINDOWS
#include "winhugs\winmenu.h"
#endif
extern char *appName;
extern HWND		hWndText;	/* text output window handle	   */
extern HWND		hWndMain;	/* main window handle		   */
#if HUGS_FOR_WINDOWS
#include "winhugs\wintext.h"
#endif
#endif


/*---------------------------------------------------------------------------
 * Macros used in declarations:
 *  function prototypes
 *  local/far declarations
 *  HUGS_noreturn/HUGS_unused (prevent spurious warnings)
 *  result type of main
 *  dynamic linking declarations
 *-------------------------------------------------------------------------*/

#if HAVE_PROTOTYPES       /* To enable use of prototypes whenever possible */
#define Args(x) x
#else
#define Args(x) ()
#endif

/* local = prefix for locally defined functions */
/* far   = prefix for far pointers              */
#if DOS
# define local near pascal
#else
# define local
# define far
#endif

#ifdef __GNUC__     /* Avoid spurious warnings                             */
#if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7
#define HUGS_noreturn  __attribute__ ((noreturn))
#define HUGS_unused    __attribute__ ((unused))
#else
#define HUGS_noreturn  
#define HUGS_unused
#endif
#else
#define HUGS_noreturn  
#define HUGS_unused
#endif

/*---------------------------------------------------------------------------
 * Dynamic linking tricks
 *-------------------------------------------------------------------------*/

#if 0
/* DLLs, shareable libraries, etc generated by the foreign language
 * interface generator need some way to access the Hugs stack, standard
 * constructor functions, the garbage collector, etc.
 *
 * Most UNIX systems use the same mechanisms as for static linking - when
 * you load the shareable object file, it patches it with the values of
 * the required symbols.
 *
 * DOS/Windows uses a different mechanism - a DLL (or EXE) accesses code and
 * data from other DLLs (or EXEs) via an indirection.  No big deal for code
 * but it makes a huge difference when accessing data and the compiler
 * _HAS TO KNOW_ whether a piece of data is accessed directly (it's in
 * the same DLL/EXE) or indirectly.
 *
 * On Microsoft Visual C++, this is done using a VC++ specific language
 * extension on declarations and definitions of all imported/exported
 * symbols.  The "extern" declarations of imported symbols are modified
 * with "__declspec(dllimport)" and the definitions of exported symbols
 * are marked with "__declspec(dllexport)".  If you want both the 
 * declaration and the definition to coexist in the same file without 



( run in 0.560 second using v1.01-cache-2.11-cpan-39bf76dae61 )