Removed (pretty inconsistently used) tab chars from source code base.

This commit is contained in:
Oliver Schmidt
2013-05-09 13:56:54 +02:00
parent 44fd1082ae
commit 85885001b1
1773 changed files with 62864 additions and 62868 deletions

View File

@@ -1,6 +1,6 @@
#define hash_hash # ## #
#define mkstr(a) # a
#define in_between(a) mkstr(a)
#define join(c, d) in_between(c hash_hash d)
#define hash_hash # ## #
#define mkstr(a) # a
#define in_between(a) mkstr(a)
#define join(c, d) in_between(c hash_hash d)
char p[] = join(x, y); // Comment
char p[] = join(x, y); // Comment

View File

@@ -1,17 +1,17 @@
#define x 3
#define f(a) f(x * (a))
#undef x
#define x 2
#define g f
#define z z[0]
#define h g(~
#define m(a) a(w)
#define w 0,1
#define t(a) a
#define p() int
#define q(x) x
#define r(x,y) x ## y
#define str(x) # x
#define x 3
#define f(a) f(x * (a))
#undef x
#define x 2
#define g f
#define z z[0]
#define h g(~
#define m(a) a(w)
#define w 0,1
#define t(a) a
#define p() int
#define q(x) x
#define r(x,y) x ## y
#define str(x) # x
f(y+1) + f(f(z)) % t(t(g) (0) + t)(1);
g(x+(3,4)-w) | h 5) & m(f)^m(m);

View File

@@ -1,16 +1,16 @@
#define str(s) # s
#define xstr(s) str(s)
#define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \
x ## s, x ## t)
#define INCFILE(n) vers ## n // Comment
#define glue(a,b) a ## b
#define xglue(a,b) glue(a,b)
#define HIGHLOW "hello"
#define LOW LOW ", world"
#define str(s) # s
#define xstr(s) str(s)
#define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \
x ## s, x ## t)
#define INCFILE(n) vers ## n // Comment
#define glue(a,b) a ## b
#define xglue(a,b) glue(a,b)
#define HIGHLOW "hello"
#define LOW LOW ", world"
debug (1, 2);
fputs (str (strncmp("abc\0d", "abc", '\4') // Comment
== 0) str (: @\n), s);
== 0) str (: @\n), s);
glue (HIGH, LOW);
xglue (HIGH, LOW);

View File

@@ -1,3 +1,3 @@
#define t(x,y,z) x ## y ## z
#define t(x,y,z) x ## y ## z
int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),
t(10,,), t(,11,), t(,,12), t(,,) };
t(10,,), t(,11,), t(,,12), t(,,) };

View File

@@ -1,3 +1,3 @@
#define t(x,y,z) x ## y ## z
int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),
t(10,,), t(,11,), t(,,12), t(,,) };
t(10,,), t(,11,), t(,,12), t(,,) };

View File

@@ -5,74 +5,74 @@
; include some GEOS defines
.include "../../libsrc/geos/inc/const.inc"
.include "../../libsrc/geos/inc/jumptab.inc"
.include "../../libsrc/geos/inc/geossym.inc"
.include "../../libsrc/geos/inc/geosmac.inc"
.include "../../libsrc/geos/inc/const.inc"
.include "../../libsrc/geos/inc/jumptab.inc"
.include "../../libsrc/geos/inc/geossym.inc"
.include "../../libsrc/geos/inc/geosmac.inc"
; import load addresses for all VLIR chains
; these labels are defined upon linking with ld65
.import __OVERLAYADDR__
.import __OVERLAYSIZE__
.import __OVERLAYADDR__
.import __OVERLAYSIZE__
; import names of functions defined (and exported) in each VLIR part
; of your application
; here I used an OVERLAYx_ prefix to prevent name clashes
.import OVERLAY1_Function1
.import OVERLAY2_Function1
.import OVERLAY1_Function1
.import OVERLAY2_Function1
; segments "STARTUP", "CODE", "DATA", "RODATA" and "BSS" all go to VLIR0 chain
.segment "STARTUP"
; code segment for VLIR 0 chain
.segment "STARTUP"
; code segment for VLIR 0 chain
ProgExec:
LoadW r0, paramString ; show something
jsr DoDlgBox
LoadW r0, paramString ; show something
jsr DoDlgBox
MoveW dirEntryBuf+OFF_DE_TR_SC, r1
LoadW r4, fileHeader
jsr GetBlock ; load back VLIR t&s table
bnex error
MoveW dirEntryBuf+OFF_DE_TR_SC, r1
LoadW r4, fileHeader
jsr GetBlock ; load back VLIR t&s table
bnex error
lda #1
jsr PointRecord ; we want next module (#1)
LoadW r2, __OVERLAYSIZE__ ; length - as many bytes as we have room for
LoadW r7, __OVERLAYADDR__ ; all VLIR segments have the same load address
jsr ReadRecord ; load it
bnex error
jsr OVERLAY1_Function1 ; execute something
lda #1
jsr PointRecord ; we want next module (#1)
LoadW r2, __OVERLAYSIZE__ ; length - as many bytes as we have room for
LoadW r7, __OVERLAYADDR__ ; all VLIR segments have the same load address
jsr ReadRecord ; load it
bnex error
jsr OVERLAY1_Function1 ; execute something
lda #2
jsr PointRecord ; next module
LoadW r2, __OVERLAYSIZE__
LoadW r7, __OVERLAYADDR__
jsr ReadRecord ; load it
bnex error
jsr OVERLAY2_Function1 ; execute something
lda #2
jsr PointRecord ; next module
LoadW r2, __OVERLAYSIZE__
LoadW r7, __OVERLAYADDR__
jsr ReadRecord ; load it
bnex error
jsr OVERLAY2_Function1 ; execute something
error: jmp EnterDeskTop ; end of application
error: jmp EnterDeskTop ; end of application
.segment "RODATA"
; read-only data segment
.segment "RODATA"
; read-only data segment
paramString:
.byte DEF_DB_POS | 1
.byte DBTXTSTR, TXT_LN_X, TXT_LN_2_Y
.word line1
.byte DBTXTSTR, TXT_LN_X, TXT_LN_3_Y
.word line2
.byte OK, DBI_X_0, DBI_Y_2
.byte NULL
.byte DEF_DB_POS | 1
.byte DBTXTSTR, TXT_LN_X, TXT_LN_2_Y
.word line1
.byte DBTXTSTR, TXT_LN_X, TXT_LN_3_Y
.word line2
.byte OK, DBI_X_0, DBI_Y_2
.byte NULL
line1: .byte BOLDON, "Hello World!",0
line2: .byte OUTLINEON,"Hello",PLAINTEXT," world!",0
line1: .byte BOLDON, "Hello World!",0
line2: .byte OUTLINEON,"Hello",PLAINTEXT," world!",0
.segment "DATA"
; read/write initialized data segment
.segment "DATA"
; read/write initialized data segment
counter: .word 0
.segment "BSS"
; read/write uninitialized data segment
; this space doesn't go into output file, only its size and
; position is remembered
.segment "BSS"
; read/write uninitialized data segment
; this space doesn't go into output file, only its size and
; position is remembered

View File

@@ -5,41 +5,41 @@
; include some GEOS defines
.include "../../libsrc/geos/inc/const.inc"
.include "../../libsrc/geos/inc/jumptab.inc"
.include "../../libsrc/geos/inc/geossym.inc"
.include "../../libsrc/geos/inc/geosmac.inc"
.include "../../libsrc/geos/inc/const.inc"
.include "../../libsrc/geos/inc/jumptab.inc"
.include "../../libsrc/geos/inc/geossym.inc"
.include "../../libsrc/geos/inc/geosmac.inc"
; export names of functions that will be used in the main program
.export OVERLAY1_Function1
.export OVERLAY1_Function2
.export OVERLAY1_Function1
.export OVERLAY1_Function2
; go into OVERLAY1 segment - everything that is here will go into
; VLIR chain #1
.segment "OVERLAY1"
.segment "OVERLAY1"
OVERLAY1_Function1: jmp Function1 ; jump table, not really necessary
OVERLAY1_Function2: jmp Function2
; etc.
OVERLAY1_Function1: jmp Function1 ; jump table, not really necessary
OVERLAY1_Function2: jmp Function2
; etc.
; rodata - if this is defined in .segment "RODATA"
; it will end up in the VLIR0 part, you don't want that
paramString:
.byte DEF_DB_POS | 1
.byte DBTXTSTR, TXT_LN_X, TXT_LN_2_Y
.word line1
.byte DBTXTSTR, TXT_LN_X, TXT_LN_3_Y
.word line2
.byte OK, DBI_X_0, DBI_Y_2
.byte NULL
.byte DEF_DB_POS | 1
.byte DBTXTSTR, TXT_LN_X, TXT_LN_2_Y
.word line1
.byte DBTXTSTR, TXT_LN_X, TXT_LN_3_Y
.word line2
.byte OK, DBI_X_0, DBI_Y_2
.byte NULL
line1: .byte "This is in module 1",0
line2: .byte "This is in module 1",0
line1: .byte "This is in module 1",0
line2: .byte "This is in module 1",0
; code
Function1: LoadW r0, paramString
jsr DoDlgBox
Function2: rts
Function1: LoadW r0, paramString
jsr DoDlgBox
Function2: rts

View File

@@ -5,32 +5,32 @@
; similar to vlir1.s except the fact that this is chain #2
.include "../../libsrc/geos/inc/const.inc"
.include "../../libsrc/geos/inc/jumptab.inc"
.include "../../libsrc/geos/inc/geossym.inc"
.include "../../libsrc/geos/inc/geosmac.inc"
.include "../../libsrc/geos/inc/const.inc"
.include "../../libsrc/geos/inc/jumptab.inc"
.include "../../libsrc/geos/inc/geossym.inc"
.include "../../libsrc/geos/inc/geosmac.inc"
.export OVERLAY2_Function1
.export OVERLAY2_Function2
.export OVERLAY2_Function1
.export OVERLAY2_Function2
.segment "OVERLAY2"
.segment "OVERLAY2"
OVERLAY2_Function1: jmp Function1
OVERLAY2_Function2: jmp Function2
; etc.
OVERLAY2_Function1: jmp Function1
OVERLAY2_Function2: jmp Function2
; etc.
paramString:
.byte DEF_DB_POS | 1
.byte DBTXTSTR, TXT_LN_X, TXT_LN_2_Y
.word line1
.byte DBTXTSTR, TXT_LN_X, TXT_LN_3_Y
.word line2
.byte OK, DBI_X_0, DBI_Y_2
.byte NULL
.byte DEF_DB_POS | 1
.byte DBTXTSTR, TXT_LN_X, TXT_LN_2_Y
.word line1
.byte DBTXTSTR, TXT_LN_X, TXT_LN_3_Y
.word line2
.byte OK, DBI_X_0, DBI_Y_2
.byte NULL
Function2: LoadW r0, paramString
jsr DoDlgBox
Function1: rts
Function2: LoadW r0, paramString
jsr DoDlgBox
Function1: rts
line1: .byte "This is in module 2",0
line2: .byte "This is in module 2",0
line1: .byte "This is in module 2",0
line2: .byte "This is in module 2",0

View File

@@ -12,7 +12,7 @@ extern char _defdev[];
int main(void)
{
printf("default device: %s\n", _defdev);
if (_dos_type != SPARTADOS && _dos_type != OSADOS) cgetc();
return 0;
printf("default device: %s\n", _defdev);
if (_dos_type != SPARTADOS && _dos_type != OSADOS) cgetc();
return 0;
}

View File

@@ -3,56 +3,56 @@
; scrcode macro test
;
; compile with
; ca65 -I../../../asminc -tatari -o scrcode.o scrcode.s
; ld65 -tatari -o scrcode.com scrcode.o
; ca65 -I../../../asminc -tatari -o scrcode.o scrcode.s
; ld65 -tatari -o scrcode.com scrcode.o
.import __CODE_LOAD__, __BSS_LOAD__
.import __CODE_LOAD__, __BSS_LOAD__
.include "atari.inc"
.macpack atari
.include "atari.inc"
.macpack atari
.code
rts ; SpartaDOS workaround
rts ; SpartaDOS workaround
; entry point
lda #0
tay
tax
lda #0
tay
tax
; display dispdata
disp: lda dispdata,x
sta (SAVMSC),y
inx
iny
cpx #disp_len
bne disp
disp: lda dispdata,x
sta (SAVMSC),y
inx
iny
cpx #disp_len
bne disp
; wait for key press
key: lda CH
cmp #255
beq key
key: lda CH
cmp #255
beq key
rts
rts
.data
dispdata: scrcode "fooBa", 'r', $66, 3+4
disp_len = * - dispdata
dispdata: scrcode "fooBa", 'r', $66, 3+4
disp_len = * - dispdata
.segment "AUTOSTRT"
.segment "AUTOSTRT"
.word $02E0
.word $02E1
.word __CODE_LOAD__+1
.word $02E0
.word $02E1
.word __CODE_LOAD__+1
.segment "EXEHDR"
.segment "EXEHDR"
.word $FFFF
.word __CODE_LOAD__
.word __BSS_LOAD__ - 1
.word $FFFF
.word __CODE_LOAD__
.word __BSS_LOAD__ - 1
.end

View File

@@ -25,14 +25,14 @@
int main(void)
{
clrscr();
cprintf("12345\n");
cprintf("67890\n");
gotoxy(0,4);
cprintf("12345\r");
cprintf("67890\r");
printf("\n\n");
printf("hit return to exit....\n");
fgetc(stdin);
return(0);
clrscr();
cprintf("12345\n");
cprintf("67890\n");
gotoxy(0,4);
cprintf("12345\r");
cprintf("67890\r");
printf("\n\n");
printf("hit return to exit....\n");
fgetc(stdin);
return(0);
}

View File

@@ -18,32 +18,32 @@
int main(void)
{
char c;
char c;
NEWLINE;
cursor (1);
PRINTF("enter key (cursor on): ");
c = cgetc();
PRINTF("enter key (cursor on): ");
c = cgetc();
NEWLINE;
cursor (0);
PRINTF("enter key (cursor off): ");
c = cgetc();
PRINTF("enter key (cursor off): ");
c = cgetc();
NEWLINE;
PRINTF("enter key (cursor on): ");
PRINTF("enter key (cursor on): ");
cursor (1);
c = cgetc();
c = cgetc();
NEWLINE;
PRINTF("enter key (cursor off): ");
PRINTF("enter key (cursor off): ");
cursor (0);
c = cgetc();
c = cgetc();
NEWLINE;
PRINTF("hit any key to exit...");
c = cgetc();
NEWLINE;
return(0);
return(0);
}

View File

@@ -1,17 +1,17 @@
/*
first test for posix directory routines for the c64
kludges:
- currently uses cbm_open, which conflicts with standard i/o,
which in turn makes it infact kindof unuseable. this can
be easily changed however, since the only reason not to use
open/read was that it currently appends ,u,r to filenames
- the offset in current dir stream should better be calculated
from the values returned by "read".
- the type flag isnt filled in atm.
- scandir/alphasort/versionsort is missing
- some bits are currently untested (ie, unused in the testprogram)
27/02/2003 gpz
first test for posix directory routines for the c64
kludges:
- currently uses cbm_open, which conflicts with standard i/o,
which in turn makes it infact kindof unuseable. this can
be easily changed however, since the only reason not to use
open/read was that it currently appends ,u,r to filenames
- the offset in current dir stream should better be calculated
from the values returned by "read".
- the type flag isnt filled in atm.
- scandir/alphasort/versionsort is missing
- some bits are currently untested (ie, unused in the testprogram)
27/02/2003 gpz
*/
#include <stdio.h>

View File

@@ -11,30 +11,30 @@
#include <stdbool.h>
static bool test(int dividend, int divisor) {
div_t result;
div_t result;
result = div(dividend, divisor);
printf("%+d/%+d= %+d, %+d%%%+d= %+d, div()= %+d, %+d\n",
dividend, divisor, dividend / divisor,
dividend, divisor, dividend % divisor,
result.quot, result.rem);
return result.quot * divisor + result.rem != dividend;
}
result = div(dividend, divisor);
printf("%+d/%+d= %+d, %+d%%%+d= %+d, div()= %+d, %+d\n",
dividend, divisor, dividend / divisor,
dividend, divisor, dividend % divisor,
result.quot, result.rem);
return result.quot * divisor + result.rem != dividend;
}
int main(void) {
bool t;
bool t;
printf("\nTest of division and modulus operations:\n\n");
t = test(+40, +3) ||
test(+40, -3) ||
test(-40, +3) ||
test(-40, -3);
if (t)
printf("\nThe div() function made a wrong result!\n");
printf("\nTest of division and modulus operations:\n\n");
t = test(+40, +3) ||
test(+40, -3) ||
test(-40, +3) ||
test(-40, -3);
if (t)
printf("\nThe div() function made a wrong result!\n");
#ifdef __ATARI__
/* Atari DOS 2 clears the screen after program-termination, so wait. */
printf("\nTap a key, to exit. ");
getchar();
/* Atari DOS 2 clears the screen after program-termination, so wait. */
printf("\nTap a key, to exit. ");
getchar();
#endif
return (int)t;
}
return (int)t;
}

View File

@@ -11,17 +11,17 @@
#elif defined(__C128__)
#define DRIVERNAME "c128-ram.emd"
#elif defined(__C16__)
#define DRIVERNAME "c16-ram.emd"
#define DRIVERNAME "c16-ram.emd"
#elif defined(__CBM510__)
#define DRIVERNAME "cbm510-ram.emd"
#define DRIVERNAME "cbm510-ram.emd"
#elif defined(__CBM610__)
#define DRIVERNAME "cbm610-ram.emd"
#define DRIVERNAME "cbm610-ram.emd"
#elif defined(__APPLE2__)
#define DRIVERNAME "a2.auxmem.emd"
#define DRIVERNAME "a2.auxmem.emd"
#elif defined(__APPLE2ENH__)
#define DRIVERNAME "a2e.auxmem.emd"
#define DRIVERNAME "a2e.auxmem.emd"
#else
#define DRIVERNAME "unknown"
#define DRIVERNAME "unknown"
#error "Unknown target system"
#endif
@@ -82,9 +82,9 @@ int main (void)
clrscr ();
Res = em_load_driver (DRIVERNAME);
if (Res != EM_ERR_OK) {
cprintf ("Error in em_load_driver: %u\r\n", Res);
cprintf ("Error in em_load_driver: %u\r\n", Res);
cprintf ("os: %u, %s\r\n", _oserror, _stroserror (_oserror));
exit (EXIT_FAILURE);
exit (EXIT_FAILURE);
}
atexit (cleanup);

View File

@@ -1,12 +1,12 @@
.export _getsp
.importzp sp
.export _getsp
.importzp sp
.proc _getsp
.proc _getsp
ldx sp+1
lda sp
rts
ldx sp+1
lda sp
rts
.endproc

View File

@@ -23,10 +23,10 @@ static char* Alloc (void)
* also allow us to retrieve it later.
*/
if (P) {
memset (P, Size, Size);
memset (P, Size, Size);
} else {
printf ("Could not allocate %u bytes\n", Size);
exit (EXIT_FAILURE);
printf ("Could not allocate %u bytes\n", Size);
exit (EXIT_FAILURE);
}
return P;
}
@@ -43,11 +43,11 @@ static void Free (unsigned char* P)
/* Scan the block */
for (I = 1; I < Size; ++I) {
if (P[I] != Size) {
printf ("Scan failed - expected %02X, got %02X\n",
Size, P[I]);
exit (EXIT_FAILURE);
}
if (P[I] != Size) {
printf ("Scan failed - expected %02X, got %02X\n",
Size, P[I]);
exit (EXIT_FAILURE);
}
}
/* Free the block */
@@ -61,8 +61,8 @@ static void FillArray (void)
{
unsigned char I = 0;
do {
V[I] = Alloc ();
++I;
V[I] = Alloc ();
++I;
} while (I != 0);
}
@@ -75,20 +75,20 @@ static void ShowInfo (void)
unsigned Count = 0;
register struct freeblock* P = _heapfirst;
while (P) {
++Count;
P = P->next;
++Count;
P = P->next;
}
printf ("%04X %04X %04X %04X %04X %u\n",
_heaporg, _heapptr, _heapend, _heapfirst, _heaplast, Count);
_heaporg, _heapptr, _heapend, _heapfirst, _heaplast, Count);
if (Count) {
P = _heapfirst;
while (P) {
printf ("%04X %04X %04X %04X(%u)\n",
(unsigned) P, P[2], P[1], P[0], P[0]);
P = P->next;
}
getchar ();
P = _heapfirst;
while (P) {
printf ("%04X %04X %04X %04X(%u)\n",
(unsigned) P, P[2], P[1], P[0], P[0]);
P = P->next;
}
getchar ();
}
}
@@ -99,8 +99,8 @@ static void Test1 (void)
unsigned char I;
FillArray ();
for (I = 0; I < 0x80; ++I) {
Free (V[0x7F-I]);
Free (V[0x80+I]);
Free (V[0x7F-I]);
Free (V[0x80+I]);
}
ShowInfo ();
}
@@ -113,8 +113,8 @@ static void Test2 (void)
FillArray ();
I = 0;
do {
Free (V[I]);
++I;
Free (V[I]);
++I;
} while (I != 0);
ShowInfo ();
}
@@ -127,8 +127,8 @@ static void Test3 (void)
FillArray ();
I = 0;
do {
--I;
Free (V[I]);
--I;
Free (V[I]);
} while (I != 0);
ShowInfo ();
}
@@ -141,13 +141,13 @@ static void Test4 (void)
FillArray ();
I = 0;
do {
Free (V[I]);
I += 2;
Free (V[I]);
I += 2;
} while (I != 0);
I = 1;
do {
Free (V[I]);
I += 2;
Free (V[I]);
I += 2;
} while (I != 1);
ShowInfo ();
}
@@ -160,26 +160,26 @@ static void Test5 (void)
FillArray ();
I = 0;
do {
Free (V[I]);
I += 2;
Free (V[I]);
I += 2;
} while (I != 0);
do {
V[I] = Alloc ();
I += 2;
V[I] = Alloc ();
I += 2;
} while (I != 0);
I = 1;
do {
Free (V[I]);
I += 2;
Free (V[I]);
I += 2;
} while (I != 1);
do {
V[I] = Alloc ();
I += 2;
V[I] = Alloc ();
I += 2;
} while (I != 1);
I = 0;
do {
Free (V[I]);
++I;
Free (V[I]);
++I;
} while (I != 0);
ShowInfo ();
}
@@ -192,16 +192,16 @@ static void Test6 (void)
FillArray ();
I = J = 0;
do {
do {
Free (V[I]);
V[I] = Alloc ();
++I;
} while (I != 0);
++J;
do {
Free (V[I]);
V[I] = Alloc ();
++I;
} while (I != 0);
++J;
} while (J < 5);
do {
Free (V[I]);
++I;
Free (V[I]);
++I;
} while (I != 0);
ShowInfo ();
}

View File

@@ -19,27 +19,27 @@ int main (void)
unsigned char Res = joy_load_driver (joy_stddrv);
#endif
if (Res != JOY_ERR_OK) {
cprintf ("Error in joy_load_driver: %u\r\n", Res);
cprintf ("Error in joy_load_driver: %u\r\n", Res);
cprintf ("os: %u, %s\r\n", _oserror, _stroserror (_oserror));
exit (EXIT_FAILURE);
exit (EXIT_FAILURE);
}
clrscr ();
count = joy_count ();
cprintf ("Driver supports %d joystick(s)", count);
while (1) {
for (i = 0; i < count; ++i) {
gotoxy (0, i+1);
j = joy_read (i);
cprintf ("%2d: %-6s%-6s%-6s%-6s%-6s%-6s",
i,
(j & joy_masks[JOY_UP])? " up " : " ---- ",
(j & joy_masks[JOY_DOWN])? " down " : " ---- ",
(j & joy_masks[JOY_LEFT])? " left " : " ---- ",
(j & joy_masks[JOY_RIGHT])? "right " : " ---- ",
(j & joy_masks[JOY_FIRE])? " fire " : " ---- ",
(j & joy_masks[JOY_FIRE2])? "fire2 " : " ---- ");
}
for (i = 0; i < count; ++i) {
gotoxy (0, i+1);
j = joy_read (i);
cprintf ("%2d: %-6s%-6s%-6s%-6s%-6s%-6s",
i,
(j & joy_masks[JOY_UP])? " up " : " ---- ",
(j & joy_masks[JOY_DOWN])? " down " : " ---- ",
(j & joy_masks[JOY_LEFT])? " left " : " ---- ",
(j & joy_masks[JOY_RIGHT])? "right " : " ---- ",
(j & joy_masks[JOY_FIRE])? " fire " : " ---- ",
(j & joy_masks[JOY_FIRE2])? "fire2 " : " ---- ");
}
}
return 0;
}

View File

@@ -101,7 +101,7 @@ int main(void)
** (And, run emulators at their maximun speed.)
*/
#if 0
continue;
continue;
#endif
/* Do one row of tests */
@@ -130,9 +130,9 @@ int main(void)
}
}
if (kbhit () && toupper (cgetc ()) == 'Q') {
goto Done;
}
if (kbhit () && toupper (cgetc ()) == 'Q') {
goto Done;
}
res += lhs;
} while (++rhs != 0);
@@ -164,8 +164,8 @@ Done:
#ifdef __ATARI__
if (_dos_type != SPARTADOS && _dos_type != OSADOS) {
cprintf ("\rTap a key, to exit. ");
cgetc();
cprintf ("\rTap a key, to exit. ");
cgetc();
}
#endif
return 0;

View File

@@ -20,36 +20,36 @@ int main(void)
/* Generate two temporary file-names that have a random, unused spelling. */
_randomize();
for (;;) {
r = rand();
sprintf(name1, "r%04.4u.1", (unsigned)r);
sprintf(name2, "r%04.4u.2", (unsigned)r);
r = rand();
sprintf(name1, "r%04.4u.1", (unsigned)r);
sprintf(name2, "r%04.4u.2", (unsigned)r);
/* Ensure that neither file-name exists. */
errno = 0;
file = fopen(name1, "r");
if (file != NULL) {
fclose(file);
continue; /* try a different spelling */
}
/* Ensure that neither file-name exists. */
errno = 0;
file = fopen(name1, "r");
if (file != NULL) {
fclose(file);
continue; /* try a different spelling */
}
/* Make sure that fopen() failed for the right reason. */
if (errno != ENOENT) {
perror("Disk error with first name");
return EXIT_FAILURE;
}
/* Make sure that fopen() failed for the right reason. */
if (errno != ENOENT) {
perror("Disk error with first name");
return EXIT_FAILURE;
}
errno = 0;
file = fopen(name2, "r");
if (file != NULL) {
fclose(file);
continue;
}
if (errno != ENOENT) {
perror("Disk error with second name");
return EXIT_FAILURE;
}
errno = 0;
file = fopen(name2, "r");
if (file != NULL) {
fclose(file);
continue;
}
if (errno != ENOENT) {
perror("Disk error with second name");
return EXIT_FAILURE;
}
break; /* neither one exists; do next step */
break; /* neither one exists; do next step */
}
/* Create the first file.
@@ -58,16 +58,16 @@ int main(void)
printf("Creating file: %s\n", name1);
file = fopen(name1, "w");
if (file == NULL) {
_poserror("Disk error making first file");
return EXIT_FAILURE;
_poserror("Disk error making first file");
return EXIT_FAILURE;
}
fclose(file);
/* Verify that the file-name exists now. */
file = fopen(name1, "r");
if (file == NULL) {
_poserror("Cannot find first name");
return EXIT_FAILURE;
_poserror("Cannot find first name");
return EXIT_FAILURE;
}
fclose(file);
@@ -78,23 +78,23 @@ int main(void)
printf("Renaming %s to %s\n", name1, name2);
r = rename(name1, name2);
if (r < 0) {
_poserror("rename() failed");
return EXIT_FAILURE;
_poserror("rename() failed");
return EXIT_FAILURE;
}
/* Verify that the first file-name no longer exists. */
file = fopen(name1, "r");
if (file != NULL) {
fclose(file);
_poserror("First name still exists");
return EXIT_FAILURE;
fclose(file);
_poserror("First name still exists");
return EXIT_FAILURE;
}
/* Verify that the second file-name exists now. */
file = fopen(name2, "r");
if (file == NULL) {
_poserror("Cannot find second name");
return EXIT_FAILURE;
_poserror("Cannot find second name");
return EXIT_FAILURE;
}
fclose(file);
@@ -104,8 +104,8 @@ int main(void)
printf("Removing %s\n", name2);
r = remove(name2);
if (r < 0) {
_poserror("remove() failed");
return EXIT_FAILURE;
_poserror("remove() failed");
return EXIT_FAILURE;
}
printf("rename() passed the test.\n");

View File

@@ -209,7 +209,7 @@ int main(void) {
"\tto the first argument.\r\n\n",
t + 1, n1, test_data[t].v1.nvalue);
}
else { /* test_data[t].type1 == CHAR */
else { /* test_data[t].type1 == CHAR */
if (strcmp(test_data[t].v1.svalue, s1))
PRINTF("Test #%u assigned\r\n\"%s\",\r\n"
"\tinstead of\r\n\"%s\",\r\n"
@@ -223,7 +223,7 @@ int main(void) {
"\tto the second argument.\r\n\n",
t + 1, n2, test_data[t].v2.nvalue);
}
else { /* test_data[t].type2 == CHAR */
else { /* test_data[t].type2 == CHAR */
if (strcmp(test_data[t].v2.svalue, s2))
PRINTF("Test #%u assigned\r\n\"%s\",\r\n"
"\tinstead of\r\n\"%s\",\r\n"
@@ -249,8 +249,8 @@ int main(void) {
*/
PRINTF("Testing \"%%p\"...\r\n");
sprintf(s1, "%p %p %p %p", NULL, NULL,
Pause, /* static (program) storage */
&c); /* automatic (stack) storage */
Pause, /* static (program) storage */
&c); /* automatic (stack) storage */
sscanf(s1, "%p%p%p %p", &p1, &p2, &p3, &p4);
if (p1 != NULL || p2 != NULL ||
p3 != (void *)Pause || p4 != (void *)&c)

View File

@@ -10,15 +10,15 @@
#elif defined(__C128__)
#define DRIVERNAME "c128-swlink.ser"
#elif defined(__PLUS4__)
#define DRIVERNAME "plus4-stdser.ser"
#define DRIVERNAME "plus4-stdser.ser"
#elif defined(__CBM610__)
#define DRIVERNAME "cbm610-std.ser"
#define DRIVERNAME "cbm610-std.ser"
#elif defined(__APPLE2__)
#define DRIVERNAME "a2.ssc.ser"
#define DRIVERNAME "a2.ssc.ser"
#elif defined(__APPLE2ENH__)
#define DRIVERNAME "a2e.ssc.ser"
#define DRIVERNAME "a2e.ssc.ser"
#else
#define DRIVERNAME "unknown"
#define DRIVERNAME "unknown"
#error "Unknown target system"
#endif

View File

@@ -3,7 +3,7 @@
#include <string.h>
/* Test string. Must NOT have duplicate characters! */
static char S[] = "Helo wrd!\n";
@@ -26,28 +26,28 @@ int main (void)
/* Search for all characters in the string, including the terminator */
for (I = 0; I < Len+1; ++I) {
/* Search for this char */
P = strchr (S, S[I]);
/* Search for this char */
P = strchr (S, S[I]);
/* Check if we found it */
if (P == 0 || (P - S) != I) {
printf ("Failed for code 0x%02X, offset %u!\n", S[I], I);
printf ("P = %04X offset = %04X\n", P, P-S);
exit (EXIT_FAILURE);
}
/* Check if we found it */
if (P == 0 || (P - S) != I) {
printf ("Failed for code 0x%02X, offset %u!\n", S[I], I);
printf ("P = %04X offset = %04X\n", P, P-S);
exit (EXIT_FAILURE);
}
/* Mark the char as checked */
Found[S[I]] = 1;
/* Mark the char as checked */
Found[S[I]] = 1;
}
/* Search for all other characters and make sure they aren't found */
for (I = 0; I < 256; ++I) {
if (Found[I] == 0) {
if (strchr (S, (char)I) != 0) {
printf ("Failed for code 0x%02X\n", I);
exit (EXIT_FAILURE);
}
}
if (Found[I] == 0) {
if (strchr (S, (char)I) != 0) {
printf ("Failed for code 0x%02X\n", I);
exit (EXIT_FAILURE);
}
}
}
/* Test passed */

View File

@@ -5,11 +5,11 @@
/* From _heap.h */
extern unsigned _horg; /* Bottom of heap */
extern unsigned _hptr; /* Current top */
extern unsigned _hend; /* Upper limit */
extern unsigned _hfirst; /* First free block in list */
extern unsigned _hlast; /* Last free block in list */
extern unsigned _horg; /* Bottom of heap */
extern unsigned _hptr; /* Current top */
extern unsigned _hend; /* Upper limit */
extern unsigned _hfirst; /* First free block in list */
extern unsigned _hlast; /* Last free block in list */
static unsigned char* V[256];
@@ -23,20 +23,20 @@ static void ShowInfo (void)
unsigned Count = 0;
unsigned** P = (unsigned**) _hfirst;
while (P) {
++Count;
P = P[1];
++Count;
P = P[1];
}
printf ("%04X %04X %04X %04X %04X %u\n",
_horg, _hptr, _hend, _hfirst, _hlast, Count);
_horg, _hptr, _hend, _hfirst, _hlast, Count);
if (Count) {
P = (unsigned**) _hfirst;
while (P) {
printf ("%04X %04X %04X %04X(%u)\n",
(unsigned) P, P[2], P[1], P[0], P[0]);
P = P[1];
}
getchar ();
P = (unsigned**) _hfirst;
while (P) {
printf ("%04X %04X %04X %04X(%u)\n",
(unsigned) P, P[2], P[1], P[0], P[0]);
P = P[1];
}
getchar ();
}
}
@@ -51,10 +51,10 @@ static const char* RandStr (void)
char C;
for (I = 0; I < Len; ++I) {
do {
C = rand() & 0xFF;
} while (C == 0);
S[I] = C;
do {
C = rand() & 0xFF;
} while (C == 0);
S[I] = C;
}
S[Len] = '\0';
@@ -68,8 +68,8 @@ static void FillArray (void)
{
unsigned char I = 0;
do {
V[I] = strdup (RandStr ());
++I;
V[I] = strdup (RandStr ());
++I;
} while (I != 0);
}
@@ -80,8 +80,8 @@ static void FreeArray (void)
{
unsigned char I = 0;
do {
free (V[I]);
++I;
free (V[I]);
++I;
} while (I != 0);
}

View File

@@ -17,7 +17,7 @@ int main (void)
{
char I;
for (I = 0; I < 20; ++I) {
printf ("%02d: %d\n", I, strncmp (S1, S2, I));
printf ("%02d: %d\n", I, strncmp (S1, S2, I));
}
return 0;
}