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