[dslinux-commit-bounces at dslinux.in-berlin.de: Auto-discard notification]
Stefan Sperling
stsp at stsp.in-berlin.de
Sun Nov 12 10:27:16 CET 2006
----- Forwarded message from dslinux-commit-bounces at dslinux.in-berlin.de -----
Subject: Auto-discard notification
From: dslinux-commit-bounces at dslinux.in-berlin.de
To: dslinux-commit-owner at dslinux.in-berlin.de
Date: Sun, 12 Nov 2006 02:41:42 +0100
The attached message has been automatically discarded.
From: cayenne <dslinux_cayenne at user.in-berlin.de>
To: diegoesep at yahoo.fr, thechuckster at gmail.com, kineox at gmail.com,
BThaeler at aol.com, dslinux-commit at dslinux.in-berlin.de
Subject: dslinux/user/games/sudoku/win32 curses.c curses.h termios.c termios.h
unistd.c unistd.h
Date: Sun, 12 Nov 2006 01:41:35 +0000
X-Mailer: Python syncmail $Revision: 2.1 $
<http://sf.net/projects/cvs-syncmail>
X-Spam-Score: (-1.799) ALL_TRUSTED,BAYES_50
Update of /cvsroot/dslinux/dslinux/user/games/sudoku/win32
In directory antilope:/tmp/cvs-serv3889/win32
Added Files:
curses.c curses.h termios.c termios.h unistd.c unistd.h
Log Message:
adding pristine copy of sudoku to HEAD so I can branch from it
--- NEW FILE: unistd.c ---
/* Dummy signal implementation for Win32 port
*/
#include "unistd.h"
int
sigemptyset( sigset_t * sigset )
{
*sigset = 0;
return 0;
}
void
sigaction( int sig, struct sigaction * action, int ignored )
{
/* Nothing */
}
--- NEW FILE: termios.c ---
/* Dumb termios implementation for Win32 port
*/
#include "termios.h"
int
tcgetattr( int fd, struct termios * t )
{
return 0;
}
int
tcsetattr( int fd, int mode, struct termios * t )
{
return 0;
}
--- NEW FILE: curses.h ---
/* Dummy header for Win32 port
*
* Provide prototypes for required 'curses' functions.
*/
#include <Windows.h>
typedef void * Window;
#define stdscr 0
#define A_BOLD ( FOREGROUND_INTENSITY | FOREGROUND_BLUE )
void wclear( Window * );
void attron( unsigned short );
void attroff( unsigned short );
void mvaddstr( int, int, const char * );
void addch( int );
void move( int, int );
void wclrtoeol( Window * );
void wrefresh( Window * );
void mvaddch( int, int, int );
int wgetch( Window * );
void beep( void );
void noecho( void );
void raw( void );
int initscr( void );
void endwin( void );
--- NEW FILE: unistd.h ---
/* Dummy header for Win32 port
*/
#include <direct.h>
#include <io.h>
#include <process.h>
#define PATH_MAX _MAX_PATH
#define getcwd _getcwd
#define getpid _getpid
#define isatty _isatty
#define pclose _pclose
#define popen _popen
typedef int sigset_t;
int sigemptyset( sigset_t * );
struct sigaction
{
void (*sa_handler)( int );
sigset_t sa_mask;
int sa_flags;
};
void sigaction( int, struct sigaction *, int );
--- NEW FILE: curses.c ---
/* Dumb curses implementation for Win32 port
*/
#include "curses.h"
static HANDLE _conin;
static HANDLE _conout;
void
wclear( Window * w )
{
COORD sz, xy = { 0, 0 };
DWORD wrote;
sz = GetLargestConsoleWindowSize( _conout );
FillConsoleOutputCharacter( _conout, ' ', sz.X * sz.Y, xy, &wrote );
}
void
attron( unsigned short attr )
{
SetConsoleTextAttribute( _conout, attr );
}
void
attroff( unsigned short attr )
{
SetConsoleTextAttribute( _conout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE );
}
void
move( int y, int x )
{
COORD xy = { x, y };
SetConsoleCursorPosition( _conout, xy );
}
void
mvaddstr( int y, int x, const char * str )
{
DWORD wrote;
move( y,x );
WriteConsole( _conout, str, strlen( str ), &wrote, 0 );
}
void
addch( int ch )
{
DWORD wrote;
WriteConsole( _conout, &ch, 1, &wrote, 0 );
}
void
mvaddch( int y, int x, int ch )
{
move( y, x );
addch( ch );
}
void
wclrtoeol( Window * w )
{
CONSOLE_SCREEN_BUFFER_INFO info;
DWORD wrote;
GetConsoleScreenBufferInfo( _conout, &info );
FillConsoleOutputCharacter( _conout, ' ', info.dwSize.X - info.dwCursorPosition.X,
info.dwCursorPosition, &wrote );
}
void
wrefresh( Window * w )
{
/* Do nothing - all changes are immediate */
}
int
wgetch( Window * w )
{
INPUT_RECORD in;
DWORD got;
while( 1 )
{
do
ReadConsoleInput( _conin, &in, 1, &got );
while( KEY_EVENT != in.EventType || 0 == in.Event.KeyEvent.bKeyDown );
/* Translate direction keys into vi(1) motion */
switch( in.Event.KeyEvent.wVirtualKeyCode )
{
case VK_LEFT: return 'h';
case VK_RIGHT: return 'l';
case VK_UP: return 'k';
case VK_DOWN: return 'j';
/* Ignore standard modifier keys */
case VK_SHIFT:
case VK_CONTROL:
case VK_MENU:
continue;
}
return in.Event.KeyEvent.uChar.AsciiChar;
}
}
void
beep( void )
{
Beep( 650, 250 );
}
void
noecho( void )
{
/* Do nothing */
}
void
raw( void )
{
SetConsoleMode( _conin, ENABLE_PROCESSED_INPUT );
}
int
initscr( void )
{
_conin = GetStdHandle( STD_INPUT_HANDLE );
_conout = GetStdHandle( STD_OUTPUT_HANDLE );
SetConsoleTitle( "Sudoku" );
return 1;
}
void
endwin( void )
{
CloseHandle( _conin );
CloseHandle( _conout );
}
--- NEW FILE: termios.h ---
/* Dummy header for Win32 port
*/
#define ISIG 0
#define TCSANOW 0
struct termios
{
int c_lflag;
};
int tcgetattr( int, struct termios * );
int tcsetattr( int, int, struct termios * );
----- End forwarded message -----
--
stefan
http://stsp.in-berlin.de PGP Key: 0xF59D25F0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://mailman.dslinux.in-berlin.de/pipermail/dslinux-commit-dslinux.in-berlin.de/attachments/20061112/486c00aa/attachment.pgp
More information about the dslinux-commit
mailing list