Skip to content

Commit

Permalink
Changes to build with G++
Browse files Browse the repository at this point in the history
Changes to build with G++
  • Loading branch information
khval committed Apr 22, 2023
1 parent 3cc6169 commit 71f08b3
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 30 deletions.
4 changes: 2 additions & 2 deletions UTF8_files/Makefile
Expand Up @@ -58,11 +58,11 @@ clean:
$(RM) $(TARGET) $(OBJS)

init.o: init.c libbase.h UTF8.library_rev.h UTF8_vectors.c ../include/interfaces/UTF8.h
gcc -Wall -O3 -Iinclude -c -o init.o init.c
$(CXX) -Wall -O3 -Iinclude -fpermissive -c -o init.o init.c


%.o: %.c
gcc -Wall -O3 $(INC) $(DEBUG) -c -D__USE_INLINE__ -D__no_stdlib__ $(@:.o=.c) -o $@
$(CXX) -Wall -O3 $(INC) $(DEBUG) -c -D__USE_INLINE__ -D__no_stdlib__ $(@:.o=.c) -o $@


.PHONY: revision
Expand Down
30 changes: 23 additions & 7 deletions UTF8_files/init.c
Expand Up @@ -18,19 +18,30 @@
#include <proto/exec.h>
#include <dos/dos.h>
#include <exec/types.h>
#include <newlib.h>
#include <libraries/UTF8.h>
#include <proto/UTF8.h>
#include <stdarg.h>
#include <string.h>

#include "UTF8.library_rev.h"

/* Version Tag */
//include "UTF8.library_rev.h"
STATIC CONST UBYTE USED verstag[] = VERSTAG;
STATIC CONST UBYTE USED *verstag = (const UBYTE*) VERSTAG;

#include "libbase.h"

struct ExecIFace *IExec = NULL;
struct Library *DOSBase = NULL;
struct Library *NewLibBase = NULL;
struct Library *GraphicsBase = NULL;
struct Library *DiskfontBase = NULL;

struct ExecIFace *IExec = NULL;
struct DOSIFace *IDOS = NULL;
struct NewLibIFace *INewlib = NULL;
struct GraphicsIFace *IGraphics = NULL;
struct DiskfontIFace *IDiskfont = NULL;

struct u8l u8_b1[256];
struct u8l u8_b2[256];
Expand Down Expand Up @@ -137,13 +148,18 @@ STATIC APTR libExpunge(struct LibraryManagerInterface *Self)
return result;
}

void _memset( char *ptr, char n, int size )
{
for (ptr; size; size --) *ptr = n;
}


void init_table()
{
int n,nn,prefix,cnt;
int v;
bzero( u8_b1, sizeof(u8_b1) );
bzero( u8_b2, sizeof(u8_b2) );
_memset( (char*) u8_b1, 0, sizeof(u8_b1) );
_memset( (char*) u8_b2, 0, sizeof(u8_b2) );

// setup first byte in UTF8...

Expand Down Expand Up @@ -187,11 +203,11 @@ STATIC struct Library *libInit(struct Library *LibraryBase, APTR seglist, struct

libBase->libNode.lib_Node.ln_Type = NT_LIBRARY;
libBase->libNode.lib_Node.ln_Pri = 0;
libBase->libNode.lib_Node.ln_Name = "UTF8.library";
libBase->libNode.lib_Node.ln_Name = (STRPTR) "UTF8.library";
libBase->libNode.lib_Flags = LIBF_SUMUSED|LIBF_CHANGED;
libBase->libNode.lib_Version = VERSION;
libBase->libNode.lib_Revision = REVISION;
libBase->libNode.lib_IdString = VSTRING;
libBase->libNode.lib_IdString = (STRPTR) VSTRING;

IExec = (struct ExecIFace *)exec;

Expand Down Expand Up @@ -219,7 +235,7 @@ STATIC struct Library *libInit(struct Library *LibraryBase, APTR seglist, struct
if (NewLibBase)
{
IExec ->DebugPrintF("UTF8.library: opened newlib.library version 53\n");
INewlib = (struct DOSIFace *) IExec->GetInterface( NewLibBase,"main", 1, NULL);
INewlib = (NewLibIFace*) IExec->GetInterface( NULL /*NewLibBase*/,"main", 1, NULL);
}

if (DiskfontBase)
Expand Down
18 changes: 9 additions & 9 deletions UTF8_files/libbase.h
Expand Up @@ -5,10 +5,10 @@
#include <proto/graphics.h>
#endif

struct Library *DOSBase;
struct Library *NewLibBase;
struct Library *GraphicsBase;
struct Library *DiskfontBase;
extern struct Library *DOSBase;
extern struct Library *NewLibBase;
extern struct Library *GraphicsBase;
extern struct Library *DiskfontBase;

#ifdef _MSC_VER

Expand All @@ -27,11 +27,11 @@ struct Library *DiskfontBase;

#ifdef __amigaos4__

struct ExecIFace *IExec;
struct DOSIFace *IDOS;
struct NewLibIFace *INewlib;
struct GraphicsIFace *IGraphics;
struct DiskfontIFace *IDiskfont;
extern struct ExecIFace *IExec;
extern struct DOSIFace *IDOS;
extern struct NewLibIFace *INewlib;
extern struct GraphicsIFace *IGraphics;
extern struct DiskfontIFace *IDiskfont;

#define sys_alloc(size,type) AllocVecTags(size,AVT_Type, type, TAG_END)
#define sys_alloc_clear(size,type) AllocVecTags(size,AVT_Type,type,AVT_ClearWithValue,0,TAG_END)
Expand Down
1 change: 0 additions & 1 deletion UTF8_files/main/UTF8Copy.c
Expand Up @@ -57,7 +57,6 @@
*
*/


unsigned char * _UTF8_UTF8Copy(struct UTF8IFace *Self,unsigned char *UTF8, ULONG mem_flags )
{
int size;
Expand Down
5 changes: 2 additions & 3 deletions UTF8_files/main/UTF8Decode.c
Expand Up @@ -65,7 +65,6 @@
*
*/


char * _UTF8_UTF8Decode(struct UTF8IFace *Self, ULONG *codeset_page, unsigned char * UTF8, ULONG flags )
{
char *c;
Expand All @@ -80,7 +79,7 @@ char * _UTF8_UTF8Decode(struct UTF8IFace *Self, ULONG *codeset_page, unsigned ch

DebugPrintF(" _UTF8_UTF8Decode UTF8 string len = %d \n", size);

new_str = sys_alloc_clear(size, flags);
new_str = (char *) sys_alloc_clear(size, flags);
if (new_str)
{
c = new_str;
Expand Down Expand Up @@ -130,7 +129,7 @@ char * _UTF8_UTF8DecodeLen(struct UTF8IFace *Self, ULONG *codeset_page, unsigned

DebugPrintF(" _UTF8_Decode UTF8 string size = %d \n", size);

new_str = sys_alloc(size,flags);
new_str = (char *) sys_alloc(size,flags);

if (new_str)
{
Expand Down
5 changes: 2 additions & 3 deletions UTF8_files/main/UTF8Encode.c
Expand Up @@ -64,7 +64,6 @@
*
*/


unsigned char * _UTF8_UTF8Encode(struct UTF8IFace *Self, ULONG *codeset_page, char * ascii, ULONG mem_flags)
{
unsigned char *c;
Expand All @@ -78,7 +77,7 @@ unsigned char * _UTF8_UTF8Encode(struct UTF8IFace *Self, ULONG *codeset_page, ch
for (c = (unsigned char *) ascii; *c ; c++ )
size += _UTF8_UTF8EstimateByteSize( Self, *c );

utf8 = sys_alloc(size, mem_flags );
utf8 = (unsigned char *) sys_alloc(size, mem_flags );
if (utf8)
{
pos = 0;
Expand All @@ -93,7 +92,7 @@ unsigned char * _UTF8_UTF8Encode(struct UTF8IFace *Self, ULONG *codeset_page, ch
for (c = (unsigned char *) ascii; *c ; c++ )
size += _UTF8_UTF8EstimateByteSize( Self, codeset_page[ *c ] );

utf8 = sys_alloc(size, mem_flags );
utf8 = (unsigned char *) sys_alloc(size, mem_flags );
if (utf8)
{
pos = 0;
Expand Down
2 changes: 1 addition & 1 deletion UTF8_files/main/UTF8GetGlyph.c
Expand Up @@ -164,4 +164,4 @@ ULONG _UTF8_UTF8GetGlyph(struct UTF8IFace *Self, unsigned char *utf8, int * len
return ret;
}
*/
*/
1 change: 0 additions & 1 deletion UTF8_files/main/UTF8Left.c
Expand Up @@ -58,7 +58,6 @@
*
*/


unsigned char * _UTF8_UTF8Left(struct UTF8IFace *Self,
unsigned char *UTF8, int _len, ULONG flags )
{
Expand Down
2 changes: 0 additions & 2 deletions UTF8_files/main/UTF8Merge.c
Expand Up @@ -60,8 +60,6 @@
*
*/



unsigned char * VARARGS68K _UTF8_UTF8Merge(struct UTF8IFace *Self,ULONG mem_flag, ...)
{
va_list list;
Expand Down
1 change: 0 additions & 1 deletion UTF8_files/main/UTF8casecmp.c
Expand Up @@ -64,7 +64,6 @@
*
*/


int _UTF8_UTF8CaseCmp(struct UTF8IFace *Self, unsigned char *UTF8_alphabet, unsigned char *UTF8_one, unsigned char *UTF8_two)
{
int pos_one =0, pos_two = 0, len;
Expand Down

0 comments on commit 71f08b3

Please sign in to comment.