1 #ifndef __POUTPUT_H
2 #define __POUTPUT_H
3 
4 #include "boot/console.h" /* currently from boot/console.h... to be moved later */
5 
6 #ifndef _CONSOLE_DRIVER
7 
8 #define vga13() (_vga13())
9 #define plSetTextMode(x) (_plSetTextMode(x))
10 #define plSetBarFont(x) (_plSetBarFont(x))
11 #define displaystr(y, x, attr, str, len) (_displaystr(y, x, attr, str, len))
12 #define displaystrattr(y, x, buf, len) (_displaystrattr(y, x, buf, len))
13 #define displaystr_iso8859latin1(y, x, attr, str, len) (_displaystr_iso8859latin1(y, x, attr, str, len))
14 #define displaystrattr_iso8859latin1(y, x, buf, len) (_displaystrattr_iso8859latin1(y, x, buf, len))
15 #define displaystr_utf8(y, x, attr, str, len) (_displaystr_utf8(y, x, attr, str, len))
16 #define measurestr_utf8(str, strlen) (_measurestr_utf8(str, strlen))
17 #define displayvoid(y, x, len) (_displayvoid(y, x, len))
18 #define plSetGraphMode(size) (_plSetGraphMode(size))
19 #define gdrawchar(x, y, c, f, b) (_gdrawchar(x, y, c, f, b))
20 #define gdrawchart(x, y, c, f) (_gdrawchart(x, y, c, f))
21 #define gdrawcharp(x, y, c, f, picp) (_gdrawcharp(x, y, c, f, picp))
22 #define gdrawchar8(x, y, c, f, b) (_gdrawchar8(x, y, c, f, b))
23 #define gdrawchar8t(x, y, c, f) (_gdrawchar8t(x, y, c, f))
24 #define gdrawchar8p(x, y, c, f, picp) (_gdrawchar8p(x, y, c, f, picp))
25 #define gdrawstr(y, x, s, len, f, b) (_gdrawstr(y, x, s, len, f, b))
26 #define gupdatestr(y, x, str, len, old) (_gupdatestr(y, x, str, len, old))
27 #define drawbar(x, yb, yh, hgt, c) (_drawbar(x, yb, yh, hgt, c))
28 #define idrawbar(x, yb, yh, hgt, c) (_idrawbar(x, yb, yh, hgt, c))
29 #define gupdatepal(c,r,g,b) (_gupdatepal(c,r,g,b))
30 #define gflushpal() (_gflushpal())
31 #define plDisplaySetupTextmode() (_plDisplaySetupText())
32 #define plGetDisplayTextModeName() (_plGetDisplayTextModeName())
33 #define Screenshot() (_Screenshot())
34 #define TextScreenshot(scrType) (_TextScreenshot(scrType))
35 #define RefreshScreen() (_RefreshScreen())
36 
37 #define ekbhit() (_ekbhit())
38 #define egetch() (_egetch())
39 #define validkey(k) (_validkey(k))
40 
41 #define setcur(y, x) _setcur(y, x)
42 #define setcurshape(shape) _setcurshape(shape)
43 #define conRestore() _conRestore()
44 #define conSave() _conSave()
45 
46 #define plDosShell() _plDosShell()
47 
48 #endif
49 
50 /* standard functions that can be used to embed in ekbhit and egetch when
51  * escaped key-codes are used, or you want to push ready keys (values above 256)
52  */
53 extern void ___push_key(uint16_t);
54 extern int ___peek_key(void);
55 extern /*uint16_t*/int ___pop_key(void);
56 extern void ___setup_key(int(*kbhit)(void), int(*getch)(void));
57 
58 extern char *convnum(unsigned long num, char *buf, unsigned char radix, unsigned short len, char clip0/*=1*/);
59 #define _convnum(num,buf,radix,len) convnum(num,buf,radix,len,1)
60 
61 extern void writenum(uint16_t *buf, unsigned short ofs, unsigned char attr, unsigned long num, unsigned char radix, unsigned short len, char clip0/*=1*/);
62 #define _writenum(buf, ofs, attr, num, radix, len) writenum(buf, ofs, attr, num, radix, len, 1)
63 extern void writestring(uint16_t *buf, unsigned short ofs, unsigned char attr, const char *str, unsigned short len);
64 extern void writestringattr(uint16_t *buf, unsigned short ofs, const uint16_t *str, unsigned short len);
65 extern void markstring(uint16_t *buf, unsigned short ofs, unsigned short len);
66 extern void fillstr(uint16_t *buf, const unsigned short ofs, const unsigned char chr, const unsigned char attr, unsigned short len);
67 
68 enum vidType
69 {
70 	vidNorm, /* text-only systems - console, curses etc.. can support setting video-mode */
71 	vidVESA, /* text and graphical systems.. can support setting video-mode */
72 	vidModern, /* text and graphical systems.. try to not override video-mode */
73 };
74 
75 extern unsigned int plScrHeight;        /* How many textlines can we currently fit. Undefined for wurfel-mode */
76 extern unsigned int plScrWidth;         /* How many characters can we currently fir on a line */
77 extern enum vidType plVidType;                  /* vidNorm for textmode only, or vidVESA for graphical support also */
78 extern unsigned char plScrType;         /* Last set textmode */
79 extern int plScrMode;                   /* If we are in graphical mode, this value is set to either 13 (for wurfel), 100 for 640x480 or 101 for 1024x768 */
80 extern uint8_t *plVidMem;               /* This points to the current selected bank, and should atleast provide 64k of available bufferspace */
81 extern int plScrLineBytes;              /* How many bytes does one line from plVidMem use (can be padded) */
82 extern int plScrLines;                  /* How many graphical lines do we have, should always be 480 or 768, but can be padded */
83 extern void make_title(char *part);
84 
85 extern int plScrTextGUIOverlay;         /* Is text rendered virtually into a framebuffer, AND supports overlays? */
86 
87 typedef enum {
88 	_4x4 = 0,
89 	_8x8 = 1,
90 	_8x16 = 2,
91 	_FONT_MAX = 2
92 } FontSizeEnum;
93 
94 struct FontSizeInfo_t
95 {
96 	uint8_t w, h;
97 };
98 extern const struct FontSizeInfo_t FontSizeInfo[_FONT_MAX+1];
99 
100 extern FontSizeEnum plCurrentFont; /* Only drivers can change this, and their helper functions can use it */
101 
102 #ifdef _CONSOLE_DRIVER
103 
104 extern unsigned char plpalette[256];
105 
106 extern void generic_gdrawstr(unsigned short y, unsigned short x, const char *str, unsigned short len, unsigned char f, unsigned char b);
107 extern void generic_gdrawchar8(unsigned short x, unsigned short y, unsigned char c, unsigned char f, unsigned char b);
108 extern void generic_gdrawchar8t(unsigned short x, unsigned short y, unsigned char c, unsigned char f);
109 extern void generic_gdrawchar8p(unsigned short x, unsigned short y, unsigned char c, unsigned char f, void *picp);
110 extern void generic_gdrawstr(unsigned short y, unsigned short x, const char *str, unsigned short len, unsigned char f, unsigned char b);
111 extern void generic_gdrawcharp(unsigned short x, unsigned short y, unsigned char c, unsigned char f, void *picp);
112 extern void generic_gdrawchar(unsigned short x, unsigned short y, unsigned char c, unsigned char f, unsigned char b);
113 extern void generic_gupdatestr(unsigned short y, unsigned short x, const uint16_t *str, unsigned short len, uint16_t *old);
114 #endif
115 
116 #endif
117