File: libmac.h

package info (click to toggle)
crawl 1%3A4.0.0beta23-2woody1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,264 kB
  • ctags: 5,033
  • sloc: cpp: 100,977; perl: 233; makefile: 63; sh: 11
file content (80 lines) | stat: -rw-r--r-- 1,562 bytes parent folder | download
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
/*
 *  File:       libmac.h
 *  Summary:    Mac specific routines used by Crawl.
 *  Written by: Jesse Jones
 *
 *  Change History (most recent first): 
 *
 *               <1>     3/23/99        JDJ             Created
 */
#ifndef LIBMAC_H
#define LIBMAC_H

#if macintosh

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

#define MAC_NUMBER_OF_LINES     30

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

const int S_IWRITE = 0x10000;   // not sure about these...

const int S_IREAD = 0x20000;


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

inline int random()
{
    return rand();
}
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);


// 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