home *** CD-ROM | disk | FTP | other *** search
- #ifndef __wimpc_h
- #define __wimpc_h
-
- /* wimpc.h */
-
- /* Copyright (C) David Elworthy 1991. No warranty is given on this code. */
-
- /*
- 1.0 -- April 1991 -- First working version
- 2.0 -- July 1991 -- Force creation parameter added to initialise
-
- * This file provides functions for adapting command line c programs to
- * use the wimp.
- * This means intercepting printf amd fread, providing an event handler,
- * and generally getting things going.
- * As explained in wimpio.h, scanf can't be intercepted which is a pain in the bum.
- *
- * Much of the work is automatic, e.g. you need not call printf_select. The things
- * you have to call are:
- * wimpc_init
- *
- */
-
- #include <stdio.h>
-
- /* Select how output to stdout and stderr appears. Default is to a window for
- both.
- */
- extern void printf_select(int w_stdout, /* 1 for window, 0 for real stdout */
- int w_stderr /* 1 for window, 0 for real, -1 for werr */);
-
- /* Do all the initialisation you need to set up the wimp.
- taskname is used for the task display. resources is used for application
- files: we look in resources$dir.
- The two flags allow you to initialise heap and/or flex
- The create flag, forces creation of the print and read windows,
- which are otherwise created when they are needed. It is intended when you want to
- fiddle with the windows, e.g. by changing the event handler. You can create the
- windows without showing them. See wimpio.h for suitable values.
- */
-
- extern void wimpc_init(char *taskname, char *resources, int init_heap, int init_flex, int create);
-
- /* Checkpoint. Calling this allows event handlers and other tasks to get a look in.
- If there are any active windows, it will process one event. This will not cause the
- program to close down, even if there are no active windows.
- */
- extern void wimpc_checkpoint(void);
-
- /* Fake input - transfer to the stdio buffer */
- extern void w_fake_input(char *string, int len);
-
-
- /* C library functions */
- #define printf w_printf
- #define fprintf w_fprintf
- #define fread w_fread
- #define fwrite w_fwrite
-
- extern int w_fprintf(FILE *stream, const char *format, ...);
- extern int w_printf(const char *format, ...);
- extern size_t w_fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
- extern size_t w_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-
- #endif
-