1996-03-22 00:37:53 +00:00
|
|
|
/* Callbacks for pointers to `void'.
|
|
|
|
* Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
*
|
|
|
|
* Author: Albin L. Jones <Albin.L.Jones@Dartmouth.EDU>
|
|
|
|
* Created: Sat Feb 10 22:04:38 EST 1996
|
|
|
|
* Updated: Mon Mar 11 02:03:13 EST 1996
|
|
|
|
* Serial: 96.03.11.04
|
|
|
|
*
|
1996-05-12 00:56:10 +00:00
|
|
|
* This file is part of the GNUstep Base Library.
|
1996-03-22 00:37:53 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free
|
1999-09-09 02:56:20 +00:00
|
|
|
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
1996-03-22 00:37:53 +00:00
|
|
|
|
|
|
|
/**** Included Headers *******************************************************/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
2000-03-24 05:40:19 +00:00
|
|
|
#include "config.h"
|
1996-03-22 00:37:53 +00:00
|
|
|
#include <Foundation/NSString.h>
|
1998-12-20 21:27:47 +00:00
|
|
|
#include <base/o_cbs.h>
|
1996-03-22 00:37:53 +00:00
|
|
|
|
|
|
|
/**** Function Implementations ***********************************************/
|
|
|
|
|
|
|
|
size_t
|
1996-04-17 19:26:04 +00:00
|
|
|
o_non_owned_void_p_hash(register const void *cptr)
|
1996-03-22 00:37:53 +00:00
|
|
|
{
|
|
|
|
return ((size_t) cptr)/4;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1996-04-17 19:26:04 +00:00
|
|
|
o_non_owned_void_p_compare(register const void *cptr,
|
1996-03-22 00:37:53 +00:00
|
|
|
register const void *dptr)
|
|
|
|
{
|
|
|
|
if (cptr == dptr)
|
|
|
|
return 0;
|
|
|
|
else if (cptr < dptr)
|
|
|
|
return -1;
|
|
|
|
else /* if (cptr > dptr) */
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1996-04-17 19:26:04 +00:00
|
|
|
o_non_owned_void_p_is_equal(register const void *cptr,
|
1996-03-22 00:37:53 +00:00
|
|
|
register const void *dptr)
|
|
|
|
{
|
|
|
|
return (cptr == dptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
const void *
|
1996-04-17 19:26:04 +00:00
|
|
|
o_non_owned_void_p_retain(const void *cptr)
|
1996-03-22 00:37:53 +00:00
|
|
|
{
|
|
|
|
return cptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1996-04-17 19:26:04 +00:00
|
|
|
o_non_owned_void_p_release(void *cptr)
|
1996-03-22 00:37:53 +00:00
|
|
|
{
|
|
|
|
/* We don't own CPTR, so we don't release it. */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
NSString *
|
1996-04-17 19:26:04 +00:00
|
|
|
o_non_owned_void_p_describe(const void *cptr)
|
1996-03-22 00:37:53 +00:00
|
|
|
{
|
|
|
|
/* FIXME: Code this. */
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t
|
1996-04-17 19:26:04 +00:00
|
|
|
o_owned_void_p_hash(register const void *cptr)
|
1996-03-22 00:37:53 +00:00
|
|
|
{
|
|
|
|
/* We divide by 4 because many machines align
|
|
|
|
* memory on word boundaries. */
|
|
|
|
return ((size_t) cptr)/4;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1996-04-17 19:26:04 +00:00
|
|
|
o_owned_void_p_compare(register const void *cptr,
|
1996-03-22 00:37:53 +00:00
|
|
|
register const void *dptr)
|
|
|
|
{
|
|
|
|
if (cptr == dptr)
|
|
|
|
return 0;
|
|
|
|
else if (cptr < dptr)
|
|
|
|
return -1;
|
|
|
|
else /* if (cptr > dptr) */
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1996-04-17 19:26:04 +00:00
|
|
|
o_owned_void_p_is_equal(register const void *cptr,
|
1996-03-22 00:37:53 +00:00
|
|
|
register const void *dptr)
|
|
|
|
{
|
|
|
|
return (cptr == dptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
const void *
|
1996-04-17 19:26:04 +00:00
|
|
|
o_owned_void_p_retain(const void *cptr)
|
1996-03-22 00:37:53 +00:00
|
|
|
{
|
|
|
|
return cptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1996-04-17 19:26:04 +00:00
|
|
|
o_owned_void_p_release(void *cptr)
|
1996-03-22 00:37:53 +00:00
|
|
|
{
|
|
|
|
free((void *)cptr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
NSString *
|
1996-04-17 19:26:04 +00:00
|
|
|
o_owned_void_p_describe(const void *obj)
|
1996-03-22 00:37:53 +00:00
|
|
|
{
|
|
|
|
/* FIXME: Code this. */
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|