summaryrefslogtreecommitdiffstats
path: root/stone_soup/crawl-ref/source/libmac.h
blob: 8b7e3903d6dbcb303d90c79fddb7c789e2e2a139 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 *  File:       libmac.h
 *  Summary:    Mac specific routines used by Crawl.
 *  Written by: Jesse Jones
 *
 *  Change History (most recent first): 
 *
 *    <2>     5/25/02     JDJ       Updated for Mach-O targets
 *    <1>     3/23/99     JDJ       Created
 */
 
#ifndef LIBMAC_H
#define LIBMAC_H

#if macintosh

#ifdef _BSD_SIZE_T_			// $$$ is there a better way to test for OS X?
	#define OSX	1
#else
	#define OS9	1
#endif

#include <fcntl.h>
#include <stdlib.h>
#include <string.h>

#if OSX
	#include <unistd.h>
#endif

#define MAC_NUMBER_OF_LINES     30

// constants
const int _NORMALCURSOR = 1;
const int _NOCURSOR = 0;


// non-ANSI functions
int stricmp(const char* lhs, const char* rhs);
char* strlwr(char* str);
void itoa(int n, char* buffer, int radix);

#if !OSX
	inline void srandom(unsigned int seed)
	{
	    srand(seed);
	}

	int open(const char* path, int openFlags, int permissions);
	int open(const char* path, int openFlags, int permissions, int mysteryFlags);
	int close(int desc);
	int read(int desc, void *buffer, unsigned int bytes);
	int write(int desc, const void *buffer, unsigned int bytes);
	int unlink(const char* path);
#endif


// curses(?) functions
void clrscr();
void gotoxy(int x, int y);
void textcolor(int c);
void cprintf(const char* format,...);

void window(int x, int y, int lx, int ly);
int wherex();
int wherey();
void putch(char c);
int kbhit();

char getche();
int getch();
void getstr(char* buffer, int bufferSize);

void textbackground(int c);
void _setcursortype(int curstype);


// misc functions
void delay(int ms);

void init_mac();
void deinit_mac();


#endif // macintosh
#endif // LIBMAC_H