/* Prepare to read input from the files listed in argv. */
void d_init(int argc, char *argv[])
{
   d_argc = argc;
   d_argv = argv;
   d_file_num = 0;
   d_close_input();
}
예제 #2
0
static void load_prototypes(const char *filename)
{
    dstr line;
    const char *name;
    const char *newtext;
    const char *file_name;
    const char *line_number;
    dstr text;

    d_open_input(filename);

    while (d_getline(line)) {
        if (d_match(line, "([^:]*): ([^:]*):([^:]*):([^:]*)")) {
            name = d_submatch(1);
            newtext = d_submatch(2);
            file_name = d_submatch(3);
            line_number = d_submatch(4);

            d_assign(text, lookup_prototype(name));
            strcat(text, "\n");
            strcat(text, newtext);
            protos = aa_insert(protos, name, text);

            d_assign(text, lookup_source(name));
            if (strlen(text) == 0) {
                strcat(text, "https://github.com/liballeg/allegro5/blob/5.1/");
                strcat(text, file_name);
                strcat(text, "#L");
                strcat(text, line_number);
                sources = aa_insert(sources, name, text);
            }
        }
    }

    d_close_input();
}