Commit 752d038a authored by Stewart Brodie's avatar Stewart Brodie
Browse files

Changes to cstrong.c for UNIX compatibility.

  Switching macros inverted.
Detail:
  Tested.
Admin:
  Still works.


Version 6.22. Tagged as 'defmod-6_22'
parent 56c7f95f
/* (6.21)
/* (6.22)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 6.21
#define Module_MajorVersion_CMHG 6.22
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 06 Jun 2001
#define Module_Date_CMHG 07 Jun 2001
#define Module_MajorVersion "6.21"
#define Module_Version 621
#define Module_MajorVersion "6.22"
#define Module_Version 622
#define Module_MinorVersion ""
#define Module_Date "06 Jun 2001"
#define Module_Date "07 Jun 2001"
#define Module_ApplicationDate2 "06-Jun-01"
#define Module_ApplicationDate4 "06-Jun-2001"
#define Module_ApplicationDate2 "07-Jun-01"
#define Module_ApplicationDate4 "07-Jun-2001"
#define Module_ComponentName "defmod"
#define Module_ComponentPath "RiscOS/Tools/Sources/GNU/defmod"
#define Module_FullVersion "6.21"
#define Module_HelpVersion "6.21 (06 Jun 2001)"
#define Module_FullVersion "6.22"
#define Module_HelpVersion "6.22 (07 Jun 2001)"
......@@ -32,7 +32,12 @@
typedef struct {int cb [4];} messagetrans_control_block;
#ifdef EXECUTE_ON_RISCOS
#ifdef EXECUTE_ON_UNIX
extern void messagetrans_error_lookup(_kernel_oserror *, void *, _kernel_oserror *,
int, char *, char *, char *, char *);
#else /* EXECUTE_ON_UNIX */
#define xmessagetrans_file_info(file_name, flags, size) \
_swix (MessageTrans_FileInfo, _IN (1) | _OUT (0) | _OUT (2), \
......@@ -100,11 +105,6 @@ typedef struct {int cb [4];} messagetrans_control_block;
_swix (MessageTrans_CopyError, _IN (0) | _OUT (0), \
(os_error *) (error), (os_error **) (copy))
#else /* EXECUTE_ON_RISCOS */
extern void messagetrans_error_lookup(_kernel_oserror *, void *, _kernel_oserror *,
int, char *, char *, char *, char *);
#endif
#endif /* EXECUTE_ON_UNIX */
#endif
......@@ -130,7 +130,11 @@ typedef byte os_date_and_time [5];
#define os_GLOBAL_NO_ANY 9
#define os_GLOBAL_NO_MEM 49
#ifdef EXECUTE_ON_RISCOS
#ifdef EXECUTE_ON_UNIX
extern os_error *xos_pretty_print(char *, void *, void *);
#else /* EXECUTE_ON_UNIX */
#define xos_writec(c) \
_swix (OS_WriteC, _IN (0), (int) (c))
......@@ -600,10 +604,6 @@ typedef byte os_date_and_time [5];
#define xos_convert_file_size() \
_swix (OS_ConvertFileSize, )
#else /* EXECUTE_ON_RISCOS */
extern os_error *xos_pretty_print(char *, void *, void *);
#endif /* EXECUTE_ON_RISCOS */
#endif /* EXECUTE_ON_UNIX */
#endif
......@@ -95,7 +95,13 @@
#define osfile_TYPE(load_addr) ((load_addr & 0xFFF00000) == 0xFFF00000? \
(load_addr) >> 8 & 0xFFF: osfile_TYPE_UNTYPED)
#ifdef EXECUTE_ON_RISCOS
#ifdef EXECUTE_ON_UNIX
extern os_error *xosfile_create_dir(char *, int);
extern void osfile_create_dir(char *, int);
extern void os_generate_error(_kernel_oserror *);
#else /* EXECUTE_ON_UNIX */
#define xosfile_load(file_name, addr, load_addr, exec_addr, size, attr) \
_swix (OS_File, _IN (0) | _IN (1) | _IN (2) | _IN (3) | _OUT (2) | \
......@@ -183,13 +189,6 @@
#define xosfile_read_with_type_no_path() ...
#define xosfile_read_block_size() ...
#else /* EXECUTE_ON_RISCOS */
extern os_error *xosfile_create_dir(char *, int);
extern void osfile_create_dir(char *, int);
extern void os_generate_error(_kernel_oserror *);
#endif /* EXECUTE_ON_RISCOS */
#endif /* EXECUTE_ON_UNIX */
#endif
......@@ -36,7 +36,11 @@ typedef int territory_t;
#define territory_SYMBOL_DECIMAL_POINT 0
#ifdef EXECUTE_ON_RISCOS
#ifdef EXECUTE_ON_UNIX
/* No UNIX definitions required for this component */
#else /* EXECUTE_ON_UNIX */
#define xterritory_number() \
_swix (Territory_Number, )
......@@ -147,10 +151,6 @@ typedef int territory_t;
#define xterritory_convert_text_to_string() \
_swix (Territory_ConvertTextToString, )
#else /* EXECUTE_ON_RISCOS */
/* No UNIX definitions required for this component */
#endif /* EXECUTE_ON_RISCOS */
#endif /* EXECUTE_ON_UNIX */
#endif
......@@ -42,7 +42,7 @@ typedef unsigned char byte;
#define SIG_LIMIT 11 /*largest signal number + 1*/
#ifdef EXECUTE_ON_RISCOS
#ifndef EXECUTE_ON_UNIX
#ifndef __swis_h
#define _C (1U << 29)
#define _Z (1U << 30)
......
......@@ -6,7 +6,7 @@
.SUFFIXES: .o .c
CC = gcc
CFLAGS = -I. -DPACE_BUILD
CFLAGS = -I. -DPACE_BUILD -DUNIX -DEXECUTE_ON_UNIX
LD = gcc
LDFLAGS =
YACC = bison
......
......@@ -62,6 +62,12 @@
#define SWIS _swis
#define SEP "_"
#ifdef EXECUTE_ON_UNIX
# define DIRSEP "/"
#else
# define DIRSEP "."
#endif
/* type definitions */
/* global variables */
......@@ -150,13 +156,13 @@ static FILE *open_file( const char *path_name,
}
/* ensure the directory exists */
sprintf( data_name, "%s.%s" SEP, path_name, prefix );
sprintf( data_name, "%s" DIRSEP "%s" SEP, path_name, prefix );
tracef( "open_file - creating %s\n" _ data_name );
osfile_create_dir( data_name, 0 );
/* create the file */
sprintf( data_name,
"%s.%s" SEP ".%s",
"%s" DIRSEP "%s" SEP DIRSEP "%s",
path_name,
prefix,
suffix? suffix + 1 : name
......
......@@ -443,10 +443,10 @@ static int Emit_Get (FILE *file, char *name)
#elif 0 // And again 20000930
if ((rc = sprintf (s, "\"GET OSLib:Hdr.%s\"", name)) < 0)
#else
#ifdef EXECUTE_ON_RISCOS
if ((rc = sprintf (s, "\"GET OSLib:oslib.Hdr.%s\"", name)) < 0)
#else
#ifdef EXECUTE_ON_UNIX
if ((rc = sprintf (s, "\"GET oslib/Hdr/%s\"", name)) < 0)
#else
if ((rc = sprintf (s, "\"GET OSLib:oslib.Hdr.%s\"", name)) < 0)
#endif
#endif
goto finish;
......
......@@ -43,10 +43,10 @@
#define MEM_FOR_OBJASM (1024*1024)
#ifdef EXECUTE_ON_RISCOS
# define ASMCMD "ObjAsm"
#else
#ifdef EXECUTE_ON_UNIX
# define ASMCMD "armasm"
#else
# define ASMCMD "ObjAsm"
#endif
static char *Local;
......@@ -1002,7 +1002,7 @@ os_error *objasm_output
prefix_dir [len] = '\0';
#endif
#ifdef EXECUTE_ON_RISCOS
#ifndef EXECUTE_ON_UNIX
if ((via_file = fopen ("ViaFile", "w+")) == NULL)
{
error = (os_error*)_kernel_last_oserror ();
......@@ -1039,7 +1039,14 @@ os_error *objasm_output
if ((rc = sprintf (dir_name, "0x%.5X%s", s->swi & 0xDFFF0,
!nonx? "x": "")) < 0)
goto finish;
#ifdef EXECUTE_ON_RISCOS
#ifdef EXECUTE_ON_UNIX
if ((rc = sprintf (name1, "%s/%s.%.3d.s", output, dir_name,
count)) < 0)
goto finish;
if ((rc = sprintf (name2, "%s/%s.%.3d.o", output, dir_name,
count)) < 0)
goto finish;
#else
if ((rc = sprintf (name1, "%s.%s", output, dir_name)) < 0)
goto finish;
if ((error = xosfile_create_dir (name1, 0)) != NULL)
......@@ -1060,13 +1067,6 @@ os_error *objasm_output
if ((rc = sprintf (name2, "%s.%s.o.%.3d", output, dir_name,
count)) < 0)
goto finish;
#else
if ((rc = sprintf (name1, "%s/%s.%.3d.s", output, dir_name,
count)) < 0)
goto finish;
if ((rc = sprintf (name2, "%s/%s.%.3d.o", output, dir_name,
count)) < 0)
goto finish;
#endif
if ((object = fopen (name1, "w")) == NULL)
{
......
......@@ -1095,39 +1095,33 @@ int main (int argc, char *argv [])
else if (strcmp (argv [i], "-byte_wide") == 0)
{ /*Add the contents of the given file to the byte wide table.*/
char buffer [256], *cc;
#ifdef EXECUTE_ON_RISCOS
int f;
#else
#ifdef EXECUTE_ON_UNIX
FILE *f;
#else
int f;
#endif
enum {Copying, Skipping} state = Skipping;
bits psr;
i++;
#ifdef EXECUTE_ON_RISCOS
if ((error = xosfind_openin (osfind_NO_PATH |
osfind_ERROR_IF_DIR | osfind_ERROR_IF_ABSENT, argv [i], NULL,
&f)) != NULL)
goto finish;
#else
#ifdef EXECUTE_ON_UNIX
if ((f = fopen(argv[i],"r")) == NULL) {
error = _kernel_last_oserror();
goto finish;
}
#else
if ((error = xosfind_openin (osfind_NO_PATH |
osfind_ERROR_IF_DIR | osfind_ERROR_IF_ABSENT, argv [i], NULL,
&f)) != NULL)
goto finish;
#endif
cc = buffer;
do
{ int c;
#ifdef EXECUTE_ON_RISCOS
if ((error = xos_bget (f, &c, &psr)) != NULL)
goto finish; /*leaves the file open - who cares?*/
*cc = c; /*_swix idiocy*/
if ((psr & _C) != NONE) *cc = ' ';
#else
#ifdef EXECUTE_ON_UNIX
*cc = c = getc(f);
if (ferror(f)) {
error = _kernel_last_oserror();
......@@ -1135,6 +1129,12 @@ int main (int argc, char *argv [])
}
if (feof(f)) *cc = ' ';
#else
if ((error = xos_bget (f, &c, &psr)) != NULL)
goto finish; /*leaves the file open - who cares?*/
*cc = c; /*_swix idiocy*/
if ((psr & _C) != NONE) *cc = ' ';
#endif
switch (state)
......@@ -1162,14 +1162,14 @@ int main (int argc, char *argv [])
}
}
/* Loop termination condition depends on target ... */
#ifdef EXECUTE_ON_RISCOS
#ifdef EXECUTE_ON_UNIX
while (!feof(f));
(void) fclose(f);
#else
while ((psr & _C) == NONE);
if ((error = xosfind_close (f)) != NULL)
goto finish;
#else
while (!feof(f));
(void) fclose(f);
#endif
}
else if (strcmp (argv [i], "-26bit") == 0)
......
......@@ -180,7 +180,7 @@ static os_error *Lookup
is no territory. J R C 23rd Feb 1995*/
/*Second attempt: the first stupidly still kept the erorr return from
xterritory_collate() in |error|.*/
#ifdef EXECUTE_ON_RISCOS
#ifndef EXECUTE_ON_UNIX
if (xterritory_collate (territory_CURRENT, s, t->entries [i].token,
territory_IGNORE_CASE, &collate) != NULL)
#endif
......
/*riscos.c - useful functions for windowing applications*/
/*unix.c - emulation of some useful SWIs and functions*/
/*OSLib---efficient, type-safe, transparent, extensible,\n"
register-safe A P I coverage of RISC O S*/
......
......@@ -98,7 +98,7 @@ x_LOCAL_ERROR( Error_No_Memory, os_GLOBAL_NO_MEM, "NoMem" );
static int Signals [] = { SIGINT,
#ifdef EXECUTE_ON_RISCOS
#ifdef SIGSTAK
SIGSTAK,
#endif
SIGOSERROR };
......@@ -114,7 +114,7 @@ static os_error *Copy_Error (International_Error *ie)
every time a message is to be looked up, and the module only opens
the file at most once. We don't really care about this.*/
#ifdef EXECUTE_ON_RISCOS
#ifndef EXECUTE_ON_UNIX
if( xmessagetrans_open_file( &cb, "SharedCLibrary:Messages", NULL ) == NULL )
{
e = xmessagetrans_error_lookup( ie -> token,
......@@ -148,14 +148,14 @@ static void SigHandler( int iSignal )
switch( iSignal )
{
case SIGINT:
#ifdef EXECUTE_ON_RISCOS
pxError = xmessagetrans_error_lookup( Error_Escape, NULL, NULL, 0, SKIP, SKIP, SKIP, SKIP );
#else
#ifdef EXECUTE_ON_UNIX
pxError = Error_Escape;
#else
pxError = xmessagetrans_error_lookup( Error_Escape, NULL, NULL, 0, SKIP, SKIP, SKIP, SKIP );
#endif
break;
#if defined(SIGSTAK) && defined(EXECUTE_ON_RISCOS)
#ifdef SIGSTAK
case SIGSTAK:
pxError = Copy_Error( Error_Stack );
break;
......
......@@ -19,7 +19,9 @@
#define x_MAXDEPTH 256
//#define TRACE 0
#ifdef EXECUTE_ON_RISCOS
#ifdef EXECUTE_ON_UNIX
# define SIGOSERROR (SIGUSR1)
#else
/* the following signals are defined in CLib, but not in UNIXLib */
/* Stack overflow. */
# if !defined SIGSTAK
......@@ -29,8 +31,6 @@
# if !defined SIGOSERROR
# define SIGOSERROR 10
# endif
#else
# define SIGOSERROR (SIGUSR1)
#endif
typedef struct x_exception
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment