[BRLTTY] Bug report MingW
Lars Bjørndal
lars.bjorndal at broadpark.no
Wed Mar 22 03:03:33 EST 2006
Samuel Thibault <samuel.thibault at ens-lyon.org> writes:
...
> This is really strange: I just tried on my machine, and this works
> except some errors in Programs/auth.c (btw, Dave, you should try
> compiling in mingw for fixing this.)
>
> Could you send the output of
> gcc -Wall -g -O2 -DWINVER=0X0501 -I. -I.. -I. -I.. -DHAVE_CONFIG_H -E ./sys_windows.c
> ?
OK:
In file included from ./sys_windows.c:25:
sys_boot_none.h:18: warning: #warning boot parameter retrieval not available on this platform
In file included from sys_beep_windows.h:19,
from ./sys_windows.c:31:
sys_beep_none.h:18: warning: #warning console beep support not available on this platform
# 1 "./sys_windows.c"
# 1 "../prologue.h" 1
# 51 "../prologue.h"
# 1 "/usr/include/sys/types.h" 1 3
# 1 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 1 3
# 63 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
typedef int ptrdiff_t;
typedef unsigned int size_t;
typedef short unsigned int wchar_t;
typedef unsigned int wint_t;
# 319 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 31 "/usr/include/sys/types.h" 2 3
# 1 "/usr/include/machine/types.h" 1 3
# 32 "/usr/include/sys/types.h" 2 3
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long clock_t;
typedef long time_t;
struct timespec {
time_t tv_sec;
long tv_nsec;
};
struct itimerspec {
struct timespec it_interval;
struct timespec it_value;
};
typedef long daddr_t;
typedef char * caddr_t;
typedef unsigned long ino_t;
typedef unsigned long vm_offset_t;
typedef unsigned long vm_size_t;
typedef char int8_t;
typedef unsigned char u_int8_t;
typedef short int16_t;
typedef unsigned short u_int16_t;
typedef int int32_t;
typedef unsigned int u_int32_t;
typedef long long int64_t;
typedef unsigned long long u_int64_t;
typedef int32_t register_t;
typedef short dev_t;
typedef long off_t;
typedef unsigned short uid_t;
typedef unsigned short gid_t;
typedef int pid_t;
typedef long key_t;
typedef long ssize_t;
typedef char * addr_t;
typedef int mode_t;
# 152 "/usr/include/sys/types.h" 3
typedef unsigned short nlink_t;
typedef long fd_mask;
typedef struct _types_fd_set {
fd_mask fds_bits[((( 64 )+(( (sizeof (fd_mask) * 8 ) )-1))/( (sizeof (fd_mask) * 8 ) )) ];
} _types_fd_set;
typedef unsigned long clockid_t;
typedef unsigned long timer_t;
# 1 "/usr/include/sys/features.h" 1 3
# 72 "/usr/include/sys/features.h" 3
# 221 "/usr/include/sys/types.h" 2 3
# 324 "/usr/include/sys/types.h" 3
# 1 "/usr/include/cygwin/types.h" 1 3
typedef void *pthread_t;
typedef void *pthread_mutex_t;
typedef void *pthread_key_t;
typedef void *pthread_attr_t;
typedef void *pthread_mutexattr_t;
typedef void *pthread_condattr_t;
typedef void *pthread_cond_t;
typedef struct
{
pthread_mutex_t mutex;
int state;
}
pthread_once_t;
typedef void *pthread_rwlock_t;
typedef void *pthread_rwlockattr_t;
# 58 "/usr/include/cygwin/types.h" 3
# 326 "/usr/include/sys/types.h" 2 3
# 53 "../prologue.h" 2
# 1 "/usr/include/stdlib.h" 1 3
# 1 "/usr/include/_ansi.h" 1 3
# 1 "/usr/include/sys/config.h" 1 3
# 14 "/usr/include/sys/config.h" 3
# 25 "/usr/include/sys/config.h" 3
# 44 "/usr/include/sys/config.h" 3
typedef int __int32_t;
typedef unsigned int __uint32_t;
# 15 "/usr/include/_ansi.h" 2 3
# 67 "/usr/include/_ansi.h" 3
# 13 "/usr/include/stdlib.h" 2 3
# 1 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 1 3
# 21 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 63 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 128 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 190 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 271 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 319 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 17 "/usr/include/stdlib.h" 2 3
# 1 "/usr/include/sys/reent.h" 1 3
# 1 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/_ansi.h" 1 3
# 77 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/_ansi.h" 3
# 13 "/usr/include/sys/reent.h" 2 3
# 1 "/usr/include/sys/_types.h" 1 3
typedef long _off_t;
typedef long _ssize_t;
# 14 "/usr/include/sys/reent.h" 2 3
typedef __uint32_t __ULong;
struct _glue
{
struct _glue *_next;
int _niobs;
struct __sFILE *_iobs;
};
struct _Bigint
{
struct _Bigint *_next;
int _k, _maxwds, _sign, _wds;
__ULong _x[1];
};
struct __tm
{
int __tm_sec;
int __tm_min;
int __tm_hour;
int __tm_mday;
int __tm_mon;
int __tm_year;
int __tm_wday;
int __tm_yday;
int __tm_isdst;
};
struct _atexit {
struct _atexit *_next;
int _ind;
void (*_fns[32 ])(void);
};
struct __sbuf {
unsigned char *_base;
int _size;
};
typedef long _fpos_t;
struct __sFILE {
unsigned char *_p;
int _r;
int _w;
short _flags;
short _file;
struct __sbuf _bf;
int _lbfsize;
void * _cookie;
_ssize_t __attribute__((__cdecl__)) (*_read) (void * _cookie, char *_buf, int _n) ;
_ssize_t __attribute__((__cdecl__)) (*_write) (void * _cookie, const char *_buf,
int _n) ;
_fpos_t __attribute__((__cdecl__)) (*_seek) (void * _cookie, _fpos_t _offset, int _whence) ;
int __attribute__((__cdecl__)) (*_close) (void * _cookie) ;
struct __sbuf _ub;
unsigned char *_up;
int _ur;
unsigned char _ubuf[3];
unsigned char _nbuf[1];
struct __sbuf _lb;
int _blksize;
int _offset;
struct _reent *_data;
};
struct _rand48 {
unsigned short _seed[3];
unsigned short _mult[3];
unsigned short _add;
};
struct _reent
{
int _errno;
struct __sFILE *_stdin, *_stdout, *_stderr;
int _inc;
char _emergency[25];
int _current_category;
const char *_current_locale;
int __sdidinit;
void __attribute__((__cdecl__)) (*__cleanup) (struct _reent *) ;
struct _Bigint *_result;
int _result_k;
struct _Bigint *_p5s;
struct _Bigint **_freelist;
int _cvtlen;
char *_cvtbuf;
union
{
struct
{
unsigned int _unused_rand;
char * _strtok_last;
char _asctime_buf[26];
struct __tm _localtime_buf;
int _gamma_signgam;
__extension__ unsigned long long _rand_next;
struct _rand48 _r48;
} _reent;
struct
{
unsigned char * _nextf[30 ];
unsigned int _nmalloc[30 ];
} _unused;
} _new;
struct _atexit *_atexit;
struct _atexit _atexit0;
void (**(_sig_func))(int);
struct _glue __sglue;
struct __sFILE __sf[3];
};
extern struct _reent *_impure_ptr ;
void _reclaim_reent (struct _reent *) ;
# 19 "/usr/include/stdlib.h" 2 3
typedef struct
{
int quot;
int rem;
} div_t;
typedef struct
{
long quot;
long rem;
} ldiv_t;
extern __attribute__(( dllimport )) int __mb_cur_max;
void __attribute__((__cdecl__)) abort (void ) __attribute__ ( (noreturn) ) ;
int __attribute__((__cdecl__)) abs (int) ;
int __attribute__((__cdecl__)) atexit (void (*__func)(void )) ;
double __attribute__((__cdecl__)) atof (const char *__nptr) ;
float __attribute__((__cdecl__)) atoff (const char *__nptr) ;
int __attribute__((__cdecl__)) atoi (const char *__nptr) ;
long __attribute__((__cdecl__)) atol (const char *__nptr) ;
void * __attribute__((__cdecl__)) bsearch (const void * __key,
const void * __base,
size_t __nmemb,
size_t __size,
int (* __attribute__((__cdecl__)) _compar ) (const void * , const void * ) ) ;
void * __attribute__((__cdecl__)) calloc (size_t __nmemb, size_t __size) ;
div_t __attribute__((__cdecl__)) div (int __numer, int __denom) ;
void __attribute__((__cdecl__)) exit (int __status) __attribute__ ( (noreturn) ) ;
void __attribute__((__cdecl__)) free (void * ) ;
char * __attribute__((__cdecl__)) getenv (const char *__string) ;
char * __attribute__((__cdecl__)) _getenv_r (struct _reent *, const char *__string) ;
char * __attribute__((__cdecl__)) _findenv (const char *, int *) ;
char * __attribute__((__cdecl__)) _findenv_r (struct _reent *, const char *, int *) ;
long __attribute__((__cdecl__)) labs (long) ;
ldiv_t __attribute__((__cdecl__)) ldiv (long __numer, long __denom) ;
void * __attribute__((__cdecl__)) malloc (size_t __size) ;
int __attribute__((__cdecl__)) mblen (const char *, size_t) ;
int __attribute__((__cdecl__)) _mblen_r (struct _reent *, const char *, size_t, int *) ;
int __attribute__((__cdecl__)) mbtowc (wchar_t *, const char *, size_t) ;
int __attribute__((__cdecl__)) _mbtowc_r (struct _reent *, wchar_t *, const char *, size_t, int *) ;
int __attribute__((__cdecl__)) wctomb (char *, wchar_t) ;
int __attribute__((__cdecl__)) _wctomb_r (struct _reent *, char *, wchar_t, int *) ;
size_t __attribute__((__cdecl__)) mbstowcs (wchar_t *, const char *, size_t) ;
size_t __attribute__((__cdecl__)) _mbstowcs_r (struct _reent *, wchar_t *, const char *, size_t, int *) ;
size_t __attribute__((__cdecl__)) wcstombs (char *, const wchar_t *, size_t) ;
size_t __attribute__((__cdecl__)) _wcstombs_r (struct _reent *, char *, const wchar_t *, size_t, int *) ;
int __attribute__((__cdecl__)) mkstemp (char *) ;
char * __attribute__((__cdecl__)) mktemp (char *) ;
void __attribute__((__cdecl__)) qsort (void * __base, size_t __nmemb, size_t __size, int(*_compar)(const void * , const void * )) ;
int __attribute__((__cdecl__)) rand (void ) ;
void * __attribute__((__cdecl__)) realloc (void * __r, size_t __size) ;
void __attribute__((__cdecl__)) srand (unsigned __seed) ;
double __attribute__((__cdecl__)) strtod (const char *__n, char **_end_PTR) ;
double __attribute__((__cdecl__)) _strtod_r (struct _reent *,const char *__n, char **_end_PTR) ;
float __attribute__((__cdecl__)) strtodf (const char *__n, char **_end_PTR) ;
long __attribute__((__cdecl__)) strtol (const char *__n, char **_end_PTR, int __base) ;
long __attribute__((__cdecl__)) _strtol_r (struct _reent *,const char *__n, char **_end_PTR, int __base) ;
unsigned long __attribute__((__cdecl__)) strtoul (const char *_n_PTR, char **_end_PTR, int __base) ;
unsigned long __attribute__((__cdecl__)) _strtoul_r (struct _reent *,const char *_n_PTR, char **_end_PTR, int __base) ;
int __attribute__((__cdecl__)) system (const char *__string) ;
int __attribute__((__cdecl__)) putenv (const char *__string) ;
int __attribute__((__cdecl__)) _putenv_r (struct _reent *, const char *__string) ;
int __attribute__((__cdecl__)) setenv (const char *__string, const char *__value, int __overwrite) ;
int __attribute__((__cdecl__)) _setenv_r (struct _reent *, const char *__string, const char *__value, int __overwrite) ;
char * __attribute__((__cdecl__)) gcvt (double,int,char *) ;
char * __attribute__((__cdecl__)) gcvtf (float,int,char *) ;
char * __attribute__((__cdecl__)) fcvt (double,int,int *,int *) ;
char * __attribute__((__cdecl__)) fcvtf (float,int,int *,int *) ;
char * __attribute__((__cdecl__)) ecvt (double,int,int *,int *) ;
char * __attribute__((__cdecl__)) ecvtbuf (double, int, int*, int*, char *) ;
char * __attribute__((__cdecl__)) fcvtbuf (double, int, int*, int*, char *) ;
char * __attribute__((__cdecl__)) ecvtf (float,int,int *,int *) ;
char * __attribute__((__cdecl__)) dtoa (double, int, int, int *, int*, char**) ;
int __attribute__((__cdecl__)) rand_r (unsigned *__seed) ;
double __attribute__((__cdecl__)) drand48 (void ) ;
double __attribute__((__cdecl__)) _drand48_r (struct _reent *) ;
double __attribute__((__cdecl__)) erand48 (unsigned short [3]) ;
double __attribute__((__cdecl__)) _erand48_r (struct _reent *, unsigned short [3]) ;
long __attribute__((__cdecl__)) jrand48 (unsigned short [3]) ;
long __attribute__((__cdecl__)) _jrand48_r (struct _reent *, unsigned short [3]) ;
void __attribute__((__cdecl__)) lcong48 (unsigned short [7]) ;
void __attribute__((__cdecl__)) _lcong48_r (struct _reent *, unsigned short [7]) ;
long __attribute__((__cdecl__)) lrand48 (void ) ;
long __attribute__((__cdecl__)) _lrand48_r (struct _reent *) ;
long __attribute__((__cdecl__)) mrand48 (void ) ;
long __attribute__((__cdecl__)) _mrand48_r (struct _reent *) ;
long __attribute__((__cdecl__)) nrand48 (unsigned short [3]) ;
long __attribute__((__cdecl__)) _nrand48_r (struct _reent *, unsigned short [3]) ;
unsigned short *
__attribute__((__cdecl__)) seed48 (unsigned short [3]) ;
unsigned short *
__attribute__((__cdecl__)) _seed48_r (struct _reent *, unsigned short [3]) ;
void __attribute__((__cdecl__)) srand48 (long) ;
void __attribute__((__cdecl__)) _srand48_r (struct _reent *, long) ;
char * __attribute__((__cdecl__)) realpath (const char *, char *) ;
void __attribute__((__cdecl__)) unsetenv (const char *__string) ;
void __attribute__((__cdecl__)) _unsetenv_r (struct _reent *, const char *__string) ;
int __attribute__((__cdecl__)) random (void ) ;
long __attribute__((__cdecl__)) srandom (unsigned __seed) ;
char * __attribute__((__cdecl__)) ptsname (int) ;
int __attribute__((__cdecl__)) grantpt (int) ;
int __attribute__((__cdecl__)) unlockpt (int) ;
char * __attribute__((__cdecl__)) _dtoa_r (struct _reent *, double, int, int, int *, int*, char**) ;
void * __attribute__((__cdecl__)) _malloc_r (struct _reent *, size_t) ;
void * __attribute__((__cdecl__)) _calloc_r (struct _reent *, size_t, size_t) ;
void __attribute__((__cdecl__)) _free_r (struct _reent *, void * ) ;
void * __attribute__((__cdecl__)) _realloc_r (struct _reent *, void * , size_t) ;
void __attribute__((__cdecl__)) _mstats_r (struct _reent *, char *) ;
int __attribute__((__cdecl__)) _system_r (struct _reent *, const char *) ;
void __attribute__((__cdecl__)) __eprintf (const char *, const char *, unsigned int, const char *) ;
# 54 "../prologue.h" 2
# 1 "/usr/include/unistd.h" 1 3
# 1 "/usr/include/sys/unistd.h" 1 3
# 1 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/_ansi.h" 1 3
# 77 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/_ansi.h" 3
# 8 "/usr/include/sys/unistd.h" 2 3
# 1 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 1 3
# 21 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 63 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 128 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 190 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 271 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 319 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 13 "/usr/include/sys/unistd.h" 2 3
extern char **environ;
void __attribute__((__cdecl__)) _exit (int __status ) __attribute__ ( (noreturn) ) ;
int __attribute__((__cdecl__)) access (const char *__path, int __amode ) ;
unsigned __attribute__((__cdecl__)) alarm (unsigned __secs ) ;
int __attribute__((__cdecl__)) chdir (const char *__path ) ;
int __attribute__((__cdecl__)) chmod (const char *__path, mode_t __mode ) ;
int __attribute__((__cdecl__)) chown (const char *__path, uid_t __owner, gid_t __group ) ;
int __attribute__((__cdecl__)) chroot (const char *__path ) ;
int __attribute__((__cdecl__)) close (int __fildes ) ;
char __attribute__((__cdecl__)) *ctermid (char *__s ) ;
char __attribute__((__cdecl__)) *cuserid (char *__s ) ;
int __attribute__((__cdecl__)) dup (int __fildes ) ;
int __attribute__((__cdecl__)) dup2 (int __fildes, int __fildes2 ) ;
int __attribute__((__cdecl__)) execl (const char *__path, const char *, ... ) ;
int __attribute__((__cdecl__)) execle (const char *__path, const char *, ... ) ;
int __attribute__((__cdecl__)) execlp (const char *__file, const char *, ... ) ;
int __attribute__((__cdecl__)) execv (const char *__path, char * const __argv[] ) ;
int __attribute__((__cdecl__)) execve (const char *__path, char * const __argv[], char * const __envp[] ) ;
int __attribute__((__cdecl__)) execvp (const char *__file, char * const __argv[] ) ;
int __attribute__((__cdecl__)) fchmod (int __fildes, mode_t __mode ) ;
int __attribute__((__cdecl__)) fchown (int __fildes, uid_t __owner, gid_t __group ) ;
pid_t __attribute__((__cdecl__)) fork (void ) ;
long __attribute__((__cdecl__)) fpathconf (int __fd, int __name ) ;
int __attribute__((__cdecl__)) fsync (int __fd) ;
char __attribute__((__cdecl__)) *getcwd (char *__buf, size_t __size ) ;
gid_t __attribute__((__cdecl__)) getegid (void ) ;
uid_t __attribute__((__cdecl__)) geteuid (void ) ;
gid_t __attribute__((__cdecl__)) getgid (void ) ;
int __attribute__((__cdecl__)) getgroups (int __gidsetsize, gid_t __grouplist[] ) ;
char __attribute__((__cdecl__)) *getlogin (void ) ;
int __attribute__((__cdecl__)) getlogin_r (char *name, size_t namesize) ;
char __attribute__((__cdecl__)) *getpass (__const char *__prompt) ;
size_t __attribute__((__cdecl__)) getpagesize (void) ;
pid_t __attribute__((__cdecl__)) getpgid (pid_t) ;
pid_t __attribute__((__cdecl__)) getpgrp (void ) ;
pid_t __attribute__((__cdecl__)) getpid (void ) ;
pid_t __attribute__((__cdecl__)) getppid (void ) ;
uid_t __attribute__((__cdecl__)) getuid (void ) ;
char __attribute__((__cdecl__)) *getwd (char *__buf ) ;
int __attribute__((__cdecl__)) isatty (int __fildes ) ;
int __attribute__((__cdecl__)) lchown (const char *__path, uid_t __owner, gid_t __group ) ;
int __attribute__((__cdecl__)) link (const char *__path1, const char *__path2 ) ;
int __attribute__((__cdecl__)) nice (int __nice_value ) ;
off_t __attribute__((__cdecl__)) lseek (int __fildes, off_t __offset, int __whence ) ;
long __attribute__((__cdecl__)) pathconf (const char *__path, int __name ) ;
int __attribute__((__cdecl__)) pause (void ) ;
int __attribute__((__cdecl__)) pthread_atfork (void (*)(void), void (*)(void), void (*)(void)) ;
int __attribute__((__cdecl__)) pipe (int __fildes[2] ) ;
_ssize_t __attribute__((__cdecl__)) read (int __fd, void *__buf, size_t __nbyte ) ;
int __attribute__((__cdecl__)) rmdir (const char *__path ) ;
void * __attribute__((__cdecl__)) sbrk (size_t __incr) ;
int __attribute__((__cdecl__)) setegid (gid_t __gid ) ;
int __attribute__((__cdecl__)) seteuid (uid_t __uid ) ;
int __attribute__((__cdecl__)) setgid (gid_t __gid ) ;
int __attribute__((__cdecl__)) setpgid (pid_t __pid, pid_t __pgid ) ;
int __attribute__((__cdecl__)) setpgrp (void ) ;
pid_t __attribute__((__cdecl__)) setsid (void ) ;
int __attribute__((__cdecl__)) setuid (uid_t __uid ) ;
unsigned __attribute__((__cdecl__)) sleep (unsigned int __seconds ) ;
void __attribute__((__cdecl__)) swab (const void *, void *, ssize_t) ;
long __attribute__((__cdecl__)) sysconf (int __name ) ;
pid_t __attribute__((__cdecl__)) tcgetpgrp (int __fildes ) ;
int __attribute__((__cdecl__)) tcsetpgrp (int __fildes, pid_t __pgrp_id ) ;
char __attribute__((__cdecl__)) *ttyname (int __fildes ) ;
int __attribute__((__cdecl__)) unlink (const char *__path ) ;
int __attribute__((__cdecl__)) vhangup (void ) ;
_ssize_t __attribute__((__cdecl__)) write (int __fd, const void *__buf, size_t __nbyte ) ;
pid_t __attribute__((__cdecl__)) vfork (void ) ;
int __attribute__((__cdecl__)) _close (int __fildes ) ;
pid_t __attribute__((__cdecl__)) _fork (void ) ;
pid_t __attribute__((__cdecl__)) _getpid (void ) ;
int __attribute__((__cdecl__)) _link (const char *__path1, const char *__path2 ) ;
off_t __attribute__((__cdecl__)) _lseek (int __fildes, off_t __offset, int __whence ) ;
_ssize_t __attribute__((__cdecl__)) _read (int __fd, void *__buf, size_t __nbyte ) ;
void * __attribute__((__cdecl__)) _sbrk (size_t __incr) ;
int __attribute__((__cdecl__)) _unlink (const char *__path ) ;
_ssize_t __attribute__((__cdecl__)) _write (int __fd, const void *__buf, size_t __nbyte ) ;
int __attribute__((__cdecl__)) _execve (const char *__path, char * const __argv[], char * const __envp[] ) ;
int __attribute__((__cdecl__)) getdtablesize (void) ;
int __attribute__((__cdecl__)) setdtablesize (int) ;
unsigned __attribute__((__cdecl__)) usleep (unsigned int __useconds) ;
int __attribute__((__cdecl__)) ftruncate (int __fd, off_t __length) ;
int __attribute__((__cdecl__)) truncate (const char *, off_t __length) ;
int __attribute__((__cdecl__)) gethostname (char *__name, size_t __len) ;
char * __attribute__((__cdecl__)) mktemp (char *) ;
int __attribute__((__cdecl__)) sync (void) ;
int __attribute__((__cdecl__)) readlink (const char *__path, char *__buf, int __buflen) ;
int __attribute__((__cdecl__)) symlink (const char *__name1, const char *__name2) ;
# 6 "/usr/include/unistd.h" 2 3
# 1 "/usr/include/getopt.h" 1 3
struct option {
const char *name;
int has_arg;
int *flag;
int val;
};
extern int opterr;
extern int optind;
extern int optopt;
extern int optreset;
extern char *optarg;
int getopt (int, char * const *, const char *);
int getopt_long (int, char * const *, const char *, const struct option *, int *);
# 7 "/usr/include/unistd.h" 2 3
# 55 "../prologue.h" 2
# 1 "../config.h" 1
# 91 "../config.h"
# 58 "../prologue.h" 2
# 77 "../prologue.h"
# 18 "./sys_windows.c" 2
# 1 "misc.h" 1
# 1 "/usr/include/stdio.h" 1 3
# 1 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 1 3
# 21 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 63 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 128 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 190 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 271 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 319 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 37 "/usr/include/stdio.h" 2 3
# 1 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stdarg.h" 1 3
typedef void *__gnuc_va_list;
# 123 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stdarg.h" 3
# 210 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stdarg.h" 3
# 40 "/usr/include/stdio.h" 2 3
typedef _fpos_t fpos_t;
typedef struct __sFILE FILE;
FILE * __attribute__((__cdecl__)) tmpfile (void) ;
char * __attribute__((__cdecl__)) tmpnam (char *) ;
int __attribute__((__cdecl__)) fclose (FILE *) ;
int __attribute__((__cdecl__)) fflush (FILE *) ;
FILE * __attribute__((__cdecl__)) freopen (const char *, const char *, FILE *) ;
void __attribute__((__cdecl__)) setbuf (FILE *, char *) ;
int __attribute__((__cdecl__)) setvbuf (FILE *, char *, int, size_t) ;
int __attribute__((__cdecl__)) fprintf (FILE *, const char *, ...) ;
int __attribute__((__cdecl__)) fscanf (FILE *, const char *, ...) ;
int __attribute__((__cdecl__)) printf (const char *, ...) ;
int __attribute__((__cdecl__)) scanf (const char *, ...) ;
int __attribute__((__cdecl__)) sscanf (const char *, const char *, ...) ;
int __attribute__((__cdecl__)) vfprintf (FILE *, const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) vprintf (const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) vsprintf (char *, const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) fgetc (FILE *) ;
char * __attribute__((__cdecl__)) fgets (char *, int, FILE *) ;
int __attribute__((__cdecl__)) fputc (int, FILE *) ;
int __attribute__((__cdecl__)) fputs (const char *, FILE *) ;
int __attribute__((__cdecl__)) getc (FILE *) ;
int __attribute__((__cdecl__)) getchar (void) ;
char * __attribute__((__cdecl__)) gets (char *) ;
int __attribute__((__cdecl__)) putc (int, FILE *) ;
int __attribute__((__cdecl__)) putchar (int) ;
int __attribute__((__cdecl__)) puts (const char *) ;
int __attribute__((__cdecl__)) ungetc (int, FILE *) ;
size_t __attribute__((__cdecl__)) fread (void * , size_t _size, size_t _n, FILE *) ;
size_t __attribute__((__cdecl__)) fwrite (const void * , size_t _size, size_t _n, FILE *) ;
int __attribute__((__cdecl__)) fgetpos (FILE *, fpos_t *) ;
int __attribute__((__cdecl__)) fseek (FILE *, long, int) ;
int __attribute__((__cdecl__)) fsetpos (FILE *, const fpos_t *) ;
long __attribute__((__cdecl__)) ftell ( FILE *) ;
void __attribute__((__cdecl__)) rewind (FILE *) ;
void __attribute__((__cdecl__)) clearerr (FILE *) ;
int __attribute__((__cdecl__)) feof (FILE *) ;
int __attribute__((__cdecl__)) ferror (FILE *) ;
void __attribute__((__cdecl__)) perror (const char *) ;
FILE * __attribute__((__cdecl__)) fopen (const char *_name, const char *_type) ;
int __attribute__((__cdecl__)) sprintf (char *, const char *, ...) ;
int __attribute__((__cdecl__)) remove (const char *) ;
int __attribute__((__cdecl__)) rename (const char *, const char *) ;
int __attribute__((__cdecl__)) vfiprintf (FILE *, const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) iprintf (const char *, ...) ;
int __attribute__((__cdecl__)) fiprintf (FILE *, const char *, ...) ;
int __attribute__((__cdecl__)) siprintf (char *, const char *, ...) ;
char * __attribute__((__cdecl__)) tempnam (const char *, const char *) ;
int __attribute__((__cdecl__)) vsnprintf (char *, size_t, const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) vfscanf (FILE *, const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) vscanf (const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) vsscanf (const char *, const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) snprintf (char *, size_t, const char *, ...) ;
FILE * __attribute__((__cdecl__)) fdopen (int, const char *) ;
int __attribute__((__cdecl__)) fileno (FILE *) ;
int __attribute__((__cdecl__)) getw (FILE *) ;
int __attribute__((__cdecl__)) pclose (FILE *) ;
FILE * __attribute__((__cdecl__)) popen (const char *, const char *) ;
int __attribute__((__cdecl__)) putw (int, FILE *) ;
void __attribute__((__cdecl__)) setbuffer (FILE *, char *, int) ;
int __attribute__((__cdecl__)) setlinebuf (FILE *) ;
FILE * __attribute__((__cdecl__)) _fdopen_r (struct _reent *, int, const char *) ;
FILE * __attribute__((__cdecl__)) _fopen_r (struct _reent *, const char *, const char *) ;
int __attribute__((__cdecl__)) _fscanf_r (struct _reent *, FILE *, const char *, ...) ;
int __attribute__((__cdecl__)) _getchar_r (struct _reent *) ;
char * __attribute__((__cdecl__)) _gets_r (struct _reent *, char *) ;
int __attribute__((__cdecl__)) _iprintf_r (struct _reent *, const char *, ...) ;
int __attribute__((__cdecl__)) _mkstemp_r (struct _reent *, char *) ;
char * __attribute__((__cdecl__)) _mktemp_r (struct _reent *, char *) ;
void __attribute__((__cdecl__)) _perror_r (struct _reent *, const char *) ;
int __attribute__((__cdecl__)) _printf_r (struct _reent *, const char *, ...) ;
int __attribute__((__cdecl__)) _putchar_r (struct _reent *, int) ;
int __attribute__((__cdecl__)) _puts_r (struct _reent *, const char *) ;
int __attribute__((__cdecl__)) _remove_r (struct _reent *, const char *) ;
int __attribute__((__cdecl__)) _rename_r (struct _reent *,
const char *_old, const char *_new) ;
int __attribute__((__cdecl__)) _scanf_r (struct _reent *, const char *, ...) ;
int __attribute__((__cdecl__)) _sprintf_r (struct _reent *, char *, const char *, ...) ;
int __attribute__((__cdecl__)) _snprintf_r (struct _reent *, char *, size_t, const char *, ...) ;
int __attribute__((__cdecl__)) _sscanf_r (struct _reent *, const char *, const char *, ...) ;
char * __attribute__((__cdecl__)) _tempnam_r (struct _reent *, const char *, const char *) ;
FILE * __attribute__((__cdecl__)) _tmpfile_r (struct _reent *) ;
char * __attribute__((__cdecl__)) _tmpnam_r (struct _reent *, char *) ;
int __attribute__((__cdecl__)) _vfprintf_r (struct _reent *, FILE *, const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) _vprintf_r (struct _reent *, const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) _vsprintf_r (struct _reent *, char *, const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) _vsnprintf_r (struct _reent *, char *, size_t, const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) _vfscanf_r (struct _reent *, FILE *, const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) _vscanf_r (struct _reent *, const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) _vsscanf_r (struct _reent *, const char *, const char *, __gnuc_va_list ) ;
int __attribute__((__cdecl__)) __srget (FILE *) ;
int __attribute__((__cdecl__)) __swbuf (int, FILE *) ;
FILE * __attribute__((__cdecl__)) funopen (const void * _cookie,
int (*readfn)(void * _cookie, char *_buf, int _n),
int (*writefn)(void * _cookie, const char *_buf, int _n),
fpos_t (*seekfn)(void * _cookie, fpos_t _off, int _whence),
int (*closefn)(void * _cookie)) ;
static __inline__ int __sgetc(FILE *__p)
{
int __c = (--( __p )->_r < 0 ? __srget( __p ) : (int)(*( __p )->_p++)) ;
if ((__p->_flags & 0x4000 ) && (__c == '\r'))
{
int __c2 = (--( __p )->_r < 0 ? __srget( __p ) : (int)(*( __p )->_p++)) ;
if (__c2 == '\n')
__c = __c2;
else
ungetc(__c2, __p);
}
return __c;
}
# 314 "/usr/include/stdio.h" 3
# 27 "misc.h" 2
# 1 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stdarg.h" 1 3
void va_end (__gnuc_va_list);
# 176 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stdarg.h" 3
typedef __gnuc_va_list va_list;
# 28 "misc.h" 2
# 1 "/usr/include/sys/time.h" 1 3
# 1 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/_ansi.h" 1 3
# 77 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/_ansi.h" 3
# 8 "/usr/include/sys/time.h" 2 3
struct timeval {
long tv_sec;
long tv_usec;
};
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
# 1 "/usr/include/sys/select.h" 1 3
# 1 "/usr/include/sys/cdefs.h" 1 3
# 17 "/usr/include/sys/select.h" 2 3
# 1 "/usr/include/sys/time.h" 1 3
# 83 "/usr/include/sys/time.h" 3
# 23 "/usr/include/sys/select.h" 2 3
# 1 "/usr/include/time.h" 1 3
# 1 "/usr/include/machine/time.h" 1 3
# 21 "/usr/include/time.h" 2 3
# 1 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 1 3
# 21 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 63 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 128 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 190 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 271 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 319 "/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/include/stddef.h" 3
# 30 "/usr/include/time.h" 2 3
struct tm
{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};
clock_t __attribute__((__cdecl__)) clock (void) ;
double __attribute__((__cdecl__)) difftime (time_t _time2, time_t _time1) ;
time_t __attribute__((__cdecl__)) mktime (struct tm *_timeptr) ;
time_t __attribute__((__cdecl__)) time (time_t *_timer) ;
char * __attribute__((__cdecl__)) asctime (const struct tm *_tblock) ;
char * __attribute__((__cdecl__)) ctime (const time_t *_time) ;
struct tm * __attribute__((__cdecl__)) gmtime (const time_t *_timer) ;
struct tm * __attribute__((__cdecl__)) localtime (const time_t *_timer) ;
size_t __attribute__((__cdecl__)) strftime (char *_s, size_t _maxsize, const char *_fmt, const struct tm *_t) ;
char * __attribute__((__cdecl__)) asctime_r (const struct tm *, char *) ;
char * __attribute__((__cdecl__)) ctime_r (const time_t *, char *) ;
struct tm * __attribute__((__cdecl__)) gmtime_r (const time_t *, struct tm *) ;
struct tm * __attribute__((__cdecl__)) localtime_r (const time_t *, struct tm *) ;
extern __attribute__(( dllimport )) time_t _timezone;
extern __attribute__(( dllimport )) int _daylight;
extern __attribute__(( dllimport )) char *_tzname[2];
char * __attribute__((__cdecl__)) timezone (void) ;
void __attribute__((__cdecl__)) tzset (void) ;
# 121 "/usr/include/time.h" 3
# 158 "/usr/include/time.h" 3
# 168 "/usr/include/time.h" 3
# 24 "/usr/include/sys/select.h" 2 3
int select (int __n, _types_fd_set *__readfds, _types_fd_set *__writefds,
_types_fd_set *__exceptfds, struct timeval *__timeout) ;
# 27 "/usr/include/sys/time.h" 2 3
struct itimerval {
struct timeval it_interval;
struct timeval it_value;
};
# 62 "/usr/include/sys/time.h" 3
# 71 "/usr/include/sys/time.h" 3
int __attribute__((__cdecl__)) gettimeofday (struct timeval *__p, struct timezone *__z) ;
int __attribute__((__cdecl__)) settimeofday (const struct timeval *, const struct timezone *) ;
int __attribute__((__cdecl__)) utimes (const char *__path, struct timeval *__tvp) ;
int __attribute__((__cdecl__)) getitimer (int __which, struct itimerval *__value) ;
int __attribute__((__cdecl__)) setitimer (int __which, const struct itimerval *__value,
struct itimerval *__ovalue) ;
# 29 "misc.h" 2
# 76 "misc.h"
extern char **splitString (const char *string, char delimiter, int *count);
extern void deallocateStrings (char **array);
extern int processLines (
FILE *file,
int (*handler) (char *line, void *data),
void *data
);
extern int readLine (
FILE *file,
char **buffer,
size_t *size
);
extern void formatInputError (
char *buffer,
int size,
const char *file,
const int *line,
const char *format,
va_list argp
);
extern void approximateDelay (int milliseconds);
extern void accurateDelay (int milliseconds);
extern long int millisecondsBetween (const struct timeval *from, const struct timeval *to);
extern long int millisecondsSince (const struct timeval *from);
extern int hasTimedOut (int milliseconds);
# 1 "/usr/include/syslog.h" 1 3
# 1 "/usr/include/sys/syslog.h" 1 3
void closelog (void);
void openlog (const char *, int, int);
int setlogmask (int);
void syslog (int, const char *, ...);
# 14 "/usr/include/syslog.h" 2 3
# 120 "misc.h" 2
# 132 "misc.h"
extern void LogOpen(int toConsole);
extern void LogClose(void);
extern void LogPrint
(int level, const char *format, ...)
__attribute__((format(printf, 2, 3)))
;
extern void LogError (const char *action);
extern void LogBytes (const char *description, const unsigned char *data, unsigned int length);
extern int setLogLevel (int level);
extern const char *setPrintPrefix (const char *prefix);
extern int setPrintLevel (int level);
extern int setPrintOff (void);
extern int getConsole (void);
extern int writeConsole (const unsigned char *address, size_t count);
extern int ringBell (void);
extern void *mallocWrapper (size_t size);
extern void *reallocWrapper (void *address, size_t size);
extern char *strdupWrapper (const char *string);
extern char *getWorkingDirectory (void);
extern char *makePath (const char *directory, const char *file);
extern void fixPath (char **path, const char *extension, const char *prefix);
extern int makeDirectory (const char *path);
extern const char *getDeviceDirectory (void);
extern char *getDevicePath (const char *device);
extern int isQualifiedDevice (const char **path, const char *qualifier);
extern void unsupportedDevice (const char *path);
extern int rescaleInteger (int value, int from, int to);
extern int isInteger (int *value, const char *string);
extern int isFloat (float *value, const char *string);
extern int validateInteger (int *value, const char *string, const int *minimum, const int *maximum);
extern int validateFloat (float *value, const char *string, const float *minimum, const float *maximum);
extern int validateChoice (unsigned int *value, const char *string, const char *const *choices);
extern int validateFlag (unsigned int *value, const char *string, const char *on, const char *off);
extern int validateOnOff (unsigned int *value, const char *string);
extern int validateYesNo (unsigned int *value, const char *string);
# 20 "./sys_windows.c" 2
# 1 "system.h" 1
extern char *getProgramPath (void);
extern char *getBootParameters (const char *name);
extern int executeHostCommand (const char *const *arguments);
extern void *loadSharedObject (const char *path);
extern void unloadSharedObject (void *object);
extern int findSharedSymbol (void *object, const char *symbol, void *pointerAddress);
extern int canBeep (void);
extern int synchronousBeep (unsigned short frequency, unsigned short milliseconds);
extern int asynchronousBeep (unsigned short frequency, unsigned short milliseconds);
extern int startBeep (unsigned short frequency);
extern int stopBeep (void);
extern void endBeep (void);
typedef struct PcmDeviceStruct PcmDevice;
typedef enum {
PCM_FMT_U8,
PCM_FMT_S8,
PCM_FMT_U16B,
PCM_FMT_S16B,
PCM_FMT_U16L,
PCM_FMT_S16L,
PCM_FMT_ULAW,
PCM_FMT_ALAW,
PCM_FMT_UNKNOWN
} PcmAmplitudeFormat;
extern PcmDevice *openPcmDevice (int errorLevel, const char *device);
extern void closePcmDevice (PcmDevice *pcm);
extern int writePcmData (PcmDevice *pcm, const unsigned char *buffer, int count);
extern int getPcmBlockSize (PcmDevice *pcm);
extern int getPcmSampleRate (PcmDevice *pcm);
extern int setPcmSampleRate (PcmDevice *pcm, int rate);
extern int getPcmChannelCount (PcmDevice *pcm);
extern int setPcmChannelCount (PcmDevice *pcm, int channels);
extern PcmAmplitudeFormat getPcmAmplitudeFormat (PcmDevice *pcm);
extern PcmAmplitudeFormat setPcmAmplitudeFormat (PcmDevice *pcm, PcmAmplitudeFormat format);
extern void forcePcmOutput (PcmDevice *pcm);
extern void awaitPcmOutput (PcmDevice *pcm);
extern void cancelPcmOutput (PcmDevice *pcm);
typedef struct MidiDeviceStruct MidiDevice;
typedef void (*MidiBufferFlusher) (unsigned char *buffer, int count);
extern MidiDevice *openMidiDevice (int errorLevel, const char *device);
extern void closeMidiDevice (MidiDevice *midi);
extern int flushMidiDevice (MidiDevice *midi);
extern int setMidiInstrument (MidiDevice *midi, unsigned char channel, unsigned char instrument);
extern int beginMidiBlock (MidiDevice *midi);
extern int endMidiBlock (MidiDevice *midi);
extern int startMidiNote (MidiDevice *midi, unsigned char channel, unsigned char note, unsigned char volume);
extern int stopMidiNote (MidiDevice *midi, unsigned char channel);
extern int insertMidiWait (MidiDevice *midi, int duration);
extern int enablePorts (int errorLevel, unsigned short int base, unsigned short int count);
extern int disablePorts (unsigned short int base, unsigned short int count);
extern unsigned char readPort1 (unsigned short int port);
extern void writePort1 (unsigned short int port, unsigned char value);
# 21 "./sys_windows.c" 2
# 1 "sys_prog_windows.h" 1
char *
getProgramPath (void) {
char *path = ((void *)0) ;
HMODULE handle;
if ((handle = GetModuleHandle(((void *)0) ))) {
size_t size = 0X80;
char *buffer = ((void *)0) ;
while (1) {
buffer = reallocWrapper(buffer, size<<=1);
{
DWORD length = GetModuleFileName(handle, buffer, size);
if (!length) {
LogWindowsError("GetModuleFileName");
break;
}
if (length < size) {
buffer[length] = 0;
path = strdupWrapper(buffer);
while (length > 0)
if (path[--length] == '\\')
path[length] = '/';
break;
}
}
}
free(buffer);
} else {
LogWindowsError("GetModuleHandle");
}
return path;
}
# 23 "./sys_windows.c" 2
# 1 "sys_boot_none.h" 1
char *
getBootParameters (const char *name) {
return ((void *)0) ;
}
# 25 "./sys_windows.c" 2
# 1 "sys_exec_windows.h" 1
static int
addWindowsCommandLineCharacter (char **buffer, int *size, int *length, char character) {
if (*length == *size) {
char *newBuffer = realloc(*buffer, (*size = *size? *size<<1: 0X80));
if (!newBuffer) {
LogError("realloc");
return 0;
}
*buffer = newBuffer;
}
(*buffer)[(*length)++] = character;
return 1;
}
static char *
makeWindowsCommandLine (const char *const *arguments) {
const char backslash = '\\';
const char quote = '"';
char *buffer = ((void *)0) ;
int size = 0;
int length = 0;
while (*arguments) {
const char *character = *arguments;
int backslashCount = 0;
int needQuotes = 0;
int start = length;
while (*character) {
if (*character == backslash) {
++backslashCount;
} else {
if (*character == quote) {
needQuotes = 1;
backslashCount = (backslashCount * 2) + 1;
} else if ((*character == ' ') || (*character == '\t')) {
needQuotes = 1;
}
while (backslashCount > 0) {
if (!addWindowsCommandLineCharacter(&buffer, &size, &length, ( backslash ))) goto error ;
--backslashCount;
}
if (!addWindowsCommandLineCharacter(&buffer, &size, &length, ( *character ))) goto error ;
}
++character;
}
if (needQuotes) backslashCount *= 2;
while (backslashCount > 0) {
if (!addWindowsCommandLineCharacter(&buffer, &size, &length, ( backslash ))) goto error ;
--backslashCount;
}
if (needQuotes) {
if (!addWindowsCommandLineCharacter(&buffer, &size, &length, ( quote ))) goto error ;
if (!addWindowsCommandLineCharacter(&buffer, &size, &length, ( quote ))) goto error ;
memmove(&buffer[start+1], &buffer[start], length-start-1);
buffer[start] = quote;
}
if (!addWindowsCommandLineCharacter(&buffer, &size, &length, ( ' ' ))) goto error ;
++arguments;
}
buffer[length-1] = 0;
{
char *line = realloc(buffer, length);
if (line) return line;
LogError("realloc");
}
error:
if (buffer) free(buffer);
return ((void *)0) ;
}
int
executeHostCommand (const char *const *arguments) {
int result = 0XFF;
char *line;
if ((line = makeWindowsCommandLine(arguments))) {
STARTUPINFO startup;
PROCESS_INFORMATION process;
memset(&startup, 0, sizeof(startup));
startup.cb = sizeof(startup);
memset(&process, 0, sizeof(process));
LogPrint(7 , "host command: %s", line);
if (CreateProcess(((void *)0) , line, ((void *)0) , ((void *)0) , TRUE,
CREATE_NEW_PROCESS_GROUP,
((void *)0) , ((void *)0) , &startup, &process)) {
DWORD status;
while ((status = WaitForSingleObject(process.hProcess, INFINITE)) == WAIT_TIMEOUT);
if (status == WAIT_OBJECT_0) {
DWORD code;
if (GetExitCodeProcess(process.hProcess, &code)) {
result = code;
} else {
LogWindowsError("GetExitCodeProcess");
}
} else {
LogWindowsError("WaitForSingleObject");
}
CloseHandle(process.hProcess);
CloseHandle(process.hThread);
} else {
LogWindowsError("CreateProcess");
}
free(line);
}
return result;
}
# 27 "./sys_windows.c" 2
# 1 "sys_shlib_windows.h" 1
void *
loadSharedObject (const char *path) {
HMODULE library;
if (!(library = LoadLibrary(path)))
LogWindowsError("loading library");
return library;
}
void
unloadSharedObject (void *object) {
if (!(FreeLibrary((HMODULE) object)))
LogWindowsError("unloading library");
}
int
findSharedSymbol (void *object, const char *symbol, void *pointerAddress) {
void **address = pointerAddress;
if ((*address = GetProcAddress((HMODULE) object, symbol)))
return 1;
LogWindowsError("looking up symbol in library");
return 0;
}
# 29 "./sys_windows.c" 2
# 1 "sys_beep_windows.h" 1
# 1 "sys_beep_none.h" 1
int
canBeep (void) {
return 0;
}
int
asynchronousBeep (unsigned short frequency, unsigned short milliseconds) {
return 0;
}
int
synchronousBeep (unsigned short frequency, unsigned short milliseconds) {
return 0;
}
int
startBeep (unsigned short frequency) {
return 0;
}
int
stopBeep (void) {
return 0;
}
void
endBeep (void) {
}
# 19 "sys_beep_windows.h" 2
# 50 "sys_beep_windows.h"
# 31 "./sys_windows.c" 2
# 1 "sys_pcm_windows.h" 1
struct PcmDeviceStruct {
HWAVEOUT handle;
UINT deviceID;
WAVEFORMATEX format;
HANDLE done;
WAVEHDR waveHdr;
size_t bufSize;
};
static WAVEFORMATEX defaultFormat = { WAVE_FORMAT_PCM, 1, 11025, 11025, 1, 8, 0 };
static void
recomputeWaveOutFormat(WAVEFORMATEX *format) {
format->nBlockAlign = format->nChannels * ((format->wBitsPerSample + 7) / 8);
format->nAvgBytesPerSec = format->nBlockAlign * format->nSamplesPerSec;
}
static WAVEHDR initWaveHdr = { ((void *)0) , 0, 0, 0, 0, 1, ((void *)0) , 0 };
static void
LogWaveOutError(MMRESULT error, int errorLevel, const char *action) {
char msg[MAXERRORLENGTH];
waveOutGetErrorText(error, msg, sizeof(msg));
LogPrint(errorLevel, "%s error %d: %s.", action, error, msg);
}
PcmDevice *
openPcmDevice (int errorLevel, const char *device) {
PcmDevice *pcm;
MMRESULT mmres;
WAVEOUTCAPS caps;
int id = 0;
if (device && *device) {
if (!isInteger(&id, device) || (id < 0) || (id >= waveOutGetNumDevs())) {
LogPrint(errorLevel, "invalid PCM device number: %s", device);
return ((void *)0) ;
}
}
if (!(pcm = malloc(sizeof(*pcm)))) {
LogError("PCM device allocation");
return ((void *)0) ;
}
pcm->deviceID = id;
if ((waveOutGetDevCaps(pcm->deviceID, &caps, sizeof(caps))) != MMSYSERR_NOERROR)
pcm->format = defaultFormat;
else {
LogPrint(errorLevel, "PCM device %d is %s", pcm->deviceID, caps.szPname);
pcm->format.wFormatTag = WAVE_FORMAT_PCM;
if (caps.dwFormats &
(WAVE_FORMAT_1S08
|WAVE_FORMAT_1S16
|WAVE_FORMAT_2S08
|WAVE_FORMAT_2S16
|WAVE_FORMAT_4S08
|WAVE_FORMAT_4S16))
pcm->format.nChannels = 2;
else
pcm->format.nChannels = 1;
if (caps.dwFormats &
(WAVE_FORMAT_4M08
|WAVE_FORMAT_4M16
|WAVE_FORMAT_4S08
|WAVE_FORMAT_4S16))
pcm->format.nSamplesPerSec = 44100;
else if (caps.dwFormats &
(WAVE_FORMAT_2M08
|WAVE_FORMAT_2M16
|WAVE_FORMAT_2S08
|WAVE_FORMAT_2S16))
pcm->format.nSamplesPerSec = 22050;
else if (caps.dwFormats &
(WAVE_FORMAT_1M08
|WAVE_FORMAT_1M16
|WAVE_FORMAT_1S08
|WAVE_FORMAT_1S16))
pcm->format.nSamplesPerSec = 11025;
else {
LogPrint(errorLevel, "unknown PCM capability %#lx",caps.dwFormats);
goto out;
}
if (caps.dwFormats &
(WAVE_FORMAT_1M16
|WAVE_FORMAT_1S16
|WAVE_FORMAT_2M16
|WAVE_FORMAT_2S16
|WAVE_FORMAT_4M16
|WAVE_FORMAT_4S16))
pcm->format.wBitsPerSample = 16;
else if (caps.dwFormats &
(WAVE_FORMAT_1M08
|WAVE_FORMAT_1S08
|WAVE_FORMAT_2M08
|WAVE_FORMAT_2S08
|WAVE_FORMAT_4M08
|WAVE_FORMAT_4S08))
pcm->format.wBitsPerSample = 8;
else {
LogPrint(3 , "unknown PCM capability %#lx",caps.dwFormats);
goto out;
}
recomputeWaveOutFormat(&pcm->format);
pcm->format.cbSize = 0;
}
if (!(pcm->done = CreateEvent(((void *)0) , FALSE, TRUE, ((void *)0) ))) {
LogWindowsError("creating PCM completion event");
goto out;
}
pcm->waveHdr = initWaveHdr;
pcm->bufSize = 0;
if ((mmres = waveOutOpen(&pcm->handle, pcm->deviceID,
&pcm->format, (DWORD) pcm->done, 0, CALLBACK_EVENT)) != MMSYSERR_NOERROR) {
LogWaveOutError(mmres, errorLevel, "opening PCM device");
goto outEvent;
}
return pcm;
outEvent:
CloseHandle(pcm->done);
out:
free(pcm);
return ((void *)0) ;
}
static int
unprepareHeader(PcmDevice *pcm) {
MMRESULT mmres;
awaitPcmOutput(pcm);
if ((mmres = waveOutUnprepareHeader(pcm->handle, &pcm->waveHdr, sizeof(pcm->waveHdr))) != MMSYSERR_NOERROR) {
LogWaveOutError(mmres, 3 , "unpreparing PCM data header");
return 0;
}
return 1;
}
static int
updateWaveOutFormat(PcmDevice *pcm, WAVEFORMATEX *format, const char *errmsg) {
MMRESULT mmres;
recomputeWaveOutFormat(format);
if (!(unprepareHeader(pcm))) return 0;
if (waveOutOpen(((void *)0) , pcm->deviceID, format, 0, 0, WAVE_FORMAT_QUERY) == MMSYSERR_NOERROR) {
waveOutClose(pcm->handle);
pcm->handle = INVALID_HANDLE_VALUE;
if ((mmres = waveOutOpen(&pcm->handle, pcm->deviceID, format,
(DWORD) pcm->done, 0, CALLBACK_EVENT)) == MMSYSERR_NOERROR) {
pcm->format = *format;
return 1;
}
LogWaveOutError(mmres, 3 , errmsg);
}
return 0;
}
void
closePcmDevice (PcmDevice *pcm) {
CloseHandle(pcm->done);
unprepareHeader(pcm);
waveOutClose(pcm->handle);
free(pcm->waveHdr.lpData);
free(pcm);
}
int
writePcmData (PcmDevice *pcm, const unsigned char *buffer, int count) {
MMRESULT mmres;
void *newBuf;
if (!count) return 1;
if (count > pcm->bufSize) {
if (!(unprepareHeader(pcm))) return 0;
if (!(newBuf = realloc(pcm->waveHdr.lpData, 2 * count))) {
LogError("allocating PCM data buffer");
return 0;
}
pcm->waveHdr.lpData = newBuf;
pcm->waveHdr.dwFlags = 0;
pcm->waveHdr.dwBufferLength = pcm->bufSize = 2 * count;
}
awaitPcmOutput(pcm);
if (!(pcm->waveHdr.dwFlags & WHDR_PREPARED))
if ((mmres = waveOutPrepareHeader(pcm->handle, &pcm->waveHdr, sizeof(pcm->waveHdr))) != MMSYSERR_NOERROR) {
LogWaveOutError(mmres, 3 , "preparing PCM data header");
return 0;
}
pcm->waveHdr.dwBufferLength = count;
memcpy(pcm->waveHdr.lpData, buffer, count);
ResetEvent(pcm->done);
if ((mmres = waveOutWrite(pcm->handle, &pcm->waveHdr, sizeof(pcm->waveHdr))) != MMSYSERR_NOERROR) {
SetEvent(pcm->done);
LogWaveOutError(mmres, 3 , "writing PCM data");
return 0;
}
return 1;
}
int
getPcmBlockSize (PcmDevice *pcm) {
return 0X10000;
}
int
getPcmSampleRate (PcmDevice *pcm) {
return pcm->format.nSamplesPerSec;
}
int
setPcmSampleRate (PcmDevice *pcm, int rate) {
WAVEFORMATEX format = pcm->format;
format.nSamplesPerSec = rate;
if (!updateWaveOutFormat(pcm, &format, "setting PCM sample rate"))
return getPcmSampleRate(pcm);
else
return rate;
}
int
getPcmChannelCount (PcmDevice *pcm) {
return pcm->format.nChannels;
}
int
setPcmChannelCount (PcmDevice *pcm, int channels) {
WAVEFORMATEX format = pcm->format;
format.nChannels = channels;
if (!updateWaveOutFormat(pcm, &format, "setting PCM channel count"))
return getPcmChannelCount(pcm);
else
return channels;
}
PcmAmplitudeFormat
getPcmAmplitudeFormat (PcmDevice *pcm) {
if (pcm->format.wBitsPerSample == 8) return PCM_FMT_U8;
if (pcm->format.wBitsPerSample == 16) return PCM_FMT_S16L;
return PCM_FMT_UNKNOWN;
}
PcmAmplitudeFormat
setPcmAmplitudeFormat (PcmDevice *pcm, PcmAmplitudeFormat format) {
WAVEFORMATEX newFormat = pcm->format;
if (format == PCM_FMT_U8) newFormat.wBitsPerSample = 8;
else if (format == PCM_FMT_S16L) newFormat.wBitsPerSample = 16;
else return getPcmAmplitudeFormat(pcm);
if (!updateWaveOutFormat(pcm, &newFormat, "setting PCM amplitude format"))
return getPcmAmplitudeFormat(pcm);
else
return format;
}
void
forcePcmOutput (PcmDevice *pcm) {
}
void
awaitPcmOutput (PcmDevice *pcm) {
while ((pcm->waveHdr.dwFlags & WHDR_PREPARED)
&& !(pcm->waveHdr.dwFlags & WHDR_DONE))
WaitForSingleObject(pcm->done, INFINITE);
SetEvent(pcm->done);
}
void
cancelPcmOutput (PcmDevice *pcm) {
waveOutReset(pcm->handle);
}
# 34 "./sys_windows.c" 2
# 1 "sys_midi_windows.h" 1
struct MidiDeviceStruct {
HMIDIOUT handle;
unsigned char note;
int count;
unsigned char buffer[0X80];
};
typedef enum {
MIDI_NoteOff = 0X80,
MIDI_NoteOn = 0X90,
MIDI_KeyPressure = 0XA0,
MIDI_ControlChange = 0XB0,
MIDI_ProgramChange = 0XC0,
MIDI_ChannelPresure = 0XD0,
MIDI_PitchBend = 0XE0,
MIDI_SystemPrefix = 0XF0
} MidiEvent;
static void
logMidiOutError (MMRESULT error, int errorLevel, const char *action) {
char text[MAXERRORLENGTH];
midiOutGetErrorText(error, text, sizeof(text));
LogPrint(errorLevel, "%s error %d: %s", action, error, text);
}
static int
addMidiMessage (MidiDevice *midi, const char *message, int length) {
if ((midi->count + length) > sizeof(midi->buffer))
if (!flushMidiDevice(midi))
return 0;
memcpy(&midi->buffer[midi->count], message, length);
midi->count += length;
return 1;
}
static int
writeMidiMessage (MidiDevice *midi, const char *message, int length) {
if (!addMidiMessage(midi, message, length)) return 0;
if (!flushMidiDevice(midi)) return 0;
return 1;
}
MidiDevice *
openMidiDevice (int errorLevel, const char *device) {
MidiDevice *midi;
MMRESULT error;
int id = 0;
static const char *const defaultDevice = "default";
if (!device || !*device) device = defaultDevice;
if (strcmp(device, defaultDevice) == 0) {
id = -1;
} else if (!isInteger(&id, device) || (id < 0) || (id >= midiOutGetNumDevs())) {
int count = midiOutGetNumDevs();
for (id=0; id<count; ++id) {
MIDIOUTCAPS cap;
if (midiOutGetDevCaps(id, &cap, sizeof(cap)) == MMSYSERR_NOERROR)
if (strncasecmp(device, cap.szPname, strlen(device)) == 0)
break;
}
if (id == count) {
LogPrint(errorLevel, "invalid MIDI device number: %s", device);
return ((void *)0) ;
}
}
if ((midi = malloc(sizeof(*midi)))) {
if ((error = midiOutOpen(&midi->handle, id, 0, 0, CALLBACK_NULL)) == MMSYSERR_NOERROR) {
midi->note = 0;
midi->count = 0;
return midi;
} else {
logMidiOutError(error, errorLevel, "MIDI device open");
}
free(midi);
} else {
LogError("MIDI device allocation");
}
return ((void *)0) ;
}
void
closeMidiDevice (MidiDevice *midi) {
flushMidiDevice(midi);
midiOutClose(midi->handle);
free(midi);
}
int
flushMidiDevice (MidiDevice *midi) {
int ok = 1;
if (midi->count > 0) {
MMRESULT error;
MIDIHDR header;
header.lpData = midi->buffer;
header.dwBufferLength = midi->count;
header.dwFlags = 0;
if ((error = midiOutPrepareHeader(midi->handle, &header, sizeof(header))) == MMSYSERR_NOERROR) {
if ((error = midiOutLongMsg(midi->handle, &header, sizeof(header))) == MMSYSERR_NOERROR) {
midi->count = 0;
} else {
logMidiOutError(error, 3 , "midiOutLongMsg");
ok = 0;
}
while ((error = midiOutUnprepareHeader(midi->handle, &header, sizeof(header))) == MIDIERR_STILLPLAYING) {
approximateDelay(1);
}
if (error != MMSYSERR_NOERROR) {
logMidiOutError(error, 3 , "midiOutUnprepareHeader");
}
} else {
logMidiOutError(error, 3 , "midiOutPrepareHeader");
ok = 0;
}
}
return ok;
}
int
setMidiInstrument (MidiDevice *midi, unsigned char channel, unsigned char instrument) {
const unsigned char message[] = {
MIDI_ProgramChange|channel, instrument
};
return writeMidiMessage(midi, message, sizeof(message));
}
int
beginMidiBlock (MidiDevice *midi) {
return 1;
}
int
endMidiBlock (MidiDevice *midi) {
return 1;
}
int
startMidiNote (MidiDevice *midi, unsigned char channel, unsigned char note, unsigned char volume) {
const unsigned char message[] = {
MIDI_NoteOn|channel, note, (0X7F * volume / 100)
};
int ok = writeMidiMessage(midi, message, sizeof(message));
if (ok) midi->note = note;
return ok;
}
int
stopMidiNote (MidiDevice *midi, unsigned char channel) {
const unsigned char message[] = {
MIDI_NoteOff|channel, midi->note, 0
};
int ok = writeMidiMessage(midi, message, sizeof(message));
if (ok) midi->note = 0;
return ok;
}
int
insertMidiWait (MidiDevice *midi, int duration) {
approximateDelay(duration);
return 1;
}
# 38 "./sys_windows.c" 2
# 1 "sys_ports_windows.h" 1
int
enablePorts (int errorLevel, unsigned short int base, unsigned short int count) {
return 1;
}
int
disablePorts (unsigned short int base, unsigned short int count) {
return 1;
}
# 60 "sys_ports_windows.h"
# 1 "sys_ports_x86.h" 1
unsigned char
readPort1 (unsigned short int port) {
unsigned char v;
__asm__ __volatile__ ("inb %w1,%0" : "=a" (v) : "Nd" (port));
return v;
}
void
writePort1 (unsigned short int port, unsigned char value) {
__asm__ __volatile__ ("outb %b0,%w1" : : "a" (value), "Nd" (port));
}
# 63 "sys_ports_windows.h" 2
# 41 "./sys_windows.c" 2
That's all...
Lars
More information about the BRLTTY
mailing list