This is main.m in view mode; [Download] [Up]
// Written by Don Yacktman Copyright (c) 1995 by Don Yacktman. // Version 1.0. All rights reserved. // // This notice may not be removed from this source code. // // This object is included in the MiscKit by permission from the author // and its use is governed by the MiscKit license, found in the file // "LICENSE.rtf" in the MiscKit distribution. Please refer to that file // for a list of all applicable permissions and restrictions. // #import <misckit/misckit.h> #import <misckit/miscmerge.h> void main() { List *output; int i; // Set up the file names for the template and data files MiscString *templateFile = [MiscString newWithString:"test1.template"]; MiscString *dataFile = [MiscString newWithString:"test1.data"]; // A way to read the data file, independent of the merges // (But it turns an ascii file into a data structure the // merge kit can deal with.) MiscRecordParser *recparser = [[MiscRecordParser alloc] init]; // Basic objects required for a merge: MiscMergeTemplate *template = [[MiscMergeTemplate alloc] init]; MiscMergeDriver *merger = [[MiscMergeDriver alloc] init]; // Load the files from disk [template parseFromFileNamed:templateFile]; [recparser loadFromFileNamed:dataFile]; // set up the merge [merger setTemplate:template]; [merger setMergeData:[recparser records]]; // do the merge output = [merger doMerge:nil]; // Print out the results for (i=0; i<[output count]; i++) { printf("--------------------------------------------------------\n"); printf("%s\n", [[output objectAt:i] stringValue]); } printf("--------------------------------------------------------\n"); // If we weren't exiting, we'd go to the trouble of freeing everything // here to avoid memory leaks. exit(0); }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.