Add try.sh to 1985/sicherman
The Makefile was also modified to have a sicherman.alt rule as it requires -traditional-cpp. There is an argument that this should be removed and instead the alt2 version (which is compiled if a compiler fails to compile sicherman.c because of the 'wrong' number of args to main() - one arg) would become the alt version because if someone wants to try the original code they can look at sicherman.orig.c. This can be done another time if it's worth doing (which I think it might be).
This commit is contained in:
1 parent
ec71d8ad68
commit
53fb889475
4 files changed
+65
-19
No files matched your search
+16
-10
@@ -304,18 +304,18 @@ case as `c`.
|
||||
|
||||
- The code in `main()` is where there are significant changes, changing from:
|
||||
|
||||
```c
|
||||
while (read(0,&__,1) & write((_=(_=C_C_(__),C)),
|
||||
_C_,1)) _=C-V+subr(&V);
|
||||
```
|
||||
```c
|
||||
while (read(0,&__,1) & write((_=(_=C_C_(__),C)),
|
||||
_C_,1)) _=C-V+subr(&V);
|
||||
```
|
||||
|
||||
to:
|
||||
to:
|
||||
|
||||
```c
|
||||
while (read(0,&__,1) & write((_=(_=C_C_(__),
|
||||
V))?__:__-_+'\b'b'\b'|((_-52)%('\b'b'\b'+~
|
||||
' '&'\t'b'\n')+1),1),&_,1))_=c-v+subr(&v));
|
||||
```
|
||||
```c
|
||||
while (read(0,&__,1) & write((_=(_=C_C_(__),
|
||||
V))?__:__-_+'\b'b'\b'|((_-52)%('\b'b'\b'+~
|
||||
' '&'\t'b'\n')+1),1),&_,1))_=c-v+subr(&v));
|
||||
```
|
||||
|
||||
Note how numerous of the macros (though two changed in case) can still be
|
||||
used but some cannot be. Can you figure out why? Why too is it that the
|
||||
@@ -324,6 +324,12 @@ case as `c`.
|
||||
remove it from `main()`? What happens if you remove it from `subr()` or
|
||||
don't even bother calling `subr()`?
|
||||
|
||||
Additional code was added in case the fix cannot be compiled by some compilers
|
||||
should they object to `main()` having only one arg. This version will
|
||||
automatically be compiled if the entry fails to compile for some reason.
|
||||
|
||||
Cody also added the [try.sh](/1985/sicherman/try.sh) script.
|
||||
|
||||
|
||||
# <a name="1986"></a>1986
|
||||
|
||||
|
||||
Reference in new issue
Block a user