ObjFW  Check-in [33f646ce2d]

Overview
Comment:More changes to port ObjFW to PSP.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 33f646ce2df956c8086a529e124f591a77b95e39f8c7a6ee7177661da771b4f4
User & Date: js on 2011-02-09 19:34:26
Other Links: manifest | tags
Context
2011-02-09
22:12
Add -Wwrite-strings. check-in: a5ab6bf63b user: js tags: trunk
19:34
More changes to port ObjFW to PSP. check-in: 33f646ce2d user: js tags: trunk
18:55
Initial PSP port. check-in: d230ac577d user: js tags: trunk
Changes

Modified configure.ac from [ecf4c3dfb1] to [6472ce0463].

1
2
3
4

5
6
7
8
9
10
11
AC_INIT(ObjFW, 0.4-dev, js@webkeks.org)
AC_CONFIG_SRCDIR(src)

AS_IF([test x"$host" = x"psp"], [

	LIBS="$LIBS -lc -lpspkernel -lpspuser"
	LIBS="$LIBS -lpspnet -lpspnet_inet -lpspnet_resolver"
])

AC_CANONICAL_HOST

AC_LANG([Objective C])




>







1
2
3
4
5
6
7
8
9
10
11
12
AC_INIT(ObjFW, 0.4-dev, js@webkeks.org)
AC_CONFIG_SRCDIR(src)

AS_IF([test x"$host" = x"psp"], [
	OBJCFLAGS="-G0 $OBJCFLAGS"
	LIBS="$LIBS -lc -lpspkernel -lpspuser"
	LIBS="$LIBS -lpspnet -lpspnet_inet -lpspnet_resolver"
])

AC_CANONICAL_HOST

AC_LANG([Objective C])

Modified src/OFFile.h from [ee5f8a5c17] to [8d2faaebb5].

105
106
107
108
109
110
111

112
113
114
115
116
117
118
119
120
121
122

123
124
125
126
127
128
129
130
131
+ (void)changeToDirectory: (OFString*)path;

/**
 * \return The date of the last modification of the file
 */
+ (OFDate*)modificationDateOfFile: (OFString*)path;


/**
 * Changes the mode of a file.
 *
 * Only changes read-only flag on Windows.
 *
 * \param path The path to the file of which the mode should be changed as a
 *	       string
 * \param mode The new mode for the file
 */
+ (void)changeModeOfFile: (OFString*)path
		  toMode: (mode_t)mode;


#ifndef _WIN32
/**
 * Changes the owner of a file.
 *
 * Not available on Windows.
 *
 * \param path The path to the file of which the owner should be changed as a
 *	       string







>











>

|







105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
+ (void)changeToDirectory: (OFString*)path;

/**
 * \return The date of the last modification of the file
 */
+ (OFDate*)modificationDateOfFile: (OFString*)path;

#ifndef _PSP
/**
 * Changes the mode of a file.
 *
 * Only changes read-only flag on Windows.
 *
 * \param path The path to the file of which the mode should be changed as a
 *	       string
 * \param mode The new mode for the file
 */
+ (void)changeModeOfFile: (OFString*)path
		  toMode: (mode_t)mode;
#endif

#if !defined(_WIN32) && !defined(_PSP)
/**
 * Changes the owner of a file.
 *
 * Not available on Windows.
 *
 * \param path The path to the file of which the owner should be changed as a
 *	       string

Modified src/OFFile.m from [ab8f876cd6] to [c76530e6dd].

394
395
396
397
398
399
400

401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427

428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
+ (void)changeToDirectory: (OFString*)path
{
	if (chdir([path cString]))
		@throw [OFChangeDirectoryFailedException newWithClass: self
								 path: path];
}


+ (void)changeModeOfFile: (OFString*)path
		  toMode: (mode_t)mode
{
#ifndef _WIN32
	if (chmod([path cString], mode))
		@throw [OFChangeFileModeFailedException newWithClass: self
								path: path
								mode: mode];
#else
	DWORD attrs = GetFileAttributes([path cString]);

	if (attrs == INVALID_FILE_ATTRIBUTES)
		@throw [OFChangeFileModeFailedException newWithClass: self
								path: path
								mode: mode];

	if ((mode / 100) & 2)
		attrs &= ~FILE_ATTRIBUTE_READONLY;
	else
		attrs |= FILE_ATTRIBUTE_READONLY;

	if (!SetFileAttributes([path cString], attrs))
		@throw [OFChangeFileModeFailedException newWithClass: self
								path: path
								mode: mode];
#endif
}


+ (OFDate*)modificationDateOfFile: (OFString*)path
{
	struct stat s;

	if (stat([path cString], &s) == -1)
		/* FIXME: Maybe use another exception? */
		@throw [OFOpenFileFailedException newWithClass: self
							  path: path
							  mode: @"r"];

	/* FIXME: We could be more precise on some OSes */
	return [OFDate dateWithTimeIntervalSince1970: s.st_mtime];
}

#ifndef _WIN32
+ (void)changeOwnerOfFile: (OFString*)path
		  toOwner: (OFString*)owner
		    group: (OFString*)group
{
	uid_t uid = -1;
	gid_t gid = -1;








>



|




|
















|

>















|







394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
+ (void)changeToDirectory: (OFString*)path
{
	if (chdir([path cString]))
		@throw [OFChangeDirectoryFailedException newWithClass: self
								 path: path];
}

#ifndef _PSP
+ (void)changeModeOfFile: (OFString*)path
		  toMode: (mode_t)mode
{
# ifndef _WIN32
	if (chmod([path cString], mode))
		@throw [OFChangeFileModeFailedException newWithClass: self
								path: path
								mode: mode];
# else
	DWORD attrs = GetFileAttributes([path cString]);

	if (attrs == INVALID_FILE_ATTRIBUTES)
		@throw [OFChangeFileModeFailedException newWithClass: self
								path: path
								mode: mode];

	if ((mode / 100) & 2)
		attrs &= ~FILE_ATTRIBUTE_READONLY;
	else
		attrs |= FILE_ATTRIBUTE_READONLY;

	if (!SetFileAttributes([path cString], attrs))
		@throw [OFChangeFileModeFailedException newWithClass: self
								path: path
								mode: mode];
# endif
}
#endif

+ (OFDate*)modificationDateOfFile: (OFString*)path
{
	struct stat s;

	if (stat([path cString], &s) == -1)
		/* FIXME: Maybe use another exception? */
		@throw [OFOpenFileFailedException newWithClass: self
							  path: path
							  mode: @"r"];

	/* FIXME: We could be more precise on some OSes */
	return [OFDate dateWithTimeIntervalSince1970: s.st_mtime];
}

#if !defined(_WIN32) && !defined(_PSP)
+ (void)changeOwnerOfFile: (OFString*)path
		  toOwner: (OFString*)owner
		    group: (OFString*)group
{
	uid_t uid = -1;
	gid_t gid = -1;

524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
		while (![src isAtEndOfStream]) {
			size_t len = [src readNBytes: 4096
					  intoBuffer: buf];
			[dest writeNBytes: len
			       fromBuffer: buf];
		}

#ifndef _WIN32
		if (!override) {
			struct stat s;

			if (fstat(src->fd, &s) == 0)
				fchmod(dest->fd, s.st_mode);
		}
#endif







|







526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
		while (![src isAtEndOfStream]) {
			size_t len = [src readNBytes: 4096
					  intoBuffer: buf];
			[dest writeNBytes: len
			       fromBuffer: buf];
		}

#if !defined(_WIN32) && !defined(_PSP)
		if (!override) {
			struct stat s;

			if (fstat(src->fd, &s) == 0)
				fchmod(dest->fd, s.st_mode);
		}
#endif

Modified src/OFObject.m from [a091595654] to [0e939837b3].

116
117
118
119
120
121
122
123
124
125
126
127
128
129





130
131
132
133
134
135
136
	}
#endif

#if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME)
	objc_setEnumerationMutationHandler(enumeration_mutation_handler);
#endif

#ifndef _WIN32
	if ((of_pagesize = sysconf(_SC_PAGESIZE)) < 1)
		of_pagesize = 4096;
#else
	SYSTEM_INFO si;
	GetSystemInfo(&si);
	of_pagesize = si.dwPageSize;





#endif
}

+ (void)initialize
{
}








|
<
<
<



>
>
>
>
>







116
117
118
119
120
121
122
123



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
	}
#endif

#if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME)
	objc_setEnumerationMutationHandler(enumeration_mutation_handler);
#endif

#if defined(_WIN32)



	SYSTEM_INFO si;
	GetSystemInfo(&si);
	of_pagesize = si.dwPageSize;
#elif defined(_PSP)
	of_pagesize = 512;
#else
	if ((of_pagesize = sysconf(_SC_PAGESIZE)) < 1)
		of_pagesize = 4096;
#endif
}

+ (void)initialize
{
}