Sol 6.1이 내 34년 된 매킨토시 플러스용 'Hello World' 앱을 한 번에 짜줬다.
Sol 6.1 was able to one-shot a Hello World application for my 34 year old Macintosh Plus.
핵심 요약
Sol 6.1 모델을 활용해 34년 된 구형 매킨토시용 코드를 성공적으로 작성한 사례가 공유되었습니다.
- 코드 생성 능력 — Sol 6.1이 구형 매킨토시용 Hello World 앱을 한 번에 작성함
- 레트로 컴퓨팅 — 34년 된 매킨토시 플러스 하드웨어에 대한 향수를 자극함
- 모델 성능 논쟁 — 최신 모델이 아니어도 충분히 가능한 작업이라는 의견이 다수임
- 기술적 호기심 — 구형 기술 역설계나 최적화에 대한 커뮤니티의 관심이 높음
Sol 6.1로 내 34년 된 매킨토시 플러스에서 돌아갈 Hello World 앱을 한 방에 뽑아내려던 참이었다.
#include <Quickdraw.h>
#include <Fonts.h>
#include <Windows.h>
#include <Menus.h>
#include <Dialogs.h>
#include <Events.h>
#include <Memory.h>
#include <OSUtils.h>
static WindowPtr helloWindow;
static Boolean running = true;
static const unsigned char helloText\[\] = {5, 'H', 'e', 'l', 'l', 'o'};
static const unsigned char windowTitle\[\] = {5, 'H', 'e', 'l', 'l', 'o'};
static const unsigned char fileTitle\[\] = {4, 'F', 'i', 'l', 'e'};
static const unsigned char quitItem\[\] = {6, 'Q', 'u', 'i', 't', '/', 'Q'};
static void drawHello(void)
{
Rect r = helloWindow->portRect;
SetPort(helloWindow);
EraseRect(&r);
TextFont(0);
TextSize(24);
TextFace(0);
MoveTo((r.right - StringWidth(helloText)) / 2, (r.bottom + 18) / 2);
DrawString(helloText);
}
static void chooseMenu(long choice)
{
if ((short)(choice >> 16) == 128 && (short)choice == 1)
running = false;
HiliteMenu(0);
}
int main(void)
{
EventRecord event;
WindowPtr clicked;
Rect bounds = {80, 96, 220, 416};
Rect dragBounds = {24, 0, 342, 512};
MenuHandle fileMenu;
MaxApplZone();
InitGraf(&qd.thePort);
InitFonts();
InitWindows();
InitMenus();
TEInit();
InitDialogs(0);
InitCursor();
fileMenu = NewMenu(128, fileTitle);
AppendMenu(fileMenu, quitItem);
InsertMenu(fileMenu, 0);
DrawMenuBar();
helloWindow = NewWindow(0, &bounds, windowTitle, true,
documentProc, (WindowPtr)-1L, true, 0);
if (!helloWindow) return 1;
SetPort(helloWindow);
while (running) {
if (!WaitNextEvent(everyEvent, &event, 10, 0)) continue;
switch (event.what) {
case updateEvt:
if ((WindowPtr)event.message == helloWindow) {
BeginUpdate(helloWindow);
drawHello();
EndUpdate(helloWindow);
}
break;
case mouseDown:
switch (FindWindow(event.where, &clicked)) {
case inMenuBar: chooseMenu(MenuSelect(event.where)); break;
case inDrag: DragWindow(clicked, event.where, &dragBounds); break;
case inGoAway:
if (clicked == helloWindow && TrackGoAway(clicked, event.where))
running = false;
break;
case inContent: SelectWindow(clicked); break;
case inSysWindow: SystemClick(&event, clicked); break;
}
break;
case keyDown:
case autoKey:
if (event.modifiers & cmdKey)
chooseMenu(MenuKey((char)(event.message & charCodeMask)));
break;
}
}
DisposeWindow(helloWindow);
return 0;
}

