PDA

View Full Version : I'm missing the paradigm shift to XCode




DavidCar
Feb 22, 2005, 03:08 PM
Simple XCode Question

I'm quite new to XCode, C and Objective C. I am trying to port an old project from THINK Pascal. I've got the "15 minute text editor" from Apple documentation up and running. I've successfully added a MyDocument class, and I'm starting on a MyTreeItem class. I've answered various questions through the built in documentation, but I've run into a problem that may be too fundamental to easily find in the documentation.

This is generally what I am trying to port:

---------------------

UNIT ParserManager;

INTERFACE
Uses ParserDefs;

Function MyParser(hPE: PEHandle; var hTree; MyTreeHandle): BOOLEAN;

IMPLEMENTATION
Uses ParserProcs;

Function MyParser(hPE: PEHandle; var hTree; MyTreeHandle): BOOLEAN;
BEGIN
MyParser := FALSE;
hTree := NIL;
END

END.

---------------------

So I am expecting in XCode to have a file called ParserManager.h which contains

#import <Cocoa/Cocoa.h>
#import "ParserDefs.h"
#import "MyTreeItem.h"

(BOOL) MyParser(NSString *Str, MyTreeItem **tree);


... and a file called ParserManager.m which contains

#import "ParserProcs.h"

(BOOL) MyParser(NSString *Str, MyTreeItem **tree) {
return NO;
}

... and my file MyDocument.m would contain


#import "ParserManager.h"

...

NSString *Str;
MyTreeItem *tree;

if (MyParser(Str, &tree)) {
// set flag
};

---------------------

I must be failing to navigate a paradigm shift here, because XCode doesn't get what I want it to do. Would enlightened ones be redefining MyParser as a class, or what?



DavidCar
Feb 23, 2005, 05:36 PM
I found my problem, which was just a trivial omission rather than something as grand as missing a paradigm shift. If the complier had given me a clearer error message I would not have had to spend hours trying to find the source of the problem.