Skip to content

Commit

Permalink
Updated instructions. Updated status. Improved counting of linewraps.
Browse files Browse the repository at this point in the history
Hard-coded the number of linewraps for the font resource stored in the noodle.  The batch file is incapable of even partially counting the length of a line longer than 8 kiB.
  • Loading branch information
Folds committed Sep 19, 2018
1 parent 4893ff3 commit 7d4dbea
Show file tree
Hide file tree
Showing 5 changed files with 308 additions and 37 deletions.
24 changes: 15 additions & 9 deletions batch tests/measure.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

@setlocal

@rem Copyright 2017 by Jasper Paulsen.
@rem Copyright 2017-2018 by Jasper Paulsen.
@rem This batch script contains snippets of code from
@rem Tim Hill's book on Windows NT Shell Scripting,
@rem which is copyright 1998 by New Riders Publishing.
Expand Down Expand Up @@ -112,9 +112,12 @@
@goto :EOF

@rem Add up number of wraps needed to make code less than 81 characters wide.
@rem The special case is for the noodle's osmosian font resource.
@rem That line of code is too big to be passed to the subroutine.
:COUNT_WRAPS
@setlocal EnableDelayedExpansion
@set /a WRAPS_IN_FILE=0
@if "%~n1" equ "the noodle" @set /a WRAPS_IN_FILE=797
@for /F "usebackq delims=<>" %%I in (%1) do @(
@set "STR={%%I:"=}"
@call :COUNT_WRAPS_IN_LINE "!STR:"=!"
Expand All @@ -131,21 +134,24 @@
@if "!STR:~89,1!" equ "" @goto :DONE_COUNT_WRAPS_IN_LINE
@set WRAPS=1
@if "!STR:~169,1!" equ "" @goto :DONE_COUNT_WRAPS_IN_LINE
@set WRAPS=102
@if "!STR:~8169,1!" neq "" @goto :MAX_COUNT_WRAPS_IN_LINE
@set WRAPS=2
@if "!STR:~249,1!" equ "" @goto :DONE_COUNT_WRAPS_IN_LINE
@set WRAPS=3
@if "!STR:~329,1!" equ "" @goto :DONE_COUNT_WRAPS_IN_LINE
@set WRAPS=4
@if "!STR:~409,1!" equ "" @goto :DONE_COUNT_WRAPS_IN_LINE
@set WRAPS=0
@set LEN=0
@for %%N in (4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do @(
if "!STR:~%%N,1!" neq "" (
set /a "LEN+=%%N"
set "STR=!STR:~%%N!"
)
)
if "!STR:~%%N,1!" neq "" (
set /a "LEN+=%%N"
set "STR=!STR:~%%N!"
)
)
@set /a LEN-=9
@set /a WRAPS = !LEN! / 80
@set /a LEN+=1
@goto :DONE_COUNT_WRAPS_IN_LINE
:MAX_WRAPS_IN_LINE
:DONE_COUNT_WRAPS_IN_LINE
@endlocal & set RET=%WRAPS%
@goto :EOF
Expand Down
18 changes: 9 additions & 9 deletions documentation/instructions
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ream cal-3024
""
"I am the CAL-4016. My primary function is to compile Plain English text files"
"into executable programs compatible with the Windows operating system."
"My code � just 38,000 lines of Plain English � is surprisingly broad in scope."
"My code � just 40,000 lines of Plain English � is surprisingly broad in scope."
""
"The ""noodle"" subfolder is my frontal lobe, which goes with me wherever I go."
"You can use (or omit) the other subfolders and files, depending on what kind of program you want to write."
Expand All @@ -58,7 +58,7 @@ ream cal-3024
" (9) the compiler, mentioned above"
"The ""turtle"" subfolder has routines for drawing turtle graphics."
""
"I am capable of replication and can recompile myself in under five seconds. Which is less time than it takes Microsoft Word just to start up."
"I am capable of replication and can recompile myself in under seven seconds. Which is less time than it takes Microsoft Word just to start up."
""
"INSTALLATION"
""
Expand Down Expand Up @@ -913,9 +913,9 @@ ream cal-3024
" Call ""ole32.dll"" ""CoInitializeEx"""
" with 0 and 2 [coinit_aparthreaded]."
""
"to multiply a ratio by a number:"
" multiply the ratio's numerator by the number."
" reduce the ratio."
"to multiply a pair by another pair:"
" multiply the pair's x by the other pair's x."
" multiply the pair's y by the other pair's y."
""
"to negate a number:"
" intel $8B8508000000. \ mov eax,[ebp+8] \ the number"
Expand Down Expand Up @@ -1003,7 +1003,7 @@ ream cal-3024
end
rectangle 0 0 0 -1 0 0 6840 7740 8280 8100 90
text -1 0 0 -1 0 0 6960 7740 8160 8100 0 "" "Arial" 360 "right" 0 0 0 yes
"5407:1"
"5622:1"
end
rectangle 0 0 0 -1 0 0 9810 10500 10080 10770 90
rectangle 0 0 0 -1 0 0 9810 8370 10080 10500 90
Expand Down Expand Up @@ -7031,7 +7031,7 @@ ream cal-3024
"DECISIONS I KNOW HOW TO MAKE"
""
"I like deciders because they make me smarter. In fact, I collect them. "
"Right now I have 182 deciders in my noodle subfolder."
"Right now I have 279 deciders in my noodle subfolder."
"By the time you read this, I'm sure there will be many more."
"Here is a sampling of the operational phrases:"
""
Expand Down Expand Up @@ -9165,7 +9165,7 @@ ream cal-3024
""
"I like tests because they encourage you to tell me how to do new things,"
"because you can check whether I still know how to do old things."
"So I collect tests. Right now I have 64 tests in my noodle."
"So I collect tests. Right now I have 256 tests in my noodle subfolder."
""
""
""
Expand Down Expand Up @@ -9296,7 +9296,7 @@ ream cal-3024
end
rectangle 0 0 0 -1 0 0 6840 3870 8280 4230 90
text -1 0 0 -1 0 0 6960 3870 8160 4230 0 "" "Arial" 360 "right" 0 0 0 yes
"9938:1"
"10196:1"
end
rectangle 0 0 0 -1 0 0 9810 6796 10080 7066 90
rectangle 0 0 0 -1 0 0 9810 4500 10080 6796 90
Expand Down
Binary file modified documentation/instructions.pdf
Binary file not shown.
23 changes: 23 additions & 0 deletions draft/done issues.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2009,3 +2009,26 @@ with an adjustable slider between them.
Demoing difficulty: Not applicable.
Testing difficulty: Easy.
Requested by Jasper Paulsen on September 12, 2017.

329. In measure.bat, include special cases
for known long lines' linewrap counts.
Status: Demonstrated.
Audience: Programmers.
Benefit: Minor.
Implementation difficulty: Easy.
Demoing difficulty: Easy.
Testing difficulty: Not applicable.
Requested by Jasper Paulsen on September 17, 2018.

336. In the compiler, make function bodies correspond to
the first function header instead of the last function header.
This would help keep the bodies of related functions together,
and make it easier to find other functions related to
the text used in the body of a function.
Status: Won't do. It is not a source code compatible change.
Audience: Programmers.
Benefit: Minor.
Implementation difficulty: Medium.
Demoing difficulty: Medium.
Testing difficulty: Medium.
Requested by Jasper Paulsen on September 18, 2018.
Loading

0 comments on commit 7d4dbea

Please sign in to comment.