mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-26 20:21:45 +00:00
Make the produced object file configurable...
at run time, from the command line.
This commit is contained in:
committed by
Olaf Seibert
parent
c80c87b2d4
commit
e2fb29e3f2
43
object.c
43
object.c
@@ -47,6 +47,8 @@ DAMAGE.
|
||||
#include "rad50.h"
|
||||
#include "object.h"
|
||||
|
||||
int rt11 = 0;
|
||||
|
||||
/*
|
||||
writerec writes "formatted binary records."
|
||||
Each is preceeded by any number of 0 bytes, begins with a 1,0 pair,
|
||||
@@ -66,24 +68,27 @@ static int writerec(
|
||||
int chksum; /* Checksum is negative sum of all
|
||||
bytes including header and length */
|
||||
int i;
|
||||
#if RT11
|
||||
unsigned hdrlen = len + 4;
|
||||
#else
|
||||
unsigned hdrlen = len;
|
||||
#endif
|
||||
unsigned hdrlen;
|
||||
|
||||
if (rt11) {
|
||||
hdrlen = len + 4;
|
||||
} else {
|
||||
hdrlen = len;
|
||||
}
|
||||
|
||||
if (fp == NULL)
|
||||
return 1; /* Silently ignore this attempt to write. */
|
||||
|
||||
chksum = 0;
|
||||
#if RT11
|
||||
if (fputc(FBR_LEAD1, fp) == EOF) /* All recs begin with 1,0 */
|
||||
return 0;
|
||||
chksum -= FBR_LEAD1;
|
||||
if (fputc(FBR_LEAD2, fp) == EOF)
|
||||
return 0;
|
||||
chksum -= FBR_LEAD2;
|
||||
#endif /* RT11 */
|
||||
|
||||
if (rt11) {
|
||||
if (fputc(FBR_LEAD1, fp) == EOF) /* All recs begin with 1,0 */
|
||||
return 0;
|
||||
chksum -= FBR_LEAD1;
|
||||
if (fputc(FBR_LEAD2, fp) == EOF)
|
||||
return 0;
|
||||
chksum -= FBR_LEAD2;
|
||||
} /* RT11 */
|
||||
|
||||
i = hdrlen & 0xff; /* length, lsb */
|
||||
chksum -= i;
|
||||
@@ -106,13 +111,13 @@ static int writerec(
|
||||
|
||||
chksum &= 0xff;
|
||||
|
||||
#if RT11
|
||||
fputc(chksum, fp); /* Followed by the checksum byte */
|
||||
#else /* RT11 */
|
||||
if (hdrlen & 1) {
|
||||
fputc(0, fp); /* Padding to even boundary */
|
||||
if (rt11) {
|
||||
fputc(chksum, fp); /* Followed by the checksum byte */
|
||||
} else { /* RT11 */
|
||||
if (hdrlen & 1) {
|
||||
fputc(0, fp); /* Padding to even boundary */
|
||||
}
|
||||
#endif /* RT11 */
|
||||
} /* RT11 */
|
||||
|
||||
return 1; /* Worked okay. */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user