mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-11 00:30:49 +00:00
Change from Nick Christopher. See Oct 1 ChangeLog entry.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1881 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f9e6a93d45
commit
05f694ad66
2 changed files with 42 additions and 4 deletions
|
@ -174,6 +174,7 @@ Time.m \
|
|||
UdpPort.m \
|
||||
behavior.m \
|
||||
lex.pl.m \
|
||||
lex.sf.m \
|
||||
ostream.m \
|
||||
o_array.m \
|
||||
o_array_bas.m \
|
||||
|
@ -195,6 +196,7 @@ o_map_bas.m \
|
|||
o_map_cbs.m \
|
||||
preface.m \
|
||||
proplist.tab.m \
|
||||
stringsfile.tab.m \
|
||||
mframe.m \
|
||||
objc-gnu2next.m
|
||||
|
||||
|
@ -212,6 +214,9 @@ md5.h \
|
|||
proplist.l \
|
||||
proplist.tab.h \
|
||||
proplist.y \
|
||||
stringsfile.l \
|
||||
stringsfile.tab.h \
|
||||
stringsfile.y \
|
||||
win32-entry.c \
|
||||
win32-def.top
|
||||
|
||||
|
@ -588,6 +593,13 @@ proplist.tab.m proplist.tab.h: proplist.y
|
|||
lex.pl.m: proplist.l proplist.tab.h
|
||||
$(LEX) -t -B -Ppl proplist.l > $@
|
||||
|
||||
stringsfile.tab.m stringsfile.tab.h: stringsfile.y
|
||||
rm -f stringsfile.tab.m.h
|
||||
$(YACC) -d -p sf stringsfile.y -o stringsfile.tab.m
|
||||
mv stringsfile.tab.m.h stringsfile.tab.h
|
||||
lex.sf.m: stringsfile.l stringsfile.tab.h
|
||||
$(LEX) -t -B -Psf stringsfile.l > $@
|
||||
|
||||
objc-load${OEXT}: dynamic-load.h
|
||||
|
||||
dynamic-load.h: ../config.status
|
||||
|
|
|
@ -48,12 +48,19 @@
|
|||
#include <Foundation/NSCharacterSet.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <gnustep/base/IndexedCollection.h>
|
||||
#include <gnustep/base/IndexedCollectionPrivate.h>
|
||||
#include <gnustep/base/String.h>
|
||||
#include <gnustep/base/behavior.h>
|
||||
#include <limits.h>
|
||||
#include <string.h> // for strstr()
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
@implementation NSString
|
||||
|
||||
|
@ -289,8 +296,21 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
- (id) initWithContentsOfFile: (NSString*)path
|
||||
{
|
||||
[self notImplemented:_cmd];
|
||||
return self;
|
||||
struct stat buf;
|
||||
int fd;
|
||||
char *s;
|
||||
|
||||
stat([path cString], &buf);
|
||||
|
||||
OBJC_MALLOC(s,char,buf.st_size + 1);
|
||||
fd = open([path cString], O_RDONLY);
|
||||
if ( fd < 0 )
|
||||
[NSException raise: NSGenericException format: @"Could not open file %s", [path cString]];
|
||||
|
||||
read(fd,(void *)s,buf.st_size);
|
||||
s[buf.st_size] = (char)0;
|
||||
|
||||
return [self initWithCStringNoCopy:s length: buf.st_size freeWhenDone:YES];
|
||||
}
|
||||
|
||||
- (id) initWithData: (NSData*)data
|
||||
|
@ -1038,8 +1058,14 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
- (NSDictionary*) propertyListFromStringsFileFormat
|
||||
{
|
||||
[self notImplemented:_cmd];
|
||||
return nil;
|
||||
id dict = [[[NSMutableDictionary alloc] init] autorelease];
|
||||
void *bufstate;
|
||||
|
||||
bufstate = (void *)sf_scan_string([self cString]);
|
||||
sfSetDict(dict);
|
||||
sfparse(dict);
|
||||
sf_delete_buffer(bufstate);
|
||||
return dict;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue