quick and dirty emscripten port
This commit is contained in:
parent
c3ec56725b
commit
96eb275622
|
|
@ -20,6 +20,7 @@
|
||||||
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/calma/CalmaRead.c,v 1.3 2010/06/24 12:37:15 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/calma/CalmaRead.c,v 1.3 2010/06/24 12:37:15 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
@ -409,12 +410,9 @@ calmaParseUnits()
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void CalmaReadError(char *format, ...)
|
||||||
/*VARARGS1*/
|
|
||||||
CalmaReadError(format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
|
||||||
char *format;
|
|
||||||
char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10;
|
|
||||||
{
|
{
|
||||||
|
va_list args;
|
||||||
OFFTYPE filepos;
|
OFFTYPE filepos;
|
||||||
|
|
||||||
calmaTotalErrors++;
|
calmaTotalErrors++;
|
||||||
|
|
@ -432,15 +430,15 @@ CalmaReadError(format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||||
cifReadCellDef->cd_name);
|
cifReadCellDef->cd_name);
|
||||||
fprintf(calmaErrorFile, "(byte position %"DLONG_PREFIX"d): ",
|
fprintf(calmaErrorFile, "(byte position %"DLONG_PREFIX"d): ",
|
||||||
(dlong)filepos);
|
(dlong)filepos);
|
||||||
fprintf(calmaErrorFile, format, a1, a2, a3, a4, a5, a6, a7,
|
va_start(args, format);
|
||||||
a8, a9, a10);
|
Vfprintf(calmaErrorFile, format, args);
|
||||||
|
va_end(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TxError("Error while reading cell \"%s\" ", cifReadCellDef->cd_name);
|
TxError("Error while reading cell \"%s\" ", cifReadCellDef->cd_name);
|
||||||
TxError("(byte position %"DLONG_PREFIX"d): ", (dlong)filepos);
|
TxError("(byte position %"DLONG_PREFIX"d): ", (dlong)filepos);
|
||||||
TxError(format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((calmaTotalErrors == 100) && (CIFWarningLevel == CIF_WARN_LIMIT))
|
else if ((calmaTotalErrors == 100) && (CIFWarningLevel == CIF_WARN_LIMIT))
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ static char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic-8.0/c
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <arpa/inet.h> /* for htons() */
|
#include <arpa/inet.h> /* for htons() */
|
||||||
#ifdef SYSV
|
#if defined(SYSV) || defined(EMSCRIPTEN)
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ static char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic-8.0/c
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <arpa/inet.h> /* for htons() */
|
#include <arpa/inet.h> /* for htons() */
|
||||||
#ifdef SYSV
|
#if defined(SYSV) || defined(EMSCRIPTEN)
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,9 @@ extern bool CalmaWrite();
|
||||||
extern void CalmaReadFile();
|
extern void CalmaReadFile();
|
||||||
extern void CalmaTechInit();
|
extern void CalmaTechInit();
|
||||||
extern bool CalmaGenerateArray();
|
extern bool CalmaGenerateArray();
|
||||||
extern void CalmaReadError();
|
extern void CalmaReadError(char *format, ...);
|
||||||
|
|
||||||
/* C99 compat */
|
/* C99 compat */
|
||||||
extern void CalmaReadError();
|
|
||||||
extern int calmaAddSegment();
|
extern int calmaAddSegment();
|
||||||
extern void calmaDelContacts();
|
extern void calmaDelContacts();
|
||||||
extern void calmaElementBoundary();
|
extern void calmaElementBoundary();
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ CIFPolyToRects(path, plane, resultTbl, ui, isCalma)
|
||||||
if ((tail->cifp_x != path->cifp_x) || (tail->cifp_y != path->cifp_y))
|
if ((tail->cifp_x != path->cifp_x) || (tail->cifp_y != path->cifp_y))
|
||||||
{
|
{
|
||||||
if (isCalma)
|
if (isCalma)
|
||||||
CalmaReadError("Boundary is not closed.\n" );
|
CalmaReadError("Boundary is not closed.\n");
|
||||||
|
|
||||||
p = (CIFPath *) mallocMagic ((unsigned) sizeof (CIFPath));
|
p = (CIFPath *) mallocMagic ((unsigned) sizeof (CIFPath));
|
||||||
p->cifp_x = path->cifp_x;
|
p->cifp_x = path->cifp_x;
|
||||||
|
|
|
||||||
|
|
@ -1046,7 +1046,7 @@ CmdPaintEraseButton(w, refPoint, isPaint, isScreen)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DBEraseValid(EditCellUse->cu_def, &editRect, &mask, 0);
|
DBEraseValid(EditCellUse->cu_def, &editRect, &mask, 0);
|
||||||
DBEraseLabel(EditCellUse->cu_def, &editRect, &mask);
|
DBEraseLabel(EditCellUse->cu_def, &editRect, &mask, NULL);
|
||||||
}
|
}
|
||||||
SelectClear();
|
SelectClear();
|
||||||
DBAdjustLabels(EditCellUse->cu_def, &editRect);
|
DBAdjustLabels(EditCellUse->cu_def, &editRect);
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,4 @@
|
||||||
# script itself. It also sets up CFLAGS without the default optimizer
|
# script itself. It also sets up CFLAGS without the default optimizer
|
||||||
# flag (-O2).
|
# flag (-O2).
|
||||||
|
|
||||||
( CFLAGS="-g"; export CFLAGS; cd scripts ; ./configure "$@" )
|
( CFLAGS="-g -Wno-int-conversion -Wno-implicit-int"; export CFLAGS; cd scripts ; ./configure "$@" )
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#ifdef SYSV
|
#if defined(SYSV) || defined(EMSCRIPTEN)
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -780,7 +780,7 @@ extTimeProc(proc, def, tv)
|
||||||
{
|
{
|
||||||
int secs, usecs, i;
|
int secs, usecs, i;
|
||||||
|
|
||||||
#ifdef SYSV
|
#if defined(SYSV) || defined(EMSCRIPTEN)
|
||||||
tv->tv_sec = 0;
|
tv->tv_sec = 0;
|
||||||
tv->tv_usec = 0;
|
tv->tv_usec = 0;
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#define VERSATEC /* Add this for HP plotter support */
|
#define VERSATEC /* Add this for HP plotter support */
|
||||||
|
|
||||||
/* system V machines lack vfont.h, so include the defs below. */
|
/* system V machines lack vfont.h, so include the defs below. */
|
||||||
#if !defined(SYSV) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(CYGWIN) && !defined(__APPLE__) && !defined(__DragonFly__) && !defined(__OpenBSD__)
|
#if !defined(SYSV) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(CYGWIN) && !defined(__APPLE__) && !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(EMSCRIPTEN)
|
||||||
#include <vfont.h>
|
#include <vfont.h>
|
||||||
#else
|
#else
|
||||||
struct header {
|
struct header {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||||
#include "select/select.h"
|
#include "select/select.h"
|
||||||
#include "graphics/graphics.h"
|
#include "graphics/graphics.h"
|
||||||
|
|
||||||
#if defined(SYSV) || defined(__APPLE__)
|
#if defined(SYSV) || defined(__APPLE__) || defined(EMSCRIPTEN)
|
||||||
# define NO_RUSAGE
|
# define NO_RUSAGE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#ifdef SYSV
|
#if defined(SYSV) || defined(EMSCRIPTEN)
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -262,7 +262,7 @@ plowGenRandom(lo, hi)
|
||||||
int lo, hi; /* Inclusive bounds for the integer we'll generate */
|
int lo, hi; /* Inclusive bounds for the integer we'll generate */
|
||||||
{
|
{
|
||||||
int range = hi - lo + 1;
|
int range = hi - lo + 1;
|
||||||
#ifdef SYSV
|
#if defined(SYSV) || defined(EMSCRIPTEN)
|
||||||
int r = rand();
|
int r = rand();
|
||||||
#else
|
#else
|
||||||
int r = random();
|
int r = random();
|
||||||
|
|
|
||||||
|
|
@ -7774,13 +7774,11 @@ case $target in
|
||||||
*-linux*)
|
*-linux*)
|
||||||
$as_echo "#define linux 1" >>confdefs.h
|
$as_echo "#define linux 1" >>confdefs.h
|
||||||
|
|
||||||
$as_echo "#define SYSV 1" >>confdefs.h
|
|
||||||
|
|
||||||
$as_echo "#define ISC 1" >>confdefs.h
|
$as_echo "#define ISC 1" >>confdefs.h
|
||||||
|
|
||||||
case $target in
|
case $target in
|
||||||
*x86_64*)
|
*x86_64*)
|
||||||
CFLAGS="${CFLAGS} -m64 -fPIC -Werror=implicit-function-declaration"
|
CFLAGS="${CFLAGS} -fPIC -Werror=implicit-function-declaration"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if test $usingOGL ; then
|
if test $usingOGL ; then
|
||||||
|
|
|
||||||
|
|
@ -1353,13 +1353,12 @@ dnl ----------------------------------------------------------------
|
||||||
case $target in
|
case $target in
|
||||||
*-linux*)
|
*-linux*)
|
||||||
AC_DEFINE(linux)
|
AC_DEFINE(linux)
|
||||||
AC_DEFINE(SYSV)
|
|
||||||
dnl Defining "ISC" prevents compiler failure on redefinition of "wchar_t"
|
dnl Defining "ISC" prevents compiler failure on redefinition of "wchar_t"
|
||||||
AC_DEFINE(ISC)
|
AC_DEFINE(ISC)
|
||||||
dnl 64-bit support for AMD Opteron
|
dnl 64-bit support for AMD Opteron
|
||||||
case $target in
|
case $target in
|
||||||
*x86_64*)
|
*x86_64*)
|
||||||
CFLAGS="${CFLAGS} -m64 -fPIC -Werror=implicit-function-declaration"
|
CFLAGS="${CFLAGS} -fPIC -Werror=implicit-function-declaration"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if test $usingOGL ; then
|
if test $usingOGL ; then
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ SimStartRsim(argv)
|
||||||
|
|
||||||
FORK(child);
|
FORK(child);
|
||||||
/*
|
/*
|
||||||
#ifdef SYSV
|
#if defined(SYSV)
|
||||||
child = fork();
|
child = fork();
|
||||||
#else
|
#else
|
||||||
child = vfork();
|
child = vfork();
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ typedef struct {
|
||||||
#define TX_CMD_PROMPT ":"
|
#define TX_CMD_PROMPT ":"
|
||||||
|
|
||||||
/* all of the state associated with a tty terminal */
|
/* all of the state associated with a tty terminal */
|
||||||
#if !defined(SYSV) && !defined(CYGWIN) && !defined(__OpenBSD__)
|
#if !defined(SYSV) && !defined(CYGWIN) && !defined(__OpenBSD__) && !defined(EMSCRIPTEN)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct sgttyb tx_i_sgtty;
|
struct sgttyb tx_i_sgtty;
|
||||||
struct tchars tx_i_tchars;
|
struct tchars tx_i_tchars;
|
||||||
|
|
|
||||||
|
|
@ -1218,7 +1218,7 @@ txGetTermState(buf)
|
||||||
ioctl( fileno( stdin ), TCGETA, buf);
|
ioctl( fileno( stdin ), TCGETA, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined (__OpenBSD__)
|
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||||
|
|
||||||
void
|
void
|
||||||
txGetTermState(buf)
|
txGetTermState(buf)
|
||||||
|
|
@ -1259,7 +1259,7 @@ void
|
||||||
txSetTermState(buf)
|
txSetTermState(buf)
|
||||||
#if defined(SYSV) || defined(CYGWIN)
|
#if defined(SYSV) || defined(CYGWIN)
|
||||||
struct termio *buf;
|
struct termio *buf;
|
||||||
#elif defined(__OpenBSD__)
|
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||||
struct termios *buf;
|
struct termios *buf;
|
||||||
#else
|
#else
|
||||||
txTermState *buf;
|
txTermState *buf;
|
||||||
|
|
@ -1267,7 +1267,7 @@ txSetTermState(buf)
|
||||||
{
|
{
|
||||||
#if defined(SYSV) || defined(CYGWIN)
|
#if defined(SYSV) || defined(CYGWIN)
|
||||||
ioctl( fileno(stdin), TCSETAF, buf );
|
ioctl( fileno(stdin), TCSETAF, buf );
|
||||||
#elif defined (__OpenBSD__)
|
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||||
(void) tcsetattr( fileno(stdin), TCSANOW, buf );
|
(void) tcsetattr( fileno(stdin), TCSANOW, buf );
|
||||||
#else
|
#else
|
||||||
/* set the current terminal characteristics */
|
/* set the current terminal characteristics */
|
||||||
|
|
@ -1298,13 +1298,13 @@ void
|
||||||
txInitTermRec(buf)
|
txInitTermRec(buf)
|
||||||
#if defined(SYSV) || defined(CYGWIN)
|
#if defined(SYSV) || defined(CYGWIN)
|
||||||
struct termio *buf;
|
struct termio *buf;
|
||||||
#elif defined(__OpenBSD__)
|
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||||
struct termios *buf;
|
struct termios *buf;
|
||||||
#else
|
#else
|
||||||
txTermState *buf;
|
txTermState *buf;
|
||||||
#endif /* SYSV */
|
#endif /* SYSV */
|
||||||
{
|
{
|
||||||
#if defined(SYSV) || defined(CYGWIN) || defined(__OpenBSD__)
|
#if defined(SYSV) || defined(CYGWIN) || defined(__OpenBSD__) || defined(EMSCRIPTEN)
|
||||||
buf->c_lflag = ISIG; /* raw: no echo and no processing, allow signals */
|
buf->c_lflag = ISIG; /* raw: no echo and no processing, allow signals */
|
||||||
buf->c_cc[ VMIN ] = 1;
|
buf->c_cc[ VMIN ] = 1;
|
||||||
buf->c_cc[ VTIME ] = 0;
|
buf->c_cc[ VTIME ] = 0;
|
||||||
|
|
@ -1321,7 +1321,7 @@ txInitTermRec(buf)
|
||||||
|
|
||||||
#if defined(SYSV) || defined(CYGWIN)
|
#if defined(SYSV) || defined(CYGWIN)
|
||||||
struct termio closeTermState;
|
struct termio closeTermState;
|
||||||
#elif defined(__OpenBSD__)
|
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||||
struct termios closeTermState;
|
struct termios closeTermState;
|
||||||
#else
|
#else
|
||||||
static txTermState closeTermState;
|
static txTermState closeTermState;
|
||||||
|
|
@ -1355,7 +1355,7 @@ txSaveTerm()
|
||||||
TxEOFChar = closeTermState.c_cc[VEOF];
|
TxEOFChar = closeTermState.c_cc[VEOF];
|
||||||
TxInterruptChar = closeTermState.c_cc[VINTR];
|
TxInterruptChar = closeTermState.c_cc[VINTR];
|
||||||
haveCloseState = TRUE;
|
haveCloseState = TRUE;
|
||||||
#elif defined(__OpenBSD__)
|
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||||
(void) tcgetattr( fileno( stdin ), &closeTermState);
|
(void) tcgetattr( fileno( stdin ), &closeTermState);
|
||||||
txEraseChar = closeTermState.c_cc[VERASE];
|
txEraseChar = closeTermState.c_cc[VERASE];
|
||||||
txKillChar = closeTermState.c_cc[VKILL];
|
txKillChar = closeTermState.c_cc[VKILL];
|
||||||
|
|
@ -1398,7 +1398,7 @@ TxSetTerminal()
|
||||||
{
|
{
|
||||||
#if defined(SYSV) || defined(CYGWIN)
|
#if defined(SYSV) || defined(CYGWIN)
|
||||||
struct termio buf;
|
struct termio buf;
|
||||||
#elif defined(__OpenBSD__)
|
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||||
struct termios buf;
|
struct termios buf;
|
||||||
#else
|
#else
|
||||||
txTermState buf;
|
txTermState buf;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#if defined(__OpenBSD__)
|
#if defined(__OpenBSD__) || defined(EMSCRIPTEN)
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/ioctl_compat.h>
|
#include <sys/ioctl_compat.h>
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||||
|
|
||||||
/* Imports */
|
/* Imports */
|
||||||
|
|
||||||
extern void TxError();
|
extern void TxError(char *, ...);
|
||||||
extern char *TxGetLine();
|
extern char *TxGetLine();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -367,7 +367,9 @@ NLNetName(net)
|
||||||
NLNet *net;
|
NLNet *net;
|
||||||
{
|
{
|
||||||
static char tempId[100];
|
static char tempId[100];
|
||||||
#if defined(linux) || defined(CYGWIN)
|
#if defined(EMSCRIPTEN)
|
||||||
|
int etext;
|
||||||
|
#elif defined(linux) || defined(CYGWIN)
|
||||||
extern int etext asm("etext");
|
extern int etext asm("etext");
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
int etext;
|
int etext;
|
||||||
|
|
|
||||||
|
|
@ -665,7 +665,7 @@ SigInit(batchmode)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(SYSV) && !defined(CYGWIN)
|
#if !defined(SYSV) && !defined(CYGWIN) && !defined(EMSCRIPTEN)
|
||||||
sigsetmask(0);
|
sigsetmask(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -673,7 +673,7 @@ SigInit(batchmode)
|
||||||
void
|
void
|
||||||
sigSetAction(int signo, sigRetVal (*handler)(int))
|
sigSetAction(int signo, sigRetVal (*handler)(int))
|
||||||
{
|
{
|
||||||
#if defined(SYSV) || defined(CYGWIN) || defined(__NetBSD__)
|
#if defined(SYSV) || defined(CYGWIN) || defined(__NetBSD__) || defined(EMSCRIPTEN)
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
sa.sa_handler = handler;
|
sa.sa_handler = handler;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue