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

variable.h

Go to the documentation of this file.
00001  /*
00002   * plint/data/variable.h : variables data structures
00003   * 
00004   * Time-stamp: <2002-12-21 14:28:00 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 
00047 struct _plint_type_iface
00048 {
00049 
00050   void (* neu)(plint_var_t VARIABLE); 
00051   void (* cpy)(plint_ref_t DESTINATION, plint_var_t SOURCE); 
00052   void (* fre)(plint_var_const_t CONST_VARIABLE); 
00054   void (* idx)(plint_mem_t * PMEMORY, plint_ref_t * PREFERENCE, int INDEX); 
00056   void (* fld)(plint_mem_t * PMEMORY, plint_ref_t * PREFERENCE, plint_str_t FIELD); 
00059   void (* key)(plint_mem_t * PMEMORY, plint_ref_t * REFERENCE, plint_val_t * PVALUE, plint_typ_t TYPE); 
00063   void (* get)(plint_idx_t * PINDEX); 
00065 };
00066 
00067 
00073 struct _plint_var
00074 {
00075   plint_ptr_t ptr;      
00077   plint_ref_t cpy;      
00079   flag_t singleton:1;   
00080   flag_t readonly :1;   
00081   flag_t unity    :1;   
00083   plint_typkey_t key;   
00084   void * data;          
00086   struct _plint_gc_chunk _gc;
00087 
00088 #define PLINT_VAR_NEW(__key__, __args__...) plint_var_new(__key__, PLINT_PTR_NEW(__args__))
00089 
00090 };
00091 
00092 __BEGIN_DECLS
00093 
00094 plint_var_t plint_var_new(plint_typkey_t KEY, plint_ptr_t VALUE);
00095 void plint_var_fre(plint_var_t VARIABLE);
00096 plint_var_t plint_var_cpy(plint_var_t VARIABLE);
00097 inline plint_var_t plint_var_dup(plint_var_t VARIABLE);
00098 void plint_var_inc(plint_ref_t REFERENCE);
00099 void plint_var_dec(plint_ref_t REFERENCE);
00100 
00101 #ifndef PLINT_SELF_REF
00102 inline
00103 #endif
00104 void plint_var_asg(plint_mem_t MEMORY, plint_ref_t DESTINATION, plint_var_t SOURCE, plint_easg_t TYPE);
00105 
00106 __END_DECLS
00107 
00108 #define plint_var_singleton(__v__) (__v__)->singleton
00109 #define plint_var_readonly(__v__)  (__v__)->readonly
00110 #define plint_var_unity(__v__)  (__v__)->unity
00111 #define plint_var_data(__v__)  (__v__)->data
00112 
00113 #define plint_var_val(__v__) ((__v__)->ptr)
00114 
00115 #define plint_var_typ(__v__) (plint_var_val(__v__)->typ)
00116 #define plint_var_num_int(__v__) (plint_var_val(__v__)->val.num_int)
00117 #define plint_var_num_dbl(__v__) (plint_var_val(__v__)->val.num_dbl)
00118 #define plint_var_num(__v__) plint_val_num(&plint_var_val(__v__)->val, plint_var_typ(__v__))
00119 #define plint_var_pnt(__v__) (plint_var_val(__v__)->val.pnt)
00120 #define plint_var_str(__v__) (plint_var_val(__v__)->val.str)
00121 #define plint_var_bol(__v__) (plint_var_val(__v__)->val.bol)
00122 #define plint_var_tab(__v__) (plint_var_val(__v__)->val.tab)
00123 #define plint_var_hsh(__v__) (plint_var_val(__v__)->val.hsh)
00124 

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