00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <assert.h>
00021 #include <stdlib.h>
00022 #include <stdio.h>
00023 #include <string.h>
00024 #include "cflow_struct.h"
00025 #include "read_tools.h"
00026 #include "read_free.h"
00027
00028
00029
00030
00031
00032
00033
00034 int scan_free(const char *line, LINE_INFO *line_info)
00035 {
00036 int pos;
00037 int lu;
00038
00039
00040 lu = sscanf(line, "%d%n",
00041 &(line_info->id), &pos);
00042 if (lu != 1)
00043 return 0;
00044
00045
00046 line = line + pos;
00047
00048
00049 line_info->depth = str_count_char(line, '\t');
00050
00051
00052 lu = sscanf(line, "%s%n",
00053 line_info->fct, &pos);
00054 if (lu != 1)
00055 return 0;
00056
00057
00058 if (strcmp(line_info->fct, "...") == 0)
00059 {
00060
00061 line = line + pos;
00062 lu = sscanf(line, "%s%n",
00063 line_info->fct, &pos);
00064 if (lu != 1)
00065 return 0;
00066 }
00067
00068
00069 line = line + pos;
00070
00071
00072 if (strstr(line,"{}") != NULL)
00073 line_info->type = EXTERNAL;
00074 else if (strstr(line,"...") != NULL)
00075 {
00076 line_info->type = REFERENCE;
00077
00078 line = strchr(line,'{');
00079 if (line == NULL)
00080 return 0;
00081 lu = sscanf(line, "{%d}", &(line_info->id));
00082 if (lu != 1)
00083 return 0;
00084 }
00085 else
00086 {
00087 line_info->type = INTERNAL;
00088 lu = sscanf(line, " {%s %d}",
00089 line_info->src, &(line_info->line_src));
00090 if (lu != 2)
00091 return 0;
00092 line_info->fct_type[0]='\0';
00093 }
00094
00095
00096 return 1;
00097 }