The CiaoPP user menu interface
Author(s): David Trallero Mena.This module defines a simplified user-level interface for CiaoPP. It complements the more expert-oriented interface defined in The CiaoPP low-level programming interface. This is also the interface called by the shortcuts available in menus and toolbars in the emacs mode.
The idea of this interface is to make it easy to perform some fundamental, prepackaged tasks, such as checking assertions in programs (i.e., types, modes, determinacy, non-failure, cost, etc.), performing optimizations such as specialization and parallelization, and performing several types of analysis of the program. The results can be observed as new or transformed assertions and predicates in a new version of the program.
In order to use CiaoPP, the user must provide two kinds of information: first, a number of preprocessing options must be set if necessary in order to configure the system; and then, the action that has to be done must be selected (analysis, assertion checking, optimization). Those options are controlled by a set of so-called flags. By default, all flags are initialized to the appropriate values in most of the cases. If the value of any of the flags has to be changed by the user, the flag must be changed before performing the corresponding action. There are two ways to change the flag values. The most usual way consists in calling customize_and_preprocess/1 from the CiaoPP top-level shell with the file name as argument. In the emacs environment this can be done most easily by clicking on the options button in the toolbar or in the CiaoPP menus. It will prompt (with help) for the value of the different options and flags.
The second way to change flag values consist in executing in the CiaoPP top-level shell a number of calls to set_menu_flag/3 with the right values, and then calling one of the following predicates:
- auto_check_assert/1 with the file name as argument to check a program.
- auto_optimize/1 with the file name as argument to optimize (transform) a program.
- auto_analyze/1 with the file name as argument to analyze a program.
In the emacs environement these actions can be performed most easily by clicking on the corresponding button in the toolbar or in the CiaoPP menus.
The customization menus can be made to show more or less detail depending on the level of expertise of the user. This can be configured in the customization menu itself.
Usage and interface
- Library usage:
:- use_module(library(auto_interface)). - Exports:
- Predicates:
auto_analyze/1, auto_optimize/1, auto_check_assert/1, auto_analyze/2, auto_optimize/2, auto_check_assert/2, customize/0, customize/1, customize_and_preprocess/0, customize_and_preprocess/1, customize_but_dont_save/1, again/0, clean_aux_files/1, select_modules/1, customize_java/1, customize_and_preprocess_java/1. - Multifiles:
hook_menu_flag_values/3, hook_menu_check_flag_value/3, hook_menu_flag_help/3, hook_menu_default_option/3.
- Predicates:
- Imports:
- Application modules:
ciaopp(driver), ciaopp(printer), ciaopp(preprocess_flags), ciaopp(p_unit(p_dump)), ciaopp(plai(fixpo_ops)), plai(acc_ops), auto_interface(optim_comp), plai(intermod), infer(infer_db), program(assrt_db), program(p_unit), program(itf_db), program(aux_filenames), infer(infer_dom). - System library modules:
menu/menu_generator, menu/menu_rt, lists, aggregates, prolog_sys, system, messages, prompt, filenames. - Internal (engine) modules:
term_basic, arithmetic, atomic_basic, basic_props, basiccontrol, data_facts, exceptions, io_aux, io_basic, prolog_flags, streams_basic, system_info, term_compare, term_typing, hiord_rt, debugger_support. - Packages:
prelude, nonpure, assertions, api(api_menu), menu/menu, argnames, fsyntax.
- Application modules:
Documentation on exports
Usage:auto_analyze(F)
Analyze the module F with the current analysis options (use customize(analyze) to change these options).
Usage:auto_optimize(F)
Optimize file F with the current options (use customize(optimize) to change these options).
Usage:auto_check_assert(F)
Check the assertions in file F, with the current options, giving errors if assertions are violated (use customize(check_assertions) to change these options).
Usage:
Enter an interactive menu to select the preprocessing action (analysis / assertion checking / transformation / optimization / ...) to be performed by deafult and the different options (i.e., setting the preprocessor flags).
Usage:customize(X)
Customize is used for changing the values of a set of flags. These flags are grouped into analyze, check assertions and optimize. X should take the values: analyze, check_assertions or optimize.
Usage:
Select options using customize/0, and then call auto_analyze/1, auto_optimize/1, or auto_check_assert/1 (as determined by the selected options) on the default file. If no default file is defined, prompt for the name of to be processed, which becomes from now on the default file.
Usage:customize_and_preprocess(File)
Select options using customize/0, and then call auto_analyze/1, auto_optimize/1, or auto_check_assert/1 (as determined by the selected options) with File as argument. File is from now on the default file.
Usage:customize_but_dont_save(Option)
Same as customize( Option ), but menu flags will not be modified.
Usage:
Performs the last actions done by customize_and_preprocess/1, on the last file previously analyzed, checked, or optimized
Usage:clean_aux_files(File)
Deletes any auxiliary file regarding File or its related files (e.g., imported modules in a modular program).
- The following properties should hold at call time:
(atom/1)File is currently instantiated to an atom.
Usage:customize_java(X)
Customize is used for change the values of a set of flags in case of java analysis. So far, the value of X is only 'all'.
Usage:customize_and_preprocess_java(File)
It is like doing customize_java(all), and then calling with File as argument.
Usage:save_menu_config(Name)
Save the current flags configuration under the Name key.
- The following properties should hold at call time:
(atm/1)Name is an atom.
Usage:remove_menu_config(Name)
Remove the configuration stored with the Name key (the same provided in save_menu_config/1).
- The following properties should hold at call time:
(atm/1)Name is an atom.
Usage:restore_menu_config(Name)
Restore the configuration saved with the Name key (the same provided in save_menu_config/1).
- The following properties should hold at call time:
(atm/1)Name is an atom.
Usage:show_menu_config(C)
Show specific configuration values pointed by C key (the same provided in save_menu_config/1).
- The following properties should hold at call time:
(atm/1)C is an atom.
Documentation on multifiles
Usage:hook_menu_flag_values(Menu,Flag,Values)
Menu hook that determines the possible Values that a Flag can have in menu Menu.
Usage:hook_menu_check_flag_value(Menu,Flag,Value)
Menu hook that checks if Value is a correct option for Flag in menu Menu.
Usage:hook_menu_flag_help(Menu,Flag,Values)
Menu hook that determines the Help text for a Flag in menu Menu.
Usage:hook_menu_default_option(Menu,Flag,DOpt)
Menu hook that determines the default option DOpt for the Flag in menu Menu.
Known bugs and planned improvements
- 1 commented out the question for error file since we are generating it in any case (not yet implemented)
- 2 when auto_cthecks has the value 'on' (instead of 'auto'), the result of compile_time checking is not fully handled yet
- needed_to_prove/3 is a weird predicate, it must be more easy to read. --EMM.