ThinkC [Study Group 0] Getting your Development Environment Setup & Hello, World!

Relating to ThinkC Development

Mu0n

Active Tinkerer
Oct 29, 2021
610
560
93
Quebec
www.youtube.com
I appreciate your help but I'm thinking Extreme Long Term about this website (after all, it started out in 2004) and I don't want to impose further recurrent work on you, nor be forced to seek out helping hands. It's really braindead simple to edit in its current form. Anyone familiar with basic html circa 1998 can maintain that website.
 
  • Like
Reactions: Daniel Hansen

retr01

Senior Tinkerer
Jun 6, 2022
2,474
1
796
113
Utah, USA
retr01.com
I appreciate your help but I'm thinking Extreme Long Term about this website (after all, it started out in 2004) and I don't want to impose further recurrent work on you, nor be forced to seek out helping hands. It's really braindead simple to edit in its current form. Anyone familiar with basic html circa 1998 can maintain that website.

I am. :) Unfortunately, I have other priorities.
 

pretzelFTW

New Tinkerer
Sep 5, 2022
26
8
3
Hi!
Just found the forum a few days ago and figured I'd join the study group!

I'm using a Mac Plus with 4MB RAM. (I would have rather used the SE/30 I acquired a while back, but it needs recapping)

I tried System 7.5.3 and THINK 6 but didn't get too far – there wasn't enough memory to run Hello World :(

Went with System 6.0.8 (which is what I usually run on my Mac Plus) and THINK C 5.0. So I guess I'll have to skip the System 7-specific content in the book – or get an emulator going.

Anyway, made it through the first two chapters. So far so good!
 

Kabootie Computey!

New Tinkerer
Sep 13, 2022
15
19
3
www.kabootie.com
I'm also joining the party really late, but I found this study group a few days ago, and I'm mega excited about it. What a fun idea! I didn't have the programming chops in the 1990s to build mac programs that would have been any good, but I wanted to SO MUCH.

I'm going to try to do this all on a vintage mac - a Centris 610 I got working a few weeks ago, with Mac OS 7.6.1. It seems to play great with Symantec C++ 6.0 from the bundle of resources provided, but wow it took almost 5 hours to copy that whole bundle to the computer over LocalTalk. I had forgotten how much waiting everything used to require.

IMG_7820.jpg
 

Patrick

Tinkerer
Oct 26, 2021
435
1
224
43
WELCOME !

Thats almost the same setup my family had in the 90's including the monitor. except we had a Quadra 610. (which is near enough to be the same for all intents / purposes)

looking forward to what you will come up with!
 
  • Like
Reactions: Kabootie Computey!

techknight

Moderator
Staff member
Dec 2, 2021
76
79
18
North Carolina
  • Like
Reactions: Patrick

MacOfAllTrades

Tinkerer
Oct 5, 2022
168
183
43
Ok - I'm game!
I was only a little further in using the Macintosh C Programming By Example book but I'll do the study group thing with this C Programming Primer book. It looks good.

The timing will encourage me to stay motivated.

I'm using either an SE or SE/30. Think C kinda of flipped on me when I took the same project that was working on the SE over to my SE/30. Cycling the "Optimize for 68020" preferences checkbox fixed the problem. Pretty weird but if anyone bounces between a 68000 and 68030 and find their programs don't run right / crash, I suggest trying to turn on 68020 optimization and rebuild, then you can turn it off if you want again.
Screen Shot 2022-10-06 at 11.21.38 PM.png
 
  • Like
Reactions: eric and Patrick

superbenk

New Tinkerer
Apr 9, 2023
15
6
3
I just learned about this & am excited to jump in (albeit quite late!) to learn some C in a fun way! I'm developing in Mini vMac on a MacII w/ 8MB RAM running System 7.5.5 w/ THINK C v5.0. I've gone through the "ShowPICT" example in Chapter 2 but it breaks in a weird way that I don't understand. I've gone over my code a few times & I don't think I have any bugs in it. When I run it the picture appears but the menu bar goes blank & it won't exit the picture window no matter what I do. Mouse still moves but the computer seems to be otherwise frozen. I have to force reboot to get back to a working state. Any ideas? Screenshot is from a MacSE/4MB RAM in Mini vMac running the built standalone binary. It crashes/fails the same way on both systems.

C:
#define kBaseResID             128
#define    kMoveToFront        (WindowPtr)-1L

/****************/
/* Functions    */
/****************/

void     ToolBoxInit( void );
void    WindowInit( void );
void    DrawMyPicture( void );
void    CenterPict( PicHandle picture, Rect *destRectPtr );

/* main **************************************************/

void    main( void )
{
    ToolBoxInit();
    WindowInit();
    DrawMyPicture();
    
    //while ( !Button() );
}

/* ToolBoxInit ********************************************/

void    ToolBoxInit( void )
{
    InitGraf( &thePort );
    InitFonts();
    InitMenus();
    TEInit();
    InitDialogs( nil );
    InitCursor();
}

/* WindowInit *********************************************/

void    WindowInit( void )
{
    WindowPtr    window;
    window = GetNewWindow( kBaseResID, nil, kMoveToFront );
    
    if ( window == nil )
    {
        SysBeep( 10 );     /* Couldn’t load the WIND resource! */
        
        ExitToShell();
    }
    
    ShowWindow( window );
    SetPort( window );
}

/* DrawMyPicture ******************************************/

void     DrawMyPicture( void )
{
    Rect         pictureRect;
    WindowPtr    window;
    PicHandle    picture;
    
    window = FrontWindow();
    
    pictureRect = window->portRect;
    
    picture = GetPicture( kBaseResID );
    
    if ( picture == nil )
    {
        SysBeep( 10 );    /* Couldn’t load the PICT resource! */
        
        ExitToShell();
    }
    
    CenterPict( picture, &pictureRect );
    DrawPicture( picture, &pictureRect );
}

/* CenterPict *********************************************/

void     CenterPict( PicHandle picture, Rect *destRectPtr )
{
    Rect        windRect, pictRect;
    
    windRect = *destRectPtr;
    pictRect = (**( picture )).picFrame;
    OffsetRect( &pictRect, windRect.left - pictRect.left,
                windRect.top - pictRect.top);
    OffsetRect( &pictRect, (windRect.right -
                pictRect.right)/2, (windRect.bottom -
                pictRect.bottom)/2);
    *destRectPtr = pictRect;
}

ShowPICT-hung.png
 
Last edited:

pretzelFTW

New Tinkerer
Sep 5, 2022
26
8
3
There's no menu bar in this simple app. It should exit on a mouse button click.

C:
    //while ( !Button() );

You have the main event loop commented out. Re-enable that and it should start working.
 
Last edited:

Mu0n

Active Tinkerer
Oct 29, 2021
610
560
93
Quebec
www.youtube.com
There's no menu bar in this simple app. It should exit on a mouse button click.

C:
    //while ( !Button() );

You have the main event loop commented out. Re-enable that and it should start working.

That's not it, as it is, it's instructed to simply quit the app right away and go back to the Finder, not hang.
 
  • Like
Reactions: pretzelFTW

superbenk

New Tinkerer
Apr 9, 2023
15
6
3
There's no menu bar in this simple app. It should exit on a mouse button click.

C:
    //while ( !Button() );

You have the main event loop commented out. Re-enable that and it should start working.
This was me copying/pasting code I was trying to troubleshoot with. The screenshot is of the program running without that line commented out. I pasted in the wrong code here.
 
  • Like
Reactions: pretzelFTW