home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / Src / address.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-17  |  1.3 KB  |  56 lines

  1. /*
  2.  *
  3.  *  a d d r e s s . c            -- Addresses management
  4.  *
  5.  *
  6.  * Copyright ⌐ 1993-1996 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
  7.  * 
  8.  *
  9.  * Permission to use, copy, and/or distribute this software and its
  10.  * documentation for any purpose and without fee is hereby granted, provided
  11.  * that both the above copyright notice and this permission notice appear in
  12.  * all copies and derived works.  Fees for distribution or use of this
  13.  * software or derived works may only be charged with express written
  14.  * permission of the copyright holder.  
  15.  * This software is provided ``as is'' without express or implied warranty.
  16.  *
  17.  * This software is a derivative work of other copyrighted softwares; the
  18.  * copyright notices of these softwares are placed in the file COPYRIGHTS
  19.  *
  20.  *
  21.  *            Author: Erick Gallesio [eg@kaolin.unice.fr]
  22.  *    Creation date: 16-Mar-1994 10:34
  23.  * Last file update: 22-Feb-1996 23:05
  24.  *
  25.  *
  26.  */
  27.  
  28. #include "stk.h"
  29. #include "gc.h"
  30.  
  31. SCM STk_address2object(char *buffer)
  32. {
  33.   SCM address;
  34.  
  35.   sscanf(buffer, "%lx", &address);
  36.   if (!STk_valid_address(address)) 
  37.     Err("bad address", STk_makestring(buffer));
  38.   return address;
  39. }
  40.  
  41.  
  42. PRIMITIVE STk_address_of(SCM obj)
  43. {
  44.   SCM z;
  45.  
  46.   NEWCELL(z, tc_address);
  47.   z->storage_as.env.data = obj;
  48.  
  49.   return z;
  50. }
  51.  
  52. PRIMITIVE STk_addressp(SCM address)
  53. {
  54.   return TYPEP(address, tc_address)? Truth: Ntruth;
  55. }
  56.