00001
00002
00003
00004
00005
00006
00007
00008
00009
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
00021
00022 #include <string.h>
00023
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
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
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
00065 if (Mdes2_pool == NULL)
00066 Mdes2_pool = L_create_alloc_pool ("Mdes2", sizeof (Mdes2), 1);
00067
00068
00069 mdes2 = (Mdes2 *) L_alloc (Mdes2_pool);
00070
00071
00072 mdes2->file_name = strdup (file_name);
00073
00074
00075 mdes2->md_mdes = MD_read_md (in, file_name);
00076 fclose (in);
00077
00078 mdes2->version1_mdes = NULL;
00079
00080
00081 mdes2->sm_mdes = SM_build_mdes (mdes2);
00082
00083
00084 return (mdes2);
00085 }
00086
00087
00088