Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals  

number.h

Go to the documentation of this file.
00001  /*
00002   * plint/data/val/number.h : numbers data structures
00003   * 
00004   * Time-stamp: <2002-10-07 04:52:19 gseba>
00005   * 
00006   * Copyright (C) Sebastian Glita, email: gseba@users.sourceforge.net
00007   * 
00008   * This file is part of plint.
00009   * 
00010   * plint is free software; you can  redistribute it and/or modify it under the
00011   * terms of the  GNU General Public License as published  by the Free Software
00012   * Foundation; either version 2, or (at your option) any later version.
00013   *
00014   * plint  is distributed  in the  hope  that it  will be  useful, but  WITHOUT
00015   * ANY  WARRANTY; without  even  the implied  warranty  of MERCHANTABILITY  or
00016   * FITNESS FOR A  PARTICULAR PURPOSE.  See the GNU  General Public License for
00017   * more details.
00018   * 
00019   * You should  have received a  copy of the  GNU General Public  License along
00020   * with  plint; see  the file  COPYING.  If  not, write  to the  Free Software
00021   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA USA.
00022   *
00023   */
00024 
00025 #ifndef PLINT_DATA_TYPE_H
00026 #error Dont include me directly, but through data/type.h
00027 #endif
00028 
00043 struct _plint_num
00044 {
00045 
00046   plint_typ_t typ;                      
00047   union {
00048 
00049     int num_int;                                
00050     double num_dbl;                             
00052   } val;                                
00054   /* TODO: are these correct ? */
00055 #define PLINT_INT_MAX "-2147483647"
00056 #define PLINT_DBL_MAX "-2147483647.99999999999999"
00057 
00058 };
00059 
00060 __BEGIN_DECLS
00061 
00062 #define plint_num_int_cpy(__i__) (__i__)
00063 #define plint_num_int_dup plint_num_int_cpy
00064 #define plint_num_int_fre(__i__) 
00065 
00066 #define plint_num_dbl_cpy(__d__) (__d__)
00067 #define plint_num_dbl_dup plint_num_dbl_cpy
00068 #define plint_num_dbl_fre(__d__) 
00069 
00070 #define plint_num_cpy(__n__) (__n__)
00071 #define plint_num_dup plint_num_cpy
00072 #define plint_num_fre(__n__) 
00073 
00074 #define PLINT_num_int_INIT(__i__) { typ: PLINT_num_int, val:num_int:__i__ }
00075 #define PLINT_num_dbl_INIT(__d__) { typ: PLINT_num_dbl, val:num_dbl:__d__ }
00076 
00077 inline int plint_num_n2i(plint_num_t NUMBER);
00078 inline double plint_num_n2d(plint_num_t NUMBER);
00079 inline plint_num_t plint_num_INT(int INTEGER);
00080 inline plint_num_t plint_num_DBL(double REAL);
00081 
00082 plint_val_t plint_num_val(plint_num_t NUMBER);
00083 #define plint_val_num(__pval__, __type__) (((__type__) != PLINT_num_dbl) ? plint_num_INT((__pval__)->num_int) : plint_num_DBL((__pval__)->num_dbl))
00084 
00085 inline plint_num_t plint_ptr_num(plint_ptr_t VALUE);
00086 inline plint_ptr_t plint_num_ptr(plint_num_t NUMBER);
00087 inline plint_ptr_t plint_num_set(plint_ptr_t VALUE, plint_num_t NUMBER);
00088 
00089 __END_DECLS
00090 

Generated on Thu Jan 9 19:02:38 2003 for plint by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002