use b_plain use cz/vars use cz/tok cz_header() grep(i, defines, vec*, **(cstr*)vec0(*i) != 'l') grep(i, includes, cstr, cstr_begins_with_word(*i, "export")) for_vec(i, extern_langs, vec*) grep(j, *i, cstr, **j != '\t' || strstr(*j, "export ")) if veclen(*i) <= 1 *i = NULL remove_null(extern_langs) # keep using_namespaces # keep enums vecclr(struct_union_class_template_protos) vecclr(struct_union_typedefs) # keep typedef # keep structs_unions_classes_templates grep(i, function_protos, cstr, !cstr_begins_with_word(*i, "local", "static")) grep(i, var_protos, cstr, !cstr_begins_with_word(*i, "local", "static")) for_vec(i, local_and_global_vars, vec*) cstr l = *(cstr*)vec0(*i) if !cstr_begins_with_word(l, "local", "static") vec_push(var_protos, fformat("extern %s", l)) vecclr(local_and_global_vars) vecclr(var_assignments) vecclr(functions)