Skip to content

Commit afd0103

Browse files
committed
Fix Linux compilation
1 parent 4fa7d4e commit afd0103

File tree

15 files changed

+45
-2797
lines changed

15 files changed

+45
-2797
lines changed

makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ OBJS_CMP = \
6868
src/hspcmp/tagstack.o \
6969
src/hspcmp/hsmanager.o \
7070
src/hspcmp/token.o \
71-
src/hspcmp/linux/supio_linux.o
71+
src/hsp3/strbuf.o \
72+
src/hsp3/linux/supio_linux.o
7273

7374
OBJS_CL = \
7475
src/hsp3/linux/main.o \
@@ -457,7 +458,7 @@ hsp3cl: $(OBJS_CL)
457458
%.o: %.cpp
458459
$(CXX) $(CFLAGS_CL) -c $< -o $*.o
459460

460-
hsed: src/tools/hsed_gtk2.cpp src/tools/supio.cpp
461+
hsed: src/tools/linux/hsed_gtk2.cpp src/tools/linux/supio.cpp
461462
$(CXX) -O2 -Wno-write-strings -o hsed src/tools/linux/hsed_gtk2.cpp src/tools/linux/supio.cpp `$(PKG_CONFIG) --cflags --libs gtk+-2.0`
462463

463464
libgameplay.a: $(OBJS_GAMEPLAY)

makefile.raspbian

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ OBJS = \
5555

5656
OBJS_CMP = \
5757
src/hspcmp/main.o \
58+
src/hsp3/strbuf.o \
59+
src/hsp3/linux/supio_linux.o \
5860
src/hspcmp/token.o \
59-
src/hspcmp/linux/supio_linux.o \
6061
src/hspcmp/ahtmodel.o \
6162
src/hspcmp/ahtobj.o \
6263
src/hspcmp/codegen.o \
@@ -128,8 +129,8 @@ hsp3cl: $(OBJS_CL)
128129
%.o: %.cpp
129130
$(CXX) $(CFLAGS_CL) -c $< -o $*.o
130131

131-
hsed: src/tools/hsed_gtk2.cpp src/tools/supio.cpp
132-
$(CXX) -O2 -Wno-write-strings -DHSPRASPBIAN -o hsed src/tools/linux/hsed_gtk2.cpp src/tools/linux/supio.cpp `$(PKG_CONFIG) --cflags --libs gtk+-2.0`
132+
hsed: src/tools/linux/hsed_gtk2.cpp src/tools/linux/supio.cpp
133+
$(CXX) -O2 -Wno-write-strings -o hsed src/tools/linux/hsed_gtk2.cpp src/tools/linux/supio.cpp `$(PKG_CONFIG) --cflags --libs gtk+-2.0`
133134

134135
clean:
135136
rm -f $(OBJS) $(OBJS_CMP) $(OBJS_CL) $(TARGETS)

src/hsp3/linux/supio_linux.cpp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,18 +858,18 @@ int ReplaceDone( void )
858858
//
859859
// linux debug support
860860
//
861-
void Alert( const char *mes )
861+
void Alert( char *mes )
862862
{
863863
printf( "%s", mes );
864864
printf( "\r\n" );
865865
}
866866

867-
void AlertV( const char *mes, int val )
867+
void AlertV( char *mes, int val )
868868
{
869869
printf( "%s%d\r\n",mes,val );
870870
}
871871

872-
void Alertf( const char *format, ... )
872+
void Alertf( char *format, ... )
873873
{
874874
char textbf[4096];
875875
va_list args;
@@ -880,3 +880,22 @@ void Alertf( const char *format, ... )
880880
printf( "\r\n" );
881881
}
882882

883+
884+
885+
//
886+
// Memory Manager
887+
//
888+
char *mem_alloc( void *base, int newsize, int oldsize )
889+
{
890+
char *p;
891+
if ( base == NULL ) {
892+
p = (char *)calloc( newsize, 1 );
893+
return p;
894+
}
895+
if ( newsize <= oldsize ) return (char *)base;
896+
p = (char *)calloc( newsize, 1 );
897+
memcpy( p, base, oldsize );
898+
free( base );
899+
return p;
900+
}
901+

src/hsp3/linux/supio_linux.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ char *mem_ini( int size );
1212
void mem_bye( void *ptr );
1313
int mem_save( char *fname, void *mem, int msize, int seekofs );
1414
void strcase( char *str );
15+
char *mem_alloc( void *base, int newsize, int oldsize );
16+
1517
int strcpy2( char *str1, char *str2 );
1618
int strcat2( char *str1, char *str2 );
1719
char *strstr2( char *target, char *src );

0 commit comments

Comments
 (0)