From: Diemo S. <di...@us...> - 2008-12-18 11:20:31
|
Update of /cvsroot/sdif/SDIF/examples In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30774 Modified Files: list-types.c Log Message: separate frameinfo_from_signature function Index: list-types.c =================================================================== RCS file: /cvsroot/sdif/SDIF/examples/list-types.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** list-types.c 18 Dec 2008 11:07:25 -0000 1.2 --- list-types.c 18 Dec 2008 11:20:25 -0000 1.3 *************** *** 4,12 **** arguments, get matrices and matrix column names ! compile as: gcc -I../include -g list-types.c -lsdif -olist-types run as: ./list-types <testfile.sdif> 1REB ; echo $? $Log$ Revision 1.2 2008/12/18 11:07:25 diemo read headers --- 4,15 ---- arguments, get matrices and matrix column names ! compile as: gcc -I../include -g -o list-types list-types.c -lsdif run as: ./list-types <testfile.sdif> 1REB ; echo $? $Log$ + Revision 1.3 2008/12/18 11:20:25 diemo + separate frameinfo_from_signature function + Revision 1.2 2008/12/18 11:07:25 diemo read headers *************** *** 14,22 **** Revision 1.1 2008/12/18 10:59:16 diemo simple example showing SdifTestFrameType and direct access to struct elements - */ #include "sdif.h" /* open file and read header */ SdifFileT *open_file (char *infile) --- 17,26 ---- Revision 1.1 2008/12/18 10:59:16 diemo simple example showing SdifTestFrameType and direct access to struct elements */ + #include "sdif.h" + /* open file and read header */ SdifFileT *open_file (char *infile) *************** *** 59,80 **** } ! int main (int argc, char *argv[]) { - char *filename = argc > 1 ? argv[1] : "-"; - char *fsigstr = argc > 2 ? argv[2] : "1TYP"; - - SdifFileT *file = open_file(filename); - SdifSignature fsig = SdifStringToSignature(fsigstr); - - /* frame and matrix types tables in sdif file struct store only - the file-defined types! */ - SdifHashTableT *ftable = SdifFGetFrameTypesTable(file); - SdifHashTableT *mtable = SdifFGetMatrixTypesTable(file); - if (!ftable || !mtable) exit(2); - - printf("Found %d user-defined frame types, %d matrix types SDIF file %s.\n", - ftable->NbOfData, mtable->NbOfData, filename); - SdifFrameTypeT *ftype = SdifTestFrameType(file, fsig); if (!ftype) { --- 63,70 ---- } ! void frameinfo_from_signature (SdifFileT *file, SdifSignature fsig) { SdifFrameTypeT *ftype = SdifTestFrameType(file, fsig); + if (!ftype) { *************** *** 101,104 **** --- 91,117 ---- } + } + + int main (int argc, char *argv[]) + { + char *filename = argc > 1 ? argv[1] : "-"; + char *fsigstr = argc > 2 ? argv[2] : "1TYP"; + + SdifFileT *file = open_file(filename); + SdifSignature fsig = SdifStringToSignature(fsigstr); + + /* frame and matrix types tables in sdif file struct store only + the file-defined types! */ + SdifHashTableT *ftable = SdifFGetFrameTypesTable(file); + SdifHashTableT *mtable = SdifFGetMatrixTypesTable(file); + + if (!ftable || !mtable) exit(2); + printf("Found %d user-defined frame types, %d matrix types SDIF file %s.\n", + ftable->NbOfData, mtable->NbOfData, filename); + + /* print information about the definition of the given frame and + matrices therein */ + frameinfo_from_signature(file, fsig); + SdifFClose(file); } |