You've already forked libadalang
mirror of
https://github.com/AdaCore/libadalang.git
synced 2026-02-12 12:28:54 -08:00
Data types in this API store analysis units directly. This means that in order to create the config pragmas mapping for a given project, all sources of that project + for the config pragmas files need to be parsed. For cases like opening a project in order to analyze only a couple of source files, this is very inefficient, both for processing time and for memory consumption. This commit reworks the data types to avoid this: store filenames instead of analysis units.
176 lines
4.4 KiB
Plaintext
176 lines
4.4 KiB
Plaintext
## vim: filetype=makocpp
|
|
|
|
<%
|
|
option_type = capi.get_name('gpr_option')
|
|
options_type = capi.get_name('gpr_options')
|
|
project_type = capi.get_name('gpr_project')
|
|
str_array_type = capi.get_name('string_array_ptr')
|
|
string_array_struct = capi.get_name('string_array_ptr_struct')
|
|
target_info_type = capi.get_name('target_information')
|
|
%>
|
|
|
|
/* Handling of string arrays */
|
|
|
|
${c_doc('libadalang.string_array')}
|
|
typedef struct {
|
|
int length;
|
|
const char**c_ptr;
|
|
} ${string_array_struct};
|
|
|
|
typedef ${string_array_struct} *${str_array_type};
|
|
|
|
${c_doc('libadalang.free_string_array')}
|
|
extern void
|
|
${capi.get_name('free_string_array')} (
|
|
${str_array_type} source_files
|
|
);
|
|
|
|
/* Project handling */
|
|
|
|
${c_doc('libadalang.gpr_options')}
|
|
typedef void *${options_type};
|
|
|
|
enum ${option_type} {
|
|
ADA_GPR_OPTION_AP = 0,
|
|
ADA_GPR_OPTION_AUTOCONF = 1,
|
|
ADA_GPR_OPTION_CONFIG = 2,
|
|
ADA_GPR_OPTION_DB = 3,
|
|
ADA_GPR_OPTION_DB_MINUS = 4,
|
|
ADA_GPR_OPTION_IMPLICIT_WITH = 5,
|
|
ADA_GPR_OPTION_RESOLVE_LINKS = 6,
|
|
ADA_GPR_OPTION_NO_PROJECT = 7,
|
|
ADA_GPR_OPTION_P = 8,
|
|
ADA_GPR_OPTION_PRINT_GPR_REGISTRY = 9,
|
|
ADA_GPR_OPTION_RELOCATE_BUILD_TREE = 10,
|
|
ADA_GPR_OPTION_ROOT_DIR = 11,
|
|
ADA_GPR_OPTION_RTS = 12,
|
|
ADA_GPR_OPTION_SRC_SUBDIRS = 13,
|
|
ADA_GPR_OPTION_SUBDIRS = 14,
|
|
ADA_GPR_OPTION_TARGET = 15,
|
|
ADA_GPR_OPTION_X = 16
|
|
};
|
|
|
|
${c_doc('libadalang.gpr_options_create')}
|
|
extern ${options_type}
|
|
${capi.get_name('gpr_options_create')} (void);
|
|
|
|
${c_doc('libadalang.gpr_options_add_switch')}
|
|
extern void
|
|
${capi.get_name('gpr_options_add_switch')} (
|
|
${options_type} options,
|
|
enum ${option_type} switch_,
|
|
const char *param,
|
|
const char *index,
|
|
int override_
|
|
);
|
|
|
|
${c_doc('libadalang.gpr_options_free')}
|
|
extern void
|
|
${capi.get_name('gpr_options_free')} (${options_type} options);
|
|
|
|
${c_doc('libadalang.gpr_project')}
|
|
typedef void *${project_type};
|
|
|
|
${c_doc('libadalang.gpr_project_load')}
|
|
extern void
|
|
${capi.get_name('gpr_project_load')}(
|
|
${options_type} options,
|
|
int ada_only,
|
|
${project_type} *project,
|
|
${str_array_type} *errors
|
|
);
|
|
|
|
${c_doc('libadalang.gpr_project_free')}
|
|
extern void
|
|
${capi.get_name('gpr_project_free')} (${project_type} self);
|
|
|
|
${c_doc('libadalang.gpr_project_create_unit_provider')}
|
|
extern ${unit_provider_type}
|
|
${capi.get_name('gpr_project_create_unit_provider')} (
|
|
${project_type} self,
|
|
const char *project
|
|
);
|
|
|
|
${c_doc('libadalang.gpr_project_source_files')}
|
|
extern ${str_array_type}
|
|
${capi.get_name('gpr_project_source_files')} (
|
|
${project_type} self,
|
|
int mode,
|
|
const char **projects_data,
|
|
int projects_length
|
|
);
|
|
|
|
${c_doc('libadalang.gpr_project_default_charset')}
|
|
extern char *
|
|
${capi.get_name('gpr_project_default_charset')} (
|
|
${project_type} self,
|
|
const char *project
|
|
);
|
|
|
|
${c_doc('libadalang.gpr_project_initialize_context')}
|
|
extern void
|
|
${capi.get_name('gpr_project_initialize_context')}(
|
|
${project_type} self,
|
|
${analysis_context_type} context,
|
|
const char *project,
|
|
${event_handler_type} event_handler,
|
|
int with_trivia,
|
|
int tab_stop
|
|
);
|
|
|
|
/* Auto unit provider */
|
|
|
|
${c_doc('libadalang.create_auto_provider')}
|
|
extern ${unit_provider_type}
|
|
${capi.get_name('create_auto_provider')}(
|
|
const char **input_files,
|
|
const char *charset
|
|
);
|
|
|
|
/* Preprocessor */
|
|
|
|
${c_doc('libadalang.create_preprocessor_from_file')}
|
|
extern ${file_reader_type}
|
|
${capi.get_name('create_preprocessor_from_file')}(
|
|
const char *filename,
|
|
const char **path_data,
|
|
int path_length,
|
|
const int *line_mode
|
|
);
|
|
|
|
${c_doc('libadalang.gpr_project_create_preprocessor')}
|
|
extern ${file_reader_type}
|
|
${capi.get_name('gpr_project_create_preprocessor')}(
|
|
${project_type} self,
|
|
const char *project,
|
|
const int *line_mode
|
|
);
|
|
|
|
/* Config pragmas */
|
|
|
|
${c_doc('libadalang.set_config_pragmas_mapping')}
|
|
extern void
|
|
${capi.get_name('set_config_pragmas_mapping')}(
|
|
${analysis_context_type} context,
|
|
const char *global_pragmas,
|
|
const char **local_pragmas
|
|
);
|
|
|
|
/* Target information */
|
|
|
|
${c_doc('libadalang.target_info_type')}
|
|
typedef void *${target_info_type};
|
|
|
|
${c_doc('libadalang.target_info_load')}
|
|
extern ${target_info_type}
|
|
${capi.get_name('target_info_load')}(const char *filename);
|
|
|
|
${c_doc('libadalang.target_info_free')}
|
|
extern void
|
|
${capi.get_name('target_info_free')}(${target_info_type} self);
|
|
|
|
${c_doc('libadalang.target_info_set')}
|
|
extern void
|
|
${capi.get_name('target_info_set')}(${analysis_context_type} self,
|
|
${target_info_type} info);
|