home *** CD-ROM | disk | FTP | other *** search
- /* misc.h */
-
- #ifdef DEVELOPER
- #define MEMTRACE
- #endif
-
- #ifndef __misc_h
- #define __misc_h
-
- #include "os.h"
- #include "wimp.h"
-
- extern int misc_xeig, misc_yeig, misc_pixx, misc_pixy;
- extern wimp_palettestr misc_wimpcols;
-
- os_error *misc_err(char *msg, ...);
- void misc_boxby(wimp_box *b, int dx, int dy);
- void misc_boxto(wimp_box *b, int x, int y);
- void misc_clipbox(wimp_box *obox, wimp_box *clip);
- os_error *misc_template(char *name, wimp_wind **wdefp);
- BOOL misc_overlap(wimp_box *boxa, wimp_box *boxb);
- BOOL misc_commonbox(wimp_box *obox, wimp_box *ibox);
- void misc_boundbox(wimp_box *obox, wimp_box *ibox);
- void misc_makebox(wimp_box *obox, int x0, int y0, int x1, int y1);
- BOOL misc_inbox(wimp_box *box, int x, int y);
- void misc_newmode(void);
- os_error *misc_sprput(sprite_area *area, sprite_id *id, int x, int y);
- os_error *misc_sprputn(sprite_area *area, char *name, int x, int y);
- os_error *misc_settype(char *name, int ftype);
- os_error *misc_windowbox(wimp_box *box, BOOL shrink);
- os_error *misc_opendir(char *dirname);
-
- int misc_min(int a, int b);
- int misc_max(int a, int b);
-
- #ifdef MEMTRACE
-
- #include "flex.h"
- #include <stdlib.h>
-
- int __flex_alloc(char *name, int line, flex_ptr anchor, int n);
- int __flex_extend(char *name, int line, flex_ptr anchor, int n);
- void __flex_free(char *name, int line, flex_ptr anchor);
-
- void *__malloc(char *name, int line, size_t size);
- void *__realloc(char *name, int line, void *m, size_t size);
- void __free(char *name, int line, void *m);
-
- #define flex_alloc(anc, n) __flex_alloc(__FILE__, __LINE__, anc, n)
- #define flex_extend(anc, n) __flex_extend(__FILE__, __LINE__, anc, n)
- #define flex_free(anc) __flex_free(__FILE__, __LINE__, anc)
-
- #define malloc(s) __malloc(__FILE__, __LINE__, s)
- #define realloc(m, s) __realloc(__FILE__, __LINE__, m, s)
- #define free(m) __free(__FILE__, __LINE__, m)
-
- #define misc_malloc(ptr, size) (misc_malloc)(__FILE__, __LINE__, ptr, size)
- #define misc_free(ptr) (misc_free)(__FILE__, __LINE__, ptr)
-
- os_error *(misc_malloc)(char *name, int line, void **ptr, int size);
- void (misc_free)(char *name, int line, void **ptr);
-
- #else
-
- os_error *misc_malloc(void **ptr, int size);
- void misc_free(void **ptr);
-
- #endif
- os_error *misc_falloc(void **ptr, int size);
- os_error *misc_fextend(void **ptr, int by);
- os_error *misc_fmidextend(void **ptr, int at, int by);
-
- int misc_fsize(void **ptr);
- void misc_ffree(void **ptr);
-
- os_error *misc_force(wimp_w w);
- os_error *misc_chtitle(wimp_w w);
- void misc_growbox(wimp_box *box, int dx, int dy);
- int misc_init(char *taskname);
- int misc_wimpver(void);
- void misc_report(char *tag, ...);
- void __memreport(void);
- char *misc_leaf(char *fname);
- os_error *misc_strdup(char **dest, const char *source);
- int misc_strcicmp(const char *s1, const char *s2);
- os_error *misc_counticons(wimp_w w, int *countp);
- os_error *misc_icontextlen(wimp_w w, wimp_i i, int *lenp);
- os_error *misc_nextwriteable(wimp_w w, BOOL *wrap);
- os_error *misc_prevwriteable(wimp_w w, BOOL *wrap);
- os_error *misc_fillrect(wimp_box *box);
- os_error *misc_setfontrgb(int fh, int bcol, int fcol);
- os_error *misc_setfontcolours(int fh, int bcol, int fcol);
- os_error *misc_settitle(wimp_w w, char *title);
-
- #ifdef DEVELOPER
- os_error *misc__fix(char *file, int line, os_error *err);
- #define misc_fix(e) \
- misc__fix(__FILE__, __LINE__, e)
- #include "werr.h"
- #define misc_assert(e) \
- do { if (!(e)) werr(TRUE, "%s, line %d: Assertion %s was false", \
- __FILE__, __LINE__, #e); } while (0)
- #else
- #define misc_fix(e) e
- #define misc_assert(e) ((void) 0)
- #endif
-
- #endif
-