mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
New tools
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4253 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
650bed66c5
commit
68770468d3
4 changed files with 191 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
Fri May 14 20:00:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Tools/pldes.m: new tool to deserialise serialised property lists.
|
||||
* Tools/plser.m: new tool to serialise text property lists.
|
||||
* Tools/GNUmakefile: add pldes and plser
|
||||
|
||||
Mon May 11 15:00:00 1999 Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
|
||||
* Source/NSArray.m: getObjects: (id*)aBuffer range: (NSRange)aRange
|
||||
|
|
|
@ -31,7 +31,7 @@ include ../Version
|
|||
include ../config.mak
|
||||
|
||||
# The application to be compiled
|
||||
TOOL_NAME = gdnc defaults dread dwrite dremove plparse sfparse
|
||||
TOOL_NAME = gdnc defaults dread dwrite dremove plparse sfparse pldes plser
|
||||
OBJC_PROGRAM_NAME = gdomap
|
||||
|
||||
# The source files to be compiled
|
||||
|
@ -41,6 +41,8 @@ defaults_OBJC_FILES = defaults.m
|
|||
dread_OBJC_FILES = dread.m
|
||||
dremove_OBJC_FILES = dremove.m
|
||||
dwrite_OBJC_FILES = dwrite.m
|
||||
pldes_OBJC_FILES = pldes.m
|
||||
plser_OBJC_FILES = plser.m
|
||||
plparse_OBJC_FILES = plparse.m
|
||||
sfparse_OBJC_FILES = sfparse.m
|
||||
|
||||
|
|
92
Tools/pldes.m
Normal file
92
Tools/pldes.m
Normal file
|
@ -0,0 +1,92 @@
|
|||
/* This tool converts a serialised proerty list to a text representation.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Created: may 1999
|
||||
|
||||
This file is part of the GNUstep Project
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSFileHandle.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSUserDefaults *defs;
|
||||
NSProcessInfo *proc;
|
||||
NSArray *args;
|
||||
unsigned i;
|
||||
|
||||
proc = [NSProcessInfo processInfo];
|
||||
if (proc == nil)
|
||||
{
|
||||
NSLog(@"defaults: unable to get process information!\n");
|
||||
[pool release];
|
||||
exit(0);
|
||||
}
|
||||
|
||||
args = [proc arguments];
|
||||
|
||||
if ([args count] <= 1)
|
||||
{
|
||||
NSLog(@"No file names given to deserialize.");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 1; i < [args count]; i++)
|
||||
{
|
||||
NSString *file = [args objectAtIndex: i];
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
NSData *myData;
|
||||
NSString *myString;
|
||||
id result;
|
||||
|
||||
myData = [NSData dataWithContentsOfFile: file];
|
||||
result = [NSDeserializer deserializePropertyListFromData: myData
|
||||
mutableContainers: NO];
|
||||
if (result == nil)
|
||||
NSLog(@"Loading '%@' - nil property list", file);
|
||||
else
|
||||
{
|
||||
NSFileHandle *out;
|
||||
|
||||
myString = [result description];
|
||||
out = [NSFileHandle fileHandleWithStandardOutput];
|
||||
myData = [myString dataUsingEncoding: NSASCIIStringEncoding];
|
||||
[out writeData: myData];
|
||||
[out synchronizeFile];
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"Loading '%@' - %@", file, [localException reason]);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
}
|
||||
[pool release];
|
||||
return 0;
|
||||
}
|
90
Tools/plser.m
Normal file
90
Tools/plser.m
Normal file
|
@ -0,0 +1,90 @@
|
|||
/* This tool converts a text property list to a serialised representation.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Created: may 1999
|
||||
|
||||
This file is part of the GNUstep Project
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSFileHandle.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSUserDefaults *defs;
|
||||
NSProcessInfo *proc;
|
||||
NSArray *args;
|
||||
unsigned i;
|
||||
|
||||
proc = [NSProcessInfo processInfo];
|
||||
if (proc == nil)
|
||||
{
|
||||
NSLog(@"defaults: unable to get process information!\n");
|
||||
[pool release];
|
||||
exit(0);
|
||||
}
|
||||
|
||||
args = [proc arguments];
|
||||
|
||||
if ([args count] <= 1)
|
||||
{
|
||||
NSLog(@"No file names given to deserialize.");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 1; i < [args count]; i++)
|
||||
{
|
||||
NSString *file = [args objectAtIndex: i];
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
NSData *myData;
|
||||
NSString *myString;
|
||||
id result;
|
||||
|
||||
myString = [NSString stringWithContentsOfFile: file];
|
||||
result = [myString propertyList];
|
||||
if (result == nil)
|
||||
NSLog(@"Loading '%@' - nil property list", file);
|
||||
else
|
||||
{
|
||||
NSFileHandle *out;
|
||||
|
||||
myData = [NSSerializer serializePropertyList: result];
|
||||
out = [NSFileHandle fileHandleWithStandardOutput];
|
||||
[out writeData: myData];
|
||||
[out synchronizeFile];
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"Loading '%@' - %@", file, [localException reason]);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
}
|
||||
[pool release];
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue