mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
New property-list stuff, bugfixes and 64-bit clean version with many
improvements. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3651 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
362e54106f
commit
d9692822a9
5 changed files with 768 additions and 95 deletions
|
@ -142,24 +142,24 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)formUnionWithCharacterSet:(NSCharacterSet *)otherSet
|
- (void) formUnionWithCharacterSet: (NSCharacterSet *)otherSet
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char *other_bytes;
|
const char *other_bytes;
|
||||||
|
|
||||||
other_bytes = [[otherSet bitmapRepresentation] bytes];
|
other_bytes = [[otherSet bitmapRepresentation] bytes];
|
||||||
for (i=0; i < BITMAP_SIZE; i++)
|
for (i = 0; i < BITMAP_SIZE; i++)
|
||||||
data[i] = (data[i] || other_bytes[i]);
|
data[i] = (data[i] | other_bytes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)formIntersectionWithCharacterSet:(NSCharacterSet *)otherSet
|
- (void) formIntersectionWithCharacterSet: (NSCharacterSet *)otherSet
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char *other_bytes;
|
const char *other_bytes;
|
||||||
|
|
||||||
other_bytes = [[otherSet bitmapRepresentation] bytes];
|
other_bytes = [[otherSet bitmapRepresentation] bytes];
|
||||||
for (i=0; i < BITMAP_SIZE; i++)
|
for (i = 0; i < BITMAP_SIZE; i++)
|
||||||
data[i] = (data[i] && other_bytes[i]);
|
data[i] = (data[i] & other_bytes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)removeCharactersInRange:(NSRange)aRange
|
- (void)removeCharactersInRange:(NSRange)aRange
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -31,7 +31,7 @@ include ../Version
|
||||||
include ../config.mak
|
include ../config.mak
|
||||||
|
|
||||||
# The application to be compiled
|
# The application to be compiled
|
||||||
TOOL_NAME = gdnc defaults dread dwrite dremove
|
TOOL_NAME = gdnc defaults dread dwrite dremove plparse sfparse
|
||||||
OBJC_PROGRAM_NAME = gdomap
|
OBJC_PROGRAM_NAME = gdomap
|
||||||
|
|
||||||
# The source files to be compiled
|
# The source files to be compiled
|
||||||
|
@ -41,6 +41,8 @@ defaults_OBJC_FILES = defaults.m
|
||||||
dread_OBJC_FILES = dread.m
|
dread_OBJC_FILES = dread.m
|
||||||
dremove_OBJC_FILES = dremove.m
|
dremove_OBJC_FILES = dremove.m
|
||||||
dwrite_OBJC_FILES = dwrite.m
|
dwrite_OBJC_FILES = dwrite.m
|
||||||
|
plparse_OBJC_FILES = plparse.m
|
||||||
|
sfparse_OBJC_FILES = sfparse.m
|
||||||
|
|
||||||
SOURCES = gdomap.c gdnc.m defaults.m dread.m dremove.m dwrite.m
|
SOURCES = gdomap.c gdnc.m defaults.m dread.m dremove.m dwrite.m
|
||||||
|
|
||||||
|
|
89
Tools/plparse.m
Normal file
89
Tools/plparse.m
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
/* This tool checks that a file contains a valid text property-list
|
||||||
|
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
Created: February 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/NSException.h>
|
||||||
|
#include <Foundation/NSString.h>
|
||||||
|
#include <Foundation/NSProcessInfo.h>
|
||||||
|
#include <Foundation/NSUserDefaults.h>
|
||||||
|
#include <Foundation/NSDebug.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] == 0)
|
||||||
|
{
|
||||||
|
NSLog(@"No file names given to parse.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (i = 0; i < [args count]; i++)
|
||||||
|
{
|
||||||
|
NSString *file = [args objectAtIndex: i];
|
||||||
|
|
||||||
|
NS_DURING
|
||||||
|
{
|
||||||
|
NSString *myString;
|
||||||
|
id result;
|
||||||
|
|
||||||
|
myString = [NSString stringWithContentsOfFile: file];
|
||||||
|
result = [myString propertyList];
|
||||||
|
if (result == nil)
|
||||||
|
NSLog(@"Parsing '%@' - nil property list", file);
|
||||||
|
else if ([result isKindOfClass: [NSDictionary class]] == YES)
|
||||||
|
NSLog(@"Parsing '%@' - a dictionary", file);
|
||||||
|
else if ([result isKindOfClass: [NSArray class]] == YES)
|
||||||
|
NSLog(@"Parsing '%@' - an array", file);
|
||||||
|
else if ([result isKindOfClass: [NSData class]] == YES)
|
||||||
|
NSLog(@"Parsing '%@' - a data object", file);
|
||||||
|
else if ([result isKindOfClass: [NSString class]] == YES)
|
||||||
|
NSLog(@"Parsing '%@' - a string", file);
|
||||||
|
else
|
||||||
|
NSLog(@"Parsing '%@' - unexpected class - %@",
|
||||||
|
file, [[result class] description]);
|
||||||
|
}
|
||||||
|
NS_HANDLER
|
||||||
|
{
|
||||||
|
NSLog(@"Parsing '%@' - %@", file, [localException reason]);
|
||||||
|
}
|
||||||
|
NS_ENDHANDLER
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[pool release];
|
||||||
|
return 0;
|
||||||
|
}
|
83
Tools/sfparse.m
Normal file
83
Tools/sfparse.m
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
/* This tool checks that a file is a valid strings-file
|
||||||
|
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
Created: February 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/NSException.h>
|
||||||
|
#include <Foundation/NSString.h>
|
||||||
|
#include <Foundation/NSProcessInfo.h>
|
||||||
|
#include <Foundation/NSUserDefaults.h>
|
||||||
|
#include <Foundation/NSDebug.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] == 0)
|
||||||
|
{
|
||||||
|
NSLog(@"No file names given to parse.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (i = 0; i < [args count]; i++)
|
||||||
|
{
|
||||||
|
NSString *file = [args objectAtIndex: i];
|
||||||
|
|
||||||
|
NS_DURING
|
||||||
|
{
|
||||||
|
NSString *myString;
|
||||||
|
id result;
|
||||||
|
|
||||||
|
myString = [NSString stringWithContentsOfFile: file];
|
||||||
|
result = [myString propertyListFromStringsFileFormat];
|
||||||
|
if (result == nil)
|
||||||
|
NSLog(@"Parsing '%@' - nil property list", file);
|
||||||
|
else if ([result isKindOfClass: [NSDictionary class]] == YES)
|
||||||
|
NSLog(@"Parsing '%@' - seems ok", file);
|
||||||
|
else
|
||||||
|
NSLog(@"Parsing '%@' - unexpected class - %@",
|
||||||
|
file, [[result class] description]);
|
||||||
|
}
|
||||||
|
NS_HANDLER
|
||||||
|
{
|
||||||
|
NSLog(@"Parsing '%@' - %@", file, [localException reason]);
|
||||||
|
}
|
||||||
|
NS_ENDHANDLER
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[pool release];
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue