Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

mdes2.c

Go to the documentation of this file.
00001 /*****************************************************************************\
00002  *      File:   mdes2.c
00003  *      Author: John C. Gyllenhaal
00004  *      Creation Date:  April 1996
00005  *      Copyright (c) 1996 John C. Gyllenhaal, Wen-mei Hwu and
00006  *                         The Board of Trustees of the University of Illinois.
00007  *                         All rights reserved.
00008  *      The University of Illinois software License Agreement
00009  *      specifies the terms and conditions for redistribution.
00010 \*****************************************************************************/
00011 
00012 #ifndef lint
00013 #define lint
00014 static char copyright[] =
00015 "@(#) Copyright (c) 1996 John C. Gyllenhaal, Wen-mei Hwu and The Board of \n\
00016  Trustees of the University of Illinois. All rights reserved.\n";
00017 #endif
00018 
00019 #include <stdio.h>
00020 // wah 3/19/98 Changed strings.h to string.h
00021 //#include <strings.h>
00022 #include <string.h>
00023 //#include <Lcode/l_main.h>
00024 #include "l_alloc_new.h"
00025 #include "lmdes.h"
00026 #include "mdes2.h"
00027 #include "mdes2.h"
00028 #include "l_punt.h"
00029 
00030 static L_Alloc_Pool *Mdes2_pool = NULL;
00031 
00032 
00033 
00034 Mdes2 *load_mdes2 (char *file_name)
00035 {
00036     Mdes2 *mdes2;
00037     FILE *in, *version1_in;
00038     char *version1_name;
00039     int name_len;
00040     int i;
00041 
00042     /* For now, make sure ends with .lmdes2 */
00043     name_len = strlen (file_name);
00044     if ((name_len < 7) ||
00045         (file_name[name_len -7] != '.') ||
00046         (file_name[name_len -6] != 'l') ||
00047         (file_name[name_len -5] != 'm') ||
00048         (file_name[name_len -4] != 'd') ||
00049         (file_name[name_len -3] != 'e') ||
00050         (file_name[name_len -2] != 's') ||
00051         (file_name[name_len -1] != '2'))
00052     {
00053         L_punt ("load_mdes2: '%s' must currently end with .lmdes2",
00054                 file_name);
00055     }
00056 
00057     /* Open the file for reading */
00058     if ((in = fopen (file_name, "r")) == NULL)
00059     {
00060         L_punt ("load_mdes2: Unable to open mdes2 file '%s' for reading.",
00061                 file_name);
00062     }
00063     
00064     /* Initialize mdes2 alloc pool if necessary */
00065     if (Mdes2_pool == NULL)
00066         Mdes2_pool = L_create_alloc_pool ("Mdes2", sizeof (Mdes2), 1);
00067 
00068     /* Allocate the mdes2 structure */
00069     mdes2 = (Mdes2 *) L_alloc (Mdes2_pool);
00070 
00071     /* Get a copy of the file name */
00072     mdes2->file_name = strdup (file_name);
00073 
00074     /* Read the md version of the machine description */
00075     mdes2->md_mdes = MD_read_md (in, file_name);
00076     fclose (in);
00077 
00078     mdes2->version1_mdes = NULL;
00079 
00080     /* Create the schedule manager version of the mdes */
00081     mdes2->sm_mdes = SM_build_mdes (mdes2);
00082     
00083     /* Return the newly created mdes2 structure */
00084     return (mdes2);
00085 }
00086 
00087 
00088 

Generated on Mon Jul 21 20:28:03 2003 for TINKER LEGO DOC by doxygen 1.3.2