1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-14 00:32:08 +00:00

Fixed geos portion of Makefile

git-svn-id: svn://svn.cc65.org/cc65/trunk@780 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2001-07-14 14:41:30 +00:00
parent 49376daf0d
commit 5e14218975
2 changed files with 139 additions and 108 deletions

View File

@ -50,7 +50,7 @@ atarilib:
for i in atari common runtime conio dbg; do \ for i in atari common runtime conio dbg; do \
CC=$(CC) \ CC=$(CC) \
AS=$(AS) \ AS=$(AS) \
CFLAGS="-Osir -g -t atari -I../../include" \ CFLAGS="-Osir -g -t atari -I../../include" \
AFLAGS="-t atari" \ AFLAGS="-t atari" \
$(MAKE) -C $$i || exit 1; \ $(MAKE) -C $$i || exit 1; \
done done
@ -66,7 +66,7 @@ c64lib:
for i in c64 cbm common runtime conio dbg; do \ for i in c64 cbm common runtime conio dbg; do \
CC=$(CC) \ CC=$(CC) \
AS=$(AS) \ AS=$(AS) \
CFLAGS="-Osir -g -t c64 -I../../include" \ CFLAGS="-Osir -g -t c64 -I../../include" \
AFLAGS="-t c64" \ AFLAGS="-t c64" \
$(MAKE) -C $$i || exit 1; \ $(MAKE) -C $$i || exit 1; \
done done
@ -111,7 +111,13 @@ cbm610lib:
# GEOS on the C64/128 # GEOS on the C64/128
geoslib: geoslib:
for i in geos common runtime; do \ CC=$(CC) \
AS=../$(AS) \
AR=../$(AR) \
CFLAGS="-Osir -g -t geos -I../../include" \
AFLAGS="-t geos" \
$(MAKE) -C geos || exit 1
for i in common runtime; do \
CC=$(CC) \ CC=$(CC) \
AS=$(AS) \ AS=$(AS) \
AR=$(AR) \ AR=$(AR) \

View File

@ -19,26 +19,36 @@
/*****************************************************************************/ /*****************************************************************************/
/* SetJmp return codes */ /* SetJmp return codes */
/*****************************************************************************/ /*****************************************************************************/
#define RC_OK 0 /* Regular call */ #define RC_OK 0 /* Regular call */
#define RC_EOF 1 /* EOF reached */ #define RC_EOF 1 /* EOF reached */
#define RC_NOCONV 2 /* No conversion possible */ #define RC_NOCONV 2 /* No conversion possible */
/*****************************************************************************/ /*****************************************************************************/
/* Data */ /* Data */
/*****************************************************************************/ /*****************************************************************************/
static jmp_buf JumpBuf; /* Label that is used in case of EOF */ static struct indesc* D; /* Copy of function argument */
static char C; /* Character from input */ static va_list ap; /* Copy of function argument */
static unsigned Width; /* Maximum field width */ static jmp_buf JumpBuf; /* Label that is used in case of EOF */
static char C; /* Character from input */
static unsigned Width; /* Maximum field width */
static long IntVal; /* Converted int value */
static unsigned Conversions; /* Number of conversions */
/* Flags */
static unsigned char Positive; /* Flag for positive value */
static unsigned char NoAssign; /* Supppress assigment */
static unsigned char IsShort; /* Short type */
static unsigned char IsLong; /* Long type */
@ -54,39 +64,39 @@ static unsigned Width; /* Maximum field width */
static void ReadChar (struct indesc* d) static void ReadChar (void)
/* Get an input character, count characters */ /* Get an input character, count characters */
{ {
C = d->fin (d); C = D->fin (D);
++d->ccount; ++D->ccount;
} }
static void SkipWhite (struct indesc* d) static void SkipWhite (void)
/* Skip white space in the input and return the first non white character */ /* Skip white space in the input and return the first non white character */
{ {
while (isspace (C)) { while (isspace (C)) {
ReadChar (d); ReadChar ();
} }
} }
static unsigned char ReadSign (struct indesc* d) static void ReadSign (void)
/* Read an optional sign and skip it. Return 1 if the value is positive, /* Read an optional sign and skip it. Store 1 in Positive if the value is
* return 0 otherwise. * positive, store 0 otherwise.
*/ */
{ {
switch (C) { switch (C) {
case '-': case '-':
ReadChar (d); ReadChar ();
return 0; Positive = 0;
case '+': case '+':
ReadChar (d); ReadChar ();
/* FALLTHROUGH */ /* FALLTHROUGH */
default: default:
return 1; Positive = 1;
} }
} }
@ -105,51 +115,71 @@ static unsigned char HexVal (char C)
static unsigned long ReadInt (struct indesc* d, unsigned char Base) static void ReadInt (unsigned char Base)
/* Read an integer */ /* Read an integer and store it into IntVal */
{ {
unsigned long V = 0;
/* Value must start with a digit */ /* Value must start with a digit */
if (!isdigit (C)) { if (!isdigit (C)) {
longjmp (JumpBuf, RC_NOCONV); longjmp (JumpBuf, RC_NOCONV);
} }
/* Read the value */ /* Read the value */
IntVal = 0;
while (isxdigit (C) && Width-- > 0) { while (isxdigit (C) && Width-- > 0) {
printf ("ReadInt: '%c'\n", C); printf ("ReadInt: '%c'\n", C);
V = V * Base + HexVal (C); IntVal = IntVal * Base + HexVal (C);
ReadChar (d); ReadChar ();
} }
/* Return the read value */ /* One more conversion */
return V; ++Conversions;
} }
int _scanf (struct indesc* d, const char* format, va_list ap) static void AssignInt (void)
/* Assign the integer value in Val to the next argument. The function makes
* several non portable assumptions to reduce code size:
* - int and unsigned types have the same representation
* - short and int have the same representation.
* - all pointer types have the same representation.
*/
{
if (!NoAssign) {
/* Get the next argument pointer */
void* P = va_arg (ap, void*);
/* Assign to the converted value */
if (IsLong) {
*(long*)P = IntVal;
} else {
*(int*)P = (int) IntVal;
}
}
}
int _scanf (struct indesc* D_, const char* format, va_list ap_)
/* This is the routine used to do the actual work. It is called from several /* This is the routine used to do the actual work. It is called from several
* types of wrappers to implement the actual ISO xxscanf functions. * types of wrappers to implement the actual ISO xxscanf functions.
*/ */
{ {
unsigned Conversions; /* Number of conversions */ char F; /* Character from format string */
unsigned char Result; /* setjmp result */
char F; /* Character from format string */ char* S;
unsigned char NoAssign; /* Supppress assigment */ unsigned char Base; /* Integer base in %i */
unsigned char IsShort; /* Short type */
unsigned char IsLong; /* Long type */
unsigned char Positive; /* Flag for positive value */
unsigned char Result; /* setjmp result */
/* Variables that hold intermediate values */
void* P;
long L;
/* Place copies of the arguments into global variables. This is not very
* nice, but on a 6502 platform it gives better code, since the values
* do not have to be passed as parameters.
*/
D = D_;
ap = ap_;
/* Initialize variables */ /* Initialize variables */
Conversions = 0; Conversions = 0;
d->ccount = 0; D->ccount = 0;
/* Set up the jump label. The get() routine will use this label when EOF /* Set up the jump label. The get() routine will use this label when EOF
* is reached. * is reached.
@ -160,7 +190,7 @@ int _scanf (struct indesc* d, const char* format, va_list ap)
Again: Again:
/* Get the next input character */ /* Get the next input character */
ReadChar (d); ReadChar ();
/* Walk over the format string */ /* Walk over the format string */
while (F = *format++) { while (F = *format++) {
@ -180,7 +210,7 @@ Again:
* any amount of whitespace including none(!). So this * any amount of whitespace including none(!). So this
* match will never fail. * match will never fail.
*/ */
SkipWhite (d); SkipWhite ();
continue; continue;
} else if (F != C) { } else if (F != C) {
@ -235,80 +265,64 @@ FlagsDone:
printf ("F = '%c'\n", F); printf ("F = '%c'\n", F);
switch (F) { switch (F) {
case 'D': case 'D':
IsLong = 1; IsLong = 1;
case 'd': case 'd':
/* Optionally signed decimal integer */ /* Optionally signed decimal integer */
SkipWhite (d); SkipWhite ();
Positive = ReadSign (d); ReadSign ();
L = ReadInt (d, 10); ReadInt (10);
if (!Positive) { if (!Positive) {
L = -L; IntVal = -IntVal;
} }
if (!NoAssign) { AssignInt ();
/* All pointers have the same size, so save some break;
* code here.
*/
P = va_arg (ap, void*);
if (IsLong) {
*(long*)P = L;
} else {
*(int*)P = (int) L;
}
}
break;
case 'i': case 'i':
/* Optionally signed integer with a base */ /* Optionally signed integer with a base */
break; SkipWhite ();
ReadSign ();
if (C == '0') {
ReadChar ();
switch (C) {
case 'x':
case 'X':
Base = 16;
ReadChar();
break;
default:
Base = 8;
}
} else {
Base = 10;
}
ReadInt (Base);
if (!Positive) {
IntVal = -IntVal;
}
AssignInt ();
break;
case 'o': case 'o':
/* Unsigned octal integer */ /* Unsigned octal integer */
L = ReadInt (d, 8); SkipWhite ();
if (!NoAssign) { ReadInt (8);
/* All pointers have the same size, so save some AssignInt ();
* code here.
*/
P = va_arg (ap, void*);
if (IsLong) {
*(long*)P = L;
} else {
*(int*)P = (int) L;
}
}
break; break;
case 'u': case 'u':
/* Unsigned decimal integer */ /* Unsigned decimal integer */
L = ReadInt (d, 10); SkipWhite ();
if (!NoAssign) { ReadInt (10);
/* All pointers have the same size, so save some AssignInt ();
* code here.
*/
P = va_arg (ap, void*);
if (IsLong) {
*(long*)P = L;
} else {
*(int*)P = (int) L;
}
}
break; break;
case 'x': case 'x':
case 'X': case 'X':
/* Unsigned hexadecimal integer */ /* Unsigned hexadecimal integer */
L = ReadInt (d, 16); SkipWhite ();
if (!NoAssign) { ReadInt (16);
/* All pointers have the same size, so save some AssignInt ();
* code here.
*/
P = va_arg (ap, void*);
if (IsLong) {
*(long*)P = L;
} else {
*(int*)P = (int) L;
}
}
break; break;
case 'E': case 'E':
@ -320,6 +334,14 @@ FlagsDone:
case 's': case 's':
/* Whitespace terminated string */ /* Whitespace terminated string */
SkipWhite ();
S = NoAssign? 0 : va_arg (ap, char*);
while (C && !isspace (C) && Width--) {
if (S) {
*S++ = C;
}
ReadChar ();
}
break; break;
case 'c': case 'c':
@ -330,12 +352,15 @@ FlagsDone:
/* String using characters from a set */ /* String using characters from a set */
break; break;
case 'p': case 'p':
/* Pointer */ /* Pointer */
break; break;
case 'n': case 'n':
/* Store characters consumed so far */ /* Store characters consumed so far */
IntVal = D->ccount;
IsLong = 0;
AssignInt ();
break; break;
default: default:
@ -354,7 +379,7 @@ FlagsDone:
} else if (Result == RC_EOF) { } else if (Result == RC_EOF) {
/* Jump via JumpBuf means EOF on input */ /* Jump via JumpBuf means EOF on input */
if (d->ccount == 0) { if (D->ccount == 0) {
/* Special case: error */ /* Special case: error */
return -1; return -1;
} }