/*************************************************************************\ * Copyright (c) 2002 The University of Chicago, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * This file is distributed subject to a Software License Agreement found * in the file LICENSE that is included with this distribution. \*************************************************************************/ /* program: TFS2sdds * purpose: convert MAD TFS data to SDDS * * Michael Borland, 1995 $Log: TFS2sdds.c,v $ Revision 1.6 2002/08/14 17:12:35 soliday Added Open License Revision 1.5 2001/01/23 19:14:53 soliday Standardized usage message. Revision 1.4 1999/05/25 19:01:52 soliday Removed compiler warning on linux. Revision 1.3 1995/09/06 14:55:45 saunders First test release of SDDS1.5 */ #include "mdb.h" #include "scan.h" #include "SDDS.h" #include "match_string.h" #define SET_PIPE 0 #define N_OPTIONS 1 static char *option[N_OPTIONS] = { "pipe", }; char *USAGE = "TFS2sdds \n\ [-pipe[=input][,output]]\n\n\ Converts LEP TFS format files (used by MAD) to SDDS.\n\n\ Program by Michael Borland. (This is version 1, July 1995)."; #define SHORT_TYPE 0 #define LONG_TYPE 1 #define DOUBLE_TYPE 2 #define FLOAT_TYPE 3 #define STRING_TYPE 4 #define TYPENAMES 5 static char *typeName[TYPENAMES] = { "short", "long", "double", "float", "string", } ; #define SDDS_MAXLINE 1024 long identifyType(char *format); int main(int argc, char **argv) { SCANNED_ARG *scanned; long i_arg, type, inHeader; char *input, *output; unsigned long pipeFlags; FILE *fpi, *fpo; char s1[SDDS_MAXLINE], s2[SDDS_MAXLINE]; char *name, *format, *value; SDDS_RegisterProgramName(argv[0]); argc = scanargs(&scanned, argc, argv); if (argc<2) bomb(NULL, USAGE); input = output = format = value = NULL; pipeFlags = 0; for (i_arg=1; i_arg