From 398c6b7980ac52ba15af78f45e71f49f33ded1aa Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 4 Feb 2003 02:43:27 +0000 Subject: DOS updates (Daniel Borca) --- src/glut/dos/PC_HW/pc_hw.c | 15 ++++++--------- src/glut/dos/PC_HW/pc_hw.h | 7 +++---- src/glut/dos/PC_HW/pc_keyb.c | 7 ++++++- src/glut/dos/PC_HW/pc_mouse.c | 17 ++--------------- src/glut/dos/PC_HW/pc_timer.c | 4 ++-- 5 files changed, 19 insertions(+), 31 deletions(-) (limited to 'src/glut/dos/PC_HW') diff --git a/src/glut/dos/PC_HW/pc_hw.c b/src/glut/dos/PC_HW/pc_hw.c index 867daf89b0..f08286d4c4 100644 --- a/src/glut/dos/PC_HW/pc_hw.c +++ b/src/glut/dos/PC_HW/pc_hw.c @@ -73,9 +73,6 @@ void *pc_malloc (size_t size) /* * standard redirection */ -#define STDOUT 1 -#define STDERR 2 - static char outname[L_tmpnam]; static int h_out, h_outbak; static char errname[L_tmpnam]; @@ -86,9 +83,9 @@ int pc_open_stdout (void) tmpnam(outname); if ((h_out=open(outname, O_WRONLY | O_CREAT | O_TEXT | O_TRUNC, S_IREAD | S_IWRITE)) > 0) { - h_outbak = dup(STDOUT); + h_outbak = dup(STDOUT_FILENO); fflush(stdout); - dup2(h_out, STDOUT); + dup2(h_out, STDOUT_FILENO); } return h_out; @@ -100,7 +97,7 @@ void pc_close_stdout (void) char *line = alloca(512); if (h_out > 0) { - dup2(h_outbak, STDOUT); + dup2(h_outbak, STDOUT_FILENO); close(h_out); close(h_outbak); @@ -119,9 +116,9 @@ int pc_open_stderr (void) tmpnam(errname); if ((h_err=open(errname, O_WRONLY | O_CREAT | O_TEXT | O_TRUNC, S_IREAD | S_IWRITE)) > 0) { - h_errbak = dup(STDERR); + h_errbak = dup(STDERR_FILENO); fflush(stderr); - dup2(h_err, STDERR); + dup2(h_err, STDERR_FILENO); } return h_err; @@ -133,7 +130,7 @@ void pc_close_stderr (void) char *line = alloca(512); if (h_err > 0) { - dup2(h_errbak, STDERR); + dup2(h_errbak, STDERR_FILENO); close(h_err); close(h_errbak); diff --git a/src/glut/dos/PC_HW/pc_hw.h b/src/glut/dos/PC_HW/pc_hw.h index 77572e6441..c38c8959b6 100644 --- a/src/glut/dos/PC_HW/pc_hw.h +++ b/src/glut/dos/PC_HW/pc_hw.h @@ -1,5 +1,5 @@ /* - * PC/HW routine collection v1.2 for DOS/DJGPP + * PC/HW routine collection v1.3 for DOS/DJGPP * * Copyright (C) 2002 - Borca Daniel * Email : dborca@yahoo.com @@ -39,6 +39,7 @@ int pc_clexit (VFUNC f); #define ENDOFUNC(x) static void x##_end() { } #define LOCKFUNC(x) _go32_dpmi_lock_code((void *)x, (long)x##_end - (long)x) #define LOCKDATA(x) _go32_dpmi_lock_data((void *)&x, sizeof(x)) +#define LOCKBUFF(x, l) _go32_dpmi_lock_data((void *)x, l) void *pc_malloc (size_t size); @@ -194,6 +195,7 @@ void pc_remove_keyb (void); int pc_keypressed (void); int pc_readkey (void); int pc_keydown (int code); +int pc_keyshifts (void); /* * timer @@ -210,9 +212,6 @@ MFUNC pc_install_mouse_handler (MFUNC handler); void pc_mouse_area (int x1, int y1, int x2, int y2); void pc_mouse_speed (int xspeed, int yspeed); int pc_query_mouse (int *x, int *y); -void pc_show_mouse (void); -void pc_scare_mouse (void); -void pc_unscare_mouse (void); /* * standard redirection diff --git a/src/glut/dos/PC_HW/pc_keyb.c b/src/glut/dos/PC_HW/pc_keyb.c index fb22923d63..333ca757f5 100644 --- a/src/glut/dos/PC_HW/pc_keyb.c +++ b/src/glut/dos/PC_HW/pc_keyb.c @@ -1,5 +1,5 @@ /* - * PC/HW routine collection v1.1 for DOS/DJGPP + * PC/HW routine collection v1.3 for DOS/DJGPP * * Copyright (C) 2002 - Borca Daniel * Email : dborca@yahoo.com @@ -445,6 +445,11 @@ int pc_keydown (int code) return pc_key[code]; } +int pc_keyshifts (void) +{ + return key_shifts; +} + void pc_remove_keyb (void) { if (keyboard_installed) { diff --git a/src/glut/dos/PC_HW/pc_mouse.c b/src/glut/dos/PC_HW/pc_mouse.c index 01e9502dd0..3ed7650906 100644 --- a/src/glut/dos/PC_HW/pc_mouse.c +++ b/src/glut/dos/PC_HW/pc_mouse.c @@ -1,5 +1,5 @@ /* - * PC/HW routine collection v1.2 for DOS/DJGPP + * PC/HW routine collection v1.3 for DOS/DJGPP * * Copyright (C) 2002 - Borca Daniel * Email : dborca@yahoo.com @@ -212,22 +212,9 @@ int pc_query_mouse (int *x, int *y) return pc_mouse_b; } -void pc_show_mouse (void) -{ - /* not implemented */ -} -void pc_scare_mouse (void) -{ - /* not implemented */ -} -void pc_unscare_mouse (void) -{ - /* not implemented */ -} - __asm("\n\ .text \n\ - .balign 4 \n\ + .p2align 5,,31 \n\ .global _mouse_wrapper \n\ _mouse_wrapper: \n\ cld \n\ diff --git a/src/glut/dos/PC_HW/pc_timer.c b/src/glut/dos/PC_HW/pc_timer.c index ec348e278b..36c02910a3 100644 --- a/src/glut/dos/PC_HW/pc_timer.c +++ b/src/glut/dos/PC_HW/pc_timer.c @@ -1,5 +1,5 @@ /* - * PC/HW routine collection v1.0 for DOS/DJGPP + * PC/HW routine collection v1.3 for DOS/DJGPP * * Copyright (C) 2002 - Borca Daniel * Email : dborca@yahoo.com @@ -27,7 +27,7 @@ typedef struct { volatile void *parm; } TIMER; -TIMER timer_main, timer_func[MAX_TIMERS]; +static TIMER timer_main, timer_func[MAX_TIMERS]; static int timer () { -- cgit v1.2.3