Merge pull request #10 from sezero/sezero1

os2 / watcom support
master
Claudio Matsuoka 9 years ago committed by GitHub
commit c9b73006ae
  1. 2
      Makefile.am
  2. 37
      os2/Makefile.os2
  3. 8
      os2/unistd.h
  4. 6
      os2/usleep.c
  5. 4
      src/commands.c
  6. 3
      src/list.h
  7. 14
      src/read_config.c
  8. 4
      src/sound.c
  9. 16
      src/sound_dart.c

@ -2,4 +2,4 @@
SUBDIRS = src
EXTRA_DIST = CREDITS Changelog girl_from_mars.xm
EXTRA_DIST = CREDITS Changelog girl_from_mars.xm os2/Makefile.os2 os2/unistd.h os2/usleep.c

@ -0,0 +1,37 @@
# Makefile for OS/2 using Watcom compiler.
#
# wmake -f Makefile.os2
CC=wcc386
INCLUDES=-I..\os2 -I..\src
CPPFLAGS=-DHAVE_SIGNAL_H -DHAVE_SYS_TIME_H
CPPFLAGS+= -DSOUND_OS2DART
CPPFLAGS+= -DVERSION="4.2.0"
# for an exe using libxmp.dll: link to libxmp.lib
# for a statically linked exe: link to xmp_static.lib
LIBS=libxmp.lib mmpm2.lib
#LIBS=xmp_static.lib mmpm2.lib
CFLAGS = -bt=os2 -bm -fp5 -fpi87 -mf -oeatxh -w4 -zp8 -ei -q
# -5s : Pentium stack calling conventions.
# -5r : Pentium register calling conventions.
CFLAGS+= -5s
.SUFFIXES:
.SUFFIXES: .obj .c
AOUT=xmp.exe
COMPILE=$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES)
OBJ = commands.obj getopt.obj getopt1.obj info.obj main.obj options.obj read_config.obj sound.obj sound_aiff.obj sound_file.obj sound_null.obj sound_wav.obj sound_dart.obj terminal.obj usleep.obj
all: $(AOUT)
$(AOUT): $(OBJ)
wlink N $(AOUT) SYS OS2V2 LIBR {$(LIBS)} F {$(OBJ)}
clean:
FOR %F IN ( $(AOUT) $(OBJ) $(EXTRA_OBJ) ) DO IF EXIST %F ERASE %F
.c: ..\src
.c.obj:
$(COMPILE) -fo=$^@ $<

@ -0,0 +1,8 @@
#ifndef _XMP_OS2_UNISTD_H
#define _XMP_OS2_UNISTD_H
#include <io.h> /* do not want Watcom unistd.h */
void usleep (unsigned long usec);
#endif

@ -0,0 +1,6 @@
#define INCL_DOSPROCESS
#include <os2.h>
void usleep (unsigned long usec)
{
DosSleep(usec ? (usec/1000l) : 1l);
}

@ -7,7 +7,7 @@
*/
#include <unistd.h>
#ifdef WIN32
#if defined(_WIN32) || defined(__OS2__)
#include <conio.h>
#endif
#include <xmp.h>
@ -65,7 +65,7 @@ static int read_key(void)
if (stdin_ready_for_reading())
#endif
ret = read(0, &key, 1);
#elif defined WIN32
#elif defined(_WIN32) || defined(__OS2__)
if (kbhit()) {
key = getch();
ret = 1;

@ -7,6 +7,9 @@
#ifdef _MSC_VER
#define __inline__ __inline
#endif
#ifdef __WATCOMC__
#define __inline__ inline
#endif
/*
* Simple doubly linked list implementation.

@ -43,10 +43,11 @@ int read_config(struct options *o)
char *hash, *var, *val, line[256];
char cparm[512];
#if defined __EMX__
char *home = getenv("HOME");
#if defined(__OS2__) || defined(__EMX__)
const char *home = getenv("HOME");
if (!home) home = "C:";
snprintf(myrc, PATH_MAX, "%s\\.xmp\\xmp.conf", home);
snprintf(myrc, PATH_MAX, "%s\\xmp.conf", home);
if ((rc = fopen(myrc, "r")) == NULL) {
if ((rc = fopen("xmp.conf", "r")) == NULL) {
@ -280,11 +281,12 @@ static void parse_modconf(struct options *o, char *confname, unsigned char *md5)
void read_modconf(struct options *o, unsigned char *md5)
{
#if defined __EMX__
#if defined(__OS2__) || defined(__EMX__)
char myrc[PATH_MAX];
char *home = getenv("HOME");
const char *home = getenv("HOME");
if (!home) home = "C:";
snprintf(myrc, PATH_MAX, "%s\\.xmp\\modules.conf", home);
snprintf(myrc, PATH_MAX, "%s\\modules.conf", home);
parse_modconf(o, "xmp-modules.conf", md5);
parse_modconf(o, myrc, md5);
#elif defined __AMIGA__

@ -18,6 +18,7 @@ extern struct sound_driver sound_qnx;
extern struct sound_driver sound_alsa05;
extern struct sound_driver sound_oss;
extern struct sound_driver sound_alsa;
extern struct sound_driver sound_os2dart;
extern struct sound_driver sound_win32;
extern struct sound_driver sound_pulseaudio;
extern struct sound_driver sound_coreaudio;
@ -70,6 +71,9 @@ void init_sound_drivers(void)
#ifdef SOUND_COREAUDIO
register_sound_driver(&sound_coreaudio);
#endif
#ifdef SOUND_OS2DART
register_sound_driver(&sound_os2dart);
#endif
#ifdef SOUND_WIN32
register_sound_driver(&sound_win32);
#endif

@ -18,6 +18,8 @@
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
#undef VERSION /* stop conflict with os2medef.h */
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@ -74,7 +76,7 @@ static int init(struct options *options)
int flags;
int i;
MCI_AMP_OPEN_PARMS AmpOpenParms;
char *token, **parm;
char *token;
parm_init(parm);
chkparm1("sharing", sharing = *token);
@ -210,6 +212,18 @@ static void deinit(void)
}
}
static void flush(void)
{
}
static void onpause(void)
{
}
static void onresume(void)
{
}
static const char *const help[] = {
"sharing={Y,N}", "Device Sharing (default is N)",
"device=val", "OS/2 Audio Device (default is 0 auto-detect)",

Loading…
Cancel
Save