muta...@gmail.com
2021-04-03 05:52:00 UTC
Hi Alexey.
I had another crack at using Smaller C to build
PDOS, and after rebuilding (with Borland C) with
larger defines, I was able to get past all the
constraints. There was just one place that took
quite a while to figure out. I'm not used to
debugging at that level.
If you look here:
C:\devel\pdos\src>smlrpp -o temp.e temp.c
C:\devel\pdos\src>type temp.c
fatfile->lastBytes = (unsigned int)
(fatfile->fileSize
% ((unsigned long)fat->sectors_per_cluster
* (unsigned long)fat->sector_size));
C:\devel\pdos\src>type temp.e
#line 1 "temp.c"
fatfile->lastBytes = (unsigned int)
(fatfile->fileSize
((unsigned long)fat->sectors_per_cluster
* (unsigned long)fat->sector_size));
You can see the "%" has disappeared. All the
preprocessor needed to do was copy input to
output, instead of mangling it. I was previously
compiling with Cygwin gcc (just by running
"make"), but I switched to Borland C to see if
it was a compiler issue.
bcc32 -DSTAND_ALONE -DSTD_MACROS=0 -DSTD_ASSERT=0 -DUCPP_CONFIG cpp.c mem.c nhash.c lexer.c assert.c macro.c eval.c arith.c
But it had the same issue. I took a look at lexer.c
and it was way too complicated for me to understand.
But I actually have another preprocessor-only program,
which is public domain, so I switched to that. That
showed an unrelated problem with the PD version, so I
have asked the author to see if he can fix that.
I used this for Smaller C BTW:
bcc32 -DMAX_IDENT_TABLE_LEN=20000 -DSYNTAX_STACK_MAX=10000 -DSTACK_SIZE=500 smlrc.c
Anyway, with all that done, the only thing that
Smaller C can't cope with is some floating point
stuff in PDPCLIB.
One of them is this:
smlrc -huge -I . math.e math.s
Error in "math.c" (720:18)
Compound assignment not supported with floats
I simplified it to:
__PDPCLIB_API__ double modf(double value, double *iptr)
value -= 5.0;
If I change that to:
value = value - 5.0;
it is accepted. Is the original syntax difficult to support?
Thanks. Paul.
I had another crack at using Smaller C to build
PDOS, and after rebuilding (with Borland C) with
larger defines, I was able to get past all the
constraints. There was just one place that took
quite a while to figure out. I'm not used to
debugging at that level.
If you look here:
C:\devel\pdos\src>smlrpp -o temp.e temp.c
C:\devel\pdos\src>type temp.c
fatfile->lastBytes = (unsigned int)
(fatfile->fileSize
% ((unsigned long)fat->sectors_per_cluster
* (unsigned long)fat->sector_size));
C:\devel\pdos\src>type temp.e
#line 1 "temp.c"
fatfile->lastBytes = (unsigned int)
(fatfile->fileSize
((unsigned long)fat->sectors_per_cluster
* (unsigned long)fat->sector_size));
You can see the "%" has disappeared. All the
preprocessor needed to do was copy input to
output, instead of mangling it. I was previously
compiling with Cygwin gcc (just by running
"make"), but I switched to Borland C to see if
it was a compiler issue.
bcc32 -DSTAND_ALONE -DSTD_MACROS=0 -DSTD_ASSERT=0 -DUCPP_CONFIG cpp.c mem.c nhash.c lexer.c assert.c macro.c eval.c arith.c
But it had the same issue. I took a look at lexer.c
and it was way too complicated for me to understand.
But I actually have another preprocessor-only program,
which is public domain, so I switched to that. That
showed an unrelated problem with the PD version, so I
have asked the author to see if he can fix that.
I used this for Smaller C BTW:
bcc32 -DMAX_IDENT_TABLE_LEN=20000 -DSYNTAX_STACK_MAX=10000 -DSTACK_SIZE=500 smlrc.c
Anyway, with all that done, the only thing that
Smaller C can't cope with is some floating point
stuff in PDPCLIB.
One of them is this:
smlrc -huge -I . math.e math.s
Error in "math.c" (720:18)
Compound assignment not supported with floats
I simplified it to:
__PDPCLIB_API__ double modf(double value, double *iptr)
value -= 5.0;
If I change that to:
value = value - 5.0;
it is accepted. Is the original syntax difficult to support?
Thanks. Paul.