//uspace/trunk/console/gcons.h |
---|
31,5 → 31,6 |
void gcons_init(int phone); |
void gcons_change_console(int consnum); |
void gcons_notify_char(int consnum); |
#endif |
//uspace/trunk/console/console.c |
---|
284,6 → 284,7 |
return; |
case CONSOLE_PUTCHAR: |
write_char(consnum, IPC_GET_ARG1(call)); |
gcons_notify_char(consnum); |
break; |
case CONSOLE_CLEAR: |
/* Send message to fb */ |
296,13 → 297,13 |
break; |
case CONSOLE_GOTO: |
screenbuffer_goto(&(connections[consnum].screenbuffer), IPC_GET_ARG1(call), IPC_GET_ARG2(call)); |
screenbuffer_goto(&(connections[consnum].screenbuffer), IPC_GET_ARG2(call), IPC_GET_ARG1(call)); |
break; |
case CONSOLE_GETSIZE: |
arg1 = fb_info.cols; |
arg2 = fb_info.rows; |
arg1 = fb_info.rows; |
arg2 = fb_info.cols; |
break; |
case CONSOLE_FLUSH: |
sync_send_2(fb_info.phone, FB_FLUSH, 0, 0, NULL, NULL); |
//uspace/trunk/console/gcons.c |
---|
48,6 → 48,7 |
static int console_vp; |
static int cstatus_vp[CONSOLE_COUNT]; |
static int console_has_input[CONSOLE_COUNT]; |
static int cstat_row, cstat_col; /* Size of cstatus buttons */ |
static int fbphone; |
55,7 → 56,8 |
enum butstate { |
CONS_ACTIVE = 0, |
CONS_IDLE, |
CONS_HAS_INPUT |
CONS_HAS_INPUT, |
CONS_DISCONNECTED |
}; |
static struct { |
64,7 → 66,8 |
} stat_colors[] = { |
{0xd0d0d0, 0x808080}, |
{0xd0d0d0, 0x0}, |
{0xd0d0d0, 0xa04040} |
{0xd0d0d0, 0xa04040}, |
{0xd0d0d0, 0x0} |
}; |
static int active_console = 0; |
108,9 → 111,11 |
vp_switch(cstatus_vp[consnum]); |
set_style(stat_colors[state].fgcolor, stat_colors[state].bgcolor); |
clear(); |
snprintf(data, 5, "%d", consnum+1); |
for (i=0;data[i];i++) |
putch(data[i], 0, i); |
if (state != CONS_DISCONNECTED) { |
snprintf(data, 5, "%d", consnum+1); |
for (i=0;data[i];i++) |
putch(data[i], 0, i); |
} |
} |
void gcons_change_console(int consnum) |
121,6 → 126,8 |
draw_stat(active_console, CONS_IDLE); |
active_console = consnum; |
draw_stat(consnum, CONS_ACTIVE); |
console_has_input[consnum] = 0; |
vp_switch(console_vp); |
} |
129,6 → 136,12 |
if (!use_gcons) |
return; |
if (consnum == active_console || console_has_input[consnum]) |
return; |
console_has_input[consnum] = 1; |
draw_stat(consnum, CONS_HAS_INPUT); |
vp_switch(console_vp); |
} |
144,7 → 157,7 |
clear(); |
for (i=0;i < CONSOLE_COUNT; i++) |
draw_stat(i, i == active_console ? CONS_ACTIVE : CONS_IDLE); |
draw_stat(i, i == active_console ? CONS_ACTIVE : CONS_DISCONNECTED); |
vp_switch(console_vp); |
} |
//uspace/trunk/libc/include/err.h |
---|
29,7 → 29,6 |
#ifndef _libc__ERR_H_ |
#define _libc__ERR_H_ |
extern void errx (int __status, __const char *__format, ...) |
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); |
#define errx(status,fmt,...) { printf((fmt),##__VA_ARGS__);_exit(status);} |
#endif |
//uspace/trunk/libc/include/io/stream.h |
---|
26,6 → 26,9 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __libc_STREAM_H_ |
#define __libc_STREAM_H_ |
#include <libarch/types.h> |
#define EMFILE -17 |
38,3 → 41,5 |
fd_t open(const char *fname, int flags); |
int get_fd_phone(int fd); |
#endif |
//uspace/trunk/tetris/screen.c |
---|
97,6 → 97,7 |
scr_clear(void) |
{ |
resume_normal(); |
send_call(con_phone, CONSOLE_CLEAR, 0); |
curscore = -1; |
memset((char *)curscreen, 0, sizeof(curscreen)); |
186,12 → 187,6 |
} |
#if vax && !__GNUC__ |
typedef int regcell; /* pcc is bad at `register char', etc */ |
#else |
typedef cell regcell; |
#endif |
/* |
* Update the screen. |
*/ |
199,7 → 194,7 |
scr_update(void) |
{ |
cell *bp, *sp; |
regcell so, cur_so = 0; |
cell so, cur_so = 0; |
int i, ccol, j; |
static const struct shape *lastshape; |
299,17 → 294,12 |
scr_msg(char *s, int set) |
{ |
if (set || CEstr == NULL) { |
int l = strlen(s); |
moveto(Rows - 2, ((Cols - l) >> 1) - 1); |
if (set) |
putstr(s); |
else |
while (--l >= 0) |
(void) putchar(' '); |
} else { |
moveto(Rows - 2, 0); |
putpad(CEstr); |
} |
int l = strlen(s); |
moveto(Rows - 2, ((Cols - l) >> 1) - 1); |
if (set) |
putstr(s); |
else |
while (--l >= 0) |
(void) putchar(' '); |
} |
//uspace/trunk/tetris/tetris.c |
---|
45,12 → 45,10 |
* Tetris (or however it is spelled). |
*/ |
//#include <sys/param.h> |
#include <sys/time.h> |
#include <sys/types.h> |
#include <err.h> |
//#include <signal.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
//uspace/trunk/Makefile |
---|
38,7 → 38,8 |
init \ |
ns \ |
fb \ |
console |
console \ |
tetris |
ifeq ($(ARCH), amd64) |
DIRS += pci \ |