mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
New file.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@974 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e7b5ad79cb
commit
e8402c57f0
3 changed files with 166 additions and 0 deletions
42
INSTALL.WIN32
Normal file
42
INSTALL.WIN32
Normal file
|
@ -0,0 +1,42 @@
|
|||
Installing on Windows NT/95
|
||||
***************************
|
||||
|
||||
The system requires that you have headers and for the WIN32 API
|
||||
and ANSI-C. If you are have a working bash shell then
|
||||
you should run the normal Unix ./configure shell script; otherwise,
|
||||
you can follow these instructions and run the configure.bat batch file.
|
||||
|
||||
Quick installation instructions:
|
||||
|
||||
configure
|
||||
make
|
||||
make install
|
||||
|
||||
Detailled installation instructions:
|
||||
|
||||
1. Install `gcc'. The library requires gcc version
|
||||
2.7.0 or later.
|
||||
|
||||
2. Configure the package for your system. Review the Makefile.sed.nt
|
||||
files which is used to process Makefile.in to create a working
|
||||
Makefiles. They exist in the directories: ./ , ./checks , ./src
|
||||
Of interest are:
|
||||
|
||||
'libdir' where to install the library file
|
||||
'includedir' where to install the headers
|
||||
'install' make rules to install libobjects
|
||||
|
||||
4. Run 'configure.bat' to create the Makefiles, and the header configuration
|
||||
file 'src/objects/config.h'
|
||||
|
||||
5. Type `make' to compile the package. If you want, you can override
|
||||
the `make' variables `CFLAGS' like this:
|
||||
make CFLAGS=-O2
|
||||
|
||||
6. Type `make install' to install the library, data files, header
|
||||
files, and documentation.
|
||||
|
||||
7. You can remove the program binaries and object files from the
|
||||
source directory by typing `make clean'. To also remove the
|
||||
Makefile(s), and `config.status' (all the files that `configure'
|
||||
created), type `make distclean'.
|
59
Testing/nshashtable.m
Normal file
59
Testing/nshashtable.m
Normal file
|
@ -0,0 +1,59 @@
|
|||
#include <stdio.h>
|
||||
#include <Foundation/NSHashTable.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
NSHashTable *ht;
|
||||
NSHashEnumerator he;
|
||||
int i;
|
||||
void *v;
|
||||
|
||||
/* Test with ints */
|
||||
|
||||
ht = NSCreateHashTable (NSIntHashCallBacks, 0);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
NSHashInsert (ht, (void*)i);
|
||||
|
||||
NSHashRemove (ht, (void*)3);
|
||||
|
||||
he = NSEnumerateHashTable (ht);
|
||||
while ((v = NSNextHashEnumeratorItem (&he)))
|
||||
printf ("(%d) ", (int)v);
|
||||
printf ("\n");
|
||||
|
||||
NSFreeHashTable (ht);
|
||||
|
||||
|
||||
#if 0
|
||||
/* Test with NSNumber objects */
|
||||
|
||||
mt = NSCreateHashTable (NSObjectHashKeyCallBacks,
|
||||
NSObjectHashValueCallBacks,
|
||||
0);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
NSHashInsert (mt,
|
||||
[NSNumber numberWithInt: i],
|
||||
[NSNumber numberWithInt: i*i]);
|
||||
|
||||
o = [NSNumber numberWithInt: 3];
|
||||
printf ("value for key %s is %s\n",
|
||||
[[o description] cString],
|
||||
[[(id)NSHashGet (mt, o) description] cString]);
|
||||
NSHashRemove (mt, o);
|
||||
printf ("after removing: value for key %s is %s\n",
|
||||
[[o description] cString],
|
||||
[[(id)NSHashGet (mt, o) description] cString]);
|
||||
|
||||
me = NSEnumerateHashTable (mt);
|
||||
while (NSNextHashEnumeratorPair (&me, &k, &v))
|
||||
printf ("(%d,%d) ", [(id)k intValue], [(id)v intValue]);
|
||||
printf ("\n");
|
||||
|
||||
NSFreeHashTable (mt);
|
||||
#endif
|
||||
|
||||
exit (0);
|
||||
}
|
65
Testing/nsmaptable.m
Normal file
65
Testing/nsmaptable.m
Normal file
|
@ -0,0 +1,65 @@
|
|||
#include <stdio.h>
|
||||
#include <Foundation/NSMapTable.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
NSMapTable *mt;
|
||||
NSMapEnumerator me;
|
||||
int i;
|
||||
void *k;
|
||||
void *v;
|
||||
id o;
|
||||
|
||||
/* Test with ints */
|
||||
|
||||
mt = NSCreateMapTable (NSIntMapKeyCallBacks,
|
||||
NSIntMapValueCallBacks,
|
||||
0);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
NSMapInsert (mt, (void*)i, (void*)(i*2));
|
||||
|
||||
printf ("value for key %d is %d\n",
|
||||
3, (int)NSMapGet (mt, (void*)3));
|
||||
NSMapRemove (mt, (void*)3);
|
||||
printf ("after removing: value for key %d is %d\n",
|
||||
3, (int)NSMapGet (mt, (void*)3));
|
||||
|
||||
me = NSEnumerateMapTable (mt);
|
||||
while (NSNextMapEnumeratorPair (&me, &k, &v))
|
||||
printf ("(%d,%d) ", (int)k, (int)v);
|
||||
printf ("\n");
|
||||
|
||||
NSFreeMapTable (mt);
|
||||
|
||||
|
||||
/* Test with NSNumber objects */
|
||||
|
||||
mt = NSCreateMapTable (NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
0);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
NSMapInsert (mt,
|
||||
[NSNumber numberWithInt: i],
|
||||
[NSNumber numberWithInt: i*i]);
|
||||
|
||||
o = [NSNumber numberWithInt: 3];
|
||||
printf ("value for key %s is %s\n",
|
||||
[[o description] cString],
|
||||
[[(id)NSMapGet (mt, o) description] cString]);
|
||||
NSMapRemove (mt, o);
|
||||
printf ("after removing: value for key %s is %s\n",
|
||||
[[o description] cString],
|
||||
[[(id)NSMapGet (mt, o) description] cString]);
|
||||
|
||||
me = NSEnumerateMapTable (mt);
|
||||
while (NSNextMapEnumeratorPair (&me, &k, &v))
|
||||
printf ("(%d,%d) ", [(id)k intValue], [(id)v intValue]);
|
||||
printf ("\n");
|
||||
|
||||
NSFreeMapTable (mt);
|
||||
|
||||
exit (0);
|
||||
}
|
Loading…
Reference in a new issue