fix so release build builds

without MEMDEBUG defined that is
This commit is contained in:
Eric House 2021-02-10 16:46:15 -08:00
parent 02a193902f
commit 96829b5478
15 changed files with 257 additions and 14 deletions

View file

@ -1108,7 +1108,8 @@ dict_super_edge_with_tile( const DictionaryCtxt* dict, array_edge* from,
void
dict_super_init( MPFORMAL DictionaryCtxt* dict )
{
dict->mpool = mpool;
MPASSIGN(dict->mpool, mpool);
/* subclass may change these later.... */
dict->func_edge_for_index = dict_super_edge_for_index;
dict->func_dict_getTopEdge = dict_super_getTopEdge;

View file

@ -1,6 +1,6 @@
/* -*- compile-command: "cd ../linux && make -j3 MEMDEBUG=TRUE"; -*- */
/*
* Copyright 2001-2011 by Eric House (xwords@eehouse.org). All rights
* Copyright 2001 - 2021 by Eric House (xwords@eehouse.org). All rights
* reserved.
*
* This program is free software; you can redistribute it and/or

View file

@ -1,3 +1,20 @@
# -*- mode: makefile; compile-command: "make -j3 MEMDEBUG=TRUE install"; -*-
# Copyright 2021 by Eric House (xwords@eehouse.org). All rights
# reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
include ../common/config.mk
@ -5,7 +22,6 @@ DEBS = cmake
INPUTS = main.c wasmdict.c wasmutls.c wasmdraw.c wasmutil.c wasmdutil.c ${COMMONSRC}
DEFINES += -DMEM_DEBUG -DDEBUG
DEFINES += -DXWFEATURE_CHAT
DEFINES += -DXWFEATURE_BONUSALL
DEFINES += -DMAX_ROWS=32
@ -28,6 +44,13 @@ DEFINES += -DPLATFORM_WASM
DEFINES += -DXWFEATURE_CROSSHAIRS
DEFINES += -DNATIVE_NLI
DEFINES += -DDEBUG_REF
ifeq ($(MEMDEBUG),TRUE)
DEFINES += -DMEM_DEBUG -DDEBUG -O
else
DEFINES += -O3
endif
OUTPUTS = main.html main.js main.js.mem main.data main.html.mem main.wasm
all: main.js

View file

@ -140,9 +140,11 @@ initDeviceGlobals( Globals* globals )
globals->procs.send = send_msg;
globals->procs.closure = globals;
#ifdef MEMDEBUG
globals->mpool = mpool_make( "wasm" );
globals->vtMgr = make_vtablemgr( globals->mpool );
globals->dutil = wasm_dutil_make( globals->mpool, globals->vtMgr, globals );
#endif
globals->vtMgr = make_vtablemgr( MPPARM_NOCOMMA(globals->mpool) );
globals->dutil = wasm_dutil_make( MPPARM(globals->mpool) globals->vtMgr, globals );
globals->dictMgr = dmgr_make( MPPARM_NOCOMMA(globals->mpool) );
globals->dict = wasm_dictionary_make( MPPARM(globals->mpool) NULL,
globals, DICTNAME, true );
@ -218,7 +220,7 @@ gameFromInvite( Globals* globals, const NetLaunchInfo* invite )
gi_disposePlayerInfo( MPPARM(globals->mpool) &globals->gi );
XP_MEMSET( &globals->gi, 0, sizeof(globals->gi) );
globals->util = wasm_util_make( globals->mpool, &globals->gi,
globals->util = wasm_util_make( MPPARM(globals->mpool) &globals->gi,
globals->dutil, globals );
loaded = game_makeFromInvite( MPPARM(globals->mpool) NULL, invite,
@ -243,7 +245,7 @@ loadSavedGame( Globals* globals )
dutil_loadStream( globals->dutil, NULL, KEY_GAME, NULL, stream );
if ( 0 < stream_getSize( stream ) ) {
XP_ASSERT( !globals->util );
globals->util = wasm_util_make( globals->mpool, &globals->gi,
globals->util = wasm_util_make( MPPARM(globals->mpool) &globals->gi,
globals->dutil, globals );
XP_LOGFF( "there's a saved game!!" );
@ -299,7 +301,7 @@ loadAndDraw( Globals* globals, const NetLaunchInfo* invite,
globals->gi.players[1].isLocal = XP_TRUE;
globals->gi.players[1].robotIQ = p1robot ? 99 : 0;
globals->util = wasm_util_make( globals->mpool, &globals->gi,
globals->util = wasm_util_make( MPPARM(globals->mpool) &globals->gi,
globals->dutil, globals );
XP_LOGFF( "calling game_makeNewGame()" );

View file

@ -1,3 +1,21 @@
/* -*- compile-command: "cd ../wasm && make main.html -j3"; -*- */
/*
* Copyright 2021 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _MAIN_H_
#define _MAIN_H_

View file

@ -1,3 +1,22 @@
/* -*- compile-command: "cd ../wasm && make main.html -j3"; -*- */
/*
* Copyright 2021 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

View file

@ -1,3 +1,22 @@
/* -*- compile-command: "cd ../wasm && make main.html -j3"; -*- */
/*
* Copyright 2021 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
#include <SDL2/SDL_image.h>

View file

@ -1,4 +1,21 @@
/* -*- compile-command: "cd ../wasm && make main.html -j3"; -*- */
/*
* Copyright 2021 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _WASMDRAW_H_
#define _WASMDRAW_H_

View file

@ -1,3 +1,22 @@
/* -*- compile-command: "cd ../wasm && make main.html -j3"; -*- */
/*
* Copyright 2021 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <time.h>
#include <emscripten.h>

View file

@ -1,3 +1,21 @@
/* -*- compile-command: "cd ../wasm && make main.html -j3"; -*- */
/*
* Copyright 2021 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _WASMDUTIL_H_
#define _WASMDUTIL_H_

View file

@ -1,3 +1,21 @@
/* -*- compile-command: "cd ../wasm && make main.html -j3"; -*- */
/*
* Copyright 2021 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "util.h"
#include "comtypes.h"
@ -512,7 +530,7 @@ wasm_util_make( MPFORMAL CurGameInfo* gi, XW_DUtilCtxt* dctxt, void* closure )
LOG_FUNC();
WasmUtilCtx* wuctxt = XP_MALLOC( mpool, sizeof(*wuctxt) );
wuctxt->super.vtable = XP_MALLOC( mpool, sizeof(*wuctxt->super.vtable) );
wuctxt->super.mpool = mpool;
MPASSIGN( wuctxt->super.mpool, mpool );
wuctxt->super.gameInfo = gi;
wuctxt->dctxt = dctxt;

View file

@ -1,3 +1,21 @@
/* -*- compile-command: "cd ../wasm && make main.html -j3"; -*- */
/*
* Copyright 2021 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _WASMUTIL_H_
#define _WASMUTIL_H_

View file

@ -1,3 +1,23 @@
/* -*- compile-command: "cd ../wasm && make main.html -j3"; -*- */
/*
* Copyright 2021 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
@ -24,3 +44,14 @@ wasm_debugff( const char* func, const char* file, const char* fmt, ...)
va_end( ap );
fprintf( stderr, "\n" );
}
#ifndef MEM_DEBUG
void
wasm_freep( void** ptrp )
{
if ( !!*ptrp ) {
free( *ptrp );
*ptrp = NULL;
}
}
#endif

View file

@ -1,5 +1,29 @@
/* -*- compile-command: "cd ../wasm && make main.html -j3"; -*- */
/*
* Copyright 2021 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _WASMUTLS_H_
#define _WASMUTLS_H_
void wasm_debugf( const char* format, ... );
void wasm_debugff( const char* func, const char* file, const char* fmt, ...);
# ifndef MEM_DEBUG
void wasm_freep( void** ptrp );
# endif
#endif

View file

@ -1,4 +1,21 @@
/* -*- compile-command: "cd ../wasm && make main.html -j3"; -*- */
/*
* Copyright 2021 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdbool.h>
#include <stdint.h>
@ -51,8 +68,7 @@ typedef void* XWEnv;
# define XP_CALLOC(pool,nbytes) calloc(1,nbytes)
# define XP_REALLOC(pool,p,s) realloc((p),(s))
# define XP_FREE(pool,p) free(p)
void linux_freep( void** ptrp );
# define XP_FREEP(pool,p) linux_freep((void**)p)
# define XP_FREEP(pool,p) wasm_freep((void**)p)
#endif
#ifdef DEBUG