Coder Social home page Coder Social logo

team-imasara / macintosh-c-by-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rhalkyard/macintosh-c-by-example

0.0 0.0 0.0 29.88 MB

Example code from the 1991 book "Macintosh C Programming by Example," updated to build under Retro68.

C 71.79% R 27.48% CMake 0.73%

macintosh-c-by-example's Introduction

Example code from Macintosh C Programming By Example

Macintosh C Programming By Example by Kurt W. G. Matthies and Thom Hogan is a very useful primer for developing software for the System 6-7 era Macintosh, and includes example code on a floppy disk that builds up from a trivial "Hello World" example, to an actually-useful multi-window hex editor.

However, the book and its code date back to 1991, and were written for the Symantec THINK C development environment, and as a result it is not straightforward to build this code under modern tools such as Retro68 or even later versions of Apple's MPW development environment.

This repo contains the example projects from the book, restructured and modified to build under Retro68. The initial commit made to this repo contains the code as-is, so that the changes I made are documented in the commit history.

The changes are as follows:

  • Converting source file encoding from MacRoman with CR line breaks, to UTF-8 with LF line breaks.

  • Adding Toolbox #includes to source files (THINK C included all Toolbox headers in a compiler preamble.)

  • Writing equivalents for missing THINK C helper functions and macros (see ThinkHelpers.c and ThinkHelpers.h).

  • Decompiling resource files (binary resource forks only usable on Macintosh systems) to text-based Rez format.

  • Adding a Retro68 cmake build system.

  • Fixing bugs found in the original code (!).

Descriptions of example applications

Chapter 4: Hey Mac

A minimal "Hello World" program that creates a window on the screen and draws some text to it.

Chapter 6: MiniGeneric

A simple single-window application with menus and dialog boxes.

Chapter 7: MultiGeneric

An expanded version of MiniGeneric that supports multiple windows.

Chapter 8: NonGeneric

A further-expanded version of MultiGeneric that demonstrates scrolling.

Chapter 9: Loser

A utility to set and clear the "invisible" file attribute, illustrating how to work with the filesystem, and how to use DialogHook functions to extend the standard system file dialog boxes.

Chapter 11: Browser

A simple file viewer application based on the framework laid out in MultiGeneric. Can view the data and resource forks as files either as text, or as a hex-dump.

Building

Retro68

From the root of this repository:

RETRO68_HOME=$HOME/Retro68-build # or wherever you installed Retro68 to
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=$RETRO68_HOME/toolchain/m68k-apple-macos/cmake/retro68.toolchain.cmake
make

Bugs

A number of bugs came to light while trying to get these projects to build - I've tried to fix the ones that caused build failures, egregious compiler warnings, or crashes, but there are probably a few left in there.

Ownership

I do not claim any ownership over this code, but since the book is long out of print and programming textbooks for 30+ year old computers aren't exactly commercially viable these days, I don't feel too bad about distributing this code. If whoever the current copyright owner is, wants it taken down, I'll oblige, but keep in mind that this book and an archive of the accompanying disk are readily available all over the retrocomputing web.

macintosh-c-by-example's People

Contributors

rhalkyard avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.