MacPaint and QuickDraw 1984 source code (2010)
computerhistory.org
computerhistory.org
REPEAT
UnloadSeg(@InitOnce); { SegInit }
UnloadSeg(@PrintDoc); { SegPrint }
UnloadSeg(@CutOrCopy); { SegScrap }
UnloadSeg(@Paste); { SegPaste }
UnloadSeg(@Rotate); { SegFlip }
UnloadSeg(@ShowPage); { SegPage }
UnloadSeg(@DrawPat); { SegUpdate }
UnloadSeg(@EditPat); { SegPatEdit }
UnloadSeg(@ChooseBrush); { SegBrush }
UnloadSeg(@Symmetry); { SegSym }
UnloadSeg(@ShowPicture); { SegHelp }
IF heapJam THEN
BEGIN
tempLong := MaxMem(tempLong); { purge heap }
heapJam := FALSE;
END;
SystemTask; { give desk accessories a chance }
IF active THEN TrackCursor;
IF GetNextEvent(everyEvent,theEvent) THEN ProcessTheEvent;
IF active AND NOT quitFlag AND (DiskSpace(0) < minDiskSpace) THEN
BEGIN
tempWord := SaveAlert(diskAlrt);
quitFlag := TRUE;
END;
IF quitFlag THEN QuitProgram;
UNTIL quitFlag;
ExitToShell;
QuickDraw in 68k assembler is beautiful, too; there's a story from the first Mac's development that, when the Macintosh team tried to rewrite as much of the Toolbox in order to fit it after asembly in 68KB of ROM, Bill Atkinson refused to touch QuickDraw [1].[1] https://www.folklore.org/StoryView.py?project=Macintosh&stor...
"If you want to get it smooth, you’ve got to rewrite it from scratch at least five times."
This is so true, and so hard to have the time and motivation to do in practice.
It does not seems to work at all.
Somehow, I do a lot of refactoring. I noticed that I am unable to improve code by more than two notches of quality in a single refactoring pass. If it's very bad and the end result must be very good (it happens rarely to never that both are true), I need to come back to the code after a year or so and have another go. To understand the original code, I need to get "into its logic", and that understanding, as well as eagerness to fix the worst problems right away, somehow prevent improvements that involve a completely different approach.
The only way to make improvements larger than that is when I've already seen a very good way to handle a similar enough problem to the code in question.
Making a lot of progress in refactoring is even harder for code I have written myself because I understand the original reasoning behind things a little too well. Getting out of that trap probably requires a good amount of external input and / or a particular mental flexibility. I assume that Bill Atkinson had these.
On personal projects, it’s a pleasure to rewrite code until I feel it “looks” good.
If you need to fit your application into 5kb of pascal code so it can be bundled with an OS, there’s going to be less code to refactor and probably less ability to not-refactor.
(Not saying refactoring isn’t important now - it’s just more of a choice now and would usually have different goals)
Atkinson invented double-clicking, the selection lasso, MacPaint, QuickDraw, and HyperCard. When Steve Jobs was asked how many man-years QuickDraw took to develop, he asked Atkinson how long it took him. Atkinson said, "four years" so Jobs responded to the reporter, "Twenty-four man-years." Yes, Jobs was a hype machine for the Mac team, but he (and everyone around him) also knew that one Atkinson year was the equivalent of six typical developer years.
https://www.folklore.org/StoryView.py?project=Macintosh&stor...
This is proof that the Ribbon version of Paint is a step backward: If the Paint window is narrow enough, all the tools end up collapsed, effectively putting them back behind menu.
But anyway, most of the functionality of Paint is actually in GDI itself.
When Assembly is part of the picture in Pascal projects, it is always pointed out as it being the case.
When C projects make use of inline Assembly all over the place, it is C, even though it isn't part of ANSI C standard, there isn't any reference to inline Assembly support, and not every C compiler does support such extensions.
The __asm__ inliner is referred to as C, sure; but not the code itself. That would be like calling FFI'd C in Rust, "rust code".
In addition, it 100% is in the standard beginning with "ANSI C" (C89):
> C89/C90 standard (ISO/IEC 9899:1990):
> * G.5.10 The asm keyword
https://en.cppreference.com/w/c/language/asm
It's just an optional extension for compilers versus a core language feature.
Yeah, that was the point of not being a core language feature, I should have expressed better.