Mercurial > hg > aim92
view stitch/stypes.c @ 0:5242703e91d3 tip
Initial checkin for AIM92 aimR8.2 (last updated May 1997).
author | tomwalters |
---|---|
date | Fri, 20 May 2011 15:19:45 +0100 |
parents | |
children |
line wrap: on
line source
/* stypes.c ====== defines types for sources operations */ #include <string.h> #include "stitch.h" #include "source.h" #include "stypes.h" #include "ops.h" char VoidIdent[] = "void" ; char CharIdent[] = "char" ; char ShortIdent[] = "short" ; char IntIdent[] = "int" ; char FloatIdent[] = "float" ; char DoubleIdent[] = "double" ; Source SourceSource( source ) Source source ; { return ( source ) ; } static TypeInfo typeTable[] = { VoidIdent, 0, SourceSource, CharIdent, sizeof ( char ), SourceCharSource, ShortIdent, sizeof ( short ), SourceShortSource, IntIdent, sizeof ( int ), SourceIntSource, FloatIdent, sizeof ( float ), SourceFloatSource, DoubleIdent, sizeof ( double ), SourceDoubleSource, (char *) 0 } ; int typeEntryNumber( type ) char *type ; { register int n ; for( n=0 ; typeTable[n].ident != (char *) 0 ; n ) if( type == typeTable[n].ident ) return ( n ) ; for( n=0 ; typeTable[n].ident != (char *) 0 ; n ) if( strcmp( type, typeTable[n].ident ) ) return ( n ) ; return ( n ) ; } Source TypeConvertSource( source, type ) Source source ; char *type ; { if( strcmp( SourceType( source ), type ) != 0 ) return ( typeTable[ typeEntryNumber( type ) ].maker( source ) ) ; else return ( source ) ; }