%------------------------------------------------------------------------------% % Copyright (C) 1999 INRIA/INSA. --- /soft/eclipse/eclipse4.1/lib_pd/opium_light/translate.op Sat Feb 20 16:09:16 1999 +++ translate.op Thu Nov 4 09:03:37 1999 @@ -20,13 +20,13 @@ translate_file_i(Scenario, SrcFile, Load, AutoLoad, SrcDir, Mod), close(Load), close(AutoLoad), - opium_printf(output, "%w is translated\n", [SrcFile]), + printf(output, "%w is translated\n", [SrcFile]), !. translate_file(Scenario, SrcFile, LoadFile, AutoLoadFile, SrcDir, _) :- - opium_printf(output, "could not translate %w\n", [SrcFile]). + printf(output, "could not translate %w\n", [SrcFile]). translate_file_i(Scenario, SrcFile, Load, Autoload, SrcDir, Mod) :- - opium_printf(output, "translating %w\n", [SrcFile]), + printf(output, "translating %w\n", [SrcFile]), build_load(Scenario, SrcFile, Load, Autoload, SrcDir, Mod). /* @@ -62,7 +62,7 @@ exists(File), !. existing(File) :- - opium_printf(error, "file %w does not exist\n", [File]), + printf(error, "file %w does not exist\n", [File]), fail. @@ -293,7 +293,7 @@ ( is_opium_declaration(Pred/_), !, X =.. [_ | [name:Name | _]], - opium_printf(error, "%w %w not properly declared\n", [Pred, Name]) + printf(error, "%w %w not properly declared\n", [Pred, Name]) ; true ). @@ -302,7 +302,7 @@ ( is_opium_declaration(Pred/_), !, X =.. [_ | [name:Name | _]], - opium_printf(error, "%w %w not properly declared\n", [Pred, Name]) + printf(error, "%w %w not properly declared\n", [Pred, Name]) ; true ). @@ -324,7 +324,7 @@ * trace : requires an execution, produces trace line * tool : tool wrt Sepia's module system (requires current module) * - * Checking of argument types and print_line are added if required, + * Checking of argument types and print_event are added if required, * primitives are generated automatically. */ build_cmd(Load, Autoload, Name, ArgList, TypeList, Abbrev, CommandType, Procedure, Scenario, Clause) :- @@ -351,7 +351,7 @@ build_cmd_int(trace, Load, Autoload, Name, [], [], Abbrev, Impl, Scenario) :- !, concat_atom([Name, '_np'], Name_np), - build_tracing_command(Load, Name, Name_np), + opium_assert(Load, (Name :- Name_np, print_event)), build_related_primitives(trace, Load, Name, Name_np, Impl, [], [], Abbrev, Scenario), build_autoload_info(Autoload, Name, Name, Scenario), build_abbrev(Load, Autoload, Name, [], Abbrev, Scenario). @@ -360,7 +360,12 @@ Cmd1 =.. [Name | ArgList], concat_atom([Name, '_np'], Name_np), name_variables(ArgList, ArgNameList), - build_tracing_command_with_arguments(Load, Cmd1, ArgList, ArgNameList, TypeList, Name_np), + opium_assert(Load, + (Cmd1 :- + check_arg_type(ArgList, ArgNameList, TypeList, NewList), + Cmd2 =.. [Name_np | NewList], + Cmd2, + print_event)), build_related_primitives(trace, Load, Name, Name_np, Impl, ArgList, TypeList, Abbrev, Scenario), build_autoload_info(Autoload, Cmd1, Name, Scenario), build_abbrev(Load, Autoload, Name, ArgList, Abbrev, Scenario). @@ -391,16 +396,6 @@ build_autoload_info(Autoload, Cmd, Name, Scenario), build_tool_abbrev(Load, Autoload, BodyName/BodyArity, Abbrev/Arity, ArgList, Scenario). -build_tracing_command(Load, Name, Name_np) :- - opium_assert(Load, (Name :- Name_np, print_line)). - -build_tracing_command_with_arguments(Load, Cmd1, ArgList, ArgNameList, TypeList, Name_np) :- - opium_assert(Load, - (Cmd1 :- - check_arg_type(ArgList, ArgNameList, TypeList, NewList), - Cmd2 =.. [Name_np | NewList], - Cmd2, - print_line)). /* * build_abbrev/6 @@ -509,7 +504,7 @@ opium_assert(Load, (Name :- Condition, - opium_printf(help, "\n%w\n\n%w\n\n", [Goal, Message]), + printf(help, "\n%w\n\n%w\n\n", [Goal, Message]), execute_demo_goal(Goal) )), opium_assert(Load, :- load_decl(Clause)). @@ -556,7 +551,7 @@ is_list_of_atoms_or_empty_list(NeededScenarios), ! ; - opium_printf(error, "scenario %w is not properly declared\n", [Name]), + printf(error, "scenario %w is not properly declared\n", [Name]), fail ). check_declaration(command, @@ -583,7 +578,7 @@ is_list(ParameterList), ! ; - opium_printf(error, "command %w is not properly declared\n", [Name]), + printf(error, "command %w is not properly declared\n", [Name]), fail ). check_declaration(procedure, @@ -601,7 +596,7 @@ is_list(ParameterList), ! ; - opium_printf(error, "procedure %w is not properly declared\n", [Name]), + printf(error, "procedure %w is not properly declared\n", [Name]), fail ). check_declaration(primitive, @@ -622,7 +617,7 @@ atom(Procedure), ! ; - opium_printf(error, "primitive %w is not properly declared\n", [Name]), + printf(error, "primitive %w is not properly declared\n", [Name]), fail ). check_declaration(type, @@ -636,7 +631,7 @@ atom(Procedure), ! ; - opium_printf(error, "type %w is not properly declared\n", [Name]), + printf(error, "type %w is not properly declared\n", [Name]), fail ). check_declaration(demo, @@ -650,7 +645,7 @@ ( atom(Name), ! ; - opium_printf(error, "demo %w is not properly declared\n", [Name]), + printf(error, "demo %w is not properly declared\n", [Name]), fail ). @@ -675,14 +670,14 @@ member(ParType, [c, single, multiple]), ! ; - opium_printf(error, "parameter %w is not properly declared\n", [Name]), + printf(error, "parameter %w is not properly declared\n", [Name]), fail ). default_args_correct(Name, ArgTypeList, DefaultArg, Mod) :- var(DefaultArg), !, - opium_printf(error, "default of parameter %w must not be a variable\n", [Name]), + printf(error, "default of parameter %w must not be a variable\n", [Name]), fail. default_args_correct(Name, ArgTypeList, nodefault, Mod) :- !. @@ -690,7 +685,7 @@ is_list(DefaultArg), !. default_args_correct(Name, ArgTypeList, DefaultArg, Mod) :- - opium_printf(error, "default values of parameter %w have to be in a list\n", [Name]), + printf(error, "default values of parameter %w have to be in a list\n", [Name]), fail.