Open Source Content Management Framework

GNUStep tutorial

Midgard can be compiled and used on a GNUStep system. The README file contains extra info on how to build.

When working on GNUStep, you need to manually checkout the latest SVN revision and build according to the rules in the README.

There are 3 sample programs included in the source tree (Examples directory) which are automatically built when building on GNUstep using the provided Makefile.

A simple Midgard application:

    int main (void)
    {
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        [MGDContext initialize];

        // Configuration
        MGDConfig *config = [[MGDConfig alloc] init];
        NSArray *files = [config listFilesInUserMode:YES];

        NSLog(@"Configuration files:");
        int k;
        for (k = 0; k < [files count]; k++) 
            NSLog(@"- %@", [files objectAtIndex:k]);

        NSLog(@"Reading configuration");
        if (! [config readFile:@"midgard.conf" inUserMode:YES]) {
            NSLog(@"Failed to read config!");
            return 128;
        }

        NSLog(@"Database name: %@", [config databaseName]);

        // Connection
        MGDConnection *connection = [[MGDConnection alloc] init];
        [connection openConfig:config];

        // Create database tables
        if (! [config createMidgardTablesForConnection:connection]) {
            NSLog(@"Falied to create tables!");
            return 128;
        }

        [config release];
        [connection release];
        [pool release];

        return 0;
    }
Tagged
objc
Designed by Nemein, hosted by Kafit