Skip to content

Instantly share code, notes, and snippets.

@mpw
Created January 21, 2019 20:30
Show Gist options
  • Save mpw/160194e8113058411932fdc468a4294c to your computer and use it in GitHub Desktop.
Save mpw/160194e8113058411932fdc468a4294c to your computer and use it in GitHub Desktop.
#!/usr/local/bin/dscsh
@interface DSCDump: NSObject
@end
@implementation DSCDump
-(void)dumpFile:aFile
{
id data,eps,dsc;
id stream = [MPWPSByteStream Stdout];
[self logWithFormat:@"Dump of %@",aFile];
data = [NSData dataWithContentsOfMappedFile:aFile];
[self logWithFormat:@"did map data"];
// eps = [MPWEPSFile epsFileWithData:data];
[self logWithFormat:@"did get the eps"];
// dsc = [eps dsc];
dsc = [MPWDSCScanner scan:[MPWEPSFile getEPSPartOfDOSEps:data]];
[self logWithFormat:@"going get dscNames"];
// dsc = [[dsc reject] isKindOf:[MPWSubData class]];
// [self logWithFormat:@"dsc = %@",dsc];
[stream writeEnumerator:[dsc objectEnumerator] spacer:@""];
[stream close];
}
-(void)safeDumpFile:aFile
{
[[self safely] dumpFile:aFile];
}
- main: args
{
if ( [args count] >= 2 ) {
args=[args objectEnumerator];
[args nextObject]; // argv[0]
// [[self do] safeDumpFile:args];
[self dumpFile:[args nextObject]];
// id dsc = [[MPWEPSFile epsFileWithData:[NSData dataWithContentsOfMappedFile:[args objectAtIndex:1]]] dsc];
// [self logWithFormat:@"dsc = %@",dsc];
}
return 0;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment