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_sun.h"
00027
00028
00029
00030
00031
00032
00033
00034 int scan_sun(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 line_info->fct[strlen(line_info->fct)-1] = '\0';
00059
00060
00061 line = line + pos;
00062
00063
00064 if (strstr(line,"<>") != NULL)
00065 line_info->type = EXTERNAL;
00066 else if (strchr(line,',') != NULL)
00067 {
00068 line_info->type = INTERNAL;
00069 lu = sscanf(line, "%[^,]%n, <%s %d>",
00070 line_info->fct_type, &pos, line_info->src, &(line_info->line_src));
00071 if (lu != 3)
00072 return 0;
00073 line_info->fct_type[pos]='\0';
00074 }
00075 else
00076 {
00077 line_info->type = REFERENCE;
00078 lu = sscanf(line, " %d", &(line_info->id));
00079 if (lu != 1)
00080 return 0;
00081 }
00082
00083
00084 return 1;
00085 }