/home/doxygen/libascend/compiler/dimen.h

Go to the documentation of this file.
00001 /*  ASCEND modelling environment
00002     Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
00003     Copyright (C) 2006 Carnegie Mellon University
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2, or (at your option)
00008     any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 *//*
00023     by Tom Epperly
00024     8/18/89
00025     Version: $Revision: 1.7 $
00026     Version control file: $RCSfile: dimen.h,v $
00027     Date last modified: $Date: 1997/07/18 12:28:58 $
00028     Last modified by: $Author: mthomas $
00029 */
00030 
00031 #ifndef ASC_DIMEN_H
00032 #define ASC_DIMEN_H
00033 
00038 #include <utilities/ascConfig.h>
00039 #include "compiler.h"
00040 #include "fractions.h"
00041 
00042 
00043 /* Keep these defines current with DimNames in dimen.h. */
00044 #define NUM_DIMENS            10  
00045 #define D_MASS                0   
00046 #define D_QUANTITY            1   
00047 #define D_LENGTH              2   
00048 #define D_TIME                3   
00049 #define D_TEMPERATURE         4   
00050 #define D_CURRENCY            5   
00051 #define D_ELECTRIC_CURRENT    6   
00052 #define D_LUMINOUS_INTENSITY  7   
00053 #define D_PLANE_ANGLE         8   
00054 #define D_SOLID_ANGLE         9   
00057 struct DimStruct {
00058   struct fraction f[NUM_DIMENS];  
00059   unsigned int wild;              
00060 };
00061 #define DIM_WILD 0x1
00062 
00065 typedef struct DimStruct dim_type;
00066 
00067 ASC_DLLSPEC struct gl_list_t *g_dimen_list;
00074 extern void InitDimenList(void);
00080 extern void DestroyDimenList(void);
00085 #define GetDimFraction(d,i) ((d).f[i])
00086 
00101 #define GetDimPower(d,i)  \
00102  (int)(Denominator((d).f[i])==1 ? Numerator((d).f[i]) : 0)
00103 
00108 #define SetDimFraction(d,i,frac) ( (d).f[(i)] = (frac) )
00109 
00113 ASC_DLLSPEC void ClearDimensions(dim_type *d);
00118 ASC_DLLSPEC CONST dim_type*Dimensionless(void);
00123 ASC_DLLSPEC CONST dim_type *TrigDimension(void);
00128 ASC_DLLSPEC CONST dim_type *WildDimension(void);
00134 extern CONST dim_type *HalfDimension(CONST dim_type *d, int b);
00141 extern CONST dim_type *ThirdDimension(CONST dim_type *d, int b);
00148 extern CONST dim_type *SquareDimension(CONST dim_type *d, int b);
00155 extern CONST dim_type *CubeDimension(CONST dim_type *d, int b);
00162 extern CONST dim_type *PowDimension(long mult, CONST dim_type *d, int b);
00170 extern void SetWild(dim_type *dim);
00175 ASC_DLLSPEC int IsWild(CONST dim_type *d);
00180 extern int OddDimension(CONST dim_type *d);
00185 extern int NonCubicDimension(CONST dim_type *d);
00190 extern int SameDimen(CONST dim_type *d1, CONST dim_type *d2);
00198 ASC_DLLSPEC int CmpDimen(CONST dim_type *d1, CONST dim_type *d2);
00203 ASC_DLLSPEC CONST dim_type *FindOrAddDimen(CONST dim_type *d);
00218 ASC_DLLSPEC void CopyDimensions(CONST dim_type *src, dim_type *dest);
00223 ASC_DLLSPEC dim_type AddDimensions(CONST dim_type *d1, CONST dim_type *d2);
00233 extern CONST dim_type *SumDimensions(CONST dim_type *d1, CONST dim_type *d2, int check);
00243 ASC_DLLSPEC dim_type SubDimensions(CONST dim_type *d1, CONST dim_type *d2);
00253 extern CONST dim_type *DiffDimensions(CONST dim_type *d1, CONST dim_type *d2, int check);
00263 ASC_DLLSPEC dim_type ScaleDimensions(CONST dim_type *dim, struct fraction frac);
00268 ASC_DLLSPEC void ParseDim(dim_type *dim, CONST char *c);
00288 ASC_DLLSPEC char *DimName(CONST int nIndex);
00294 extern CONST dim_type *CheckDimensionsMatch(CONST dim_type *d1, CONST dim_type *d2);
00303 ASC_DLLSPEC void PrintDimen(FILE *f ,CONST dim_type *d);
00307 ASC_DLLSPEC void PrintDimenMessage(CONST char *message
00308         , CONST char *label1, CONST dim_type *d1
00309         , CONST char *label2, CONST dim_type *d2
00310 );
00311 
00314 ASC_DLLSPEC void DumpDimens(FILE *f);
00317 /* @} */
00318 
00319 #endif /* ASC_DIMEN_H */

Generated on Thu Jul 17 04:00:10 2008 for libascend by  doxygen 1.5.1